function _array_like_to_array(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]"u"};function P(n,t){if(!n||!t)return;var i=N(n);n=_object_spread({},n);var e=Object.keys(n),s=e.length;for(var r=0;r1?_len-1:0),_key=1;_key<_len;_key++){t[_key-1]=arguments[_key]}return P(t,function(i){B(n,i)}),n},U=function U(n,t){var i=n.length>>>0;if(typeof t!="function")throw new TypeError("predicate must be a function");var e=arguments[1];var s=0;for(;sE.WAIT_FOR_VOLCANO_READY_TIME_LIMIT&&(clearInterval(_this.waitingTimer),_this.waitingTimer=null,_this.waitingForReadyTasks.forEach(function(param){var s=param.onFail;s&&s()}),console.error("unmatched method `window.collectEvent`"))},34)}},{key:"report",value:function report(t){var i=t.params,e=t.key;if(window.$_isAbtestLoad){window.collectEvent(e,i);return}this.registerWiteForReadyTask(function(){window.collectEvent(e,i)})}},{key:"checkDebug",value:function checkDebug(t){return _async_to_generator(function(){var e,s,r,e1,r1,o,l,e2;return _ts_generator(this,function(_state){switch(_state.label){case 0:_state.trys.push([0,3,,4]);if(window.URL&&window.URLSearchParams){e=new URL(window.location.href),s=Array.from(e.searchParams.keys()),r="ab_".concat(t.exp);if(s.includes(r))return[2,(console.log("hit debug: ".concat(r)),console.log("ab config: ",t),e.searchParams.get(r))]}if(!!!document.querySelector("#__cgm_inject"))return[3,2];return[4,new Promise(function(h){var c;var p=setInterval(function(){console.log("[cat] finding cgm context");var u=document.querySelector("#__cgm_context");u&&(clearTimeout(c),clearInterval(p),h(u))},60);c=setTimeout(function(){clearInterval(p),h(null),console.log("[cat] finding cgm context timeout")},6030)})];case 1:e1=_state.sent();if(!e1)return[2,null];r1=JSON.parse(e1.dataset.context||"{}").ab_version_debug||[];o={};r1.forEach(function(h){h.param===t.exp&&(o=h)});l=o.value;if(l)return[2,(console.log("hit debug: ".concat(t.exp),l),console.log("ab config: ",t),l)];_state.label=2;case 2:return[2,null];case 3:e2=_state.sent();return[2,null];case 4:return[2]}})})()}},{key:"ab",value:function ab(t){var i=t.exp,tmp=t.defaultAbValue,e=tmp===void 0?"":tmp,tmp1=t.timeout,s=tmp1===void 0?E.GET_AB_RESULT_TIMEOUT:tmp1,r=t.onTimeout,tmp2=t.autoExposure,o=tmp2===void 0?!0:tmp2,tmp3=t.isHistory,l=tmp3===void 0?!1:tmp3,tmp4=t.userId,h=tmp4===void 0?null:tmp4;var _this=this;return new Promise(function(){var _ref=_async_to_generator(function(c,p){var u,w,b,et;return _ts_generator(this,function(_state){switch(_state.label){case 0:return[4,_this.checkDebug(t)];case 1:u=_state.sent();if(u!==null){c(u);return[2]}if(H()){p({reason:E.AB_REJECT_REASON.NOT_SUPPORT_IE,config:t});return[2]}w=setTimeout(function(){var f={reason:E.AB_REJECT_REASON.WAIT_FOR_RESULT_TIMEOUT,config:t};r&&r(f),p(f)},s),b=function(){window.collectEvent("getVar",i,e,function(f){clearTimeout(w),c(f)})},et=function(){window.getABVersionWithoutExposure(i,function(f){clearTimeout(w),c(f)})};if(window.$_isAbtestLoad){l?window.getHistoryABVersion(i,h,function(f){clearTimeout(w),c(f)}):o?b():et();return[2]}_this.registerWiteForReadyTask(function(){b()},function(){p({reason:E.AB_REJECT_REASON.WAIT_FOR_ENGINE_READY_TIMEOUT,config:t})});return[2]}})});return function(c,p){return _ref.apply(this,arguments)}}())}}]);return E}();y.WAIT_FOR_VOLCANO_READY_TIME_LIMIT=3e3,y.GET_AB_RESULT_TIMEOUT=60*1e3,y.AB_REJECT_REASON={WAIT_FOR_RESULT_TIMEOUT:0,WAIT_FOR_ENGINE_READY_TIMEOUT:1,NOT_SUPPORT_IE:2};var F=y;var a=function(n){return n.LOCAL="local",n.DEV="development",n.EXP="experimental",n.STAGE="staging",n.PROD="production",n}(a||{});var _obj;var W={cli:"https://cliim.net",user:"https://user.cliim.net",biz:"https://biz.cliim.net",nc:"https://nc.cliim.net",socket:"wss://socket-api.cliim.net",proxy:"https://proxy.cli.im",analysis:"https://analysis-api.cliim.net",log:"https://log-api.cliim.net",tongji:"https://tongji.cliim.net",upload:"https://upload-api.cliim.net",goSocket:"wss://go-socket-api.cliim.net",goSocketHttp:"https://go-socket-api.cliim.net",df:"https://datafinder-api.cliim.net",volcano:"https://volcengine-api.cliim.net",console:"https://console.cliim.net",feLib:"https://gstatic-dev.clewm.net/dev",wxApi:"https://wechat.cli.im/wx-api-net"},q={cli:"https://cliim.net",user:"https://user.cliim.net",biz:"https://biz.cliim.net",nc:"https://nc.cliim.net",socket:"wss://socket-api.cliim.net",proxy:"https://proxy.cli.im",analysis:"https://analysis-api.cliim.net",log:"https://log-api.cliim.net",tongji:"https://tongji.cliim.net",upload:"https://upload-api.cliim.net",goSocket:"wss://go-socket-api.cliim.net",goSocketHttp:"https://go-socket-api.cliim.net",df:"https://datafinder-api.cliim.net",volcano:"https://volcengine-api.cliim.net",console:"https://console.cliim.net",feLib:"https://gstatic-dev.clewm.net/dev",wxApi:"https://wechat.cli.im/wx-api-net"},j={cli:"https://exp.cliim.net",user:"https://exp-user.cliim.net",biz:"https://exp-biz.cliim.net",nc:"https://exp-nc.cliim.net",socket:"wss://socket-api.cliim.net",proxy:"https://proxy.cli.im",analysis:"https://analysis-api.cliim.net",log:"https://log-api.cliim.net",tongji:"https://tongji.cliim.net",upload:"https://upload-api.cliim.net",goSocket:"wss://go-socket-api.cliim.net",goSocketHttp:"https://go-socket-api.cliim.net",df:"https://datafinder-api.cliim.net",volcano:"https://volcengine-api.cliim.net",console:"https://exp-console.cliim.net",feLib:"https://gstatic-dev.clewm.net/exp",wxApi:"https://wechat.cli.im/wx-api-net"},J={cli:"https://cliim.com",user:"https://user.cliim.com",biz:"https://biz.cliim.com",nc:"https://nc.cliim.com",socket:"wss://socket-api.cliim.com",proxy:"https://proxy.cli.im",analysis:"https://analysis-api.cliim.com",log:"https://log-api.cliim.com",tongji:"https://tongji.cliim.com",upload:"https://upload-api.cliim.com",goSocket:"wss://go-socket-api.cliim.com",goSocketHttp:"https://go-socket-api.cliim.com",df:"https://datafinder-api.cliim.net",volcano:"https://volcengine-api.cliim.net",console:"https://console.cliim.com",feLib:"https://gstatic-dev.clewm.net/com",wxApi:"https://wechat.cli.im/wx-api-com"},$={cli:"https://cli.im",user:"https://user.cli.im",biz:"https://biz.cli.im",nc:"https://nc.cli.im",socket:"wss://socket.api.cli.im",proxy:"https://proxy.cli.im",analysis:"https://analysis-api.cli.im",log:"https://log-api.cli.im",tongji:"https://tongji.cli.im",upload:"https://upload-api.cli.im",goSocket:"wss://go-socket-api.cli.im",goSocketHttp:"https://go-socket-api.cli.im",df:"https://datafinder-api.cli.im",volcano:"https://volcengine.api.cli.im",console:"https://console.cli.im",feLib:"https://gstatic.clewm.net",wxApi:"https://wx.api.cli.im"},S=(_obj={},_define_property(_obj,a.LOCAL,W),_define_property(_obj,a.DEV,q),_define_property(_obj,a.EXP,j),_define_property(_obj,a.STAGE,J),_define_property(_obj,a.PROD,$),_obj),z={"em.ilc":a.LOCAL,tsohlacol:a.LOCAL,"ten.miilc":a.DEV,"moc.miilc":a.STAGE,"mi.miilc":a.PROD},X={"static.cli.me":a.LOCAL,"exp-static-develop.clewm.net":a.EXP,"static-develop.clewm.net":a.DEV,"static-test.clewm.net":a.STAGE,"static.clewm.net":a.PROD,"preview-static.clewm.net":a.PROD,"gstatic-dev.clewm.net":a.DEV,"gstatic.clewm.net":a.PROD},Y=function(n){if(n==="127.0.0.1"||n==="0.0.0.0")return!0;var t=/^(10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3})$/igm;return n=n.split(":")[0],t.test(n)},K=function(n){return n.replace("http://","").replace("https://","")},I=function(n){if(!n)try{n=window.location.hostname}catch(e){n=""}if(!n)return a.PROD;if(n=K(n),n.indexOf("exp.")===0||n.indexOf("exp-")===0)return a.EXP;if(Y(n))return a.LOCAL;var t=n.split(".").reverse().splice(0,2).reverse().join(".").split("").reverse().join("");return z[t]||X[n]||a.PROD};var d=function(){function d(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_class_call_check(this,d);var _t_env;this.env=I(),this.env=(_t_env=t.env)!==null&&_t_env!==void 0?_t_env:I()}_create_class(d,[{key:"domain",get:function get(){return S[this.env]}},{key:"setEnv",value:function setEnv(t){this.env=t}}]);return d}();d.Domain=S,d.Env=a;var A=function(){function M(){_class_call_check(this,M);this.queue=[]}_create_class(M,[{key:"add",value:function add(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var e=Date.now();i.cAt=e,i.name=t;var s=this.queue[this.queue.length-1],r=this.queue[0];return i.offset=e-(s?s.cAt:e),i.offsetFromStart=e-(r?r.cAt:e),this.queue.push(i),this}},{key:"clean",value:function clean(){return this.queue=[],this}},{key:"reportData",get:function get(){return this.queue}}],[{key:"getPageInstance",value:function getPageInstance(){return M.pageInstance}}]);return M}();A.pageInstance=new A;var D=A;window.__RateReport=D;var _obj1;var L=new d,Q=(_obj1={},_define_property(_obj1,d.Env.PROD,"380606"),_define_property(_obj1,d.Env.STAGE,"380606"),_define_property(_obj1,d.Env.DEV,"354720"),_define_property(_obj1,d.Env.LOCAL,"354720"),_define_property(_obj1,d.Env.EXP,"354720"),_obj1),k=function(n){var t,i=new RegExp("(^| )"+n+"=([^;]*)(;|$)");return(t=document.cookie.match(i))?unescape(t[2]):""},Z=function(n){var t=L.domain.df+"/v1/events/report",i="POST",e=new XMLHttpRequest;e.open(i,t,!0),e.setRequestHeader("Content-Type","application/json"),e.send(JSON.stringify([n])),e.onerror=function(){}};var v=function(){function v(){_class_call_check(this,v);this.baseHeader={},this.queue=[],this.source="WEB_APP",this.user={user_unique_id:-1,web_id:""},this.reportTimer=null,this.setBootParams()}_create_class(v,[{key:"setBootParams",value:function setBootParams(){var t=navigator.language,i=navigator.userAgent;this.baseHeader={strict:0,language:t,screen_width:window.screen.width,screen_height:window.screen.height,platform:"WEB",host:window.location.host,custom:{ua:i}}}},{key:"getBaseParams",value:function getBaseParams(){return{user:this.user,header:this.baseHeader}}},{key:"report",value:function report(t){var _this=this;this.queue.push({event:t.key,params:JSON.stringify(t.params),local_time_ms:Date.now(),session_id:""}),clearTimeout(this.reportTimer),setTimeout(_async_to_generator(function(){var s,r,o,_tmp,_,i,e,_ref;return _ts_generator(this,function(_state){switch(_state.label){case 0:_tmp=_this.user.web_id;if(_tmp)return[3,2];_=_this.user;return[4,_this.takeWebId()];case 1:_tmp=_.web_id=_state.sent();_state.label=2;case 2:_tmp;i=JSON.parse(JSON.stringify(_this.getBaseParams())),e=_object_spread({local_time:Date.now(),source:_this.source,events:JSON.parse(JSON.stringify(_this.queue))},i);_this.queue=[],e.header.custom.url=window.location.href,e.header.custom.cvid=k("cvid")||"",e.header.custom.ssid=k("PHPSESSID")||"",window.__userInfo&&(e.header.custom.user_id=(_ref=(o=(r=(s=window.__userInfo)==null?void 0:s.data)==null?void 0:r.user_info)==null?void 0:o.user_id)!==null&&_ref!==void 0?_ref:""),e.header.custom=JSON.stringify(e.header.custom),!(e.events.length<1)&&Z(e);return[2]}})}),300)}},{key:"setSource",value:function setSource(t){this.source=t}},{key:"setUser",value:function setUser(t){this.user=_object_spread({},this.user,t)}},{key:"abHitTest",value:function abHitTest(t,i){return!1}},{key:"ab",value:function ab(){return""}},{key:"takeWebId",value:function takeWebId(){if(!window.collectEvent)return Promise.resolve("");var t="__tea_cache_tokens_".concat(Q[L.env]),i=function(){try{return JSON.parse(k(t)).web_id}catch(e){return""}}();return i?Promise.resolve(i):new Promise(function(e){window.collectEvent("getToken",function(s){return e(s.web_id)})})}}]);return v}();v.RateReport=D;var tt={Volcano:F,DataFinderForBrowserEngine:v};var T=function(){function T(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_class_call_check(this,T);var _t_Plugins;this.config=t,this.beforeEachCallback=[],this.afterEachCallback=[],this.delayReport=[],this.untilReport=[],this.matchBeforeMap={},this.matchAfterMap={},t.engine&&this.useEngine(t.engine),this.registerPlugin((_t_Plugins=t.Plugins)!==null&&_t_Plugins!==void 0?_t_Plugins:[])}_create_class(T,[{key:"useEngine",value:function useEngine(t){this.engine=t}},{key:"match",value:function match(t){var _this=this;return{beforeReport:function(i){return _this.matchBeforeMap[t]=i,_this},afterReport:function(i){return _this.matchAfterMap[t]=i,_this}}}},{key:"abHitValue",value:function abHitValue(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.engine.ab(_object_spread({exp:t,matchers:{},type:"AB_HIT_VALUE"},i))}},{key:"abHitTest",value:function abHitTest(t,i){if(V(i)&&(i=[i]),this.engine.abHitTest)return this.engine.abHitTest(t,i);var e=this.abHitValue(t);return R(e)?new Promise(function(){var _ref=_async_to_generator(function(s,r){var _$o,o;return _ts_generator(this,function(_state){switch(_state.label){case 0:_state.trys.push([0,2,,3]);return[4,e];case 1:_$o=_state.sent();s(i.indexOf(_$o)>-1);return[3,3];case 2:o=_state.sent();r(o);return[3,3];case 3:return[2]}})});return function(s,r){return _ref.apply(this,arguments)}}()):i.indexOf(e)>-1}},{key:"ab",value:function ab(t,i,e){var s=t;O(t)||(s={exp:t,matchers:_define_property({},i,e),type:"MATCH_AB"});var r=this.engine.ab(s),o=_object_spread({match:!1},s);if(R(r))return new Promise(function(){var _ref=_async_to_generator(function(c,p){var _$u,w,b,u;return _ts_generator(this,function(_state){switch(_state.label){case 0:_state.trys.push([0,2,,3]);return[4,r];case 1:_$u=_state.sent();s.onGotAbResult&&s.onGotAbResult(_$u,s);w=s.matchers[_$u];if(x(w)){s.onNoMatcher&&s.onNoMatcher(o),c(o);return[2]}o.match=!0;b=w(o);s.afterRunMatcher&&s.afterRunMatcher(o),c(b);return[3,3];case 2:u=_state.sent();p(u);return[3,3];case 3:return[2]}})});return function(c,p){return _ref.apply(this,arguments)}}());s.onGotAbResult&&s.onGotAbResult(r,s);var l=s.matchers[r];if(x(l))return s.onNoMatcher&&s.onNoMatcher(o),o;o.match=!0;var h=l(s);return s.afterRunMatcher&&s.afterRunMatcher(o),h}},{key:"abDispatchReturnValueGenerator",value:function abDispatchReturnValueGenerator(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var e=this;return{hit:function hit(s){return{do:function _do(r){return s===t&&(i=!0,r&&r(t)),e.abDispatchReturnValueGenerator(t,i)}}},noMatch:function noMatch(s){return i||s&&s(t),e.abDispatchReturnValueGenerator(t,i)},finally:function _finally(s){return s&&s(t),e.abDispatchReturnValueGenerator(t,i)}}}},{key:"abDispatch",value:function abDispatch(t){var i=this.abHitValue(t);var _this=this;return R(i)?new Promise(function(){var _ref=_async_to_generator(function(e,s){var _$r,r;return _ts_generator(this,function(_state){switch(_state.label){case 0:_state.trys.push([0,2,,3]);return[4,i];case 1:_$r=_state.sent();e(_this.abDispatchReturnValueGenerator(_$r));return[3,3];case 2:r=_state.sent();s(r);return[3,3];case 3:return[2]}})});return function(e,s){return _ref.apply(this,arguments)}}()):this.abDispatchReturnValueGenerator(i)}},{key:"reportOnce",value:function reportOnce(t,i){this.report({key:t,untilTimes:1,params:i})}},{key:"report",value:function report(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var e={key:"",delayTimes:0,untilTimes:0,params:i,sampling:1};O(t)?C(e,t):e.key=t;var s=Number(e.sampling||0);var _ref,_ref1;s<1&&Math.random()>1-s||(((_ref=e==null?void 0:e.delayTimes)!==null&&_ref!==void 0?_ref:0)<=0&&((_ref1=e==null?void 0:e.untilTimes)!==null&&_ref1!==void 0?_ref1:0)<=0&&this.appear(e),this.checkReportInQueue(e,e.delayTimes>0?m.Delay:m.UntilSometimes))}},{key:"reportDelay",value:function reportDelay(t,i,e){this.report({key:t,delayTimes:i,params:e})}},{key:"reportUntil",value:function reportUntil(t,i,e){this.report({key:t,untilTimes:i,params:e})}},{key:"catch",value:function _catch(t,i){try{var _$e=i;var _this=this;if(R(_$e))return new Promise(function(){var _ref=_async_to_generator(function(s,r){var o;return _ts_generator(this,function(_state){switch(_state.label){case 0:_state.trys.push([0,2,,3]);return[4,_$e];case 1:s.apply(void 0,[_state.sent()]);return[3,3];case 2:o=_state.sent();_this.errorReport(t,o),r(o);return[3,3];case 3:return[2]}})});return function(s,r){return _ref.apply(this,arguments)}}())}catch(e){throw this.errorReport(t,e),e}}},{key:"catcher",value:function catcher(t,i){var _this=this;return function(){for(var _len=arguments.length,e=new Array(_len),_key=0;_key<_len;_key++){e[_key]=arguments[_key]}try{var _$s=i.apply(void 0,_to_consumable_array(e));var _this1=_this;return R(_$s)?new Promise(function(){var _ref=_async_to_generator(function(r,o){var l;return _ts_generator(this,function(_state){switch(_state.label){case 0:_state.trys.push([0,2,,3]);return[4,_$s];case 1:r.apply(void 0,[_state.sent()]);return[3,3];case 2:l=_state.sent();_this1.errorReport(t,l),o(l);return[3,3];case 3:return[2]}})});return function(r,o){return _ref.apply(this,arguments)}}()):_$s}catch(s){throw _this.errorReport(t,s),s}}}},{key:"errorReport",value:function errorReport(t,i){this.appear({key:t,params:{errMsg:i},untilTimes:0,delayTimes:0},g.Error)}},{key:"beforeEach",value:function beforeEach(t){this.beforeEachCallback.push(t)}},{key:"afterEach",value:function afterEach(t){this.afterEachCallback.push(t)}},{key:"checkReportInQueue",value:function checkReportInQueue(t,i){var _ref;var e=this.delayReport,s=this.untilReport,r=i===m.Delay,o=r?e:s,l=(_ref=t==null?void 0:t[r?"delayTimes":"untilTimes"])!==null&&_ref!==void 0?_ref:0;if(l>0){var h=U(o,function(c){return c.key===t.key});if(h===-1)o.push({key:t.key,totalTimes:l,restTimes:l+(r?-1:0),done:!1}),r||this.appear(t);else{var c=o[h];c.restTimes=c.restTimes-1,r?c.restTimes<1&&!c.done&&(this.appear(t),c.done=!0):c.restTimes>0&&!c.done?this.appear(t):c.done=!0}}}},{key:"appear",value:function appear(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g.Report;var _this=this;return _async_to_generator(function(){var e,s,r,o,l,h,c,p,u,c1,p1,u1;return _ts_generator(this,function(_state){switch(_state.label){case 0:e=_object_spread_props(_object_spread({},t),{type:i}),s=_this.beforeEachCallback,r=_this.afterEachCallback,o=_this.matchBeforeMap,l=_this.matchAfterMap,h=e.key;c=0,p=s.length;_state.label=1;case 1:if(!(c