ozzmotik

Untitled

Aug 17th, 2018
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2. (window.webpackJsonp = window.webpackJsonp || []).push([["vendors~Chat~RedesignChat"], {
  3.   "./node_modules/agentkeepalive/browser.js" : function(mixin, doPost) {
  4.     /**
  5.      * @return {undefined}
  6.      */
  7.     function storeMixin() {
  8.     }
  9.     /** @type {function(): undefined} */
  10.     mixin.exports = storeMixin;
  11.     /** @type {function(): undefined} */
  12.     mixin.exports.HttpsAgent = storeMixin;
  13.   },
  14.   "./node_modules/form-data/lib/browser.js" : function(mixin, doPost) {
  15.     mixin.exports = "object" == typeof self ? self.FormData : window.FormData;
  16.   },
  17.   "./node_modules/lodash/_arrayAggregator.js" : function(mixin, doPost) {
  18.     /**
  19.      * @param {string} o
  20.      * @param {?} h
  21.      * @param {?} t
  22.      * @param {?} c
  23.      * @return {?}
  24.      */
  25.     mixin.exports = function(o, h, t, c) {
  26.       /** @type {number} */
  27.       var x = -1;
  28.       var end = null == o ? 0 : o.length;
  29.       for (; ++x < end;) {
  30.         var i = o[x];
  31.         h(c, i, t(i), o);
  32.       }
  33.       return c;
  34.     };
  35.   },
  36.   "./node_modules/lodash/_arrayIncludesWith.js" : function(mixin, doPost) {
  37.     /**
  38.      * @param {string} o
  39.      * @param {?} value
  40.      * @param {?} process
  41.      * @return {?}
  42.      */
  43.     mixin.exports = function(o, value, process) {
  44.       /** @type {number} */
  45.       var k = -1;
  46.       var kl = null == o ? 0 : o.length;
  47.       for (; ++k < kl;) {
  48.         if (process(value, o[k])) {
  49.           return true;
  50.         }
  51.       }
  52.       return false;
  53.     };
  54.   },
  55.   "./node_modules/lodash/_baseAggregator.js" : function(moduleDef, opts, validateCallback) {
  56.     var callback = validateCallback("./node_modules/lodash/_baseEach.js");
  57.     /**
  58.      * @param {?} obj
  59.      * @param {?} h
  60.      * @param {?} t
  61.      * @param {?} value
  62.      * @return {?}
  63.      */
  64.     moduleDef.exports = function(obj, h, t, value) {
  65.       return callback(obj, function(label, s, e) {
  66.         h(value, label, t(label), e);
  67.       }), value;
  68.     };
  69.   },
  70.   "./node_modules/lodash/_baseDelay.js" : function(mixin, doPost) {
  71.     /** @type {string} */
  72.     var ERR_ACCESSORS_NOT_SUPPORTED = "Expected a function";
  73.     /**
  74.      * @param {!Function} a
  75.      * @param {?} n
  76.      * @param {?} s
  77.      * @return {?}
  78.      */
  79.     mixin.exports = function(a, n, s) {
  80.       if ("function" != typeof a) {
  81.         throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
  82.       }
  83.       return setTimeout(function() {
  84.         a.apply(void 0, s);
  85.       }, n);
  86.     };
  87.   },
  88.   "./node_modules/lodash/_baseDifference.js" : function(blob, id, require) {
  89.     var User = require("./node_modules/lodash/_SetCache.js");
  90.     var fn = require("./node_modules/lodash/_arrayIncludes.js");
  91.     var sh = require("./node_modules/lodash/_arrayIncludesWith.js");
  92.     var callback = require("./node_modules/lodash/_arrayMap.js");
  93.     var $ = require("./node_modules/lodash/_baseUnary.js");
  94.     var max = require("./node_modules/lodash/_cacheHas.js");
  95.     /** @type {number} */
  96.     var requiredLength = 200;
  97.     /**
  98.      * @param {!NodeList} e
  99.      * @param {?} value
  100.      * @param {string} d
  101.      * @param {string} key
  102.      * @return {?}
  103.      */
  104.     blob.exports = function(e, value, d, key) {
  105.       /** @type {number} */
  106.       var s = -1;
  107.       var h = fn;
  108.       /** @type {boolean} */
  109.       var honorSkips = true;
  110.       var p = e.length;
  111.       /** @type {!Array} */
  112.       var dimsWithHiers = [];
  113.       var calls = value.length;
  114.       if (!p) {
  115.         return dimsWithHiers;
  116.       }
  117.       if (d) {
  118.         value = callback(value, $(d));
  119.       }
  120.       if (key) {
  121.         h = sh;
  122.         /** @type {boolean} */
  123.         honorSkips = false;
  124.       } else {
  125.         if (value.length >= requiredLength) {
  126.           h = max;
  127.           /** @type {boolean} */
  128.           honorSkips = false;
  129.           value = new User(value);
  130.         }
  131.       }
  132.       e: for (; ++s < p;) {
  133.         var f = e[s];
  134.         var x = null == d ? f : d(f);
  135.         if (f = key || 0 !== f ? f : 0, honorSkips && x == x) {
  136.           var i = calls;
  137.           for (; i--;) {
  138.             if (value[i] === x) {
  139.               continue e;
  140.             }
  141.           }
  142.           dimsWithHiers.push(f);
  143.         } else {
  144.           if (!h(value, x, key)) {
  145.             dimsWithHiers.push(f);
  146.           }
  147.         }
  148.       }
  149.       return dimsWithHiers;
  150.     };
  151.   },
  152.   "./node_modules/lodash/_baseOrderBy.js" : function(blob, id, require) {
  153.     var max = require("./node_modules/lodash/_arrayMap.js");
  154.     var saturation = require("./node_modules/lodash/_baseIteratee.js");
  155.     var karmaConfigModule = require("./node_modules/lodash/_baseMap.js");
  156.     var sparqlQuery = require("./node_modules/lodash/_baseSortBy.js");
  157.     var min = require("./node_modules/lodash/_baseUnary.js");
  158.     var nest = require("./node_modules/lodash/_compareMultiple.js");
  159.     var layer = require("./node_modules/lodash/identity.js");
  160.     /**
  161.      * @param {?} config
  162.      * @param {string} value
  163.      * @param {?} data
  164.      * @return {?}
  165.      */
  166.     blob.exports = function(config, value, data) {
  167.       /** @type {number} */
  168.       var index = -1;
  169.       value = max(value.length ? value : [layer], min(saturation));
  170.       var aconf = karmaConfigModule(config, function(appid, canCreateDiscussions, isSlidingUp) {
  171.         return {
  172.           criteria : max(value, function(t) {
  173.             return t(appid);
  174.           }),
  175.           index : ++index,
  176.           value : appid
  177.         };
  178.       });
  179.       return sparqlQuery(aconf, function(results, elem) {
  180.         return nest(results, elem, data);
  181.       });
  182.     };
  183.   },
  184.   "./node_modules/lodash/_baseReduce.js" : function(mixin, doPost) {
  185.     /**
  186.      * @param {?} names
  187.      * @param {?} callback
  188.      * @param {?} accumulator
  189.      * @param {number} initAccum
  190.      * @param {?} req
  191.      * @return {?}
  192.      */
  193.     mixin.exports = function(names, callback, accumulator, initAccum, req) {
  194.       return req(names, function(value, index, collection) {
  195.         accumulator = initAccum ? (initAccum = false, value) : callback(accumulator, value, index, collection);
  196.       }), accumulator;
  197.     };
  198.   },
  199.   "./node_modules/lodash/_baseSortBy.js" : function(mixin, doPost) {
  200.     /**
  201.      * @param {?} array
  202.      * @param {?} sortFn
  203.      * @return {?}
  204.      */
  205.     mixin.exports = function(array, sortFn) {
  206.       var i = array.length;
  207.       array.sort(sortFn);
  208.       for (; i--;) {
  209.         array[i] = array[i].value;
  210.       }
  211.       return array;
  212.     };
  213.   },
  214.   "./node_modules/lodash/_baseUniq.js" : function(blob, id, require) {
  215.     var ElementCreator = require("./node_modules/lodash/_SetCache.js");
  216.     var DateTime = require("./node_modules/lodash/_arrayIncludes.js");
  217.     var diff = require("./node_modules/lodash/_arrayIncludesWith.js");
  218.     var a2 = require("./node_modules/lodash/_cacheHas.js");
  219.     var resolve = require("./node_modules/lodash/_createSet.js");
  220.     var error = require("./node_modules/lodash/_setToArray.js");
  221.     /** @type {number} */
  222.     var maxNodes = 200;
  223.     /**
  224.      * @param {!NodeList} data
  225.      * @param {boolean} err
  226.      * @param {string} r
  227.      * @return {?}
  228.      */
  229.     blob.exports = function(data, err, r) {
  230.       /** @type {number} */
  231.       var n = -1;
  232.       var d = DateTime;
  233.       var nodeCount = data.length;
  234.       /** @type {boolean} */
  235.       var nodes = true;
  236.       /** @type {!Array} */
  237.       var body = [];
  238.       /** @type {!Array} */
  239.       var result = body;
  240.       if (r) {
  241.         /** @type {boolean} */
  242.         nodes = false;
  243.         d = diff;
  244.       } else {
  245.         if (nodeCount >= maxNodes) {
  246.           var statusCode = err ? null : resolve(data);
  247.           if (statusCode) {
  248.             return error(statusCode);
  249.           }
  250.           /** @type {boolean} */
  251.           nodes = false;
  252.           d = a2;
  253.           result = new ElementCreator;
  254.         } else {
  255.           /** @type {!Array} */
  256.           result = err ? [] : body;
  257.         }
  258.       }
  259.       e: for (; ++n < nodeCount;) {
  260.         var id = data[n];
  261.         var key = err ? err(id) : id;
  262.         if (id = r || 0 !== id ? id : 0, nodes && key == key) {
  263.           var index = result.length;
  264.           for (; index--;) {
  265.             if (result[index] === key) {
  266.               continue e;
  267.             }
  268.           }
  269.           if (err) {
  270.             result.push(key);
  271.           }
  272.           body.push(id);
  273.         } else {
  274.           if (!d(result, key, r)) {
  275.             if (result !== body) {
  276.               result.push(key);
  277.             }
  278.             body.push(id);
  279.           }
  280.         }
  281.       }
  282.       return body;
  283.     };
  284.   },
  285.   "./node_modules/lodash/_compareAscending.js" : function(blob, type, exclude) {
  286.     var extend = exclude("./node_modules/lodash/isSymbol.js");
  287.     /**
  288.      * @param {number} obj
  289.      * @param {number} value
  290.      * @return {?}
  291.      */
  292.     blob.exports = function(obj, value) {
  293.       if (obj !== value) {
  294.         /** @type {boolean} */
  295.         var t = void 0 !== obj;
  296.         /** @type {boolean} */
  297.         var reverseIsSingle = null === obj;
  298.         /** @type {boolean} */
  299.         var xy = obj == obj;
  300.         var props = extend(obj);
  301.         /** @type {boolean} */
  302.         var reverseValue = void 0 !== value;
  303.         /** @type {boolean} */
  304.         var isTranslucent = null === value;
  305.         /** @type {boolean} */
  306.         var fallback = value == value;
  307.         var f = extend(value);
  308.         if (!isTranslucent && !f && !props && obj > value || props && reverseValue && fallback && !isTranslucent && !f || reverseIsSingle && reverseValue && fallback || !t && fallback || !xy) {
  309.           return 1;
  310.         }
  311.         if (!reverseIsSingle && !props && !f && obj < value || f && t && xy && !reverseIsSingle && !props || isTranslucent && t && xy || !reverseValue && xy || !fallback) {
  312.           return -1;
  313.         }
  314.       }
  315.       return 0;
  316.     };
  317.   },
  318.   "./node_modules/lodash/_compareMultiple.js" : function(blob, options, seriesStackIndexCallback) {
  319.     var compareFunction = seriesStackIndexCallback("./node_modules/lodash/_compareAscending.js");
  320.     /**
  321.      * @param {!Object} left
  322.      * @param {!Object} right
  323.      * @param {!NodeList} result
  324.      * @return {?}
  325.      */
  326.     blob.exports = function(left, right, result) {
  327.       /** @type {number} */
  328.       var i = -1;
  329.       var a = left.criteria;
  330.       var b = right.criteria;
  331.       var l = a.length;
  332.       var goal = result.length;
  333.       for (; ++i < l;) {
  334.         var WBP_EOT = compareFunction(a[i], b[i]);
  335.         if (WBP_EOT) {
  336.           return i >= goal ? WBP_EOT : WBP_EOT * ("desc" == result[i] ? -1 : 1);
  337.         }
  338.       }
  339.       return left.index - right.index;
  340.     };
  341.   },
  342.   "./node_modules/lodash/_createAggregator.js" : function(blob, id, require) {
  343.     var b = require("./node_modules/lodash/_arrayAggregator.js");
  344.     var forIn = require("./node_modules/lodash/_baseAggregator.js");
  345.     var f = require("./node_modules/lodash/_baseIteratee.js");
  346.     var isArray = require("./node_modules/lodash/isArray.js");
  347.     /**
  348.      * @param {?} query
  349.      * @param {boolean} select
  350.      * @return {?}
  351.      */
  352.     blob.exports = function(query, select) {
  353.       return function(a, val) {
  354.         var merge = isArray(a) ? b : forIn;
  355.         var start = select ? select() : {};
  356.         return merge(a, query, f(val, 2), start);
  357.       };
  358.     };
  359.   },
  360.   "./node_modules/lodash/_createSet.js" : function(module, exports, __webpack_require__) {
  361.     var Date = __webpack_require__("./node_modules/lodash/_Set.js");
  362.     var _bling = __webpack_require__("./node_modules/lodash/noop.js");
  363.     var isSameMinute = __webpack_require__("./node_modules/lodash/_setToArray.js");
  364.     var storeMixin = Date && 1 / isSameMinute(new Date([, -0]))[1] == 1 / 0 ? function(expiredTo) {
  365.       return new Date(expiredTo);
  366.     } : _bling;
  367.     module.exports = storeMixin;
  368.   },
  369.   "./node_modules/lodash/_iteratorToArray.js" : function(mixin, doPost) {
  370.     /**
  371.      * @param {!Node} e
  372.      * @return {?}
  373.      */
  374.     mixin.exports = function(e) {
  375.       var _s;
  376.       /** @type {!Array} */
  377.       var _arr = [];
  378.       for (; !(_s = e.next()).done;) {
  379.         _arr.push(_s.value);
  380.       }
  381.       return _arr;
  382.     };
  383.   },
  384.   "./node_modules/lodash/chunk.js" : function(blob, callback, jQuery) {
  385.     var set = jQuery("./node_modules/lodash/_baseSlice.js");
  386.     var next = jQuery("./node_modules/lodash/_isIterateeCall.js");
  387.     var map = jQuery("./node_modules/lodash/toInteger.js");
  388.     /** @type {function(?): number} */
  389.     var nativeCeil = Math.ceil;
  390.     /** @type {function(...?): number} */
  391.     var max = Math.max;
  392.     /**
  393.      * @param {string} name
  394.      * @param {number} size
  395.      * @param {boolean} err
  396.      * @return {?}
  397.      */
  398.     blob.exports = function(name, size, err) {
  399.       /** @type {number} */
  400.       size = (err ? next(name, size, err) : void 0 === size) ? 1 : max(map(size), 0);
  401.       var length = null == name ? 0 : name.length;
  402.       if (!length || size < 1) {
  403.         return [];
  404.       }
  405.       /** @type {number} */
  406.       var value = 0;
  407.       /** @type {number} */
  408.       var off = 0;
  409.       /** @type {!Array} */
  410.       var data = Array(nativeCeil(length / size));
  411.       for (; value < length;) {
  412.         data[off++] = set(name, value, value = value + size);
  413.       }
  414.       return data;
  415.     };
  416.   },
  417.   "./node_modules/lodash/defer.js" : function(module, metadata, packageSuccess) {
  418.     var isCommercial = packageSuccess("./node_modules/lodash/_baseDelay.js");
  419.     var storeMixin = packageSuccess("./node_modules/lodash/_baseRest.js")(function(tile, leftFence) {
  420.       return isCommercial(tile, 1, leftFence);
  421.     });
  422.     module.exports = storeMixin;
  423.   },
  424.   "./node_modules/lodash/difference.js" : function(mixin, doPost, __webpack_require__) {
  425.     var normalise = __webpack_require__("./node_modules/lodash/_baseDifference.js");
  426.     var parse = __webpack_require__("./node_modules/lodash/_baseFlatten.js");
  427.     var createBracketMap = __webpack_require__("./node_modules/lodash/_baseRest.js");
  428.     var isArray = __webpack_require__("./node_modules/lodash/isArrayLikeObject.js");
  429.     var m = createBracketMap(function(e, argvString) {
  430.       return isArray(e) ? normalise(e, parse(argvString, 1, isArray, true)) : [];
  431.     });
  432.     mixin.exports = m;
  433.   },
  434.   "./node_modules/lodash/first.js" : function(module, object, instantiate) {
  435.     module.exports = instantiate("./node_modules/lodash/head.js");
  436.   },
  437.   "./node_modules/lodash/head.js" : function(mixin, doPost) {
  438.     /**
  439.      * @param {!Array} value
  440.      * @return {?}
  441.      */
  442.     mixin.exports = function(value) {
  443.       return value && value.length ? value[0] : void 0;
  444.     };
  445.   },
  446.   "./node_modules/lodash/keyBy.js" : function(module, metadata, packageSuccess) {
  447.     var updateSiteUsage = packageSuccess("./node_modules/lodash/_baseAssignValue.js");
  448.     var storeMixin = packageSuccess("./node_modules/lodash/_createAggregator.js")(function(siteData, leftFence, size) {
  449.       updateSiteUsage(siteData, size, leftFence);
  450.     });
  451.     module.exports = storeMixin;
  452.   },
  453.   "./node_modules/lodash/reduce.js" : function(blob, id, require) {
  454.     var str = require("./node_modules/lodash/_arrayReduce.js");
  455.     var CheckDailyStat = require("./node_modules/lodash/_baseEach.js");
  456.     var $ = require("./node_modules/lodash/_baseIteratee.js");
  457.     var model = require("./node_modules/lodash/_baseReduce.js");
  458.     var isArray = require("./node_modules/lodash/isArray.js");
  459.     /**
  460.      * @param {?} val
  461.      * @param {?} el
  462.      * @param {?} data
  463.      * @return {?}
  464.      */
  465.     blob.exports = function(val, el, data) {
  466.       var value = isArray(val) ? str : model;
  467.       /** @type {boolean} */
  468.       var transformValue = arguments.length < 3;
  469.       return value(val, $(el, 4), data, transformValue, CheckDailyStat);
  470.     };
  471.   },
  472.   "./node_modules/lodash/sortBy.js" : function(mixin, data, filter) {
  473.     var even = filter("./node_modules/lodash/_baseFlatten.js");
  474.     var fn = filter("./node_modules/lodash/_baseOrderBy.js");
  475.     var isMatch = filter("./node_modules/lodash/_baseRest.js");
  476.     var drawCorners = filter("./node_modules/lodash/_isIterateeCall.js");
  477.     var m = isMatch(function(params, n) {
  478.       if (null == params) {
  479.         return [];
  480.       }
  481.       var argl = n.length;
  482.       return argl > 1 && drawCorners(params, n[0], n[1]) ? n = [] : argl > 2 && drawCorners(n[0], n[1], n[2]) && (n = [n[0]]), fn(params, even(n, 1), []);
  483.     });
  484.     mixin.exports = m;
  485.   },
  486.   "./node_modules/lodash/toArray.js" : function(blob, id, require) {
  487.     var component = require("./node_modules/lodash/_Symbol.js");
  488.     var extend = require("./node_modules/lodash/_copyArray.js");
  489.     var toInteger = require("./node_modules/lodash/_getTag.js");
  490.     var sphereKnn = require("./node_modules/lodash/isArrayLike.js");
  491.     var isArray = require("./node_modules/lodash/isString.js");
  492.     var sparqlQuery = require("./node_modules/lodash/_iteratorToArray.js");
  493.     var type = require("./node_modules/lodash/_mapToArray.js");
  494.     var x_rbtn_last = require("./node_modules/lodash/_setToArray.js");
  495.     var flatten = require("./node_modules/lodash/_stringToArray.js");
  496.     var x_rbtn_item = require("./node_modules/lodash/values.js");
  497.     /** @type {string} */
  498.     var color = "[object Map]";
  499.     /** @type {string} */
  500.     var last = "[object Set]";
  501.     var iteratorSymbol = component ? component.iterator : void 0;
  502.     /**
  503.      * @param {?} value
  504.      * @return {?}
  505.      */
  506.     blob.exports = function(value) {
  507.       if (!value) {
  508.         return [];
  509.       }
  510.       if (sphereKnn(value)) {
  511.         return isArray(value) ? flatten(value) : extend(value);
  512.       }
  513.       if (iteratorSymbol && value[iteratorSymbol]) {
  514.         return sparqlQuery(value[iteratorSymbol]());
  515.       }
  516.       var i = toInteger(value);
  517.       return (i == color ? type : i == last ? x_rbtn_last : x_rbtn_item)(value);
  518.     };
  519.   },
  520.   "./node_modules/lodash/uniq.js" : function(moduleDef, fn, after) {
  521.     var cb = after("./node_modules/lodash/_baseUniq.js");
  522.     /**
  523.      * @param {!Array} data
  524.      * @return {?}
  525.      */
  526.     moduleDef.exports = function(data) {
  527.       return data && data.length ? cb(data) : [];
  528.     };
  529.   },
  530.   "./node_modules/lodash/uniqBy.js" : function(moduleDef, opts, require) {
  531.     var render = require("./node_modules/lodash/_baseIteratee.js");
  532.     var cb = require("./node_modules/lodash/_baseUniq.js");
  533.     /**
  534.      * @param {!Array} data
  535.      * @param {?} outFile
  536.      * @return {?}
  537.      */
  538.     moduleDef.exports = function(data, outFile) {
  539.       return data && data.length ? cb(data, render(outFile, 2)) : [];
  540.     };
  541.   },
  542.   "./node_modules/sendbird/SendBird.min.js" : function(blob, id, require) {
  543.     if ("undefined" != typeof self) {
  544.       self;
  545.     }
  546.     blob.exports = function() {
  547.       /**
  548.        * @return {undefined}
  549.        */
  550.       function FormData() {
  551.         /** @type {boolean} */
  552.         this.oldIE = true;
  553.         /** @type {string} */
  554.         this.boundary = "--------FormData" + Math.random();
  555.         /** @type {!Array} */
  556.         this._fields = [];
  557.       }
  558.       var console;
  559.       /** @type {boolean} */
  560.       var t = false;
  561.       /** @type {string} */
  562.       var ref1 = "wss://ws.sendbird.com";
  563.       /** @type {string} */
  564.       var combined = "https://api.sendbird.com";
  565.       try {
  566.         /** @type {!Console} */
  567.         console = window.console || {
  568.           log : function() {
  569.           }
  570.         };
  571.       } catch (e) {
  572.         console = {
  573.           log : function() {
  574.           }
  575.         };
  576.       }
  577.       /** @type {string} */
  578.       var i = "undefined";
  579.       try {
  580.         /** @type {string} */
  581.         i = navigator.userAgent.replace(/,/g, ".");
  582.       } catch (e) {
  583.         /** @type {string} */
  584.         i = "undefined";
  585.       }
  586.       var Model;
  587.       /** @type {string} */
  588.       var spec = "JS," + i + ",3.0.69,";
  589.       var b = function() {
  590.         try {
  591.           if (document && 9 === document.documentMode) {
  592.             return true;
  593.           }
  594.         } catch (e) {
  595.           return false;
  596.         }
  597.         return false;
  598.       }();
  599.       var c = function() {
  600.         try {
  601.           if (document && document.documentMode <= 8) {
  602.             return true;
  603.           }
  604.         } catch (e) {
  605.           return false;
  606.         }
  607.         return false;
  608.       }();
  609.       if (b || c) {
  610.         if ("function" != typeof String.prototype.trim) {
  611.           /**
  612.            * @return {string}
  613.            * @this {!String}
  614.            */
  615.           String.prototype.trim = function() {
  616.             return this.replace(/^\s+|\s+$/g, "");
  617.           };
  618.         }
  619.         if ("function" != typeof Array.prototype.forEach) {
  620.           /**
  621.            * @param {(function(this:S, T, number, !Array<T>): ?|null)} callback
  622.            * @param {(S|null)=} p1
  623.            * @return {undefined}
  624.            * @template T,S
  625.            */
  626.           Array.prototype.forEach = function(callback) {
  627.             /** @type {number} */
  628.             var i = 0;
  629.             for (; i < this.length; i++) {
  630.               callback.apply(this, [this[i], i, this]);
  631.             }
  632.           };
  633.         }
  634.         /**
  635.          * @param {string} key
  636.          * @param {!Object} value
  637.          * @return {undefined}
  638.          */
  639.         FormData.prototype.append = function(key, value) {
  640.           this._fields.push([key, value]);
  641.         };
  642.         /**
  643.          * @return {?}
  644.          */
  645.         FormData.prototype.toString = function() {
  646.           var boundary = this.boundary;
  647.           /** @type {string} */
  648.           var body = "";
  649.           return this._fields.forEach(function(running) {
  650.             if (body = body + ("--" + boundary + "\r\n"), running[1].name) {
  651.               var storage = running[1];
  652.               /** @type {string} */
  653.               body = body + ('Content-Disposition: form-data; name="' + running[0] + '"; filename="' + storage.name + '"\r\n');
  654.               /** @type {string} */
  655.               body = body + "Content-Transfer-Encoding: base64\r\n";
  656.               /** @type {string} */
  657.               body = body + ("Content-Type: " + storage.type + "\r\n\r\n");
  658.               /** @type {string} */
  659.               body = body + (storage.base64 + "\r\n");
  660.             } else {
  661.               /** @type {string} */
  662.               body = body + ('Content-Disposition: form-data; name="' + running[0] + '";\r\n\r\n');
  663.               /** @type {string} */
  664.               body = body + (running[1] + "\r\n");
  665.             }
  666.           }), body = body + ("--" + boundary + "--");
  667.         };
  668.         Model = FormData;
  669.       } else {
  670.         if ("undefined" == typeof window && "undefined" == typeof FormData) {
  671.           try {
  672.             Model = require("./node_modules/form-data/lib/browser.js");
  673.           } catch (e) {
  674.           }
  675.         }
  676.       }
  677.       /**
  678.        * @param {!Object} chunk
  679.        * @param {!Object} output
  680.        * @param {!Function} callback
  681.        * @return {undefined}
  682.        */
  683.       var callback = function(chunk, output, callback) {
  684.         if (callback && "function" == typeof callback) {
  685.           if (chunk) {
  686.             /** @type {null} */
  687.             var internalError = null;
  688.             try {
  689.               /** @type {*} */
  690.               internalError = JSON.parse(chunk.response);
  691.             } catch (e) {
  692.             }
  693.             var stdout = internalError ? internalError.message : null;
  694.             var mm2 = internalError ? internalError.code : null;
  695.             callback(output, new Date(stdout, mm2));
  696.           } else {
  697.             callback(output, null);
  698.           }
  699.         }
  700.       };
  701.       /**
  702.        * @param {!Object} obj
  703.        * @return {?}
  704.        */
  705.       var check = function(obj) {
  706.         var i;
  707.         for (i in obj) {
  708.           if (obj.hasOwnProperty(i)) {
  709.             return false;
  710.           }
  711.         }
  712.         return Array.isArray(obj) ? JSON.stringify(obj) === JSON.stringify([]) : JSON.stringify(obj) === JSON.stringify({});
  713.       };
  714.       /**
  715.        * @param {number} val
  716.        * @return {?}
  717.        */
  718.       var cb = function(val) {
  719.         try {
  720.           if ("number" == typeof val) {
  721.             return true;
  722.           }
  723.           if ("string" == typeof val) {
  724.             return /^\d+$/.test(val);
  725.           }
  726.         } catch (e) {
  727.           return t && console.error(e), false;
  728.         }
  729.       };
  730.       var fn = function() {
  731.         /**
  732.          * @return {undefined}
  733.          */
  734.         var subclass = function() {
  735.         };
  736.         return function(parentClass, childClass) {
  737.           subclass.prototype = new parentClass;
  738.           childClass.prototype = new subclass;
  739.           childClass.super = parentClass.prototype;
  740.           /** @type {!Function} */
  741.           childClass.prototype.constructor = childClass;
  742.         };
  743.       }();
  744.       /**
  745.        * @param {string} a
  746.        * @param {number} m
  747.        * @return {?}
  748.        */
  749.       var Date = function(a, m) {
  750.         return this.name = "SendBirdException", this.code = m || 0, this.message = a, this;
  751.       };
  752.       fn(Error, Date);
  753.       var R = {
  754.         MessageTypeFilter : {
  755.           ALL : 0,
  756.           USER : 1,
  757.           FILE : 2,
  758.           ADMIN : 3
  759.         }
  760.       };
  761.       /**
  762.        * @param {!Array} a
  763.        * @return {?}
  764.        */
  765.       var f = function(a) {
  766.         return Object.keys(a).forEach(function(i) {
  767.           if (null !== a[i] && void 0 !== a[i] && "object" == typeof a[i]) {
  768.             a[i] = f(a[i]);
  769.           }
  770.         }), Object.freeze(a);
  771.       };
  772.       /**
  773.        * @param {?} obj
  774.        * @return {?}
  775.        */
  776.       var $ = function(obj) {
  777.         return JSON.parse(JSON.stringify(obj));
  778.       };
  779.       /**
  780.        * @param {!Object} self
  781.        * @param {number} index
  782.        * @param {number} v
  783.        * @return {undefined}
  784.        */
  785.       var log = function(self, index, v) {
  786.         try {
  787.           if ("number" == typeof index && index >= 0) {
  788.             if ("all" === self.myCountPreference || "unread_message_count_only" === self.myCountPreference) {
  789.               if (self.isSuper) {
  790.                 /** @type {number} */
  791.                 self.unreadMessageCount = index >= 1 ? 1 : 0;
  792.               } else {
  793.                 /** @type {number} */
  794.                 self.unreadMessageCount = index;
  795.               }
  796.             } else {
  797.               /** @type {number} */
  798.               self.unreadMessageCount = 0;
  799.             }
  800.           }
  801.           if ("number" == typeof v && v >= 0) {
  802.             if ("all" === self.myCountPreference || "unread_mention_count_only" === self.myCountPreference) {
  803.               /** @type {number} */
  804.               self.unreadMentionCount = v;
  805.             } else {
  806.               /** @type {number} */
  807.               self.unreadMentionCount = 0;
  808.             }
  809.           }
  810.         } catch (e) {
  811.         }
  812.       };
  813.       /**
  814.        * @return {?}
  815.        */
  816.       var init = function() {
  817.         var inputData;
  818.         var crawler = {};
  819.         try {
  820.           inputData = "undefined" == typeof window ? require("./node_modules/xhr2/lib/browser.js") : null;
  821.         } catch (n) {
  822.           /** @type {null} */
  823.           inputData = null;
  824.         }
  825.         if (inputData) {
  826.           try {
  827.             var Sia = require("./node_modules/agentkeepalive/browser.js");
  828.             var Worker = require("./node_modules/agentkeepalive/browser.js").HttpsAgent;
  829.             var timeStart = new Sia({
  830.               keepAlive : true,
  831.               timeout : 6e4,
  832.               keepAliveTimeout : 6e4
  833.             });
  834.             crawler.httpAgent = timeStart;
  835.             var sanitise = new Worker({
  836.               keepAlive : true,
  837.               timeout : 6e4,
  838.               keepAliveTimeout : 6e4
  839.             });
  840.             crawler.httpsAgent = sanitise;
  841.           } catch (e) {
  842.           }
  843.         }
  844.         /**
  845.          * @return {?}
  846.          */
  847.         var cb = function() {
  848.           var result;
  849.           return inputData ? (result = new inputData).nodejsSet(crawler) : result = new XMLHttpRequest, result;
  850.         };
  851.         /**
  852.          * @param {string} e
  853.          * @param {?} data
  854.          * @param {string} method
  855.          * @param {!Object} values
  856.          * @param {!Function} doc
  857.          * @return {undefined}
  858.          */
  859.         var get = function(e, data, method, values, doc) {
  860.           var xhr = cb();
  861.           xhr.open(method, e);
  862.           /**
  863.            * @return {undefined}
  864.            */
  865.           xhr.onload = function() {
  866.             if (xhr.status >= 200 && xhr.status < 400) {
  867.               /** @type {boolean} */
  868.               var e = false;
  869.               /** @type {null} */
  870.               var stderr = null;
  871.               try {
  872.                 /** @type {*} */
  873.                 stderr = JSON.parse(xhr.responseText);
  874.               } catch (n) {
  875.                 /** @type {boolean} */
  876.                 e = true;
  877.               }
  878.               if (e) {
  879.                 callback(new Date("Request failed.", concat.REQUEST_FAILED), null, doc);
  880.               } else {
  881.                 callback(null, stderr, doc);
  882.               }
  883.             } else {
  884.               callback({
  885.                 status : xhr.status,
  886.                 statusText : xhr.statusText,
  887.                 response : xhr.responseText
  888.               }, null, doc);
  889.             }
  890.           };
  891.           /**
  892.            * @return {undefined}
  893.            */
  894.           xhr.onerror = function() {
  895.             callback({
  896.               status : 404,
  897.               statusText : "There was a connection error",
  898.               response : JSON.stringify({
  899.                 message : "There was a connection error",
  900.                 code : concat.NETWORK_ERROR
  901.               })
  902.             }, null, doc);
  903.           };
  904.           try {
  905.             var i;
  906.             for (i in values) {
  907.               xhr.setRequestHeader(i, values[i] ? values[i] : "sendbird");
  908.             }
  909.           } catch (e) {
  910.           }
  911.           try {
  912.             switch(method) {
  913.               case "get":
  914.               case "GET":
  915.                 xhr.send();
  916.                 break;
  917.               default:
  918.                 if ("undefined" != typeof FormData && FormData && data instanceof FormData || void 0 !== Model && Model && data instanceof Model) {
  919.                   if (data.oldIE) {
  920.                     xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + data.boundary);
  921.                     xhr.send(data.toString());
  922.                   } else {
  923.                     xhr.send(data);
  924.                   }
  925.                 } else {
  926.                   xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8");
  927.                   xhr.send(JSON.stringify(data));
  928.                 }
  929.             }
  930.           } catch (size_buffer) {
  931.             if (t) {
  932.               console.log("request.send() fail: ", size_buffer);
  933.             }
  934.           }
  935.         };
  936.         /** @type {boolean} */
  937.         var lastTrackInfoUrl = false;
  938.         /**
  939.          * @param {?} key
  940.          * @param {?} name
  941.          * @param {string} value
  942.          * @return {undefined}
  943.          */
  944.         var callback = function(key, name, value) {
  945.           if (value && "function" == typeof value) {
  946.             if (void 0 === name) {
  947.               /** @type {null} */
  948.               name = null;
  949.             }
  950.             if (void 0 === key) {
  951.               /** @type {null} */
  952.               key = null;
  953.             }
  954.             if (lastTrackInfoUrl) {
  955.               value(name, key);
  956.             } else {
  957.               value(key, name);
  958.             }
  959.           }
  960.         };
  961.         /** @type {string} */
  962.         var path = "";
  963.         /** @type {number} */
  964.         var retries = 0;
  965.         /** @type {number} */
  966.         var ms = 0;
  967.         /**
  968.          * @param {!Object} result
  969.          * @return {undefined}
  970.          */
  971.         var $ = function(result) {
  972.           /**
  973.            * @return {?}
  974.            */
  975.           this.isOpenChannel = function() {
  976.             return this.channelType === update.CHANNEL_TYPE_OPEN;
  977.           };
  978.           /**
  979.            * @return {?}
  980.            */
  981.           this.isGroupChannel = function() {
  982.             return this.channelType === update.CHANNEL_TYPE_GROUP;
  983.           };
  984.           /**
  985.            * @return {?}
  986.            */
  987.           this.isUserMessage = function() {
  988.             return this.messageType === $.MESSAGE_TYPE_USER;
  989.           };
  990.           /**
  991.            * @return {?}
  992.            */
  993.           this.isAdminMessage = function() {
  994.             return this.messageType === $.MESSAGE_TYPE_ADMIN;
  995.           };
  996.           /**
  997.            * @return {?}
  998.            */
  999.           this.isFileMessage = function() {
  1000.             return this.messageType === $.MESSAGE_TYPE_FILE;
  1001.           };
  1002.           /**
  1003.            * @param {!Object} res
  1004.            * @return {undefined}
  1005.            */
  1006.           this._update = function(res) {
  1007.             /** @type {number} */
  1008.             this.messageId = res.hasOwnProperty("msg_id") ? parseInt(res.msg_id) : 0;
  1009.             /** @type {string} */
  1010.             this.channelUrl = res.hasOwnProperty("channel_url") ? String(res.channel_url) : "";
  1011.             /** @type {number} */
  1012.             this.createdAt = res.hasOwnProperty("ts") ? parseInt(res.ts) : 0;
  1013.             /** @type {number} */
  1014.             this.updatedAt = res.hasOwnProperty("updated_at") ? parseInt(res.updated_at) : 0;
  1015.             /** @type {string} */
  1016.             this.channelType = res.hasOwnProperty("channel_type") ? String(res.channel_type) : update.CHANNEL_TYPE_GROUP;
  1017.             this.mentionType = res.hasOwnProperty("mention_type") ? res.mention_type : UserService.MentionType.USERS;
  1018.             var $scope = this;
  1019.             /** @type {!Array} */
  1020.             $scope.mentionedUsers = [];
  1021.             if (res.hasOwnProperty("mentioned_users")) {
  1022.               res.mentioned_users.forEach(function(options) {
  1023.                 var c = new client(options);
  1024.                 $scope.mentionedUsers.push(c);
  1025.               });
  1026.             }
  1027.           };
  1028.           /**
  1029.            * @return {?}
  1030.            */
  1031.           this.serialize = function() {
  1032.             /** @type {*} */
  1033.             var params = JSON.parse(JSON.stringify(this));
  1034.             return params.hasOwnProperty("_sender") && (params.sender = params._sender, delete params._sender), f(params);
  1035.           };
  1036.           /** @type {string} */
  1037.           this.messageType = $.MESSAGE_TYPE_BASE;
  1038.           if (result) {
  1039.             this._update(result);
  1040.           }
  1041.         };
  1042.         /**
  1043.          * @param {!Object} data
  1044.          * @param {?} input
  1045.          * @return {?}
  1046.          */
  1047.         $.build = function(data, input) {
  1048.           if (!data) {
  1049.             return null;
  1050.           }
  1051.           var d;
  1052.           var e;
  1053.           var n;
  1054.           var type;
  1055.           var options;
  1056.           var h;
  1057.           var callback;
  1058.           var version;
  1059.           var id;
  1060.           var title;
  1061.           switch(data.type) {
  1062.             case "MESG":
  1063.               return d = new client(data.user), e = parseInt(data.message_id), n = String(data.message), type = String(data.data), options = parseInt(data.created_at), h = parseInt(data.updated_at), callback = data.hasOwnProperty("custom_type") ? String(data.custom_type) : "", version = data.hasOwnProperty("translations") ? data.translations : {}, id = data.hasOwnProperty("mention_type") ? data.mention_type : UserService.MentionType.USERS, title = data.mentioned_users, new self(self.build("", e,
  1064.               d, input, n, type, callback, version, options, h, id, title));
  1065.             case "FILE":
  1066.               d = new client(data.user);
  1067.               /** @type {number} */
  1068.               e = parseInt(data.message_id);
  1069.               /** @type {string} */
  1070.               n = String(data.message);
  1071.               /** @type {number} */
  1072.               options = parseInt(data.created_at);
  1073.               /** @type {number} */
  1074.               h = parseInt(data.updated_at);
  1075.               /** @type {string} */
  1076.               callback = data.hasOwnProperty("custom_type") ? String(data.custom_type) : "";
  1077.               id = data.hasOwnProperty("mention_type") ? data.mention_type : UserService.MentionType.USERS;
  1078.               title = data.mentioned_users;
  1079.               var file = data.file;
  1080.               /** @type {string} */
  1081.               var key = String(file.url);
  1082.               /** @type {string} */
  1083.               var result = String(file.name);
  1084.               /** @type {string} */
  1085.               var NINETY_EIGHT_HOURS = String(file.type);
  1086.               /** @type {number} */
  1087.               var clientApiUrl = parseInt(file.size) || 0;
  1088.               /** @type {string} */
  1089.               type = String(file.data);
  1090.               var interceptedDescriptors = data.hasOwnProperty("thumbnails") ? data.thumbnails : [];
  1091.               var TMP_FILENAME = !!data.hasOwnProperty("require_auth") && data.require_auth;
  1092.               return new test(test.build("", e, d, input, key, result, NINETY_EIGHT_HOURS, clientApiUrl, type, callback, options, interceptedDescriptors, TMP_FILENAME, h, id, title));
  1093.             case "BRDM":
  1094.             case "ADMM":
  1095.               return e = parseInt(data.message_id), n = String(data.message), type = String(data.data), options = parseInt(data.created_at), h = parseInt(data.updated_at), callback = data.hasOwnProperty("custom_type") ? String(data.custom_type) : "", version = data.hasOwnProperty("translations") ? data.translations : {}, id = data.hasOwnProperty("mention_type") ? data.mention_type : UserService.MentionType.USERS, title = data.mentioned_users, new logger(logger.build(e, input, n, type, callback, version,
  1096.               options, h, id, title));
  1097.           }
  1098.           return null;
  1099.         };
  1100.         /** @type {string} */
  1101.         $.MESSAGE_TYPE_BASE = "base";
  1102.         /** @type {string} */
  1103.         $.MESSAGE_TYPE_ADMIN = "admin";
  1104.         /** @type {string} */
  1105.         $.MESSAGE_TYPE_USER = "user";
  1106.         /** @type {string} */
  1107.         $.MESSAGE_TYPE_FILE = "file";
  1108.         /**
  1109.          * @param {string} options
  1110.          * @return {undefined}
  1111.          */
  1112.         var logger = function(options) {
  1113.           /** @type {string} */
  1114.           this.messageType = $.MESSAGE_TYPE_ADMIN;
  1115.           if (options) {
  1116.             this._update(options);
  1117.             /** @type {string} */
  1118.             this.message = String(options.message);
  1119.             /** @type {string} */
  1120.             this.data = options.hasOwnProperty("data") ? String(options.data) : "";
  1121.             /** @type {string} */
  1122.             this.customType = options.hasOwnProperty("custom_type") ? String(options.custom_type) : "";
  1123.             this.translations = options.hasOwnProperty("translations") ? options.translations : {};
  1124.           }
  1125.         };
  1126.         fn($, logger);
  1127.         /**
  1128.          * @param {string} e
  1129.          * @param {!Object} value
  1130.          * @param {string} p
  1131.          * @param {!Object} id
  1132.          * @param {string} n
  1133.          * @param {string} a
  1134.          * @param {number} i
  1135.          * @param {number} url
  1136.          * @param {number} key
  1137.          * @param {!Object} type
  1138.          * @return {?}
  1139.          */
  1140.         logger.build = function(e, value, p, id, n, a, i, url, key, type) {
  1141.           var data = {
  1142.             msg_id : e,
  1143.             channel_url : value.url,
  1144.             channel_type : value.channelType === update.CHANNEL_TYPE_OPEN ? update.CHANNEL_TYPE_OPEN : update.CHANNEL_TYPE_GROUP,
  1145.             ts : i,
  1146.             updated_at : url,
  1147.             message : p,
  1148.             data : id
  1149.           };
  1150.           return n && (data.custom_type = n), a && (data.translations = a), data.mention_type = key, data.mentioned_users = [], type && (data.mentioned_users = type), data;
  1151.         };
  1152.         /**
  1153.          * @param {?} window
  1154.          * @return {?}
  1155.          */
  1156.         logger.buildFromSerializedData = function(window) {
  1157.           var self = $(window);
  1158.           /** @type {!Array} */
  1159.           var signal = [];
  1160.           return self.mentionedUsers.forEach(function($scope) {
  1161.             signal.push(client.build($scope.userId, $scope.nickname, $scope.profileUrl, $scope.connectionStatus, $scope.lastSeenAt, $scope.metaData, $scope.isActive, $scope.friendDiscoveryKey, $scope.friendName));
  1162.           }), new logger(logger.build(self.messageId, {
  1163.             url : self.channelUrl,
  1164.             channelType : self.channelType
  1165.           }, self.message, self.data, self.customType, self.translations, self.createdAt, self.updatedAt, self.mentionType, signal));
  1166.         };
  1167.         /**
  1168.          * @param {!Object} options
  1169.          * @return {undefined}
  1170.          */
  1171.         var self = function(options) {
  1172.           /** @type {string} */
  1173.           this.messageType = $.MESSAGE_TYPE_USER;
  1174.           if (options) {
  1175.             this._update(options);
  1176.             /** @type {string} */
  1177.             this.message = String(options.message);
  1178.             /** @type {string} */
  1179.             this.data = options.hasOwnProperty("data") ? String(options.data) : "";
  1180.             this._sender = new client(options.user);
  1181.             if (c) {
  1182.               this.sender = this._sender;
  1183.             } else {
  1184.               Object.defineProperty(this, "sender", {
  1185.                 get : function() {
  1186.                   if (setup.getInstance().Options.useMemberAsMessageSender && this.isGroupChannel()) {
  1187.                     var self = link.cachedChannels[this.channelUrl];
  1188.                     if (self) {
  1189.                       var data = self.memberMap[this._sender.userId];
  1190.                       if (data) {
  1191.                         if (this._sender.nickname !== data.nickname) {
  1192.                           this._sender.nickname = data.nickname;
  1193.                         }
  1194.                         if (this._sender.profileUrl !== data.profileUrl) {
  1195.                           this._sender.profileUrl = data.profileUrl;
  1196.                         }
  1197.                         if (this._sender.metaData !== data.metaData) {
  1198.                           this._sender.metaData = data.metaData;
  1199.                         }
  1200.                       }
  1201.                     }
  1202.                   }
  1203.                   return this._sender;
  1204.                 },
  1205.                 set : function(sender) {
  1206.                   /** @type {string} */
  1207.                   this._sender = sender;
  1208.                 }
  1209.               });
  1210.             }
  1211.             /** @type {string} */
  1212.             this.reqId = options.hasOwnProperty("req_id") ? String(options.req_id) : "";
  1213.             /** @type {string} */
  1214.             this.customType = options.hasOwnProperty("custom_type") ? String(options.custom_type) : "";
  1215.             this.translations = options.hasOwnProperty("translations") ? options.translations : {};
  1216.           }
  1217.         };
  1218.         fn($, self);
  1219.         /**
  1220.          * @param {string} e
  1221.          * @param {?} id
  1222.          * @param {!Object} data
  1223.          * @param {!Object} value
  1224.          * @param {string} name
  1225.          * @param {string} event
  1226.          * @param {string} i
  1227.          * @param {number} url
  1228.          * @param {number} type
  1229.          * @param {!Object} key
  1230.          * @param {string} obj
  1231.          * @param {!Object} args
  1232.          * @param {string} path
  1233.          * @return {?}
  1234.          */
  1235.         self.build = function(e, id, data, value, name, event, i, url, type, key, obj, args, path) {
  1236.           var params = {};
  1237.           /** @type {string} */
  1238.           params.req_id = e;
  1239.           params.msg_id = id;
  1240.           params.channel_url = value.url;
  1241.           /** @type {string} */
  1242.           params.channel_type = value.channelType === update.CHANNEL_TYPE_OPEN ? update.CHANNEL_TYPE_OPEN : update.CHANNEL_TYPE_GROUP;
  1243.           /** @type {number} */
  1244.           params.ts = type;
  1245.           /** @type {!Object} */
  1246.           params.updated_at = key;
  1247.           /** @type {string} */
  1248.           params.message = name;
  1249.           if (event) {
  1250.             /** @type {string} */
  1251.             params.data = event;
  1252.           }
  1253.           if (i) {
  1254.             /** @type {string} */
  1255.             params.custom_type = i;
  1256.           }
  1257.           if (url) {
  1258.             /** @type {number} */
  1259.             params.translations = url;
  1260.           }
  1261.           var user = {};
  1262.           user.user_id = data.userId;
  1263.           user.nickname = data.nickname;
  1264.           user.profile_url = data.profileUrl;
  1265.           try {
  1266.             /** @type {*} */
  1267.             user.metadata = "string" == typeof data.metaData ? JSON.parse(data.metaData) : data.metaData;
  1268.           } catch (e) {
  1269.             user.metadata = {};
  1270.           }
  1271.           return params.user = user, params.mention_type = UserService.MentionType.USERS, obj && (params.mention_type = obj), params.mentioned_users = [], args && (params.mentioned_users = args), path && (params.mentioned_user_ids = path), params;
  1272.         };
  1273.         /**
  1274.          * @param {?} e
  1275.          * @return {?}
  1276.          */
  1277.         self.buildFromSerializedData = function(e) {
  1278.           var data = $(e);
  1279.           /** @type {!Array} */
  1280.           var title = [];
  1281.           return data.mentionedUsers.forEach(function($scope) {
  1282.             title.push(client.build($scope.userId, $scope.nickname, $scope.profileUrl, $scope.connectionStatus, $scope.lastSeenAt, $scope.metaData, $scope.isActive, $scope.friendDiscoveryKey, $scope.friendName));
  1283.           }), new self(self.build(data.reqId, data.messageId, data.sender, {
  1284.             url : data.channelUrl,
  1285.             channelType : data.channelType
  1286.           }, data.message, data.data, data.customType, data.translations, data.createdAt, data.updatedAt, data.mentionType, title));
  1287.         };
  1288.         /**
  1289.          * @param {!Object} data
  1290.          * @return {undefined}
  1291.          */
  1292.         var test = function(data) {
  1293.           if (this.messageType = $.MESSAGE_TYPE_FILE, data && (this._update(data), this._sender = new client(data.user), c ? this.sender = this._sender : Object.defineProperty(this, "sender", {
  1294.             get : function() {
  1295.               if (setup.getInstance().Options.useMemberAsMessageSender && this.isGroupChannel()) {
  1296.                 var self = link.cachedChannels[this.channelUrl];
  1297.                 if (self) {
  1298.                   var data = self.memberMap[this._sender.userId];
  1299.                   if (data) {
  1300.                     if (this._sender.nickname !== data.nickname) {
  1301.                       this._sender.nickname = data.nickname;
  1302.                     }
  1303.                     if (this._sender.profileUrl !== data.profileUrl) {
  1304.                       this._sender.profileUrl = data.profileUrl;
  1305.                     }
  1306.                     if (this._sender.metaData !== data.metaData) {
  1307.                       this._sender.metaData = data.metaData;
  1308.                     }
  1309.                   }
  1310.                 }
  1311.               }
  1312.               return this._sender;
  1313.             },
  1314.             set : function(sender) {
  1315.               /** @type {string} */
  1316.               this._sender = sender;
  1317.             }
  1318.           }), this.requireAuth = !!data.hasOwnProperty("require_auth") && data.require_auth, this.url = this.requireAuth ? String(data.url).split("?auth=")[0] + "?auth=" + exports.getInstance().ekey : String(data.url).split("?auth=")[0], this.name = data.hasOwnProperty("name") ? data.name : "File", this.size = parseInt(data.size) || 0, this.type = String(data.type), this.data = data.hasOwnProperty("custom") ? String(data.custom) : "", this.reqId = data.hasOwnProperty("req_id") ? String(data.req_id) :
  1319.           "", this.customType = data.hasOwnProperty("custom_type") ? String(data.custom_type) : "", this.thumbnails = data.hasOwnProperty("thumbnails") ? data.thumbnails : [], this.requireAuth)) {
  1320.             var i;
  1321.             for (i in this.thumbnails) {
  1322.               /** @type {string} */
  1323.               this.thumbnails[i].url = String(this.thumbnails[i].url).split("?auth=")[0] + "?auth=" + exports.getInstance().ekey;
  1324.             }
  1325.           }
  1326.         };
  1327.         fn($, test);
  1328.         /**
  1329.          * @param {string} e
  1330.          * @param {?} id
  1331.          * @param {!Object} data
  1332.          * @param {!Object} options
  1333.          * @param {string} a
  1334.          * @param {string} x
  1335.          * @param {string} i
  1336.          * @param {string} url
  1337.          * @param {string} f
  1338.          * @param {!Object} name
  1339.          * @param {number} arr
  1340.          * @param {!Object} value
  1341.          * @param {boolean} path
  1342.          * @param {!Object} text
  1343.          * @param {string} type
  1344.          * @param {!Object} n
  1345.          * @param {string} err
  1346.          * @return {?}
  1347.          */
  1348.         test.build = function(e, id, data, options, a, x, i, url, f, name, arr, value, path, text, type, n, err) {
  1349.           var item = {};
  1350.           /** @type {string} */
  1351.           item.req_id = e;
  1352.           item.msg_id = id;
  1353.           item.channel_url = options.url;
  1354.           /** @type {string} */
  1355.           item.channel_type = options.channelType === update.CHANNEL_TYPE_OPEN ? update.CHANNEL_TYPE_OPEN : update.CHANNEL_TYPE_GROUP;
  1356.           /** @type {number} */
  1357.           item.ts = arr;
  1358.           /** @type {!Object} */
  1359.           item.updated_at = text;
  1360.           /** @type {string} */
  1361.           item.url = a;
  1362.           /** @type {string} */
  1363.           item.name = x;
  1364.           /** @type {string} */
  1365.           item.type = i;
  1366.           /** @type {string} */
  1367.           item.size = url;
  1368.           /** @type {string} */
  1369.           item.custom = f;
  1370.           var user = {};
  1371.           user.user_id = data.userId;
  1372.           user.nickname = data.nickname;
  1373.           user.profile_url = data.profileUrl;
  1374.           try {
  1375.             /** @type {*} */
  1376.             user.metadata = JSON.parse(data.metaData);
  1377.           } catch (e) {
  1378.             user.metadata = {};
  1379.           }
  1380.           return item.user = user, name && (item.custom_type = name), path && (item.require_auth = path), value && (item.thumbnails = value), item.mention_type = type, item.mentioned_users = [], n && (item.mentioned_users = n), err && (item.mentioned_user_ids = err), item;
  1381.         };
  1382.         /**
  1383.          * @param {?} window
  1384.          * @return {?}
  1385.          */
  1386.         test.buildFromSerializedData = function(window) {
  1387.           var self = $(window);
  1388.           /** @type {!Array} */
  1389.           var dnorm = [];
  1390.           return self.mentionedUsers.forEach(function($scope) {
  1391.             dnorm.push(client.build($scope.userId, $scope.nickname, $scope.profileUrl, $scope.connectionStatus, $scope.lastSeenAt, $scope.metaData, $scope.isActive, $scope.friendDiscoveryKey, $scope.friendName));
  1392.           }), new test(test.build(self.reqId, self.messageId, self.sender, {
  1393.             url : self.channelUrl,
  1394.             channelType : self.channelType
  1395.           }, self.url, self.name, self.type, self.size, self.data, self.customType, self.createdAt, self.thumbnails, self.requireAuth, self.updatedAt, self.mentionType, dnorm));
  1396.         };
  1397.         /**
  1398.          * @param {!Object} data
  1399.          * @return {undefined}
  1400.          */
  1401.         var update = function(data) {
  1402.           /**
  1403.            * @param {!Object} user
  1404.            * @return {undefined}
  1405.            */
  1406.           this._update = function(user) {
  1407.             /** @type {string} */
  1408.             this.url = user.hasOwnProperty("channel_url") ? String(user.channel_url) : "";
  1409.             /** @type {string} */
  1410.             this.name = user.hasOwnProperty("name") ? String(user.name) : "";
  1411.             /** @type {string} */
  1412.             this.coverUrl = user.hasOwnProperty("cover_url") ? String(user.cover_url) : "";
  1413.             /** @type {number} */
  1414.             this.createdAt = user.hasOwnProperty("created_at") ? 1e3 * user.created_at : 0;
  1415.             /** @type {string} */
  1416.             this.data = user.hasOwnProperty("data") ? String(user.data) : "";
  1417.             this.customType = user.hasOwnProperty("custom_type") ? user.custom_type : "";
  1418.             this.isFrozen = !!user.hasOwnProperty("freeze") && user.freeze;
  1419.             this.isEphemeral = !!user.hasOwnProperty("is_ephemeral") && user.is_ephemeral;
  1420.             this.fileUploadRequest = {};
  1421.           };
  1422.           /**
  1423.            * @return {?}
  1424.            */
  1425.           this.serialize = function() {
  1426.             /** @type {*} */
  1427.             var item = JSON.parse(JSON.stringify(this));
  1428.             if (item.hasOwnProperty("lastMessage") && null !== item.lastMessage && void 0 !== item.lastMessage && "object" == typeof item.lastMessage) {
  1429.               var message = item.lastMessage;
  1430.               if (message.hasOwnProperty("_sender")) {
  1431.                 message.sender = message._sender;
  1432.                 delete message._sender;
  1433.                 item.lastMessage = message;
  1434.               }
  1435.             }
  1436.             return f(item);
  1437.           };
  1438.           /**
  1439.            * @return {?}
  1440.            */
  1441.           this.isGroupChannel = function() {
  1442.             return this.channelType === update.CHANNEL_TYPE_GROUP;
  1443.           };
  1444.           /**
  1445.            * @return {?}
  1446.            */
  1447.           this.isOpenChannel = function() {
  1448.             return this.channelType === update.CHANNEL_TYPE_OPEN;
  1449.           };
  1450.           /**
  1451.            * @param {string} n
  1452.            * @param {string} c
  1453.            * @return {?}
  1454.            */
  1455.           this.getMessageChangeLogsByToken = function(n, c) {
  1456.             if ("function" == typeof n && (c = n, n = null), "function" != typeof c) {
  1457.               return null;
  1458.             }
  1459.             exports.getInstance().getMessageChangeLogsByToken(this.isOpenChannel(), this.url, n, function(result, exisObj) {
  1460.               if (exisObj) {
  1461.                 callback(null, exisObj, c);
  1462.               } else {
  1463.                 var s = result.updated.map(function(e) {
  1464.                   return $.build(e, this);
  1465.                 });
  1466.                 var deletedMessageIds = result.deleted.map(function(context) {
  1467.                   return context.message_id;
  1468.                 });
  1469.                 var courseSections = result.has_more;
  1470.                 var token = result.next;
  1471.                 callback({
  1472.                   updatedMessages : s,
  1473.                   deletedMessageIds : deletedMessageIds,
  1474.                   hasMore : courseSections,
  1475.                   token : token
  1476.                 }, null, c);
  1477.               }
  1478.             });
  1479.           };
  1480.           /**
  1481.            * @return {?}
  1482.            */
  1483.           this.createOperatorListQuery = function() {
  1484.             return new postLink(this);
  1485.           };
  1486.           /**
  1487.            * @return {?}
  1488.            */
  1489.           this.createPreviousMessageListQuery = function() {
  1490.             return new Assets(this);
  1491.           };
  1492.           /**
  1493.            * @return {?}
  1494.            */
  1495.           this.createMessageListQuery = function() {
  1496.             return new initialize(this);
  1497.           };
  1498.           /**
  1499.            * @param {(Object|string)} e
  1500.            * @param {number} result
  1501.            * @param {boolean} x
  1502.            * @param {number} name
  1503.            * @param {number} callback
  1504.            * @param {?} obj
  1505.            * @param {string} type
  1506.            * @param {string} s
  1507.            * @param {!Array} args
  1508.            * @param {!Function} key
  1509.            * @return {?}
  1510.            */
  1511.           var handleError = function(e, result, x, name, callback, obj, type, s, args, key) {
  1512.             if (type === R.MessageTypeFilter.ADMIN ? type = "ADMM" : type === R.MessageTypeFilter.USER ? type = "MESG" : type === R.MessageTypeFilter.FILE ? type = "FILE" : type === R.MessageTypeFilter.ALL && (type = ""), cb(result) && "boolean" == typeof x && cb(name) && cb(callback) && "boolean" == typeof obj && "string" == typeof type && "string" == typeof s && Array.isArray(args)) {
  1513.               /** @type {number} */
  1514.               var i = 0;
  1515.               for (; i < args.length; i++) {
  1516.                 if ("string" != typeof args[i]) {
  1517.                   return void callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), key);
  1518.                 }
  1519.               }
  1520.               exports.getInstance().messageList(e.isOpenChannel(), e.url, result, name, callback, x, obj, type, s, args, function(data, exisObj) {
  1521.                 if (exisObj) {
  1522.                   callback(null, exisObj, key);
  1523.                 } else {
  1524.                   var msgs = data.messages;
  1525.                   /** @type {!Array} */
  1526.                   var bounds = [];
  1527.                   var i;
  1528.                   for (i in msgs) {
  1529.                     var ne = $.build(msgs[i], e);
  1530.                     if (ne) {
  1531.                       bounds.push(ne);
  1532.                     }
  1533.                   }
  1534.                   callback(bounds, null, key);
  1535.                 }
  1536.               });
  1537.             } else {
  1538.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), key);
  1539.             }
  1540.           };
  1541.           /**
  1542.            * @param {(Object|string)} e
  1543.            * @param {number} d
  1544.            * @param {boolean} x
  1545.            * @param {number} n
  1546.            * @param {number} r
  1547.            * @param {?} path
  1548.            * @param {string} type
  1549.            * @param {?} value
  1550.            * @param {!Array} doc
  1551.            * @param {!Function} key
  1552.            * @return {?}
  1553.            */
  1554.           var add = function(e, d, x, n, r, path, type, value, doc, key) {
  1555.             if (type === R.MessageTypeFilter.ADMIN ? type = "ADMM" : type === R.MessageTypeFilter.USER ? type = "MESG" : type === R.MessageTypeFilter.FILE ? type = "FILE" : type === R.MessageTypeFilter.ALL && (type = ""), cb(d) && "boolean" == typeof x && cb(n) && cb(r) && "boolean" == typeof path && "string" == typeof type && "string" == typeof value && Array.isArray(doc)) {
  1556.               /** @type {number} */
  1557.               var firstPart = 0;
  1558.               for (; firstPart < doc.length; firstPart++) {
  1559.                 if ("string" != typeof doc[firstPart]) {
  1560.                   return void callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), key);
  1561.                 }
  1562.               }
  1563.               exports.getInstance().messageListByID(e.isOpenChannel(), e.url, d, n, r, x, path, type, value, doc, function(data, exisObj) {
  1564.                 if (exisObj) {
  1565.                   callback(null, exisObj, key);
  1566.                 } else {
  1567.                   var msgs = data.messages;
  1568.                   /** @type {!Array} */
  1569.                   var bounds = [];
  1570.                   var i;
  1571.                   for (i in msgs) {
  1572.                     var ne = $.build(msgs[i], e);
  1573.                     if (ne) {
  1574.                       bounds.push(ne);
  1575.                     }
  1576.                   }
  1577.                   callback(bounds, null, key);
  1578.                 }
  1579.               });
  1580.             } else {
  1581.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), key);
  1582.             }
  1583.           };
  1584.           /**
  1585.            * @param {undefined} error
  1586.            * @param {boolean} response
  1587.            * @param {undefined} session
  1588.            * @param {?} resp
  1589.            * @param {string} i
  1590.            * @param {string} wildcard
  1591.            * @param {!Array} callback
  1592.            * @param {!Object} thisArg
  1593.            * @return {?}
  1594.            */
  1595.           this.getNextMessagesByTimestamp = function(error, response, session, resp, i, wildcard, callback, thisArg) {
  1596.             return "function" != typeof callback || thisArg || (thisArg = callback, callback = []), handleError(this, error, response, 0, session, resp, i, wildcard, callback, thisArg);
  1597.           };
  1598.           /**
  1599.            * @param {undefined} err
  1600.            * @param {boolean} res
  1601.            * @param {undefined} error
  1602.            * @param {?} resp
  1603.            * @param {string} i
  1604.            * @param {string} wildcard
  1605.            * @param {!Array} callback
  1606.            * @param {!Object} thisArg
  1607.            * @return {?}
  1608.            */
  1609.           this.getPreviousMessagesByTimestamp = function(err, res, error, resp, i, wildcard, callback, thisArg) {
  1610.             return "function" != typeof callback || thisArg || (thisArg = callback, callback = []), handleError(this, err, res, error, 0, resp, i, wildcard, callback, thisArg);
  1611.           };
  1612.           /**
  1613.            * @param {undefined} res
  1614.            * @param {undefined} error
  1615.            * @param {undefined} session
  1616.            * @param {?} resp
  1617.            * @param {string} i
  1618.            * @param {string} wildcard
  1619.            * @param {!Array} callback
  1620.            * @param {!Object} thisArg
  1621.            * @return {?}
  1622.            */
  1623.           this.getPreviousAndNextMessagesByTimestamp = function(res, error, session, resp, i, wildcard, callback, thisArg) {
  1624.             return "function" != typeof callback || thisArg || (thisArg = callback, callback = []), handleError(this, res, true, error, session, resp, i, wildcard, callback, thisArg);
  1625.           };
  1626.           /**
  1627.            * @param {undefined} right
  1628.            * @param {boolean} n
  1629.            * @param {undefined} selector
  1630.            * @param {?} capture
  1631.            * @param {string} i
  1632.            * @param {?} howmany
  1633.            * @param {!Array} callback
  1634.            * @param {!Object} thisArg
  1635.            * @return {?}
  1636.            */
  1637.           this.getNextMessagesByID = function(right, n, selector, capture, i, howmany, callback, thisArg) {
  1638.             return "function" != typeof callback || thisArg || (thisArg = callback, callback = []), add(this, right, n, 0, selector, capture, i, howmany, callback, thisArg);
  1639.           };
  1640.           /**
  1641.            * @param {undefined} obj
  1642.            * @param {boolean} h
  1643.            * @param {undefined} pos
  1644.            * @param {?} z
  1645.            * @param {string} app
  1646.            * @param {?} layoutPath
  1647.            * @param {!Array} callback
  1648.            * @param {!Object} thisArg
  1649.            * @return {?}
  1650.            */
  1651.           this.getPreviousMessagesByID = function(obj, h, pos, z, app, layoutPath, callback, thisArg) {
  1652.             return "function" != typeof callback || thisArg || (thisArg = callback, callback = []), add(this, obj, h, pos, 0, z, app, layoutPath, callback, thisArg);
  1653.           };
  1654.           /**
  1655.            * @param {undefined} right
  1656.            * @param {undefined} n
  1657.            * @param {undefined} selector
  1658.            * @param {?} capture
  1659.            * @param {string} i
  1660.            * @param {?} howmany
  1661.            * @param {!Array} callback
  1662.            * @param {!Object} thisArg
  1663.            * @return {?}
  1664.            */
  1665.           this.getPreviousAndNextMessagesByID = function(right, n, selector, capture, i, howmany, callback, thisArg) {
  1666.             return "function" != typeof callback || thisArg || (thisArg = callback, callback = []), add(this, right, true, n, selector, capture, i, howmany, callback, thisArg);
  1667.           };
  1668.           /**
  1669.            * @param {?} id
  1670.            * @param {string} type
  1671.            * @param {undefined} result
  1672.            * @param {undefined} title
  1673.            * @param {undefined} status
  1674.            * @param {undefined} options
  1675.            * @param {undefined} e
  1676.            * @param {!Array} fn
  1677.            * @param {string} target
  1678.            * @param {string} date
  1679.            * @param {string} duration
  1680.            * @param {string} el
  1681.            * @param {string} out
  1682.            * @param {!Object} src
  1683.            * @return {?}
  1684.            */
  1685.           this._sendFileCommand = function(id, type, result, title, status, options, e, fn, target, date, duration, el, out, src) {
  1686.             var key;
  1687.             var data = this;
  1688.             key = src ? src.reqId : init.generateRequestId();
  1689.             var message = init.bFile(key, id, type, result, title, status, options, e, fn, target, date, duration, el);
  1690.             var scriptPubKey = test.build(message.requestId, 0, setup.getInstance().currentUser, this, "string" == typeof type ? type : "", result, title, status, options, e, null, null, false, null, date, null, duration);
  1691.             var scriptPubKeyBuffer = new test(scriptPubKey);
  1692.             return "string" == typeof type && setup.getInstance().sendCommand(message, function(canCreateDiscussions, options) {
  1693.               if (options) {
  1694.                 callback(null, new Date(options.message, options.code), out);
  1695.               } else {
  1696.                 var req = new test(canCreateDiscussions.getJsonElement());
  1697.                 var user = setup.getInstance().currentUser;
  1698.                 if (user && req._sender && user.userId === req._sender.userId) {
  1699.                   if (user.nickname !== req._sender.nickname) {
  1700.                     user.nickname = req._sender.nickname;
  1701.                   }
  1702.                   if (user.profileUrl !== req._sender.profileUrl) {
  1703.                     user.profileUrl = req._sender.profileUrl;
  1704.                   }
  1705.                 }
  1706.                 if (data.isGroupChannel()) {
  1707.                   link.getChannel(data.url, function(_this, value) {
  1708.                     if (lastTrackInfoUrl) {
  1709.                       var p = _this;
  1710.                       _this = value;
  1711.                       value = p;
  1712.                     }
  1713.                     if (value) {
  1714.                       callback(null, value, out);
  1715.                     } else {
  1716.                       var indexLookupKey;
  1717.                       for (indexLookupKey in _this.lastMessage = req, setup.getInstance().channelHandlers) {
  1718.                         setup.getInstance().channelHandlers[indexLookupKey].onChannelChanged(_this);
  1719.                       }
  1720.                     }
  1721.                   });
  1722.                 }
  1723.                 callback(req, null, out);
  1724.               }
  1725.             }), scriptPubKeyBuffer;
  1726.           };
  1727.           /**
  1728.            * @param {!Array} data
  1729.            * @return {?}
  1730.            */
  1731.           this._getSendFileMessageParamInfo = function(data) {
  1732.             var file = {
  1733.               file : null,
  1734.               name : null,
  1735.               type : null,
  1736.               size : null,
  1737.               data : "",
  1738.               customType : "",
  1739.               thumbnailSizes : [],
  1740.               callback : null,
  1741.               progressHandler : null,
  1742.               mentionType : UserService.MentionType.USERS,
  1743.               mentionedUserIds : [],
  1744.               pushNotificationDeliveryOption : set.PushNotificationDeliveryOption.DEFAULT
  1745.             };
  1746.             switch("function" == typeof data.slice(-1)[0] && (file.callback = data.pop()), "function" == typeof data.slice(-1)[0] && (file.progressHandler = data.pop()), data.length) {
  1747.               case 1:
  1748.                 if (data[0] instanceof set) {
  1749.                   var self = data[0];
  1750.                   file.file = self.file ? self.file : self.fileUrl;
  1751.                   file.name = self.fileName;
  1752.                   file.type = self.mimeType;
  1753.                   file.size = self.fileSize;
  1754.                   file.data = self.data;
  1755.                   file.customType = self.customType;
  1756.                   file.thumbnailSizes = self.thumbnailSizes;
  1757.                   file.mentionType = self._mentionType;
  1758.                   file.mentionedUserIds = self._mentionedIds;
  1759.                   file.pushNotificationDeliveryOption = self.pushNotificationDeliveryOption ? self.pushNotificationDeliveryOption : set.PushNotificationDeliveryOption.DEFAULT;
  1760.                 } else {
  1761.                   file.file = data[0];
  1762.                 }
  1763.                 break;
  1764.               case 2:
  1765.                 file.file = data[0];
  1766.                 file.data = data[1];
  1767.                 break;
  1768.               case 3:
  1769.                 file.file = data[0];
  1770.                 file.data = data[1];
  1771.                 file.customType = data[2];
  1772.                 break;
  1773.               case 4:
  1774.                 file.file = data[0];
  1775.                 file.data = data[1];
  1776.                 file.customType = data[2];
  1777.                 file.thumbnailSizes = data[3];
  1778.                 break;
  1779.               case 5:
  1780.                 file.file = data[0];
  1781.                 file.name = data[1];
  1782.                 file.type = data[2];
  1783.                 file.size = data[3];
  1784.                 file.data = data[4];
  1785.                 break;
  1786.               case 6:
  1787.                 file.file = data[0];
  1788.                 file.name = data[1];
  1789.                 file.type = data[2];
  1790.                 file.size = data[3];
  1791.                 file.data = data[4];
  1792.                 file.customType = data[5];
  1793.                 break;
  1794.               case 7:
  1795.                 file.file = data[0];
  1796.                 file.name = data[1];
  1797.                 file.type = data[2];
  1798.                 file.size = data[3];
  1799.                 file.data = data[4];
  1800.                 file.customType = data[5];
  1801.                 file.thumbnailSizes = data[6];
  1802.             }
  1803.             return "string" != typeof file.file && null !== file.file && (null !== file.name && void 0 !== file.name && file.name || (file.name = file.file.name), null !== file.type && void 0 !== file.type && file.type || (file.type = file.file.type), null !== file.size && void 0 !== file.size || (file.size = file.file.size)), null !== file.name && void 0 !== file.name || (file.name = ""), null !== file.type && void 0 !== file.type || (file.type = ""), null !== file.size && void 0 !== file.size ||
  1804.             (file.size = 0), file;
  1805.           };
  1806.           /**
  1807.            * @return {?}
  1808.            */
  1809.           this.sendFileMessage = function() {
  1810.             var self = this;
  1811.             var options = this._getSendFileMessageParamInfo(Array.prototype.slice.call(arguments));
  1812.             var item = options.file;
  1813.             var val = options.name;
  1814.             var value = options.type;
  1815.             var number = options.size;
  1816.             var i = options.data;
  1817.             var e = options.customType;
  1818.             var filename = options.thumbnailSizes;
  1819.             var scale = options.callback;
  1820.             var handlers = options.progressHandler;
  1821.             var h = options.mentionType;
  1822.             var isYTime = options.mentionedUserIds;
  1823.             var title = options.pushNotificationDeliveryOption;
  1824.             if (null !== filename && void 0 !== filename || (filename = []), setup.getInstance().hasLoggedIn()) {
  1825.               if (!(null === item || void 0 === item || null !== val && void 0 !== val && "string" != typeof val || null !== value && void 0 !== value && "string" != typeof value || null !== number && void 0 !== number && (!cb(number) || parseInt(number) < 0) || null !== i && void 0 !== i && "string" != typeof i || null !== e && void 0 !== e && "string" != typeof e || !Array.isArray(filename) || [set.PushNotificationDeliveryOption.DEFAULT, set.PushNotificationDeliveryOption.SUPPRESS].indexOf(title) <
  1826.               0)) {
  1827.                 var content = self.url;
  1828.                 /** @type {null} */
  1829.                 var result = null;
  1830.                 return "string" == typeof item ? result = self._sendFileCommand(content, item, val, value, number, i, e, [], false, h, isYTime, title, scale) : (result = self._sendFileCommand(content, item, val, value, number, i, e, [], false, h, isYTime, title, scale), exports.getInstance().uploadFile(item, value, filename, content, function(d, exisObj) {
  1831.                   if (exisObj) {
  1832.                     callback(null, exisObj, scale);
  1833.                   } else {
  1834.                     /** @type {*} */
  1835.                     var data = "object" == typeof d ? d : JSON.parse(d);
  1836.                     var c = data.url;
  1837.                     var mouseOut = data.hasOwnProperty("thumbnails") ? data.thumbnails : [];
  1838.                     var t = !!data.hasOwnProperty("require_auth") && data.require_auth;
  1839.                     self._sendFileCommand(content, c, val, value, number, i, e, mouseOut, t, h, isYTime, title, scale, result);
  1840.                   }
  1841.                 }, handlers, this.fileUploadRequest, result.reqId)), result;
  1842.               }
  1843.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), scale);
  1844.             } else {
  1845.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), scale);
  1846.             }
  1847.           };
  1848.           /**
  1849.            * @param {undefined} i
  1850.            * @param {string} productInfo
  1851.            * @return {?}
  1852.            */
  1853.           this.cancelUploadingFileMessage = function(i, productInfo) {
  1854.             if (setup.getInstance().hasLoggedIn()) {
  1855.               if (cb(i)) {
  1856.                 var resizedObj = this;
  1857.                 var xhr = resizedObj.fileUploadRequest[i];
  1858.                 return xhr ? (xhr.upload.onabort = function() {
  1859.                   delete resizedObj.fileUploadRequest[i];
  1860.                   callback(true, null, productInfo);
  1861.                 }, xhr.abort(), true) : (callback(false, new Date("Uploading has been completed or cancelled.", concat.FILE_UPLOAD_CANCEL_FAILED), productInfo), false);
  1862.               }
  1863.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), productInfo);
  1864.             } else {
  1865.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), productInfo);
  1866.             }
  1867.           };
  1868.           /**
  1869.            * @param {string} name
  1870.            * @param {string} options
  1871.            * @param {string} y
  1872.            * @param {number} t
  1873.            * @param {undefined} x
  1874.            * @return {?}
  1875.            */
  1876.           this.sendUserMessage = function(name, options, y, t, x) {
  1877.             var data = this;
  1878.             /** @type {string} */
  1879.             var version = UserService.MentionType.USERS;
  1880.             /** @type {!Array} */
  1881.             var val = [];
  1882.             /** @type {string} */
  1883.             var type = next.PushNotificationDeliveryOption.DEFAULT;
  1884.             if ("function" == typeof options && (x = options, options = "", y = "", t = [], name instanceof next)) {
  1885.               /** @type {string} */
  1886.               var data = name;
  1887.               name = data.message;
  1888.               options = data.data;
  1889.               y = data.customType;
  1890.               t = data.targetLanguages;
  1891.               version = data._mentionType;
  1892.               val = data._mentionedIds;
  1893.               type = data.pushNotificationDeliveryOption ? data.pushNotificationDeliveryOption : next.PushNotificationDeliveryOption.DEFAULT;
  1894.             }
  1895.             if ("function" == typeof y && (x = y, y = "", t = []), "function" == typeof t && (x = t, t = []), t || (t = []), "string" == typeof t && (t = [t]), null === options && (options = ""), null === y && (y = ""), setup.getInstance().hasLoggedIn()) {
  1896.               if ("string" == typeof name && "string" == typeof options && "string" == typeof y && Array.isArray(t) && !([next.PushNotificationDeliveryOption.DEFAULT, next.PushNotificationDeliveryOption.SUPPRESS].indexOf(type) < 0)) {
  1897.                 var cmd = init.bMessage(this.url, name, options, y, version, val, t, type);
  1898.                 var node = self.build(cmd.requestId, 0, setup.getInstance().currentUser, this, name, options, y, t, (new Date).getTime(), null, version, null, val);
  1899.                 var doc = new self(node);
  1900.                 return setup.getInstance().sendCommand(cmd, function(canCreateDiscussions, options) {
  1901.                   if (options) {
  1902.                     callback(null, new Date(options.message, options.code), x);
  1903.                   } else {
  1904.                     var req = new self(canCreateDiscussions.getJsonElement());
  1905.                     var user = setup.getInstance().currentUser;
  1906.                     if (user && req._sender && user.userId === req._sender.userId) {
  1907.                       if (user.nickname !== req._sender.nickname) {
  1908.                         user.nickname = req._sender.nickname;
  1909.                       }
  1910.                       if (user.profileUrl !== req._sender.profileUrl) {
  1911.                         user.profileUrl = req._sender.profileUrl;
  1912.                       }
  1913.                     }
  1914.                     if (data.isGroupChannel()) {
  1915.                       link.getChannel(data.url, function(_this, value) {
  1916.                         if (lastTrackInfoUrl) {
  1917.                           var p = _this;
  1918.                           _this = value;
  1919.                           value = p;
  1920.                         }
  1921.                         if (value) {
  1922.                           callback(null, value, x);
  1923.                         } else {
  1924.                           var indexLookupKey;
  1925.                           for (indexLookupKey in _this.lastMessage = req, setup.getInstance().channelHandlers) {
  1926.                             setup.getInstance().channelHandlers[indexLookupKey].onChannelChanged(_this);
  1927.                           }
  1928.                         }
  1929.                       });
  1930.                     }
  1931.                     callback(req, null, x);
  1932.                   }
  1933.                 }), doc;
  1934.               }
  1935.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), x);
  1936.             } else {
  1937.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), x);
  1938.             }
  1939.           };
  1940.           /**
  1941.            * @param {undefined} id
  1942.            * @param {number} name
  1943.            * @param {number} options
  1944.            * @param {number} x
  1945.            * @param {string} local
  1946.            * @return {?}
  1947.            */
  1948.           this.updateUserMessage = function(id, name, options, x, local) {
  1949.             /** @type {!Array<?>} */
  1950.             var a = Array.prototype.slice.call(arguments);
  1951.             if (5 !== a.length) {
  1952.               return "function" == typeof a.slice(-1)[0] && (local = a.pop()), void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), local);
  1953.             }
  1954.             if (setup.getInstance().hasLoggedIn()) {
  1955.               if (cb(id)) {
  1956.                 if ("string" != typeof name && null !== name && void 0 !== name || "string" != typeof options && null !== options && void 0 !== options || "string" != typeof x && null !== x && void 0 !== x) {
  1957.                   callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), local);
  1958.                 } else {
  1959.                   var message = init.bUpdateUserMessage(this.url, id, name, options, x);
  1960.                   setup.getInstance().sendCommand(message, function(canCreateDiscussions, options) {
  1961.                     if (options) {
  1962.                       callback(null, new Date(options.message, options.code), local);
  1963.                     } else {
  1964.                       var plugin = new self(canCreateDiscussions.getJsonElement());
  1965.                       callback(plugin, null, local);
  1966.                     }
  1967.                   });
  1968.                 }
  1969.               } else {
  1970.                 callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), local);
  1971.               }
  1972.             } else {
  1973.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), local);
  1974.             }
  1975.           };
  1976.           /**
  1977.            * @param {undefined} id
  1978.            * @param {number} name
  1979.            * @param {number} options
  1980.            * @param {string} childCompute
  1981.            * @return {?}
  1982.            */
  1983.           this.updateFileMessage = function(id, name, options, childCompute) {
  1984.             /** @type {!Array<?>} */
  1985.             var r = Array.prototype.slice.call(arguments);
  1986.             if (4 !== r.length) {
  1987.               return "function" == typeof r.slice(-1)[0] && (childCompute = r.pop()), void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), childCompute);
  1988.             }
  1989.             if (setup.getInstance().hasLoggedIn()) {
  1990.               if (cb(id)) {
  1991.                 if ("string" != typeof name && null !== name && void 0 !== name || "string" != typeof options && null !== options && void 0 !== options) {
  1992.                   callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), childCompute);
  1993.                 } else {
  1994.                   var url = init.bUpdateFileMessage(this.url, id, name, options);
  1995.                   setup.getInstance().sendCommand(url, function(canCreateDiscussions, options) {
  1996.                     if (options) {
  1997.                       callback(null, new Date(options.message, options.code), childCompute);
  1998.                     } else {
  1999.                       var identifierPositions = new test(canCreateDiscussions.getJsonElement());
  2000.                       callback(identifierPositions, null, childCompute);
  2001.                     }
  2002.                   });
  2003.                 }
  2004.               } else {
  2005.                 callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), childCompute);
  2006.               }
  2007.             } else {
  2008.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), childCompute);
  2009.             }
  2010.           };
  2011.           /**
  2012.            * @param {!Object} obj
  2013.            * @param {string} delimiter
  2014.            * @return {?}
  2015.            */
  2016.           this.createMetaCounters = function(obj, delimiter) {
  2017.             return setup.getInstance().hasLoggedIn() ? null == obj || "object" != typeof obj || Array.isArray(obj) || check(obj) ? void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), delimiter) : void exports.getInstance().createMetaCounters(this.isOpenChannel(), this.url, obj, function(identifierPositions, exisObj) {
  2018.               if (exisObj) {
  2019.                 callback(null, exisObj, delimiter);
  2020.               } else {
  2021.                 callback(identifierPositions, null, delimiter);
  2022.               }
  2023.             }) : void callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), delimiter);
  2024.           };
  2025.           /**
  2026.            * @param {?} obj
  2027.            * @param {string} n
  2028.            * @param {?} t
  2029.            * @return {?}
  2030.            */
  2031.           this.updateMetaCounters = function(obj, n, t) {
  2032.             return setup.getInstance().hasLoggedIn() ? ("function" != typeof n && void 0 !== t || (t = n, n = false), null == obj || "object" != typeof obj || Array.isArray(obj) || check(obj) || "boolean" != typeof n ? void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), t) : void exports.getInstance().updateMetaCounters(this.isOpenChannel(), this.url, obj, n, exports.UPDATE_META_COUNTER_MODE_SET, function(identifierPositions, n) {
  2033.               if (n) {
  2034.                 callback(null, n, t);
  2035.               } else {
  2036.                 callback(identifierPositions, null, t);
  2037.               }
  2038.             })) : void callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), t);
  2039.           };
  2040.           /**
  2041.            * @param {?} obj
  2042.            * @param {string} delimiter
  2043.            * @return {?}
  2044.            */
  2045.           this.increaseMetaCounters = function(obj, delimiter) {
  2046.             return setup.getInstance().hasLoggedIn() ? null == obj || "object" != typeof obj || Array.isArray(obj) || check(obj) ? void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), delimiter) : void exports.getInstance().updateMetaCounters(this.isOpenChannel(), this.url, obj, false, exports.UPDATE_META_COUNTER_MODE_INC, function(identifierPositions, exisObj) {
  2047.               if (exisObj) {
  2048.                 callback(null, exisObj, delimiter);
  2049.               } else {
  2050.                 callback(identifierPositions, null, delimiter);
  2051.               }
  2052.             }) : void callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), delimiter);
  2053.           };
  2054.           /**
  2055.            * @param {?} obj
  2056.            * @param {string} delimiter
  2057.            * @return {?}
  2058.            */
  2059.           this.decreaseMetaCounters = function(obj, delimiter) {
  2060.             return setup.getInstance().hasLoggedIn() ? null == obj || "object" != typeof obj || Array.isArray(obj) || check(obj) ? void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), delimiter) : void exports.getInstance().updateMetaCounters(this.isOpenChannel(), this.url, obj, false, exports.UPDATE_META_COUNTER_MODE_DEC, function(canCreateDiscussions, exisObj) {
  2061.               if (exisObj) {
  2062.                 callback(null, exisObj, delimiter);
  2063.               } else {
  2064.                 var bufferObj = canCreateDiscussions;
  2065.                 var data = {};
  2066.                 var prop;
  2067.                 for (prop in bufferObj) {
  2068.                   var buffer = bufferObj[prop];
  2069.                   data[prop] = buffer;
  2070.                 }
  2071.                 callback(data, null, delimiter);
  2072.               }
  2073.             }) : void callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), delimiter);
  2074.           };
  2075.           /**
  2076.            * @param {!Object} tree
  2077.            * @param {string} addr
  2078.            * @return {?}
  2079.            */
  2080.           this.getMetaCounters = function(tree, addr) {
  2081.             return setup.getInstance().hasLoggedIn() ? Array.isArray(tree) ? void exports.getInstance().getMetaCounters(this.isOpenChannel(), this.url, tree, function(identifierPositions, exisObj) {
  2082.               if (exisObj) {
  2083.                 callback(null, exisObj, addr);
  2084.               } else {
  2085.                 callback(identifierPositions, null, addr);
  2086.               }
  2087.             }) : void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), addr) : void callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), addr);
  2088.           };
  2089.           /**
  2090.            * @param {string} productInfo
  2091.            * @return {undefined}
  2092.            */
  2093.           this.getAllMetaCounters = function(productInfo) {
  2094.             if (setup.getInstance().hasLoggedIn()) {
  2095.               exports.getInstance().getAllMetaCounters(this.isOpenChannel(), this.url, function(identifierPositions, exisObj) {
  2096.                 if (exisObj) {
  2097.                   callback(null, exisObj, productInfo);
  2098.                 } else {
  2099.                   callback(identifierPositions, null, productInfo);
  2100.                 }
  2101.               });
  2102.             } else {
  2103.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), productInfo);
  2104.             }
  2105.           };
  2106.           /**
  2107.            * @param {?} data
  2108.            * @param {string} productInfo
  2109.            * @return {?}
  2110.            */
  2111.           this.deleteMetaCounter = function(data, productInfo) {
  2112.             return setup.getInstance().hasLoggedIn() ? "string" != typeof data ? void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), productInfo) : void exports.getInstance().deleteMetaCounter(this.isOpenChannel(), this.url, data, function(identifierPositions, exisObj) {
  2113.               if (exisObj) {
  2114.                 callback(null, exisObj, productInfo);
  2115.               } else {
  2116.                 callback(identifierPositions, null, productInfo);
  2117.               }
  2118.             }) : void callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), productInfo);
  2119.           };
  2120.           /**
  2121.            * @param {string} productInfo
  2122.            * @return {undefined}
  2123.            */
  2124.           this.deleteAllMetaCounters = function(productInfo) {
  2125.             if (setup.getInstance().hasLoggedIn()) {
  2126.               exports.getInstance().deleteAllMetaCounters(this.isOpenChannel(), this.url, function(identifierPositions, exisObj) {
  2127.                 if (exisObj) {
  2128.                   if (productInfo) {
  2129.                     callback(null, exisObj, productInfo);
  2130.                   }
  2131.                 } else {
  2132.                   callback(identifierPositions, null, productInfo);
  2133.                 }
  2134.               });
  2135.             } else {
  2136.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), productInfo);
  2137.             }
  2138.           };
  2139.           /**
  2140.            * @param {!Object} obj
  2141.            * @param {string} index
  2142.            * @return {?}
  2143.            */
  2144.           this.createMetaData = function(obj, index) {
  2145.             return setup.getInstance().hasLoggedIn() ? null == obj || "object" != typeof obj || Array.isArray(obj) || check(obj) ? void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), index) : void exports.getInstance().createMetaData(this.isOpenChannel(), this.url, obj, function(identifierPositions, exisObj) {
  2146.               if (exisObj) {
  2147.                 callback(null, exisObj, index);
  2148.               } else {
  2149.                 callback(identifierPositions, null, index);
  2150.               }
  2151.             }) : void callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), index);
  2152.           };
  2153.           /**
  2154.            * @param {?} data
  2155.            * @param {string} t
  2156.            * @param {?} type
  2157.            * @return {?}
  2158.            */
  2159.           this.updateMetaData = function(data, t, type) {
  2160.             return setup.getInstance().hasLoggedIn() ? ("function" != typeof t && void 0 !== type || (type = t, t = false), null == data || "object" != typeof data || Array.isArray(data) || check(data) || "boolean" != typeof t ? void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), type) : void exports.getInstance().updateMetaData(this.isOpenChannel(), this.url, data, t, function(identifierPositions, n) {
  2161.               if (n) {
  2162.                 callback(null, n, type);
  2163.               } else {
  2164.                 callback(identifierPositions, null, type);
  2165.               }
  2166.             })) : void callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), type);
  2167.           };
  2168.           /**
  2169.            * @param {!Object} text
  2170.            * @param {string} user
  2171.            * @return {?}
  2172.            */
  2173.           this.getMetaData = function(text, user) {
  2174.             return setup.getInstance().hasLoggedIn() ? Array.isArray(text) ? void exports.getInstance().getMetaData(this.isOpenChannel(), this.url, text, function(identifierPositions, exisObj) {
  2175.               if (exisObj) {
  2176.                 callback(null, exisObj, user);
  2177.               } else {
  2178.                 callback(identifierPositions, null, user);
  2179.               }
  2180.             }) : void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), user) : void callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), user);
  2181.           };
  2182.           /**
  2183.            * @param {string} productInfo
  2184.            * @return {undefined}
  2185.            */
  2186.           this.getAllMetaData = function(productInfo) {
  2187.             if (setup.getInstance().hasLoggedIn()) {
  2188.               exports.getInstance().getAllMetaData(this.isOpenChannel(), this.url, function(identifierPositions, exisObj) {
  2189.                 if (exisObj) {
  2190.                   callback(null, exisObj, productInfo);
  2191.                 } else {
  2192.                   callback(identifierPositions, null, productInfo);
  2193.                 }
  2194.               });
  2195.             } else {
  2196.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), productInfo);
  2197.             }
  2198.           };
  2199.           /**
  2200.            * @param {?} data
  2201.            * @param {string} productInfo
  2202.            * @return {?}
  2203.            */
  2204.           this.deleteMetaData = function(data, productInfo) {
  2205.             return setup.getInstance().hasLoggedIn() ? "string" != typeof data ? void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), productInfo) : void exports.getInstance().deleteMetaData(this.isOpenChannel(), this.url, data, function(identifierPositions, exisObj) {
  2206.               if (exisObj) {
  2207.                 callback(null, exisObj, productInfo);
  2208.               } else {
  2209.                 callback(identifierPositions, null, productInfo);
  2210.               }
  2211.             }) : void callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), productInfo);
  2212.           };
  2213.           /**
  2214.            * @param {string} productInfo
  2215.            * @return {undefined}
  2216.            */
  2217.           this.deleteAllMetaData = function(productInfo) {
  2218.             if (setup.getInstance().hasLoggedIn()) {
  2219.               exports.getInstance().deleteAllMetaData(this.isOpenChannel(), this.url, function(identifierPositions, exisObj) {
  2220.                 if (exisObj) {
  2221.                   if (productInfo) {
  2222.                     callback(null, exisObj, productInfo);
  2223.                   }
  2224.                 } else {
  2225.                   callback(identifierPositions, null, productInfo);
  2226.                 }
  2227.               });
  2228.             } else {
  2229.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), productInfo);
  2230.             }
  2231.           };
  2232.           /**
  2233.            * @param {!Object} obj
  2234.            * @param {string} user
  2235.            * @return {?}
  2236.            */
  2237.           this.deleteMessage = function(obj, user) {
  2238.             /** @type {!Array<?>} */
  2239.             var t = Array.prototype.slice.call(arguments);
  2240.             if (2 !== t.length) {
  2241.               return "function" == typeof t.slice(-1)[0] && (user = t.pop()), void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), user);
  2242.             }
  2243.             if (setup.getInstance().hasLoggedIn()) {
  2244.               if ("object" != typeof obj || check(obj) || Array.isArray(obj) || Object.keys(obj).indexOf("messageId") < 0 || !obj) {
  2245.                 callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), user);
  2246.               } else {
  2247.                 exports.getInstance().deleteMessage(this.isOpenChannel(), this.url, obj.messageId, function(canCreateDiscussions, endNow) {
  2248.                   callback(null, endNow || null, user);
  2249.                 });
  2250.               }
  2251.             } else {
  2252.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), user);
  2253.             }
  2254.           };
  2255.           /** @type {string} */
  2256.           this.channelType = update.CHANNEL_TYPE_BASE;
  2257.           if (data) {
  2258.             this._update(data);
  2259.           }
  2260.         };
  2261.         /** @type {string} */
  2262.         update.CHANNEL_TYPE_OPEN = "open";
  2263.         /** @type {string} */
  2264.         update.CHANNEL_TYPE_GROUP = "group";
  2265.         /** @type {string} */
  2266.         update.CHANNEL_TYPE_BASE = "base";
  2267.         /**
  2268.          * @param {undefined} data
  2269.          * @return {undefined}
  2270.          */
  2271.         var Model = function(data) {
  2272.           /**
  2273.            * @param {!Object} info
  2274.            * @return {undefined}
  2275.            */
  2276.           this.parse = function(info) {
  2277.             if (info.hasOwnProperty("participant_count") && (this.participantCount = parseInt(info.participant_count)), info.hasOwnProperty("operators") && info.operators) {
  2278.               var type;
  2279.               for (type in this.operators = [], info.operators) {
  2280.                 var new_client = new client(info.operators[type]);
  2281.                 this.operators.push(new_client);
  2282.               }
  2283.             }
  2284.           };
  2285.           /**
  2286.            * @param {string} e
  2287.            * @return {undefined}
  2288.            */
  2289.           this.refresh = function(e) {
  2290.             Model.getChannelWithoutCache(this.url, function(newPath, path) {
  2291.               if (lastTrackInfoUrl) {
  2292.                 var title = newPath;
  2293.                 newPath = path;
  2294.                 path = title;
  2295.               }
  2296.               if (path) {
  2297.                 callback(null, path, e);
  2298.               } else {
  2299.                 callback(newPath, null, e);
  2300.               }
  2301.             });
  2302.           };
  2303.           /**
  2304.            * @param {!Object} data
  2305.            * @return {undefined}
  2306.            */
  2307.           this.update = function(data) {
  2308.             this._update(data);
  2309.             this.parse(data);
  2310.           };
  2311.           /**
  2312.            * @param {string} filename
  2313.            * @return {undefined}
  2314.            */
  2315.           this.delete = function(filename) {
  2316.             var url = this.url;
  2317.             exports.getInstance().deleteOpenChannel(url, function(identifierPositions, exisObj) {
  2318.               if (exisObj) {
  2319.                 callback(null, exisObj, filename);
  2320.               } else {
  2321.                 delete Model.cachedChannels[url];
  2322.                 callback(identifierPositions, null, filename);
  2323.               }
  2324.             });
  2325.           };
  2326.           /**
  2327.            * @param {string} end
  2328.            * @return {undefined}
  2329.            */
  2330.           this.enter = function(end) {
  2331.             var validator = this;
  2332.             var newCommand = init.bEnter(validator.url);
  2333.             setup.getInstance().sendCommand(newCommand, function(canCreateDiscussions, options) {
  2334.               if (options) {
  2335.                 callback(null, new Date(options.message, options.code), end);
  2336.               } else {
  2337.                 Model.enteredChannels[validator.url] = validator;
  2338.                 callback(null, null, end);
  2339.               }
  2340.             });
  2341.           };
  2342.           /**
  2343.            * @param {string} status
  2344.            * @return {undefined}
  2345.            */
  2346.           this.exit = function(status) {
  2347.             var validator = this;
  2348.             var newCommand = init.bExit(validator.url);
  2349.             setup.getInstance().sendCommand(newCommand, function(canCreateDiscussions, options) {
  2350.               if (options) {
  2351.                 callback(null, new Date(options.message, options.code), status);
  2352.               } else {
  2353.                 delete Model.enteredChannels[validator.url];
  2354.                 callback(null, null, status);
  2355.               }
  2356.             });
  2357.           };
  2358.           /**
  2359.            * @return {?}
  2360.            */
  2361.           this.createParticipantListQuery = function() {
  2362.             return new load(load.PARTICIPANT, this);
  2363.           };
  2364.           /**
  2365.            * @return {?}
  2366.            */
  2367.           this.createMutedUserListQuery = function() {
  2368.             return new load(load.MUTED_USER, this);
  2369.           };
  2370.           /**
  2371.            * @return {?}
  2372.            */
  2373.           this.createBannedUserListQuery = function() {
  2374.             return new load(load.BANNED_USER, this);
  2375.           };
  2376.           /**
  2377.            * @return {?}
  2378.            */
  2379.           this.updateChannel = function() {
  2380.             /** @type {!Array<?>} */
  2381.             var e = Array.prototype.slice.call(arguments);
  2382.             /** @type {null} */
  2383.             var S = null;
  2384.             /** @type {null} */
  2385.             var message = null;
  2386.             /** @type {null} */
  2387.             var currentMenu = null;
  2388.             /** @type {null} */
  2389.             var rel = null;
  2390.             /** @type {null} */
  2391.             var u = null;
  2392.             /** @type {null} */
  2393.             var i = null;
  2394.             switch("function" == typeof e.slice(-1)[0] && (i = e.pop()), e.length) {
  2395.               case 3:
  2396.                 S = e[0];
  2397.                 message = e[1];
  2398.                 currentMenu = e[2];
  2399.                 break;
  2400.               case 4:
  2401.                 S = e[0];
  2402.                 message = e[1];
  2403.                 currentMenu = e[2];
  2404.                 rel = e[3];
  2405.                 break;
  2406.               case 5:
  2407.                 S = e[0];
  2408.                 message = e[1];
  2409.                 currentMenu = e[2];
  2410.                 rel = e[3];
  2411.                 u = e[4];
  2412.                 break;
  2413.               default:
  2414.                 return void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), i);
  2415.             }
  2416.             this.updateChannelWithOperatorUserIds(S, message, currentMenu, rel, u, i);
  2417.           };
  2418.           /**
  2419.            * @param {?} token
  2420.            * @param {?} data
  2421.            * @param {?} val
  2422.            * @param {?} name
  2423.            * @param {?} a
  2424.            * @param {string} b
  2425.            * @return {undefined}
  2426.            */
  2427.           this.updateChannelWithOperatorUserIds = function(token, data, val, name, a, b) {
  2428.             if ("function" == typeof a) {
  2429.               /** @type {!Function} */
  2430.               b = a;
  2431.               /** @type {null} */
  2432.               a = null;
  2433.             }
  2434.             if ("string" != typeof token && null !== token && void 0 !== token || "string" != typeof data && check(data) && null !== data && void 0 !== data || "string" != typeof val && null !== val && void 0 !== val || "string" != typeof name && !Array.isArray(name) && null !== name && void 0 !== name || "string" != typeof a && null !== a && void 0 !== a) {
  2435.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), b);
  2436.             } else {
  2437.               exports.getInstance().updateOpenChannel(this.url, token, data, val, name, a, function(item, n) {
  2438.                 if (n) {
  2439.                   callback(null, n, b);
  2440.                 } else {
  2441.                   var t = Model.upsert(item);
  2442.                   callback(t, null, b);
  2443.                 }
  2444.               });
  2445.             }
  2446.           };
  2447.           /**
  2448.            * @param {!Object} user
  2449.            * @param {number} n
  2450.            * @param {!Function} e
  2451.            * @return {undefined}
  2452.            */
  2453.           this.banUser = function(user, n, e) {
  2454.             if ("function" == typeof n && 3 !== arguments.length) {
  2455.               /** @type {number} */
  2456.               e = n;
  2457.               /** @type {number} */
  2458.               n = -1;
  2459.             }
  2460.             if (!user || "number" != typeof n || parseInt(n) < 0 && -1 !== parseInt(n)) {
  2461.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), e);
  2462.             } else {
  2463.               this.banUserWithUserId(user.userId, n, e);
  2464.             }
  2465.           };
  2466.           /**
  2467.            * @param {undefined} uid
  2468.            * @param {number} value
  2469.            * @param {!Function} width
  2470.            * @return {undefined}
  2471.            */
  2472.           this.banUserWithUserId = function(uid, value, width) {
  2473.             if ("function" == typeof value && 3 !== arguments.length) {
  2474.               /** @type {number} */
  2475.               width = value;
  2476.               /** @type {number} */
  2477.               value = -1;
  2478.             }
  2479.             if (!uid || parseInt(value) < 0 && -1 !== parseInt(value)) {
  2480.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), width);
  2481.             } else {
  2482.               exports.getInstance().banUser(this.url, uid, null, value, false, function(canCreateDiscussions, endNow) {
  2483.                 callback(null, endNow || null, width);
  2484.               });
  2485.             }
  2486.           };
  2487.           /**
  2488.            * @param {!Object} user
  2489.            * @param {string} subreddit
  2490.            * @return {undefined}
  2491.            */
  2492.           this.unbanUser = function(user, subreddit) {
  2493.             if (user) {
  2494.               this.unbanUserWithUserId(user.userId, subreddit);
  2495.             } else {
  2496.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), subreddit);
  2497.             }
  2498.           };
  2499.           /**
  2500.            * @param {boolean} sub
  2501.            * @param {string} channel
  2502.            * @return {undefined}
  2503.            */
  2504.           this.unbanUserWithUserId = function(sub, channel) {
  2505.             if (sub) {
  2506.               exports.getInstance().unbanUser(this.url, sub, false, function(canCreateDiscussions, endNow) {
  2507.                 callback(null, endNow || null, channel);
  2508.               });
  2509.             } else {
  2510.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), channel);
  2511.             }
  2512.           };
  2513.           /**
  2514.            * @param {!Object} data
  2515.            * @param {string} id
  2516.            * @return {undefined}
  2517.            */
  2518.           this.muteUser = function(data, id) {
  2519.             if (data) {
  2520.               this.muteUserWithUserId(data.userId, id);
  2521.             } else {
  2522.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), id);
  2523.             }
  2524.           };
  2525.           /**
  2526.            * @param {string} cards
  2527.            * @param {string} key
  2528.            * @return {undefined}
  2529.            */
  2530.           this.muteUserWithUserId = function(cards, key) {
  2531.             if (cards) {
  2532.               exports.getInstance().muteUser(this.url, cards, false, function(canCreateDiscussions, endNow) {
  2533.                 callback(null, endNow || null, key);
  2534.               });
  2535.             } else {
  2536.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), key);
  2537.             }
  2538.           };
  2539.           /**
  2540.            * @param {!Object} accessToken
  2541.            * @param {string} id
  2542.            * @return {undefined}
  2543.            */
  2544.           this.unmuteUser = function(accessToken, id) {
  2545.             if (accessToken) {
  2546.               this.unmuteUserWithUserId(accessToken.userId, id);
  2547.             } else {
  2548.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), id);
  2549.             }
  2550.           };
  2551.           /**
  2552.            * @param {boolean} cards
  2553.            * @param {string} key
  2554.            * @return {undefined}
  2555.            */
  2556.           this.unmuteUserWithUserId = function(cards, key) {
  2557.             if (cards) {
  2558.               exports.getInstance().unmuteUser(this.url, cards, false, function(canCreateDiscussions, endNow) {
  2559.                 callback(null, endNow || null, key);
  2560.               });
  2561.             } else {
  2562.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), key);
  2563.             }
  2564.           };
  2565.           /**
  2566.            * @param {!Object} token
  2567.            * @return {?}
  2568.            */
  2569.           this.isOperator = function(token) {
  2570.             return !!token && this.isOperatorWithUserId(token.userId);
  2571.           };
  2572.           /**
  2573.            * @param {?} userId
  2574.            * @return {?}
  2575.            */
  2576.           this.isOperatorWithUserId = function(userId) {
  2577.             var index;
  2578.             for (index in this.operators) {
  2579.               if (this.operators[index].userId === userId) {
  2580.                 return true;
  2581.               }
  2582.             }
  2583.             return false;
  2584.           };
  2585.           /** @type {string} */
  2586.           this.channelType = update.CHANNEL_TYPE_OPEN;
  2587.           /** @type {number} */
  2588.           this.participantCount = 0;
  2589.           /** @type {!Array} */
  2590.           this.operators = [];
  2591.           if (data) {
  2592.             this._update(data);
  2593.             this.parse(data);
  2594.           }
  2595.         };
  2596.         fn(update, Model);
  2597.         Model.enteredChannels = {};
  2598.         /**
  2599.          * @return {undefined}
  2600.          */
  2601.         Model.clearEnteredChannels = function() {
  2602.           Model.enteredChannels = {};
  2603.         };
  2604.         /**
  2605.          * @return {?}
  2606.          */
  2607.         Model.createOpenChannelListQuery = function() {
  2608.           return new Controller;
  2609.         };
  2610.         /**
  2611.          * @param {?} e
  2612.          * @return {?}
  2613.          */
  2614.         Model.buildFromSerializedData = function(e) {
  2615.           var data = $(e);
  2616.           return new Model({
  2617.             channel_url : data.url,
  2618.             name : data.name,
  2619.             cover_url : data.coverUrl,
  2620.             data : data.data,
  2621.             custom_type : data.customType,
  2622.             created_at : data.createdAt / 1e3,
  2623.             freeze : data.isFrozen,
  2624.             is_ephemeral : data.isEphemeral,
  2625.             participant_count : data.participantCount,
  2626.             operators : data.operators.map(function($scope) {
  2627.               return client.build($scope.userId, $scope.nickname, $scope.profileUrl, $scope.connectionStatus, $scope.lastSeenAt, $scope.metaData, $scope.isActive, $scope.friendDiscoveryKey, $scope.friendName);
  2628.             })
  2629.           });
  2630.         };
  2631.         /**
  2632.          * @return {undefined}
  2633.          */
  2634.         Model.createChannel = function() {
  2635.           var e;
  2636.           var body;
  2637.           var method;
  2638.           var value;
  2639.           var db;
  2640.           var a;
  2641.           switch(arguments.length) {
  2642.             case 1:
  2643.               a = arguments[0];
  2644.               break;
  2645.             case 4:
  2646.               e = arguments[0];
  2647.               body = arguments[1];
  2648.               method = arguments[2];
  2649.               a = arguments[3];
  2650.               break;
  2651.             case 5:
  2652.               e = arguments[0];
  2653.               body = arguments[1];
  2654.               method = arguments[2];
  2655.               value = arguments[3];
  2656.               a = arguments[4];
  2657.               break;
  2658.             case 6:
  2659.               e = arguments[0];
  2660.               body = arguments[1];
  2661.               method = arguments[2];
  2662.               value = arguments[3];
  2663.               db = arguments[4];
  2664.               a = arguments[5];
  2665.           }
  2666.           Model.createChannelWithOperatorUserIds(e, body, method, value, db, a);
  2667.         };
  2668.         /**
  2669.          * @param {?} data
  2670.          * @return {?}
  2671.          */
  2672.         Model.upsert = function(data) {
  2673.           var model = new Model(data);
  2674.           return Model.cachedChannels.hasOwnProperty(model.url) ? Model.cachedChannels[model.url].update(data) : Model.cachedChannels[model.url] = model, Model.cachedChannels[model.url];
  2675.         };
  2676.         /**
  2677.          * @param {number} e
  2678.          * @param {?} lang
  2679.          * @param {number} name
  2680.          * @param {number} data
  2681.          * @param {number} a
  2682.          * @param {!Object} b
  2683.          * @return {undefined}
  2684.          */
  2685.         Model.createChannelWithOperatorUserIds = function(e, lang, name, data, a, b) {
  2686.           if ("function" == typeof a) {
  2687.             /** @type {number} */
  2688.             b = a;
  2689.             /** @type {string} */
  2690.             a = "";
  2691.           }
  2692.           if ("string" != typeof e && null !== e && void 0 !== e || "string" != typeof lang && check(lang) && null !== lang && void 0 !== lang || "string" != typeof name && null !== name && void 0 !== name || "string" != typeof data && !Array.isArray(data) && null !== data && void 0 !== data || "string" != typeof a && null !== a && void 0 !== a) {
  2693.             callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), b);
  2694.           } else {
  2695.             exports.getInstance().createOpenChannel(e, lang, name, data, a, function(item, n) {
  2696.               if (n) {
  2697.                 callback(null, n, b);
  2698.               } else {
  2699.                 var t = Model.upsert(item);
  2700.                 callback(t, null, b);
  2701.               }
  2702.             });
  2703.           }
  2704.         };
  2705.         Model.cachedChannels = {};
  2706.         /**
  2707.          * @return {undefined}
  2708.          */
  2709.         Model.clearCache = function() {
  2710.           Model.cachedChannels = {};
  2711.         };
  2712.         /**
  2713.          * @param {?} joinModel
  2714.          * @return {undefined}
  2715.          */
  2716.         Model.removeCachedChannel = function(joinModel) {
  2717.           delete Model.cachedChannels[joinModel];
  2718.         };
  2719.         /**
  2720.          * @param {string} name
  2721.          * @param {!Function} value
  2722.          * @return {undefined}
  2723.          */
  2724.         Model.getChannel = function(name, value) {
  2725.           if (name) {
  2726.             if (Model.cachedChannels.hasOwnProperty(name)) {
  2727.               callback(Model.cachedChannels[name], null, value);
  2728.             } else {
  2729.               Model.getChannelWithoutCache(name, value);
  2730.             }
  2731.           } else {
  2732.             callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), value);
  2733.           }
  2734.         };
  2735.         /**
  2736.          * @param {string} k
  2737.          * @param {!Function} array
  2738.          * @return {undefined}
  2739.          */
  2740.         Model.getChannelWithoutCache = function(k, array) {
  2741.           if (k) {
  2742.             exports.getInstance().getOpenChannel(k, function(data, exisObj) {
  2743.               if (exisObj) {
  2744.                 callback(null, exisObj, array);
  2745.               } else {
  2746.                 Model.upsert(data);
  2747.                 callback(Model.cachedChannels[k], null, array);
  2748.               }
  2749.             });
  2750.           } else {
  2751.             callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), array);
  2752.           }
  2753.         };
  2754.         /**
  2755.          * @return {undefined}
  2756.          */
  2757.         var B = function() {
  2758.           /** @type {!Array} */
  2759.           this.channelCustomTypesFilter = [];
  2760.           /** @type {string} */
  2761.           this.superChannelFilter = link.superChannelFilter.ALL;
  2762.         };
  2763.         /**
  2764.          * @param {undefined} data
  2765.          * @return {undefined}
  2766.          */
  2767.         var link = function(data) {
  2768.           var users = {};
  2769.           /** @type {number} */
  2770.           var type = 0;
  2771.           /** @type {number} */
  2772.           var x = 0;
  2773.           /**
  2774.            * @param {!Object} data
  2775.            * @return {undefined}
  2776.            */
  2777.           this.parse = function(data) {
  2778.             var self = this;
  2779.             if (self.isDistinct = !!data.is_distinct && data.is_distinct, self.isPushEnabled = !!data.is_push_enabled && data.is_push_enabled, self.isHidden = !!data.hasOwnProperty("is_hidden") && data.is_hidden, self.myCountPreference = data.hasOwnProperty("count_preference") ? data.count_preference : link.CountPreference.ALL, self.unreadMessageCount = 0, self.unreadMentionCount = 0, log(self, parseInt(data.unread_message_count), parseInt(data.unread_mention_count)), data.hasOwnProperty("read_receipt")) {
  2780.               var container;
  2781.               for (container in self.cachedReadReceiptStatus = {}, data.read_receipt) {
  2782.                 var s = data.read_receipt[container];
  2783.                 self.updateReadReceipt(container, parseInt(s));
  2784.               }
  2785.             }
  2786.             if (data.hasOwnProperty("members")) {
  2787.               /** @type {!Array} */
  2788.               self.members = [];
  2789.               self.memberMap = {};
  2790.               data.members.forEach(function(doc) {
  2791.                 var result = new _this(doc);
  2792.                 self.members.push(result);
  2793.                 self.memberMap[result.userId] = result;
  2794.               });
  2795.             }
  2796.             if (data.hasOwnProperty("member_state")) {
  2797.               self.myMemberState = data.member_state;
  2798.             } else {
  2799.               /** @type {string} */
  2800.               self.myMemberState = "none";
  2801.             }
  2802.             if (data.hasOwnProperty("my_role")) {
  2803.               self.myRole = data.my_role || link.Role.NONE;
  2804.             } else {
  2805.               /** @type {string} */
  2806.               self.myRole = link.Role.NONE;
  2807.             }
  2808.             if (data.hasOwnProperty("is_muted")) {
  2809.               if ("string" == typeof data.is_muted) {
  2810.                 /** @type {string} */
  2811.                 self.myMutedState = data.is_muted;
  2812.               } else {
  2813.                 if ("boolean" == typeof data.is_muted) {
  2814.                   /** @type {string} */
  2815.                   self.myMutedState = data.is_muted ? "muted" : "unmuted";
  2816.                 }
  2817.               }
  2818.             } else {
  2819.               /** @type {string} */
  2820.               self.myMutedState = "unmuted";
  2821.             }
  2822.             if (data.hasOwnProperty("member_count")) {
  2823.               /** @type {number} */
  2824.               self.memberCount = parseInt(data.member_count);
  2825.             }
  2826.             if (data.hasOwnProperty("joined_member_count")) {
  2827.               /** @type {number} */
  2828.               self.joinedMemberCount = parseInt(data.joined_member_count);
  2829.             }
  2830.             if (data.hasOwnProperty("last_message") && "object" == typeof data.last_message && data.last_message) {
  2831.               if (data.last_message instanceof $) {
  2832.                 self.lastMessage = data.last_message;
  2833.               } else {
  2834.                 self.lastMessage = $.build(data.last_message, self);
  2835.               }
  2836.             } else {
  2837.               /** @type {null} */
  2838.               self.lastMessage = null;
  2839.             }
  2840.             if (data.hasOwnProperty("inviter") && null !== data.inviter && "object" == typeof data.inviter && !check(data.inviter)) {
  2841.               self.inviter = new client(data.inviter);
  2842.             } else {
  2843.               /** @type {null} */
  2844.               self.inviter = null;
  2845.             }
  2846.             if (data.hasOwnProperty("is_super") && null !== data.is_super && "boolean" == typeof data.is_super) {
  2847.               /** @type {boolean} */
  2848.               self.isSuper = data.is_super;
  2849.             } else {
  2850.               /** @type {boolean} */
  2851.               self.isSuper = false;
  2852.             }
  2853.             if (data.hasOwnProperty("is_public") && null !== data.is_public && "boolean" == typeof data.is_public) {
  2854.               /** @type {boolean} */
  2855.               self.isPublic = data.is_public;
  2856.             } else {
  2857.               /** @type {boolean} */
  2858.               self.isPublic = false;
  2859.             }
  2860.           };
  2861.           /**
  2862.            * @param {string} e
  2863.            * @return {undefined}
  2864.            */
  2865.           this.refresh = function(e) {
  2866.             link.getChannelWithoutCache(this.url, function(newPath, path) {
  2867.               if (lastTrackInfoUrl) {
  2868.                 var title = newPath;
  2869.                 newPath = path;
  2870.                 path = title;
  2871.               }
  2872.               if (path) {
  2873.                 callback(null, path, e);
  2874.               } else {
  2875.                 callback(newPath, null, e);
  2876.               }
  2877.             });
  2878.           };
  2879.           /**
  2880.            * @param {!Object} data
  2881.            * @return {undefined}
  2882.            */
  2883.           this.update = function(data) {
  2884.             this._update(data);
  2885.             this.parse(data);
  2886.           };
  2887.           /**
  2888.            * @return {?}
  2889.            */
  2890.           this.updateChannel = function() {
  2891.             /** @type {!Array<?>} */
  2892.             var a = Array.prototype.slice.call(arguments);
  2893.             /** @type {null} */
  2894.             var t = null;
  2895.             /** @type {null} */
  2896.             var name = null;
  2897.             /** @type {null} */
  2898.             var val = null;
  2899.             /** @type {null} */
  2900.             var data = null;
  2901.             /** @type {null} */
  2902.             var value = null;
  2903.             /** @type {null} */
  2904.             var productInfo = null;
  2905.             /** @type {null} */
  2906.             var result = null;
  2907.             switch("function" == typeof a.slice(-1)[0] && (productInfo = a.pop()), a.length) {
  2908.               case 1:
  2909.                 if (!(a[0] instanceof render)) {
  2910.                   return void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), productInfo);
  2911.                 }
  2912.                 var el = a[0];
  2913.                 t = el.isDistinct;
  2914.                 name = el.name;
  2915.                 val = el.channelCover;
  2916.                 data = el.data;
  2917.                 value = el.customType;
  2918.                 result = el.isPublic;
  2919.                 break;
  2920.               case 3:
  2921.                 t = this.isDistinct;
  2922.                 name = a[0];
  2923.                 val = a[1];
  2924.                 data = a[2];
  2925.                 break;
  2926.               case 4:
  2927.                 t = a[0];
  2928.                 name = a[1];
  2929.                 val = a[2];
  2930.                 data = a[3];
  2931.                 break;
  2932.               case 5:
  2933.                 t = a[0];
  2934.                 name = a[1];
  2935.                 val = a[2];
  2936.                 data = a[3];
  2937.                 value = a[4];
  2938.                 break;
  2939.               default:
  2940.                 return void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), productInfo);
  2941.             }
  2942.             if ("string" != typeof name && null !== name && void 0 !== name || "string" != typeof val && check(val) && null !== val && void 0 !== val || "string" != typeof data && null !== data && void 0 !== data || "boolean" != typeof t && null !== t || "boolean" != typeof result && null !== result || "string" != typeof value && null !== value && void 0 !== value) {
  2943.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), productInfo);
  2944.             } else {
  2945.               exports.getInstance().updateGroupChannel(this.url, t, name, val, data, value, result, function(item, n) {
  2946.                 if (n) {
  2947.                   callback(null, n, productInfo);
  2948.                 } else {
  2949.                   var t = link.upsert(item);
  2950.                   callback(t, null, productInfo);
  2951.                 }
  2952.               });
  2953.             }
  2954.           };
  2955.           /**
  2956.            * @param {string} productInfo
  2957.            * @return {undefined}
  2958.            */
  2959.           this.resetMyHistory = function(productInfo) {
  2960.             if (setup.getInstance().hasLoggedIn()) {
  2961.               exports.getInstance().resetMyHistory(this.url, function(identifierPositions, exisObj) {
  2962.                 if (exisObj) {
  2963.                   callback(null, exisObj, productInfo);
  2964.                 } else {
  2965.                   callback(identifierPositions, null, productInfo);
  2966.                 }
  2967.               });
  2968.             } else {
  2969.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), productInfo);
  2970.             }
  2971.           };
  2972.           /**
  2973.            * @param {string} user
  2974.            * @param {string} request
  2975.            * @return {undefined}
  2976.            */
  2977.           this.invite = function(user, request) {
  2978.             if ("string" == typeof user && (user = [{
  2979.               userId : user
  2980.             }]), Array.isArray(user) && !check(user)) {
  2981.               /** @type {!Array} */
  2982.               var todos = [];
  2983.               var i;
  2984.               for (i in user) {
  2985.                 if ("object" != typeof user[i] || check(user[i])) {
  2986.                   callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), request);
  2987.                   break;
  2988.                 }
  2989.                 todos.push(user[i].userId);
  2990.               }
  2991.               this.inviteWithUserIds(todos, request);
  2992.             } else {
  2993.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), request);
  2994.             }
  2995.           };
  2996.           /**
  2997.            * @param {!Object} value
  2998.            * @param {string} username
  2999.            * @return {undefined}
  3000.            */
  3001.           this.inviteWithUserIds = function(value, username) {
  3002.             if (Array.isArray(value) && !check(value)) {
  3003.               exports.getInstance().groupChannelInvite(this.url, value, function(data, exisObj) {
  3004.                 if (exisObj) {
  3005.                   callback(null, exisObj, username);
  3006.                 } else {
  3007.                   var s = link.upsert(data);
  3008.                   callback(s, null, username);
  3009.                 }
  3010.               });
  3011.             } else {
  3012.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), username);
  3013.             }
  3014.           };
  3015.           /**
  3016.            * @param {string} token
  3017.            * @return {undefined}
  3018.            */
  3019.           this.acceptInvitation = function(token) {
  3020.             exports.getInstance().acceptInvitation(this.url, setup.getInstance().getCurrentUserId(), function(data, exisObj) {
  3021.               if (exisObj) {
  3022.                 callback(null, exisObj, token);
  3023.               } else {
  3024.                 var opts = link.upsert(data);
  3025.                 /** @type {string} */
  3026.                 opts.myMemberState = "joined";
  3027.                 link.cachedChannels[opts.url] = opts;
  3028.                 callback(opts, null, token);
  3029.               }
  3030.             });
  3031.           };
  3032.           /**
  3033.            * @param {string} productInfo
  3034.            * @return {undefined}
  3035.            */
  3036.           this.declineInvitation = function(productInfo) {
  3037.             var options = this;
  3038.             exports.getInstance().declineInvitation(this.url, setup.getInstance().getCurrentUserId(), function(identifierPositions, exisObj) {
  3039.               if (exisObj) {
  3040.                 callback(null, exisObj, productInfo);
  3041.               } else {
  3042.                 /** @type {string} */
  3043.                 options.myMemberState = "none";
  3044.                 link.cachedChannels[options.url] = options;
  3045.                 if (!options.isPublic) {
  3046.                   link.removeCachedChannel(options.url);
  3047.                 }
  3048.                 callback(identifierPositions, null, productInfo);
  3049.               }
  3050.             });
  3051.           };
  3052.           /**
  3053.            * @param {?} e
  3054.            * @param {string} c
  3055.            * @return {undefined}
  3056.            */
  3057.           this.hide = function(e, c) {
  3058.             if (1 === arguments.length && "function" == typeof e && (c = e, e = false), null !== e && void 0 !== e || (e = false), "boolean" == typeof e) {
  3059.               var name = this.url;
  3060.               var hyperlinkTip = this;
  3061.               exports.getInstance().groupChannelHide(name, setup.getInstance().getCurrentUserId(), e, function(identifierPositions, exisObj) {
  3062.                 if (exisObj) {
  3063.                   callback(null, exisObj, c);
  3064.                 } else {
  3065.                   /** @type {boolean} */
  3066.                   hyperlinkTip.isHidden = true;
  3067.                   var resource = link.cachedChannels[name];
  3068.                   if (resource) {
  3069.                     /** @type {boolean} */
  3070.                     resource.isHidden = true;
  3071.                     if (e) {
  3072.                       log(resource, 0, 0);
  3073.                     }
  3074.                     link.cachedChannels[name] = resource;
  3075.                   }
  3076.                   callback(identifierPositions, null, c);
  3077.                 }
  3078.               });
  3079.             } else {
  3080.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), c);
  3081.             }
  3082.           };
  3083.           /**
  3084.            * @param {string} metadata
  3085.            * @return {undefined}
  3086.            */
  3087.           this.join = function(metadata) {
  3088.             var url = this.url;
  3089.             exports.getInstance().publicGroupChannelJoin(url, setup.getInstance().getCurrentUserId(), function(data, exisObj) {
  3090.               if (exisObj) {
  3091.                 callback(null, exisObj, metadata);
  3092.               } else {
  3093.                 var opts = link.upsert(data);
  3094.                 /** @type {string} */
  3095.                 opts.myMemberState = "joined";
  3096.                 link.cachedChannels[opts.url] = opts;
  3097.                 callback(opts, null, metadata);
  3098.               }
  3099.             });
  3100.           };
  3101.           /**
  3102.            * @param {string} username
  3103.            * @return {undefined}
  3104.            */
  3105.           this.leave = function(username) {
  3106.             var url = this.url;
  3107.             exports.getInstance().groupChannelLeave(url, setup.getInstance().getCurrentUserId(), function(n, endNow) {
  3108.               callback(null, endNow || null, username);
  3109.             });
  3110.           };
  3111.           /**
  3112.            * @return {undefined}
  3113.            */
  3114.           this.markAsRead = function() {
  3115.             this._sendMarkAsRead(null);
  3116.           };
  3117.           /**
  3118.            * @param {string} e
  3119.            * @return {undefined}
  3120.            */
  3121.           this._sendMarkAsRead = function(e) {
  3122.             var self = this;
  3123.             var newCommand = init.bRead(self.url);
  3124.             setup.getInstance().sendCommand(newCommand, function(canCreateDiscussions, options) {
  3125.               if (options) {
  3126.                 callback(null, new Date(options.message, options.code), e);
  3127.               } else {
  3128.                 if (self.unreadMessageCount > 0 || self.unreadMentionCount > 0) {
  3129.                   var indexLookupKey;
  3130.                   for (indexLookupKey in log(self, 0, 0), setup.getInstance().channelHandlers) {
  3131.                     setup.getInstance().channelHandlers[indexLookupKey].onChannelChanged(self);
  3132.                   }
  3133.                 }
  3134.                 callback(null, null, e);
  3135.               }
  3136.             });
  3137.           };
  3138.           /**
  3139.            * @param {!Object} options
  3140.            * @return {?}
  3141.            */
  3142.           this.getReadReceipt = function(options) {
  3143.             if (!(options instanceof $)) {
  3144.               return console.log("message is not BaseMessage instance"), -1;
  3145.             }
  3146.             if (options.messageType === $.MESSAGE_TYPE_ADMIN) {
  3147.               return 0;
  3148.             }
  3149.             var user = setup.getInstance().currentUser;
  3150.             /** @type {number} */
  3151.             var variable = 0;
  3152.             var date = options.createdAt;
  3153.             var members = this.members;
  3154.             var property;
  3155.             for (property in members) {
  3156.               var member = members[property];
  3157.               var id = member.userId;
  3158.               if (!(user.userId === id || options.sender && options.sender.userId === id)) {
  3159.                 if (this.cachedReadReceiptStatus[id] < date) {
  3160.                   variable++;
  3161.                 }
  3162.               }
  3163.             }
  3164.             return this.isSuper ? 0 : variable;
  3165.           };
  3166.           /**
  3167.            * @return {?}
  3168.            */
  3169.           this.getReadStatus = function() {
  3170.             var loads = {};
  3171.             if (!setup.getInstance().currentUser) {
  3172.               return loads;
  3173.             }
  3174.             var members = this.members;
  3175.             var property;
  3176.             for (property in members) {
  3177.               var member = members[property];
  3178.               var id = member.userId;
  3179.               if (member.userId !== setup.getInstance().getCurrentUserId()) {
  3180.                 var a = this.cachedReadReceiptStatus[id];
  3181.                 loads[id] = {
  3182.                   user : member,
  3183.                   last_seen_at : parseInt(a)
  3184.                 };
  3185.               }
  3186.             }
  3187.             return loads;
  3188.           };
  3189.           /**
  3190.            * @param {string} i
  3191.            * @param {number} eof
  3192.            * @return {undefined}
  3193.            */
  3194.           this.updateReadReceipt = function(i, eof) {
  3195.             /** @type {string} */
  3196.             var t = i;
  3197.             var subtreeId = this.cachedReadReceiptStatus[t];
  3198.             /** @type {number} */
  3199.             var id = eof;
  3200.             if (!subtreeId || subtreeId < id) {
  3201.               this.cachedReadReceiptStatus[t] = id;
  3202.             }
  3203.           };
  3204.           /**
  3205.            * @return {undefined}
  3206.            */
  3207.           this.startTyping = function() {
  3208.             /** @type {number} */
  3209.             var xMax = (new Date).getTime();
  3210.             var width = setup.getInstance().Options.typingIndicatorThrottle;
  3211.             if (("number" != typeof width || width < 1e3 || width > 9e3) && (width = 1e3), xMax - type >= width) {
  3212.               /** @type {number} */
  3213.               x = 0;
  3214.               /** @type {number} */
  3215.               type = xMax;
  3216.               var url = init.bTypeStart(this.url, type);
  3217.               setup.getInstance().sendCommand(url, null);
  3218.             }
  3219.           };
  3220.           /**
  3221.            * @return {undefined}
  3222.            */
  3223.           this.endTyping = function() {
  3224.             /** @type {number} */
  3225.             var prevX = (new Date).getTime();
  3226.             var right = setup.getInstance().Options.typingIndicatorThrottle;
  3227.             if (("number" != typeof right || right < 1e3 || right > 9e3) && (right = 1e3), prevX - x >= right) {
  3228.               /** @type {number} */
  3229.               type = 0;
  3230.               /** @type {number} */
  3231.               x = prevX;
  3232.               var url = init.bTypeEnd(this.url, x);
  3233.               setup.getInstance().sendCommand(url, null);
  3234.             }
  3235.           };
  3236.           /**
  3237.            * @return {?}
  3238.            */
  3239.           this.invalidateTypingStatus = function() {
  3240.             /** @type {boolean} */
  3241.             var e = false;
  3242.             /** @type {number} */
  3243.             var curt = (new Date).getTime();
  3244.             var name;
  3245.             for (name in users) {
  3246.               if (curt - users[name] >= 1e4) {
  3247.                 delete users[name];
  3248.                 /** @type {boolean} */
  3249.                 e = true;
  3250.               }
  3251.             }
  3252.             return e;
  3253.           };
  3254.           /**
  3255.            * @param {!Object} post
  3256.            * @param {boolean} mark_deleted
  3257.            * @return {undefined}
  3258.            */
  3259.           this.updateTypingStatus = function(post, mark_deleted) {
  3260.             if (mark_deleted) {
  3261.               /** @type {number} */
  3262.               users[post.userId] = (new Date).getTime();
  3263.             } else {
  3264.               delete users[post.userId];
  3265.             }
  3266.           };
  3267.           /**
  3268.            * @return {?}
  3269.            */
  3270.           this.isTyping = function() {
  3271.             return 0 !== Object.keys(users).length;
  3272.           };
  3273.           /**
  3274.            * @return {?}
  3275.            */
  3276.           this.getTypingMembers = function() {
  3277.             /** @type {!Array} */
  3278.             var currentMaxTerms = [];
  3279.             var i;
  3280.             for (i in users) {
  3281.               var j = this.memberMap[i];
  3282.               if (this.memberMap[i]) {
  3283.                 currentMaxTerms.push(j);
  3284.               }
  3285.             }
  3286.             return currentMaxTerms;
  3287.           };
  3288.           /**
  3289.            * @param {!Object} data
  3290.            * @return {undefined}
  3291.            */
  3292.           this.addMember = function(data) {
  3293.             if (!this.isSuper) {
  3294.               var e = this.removeMember(data);
  3295.               if (e && e.state === _this.JOINED) {
  3296.                 /** @type {string} */
  3297.                 data.state = _this.JOINED;
  3298.               }
  3299.               /** @type {!Object} */
  3300.               this.memberMap[data.userId] = data;
  3301.               this.members.push(data);
  3302.               this.memberCount++;
  3303.               this.updateReadReceipt(data.userId, 0);
  3304.             }
  3305.           };
  3306.           /**
  3307.            * @param {!Object} message
  3308.            * @return {?}
  3309.            */
  3310.           this.removeMember = function(message) {
  3311.             /** @type {null} */
  3312.             var change = null;
  3313.             if (!this.isSuper) {
  3314.               var uid = message.userId;
  3315.               if (this.memberMap.hasOwnProperty(message.userId)) {
  3316.                 var i;
  3317.                 for (i in delete this.memberMap[message.userId], this.members) {
  3318.                   var d = this.members[i];
  3319.                   if (d.userId === uid) {
  3320.                     change = d;
  3321.                     this.members.splice(i, 1);
  3322.                     break;
  3323.                   }
  3324.                 }
  3325.                 this.memberCount--;
  3326.               }
  3327.             }
  3328.             return change;
  3329.           };
  3330.           /**
  3331.            * @return {undefined}
  3332.            */
  3333.           this.updateJoinedMemberCount = function() {
  3334.             if (!this.isSuper) {
  3335.               /** @type {number} */
  3336.               var e = 0;
  3337.               var length = this.members.length;
  3338.               /** @type {number} */
  3339.               var i = 0;
  3340.               for (; i < length; i++) {
  3341.                 if (this.members[i].state === _this.JOINED) {
  3342.                   e++;
  3343.                 }
  3344.               }
  3345.               /** @type {number} */
  3346.               this.joinedMemberCount = e;
  3347.             }
  3348.           };
  3349.           /** @type {number} */
  3350.           var realWidth = 0;
  3351.           /**
  3352.            * @param {number} s
  3353.            * @param {number} index
  3354.            * @param {number} width
  3355.            * @return {undefined}
  3356.            */
  3357.           this.setLatestMemberCount = function(s, index, width) {
  3358.             if ("number" == typeof s && "number" == typeof index && "number" == typeof width && width >= realWidth) {
  3359.               /** @type {number} */
  3360.               realWidth = width;
  3361.               /** @type {number} */
  3362.               this.memberCount = s;
  3363.               /** @type {number} */
  3364.               this.joinedMemberCount = index;
  3365.             }
  3366.           };
  3367.           /**
  3368.            * @param {string} data
  3369.            * @param {string} productInfo
  3370.            * @return {undefined}
  3371.            */
  3372.           this.setPushPreference = function(data, productInfo) {
  3373.             var options = this;
  3374.             if (setup.getInstance().hasLoggedIn()) {
  3375.               exports.getInstance().setPushPreference(setup.getInstance().getCurrentUserId(), this.url, data, function(entry, exisObj) {
  3376.                 if (exisObj) {
  3377.                   callback(null, exisObj, productInfo);
  3378.                 } else {
  3379.                   options.isPushEnabled = entry.enable;
  3380.                   callback(entry, null, productInfo);
  3381.                 }
  3382.               });
  3383.             } else {
  3384.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), productInfo);
  3385.             }
  3386.           };
  3387.           /**
  3388.            * @param {string} productInfo
  3389.            * @return {undefined}
  3390.            */
  3391.           this.getPushPreference = function(productInfo) {
  3392.             var rayleigh = this;
  3393.             if (setup.getInstance().hasLoggedIn()) {
  3394.               exports.getInstance().getPushPreference(setup.getInstance().getCurrentUserId(), this.url, function(thumb, exisObj) {
  3395.                 if (exisObj) {
  3396.                   callback(null, exisObj, productInfo);
  3397.                 } else {
  3398.                   if (productInfo) {
  3399.                     var value;
  3400.                     try {
  3401.                       value = thumb.enable;
  3402.                     } catch (e) {
  3403.                       /** @type {boolean} */
  3404.                       value = false;
  3405.                     }
  3406.                     rayleigh.isPushEnabled = value;
  3407.                     callback(value, null, productInfo);
  3408.                   }
  3409.                 }
  3410.               });
  3411.             } else {
  3412.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), productInfo);
  3413.             }
  3414.           };
  3415.           /**
  3416.            * @param {?} options
  3417.            * @param {string} childCompute
  3418.            * @return {undefined}
  3419.            */
  3420.           this.setMyCountPreference = function(options, childCompute) {
  3421.             if (setup.getInstance().hasLoggedIn()) {
  3422.               if ([link.CountPreference.ALL, link.CountPreference.UNREAD_MESSAGE_COUNT_ONLY, link.CountPreference.UNREAD_MENTION_COUNT_ONLY, link.CountPreference.OFF].indexOf(options) < 0) {
  3423.                 callback(null, new Date("Invalid parameters.", concat.INVALID_PARAMETER), childCompute);
  3424.               } else {
  3425.                 var self = this;
  3426.                 exports.getInstance().setCountPreference(setup.getInstance().getCurrentUserId(), this.url, options, function(PeerJS, exisObj) {
  3427.                   if (exisObj) {
  3428.                     callback(null, exisObj, childCompute);
  3429.                   } else {
  3430.                     self.myCountPreference = PeerJS.count_preference;
  3431.                     log(self, self.unreadMessageCount, self.unreadMentionCount);
  3432.                     callback(self.myCountPreference, null, childCompute);
  3433.                   }
  3434.                 });
  3435.               }
  3436.             } else {
  3437.               callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), childCompute);
  3438.             }
  3439.           };
  3440.           /**
  3441.            * @return {?}
  3442.            */
  3443.           this.createMemberListQuery = function() {
  3444.             var url = this.url;
  3445.             return new reset(url);
  3446.           };
  3447.           /**
  3448.            * @param {!Object} user
  3449.            * @param {number} callback
  3450.            * @param {!Function} data
  3451.            * @param {!Function} e
  3452.            * @return {undefined}
  3453.            */
  3454.           this.banUser = function(user, callback, data, e) {
  3455.             if (user && user.hasOwnProperty("userId") && "string" == typeof data) {
  3456.               this.banUserWithUserId(user.userId, callback, data, e);
  3457.             } else {
  3458.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), e);
  3459.             }
  3460.           };
  3461.           /**
  3462.            * @param {boolean} target
  3463.            * @param {number} fn
  3464.            * @param {!Function} err
  3465.            * @param {string} head
  3466.            * @return {undefined}
  3467.            */
  3468.           this.banUserWithUserId = function(target, fn, err, head) {
  3469.             if (target && "string" == typeof target && "string" == typeof err) {
  3470.               exports.getInstance().banUser(this.url, target, err, fn, true, function(canCreateDiscussions, endNow) {
  3471.                 callback(null, endNow || null, head);
  3472.               });
  3473.             } else {
  3474.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), head);
  3475.             }
  3476.           };
  3477.           /**
  3478.            * @param {!Object} user
  3479.            * @param {string} subject
  3480.            * @return {undefined}
  3481.            */
  3482.           this.unbanUser = function(user, subject) {
  3483.             if (user && user.hasOwnProperty("userId")) {
  3484.               this.unbanUserWithUserId(user.userId, subject);
  3485.             } else {
  3486.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), subject);
  3487.             }
  3488.           };
  3489.           /**
  3490.            * @param {boolean} target
  3491.            * @param {string} channel
  3492.            * @return {undefined}
  3493.            */
  3494.           this.unbanUserWithUserId = function(target, channel) {
  3495.             if (target && "string" == typeof target) {
  3496.               exports.getInstance().unbanUser(this.url, target, true, function(canCreateDiscussions, endNow) {
  3497.                 callback(null, endNow || null, channel);
  3498.               });
  3499.             } else {
  3500.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), channel);
  3501.             }
  3502.           };
  3503.           /**
  3504.            * @param {!Object} data
  3505.            * @param {string} id
  3506.            * @return {undefined}
  3507.            */
  3508.           this.muteUser = function(data, id) {
  3509.             if (data && data.hasOwnProperty("userId")) {
  3510.               this.muteUserWithUserId(data.userId, id);
  3511.             } else {
  3512.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), id);
  3513.             }
  3514.           };
  3515.           /**
  3516.            * @param {string} fn
  3517.            * @param {string} n
  3518.            * @return {undefined}
  3519.            */
  3520.           this.muteUserWithUserId = function(fn, n) {
  3521.             if (fn && "string" == typeof fn) {
  3522.               exports.getInstance().muteUser(this.url, fn, true, function(canCreateDiscussions, endNow) {
  3523.                 callback(null, endNow || null, n);
  3524.               });
  3525.             } else {
  3526.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), n);
  3527.             }
  3528.           };
  3529.           /**
  3530.            * @param {!Object} socket
  3531.            * @param {string} id
  3532.            * @return {undefined}
  3533.            */
  3534.           this.unmuteUser = function(socket, id) {
  3535.             if (socket && socket.hasOwnProperty("userId")) {
  3536.               this.unmuteUserWithUserId(socket.userId, id);
  3537.             } else {
  3538.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), id);
  3539.             }
  3540.           };
  3541.           /**
  3542.            * @param {boolean} fn
  3543.            * @param {string} n
  3544.            * @return {undefined}
  3545.            */
  3546.           this.unmuteUserWithUserId = function(fn, n) {
  3547.             if (fn && "string" == typeof fn) {
  3548.               exports.getInstance().unmuteUser(this.url, fn, true, function(canCreateDiscussions, endNow) {
  3549.                 callback(null, endNow || null, n);
  3550.               });
  3551.             } else {
  3552.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), n);
  3553.             }
  3554.           };
  3555.           /**
  3556.            * @param {boolean} value
  3557.            * @return {undefined}
  3558.            */
  3559.           this.freeze = function(value) {
  3560.             exports.getInstance().freeze(this.url, true, true, function(data, exisObj) {
  3561.               if (exisObj) {
  3562.                 callback(null, exisObj, value);
  3563.               } else {
  3564.                 link.upsert(data);
  3565.                 callback(null, null, value);
  3566.               }
  3567.             });
  3568.           };
  3569.           /**
  3570.            * @param {string} value
  3571.            * @return {undefined}
  3572.            */
  3573.           this.unfreeze = function(value) {
  3574.             exports.getInstance().freeze(this.url, true, false, function(data, exisObj) {
  3575.               if (exisObj) {
  3576.                 callback(null, exisObj, value);
  3577.               } else {
  3578.                 link.upsert(data);
  3579.                 callback(null, null, value);
  3580.               }
  3581.             });
  3582.           };
  3583.           /**
  3584.            * @return {?}
  3585.            */
  3586.           this.createBannedUserListQuery = function() {
  3587.             return new load(load.BANNED_USER, this);
  3588.           };
  3589.           /** @type {string} */
  3590.           this.channelType = update.CHANNEL_TYPE_GROUP;
  3591.           /** @type {boolean} */
  3592.           this.isDistinct = false;
  3593.           /** @type {boolean} */
  3594.           this.isSuper = false;
  3595.           /** @type {boolean} */
  3596.           this.isPublic = false;
  3597.           /** @type {number} */
  3598.           this.unreadMessageCount = 0;
  3599.           /** @type {null} */
  3600.           this.inviter = null;
  3601.           /** @type {!Array} */
  3602.           this.members = [];
  3603.           this.memberMap = {};
  3604.           this.lastMessage = {};
  3605.           /** @type {number} */
  3606.           this.memberCount = 0;
  3607.           /** @type {number} */
  3608.           this.joinedMemberCount = 0;
  3609.           this.cachedReadReceiptStatus = {};
  3610.           this.isPushEnabled;
  3611.           /** @type {boolean} */
  3612.           this.isHidden = false;
  3613.           if (data) {
  3614.             this._update(data);
  3615.             this.parse(data);
  3616.           }
  3617.         };
  3618.         fn(update, link);
  3619.         /**
  3620.          * @param {?} window
  3621.          * @return {?}
  3622.          */
  3623.         link.buildFromSerializedData = function(window) {
  3624.           var self = $(window);
  3625.           return new link({
  3626.             channel_url : self.url,
  3627.             name : self.name,
  3628.             cover_url : self.coverUrl,
  3629.             data : self.data,
  3630.             custom_type : self.customType,
  3631.             created_at : self.createdAt / 1e3,
  3632.             is_distinct : self.isDistinct,
  3633.             is_super : self.isSuper,
  3634.             is_public : self.isPublic,
  3635.             freeze : self.isFrozen,
  3636.             is_ephemeral : self.isEphemeral,
  3637.             unread_message_count : self.unreadMessageCount,
  3638.             unread_mention_count : self.unreadMentionCount,
  3639.             is_push_enabled : self.isPushEnabled,
  3640.             count_preference : self.myCountPreference,
  3641.             is_hidden : self.isHidden,
  3642.             member_count : self.memberCount,
  3643.             joined_member_count : self.joinedMemberCount,
  3644.             member_state : self.myMemberState,
  3645.             my_role : self.myRole,
  3646.             is_muted : self.myMutedState,
  3647.             members : self.members.map(function($scope) {
  3648.               return _this.build(client.build($scope.userId, $scope.nickname, $scope.profileUrl, $scope.connectionStatus, $scope.lastSeenAt, $scope.metaData, $scope.isActive, $scope.friendDiscoveryKey, $scope.friendName), $scope.state, $scope.isBlockedByMe, $scope.isBlockingMe);
  3649.             }),
  3650.             last_message : function(options) {
  3651.               return null !== options && void 0 !== options && "object" == typeof options ? options.messageType === $.MESSAGE_TYPE_USER ? new self(self.build(options.reqId, options.messageId, options.sender, {
  3652.                 url : options.channelUrl,
  3653.                 channelType : options.channelType
  3654.               }, options.message, options.data, options.customType, options.translations, options.createdAt, options.updatedAt, options.mentionType, options.mentionedUsers)) : options.messageType === $.MESSAGE_TYPE_FILE ? new test(test.build(options.reqId, options.messageId, options.sender, {
  3655.                 url : options.channelUrl,
  3656.                 channelType : options.channelType
  3657.               }, options.url, options.name, options.type, options.size, options.data, options.customType, options.createdAt, options.thumbnails, options.requireAuth, options.updatedAt, options.mentionType, options.mentionedUsers)) : new logger(logger.build(options.messageId, {
  3658.                 url : options.channelUrl,
  3659.                 channelType : options.channelType
  3660.               }, options.message, options.data, options.customType, options.translations, options.createdAt, options.updatedAt, options.mentionType, options.mentionedUsers)) : null;
  3661.             }(self.lastMessage),
  3662.             read_receipt : self.cachedReadReceiptStatus,
  3663.             inviter : null !== self.inviter && void 0 !== self.inviter && "object" == typeof self.inviter ? client.build(self.inviter.userId, self.inviter.nickname, self.inviter.profileUrl, self.inviter.connectionStatus, self.inviter.lastSeenAt, self.inviter.metaData, self.inviter.isActive, self.inviter.friendDiscoveryKey, self.inviter.friendName) : null
  3664.           });
  3665.         };
  3666.         /**
  3667.          * @return {?}
  3668.          */
  3669.         link.createMyGroupChannelListQuery = function() {
  3670.           return new Context(setup.getInstance().currentUser);
  3671.         };
  3672.         /**
  3673.          * @return {?}
  3674.          */
  3675.         link.createPublicGroupChannelListQuery = function() {
  3676.           return new iterator;
  3677.         };
  3678.         link.memberState = {
  3679.           ALL : 0,
  3680.           JOINED : 1,
  3681.           INVITED : 2,
  3682.           INVITED_BY_FRIEND : 3,
  3683.           INVITED_BY_NON_FRIEND : 4
  3684.         };
  3685.         link.memberStateFilter = {
  3686.           ALL : "all",
  3687.           JOINED : "joined_only",
  3688.           INVITED : "invited_only",
  3689.           INVITED_BY_FRIEND : "invited_by_friend",
  3690.           INVITED_BY_NON_FRIEND : "invited_by_non_friend"
  3691.         };
  3692.         link.superChannelFilter = {
  3693.           ALL : "all",
  3694.           SUPER : "super",
  3695.           NON_SUPER : "nonsuper"
  3696.         };
  3697.         link.publicChannelFilter = {
  3698.           ALL : "all",
  3699.           PUBLIC : "public",
  3700.           PRIVATE : "private"
  3701.         };
  3702.         link.Role = {
  3703.           OPERATOR : "operator",
  3704.           NONE : "none"
  3705.         };
  3706.         link.UnreadItemKey = {
  3707.           GROUP_CHANNEL_UNREAD_MENTION_COUNT : "group_channel_unread_mention_count",
  3708.           NONSUPER_UNREAD_MENTION_COUNT : "non_super_group_channel_unread_mention_count",
  3709.           SUPER_UNREAD_MENTION_COUNT : "super_group_channel_unread_mention_count",
  3710.           GROUP_CHANNEL_UNREAD_MESSAGE_COUNT : "group_channel_unread_message_count",
  3711.           NONSUPER_UNREAD_MESSAGE_COUNT : "non_super_group_channel_unread_message_count",
  3712.           SUPER_UNREAD_MESSAGE_COUNT : "super_group_channel_unread_message_count",
  3713.           GROUP_CHANNEL_INVITATION_COUNT : "group_channel_invitation_count",
  3714.           NONSUPER_INVITATION_COUNT : "non_super_group_channel_invitation_count",
  3715.           SUPER_INVITATION_COUNT : "super_group_channel_invitation_count"
  3716.         };
  3717.         link.CountPreference = {
  3718.           ALL : "all",
  3719.           UNREAD_MESSAGE_COUNT_ONLY : "unread_message_count_only",
  3720.           UNREAD_MENTION_COUNT_ONLY : "unread_mention_count_only",
  3721.           OFF : "off"
  3722.         };
  3723.         /**
  3724.          * @param {number} d
  3725.          * @param {undefined} data
  3726.          * @return {?}
  3727.          */
  3728.         link.getChannelCount = function(d, data) {
  3729.           return "function" == typeof d && 1 === arguments.length && (data = d, d = link.memberState.ALL), d !== link.memberState.ALL && d !== link.memberState.JOINED && d !== link.memberState.INVITED && d !== link.memberState.INVITED_BY_FRIEND && d !== link.memberState.INVITED_BY_NON_FRIEND ? void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), data) : setup.getInstance().hasLoggedIn() ? void exports.getInstance().getGroupChannelCount(setup.getInstance().getCurrentUserId(),
  3730.           d, function(mainPost, exisObj) {
  3731.             if (exisObj) {
  3732.               callback(null, exisObj, data);
  3733.             } else {
  3734.               /** @type {number} */
  3735.               var s = parseInt(mainPost.group_channel_count);
  3736.               callback(s, null, data);
  3737.             }
  3738.           }) : void(data && callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), data));
  3739.         };
  3740.         /**
  3741.          * @param {!Array} cards
  3742.          * @param {string} status
  3743.          * @return {?}
  3744.          */
  3745.         link.getUnreadItemCount = function(cards, status) {
  3746.           if (!Array.isArray(cards) || cards.length < 1) {
  3747.             callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), status);
  3748.           } else {
  3749.             /** @type {number} */
  3750.             var i = 0;
  3751.             for (; i < cards.length; i++) {
  3752.               if ([link.UnreadItemKey.SUPER_UNREAD_MESSAGE_COUNT, link.UnreadItemKey.NONSUPER_UNREAD_MESSAGE_COUNT, link.UnreadItemKey.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT, link.UnreadItemKey.SUPER_UNREAD_MENTION_COUNT, link.UnreadItemKey.NONSUPER_UNREAD_MENTION_COUNT, link.UnreadItemKey.GROUP_CHANNEL_UNREAD_MENTION_COUNT, link.UnreadItemKey.SUPER_INVITATION_COUNT, link.UnreadItemKey.NONSUPER_INVITATION_COUNT, link.UnreadItemKey.GROUP_CHANNEL_INVITATION_COUNT].indexOf(cards[i]) < 0) {
  3753.                 return void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), status);
  3754.               }
  3755.             }
  3756.             var uncert = cards.filter(function(i, match) {
  3757.               return cards.indexOf(i) === match;
  3758.             });
  3759.             exports.getInstance().getUnreadItemCount(setup.getInstance().getCurrentUserId(), uncert, function(identifierPositions, exisObj) {
  3760.               if (exisObj) {
  3761.                 callback(null, exisObj, status);
  3762.               } else {
  3763.                 callback(identifierPositions, null, status);
  3764.               }
  3765.             });
  3766.           }
  3767.         };
  3768.         /**
  3769.          * @param {string} c
  3770.          * @param {string} d
  3771.          * @return {undefined}
  3772.          */
  3773.         link.getTotalUnreadMessageCount = function(c, d) {
  3774.           if ("function" == typeof c) {
  3775.             /** @type {string} */
  3776.             d = c;
  3777.             /** @type {null} */
  3778.             c = null;
  3779.           }
  3780.           /** @type {string} */
  3781.           var a = c;
  3782.           /** @type {string} */
  3783.           var val = link.superChannelFilter.ALL;
  3784.           if (c instanceof B) {
  3785.             a = c.channelCustomTypesFilter;
  3786.             val = c.superChannelFilter;
  3787.           }
  3788.           if (null !== a && void 0 !== a && !Array.isArray(a) || "string" != typeof val && [link.superChannelFilter.ALL, link.superChannelFilter.SUPER, link.superChannelFilter.NON_SUPER].indexOf(val) < 0) {
  3789.             callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), d);
  3790.           } else {
  3791.             exports.getInstance().getTotalUnreadMessageCount(setup.getInstance().getCurrentUserId(), a, val, function(counter, exisObj) {
  3792.               if (exisObj) {
  3793.                 callback(null, exisObj, d);
  3794.               } else {
  3795.                 /** @type {number} */
  3796.                 var s = parseInt(counter.unread_count);
  3797.                 callback(s, null, d);
  3798.               }
  3799.             });
  3800.           }
  3801.         };
  3802.         /**
  3803.          * @param {string} productInfo
  3804.          * @return {undefined}
  3805.          */
  3806.         link.getTotalUnreadChannelCount = function(productInfo) {
  3807.           exports.getInstance().getTotalUnreadChannelCount(setup.getInstance().getCurrentUserId(), function(counter, exisObj) {
  3808.             if (exisObj) {
  3809.               callback(null, exisObj, productInfo);
  3810.             } else {
  3811.               /** @type {number} */
  3812.               var s = parseInt(counter.unread_count);
  3813.               callback(s, null, productInfo);
  3814.             }
  3815.           });
  3816.         };
  3817.         /**
  3818.          * @return {undefined}
  3819.          */
  3820.         link.createChannel = function() {
  3821.           /** @type {null} */
  3822.           var a = null;
  3823.           /** @type {!Array} */
  3824.           var module = [];
  3825.           /** @type {null} */
  3826.           var progress = null;
  3827.           /** @type {null} */
  3828.           var ghash = null;
  3829.           /** @type {null} */
  3830.           var url = null;
  3831.           /** @type {null} */
  3832.           var data = null;
  3833.           /** @type {null} */
  3834.           var str = null;
  3835.           /** @type {null} */
  3836.           var storedItem = null;
  3837.           /** @type {null} */
  3838.           var path = null;
  3839.           var settings = {
  3840.             isPublic : null,
  3841.             channelUrl : null
  3842.           };
  3843.           /** @type {!Array} */
  3844.           var restaurantId = [];
  3845.           /** @type {null} */
  3846.           var result = null;
  3847.           switch(arguments.length) {
  3848.             case 2:
  3849.               if (arguments[0] instanceof render) {
  3850.                 var obj = arguments[0];
  3851.                 module = obj._inviteUserIds;
  3852.                 /** @type {!Array} */
  3853.                 a = [];
  3854.                 progress = obj.isDistinct;
  3855.                 ghash = obj.isSuper;
  3856.                 url = obj.name;
  3857.                 data = obj.channelCover;
  3858.                 str = obj.data;
  3859.                 path = obj.customType;
  3860.                 restaurantId = obj._operatorIds;
  3861.                 settings.isPublic = obj.isPublic;
  3862.                 settings.channelUrl = obj.channelUrl;
  3863.                 result = obj.isEphemeral;
  3864.                 storedItem = arguments[1];
  3865.                 break;
  3866.               }
  3867.               a = arguments[0];
  3868.               /** @type {boolean} */
  3869.               progress = false;
  3870.               storedItem = arguments[1];
  3871.               break;
  3872.             case 3:
  3873.               a = arguments[0];
  3874.               progress = arguments[1];
  3875.               storedItem = arguments[2];
  3876.               break;
  3877.             case 4:
  3878.               a = arguments[0];
  3879.               progress = arguments[1];
  3880.               path = arguments[2];
  3881.               storedItem = arguments[3];
  3882.               break;
  3883.             case 6:
  3884.               a = arguments[0];
  3885.               progress = arguments[1];
  3886.               url = arguments[2];
  3887.               data = arguments[3];
  3888.               str = arguments[4];
  3889.               storedItem = arguments[5];
  3890.               break;
  3891.             case 7:
  3892.               a = arguments[0];
  3893.               progress = arguments[1];
  3894.               url = arguments[2];
  3895.               data = arguments[3];
  3896.               str = arguments[4];
  3897.               path = arguments[5];
  3898.               storedItem = arguments[6];
  3899.           }
  3900.           if (!Array.isArray(a) || "boolean" != typeof progress && null !== progress || "boolean" != typeof ghash && null !== ghash || "boolean" != typeof result && null !== result || "boolean" != typeof settings.isPublic && null !== settings.isPublic || "string" != typeof settings.channelUrl && null !== settings.channelUrl || "string" != typeof url && null !== url && void 0 !== url || "string" != typeof data && check(data) && null !== data && void 0 !== data || "string" != typeof str && null !==
  3901.           str && void 0 !== str || "string" != typeof path && null !== path && void 0 !== path) {
  3902.             callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), storedItem);
  3903.           } else {
  3904.             a.forEach(function(g) {
  3905.               module.push(g.userId);
  3906.             });
  3907.             link.createChannelWithUserIds(module, progress, url, data, str, path, ghash, settings, restaurantId, result, storedItem);
  3908.           }
  3909.         };
  3910.         /**
  3911.          * @return {undefined}
  3912.          */
  3913.         link.createChannelWithUserIds = function() {
  3914.           /** @type {null} */
  3915.           var data = null;
  3916.           /** @type {null} */
  3917.           var result = null;
  3918.           /** @type {null} */
  3919.           var lang = null;
  3920.           /** @type {null} */
  3921.           var val = null;
  3922.           /** @type {null} */
  3923.           var a = null;
  3924.           /** @type {null} */
  3925.           var token = null;
  3926.           /** @type {null} */
  3927.           var url = null;
  3928.           /** @type {null} */
  3929.           var c = null;
  3930.           /** @type {!Array} */
  3931.           var q = [];
  3932.           var o = {
  3933.             isPublic : null,
  3934.             channelUrl : null
  3935.           };
  3936.           /** @type {null} */
  3937.           var t = null;
  3938.           switch(arguments.length) {
  3939.             case 2:
  3940.               data = arguments[0];
  3941.               /** @type {boolean} */
  3942.               result = false;
  3943.               token = arguments[1];
  3944.               break;
  3945.             case 3:
  3946.               data = arguments[0];
  3947.               result = arguments[1];
  3948.               token = arguments[2];
  3949.               break;
  3950.             case 4:
  3951.               data = arguments[0];
  3952.               result = arguments[1];
  3953.               url = arguments[2];
  3954.               token = arguments[3];
  3955.               break;
  3956.             case 6:
  3957.               data = arguments[0];
  3958.               result = arguments[1];
  3959.               lang = arguments[2];
  3960.               val = arguments[3];
  3961.               a = arguments[4];
  3962.               token = arguments[5];
  3963.               break;
  3964.             case 7:
  3965.               data = arguments[0];
  3966.               result = arguments[1];
  3967.               lang = arguments[2];
  3968.               val = arguments[3];
  3969.               a = arguments[4];
  3970.               url = arguments[5];
  3971.               token = arguments[6];
  3972.               break;
  3973.             case 8:
  3974.               data = arguments[0];
  3975.               result = arguments[1];
  3976.               lang = arguments[2];
  3977.               val = arguments[3];
  3978.               a = arguments[4];
  3979.               url = arguments[5];
  3980.               c = arguments[6];
  3981.               token = arguments[7];
  3982.               break;
  3983.             case 9:
  3984.               data = arguments[0];
  3985.               result = arguments[1];
  3986.               lang = arguments[2];
  3987.               val = arguments[3];
  3988.               a = arguments[4];
  3989.               url = arguments[5];
  3990.               c = arguments[6];
  3991.               o.isPublic = arguments[7].isPublic;
  3992.               o.channelUrl = arguments[7].channelUrl;
  3993.               token = arguments[8];
  3994.               break;
  3995.             case 10:
  3996.               data = arguments[0];
  3997.               result = arguments[1];
  3998.               lang = arguments[2];
  3999.               val = arguments[3];
  4000.               a = arguments[4];
  4001.               url = arguments[5];
  4002.               c = arguments[6];
  4003.               o.isPublic = arguments[7].isPublic;
  4004.               o.channelUrl = arguments[7].channelUrl;
  4005.               q = arguments[8];
  4006.               token = arguments[9];
  4007.               break;
  4008.             case 11:
  4009.               data = arguments[0];
  4010.               result = arguments[1];
  4011.               lang = arguments[2];
  4012.               val = arguments[3];
  4013.               a = arguments[4];
  4014.               url = arguments[5];
  4015.               c = arguments[6];
  4016.               o.isPublic = arguments[7].isPublic;
  4017.               o.channelUrl = arguments[7].channelUrl;
  4018.               q = arguments[8];
  4019.               t = arguments[9];
  4020.               token = arguments[10];
  4021.           }
  4022.           if (setup.getInstance().hasLoggedIn()) {
  4023.             if (!Array.isArray(data) || "boolean" != typeof result && null !== result || "boolean" != typeof c && null !== c || "boolean" != typeof t && null !== t || "boolean" != typeof o.isPublic && null !== o.isPublic || "string" != typeof o.channelUrl && null !== o.channelUrl || "string" != typeof lang && null !== lang && void 0 !== lang || "string" != typeof val && check(val) && null !== val && void 0 !== val || "string" != typeof a && null !== a && void 0 !== a || "string" != typeof url &&
  4024.             null !== url && void 0 !== url) {
  4025.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), token);
  4026.             } else {
  4027.               var _this = data.filter(function(sceneUid, binderProcessPid, scenes) {
  4028.                 return binderProcessPid === scenes.indexOf(sceneUid);
  4029.               });
  4030.               var currentUser = setup.getInstance().currentUser;
  4031.               _this.push(currentUser.userId);
  4032.               exports.getInstance().createGroupChannel(_this, result, lang, val, a, url, c, o, q, t, function(name, n) {
  4033.                 if (n) {
  4034.                   callback(null, n, token);
  4035.                 } else {
  4036.                   var opts = new link(name);
  4037.                   link.cachedChannels[opts.url] = opts;
  4038.                   callback(opts, null, token);
  4039.                 }
  4040.               });
  4041.             }
  4042.           } else {
  4043.             callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), token);
  4044.           }
  4045.         };
  4046.         link.cachedChannels = {};
  4047.         /**
  4048.          * @return {undefined}
  4049.          */
  4050.         link.clearCache = function() {
  4051.           link.cachedChannels = {};
  4052.         };
  4053.         /**
  4054.          * @param {?} tag
  4055.          * @return {undefined}
  4056.          */
  4057.         link.removeCachedChannel = function(tag) {
  4058.           delete link.cachedChannels[tag];
  4059.         };
  4060.         /**
  4061.          * @param {?} item
  4062.          * @return {?}
  4063.          */
  4064.         link.upsert = function(item) {
  4065.           var data = new link(item);
  4066.           if (link.cachedChannels.hasOwnProperty(data.url)) {
  4067.             if (data.isEphemeral) {
  4068.               var self = link.cachedChannels[data.url];
  4069.               item.last_message = self.lastMessage;
  4070.               item.unread_message_count = self.unreadMessageCount;
  4071.             }
  4072.             link.cachedChannels[data.url].update(item);
  4073.           } else {
  4074.             link.cachedChannels[data.url] = data;
  4075.           }
  4076.           return link.cachedChannels[data.url];
  4077.         };
  4078.         /**
  4079.          * @param {string} c
  4080.          * @param {!Function} pos
  4081.          * @return {undefined}
  4082.          */
  4083.         link.getChannelWithoutCache = function(c, pos) {
  4084.           if (c) {
  4085.             exports.getInstance().getGroupChannel(c, true, true, function(data, exisObj) {
  4086.               if (exisObj) {
  4087.                 callback(null, exisObj, pos);
  4088.               } else {
  4089.                 var s = link.upsert(data);
  4090.                 callback(s, null, pos);
  4091.               }
  4092.             });
  4093.           } else {
  4094.             callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), pos);
  4095.           }
  4096.         };
  4097.         /**
  4098.          * @param {string} name
  4099.          * @param {!Function} index
  4100.          * @return {undefined}
  4101.          */
  4102.         link.getChannel = function(name, index) {
  4103.           if (name) {
  4104.             if (link.cachedChannels.hasOwnProperty(name)) {
  4105.               callback(link.cachedChannels[name], null, index);
  4106.             } else {
  4107.               link.getChannelWithoutCache(name, index);
  4108.             }
  4109.           } else {
  4110.             callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), index);
  4111.           }
  4112.         };
  4113.         link.markAsReadAllLastSentAt;
  4114.         /**
  4115.          * @param {string} e
  4116.          * @return {undefined}
  4117.          */
  4118.         link.markAsReadAll = function(e) {
  4119.           setup.getInstance().markAsReadAll(e);
  4120.         };
  4121.         /**
  4122.          * @param {!Object} data
  4123.          * @return {undefined}
  4124.          */
  4125.         var read = function(data) {
  4126.           if (data) {
  4127.             /** @type {number} */
  4128.             this.category = data.hasOwnProperty("cat") ? parseInt(data.cat) : 0;
  4129.             this.data = data.hasOwnProperty("data") ? data.data : null;
  4130.             /** @type {string} */
  4131.             this.channelUrl = data.hasOwnProperty("channel_url") ? String(data.channel_url) : "";
  4132.             /** @type {string} */
  4133.             this.channelType = data.hasOwnProperty("channel_type") ? String(data.channel_type) : update.CHANNEL_TYPE_GROUP;
  4134.           }
  4135.           /**
  4136.            * @return {?}
  4137.            */
  4138.           this.isGroupChannel = function() {
  4139.             return this.channelType === update.CHANNEL_TYPE_GROUP;
  4140.           };
  4141.           /**
  4142.            * @return {?}
  4143.            */
  4144.           this.isOpenChannel = function() {
  4145.             return this.channelType === update.CHANNEL_TYPE_OPEN;
  4146.           };
  4147.         };
  4148.         /** @type {number} */
  4149.         read.CATEGORY_NONE = 0;
  4150.         /** @type {number} */
  4151.         read.CATEGORY_CHANNEL_ENTER = 10102;
  4152.         /** @type {number} */
  4153.         read.CATEGORY_CHANNEL_EXIT = 10103;
  4154.         /** @type {number} */
  4155.         read.CATEGORY_USER_CHANNEL_MUTE = 10201;
  4156.         /** @type {number} */
  4157.         read.CATEGORY_USER_CHANNEL_UNMUTE = 10200;
  4158.         /** @type {number} */
  4159.         read.CATEGORY_USER_CHANNEL_BAN = 10601;
  4160.         /** @type {number} */
  4161.         read.CATEGORY_USER_CHANNEL_UNBAN = 10600;
  4162.         /** @type {number} */
  4163.         read.CATEGORY_CHANNEL_FREEZE = 10701;
  4164.         /** @type {number} */
  4165.         read.CATEGORY_CHANNEL_UNFREEZE = 10700;
  4166.         /** @type {number} */
  4167.         read.CATEGORY_TYPING_START = 10900;
  4168.         /** @type {number} */
  4169.         read.CATEGORY_TYPING_END = 10901;
  4170.         /** @type {number} */
  4171.         read.CATEGORY_CHANNEL_JOIN = 1e4;
  4172.         /** @type {number} */
  4173.         read.CATEGORY_CHANNEL_LEAVE = 10001;
  4174.         /** @type {number} */
  4175.         read.CATEGORY_CHANNEL_INVITE = 10020;
  4176.         /** @type {number} */
  4177.         read.CATEGORY_CHANNEL_DECLINE_INVITE = 10022;
  4178.         /** @type {number} */
  4179.         read.CATEGORY_CHANNEL_PROP_CHANGED = 11e3;
  4180.         /** @type {number} */
  4181.         read.CATEGORY_CHANNEL_DELETED = 12e3;
  4182.         /** @type {number} */
  4183.         read.CATEGORY_CHANNEL_META_DATA_CHANGED = 11100;
  4184.         /** @type {number} */
  4185.         read.CATEGORY_CHANNEL_META_COUNTERS_CHANGED = 11200;
  4186.         /** @type {number} */
  4187.         read.CATEGORY_CHANNEL_HIDE = 13e3;
  4188.         /**
  4189.          * @param {(Object|string)} context
  4190.          * @return {undefined}
  4191.          */
  4192.         var _init = function(context) {
  4193.           if (context) {
  4194.             /** @type {number} */
  4195.             this.category = context.hasOwnProperty("cat") ? parseInt(context.cat) : 0;
  4196.           }
  4197.         };
  4198.         /** @type {number} */
  4199.         _init.CATEGORY_USER_BLOCK = 20001;
  4200.         /** @type {number} */
  4201.         _init.CATEGORY_USER_UNBLOCK = 2e4;
  4202.         /** @type {number} */
  4203.         _init.CATEGORY_FRIEND_DISCOVERED = 20900;
  4204.         /**
  4205.          * @param {!Object} data
  4206.          * @return {undefined}
  4207.          */
  4208.         var client = function(data) {
  4209.           /** @type {string} */
  4210.           this.nickname = "";
  4211.           /** @type {string} */
  4212.           this.profileUrl = "";
  4213.           /** @type {string} */
  4214.           this.userId = "";
  4215.           /** @type {string} */
  4216.           this.connectionStatus = "";
  4217.           /** @type {null} */
  4218.           this.lastSeenAt = null;
  4219.           this.metaData = {};
  4220.           /** @type {boolean} */
  4221.           this.isActive = true;
  4222.           /** @type {null} */
  4223.           this.friendDiscoveryKey = null;
  4224.           /** @type {null} */
  4225.           this.friendName = null;
  4226.           /**
  4227.            * @return {?}
  4228.            */
  4229.           this.getOriginalProfileUrl = function() {
  4230.             /** @type {string} */
  4231.             var value = "";
  4232.             if (((value = (value = this.profileUrl.indexOf("://") > -1 ? this.profileUrl.split("/")[2] : this.profileUrl.split("/")[0]).split("?")[0]).indexOf("sendbird.com") > -1 || value.indexOf("intoz.com") > -1) && this.profileUrl.indexOf(value + "/profile_images/") > -1) {
  4233.               var locationPath = this.profileUrl.replace("profile_images/", "");
  4234.               return locationPath === this.profileUrl ? "" : locationPath;
  4235.             }
  4236.             return "";
  4237.           };
  4238.           /**
  4239.            * @param {!Object} data
  4240.            * @return {undefined}
  4241.            */
  4242.           this._update = function(data) {
  4243.             if (data.hasOwnProperty("guest_id")) {
  4244.               /** @type {string} */
  4245.               this.userId = String(data.guest_id);
  4246.             }
  4247.             if (data.hasOwnProperty("user_id")) {
  4248.               /** @type {string} */
  4249.               this.userId = String(data.user_id);
  4250.             }
  4251.             if (data.hasOwnProperty("name")) {
  4252.               /** @type {string} */
  4253.               this.nickname = String(data.name);
  4254.             }
  4255.             if (data.hasOwnProperty("nickname")) {
  4256.               /** @type {string} */
  4257.               this.nickname = String(data.nickname);
  4258.             }
  4259.             if (data.hasOwnProperty("image")) {
  4260.               /** @type {string} */
  4261.               this.profileUrl = String(data.image);
  4262.             }
  4263.             if (data.hasOwnProperty("profile_url")) {
  4264.               /** @type {string} */
  4265.               this.profileUrl = String(data.profile_url);
  4266.             }
  4267.             if (data.hasOwnProperty("is_online")) {
  4268.               if (data.is_online === client.NON_AVAILABLE) {
  4269.                 /** @type {string} */
  4270.                 this.connectionStatus = client.NON_AVAILABLE;
  4271.               } else {
  4272.                 /** @type {string} */
  4273.                 this.connectionStatus = data.is_online ? client.ONLINE : client.OFFLINE;
  4274.               }
  4275.             } else {
  4276.               /** @type {string} */
  4277.               this.connectionStatus = client.NON_AVAILABLE;
  4278.             }
  4279.             if (data.hasOwnProperty("last_seen_at")) {
  4280.               /** @type {number} */
  4281.               this.lastSeenAt = parseInt(data.last_seen_at);
  4282.             } else {
  4283.               /** @type {number} */
  4284.               this.lastSeenAt = 0;
  4285.             }
  4286.             if (data.hasOwnProperty("metadata")) {
  4287.               this.metaData = data.metadata;
  4288.             } else {
  4289.               this.metaData = {};
  4290.             }
  4291.             if (data.hasOwnProperty("is_active")) {
  4292.               this.isActive = void 0 === data.is_active || data.is_active;
  4293.             } else {
  4294.               /** @type {boolean} */
  4295.               this.isActive = true;
  4296.             }
  4297.             if (data.hasOwnProperty("friend_discovery_key")) {
  4298.               this.friendDiscoveryKey = data.friend_discovery_key;
  4299.             } else {
  4300.               /** @type {null} */
  4301.               this.friendDiscoveryKey = null;
  4302.             }
  4303.             if (data.hasOwnProperty("friend_name")) {
  4304.               this.friendName = data.friend_name;
  4305.             } else {
  4306.               /** @type {null} */
  4307.               this.friendName = null;
  4308.             }
  4309.           };
  4310.           /**
  4311.            * @param {(Object|string)} e
  4312.            * @param {boolean} islongclick
  4313.            * @return {undefined}
  4314.            */
  4315.           this._updateMetaData = function(e, islongclick) {
  4316.             var me = this;
  4317.             /** @type {!Array<string>} */
  4318.             var s = Object.keys(e);
  4319.             if (islongclick) {
  4320.               s.forEach(function(key) {
  4321.                 delete me.metaData[key];
  4322.               });
  4323.             } else {
  4324.               s.forEach(function(key) {
  4325.                 me.metaData[key] = e[key];
  4326.               });
  4327.             }
  4328.           };
  4329.           /**
  4330.            * @param {!Object} value
  4331.            * @param {!Function} data
  4332.            * @return {?}
  4333.            */
  4334.           this.createMetaData = function(value, data) {
  4335.             var $this = this;
  4336.             return "function" == typeof value && 1 === arguments.length && (data = value, value = {}), "object" != typeof value || check(value) || Array.isArray(value) ? void callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), data) : setup.getInstance().hasLoggedIn() ? void exports.getInstance().createUserMetaData($this.userId, value, function(e, exisObj) {
  4337.               if (exisObj) {
  4338.                 callback(null, exisObj, data);
  4339.               } else {
  4340.                 $this._updateMetaData(e);
  4341.                 callback(e, null, data);
  4342.               }
  4343.             }) : void(data && callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), data));
  4344.           };
  4345.           /**
  4346.            * @param {!Object} value
  4347.            * @param {!Object} type
  4348.            * @param {!Function} data
  4349.            * @return {?}
  4350.            */
  4351.           this.updateMetaData = function(value, type, data) {
  4352.             var $this = this;
  4353.             return "function" == typeof value && 1 === arguments.length && (data = value, value = {}), "function" == typeof type && 2 === arguments.length && (data = type, type = false), "object" != typeof value || check(value) || Array.isArray(value) || "boolean" != typeof type ? void callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), data) : setup.getInstance().hasLoggedIn() ? void exports.getInstance().updateUserMetaData($this.userId, value, type, function(e, n) {
  4354.               if (n) {
  4355.                 callback(null, n, data);
  4356.               } else {
  4357.                 $this._updateMetaData(e);
  4358.                 callback(e, null, data);
  4359.               }
  4360.             }) : void(data && callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), data));
  4361.           };
  4362.           /**
  4363.            * @param {string} productInfo
  4364.            * @return {undefined}
  4365.            */
  4366.           this.deleteAllMetaData = function(productInfo) {
  4367.             var response = this;
  4368.             var result = response.metaData;
  4369.             if (setup.getInstance().hasLoggedIn()) {
  4370.               exports.getInstance().deleteAllUserMetaData(response.userId, function(identifierPositions, exisObj) {
  4371.                 if (exisObj) {
  4372.                   callback(null, exisObj, productInfo);
  4373.                 } else {
  4374.                   response._updateMetaData(result, true);
  4375.                   callback(identifierPositions, null, productInfo);
  4376.                 }
  4377.               });
  4378.             } else {
  4379.               if (productInfo) {
  4380.                 callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), productInfo);
  4381.               }
  4382.             }
  4383.           };
  4384.           /**
  4385.            * @param {string} n
  4386.            * @param {string} c
  4387.            * @return {undefined}
  4388.            */
  4389.           this.deleteMetaData = function(n, c) {
  4390.             var u = this;
  4391.             if ("function" == typeof n && 1 === arguments.length && (c = n, n = null), "string" == typeof n) {
  4392.               if (setup.getInstance().hasLoggedIn()) {
  4393.                 var s = {};
  4394.                 /** @type {string} */
  4395.                 s[n] = "";
  4396.                 exports.getInstance().deleteUserMetaData(u.userId, n, function(identifierPositions, exisObj) {
  4397.                   if (exisObj) {
  4398.                     callback(null, exisObj, c);
  4399.                   } else {
  4400.                     u._updateMetaData(s, true);
  4401.                     callback(identifierPositions, null, c);
  4402.                   }
  4403.                 });
  4404.               } else {
  4405.                 if (c) {
  4406.                   callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), c);
  4407.                 }
  4408.               }
  4409.             } else {
  4410.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), c);
  4411.             }
  4412.           };
  4413.           /**
  4414.            * @return {?}
  4415.            */
  4416.           this.serialize = function() {
  4417.             /** @type {*} */
  4418.             var passedValue1 = JSON.parse(JSON.stringify(this));
  4419.             return f(passedValue1);
  4420.           };
  4421.           if (data) {
  4422.             this._update(data);
  4423.           }
  4424.         };
  4425.         /** @type {string} */
  4426.         client.NON_AVAILABLE = "nonavailable";
  4427.         /** @type {string} */
  4428.         client.ONLINE = "online";
  4429.         /** @type {string} */
  4430.         client.OFFLINE = "offline";
  4431.         /**
  4432.          * @param {string} res
  4433.          * @param {string} value
  4434.          * @param {!Object} p
  4435.          * @param {!Object} set
  4436.          * @param {string} fn
  4437.          * @param {!Object} data
  4438.          * @param {!Object} i
  4439.          * @param {number} url
  4440.          * @param {number} key
  4441.          * @return {?}
  4442.          */
  4443.         client.build = function(res, value, p, set, fn, data, i, url, key) {
  4444.           return {
  4445.             user_id : res,
  4446.             nickname : value,
  4447.             profile_url : p,
  4448.             is_online : set,
  4449.             last_seen_at : fn,
  4450.             metadata : data,
  4451.             is_active : i,
  4452.             friend_discovery_key : url,
  4453.             friend_name : key
  4454.           };
  4455.         };
  4456.         /**
  4457.          * @param {?} scope
  4458.          * @return {?}
  4459.          */
  4460.         client.buildFromSerializedData = function(scope) {
  4461.           var $scope = $(scope);
  4462.           return new client(client.build($scope.userId, $scope.nickname, $scope.profileUrl, $scope.connectionStatus, $scope.lastSeenAt, $scope.metaData, $scope.isActive, $scope.friendDiscoveryKey, $scope.friendName));
  4463.         };
  4464.         /**
  4465.          * @param {undefined} data
  4466.          * @return {undefined}
  4467.          */
  4468.         var _this = function(data) {
  4469.           /** @type {string} */
  4470.           this.state = "";
  4471.           /** @type {boolean} */
  4472.           this.isBlockedByMe = false;
  4473.           /** @type {boolean} */
  4474.           this.isBlockingMe = false;
  4475.           /**
  4476.            * @param {!Object} message
  4477.            * @return {undefined}
  4478.            */
  4479.           this.parse = function(message) {
  4480.             this.state = message.state;
  4481.             if (message.hasOwnProperty("is_blocked_by_me")) {
  4482.               this.isBlockedByMe = message.is_blocked_by_me;
  4483.             }
  4484.             if (message.hasOwnProperty("is_blocking_me")) {
  4485.               this.isBlockingMe = message.is_blocking_me;
  4486.             }
  4487.           };
  4488.           if (data) {
  4489.             this._update(data);
  4490.             this.parse(data);
  4491.           }
  4492.         };
  4493.         fn(client, _this);
  4494.         /** @type {string} */
  4495.         _this.JOINED = "joined";
  4496.         /** @type {string} */
  4497.         _this.INVITED = "invited";
  4498.         /**
  4499.          * @param {string} e
  4500.          * @param {!Object} res
  4501.          * @param {boolean} format
  4502.          * @param {boolean} data
  4503.          * @return {?}
  4504.          */
  4505.         _this.build = function(e, res, format, data) {
  4506.           /** @type {string} */
  4507.           var module = e;
  4508.           return module.state = res, module.is_blocked_by_me = format, module.is_blocking_me = data, module;
  4509.         };
  4510.         /**
  4511.          * @param {?} scope
  4512.          * @return {?}
  4513.          */
  4514.         _this.buildFromSerializedData = function(scope) {
  4515.           var $scope = $(scope);
  4516.           return new _this(_this.build(client.build($scope.userId, $scope.nickname, $scope.profileUrl, $scope.connectionStatus, $scope.lastSeenAt, $scope.metaData, $scope.isActive, $scope.friendDiscoveryKey, $scope.friendName), $scope.state, $scope.isBlockedByMe, $scope.isBlockingMe));
  4517.         };
  4518.         /**
  4519.          * @param {?} flightPhase
  4520.          * @param {?} navigationLibrary
  4521.          * @param {?} airportController
  4522.          * @return {?}
  4523.          */
  4524.         var init = function(flightPhase, navigationLibrary, airportController) {
  4525.           /**
  4526.            * @return {?}
  4527.            */
  4528.           this.isAckRequired = function() {
  4529.             return "MESG" === this.command || "FILE" === this.command || "ENTR" === this.command || "EXIT" === this.command || "READ" === this.command || "MEDI" === this.command || "FEDI" === this.command;
  4530.           };
  4531.           /**
  4532.            * @return {?}
  4533.            */
  4534.           this.encode = function() {
  4535.             return this.command + this.payload + "\n";
  4536.           };
  4537.           /**
  4538.            * @param {string} a
  4539.            * @return {undefined}
  4540.            */
  4541.           this.decode = function(a) {
  4542.             a = a.trim();
  4543.             this.command = a.substring(0, 4);
  4544.             this.payload = a.substring(4);
  4545.           };
  4546.           /**
  4547.            * @return {?}
  4548.            */
  4549.           this.getJsonElement = function() {
  4550.             return JSON.parse(this.payload);
  4551.           };
  4552.           /**
  4553.            * @return {?}
  4554.            */
  4555.           this.isRequestIdCommand = function() {
  4556.             return this.isAckRequired() || "EROR" === this.command;
  4557.           };
  4558.           this.command;
  4559.           this.payload;
  4560.           this.requestId;
  4561.           var id;
  4562.           var options = this;
  4563.           if (0 !== arguments.length) {
  4564.             switch(arguments.length) {
  4565.               case 1:
  4566.                 var a = arguments[0];
  4567.                 if (!a || a.length <= 4) {
  4568.                   return options.command = "NOOP", void(options.payload = "{}");
  4569.                 }
  4570.                 if (a = a.trim(), options.command = a.substring(0, 4), options.payload = a.substring(4), options.isRequestIdCommand()) {
  4571.                   var req = options.getJsonElement();
  4572.                   if (req) {
  4573.                     options.requestId = req.hasOwnProperty("req_id") ? req.req_id : "";
  4574.                   }
  4575.                 }
  4576.                 break;
  4577.               case 3:
  4578.                 id = arguments[2];
  4579.               case 2:
  4580.                 var opts = arguments[0];
  4581.                 var data = arguments[1];
  4582.                 id = id || "";
  4583.                 options.command = opts;
  4584.                 options.requestId = id;
  4585.                 if (!options.requestId) {
  4586.                   if (options.isRequestIdCommand()) {
  4587.                     options.requestId = init.generateRequestId();
  4588.                   }
  4589.                 }
  4590.                 data.req_id = options.requestId;
  4591.                 /** @type {string} */
  4592.                 options.payload = JSON.stringify(data);
  4593.             }
  4594.           }
  4595.         };
  4596.         /**
  4597.          * @param {?} l
  4598.          * @param {string} m
  4599.          * @param {string} b
  4600.          * @param {string} s
  4601.          * @param {string} topic
  4602.          * @param {!Object} value
  4603.          * @param {number} track
  4604.          * @param {string} language
  4605.          * @return {?}
  4606.          */
  4607.         init.bMessage = function(l, m, b, s, topic, value, track, language) {
  4608.           var $scope = {};
  4609.           return $scope.channel_url = l, $scope.message = m, $scope.data = b, $scope.mention_type = topic, $scope.mentioned_user_ids = [], topic === UserService.MentionType.CHANNEL ? $scope.mentioned_user_ids = [] : Array.isArray(value) && value.length > 0 && ($scope.mentioned_user_ids = value), s && ($scope.custom_type = s), track.length > 0 && ($scope.target_langs = track), language && language !== next.PushNotificationDeliveryOption.DEFAULT && ($scope.push_option = language), new init("MESG",
  4610.           $scope);
  4611.         };
  4612.         /**
  4613.          * @param {?} selectedCube
  4614.          * @return {?}
  4615.          */
  4616.         init.bRead = function(selectedCube) {
  4617.           var connections = {};
  4618.           return connections.channel_url = selectedCube, new init("READ", connections);
  4619.         };
  4620.         /**
  4621.          * @param {?} key
  4622.          * @param {number} value
  4623.          * @return {?}
  4624.          */
  4625.         init.bTypeStart = function(key, value) {
  4626.           var context = {};
  4627.           return context.channel_url = key, context.time = value, new init("TPST", context);
  4628.         };
  4629.         /**
  4630.          * @param {?} index
  4631.          * @param {number} key
  4632.          * @return {?}
  4633.          */
  4634.         init.bTypeEnd = function(index, key) {
  4635.           var context = {};
  4636.           return context.channel_url = index, context.time = key, new init("TPEN", context);
  4637.         };
  4638.         /**
  4639.          * @param {number} header
  4640.          * @param {?} w
  4641.          * @param {string} p
  4642.          * @param {string} name
  4643.          * @param {string} type
  4644.          * @param {string} label
  4645.          * @param {string} f
  4646.          * @param {string} e
  4647.          * @param {!Object} value
  4648.          * @param {string} n
  4649.          * @param {string} c
  4650.          * @param {string} val
  4651.          * @param {string} s
  4652.          * @return {?}
  4653.          */
  4654.         init.bFile = function(header, w, p, name, type, label, f, e, value, n, c, val, s) {
  4655.           var data = {};
  4656.           return data.channel_url = w, data.url = p, data.name = name || "", data.type = type || "", data.size = label || 0, data.custom = f, e && (data.custom_type = e), value && (data.thumbnails = value), n && (data.require_auth = n), data.mention_type = c, data.mentioned_user_ids = [], c === UserService.MentionType.CHANNEL ? data.mentioned_user_ids = [] : Array.isArray(val) && val.length > 0 && (data.mentioned_user_ids = val), s && s !== set.PushNotificationDeliveryOption.DEFAULT && (data.push_option =
  4657.           s), new init("FILE", data, header);
  4658.         };
  4659.         /**
  4660.          * @return {?}
  4661.          */
  4662.         init.bPing = function() {
  4663.           var context = {};
  4664.           return context.id = (new Date).getTime(), new init("PING", context);
  4665.         };
  4666.         /**
  4667.          * @param {?} selectedCube
  4668.          * @return {?}
  4669.          */
  4670.         init.bEnter = function(selectedCube) {
  4671.           var connections = {};
  4672.           return connections.channel_url = selectedCube, new init("ENTR", connections);
  4673.         };
  4674.         /**
  4675.          * @param {?} selectedCube
  4676.          * @return {?}
  4677.          */
  4678.         init.bExit = function(selectedCube) {
  4679.           var connections = {};
  4680.           return connections.channel_url = selectedCube, new init("EXIT", connections);
  4681.         };
  4682.         /**
  4683.          * @param {?} key
  4684.          * @param {!Object} index
  4685.          * @param {?} type
  4686.          * @param {?} v
  4687.          * @param {number} dimension
  4688.          * @return {?}
  4689.          */
  4690.         init.bUpdateUserMessage = function(key, index, type, v, dimension) {
  4691.           var data = {};
  4692.           return data.channel_url = key, data.msg_id = index, null != type && void 0 !== type && (data.message = type), null != v && void 0 !== v && (data.data = v), null != dimension && void 0 !== dimension && (data.custom_type = dimension), new init("MEDI", data);
  4693.         };
  4694.         /**
  4695.          * @param {?} storePage
  4696.          * @param {!Object} id
  4697.          * @param {?} bool
  4698.          * @param {number} val
  4699.          * @return {?}
  4700.          */
  4701.         init.bUpdateFileMessage = function(storePage, id, bool, val) {
  4702.           var self = {};
  4703.           return self.channel_url = storePage, self.msg_id = id, null != bool && void 0 !== bool && (self.data = bool), null != val && void 0 !== val && (self.custom_type = val), new init("FEDI", self);
  4704.         };
  4705.         /** @type {number} */
  4706.         init.requestIdSeed = (new Date).getTime();
  4707.         /**
  4708.          * @return {?}
  4709.          */
  4710.         init.generateRequestId = function() {
  4711.           return init.requestIdSeed++, String(init.requestIdSeed);
  4712.         };
  4713.         /**
  4714.          * @param {?} scope
  4715.          * @return {undefined}
  4716.          */
  4717.         var postLink = function(scope) {
  4718.           /** @type {boolean} */
  4719.           this.isLoading = false;
  4720.           /** @type {boolean} */
  4721.           this.hasNext = true;
  4722.           /** @type {number} */
  4723.           this.limit = 20;
  4724.           /** @type {string} */
  4725.           var n = "";
  4726.           var $scope = this;
  4727.           /**
  4728.            * @param {string} stat
  4729.            * @return {?}
  4730.            */
  4731.           this.next = function(stat) {
  4732.             return $scope.hasNext ? $scope.isLoading ? void callback(null, new Date("Query in progress.", concat.QUERY_IN_PROGRESS), stat) : "number" != typeof $scope.limit || $scope.limit < 1 ? void callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), stat) : ($scope.isLoading = true, void exports.getInstance().loadOperatorList(scope.url, scope.isOpenChannel(), n, $scope.limit, function(status, exisObj) {
  4733.               if (exisObj) {
  4734.                 return $scope.isLoading = false, void callback(null, exisObj, stat);
  4735.               }
  4736.               /** @type {string} */
  4737.               var field = status;
  4738.               if (!(n = String(field.next)) || n.length <= 0) {
  4739.                 /** @type {boolean} */
  4740.                 $scope.hasNext = false;
  4741.               }
  4742.               var identifierPositions = field.operators.map(function(options) {
  4743.                 return new client(options);
  4744.               });
  4745.               /** @type {boolean} */
  4746.               $scope.isLoading = false;
  4747.               callback(identifierPositions, null, stat);
  4748.             })) : void callback([], null, stat);
  4749.           };
  4750.         };
  4751.         /**
  4752.          * @param {?} seen
  4753.          * @return {undefined}
  4754.          */
  4755.         var reset = function(seen) {
  4756.           /** @type {boolean} */
  4757.           this.isLoading = false;
  4758.           /** @type {boolean} */
  4759.           this.hasNext = true;
  4760.           /** @type {number} */
  4761.           this.limit = 20;
  4762.           /** @type {string} */
  4763.           this.mutedMemberFilter = reset.MUTED_MEMBER_FILTER.ALL;
  4764.           /** @type {string} */
  4765.           this.operatorFilter = reset.OPERATOR_FILTER.ALL;
  4766.           /** @type {string} */
  4767.           this.memberStateFilter = link.memberStateFilter.ALL;
  4768.           /** @type {null} */
  4769.           this.nicknameStartsWithFilter = null;
  4770.           /** @type {string} */
  4771.           var numAddresses = reset.Order.MEMBER_NICKNAME_ALPHABETICAL;
  4772.           /** @type {string} */
  4773.           var authToken = "";
  4774.           var $scope = this;
  4775.           /**
  4776.            * @param {string} stat
  4777.            * @return {?}
  4778.            */
  4779.           this.next = function(stat) {
  4780.             return $scope.hasNext ? $scope.isLoading ? void callback(null, new Date("Query in progress.", concat.QUERY_IN_PROGRESS), stat) : "number" != typeof $scope.limit || $scope.limit < 1 || "string" != typeof $scope.mutedMemberFilter || [reset.MUTED_MEMBER_FILTER.ALL, reset.MUTED_MEMBER_FILTER.MUTED, reset.MUTED_MEMBER_FILTER.UNMUTED].indexOf($scope.mutedMemberFilter.toLowerCase()) < 0 || "string" != typeof $scope.operatorFilter || [reset.OPERATOR_FILTER.ALL, reset.OPERATOR_FILTER.OPERATOR,
  4781.             reset.OPERATOR_FILTER.NONOPERATOR].indexOf($scope.operatorFilter.toLowerCase()) < 0 || "string" != typeof $scope.memberStateFilter || [link.memberStateFilter.ALL, link.memberStateFilter.JOINED, link.memberStateFilter.INVITED, link.memberStateFilter.INVITED_BY_FRIEND, link.memberStateFilter.INVITED_BY_NON_FRIEND].indexOf($scope.memberStateFilter.toLowerCase()) < 0 || null !== $scope.nicknameStartsWithFilter && "string" != typeof $scope.nicknameStartsWithFilter ? void callback(null, new Date("Invalid parameter.",
  4782.             concat.INVALID_PARAMETER), stat) : ($scope.isLoading = true, void exports.getInstance().loadGroupChannelMemberList(seen, authToken, $scope.limit, $scope.mutedMemberFilter, $scope.operatorFilter, $scope.memberStateFilter, $scope.nicknameStartsWithFilter, numAddresses, function(bruce, n) {
  4783.               if (n) {
  4784.                 return $scope.isLoading = false, void callback(null, n, stat);
  4785.               }
  4786.               /** @type {!Object} */
  4787.               var a = bruce;
  4788.               if (!(authToken = String(a.next)) || authToken.length <= 0) {
  4789.                 /** @type {boolean} */
  4790.                 $scope.hasNext = false;
  4791.               }
  4792.               var identifierPositions = a.members.map(function(operator) {
  4793.                 return new _this(operator);
  4794.               });
  4795.               /** @type {boolean} */
  4796.               $scope.isLoading = false;
  4797.               callback(identifierPositions, null, stat);
  4798.             })) : void callback([], null, stat);
  4799.           };
  4800.         };
  4801.         reset.MUTED_MEMBER_FILTER = {
  4802.           ALL : "all",
  4803.           MUTED : "muted",
  4804.           UNMUTED : "unmuted"
  4805.         };
  4806.         reset.OPERATOR_FILTER = {
  4807.           ALL : "all",
  4808.           OPERATOR : "operator",
  4809.           NONOPERATOR : "nonoperator"
  4810.         };
  4811.         reset.Order = {
  4812.           MEMBER_NICKNAME_ALPHABETICAL : "member_nickname_alphabetical"
  4813.         };
  4814.         /**
  4815.          * @param {!Function} opt_configureForTesting
  4816.          * @return {undefined}
  4817.          */
  4818.         var Context = function(opt_configureForTesting) {
  4819.           /** @type {boolean} */
  4820.           this.isLoading = false;
  4821.           /** @type {boolean} */
  4822.           this.hasNext = true;
  4823.           /** @type {number} */
  4824.           this.limit = 20;
  4825.           /** @type {boolean} */
  4826.           this.includeEmpty = false;
  4827.           /** @type {string} */
  4828.           this.order = Context.ORDER_LATEST_LAST_MESSAGE;
  4829.           /** @type {!Array} */
  4830.           this.userIdsFilter = [];
  4831.           /** @type {boolean} */
  4832.           this.userIdsFilterExactMatch = false;
  4833.           /** @type {string} */
  4834.           this.queryType = "AND";
  4835.           var d = {
  4836.             userIds : [],
  4837.             includeMode : true,
  4838.             queryType : iterator.USER_IDS_INCLUDE_QUERY_TYPE.AND
  4839.           };
  4840.           /** @type {!Array} */
  4841.           this._userIdsExactFilter = [];
  4842.           /** @type {!Array} */
  4843.           this._userIdsIncludeFilter = [];
  4844.           /** @type {string} */
  4845.           this._userIdsIncludeFilterQueryType = iterator.USER_IDS_INCLUDE_QUERY_TYPE.AND;
  4846.           if (c) {
  4847.             /** @type {!Array} */
  4848.             this.userIdsExactFilter = this._userIdsExactFilter;
  4849.             /** @type {!Array} */
  4850.             this.userIdsIncludeFilter = this._userIdsIncludeFilter;
  4851.             /** @type {string} */
  4852.             this.userIdsIncludeFilterQueryType = this._userIdsIncludeFilterQueryType;
  4853.           } else {
  4854.             Object.defineProperty(this, "userIdsExactFilter", {
  4855.               get : function() {
  4856.                 return this._userIdsExactFilter;
  4857.               },
  4858.               set : function(e) {
  4859.                 if (Array.isArray(e)) {
  4860.                   /** @type {!Object} */
  4861.                   this._userIdsExactFilter = e;
  4862.                   /** @type {!Array} */
  4863.                   this._userIdsIncludeFilter = [];
  4864.                   d = {
  4865.                     userIds : this._userIdsExactFilter,
  4866.                     includeMode : false
  4867.                   };
  4868.                 }
  4869.               }
  4870.             });
  4871.             Object.defineProperty(this, "userIdsIncludeFilter", {
  4872.               get : function() {
  4873.                 return this._userIdsIncludeFilter;
  4874.               },
  4875.               set : function(e) {
  4876.                 if (Array.isArray(e)) {
  4877.                   /** @type {!Object} */
  4878.                   this._userIdsIncludeFilter = e;
  4879.                   /** @type {!Array} */
  4880.                   this._userIdsExactFilter = [];
  4881.                   d = {
  4882.                     userIds : this._userIdsIncludeFilter,
  4883.                     includeMode : true
  4884.                   };
  4885.                 }
  4886.               }
  4887.             });
  4888.             Object.defineProperty(this, "userIdsIncludeFilterQueryType", {
  4889.               get : function() {
  4890.                 return this._userIdsIncludeFilterQueryType;
  4891.               },
  4892.               set : function(mymuted) {
  4893.                 /** @type {string} */
  4894.                 this._userIdsIncludeFilterQueryType = mymuted;
  4895.                 d = {
  4896.                   queryType : this._userIdsIncludeFilterQueryType
  4897.                 };
  4898.               }
  4899.             });
  4900.           }
  4901.           /** @type {string} */
  4902.           this.nicknameContainsFilter = "";
  4903.           /** @type {string} */
  4904.           this.channelNameContainsFilter = "";
  4905.           /** @type {string} */
  4906.           this.memberStateFilter = link.memberStateFilter.ALL;
  4907.           /** @type {string} */
  4908.           this.customTypeFilter = "";
  4909.           /** @type {!Array} */
  4910.           this.customTypesFilter = [];
  4911.           /** @type {!Array} */
  4912.           this.channelUrlsFilter = [];
  4913.           /** @type {string} */
  4914.           this.superChannelFilter = link.superChannelFilter.ALL;
  4915.           /** @type {string} */
  4916.           this.publicChannelFilter = link.publicChannelFilter.ALL;
  4917.           /** @type {null} */
  4918.           this.customTypeStartsWithFilter = null;
  4919.           /** @type {!Function} */
  4920.           var c1State = opt_configureForTesting;
  4921.           /** @type {string} */
  4922.           var s = "";
  4923.           var options = this;
  4924.           /**
  4925.            * @param {string} stat
  4926.            * @return {?}
  4927.            */
  4928.           this.next = function(stat) {
  4929.             if (options.hasNext) {
  4930.               if (options.isLoading) {
  4931.                 callback(null, new Date("Query in progress.", concat.QUERY_IN_PROGRESS), stat);
  4932.               } else {
  4933.                 if (null !== options.nicknameContainsFilter && void 0 !== options.nicknameContainsFilter || (options.nicknameContainsFilter = ""), null !== options.channelNameContainsFilter && void 0 !== options.channelNameContainsFilter || (options.channelNameContainsFilter = ""), null === options.customTypeStartsWithFilter || "string" == typeof options.customTypeStartsWithFilter) {
  4934.                   if (!Array.isArray(options._userIdsExactFilter) || !Array.isArray(options._userIdsIncludeFilter) || "string" != typeof options._userIdsIncludeFilterQueryType || [iterator.USER_IDS_INCLUDE_QUERY_TYPE.AND, iterator.USER_IDS_INCLUDE_QUERY_TYPE.OR].indexOf(options._userIdsIncludeFilterQueryType.toUpperCase()) < 0) {
  4935.                     callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), stat);
  4936.                   } else {
  4937.                     if ("number" == typeof options.memberStateFilter) {
  4938.                       if (typeof options.memberStateFilter < 0 || typeof options.memberStateFilter > 4) {
  4939.                         return void callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), stat);
  4940.                       }
  4941.                       options.memberStateFilter = ["all", "joined_only", "invited_only", "invited_by_friend", "invited_by_non_friend"][options.memberStateFilter];
  4942.                     }
  4943.                     if (!cb(options.limit) || !Array.isArray(options.userIdsFilter) || "boolean" != typeof options.includeEmpty || "boolean" != typeof options.userIdsFilterExactMatch || "string" != typeof options.customTypeFilter || !Array.isArray(options.customTypesFilter) || "string" != typeof options.queryType || ["AND", "OR"].indexOf(options.queryType.toUpperCase()) < 0 || "string" != typeof options.order || [Context.ORDER_CHRONOLOGICAL, Context.ORDER_LATEST_LAST_MESSAGE, Context.CHANNEL_NAME_ALPHABETICAL].indexOf(options.order.toLowerCase()) <
  4944.                     0 || "string" != typeof options.memberStateFilter || [link.memberStateFilter.ALL, link.memberStateFilter.JOINED, link.memberStateFilter.INVITED, link.memberStateFilter.INVITED_BY_FRIEND, link.memberStateFilter.INVITED_BY_NON_FRIEND].indexOf(options.memberStateFilter.toLowerCase()) < 0 || "string" != typeof options.nicknameContainsFilter || "string" != typeof options.channelNameContainsFilter || !Array.isArray(options.channelUrlsFilter) || "string" != typeof options.superChannelFilter ||
  4945.                     [link.superChannelFilter.ALL, link.superChannelFilter.SUPER, link.superChannelFilter.NON_SUPER].indexOf(options.superChannelFilter.toLowerCase()) < 0 || "string" != typeof options.publicChannelFilter || [link.publicChannelFilter.ALL, link.publicChannelFilter.PUBLIC, link.publicChannelFilter.PRIVATE].indexOf(options.publicChannelFilter.toLowerCase()) < 0) {
  4946.                       callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), stat);
  4947.                     } else {
  4948.                       if (Array.isArray(options.userIdsFilter) && options.userIdsFilter.length > 0) {
  4949.                         d = {
  4950.                           userIds : options.userIdsFilter,
  4951.                           includeMode : !options.userIdsFilterExactMatch,
  4952.                           queryType : options.queryType
  4953.                         };
  4954.                       }
  4955.                       /** @type {boolean} */
  4956.                       options.isLoading = true;
  4957.                       exports.getInstance().loadUserGroupChannelList(c1State.userId, s, options.limit, options.includeEmpty, options.order, d, options.nicknameContainsFilter, options.channelNameContainsFilter, options.channelUrlsFilter, options.customTypeFilter, options.customTypesFilter, options.customTypeStartsWithFilter, options.memberStateFilter, options.superChannelFilter, options.publicChannelFilter, function(calendar_obj, exisObj) {
  4958.                         if (exisObj) {
  4959.                           return options.isLoading = false, void callback(null, exisObj, stat);
  4960.                         }
  4961.                         /** @type {!Object} */
  4962.                         var data = calendar_obj;
  4963.                         if (!(s = String(data.next)) || s.length <= 0) {
  4964.                           /** @type {boolean} */
  4965.                           options.hasNext = false;
  4966.                         }
  4967.                         var allChannels = data.channels;
  4968.                         /** @type {!Array} */
  4969.                         var cache = [];
  4970.                         var i;
  4971.                         for (i in allChannels) {
  4972.                           var u = link.upsert(allChannels[i]);
  4973.                           cache.push(u);
  4974.                         }
  4975.                         /** @type {boolean} */
  4976.                         options.isLoading = false;
  4977.                         callback(cache, null, stat);
  4978.                       });
  4979.                     }
  4980.                   }
  4981.                 } else {
  4982.                   callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), stat);
  4983.                 }
  4984.               }
  4985.             } else {
  4986.               callback([], null, stat);
  4987.             }
  4988.           };
  4989.         };
  4990.         /** @type {string} */
  4991.         Context.ORDER_LATEST_LAST_MESSAGE = "latest_last_message";
  4992.         /** @type {string} */
  4993.         Context.ORDER_CHRONOLOGICAL = "chronological";
  4994.         /** @type {string} */
  4995.         Context.CHANNEL_NAME_ALPHABETICAL = "channel_name_alphabetical";
  4996.         /** @type {string} */
  4997.         Context.MEMBER_STATE_INVITED_ONLY = "invited_only";
  4998.         /** @type {string} */
  4999.         Context.MEMBER_STATE_JOINED_ONLY = "joined_only";
  5000.         /** @type {string} */
  5001.         Context.MEMBER_STATE_ALL = "all";
  5002.         /**
  5003.          * @return {undefined}
  5004.          */
  5005.         var iterator = function() {
  5006.           /** @type {string} */
  5007.           var authToken = "";
  5008.           /** @type {boolean} */
  5009.           this.isLoading = false;
  5010.           /** @type {boolean} */
  5011.           this.hasNext = true;
  5012.           /** @type {number} */
  5013.           this.limit = 20;
  5014.           /** @type {boolean} */
  5015.           this.includeEmpty = true;
  5016.           /** @type {string} */
  5017.           this.order = iterator.ORDER_CHRONOLOGICAL;
  5018.           /** @type {null} */
  5019.           this.channelNameContainsFilter = null;
  5020.           /** @type {!Array} */
  5021.           this.channelUrlsFilter = [];
  5022.           /** @type {!Array} */
  5023.           this.customTypesFilter = [];
  5024.           /** @type {null} */
  5025.           this.customTypeStartsWithFilter = null;
  5026.           /** @type {string} */
  5027.           this.superChannelFilter = link.superChannelFilter.ALL;
  5028.           /** @type {string} */
  5029.           this.membershipFilter = iterator.MEMBERSHIP_TYPE.JOINED;
  5030.           var request = this;
  5031.           /**
  5032.            * @param {string} err
  5033.            * @return {?}
  5034.            */
  5035.           this.next = function(err) {
  5036.             return setup.getInstance().hasLoggedIn() ? request.hasNext ? request.isLoading ? void callback(null, new Date("Query in progress.", concat.QUERY_IN_PROGRESS), err) : !cb(request.limit) || "boolean" != typeof request.includeEmpty || !Array.isArray(request.customTypesFilter) || !Array.isArray(request.channelUrlsFilter) || null !== request.channelNameContainsFilter && "string" != typeof request.channelNameContainsFilter || null !== request.customTypeStartsWithFilter && "string" != typeof request.customTypeStartsWithFilter ||
  5037.             "string" != typeof request.order || [iterator.ORDER_CHRONOLOGICAL, iterator.ORDER_LATEST_LAST_MESSAGE, iterator.CHANNEL_NAME_ALPHABETICAL].indexOf(request.order.toLowerCase()) < 0 ? void callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), err) : "string" != typeof request.superChannelFilter || [link.superChannelFilter.ALL, link.superChannelFilter.SUPER, link.superChannelFilter.NON_SUPER].indexOf(request.superChannelFilter.toLowerCase()) < 0 || "string" != typeof request.membershipFilter ||
  5038.             [iterator.MEMBERSHIP_TYPE.ALL, iterator.MEMBERSHIP_TYPE.JOINED].indexOf(request.membershipFilter.toLowerCase()) < 0 ? void callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), err) : (request.isLoading = true, void exports.getInstance().loadPublicGroupChannelList(authToken, request.limit, request.includeEmpty, request.order, request.channelNameContainsFilter, request.channelUrlsFilter, request.customTypesFilter, request.customTypeStartsWithFilter, request.superChannelFilter,
  5039.             request.membershipFilter, function(calendar_obj, exisObj) {
  5040.               if (exisObj) {
  5041.                 return request.isLoading = false, void callback(null, exisObj, err);
  5042.               }
  5043.               /** @type {!Object} */
  5044.               var data = calendar_obj;
  5045.               if (!(authToken = String(data.next)) || authToken.length <= 0) {
  5046.                 /** @type {boolean} */
  5047.                 request.hasNext = false;
  5048.               }
  5049.               var allChannels = data.channels;
  5050.               /** @type {!Array} */
  5051.               var cache = [];
  5052.               var i;
  5053.               for (i in allChannels) {
  5054.                 var u = link.upsert(allChannels[i]);
  5055.                 cache.push(u);
  5056.               }
  5057.               /** @type {boolean} */
  5058.               request.isLoading = false;
  5059.               callback(cache, null, err);
  5060.             })) : void callback([], null, err) : void(err && callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), err));
  5061.           };
  5062.         };
  5063.         /** @type {string} */
  5064.         iterator.ORDER_CHRONOLOGICAL = "chronological";
  5065.         /** @type {string} */
  5066.         iterator.CHANNEL_NAME_ALPHABETICAL = "channel_name_alphabetical";
  5067.         iterator.USER_IDS_INCLUDE_QUERY_TYPE = {
  5068.           AND : "AND",
  5069.           OR : "OR"
  5070.         };
  5071.         iterator.MEMBERSHIP_TYPE = {
  5072.           ALL : "all",
  5073.           JOINED : "joined"
  5074.         };
  5075.         /**
  5076.          * @param {!Object} width
  5077.          * @return {undefined}
  5078.          */
  5079.         var initialize = function(width) {
  5080.           /** @type {boolean} */
  5081.           this.isLoading = false;
  5082.           /** @type {!Object} */
  5083.           var n = width;
  5084.           var maritalStatusesStore = this;
  5085.           /**
  5086.            * @param {undefined} results
  5087.            * @param {undefined} err
  5088.            * @param {?} val
  5089.            * @param {string} e
  5090.            * @return {undefined}
  5091.            */
  5092.           this.next = function(results, err, val, e) {
  5093.             if (maritalStatusesStore.isLoading) {
  5094.               callback(null, new Date("Query in progress.", concat.QUERY_IN_PROGRESS), e);
  5095.             } else {
  5096.               if (4 === arguments.length) {
  5097.                 if (cb(results) && cb(err) && "boolean" == typeof val) {
  5098.                   /** @type {boolean} */
  5099.                   maritalStatusesStore.isLoading = true;
  5100.                   exports.getInstance().messageList(n.isOpenChannel(), n.url, results, 0, err, false, val, "", "", [], function(data, exisObj) {
  5101.                     if (exisObj) {
  5102.                       return maritalStatusesStore.isLoading = false, void callback(null, exisObj, e);
  5103.                     }
  5104.                     var msgs = data.messages;
  5105.                     /** @type {!Array} */
  5106.                     var identifierPositions = [];
  5107.                     var i;
  5108.                     for (i in msgs) {
  5109.                       var fn = $.build(msgs[i], n);
  5110.                       if (fn) {
  5111.                         identifierPositions.push(fn);
  5112.                       }
  5113.                     }
  5114.                     /** @type {boolean} */
  5115.                     maritalStatusesStore.isLoading = false;
  5116.                     callback(identifierPositions, null, e);
  5117.                   });
  5118.                 } else {
  5119.                   callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), e);
  5120.                 }
  5121.               } else {
  5122.                 if ("function" != typeof e) {
  5123.                   /** @type {!Array<?>} */
  5124.                   var i = Array.prototype.slice.call(arguments);
  5125.                   if ("function" == typeof i.slice(-1)[0]) {
  5126.                     e = i.pop();
  5127.                   }
  5128.                 }
  5129.                 callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), e);
  5130.               }
  5131.             }
  5132.           };
  5133.           /**
  5134.            * @param {undefined} e
  5135.            * @param {undefined} t
  5136.            * @param {?} obj
  5137.            * @param {string} a
  5138.            * @return {undefined}
  5139.            */
  5140.           this.prev = function(e, t, obj, a) {
  5141.             if (maritalStatusesStore.isLoading) {
  5142.               callback(null, new Date("Query in progress.", concat.QUERY_IN_PROGRESS), a);
  5143.             } else {
  5144.               if (4 === arguments.length) {
  5145.                 if (cb(e) && cb(t) && "boolean" == typeof obj) {
  5146.                   /** @type {boolean} */
  5147.                   maritalStatusesStore.isLoading = true;
  5148.                   exports.getInstance().messageList(n.isOpenChannel(), n.url, e, t, 0, false, obj, "", "", [], function(data, exisObj) {
  5149.                     if (exisObj) {
  5150.                       return maritalStatusesStore.isLoading = false, void callback(null, exisObj, a);
  5151.                     }
  5152.                     var msgs = data.messages;
  5153.                     /** @type {!Array} */
  5154.                     var identifierPositions = [];
  5155.                     var i;
  5156.                     for (i in msgs) {
  5157.                       var fn = $.build(msgs[i], n);
  5158.                       if (fn) {
  5159.                         identifierPositions.push(fn);
  5160.                       }
  5161.                     }
  5162.                     /** @type {boolean} */
  5163.                     maritalStatusesStore.isLoading = false;
  5164.                     callback(identifierPositions, null, a);
  5165.                   });
  5166.                 } else {
  5167.                   callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), a);
  5168.                 }
  5169.               } else {
  5170.                 if ("function" != typeof a) {
  5171.                   /** @type {!Array<?>} */
  5172.                   var i = Array.prototype.slice.call(arguments);
  5173.                   if ("function" == typeof i.slice(-1)[0]) {
  5174.                     a = i.pop();
  5175.                   }
  5176.                 }
  5177.                 callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), a);
  5178.               }
  5179.             }
  5180.           };
  5181.           /**
  5182.            * @param {undefined} results
  5183.            * @param {undefined} err
  5184.            * @param {undefined} r
  5185.            * @param {?} path
  5186.            * @param {string} e
  5187.            * @return {undefined}
  5188.            */
  5189.           this.load = function(results, err, r, path, e) {
  5190.             if (maritalStatusesStore.isLoading) {
  5191.               callback(null, new Date("Query in progress.", concat.QUERY_IN_PROGRESS), e);
  5192.             } else {
  5193.               if (5 === arguments.length) {
  5194.                 if (cb(results) && cb(err) && cb(r) && "boolean" == typeof path) {
  5195.                   /** @type {boolean} */
  5196.                   maritalStatusesStore.isLoading = true;
  5197.                   exports.getInstance().messageList(n.isOpenChannel(), n.url, results, err, r, true, path, "", "", [], function(data, exisObj) {
  5198.                     if (exisObj) {
  5199.                       return maritalStatusesStore.isLoading = false, void callback(null, exisObj, e);
  5200.                     }
  5201.                     var msgs = data.messages;
  5202.                     /** @type {!Array} */
  5203.                     var identifierPositions = [];
  5204.                     var i;
  5205.                     for (i in msgs) {
  5206.                       var fn = $.build(msgs[i], n);
  5207.                       if (fn) {
  5208.                         identifierPositions.push(fn);
  5209.                       }
  5210.                     }
  5211.                     /** @type {boolean} */
  5212.                     maritalStatusesStore.isLoading = false;
  5213.                     callback(identifierPositions, null, e);
  5214.                   });
  5215.                 } else {
  5216.                   callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), e);
  5217.                 }
  5218.               } else {
  5219.                 if ("function" != typeof e) {
  5220.                   /** @type {!Array<?>} */
  5221.                   var o = Array.prototype.slice.call(arguments);
  5222.                   if ("function" == typeof o.slice(-1)[0]) {
  5223.                     e = o.pop();
  5224.                   }
  5225.                 }
  5226.                 callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), e);
  5227.               }
  5228.             }
  5229.           };
  5230.         };
  5231.         /**
  5232.          * @return {undefined}
  5233.          */
  5234.         var Controller = function() {
  5235.           /** @type {string} */
  5236.           var authToken = "";
  5237.           /** @type {number} */
  5238.           this.limit = 20;
  5239.           /** @type {boolean} */
  5240.           this.isLoading = false;
  5241.           /** @type {boolean} */
  5242.           this.hasNext = true;
  5243.           /** @type {null} */
  5244.           this.nameKeyword = null;
  5245.           /** @type {null} */
  5246.           this.urlKeyword = null;
  5247.           /** @type {null} */
  5248.           this.customType = null;
  5249.           var self = this;
  5250.           /**
  5251.            * @param {string} stat
  5252.            * @return {?}
  5253.            */
  5254.           this.next = function(stat) {
  5255.             return this.hasNext ? this.isLoading ? void callback(null, new Date("Query in progress.", concat.QUERY_IN_PROGRESS), stat) : "string" != typeof self.nameKeyword && null !== self.nameKeyword || "string" != typeof self.urlKeyword && null !== self.urlKeyword || "string" != typeof self.customType && null !== self.customType || !cb(self.limit) ? void callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), stat) : (self.isLoading = true, void exports.getInstance().loadOpenChannelList(authToken,
  5256.             self.limit, self.nameKeyword, self.urlKeyword, self.customType, function(text, exisObj) {
  5257.               if (exisObj) {
  5258.                 return self.isLoading = false, void callback(null, exisObj, stat);
  5259.               }
  5260.               /** @type {!Object} */
  5261.               var state = text;
  5262.               try {
  5263.                 /** @type {string} */
  5264.                 authToken = String(state.next);
  5265.               } catch (n) {
  5266.                 /** @type {string} */
  5267.                 authToken = "";
  5268.               }
  5269.               if (!authToken) {
  5270.                 /** @type {boolean} */
  5271.                 self.hasNext = false;
  5272.               }
  5273.               var channels = state.channels;
  5274.               /** @type {!Array} */
  5275.               var o = [];
  5276.               channels.forEach(function(query) {
  5277.                 var n = Model.upsert(query);
  5278.                 o.push(n);
  5279.               });
  5280.               /** @type {boolean} */
  5281.               self.isLoading = false;
  5282.               callback(o, null, stat);
  5283.             })) : void callback([], null, stat);
  5284.           };
  5285.         };
  5286.         /**
  5287.          * @param {!Object} options
  5288.          * @return {undefined}
  5289.          */
  5290.         var Assets = function(options) {
  5291.           /** @type {!Object} */
  5292.           var data = options;
  5293.           /** @type {number} */
  5294.           var start = 0x7fffffffffffffff;
  5295.           /** @type {boolean} */
  5296.           this.hasMore = true;
  5297.           /** @type {boolean} */
  5298.           this.isLoading = false;
  5299.           var self = this;
  5300.           /** @type {number} */
  5301.           this.limit = 20;
  5302.           /** @type {boolean} */
  5303.           this.reverse = false;
  5304.           /** @type {null} */
  5305.           this.messageTypeFilter = null;
  5306.           /** @type {null} */
  5307.           this.customTypeFilter = null;
  5308.           /** @type {!Array} */
  5309.           this.senderUserIdsFilter = [];
  5310.           /**
  5311.            * @return {?}
  5312.            */
  5313.           this.load = function() {
  5314.             /** @type {null} */
  5315.             var productInfo = null;
  5316.             /** @type {!Array<?>} */
  5317.             var nodes = Array.prototype.slice.call(arguments);
  5318.             switch("function" == typeof nodes.slice(-1)[0] && (productInfo = nodes.pop()), nodes.length) {
  5319.               case 2:
  5320.                 this.limit = nodes[0];
  5321.                 this.reverse = nodes[1];
  5322.                 break;
  5323.               case 3:
  5324.                 this.limit = nodes[0];
  5325.                 this.reverse = nodes[1];
  5326.                 this.messageTypeFilter = nodes[2];
  5327.             }
  5328.             if (null === this.messageTypeFilter || void 0 === this.messageTypeFilter || this.messageTypeFilter === R.MessageTypeFilter.ALL ? this.messageTypeFilter = "" : this.messageTypeFilter.toString().toLowerCase() === $.MESSAGE_TYPE_USER || this.messageTypeFilter === R.MessageTypeFilter.USER ? this.messageTypeFilter = "MESG" : this.messageTypeFilter.toString().toLowerCase() === $.MESSAGE_TYPE_FILE || this.messageTypeFilter === R.MessageTypeFilter.FILE ? this.messageTypeFilter = "FILE" : this.messageTypeFilter.toString().toLowerCase() !==
  5329.             $.MESSAGE_TYPE_ADMIN && this.messageTypeFilter !== R.MessageTypeFilter.ADMIN || (this.messageTypeFilter = "ADMM"), !cb(this.limit) || "boolean" != typeof this.reverse || null !== this.messageTypeFilter && "string" != typeof this.messageTypeFilter || null !== this.customTypeFilter && "string" != typeof this.customTypeFilter || !Array.isArray(this.senderUserIdsFilter)) {
  5330.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), productInfo);
  5331.             } else {
  5332.               /** @type {number} */
  5333.               var layer_i = 0;
  5334.               for (; layer_i < this.senderUserIdsFilter.length; layer_i++) {
  5335.                 if ("string" != typeof this.senderUserIdsFilter[layer_i]) {
  5336.                   return void callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), productInfo);
  5337.                 }
  5338.               }
  5339.               if (self.hasMore) {
  5340.                 if (self.isLoading) {
  5341.                   return void callback(null, new Date("Query in progress.", concat.QUERY_IN_PROGRESS), productInfo);
  5342.                 }
  5343.                 /** @type {boolean} */
  5344.                 self.isLoading = true;
  5345.                 exports.getInstance().messageList(data.isOpenChannel(), data.url, start, this.limit, 0, false, this.reverse, this.messageTypeFilter, this.customTypeFilter, this.senderUserIdsFilter, function(data, exisObj) {
  5346.                   if (exisObj) {
  5347.                     return self.isLoading = false, void callback(null, exisObj, productInfo);
  5348.                   }
  5349.                   var msgs = data.messages;
  5350.                   /** @type {!Array} */
  5351.                   var queue = [];
  5352.                   var i;
  5353.                   for (i in msgs) {
  5354.                     var token = $.build(msgs[i], data);
  5355.                     if (token) {
  5356.                       queue.push(token);
  5357.                       if (token.createdAt <= start) {
  5358.                         start = token.createdAt;
  5359.                       }
  5360.                     }
  5361.                   }
  5362.                   if (queue.length <= 0 || queue.length < self.limit) {
  5363.                     /** @type {boolean} */
  5364.                     self.hasMore = false;
  5365.                   }
  5366.                   /** @type {boolean} */
  5367.                   self.isLoading = false;
  5368.                   callback(queue, null, productInfo);
  5369.                 });
  5370.               }
  5371.             }
  5372.           };
  5373.         };
  5374.         /**
  5375.          * @param {number} track
  5376.          * @param {!Object} url
  5377.          * @return {undefined}
  5378.          */
  5379.         var load = function(track, url) {
  5380.           var lastTrackTitle;
  5381.           var s;
  5382.           var result;
  5383.           /** @type {string} */
  5384.           var a = "";
  5385.           /** @type {boolean} */
  5386.           this.hasNext = true;
  5387.           /** @type {number} */
  5388.           this.limit = 20;
  5389.           /** @type {boolean} */
  5390.           this.isLoading = false;
  5391.           /** @type {!Array} */
  5392.           this.userIds = [];
  5393.           /** @type {string} */
  5394.           this.metaDataKey = "";
  5395.           /** @type {!Array} */
  5396.           this.metaDataValues = [];
  5397.           var data = this;
  5398.           switch(url && (s = url), lastTrackTitle = track) {
  5399.             case load.ALL_USER:
  5400.             case load.BLOCKED_USER:
  5401.               /** @type {string} */
  5402.               result = "users";
  5403.               break;
  5404.             case load.FILTERED_USER:
  5405.               /** @type {!Object} */
  5406.               this.userIds = url;
  5407.               /** @type {string} */
  5408.               result = "users";
  5409.               break;
  5410.             case load.PARTICIPANT:
  5411.               /** @type {string} */
  5412.               result = "participants";
  5413.               break;
  5414.             case load.MUTED_USER:
  5415.               /** @type {string} */
  5416.               result = "muted_list";
  5417.               break;
  5418.             case load.BANNED_USER:
  5419.               /** @type {string} */
  5420.               result = "banned_list";
  5421.           }
  5422.           /**
  5423.            * @param {string} stat
  5424.            * @return {undefined}
  5425.            */
  5426.           this.next = function(stat) {
  5427.             if (data.hasNext) {
  5428.               if (setup.getInstance().hasLoggedIn()) {
  5429.                 if (data.isLoading) {
  5430.                   callback(null, new Date("Query in progress.", concat.QUERY_IN_PROGRESS), stat);
  5431.                 } else {
  5432.                   if (!(cb(data.limit) && Array.isArray(data.userIds) && "string" == typeof data.metaDataKey && Array.isArray(data.metaDataValues)) || data.metaDataKey && check(data.metaDataValues) || !data.metaDataKey && !check(data.metaDataValues)) {
  5433.                     callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), stat);
  5434.                   } else {
  5435.                     /** @type {boolean} */
  5436.                     data.isLoading = true;
  5437.                     /**
  5438.                      * @param {!Object} res
  5439.                      * @param {?} refresh
  5440.                      * @return {?}
  5441.                      */
  5442.                     var create = function(res, refresh) {
  5443.                       if (refresh) {
  5444.                         return data.isLoading = false, void callback(null, refresh, stat);
  5445.                       }
  5446.                       if (!(a = res.next)) {
  5447.                         /** @type {boolean} */
  5448.                         data.hasNext = false;
  5449.                       }
  5450.                       var r = res[result];
  5451.                       /** @type {!Array} */
  5452.                       var users = [];
  5453.                       var i;
  5454.                       for (i in r) {
  5455.                         if (track === load.BANNED_USER) {
  5456.                           users.push(new client(r[i].user));
  5457.                         } else {
  5458.                           users.push(new client(r[i]));
  5459.                         }
  5460.                       }
  5461.                       /** @type {boolean} */
  5462.                       data.isLoading = false;
  5463.                       callback(users, null, stat);
  5464.                     };
  5465.                     switch(lastTrackTitle) {
  5466.                       case load.ALL_USER:
  5467.                         exports.getInstance().loadUserList(a, data.limit, [], data.metaDataKey, data.metaDataValues, create);
  5468.                         break;
  5469.                       case load.FILTERED_USER:
  5470.                         exports.getInstance().loadUserList(a, data.limit, data.userIds, data.metaDataKey, data.metaDataValues, create);
  5471.                         break;
  5472.                       case load.BLOCKED_USER:
  5473.                         exports.getInstance().loadBlockedUserList(setup.getInstance().getCurrentUserId(), a, data.limit, create);
  5474.                         break;
  5475.                       case load.PARTICIPANT:
  5476.                         exports.getInstance().loadOpenChannelParticipantList(s.url, a, data.limit, create);
  5477.                         break;
  5478.                       case load.MUTED_USER:
  5479.                         exports.getInstance().loadMutedUserList(s, a, data.limit, create);
  5480.                         break;
  5481.                       case load.BANNED_USER:
  5482.                         exports.getInstance().loadBannedUserList(s, a, data.limit, create);
  5483.                     }
  5484.                   }
  5485.                 }
  5486.               } else {
  5487.                 if (stat) {
  5488.                   callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED), stat);
  5489.                 }
  5490.               }
  5491.             } else {
  5492.               callback([], null, stat);
  5493.             }
  5494.           };
  5495.         };
  5496.         /** @type {string} */
  5497.         load.ALL_USER = "alluser";
  5498.         /** @type {string} */
  5499.         load.FILTERED_USER = "filtereduser";
  5500.         /** @type {string} */
  5501.         load.BLOCKED_USER = "blockeduser";
  5502.         /** @type {string} */
  5503.         load.PARTICIPANT = "participant";
  5504.         /** @type {string} */
  5505.         load.MUTED_USER = "muteduser";
  5506.         /** @type {string} */
  5507.         load.BANNED_USER = "banneduser";
  5508.         /**
  5509.          * @return {undefined}
  5510.          */
  5511.         var concat = function() {
  5512.         };
  5513.         /** @type {number} */
  5514.         concat.INVALID_INITIALIZATION = 800100;
  5515.         /** @type {number} */
  5516.         concat.CONNECTION_REQUIRED = 800101;
  5517.         /** @type {number} */
  5518.         concat.INVALID_PARAMETER = 800110;
  5519.         /** @type {number} */
  5520.         concat.NETWORK_ERROR = 800120;
  5521.         /** @type {number} */
  5522.         concat.NETWORK_ROUTING_ERROR = 800121;
  5523.         /** @type {number} */
  5524.         concat.MALFORMED_DATA = 800130;
  5525.         /** @type {number} */
  5526.         concat.MALFORMED_ERROR_DATA = 800140;
  5527.         /** @type {number} */
  5528.         concat.WRONG_CHANNEL_TYPE = 800150;
  5529.         /** @type {number} */
  5530.         concat.MARK_AS_READ_RATE_LIMIT_EXCEEDED = 800160;
  5531.         /** @type {number} */
  5532.         concat.QUERY_IN_PROGRESS = 800170;
  5533.         /** @type {number} */
  5534.         concat.ACK_TIMEOUT = 800180;
  5535.         /** @type {number} */
  5536.         concat.LOGIN_TIMEOUT = 800190;
  5537.         /** @type {number} */
  5538.         concat.WEBSOCKET_CONNECTION_CLOSED = 800200;
  5539.         /** @type {number} */
  5540.         concat.WEBSOCKET_CONNECTION_FAILED = 800210;
  5541.         /** @type {number} */
  5542.         concat.REQUEST_FAILED = 800220;
  5543.         /** @type {number} */
  5544.         concat.FILE_UPLOAD_CANCEL_FAILED = 800230;
  5545.         /** @type {number} */
  5546.         concat.REQUEST_CANCELLED = 800240;
  5547.         /**
  5548.          * @param {?} listener
  5549.          * @return {undefined}
  5550.          */
  5551.         var Client = function(listener) {
  5552.           var socket;
  5553.           var newentry_;
  5554.           /** @type {boolean} */
  5555.           var callback_topic = false;
  5556.           if (!listener) {
  5557.             listener = new Client.WSClientHandler;
  5558.           }
  5559.           /**
  5560.            * @return {?}
  5561.            */
  5562.           this.getConnectionState = function() {
  5563.             return 1 === socket.readyState ? setup.getInstance().connectionState.OPEN : setup.getInstance().connectionState.CLOSED;
  5564.           };
  5565.           var riak = new function() {
  5566.             var _takingTooLongTimeout;
  5567.             var paintNodesTimeout;
  5568.             /**
  5569.              * @return {undefined}
  5570.              */
  5571.             this.ping = function() {
  5572.               if (t) {
  5573.                 console.log("PING");
  5574.               }
  5575.               clearTimeout(_takingTooLongTimeout);
  5576.               clearTimeout(paintNodesTimeout);
  5577.               /** @type {number} */
  5578.               _takingTooLongTimeout = setTimeout(function() {
  5579.                 var a = init.bPing();
  5580.                 setup.getInstance().wsClient.send(a);
  5581.                 /** @type {number} */
  5582.                 paintNodesTimeout = setTimeout(function() {
  5583.                   if (t) {
  5584.                     console.log("PING Timeout");
  5585.                   }
  5586.                   clearTimeout(_takingTooLongTimeout);
  5587.                   clearTimeout(paintNodesTimeout);
  5588.                   listener.onError();
  5589.                 }, 5e3);
  5590.               }, 15e3);
  5591.             };
  5592.             /**
  5593.              * @return {undefined}
  5594.              */
  5595.             this.stop = function() {
  5596.               clearTimeout(_takingTooLongTimeout);
  5597.               clearTimeout(paintNodesTimeout);
  5598.             };
  5599.           };
  5600.           /**
  5601.            * @param {!Object} o
  5602.            * @param {!Object} name
  5603.            * @param {?} v
  5604.            * @return {?}
  5605.            */
  5606.           this.connect = function(o, name, v) {
  5607.             if (t) {
  5608.               console.log("WSClient connect called");
  5609.             }
  5610.             newentry_ = v;
  5611.             /** @type {null} */
  5612.             var Socket = null;
  5613.             /** @type {boolean} */
  5614.             var _ = false;
  5615.             try {
  5616.               Socket = "undefined" == typeof WebSocket ? require("./node_modules/websocket/lib/browser.js").w3cwebsocket : WebSocket;
  5617.             } catch (e) {
  5618.               /** @type {function(new:WebSocket, string, string=): ?} */
  5619.               Socket = WebSocket;
  5620.             }
  5621.             try {
  5622.               /** @type {string} */
  5623.               var entryName = "/?p=JS&pv=" + encodeURIComponent(i) + "&sv=" + encodeURIComponent("3.0.69") + "&ai=" + encodeURIComponent(path);
  5624.               if (exports.getInstance().sessionKey ? entryName = entryName + ("&key=" + encodeURIComponent(exports.getInstance().sessionKey)) : entryName = entryName + ("&user_id=" + encodeURIComponent(o) + "&access_token=" + encodeURIComponent(name)), !(socket = new Socket(newentry_ + entryName))) {
  5625.                 return void listener.onError("ws is not exist.");
  5626.               }
  5627.             } catch (id) {
  5628.               return void listener.onError(id);
  5629.             }
  5630.             if (t) {
  5631.               try {
  5632.                 window.ws = socket;
  5633.               } catch (e) {
  5634.               }
  5635.             }
  5636.             /**
  5637.              * @param {?} evt
  5638.              * @return {undefined}
  5639.              */
  5640.             socket.onopen = function(evt) {
  5641.               if (riak) {
  5642.                 riak.ping();
  5643.               }
  5644.               if (t) {
  5645.                 console.log("WSClient onopen called");
  5646.               }
  5647.               listener.onOpen(evt);
  5648.             };
  5649.             /**
  5650.              * @param {!Object} event
  5651.              * @return {undefined}
  5652.              */
  5653.             socket.onmessage = function(event) {
  5654.               (new Date).getTime();
  5655.               var functions = event.data.split("\n");
  5656.               var name;
  5657.               for (name in functions) {
  5658.                 var fn = functions[name];
  5659.                 if (fn && "string" == typeof fn) {
  5660.                   try {
  5661.                     if ("PONG" === fn.substring(0, 4)) {
  5662.                       if (riak) {
  5663.                         riak.ping();
  5664.                       }
  5665.                       continue;
  5666.                     }
  5667.                   } catch (size_buffer) {
  5668.                     if (t) {
  5669.                       console.log("ws.onmessage-command check error: ", size_buffer);
  5670.                     }
  5671.                   }
  5672.                   listener.onMessage(fn);
  5673.                 }
  5674.               }
  5675.             };
  5676.             /**
  5677.              * @param {string} e
  5678.              * @return {undefined}
  5679.              */
  5680.             socket.onclose = function(e) {
  5681.               if (t) {
  5682.                 console.log("WSClient ws.onclose called - e, explicitDisconnect: ", e, callback_topic);
  5683.               }
  5684.               if (riak) {
  5685.                 riak.stop();
  5686.               }
  5687.               if (callback_topic) {
  5688.                 listener.onClose(e);
  5689.               } else {
  5690.                 if (!_) {
  5691.                   listener.onError(e);
  5692.                 }
  5693.               }
  5694.               /** @type {boolean} */
  5695.               callback_topic = false;
  5696.             };
  5697.             /**
  5698.              * @param {string} e
  5699.              * @return {undefined}
  5700.              */
  5701.             socket.onerror = function(e) {
  5702.               if (t) {
  5703.                 console.log("WSClient ws.onerror called: ", e);
  5704.               }
  5705.               if (riak) {
  5706.                 riak.stop();
  5707.               }
  5708.               /** @type {boolean} */
  5709.               _ = true;
  5710.               listener.onError(e);
  5711.             };
  5712.           };
  5713.           /**
  5714.            * @param {?} force
  5715.            * @param {?} callback
  5716.            * @return {undefined}
  5717.            */
  5718.           this.disconnect = function(force, callback) {
  5719.             if (t) {
  5720.               console.log("WSClient disconnect called [explicit]: ", force);
  5721.             }
  5722.             if (riak) {
  5723.               riak.stop();
  5724.             }
  5725.             /** @type {null} */
  5726.             riak = null;
  5727.             /** @type {boolean} */
  5728.             callback_topic = true === force;
  5729.             if (socket) {
  5730.               /**
  5731.                * @return {undefined}
  5732.                */
  5733.               socket.onopen = function() {
  5734.               };
  5735.               /**
  5736.                * @return {undefined}
  5737.                */
  5738.               socket.onmessage = function() {
  5739.               };
  5740.               /**
  5741.                * @return {undefined}
  5742.                */
  5743.               socket.onclose = function() {
  5744.                 if (callback) {
  5745.                   callback();
  5746.                 }
  5747.               };
  5748.               /**
  5749.                * @return {undefined}
  5750.                */
  5751.               socket.onerror = function() {
  5752.               };
  5753.               socket.close();
  5754.               /** @type {null} */
  5755.               socket = null;
  5756.             }
  5757.             if (callback_topic) {
  5758.               listener.onClose();
  5759.             } else {
  5760.               listener.onError();
  5761.             }
  5762.             /** @type {boolean} */
  5763.             callback_topic = false;
  5764.           };
  5765.           /**
  5766.            * @param {!Object} value
  5767.            * @param {!Function} next
  5768.            * @return {undefined}
  5769.            */
  5770.           this.send = function(value, next) {
  5771.             if (1 !== socket.readyState) {
  5772.               if (next) {
  5773.                 next(null, new Date("Connection is not valid. Please reconnect.", concat.WEBSOCKET_CONNECTION_CLOSED));
  5774.               }
  5775.             } else {
  5776.               socket.send(value.encode());
  5777.               if (next) {
  5778.                 next(null, null);
  5779.               }
  5780.             }
  5781.           };
  5782.         };
  5783.         /**
  5784.          * @return {undefined}
  5785.          */
  5786.         Client.WSClientHandler = function() {
  5787.           /**
  5788.            * @return {undefined}
  5789.            */
  5790.           this.onReady = function() {
  5791.           };
  5792.           /**
  5793.            * @return {undefined}
  5794.            */
  5795.           this.onOpen = function() {
  5796.           };
  5797.           /**
  5798.            * @return {undefined}
  5799.            */
  5800.           this.onClose = function() {
  5801.           };
  5802.           /**
  5803.            * @return {undefined}
  5804.            */
  5805.           this.onMessage = function() {
  5806.           };
  5807.           /**
  5808.            * @return {undefined}
  5809.            */
  5810.           this.onError = function() {
  5811.           };
  5812.         };
  5813.         /**
  5814.          * @return {?}
  5815.          */
  5816.         var exports = function() {
  5817.           var quandl = exports.getInstance();
  5818.           if (quandl) {
  5819.             return quandl;
  5820.           }
  5821.           this.sessionKey;
  5822.           /** @type {number} */
  5823.           var t = 0;
  5824.           /**
  5825.            * @param {string} _
  5826.            * @param {?} c
  5827.            * @param {string} t
  5828.            * @param {!Function} e
  5829.            * @return {undefined}
  5830.            */
  5831.           this.getMessageChangeLogsByToken = function(_, c, t, e) {
  5832.             /** @type {string} */
  5833.             var r = "";
  5834.             /** @type {string} */
  5835.             r = _ ? exports.API_OPENCHANNELS_CHANNELURL_MESSAGES_CHANGELOGS.replace("%s", encodeURIComponent(c)) : exports.API_GROUPCHANNELS_CHANNELURL_MESSAGES_CHANGELOGS.replace("%s", encodeURIComponent(c));
  5836.             var app = {};
  5837.             if (t) {
  5838.               /** @type {string} */
  5839.               app.token = t;
  5840.             }
  5841.             callback(r, app, e);
  5842.           };
  5843.           /**
  5844.            * @param {?} s
  5845.            * @param {?} n
  5846.            * @param {string} k
  5847.            * @return {undefined}
  5848.            */
  5849.           this.setChannelInvitationPreference = function(s, n, k) {
  5850.             /** @type {string} */
  5851.             var lexed = exports.API_USERS_USERID_GROUP_CHANNEL_INVITATION_PREFERENCE.replace("%s", encodeURIComponent(s));
  5852.             render(lexed, {
  5853.               auto_accept : n
  5854.             }, k);
  5855.           };
  5856.           /**
  5857.            * @param {?} s
  5858.            * @param {string} color
  5859.            * @return {undefined}
  5860.            */
  5861.           this.getChannelInvitationPreference = function(s, color) {
  5862.             /** @type {string} */
  5863.             var t = exports.API_USERS_USERID_GROUP_CHANNEL_INVITATION_PREFERENCE.replace("%s", encodeURIComponent(s));
  5864.             callback(t, color);
  5865.           };
  5866.           /**
  5867.            * @param {?} xml
  5868.            * @param {number} t
  5869.            * @param {!Function} c
  5870.            * @return {undefined}
  5871.            */
  5872.           this.getGroupChannelCount = function(xml, t, c) {
  5873.             /** @type {string} */
  5874.             var s = exports.API_USERS_USERID_GROUP_CHANNEL_COUNT.replace("%s", encodeURIComponent(xml));
  5875.             /** @type {string} */
  5876.             var isActive = "";
  5877.             /** @type {string} */
  5878.             isActive = t === link.memberState.JOINED ? "joined" : t === link.memberState.INVITED ? "invited" : t === link.memberState.INVITED_BY_FRIEND ? "invited_by_friend" : t === link.memberState.INVITED_BY_NON_FRIEND ? "invited_by_non_friend" : "all";
  5879.             callback(s, {
  5880.               state : isActive
  5881.             }, c);
  5882.           };
  5883.           /**
  5884.            * @param {?} s
  5885.            * @param {!Array} n
  5886.            * @param {!Function} updated
  5887.            * @return {undefined}
  5888.            */
  5889.           this.getUnreadItemCount = function(s, n, updated) {
  5890.             /** @type {string} */
  5891.             var e = exports.API_USERS_USERID_UNREAD_ITEM_COUNT.replace("%s", encodeURIComponent(s));
  5892.             var r = {
  5893.               item_keys : n.join(",")
  5894.             };
  5895.             callback(e, r, updated);
  5896.           };
  5897.           /**
  5898.            * @param {?} hash
  5899.            * @param {!Object} result
  5900.            * @param {string} styles
  5901.            * @param {!Function} zoom
  5902.            * @return {undefined}
  5903.            */
  5904.           this.getTotalUnreadMessageCount = function(hash, result, styles, zoom) {
  5905.             /** @type {string} */
  5906.             var r = exports.API_USERS_USERID_UNREAD_MESSAGE_COUNT.replace("%s", encodeURIComponent(hash));
  5907.             /** @type {null} */
  5908.             var body = null;
  5909.             if (null !== result && result.length > 0) {
  5910.               body = extend(result);
  5911.             }
  5912.             var x = {
  5913.               super_mode : styles
  5914.             };
  5915.             if (body) {
  5916.               x.custom_types = body;
  5917.             }
  5918.             callback(r, x, zoom);
  5919.           };
  5920.           /**
  5921.            * @param {?} s
  5922.            * @param {string} color
  5923.            * @return {undefined}
  5924.            */
  5925.           this.getTotalUnreadChannelCount = function(s, color) {
  5926.             /** @type {string} */
  5927.             var t = exports.API_USERS_USERID_UNREAD_CHANNEL_COUNT.replace("%s", encodeURIComponent(s));
  5928.             callback(t, color);
  5929.           };
  5930.           /**
  5931.            * @param {!Function} cb
  5932.            * @return {undefined}
  5933.            */
  5934.           this.checkRouting = function(cb) {
  5935.             if (setup.getInstance() && setup.getInstance().customApiHost && setup.getInstance().customWsHost) {
  5936.               if ("function" == typeof cb) {
  5937.                 cb({
  5938.                   API_HOST : setup.getInstance().customApiHost,
  5939.                   WS_HOST : setup.getInstance().customWsHost
  5940.                 });
  5941.               }
  5942.             } else {
  5943.               /** @type {number} */
  5944.               var t0 = (new Date).getTime() / 1e3;
  5945.               if (0 === t || t - t0 > 300) {
  5946.                 get(exports.API_ROUTING_URL.replace("%s", path), {}, "GET", {
  5947.                   SendBird : spec + path
  5948.                 }, function(result, i) {
  5949.                   if (i) {
  5950.                     cb(null, new Date("Server is unreachable.", concat.NETWORK_ROUTING_ERROR));
  5951.                   } else {
  5952.                     ref1 = result.ws_server;
  5953.                     combined = result.api_server;
  5954.                     /** @type {number} */
  5955.                     t = t0;
  5956.                     if ("function" == typeof cb) {
  5957.                       cb({
  5958.                         API_HOST : combined,
  5959.                         WS_HOST : ref1
  5960.                       });
  5961.                     }
  5962.                   }
  5963.                 });
  5964.               } else {
  5965.                 cb({
  5966.                   API_HOST : setup.getInstance().getCurrentApiHost(),
  5967.                   WS_HOST : setup.getInstance().getCurrentWsHost()
  5968.                 }, null);
  5969.               }
  5970.             }
  5971.           };
  5972.           /**
  5973.            * @param {string} data
  5974.            * @param {number} level
  5975.            * @param {!Object} file
  5976.            * @param {string} obj
  5977.            * @param {!Object} stream
  5978.            * @param {string} state
  5979.            * @param {!Function} done
  5980.            * @param {?} progress
  5981.            * @param {?} params
  5982.            * @param {?} type
  5983.            * @return {undefined}
  5984.            */
  5985.           var request = function(data, level, file, obj, stream, state, done, progress, params, type) {
  5986.             if (setup.getInstance().hasLoggedIn()) {
  5987.               exports.getInstance().checkRouting(function(config, canCreateDiscussions) {
  5988.                 if (canCreateDiscussions) {
  5989.                   done(null, new Date("Request failed.", concat.REQUEST_FAILED));
  5990.                 } else {
  5991.                   var xhr = cb();
  5992.                   xhr.open("POST", config.API_HOST + data, true);
  5993.                   xhr.setRequestHeader("SendBird", spec + path);
  5994.                   xhr.setRequestHeader("Session-Key", exports.getInstance().sessionKey);
  5995.                   var self = Model ? new Model : new FormData;
  5996.                   var i;
  5997.                   for (i in obj && "undefined" != typeof Blob && (file instanceof Blob || "string" == typeof file || Array.isArray(file) || file.hasOwnProperty("isRNFetchBlobPolyfill")) ? self.append("file", new Blob([file], {
  5998.                     type : obj
  5999.                   }), file.name) : self.append("file", file, file.name), state && self.append("channel_url", state), stream) {
  6000.                     /** @type {number} */
  6001.                     var id = parseInt(i) + 1;
  6002.                     self.append("thumbnail" + id, stream[i].maxWidth + "," + stream[i].maxHeight);
  6003.                   }
  6004.                   /**
  6005.                    * @return {undefined}
  6006.                    */
  6007.                   xhr.onload = function() {
  6008.                     if (params && params[type]) {
  6009.                       delete params[type];
  6010.                     }
  6011.                     if (xhr.status >= 200 && xhr.status < 400) {
  6012.                       callback(null, JSON.parse(xhr.responseText), done);
  6013.                     } else {
  6014.                       callback({
  6015.                         status : xhr.status,
  6016.                         statusText : xhr.statusText,
  6017.                         response : xhr.responseText
  6018.                       }, null, done);
  6019.                     }
  6020.                   };
  6021.                   /**
  6022.                    * @param {?} event
  6023.                    * @return {undefined}
  6024.                    */
  6025.                   xhr.onerror = function(event) {
  6026.                     if (params && params[type]) {
  6027.                       delete params[type];
  6028.                     }
  6029.                     done(null, new Date(xhr.statusText, concat.REQUEST_FAILED));
  6030.                   };
  6031.                   /**
  6032.                    * @param {?} event
  6033.                    * @return {undefined}
  6034.                    */
  6035.                   xhr.onabort = function(event) {
  6036.                     if (params && params[type]) {
  6037.                       delete params[type];
  6038.                     }
  6039.                     done(null, new Date("File upload has been cancelled.", concat.REQUEST_CANCELLED));
  6040.                   };
  6041.                   /**
  6042.                    * @param {!ProgressEvent} e
  6043.                    * @return {undefined}
  6044.                    */
  6045.                   xhr.upload.onprogress = function(e) {
  6046.                     if (e.lengthComputable && e.loaded >= e.total && params && params[type]) {
  6047.                       delete params[type];
  6048.                     }
  6049.                     if (progress) {
  6050.                       progress(e);
  6051.                     }
  6052.                   };
  6053.                   if (self.oldIE) {
  6054.                     xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + self.boundary);
  6055.                     xhr.send(self.toString());
  6056.                   } else {
  6057.                     xhr.send(self);
  6058.                   }
  6059.                   if (params) {
  6060.                     params[type] = xhr;
  6061.                   }
  6062.                 }
  6063.               });
  6064.             } else {
  6065.               if (done) {
  6066.                 done(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED));
  6067.               }
  6068.             }
  6069.           };
  6070.           /**
  6071.            * @param {string} data
  6072.            * @param {!Object} obj
  6073.            * @param {!Object} callback
  6074.            * @return {undefined}
  6075.            */
  6076.           var forEach = function(data, obj, callback) {
  6077.             if ("function" == typeof obj) {
  6078.               /** @type {!Object} */
  6079.               callback = obj;
  6080.               obj = {};
  6081.             }
  6082.             if (setup.getInstance().hasLoggedIn()) {
  6083.               exports.getInstance().checkRouting(function(config, canCreateDiscussions) {
  6084.                 if (canCreateDiscussions) {
  6085.                   callback(null, new Date("Request failed.", concat.REQUEST_FAILED));
  6086.                 } else {
  6087.                   get(config.API_HOST + data, obj, "DELETE", {
  6088.                     "Session-Key" : exports.getInstance().sessionKey,
  6089.                     SendBird : spec + path
  6090.                   }, callback);
  6091.                 }
  6092.               });
  6093.             } else {
  6094.               if (callback) {
  6095.                 callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED));
  6096.               }
  6097.             }
  6098.           };
  6099.           /**
  6100.            * @param {!Object} arr
  6101.            * @return {?}
  6102.            */
  6103.           var extend = function(arr) {
  6104.             /** @type {string} */
  6105.             var reverse_search_string = "";
  6106.             var index;
  6107.             for (index in arr) {
  6108.               if (arr.hasOwnProperty(index)) {
  6109.                 /** @type {string} */
  6110.                 reverse_search_string = reverse_search_string + (encodeURIComponent(arr[index]) + ",");
  6111.               }
  6112.             }
  6113.             return reverse_search_string.length > 1 && (reverse_search_string = reverse_search_string.substring(0, reverse_search_string.length - 1)), reverse_search_string;
  6114.           };
  6115.           /**
  6116.            * @param {string} str
  6117.            * @param {!Object} n
  6118.            * @param {!Function} text
  6119.            * @return {undefined}
  6120.            */
  6121.           var callback = function(str, n, text) {
  6122.             if ("function" == typeof n && (text = n, n = {}), setup.getInstance().hasLoggedIn()) {
  6123.               var data;
  6124.               /** @type {string} */
  6125.               var value = "";
  6126.               if (n) {
  6127.                 var c;
  6128.                 for (c in n) {
  6129.                   if ("" !== value) {
  6130.                     /** @type {string} */
  6131.                     value = value + "&";
  6132.                   }
  6133.                   /** @type {string} */
  6134.                   value = value + (c + "=" + n[c]);
  6135.                 }
  6136.                 /** @type {string} */
  6137.                 data = str + "?" + value;
  6138.               } else {
  6139.                 /** @type {string} */
  6140.                 data = str;
  6141.               }
  6142.               exports.getInstance().checkRouting(function(config, canCreateDiscussions) {
  6143.                 if (canCreateDiscussions) {
  6144.                   text(null, new Date("Request failed.", concat.REQUEST_FAILED));
  6145.                 } else {
  6146.                   get(config.API_HOST + data, n, "GET", {
  6147.                     "Session-Key" : exports.getInstance().sessionKey,
  6148.                     SendBird : spec + path
  6149.                   }, text);
  6150.                 }
  6151.               });
  6152.             } else {
  6153.               if (text) {
  6154.                 text(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED));
  6155.               }
  6156.             }
  6157.           };
  6158.           /**
  6159.            * @param {string} data
  6160.            * @param {!Object} options
  6161.            * @param {!Function} callback
  6162.            * @return {undefined}
  6163.            */
  6164.           var next = function(data, options, callback) {
  6165.             if ("function" == typeof options) {
  6166.               /** @type {!Object} */
  6167.               callback = options;
  6168.               options = {};
  6169.             }
  6170.             if (setup.getInstance().hasLoggedIn()) {
  6171.               exports.getInstance().checkRouting(function(config, webhookMsg) {
  6172.                 if (webhookMsg) {
  6173.                   callback(null, webhookMsg);
  6174.                 } else {
  6175.                   get(config.API_HOST + data, options, "POST", {
  6176.                     "Session-Key" : exports.getInstance().sessionKey,
  6177.                     SendBird : spec + path
  6178.                   }, callback);
  6179.                 }
  6180.               });
  6181.             } else {
  6182.               if (callback) {
  6183.                 callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED));
  6184.               }
  6185.             }
  6186.           };
  6187.           /**
  6188.            * @param {string} input
  6189.            * @param {!Object} obj
  6190.            * @param {!Object} text
  6191.            * @return {undefined}
  6192.            */
  6193.           var render = function(input, obj, text) {
  6194.             if ("function" == typeof obj) {
  6195.               /** @type {!Object} */
  6196.               text = obj;
  6197.               obj = {};
  6198.             }
  6199.             if (setup.getInstance().hasLoggedIn()) {
  6200.               exports.getInstance().checkRouting(function(CONFIG, canCreateDiscussions) {
  6201.                 if (!canCreateDiscussions) {
  6202.                   get(CONFIG.API_HOST + input, obj, "PUT", {
  6203.                     "Session-Key" : exports.getInstance().sessionKey,
  6204.                     SendBird : spec + path
  6205.                   }, text);
  6206.                 }
  6207.               });
  6208.             } else {
  6209.               if (text) {
  6210.                 text(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED));
  6211.               }
  6212.             }
  6213.           };
  6214.           /**
  6215.            * @param {?} id
  6216.            * @param {string} event
  6217.            * @param {!Function} cb
  6218.            * @return {undefined}
  6219.            */
  6220.           this.addFriends = function(id, event, cb) {
  6221.             /** @type {string} */
  6222.             var instrumented = exports.API_FRIENDS.replace("%s", encodeURIComponent(id));
  6223.             next(instrumented, {
  6224.               user_ids : event
  6225.             }, cb);
  6226.           };
  6227.           /**
  6228.            * @param {!Array} keywords
  6229.            * @param {!Array} k
  6230.            * @param {string} fun
  6231.            * @return {undefined}
  6232.            */
  6233.           this.deleteFriends = function(keywords, k, fun) {
  6234.             /** @type {string} */
  6235.             var b = exports.API_FRIENDS.replace("%s", encodeURIComponent(keywords));
  6236.             if (k.length > 0) {
  6237.               b = b + "?user_ids=";
  6238.               k.forEach(function(qov) {
  6239.                 b = b + (encodeURIComponent(qov) + ",");
  6240.               });
  6241.               b = b.substring(0, b.length - 1);
  6242.             }
  6243.             forEach(b, {}, fun);
  6244.           };
  6245.           /**
  6246.            * @param {!Array} val
  6247.            * @param {!Array} o
  6248.            * @param {string} fun
  6249.            * @return {undefined}
  6250.            */
  6251.           this.deleteFriendDiscoveries = function(val, o, fun) {
  6252.             /** @type {string} */
  6253.             var b = exports.API_FRIENDS_DISCOVERIES.replace("%s", encodeURIComponent(val));
  6254.             if (o.length > 0) {
  6255.               b = b + "?friend_discovery_keys=";
  6256.               o.forEach(function(qov) {
  6257.                 b = b + (encodeURIComponent(qov) + ",");
  6258.               });
  6259.               b = b.substring(0, b.length - 1);
  6260.             }
  6261.             forEach(b, {}, fun);
  6262.           };
  6263.           /**
  6264.            * @param {?} val
  6265.            * @param {!Object} from
  6266.            * @param {string} profile
  6267.            * @return {undefined}
  6268.            */
  6269.           this.uploadFriendDiscoveries = function(val, from, profile) {
  6270.             /** @type {string} */
  6271.             var lexed = exports.API_FRIENDS_DISCOVERIES.replace("%s", encodeURIComponent(val));
  6272.             var view = {
  6273.               friend_discoveries : []
  6274.             };
  6275.             from.forEach(function(views) {
  6276.               view.friend_discoveries.push({
  6277.                 friend_discovery_key : views.friendDiscoveryKey,
  6278.                 friend_name : "string" == typeof views.friendName || views.friendName ? views.friendName : null
  6279.               });
  6280.             });
  6281.             render(lexed, view, profile);
  6282.           };
  6283.           /**
  6284.            * @param {?} s
  6285.            * @param {string} name
  6286.            * @param {!Function} updated
  6287.            * @return {undefined}
  6288.            */
  6289.           this.getFriendChangeLogsByToken = function(s, name, updated) {
  6290.             /** @type {string} */
  6291.             var e = exports.API_FRIENDS_CHANGE_LOGS.replace("%s", encodeURIComponent(s));
  6292.             var r = {};
  6293.             if (name) {
  6294.               /** @type {string} */
  6295.               r.token = name;
  6296.             }
  6297.             callback(e, r, updated);
  6298.           };
  6299.           /**
  6300.            * @param {?} match
  6301.            * @param {string} token
  6302.            * @param {number} duration
  6303.            * @param {!Function} value
  6304.            * @return {undefined}
  6305.            */
  6306.           this.friendListQuery = function(match, token, duration, value) {
  6307.             /** @type {string} */
  6308.             var r = exports.API_FRIENDS.replace("%s", encodeURIComponent(match));
  6309.             var result = {
  6310.               limit : duration,
  6311.               token : encodeURIComponent(token)
  6312.             };
  6313.             callback(r, result, value);
  6314.           };
  6315.           /**
  6316.            * @param {?} s
  6317.            * @param {!Object} data
  6318.            * @param {!Function} items
  6319.            * @return {undefined}
  6320.            */
  6321.           this.createUserMetaData = function(s, data, items) {
  6322.             /** @type {string} */
  6323.             var instrumented = exports.API_USERS_USERID_METADATA.replace("%s", encodeURIComponent(s));
  6324.             var r = {};
  6325.             /** @type {!Object} */
  6326.             r.metadata = data;
  6327.             next(instrumented, r, items);
  6328.           };
  6329.           /**
  6330.            * @param {?} i
  6331.            * @param {!Object} match
  6332.            * @param {!Object} keys
  6333.            * @param {string} k
  6334.            * @return {undefined}
  6335.            */
  6336.           this.updateUserMetaData = function(i, match, keys, k) {
  6337.             /** @type {string} */
  6338.             var lexed = exports.API_USERS_USERID_METADATA.replace("%s", encodeURIComponent(i));
  6339.             var self = {};
  6340.             /** @type {!Object} */
  6341.             self.metadata = match;
  6342.             /** @type {!Object} */
  6343.             self.upsert = keys;
  6344.             render(lexed, self, k);
  6345.           };
  6346.           /**
  6347.            * @param {?} hash
  6348.            * @param {string} fun
  6349.            * @return {undefined}
  6350.            */
  6351.           this.deleteAllUserMetaData = function(hash, fun) {
  6352.             /** @type {string} */
  6353.             var temporaryStyles = exports.API_USERS_USERID_METADATA.replace("%s", encodeURIComponent(hash));
  6354.             forEach(temporaryStyles, {}, fun);
  6355.           };
  6356.           /**
  6357.            * @param {?} s
  6358.            * @param {string} n
  6359.            * @param {string} fun
  6360.            * @return {undefined}
  6361.            */
  6362.           this.deleteUserMetaData = function(s, n, fun) {
  6363.             /** @type {string} */
  6364.             var temporaryStyles = exports.API_USERS_USERID_METADATA_KEY.replace("%s", encodeURIComponent(s)).replace("%s", encodeURIComponent(n));
  6365.             forEach(temporaryStyles, {}, fun);
  6366.           };
  6367.           /**
  6368.            * @param {?} query
  6369.            * @param {string} profile
  6370.            * @return {undefined}
  6371.            */
  6372.           this.resetMyHistory = function(query, profile) {
  6373.             /** @type {string} */
  6374.             var lexed = exports.API_GROUPCHANNELS_RESET_USER_HISTORY.replace("%s", encodeURIComponent(query));
  6375.             render(lexed, {}, profile);
  6376.           };
  6377.           /**
  6378.            * @param {?} line
  6379.            * @param {!Object} input
  6380.            * @param {!Function} request
  6381.            * @return {undefined}
  6382.            */
  6383.           this.groupChannelInvite = function(line, input, request) {
  6384.             /** @type {string} */
  6385.             var instrumented = exports.API_GROUPCHANNELS_CHANNELURL_INVITE.replace("%s", encodeURIComponent(line));
  6386.             var data = {};
  6387.             /** @type {!Array} */
  6388.             var temp = [];
  6389.             try {
  6390.               if (Array.isArray(input)) {
  6391.                 /** @type {!Object} */
  6392.                 temp = input;
  6393.               } else {
  6394.                 temp.push(input);
  6395.               }
  6396.             } catch (e) {
  6397.               request(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER));
  6398.             }
  6399.             /** @type {!Array} */
  6400.             data.user_ids = temp;
  6401.             next(instrumented, data, request);
  6402.           };
  6403.           /**
  6404.            * @param {?} token
  6405.            * @param {string} user
  6406.            * @param {string} res
  6407.            * @return {undefined}
  6408.            */
  6409.           this.acceptInvitation = function(token, user, res) {
  6410.             /** @type {string} */
  6411.             var lexed = exports.API_GROUPCHANNELS_CHANNELURL_ACCEPT_INVITATION.replace("%s", encodeURIComponent(token));
  6412.             var data = {};
  6413.             /** @type {string} */
  6414.             data.user_id = user;
  6415.             render(lexed, data, res);
  6416.           };
  6417.           /**
  6418.            * @param {?} id
  6419.            * @param {string} room
  6420.            * @param {string} reason
  6421.            * @return {undefined}
  6422.            */
  6423.           this.declineInvitation = function(id, room, reason) {
  6424.             /** @type {string} */
  6425.             var lexed = exports.API_GROUPCHANNELS_CHANNELURL_DECLINE_INVITATION.replace("%s", encodeURIComponent(id));
  6426.             var item = {};
  6427.             /** @type {string} */
  6428.             item.user_id = room;
  6429.             render(lexed, item, reason);
  6430.           };
  6431.           /**
  6432.            * @param {?} e
  6433.            * @param {string} id
  6434.            * @param {?} n
  6435.            * @param {string} k
  6436.            * @return {undefined}
  6437.            */
  6438.           this.groupChannelHide = function(e, id, n, k) {
  6439.             /** @type {string} */
  6440.             var lexed = exports.API_GROUPCHANNELS_CHANNELURL_HIDE.replace("%s", encodeURIComponent(e));
  6441.             var item = {};
  6442.             /** @type {string} */
  6443.             item.user_id = id;
  6444.             item.hide_previous_messages = n;
  6445.             render(lexed, item, k);
  6446.           };
  6447.           /**
  6448.            * @param {?} url
  6449.            * @param {string} username
  6450.            * @param {string} profile
  6451.            * @return {undefined}
  6452.            */
  6453.           this.publicGroupChannelJoin = function(url, username, profile) {
  6454.             /** @type {string} */
  6455.             var lexed = exports.API_GROUPCHANNELS_CHANNELURL_JOIN.replace("%s", encodeURIComponent(url));
  6456.             var item = {};
  6457.             /** @type {string} */
  6458.             item.user_id = username;
  6459.             render(lexed, item, profile);
  6460.           };
  6461.           /**
  6462.            * @param {?} url
  6463.            * @param {string} username
  6464.            * @param {string} profile
  6465.            * @return {undefined}
  6466.            */
  6467.           this.groupChannelLeave = function(url, username, profile) {
  6468.             /** @type {string} */
  6469.             var lexed = exports.API_GROUPCHANNELS_CHANNELURL_LEAVE.replace("%s", encodeURIComponent(url));
  6470.             var item = {};
  6471.             /** @type {string} */
  6472.             item.user_id = username;
  6473.             render(lexed, item, profile);
  6474.           };
  6475.           /**
  6476.            * @param {?} e
  6477.            * @param {string} id
  6478.            * @param {undefined} profile
  6479.            * @return {undefined}
  6480.            */
  6481.           this.groupChannelMarkAsRead = function(e, id, profile) {
  6482.             /** @type {string} */
  6483.             var lexed = exports.API_GROUPCHANNELS_CHANNELURL_MESSAGES_MARKASREAD.replace("%s", encodeURIComponent(e));
  6484.             var item = {};
  6485.             /** @type {string} */
  6486.             item.user_id = id;
  6487.             render(lexed, item, profile);
  6488.           };
  6489.           /**
  6490.            * @param {?} val
  6491.            * @param {!Object} from
  6492.            * @param {string} profile
  6493.            * @return {undefined}
  6494.            */
  6495.           this.groupChannelMarkAsReadAll = function(val, from, profile) {
  6496.             /** @type {string} */
  6497.             var lexed = exports.API_USERS_USERID_MARKASREADALL.replace("%s", encodeURIComponent(val));
  6498.             var data = {};
  6499.             if (from) {
  6500.               /** @type {!Object} */
  6501.               data.channel_urls = from;
  6502.             }
  6503.             render(lexed, data, profile);
  6504.           };
  6505.           /**
  6506.            * @param {string} show
  6507.            * @param {?} text
  6508.            * @param {number} val
  6509.            * @param {number} type
  6510.            * @param {number} err
  6511.            * @param {boolean} args
  6512.            * @param {?} arr
  6513.            * @param {string} value
  6514.            * @param {string} source
  6515.            * @param {!Array} obj
  6516.            * @param {!Function} h
  6517.            * @return {undefined}
  6518.            */
  6519.           this.messageList = function(show, text, val, type, err, args, arr, value, source, obj, h) {
  6520.             var mode;
  6521.             /** @type {string} */
  6522.             mode = show ? String(exports.API_OPENCHANNELS_CHANNELURL_MESSAGES.replace("%s", text)) : String(exports.API_GROUPCHANNELS_CHANNELURL_MESSAGES.replace("%s", text));
  6523.             var self = {};
  6524.             /** @type {string} */
  6525.             self.is_sdk = String(true);
  6526.             /** @type {string} */
  6527.             self.message_ts = String(val);
  6528.             /** @type {string} */
  6529.             self.prev_limit = String(type);
  6530.             /** @type {string} */
  6531.             self.next_limit = String(err);
  6532.             /** @type {string} */
  6533.             self.include = String(args);
  6534.             /** @type {string} */
  6535.             self.reverse = String(arr);
  6536.             if (value) {
  6537.               /** @type {string} */
  6538.               self.message_type = String(value);
  6539.             }
  6540.             if (source) {
  6541.               /** @type {string} */
  6542.               self.custom_type = String(source);
  6543.             }
  6544.             if (obj.length > 0) {
  6545.               self.sender_ids = extend(obj);
  6546.             }
  6547.             callback(mode, self, h);
  6548.           };
  6549.           /**
  6550.            * @param {string} show
  6551.            * @param {?} index
  6552.            * @param {number} message
  6553.            * @param {number} format
  6554.            * @param {number} width
  6555.            * @param {boolean} e
  6556.            * @param {?} filename
  6557.            * @param {string} key
  6558.            * @param {?} text
  6559.            * @param {!Object} obj
  6560.            * @param {!Function} h
  6561.            * @return {undefined}
  6562.            */
  6563.           this.messageListByID = function(show, index, message, format, width, e, filename, key, text, obj, h) {
  6564.             var mode;
  6565.             /** @type {string} */
  6566.             mode = show ? String(exports.API_OPENCHANNELS_CHANNELURL_MESSAGES.replace("%s", index)) : String(exports.API_GROUPCHANNELS_CHANNELURL_MESSAGES.replace("%s", index));
  6567.             var data = {};
  6568.             /** @type {string} */
  6569.             data.is_sdk = String(true);
  6570.             /** @type {number} */
  6571.             data.message_id = message;
  6572.             /** @type {string} */
  6573.             data.prev_limit = String(format);
  6574.             /** @type {string} */
  6575.             data.next_limit = String(width);
  6576.             /** @type {string} */
  6577.             data.include = String(e);
  6578.             /** @type {string} */
  6579.             data.reverse = String(filename);
  6580.             if (key) {
  6581.               /** @type {string} */
  6582.               data.message_type = String(key);
  6583.             }
  6584.             if (text) {
  6585.               /** @type {string} */
  6586.               data.custom_type = String(text);
  6587.             }
  6588.             if (obj.length > 0) {
  6589.               data.sender_ids = extend(obj);
  6590.             }
  6591.             callback(mode, data, h);
  6592.           };
  6593.           /**
  6594.            * @param {?} pkg
  6595.            * @param {string} data
  6596.            * @param {?} callback
  6597.            * @return {undefined}
  6598.            */
  6599.           this.login = function(pkg, data, callback) {
  6600.             /** @type {string} */
  6601.             var instrumented = exports.API_USERS_USERID_LOGIN.replace("%s", encodeURIComponent(pkg));
  6602.             var options = {};
  6603.             options.app_id = path;
  6604.             if (data) {
  6605.               /** @type {string} */
  6606.               options.access_token = data;
  6607.             }
  6608.             next(instrumented, options, function(data, webhookMsg) {
  6609.               if (webhookMsg) {
  6610.                 callback(null, webhookMsg);
  6611.               } else {
  6612.                 exports.getInstance().sessionKey = data.key;
  6613.                 exports.getInstance().ekey = data.ekey;
  6614.                 callback(data, webhookMsg);
  6615.               }
  6616.             });
  6617.           };
  6618.           /**
  6619.            * @param {?} val
  6620.            * @param {string} data
  6621.            * @param {!Object} info
  6622.            * @param {!Array} id
  6623.            * @return {undefined}
  6624.            */
  6625.           this.updateUserInfo = function(val, data, info, id) {
  6626.             var item = {};
  6627.             if (data) {
  6628.               /** @type {string} */
  6629.               item.nickname = data;
  6630.             }
  6631.             if (info) {
  6632.               /** @type {!Object} */
  6633.               item.profile_url = info;
  6634.             }
  6635.             /** @type {string} */
  6636.             var lexed = String(exports.API_USERS_USERID).replace("%s", encodeURIComponent(val));
  6637.             render(lexed, item, id);
  6638.           };
  6639.           /**
  6640.            * @param {?} url
  6641.            * @param {string} s
  6642.            * @param {!Object} v
  6643.            * @param {!Array} k
  6644.            * @return {undefined}
  6645.            */
  6646.           this.updateCurrentUserInfoWithFile = function(url, s, v, k) {
  6647.             if ("string" == typeof v) {
  6648.               this.updateUserInfo(url, s, v, k);
  6649.             } else {
  6650.               var $ = Model ? new Model : new FormData;
  6651.               $.append("nickname", s);
  6652.               $.append("profile_file", v, v.name);
  6653.               /** @type {string} */
  6654.               var lexed = String(exports.API_USERS_USERID).replace("%s", encodeURIComponent(url));
  6655.               render(lexed, $, k);
  6656.             }
  6657.           };
  6658.           /**
  6659.            * @param {string} id
  6660.            * @param {boolean} n
  6661.            * @param {boolean} e
  6662.            * @param {!Function} percent
  6663.            * @return {undefined}
  6664.            */
  6665.           this.getGroupChannel = function(id, n, e, percent) {
  6666.             /** @type {string} */
  6667.             var r = exports.API_GROUPCHANNELS_CHANNELURL.replace("%s", encodeURIComponent(id));
  6668.             var output = {
  6669.               member : String(n),
  6670.               read_receipt : String(e)
  6671.             };
  6672.             callback(r, output, percent);
  6673.           };
  6674.           /**
  6675.            * @param {string} resourceName
  6676.            * @param {string} color
  6677.            * @return {undefined}
  6678.            */
  6679.           this.getOpenChannel = function(resourceName, color) {
  6680.             /** @type {string} */
  6681.             var t = exports.API_OPENCHANNELS_CHANNELURL.replace("%s", encodeURIComponent(resourceName));
  6682.             callback(t, color);
  6683.           };
  6684.           /**
  6685.            * @param {!Array} b
  6686.            * @param {!Object} f
  6687.            * @param {string} name
  6688.            * @param {string} file
  6689.            * @param {!Object} a
  6690.            * @param {!Object} v
  6691.            * @param {!Object} s
  6692.            * @param {!Object} o
  6693.            * @param {!Object} c
  6694.            * @param {!Object} tree
  6695.            * @param {!Function} items
  6696.            * @return {undefined}
  6697.            */
  6698.           this.createGroupChannel = function(b, f, name, file, a, v, s, o, c, tree, items) {
  6699.             /** @type {string} */
  6700.             var level = exports.API_GROUPCHANNELS;
  6701.             /** @type {!Array} */
  6702.             var p = [];
  6703.             if ("string" == typeof b) {
  6704.               p.push(b);
  6705.             } else {
  6706.               b.forEach(function(e) {
  6707.                 p.push(e);
  6708.               });
  6709.             }
  6710.             var data;
  6711.             /** @type {!Array<?>} */
  6712.             var inputblob = p.filter(function(value, index) {
  6713.               return p.indexOf(value) === index;
  6714.             });
  6715.             var i = o.isPublic;
  6716.             var m = o.channelUrl;
  6717.             if (file && "string" != typeof file) {
  6718.               data = Model ? new Model : new FormData;
  6719.               if (file) {
  6720.                 data.append("cover_file", file, file.name);
  6721.               }
  6722.               data.append("user_ids", inputblob);
  6723.               if (null !== m) {
  6724.                 data.append("channel_url", m);
  6725.               }
  6726.               if (null !== f) {
  6727.                 data.append("is_distinct", f);
  6728.               }
  6729.               if (null !== s) {
  6730.                 data.append("is_super", s);
  6731.               }
  6732.               if (null !== i) {
  6733.                 data.append("is_public", i);
  6734.               }
  6735.               if (null !== tree) {
  6736.                 data.append("is_ephemeral", tree);
  6737.               }
  6738.               if (null !== name && "string" == typeof name) {
  6739.                 data.append("name", name);
  6740.               }
  6741.               if (a) {
  6742.                 data.append("data", a);
  6743.               }
  6744.               if (v) {
  6745.                 data.append("custom_type", v);
  6746.               }
  6747.               if (Array.isArray(c) && c.length > 0) {
  6748.                 data.append("operator_ids", c);
  6749.               }
  6750.             } else {
  6751.               data = {};
  6752.               if (null !== file && "string" == typeof file) {
  6753.                 /** @type {string} */
  6754.                 data.cover_url = file;
  6755.               }
  6756.               /** @type {!Array<?>} */
  6757.               data.user_ids = inputblob;
  6758.               if (null !== m) {
  6759.                 data.channel_url = m;
  6760.               }
  6761.               if (null !== f) {
  6762.                 /** @type {!Object} */
  6763.                 data.is_distinct = f;
  6764.               }
  6765.               if (null !== s) {
  6766.                 /** @type {!Object} */
  6767.                 data.is_super = s;
  6768.               }
  6769.               if (null !== i) {
  6770.                 data.is_public = i;
  6771.               }
  6772.               if (null !== tree) {
  6773.                 /** @type {!Object} */
  6774.                 data.is_ephemeral = tree;
  6775.               }
  6776.               if (null !== name && "string" == typeof name) {
  6777.                 /** @type {string} */
  6778.                 data.name = name;
  6779.               }
  6780.               if (a) {
  6781.                 /** @type {!Object} */
  6782.                 data.data = a;
  6783.               }
  6784.               if (v) {
  6785.                 /** @type {!Object} */
  6786.                 data.custom_type = v;
  6787.               }
  6788.               if (Array.isArray(c) && c.length > 0) {
  6789.                 /** @type {!Object} */
  6790.                 data.operator_ids = c;
  6791.               }
  6792.             }
  6793.             next(level, data, items);
  6794.           };
  6795.           /**
  6796.            * @param {string} c
  6797.            * @param {?} data
  6798.            * @param {?} t
  6799.            * @param {!Object} value
  6800.            * @param {?} options
  6801.            * @param {!Function} code
  6802.            * @return {undefined}
  6803.            */
  6804.           this.createOpenChannel = function(c, data, t, value, options, code) {
  6805.             var self;
  6806.             /** @type {string} */
  6807.             var instrumented = String(exports.API_OPENCHANNELS);
  6808.             if (data && "string" != typeof data) {
  6809.               self = Model ? new Model : new FormData;
  6810.               if (data) {
  6811.                 self.append("cover_file", data, data.name);
  6812.               }
  6813.               if (null !== c && "string" == typeof c) {
  6814.                 self.append("name", c);
  6815.               }
  6816.               if (t) {
  6817.                 self.append("data", t);
  6818.               }
  6819.               if (value) {
  6820.                 if (Array.isArray(value)) {
  6821.                   self.append("operators", value);
  6822.                 } else {
  6823.                   self.append("operators", [value]);
  6824.                 }
  6825.               }
  6826.               if (options) {
  6827.                 self.append("custom_type", options);
  6828.               }
  6829.             } else {
  6830.               self = {};
  6831.               if (null !== data && "string" == typeof data) {
  6832.                 /** @type {string} */
  6833.                 self.cover_url = data;
  6834.               }
  6835.               if (null !== c && "string" == typeof c) {
  6836.                 /** @type {string} */
  6837.                 self.name = c;
  6838.               }
  6839.               if (t) {
  6840.                 self.data = t;
  6841.               }
  6842.               if (value) {
  6843.                 if (Array.isArray(value)) {
  6844.                   /** @type {!Object} */
  6845.                   self.operators = value;
  6846.                 } else {
  6847.                   /** @type {!Array} */
  6848.                   self.operators = [value];
  6849.                 }
  6850.               }
  6851.               if (options) {
  6852.                 self.custom_type = options;
  6853.               }
  6854.             }
  6855.             next(instrumented, self, code);
  6856.           };
  6857.           /**
  6858.            * @param {?} shareUrl
  6859.            * @param {!Object} title
  6860.            * @param {string} config
  6861.            * @param {string} value
  6862.            * @param {string} id
  6863.            * @param {string} child
  6864.            * @param {string} i
  6865.            * @param {string} k
  6866.            * @return {undefined}
  6867.            */
  6868.           this.updateGroupChannel = function(shareUrl, title, config, value, id, child, i, k) {
  6869.             var item;
  6870.             /** @type {string} */
  6871.             var parsedValue = String(exports.API_GROUPCHANNELS_CHANNELURL.replace("%s", encodeURIComponent(shareUrl)));
  6872.             if (value && "string" != typeof value) {
  6873.               item = Model ? new Model : new FormData;
  6874.               if (null !== title) {
  6875.                 item.append("is_distinct", title);
  6876.               }
  6877.               if (null !== i) {
  6878.                 item.append("is_public", i);
  6879.               }
  6880.               if (value) {
  6881.                 item.append("cover_file", value, value.name);
  6882.               }
  6883.               if (null !== config && "string" == typeof config) {
  6884.                 item.append("name", config);
  6885.               }
  6886.               if (null !== id && "string" == typeof id) {
  6887.                 item.append("data", id);
  6888.               }
  6889.               if (null !== child && "string" == typeof child) {
  6890.                 item.append("custom_type", child);
  6891.               }
  6892.             } else {
  6893.               item = {};
  6894.               if (null !== title) {
  6895.                 /** @type {!Object} */
  6896.                 item.is_distinct = title;
  6897.               }
  6898.               if (null !== i) {
  6899.                 /** @type {string} */
  6900.                 item.is_public = i;
  6901.               }
  6902.               if (null !== value && "string" == typeof value) {
  6903.                 /** @type {string} */
  6904.                 item.cover_url = value;
  6905.               }
  6906.               if (null !== config && "string" == typeof config) {
  6907.                 /** @type {string} */
  6908.                 item.name = config;
  6909.               }
  6910.               if (null !== id && "string" == typeof id) {
  6911.                 /** @type {string} */
  6912.                 item.data = id;
  6913.               }
  6914.               if (null !== child && "string" == typeof child) {
  6915.                 /** @type {string} */
  6916.                 item.custom_type = child;
  6917.               }
  6918.             }
  6919.             render(parsedValue, item, k);
  6920.           };
  6921.           /**
  6922.            * @param {?} file
  6923.            * @param {string} name
  6924.            * @param {?} data
  6925.            * @param {?} obj
  6926.            * @param {!Object} id
  6927.            * @param {?} a
  6928.            * @param {string} cur
  6929.            * @return {undefined}
  6930.            */
  6931.           this.updateOpenChannel = function(file, name, data, obj, id, a, cur) {
  6932.             var $scope;
  6933.             /** @type {string} */
  6934.             var parsedValue = String(exports.API_OPENCHANNELS_CHANNELURL.replace("%s", encodeURIComponent(file)));
  6935.             if (data && "string" != typeof data) {
  6936.               $scope = Model ? new Model : new FormData;
  6937.               if (data) {
  6938.                 $scope.append("cover_file", data, data.name);
  6939.               }
  6940.               if (null !== name && "string" == typeof name) {
  6941.                 $scope.append("name", name);
  6942.               }
  6943.               if (null !== obj && "string" == typeof obj) {
  6944.                 $scope.append("data", obj);
  6945.               }
  6946.               if (null !== id) {
  6947.                 if (Array.isArray(id)) {
  6948.                   $scope.append("operators", id);
  6949.                 } else {
  6950.                   $scope.append("operators", [id]);
  6951.                 }
  6952.               }
  6953.               if (null !== a && "string" == typeof a) {
  6954.                 $scope.append("custom_type", a);
  6955.               }
  6956.             } else {
  6957.               $scope = {};
  6958.               if (null !== data && "string" == typeof data) {
  6959.                 /** @type {string} */
  6960.                 $scope.cover_url = data;
  6961.               }
  6962.               if (null !== name && "string" == typeof name) {
  6963.                 /** @type {string} */
  6964.                 $scope.name = name;
  6965.               }
  6966.               if (null !== obj && "string" == typeof obj) {
  6967.                 /** @type {string} */
  6968.                 $scope.data = obj;
  6969.               }
  6970.               if (null !== id) {
  6971.                 if (Array.isArray(id)) {
  6972.                   /** @type {!Object} */
  6973.                   $scope.operators = id;
  6974.                 } else {
  6975.                   /** @type {!Array} */
  6976.                   $scope.operators = [id];
  6977.                 }
  6978.               }
  6979.               if (null !== a && "string" == typeof a) {
  6980.                 /** @type {string} */
  6981.                 $scope.custom_type = a;
  6982.               }
  6983.             }
  6984.             render(parsedValue, $scope, cur);
  6985.           };
  6986.           /**
  6987.            * @param {?} url
  6988.            * @param {string} fun
  6989.            * @return {undefined}
  6990.            */
  6991.           this.deleteOpenChannel = function(url, fun) {
  6992.             /** @type {string} */
  6993.             var rawContents = String(exports.API_OPENCHANNELS_CHANNELURL.replace("%s", encodeURIComponent(url)));
  6994.             forEach(rawContents, {}, fun);
  6995.           };
  6996.           /**
  6997.            * @param {string} _
  6998.            * @param {?} val
  6999.            * @param {!Object} arr
  7000.            * @param {!Function} items
  7001.            * @return {undefined}
  7002.            */
  7003.           this.createMetaCounters = function(_, val, arr, items) {
  7004.             var r;
  7005.             /** @type {string} */
  7006.             r = _ ? exports.API_OPENCHANNELS_CHANNELURL_METACOUNTER.replace("%s", encodeURIComponent(val)) : exports.API_GROUPCHANNELS_CHANNELURL_METACOUNTER.replace("%s", encodeURIComponent(val));
  7007.             var bucket = {};
  7008.             /** @type {!Object} */
  7009.             bucket.metacounter = arr;
  7010.             next(r, bucket, items);
  7011.           };
  7012.           /**
  7013.            * @param {string} lmbda
  7014.            * @param {?} n
  7015.            * @param {?} w
  7016.            * @param {!Object} p
  7017.            * @param {?} p2
  7018.            * @param {string} format
  7019.            * @return {undefined}
  7020.            */
  7021.           this.updateMetaCounters = function(lmbda, n, w, p, p2, format) {
  7022.             var lexed;
  7023.             /** @type {string} */
  7024.             lexed = lmbda ? exports.API_OPENCHANNELS_CHANNELURL_METACOUNTER.replace("%s", encodeURIComponent(n)) : exports.API_GROUPCHANNELS_CHANNELURL_METACOUNTER.replace("%s", encodeURIComponent(n));
  7025.             var obj = {};
  7026.             switch(obj.metacounter = w, obj.upsert = p, p2) {
  7027.               case exports.UPDATE_META_COUNTER_MODE_SET:
  7028.                 /** @type {string} */
  7029.                 obj.mode = "set";
  7030.                 break;
  7031.               case exports.UPDATE_META_COUNTER_MODE_INC:
  7032.                 /** @type {string} */
  7033.                 obj.mode = "increase";
  7034.                 break;
  7035.               case exports.UPDATE_META_COUNTER_MODE_DEC:
  7036.                 /** @type {string} */
  7037.                 obj.mode = "decrease";
  7038.             }
  7039.             render(lexed, obj, format);
  7040.           };
  7041.           /**
  7042.            * @param {undefined} n
  7043.            * @param {string} s
  7044.            * @param {!Function} sf
  7045.            * @return {undefined}
  7046.            */
  7047.           this.getAllMetaCounters = function(n, s, sf) {
  7048.             this.getMetaCounters(n, s, {}, sf);
  7049.           };
  7050.           /**
  7051.            * @param {string} doc
  7052.            * @param {string} val
  7053.            * @param {!Object} src
  7054.            * @param {!Function} filename
  7055.            * @return {undefined}
  7056.            */
  7057.           this.getMetaCounters = function(doc, val, src, filename) {
  7058.             var result;
  7059.             /** @type {string} */
  7060.             result = doc ? exports.API_OPENCHANNELS_CHANNELURL_METACOUNTER.replace("%s", encodeURIComponent(val)) : exports.API_GROUPCHANNELS_CHANNELURL_METACOUNTER.replace("%s", encodeURIComponent(val));
  7061.             var l = extend(src);
  7062.             callback(result, {
  7063.               keys : l
  7064.             }, filename);
  7065.           };
  7066.           /**
  7067.            * @param {string} right
  7068.            * @param {?} val
  7069.            * @param {?} size
  7070.            * @param {string} ctx
  7071.            * @return {undefined}
  7072.            */
  7073.           this.deleteMetaCounter = function(right, val, size, ctx) {
  7074.             /** @type {string} */
  7075.             var str = "";
  7076.             /** @type {string} */
  7077.             str = right ? exports.API_OPENCHANNELS_CHANNELURL_METACOUNTER_KEY.replace("%s", encodeURIComponent(val)).replace("%s", size) : exports.API_GROUPCHANNELS_CHANNELURL_METACOUNTER_KEY.replace("%s", encodeURIComponent(val)).replace("%s", size);
  7078.             forEach(str, {}, ctx);
  7079.           };
  7080.           /**
  7081.            * @param {string} _
  7082.            * @param {?} val
  7083.            * @param {string} fun
  7084.            * @return {undefined}
  7085.            */
  7086.           this.deleteAllMetaCounters = function(_, val, fun) {
  7087.             /** @type {string} */
  7088.             var r = "";
  7089.             /** @type {string} */
  7090.             r = _ ? exports.API_OPENCHANNELS_CHANNELURL_METACOUNTER.replace("%s", encodeURIComponent(val)) : exports.API_GROUPCHANNELS_CHANNELURL_METACOUNTER.replace("%s", encodeURIComponent(val));
  7091.             forEach(r, {}, fun);
  7092.           };
  7093.           /**
  7094.            * @param {string} done
  7095.            * @param {?} index
  7096.            * @param {!Object} obj
  7097.            * @param {!Function} data
  7098.            * @return {undefined}
  7099.            */
  7100.           this.createMetaData = function(done, index, obj, data) {
  7101.             /** @type {string} */
  7102.             var args = "";
  7103.             /** @type {string} */
  7104.             args = done ? exports.API_OPENCHANNELS_CHANNELURL_METADATA.replace("%s", encodeURIComponent(index)) : exports.API_GROUPCHANNELS_CHANNELURL_METADATA.replace("%s", encodeURIComponent(index));
  7105.             var n = {};
  7106.             var file = {};
  7107.             var p;
  7108.             for (p in obj) {
  7109.               var val = obj[p];
  7110.               file[p] = val;
  7111.             }
  7112.             n.metadata = file;
  7113.             next(args, n, data);
  7114.           };
  7115.           /**
  7116.            * @param {string} index
  7117.            * @param {?} base
  7118.            * @param {!Object} data
  7119.            * @param {!Object} type
  7120.            * @param {string} metadata
  7121.            * @return {undefined}
  7122.            */
  7123.           this.updateMetaData = function(index, base, data, type, metadata) {
  7124.             /** @type {string} */
  7125.             var output = "";
  7126.             /** @type {string} */
  7127.             output = index ? exports.API_OPENCHANNELS_CHANNELURL_METADATA.replace("%s", encodeURIComponent(base)) : exports.API_GROUPCHANNELS_CHANNELURL_METADATA.replace("%s", encodeURIComponent(base));
  7128.             var options = {};
  7129.             var body = {};
  7130.             var i;
  7131.             for (i in data) {
  7132.               var row = data[i];
  7133.               body[i] = row;
  7134.             }
  7135.             options.metadata = body;
  7136.             /** @type {!Object} */
  7137.             options.upsert = type;
  7138.             render(output, options, metadata);
  7139.           };
  7140.           /**
  7141.            * @param {undefined} item
  7142.            * @param {string} n
  7143.            * @param {!Function} elem
  7144.            * @return {undefined}
  7145.            */
  7146.           this.getAllMetaData = function(item, n, elem) {
  7147.             this.getMetaData(item, n, {}, elem);
  7148.           };
  7149.           /**
  7150.            * @param {string} params
  7151.            * @param {string} data
  7152.            * @param {!Object} name
  7153.            * @param {!Function} text
  7154.            * @return {undefined}
  7155.            */
  7156.           this.getMetaData = function(params, data, name, text) {
  7157.             /** @type {string} */
  7158.             var url = "";
  7159.             /** @type {string} */
  7160.             url = params ? exports.API_OPENCHANNELS_CHANNELURL_METADATA.replace("%s", encodeURIComponent(data)) : exports.API_GROUPCHANNELS_CHANNELURL_METADATA.replace("%s", encodeURIComponent(data));
  7161.             var l = extend(name);
  7162.             callback(url, {
  7163.               keys : l
  7164.             }, text);
  7165.           };
  7166.           /**
  7167.            * @param {string} right
  7168.            * @param {?} val
  7169.            * @param {?} size
  7170.            * @param {string} ctx
  7171.            * @return {undefined}
  7172.            */
  7173.           this.deleteMetaData = function(right, val, size, ctx) {
  7174.             /** @type {string} */
  7175.             var str = "";
  7176.             /** @type {string} */
  7177.             str = right ? exports.API_OPENCHANNELS_CHANNELURL_METADATA_KEY.replace("%s", encodeURIComponent(val)).replace("%s", size) : exports.API_GROUPCHANNELS_CHANNELURL_METADATA_KEY.replace("%s", encodeURIComponent(val)).replace("%s", size);
  7178.             forEach(str, {}, ctx);
  7179.           };
  7180.           /**
  7181.            * @param {string} _
  7182.            * @param {?} val
  7183.            * @param {string} fun
  7184.            * @return {undefined}
  7185.            */
  7186.           this.deleteAllMetaData = function(_, val, fun) {
  7187.             /** @type {string} */
  7188.             var r = "";
  7189.             /** @type {string} */
  7190.             r = _ ? exports.API_OPENCHANNELS_CHANNELURL_METADATA.replace("%s", encodeURIComponent(val)) : exports.API_GROUPCHANNELS_CHANNELURL_METADATA.replace("%s", encodeURIComponent(val));
  7191.             forEach(r, {}, fun);
  7192.           };
  7193.           /**
  7194.            * @param {string} token
  7195.            * @param {?} i
  7196.            * @param {!Object} data
  7197.            * @param {string} xml
  7198.            * @param {!Object} args
  7199.            * @param {!Function} port
  7200.            * @return {undefined}
  7201.            */
  7202.           this.loadUserList = function(token, i, data, xml, args, port) {
  7203.             /** @type {string} */
  7204.             var returnValue = exports.API_USERS;
  7205.             var result = {
  7206.               token : encodeURIComponent(token),
  7207.               limit : String(i)
  7208.             };
  7209.             if (!check(data)) {
  7210.               try {
  7211.                 /** @type {string} */
  7212.                 var query = "";
  7213.                 var a;
  7214.                 for (a in data) {
  7215.                   var i = data[a];
  7216.                   /** @type {string} */
  7217.                   query = query + (encodeURIComponent(i) + ",");
  7218.                 }
  7219.                 if (query.length > 1) {
  7220.                   /** @type {string} */
  7221.                   query = query.substring(0, query.length - 1);
  7222.                 }
  7223.                 /** @type {string} */
  7224.                 result.user_ids = query;
  7225.               } catch (e) {
  7226.               }
  7227.             }
  7228.             if (xml && !check(args)) {
  7229.               /** @type {string} */
  7230.               var b = "";
  7231.               args.forEach(function(qov) {
  7232.                 b = b + (encodeURIComponent(qov) + ",");
  7233.               });
  7234.               if (b.length > 0) {
  7235.                 b = b.substring(0, b.length - 1);
  7236.               }
  7237.               /** @type {string} */
  7238.               result.metadatakey = encodeURIComponent(xml);
  7239.               result.metadatavalues_in = b;
  7240.             }
  7241.             callback(returnValue, result, port);
  7242.           };
  7243.           /**
  7244.            * @param {?} match
  7245.            * @param {string} token
  7246.            * @param {?} i
  7247.            * @param {!Function} err
  7248.            * @return {undefined}
  7249.            */
  7250.           this.loadBlockedUserList = function(match, token, i, err) {
  7251.             /** @type {string} */
  7252.             var r = exports.API_USERS_USERID_BLOCK.replace("%s", encodeURIComponent(match));
  7253.             var result = {
  7254.               token : encodeURIComponent(token),
  7255.               limit : String(i)
  7256.             };
  7257.             callback(r, result, err);
  7258.           };
  7259.           /**
  7260.            * @param {string} token
  7261.            * @param {?} i
  7262.            * @param {number} s
  7263.            * @param {?} xml
  7264.            * @param {number} url
  7265.            * @param {!Function} c
  7266.            * @return {undefined}
  7267.            */
  7268.           this.loadOpenChannelList = function(token, i, s, xml, url, c) {
  7269.             /** @type {string} */
  7270.             var returnValue = exports.API_OPENCHANNELS;
  7271.             var result = {
  7272.               token : encodeURIComponent(token),
  7273.               limit : String(i)
  7274.             };
  7275.             if (null !== s) {
  7276.               /** @type {string} */
  7277.               result.name_contains = encodeURIComponent(s);
  7278.             }
  7279.             if (xml) {
  7280.               /** @type {string} */
  7281.               result.url_contains = encodeURIComponent(xml);
  7282.             }
  7283.             if (null !== url) {
  7284.               /** @type {string} */
  7285.               result.custom_type = encodeURIComponent(url);
  7286.             }
  7287.             callback(returnValue, result, c);
  7288.           };
  7289.           /**
  7290.            * @param {!Object} json
  7291.            * @param {string} options
  7292.            * @param {!Object} params
  7293.            * @param {string} data
  7294.            * @param {!Function} callback
  7295.            * @param {?} key
  7296.            * @param {?} cb
  7297.            * @param {?} parent
  7298.            * @return {undefined}
  7299.            */
  7300.           this.uploadFile = function(json, options, params, data, callback, key, cb, parent) {
  7301.             request(exports.API_STORAGE_FILE, 0, json, options, params, data, callback, key, cb, parent);
  7302.           };
  7303.           /**
  7304.            * @param {!Object} file
  7305.            * @param {!Function} callback
  7306.            * @return {undefined}
  7307.            */
  7308.           this.uploadProfileImage = function(file, callback) {
  7309.             request(exports.API_STORAGE_PROFILE, 0, file, "", [], "", callback);
  7310.           };
  7311.           /**
  7312.            * @param {?} e
  7313.            * @param {string} value
  7314.            * @param {string} i
  7315.            * @param {number} time
  7316.            * @param {!Function} r
  7317.            * @return {undefined}
  7318.            */
  7319.           this.loadOperatorList = function(e, value, i, time, r) {
  7320.             /** @type {string} */
  7321.             var id = value ? exports.API_OPENCHANNELS_OPERATORS.replace("%url", encodeURIComponent(e)) : exports.API_GROUPCHANNELS_OPERATORS.replace("%url", encodeURIComponent(e));
  7322.             var result = {
  7323.               token : encodeURIComponent(i),
  7324.               limit : time
  7325.             };
  7326.             callback(id, result, r);
  7327.           };
  7328.           /**
  7329.            * @param {?} match
  7330.            * @param {string} token
  7331.            * @param {number} duration
  7332.            * @param {string} format
  7333.            * @param {string} a
  7334.            * @param {?} unused
  7335.            * @param {?} name
  7336.            * @param {string} n
  7337.            * @param {!Function} updated
  7338.            * @return {undefined}
  7339.            */
  7340.           this.loadGroupChannelMemberList = function(match, token, duration, format, a, unused, name, n, updated) {
  7341.             /** @type {string} */
  7342.             var c = exports.API_GROUPCHANNELS_MEMBERS.replace("%url", encodeURIComponent(match));
  7343.             var result = {
  7344.               token : encodeURIComponent(token),
  7345.               limit : duration,
  7346.               muted_member_filter : format.toLowerCase(),
  7347.               operator_filter : a.toLowerCase(),
  7348.               member_state_filter : unused,
  7349.               order : n.toLowerCase()
  7350.             };
  7351.             if (name) {
  7352.               /** @type {string} */
  7353.               result.nickname_startswith = encodeURIComponent(name);
  7354.             }
  7355.             callback(c, result, updated);
  7356.           };
  7357.           /**
  7358.            * @param {string} token
  7359.            * @param {?} i
  7360.            * @param {?} state_name
  7361.            * @param {string} value
  7362.            * @param {?} process
  7363.            * @param {!Array} id
  7364.            * @param {!Array} snippets
  7365.            * @param {?} scope
  7366.            * @param {?} cond
  7367.            * @param {?} t
  7368.            * @param {!Function} c
  7369.            * @return {undefined}
  7370.            */
  7371.           this.loadPublicGroupChannelList = function(token, i, state_name, value, process, id, snippets, scope, cond, t, c) {
  7372.             /** @type {string} */
  7373.             var returnValue = exports.API_GROUPCHANNELS;
  7374.             var options = {
  7375.               public_mode : link.publicChannelFilter.PUBLIC,
  7376.               token : encodeURIComponent(token),
  7377.               limit : String(i),
  7378.               show_member : true,
  7379.               show_read_receipt : true,
  7380.               show_empty : String(state_name),
  7381.               order : value
  7382.             };
  7383.             if (process) {
  7384.               try {
  7385.                 /** @type {string} */
  7386.                 options.name_contains = encodeURIComponent(process);
  7387.               } catch (e) {
  7388.               }
  7389.             }
  7390.             if (id.length > 0) {
  7391.               try {
  7392.                 options.channel_urls = id.map(function(qov) {
  7393.                   return encodeURIComponent(qov);
  7394.                 }).join(",");
  7395.               } catch (e) {
  7396.               }
  7397.             }
  7398.             if (snippets.length > 0) {
  7399.               /** @type {string} */
  7400.               var result = "";
  7401.               snippets.forEach(function(qov) {
  7402.                 result = result + (encodeURIComponent(qov) + ",");
  7403.               });
  7404.               result = result.substring(0, result.length - 1);
  7405.               options.custom_types = result;
  7406.             }
  7407.             if (scope) {
  7408.               options.custom_type_startswith = scope;
  7409.             }
  7410.             options.super_mode = cond;
  7411.             options.public_membership_mode = t;
  7412.             callback(returnValue, options, c);
  7413.           };
  7414.           /**
  7415.            * @param {?} match
  7416.            * @param {string} i
  7417.            * @param {?} query
  7418.            * @param {boolean} partialName
  7419.            * @param {string} state
  7420.            * @param {!Object} data
  7421.            * @param {string} tableName
  7422.            * @param {string} image
  7423.            * @param {!Array} slice
  7424.            * @param {string} d
  7425.            * @param {!Array} h
  7426.            * @param {?} edge
  7427.            * @param {string} event
  7428.            * @param {string} details
  7429.            * @param {string} result
  7430.            * @param {!Function} fields
  7431.            * @return {undefined}
  7432.            */
  7433.           this.loadUserGroupChannelList = function(match, i, query, partialName, state, data, tableName, image, slice, d, h, edge, event, details, result, fields) {
  7434.             /** @type {string} */
  7435.             var m = exports.API_MYGROUPCHANNELS.replace("%s", encodeURIComponent(match));
  7436.             var userIds = data.userIds;
  7437.             /** @type {boolean} */
  7438.             var A = !data.includeMode;
  7439.             var stripeTokenId = data.queryType;
  7440.             var options = {
  7441.               token : encodeURIComponent(i),
  7442.               limit : String(query),
  7443.               show_member : true,
  7444.               show_read_receipt : true,
  7445.               show_empty : String(partialName),
  7446.               order : state,
  7447.               member_state_filter : event
  7448.             };
  7449.             if (h.length > 0) {
  7450.               /** @type {string} */
  7451.               var displayName = "";
  7452.               h.forEach(function(qov) {
  7453.                 displayName = displayName + (encodeURIComponent(qov) + ",");
  7454.               });
  7455.               displayName = displayName.substring(0, displayName.length - 1);
  7456.               options.custom_types = displayName;
  7457.             } else {
  7458.               if (d) {
  7459.                 /** @type {string} */
  7460.                 options.custom_type = encodeURIComponent(d);
  7461.               }
  7462.             }
  7463.             if (tableName) {
  7464.               try {
  7465.                 /** @type {string} */
  7466.                 options.members_nickname_contains = encodeURIComponent(tableName);
  7467.               } catch (e) {
  7468.               }
  7469.             }
  7470.             if (image) {
  7471.               try {
  7472.                 /** @type {string} */
  7473.                 options.name_contains = encodeURIComponent(image);
  7474.               } catch (e) {
  7475.               }
  7476.             }
  7477.             if (userIds.length > 0) {
  7478.               try {
  7479.                 if (A) {
  7480.                   options.members_exactly_in = extend(userIds);
  7481.                 } else {
  7482.                   options.members_include_in = extend(userIds);
  7483.                   options.query_type = stripeTokenId;
  7484.                 }
  7485.               } catch (e) {
  7486.               }
  7487.             }
  7488.             if (slice.length > 0) {
  7489.               try {
  7490.                 options.channel_urls = slice.map(function(qov) {
  7491.                   return encodeURIComponent(qov);
  7492.                 }).join(",");
  7493.               } catch (e) {
  7494.               }
  7495.             }
  7496.             /** @type {string} */
  7497.             options.super_mode = details;
  7498.             /** @type {string} */
  7499.             options.public_mode = result;
  7500.             if (edge) {
  7501.               options.custom_type_startswith = edge;
  7502.             }
  7503.             callback(m, options, fields);
  7504.           };
  7505.           /**
  7506.            * @param {?} substitution
  7507.            * @param {string} token
  7508.            * @param {?} i
  7509.            * @param {!Function} err
  7510.            * @return {undefined}
  7511.            */
  7512.           this.loadOpenChannelParticipantList = function(substitution, token, i, err) {
  7513.             /** @type {string} */
  7514.             var result = exports.API_OPENCHANNELS_CHANNELURL_PARTICIPANTS.replace("%s", substitution);
  7515.             var opts = {
  7516.               token : encodeURIComponent(token),
  7517.               limit : String(i)
  7518.             };
  7519.             callback(result, opts, err);
  7520.           };
  7521.           /**
  7522.            * @param {!Object} s
  7523.            * @param {string} token
  7524.            * @param {?} i
  7525.            * @param {!Function} err
  7526.            * @return {undefined}
  7527.            */
  7528.           this.loadMutedUserList = function(s, token, i, err) {
  7529.             /** @type {string} */
  7530.             var r = s.isOpenChannel() ? exports.API_OPENCHANNELS_CHANNELURL_MUTE.replace("%s", s.url) : exports.API_GROUPCHANNELS_CHANNELURL_MUTE.replace("%s", s.url);
  7531.             var result = {
  7532.               token : encodeURIComponent(token),
  7533.               limit : String(i)
  7534.             };
  7535.             callback(r, result, err);
  7536.           };
  7537.           /**
  7538.            * @param {!Object} s
  7539.            * @param {string} token
  7540.            * @param {?} i
  7541.            * @param {!Function} err
  7542.            * @return {undefined}
  7543.            */
  7544.           this.loadBannedUserList = function(s, token, i, err) {
  7545.             /** @type {string} */
  7546.             var r = s.isOpenChannel() ? exports.API_OPENCHANNELS_CHANNELURL_BAN.replace("%s", s.url) : exports.API_GROUPCHANNELS_CHANNELURL_BAN.replace("%s", s.url);
  7547.             var result = {
  7548.               token : encodeURIComponent(token),
  7549.               limit : String(i)
  7550.             };
  7551.             callback(r, result, err);
  7552.           };
  7553.           /**
  7554.            * @param {?} s
  7555.            * @param {string} q
  7556.            * @param {string} id
  7557.            * @return {undefined}
  7558.            */
  7559.           this.setPushTemplate = function(s, q, id) {
  7560.             /** @type {string} */
  7561.             var lexed = exports.API_USERS_USERID_PUSH_TEMPLATE.replace("%s", encodeURIComponent(s));
  7562.             render(lexed, {
  7563.               name : q
  7564.             }, id);
  7565.           };
  7566.           /**
  7567.            * @param {?} s
  7568.            * @param {string} color
  7569.            * @return {undefined}
  7570.            */
  7571.           this.getPushTemplate = function(s, color) {
  7572.             /** @type {string} */
  7573.             var t = exports.API_USERS_USERID_PUSH_TEMPLATE.replace("%s", encodeURIComponent(s));
  7574.             callback(t, color);
  7575.           };
  7576.           /**
  7577.            * @param {?} word
  7578.            * @param {!Object} s
  7579.            * @param {number} t
  7580.            * @param {number} canvas
  7581.            * @param {number} r
  7582.            * @param {number} g
  7583.            * @param {string} name
  7584.            * @param {string} check
  7585.            * @return {undefined}
  7586.            */
  7587.           this.setDoNotDisturb = function(word, s, t, canvas, r, g, name, check) {
  7588.             /** @type {string} */
  7589.             var lexed = exports.API_USERS_USERID_PUSHPREFERENCE.replace("%s", encodeURIComponent(word));
  7590.             render(lexed, {
  7591.               do_not_disturb : s,
  7592.               start_hour : t,
  7593.               start_min : canvas,
  7594.               end_hour : r,
  7595.               end_min : g,
  7596.               timezone : name
  7597.             }, check);
  7598.           };
  7599.           /**
  7600.            * @param {?} s
  7601.            * @param {string} color
  7602.            * @return {undefined}
  7603.            */
  7604.           this.getDoNotDisturb = function(s, color) {
  7605.             /** @type {string} */
  7606.             var t = exports.API_USERS_USERID_PUSHPREFERENCE.replace("%s", encodeURIComponent(s));
  7607.             callback(t, color);
  7608.           };
  7609.           /**
  7610.            * @param {?} i
  7611.            * @param {?} line
  7612.            * @param {string} v
  7613.            * @param {string} total
  7614.            * @return {undefined}
  7615.            */
  7616.           this.setPushPreference = function(i, line, v, total) {
  7617.             /** @type {string} */
  7618.             var lexed = exports.API_USERS_USERID_PUSHPREFERENCE_CHANNELURL.replace("%s", encodeURIComponent(i)).replace("%s", encodeURIComponent(line));
  7619.             var view = {};
  7620.             /** @type {string} */
  7621.             view.enable = v;
  7622.             render(lexed, view, total);
  7623.           };
  7624.           /**
  7625.            * @param {?} url
  7626.            * @param {?} c
  7627.            * @param {string} selected
  7628.            * @return {undefined}
  7629.            */
  7630.           this.getPushPreference = function(url, c, selected) {
  7631.             /** @type {string} */
  7632.             var s = exports.API_USERS_USERID_PUSHPREFERENCE_CHANNELURL.replace("%s", encodeURIComponent(url)).replace("%s", encodeURIComponent(c));
  7633.             callback(s, selected);
  7634.           };
  7635.           /**
  7636.            * @param {?} hash
  7637.            * @param {?} username
  7638.            * @param {?} time
  7639.            * @param {string} check
  7640.            * @return {undefined}
  7641.            */
  7642.           this.setCountPreference = function(hash, username, time, check) {
  7643.             /** @type {string} */
  7644.             var lexed = exports.API_USERS_COUNT_PREFERENCE.replace("%s", encodeURIComponent(hash)).replace("%s", encodeURIComponent(username));
  7645.             var item = {};
  7646.             item.count_preference = time;
  7647.             render(lexed, item, check);
  7648.           };
  7649.           /**
  7650.            * @param {?} token
  7651.            * @param {string} mappings
  7652.            * @param {!Function} code
  7653.            * @return {undefined}
  7654.            */
  7655.           this.registerGCMPushToken = function(token, mappings, code) {
  7656.             /** @type {string} */
  7657.             var instrumented = exports.API_USERS_USERID_PUSH_GCM.replace("%s", encodeURIComponent(token));
  7658.             next(instrumented, {
  7659.               gcm_reg_token : mappings
  7660.             }, code);
  7661.           };
  7662.           /**
  7663.            * @param {?} t
  7664.            * @param {?} c
  7665.            * @param {string} f
  7666.            * @return {undefined}
  7667.            */
  7668.           this.unregisterGCMPushToken = function(t, c, f) {
  7669.             /** @type {string} */
  7670.             var temporaryStyles = exports.API_USERS_USERID_PUSH_GCM_TOKEN.replace("%s", encodeURIComponent(t)).replace("%s", encodeURIComponent(c));
  7671.             forEach(temporaryStyles, f);
  7672.           };
  7673.           /**
  7674.            * @param {?} c
  7675.            * @param {string} f
  7676.            * @return {undefined}
  7677.            */
  7678.           this.unregisterGCMPushTokenAll = function(c, f) {
  7679.             /** @type {string} */
  7680.             var temporaryStyles = exports.API_USERS_USERID_PUSH_GCM.replace("%s", encodeURIComponent(c));
  7681.             forEach(temporaryStyles, f);
  7682.           };
  7683.           /**
  7684.            * @param {?} token
  7685.            * @param {!Function} mappings
  7686.            * @param {!Function} code
  7687.            * @return {undefined}
  7688.            */
  7689.           this.registerAPNSPushToken = function(token, mappings, code) {
  7690.             /** @type {string} */
  7691.             var instrumented = exports.API_USERS_USERID_PUSH_APNS.replace("%s", encodeURIComponent(token));
  7692.             next(instrumented, {
  7693.               apns_device_token : mappings
  7694.             }, code);
  7695.           };
  7696.           /**
  7697.            * @param {?} t
  7698.            * @param {?} c
  7699.            * @param {string} f
  7700.            * @return {undefined}
  7701.            */
  7702.           this.unregisterAPNSPushToken = function(t, c, f) {
  7703.             /** @type {string} */
  7704.             var temporaryStyles = exports.API_USERS_USERID_PUSH_APNS_TOKEN.replace("%s", encodeURIComponent(t)).replace("%s", encodeURIComponent(c));
  7705.             forEach(temporaryStyles, f);
  7706.           };
  7707.           /**
  7708.            * @param {?} c
  7709.            * @param {string} f
  7710.            * @return {undefined}
  7711.            */
  7712.           this.unregisterAPNSPushTokenAll = function(c, f) {
  7713.             /** @type {string} */
  7714.             var temporaryStyles = exports.API_USERS_USERID_PUSH_APNS.replace("%s", encodeURIComponent(c));
  7715.             forEach(temporaryStyles, f);
  7716.           };
  7717.           /**
  7718.            * @param {?} c
  7719.            * @param {string} f
  7720.            * @return {undefined}
  7721.            */
  7722.           this.unregisterPushTokenAll = function(c, f) {
  7723.             /** @type {string} */
  7724.             var temporaryStyles = exports.API_USERS_USERID_PUSH.replace("%s", encodeURIComponent(c));
  7725.             forEach(temporaryStyles, f);
  7726.           };
  7727.           /**
  7728.            * @param {?} username
  7729.            * @param {?} id
  7730.            * @param {!Function} type
  7731.            * @return {undefined}
  7732.            */
  7733.           this.blockUser = function(username, id, type) {
  7734.             /** @type {string} */
  7735.             var instrumented = exports.API_USERS_USERID_BLOCK.replace("%s", encodeURIComponent(username));
  7736.             next(instrumented, {
  7737.               target_id : id
  7738.             }, type);
  7739.           };
  7740.           /**
  7741.            * @param {?} param
  7742.            * @param {?} arg
  7743.            * @param {string} cb
  7744.            * @return {undefined}
  7745.            */
  7746.           this.unblockUser = function(param, arg, cb) {
  7747.             /** @type {string} */
  7748.             var temporaryStyles = exports.API_USERS_USERID_BLOCK_TARGETID.replace("%s", encodeURIComponent(param)).replace("%s", encodeURIComponent(arg));
  7749.             forEach(temporaryStyles, {}, cb);
  7750.           };
  7751.           /**
  7752.            * @param {?} username
  7753.            * @param {string} uid
  7754.            * @param {string} result
  7755.            * @param {number} value
  7756.            * @param {string} toggle
  7757.            * @param {!Function} callback
  7758.            * @return {undefined}
  7759.            */
  7760.           this.banUser = function(username, uid, result, value, toggle, callback) {
  7761.             /** @type {string} */
  7762.             var output = toggle ? exports.API_GROUPCHANNELS_CHANNELURL_BAN.replace("%s", encodeURIComponent(username)) : exports.API_OPENCHANNELS_CHANNELURL_BAN.replace("%s", encodeURIComponent(username));
  7763.             var options = {
  7764.               user_id : uid
  7765.             };
  7766.             if (result) {
  7767.               /** @type {string} */
  7768.               options.description = result;
  7769.             }
  7770.             /** @type {string} */
  7771.             options.seconds = String(value);
  7772.             next(output, options, callback);
  7773.           };
  7774.           /**
  7775.            * @param {?} file
  7776.            * @param {boolean} val
  7777.            * @param {string} callback
  7778.            * @param {string} obj
  7779.            * @return {undefined}
  7780.            */
  7781.           this.unbanUser = function(file, val, callback, obj) {
  7782.             /** @type {string} */
  7783.             var result = callback ? exports.API_GROUPCHANNELS_CHANNELURL_BAN_USERID.replace("%s", encodeURIComponent(file)).replace("%s", encodeURIComponent(val)) : exports.API_OPENCHANNELS_CHANNELURL_BAN_USERID.replace("%s", encodeURIComponent(file)).replace("%s", encodeURIComponent(val));
  7784.             forEach(result, {}, obj);
  7785.           };
  7786.           /**
  7787.            * @param {?} data
  7788.            * @param {string} id
  7789.            * @param {string} cb
  7790.            * @param {!Function} user
  7791.            * @return {undefined}
  7792.            */
  7793.           this.muteUser = function(data, id, cb, user) {
  7794.             /** @type {string} */
  7795.             var results = cb ? exports.API_GROUPCHANNELS_CHANNELURL_MUTE.replace("%s", encodeURIComponent(data)) : exports.API_OPENCHANNELS_CHANNELURL_MUTE.replace("%s", encodeURIComponent(data));
  7796.             next(results, {
  7797.               user_id : id
  7798.             }, user);
  7799.           };
  7800.           /**
  7801.            * @param {?} n
  7802.            * @param {boolean} id
  7803.            * @param {string} cb
  7804.            * @param {string} s
  7805.            * @return {undefined}
  7806.            */
  7807.           this.unmuteUser = function(n, id, cb, s) {
  7808.             /** @type {string} */
  7809.             var results = cb ? exports.API_GROUPCHANNELS_CHANNELURL_MUTE_USERID.replace("%s", encodeURIComponent(n)).replace("%s", encodeURIComponent(id)) : exports.API_OPENCHANNELS_CHANNELURL_MUTE_USERID.replace("%s", encodeURIComponent(n)).replace("%s", encodeURIComponent(id));
  7810.             forEach(results, {}, s);
  7811.           };
  7812.           /**
  7813.            * @param {string} index
  7814.            * @param {?} type
  7815.            * @param {?} data
  7816.            * @param {string} obj
  7817.            * @return {undefined}
  7818.            */
  7819.           this.deleteMessage = function(index, type, data, obj) {
  7820.             /** @type {string} */
  7821.             var source = "";
  7822.             /** @type {string} */
  7823.             source = index ? exports.API_OPENCHANNELS_CHANNELURL_MESSAGES_MESSAGEID.replace("%s", encodeURIComponent(type)).replace("%s", encodeURIComponent(data)) : exports.API_GROUPCHANNELS_CHANNELURL_MESSAGES_MESSAGEID.replace("%s", encodeURIComponent(type)).replace("%s", encodeURIComponent(data));
  7824.             forEach(source, {}, obj);
  7825.           };
  7826.           /**
  7827.            * @param {!Array} value
  7828.            * @param {string} options
  7829.            * @param {string} store
  7830.            * @param {string} k
  7831.            * @return {undefined}
  7832.            */
  7833.           this.freeze = function(value, options, store, k) {
  7834.             /** @type {string} */
  7835.             var data = options ? exports.API_GROUPCHANNELS_CHANNELURL_FREEZE.replace("%s", encodeURIComponent(value)) : exports.API_OPENCHANNELS_CHANNELURL_FREEZE.replace("%s", encodeURIComponent(value));
  7836.             render(data, {
  7837.               freeze : store
  7838.             }, k);
  7839.           };
  7840.         };
  7841.         /** @type {null} */
  7842.         var ne = null;
  7843.         /**
  7844.          * @return {?}
  7845.          */
  7846.         exports.getInstance = function() {
  7847.           return null === ne ? null : ne;
  7848.         };
  7849.         /** @type {string} */
  7850.         exports.API_VERSION = "v3";
  7851.         /** @type {string} */
  7852.         exports.API_ROUTING_URL = "https://api-p.sendbird.com/routing/%s";
  7853.         /** @type {string} */
  7854.         exports.API_USERS = "/%v/users".replace("%v", exports.API_VERSION);
  7855.         /** @type {string} */
  7856.         exports.API_USERS_USERID_LOGIN = "/%v/users/%s/login".replace("%v", exports.API_VERSION);
  7857.         /** @type {string} */
  7858.         exports.API_USERS_USERID = "/%v/users/%s".replace("%v", exports.API_VERSION);
  7859.         /** @type {string} */
  7860.         exports.API_USERS_USERID_UNREAD_ITEM_COUNT = "/%v/users/%s/unread_item_count".replace("%v", exports.API_VERSION);
  7861.         /** @type {string} */
  7862.         exports.API_USERS_USERID_METADATA = "/%v/users/%s/metadata".replace("%v", exports.API_VERSION);
  7863.         /** @type {string} */
  7864.         exports.API_USERS_USERID_METADATA_KEY = "/%v/users/%s/metadata/%s".replace("%v", exports.API_VERSION);
  7865.         /** @type {string} */
  7866.         exports.API_USERS_USERID_UNREAD_MESSAGE_COUNT = "/%v/users/%s/unread_message_count".replace("%v", exports.API_VERSION);
  7867.         /** @type {string} */
  7868.         exports.API_USERS_USERID_UNREAD_CHANNEL_COUNT = "/%v/users/%s/unread_channel_count".replace("%v", exports.API_VERSION);
  7869.         /** @type {string} */
  7870.         exports.API_USERS_USERID_MARKASREADALL = "/%v/users/%s/mark_as_read_all".replace("%v", exports.API_VERSION);
  7871.         /** @type {string} */
  7872.         exports.API_USERS_USERID_PUSH_GCM_TOKEN = "/%v/users/%s/push/gcm/%s".replace("%v", exports.API_VERSION);
  7873.         /** @type {string} */
  7874.         exports.API_USERS_USERID_PUSH_GCM = "/%v/users/%s/push/gcm".replace("%v", exports.API_VERSION);
  7875.         /** @type {string} */
  7876.         exports.API_USERS_USERID_PUSHPREFERENCE_CHANNELURL = "/%v/users/%s/push_preference/%s".replace("%v", exports.API_VERSION);
  7877.         /** @type {string} */
  7878.         exports.API_USERS_USERID_PUSHPREFERENCE = "/%v/users/%s/push_preference/".replace("%v", exports.API_VERSION);
  7879.         /** @type {string} */
  7880.         exports.API_USERS_USERID_PUSH_TEMPLATE = "/%v/users/%s/push/template".replace("%v", exports.API_VERSION);
  7881.         /** @type {string} */
  7882.         exports.API_USERS_USERID_BLOCK = "/%v/users/%s/block".replace("%v", exports.API_VERSION);
  7883.         /** @type {string} */
  7884.         exports.API_USERS_USERID_BLOCK_TARGETID = "/%v/users/%s/block/%s".replace("%v", exports.API_VERSION);
  7885.         /** @type {string} */
  7886.         exports.API_USERS_USERID_PUSH_APNS_TOKEN = "/%v/users/%s/push/apns/%s".replace("%v", exports.API_VERSION);
  7887.         /** @type {string} */
  7888.         exports.API_USERS_USERID_PUSH_APNS = "/%v/users/%s/push/apns".replace("%v", exports.API_VERSION);
  7889.         /** @type {string} */
  7890.         exports.API_USERS_USERID_PUSH = "/%v/users/%s/push".replace("%v", exports.API_VERSION);
  7891.         /** @type {string} */
  7892.         exports.API_USERS_USERID_GROUP_CHANNEL_INVITATION_PREFERENCE = "/%v/users/%s/channel_invitation_preference".replace("%v", exports.API_VERSION);
  7893.         /** @type {string} */
  7894.         exports.API_USERS_USERID_GROUP_CHANNEL_COUNT = "/%v/users/%s/group_channel_count".replace("%v", exports.API_VERSION);
  7895.         /** @type {string} */
  7896.         exports.API_USERS_COUNT_PREFERENCE = "/%v/users/%s/count_preference/%s".replace("%v", exports.API_VERSION);
  7897.         /** @type {string} */
  7898.         exports.API_OPENCHANNELS = "/%v/open_channels".replace("%v", exports.API_VERSION);
  7899.         /** @type {string} */
  7900.         exports.API_OPENCHANNELS_CHANNELURL = "/%v/open_channels/%s".replace("%v", exports.API_VERSION);
  7901.         /** @type {string} */
  7902.         exports.API_OPENCHANNELS_CHANNELURL_MESSAGES = "/%v/open_channels/%s/messages".replace("%v", exports.API_VERSION);
  7903.         /** @type {string} */
  7904.         exports.API_OPENCHANNELS_CHANNELURL_MESSAGES_MESSAGEID = "/%v/open_channels/%s/messages/%s".replace("%v", exports.API_VERSION);
  7905.         /** @type {string} */
  7906.         exports.API_OPENCHANNELS_CHANNELURL_PARTICIPANTS = "/%v/open_channels/%s/participants".replace("%v", exports.API_VERSION);
  7907.         /** @type {string} */
  7908.         exports.API_OPENCHANNELS_CHANNELURL_METADATA = "/%v/open_channels/%s/metadata".replace("%v", exports.API_VERSION);
  7909.         /** @type {string} */
  7910.         exports.API_OPENCHANNELS_CHANNELURL_METADATA_KEY = "/%v/open_channels/%s/metadata/%s".replace("%v", exports.API_VERSION);
  7911.         /** @type {string} */
  7912.         exports.API_OPENCHANNELS_CHANNELURL_METACOUNTER = "/%v/open_channels/%s/metacounter".replace("%v", exports.API_VERSION);
  7913.         /** @type {string} */
  7914.         exports.API_OPENCHANNELS_CHANNELURL_METACOUNTER_KEY = "/%v/open_channels/%s/metacounter/%s".replace("%v", exports.API_VERSION);
  7915.         /** @type {string} */
  7916.         exports.API_OPENCHANNELS_CHANNELURL_BAN = "/%v/open_channels/%s/ban".replace("%v", exports.API_VERSION);
  7917.         /** @type {string} */
  7918.         exports.API_OPENCHANNELS_CHANNELURL_BAN_USERID = "/%v/open_channels/%s/ban/%s".replace("%v", exports.API_VERSION);
  7919.         /** @type {string} */
  7920.         exports.API_OPENCHANNELS_CHANNELURL_MUTE = "/%v/open_channels/%s/mute".replace("%v", exports.API_VERSION);
  7921.         /** @type {string} */
  7922.         exports.API_OPENCHANNELS_CHANNELURL_MUTE_USERID = "/%v/open_channels/%s/mute/%s".replace("%v", exports.API_VERSION);
  7923.         /** @type {string} */
  7924.         exports.API_OPENCHANNELS_CHANNELURL_FREEZE = "/%v/open_channels/%s/freeze".replace("%v", exports.API_VERSION);
  7925.         /** @type {string} */
  7926.         exports.API_GROUPCHANNELS = "/%v/group_channels".replace("%v", exports.API_VERSION);
  7927.         /** @type {string} */
  7928.         exports.API_MYGROUPCHANNELS = "/%v/users/%s/my_group_channels".replace("%v", exports.API_VERSION);
  7929.         /** @type {string} */
  7930.         exports.API_GROUPCHANNELS_CHANNELURL = "/%v/group_channels/%s".replace("%v", exports.API_VERSION);
  7931.         /** @type {string} */
  7932.         exports.API_GROUPCHANNELS_CHANNELURL_INVITE = "/%v/group_channels/%s/invite".replace("%v", exports.API_VERSION);
  7933.         /** @type {string} */
  7934.         exports.API_GROUPCHANNELS_CHANNELURL_ACCEPT_INVITATION = "/%v/group_channels/%s/accept".replace("%v", exports.API_VERSION);
  7935.         /** @type {string} */
  7936.         exports.API_GROUPCHANNELS_CHANNELURL_DECLINE_INVITATION = "/%v/group_channels/%s/decline".replace("%v", exports.API_VERSION);
  7937.         /** @type {string} */
  7938.         exports.API_GROUPCHANNELS_CHANNELURL_HIDE = "/%v/group_channels/%s/hide".replace("%v", exports.API_VERSION);
  7939.         /** @type {string} */
  7940.         exports.API_GROUPCHANNELS_CHANNELURL_LEAVE = "/%v/group_channels/%s/leave".replace("%v", exports.API_VERSION);
  7941.         /** @type {string} */
  7942.         exports.API_GROUPCHANNELS_CHANNELURL_JOIN = "/%v/group_channels/%s/join".replace("%v", exports.API_VERSION);
  7943.         /** @type {string} */
  7944.         exports.API_GROUPCHANNELS_CHANNELURL_MESSAGES = "/%v/group_channels/%s/messages".replace("%v", exports.API_VERSION);
  7945.         /** @type {string} */
  7946.         exports.API_GROUPCHANNELS_CHANNELURL_MESSAGES_MARKASREAD = "/%v/group_channels/%s/messages/mark_as_read".replace("%v", exports.API_VERSION);
  7947.         /** @type {string} */
  7948.         exports.API_GROUPCHANNELS_CHANNELURL_MESSAGES_TOTALCOUNT = "/%v/group_channels/%s/messages/total_count".replace("%v", exports.API_VERSION);
  7949.         /** @type {string} */
  7950.         exports.API_GROUPCHANNELS_CHANNELURL_MESSAGES_UNREADCOUNT = "/%v/group_channels/%s/messages/unread_count".replace("%v", exports.API_VERSION);
  7951.         /** @type {string} */
  7952.         exports.API_GROUPCHANNELS_CHANNELURL_MESSAGES_MESSAGEID = "/%v/group_channels/%s/messages/%s".replace("%v", exports.API_VERSION);
  7953.         /** @type {string} */
  7954.         exports.API_GROUPCHANNELS_CHANNELURL_MEMBERS = "/%v/group_channels/%s/members".replace("%v", exports.API_VERSION);
  7955.         /** @type {string} */
  7956.         exports.API_GROUPCHANNELS_CHANNELURL_METADATA = "/%v/group_channels/%s/metadata".replace("%v", exports.API_VERSION);
  7957.         /** @type {string} */
  7958.         exports.API_GROUPCHANNELS_CHANNELURL_METADATA_KEY = "/%v/group_channels/%s/metadata/%s".replace("%v", exports.API_VERSION);
  7959.         /** @type {string} */
  7960.         exports.API_GROUPCHANNELS_CHANNELURL_METACOUNTER = "/%v/group_channels/%s/metacounter".replace("%v", exports.API_VERSION);
  7961.         /** @type {string} */
  7962.         exports.API_GROUPCHANNELS_CHANNELURL_METACOUNTER_KEY = "/%v/group_channels/%s/metacounter/%s".replace("%v", exports.API_VERSION);
  7963.         /** @type {string} */
  7964.         exports.API_GROUPCHANNELS_RESET_USER_HISTORY = "/%v/group_channels/%s/reset_user_history".replace("%v", exports.API_VERSION);
  7965.         /** @type {string} */
  7966.         exports.API_GROUPCHANNELS_MEMBERS = "/%v/group_channels/%url/members".replace("%v", exports.API_VERSION);
  7967.         /** @type {string} */
  7968.         exports.API_GROUPCHANNELS_CHANNELURL_BAN = "/%v/group_channels/%s/ban".replace("%v", exports.API_VERSION);
  7969.         /** @type {string} */
  7970.         exports.API_GROUPCHANNELS_CHANNELURL_BAN_USERID = "/%v/group_channels/%s/ban/%s".replace("%v", exports.API_VERSION);
  7971.         /** @type {string} */
  7972.         exports.API_GROUPCHANNELS_CHANNELURL_MUTE = "/%v/group_channels/%s/mute".replace("%v", exports.API_VERSION);
  7973.         /** @type {string} */
  7974.         exports.API_GROUPCHANNELS_CHANNELURL_MUTE_USERID = "/%v/group_channels/%s/mute/%s".replace("%v", exports.API_VERSION);
  7975.         /** @type {string} */
  7976.         exports.API_GROUPCHANNELS_CHANNELURL_FREEZE = "/%v/group_channels/%s/freeze".replace("%v", exports.API_VERSION);
  7977.         /** @type {string} */
  7978.         exports.API_STORAGE_FILE = "/%v/storage/file".replace("%v", exports.API_VERSION);
  7979.         /** @type {string} */
  7980.         exports.API_STORAGE_PROFILE = "/%v/storage/profile_image".replace("%v", exports.API_VERSION);
  7981.         /** @type {string} */
  7982.         exports.API_OPENCHANNELS_CHANNELURL_MESSAGES_CHANGELOGS = "/%v/open_channels/%s/messages/changelogs".replace("%v", exports.API_VERSION);
  7983.         /** @type {string} */
  7984.         exports.API_GROUPCHANNELS_CHANNELURL_MESSAGES_CHANGELOGS = "/%v/group_channels/%s/messages/changelogs".replace("%v", exports.API_VERSION);
  7985.         /** @type {string} */
  7986.         exports.API_FRIENDS = "/%v/users/%s/friends".replace("%v", exports.API_VERSION);
  7987.         /** @type {string} */
  7988.         exports.API_FRIENDS_CHANGE_LOGS = "/%v/users/%s/friends/changelogs".replace("%v", exports.API_VERSION);
  7989.         /** @type {string} */
  7990.         exports.API_FRIENDS_DISCOVERIES = "/%v/users/%s/friend_discoveries".replace("%v", exports.API_VERSION);
  7991.         /** @type {string} */
  7992.         exports.API_GROUPCHANNELS_OPERATORS = "/%v/group_channels/%url/operators".replace("%v", exports.API_VERSION);
  7993.         /** @type {string} */
  7994.         exports.API_OPENCHANNELS_OPERATORS = "/%v/open_channels/%url/operators".replace("%v", exports.API_VERSION);
  7995.         /** @type {number} */
  7996.         exports.UPDATE_META_COUNTER_MODE_SET = 0;
  7997.         /** @type {number} */
  7998.         exports.UPDATE_META_COUNTER_MODE_INC = 1;
  7999.         /** @type {number} */
  8000.         exports.UPDATE_META_COUNTER_MODE_DEC = 2;
  8001.         /**
  8002.          * @return {undefined}
  8003.          */
  8004.         var transform = function() {
  8005.           /** @type {string} */
  8006.           var t = "";
  8007.           /** @type {boolean} */
  8008.           this.isLoading = false;
  8009.           /** @type {boolean} */
  8010.           this.hasMore = true;
  8011.           /** @type {number} */
  8012.           this.limit = 20;
  8013.           var $scope = this;
  8014.           /**
  8015.            * @param {string} stat
  8016.            * @return {?}
  8017.            */
  8018.           this.next = function(stat) {
  8019.             if (cb($scope.limit)) {
  8020.               if ($scope.hasMore) {
  8021.                 if ($scope.isLoading) {
  8022.                   return void callback(null, new Date("Query in progress.", concat.QUERY_IN_PROGRESS), stat);
  8023.                 }
  8024.                 /** @type {boolean} */
  8025.                 $scope.isLoading = true;
  8026.                 exports.getInstance().friendListQuery(setup.getInstance().getCurrentUserId(), t, $scope.limit, function(data, exisObj) {
  8027.                   if (exisObj) {
  8028.                     return $scope.isLoading = false, void callback(null, exisObj, stat);
  8029.                   }
  8030.                   var users = data.users;
  8031.                   var identifierPositions = users.map(function(options) {
  8032.                     return new client(options);
  8033.                   });
  8034.                   $scope.hasMore = data.has_more;
  8035.                   /** @type {boolean} */
  8036.                   $scope.isLoading = false;
  8037.                   t = data.next;
  8038.                   callback(identifierPositions, null, stat);
  8039.                 });
  8040.               }
  8041.             } else {
  8042.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), stat);
  8043.             }
  8044.           };
  8045.         };
  8046.         /**
  8047.          * @param {!Object} info
  8048.          * @param {string} obj
  8049.          * @param {string} key
  8050.          * @param {string} type
  8051.          * @return {undefined}
  8052.          */
  8053.         var debug = function(info, obj, key, type) {
  8054.           if (c) {
  8055.             this[key] = info[obj];
  8056.           } else {
  8057.             Object.defineProperty(info, key, {
  8058.               get : function() {
  8059.                 return "_coverUrl" === obj || "_coverImage" === obj ? info._channelCover : info[obj];
  8060.               },
  8061.               set : function(value) {
  8062.                 if ("file" === type) {
  8063.                   if ("string" == typeof value || "object" != typeof value) {
  8064.                     return;
  8065.                   }
  8066.                 } else {
  8067.                   if (type && typeof value !== type) {
  8068.                     return;
  8069.                   }
  8070.                 }
  8071.                 /** @type {string} */
  8072.                 info[obj] = value;
  8073.                 if (!("_coverUrl" !== obj && "_coverImage" !== obj)) {
  8074.                   /** @type {string} */
  8075.                   info._channelCover = value;
  8076.                 }
  8077.               }
  8078.             });
  8079.           }
  8080.         };
  8081.         /**
  8082.          * @return {undefined}
  8083.          */
  8084.         var render = function() {
  8085.           /** @type {null} */
  8086.           this._isDistinct = null;
  8087.           debug(this, "_isDistinct", "isDistinct", "boolean");
  8088.           /** @type {null} */
  8089.           this._isSuper = null;
  8090.           debug(this, "_isSuper", "isSuper", "boolean");
  8091.           /** @type {null} */
  8092.           this._isPublic = null;
  8093.           debug(this, "_isPublic", "isPublic", "boolean");
  8094.           /** @type {null} */
  8095.           this._channelUrl = null;
  8096.           debug(this, "_channelUrl", "channelUrl", "string");
  8097.           /** @type {null} */
  8098.           this._name = null;
  8099.           debug(this, "_name", "name", "string");
  8100.           /** @type {null} */
  8101.           this._data = null;
  8102.           debug(this, "_data", "data", "string");
  8103.           /** @type {null} */
  8104.           this._customType = null;
  8105.           debug(this, "_customType", "customType", "string");
  8106.           /** @type {null} */
  8107.           this._channelCover = null;
  8108.           debug(this, "_channelCover", "channelCover", null);
  8109.           /** @type {null} */
  8110.           this._coverUrl = null;
  8111.           debug(this, "_coverUrl", "coverUrl", "string");
  8112.           /** @type {null} */
  8113.           this._coverImage = null;
  8114.           debug(this, "_coverImage", "coverImage", "file");
  8115.           /** @type {!Array} */
  8116.           this._operatorIds = [];
  8117.           /** @type {null} */
  8118.           this._operators = null;
  8119.           if (c) {
  8120.             /** @type {null} */
  8121.             this.operators = this._operators;
  8122.           } else {
  8123.             Object.defineProperty(this, "operators", {
  8124.               get : function() {
  8125.                 return this._operators;
  8126.               },
  8127.               set : function(items) {
  8128.                 if (Array.isArray(items)) {
  8129.                   /** @type {!Array} */
  8130.                   var users = [];
  8131.                   /** @type {number} */
  8132.                   var i = 0;
  8133.                   for (; i < items.length; i++) {
  8134.                     if (items[i].hasOwnProperty("userId")) {
  8135.                       users.push(items[i].userId);
  8136.                     } else {
  8137.                       /** @type {!Array} */
  8138.                       users = [];
  8139.                     }
  8140.                   }
  8141.                   if (users.length === items.length) {
  8142.                     /** @type {!Array} */
  8143.                     this._operatorIds = users;
  8144.                   }
  8145.                 }
  8146.               }
  8147.             });
  8148.           }
  8149.           /** @type {null} */
  8150.           this._operatorUserIds = null;
  8151.           if (c) {
  8152.             /** @type {null} */
  8153.             this.operatorUserIds = this._operatorUserIds;
  8154.           } else {
  8155.             Object.defineProperty(this, "operatorUserIds", {
  8156.               get : function() {
  8157.                 return this._operatorUserIds;
  8158.               },
  8159.               set : function(b) {
  8160.                 if (Array.isArray(b)) {
  8161.                   /** @type {!Array} */
  8162.                   var a = [];
  8163.                   /** @type {number} */
  8164.                   var i = 0;
  8165.                   for (; i < b.length; i++) {
  8166.                     if ("string" == typeof b[i]) {
  8167.                       a.push(b[i]);
  8168.                     } else {
  8169.                       /** @type {!Array} */
  8170.                       a = [];
  8171.                     }
  8172.                   }
  8173.                   if (a.length === b.length) {
  8174.                     /** @type {!Array} */
  8175.                     this._operatorIds = a;
  8176.                   }
  8177.                 }
  8178.               }
  8179.             });
  8180.           }
  8181.           /** @type {null} */
  8182.           this._isEphemeral = null;
  8183.           debug(this, "_isEphemeral", "isEphemeral", "boolean");
  8184.           /** @type {!Array} */
  8185.           this._inviteUserIds = [];
  8186.           /**
  8187.            * @param {!NodeList} users
  8188.            * @return {undefined}
  8189.            */
  8190.           this.addUsers = function(users) {
  8191.             if (Array.isArray(users)) {
  8192.               var l = users.length;
  8193.               /** @type {!Array} */
  8194.               var todos = [];
  8195.               /** @type {number} */
  8196.               var i = 0;
  8197.               for (; i < l; i++) {
  8198.                 if (users[i].hasOwnProperty("userId")) {
  8199.                   todos.push(users[i].userId);
  8200.                 } else {
  8201.                   /** @type {!Array} */
  8202.                   todos = [];
  8203.                 }
  8204.               }
  8205.               if (todos.length > 0) {
  8206.                 this._inviteUserIds = this._inviteUserIds.concat(todos);
  8207.               }
  8208.             }
  8209.           };
  8210.           /**
  8211.            * @param {!Object} data
  8212.            * @return {undefined}
  8213.            */
  8214.           this.addUser = function(data) {
  8215.             if (data.hasOwnProperty("userId")) {
  8216.               this._inviteUserIds.push(data.userId);
  8217.             }
  8218.           };
  8219.           /**
  8220.            * @param {!NodeList} elems
  8221.            * @return {undefined}
  8222.            */
  8223.           this.addUserIds = function(elems) {
  8224.             if (Array.isArray(elems)) {
  8225.               var length = elems.length;
  8226.               /** @type {!Array} */
  8227.               var ret = [];
  8228.               /** @type {number} */
  8229.               var i = 0;
  8230.               for (; i < length; i++) {
  8231.                 if ("string" == typeof elems[i]) {
  8232.                   ret.push(elems[i]);
  8233.                 } else {
  8234.                   /** @type {!Array} */
  8235.                   ret = [];
  8236.                 }
  8237.               }
  8238.               if (ret.length > 0) {
  8239.                 this._inviteUserIds = this._inviteUserIds.concat(ret);
  8240.               }
  8241.             }
  8242.           };
  8243.           /**
  8244.            * @param {?} callback
  8245.            * @return {undefined}
  8246.            */
  8247.           this.addUserId = function(callback) {
  8248.             if ("string" == typeof callback) {
  8249.               this._inviteUserIds.push(callback);
  8250.             }
  8251.           };
  8252.         };
  8253.         /**
  8254.          * @return {undefined}
  8255.          */
  8256.         var UserService = function() {
  8257.         };
  8258.         UserService.MentionType = {
  8259.           USERS : "users",
  8260.           CHANNEL : "channel"
  8261.         };
  8262.         /**
  8263.          * @return {undefined}
  8264.          */
  8265.         var next = function() {
  8266.           /** @type {null} */
  8267.           this._message = null;
  8268.           debug(this, "_message", "message", "string");
  8269.           /** @type {null} */
  8270.           this._targetLanguages = null;
  8271.           if (c) {
  8272.             /** @type {null} */
  8273.             this.targetLanguages = this._targetLanguages;
  8274.           } else {
  8275.             Object.defineProperty(this, "targetLanguages", {
  8276.               get : function() {
  8277.                 return this._targetLanguages;
  8278.               },
  8279.               set : function(e) {
  8280.                 if (Array.isArray(e)) {
  8281.                   /** @type {number} */
  8282.                   var i = 0;
  8283.                   for (; i < e.length; i++) {
  8284.                     if ("string" != typeof e[i]) {
  8285.                       return void(this._targetLanguages = []);
  8286.                     }
  8287.                   }
  8288.                   /** @type {!NodeList} */
  8289.                   this._targetLanguages = e;
  8290.                 }
  8291.               }
  8292.             });
  8293.           }
  8294.           /** @type {null} */
  8295.           this._data = null;
  8296.           debug(this, "_data", "data", "string");
  8297.           /** @type {null} */
  8298.           this._customType = null;
  8299.           debug(this, "_customType", "customType", "string");
  8300.           /** @type {string} */
  8301.           this._mentionType = UserService.MentionType.USERS;
  8302.           if (c) {
  8303.             /** @type {string} */
  8304.             this.mentionType = this._mentionType;
  8305.           } else {
  8306.             Object.defineProperty(this, "mentionType", {
  8307.               get : function() {
  8308.                 return this._mentionType;
  8309.               },
  8310.               set : function(e) {
  8311.                 if (!([UserService.MentionType.USERS, UserService.MentionType.CHANNEL].indexOf(e) < 0)) {
  8312.                   this._mentionType = e;
  8313.                 }
  8314.               }
  8315.             });
  8316.           }
  8317.           /** @type {!Array} */
  8318.           this._mentionedIds = [];
  8319.           /** @type {null} */
  8320.           this._mentionedUsers = null;
  8321.           if (c) {
  8322.             /** @type {null} */
  8323.             this.mentionedUsers = this._mentionedUsers;
  8324.           } else {
  8325.             Object.defineProperty(this, "mentionedUsers", {
  8326.               get : function() {
  8327.                 return this._mentionedUsers;
  8328.               },
  8329.               set : function(members) {
  8330.                 if (Array.isArray(members)) {
  8331.                   /** @type {!Array} */
  8332.                   var connections = [];
  8333.                   /** @type {!Array} */
  8334.                   var am = [];
  8335.                   var userIdToMatchId = {};
  8336.                   /** @type {number} */
  8337.                   var i = 0;
  8338.                   for (; i < members.length; i++) {
  8339.                     if (!members[i].hasOwnProperty("userId")) {
  8340.                       return this._mentionedIds = [], void(this._mentionedUsers = []);
  8341.                     }
  8342.                     if (!userIdToMatchId[members[i].userId]) {
  8343.                       /** @type {boolean} */
  8344.                       userIdToMatchId[members[i].userId] = true;
  8345.                       if (setup.getInstance().getCurrentUserId() !== members[i].userId) {
  8346.                         connections.push(members[i]);
  8347.                         am.push(members[i].userId);
  8348.                       }
  8349.                     }
  8350.                   }
  8351.                   /** @type {!Array} */
  8352.                   this._mentionedUserIds = [];
  8353.                   /** @type {!Array} */
  8354.                   this._mentionedIds = am;
  8355.                   /** @type {!Array} */
  8356.                   this._mentionedUsers = connections;
  8357.                 }
  8358.               }
  8359.             });
  8360.           }
  8361.           /** @type {null} */
  8362.           this._mentionedUserIds = null;
  8363.           if (c) {
  8364.             /** @type {null} */
  8365.             this.mentionedUserIds = this._mentionedUserIds;
  8366.           } else {
  8367.             Object.defineProperty(this, "mentionedUserIds", {
  8368.               get : function() {
  8369.                 return this._mentionedUserIds;
  8370.               },
  8371.               set : function(a) {
  8372.                 if (Array.isArray(a)) {
  8373.                   /** @type {!Array} */
  8374.                   var reorderMap = [];
  8375.                   var asm = {};
  8376.                   /** @type {number} */
  8377.                   var i = 0;
  8378.                   for (; i < a.length; i++) {
  8379.                     if ("string" != typeof a[i]) {
  8380.                       return this._mentionedIds = [], void(this._mentionedUserIds = []);
  8381.                     }
  8382.                     if (!asm[a[i]]) {
  8383.                       /** @type {boolean} */
  8384.                       asm[a[i]] = true;
  8385.                       if (setup.getInstance().getCurrentUserId() !== a[i]) {
  8386.                         reorderMap.push(a[i]);
  8387.                       }
  8388.                     }
  8389.                   }
  8390.                   /** @type {!Array} */
  8391.                   this._mentionedUsers = [];
  8392.                   /** @type {!Array} */
  8393.                   this._mentionedIds = reorderMap;
  8394.                   /** @type {!Array} */
  8395.                   this._mentionedUserIds = reorderMap;
  8396.                 }
  8397.               }
  8398.             });
  8399.           }
  8400.           /** @type {null} */
  8401.           this._pushNotificationDeliveryOption = null;
  8402.           debug(this, "_pushNotificationDeliveryOption", "pushNotificationDeliveryOption", "string");
  8403.         };
  8404.         next.PushNotificationDeliveryOption = {
  8405.           DEFAULT : "default",
  8406.           SUPPRESS : "suppress"
  8407.         };
  8408.         /**
  8409.          * @return {undefined}
  8410.          */
  8411.         var set = function() {
  8412.           /** @type {null} */
  8413.           this._file = null;
  8414.           if (c) {
  8415.             /** @type {null} */
  8416.             this.file = this._file;
  8417.           } else {
  8418.             Object.defineProperty(this, "file", {
  8419.               get : function() {
  8420.                 return this._file;
  8421.               },
  8422.               set : function(val) {
  8423.                 if ("string" != typeof val && "object" == typeof val) {
  8424.                   /** @type {null} */
  8425.                   this._fileUrl = null;
  8426.                   /** @type {!Object} */
  8427.                   this._file = val;
  8428.                 }
  8429.               }
  8430.             });
  8431.           }
  8432.           /** @type {null} */
  8433.           this._fileUrl = null;
  8434.           if (c) {
  8435.             /** @type {null} */
  8436.             this.fileUrl = this._fileUrl;
  8437.           } else {
  8438.             Object.defineProperty(this, "fileUrl", {
  8439.               get : function() {
  8440.                 return this._fileUrl;
  8441.               },
  8442.               set : function(expires) {
  8443.                 if ("string" == typeof expires) {
  8444.                   /** @type {null} */
  8445.                   this._file = null;
  8446.                   /** @type {!Object} */
  8447.                   this._fileUrl = expires;
  8448.                 }
  8449.               }
  8450.             });
  8451.           }
  8452.           /** @type {null} */
  8453.           this._thumbnailSizes = null;
  8454.           if (c) {
  8455.             /** @type {null} */
  8456.             this.thumbnailSizes = this._thumbnailSizes;
  8457.           } else {
  8458.             Object.defineProperty(this, "thumbnailSizes", {
  8459.               get : function() {
  8460.                 return this._thumbnailSizes;
  8461.               },
  8462.               set : function(stream) {
  8463.                 if (Array.isArray(stream)) {
  8464.                   /** @type {number} */
  8465.                   var i = 0;
  8466.                   for (; i < stream.length; i++) {
  8467.                     if ("object" != typeof stream[i] || "number" != typeof stream[i].maxWidth || "number" != typeof stream[i].maxHeight) {
  8468.                       return void(this._thumbnailSizes = []);
  8469.                     }
  8470.                   }
  8471.                   /** @type {string} */
  8472.                   this._thumbnailSizes = stream;
  8473.                 }
  8474.               }
  8475.             });
  8476.           }
  8477.           /** @type {null} */
  8478.           this._fileName = null;
  8479.           debug(this, "_fileName", "fileName", "string");
  8480.           /** @type {null} */
  8481.           this._mimeType = null;
  8482.           debug(this, "_mimeType", "mimeType", "string");
  8483.           /** @type {null} */
  8484.           this._fileSize = null;
  8485.           debug(this, "_fileSize", "fileSize", "number");
  8486.           /** @type {null} */
  8487.           this._data = null;
  8488.           debug(this, "_data", "data", "string");
  8489.           /** @type {null} */
  8490.           this._customType = null;
  8491.           debug(this, "_customType", "customType", "string");
  8492.           /** @type {string} */
  8493.           this._mentionType = UserService.MentionType.USERS;
  8494.           if (c) {
  8495.             /** @type {string} */
  8496.             this.mentionType = this._mentionType;
  8497.           } else {
  8498.             Object.defineProperty(this, "mentionType", {
  8499.               get : function() {
  8500.                 return this._mentionType;
  8501.               },
  8502.               set : function(e) {
  8503.                 if (!([UserService.MentionType.USERS, UserService.MentionType.CHANNEL].indexOf(e) < 0)) {
  8504.                   /** @type {string} */
  8505.                   this._mentionType = e;
  8506.                 }
  8507.               }
  8508.             });
  8509.           }
  8510.           /** @type {!Array} */
  8511.           this._mentionedIds = [];
  8512.           /** @type {null} */
  8513.           this._mentionedUsers = null;
  8514.           if (c) {
  8515.             /** @type {null} */
  8516.             this.mentionedUsers = this._mentionedUsers;
  8517.           } else {
  8518.             Object.defineProperty(this, "mentionedUsers", {
  8519.               get : function() {
  8520.                 return this._mentionedUsers;
  8521.               },
  8522.               set : function(members) {
  8523.                 if (Array.isArray(members)) {
  8524.                   /** @type {!Array} */
  8525.                   var connections = [];
  8526.                   /** @type {!Array} */
  8527.                   var am = [];
  8528.                   var userIdToMatchId = {};
  8529.                   /** @type {number} */
  8530.                   var i = 0;
  8531.                   for (; i < members.length; i++) {
  8532.                     if (!members[i].hasOwnProperty("userId")) {
  8533.                       return this._mentionedIds = [], void(this._mentionedUsers = []);
  8534.                     }
  8535.                     if (!userIdToMatchId[members[i].userId]) {
  8536.                       /** @type {boolean} */
  8537.                       userIdToMatchId[members[i].userId] = true;
  8538.                       if (setup.getInstance().getCurrentUserId() !== members[i].userId) {
  8539.                         connections.push(members[i]);
  8540.                         am.push(members[i].userId);
  8541.                       }
  8542.                     }
  8543.                   }
  8544.                   /** @type {!Array} */
  8545.                   this._mentionedUserIds = [];
  8546.                   /** @type {!Array} */
  8547.                   this._mentionedIds = am;
  8548.                   /** @type {!Array} */
  8549.                   this._mentionedUsers = connections;
  8550.                 }
  8551.               }
  8552.             });
  8553.           }
  8554.           /** @type {null} */
  8555.           this._mentionedUserIds = null;
  8556.           if (c) {
  8557.             /** @type {null} */
  8558.             this.mentionedUserIds = this._mentionedUserIds;
  8559.           } else {
  8560.             Object.defineProperty(this, "mentionedUserIds", {
  8561.               get : function() {
  8562.                 return this._mentionedUserIds;
  8563.               },
  8564.               set : function(a) {
  8565.                 if (Array.isArray(a)) {
  8566.                   /** @type {!Array} */
  8567.                   var reorderMap = [];
  8568.                   var asm = {};
  8569.                   /** @type {number} */
  8570.                   var i = 0;
  8571.                   for (; i < a.length; i++) {
  8572.                     if ("string" != typeof a[i]) {
  8573.                       return this._mentionedIds = [], void(this._mentionedUserIds = []);
  8574.                     }
  8575.                     if (!asm[a[i]]) {
  8576.                       /** @type {boolean} */
  8577.                       asm[a[i]] = true;
  8578.                       if (setup.getInstance().getCurrentUserId() !== a[i]) {
  8579.                         reorderMap.push(a[i]);
  8580.                       }
  8581.                     }
  8582.                   }
  8583.                   /** @type {!Array} */
  8584.                   this._mentionedUsers = [];
  8585.                   /** @type {!Array} */
  8586.                   this._mentionedIds = reorderMap;
  8587.                   /** @type {!Array} */
  8588.                   this._mentionedUserIds = reorderMap;
  8589.                 }
  8590.               }
  8591.             });
  8592.           }
  8593.           /** @type {null} */
  8594.           this._pushNotificationDeliveryOption = null;
  8595.           debug(this, "_pushNotificationDeliveryOption", "pushNotificationDeliveryOption", "string");
  8596.         };
  8597.         set.PushNotificationDeliveryOption = {
  8598.           DEFAULT : "default",
  8599.           SUPPRESS : "suppress"
  8600.         };
  8601.         /**
  8602.          * @param {!Object} req
  8603.          * @return {?}
  8604.          */
  8605.         var setup = function(req) {
  8606.           var data = setup.getInstance();
  8607.           if (data) {
  8608.             return data;
  8609.           }
  8610.           try {
  8611.             if (!req.hasOwnProperty("appId")) {
  8612.               return console.log("Must be set appId"), {};
  8613.             }
  8614.           } catch (e) {
  8615.             return console.log("Must be set appId"), {};
  8616.           }
  8617.           /** @type {string} */
  8618.           this.GCMPushToken = "";
  8619.           /** @type {string} */
  8620.           this.APNSPushToken = "";
  8621.           /** @type {string} */
  8622.           this.PUSH_TEMPLATE_DEFAULT = "default";
  8623.           /** @type {string} */
  8624.           this.PUSH_TEMPLATE_ALTERNATIVE = "alternative";
  8625.           /** @type {boolean} */
  8626.           this.isSessionOpened = false;
  8627.           this.pushTokenRegistrationState = {
  8628.             SUCCESS : "success",
  8629.             PENDING : "pending",
  8630.             ERROR : "error"
  8631.           };
  8632.           this.loginTimer;
  8633.           this.onLoginTimerCancel;
  8634.           this.globalTimer;
  8635.           this.reconnectTimer;
  8636.           this.onReconnectTimerCancel;
  8637.           /** @type {null} */
  8638.           this.currentUser = null;
  8639.           /**
  8640.            * @return {?}
  8641.            */
  8642.           this.getCurrentUserId = function() {
  8643.             return setup.getInstance().currentUser ? setup.getInstance().currentUser.userId : null;
  8644.           };
  8645.           this.wsClient;
  8646.           this.connectionState = {
  8647.             CONNECTING : "CONNECTING",
  8648.             OPEN : "OPEN",
  8649.             CLOSING : "CLOSING",
  8650.             CLOSED : "CLOSED"
  8651.           };
  8652.           this.ConnectionState = this.connectionState;
  8653.           this.BaseChannel = R;
  8654.           /** @type {function(!Object): undefined} */
  8655.           this.User = client;
  8656.           /** @type {function(undefined): undefined} */
  8657.           this.Member = _this;
  8658.           /** @type {function(undefined): undefined} */
  8659.           this.OpenChannel = Model;
  8660.           /** @type {function(undefined): undefined} */
  8661.           this.GroupChannel = link;
  8662.           /** @type {function(!Object): undefined} */
  8663.           this.UserMessage = self;
  8664.           /** @type {function(!Object): undefined} */
  8665.           this.FileMessage = test;
  8666.           /** @type {function(string): undefined} */
  8667.           this.AdminMessage = logger;
  8668.           this.userEventHandlers = {};
  8669.           this.channelHandlers = {};
  8670.           this.connectionHandlers = {};
  8671.           /** @type {!Array} */
  8672.           this.connectionCallback = [];
  8673.           /** @type {function(): undefined} */
  8674.           this.GroupChannelParams = render;
  8675.           /** @type {function(): undefined} */
  8676.           this.BaseMessageParams = UserService;
  8677.           /** @type {function(): undefined} */
  8678.           this.FileMessageParams = set;
  8679.           /** @type {function(): undefined} */
  8680.           this.UserMessageParams = next;
  8681.           /** @type {function(): undefined} */
  8682.           this.GroupChannelTotalUnreadMessageCountParams = B;
  8683.           var transforms = {};
  8684.           path = req.appId;
  8685.           ue = this;
  8686.           if (!(ne = exports.getInstance())) {
  8687.             ne = new exports;
  8688.           }
  8689.           this.Options = {
  8690.             _useMemberAsMessageSender : false,
  8691.             get UseMemberAsMessageSender() {
  8692.               return this._useMemberAsMessageSender;
  8693.             },
  8694.             set UseMemberAsMessageSender(val) {
  8695.               if ("boolean" == typeof val) {
  8696.                 /** @type {boolean} */
  8697.                 this._useMemberAsMessageSender = val;
  8698.               }
  8699.             },
  8700.             get useMemberAsMessageSender() {
  8701.               return this._useMemberAsMessageSender;
  8702.             },
  8703.             set useMemberAsMessageSender(val) {
  8704.               if ("boolean" == typeof val) {
  8705.                 /** @type {boolean} */
  8706.                 this._useMemberAsMessageSender = val;
  8707.               }
  8708.             },
  8709.             _typingIndicatorThrottle : 1e3,
  8710.             get typingIndicatorThrottle() {
  8711.               return this._typingIndicatorThrottle;
  8712.             },
  8713.             set typingIndicatorThrottle(index) {
  8714.               if ("number" == typeof index && index >= 1e3 && index <= 9e3) {
  8715.                 /** @type {number} */
  8716.                 this._typingIndicatorThrottle = index;
  8717.               }
  8718.             }
  8719.           };
  8720.           /** @type {null} */
  8721.           this.customApiHost = null;
  8722.           /** @type {null} */
  8723.           this.customWsHost = null;
  8724.           /**
  8725.            * @return {undefined}
  8726.            */
  8727.           this.UserEventHandler = function() {
  8728.             /**
  8729.              * @param {?} isSlidingUp
  8730.              * @return {undefined}
  8731.              */
  8732.             this.onFriendsDiscovered = function(isSlidingUp) {
  8733.             };
  8734.           };
  8735.           /**
  8736.            * @param {?} url
  8737.            * @param {?} eTag
  8738.            * @return {undefined}
  8739.            */
  8740.           this.addUserEventHandler = function(url, eTag) {
  8741.             setup.getInstance().userEventHandlers[url] = eTag;
  8742.           };
  8743.           /**
  8744.            * @param {?} ballNumber
  8745.            * @return {undefined}
  8746.            */
  8747.           this.removeUserEventHandler = function(ballNumber) {
  8748.             delete setup.getInstance().userEventHandlers[ballNumber];
  8749.           };
  8750.           /**
  8751.            * @return {undefined}
  8752.            */
  8753.           this.removeAllUserEventHandler = function() {
  8754.             setup.getInstance().userEventHandlers = {};
  8755.           };
  8756.           /**
  8757.            * @return {undefined}
  8758.            */
  8759.           this.ChannelHandler = function() {
  8760.             /**
  8761.              * @param {!Object} message
  8762.              * @param {string} e
  8763.              * @return {undefined}
  8764.              */
  8765.             this.onMessageReceived = function(message, e) {
  8766.             };
  8767.             /**
  8768.              * @param {?} message
  8769.              * @param {string} paramName
  8770.              * @return {undefined}
  8771.              */
  8772.             this.onMessageUpdated = function(message, paramName) {
  8773.             };
  8774.             /**
  8775.              * @param {?} name
  8776.              * @param {string} identityId
  8777.              * @return {undefined}
  8778.              */
  8779.             this.onMessageDeleted = function(name, identityId) {
  8780.             };
  8781.             /**
  8782.              * @param {!Array} proplist
  8783.              * @return {undefined}
  8784.              */
  8785.             this.onReadReceiptUpdated = function(proplist) {
  8786.             };
  8787.             /**
  8788.              * @param {?} val
  8789.              * @return {undefined}
  8790.              */
  8791.             this.onTypingStatusUpdated = function(val) {
  8792.             };
  8793.             /**
  8794.              * @param {!Object} socket
  8795.              * @param {?} userId
  8796.              * @return {undefined}
  8797.              */
  8798.             this.onUserJoined = function(socket, userId) {
  8799.             };
  8800.             /**
  8801.              * @param {!Object} tab
  8802.              * @param {?} id
  8803.              * @return {undefined}
  8804.              */
  8805.             this.onUserLeft = function(tab, id) {
  8806.             };
  8807.             /**
  8808.              * @param {?} meeting
  8809.              * @param {?} callback
  8810.              * @return {undefined}
  8811.              */
  8812.             this.onUserEntered = function(meeting, callback) {
  8813.             };
  8814.             /**
  8815.              * @param {?} meeting
  8816.              * @param {?} callback
  8817.              * @return {undefined}
  8818.              */
  8819.             this.onUserExited = function(meeting, callback) {
  8820.             };
  8821.             /**
  8822.              * @param {?} i
  8823.              * @param {?} purchaseDetails
  8824.              * @return {undefined}
  8825.              */
  8826.             this.onUserMuted = function(i, purchaseDetails) {
  8827.             };
  8828.             /**
  8829.              * @param {?} i
  8830.              * @param {?} purchaseDetails
  8831.              * @return {undefined}
  8832.              */
  8833.             this.onUserUnmuted = function(i, purchaseDetails) {
  8834.             };
  8835.             /**
  8836.              * @param {!Object} b
  8837.              * @param {?} n
  8838.              * @return {undefined}
  8839.              */
  8840.             this.onUserBanned = function(b, n) {
  8841.             };
  8842.             /**
  8843.              * @param {!Object} b
  8844.              * @param {?} n
  8845.              * @return {undefined}
  8846.              */
  8847.             this.onUserUnbanned = function(b, n) {
  8848.             };
  8849.             /**
  8850.              * @param {!Object} rule
  8851.              * @return {undefined}
  8852.              */
  8853.             this.onChannelFrozen = function(rule) {
  8854.             };
  8855.             /**
  8856.              * @param {!Object} rule
  8857.              * @return {undefined}
  8858.              */
  8859.             this.onChannelUnfrozen = function(rule) {
  8860.             };
  8861.             /**
  8862.              * @param {!Object} container
  8863.              * @return {undefined}
  8864.              */
  8865.             this.onChannelChanged = function(container) {
  8866.             };
  8867.             /**
  8868.              * @param {?} canCreateDiscussions
  8869.              * @return {undefined}
  8870.              */
  8871.             this.onChannelDeleted = function(canCreateDiscussions) {
  8872.             };
  8873.             /**
  8874.              * @param {!Object} tests
  8875.              * @param {!Object} n
  8876.              * @param {!Array} froot
  8877.              * @return {undefined}
  8878.              */
  8879.             this.onUserReceivedInvitation = function(tests, n, froot) {
  8880.             };
  8881.             /**
  8882.              * @param {!Object} res
  8883.              * @param {!Object} record
  8884.              * @param {?} seriesData
  8885.              * @return {undefined}
  8886.              */
  8887.             this.onUserDeclinedInvitation = function(res, record, seriesData) {
  8888.             };
  8889.             /**
  8890.              * @param {?} boundContext
  8891.              * @param {?} fromDir
  8892.              * @return {undefined}
  8893.              */
  8894.             this.onMetaDataCreated = function(boundContext, fromDir) {
  8895.             };
  8896.             /**
  8897.              * @param {?} pageData
  8898.              * @param {?} relationData
  8899.              * @return {undefined}
  8900.              */
  8901.             this.onMetaDataUpdated = function(pageData, relationData) {
  8902.             };
  8903.             /**
  8904.              * @param {?} boundContext
  8905.              * @param {?} fromDir
  8906.              * @return {undefined}
  8907.              */
  8908.             this.onMetaDataDeleted = function(boundContext, fromDir) {
  8909.             };
  8910.             /**
  8911.              * @param {?} boundContext
  8912.              * @param {?} fromDir
  8913.              * @return {undefined}
  8914.              */
  8915.             this.onMetaCountersCreated = function(boundContext, fromDir) {
  8916.             };
  8917.             /**
  8918.              * @param {?} boundContext
  8919.              * @param {?} fromDir
  8920.              * @return {undefined}
  8921.              */
  8922.             this.onMetaCountersUpdated = function(boundContext, fromDir) {
  8923.             };
  8924.             /**
  8925.              * @param {?} boundContext
  8926.              * @param {?} fromDir
  8927.              * @return {undefined}
  8928.              */
  8929.             this.onMetaCountersDeleted = function(boundContext, fromDir) {
  8930.             };
  8931.             /**
  8932.              * @param {!Object} i
  8933.              * @return {undefined}
  8934.              */
  8935.             this.onChannelHidden = function(i) {
  8936.             };
  8937.             /**
  8938.              * @param {!Object} adapter
  8939.              * @param {string} callback
  8940.              * @return {undefined}
  8941.              */
  8942.             this.onMentionReceived = function(adapter, callback) {
  8943.             };
  8944.           };
  8945.           /**
  8946.            * @param {?} url
  8947.            * @param {?} eTag
  8948.            * @return {undefined}
  8949.            */
  8950.           this.addChannelHandler = function(url, eTag) {
  8951.             setup.getInstance().channelHandlers[url] = eTag;
  8952.           };
  8953.           /**
  8954.            * @param {?} ballNumber
  8955.            * @return {undefined}
  8956.            */
  8957.           this.removeChannelHandler = function(ballNumber) {
  8958.             delete setup.getInstance().channelHandlers[ballNumber];
  8959.           };
  8960.           /**
  8961.            * @return {undefined}
  8962.            */
  8963.           this.removeAllChannelHandlers = function() {
  8964.             setup.getInstance().channelHandlers = {};
  8965.           };
  8966.           /**
  8967.            * @return {undefined}
  8968.            */
  8969.           this.ConnectionHandler = function() {
  8970.             /**
  8971.              * @return {undefined}
  8972.              */
  8973.             this.onReconnectStarted = function() {
  8974.             };
  8975.             /**
  8976.              * @return {undefined}
  8977.              */
  8978.             this.onReconnectSucceeded = function() {
  8979.             };
  8980.             /**
  8981.              * @return {undefined}
  8982.              */
  8983.             this.onReconnectFailed = function() {
  8984.             };
  8985.           };
  8986.           /**
  8987.            * @param {?} url
  8988.            * @param {?} eTag
  8989.            * @return {undefined}
  8990.            */
  8991.           this.addConnectionHandler = function(url, eTag) {
  8992.             setup.getInstance().connectionHandlers[url] = eTag;
  8993.           };
  8994.           /**
  8995.            * @param {?} ballNumber
  8996.            * @return {undefined}
  8997.            */
  8998.           this.removeConnectionHandler = function(ballNumber) {
  8999.             delete setup.getInstance().connectionHandlers[ballNumber];
  9000.           };
  9001.           /**
  9002.            * @return {undefined}
  9003.            */
  9004.           this.removeAllConnectionHandlers = function() {
  9005.             setup.getInstance().connectionHandlers = {};
  9006.           };
  9007.           /**
  9008.            * @param {(!Function|RegExp|string)} e
  9009.            * @return {?}
  9010.            */
  9011.           this.createUserListQuery = function(e) {
  9012.             return e ? new load(load.FILTERED_USER, e) : new load(load.ALL_USER);
  9013.           };
  9014.           /**
  9015.            * @return {?}
  9016.            */
  9017.           this.createBlockedUserListQuery = function() {
  9018.             return new load(load.BLOCKED_USER);
  9019.           };
  9020.           /**
  9021.            * @return {?}
  9022.            */
  9023.           this.getApplicationId = function() {
  9024.             return path;
  9025.           };
  9026.           /**
  9027.            * @return {?}
  9028.            */
  9029.           this.getDebugMode = function() {
  9030.             return t;
  9031.           };
  9032.           /**
  9033.            * @param {boolean} d
  9034.            * @return {undefined}
  9035.            */
  9036.           this.setDebugMode = function(d) {
  9037.             /** @type {boolean} */
  9038.             t = d;
  9039.           };
  9040.           /**
  9041.            * @param {string} results
  9042.            * @return {undefined}
  9043.            */
  9044.           this.setAPIHost = function(results) {
  9045.             /** @type {string} */
  9046.             combined = results;
  9047.           };
  9048.           /**
  9049.            * @param {string} n
  9050.            * @return {undefined}
  9051.            */
  9052.           this.setWSHost = function(n) {
  9053.             /** @type {string} */
  9054.             ref1 = n;
  9055.           };
  9056.           /**
  9057.            * @return {undefined}
  9058.            */
  9059.           this.clearCurrentApiHost = function() {
  9060.             /** @type {null} */
  9061.             this.customApiHost = null;
  9062.           };
  9063.           /**
  9064.            * @return {?}
  9065.            */
  9066.           this.getCurrentApiHost = function() {
  9067.             return this.customApiHost ? this.customApiHost : combined;
  9068.           };
  9069.           /**
  9070.            * @return {undefined}
  9071.            */
  9072.           this.clearCurrentWsHost = function() {
  9073.             /** @type {null} */
  9074.             this.customWsHost = null;
  9075.           };
  9076.           /**
  9077.            * @return {?}
  9078.            */
  9079.           this.getCurrentWsHost = function() {
  9080.             return this.customWsHost ? this.customWsHost : ref1;
  9081.           };
  9082.           /**
  9083.            * @param {boolean} trackInfoUrl
  9084.            * @return {undefined}
  9085.            */
  9086.           this.setErrorFirstCallback = function(trackInfoUrl) {
  9087.             /** @type {boolean} */
  9088.             lastTrackInfoUrl = trackInfoUrl;
  9089.           };
  9090.           /**
  9091.            * @return {?}
  9092.            */
  9093.           this.getErrorFirstCallback = function() {
  9094.             return lastTrackInfoUrl;
  9095.           };
  9096.           /**
  9097.            * @return {?}
  9098.            */
  9099.           this.getConnectionState = function() {
  9100.             if (!setup.getInstance()) {
  9101.               return this.connectionState.CLOSED;
  9102.             }
  9103.             try {
  9104.               return setup.getInstance().wsClient ? setup.getInstance().isSessionOpened ? setup.getInstance().wsClient.getConnectionState() : setup.getInstance().connectionState.CONNECTING : setup.getInstance().connectionState.CLOSED;
  9105.             } catch (e) {
  9106.               return setup.getInstance().connectionState.CLOSED;
  9107.             }
  9108.           };
  9109.           /**
  9110.            * @return {?}
  9111.            */
  9112.           this.hasLoggedIn = function() {
  9113.             return setup.getInstance().currentUser && exports.getInstance().sessionKey;
  9114.           };
  9115.           /**
  9116.            * @param {?} type
  9117.            * @return {?}
  9118.            */
  9119.           var route = function(type) {
  9120.             return transforms.hasOwnProperty(type) ? transforms[type] : null;
  9121.           };
  9122.           /**
  9123.            * @param {?} params
  9124.            * @return {undefined}
  9125.            */
  9126.           var run = function(params) {
  9127.             var a = new init(params);
  9128.             if (a.requestId) {
  9129.               var result = route(a.requestId);
  9130.               if (null == result) {
  9131.                 return;
  9132.               }
  9133.               clearTimeout(result.timer);
  9134.               var r = result.handler;
  9135.               if (r) {
  9136.                 if ("EROR" === a.command) {
  9137.                   var parsed = a.getJsonElement();
  9138.                   var source = parsed.code;
  9139.                   var str = parsed.message;
  9140.                   r(a, new Date(str, source));
  9141.                 } else {
  9142.                   r(a, null);
  9143.                 }
  9144.               }
  9145.             } else {
  9146.               switch(a.command) {
  9147.                 case "LOGI":
  9148.                   if (setup.getInstance().loginTimer) {
  9149.                     clearTimeout(setup.getInstance().loginTimer);
  9150.                     /** @type {null} */
  9151.                     setup.getInstance().loginTimer = null;
  9152.                     /** @type {null} */
  9153.                     setup.getInstance().onLoginTimerCancel = null;
  9154.                     var data = a.getJsonElement();
  9155.                     if (data.hasOwnProperty("error")) {
  9156.                       /** @type {boolean} */
  9157.                       setup.getInstance().isSessionOpened = false;
  9158.                       source = data.code;
  9159.                       str = data.message;
  9160.                       setup.getInstance().loginHandler(null, new Date(str, source));
  9161.                     } else {
  9162.                       /** @type {boolean} */
  9163.                       setup.getInstance().isSessionOpened = true;
  9164.                       if (data.hasOwnProperty("key")) {
  9165.                         exports.getInstance().sessionKey = data.key;
  9166.                       }
  9167.                       if (data.hasOwnProperty("ekey")) {
  9168.                         exports.getInstance().ekey = data.ekey;
  9169.                       }
  9170.                       if (data.hasOwnProperty("user_id")) {
  9171.                         setup.getInstance().currentUser = new client(data);
  9172.                       }
  9173.                       setup.getInstance().loginHandler(setup.getInstance().currentUser, null);
  9174.                     }
  9175.                   }
  9176.                   break;
  9177.                 case "MESG":
  9178.                 case "FILE":
  9179.                 case "BRDM":
  9180.                 case "ADMM":
  9181.                   /** @type {string} */
  9182.                   var req = "";
  9183.                   /** @type {boolean} */
  9184.                   var silent = false;
  9185.                   if ("MESG" === a.command ? req = new self(a.getJsonElement()) : "FILE" === a.command ? req = new test(a.getJsonElement()) : (req = new logger(a.getJsonElement()), a.getJsonElement().hasOwnProperty("silent") && (silent = a.getJsonElement().silent)), !req) {
  9186.                     return;
  9187.                   }
  9188.                   if (req.isGroupChannel()) {
  9189.                     /** @type {boolean} */
  9190.                     var p = link.cachedChannels.hasOwnProperty(req.channelUrl);
  9191.                     link.getChannel(req.channelUrl, function(self, callback) {
  9192.                       if (lastTrackInfoUrl) {
  9193.                         /** @type {!Object} */
  9194.                         var network = self;
  9195.                         /** @type {!Object} */
  9196.                         self = callback;
  9197.                         callback = network;
  9198.                       }
  9199.                       if (callback) {
  9200.                         if (r) {
  9201.                           r(null, callback);
  9202.                         }
  9203.                       } else {
  9204.                         if (self.isHidden = false, link.cachedChannels[self.url] = self, req._sender && self.memberMap.hasOwnProperty(req._sender.userId)) {
  9205.                           var user = self.memberMap[req._sender.userId];
  9206.                           if (user.nickname !== req._sender.nickname) {
  9207.                             user.nickname = req._sender.nickname;
  9208.                           }
  9209.                           if (user.profileUrl !== req._sender.profileUrl) {
  9210.                             user.profileUrl = req._sender.profileUrl;
  9211.                           }
  9212.                         }
  9213.                         var user = setup.getInstance().currentUser;
  9214.                         if (user && req._sender && user.userId === req._sender.userId) {
  9215.                           if (user.nickname !== req._sender.nickname) {
  9216.                             user.nickname = req._sender.nickname;
  9217.                           }
  9218.                           if (user.profileUrl !== req._sender.profileUrl) {
  9219.                             user.profileUrl = req._sender.profileUrl;
  9220.                           }
  9221.                         }
  9222.                         /** @type {boolean} */
  9223.                         var extension = false;
  9224.                         if (req.mentionType === UserService.MentionType.CHANNEL) {
  9225.                           if (!(req.sender && req.sender.userId === setup.getInstance().getCurrentUserId())) {
  9226.                             /** @type {boolean} */
  9227.                             extension = true;
  9228.                           }
  9229.                         } else {
  9230.                           if (req.mentionType === UserService.MentionType.USERS) {
  9231.                             var key;
  9232.                             for (key in req.mentionedUsers) {
  9233.                               if ((!req.sender || req.sender.userId !== setup.getInstance().getCurrentUserId()) && req.mentionedUsers[key].userId === setup.getInstance().getCurrentUserId()) {
  9234.                                 /** @type {boolean} */
  9235.                                 extension = true;
  9236.                                 break;
  9237.                               }
  9238.                             }
  9239.                           }
  9240.                         }
  9241.                         if (silent || (self.isEphemeral ? (self.lastMessage = req, req.sender && req.sender.userId === setup.getInstance().getCurrentUserId() || log(self, self.unreadMessageCount + 1, self.unreadMentionCount + (extension ? 1 : 0))) : p && (self.lastMessage = req, req.sender && req.sender.userId === setup.getInstance().getCurrentUserId() || log(self, self.unreadMessageCount + 1, self.unreadMentionCount + (extension ? 1 : 0)))), !silent) {
  9242.                           for (key in setup.getInstance().channelHandlers) {
  9243.                             var list = setup.getInstance().channelHandlers[key];
  9244.                             list.onChannelChanged(self);
  9245.                           }
  9246.                         }
  9247.                         for (key in setup.getInstance().channelHandlers) {
  9248.                           list = setup.getInstance().channelHandlers[key];
  9249.                           list.onMessageReceived(self, req);
  9250.                           if (extension) {
  9251.                             list.onMentionReceived(self, req);
  9252.                           }
  9253.                         }
  9254.                       }
  9255.                     });
  9256.                   } else {
  9257.                     Model.getChannel(req.channelUrl, function(validator, trOpts) {
  9258.                       if (lastTrackInfoUrl) {
  9259.                         /** @type {!Object} */
  9260.                         var rrjqbvValidator = validator;
  9261.                         /** @type {string} */
  9262.                         validator = trOpts;
  9263.                         trOpts = rrjqbvValidator;
  9264.                       }
  9265.                       if (trOpts) {
  9266.                         if (r) {
  9267.                           r(null, trOpts);
  9268.                         }
  9269.                       } else {
  9270.                         /** @type {boolean} */
  9271.                         var s = false;
  9272.                         if (req.mentionType === UserService.MentionType.CHANNEL) {
  9273.                           /** @type {boolean} */
  9274.                           s = true;
  9275.                         } else {
  9276.                           if (req.mentionType === UserService.MentionType.USERS) {
  9277.                             var key;
  9278.                             for (key in req.mentionedUsers) {
  9279.                               if (req.mentionedUsers[key].userId === setup.getInstance().getCurrentUserId()) {
  9280.                                 /** @type {boolean} */
  9281.                                 s = true;
  9282.                                 break;
  9283.                               }
  9284.                             }
  9285.                           }
  9286.                         }
  9287.                         for (key in setup.getInstance().channelHandlers) {
  9288.                           var self = setup.getInstance().channelHandlers[key];
  9289.                           if (Model.enteredChannels[validator.url]) {
  9290.                             self.onMessageReceived(validator, req);
  9291.                           }
  9292.                           if (s) {
  9293.                             self.onMentionReceived(validator, req);
  9294.                           }
  9295.                         }
  9296.                       }
  9297.                     });
  9298.                   }
  9299.                   break;
  9300.                 case "MEDI":
  9301.                 case "FEDI":
  9302.                 case "AEDI":
  9303.                   /** @type {string} */
  9304.                   req = "";
  9305.                   if (!(req = "MEDI" === a.command ? new self(a.getJsonElement()) : "FEDI" === a.command ? new test(a.getJsonElement()) : new logger(a.getJsonElement()))) {
  9306.                     return;
  9307.                   }
  9308.                   if (req.isGroupChannel()) {
  9309.                     link.getChannel(req.channelUrl, function(e, o) {
  9310.                       if (lastTrackInfoUrl) {
  9311.                         var str = e;
  9312.                         e = o;
  9313.                         o = str;
  9314.                       }
  9315.                       if (o) {
  9316.                         if (r) {
  9317.                           r(null, o);
  9318.                         }
  9319.                       } else {
  9320.                         if (req._sender && e.memberMap.hasOwnProperty(req._sender.userId)) {
  9321.                           var user = e.memberMap[req._sender.userId];
  9322.                           if (user.nickname !== req._sender.nickname) {
  9323.                             user.nickname = req._sender.nickname;
  9324.                           }
  9325.                           if (user.profileUrl !== req._sender.profileUrl) {
  9326.                             user.profileUrl = req._sender.profileUrl;
  9327.                           }
  9328.                         }
  9329.                         var user = setup.getInstance().currentUser;
  9330.                         var i;
  9331.                         for (i in user && req._sender && user.userId === req._sender.userId && (user.nickname !== req._sender.nickname && (user.nickname = req._sender.nickname), user.profileUrl !== req._sender.profileUrl && (user.profileUrl = req._sender.profileUrl)), setup.getInstance().channelHandlers) {
  9332.                           setup.getInstance().channelHandlers[i].onMessageUpdated(e, req);
  9333.                         }
  9334.                       }
  9335.                     });
  9336.                   } else {
  9337.                     Model.getChannel(req.channelUrl, function(e, o) {
  9338.                       if (lastTrackInfoUrl) {
  9339.                         var str = e;
  9340.                         e = o;
  9341.                         o = str;
  9342.                       }
  9343.                       if (o) {
  9344.                         if (r) {
  9345.                           r(null, o);
  9346.                         }
  9347.                       } else {
  9348.                         var indexLookupKey;
  9349.                         for (indexLookupKey in setup.getInstance().channelHandlers) {
  9350.                           setup.getInstance().channelHandlers[indexLookupKey].onMessageUpdated(e, req);
  9351.                         }
  9352.                       }
  9353.                     });
  9354.                   }
  9355.                   break;
  9356.                 case "READ":
  9357.                   var data = new function(config) {
  9358.                     if (config) {
  9359.                       this.reader = new client(config.user);
  9360.                       /** @type {number} */
  9361.                       this.timestamp = parseInt(config.ts);
  9362.                       /** @type {string} */
  9363.                       this.channelUrl = config.hasOwnProperty("channel_url") ? String(config.channel_url) : "";
  9364.                       /** @type {string} */
  9365.                       this.channelType = config.hasOwnProperty("channel_type") ? String(config.channel_type) : update.CHANNEL_TYPE_GROUP;
  9366.                     }
  9367.                   }(a.getJsonElement());
  9368.                   /** @type {boolean} */
  9369.                   p = link.cachedChannels.hasOwnProperty(data.channelUrl);
  9370.                   link.getChannel(data.channelUrl, function(self, callback) {
  9371.                     if (lastTrackInfoUrl) {
  9372.                       /** @type {!Array} */
  9373.                       var network = self;
  9374.                       /** @type {!Array} */
  9375.                       self = callback;
  9376.                       callback = network;
  9377.                     }
  9378.                     if (callback) {
  9379.                       if (r) {
  9380.                         r(null, callback);
  9381.                       }
  9382.                     } else {
  9383.                       if (data.reader.userId === setup.getInstance().getCurrentUserId()) {
  9384.                         if (p) {
  9385.                           if (self.unreadMessageCount > 0 || self.unreadMentionCount > 0) {
  9386.                             var type;
  9387.                             for (type in log(self, 0, 0), setup.getInstance().channelHandlers) {
  9388.                               var list = setup.getInstance().channelHandlers[type];
  9389.                               list.onChannelChanged(self);
  9390.                             }
  9391.                           }
  9392.                         } else {
  9393.                           if (0 === self.unreadMessageCount || 0 === self.unreadMentionCount) {
  9394.                             for (type in setup.getInstance().channelHandlers) {
  9395.                               list = setup.getInstance().channelHandlers[type];
  9396.                               list.onChannelChanged(self);
  9397.                             }
  9398.                           }
  9399.                         }
  9400.                       } else {
  9401.                         for (type in self.updateReadReceipt(data.reader.userId, data.timestamp), setup.getInstance().channelHandlers) {
  9402.                           list = setup.getInstance().channelHandlers[type];
  9403.                           list.onReadReceiptUpdated(self);
  9404.                         }
  9405.                       }
  9406.                     }
  9407.                   });
  9408.                   break;
  9409.                 case "TPST":
  9410.                 case "TPEN":
  9411.                 case "MTIO":
  9412.                   break;
  9413.                 case "SYEV":
  9414.                   init(a);
  9415.                   break;
  9416.                 case "USEV":
  9417.                   success(a);
  9418.                   break;
  9419.                 case "DELM":
  9420.                   var item = a.getJsonElement();
  9421.                   /** @type {string} */
  9422.                   var yminstr = String(item.channel_type);
  9423.                   /** @type {string} */
  9424.                   var name = String(item.channel_url);
  9425.                   /** @type {string} */
  9426.                   var userId = String(item.msg_id);
  9427.                   switch(yminstr) {
  9428.                     case update.CHANNEL_TYPE_OPEN:
  9429.                       Model.getChannel(name, function(e, realEvent) {
  9430.                         if (lastTrackInfoUrl) {
  9431.                           var event = e;
  9432.                           e = realEvent;
  9433.                           realEvent = event;
  9434.                         }
  9435.                         if (realEvent) {
  9436.                           console.log("Discard a command.");
  9437.                         } else {
  9438.                           var indexLookupKey;
  9439.                           for (indexLookupKey in setup.getInstance().channelHandlers) {
  9440.                             setup.getInstance().channelHandlers[indexLookupKey].onMessageDeleted(e, userId);
  9441.                           }
  9442.                         }
  9443.                       });
  9444.                       break;
  9445.                     case update.CHANNEL_TYPE_GROUP:
  9446.                       link.getChannel(name, function(e, realEvent) {
  9447.                         if (lastTrackInfoUrl) {
  9448.                           var event = e;
  9449.                           e = realEvent;
  9450.                           realEvent = event;
  9451.                         }
  9452.                         if (realEvent) {
  9453.                           console.log("Discard a command.");
  9454.                         } else {
  9455.                           var indexLookupKey;
  9456.                           for (indexLookupKey in setup.getInstance().channelHandlers) {
  9457.                             setup.getInstance().channelHandlers[indexLookupKey].onMessageDeleted(e, userId);
  9458.                           }
  9459.                         }
  9460.                       });
  9461.                   }
  9462.               }
  9463.             }
  9464.           };
  9465.           /**
  9466.            * @param {?} art
  9467.            * @return {undefined}
  9468.            */
  9469.           var success = function(art) {
  9470.             var _this = new read(art.getJsonElement());
  9471.             switch(_this.category) {
  9472.               case _init.CATEGORY_USER_BLOCK:
  9473.               case _init.CATEGORY_USER_UNBLOCK:
  9474.                 var id = _this.data.blocker.user_id;
  9475.                 var userId = _this.data.blockee.user_id;
  9476.                 Object.keys(link.cachedChannels).forEach(function(key) {
  9477.                   var session = link.cachedChannels[key];
  9478.                   try {
  9479.                     if (setup.getInstance().getCurrentUserId() === id) {
  9480.                       /** @type {boolean} */
  9481.                       session.memberMap[userId].isBlockedByMe = _this.category === _init.CATEGORY_USER_BLOCK;
  9482.                     } else {
  9483.                       if (setup.getInstance().getCurrentUserId() === userId) {
  9484.                         /** @type {boolean} */
  9485.                         session.memberMap[id].isBlockingMe = _this.category === _init.CATEGORY_USER_BLOCK;
  9486.                       }
  9487.                     }
  9488.                   } catch (e) {
  9489.                   }
  9490.                 });
  9491.                 break;
  9492.               case _init.CATEGORY_FRIEND_DISCOVERED:
  9493.                 var navLinksArr = _this.data.friend_discoveries;
  9494.                 var clojIsReversed = navLinksArr.map(function(options) {
  9495.                   return new client(options);
  9496.                 });
  9497.                 var i;
  9498.                 for (i in setup.getInstance().userEventHandlers) {
  9499.                   setup.getInstance().userEventHandlers[i].onFriendsDiscovered(clojIsReversed);
  9500.                 }
  9501.             }
  9502.           };
  9503.           /**
  9504.            * @param {!Object} ast
  9505.            * @return {undefined}
  9506.            */
  9507.           var init = function(ast) {
  9508.             var data = ast.getJsonElement();
  9509.             var req = new read(data);
  9510.             switch(req.category) {
  9511.               case read.CATEGORY_CHANNEL_JOIN:
  9512.               case read.CATEGORY_CHANNEL_LEAVE:
  9513.                 link.getChannel(req.channelUrl, function($scope, scope) {
  9514.                   if (lastTrackInfoUrl) {
  9515.                     /** @type {!Object} */
  9516.                     var s = $scope;
  9517.                     /** @type {string} */
  9518.                     $scope = scope;
  9519.                     scope = s;
  9520.                   }
  9521.                   if (scope) {
  9522.                     console.log("Discard a command: " + ast.command + ":" + req.category);
  9523.                   } else {
  9524.                     var obj = req.data.hasOwnProperty("member_count") ? req.data.member_count : null;
  9525.                     var element = req.data.hasOwnProperty("joined_member_count") ? req.data.joined_member_count : null;
  9526.                     if (req.category === read.CATEGORY_CHANNEL_JOIN) {
  9527.                       (req.data.hasOwnProperty("users") ? req.data.users : function(storeData) {
  9528.                         return storeData.state = _this.JOINED, [storeData];
  9529.                       }(req.data)).forEach(function(keyReads) {
  9530.                         !function(options, exit, item) {
  9531.                           if ($scope.isSuper) {
  9532.                             $scope.setLatestMemberCount(exit, item, data.ts);
  9533.                           } else {
  9534.                             /** @type {string} */
  9535.                             options.state = _this.JOINED;
  9536.                             $scope.addMember(new _this(options));
  9537.                             $scope.updateJoinedMemberCount();
  9538.                           }
  9539.                           var c = new client(options);
  9540.                           var i;
  9541.                           for (i in c.userId === setup.getInstance().getCurrentUserId() && ($scope.myMemberState = "joined", link.cachedChannels[$scope.url] = $scope), setup.getInstance().channelHandlers) {
  9542.                             setup.getInstance().channelHandlers[i].onUserJoined($scope, c);
  9543.                           }
  9544.                         }(keyReads, obj, element);
  9545.                       });
  9546.                     } else {
  9547.                       var c = new client(req.data);
  9548.                       var indexLookupKey;
  9549.                       for (indexLookupKey in c.userId === setup.getInstance().getCurrentUserId() ? ($scope.isPublic || link.removeCachedChannel(req.channelUrl), $scope.myMemberState = "none") : link.cachedChannels[$scope.url] = $scope, $scope.isSuper ? $scope.setLatestMemberCount(obj, element, data.ts) : ($scope.removeMember(c), $scope.updateJoinedMemberCount()), setup.getInstance().channelHandlers) {
  9550.                         setup.getInstance().channelHandlers[indexLookupKey].onUserLeft($scope, c);
  9551.                       }
  9552.                     }
  9553.                   }
  9554.                 });
  9555.                 break;
  9556.               case read.CATEGORY_CHANNEL_INVITE:
  9557.                 link.getChannel(req.channelUrl, function(options, url) {
  9558.                   if (lastTrackInfoUrl) {
  9559.                     /** @type {!Object} */
  9560.                     var method = options;
  9561.                     /** @type {!Object} */
  9562.                     options = url;
  9563.                     url = method;
  9564.                   }
  9565.                   if (url) {
  9566.                     console.log("Discard a command: " + ast.command + ":" + req.category);
  9567.                   } else {
  9568.                     /** @type {null} */
  9569.                     var uncert = null;
  9570.                     if (req.data && req.data.inviter && !check(req.data.inviter)) {
  9571.                       uncert = new client(req.data.inviter);
  9572.                     }
  9573.                     /** @type {!Array} */
  9574.                     var newNodeLists = [];
  9575.                     var j;
  9576.                     for (j in req.data.invitees) {
  9577.                       var itemNodeList = new client(req.data.invitees[j]);
  9578.                       newNodeLists.push(itemNodeList);
  9579.                       /** @type {string} */
  9580.                       req.data.invitees[j].state = _this.INVITED;
  9581.                       var child = new _this(req.data.invitees[j]);
  9582.                       if (options.isSuper) {
  9583.                         var _ = req.data.hasOwnProperty("member_count") ? req.data.member_count : null;
  9584.                         var activeItem = req.data.hasOwnProperty("joined_member_count") ? req.data.joined_member_count : null;
  9585.                         options.setLatestMemberCount(_, activeItem, data.ts);
  9586.                       } else {
  9587.                         options.addMember(child);
  9588.                       }
  9589.                       if (child.userId === setup.getInstance().getCurrentUserId()) {
  9590.                         /** @type {boolean} */
  9591.                         options.isHidden = false;
  9592.                         if ("joined" !== options.myMemberState) {
  9593.                           /** @type {string} */
  9594.                           options.myMemberState = "invited";
  9595.                         }
  9596.                         /** @type {!Object} */
  9597.                         link.cachedChannels[options.url] = options;
  9598.                       }
  9599.                     }
  9600.                     for (j in setup.getInstance().channelHandlers) {
  9601.                       setup.getInstance().channelHandlers[j].onUserReceivedInvitation(options, uncert, newNodeLists);
  9602.                     }
  9603.                   }
  9604.                 });
  9605.                 break;
  9606.               case read.CATEGORY_CHANNEL_DECLINE_INVITE:
  9607.                 link.getChannel(req.channelUrl, function(options, url) {
  9608.                   if (lastTrackInfoUrl) {
  9609.                     /** @type {!Object} */
  9610.                     var method = options;
  9611.                     /** @type {string} */
  9612.                     options = url;
  9613.                     url = method;
  9614.                   }
  9615.                   if (url) {
  9616.                     console.log("Discard a command: " + ast.command + ":" + req.category);
  9617.                   } else {
  9618.                     /** @type {null} */
  9619.                     var recordWithMsg = null;
  9620.                     if (req.data && req.data.inviter && !check(req.data.inviter)) {
  9621.                       recordWithMsg = new client(req.data.inviter);
  9622.                     }
  9623.                     var data = new client(req.data.invitee);
  9624.                     if (data.userId === setup.getInstance().getCurrentUserId() && (options.myMemberState = "none", options.isPublic || link.removeCachedChannel(req.channelUrl)), options.isSuper) {
  9625.                       var u = req.data.hasOwnProperty("member_count") ? req.data.member_count : null;
  9626.                       var activeItem = req.data.hasOwnProperty("joined_member_count") ? req.data.joined_member_count : null;
  9627.                       options.setLatestMemberCount(u, activeItem, data.ts);
  9628.                     } else {
  9629.                       options.removeMember(data);
  9630.                     }
  9631.                     var indexLookupKey;
  9632.                     for (indexLookupKey in link.cachedChannels[options.url] = options, setup.getInstance().channelHandlers) {
  9633.                       setup.getInstance().channelHandlers[indexLookupKey].onUserDeclinedInvitation(options, recordWithMsg, data);
  9634.                     }
  9635.                   }
  9636.                 });
  9637.                 break;
  9638.               case read.CATEGORY_TYPING_START:
  9639.               case read.CATEGORY_TYPING_END:
  9640.                 link.getChannel(req.channelUrl, function(newPath, i) {
  9641.                   if (lastTrackInfoUrl) {
  9642.                     var origNewPath = newPath;
  9643.                     newPath = i;
  9644.                     i = origNewPath;
  9645.                   }
  9646.                   if (i) {
  9647.                     console.log("Discard a command: " + ast.command + ":" + req.category);
  9648.                   } else {
  9649.                     var type = new client(req.data);
  9650.                     var indexLookupKey;
  9651.                     for (indexLookupKey in req.category === read.CATEGORY_TYPING_START ? newPath.updateTypingStatus(type, true) : newPath.updateTypingStatus(type, false), setup.getInstance().channelHandlers) {
  9652.                       setup.getInstance().channelHandlers[indexLookupKey].onTypingStatusUpdated(newPath);
  9653.                     }
  9654.                   }
  9655.                 });
  9656.                 break;
  9657.               case read.CATEGORY_CHANNEL_ENTER:
  9658.               case read.CATEGORY_CHANNEL_EXIT:
  9659.                 Model.getChannel(req.channelUrl, function(meeting, data) {
  9660.                   if (lastTrackInfoUrl) {
  9661.                     var meetingInfo = meeting;
  9662.                     meeting = data;
  9663.                     data = meetingInfo;
  9664.                   }
  9665.                   if (data) {
  9666.                     console.log("Discard a command: " + ast.command + ":" + req.category);
  9667.                   } else {
  9668.                     if (req.data.hasOwnProperty("participant_count")) {
  9669.                       meeting.participantCount = req.data.participant_count;
  9670.                     }
  9671.                     var c = new client(req.data);
  9672.                     if (req.category === read.CATEGORY_CHANNEL_ENTER) {
  9673.                       var i;
  9674.                       for (i in setup.getInstance().channelHandlers) {
  9675.                         var filterValue = setup.getInstance().channelHandlers[i];
  9676.                         filterValue.onUserEntered(meeting, c);
  9677.                       }
  9678.                     } else {
  9679.                       for (i in setup.getInstance().channelHandlers) {
  9680.                         filterValue = setup.getInstance().channelHandlers[i];
  9681.                         filterValue.onUserExited(meeting, c);
  9682.                       }
  9683.                     }
  9684.                   }
  9685.                 });
  9686.                 break;
  9687.               case read.CATEGORY_USER_CHANNEL_MUTE:
  9688.               case read.CATEGORY_USER_CHANNEL_UNMUTE:
  9689.                 if (req.isOpenChannel()) {
  9690.                   Model.getChannel(req.channelUrl, function(f, _$param5) {
  9691.                     if (lastTrackInfoUrl) {
  9692.                       var f3 = f;
  9693.                       f = _$param5;
  9694.                       _$param5 = f3;
  9695.                     }
  9696.                     if (_$param5) {
  9697.                       console.log("Discard a command: " + ast.command + ":" + req.category);
  9698.                     } else {
  9699.                       var purchaseDetails = new client(req.data);
  9700.                       if (req.category === read.CATEGORY_USER_CHANNEL_MUTE) {
  9701.                         var i;
  9702.                         for (i in setup.getInstance().channelHandlers) {
  9703.                           var instanceAndSymbol = setup.getInstance().channelHandlers[i];
  9704.                           instanceAndSymbol.onUserMuted(f, purchaseDetails);
  9705.                         }
  9706.                       } else {
  9707.                         for (i in setup.getInstance().channelHandlers) {
  9708.                           instanceAndSymbol = setup.getInstance().channelHandlers[i];
  9709.                           instanceAndSymbol.onUserUnmuted(f, purchaseDetails);
  9710.                         }
  9711.                       }
  9712.                     }
  9713.                   });
  9714.                 } else {
  9715.                   link.getChannel(req.channelUrl, function(f, _$param5) {
  9716.                     if (lastTrackInfoUrl) {
  9717.                       var f3 = f;
  9718.                       f = _$param5;
  9719.                       _$param5 = f3;
  9720.                     }
  9721.                     if (_$param5) {
  9722.                       console.log("Discard a command: " + ast.command + ":" + req.category);
  9723.                     } else {
  9724.                       var purchaseDetails = new client(req.data);
  9725.                       if (purchaseDetails.userId === setup.getInstance().getCurrentUserId() && (f.myMutedState = req.category === read.CATEGORY_USER_CHANNEL_MUTE ? "muted" : "unmuted"), req.category === read.CATEGORY_USER_CHANNEL_MUTE) {
  9726.                         var i;
  9727.                         for (i in setup.getInstance().channelHandlers) {
  9728.                           var instanceAndSymbol = setup.getInstance().channelHandlers[i];
  9729.                           instanceAndSymbol.onUserMuted(f, purchaseDetails);
  9730.                         }
  9731.                       } else {
  9732.                         for (i in setup.getInstance().channelHandlers) {
  9733.                           instanceAndSymbol = setup.getInstance().channelHandlers[i];
  9734.                           instanceAndSymbol.onUserUnmuted(f, purchaseDetails);
  9735.                         }
  9736.                       }
  9737.                     }
  9738.                   });
  9739.                 }
  9740.                 break;
  9741.               case read.CATEGORY_USER_CHANNEL_BAN:
  9742.               case read.CATEGORY_USER_CHANNEL_UNBAN:
  9743.                 if (req.isOpenChannel()) {
  9744.                   Model.getChannel(req.channelUrl, function(newPath, i) {
  9745.                     if (lastTrackInfoUrl) {
  9746.                       /** @type {!Object} */
  9747.                       var origNewPath = newPath;
  9748.                       /** @type {string} */
  9749.                       newPath = i;
  9750.                       i = origNewPath;
  9751.                     }
  9752.                     if (i) {
  9753.                       console.log("Discard a command: " + ast.command + ":" + req.category);
  9754.                     } else {
  9755.                       var c = new client(req.data);
  9756.                       if (req.category === read.CATEGORY_USER_CHANNEL_BAN) {
  9757.                         var i;
  9758.                         for (i in setup.getInstance().channelHandlers) {
  9759.                           var form = setup.getInstance().channelHandlers[i];
  9760.                           form.onUserBanned(newPath, c);
  9761.                         }
  9762.                       } else {
  9763.                         for (i in setup.getInstance().channelHandlers) {
  9764.                           form = setup.getInstance().channelHandlers[i];
  9765.                           form.onUserUnbanned(newPath, c);
  9766.                         }
  9767.                       }
  9768.                     }
  9769.                   });
  9770.                 } else {
  9771.                   link.getChannel(req.channelUrl, function(t, a) {
  9772.                     if (lastTrackInfoUrl) {
  9773.                       /** @type {!Object} */
  9774.                       var tmp = t;
  9775.                       /** @type {string} */
  9776.                       t = a;
  9777.                       a = tmp;
  9778.                     }
  9779.                     if (a) {
  9780.                       console.log("Discard a command: " + ast.command + ":" + req.category);
  9781.                     } else {
  9782.                       var c = new client(req.data);
  9783.                       if (req.category === read.CATEGORY_USER_CHANNEL_BAN) {
  9784.                         if (c.userId === setup.getInstance().getCurrentUserId() && (t.myMemberState = "none"), t.isSuper) {
  9785.                           var l = req.data.hasOwnProperty("member_count") ? req.data.member_count : null;
  9786.                           var previousWidgetPos = req.data.hasOwnProperty("joined_member_count") ? req.data.joined_member_count : null;
  9787.                           t.setLatestMemberCount(l, previousWidgetPos, data.ts);
  9788.                         } else {
  9789.                           t.removeMember(c);
  9790.                           t.updateJoinedMemberCount();
  9791.                         }
  9792.                         var i;
  9793.                         for (i in setup.getInstance().channelHandlers) {
  9794.                           var d = setup.getInstance().channelHandlers[i];
  9795.                           d.onUserBanned(t, c);
  9796.                         }
  9797.                       } else {
  9798.                         for (i in setup.getInstance().channelHandlers) {
  9799.                           d = setup.getInstance().channelHandlers[i];
  9800.                           d.onUserUnbanned(t, c);
  9801.                         }
  9802.                       }
  9803.                     }
  9804.                   });
  9805.                 }
  9806.                 break;
  9807.               case read.CATEGORY_CHANNEL_FREEZE:
  9808.               case read.CATEGORY_CHANNEL_UNFREEZE:
  9809.                 if (req.isOpenChannel()) {
  9810.                   Model.getChannel(req.channelUrl, function(validator, val) {
  9811.                     if (lastTrackInfoUrl) {
  9812.                       /** @type {!Object} */
  9813.                       var config = validator;
  9814.                       /** @type {string} */
  9815.                       validator = val;
  9816.                       val = config;
  9817.                     }
  9818.                     if (val) {
  9819.                       console.log("Discard a command: " + ast.command + ":" + req.category);
  9820.                     } else {
  9821.                       if (validator.isFrozen = req.data.freeze, Model.cachedChannels[validator.url] = validator, req.category === read.CATEGORY_CHANNEL_FREEZE) {
  9822.                         var i;
  9823.                         for (i in setup.getInstance().channelHandlers) {
  9824.                           var rule = setup.getInstance().channelHandlers[i];
  9825.                           rule.onChannelFrozen(validator);
  9826.                         }
  9827.                       } else {
  9828.                         for (i in setup.getInstance().channelHandlers) {
  9829.                           rule = setup.getInstance().channelHandlers[i];
  9830.                           rule.onChannelUnfrozen(validator);
  9831.                         }
  9832.                       }
  9833.                     }
  9834.                   });
  9835.                 } else {
  9836.                   link.getChannel(req.channelUrl, function(copy, byte) {
  9837.                     if (lastTrackInfoUrl) {
  9838.                       /** @type {!Object} */
  9839.                       var supportTypes = copy;
  9840.                       /** @type {string} */
  9841.                       copy = byte;
  9842.                       byte = supportTypes;
  9843.                     }
  9844.                     if (byte) {
  9845.                       console.log("Discard a command: " + ast.command + ":" + req.category);
  9846.                     } else {
  9847.                       if (copy.isFrozen = req.data.freeze, link.cachedChannels[copy.url] = copy, req.category === read.CATEGORY_CHANNEL_FREEZE) {
  9848.                         var i;
  9849.                         for (i in setup.getInstance().channelHandlers) {
  9850.                           var rule = setup.getInstance().channelHandlers[i];
  9851.                           rule.onChannelFrozen(copy);
  9852.                         }
  9853.                       } else {
  9854.                         for (i in setup.getInstance().channelHandlers) {
  9855.                           rule = setup.getInstance().channelHandlers[i];
  9856.                           rule.onChannelUnfrozen(copy);
  9857.                         }
  9858.                       }
  9859.                     }
  9860.                   });
  9861.                 }
  9862.                 break;
  9863.               case read.CATEGORY_CHANNEL_DELETED:
  9864.                 if (req.isGroupChannel()) {
  9865.                   var targetId;
  9866.                   for (targetId in link.removeCachedChannel(req.channelUrl), setup.getInstance().channelHandlers) {
  9867.                     var target = setup.getInstance().channelHandlers[targetId];
  9868.                     target.onChannelDeleted(req.channelUrl, "group");
  9869.                   }
  9870.                 } else {
  9871.                   for (targetId in Model.removeCachedChannel(req.channelUrl), setup.getInstance().channelHandlers) {
  9872.                     target = setup.getInstance().channelHandlers[targetId];
  9873.                     target.onChannelDeleted(req.channelUrl, "open");
  9874.                   }
  9875.                 }
  9876.                 break;
  9877.               case read.CATEGORY_CHANNEL_PROP_CHANGED:
  9878.                 if (req.isOpenChannel()) {
  9879.                   Model.getChannelWithoutCache(req.channelUrl, function(height, opt_height) {
  9880.                     if (lastTrackInfoUrl) {
  9881.                       var whatToScale = height;
  9882.                       height = opt_height;
  9883.                       opt_height = whatToScale;
  9884.                     }
  9885.                     if (opt_height) {
  9886.                       console.log("Discard a command: " + ast.command + ":" + req.category);
  9887.                     } else {
  9888.                       var i;
  9889.                       for (i in setup.getInstance().channelHandlers) {
  9890.                         setup.getInstance().channelHandlers[i].onChannelChanged(height);
  9891.                       }
  9892.                     }
  9893.                   });
  9894.                 } else {
  9895.                   link.getChannelWithoutCache(req.channelUrl, function(self, p) {
  9896.                     if (lastTrackInfoUrl) {
  9897.                       /** @type {!Array} */
  9898.                       var current = self;
  9899.                       /** @type {!Array} */
  9900.                       self = p;
  9901.                       p = current;
  9902.                     }
  9903.                     if (p) {
  9904.                       console.log("Discard a command: " + ast.command + ":" + req.category);
  9905.                     } else {
  9906.                       var x = self.unreadMessageCount;
  9907.                       var y = self.unreadMentionCount;
  9908.                       var indexLookupKey;
  9909.                       for (indexLookupKey in self.myCountPreference !== link.CountPreference.ALL && (self.myCountPreference === link.CountPreference.UNREAD_MESSAGE_COUNT_ONLY ? y = 0 : self.myCountPreference === link.CountPreference.UNREAD_MENTION_COUNT_ONLY ? x = 0 : (x = 0, y = 0)), log(self, x, y), setup.getInstance().channelHandlers) {
  9910.                         setup.getInstance().channelHandlers[indexLookupKey].onChannelChanged(self);
  9911.                       }
  9912.                     }
  9913.                   });
  9914.                 }
  9915.                 break;
  9916.               case read.CATEGORY_CHANNEL_META_DATA_CHANGED:
  9917.               case read.CATEGORY_CHANNEL_META_COUNTERS_CHANGED:
  9918.                 var db = req.data.hasOwnProperty("created");
  9919.                 var ret = req.data.hasOwnProperty("updated");
  9920.                 var deletedIds = req.data.hasOwnProperty("deleted");
  9921.                 if (req.isOpenChannel()) {
  9922.                   Model.getChannel(req.channelUrl, function(that, hash) {
  9923.                     if (lastTrackInfoUrl) {
  9924.                       var fooabcdefghi = that;
  9925.                       that = hash;
  9926.                       hash = fooabcdefghi;
  9927.                     }
  9928.                     if (hash) {
  9929.                       console.log("Discard a command: " + ast.command + ":" + req.category);
  9930.                     } else {
  9931.                       var indexLookupKey;
  9932.                       for (indexLookupKey in setup.getInstance().channelHandlers) {
  9933.                         var _updateMap = setup.getInstance().channelHandlers[indexLookupKey];
  9934.                         if (req.category === read.CATEGORY_CHANNEL_META_DATA_CHANGED) {
  9935.                           if (db) {
  9936.                             _updateMap.onMetaDataCreated(that, req.data.created);
  9937.                           }
  9938.                           if (ret) {
  9939.                             _updateMap.onMetaDataUpdated(that, req.data.updated);
  9940.                           }
  9941.                           if (deletedIds) {
  9942.                             _updateMap.onMetaDataDeleted(that, req.data.deleted);
  9943.                           }
  9944.                         } else {
  9945.                           if (db) {
  9946.                             _updateMap.onMetaCountersCreated(that, req.data.created);
  9947.                           }
  9948.                           if (ret) {
  9949.                             _updateMap.onMetaCountersUpdated(that, req.data.updated);
  9950.                           }
  9951.                           if (deletedIds) {
  9952.                             _updateMap.onMetaCountersDeleted(that, req.data.deleted);
  9953.                           }
  9954.                         }
  9955.                       }
  9956.                     }
  9957.                   });
  9958.                 } else {
  9959.                   link.getChannel(req.channelUrl, function(that, hash) {
  9960.                     if (lastTrackInfoUrl) {
  9961.                       var fooabcdefghi = that;
  9962.                       that = hash;
  9963.                       hash = fooabcdefghi;
  9964.                     }
  9965.                     if (hash) {
  9966.                       console.log("Discard a command: " + ast.command + ":" + req.category);
  9967.                     } else {
  9968.                       var indexLookupKey;
  9969.                       for (indexLookupKey in setup.getInstance().channelHandlers) {
  9970.                         var _updateMap = setup.getInstance().channelHandlers[indexLookupKey];
  9971.                         if (req.category === read.CATEGORY_CHANNEL_META_DATA_CHANGED) {
  9972.                           if (db) {
  9973.                             _updateMap.onMetaDataCreated(that, req.data.created);
  9974.                           }
  9975.                           if (ret) {
  9976.                             _updateMap.onMetaDataUpdated(that, req.data.updated);
  9977.                           }
  9978.                           if (deletedIds) {
  9979.                             _updateMap.onMetaDataDeleted(that, req.data.deleted);
  9980.                           }
  9981.                         } else {
  9982.                           if (db) {
  9983.                             _updateMap.onMetaCountersCreated(that, req.data.created);
  9984.                           }
  9985.                           if (ret) {
  9986.                             _updateMap.onMetaCountersUpdated(that, req.data.updated);
  9987.                           }
  9988.                           if (deletedIds) {
  9989.                             _updateMap.onMetaCountersDeleted(that, req.data.deleted);
  9990.                           }
  9991.                         }
  9992.                       }
  9993.                     }
  9994.                   });
  9995.                 }
  9996.                 break;
  9997.               case read.CATEGORY_CHANNEL_HIDE:
  9998.                 link.getChannel(req.channelUrl, function(f, _$param5) {
  9999.                   if (lastTrackInfoUrl) {
  10000.                     /** @type {!Object} */
  10001.                     var f3 = f;
  10002.                     /** @type {!Object} */
  10003.                     f = _$param5;
  10004.                     _$param5 = f3;
  10005.                   }
  10006.                   if (_$param5) {
  10007.                     console.log("Discard a command: " + ast.command + ":" + req.category);
  10008.                   } else {
  10009.                     if (f.isHidden = true, req.data && req.data.hasOwnProperty("hide_previous_messages") && req.data.hide_previous_messages && link.cachedChannels) {
  10010.                       var div = link.cachedChannels[f.url];
  10011.                       log(div, 0, 0);
  10012.                       link.cachedChannels[f.url] = div;
  10013.                     }
  10014.                     var indexLookupKey;
  10015.                     for (indexLookupKey in setup.getInstance().channelHandlers) {
  10016.                       setup.getInstance().channelHandlers[indexLookupKey].onChannelHidden(f);
  10017.                     }
  10018.                   }
  10019.                 });
  10020.             }
  10021.           };
  10022.           /**
  10023.            * @param {string} body
  10024.            * @param {string} success
  10025.            * @return {?}
  10026.            */
  10027.           this.setPushTemplate = function(body, success) {
  10028.             return !body || body !== this.PUSH_TEMPLATE_DEFAULT && body !== this.PUSH_TEMPLATE_ALTERNATIVE ? void callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), success) : this.currentUser ? void exports.getInstance().setPushTemplate(this.getCurrentUserId(), body, function(it_case, exisObj) {
  10029.               if (exisObj) {
  10030.                 callback(null, exisObj, success);
  10031.               } else {
  10032.                 var identifierPositions = it_case.name.toString();
  10033.                 callback(identifierPositions, null, success);
  10034.               }
  10035.             }) : void callback(null, new Date("Connection must be made before you set push template", concat.CONNECTION_REQUIRED), success);
  10036.           };
  10037.           /**
  10038.            * @param {string} productInfo
  10039.            * @return {undefined}
  10040.            */
  10041.           this.getPushTemplate = function(productInfo) {
  10042.             if (this.currentUser) {
  10043.               exports.getInstance().getPushTemplate(this.getCurrentUserId(), function(it_case, exisObj) {
  10044.                 if (exisObj) {
  10045.                   callback(null, exisObj, productInfo);
  10046.                 } else {
  10047.                   var identifierPositions = it_case.name.toString();
  10048.                   callback(identifierPositions, null, productInfo);
  10049.                 }
  10050.               });
  10051.             } else {
  10052.               callback(null, new Date("Connection must be made before you get push template", concat.CONNECTION_REQUIRED), productInfo);
  10053.             }
  10054.           };
  10055.           /**
  10056.            * @param {?} t
  10057.            * @param {!Function} c
  10058.            * @return {undefined}
  10059.            */
  10060.           this.setChannelInvitationPreference = function(t, c) {
  10061.             if ("boolean" != typeof t) {
  10062.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), c);
  10063.             }
  10064.             exports.getInstance().setChannelInvitationPreference(this.getCurrentUserId(), t, function(canCreateDiscussions, exisObj) {
  10065.               if (exisObj) {
  10066.                 callback(null, exisObj, c);
  10067.               } else {
  10068.                 callback({
  10069.                   autoAccept : canCreateDiscussions.auto_accept
  10070.                 }, null, c);
  10071.               }
  10072.             });
  10073.           };
  10074.           /**
  10075.            * @param {string} productInfo
  10076.            * @return {undefined}
  10077.            */
  10078.           this.getChannelInvitationPreference = function(productInfo) {
  10079.             exports.getInstance().getChannelInvitationPreference(this.getCurrentUserId(), function(n, exisObj) {
  10080.               if (exisObj) {
  10081.                 callback(null, exisObj, productInfo);
  10082.               } else {
  10083.                 callback({
  10084.                   autoAccept : n.auto_accept
  10085.                 }, null, productInfo);
  10086.               }
  10087.             });
  10088.           };
  10089.           /**
  10090.            * @return {undefined}
  10091.            */
  10092.           this.connect = function() {
  10093.             /** @type {!Array<?>} */
  10094.             var args = Array.prototype.slice.call(arguments);
  10095.             /** @type {null} */
  10096.             var id = null;
  10097.             /** @type {null} */
  10098.             var event = null;
  10099.             /** @type {null} */
  10100.             var productInfo = null;
  10101.             switch("function" == typeof args.slice(-1)[0] && (productInfo = args.pop()), args.length) {
  10102.               case 1:
  10103.                 id = args[0];
  10104.                 break;
  10105.               case 2:
  10106.                 id = args[0];
  10107.                 event = args[1];
  10108.                 break;
  10109.               case 3:
  10110.                 id = args[0];
  10111.                 this.customApiHost = args[1];
  10112.                 this.customWsHost = args[2];
  10113.                 break;
  10114.               case 4:
  10115.                 id = args[0];
  10116.                 event = args[1];
  10117.                 this.customApiHost = args[2];
  10118.                 this.customWsHost = args[3];
  10119.                 break;
  10120.               default:
  10121.                 if (t) {
  10122.                   console.log("sb.connect args length error: ", arguments);
  10123.                 }
  10124.             }
  10125.             if (id && 0 !== id.length) {
  10126.               if (setup.getInstance().reconnectTimer) {
  10127.                 clearTimeout(setup.getInstance().reconnectTimer);
  10128.                 /** @type {null} */
  10129.                 setup.getInstance().reconnectTimer = null;
  10130.                 /** @type {null} */
  10131.                 setup.getInstance().onReconnectTimerCancel = null;
  10132.               }
  10133.               if (setup.getInstance().getConnectionState() === this.connectionState.OPEN && setup.getInstance().getCurrentUserId() === id) {
  10134.                 callback(setup.getInstance().currentUser, null, productInfo);
  10135.               } else {
  10136.                 setup.getInstance().connectionCallback.push(productInfo);
  10137.                 if (1 === setup.getInstance().connectionCallback.length) {
  10138.                   callback(true, null);
  10139.                   connect(id, event);
  10140.                 }
  10141.               }
  10142.             } else {
  10143.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), productInfo);
  10144.             }
  10145.           };
  10146.           /** @type {boolean} */
  10147.           var canViewMyFiles = false;
  10148.           /** @type {boolean} */
  10149.           var _ = false;
  10150.           /** @type {boolean} */
  10151.           var canAccessMyFiles = true;
  10152.           /**
  10153.            * @return {undefined}
  10154.            */
  10155.           this.setBackgroundState = function() {
  10156.             if (!canViewMyFiles && canAccessMyFiles) {
  10157.               /** @type {boolean} */
  10158.               canViewMyFiles = true;
  10159.               if (this.getConnectionState() !== this.connectionState.CLOSED) {
  10160.                 /** @type {boolean} */
  10161.                 _ = true;
  10162.                 callback(false, null);
  10163.               } else {
  10164.                 /** @type {boolean} */
  10165.                 _ = false;
  10166.               }
  10167.             }
  10168.           };
  10169.           /**
  10170.            * @return {undefined}
  10171.            */
  10172.           this.setForegroundState = function() {
  10173.             if (canViewMyFiles && canAccessMyFiles) {
  10174.               /** @type {boolean} */
  10175.               canViewMyFiles = false;
  10176.               if (_ && this.currentUser) {
  10177.                 /** @type {number} */
  10178.                 retries = 0;
  10179.                 start(this.getCurrentUserId(), true);
  10180.               }
  10181.             }
  10182.           };
  10183.           /**
  10184.            * @return {undefined}
  10185.            */
  10186.           this.disableStateChange = function() {
  10187.             /** @type {boolean} */
  10188.             canAccessMyFiles = false;
  10189.           };
  10190.           /**
  10191.            * @return {undefined}
  10192.            */
  10193.           this.enableStateChange = function() {
  10194.             /** @type {boolean} */
  10195.             canAccessMyFiles = true;
  10196.           };
  10197.           /**
  10198.            * @param {string} progress
  10199.            * @return {undefined}
  10200.            */
  10201.           this.disconnect = function(progress) {
  10202.             callback(true, progress);
  10203.           };
  10204.           /**
  10205.            * @return {?}
  10206.            */
  10207.           this.reconnect = function() {
  10208.             if (!exports.getInstance().sessionKey || !this.currentUser) {
  10209.               return false;
  10210.             }
  10211.             /** @type {boolean} */
  10212.             var touch = true;
  10213.             return retries > 0 && (touch = false), callback(false, null), retries = 0, start(this.getCurrentUserId(), touch), true;
  10214.           };
  10215.           /**
  10216.            * @param {boolean} remaining
  10217.            * @param {string} result
  10218.            * @return {undefined}
  10219.            */
  10220.           var callback = function(remaining, result) {
  10221.             var socket = this;
  10222.             if (setup.getInstance().loginTimer) {
  10223.               clearTimeout(setup.getInstance().loginTimer);
  10224.               if (setup.getInstance().onLoginTimerCancel) {
  10225.                 setup.getInstance().onLoginTimerCancel();
  10226.                 /** @type {null} */
  10227.                 setup.getInstance().onLoginTimerCancel = null;
  10228.               }
  10229.               /** @type {null} */
  10230.               setup.getInstance().loginTimer = null;
  10231.             }
  10232.             if (setup.getInstance().reconnectTimer) {
  10233.               clearTimeout(setup.getInstance().reconnectTimer);
  10234.               if (setup.getInstance().onReconnectTimerCancel) {
  10235.                 setup.getInstance().onReconnectTimerCancel();
  10236.                 /** @type {null} */
  10237.                 setup.getInstance().onReconnectTimerCancel = null;
  10238.               }
  10239.               /** @type {null} */
  10240.               setup.getInstance().reconnectTimer = null;
  10241.             }
  10242.             if (setup.getInstance().wsClient) {
  10243.               /** @type {number} */
  10244.               retries = 0;
  10245.               setup.getInstance().wsClient.disconnect(true);
  10246.               /** @type {null} */
  10247.               setup.getInstance().wsClient = null;
  10248.             }
  10249.             (function() {
  10250.               if (remaining) {
  10251.                 var name;
  10252.                 for (name in Model.clearEnteredChannels(), Model.clearCache(), link.clearCache(), setup.getInstance().globalTimer && (clearTimeout(socket.globalTimer), setup.getInstance().globalTimer = null), setup.getInstance().ackStateMap) {
  10253.                   clearTimeout(setup.getInstance().ackStateMap[name].timer);
  10254.                 }
  10255.                 setup.getInstance().ackStateMap = {};
  10256.                 /** @type {null} */
  10257.                 setup.getInstance().currentUser = null;
  10258.                 /** @type {null} */
  10259.                 exports.getInstance().sessionKey = null;
  10260.                 /** @type {null} */
  10261.                 exports.getInstance().ekey = null;
  10262.               }
  10263.               callback(null, null, result);
  10264.             })();
  10265.           };
  10266.           /**
  10267.            * @param {!Object} e
  10268.            * @param {boolean} touch
  10269.            * @return {undefined}
  10270.            */
  10271.           var start = function(e, touch) {
  10272.             if (setup.getInstance().reconnectTimer) {
  10273.               if (t) {
  10274.                 console.log("still reconnecting");
  10275.               }
  10276.             } else {
  10277.               if ((retries = retries + 1) <= 1) {
  10278.                 if (touch) {
  10279.                   var i;
  10280.                   for (i in setup.getInstance().connectionHandlers) {
  10281.                     var instanceAndSymbol = setup.getInstance().connectionHandlers[i];
  10282.                     instanceAndSymbol.onReconnectStarted(i);
  10283.                   }
  10284.                 }
  10285.                 /** @type {number} */
  10286.                 ms = 0;
  10287.               } else {
  10288.                 /** @type {number} */
  10289.                 ms = 3e3 * Math.pow(2, retries - 2);
  10290.               }
  10291.               if (!e || !exports.getInstance().sessionKey || retries >= 6) {
  10292.                 for (i in callback(false, null), retries = 0, setup.getInstance().connectionHandlers) {
  10293.                   instanceAndSymbol = setup.getInstance().connectionHandlers[i];
  10294.                   instanceAndSymbol.onReconnectFailed(i);
  10295.                 }
  10296.                 return;
  10297.               }
  10298.               /**
  10299.                * @return {undefined}
  10300.                */
  10301.               setup.getInstance().onReconnectTimerCancel = function() {
  10302.                 /** @type {number} */
  10303.                 retries = 0;
  10304.               };
  10305.               /** @type {number} */
  10306.               setup.getInstance().reconnectTimer = setTimeout(function() {
  10307.                 /** @type {null} */
  10308.                 setup.getInstance().reconnectTimer = null;
  10309.                 /** @type {null} */
  10310.                 setup.getInstance().onReconnectTimerCancel = null;
  10311.                 if (setup.getInstance().wsClient) {
  10312.                   setup.getInstance().wsClient.disconnect(true);
  10313.                 }
  10314.                 var self = new Client.WSClientHandler;
  10315.                 setup.getInstance().wsClient = new Client(self);
  10316.                 /**
  10317.                  * @param {!Object} status
  10318.                  * @return {undefined}
  10319.                  */
  10320.                 setup.getInstance().loginHandler = function(status) {
  10321.                   var i;
  10322.                   for (i in retries = 0, Model.enteredChannels) {
  10323.                     Model.enteredChannels[i].enter();
  10324.                   }
  10325.                   for (i in setup.getInstance().connectionHandlers) {
  10326.                     setup.getInstance().connectionHandlers[i].onReconnectSucceeded(i);
  10327.                   }
  10328.                 };
  10329.                 /**
  10330.                  * @return {undefined}
  10331.                  */
  10332.                 self.onOpen = function() {
  10333.                   if (t) {
  10334.                     console.log("reconnectWS onOpen");
  10335.                   }
  10336.                   /** @type {number} */
  10337.                   setup.getInstance().loginTimer = setTimeout(function() {
  10338.                     if (t) {
  10339.                       console.log("reconnectWS loginTimer timedout");
  10340.                     }
  10341.                     /** @type {null} */
  10342.                     setup.getInstance().loginTimer = null;
  10343.                     start(e, true);
  10344.                   }, 1e4);
  10345.                   /** @type {null} */
  10346.                   setup.getInstance().onLoginTimerCancel = null;
  10347.                 };
  10348.                 /**
  10349.                  * @param {?} url
  10350.                  * @return {undefined}
  10351.                  */
  10352.                 self.onMessage = function(url) {
  10353.                   run(url);
  10354.                 };
  10355.                 /**
  10356.                  * @return {undefined}
  10357.                  */
  10358.                 self.onError = function() {
  10359.                   if (t) {
  10360.                     console.log("reconnectWS onError");
  10361.                   }
  10362.                   start(e, true);
  10363.                 };
  10364.                 /**
  10365.                  * @return {undefined}
  10366.                  */
  10367.                 self.onClose = function() {
  10368.                   if (t) {
  10369.                     console.log("reconnectWS onClose");
  10370.                   }
  10371.                 };
  10372.                 var contentSig = setup.getInstance().getCurrentApiHost();
  10373.                 exports.getInstance().checkRouting(function(self, canCreateDiscussions) {
  10374.                   if (canCreateDiscussions) {
  10375.                     start(e, true);
  10376.                   } else {
  10377.                     if (contentSig !== self.API_HOST) {
  10378.                       get(self.API_HOST, {}, "GET", {}, function() {
  10379.                       });
  10380.                     }
  10381.                     setup.getInstance().wsClient.connect(e, null, self.WS_HOST);
  10382.                   }
  10383.                 });
  10384.               }, ms);
  10385.             }
  10386.           };
  10387.           /**
  10388.            * @param {!Object} e
  10389.            * @param {!Object} type
  10390.            * @return {undefined}
  10391.            */
  10392.           var connect = function(e, type) {
  10393.             var self = new Client.WSClientHandler;
  10394.             setup.getInstance().wsClient = new Client(self);
  10395.             /**
  10396.              * @param {?} url
  10397.              * @return {undefined}
  10398.              */
  10399.             self.onMessage = function(url) {
  10400.               run(url);
  10401.             };
  10402.             /**
  10403.              * @param {?} status
  10404.              * @param {?} headers
  10405.              * @return {undefined}
  10406.              */
  10407.             setup.getInstance().loginHandler = function(status, headers) {
  10408.               if (headers) {
  10409.                 setup.getInstance().disconnect(null);
  10410.                 setup.getInstance().connectionCallback.forEach(function(productInfo) {
  10411.                   callback(null, headers, productInfo);
  10412.                 });
  10413.                 /** @type {!Array} */
  10414.                 setup.getInstance().connectionCallback = [];
  10415.               } else {
  10416.                 clearTimeout(setup.getInstance().globalTimer);
  10417.                 /**
  10418.                  * @return {undefined}
  10419.                  */
  10420.                 var login = function() {
  10421.                   if (link.cachedChannels) {
  10422.                     var key;
  10423.                     for (key in link.cachedChannels) {
  10424.                       var val = link.cachedChannels[key];
  10425.                       if (val.invalidateTypingStatus()) {
  10426.                         var type;
  10427.                         for (type in setup.getInstance().channelHandlers) {
  10428.                           var tag = setup.getInstance().channelHandlers[type];
  10429.                           tag.onTypingStatusUpdated(val);
  10430.                         }
  10431.                       }
  10432.                     }
  10433.                   }
  10434.                   /** @type {number} */
  10435.                   setup.getInstance().globalTimer = setTimeout(function() {
  10436.                     login();
  10437.                   }, 1e3);
  10438.                 };
  10439.                 login();
  10440.                 var pipelets = setup.getInstance().connectionCallback;
  10441.                 /** @type {!Array} */
  10442.                 setup.getInstance().connectionCallback = [];
  10443.                 pipelets.forEach(function(productInfo) {
  10444.                   callback(status, null, productInfo);
  10445.                 });
  10446.                 /** @type {!Array} */
  10447.                 pipelets = [];
  10448.               }
  10449.             };
  10450.             /**
  10451.              * @param {?} p
  10452.              * @return {undefined}
  10453.              */
  10454.             self.onOpen = function(p) {
  10455.               /** @type {number} */
  10456.               setup.getInstance().loginTimer = setTimeout(function() {
  10457.                 /** @type {null} */
  10458.                 setup.getInstance().loginTimer = null;
  10459.                 /** @type {null} */
  10460.                 setup.getInstance().onLoginTimerCancel = null;
  10461.                 setup.getInstance().disconnect(null);
  10462.                 setup.getInstance().connectionCallback.forEach(function(productInfo) {
  10463.                   callback(null, new Date("Connection timeout.", concat.LOGIN_TIMEOUT), productInfo);
  10464.                 });
  10465.                 /** @type {!Array} */
  10466.                 setup.getInstance().connectionCallback = [];
  10467.               }, 1e4);
  10468.               /**
  10469.                * @return {undefined}
  10470.                */
  10471.               setup.getInstance().onLoginTimerCancel = function() {
  10472.                 setup.getInstance().connectionCallback.forEach(function(productInfo) {
  10473.                   callback(null, new Date("Connection Cancelled.", concat.REQUEST_FAILED), productInfo);
  10474.                 });
  10475.                 /** @type {!Array} */
  10476.                 setup.getInstance().connectionCallback = [];
  10477.               };
  10478.             };
  10479.             /**
  10480.              * @param {string} e
  10481.              * @return {undefined}
  10482.              */
  10483.             self.onError = function(e) {
  10484.               if (t) {
  10485.                 console.log("WSClientHandler.onError", e);
  10486.               }
  10487.               if (exports.getInstance().sessionKey) {
  10488.                 start(e, true);
  10489.               } else {
  10490.                 setup.getInstance().connectionCallback.forEach(function(productInfo) {
  10491.                   callback(null, new Date("Websocket connection failed.", concat.WEBSOCKET_CONNECTION_FAILED), productInfo);
  10492.                 });
  10493.                 /** @type {!Array} */
  10494.                 setup.getInstance().connectionCallback = [];
  10495.               }
  10496.             };
  10497.             /**
  10498.              * @param {string} fn
  10499.              * @return {undefined}
  10500.              */
  10501.             self.onClose = function(fn) {
  10502.               if (t) {
  10503.                 console.log("WSClientHandler.onClose");
  10504.               }
  10505.             };
  10506.             exports.getInstance().checkRouting(function(self, s) {
  10507.               if (s) {
  10508.                 return setup.getInstance().connectionCallback.forEach(function(productInfo) {
  10509.                   callback(null, new Date("Connection routing failed.", concat.REQUEST_FAILED), productInfo);
  10510.                 }), void(setup.getInstance().connectionCallback = []);
  10511.               }
  10512.               get(self.API_HOST, {}, "GET", {}, function() {
  10513.               });
  10514.               setup.getInstance().wsClient.connect(e, type, self.WS_HOST);
  10515.             });
  10516.           };
  10517.           /**
  10518.            * @param {!Object} command
  10519.            * @param {!Function} callback
  10520.            * @return {undefined}
  10521.            */
  10522.           this.sendCommand = function(command, callback) {
  10523.             if (setup.getInstance().hasLoggedIn()) {
  10524.               if (null != setup.getInstance().wsClient && setup.getInstance().wsClient.getConnectionState() === setup.getInstance().connectionState.OPEN) {
  10525.                 if (command.isAckRequired()) {
  10526.                   var id = command.requestId;
  10527.                   var data = {
  10528.                     handler : callback,
  10529.                     timer : setTimeout(function() {
  10530.                       callback(null, new Date("Command received no ack.", concat.ACK_TIMEOUT));
  10531.                       delete transforms[id];
  10532.                     }, 1e4)
  10533.                   };
  10534.                   transforms[id] = data;
  10535.                   setup.getInstance().wsClient.send(command, function(canCreateDiscussions, exisObj) {
  10536.                     if (exisObj) {
  10537.                       return clearTimeout(data.timer), void callback(null, exisObj);
  10538.                     }
  10539.                   });
  10540.                 } else {
  10541.                   setup.getInstance().wsClient.send(command, callback);
  10542.                 }
  10543.               } else {
  10544.                 if (callback) {
  10545.                   callback(null, new Date("Connection is not valid. Please reconnect.", concat.WEBSOCKET_CONNECTION_CLOSED));
  10546.                 }
  10547.               }
  10548.             } else {
  10549.               if (callback) {
  10550.                 callback(null, new Date("Connection should be made first.", concat.CONNECTION_REQUIRED));
  10551.               }
  10552.             }
  10553.           };
  10554.           /**
  10555.            * @param {string} width
  10556.            * @return {undefined}
  10557.            */
  10558.           this.markAsReadAll = function(width) {
  10559.             /** @type {number} */
  10560.             var idx_last = (new Date).getTime();
  10561.             if (idx_last - link.markAsReadAllLastSentAt < 1e3) {
  10562.               callback(null, new Date("MarkAsRead rate limit exceeded.", concat.MARK_AS_READ_RATE_LIMIT_EXCEEDED), width);
  10563.             } else {
  10564.               /** @type {number} */
  10565.               link.markAsReadAllLastSentAt = idx_last;
  10566.               exports.getInstance().groupChannelMarkAsReadAll(setup.getInstance().getCurrentUserId(), null, function(n, exisObj) {
  10567.                 if (exisObj) {
  10568.                   callback(null, exisObj, width);
  10569.                 } else {
  10570.                   var key;
  10571.                   for (key in link.cachedChannels) {
  10572.                     log(link.cachedChannels[key], 0, 0);
  10573.                   }
  10574.                   callback(null, null, width);
  10575.                 }
  10576.               });
  10577.             }
  10578.           };
  10579.           /**
  10580.            * @param {!Object} data
  10581.            * @param {string} productInfo
  10582.            * @return {undefined}
  10583.            */
  10584.           this.markAsReadWithChannelUrls = function(data, productInfo) {
  10585.             if (Array.isArray(data)) {
  10586.               /** @type {number} */
  10587.               var idx_last = (new Date).getTime();
  10588.               if (idx_last - link.markAsReadAllLastSentAt < 1e3) {
  10589.                 callback(null, new Date("MarkAsRead rate limit exceeded.", concat.MARK_AS_READ_RATE_LIMIT_EXCEEDED), productInfo);
  10590.               } else {
  10591.                 /** @type {number} */
  10592.                 link.markAsReadAllLastSentAt = idx_last;
  10593.                 exports.getInstance().groupChannelMarkAsReadAll(setup.getInstance().getCurrentUserId(), data, function(canCreateDiscussions, exisObj) {
  10594.                   if (exisObj) {
  10595.                     callback(null, exisObj, productInfo);
  10596.                   } else {
  10597.                     data.forEach(function(key) {
  10598.                       var resource = link.cachedChannels[key];
  10599.                       if (resource) {
  10600.                         log(resource, 0, 0);
  10601.                         link.cachedChannels[key] = resource;
  10602.                       }
  10603.                     });
  10604.                     callback(null, null, productInfo);
  10605.                   }
  10606.                 });
  10607.               }
  10608.             } else {
  10609.               callback(null, new Date("Invalid parameter.", concat.INVALID_PARAMETER), productInfo);
  10610.             }
  10611.           };
  10612.           /**
  10613.            * @param {string} id
  10614.            * @param {!Object} n
  10615.            * @param {string} data
  10616.            * @return {undefined}
  10617.            */
  10618.           this.updateCurrentUserInfoWithProfileImage = function(id, n, data) {
  10619.             var req = this;
  10620.             if (n) {
  10621.               exports.getInstance().updateCurrentUserInfoWithFile(req.getCurrentUserId(), id, n, function(data, exisObj) {
  10622.                 if (exisObj) {
  10623.                   callback(null, exisObj, data);
  10624.                 } else {
  10625.                   if (req.currentUser) {
  10626.                     if (id) {
  10627.                       /** @type {string} */
  10628.                       req.currentUser.nickname = id;
  10629.                     }
  10630.                     if (n) {
  10631.                       req.currentUser.profileUrl = data.profile_url;
  10632.                     }
  10633.                   }
  10634.                   callback(req.currentUser, null, data);
  10635.                 }
  10636.               });
  10637.             } else {
  10638.               req.updateCurrentUserInfo(id, null, data);
  10639.             }
  10640.           };
  10641.           /**
  10642.            * @param {string} username
  10643.            * @param {string} info
  10644.            * @param {string} state
  10645.            * @return {undefined}
  10646.            */
  10647.           this.updateCurrentUserInfo = function(username, info, state) {
  10648.             var req = this;
  10649.             exports.getInstance().updateUserInfo(req.getCurrentUserId(), username, info, function(canCreateDiscussions, exisObj) {
  10650.               if (exisObj) {
  10651.                 callback(null, exisObj, state);
  10652.               } else {
  10653.                 if (req.currentUser) {
  10654.                   if (username) {
  10655.                     /** @type {string} */
  10656.                     req.currentUser.nickname = username;
  10657.                   }
  10658.                   if (info) {
  10659.                     /** @type {string} */
  10660.                     req.currentUser.profileUrl = info;
  10661.                   }
  10662.                 }
  10663.                 callback(req.currentUser, null, state);
  10664.               }
  10665.             });
  10666.           };
  10667.           /**
  10668.            * @return {?}
  10669.            */
  10670.           this.getPendingGCMToken = function() {
  10671.             return this.GCMPushToken;
  10672.           };
  10673.           /**
  10674.            * @return {?}
  10675.            */
  10676.           this.getPendingAPNSToken = function() {
  10677.             return this.APNSPushToken;
  10678.           };
  10679.           /**
  10680.            * @param {string} data
  10681.            * @param {string} productInfo
  10682.            * @return {?}
  10683.            */
  10684.           this.registerGCMPushTokenForCurrentUser = function(data, productInfo) {
  10685.             var res = this;
  10686.             return data ? this.currentUser ? void exports.getInstance().registerGCMPushToken(this.getCurrentUserId(), data, function(canCreateDiscussions, exisObj) {
  10687.               if (exisObj) {
  10688.                 callback(res.pushTokenRegistrationState.ERROR, exisObj, productInfo);
  10689.               } else {
  10690.                 /** @type {string} */
  10691.                 res.GCMPushToken = "";
  10692.                 callback(res.pushTokenRegistrationState.SUCCESS, null, productInfo);
  10693.               }
  10694.             }) : (res.GCMPushToken = data, void callback(res.pushTokenRegistrationState.PENDING, null, productInfo)) : void callback(res.pushTokenRegistrationState.ERROR, new Date("Invalid token", concat.INVALID_PARAMETER), productInfo);
  10695.           };
  10696.           /**
  10697.            * @param {?} data
  10698.            * @param {string} productInfo
  10699.            * @return {undefined}
  10700.            */
  10701.           this.unregisterGCMPushTokenForCurrentUser = function(data, productInfo) {
  10702.             if (data) {
  10703.               exports.getInstance().unregisterGCMPushToken(this.getCurrentUserId(), data, function(canCreateDiscussions, endNow) {
  10704.                 callback(null, endNow || null, productInfo);
  10705.               });
  10706.             } else {
  10707.               callback(null, new Date("Invalid token", concat.INVALID_PARAMETER), productInfo);
  10708.             }
  10709.           };
  10710.           /**
  10711.            * @param {string} productInfo
  10712.            * @return {undefined}
  10713.            */
  10714.           this.unregisterGCMPushTokenAllForCurrentUser = function(productInfo) {
  10715.             exports.getInstance().unregisterGCMPushTokenAll(this.getCurrentUserId(), function(n, endNow) {
  10716.               callback(null, endNow || null, productInfo);
  10717.             });
  10718.           };
  10719.           /**
  10720.            * @param {!Function} data
  10721.            * @param {string} productInfo
  10722.            * @return {?}
  10723.            */
  10724.           this.registerAPNSPushTokenForCurrentUser = function(data, productInfo) {
  10725.             var res = this;
  10726.             return data ? this.currentUser ? void exports.getInstance().registerAPNSPushToken(this.getCurrentUserId(), data, function(canCreateDiscussions, exisObj) {
  10727.               if (exisObj) {
  10728.                 callback(res.pushTokenRegistrationState.ERROR, exisObj, productInfo);
  10729.               } else {
  10730.                 /** @type {string} */
  10731.                 res.APNSPushToken = "";
  10732.                 callback(res.pushTokenRegistrationState.SUCCESS, null, productInfo);
  10733.               }
  10734.             }) : (res.APNSPushToken = data, void callback(res.pushTokenRegistrationState.PENDING, null, productInfo)) : void callback(res.pushTokenRegistrationState.ERROR, new Date("Invalid token", concat.INVALID_PARAMETER), productInfo);
  10735.           };
  10736.           /**
  10737.            * @param {?} data
  10738.            * @param {string} productInfo
  10739.            * @return {undefined}
  10740.            */
  10741.           this.unregisterAPNSPushTokenForCurrentUser = function(data, productInfo) {
  10742.             if (data) {
  10743.               exports.getInstance().unregisterAPNSPushToken(this.getCurrentUserId(), data, function(canCreateDiscussions, endNow) {
  10744.                 callback(null, endNow || null, productInfo);
  10745.               });
  10746.             } else {
  10747.               callback(null, new Date("Invalid token", concat.INVALID_PARAMETER), productInfo);
  10748.             }
  10749.           };
  10750.           /**
  10751.            * @param {string} productInfo
  10752.            * @return {undefined}
  10753.            */
  10754.           this.unregisterAPNSPushTokenAllForCurrentUser = function(productInfo) {
  10755.             exports.getInstance().unregisterAPNSPushTokenAll(this.getCurrentUserId(), function(n, endNow) {
  10756.               callback(null, endNow || null, productInfo);
  10757.             });
  10758.           };
  10759.           /**
  10760.            * @param {string} productInfo
  10761.            * @return {undefined}
  10762.            */
  10763.           this.unregisterPushTokenAllForCurrentUser = function(productInfo) {
  10764.             exports.getInstance().unregisterPushTokenAll(this.getCurrentUserId(), function(n, endNow) {
  10765.               callback(null, endNow || null, productInfo);
  10766.             });
  10767.           };
  10768.           /**
  10769.            * @param {undefined} n2
  10770.            * @param {number} t
  10771.            * @param {number} f
  10772.            * @param {number} m
  10773.            * @param {number} v
  10774.            * @param {string} s
  10775.            * @param {string} k
  10776.            * @return {undefined}
  10777.            */
  10778.           this.setDoNotDisturb = function(n2, t, f, m, v, s, k) {
  10779.             if (t < 0 || t > 23 || f < 0 || f > 59 || m < 0 || m > 23 || v < 0 || v > 59) {
  10780.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), k);
  10781.             } else {
  10782.               exports.getInstance().setDoNotDisturb(this.getCurrentUserId(), n2, t, f, m, v, s, function(e, n) {
  10783.                 if (n) {
  10784.                   callback(null, n, k);
  10785.                 } else {
  10786.                   var data = {
  10787.                     doNotDisturbOn : e.do_not_disturb,
  10788.                     startHour : e.start_hour,
  10789.                     startMin : e.start_min,
  10790.                     endHour : e.end_hour,
  10791.                     endMin : e.end_min,
  10792.                     timezone : e.timezone
  10793.                   };
  10794.                   callback(data, null, k);
  10795.                 }
  10796.               });
  10797.             }
  10798.           };
  10799.           /**
  10800.            * @param {string} productInfo
  10801.            * @return {undefined}
  10802.            */
  10803.           this.getDoNotDisturb = function(productInfo) {
  10804.             exports.getInstance().getDoNotDisturb(this.getCurrentUserId(), function(e, exisObj) {
  10805.               if (exisObj) {
  10806.                 callback(null, exisObj, productInfo);
  10807.               } else {
  10808.                 var data = {
  10809.                   doNotDisturbOn : e.do_not_disturb,
  10810.                   startHour : e.start_hour,
  10811.                   startMin : e.start_min,
  10812.                   endHour : e.end_hour,
  10813.                   endMin : e.end_min,
  10814.                   timezone : e.timezone
  10815.                 };
  10816.                 callback(data, null, productInfo);
  10817.               }
  10818.             });
  10819.           };
  10820.           /**
  10821.            * @param {!Object} data
  10822.            * @param {!Function} user
  10823.            * @return {undefined}
  10824.            */
  10825.           this.blockUser = function(data, user) {
  10826.             if ("object" == typeof data) {
  10827.               this.blockUserWithUserId(data.userId, user);
  10828.             } else {
  10829.               callback(null, new Date("You have to pass user object.", concat.INVALID_PARAMETER), user);
  10830.             }
  10831.           };
  10832.           /**
  10833.            * @param {?} user_id
  10834.            * @param {string} destination
  10835.            * @return {undefined}
  10836.            */
  10837.           this.blockUserWithUserId = function(user_id, destination) {
  10838.             if (this.getCurrentUserId() !== user_id) {
  10839.               exports.getInstance().blockUser(this.getCurrentUserId(), user_id, function(enlivenedObjects, exisObj) {
  10840.                 if (exisObj) {
  10841.                   callback(null, exisObj, destination);
  10842.                 } else {
  10843.                   callback(new client(enlivenedObjects), null, destination);
  10844.                 }
  10845.               });
  10846.             } else {
  10847.               callback(null, new Date("You can not block yourself.", concat.INVALID_PARAMETER), destination);
  10848.             }
  10849.           };
  10850.           /**
  10851.            * @param {!Object} options
  10852.            * @param {!Function} arg
  10853.            * @return {undefined}
  10854.            */
  10855.           this.unblockUser = function(options, arg) {
  10856.             if ("object" == typeof options) {
  10857.               this.unblockUserWithUserId(options.userId, arg);
  10858.             } else {
  10859.               callback(null, new Date("You have to pass user object.", concat.INVALID_PARAMETER), arg);
  10860.             }
  10861.           };
  10862.           /**
  10863.            * @param {?} d
  10864.            * @param {string} idx
  10865.            * @return {undefined}
  10866.            */
  10867.           this.unblockUserWithUserId = function(d, idx) {
  10868.             if (this.getCurrentUserId() !== d) {
  10869.               exports.getInstance().unblockUser(this.getCurrentUserId(), d, function(canCreateDiscussions, endNow) {
  10870.                 callback(null, endNow || null, idx);
  10871.               });
  10872.             } else {
  10873.               callback(null, new Date("You can not unblock yourself.", concat.INVALID_PARAMETER), idx);
  10874.             }
  10875.           };
  10876.           /**
  10877.            * @param {string} event
  10878.            * @param {string} source
  10879.            * @return {undefined}
  10880.            */
  10881.           this.addFriends = function(event, source) {
  10882.             if (Array.isArray(event)) {
  10883.               exports.getInstance().addFriends(this.getCurrentUserId(), event, function(contributor, exisObj) {
  10884.                 if (exisObj) {
  10885.                   callback(null, exisObj, source);
  10886.                 } else {
  10887.                   var identifierPositions = contributor.users.map(function(options) {
  10888.                     return new client(options);
  10889.                   });
  10890.                   callback(identifierPositions, null, source);
  10891.                 }
  10892.               });
  10893.             } else {
  10894.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), source);
  10895.             }
  10896.           };
  10897.           /**
  10898.            * @param {?} val
  10899.            * @param {boolean} k
  10900.            * @return {undefined}
  10901.            */
  10902.           this.deleteFriends = function(val, k) {
  10903.             if (Array.isArray(val)) {
  10904.               exports.getInstance().deleteFriends(this.getCurrentUserId(), val, function(identifierPositions, exisObj) {
  10905.                 if (exisObj) {
  10906.                   callback(null, exisObj, k);
  10907.                 } else {
  10908.                   callback(identifierPositions, null, k);
  10909.                 }
  10910.               });
  10911.             } else {
  10912.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), k);
  10913.             }
  10914.           };
  10915.           /**
  10916.            * @param {?} callback
  10917.            * @param {undefined} id
  10918.            * @return {undefined}
  10919.            */
  10920.           this.deleteFriend = function(callback, id) {
  10921.             if ("string" == typeof callback) {
  10922.               this.deleteFriends([callback], id);
  10923.             } else {
  10924.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), id);
  10925.             }
  10926.           };
  10927.           /**
  10928.            * @param {undefined} p
  10929.            * @param {string} width
  10930.            * @return {undefined}
  10931.            */
  10932.           this.uploadFriendDiscoveries = function(p, width) {
  10933.             /** @type {boolean} */
  10934.             var t = true;
  10935.             var i;
  10936.             for (i in p) {
  10937.               if (!p[i].hasOwnProperty("friendDiscoveryKey")) {
  10938.                 /** @type {boolean} */
  10939.                 t = false;
  10940.                 callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), width);
  10941.                 break;
  10942.               }
  10943.             }
  10944.             if (t) {
  10945.               exports.getInstance().uploadFriendDiscoveries(this.getCurrentUserId(), p, function(identifierPositions, exisObj) {
  10946.                 if (exisObj) {
  10947.                   callback(null, exisObj, width);
  10948.                 } else {
  10949.                   callback(identifierPositions, null, width);
  10950.                 }
  10951.               });
  10952.             }
  10953.           };
  10954.           /**
  10955.            * @param {?} fp
  10956.            * @param {boolean} str
  10957.            * @return {undefined}
  10958.            */
  10959.           this.deleteFriendDiscoveries = function(fp, str) {
  10960.             if (Array.isArray(fp)) {
  10961.               exports.getInstance().deleteFriendDiscoveries(this.getCurrentUserId(), fp, function(identifierPositions, exisObj) {
  10962.                 if (exisObj) {
  10963.                   callback(null, exisObj, str);
  10964.                 } else {
  10965.                   callback(identifierPositions, null, str);
  10966.                 }
  10967.               });
  10968.             } else {
  10969.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), str);
  10970.             }
  10971.           };
  10972.           /**
  10973.            * @param {?} q
  10974.            * @param {undefined} hash
  10975.            * @return {undefined}
  10976.            */
  10977.           this.deleteFriendDiscovery = function(q, hash) {
  10978.             if ("string" == typeof q) {
  10979.               this.deleteFriendDiscoveries([q], hash);
  10980.             } else {
  10981.               callback(null, new Date("Invalid arguments.", concat.INVALID_PARAMETER), hash);
  10982.             }
  10983.           };
  10984.           /**
  10985.            * @param {string} p
  10986.            * @param {string} c
  10987.            * @return {?}
  10988.            */
  10989.           this.getFriendChangeLogsByToken = function(p, c) {
  10990.             if ("function" == typeof p && (c = p, p = null), "function" != typeof c) {
  10991.               return null;
  10992.             }
  10993.             exports.getInstance().getFriendChangeLogsByToken(this.getCurrentUserId(), p, function(result, exisObj) {
  10994.               if (exisObj) {
  10995.                 callback(null, exisObj, c);
  10996.               } else {
  10997.                 var s = result.updated.map(function($scope) {
  10998.                   return new client(client.build($scope.user_id, $scope.nickname, $scope.profile_url, $scope.is_online, $scope.last_seen_at, $scope.metadata, $scope.is_active, $scope.friend_discovery_key, $scope.friend_name));
  10999.                 });
  11000.                 var deleted = result.deleted;
  11001.                 var courseSections = result.has_more;
  11002.                 var token = result.next;
  11003.                 callback({
  11004.                   updatedUsers : s,
  11005.                   deletedUserIds : deleted,
  11006.                   hasMore : courseSections,
  11007.                   token : token
  11008.                 }, null, c);
  11009.               }
  11010.             });
  11011.           };
  11012.           /**
  11013.            * @return {?}
  11014.            */
  11015.           this.createFriendListQuery = function() {
  11016.             return new transform;
  11017.           };
  11018.         };
  11019.         /** @type {null} */
  11020.         var ue = null;
  11021.         return setup.getInstance = function() {
  11022.           return null === ue ? null : ue;
  11023.         }, {
  11024.           SendBird : setup
  11025.         };
  11026.       };
  11027.       /** @type {null} */
  11028.       var self = null;
  11029.       return function() {
  11030.         /**
  11031.          * @param {!Object} options
  11032.          * @return {?}
  11033.          */
  11034.         var Class = function(options) {
  11035.           if (options.newInstance || !self) {
  11036.             var fhirball = new init;
  11037.             self = new fhirball.SendBird(options);
  11038.           } else {
  11039.             if (self && options.appId !== self.getApplicationId() && self.getConnectionState() === self.connectionState.CLOSED) {
  11040.               fhirball = new init;
  11041.               self = new fhirball.SendBird(options);
  11042.             }
  11043.           }
  11044.           return self;
  11045.         };
  11046.         return Class.getInstance = function() {
  11047.           return null === self ? null : self;
  11048.         }, Class.version = "3.0.69", {
  11049.           SendBird : Class
  11050.         };
  11051.       }().SendBird;
  11052.     }();
  11053.   },
  11054.   "./node_modules/websocket/lib/browser.js" : function(module, metadata, packageSuccess) {
  11055.     var global = function() {
  11056.       return this;
  11057.     }();
  11058.     var ariaDomEvent = global.WebSocket || global.MozWebSocket;
  11059.     var ELECTRON_VERSION = packageSuccess("./node_modules/websocket/lib/version.js");
  11060.     module.exports = {
  11061.       w3cwebsocket : ariaDomEvent ? function(event, templatesWrapper) {
  11062.         return templatesWrapper ? new ariaDomEvent(event, templatesWrapper) : new ariaDomEvent(event);
  11063.       } : null,
  11064.       version : ELECTRON_VERSION
  11065.     };
  11066.   },
  11067.   "./node_modules/websocket/lib/version.js" : function(u, name, api) {
  11068.     u.exports = api("./node_modules/websocket/package.json").version;
  11069.   },
  11070.   "./node_modules/websocket/package.json" : function(module) {
  11071.     module.exports = {
  11072.       name : "websocket",
  11073.       description : "Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",
  11074.       keywords : ["websocket", "websockets", "socket", "networking", "comet", "push", "RFC-6455", "realtime", "server", "client"],
  11075.       author : "Brian McKelvey <[email protected]> (https://www.worlize.com/)",
  11076.       contributors : ["I\u00f1aki Baz Castillo <[email protected]> (http://dev.sipdoc.net)"],
  11077.       version : "1.0.24",
  11078.       repository : {
  11079.         type : "git",
  11080.         url : "https://github.com/theturtle32/WebSocket-Node.git"
  11081.       },
  11082.       homepage : "https://github.com/theturtle32/WebSocket-Node",
  11083.       engines : {
  11084.         node : ">=0.8.0"
  11085.       },
  11086.       dependencies : {
  11087.         debug : "^2.2.0",
  11088.         nan : "^2.3.3",
  11089.         "typedarray-to-buffer" : "^3.1.2",
  11090.         yaeti : "^0.0.6"
  11091.       },
  11092.       devDependencies : {
  11093.         "buffer-equal" : "^1.0.0",
  11094.         faucet : "^0.0.1",
  11095.         gulp : "git+https://github.com/gulpjs/gulp.git#4.0",
  11096.         "gulp-jshint" : "^2.0.4",
  11097.         "jshint-stylish" : "^2.2.1",
  11098.         jshint : "^2.0.0",
  11099.         tape : "^4.0.1"
  11100.       },
  11101.       config : {
  11102.         verbose : false
  11103.       },
  11104.       scripts : {
  11105.         install : "(node-gyp rebuild 2> builderror.log) || (exit 0)",
  11106.         test : "faucet test/unit",
  11107.         gulp : "gulp"
  11108.       },
  11109.       main : "index",
  11110.       directories : {
  11111.         lib : "./lib"
  11112.       },
  11113.       browser : "lib/browser.js",
  11114.       license : "Apache-2.0"
  11115.     };
  11116.   },
  11117.   "./node_modules/xhr2/lib/browser.js" : function(module, data) {
  11118.     /** @type {function(new:XMLHttpRequest): ?} */
  11119.     module.exports = XMLHttpRequest;
  11120.   }
  11121. }]);
Add Comment
Please, Sign In to add comment