@apmplus/mini-program
Advanced tools
Comparing version 0.2.2 to 0.2.3-alpha.0
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).APMPlusMiniProSDK={})}(this,function(n){"use strict";function p(n){return JSON.stringify({ev_type:"batch",list:n})}var l=10,d=1e3;var r=function(n,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])})(n,e)};function e(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}r(n,e),n.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}var m=function(){return(m=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}).apply(this,arguments)};function h(n,e){var t={};for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&e.indexOf(o)<0&&(t[o]=n[o]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(n);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(n,o[r])&&(t[o[r]]=n[o[r]]);return t}function b(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),a=[];try{for(;(void 0===e||0<e--)&&!(r=i.next()).done;)a.push(r.value)}catch(n){o={error:n}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function y(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||((r=r||Array.prototype.slice.call(e,0,o))[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],v=function(){return{}};function g(n){return n}function w(n){return"object"==typeof n&&null!==n}var t=Object.prototype;function i(n){if(w(n)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(n);n=Object.getPrototypeOf(n);return n===t||null===n}}function a(n){return"[object Array]"===t.toString.call(n)}function S(n){return"function"==typeof n}function u(n){return"number"==typeof n}function c(n){return"string"==typeof n}function E(n,e){var t,r,o=m({},n);for(t in e)r=t,Object.prototype.hasOwnProperty.call(e,r)&&void 0!==e[t]&&(w(e[t])&&i(e[t])?o[t]=E(w(n[t])?n[t]:{},e[t]):a(e[t])&&a(n[t])?o[t]=function e(n,t){n=a(n)?n:[];t=a(t)?t:[];return Array.prototype.concat.call(n,t).map(function(n){return n instanceof RegExp?n:w(n)&&i(n)?E({},n):a(n)?e([],n):n})}(n[t],e[t]):o[t]=e[t]);return o}function P(n,e){if(!a(n))return!1;if(0===n.length)return!1;for(var t=0;t<n.length;){if(n[t]===e)return!0;t++}return!1}var x=function(n,e){if(!a(n))return n;var t=n.indexOf(e);if(0<=t){e=n.slice();return e.splice(t,1),e}return n};function k(n){return a(n)&&n.length?function(n){for(var e=[],t=n.length,r=0;r<t;r++){var o=n[r];c(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}(n):null}function I(n){try{return c(n)?n:JSON.stringify(n)}catch(n){return"[FAILED_TO_STRINGIFY]:"+String(n)}}function o(t){return w(t)?Object.keys(t).reduce(function(n,e){return n+="&"+e+"="+t[e]},"").replace("&","?"):""}var s=function(i,a,u,c){return void 0===c&&(c=!0),function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(!i)return v;var t=i[a],r=u.apply(void 0,y([t],b(n),!1)),o=r;return S(o)&&c&&(o=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{return r.apply(this,e)}catch(n){return S(t)&&t.apply(this,e)}}),i[a]=o,function(n){n||(o===i[a]?i[a]=t:r=t)}}},f=0,j=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.error.apply(console,y(["[SDK]",Date.now(),(""+f++).padStart(8," ")],b(n),!1))},O=0,C=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.warn.apply(console,y(["[SDK]",Date.now(),(""+O++).padStart(8," ")],b(n),!1))},T=function(n){return Math.random()<Number(n)},D=function(n,e){return n<Number(e)},R=function(r){return function(n){for(var e=n,t=0;t<r.length&&e;t++)try{e=r[t](e)}catch(n){j(n)}return e}};function A(){var n=function(){for(var n=new Array(16),e=0,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(n){for(var e=[],t=0;t<256;++t)e[t]=(t+256).toString(16).substr(1);var r=0,o=e;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[+r]],o[n[15]]].join("")}(n)}function N(n){var t,r,o,e=(t={},r={},o={set:function(n,e){return t[n]=e,r[n]=I(e),o},merge:function(e){return t=m(m({},t),e),Object.keys(e).forEach(function(n){r[n]=I(e[n])}),o},delete:function(n){return delete t[n],delete r[n],o},clear:function(){return t={},r={},o},get:function(n){return r[n]},toString:function(){return m({},r)}});n.provide("context",e),n.on("report",function(n){return n.extra||(n.extra={}),n.extra.context=e.toString(),n})}function M(n,e){var t=n.common||{};return t.sample_rate=e,n.common=t,n}function V(n,e,t,r,o){return n?(i=o(r,e),function(){return i}):function(){return t(e)};var i}function L(n,e,t,r){if(void 0===(n=function(n,e,t){for(var r,e=b(e.split(".")),o=e[0],i=e.slice(1);n&&0<i.length;)n=n[o],o=(r=b(i))[0],i=r.slice(1);if(n)return t(n,o)}(n,e,function(n,e){return n[e]})))return!1;var o,e="boolean"==typeof n?"bool":u(n)?"number":"string";return function(n,e,t){switch(t){case"eq":return P(e,n);case"neq":return!P(e,n);case"gt":return n>e[0];case"gte":return n>=e[0];case"lt":return n<e[0];case"lte":return n<=e[0];case"regex":return Boolean(n.match(new RegExp(e.join("|"))));case"not_regex":return!n.match(new RegExp(e.join("|")));default:return!1}}(n,(o=e,r.map(function(n){switch(o){case"number":return Number(n);case"boolean":return"1"===n;default:return String(n)}})),t)}function q(e,n){try{return"rule"===n.type?L(e,n.field,n.op,n.values):"and"===n.type?n.children.every(function(n){return q(e,n)}):n.children.some(function(n){return q(e,n)})}catch(n){return!1}}function B(e){e.provide("sendEvent",function(n){n=U(n);n&&e.report({ev_type:H,payload:n,extra:{timestamp:Date.now()}})}),e.provide("sendLog",function(n){n=K(n);n&&e.report({ev_type:H,payload:n,extra:{timestamp:Date.now()}})})}var F,z=function(n,e,t,r){if(!e)return g;var o=e.sample_rate,i=e.include_users,a=e.sample_granularity,u=e.rules,e=e.r,e=void 0===e?Math.random():e;if(P(i,n))return function(n){return M(n,1)};var c,s,f,p,l,d,m,a="session"===a,h=V(a,o,t,e,r),v=(c=u,s=a,f=o,p=t,l=e,d=r,m={},Object.keys(c).forEach(function(n){var e=c[n],t=e.enable,r=e.sample_rate,e=e.conditional_sample_rules;t?(m[n]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:V(s,r,p,l,d)},e&&(m[n].conditional_hit_rules=e.map(function(n){var e=n.sample_rate,n=n.filter;return{sample_rate:e,hit:V(s,e,p,l,d),effectiveSampleRate:e*f,filter:n}}))):m[n]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),m);return function(n){if(!h())return!1;if(!(n.ev_type in v))return M(n,o);if(!v[n.ev_type].enable)return!1;if(n.common&&n.common.sample_rate)return n;var e=v[n.ev_type],t=e.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(q(n,t[r].filter))return!!t[r].hit()&&M(n,t[r].effectiveSampleRate);return!!e.hit()&&M(n,e.effectiveSampleRate)}},H="custom",U=function(n){if(n&&w(n)&&n.name&&c(n.name)){var e={name:n.name,type:"event"};if("metrics"in n&&w(n.metrics)){var t=n.metrics,r={};for(o in t)u(t[o])&&(r[o]=t[o]);e.metrics=r}if("categories"in n&&w(n.categories)){var o,i=n.categories,a={};for(o in i)a[o]=I(i[o]);e.categories=a}return e}},K=function(n){if(n&&w(n)&&n.content&&c(n.content)){var e={content:I(n.content),type:"log",level:"info"};if("level"in n&&(e.level=n.level),"extra"in n&&w(n.extra)){var t,r=n.extra,o={},i={};for(t in r)u(r[t])?o[t]=r[t]:i[t]=I(r[t]);e.metrics=o,e.categories=i}return e}},W=["success","fail","complete"];(ze=F=F||{}).onLaunch="onLaunch",ze.onShow="onShow",ze.onHide="onHide",ze.onError="onError",ze.onPageNotFound="onPageNotFound",ze.onUnhandledRejection="onUnhandledRejection";function G(n){return"[object Object]"===Object.prototype.toString.call(n)}var J=["request","downloadFile","uploadFile"],Y=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],$=y(y([],b([F.onLaunch,F.onShow,F.onHide]),!1),[F.onError,F.onPageNotFound,F.onUnhandledRejection],!1),Q=["attached","onInit"],X=["onLoad","onShow","onReady","onUnload","onHide"],Z="unknown_error_name",nn="__HOOKED__",en=-1;var tn=function(){return Date.now()};function rn(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];if(!S(n))return 0;var r,o=tn();try{n.apply(this,e)}finally{r=tn()}return r-o}function on(t,n){Object.keys(n).forEach(function(e){n[e].addTearDown(function(){var n;return En(t,((n={})[e]=null,n))})})}function an(n,e){e.addTearDown(function(){return Sn(n,null)})}function un(n){return Pn("http")[n]}function cn(){return Pn("setData")}function sn(){return!!Pn("performance")}function fn(){return Pn("instance")}var pn,ln=function(){},dn=b((pn="tt",[function(){return pn},function(n){return pn=n}]),2),mn=dn[0],hn=dn[1],vn=function(e,t){function n(n){return t(n),e.call(this,n)}for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},gn=function(n,e,r){var o=n[e];if(!o||!o[nn])return Object.defineProperty(n,e,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{var t=r.apply(this,n);t&&(n=t)}catch(n){j(n)}return o.apply(this,n)}}),n[e]&&(n[e][nn]=!0),function(){n[e][nn]=!1,r=ln}},bn=function(){var n={instance:null};return n.instance||("undefined"!=typeof tt?n={instance:tt,platform:mn()}:"undefined"!=typeof my?n={instance:my,platform:"my"}:"undefined"!=typeof swan?n={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(n={instance:wx,platform:"wx"})),n},yn="__slardar__global__0.2.2",_n={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},wn=function(n,e){void 0===n&&(n={});var t=(e=void 0===e?bn().instance:e)?e[yn]||(e[yn]=n):n;return{setGlobalValue:function(n,e){t[n]=e},mergeGlobalValue:function(n,e){t[n]=m(m({},t[n]),e)},getGlobalValue:function(n){return t[n]},getGlobalEntirely:function(){return t},destroy:function(){t=m({},_n),e&&(e[yn]=t)}}}(m({},_n)),Sn=wn.setGlobalValue,En=wn.mergeGlobalValue,Pn=wn.getGlobalValue,xn=function(n){return Pn("app")[n]},kn=function(n){return Pn("page")[n]},In=function(n){return Pn("route")[n]},jn=function(n){return!!Pn("route")[n]},On=function(t){Y.forEach(function(e){jn(e)&&In(e).subscribe(function(n){return t(n,e)})})},Cn=function(n){return!!Pn("http")[n]},Tn=function(n){En("http",n),on("http",n)},Dn=function(){return Pn("performance")},Rn=function(n){return Pn("component")[n]},An=function(n){Sn("instance",n)};function Nn(n){return"function"==typeof n}function Mn(n,e){!n||0<=(e=n.indexOf(e))&&n.splice(e,1)}function Vn(n){return n}function Ln(t){return function(n){if((e=n)&&Nn(e.lift))return n.lift(function(n){try{return t(n,this)}catch(n){this.error(n)}});var e;throw new TypeError("Unable to lift unknown Observable type")}}function qn(n){Nn(n)?n():null!=n&&n.unsubscribe()}var Bn=function(n){return n instanceof Fn||n&&"closed"in n&&Nn(n.remove)&&Nn(n.add)&&Nn(n.unsubscribe)},Fn=(zn.prototype.unsubscribe=function(){var n,e,t,r=this;this.closed||(this.closed=!0,n=this._parentage,e=this._finalizers,t=this.initialTeardown,n&&(this._parentage=null,n.forEach(function(n){return n.remove(r)})),Nn(t)&&t(),e&&(this._finalizers=null,e.forEach(qn)))},zn.prototype.remove=function(n){this._finalizers&&Mn(this._finalizers,n),n instanceof zn&&n._removeParent(this)},zn.prototype.add=function(n){if(n&&n!==this)if(this.closed)qn(n);else{if(n instanceof zn){if(n.closed||n._hasParent(this))return;n._addParent(this)}var e=this._finalizers;this._finalizers=e?(e.push(n),e):[n]}},zn.prototype._addParent=function(n){var e=this._parentage;this._parentage=e?(e.push(n),e):[n]},zn.prototype._hasParent=function(n){return this._parentage&&~this._parentage.indexOf(n)},zn.prototype._removeParent=function(n){this._parentage&&Mn(this._parentage,n)},zn);function zn(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}var Hn,Un=(e(Kn,Hn=Fn),Kn.prototype.next=function(n){this.isStopped||this.destination.next(n)},Kn.prototype.error=function(n){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(n)}finally{this.unsubscribe()}}},Kn.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Kn.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Hn.prototype.unsubscribe.call(this),this.destination=null)},Kn.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Kn);function Kn(n){var e=Hn.call(this)||this;return e.isStopped=!1,e.destination=Jn(n)?n:new Wn(!(n=n)||Nn(n)?{next:null!=n?n:void 0}:n),e}var Wn=(Gn.prototype.next=function(n){var e=this.partialObserver;if(e.next)try{e.next(n)}catch(n){console.error("ConsumerObserver.next error",n)}},Gn.prototype.error=function(n){var e=this.partialObserver;if(e.error)try{e.error(n)}catch(n){console.error("ConsumerObserver.error error",n)}},Gn.prototype.complete=function(){var n=this.partialObserver;if(n.complete)try{n.complete()}catch(n){console.error("ConsumerObserver.complete error",n)}},Gn);function Gn(n){this.partialObserver=n}function Jn(n){return n instanceof Un||n&&((e=n)&&Nn(e.next)&&Nn(e.error)&&Nn(e.complete))&&Bn(n);var e}var Yn=($n.prototype.subscribe=function(n){var e=Jn(n)?n:new Un(n),t=this.operator,n=this.source;return e.add(t?t.call(e,n):this._trySubscribe(e)),e},$n.prototype.lift=function(n){var e=new $n;return e.source=this,e.operator=n,e},$n.prototype.pipe=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return(0===(e=n).length?Vn:1===e.length?e[0]:function(n){return e.reduce(function(n,e){return e(n)},n)})(this)},$n.prototype._subscribe=function(n){},$n.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},$n);function $n(n){n&&(this._subscribe=n)}var Qn,Xn=(e(Zn,Qn=Yn),Zn.prototype.next=function(e){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(n){return n.next(e)})},Zn.prototype.commonJudgement=function(n){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,n())},Zn.prototype.error=function(e){var t=this;this.commonJudgement(function(){var n=t.observers;for(t.hasError=!0,t.thrownError=e;n.length;)n.shift().error(e)})},Object.defineProperty(Zn.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Zn.prototype.complete=function(){var e=this;this.commonJudgement(function(){for(var n=e.observers;n.length;)n.shift().complete()})},Zn.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Zn.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Zn.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},Zn.prototype._checkFinalizedStatuses=function(n){var e=this.hasError,t=this.thrownError,r=this.isStopped;e?n.error(t):r&&n.complete()},Zn.prototype._innerSubscribe=function(n){var e=this.isStopped,t=this.observers;return e?Zn.EMPTY:(t.push(n),new Fn(function(){Mn(t,n)}))},Zn.EMPTY=((We=new Fn).closed=!0,We),Zn);function Zn(){var n=null!==Qn&&Qn.apply(this,arguments)||this;return n.closed=!1,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}var ne=new Yn(function(n){return n.complete()});function ee(r){return r<=0?function(){return ne}:Ln(function(n,e){var t=0;n.subscribe(function(n){++t<=r&&(e.next(n),r<=t&&e.complete())})})}function te(r,o){return Ln(function(n,e){var t=0;n.subscribe(function(n){return r.call(o,n,t++)&&e.next(n)})})}function re(t){return te(function(n,e){return t<=e})}var oe,ie=(e(ae,oe=Xn),ae.prototype.subscribe=function(n){var t=this,n=oe.prototype.subscribe.call(this,n);fn()&&fn()._subscriptions.push(n);var r=n.unsubscribe;return n.unsubscribe=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];r.apply(this,n),t.observed||t.unsubscribe()},n},ae.prototype.unsubscribe=function(){oe.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(n){return n()})},ae.prototype.addTearDown=function(n){this.tearDownFns.push(n)},ae);function ae(){var n=null!==oe&&oe.apply(this,arguments)||this;return n.tearDownFns=[],n}function ue(n){return 1<n.length?n:n.length&&n[0]||{}}function ce(n){var t=n.filter(function(n){return n=n,!!!Pn("app")[n]}),n=Te(t).subjectMap;En("app",n=n),on("app",n),App=vn(App,function(e){t.forEach(function(n){var r=xn(n),n=s(e,n,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];r.next({that:this,param:ue(n),time:tn()}),S(t)&&t.apply(this,n)}})();n&&r.addTearDown(n)})})}function se(n){return"SLARDAR"+n}function fe(n){return n.route||n.__route__||n.url||n.path||""}function pe(t){return{instance:t=void 0===t?bn().instance:t,request:function(n){return t.request(n)},getStorage:function(n){return t.getStorageSync(n)},setStorage:function(n,e){return t.setStorageSync(n,e)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(n){return n},monitorNetworkType:function(e){t.getNetworkType({success:function(n){e&&e({networkType:n.networkType})}}),t.onNetworkStatusChange(function(n){e&&e({networkType:n.networkType})})},performanceSubscriber:v,getSystemInfo:v,buildRequestProfile:v,componentSubject:v,setDataSubject:v,pagePerfSubscriber:v}}function le(n){function e(n,i){r.forEach(function(o){s(n,o,function(r){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];Rn(o).next({that:this,param:null,time:tn()});var t=i[o];if(S(t)&&t.apply(this,n),S(r))return r.apply(this,n)}})()})}var t=["attached"],r=n.filter(function(n){return~t.indexOf(n)});try{Component=vn(Component,function(n){w(n.lifetimes)?e(n.lifetimes,n):void 0!==n.lifetimes&&null!==n.lifetimes||(n.lifetimes={},e(n.lifetimes,n))})}catch(n){}}function de(n){function e(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(n(m({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;On(function(n,e){"invoke"===n.param.name&&(o=!1,r={navigate_start:n.time,navigate_name:e})}),kn("onLoad").pipe(re(1)).subscribe(function(n){r.load_start=n.time}),kn("onShow").pipe(re(1)).subscribe(function(n){r.dom_end=n.time}),kn("onReady").pipe(re(1)).subscribe(function(n){r.render_end=n.time,e(),t()}),xn(F.onHide).subscribe(function(){!1===o&&(e(),t())})}function me(e){var t=["downloadPackage","evaluateScript","fcp","fp","fr"];Dn().subscribe(function(n){~t.indexOf(n.name)&&e(n)})}function he(e){Rn("attached").subscribe(function(n){n=n.that;return e.call(n)})}function ve(n){return"android"===n.toLowerCase()}function ge(){var n=wx.getAccountInfoSync().miniProgram,e=(l=wx.getSystemInfoSync()).model,t=l.brand,r=l.pixelRatio,o=l.screenHeight,i=l.screenWidth,a=l.windowHeight,u=l.windowWidth,c=l.language,s=l.version,f=l.system,p=l.platform,l=l.SDKVersion;return{model:e,brand:t,pixelRatio:r,screenArea:qe({width:i,height:o}),windowArea:qe({width:u,height:a}),language:c,osName:Le(p),osVersion:f,SDKVersion:l,appId:n.appId,miniEnv:n.envVersion,miniVersion:n.version,hostName:"wx",hostVersion:s,platform:"wx"}}function be(n){return(c(n)?He:Fe)(n)}function ye(n){void 0===n&&(n="tt");var e,t="",r="",o="";return tt.getEnvInfoSync?(r=(e=tt.getEnvInfoSync().microapp).envType,t=e.appId,o=e.mpVersion):(r=tt.env.VERSION,t=""),m({appId:t,miniEnv:r,miniVersion:o,platform:n},Ue())}function _e(e){var n=kn("onReady").subscribe(function(){var n;tt.performance&&(n=(tt.performance.getCurrentPageEntries()||[]).map(function(n){n.name,n.entryType;var e=h(n,["name","entryType"]),t=Ke(n);return t?m(m({},e),t):n}),e(n))});return{disconnect:function(){return n.unsubscribe()}}}function we(){var n="",e="",t="";my.getAccountInfoSync?(d=my.getAccountInfoSync().miniProgram,e=d.envVersion,n=d.appId,t=d.version):(n=my.getAppIdSync().appId,my.getRunScene({success:function(n){e=n.envVersion}}));var r=(m=my.getSystemInfoSync()).model,o=m.brand,i=m.pixelRatio,a=m.screenHeight,u=m.screenWidth,c=m.windowHeight,s=m.windowWidth,f=m.language,p=m.version,l=m.system,d=m.platform,m=m.app;return{model:r,brand:o,pixelRatio:i,screenArea:qe({pixelRatio:i,width:u,height:a,systemPlatform:d}),windowArea:qe({width:s,height:c}),language:f,osName:Le(d),osVersion:l,SDKVersion:my.SDKVersion,appId:n,miniEnv:e,miniVersion:t,hostName:m,hostVersion:p,platform:"my"}}function Se(n){return n&&function(n){switch(Object.prototype.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return 1;default:return n instanceof Error}}(n)?{name:n.name,message:n.message,stack:n.stack}:Fe(n)}function Ee(){var n="",e="";swan.getEnvInfoSync&&(e=(d=swan.getEnvInfoSync()).env,n=d.appKey);var t=(m=swan.getSystemInfoSync()).model,r=m.brand,o=m.pixelRatio,i=m.screenHeight,a=m.screenWidth,u=m.windowHeight,c=m.windowWidth,s=m.language,f=m.version,p=m.system,l=m.platform,d=m.SDKVersion,m=m.host;return{model:t,brand:r,pixelRatio:o,screenArea:qe({width:a,height:i}),windowArea:qe({width:c,height:u}),language:s,osName:Le(l),osVersion:p,SDKVersion:d,appId:n,miniEnv:e,miniVersion:"",hostName:m,hostVersion:f,platform:"swan"}}function Pe(){return m({appId:"",miniEnv:"",miniVersion:"",platform:Ge},Ue())}function xe(n){var e=n.filter(function(n){return n=n,!!!Pn("component")[n]}),n=Te(e).subjectMap;En("component",n=n),on("component",n),Ae().componentSubject(e)}function ke(e){function n(n){G(n.methods)?e(n.methods):void 0!==n.methods&&null!==n.methods||(n.methods={},e(n.methods))}try{Component=vn(Component,n),Behavior=vn(Behavior,n)}catch(n){}}function Ie(n,e){var t=n.filter(function(n){return n=n,!!!Pn("page")[n]}),n=Te(t).subjectMap;En("page",n=n),on("page",n),n=function(e){t.forEach(function(n){var r=kn(n),n=s(e,n,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(fe(this)&&r.next({that:this,param:ue(n),time:tn()}),S(t))return t.apply(this,n)}})();n&&r.addTearDown(n)})},Page=vn(Page,n),ke(n)}function je(n){var e=n.filter(function(n){return!jn(n)}),t=Te(e).subjectMap;En("route",n=t),on("route",n),e.forEach(function(i){var n=gn(Ae().instance,i,function(o){In(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:tn()}),W.forEach(function(r){s(o,r,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];In(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:ue(n)||{}},time:tn()}),S(t)&&t.apply(this,n)}})()})});n&&t[i].addTearDown(n)})}function Oe(n,t){void 0===t&&(t=Ae().instance);var n=n.filter(function(n){return!Cn(n)}),r=Te(n).subjectMap;Tn(r),n.forEach(function(e){var n=gn(t,e,function(n){Qe(e,n)});n&&r[e].addTearDown(n)})}var Ce,Te=function(n){var e=n.reduce(function(n,e){return n[e]=new ie,n},{});return{getSubject:function(n){return e[n]},subjectMap:e}},De=b((Ce={},[function(n){if(!bn().platform)throw Error("Not support current Mini Program");if(!Array.isArray(n)||!n.length)return null;n=n.find(function(n){return n.platform===bn().platform});return n&&(Ce=n.adapterCtor())},function(){return Ce}]),2),Re=De[0],Ae=De[1],Ne=function(n){n=se(n);return!!Ae().getStorage(n)},Me=["darwin","macs","mac"],Ve=["windows_nt","windows","window"],Le=function(n){return ve(n)?"Android":"ios"===n.toLowerCase()?"iOS":~Me.indexOf(n.toLowerCase())?"Mac":~Ve.indexOf(n.toLowerCase())?"windows":"unknown"},qe=function(n){var e=n.systemPlatform,t=n.pixelRatio,r=n.width,n=n.height;return e&&ve(e)&&t?r/t+" * "+n/t:r+" * "+n},Be=function(n){return function(n){var e,t={};for(e in n)Object.prototype.hasOwnProperty.call(n,e)&&void 0!==n[e]&&null!==n[e]&&(t[e]=n[e]);return t}({domainLookupStart:n.domainLookupStart,domainLookupEnd:n.domainLookupEnd,connectStart:n.connectStart,secureConnectionStart:n.SSLconnectionStart,connectEnd:n.connectEnd,requestStart:n.requestStart,requestEnd:n.requestEnd,responseStart:n.responseStart,responseEnd:n.responseEnd,socketReused:n.socketReused,redirectStart:n.redirectStart,redirectEnd:n.redirectEnd,fetchStart:n.fetchStart,sendBytesCount:n.sendBytesCount,throughputKbps:n.throughputKbps,receivedBytedCount:n.receivedBytedCount})},Fe=function(n){return{name:Z,message:I(n)}},ze={platform:"wx",adapterCtor:function(){return m(m({},pe()),{miniPlatform:"wx",buildError:function(n){return(c(n)?function(n){n=n.split("\n");return{name:b((n[2]&&n[2].split(":")||[]).map(function(n){return n.trim()}),1)[0],message:n&&n[1]&&n[1].trim(),stack:n.slice(2).join("\n")}}:Fe)(n)},getSystemInfo:ge,observePerformance:function(e){var n=wx.getPerformance&&wx.getPerformance();if(n){n=n.createObserver(function(n){n=n.getEntries().map(function(n){return m(m({},n),{name:function(n){switch(n){case"appLaunch":return"appClick";case"firstRender":return"fr";case"firstPaint":return"fp";case"firstContentfulPaint":return"fcp";case"largestContentfulPaint":return"lcp";default:return n}}(n.name)})});e(n)});return n.observe({entryTypes:n.supportedEntryTypes}),n}},performanceSubscriber:me,buildRequestProfile:function(n){return n=Be(e=n),e.protocol&&(n.protocol=e.protocol),n;var e},componentSubject:le,pagePerfSubscriber:de,setDataSubject:he})}},He=function(n){var e=n.split("\n"),e=b((e[0]&&e[0].split(":")||[]).map(function(n){return n.trim()}),2);return{name:e[0],message:e[1],stack:n}},Ue=function(){var n=tt.getSystemInfoSync(),e=n.model,t=n.brand,r=n.pixelRatio,o=n.screenHeight,i=n.screenWidth,a=n.windowHeight,u=n.windowWidth,c=n.language,s=n.version,f=n.system,p=n.platform,l=n.SDKVersion,n=n.appName;return{model:e,brand:t,pixelRatio:r,screenArea:qe({width:i,height:o}),windowArea:qe({width:u,height:a}),language:c,osName:Le(p),osVersion:f,SDKVersion:l,hostName:n,hostVersion:s}},Ke=function(n){if("navigation"===n.entryType)return{name:"route",entryType:"navigation",path:n.name};switch(n.name){case"app-click":return{name:"appClick",entryType:"navigation"};case"miniprogram-package\t":return{name:"downloadPackage",entryType:"loadPackage"};case"first-paint":return{name:"fp",entryType:"render"};default:return null}},dn={platform:"tt",adapterCtor:function(){return m(m({},pe()),{miniPlatform:"tt",buildError:be,getSystemInfo:ye,observePerformance:_e,performanceSubscriber:me,buildRequestProfile:function(n){return Be(n)},componentSubject:le,pagePerfSubscriber:de,setDataSubject:he})}},wn={platform:"my",adapterCtor:function(){return m(m({},pe()),{miniPlatform:"my",buildError:function(n){return a(n)?function(n,e){n={message:n};return!e||(e=b((e=(n.stack=e).split("\n"))[0]&&e[0].split(":"),1)[0])&&(n.name=e),n}(n[0],n[1]):Fe(n)},setStorage:function(n,e){return my.setStorageSync({key:n,data:e})},getStorage:function(n){return my.getStorageSync({key:n}).data},getSystemInfo:we,componentSubject:function(n){var e=["onInit"],t=n.filter(function(n){return~e.indexOf(n)}),r=function(n){t.forEach(function(r){s(n,r,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(Rn(r).next({that:this,param:null,time:tn()}),S(t))return t.apply(this,n)}})()})};Component=vn(Component,function(n){w(n)?r(n):null==n&&r(n={})})},setDataSubject:function(e){Rn("onInit").subscribe(function(n){n=n.that;return e.call(n)})},pagePerfSubscriber:de})}},We={platform:"swan",adapterCtor:function(){return m(m({},pe()),{miniPlatform:"swan",buildError:Se,getSystemInfo:Ee,componentSubject:le,setDataSubject:he,pagePerfSubscriber:function(e){function t(n){n.navigate_name=n.navigate_name||"native",n.load_start=n.load_start||0,n.dom_end=n.dom_end||0,n.render_end=n.render_end||0,n.navigate_start&&0!==n.load_start&&(e(m({},n)),n.load_start=0,i=!0)}var r={},o={},i=!1,a=!0;On(function(n,e){"invoke"===n.param.name&&(i=!1,r={navigate_start:n.time,navigate_name:e},o={navigate_start:n.time,navigate_name:e})}),kn("onLoad").pipe(re(1)).subscribe(function(n){n.that.componentName?o.dom_end=n.time:r.load_start=n.time}),kn("onShow").pipe(re(1)).subscribe(function(n){n.that.componentName?(o.load_start=n.time,r.load_start=0):r.dom_end=n.time}),kn("onReady").pipe(re(1)).subscribe(function(n){n.that.componentName?a?a=!1:(o.render_end=n.time,t(o)):(r.render_end=n.time,t(r),a=!1)}),xn(F.onHide).subscribe(function(){i||(t(r),t(o))})}})}},Ge="lark",Yn={platform:Ge,adapterCtor:function(){return m(m({},pe()),{miniPlatform:Ge,buildError:be,getSystemInfo:Pe,componentSubject:le,pagePerfSubscriber:de,setDataSubject:he})}},Je="mars",Xn={platform:Je,adapterCtor:function(){return m(m({},pe()),{miniPlatform:Je,buildError:be,getSystemInfo:ye.bind(null,Je),observePerformance:_e,performanceSubscriber:me,componentSubject:le,pagePerfSubscriber:de,setDataSubject:he})}},Ye=function(n){n.on("init",function(){ce($),Ie(X),xe(Q)})},$e=function(n){n.on("init",function(){je(Y)})},Qe=function(u,n){var e=n.url,t=n.method,r=n.data,o=n.header,i=n.headers,c={api:u,request:{url:e,method:(e=t,"uploadFile"===(t=u)?"POST":"downloadFile"!==t&&e||"GET"),headers:o||i||{},body:I(r),timestamp:tn()},response:{}};s(n,"complete",function(a){return function(n){var e=c.response.timestamp||tn();c.duration=e-c.request.timestamp,c.completeCallbackTime=rn(a,n);var t,r,o,i=n.errMsg||n.errorMessage||n.error;c.response={status:(t=n.status,r=n.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:e,headers:n.header||n.headers||{},body:I(n.data),errMsg:i,timing:Ae().buildRequestProfile(n.profile||{})},un(u).next(c)}})(),s(n,"success",function(e){return function(n){c.response.timestamp=tn(),c.response.status=200,c.successCallbackTime=rn(e,n)}})(),s(n,"fail",function(e){return function(n){c.response.timestamp=tn(),c.response.status=-1,c.failCallbackTime=rn(e,n)}})()},Xe=function(n,e){void 0===e&&(e=J),n.on("init",function(){Oe(e)})};function Ze(){var a=fe(this),u=cn();var n=gn(this,"setData",function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=r[0],i=tn();return[o,function(){var n=r[1],e=tn()-i;u.next({renderTime:e,url:a,data:o,startTime:i}),n&&n.call(t)}]});n&&u.addTearDown(n)}function nt(){var n;Pn("setData")||(n=(n=Te(["setData"]).getSubject)("setData"),Sn("setData",n),an("setData",n))}function et(o){return Object.keys(o).reduce(function(n,e){var t,r;return r=o[t=e],t&&r&&(it.test(t)||at.test(r))||(n[e]=o[e]),n},{})}var rt=function(n){n.on("init",function(){nt(),kn("onLoad").subscribe(function(n){n=n.that;Ze.call(n)}),Ae().setDataSubject(Ze)})},ot=function(n){n.on("init",function(){var e,n,t,r=Ae();r.observePerformance&&!sn()&&(e=(0,Te(["performance"]).getSubject)("performance"),Sn("performance",n=e),an("performance",n),(t=r.observePerformance(function(n){n.forEach(function(n){e.next(n)})}))&&t.disconnect&&e.addTearDown(function(){return t.disconnect()}))})},it=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),at=new RegExp("(bearer|session)","i"),ut=function(){return function(n,s){var e=n.hookRequest,t=n.hookDownloadFile,r=n.hookUploadFile,f=n.ignoreUrls,p=n.collectBodyOnError,l=n.extraExtractor,n=function(n){var e,t,r,o,i,a,u,c;!function(n,e){n=k(n||[]);return!!n&&n.test(e)}(f,n.request.url)&&(c=n.response,e=n.request,t=n.api,r=n.duration,o=n.failCallbackTime,u=n.successCallbackTime,i=n.completeCallbackTime,e.headers=et(e.headers||{}),c.headers=et(c.headers||{}),a=c.errMsg,n=h(c,["errMsg"]),n=m(m({},n),{is_custom_error:!1}),a&&(n.err_msg=a),u={api:t,request:e,duration:r,cbTime:i+(o||0)+(u||0),response:n},!S(l)||(n=l(c.body,u))&&(u.extra=n,u.response.is_custom_error=!0),p&&(0===(c=c.status)||400<=c)||(delete u.request.body,delete u.response.body),s({ev_type:"http",payload:u}))};e&&un("request").subscribe(n),t&&un("downloadFile").subscribe(n),r&&un("uploadFile").subscribe(n)}},ct=function(n,e,t,r){void 0===e&&(e={}),void 0===r&&(r=[]);try{var o=n.apply(void 0,y([],b(r),!1));return o&&o(e,t)||[]}catch(n){return j("applyMonitor",n),[]}};function st(n,e,t){An(n);e=null===(n=n.config())||void 0===n?void 0:n.plugins[e];return w(e)?m(m({},t),e):!!e&&t}function ft(i){i.on("init",function(){var n,e,t,r,o=st(i,mt,ht);o&&(n=o.hookRequest,e=o.hookDownloadFile,t=o.hookUploadFile,r=[],n&&r.push("request"),e&&r.push("downloadFile"),t&&r.push("uploadFile"),Xe(i,r),ct(ut,o,i.report.bind(i)))})}function pt(n,e){return n&&e&&n===e}function lt(){var r;return function(n){try{if(t=r,!(!(e=n)||!t)&&!(!pt(e.message,t.message)&&!pt(e.stack,t.stack)))return void(r=n)}catch(n){}var e,t;return r=n}}var dt,mt="http",ht={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},vt=function(f){return void 0===f&&(f=Ae()),function(n,r){var e=n.ignoreErrors,t=n.hookOnError,o=n.hookOnUnhandledRejection,i=n.hookRouteError,a=n.dedupe,u=k(e),c=lt(),s=function(n,e,t){n=a?c(n):n;n&&(u&&u.test(n.message)||(n={error:n},e&&(n.extra=e),t&&(n.react=t),r(n)))};t&&xn(F.onError).subscribe(function(n){n=n.param,n=f.buildError(n);u&&u.test(n.message)||s(n)}),o&&xn(F.onUnhandledRejection).subscribe(function(n){var e=n.param||{},n=e.promise,t=I(e.reason);u&&u.test(t)||n.catch(g).then(function(n){var e={name:"UnhandledRejection",message:t};n&&n.stack&&(e.stack=n.stack),s(e)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&On(function(n){n=n.param;"fail"===(n=n).name&&s({name:"RouteError",message:n.value.errMsg})}),[s]}};(De=dt=dt||{}).history="history",De.manual="manual";function gt(t,n,r){var o=n,i=null,a=0,e="launch";function u(n,e){o=e,a=tn(),r(e,i=e+"_"+a),t(n,e)}return xn(F.onShow).pipe(re(1)).subscribe(function(){e="show"}),On(function(){e="history"}),[u,function(n){n&&(u(e,n),e="history")},function(n){void 0===n&&(n="hide"),i&&(r(o,i),i=null,t(n,o,tn()-a))}]}function bt(t){return t.on("init",function(){var n,e=st(t,Dt,Rt);e&&(e=(n=b(ct(kt,m(m({},e),{setPidAndViewId:function(n,e){t.set({pid:n,viewId:e,actionId:void 0})}}),t.report.bind(t)),2))[0],n=n[1],t.provide("sendPageview",e),t.provide("sendPageviewWithHide",n))}),t}function yt(t){t.on("init",function(){var n,e=st(t,At,Nt);e&&(n=Mt(t),n=b(ct(vt,e,n),1)[0],t.provide("captureException",n))})}function _t(t){t.on("init",function(){var n,e=st(t,Lt,Vt);e&&(e=(n=b(ct(It,e,function(n){}),2))[0],n=n[1],t.provide("getBreadcrumbs",e),t.provide("addBreadcrumb",n))})}function wt(e){e.on("init",function(){var n=st(e,qt,Bt);n&&(rt(e),ct(jt,n,e.report.bind(e)))})}function St(e){e.on("init",function(){var n=st(e,Ft,zt);n&&(ot(e),ct(Ot,n,e.report.bind(e)))})}function Et(e){e.on("init",function(){var n=st(e,Ht,Ut);n&&ct(Ct,n,e.report.bind(e))})}function Pt(e){e.on("init",function(){var n=st(e,Kt,Wt);n&&(ot(e),ct(Tt,n,e.report.bind(e)))})}function xt(e){return(e=void 0===e?Ae():e)?{get:function(n){return Gt("GET",n,e)},post:function(n){return Gt("POST",n,e)}}:{get:v,post:v}}var kt=function(){return function(n,r){var e=n.extractPid,t=n.routeMode,o=n.setPidAndViewId,i=function(n){return e?e(n):n},n=b(gt(function(n,e,t){r({ev_type:"pageview",payload:{pid:e,source:n,duration:t}})},"",o),3),o=n[0],a=n[1],n=n[2];return t!==dt.manual&&(kn("onShow").subscribe(function(n){return function(n){n=fe(n),n=i(n);a(n)}(n.that)}),kn("onUnload").subscribe(n.bind(null,"unload")),kn("onHide").subscribe(n.bind(null,"hide"))),[o.bind(null,"user_set"),n]}},It=function(){return function(n){var e=b(function(e,t,r){void 0===e&&(e=20),void 0===t&&(t=g),void 0===r&&(r=function(n,e){return n.slice(-e)});var o=[];return[function(){return o},function(n){t(n)&&(n=m(m({},n),{timestamp:n.timestamp||Date.now()}),o=0<=e&&o.length+1>e?r(y(y([],b(o),!1),[n],!1),e):y(y([],b(o),!1),[n],!1))}]}(n.maxBreadcrumbs,n.onAddBreadcrumb,n.onMaxBreadcrumbs),2),n=e[0],r=e[1];return J.forEach(function(n){Cn(n)&&un(n).subscribe(function(n){r({type:"http",category:n.api,message:"",data:{method:n.request.method,url:n.request.url,status_code:String(n.response.status)},timestamp:n.request.timestamp})})}),On(function(n,e){var t=n.param,n=n.time;"complete"===t.name&&r({type:"route",category:e,message:t.value.errMsg||t.value.errorMessage||"",timestamp:n,data:{url:t.url||""}})}),[n,r]}},jt=function(){return function(n,t){var r=n.isCalculateSize;cn().subscribe(function(n){var e={duration:n.renderTime,start_time:n.startTime};r&&(e.size=(n=n.data,TextEncoder?(new TextEncoder).encode(I(n)).length:2*I(n).length)),t({ev_type:"set_data",payload:e})})}},Ot=function(){return function(n,e){function t(){e({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;xn(F.onLaunch).pipe(ee(1)).subscribe(function(n){r.activate_start=n.time}),xn(F.onShow).pipe(ee(1)).subscribe(function(n){r.init_end=n.time}),kn("onLoad").pipe(ee(1)).subscribe(function(n){r.page_load_start=n.time}),kn("onShow").pipe(ee(1)).subscribe(function(n){r.page_dom_end=n.time});var i=sn();kn("onReady").pipe(ee(1)).subscribe(function(n){r.page_render_end=n.time,i&&!r.trigger||t()}),i&&Dn().pipe(te(function(n){return"appClick"===n.name}),ee(1)).subscribe(function(n){r.trigger=n.startTime,r.page_render_end&&t()}),xn(F.onHide).subscribe(function(){o||t()})}},Ct=function(){return function(n,e){Ae().pagePerfSubscriber(function(n){return e({ev_type:"page_perf",payload:n})})}},Tt=function(e){return void 0===e&&(e=Ae()),function(n,t){var r,o;sn()&&e.performanceSubscriber&&(r=0,kn("onLoad").subscribe(function(n){o=n.time,r++}),e.performanceSubscriber(function(n){var e={is_custom:!1,name:n.name,value:n.startTime,type:"perf",count:r};e.duration=n.duration||(o?n.startTime-o:0),e.is_support=0<=e.duration,t({ev_type:"performance",payload:e})}))}},Dt="pageview",Rt={routeMode:dt.history,setPidAndViewId:function(n,e){}},At="jsError",Nt={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},Mt=function(t){return function(n){var e=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:m(m({},n),{breadcrumbs:e})})}},Vt={maxBreadcrumbs:20,tap:!0},Lt="breadcrumb",qt="setData",Bt={isCalculateSize:!1},Ft="appLaunchPerf",zt={},Ht="pagePerf",Ut={},Kt="performance",Wt={},Gt=function(n,e,t){void 0===t&&(t=Ae());var r=e.url,o=e.data,i=e.success,a=void 0===i?v:i,u=e.fail,c=void 0===u?v:u,i=e.header,u={"Content-Type":"application/json"};G(e=i)&&0!==Object.keys(e).length&&Object.assign(u,i),t.request({method:n,url:r,data:o,header:u,headers:u,success:function(n){a(n)},fail:function(n){n=n.errMsg||"Network request failed";c(new Error(n))}})};function Jt(n){return o=(t=n).transport,i=n.endpoint,a=n.size,u=void 0===a?l:a,c=void 0===(t=n.wait)?d:t,s=[],f=0,{getSize:function(){return u},getWait:function(){return c},setSize:function(n){u=n},setWait:function(n){c=n},getEndpoint:function(){return i},setEndpoint:function(n){i=n},send:function(n){s.push(n),s.length>=u&&e.call(this),clearTimeout(f),f=setTimeout(e.bind(this),c)},flush:function(){clearTimeout(f),e.call(this)},getBatchData:function(){return s.length?p(s):""},clear:function(){clearTimeout(f),s=[]},fail:function(n){r=n}};function e(){var e;s.length&&(e=this.getBatchData(),o.post({url:i,data:e,fail:function(n){r&&r(n,e)}}),s=[])}var t,r,o,i,a,u,c,s,f}function Yt(n,e){return void 0===e&&(e=Xt),(n&&0<=n.indexOf("//")?"":"https://")+n+e}var $t={build:function(n){return{ev_type:n.ev_type,payload:n.payload,common:m(m({},n.extra||{}),n.overrides||{})}}},Qt="/monitor_mini/collect",Xt="/settings/minipro",Zt="apmplus.volces.com",nr="session",er={sample_rate:1,include_users:[],sample_granularity:nr,rules:{}},tr=[Qt,Xt],rr="0.2.2",or="APM_PLUS_MINI_PROGRAM",ir=function(n){n=function(n){try{return Ae().getStorage(n)}catch(n){return}}(se(String(n)));return n&&n.userId&&n.deviceId?n:{userId:A(),deviceId:A()}},ar=function(n){return n+"_"+Date.now()},ur=function(n){var e=n.aid,t=n.userId,n=n.deviceId;!function(n,e){try{Ae().setStorage(n,e)}catch(n){}}(se(String(e)),{userId:t,deviceId:n})};function cr(n){n=ir(n.aid);return{aid:0,token:"",pid:"",viewId:ar("_"),userId:n.userId,deviceId:n.deviceId,sessionId:A(),domain:Zt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:tr},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:er,sdkName:or,sdkVersion:rr}}function sr(n){var e,t=n.plugins||{};for(e in t)t[e]&&!w(t[e])&&(t[e]={});return m(m({},n),{plugins:t})}function fr(n){return w(n)&&"aid"in n&&"token"in n}function pr(n){return m({},n)}function lr(e){var r,o,i=e,a={},u=void 0,c=v,t=v;return{getConfig:function(){return i},setConfig:function(n){var e,t;return a=m(m({},a),n||{}),s(),r||(r=n,i.useLocalConfig||!i.aid?(o={},c()):u?f():(e=i.domain,n=i.aid,t=function(n){u=n,f()},xt().get({url:Yt(e)+"?biz_id="+n,success:function(n){t(n&&n.data&&n.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(n){t=n},onReady:function(n){c=function(){ur(i),n()},o&&c()}};function s(){var n=m(m(m({},e),o||{}),a);n.plugins=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t={},r=0;r<n.length;)t=E(t,n[r++]);return t}(e.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),n.sample=dr(dr(e.sample,null==o?void 0:o.sample),a.sample),i=n,t()}function f(){o=function(n){if(!n)return{};var e=n.sample,t=n.user_id,r=n.timestamp,o=t?{userId:t}:{};if(!e)return o;var i=e.sample_rate,n=e.sample_granularity,t=void 0===n?nr:n,n=e.include_users,e=e.rules,e=void 0===e?[]:e;return m(m({},o),{sample:{include_users:n,sample_rate:i,sample_granularity:t,rules:e.reduce(function(n,e){var t=e.name,r=e.enable,o=e.sample_rate,e=e.conditional_sample_rules;return n[t]={enable:r,sample_rate:o,conditional_sample_rules:e},n},{})},serverTimestamp:r})}(u),Ne(String(i.aid))&&(o.userId=e.userId),s(),c()}}function dr(r,o){if(!r||!o)return r||o;var n=m(m({},r),o);return n.include_users=y(y([],b(r.include_users||[]),!1),b(o.include_users||[]),!1),n.rules=y(y([],b(Object.keys(r.rules||{})),!1),b(Object.keys(o.rules||{})),!1).reduce(function(n,e){var t;return e in n||(e in(r.rules||{})&&e in(o.rules||{})?(n[e]=m(m({},r.rules[e]),o.rules[e]),n[e].conditional_sample_rules=y(y([],b(r.rules[e].conditional_sample_rules||[]),!1),b(o.rules[e].conditional_sample_rules||[]),!1)):n[e]=(null===(t=r.rules)||void 0===t?void 0:t[e])||(null===(t=o.rules)||void 0===t?void 0:t[e])),n},{}),n}function mr(e){function t(n){return void 0===n&&(n=Ae().getSystemInfo()),e.set(m({},n))}function r(){t(),n()}var o=!1,n=vr(e);e.on("start",function(){r(),o=!0}),e.on("init",function(){xn(F.onLaunch).pipe(ee(1)).subscribe(function(n){n=n.param.scene||en;t({scene:n}),o&&r()}),Ae().monitorNetworkType(function(n){n=n.networkType;e.set({networkType:n})})})}function hr(n){if(!Re(n))throw Error("Adapters imported incorrectly");var t,r,o,e,i,a,u,c,n=function(n){var t,r,e=n.builder,o=n.createSender,i=n.createDefaultConfig,a=n.createConfigManager,u=n.userConfigNormalizer,c=n.initConfigNormalizer,s=n.validateInitConfig,f={};_.forEach(function(n){return f[n]=[]});var p=!1,l=!1,d=!1,m=[],h=[],v={getBuilder:function(){return e},getSender:function(){return t},getPreStartQueue:function(){return m},init:function(n){if(p)C("already inited");else{if(!(n&&w(n)&&s(n)))throw new Error("invalid InitConfig, init failed");var e=i(n);if(!e)throw new Error("defaultConfig missing");n=c(n);if((r=a(e)).setConfig(n),r.onChange(function(){g("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");g("init",p=!0)}},set:function(n){p&&n&&w(n)&&(g("beforeConfig",!1,n),null!=r&&r.setConfig(n))},config:function(n){if(p)return n&&w(n)&&(g("beforeConfig",!1,n),null!=r&&r.setConfig(u(n))),null==r?void 0:r.getConfig()},provide:function(n,e){P(h,n)?C("cannot provide "+n+", reserved"):(v[n]=e,g("provide",!1,n))},start:function(){var e=this;p&&(l||null!=r&&r.onReady(function(){g("start",l=!0),m.forEach(function(n){return e.build(n)}),m=[]}))},report:function(n){n&&(!(n=R(f.beforeReport)(n))||(n=R(f.report)(n))&&(l?this.build(n):m.push(n)))},build:function(n){!l||(n=R(f.beforeBuild)(n))&&(!(n=e.build(n))||(n=R(f.build)(n))&&this.send(n))},send:function(n){!l||(n=R(f.beforeSend)(n))&&(t.send(n),g("send",!1,n))},destroy:function(){g("beforeDestroy",d=!0)},on:function(n,e){"init"===n&&p||"start"===n&&l||"beforeDestroy"===n&&d?e():f[n]&&f[n].push(e)},off:function(n,e){f[n]&&(f[n]=x(f[n],e))}},h=Object.keys(v);return v;function g(n,e){void 0===e&&(e=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[n].forEach(function(n){try{n.apply(void 0,y([],b(t),!1))}catch(n){}}),e&&(f[n].length=0)}}({validateInitConfig:fr,initConfigNormalizer:sr,userConfigNormalizer:pr,createSender:function(n){return Jt({size:20,endpoint:(n=n.domain,void 0===e&&(e=Qt),(n&&0<=n.indexOf("//")?"":"https://")+n+e),transport:xt()});var e},builder:$t,createDefaultConfig:cr,createConfigManager:lr});return N(n),o=!1,(t=n).on("init",function(){r=tn(),t.on("config",function(){var n,e=null===(n=t.config())||void 0===n?void 0:n.serverTimestamp;isNaN(e)||Number(e)<=0||o||(o=!0,(n=tn())-r<yr&&e&&(n=e-(n+r)/2,isNaN(n)||t.set({offset:n})))})}),(e=n).on("beforeBuild",function(n){return gr(n,e.config())}),n.on("report",function(n){return br(n)}),(i=n).on("start",function(){var n=i.config(),e=n.userId,n=n.sample,n=z(e,n,T,D);i.on("build",n)}),(a=n).on("init",function(){a.provide("_subscriptions",[]),An(a),Ye(a),$e(a)}),a.on("beforeDestroy",function(){if(a._subscriptions)for(;a._subscriptions.length;)a._subscriptions.shift().unsubscribe();for(var n in a)delete a[n]}),(u=n).on("init",function(){var e=[],n=u.config();n&&n.integrations&&n.integrations.forEach(function(n){P(e,n.name)||(e.push(n.name),n.setup(u),n.tearDown&&u.on("beforeDestroy",n.tearDown))})}),(c=n).on("init",function(){xn(F.onHide).subscribe(function(){var n=c.getSender();n&&n.flush()})}),mr(n),n}var vr=function(t){var r="";return function(){var n=t.getSender();r=r||n.getEndpoint();var e=t.config(),e={did:e.deviceId,sid:e.sessionId,sname:e.sdkName,sver:e.sdkVersion,soffset:e.offset||0,model:e.model,brand:e.brand,ratio:e.pixelRatio,screen:e.screenArea,window:e.windowArea,lang:e.language,osname:e.osName,osver:e.osVersion,libver:e.SDKVersion,scene:e.scene||en,menv:e.miniEnv,mver:e.miniVersion,hostname:e.hostName,hostver:e.hostVersion,platform:e.platform,biz_id:e.aid,x_auth_token:e.token};n.setEndpoint(r+o(e))}},gr=function(n,e){var t={};return t.aid=e.aid,t.pid=e.pid,t.view_id=e.viewId,t.user_id=e.userId,t.network_type=e.networkType,m(m({},n),{extra:m(m({},t),null!==(n=n.extra)&&void 0!==n?n:{})})},br=function(n){var e,e={url:(e=Ae().getCurrentPages().pop())?(e?fe(e):"")+o(e.options):"",timestamp:tn()};return m(m({},n),{extra:m(m({},e),null!==(n=n.extra)&&void 0!==n?n:{})})},yr=1e3;n.AppLaunchPerfIntegration=function(){return{name:"AppLaunchPerfIntegration",setup:function(n){St(n)}}},n.BreadcrumbIntegration=function(){return{name:"BreadcrumbIntegration",setup:function(n){_t(n)}}},n.CustomIntegration=function(){return{name:"CustomIntegration",setup:function(n){B(n)}}},n.FrameworksAdapterIntegration=function(t){return{name:"FrameworksAdapterIntegration",setup:function(n){var e=t.Taro;e&&"my"===Ae().miniPlatform&&n.on("init",function(){Oe(["request"],e)})}}},n.HttpIntegration=function(){return{name:"HttpIntegration",setup:function(n){ft(n)}}},n.JsErrorIntegration=function(){return{name:"JsErrorIntegration",setup:function(n){yt(n)}}},n.LarkAdapter=Yn,n.MarsAdapter=Xn,n.MyAdapter=wn,n.PagePerfIntegration=function(){return{name:"PagePerfIntegration",setup:function(n){Et(n)}}},n.PageviewIntegration=function(){return{name:"PageviewIntegration",setup:function(n){bt(n)}}},n.PerformanceIntegration=function(){return{name:"PerformanceIntegration",setup:function(n){Pt(n)}}},n.SetDataIntegration=function(){return{name:"SetDataIntegration",setup:function(n){wt(n)}}},n.SwanAdapter=We,n.TtAdapter=dn,n.WxAdapter=ze,n.createBaseMiniProgramClient=hr,n.createMiniProgramClient=function(n){n=hr(n);if(n)return B(n),bt(n),yt(n),ft(n),wt(n),_t(n),St(n),Et(n),Pt(n),n},n.setPlatform=hn,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).APMPlusMiniProSDK={})}(this,function(n){"use strict";function p(n){return JSON.stringify({ev_type:"batch",list:n})}var l=10,d=1e3;var r=function(n,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])})(n,e)};function e(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}r(n,e),n.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}var m=function(){return(m=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}).apply(this,arguments)};function h(n,e){var t={};for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&e.indexOf(o)<0&&(t[o]=n[o]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(n);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(n,o[r])&&(t[o[r]]=n[o[r]]);return t}function b(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),a=[];try{for(;(void 0===e||0<e--)&&!(r=i.next()).done;)a.push(r.value)}catch(n){o={error:n}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function y(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||((r=r||Array.prototype.slice.call(e,0,o))[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],v=function(){return{}};function g(n){return n}function w(n){return"object"==typeof n&&null!==n}var t=Object.prototype;function i(n){if(w(n)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(n);n=Object.getPrototypeOf(n);return n===t||null===n}}function a(n){return"[object Array]"===t.toString.call(n)}function S(n){return"function"==typeof n}function u(n){return"number"==typeof n}function c(n){return"string"==typeof n}function E(n,e){var t,r,o=m({},n);for(t in e)r=t,Object.prototype.hasOwnProperty.call(e,r)&&void 0!==e[t]&&(w(e[t])&&i(e[t])?o[t]=E(w(n[t])?n[t]:{},e[t]):a(e[t])&&a(n[t])?o[t]=function e(n,t){n=a(n)?n:[];t=a(t)?t:[];return Array.prototype.concat.call(n,t).map(function(n){return n instanceof RegExp?n:w(n)&&i(n)?E({},n):a(n)?e([],n):n})}(n[t],e[t]):o[t]=e[t]);return o}function P(n,e){if(!a(n))return!1;if(0===n.length)return!1;for(var t=0;t<n.length;){if(n[t]===e)return!0;t++}return!1}var x=function(n,e){if(!a(n))return n;var t=n.indexOf(e);if(0<=t){e=n.slice();return e.splice(t,1),e}return n};function k(n){return a(n)&&n.length?function(n){for(var e=[],t=n.length,r=0;r<t;r++){var o=n[r];c(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}(n):null}function I(n){try{return c(n)?n:JSON.stringify(n)}catch(n){return"[FAILED_TO_STRINGIFY]:"+String(n)}}function o(t){return w(t)?Object.keys(t).reduce(function(n,e){return n+="&"+e+"="+t[e]},"").replace("&","?"):""}var s=function(i,a,u,c){return void 0===c&&(c=!0),function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(!i)return v;var t=i[a],r=u.apply(void 0,y([t],b(n),!1)),o=r;return S(o)&&c&&(o=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{return r.apply(this,e)}catch(n){return S(t)&&t.apply(this,e)}}),i[a]=o,function(n){n||(o===i[a]?i[a]=t:r=t)}}},f=0,j=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.error.apply(console,y(["[SDK]",Date.now(),(""+f++).padStart(8," ")],b(n),!1))},O=0,C=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.warn.apply(console,y(["[SDK]",Date.now(),(""+O++).padStart(8," ")],b(n),!1))},T=function(n){return Math.random()<Number(n)},D=function(n,e){return n<Number(e)},R=function(r){return function(n){for(var e=n,t=0;t<r.length&&e;t++)try{e=r[t](e)}catch(n){j(n)}return e}};function A(){var n=function(){for(var n=new Array(16),e=0,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(n){for(var e=[],t=0;t<256;++t)e[t]=(t+256).toString(16).substr(1);var r=0,o=e;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[+r]],o[n[15]]].join("")}(n)}function N(n){var t,r,o,e=(t={},r={},o={set:function(n,e){return t[n]=e,r[n]=I(e),o},merge:function(e){return t=m(m({},t),e),Object.keys(e).forEach(function(n){r[n]=I(e[n])}),o},delete:function(n){return delete t[n],delete r[n],o},clear:function(){return t={},r={},o},get:function(n){return r[n]},toString:function(){return m({},r)}});n.provide("context",e),n.on("report",function(n){return n.extra||(n.extra={}),n.extra.context=e.toString(),n})}function M(n,e){var t=n.common||{};return t.sample_rate=e,n.common=t,n}function V(n,e,t,r,o){return n?(i=o(r,e),function(){return i}):function(){return t(e)};var i}function L(n,e,t,r){if(void 0===(n=function(n,e,t){for(var r,e=b(e.split(".")),o=e[0],i=e.slice(1);n&&0<i.length;)n=n[o],o=(r=b(i))[0],i=r.slice(1);if(n)return t(n,o)}(n,e,function(n,e){return n[e]})))return!1;var o,e="boolean"==typeof n?"bool":u(n)?"number":"string";return function(n,e,t){switch(t){case"eq":return P(e,n);case"neq":return!P(e,n);case"gt":return n>e[0];case"gte":return n>=e[0];case"lt":return n<e[0];case"lte":return n<=e[0];case"regex":return Boolean(n.match(new RegExp(e.join("|"))));case"not_regex":return!n.match(new RegExp(e.join("|")));default:return!1}}(n,(o=e,r.map(function(n){switch(o){case"number":return Number(n);case"boolean":return"1"===n;default:return String(n)}})),t)}function q(e,n){try{return"rule"===n.type?L(e,n.field,n.op,n.values):"and"===n.type?n.children.every(function(n){return q(e,n)}):n.children.some(function(n){return q(e,n)})}catch(n){return!1}}function B(e){e.provide("sendEvent",function(n){n=U(n);n&&e.report({ev_type:H,payload:n,extra:{timestamp:Date.now()}})}),e.provide("sendLog",function(n){n=K(n);n&&e.report({ev_type:H,payload:n,extra:{timestamp:Date.now()}})})}var F,z=function(n,e,t,r){if(!e)return g;var o=e.sample_rate,i=e.include_users,a=e.sample_granularity,u=e.rules,e=e.r,e=void 0===e?Math.random():e;if(P(i,n))return function(n){return M(n,1)};var c,s,f,p,l,d,m,a="session"===a,h=V(a,o,t,e,r),v=(c=u,s=a,f=o,p=t,l=e,d=r,m={},Object.keys(c).forEach(function(n){var e=c[n],t=e.enable,r=e.sample_rate,e=e.conditional_sample_rules;t?(m[n]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:V(s,r,p,l,d)},e&&(m[n].conditional_hit_rules=e.map(function(n){var e=n.sample_rate,n=n.filter;return{sample_rate:e,hit:V(s,e,p,l,d),effectiveSampleRate:e*f,filter:n}}))):m[n]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),m);return function(n){if(!h())return!1;if(!(n.ev_type in v))return M(n,o);if(!v[n.ev_type].enable)return!1;if(n.common&&n.common.sample_rate)return n;var e=v[n.ev_type],t=e.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(q(n,t[r].filter))return!!t[r].hit()&&M(n,t[r].effectiveSampleRate);return!!e.hit()&&M(n,e.effectiveSampleRate)}},H="custom",U=function(n){if(n&&w(n)&&n.name&&c(n.name)){var e={name:n.name,type:"event"};if("metrics"in n&&w(n.metrics)){var t=n.metrics,r={};for(o in t)u(t[o])&&(r[o]=t[o]);e.metrics=r}if("categories"in n&&w(n.categories)){var o,i=n.categories,a={};for(o in i)a[o]=I(i[o]);e.categories=a}return e}},K=function(n){if(n&&w(n)&&n.content&&c(n.content)){var e={content:I(n.content),type:"log",level:"info"};if("level"in n&&(e.level=n.level),"extra"in n&&w(n.extra)){var t,r=n.extra,o={},i={};for(t in r)u(r[t])?o[t]=r[t]:i[t]=I(r[t]);e.metrics=o,e.categories=i}return e}},W=["success","fail","complete"];(ze=F=F||{}).onLaunch="onLaunch",ze.onShow="onShow",ze.onHide="onHide",ze.onError="onError",ze.onPageNotFound="onPageNotFound",ze.onUnhandledRejection="onUnhandledRejection";function G(n){return"[object Object]"===Object.prototype.toString.call(n)}var J=["request","downloadFile","uploadFile"],Y=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],$=y(y([],b([F.onLaunch,F.onShow,F.onHide]),!1),[F.onError,F.onPageNotFound,F.onUnhandledRejection],!1),Q=["attached","onInit"],X=["onLoad","onShow","onReady","onUnload","onHide"],Z="unknown_error_name",nn="__HOOKED__",en=-1;var tn=function(){return Date.now()};function rn(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];if(!S(n))return 0;var r,o=tn();try{n.apply(this,e)}finally{r=tn()}return r-o}function on(t,n){Object.keys(n).forEach(function(e){n[e].addTearDown(function(){var n;return En(t,((n={})[e]=null,n))})})}function an(n,e){e.addTearDown(function(){return Sn(n,null)})}function un(n){return Pn("http")[n]}function cn(){return Pn("setData")}function sn(){return!!Pn("performance")}function fn(){return Pn("instance")}var pn,ln=function(){},dn=b((pn="tt",[function(){return pn},function(n){return pn=n}]),2),mn=dn[0],hn=dn[1],vn=function(e,t){function n(n){return t(n),e.call(this,n)}for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},gn=function(n,e,r){var o=n[e];if(!o||!o[nn])return Object.defineProperty(n,e,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{var t=r.apply(this,n);t&&(n=t)}catch(n){j(n)}return o.apply(this,n)}}),n[e]&&(n[e][nn]=!0),function(){n[e][nn]=!1,r=ln}},bn=function(){var n={instance:null};return n.instance||("undefined"!=typeof tt?n={instance:tt,platform:mn()}:"undefined"!=typeof my?n={instance:my,platform:"my"}:"undefined"!=typeof swan?n={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(n={instance:wx,platform:"wx"})),n},yn="__slardar__global__0.2.3-alpha.0",_n={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},wn=function(n,e){void 0===n&&(n={});var t=(e=void 0===e?bn().instance:e)?e[yn]||(e[yn]=n):n;return{setGlobalValue:function(n,e){t[n]=e},mergeGlobalValue:function(n,e){t[n]=m(m({},t[n]),e)},getGlobalValue:function(n){return t[n]},getGlobalEntirely:function(){return t},destroy:function(){t=m({},_n),e&&(e[yn]=t)}}}(m({},_n)),Sn=wn.setGlobalValue,En=wn.mergeGlobalValue,Pn=wn.getGlobalValue,xn=function(n){return Pn("app")[n]},kn=function(n){return Pn("page")[n]},In=function(n){return Pn("route")[n]},jn=function(n){return!!Pn("route")[n]},On=function(t){Y.forEach(function(e){jn(e)&&In(e).subscribe(function(n){return t(n,e)})})},Cn=function(n){return!!Pn("http")[n]},Tn=function(n){En("http",n),on("http",n)},Dn=function(){return Pn("performance")},Rn=function(n){return Pn("component")[n]},An=function(n){Sn("instance",n)};function Nn(n){return"function"==typeof n}function Mn(n,e){!n||0<=(e=n.indexOf(e))&&n.splice(e,1)}function Vn(n){return n}function Ln(t){return function(n){if((e=n)&&Nn(e.lift))return n.lift(function(n){try{return t(n,this)}catch(n){this.error(n)}});var e;throw new TypeError("Unable to lift unknown Observable type")}}function qn(n){Nn(n)?n():null!=n&&n.unsubscribe()}var Bn=function(n){return n instanceof Fn||n&&"closed"in n&&Nn(n.remove)&&Nn(n.add)&&Nn(n.unsubscribe)},Fn=(zn.prototype.unsubscribe=function(){var n,e,t,r=this;this.closed||(this.closed=!0,n=this._parentage,e=this._finalizers,t=this.initialTeardown,n&&(this._parentage=null,n.forEach(function(n){return n.remove(r)})),Nn(t)&&t(),e&&(this._finalizers=null,e.forEach(qn)))},zn.prototype.remove=function(n){this._finalizers&&Mn(this._finalizers,n),n instanceof zn&&n._removeParent(this)},zn.prototype.add=function(n){if(n&&n!==this)if(this.closed)qn(n);else{if(n instanceof zn){if(n.closed||n._hasParent(this))return;n._addParent(this)}var e=this._finalizers;this._finalizers=e?(e.push(n),e):[n]}},zn.prototype._addParent=function(n){var e=this._parentage;this._parentage=e?(e.push(n),e):[n]},zn.prototype._hasParent=function(n){return this._parentage&&~this._parentage.indexOf(n)},zn.prototype._removeParent=function(n){this._parentage&&Mn(this._parentage,n)},zn);function zn(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}var Hn,Un=(e(Kn,Hn=Fn),Kn.prototype.next=function(n){this.isStopped||this.destination.next(n)},Kn.prototype.error=function(n){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(n)}finally{this.unsubscribe()}}},Kn.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Kn.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Hn.prototype.unsubscribe.call(this),this.destination=null)},Kn.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Kn);function Kn(n){var e=Hn.call(this)||this;return e.isStopped=!1,e.destination=Jn(n)?n:new Wn(!(n=n)||Nn(n)?{next:null!=n?n:void 0}:n),e}var Wn=(Gn.prototype.next=function(n){var e=this.partialObserver;if(e.next)try{e.next(n)}catch(n){console.error("ConsumerObserver.next error",n)}},Gn.prototype.error=function(n){var e=this.partialObserver;if(e.error)try{e.error(n)}catch(n){console.error("ConsumerObserver.error error",n)}},Gn.prototype.complete=function(){var n=this.partialObserver;if(n.complete)try{n.complete()}catch(n){console.error("ConsumerObserver.complete error",n)}},Gn);function Gn(n){this.partialObserver=n}function Jn(n){return n instanceof Un||n&&((e=n)&&Nn(e.next)&&Nn(e.error)&&Nn(e.complete))&&Bn(n);var e}var Yn=($n.prototype.subscribe=function(n){var e=Jn(n)?n:new Un(n),t=this.operator,n=this.source;return e.add(t?t.call(e,n):this._trySubscribe(e)),e},$n.prototype.lift=function(n){var e=new $n;return e.source=this,e.operator=n,e},$n.prototype.pipe=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return(0===(e=n).length?Vn:1===e.length?e[0]:function(n){return e.reduce(function(n,e){return e(n)},n)})(this)},$n.prototype._subscribe=function(n){},$n.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},$n);function $n(n){n&&(this._subscribe=n)}var Qn,Xn=(e(Zn,Qn=Yn),Zn.prototype.next=function(e){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(n){return n.next(e)})},Zn.prototype.commonJudgement=function(n){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,n())},Zn.prototype.error=function(e){var t=this;this.commonJudgement(function(){var n=t.observers;for(t.hasError=!0,t.thrownError=e;n.length;)n.shift().error(e)})},Object.defineProperty(Zn.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Zn.prototype.complete=function(){var e=this;this.commonJudgement(function(){for(var n=e.observers;n.length;)n.shift().complete()})},Zn.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Zn.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Zn.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},Zn.prototype._checkFinalizedStatuses=function(n){var e=this.hasError,t=this.thrownError,r=this.isStopped;e?n.error(t):r&&n.complete()},Zn.prototype._innerSubscribe=function(n){var e=this.isStopped,t=this.observers;return e?Zn.EMPTY:(t.push(n),new Fn(function(){Mn(t,n)}))},Zn.EMPTY=((We=new Fn).closed=!0,We),Zn);function Zn(){var n=null!==Qn&&Qn.apply(this,arguments)||this;return n.closed=!1,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}var ne=new Yn(function(n){return n.complete()});function ee(r){return r<=0?function(){return ne}:Ln(function(n,e){var t=0;n.subscribe(function(n){++t<=r&&(e.next(n),r<=t&&e.complete())})})}function te(r,o){return Ln(function(n,e){var t=0;n.subscribe(function(n){return r.call(o,n,t++)&&e.next(n)})})}function re(t){return te(function(n,e){return t<=e})}var oe,ie=(e(ae,oe=Xn),ae.prototype.subscribe=function(n){var t=this,n=oe.prototype.subscribe.call(this,n);fn()&&fn()._subscriptions.push(n);var r=n.unsubscribe;return n.unsubscribe=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];r.apply(this,n),t.observed||t.unsubscribe()},n},ae.prototype.unsubscribe=function(){oe.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(n){return n()})},ae.prototype.addTearDown=function(n){this.tearDownFns.push(n)},ae);function ae(){var n=null!==oe&&oe.apply(this,arguments)||this;return n.tearDownFns=[],n}function ue(n){return 1<n.length?n:n.length&&n[0]||{}}function ce(n){var t=n.filter(function(n){return n=n,!!!Pn("app")[n]}),n=Te(t).subjectMap;En("app",n=n),on("app",n),App=vn(App,function(e){t.forEach(function(n){var r=xn(n),n=s(e,n,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];r.next({that:this,param:ue(n),time:tn()}),S(t)&&t.apply(this,n)}})();n&&r.addTearDown(n)})})}function se(n){return"SLARDAR"+n}function fe(n){return n.route||n.__route__||n.url||n.path||""}function pe(t){return{instance:t=void 0===t?bn().instance:t,request:function(n){return t.request(n)},getStorage:function(n){return t.getStorageSync(n)},setStorage:function(n,e){return t.setStorageSync(n,e)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(n){return n},monitorNetworkType:function(e){t.getNetworkType({success:function(n){e&&e({networkType:n.networkType})}}),t.onNetworkStatusChange(function(n){e&&e({networkType:n.networkType})})},performanceSubscriber:v,getSystemInfo:v,buildRequestProfile:v,componentSubject:v,setDataSubject:v,pagePerfSubscriber:v}}function le(n){function e(n,i){r.forEach(function(o){s(n,o,function(r){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];Rn(o).next({that:this,param:null,time:tn()});var t=i[o];if(S(t)&&t.apply(this,n),S(r))return r.apply(this,n)}})()})}var t=["attached"],r=n.filter(function(n){return~t.indexOf(n)});try{Component=vn(Component,function(n){w(n.lifetimes)?e(n.lifetimes,n):void 0!==n.lifetimes&&null!==n.lifetimes||(n.lifetimes={},e(n.lifetimes,n))})}catch(n){}}function de(n){function e(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(n(m({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;On(function(n,e){"invoke"===n.param.name&&(o=!1,r={navigate_start:n.time,navigate_name:e})}),kn("onLoad").pipe(re(1)).subscribe(function(n){r.load_start=n.time}),kn("onShow").pipe(re(1)).subscribe(function(n){r.dom_end=n.time}),kn("onReady").pipe(re(1)).subscribe(function(n){r.render_end=n.time,e(),t()}),xn(F.onHide).subscribe(function(){!1===o&&(e(),t())})}function me(e){var t=["downloadPackage","evaluateScript","fcp","fp","fr"];Dn().subscribe(function(n){~t.indexOf(n.name)&&e(n)})}function he(e){Rn("attached").subscribe(function(n){n=n.that;return e.call(n)})}function ve(n){return"android"===n.toLowerCase()}function ge(){var n=wx.getAccountInfoSync().miniProgram,e=(l=wx.getSystemInfoSync()).model,t=l.brand,r=l.pixelRatio,o=l.screenHeight,i=l.screenWidth,a=l.windowHeight,u=l.windowWidth,c=l.language,s=l.version,f=l.system,p=l.platform,l=l.SDKVersion;return{model:e,brand:t,pixelRatio:r,screenArea:qe({width:i,height:o}),windowArea:qe({width:u,height:a}),language:c,osName:Le(p),osVersion:f,SDKVersion:l,appId:n.appId,miniEnv:n.envVersion,miniVersion:n.version,hostName:"wx",hostVersion:s,platform:"wx"}}function be(n){return(c(n)?He:Fe)(n)}function ye(n){void 0===n&&(n="tt");var e,t="",r="",o="";return tt.getEnvInfoSync?(r=(e=tt.getEnvInfoSync().microapp).envType,t=e.appId,o=e.mpVersion):(r=tt.env.VERSION,t=""),m({appId:t,miniEnv:r,miniVersion:o,platform:n},Ue())}function _e(e){var n=kn("onReady").subscribe(function(){var n;tt.performance&&(n=(tt.performance.getCurrentPageEntries()||[]).map(function(n){n.name,n.entryType;var e=h(n,["name","entryType"]),t=Ke(n);return t?m(m({},e),t):n}),e(n))});return{disconnect:function(){return n.unsubscribe()}}}function we(){var n="",e="",t="";my.getAccountInfoSync?(d=my.getAccountInfoSync().miniProgram,e=d.envVersion,n=d.appId,t=d.version):(n=my.getAppIdSync().appId,my.getRunScene({success:function(n){e=n.envVersion}}));var r=(m=my.getSystemInfoSync()).model,o=m.brand,i=m.pixelRatio,a=m.screenHeight,u=m.screenWidth,c=m.windowHeight,s=m.windowWidth,f=m.language,p=m.version,l=m.system,d=m.platform,m=m.app;return{model:r,brand:o,pixelRatio:i,screenArea:qe({pixelRatio:i,width:u,height:a,systemPlatform:d}),windowArea:qe({width:s,height:c}),language:f,osName:Le(d),osVersion:l,SDKVersion:my.SDKVersion,appId:n,miniEnv:e,miniVersion:t,hostName:m,hostVersion:p,platform:"my"}}function Se(n){return n&&function(n){switch(Object.prototype.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return 1;default:return n instanceof Error}}(n)?{name:n.name,message:n.message,stack:n.stack}:Fe(n)}function Ee(){var n="",e="";swan.getEnvInfoSync&&(e=(d=swan.getEnvInfoSync()).env,n=d.appKey);var t=(m=swan.getSystemInfoSync()).model,r=m.brand,o=m.pixelRatio,i=m.screenHeight,a=m.screenWidth,u=m.windowHeight,c=m.windowWidth,s=m.language,f=m.version,p=m.system,l=m.platform,d=m.SDKVersion,m=m.host;return{model:t,brand:r,pixelRatio:o,screenArea:qe({width:a,height:i}),windowArea:qe({width:c,height:u}),language:s,osName:Le(l),osVersion:p,SDKVersion:d,appId:n,miniEnv:e,miniVersion:"",hostName:m,hostVersion:f,platform:"swan"}}function Pe(){return m({appId:"",miniEnv:"",miniVersion:"",platform:Ge},Ue())}function xe(n){var e=n.filter(function(n){return n=n,!!!Pn("component")[n]}),n=Te(e).subjectMap;En("component",n=n),on("component",n),Ae().componentSubject(e)}function ke(e){function n(n){G(n.methods)?e(n.methods):void 0!==n.methods&&null!==n.methods||(n.methods={},e(n.methods))}try{Component=vn(Component,n),Behavior=vn(Behavior,n)}catch(n){}}function Ie(n,e){var t=n.filter(function(n){return n=n,!!!Pn("page")[n]}),n=Te(t).subjectMap;En("page",n=n),on("page",n),n=function(e){t.forEach(function(n){var r=kn(n),n=s(e,n,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(fe(this)&&r.next({that:this,param:ue(n),time:tn()}),S(t))return t.apply(this,n)}})();n&&r.addTearDown(n)})},Page=vn(Page,n),ke(n)}function je(n){var e=n.filter(function(n){return!jn(n)}),t=Te(e).subjectMap;En("route",n=t),on("route",n),e.forEach(function(i){var n=gn(Ae().instance,i,function(o){void 0===o&&(o={}),In(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:tn()}),W.forEach(function(r){s(o,r,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];In(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:ue(n)||{}},time:tn()}),S(t)&&t.apply(this,n)}})()})});n&&t[i].addTearDown(n)})}function Oe(n,t){void 0===t&&(t=Ae().instance);var n=n.filter(function(n){return!Cn(n)}),r=Te(n).subjectMap;Tn(r),n.forEach(function(e){var n=gn(t,e,function(n){Qe(e,n)});n&&r[e].addTearDown(n)})}var Ce,Te=function(n){var e=n.reduce(function(n,e){return n[e]=new ie,n},{});return{getSubject:function(n){return e[n]},subjectMap:e}},De=b((Ce={},[function(n){if(!bn().platform)throw Error("Not support current Mini Program");if(!Array.isArray(n)||!n.length)return null;n=n.find(function(n){return n.platform===bn().platform});return n&&(Ce=n.adapterCtor())},function(){return Ce}]),2),Re=De[0],Ae=De[1],Ne=function(n){n=se(n);return!!Ae().getStorage(n)},Me=["darwin","macs","mac"],Ve=["windows_nt","windows","window"],Le=function(n){return ve(n)?"Android":"ios"===n.toLowerCase()?"iOS":~Me.indexOf(n.toLowerCase())?"Mac":~Ve.indexOf(n.toLowerCase())?"windows":"unknown"},qe=function(n){var e=n.systemPlatform,t=n.pixelRatio,r=n.width,n=n.height;return e&&ve(e)&&t?r/t+" * "+n/t:r+" * "+n},Be=function(n){return function(n){var e,t={};for(e in n)Object.prototype.hasOwnProperty.call(n,e)&&void 0!==n[e]&&null!==n[e]&&(t[e]=n[e]);return t}({domainLookupStart:n.domainLookupStart,domainLookupEnd:n.domainLookupEnd,connectStart:n.connectStart,secureConnectionStart:n.SSLconnectionStart,connectEnd:n.connectEnd,requestStart:n.requestStart,requestEnd:n.requestEnd,responseStart:n.responseStart,responseEnd:n.responseEnd,socketReused:n.socketReused,redirectStart:n.redirectStart,redirectEnd:n.redirectEnd,fetchStart:n.fetchStart,sendBytesCount:n.sendBytesCount,throughputKbps:n.throughputKbps,receivedBytedCount:n.receivedBytedCount})},Fe=function(n){return{name:Z,message:I(n)}},ze={platform:"wx",adapterCtor:function(){return m(m({},pe()),{miniPlatform:"wx",buildError:function(n){return(c(n)?function(n){n=n.split("\n");return{name:b((n[2]&&n[2].split(":")||[]).map(function(n){return n.trim()}),1)[0],message:n&&n[1]&&n[1].trim(),stack:n.slice(2).join("\n")}}:Fe)(n)},getSystemInfo:ge,observePerformance:function(e){var n=wx.getPerformance&&wx.getPerformance();if(n){n=n.createObserver(function(n){n=n.getEntries().map(function(n){return m(m({},n),{name:function(n){switch(n){case"appLaunch":return"appClick";case"firstRender":return"fr";case"firstPaint":return"fp";case"firstContentfulPaint":return"fcp";case"largestContentfulPaint":return"lcp";default:return n}}(n.name)})});e(n)});return n.observe({entryTypes:n.supportedEntryTypes}),n}},performanceSubscriber:me,buildRequestProfile:function(n){return n=Be(e=n),e.protocol&&(n.protocol=e.protocol),n;var e},componentSubject:le,pagePerfSubscriber:de,setDataSubject:he})}},He=function(n){var e=n.split("\n"),e=b((e[0]&&e[0].split(":")||[]).map(function(n){return n.trim()}),2);return{name:e[0],message:e[1],stack:n}},Ue=function(){var n=tt.getSystemInfoSync(),e=n.model,t=n.brand,r=n.pixelRatio,o=n.screenHeight,i=n.screenWidth,a=n.windowHeight,u=n.windowWidth,c=n.language,s=n.version,f=n.system,p=n.platform,l=n.SDKVersion,n=n.appName;return{model:e,brand:t,pixelRatio:r,screenArea:qe({width:i,height:o}),windowArea:qe({width:u,height:a}),language:c,osName:Le(p),osVersion:f,SDKVersion:l,hostName:n,hostVersion:s}},Ke=function(n){if("navigation"===n.entryType)return{name:"route",entryType:"navigation",path:n.name};switch(n.name){case"app-click":return{name:"appClick",entryType:"navigation"};case"miniprogram-package\t":return{name:"downloadPackage",entryType:"loadPackage"};case"first-paint":return{name:"fp",entryType:"render"};default:return null}},dn={platform:"tt",adapterCtor:function(){return m(m({},pe()),{miniPlatform:"tt",buildError:be,getSystemInfo:ye,observePerformance:_e,performanceSubscriber:me,buildRequestProfile:function(n){return Be(n)},componentSubject:le,pagePerfSubscriber:de,setDataSubject:he})}},wn={platform:"my",adapterCtor:function(){return m(m({},pe()),{miniPlatform:"my",buildError:function(n){return a(n)?function(n,e){n={message:n};return!e||(e=b((e=(n.stack=e).split("\n"))[0]&&e[0].split(":"),1)[0])&&(n.name=e),n}(n[0],n[1]):Fe(n)},setStorage:function(n,e){return my.setStorageSync({key:n,data:e})},getStorage:function(n){return my.getStorageSync({key:n}).data},getSystemInfo:we,componentSubject:function(n){var e=["onInit"],t=n.filter(function(n){return~e.indexOf(n)}),r=function(n){t.forEach(function(r){s(n,r,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(Rn(r).next({that:this,param:null,time:tn()}),S(t))return t.apply(this,n)}})()})};Component=vn(Component,function(n){w(n)?r(n):null==n&&r(n={})})},setDataSubject:function(e){Rn("onInit").subscribe(function(n){n=n.that;return e.call(n)})},pagePerfSubscriber:de})}},We={platform:"swan",adapterCtor:function(){return m(m({},pe()),{miniPlatform:"swan",buildError:Se,getSystemInfo:Ee,componentSubject:le,setDataSubject:he,pagePerfSubscriber:function(e){function t(n){n.navigate_name=n.navigate_name||"native",n.load_start=n.load_start||0,n.dom_end=n.dom_end||0,n.render_end=n.render_end||0,n.navigate_start&&0!==n.load_start&&(e(m({},n)),n.load_start=0,i=!0)}var r={},o={},i=!1,a=!0;On(function(n,e){"invoke"===n.param.name&&(i=!1,r={navigate_start:n.time,navigate_name:e},o={navigate_start:n.time,navigate_name:e})}),kn("onLoad").pipe(re(1)).subscribe(function(n){n.that.componentName?o.dom_end=n.time:r.load_start=n.time}),kn("onShow").pipe(re(1)).subscribe(function(n){n.that.componentName?(o.load_start=n.time,r.load_start=0):r.dom_end=n.time}),kn("onReady").pipe(re(1)).subscribe(function(n){n.that.componentName?a?a=!1:(o.render_end=n.time,t(o)):(r.render_end=n.time,t(r),a=!1)}),xn(F.onHide).subscribe(function(){i||(t(r),t(o))})}})}},Ge="lark",Yn={platform:Ge,adapterCtor:function(){return m(m({},pe()),{miniPlatform:Ge,buildError:be,getSystemInfo:Pe,componentSubject:le,pagePerfSubscriber:de,setDataSubject:he})}},Je="mars",Xn={platform:Je,adapterCtor:function(){return m(m({},pe()),{miniPlatform:Je,buildError:be,getSystemInfo:ye.bind(null,Je),observePerformance:_e,performanceSubscriber:me,componentSubject:le,pagePerfSubscriber:de,setDataSubject:he})}},Ye=function(n){n.on("init",function(){ce($),Ie(X),xe(Q)})},$e=function(n){n.on("init",function(){je(Y)})},Qe=function(u,n){var e=n.url,t=n.method,r=n.data,o=n.header,i=n.headers,c={api:u,request:{url:e,method:(e=t,"uploadFile"===(t=u)?"POST":"downloadFile"!==t&&e||"GET"),headers:o||i||{},body:I(r),timestamp:tn()},response:{}};s(n,"complete",function(a){return function(n){var e=c.response.timestamp||tn();c.duration=e-c.request.timestamp,c.completeCallbackTime=rn(a,n);var t,r,o,i=n.errMsg||n.errorMessage||n.error;c.response={status:(t=n.status,r=n.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:e,headers:n.header||n.headers||{},body:I(n.data),errMsg:i,timing:Ae().buildRequestProfile(n.profile||{})},un(u).next(c)}})(),s(n,"success",function(e){return function(n){c.response.timestamp=tn(),c.response.status=200,c.successCallbackTime=rn(e,n)}})(),s(n,"fail",function(e){return function(n){c.response.timestamp=tn(),c.response.status=-1,c.failCallbackTime=rn(e,n)}})()},Xe=function(n,e){void 0===e&&(e=J),n.on("init",function(){Oe(e)})};function Ze(){var a=fe(this),u=cn();var n=gn(this,"setData",function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=r[0],i=tn();return[o,function(){var n=r[1],e=tn()-i;u.next({renderTime:e,url:a,data:o,startTime:i}),n&&n.call(t)}]});n&&u.addTearDown(n)}function nt(){var n;Pn("setData")||(n=(n=Te(["setData"]).getSubject)("setData"),Sn("setData",n),an("setData",n))}function et(o){return Object.keys(o).reduce(function(n,e){var t,r;return r=o[t=e],t&&r&&(it.test(t)||at.test(r))||(n[e]=o[e]),n},{})}var rt=function(n){n.on("init",function(){nt(),kn("onLoad").subscribe(function(n){n=n.that;Ze.call(n)}),Ae().setDataSubject(Ze)})},ot=function(n){n.on("init",function(){var e,n,t,r=Ae();r.observePerformance&&!sn()&&(e=(0,Te(["performance"]).getSubject)("performance"),Sn("performance",n=e),an("performance",n),(t=r.observePerformance(function(n){n.forEach(function(n){e.next(n)})}))&&t.disconnect&&e.addTearDown(function(){return t.disconnect()}))})},it=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),at=new RegExp("(bearer|session)","i"),ut=function(){return function(n,s){var e=n.hookRequest,t=n.hookDownloadFile,r=n.hookUploadFile,f=n.ignoreUrls,p=n.collectBodyOnError,l=n.extraExtractor,n=function(n){var e,t,r,o,i,a,u,c;!function(n,e){n=k(n||[]);return!!n&&n.test(e)}(f,n.request.url)&&(c=n.response,e=n.request,t=n.api,r=n.duration,o=n.failCallbackTime,u=n.successCallbackTime,i=n.completeCallbackTime,e.headers=et(e.headers||{}),c.headers=et(c.headers||{}),a=c.errMsg,n=h(c,["errMsg"]),n=m(m({},n),{is_custom_error:!1}),a&&(n.err_msg=a),u={api:t,request:e,duration:r,cbTime:i+(o||0)+(u||0),response:n},!S(l)||(n=l(c.body,u))&&(u.extra=n,u.response.is_custom_error=!0),p&&(0===(c=c.status)||400<=c)||(delete u.request.body,delete u.response.body),s({ev_type:"http",payload:u}))};e&&un("request").subscribe(n),t&&un("downloadFile").subscribe(n),r&&un("uploadFile").subscribe(n)}},ct=function(n,e,t,r){void 0===e&&(e={}),void 0===r&&(r=[]);try{var o=n.apply(void 0,y([],b(r),!1));return o&&o(e,t)||[]}catch(n){return j("applyMonitor",n),[]}};function st(n,e,t){An(n);e=null===(n=n.config())||void 0===n?void 0:n.plugins[e];return w(e)?m(m({},t),e):!!e&&t}function ft(i){i.on("init",function(){var n,e,t,r,o=st(i,mt,ht);o&&(n=o.hookRequest,e=o.hookDownloadFile,t=o.hookUploadFile,r=[],n&&r.push("request"),e&&r.push("downloadFile"),t&&r.push("uploadFile"),Xe(i,r),ct(ut,o,i.report.bind(i)))})}function pt(n,e){return n&&e&&n===e}function lt(){var r;return function(n){try{if(t=r,!(!(e=n)||!t)&&!(!pt(e.message,t.message)&&!pt(e.stack,t.stack)))return void(r=n)}catch(n){}var e,t;return r=n}}var dt,mt="http",ht={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},vt=function(f){return void 0===f&&(f=Ae()),function(n,r){var e=n.ignoreErrors,t=n.hookOnError,o=n.hookOnUnhandledRejection,i=n.hookRouteError,a=n.dedupe,u=k(e),c=lt(),s=function(n,e,t){n=a?c(n):n;n&&(u&&u.test(n.message)||(n={error:n},e&&(n.extra=e),t&&(n.react=t),r(n)))};t&&xn(F.onError).subscribe(function(n){n=n.param,n=f.buildError(n);u&&u.test(n.message)||s(n)}),o&&xn(F.onUnhandledRejection).subscribe(function(n){var e=n.param||{},n=e.promise,t=I(e.reason);u&&u.test(t)||n.catch(g).then(function(n){var e={name:"UnhandledRejection",message:t};n&&n.stack&&(e.stack=n.stack),s(e)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&On(function(n){n=n.param;"fail"===(n=n).name&&s({name:"RouteError",message:n.value.errMsg})}),[s]}};(De=dt=dt||{}).history="history",De.manual="manual";function gt(t,n,r){var o=n,i=null,a=0,e="launch";function u(n,e){o=e,a=tn(),r(e,i=e+"_"+a),t(n,e)}return xn(F.onShow).pipe(re(1)).subscribe(function(){e="show"}),On(function(){e="history"}),[u,function(n){n&&(u(e,n),e="history")},function(n){void 0===n&&(n="hide"),i&&(r(o,i),i=null,t(n,o,tn()-a))}]}function bt(t){return t.on("init",function(){var n,e=st(t,Dt,Rt);e&&(e=(n=b(ct(kt,m(m({},e),{setPidAndViewId:function(n,e){t.set({pid:n,viewId:e,actionId:void 0})}}),t.report.bind(t)),2))[0],n=n[1],t.provide("sendPageview",e),t.provide("sendPageviewWithHide",n))}),t}function yt(t){t.on("init",function(){var n,e=st(t,At,Nt);e&&(n=Mt(t),n=b(ct(vt,e,n),1)[0],t.provide("captureException",n))})}function _t(t){t.on("init",function(){var n,e=st(t,Lt,Vt);e&&(e=(n=b(ct(It,e,function(n){}),2))[0],n=n[1],t.provide("getBreadcrumbs",e),t.provide("addBreadcrumb",n))})}function wt(e){e.on("init",function(){var n=st(e,qt,Bt);n&&(rt(e),ct(jt,n,e.report.bind(e)))})}function St(e){e.on("init",function(){var n=st(e,Ft,zt);n&&(ot(e),ct(Ot,n,e.report.bind(e)))})}function Et(e){e.on("init",function(){var n=st(e,Ht,Ut);n&&ct(Ct,n,e.report.bind(e))})}function Pt(e){e.on("init",function(){var n=st(e,Kt,Wt);n&&(ot(e),ct(Tt,n,e.report.bind(e)))})}function xt(e){return(e=void 0===e?Ae():e)?{get:function(n){return Gt("GET",n,e)},post:function(n){return Gt("POST",n,e)}}:{get:v,post:v}}var kt=function(){return function(n,r){var e=n.extractPid,t=n.routeMode,o=n.setPidAndViewId,i=function(n){return e?e(n):n},n=b(gt(function(n,e,t){r({ev_type:"pageview",payload:{pid:e,source:n,duration:t}})},"",o),3),o=n[0],a=n[1],n=n[2];return t!==dt.manual&&(kn("onShow").subscribe(function(n){return function(n){n=fe(n),n=i(n);a(n)}(n.that)}),kn("onUnload").subscribe(n.bind(null,"unload")),kn("onHide").subscribe(n.bind(null,"hide"))),[o.bind(null,"user_set"),n]}},It=function(){return function(n){var e=b(function(e,t,r){void 0===e&&(e=20),void 0===t&&(t=g),void 0===r&&(r=function(n,e){return n.slice(-e)});var o=[];return[function(){return o},function(n){t(n)&&(n=m(m({},n),{timestamp:n.timestamp||Date.now()}),o=0<=e&&o.length+1>e?r(y(y([],b(o),!1),[n],!1),e):y(y([],b(o),!1),[n],!1))}]}(n.maxBreadcrumbs,n.onAddBreadcrumb,n.onMaxBreadcrumbs),2),n=e[0],r=e[1];return J.forEach(function(n){Cn(n)&&un(n).subscribe(function(n){r({type:"http",category:n.api,message:"",data:{method:n.request.method,url:n.request.url,status_code:String(n.response.status)},timestamp:n.request.timestamp})})}),On(function(n,e){var t=n.param,n=n.time;"complete"===t.name&&r({type:"route",category:e,message:t.value.errMsg||t.value.errorMessage||"",timestamp:n,data:{url:t.url||""}})}),[n,r]}},jt=function(){return function(n,t){var r=n.isCalculateSize;cn().subscribe(function(n){var e={duration:n.renderTime,start_time:n.startTime};r&&(e.size=(n=n.data,TextEncoder?(new TextEncoder).encode(I(n)).length:2*I(n).length)),t({ev_type:"set_data",payload:e})})}},Ot=function(){return function(n,e){function t(){e({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;xn(F.onLaunch).pipe(ee(1)).subscribe(function(n){r.activate_start=n.time}),xn(F.onShow).pipe(ee(1)).subscribe(function(n){r.init_end=n.time}),kn("onLoad").pipe(ee(1)).subscribe(function(n){r.page_load_start=n.time}),kn("onShow").pipe(ee(1)).subscribe(function(n){r.page_dom_end=n.time});var i=sn();kn("onReady").pipe(ee(1)).subscribe(function(n){r.page_render_end=n.time,i&&!r.trigger||t()}),i&&Dn().pipe(te(function(n){return"appClick"===n.name}),ee(1)).subscribe(function(n){r.trigger=n.startTime,r.page_render_end&&t()}),xn(F.onHide).subscribe(function(){o||t()})}},Ct=function(){return function(n,e){Ae().pagePerfSubscriber(function(n){return e({ev_type:"page_perf",payload:n})})}},Tt=function(e){return void 0===e&&(e=Ae()),function(n,t){var r,o;sn()&&e.performanceSubscriber&&(r=0,kn("onLoad").subscribe(function(n){o=n.time,r++}),e.performanceSubscriber(function(n){var e={is_custom:!1,name:n.name,value:n.startTime,type:"perf",count:r};e.duration=n.duration||(o?n.startTime-o:0),e.is_support=0<=e.duration,t({ev_type:"performance",payload:e})}))}},Dt="pageview",Rt={routeMode:dt.history,setPidAndViewId:function(n,e){}},At="jsError",Nt={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},Mt=function(t){return function(n){var e=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:m(m({},n),{breadcrumbs:e})})}},Vt={maxBreadcrumbs:20,tap:!0},Lt="breadcrumb",qt="setData",Bt={isCalculateSize:!1},Ft="appLaunchPerf",zt={},Ht="pagePerf",Ut={},Kt="performance",Wt={},Gt=function(n,e,t){void 0===t&&(t=Ae());var r=e.url,o=e.data,i=e.success,a=void 0===i?v:i,u=e.fail,c=void 0===u?v:u,i=e.header,u={"Content-Type":"application/json"};G(e=i)&&0!==Object.keys(e).length&&Object.assign(u,i),t.request({method:n,url:r,data:o,header:u,headers:u,success:function(n){a(n)},fail:function(n){n=n.errMsg||"Network request failed";c(new Error(n))}})};function Jt(n){return o=(t=n).transport,i=n.endpoint,a=n.size,u=void 0===a?l:a,c=void 0===(t=n.wait)?d:t,s=[],f=0,{getSize:function(){return u},getWait:function(){return c},setSize:function(n){u=n},setWait:function(n){c=n},getEndpoint:function(){return i},setEndpoint:function(n){i=n},send:function(n){s.push(n),s.length>=u&&e.call(this),clearTimeout(f),f=setTimeout(e.bind(this),c)},flush:function(){clearTimeout(f),e.call(this)},getBatchData:function(){return s.length?p(s):""},clear:function(){clearTimeout(f),s=[]},fail:function(n){r=n}};function e(){var e;s.length&&(e=this.getBatchData(),o.post({url:i,data:e,fail:function(n){r&&r(n,e)}}),s=[])}var t,r,o,i,a,u,c,s,f}function Yt(n,e){return void 0===e&&(e=Xt),(n&&0<=n.indexOf("//")?"":"https://")+n+e}var $t={build:function(n){return{ev_type:n.ev_type,payload:n.payload,common:m(m({},n.extra||{}),n.overrides||{})}}},Qt="/monitor_mini/collect",Xt="/settings/minipro",Zt="apmplus.volces.com",nr="session",er={sample_rate:1,include_users:[],sample_granularity:nr,rules:{}},tr=[Qt,Xt],rr="0.2.3-alpha.0",or="APM_PLUS_MINI_PROGRAM",ir=function(n){n=function(n){try{return Ae().getStorage(n)}catch(n){return}}(se(String(n)));return n&&n.userId&&n.deviceId?n:{userId:A(),deviceId:A()}},ar=function(n){return n+"_"+Date.now()},ur=function(n){var e=n.aid,t=n.userId,n=n.deviceId;!function(n,e){try{Ae().setStorage(n,e)}catch(n){}}(se(String(e)),{userId:t,deviceId:n})};function cr(n){n=ir(n.aid);return{aid:0,token:"",pid:"",viewId:ar("_"),userId:n.userId,deviceId:n.deviceId,sessionId:A(),domain:Zt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:tr},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:er,sdkName:or,sdkVersion:rr}}function sr(n){var e,t=n.plugins||{};for(e in t)t[e]&&!w(t[e])&&(t[e]={});return m(m({},n),{plugins:t})}function fr(n){return w(n)&&"aid"in n&&"token"in n}function pr(n){return m({},n)}function lr(e){var r,o,i=e,a={},u=void 0,c=v,t=v;return{getConfig:function(){return i},setConfig:function(n){var e,t;return a=m(m({},a),n||{}),s(),r||(r=n,i.useLocalConfig||!i.aid?(o={},c()):u?f():(e=i.domain,n=i.aid,t=function(n){u=n,f()},xt().get({url:Yt(e)+"?biz_id="+n,success:function(n){t(n&&n.data&&n.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(n){t=n},onReady:function(n){c=function(){ur(i),n()},o&&c()}};function s(){var n=m(m(m({},e),o||{}),a);n.plugins=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t={},r=0;r<n.length;)t=E(t,n[r++]);return t}(e.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),n.sample=dr(dr(e.sample,null==o?void 0:o.sample),a.sample),i=n,t()}function f(){o=function(n){if(!n)return{};var e=n.sample,t=n.user_id,r=n.timestamp,o=t?{userId:t}:{};if(!e)return o;var i=e.sample_rate,n=e.sample_granularity,t=void 0===n?nr:n,n=e.include_users,e=e.rules,e=void 0===e?[]:e;return m(m({},o),{sample:{include_users:n,sample_rate:i,sample_granularity:t,rules:e.reduce(function(n,e){var t=e.name,r=e.enable,o=e.sample_rate,e=e.conditional_sample_rules;return n[t]={enable:r,sample_rate:o,conditional_sample_rules:e},n},{})},serverTimestamp:r})}(u),Ne(String(i.aid))&&(o.userId=e.userId),s(),c()}}function dr(r,o){if(!r||!o)return r||o;var n=m(m({},r),o);return n.include_users=y(y([],b(r.include_users||[]),!1),b(o.include_users||[]),!1),n.rules=y(y([],b(Object.keys(r.rules||{})),!1),b(Object.keys(o.rules||{})),!1).reduce(function(n,e){var t;return e in n||(e in(r.rules||{})&&e in(o.rules||{})?(n[e]=m(m({},r.rules[e]),o.rules[e]),n[e].conditional_sample_rules=y(y([],b(r.rules[e].conditional_sample_rules||[]),!1),b(o.rules[e].conditional_sample_rules||[]),!1)):n[e]=(null===(t=r.rules)||void 0===t?void 0:t[e])||(null===(t=o.rules)||void 0===t?void 0:t[e])),n},{}),n}function mr(e){function t(n){return void 0===n&&(n=Ae().getSystemInfo()),e.set(m({},n))}function r(){t(),n()}var o=!1,n=vr(e);e.on("start",function(){r(),o=!0}),e.on("init",function(){xn(F.onLaunch).pipe(ee(1)).subscribe(function(n){n=n.param.scene||en;t({scene:n}),o&&r()}),Ae().monitorNetworkType(function(n){n=n.networkType;e.set({networkType:n})})})}function hr(n){if(!Re(n))throw Error("Adapters imported incorrectly");var t,r,o,e,i,a,u,c,n=function(n){var t,r,e=n.builder,o=n.createSender,i=n.createDefaultConfig,a=n.createConfigManager,u=n.userConfigNormalizer,c=n.initConfigNormalizer,s=n.validateInitConfig,f={};_.forEach(function(n){return f[n]=[]});var p=!1,l=!1,d=!1,m=[],h=[],v={getBuilder:function(){return e},getSender:function(){return t},getPreStartQueue:function(){return m},init:function(n){if(p)C("already inited");else{if(!(n&&w(n)&&s(n)))throw new Error("invalid InitConfig, init failed");var e=i(n);if(!e)throw new Error("defaultConfig missing");n=c(n);if((r=a(e)).setConfig(n),r.onChange(function(){g("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");g("init",p=!0)}},set:function(n){p&&n&&w(n)&&(g("beforeConfig",!1,n),null!=r&&r.setConfig(n))},config:function(n){if(p)return n&&w(n)&&(g("beforeConfig",!1,n),null!=r&&r.setConfig(u(n))),null==r?void 0:r.getConfig()},provide:function(n,e){P(h,n)?C("cannot provide "+n+", reserved"):(v[n]=e,g("provide",!1,n))},start:function(){var e=this;p&&(l||null!=r&&r.onReady(function(){g("start",l=!0),m.forEach(function(n){return e.build(n)}),m=[]}))},report:function(n){n&&(!(n=R(f.beforeReport)(n))||(n=R(f.report)(n))&&(l?this.build(n):m.push(n)))},build:function(n){!l||(n=R(f.beforeBuild)(n))&&(!(n=e.build(n))||(n=R(f.build)(n))&&this.send(n))},send:function(n){!l||(n=R(f.beforeSend)(n))&&(t.send(n),g("send",!1,n))},destroy:function(){g("beforeDestroy",d=!0)},on:function(n,e){"init"===n&&p||"start"===n&&l||"beforeDestroy"===n&&d?e():f[n]&&f[n].push(e)},off:function(n,e){f[n]&&(f[n]=x(f[n],e))}},h=Object.keys(v);return v;function g(n,e){void 0===e&&(e=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[n].forEach(function(n){try{n.apply(void 0,y([],b(t),!1))}catch(n){}}),e&&(f[n].length=0)}}({validateInitConfig:fr,initConfigNormalizer:sr,userConfigNormalizer:pr,createSender:function(n){return Jt({size:20,endpoint:(n=n.domain,void 0===e&&(e=Qt),(n&&0<=n.indexOf("//")?"":"https://")+n+e),transport:xt()});var e},builder:$t,createDefaultConfig:cr,createConfigManager:lr});return N(n),o=!1,(t=n).on("init",function(){r=tn(),t.on("config",function(){var n,e=null===(n=t.config())||void 0===n?void 0:n.serverTimestamp;isNaN(e)||Number(e)<=0||o||(o=!0,(n=tn())-r<yr&&e&&(n=e-(n+r)/2,isNaN(n)||t.set({offset:n})))})}),(e=n).on("beforeBuild",function(n){return gr(n,e.config())}),n.on("report",function(n){return br(n)}),(i=n).on("start",function(){var n=i.config(),e=n.userId,n=n.sample,n=z(e,n,T,D);i.on("build",n)}),(a=n).on("init",function(){a.provide("_subscriptions",[]),An(a),Ye(a),$e(a)}),a.on("beforeDestroy",function(){if(a._subscriptions)for(;a._subscriptions.length;)a._subscriptions.shift().unsubscribe();for(var n in a)delete a[n]}),(u=n).on("init",function(){var e=[],n=u.config();n&&n.integrations&&n.integrations.forEach(function(n){P(e,n.name)||(e.push(n.name),n.setup(u),n.tearDown&&u.on("beforeDestroy",n.tearDown))})}),(c=n).on("init",function(){xn(F.onHide).subscribe(function(){var n=c.getSender();n&&n.flush()})}),mr(n),n}var vr=function(t){var r="";return function(){var n=t.getSender();r=r||n.getEndpoint();var e=t.config(),e={did:e.deviceId,sid:e.sessionId,sname:e.sdkName,sver:e.sdkVersion,soffset:e.offset||0,model:e.model,brand:e.brand,ratio:e.pixelRatio,screen:e.screenArea,window:e.windowArea,lang:e.language,osname:e.osName,osver:e.osVersion,libver:e.SDKVersion,scene:e.scene||en,menv:e.miniEnv,mver:e.miniVersion,hostname:e.hostName,hostver:e.hostVersion,platform:e.platform,biz_id:e.aid,x_auth_token:e.token};n.setEndpoint(r+o(e))}},gr=function(n,e){var t={};return t.aid=e.aid,t.pid=e.pid,t.view_id=e.viewId,t.user_id=e.userId,t.network_type=e.networkType,m(m({},n),{extra:m(m({},t),null!==(n=n.extra)&&void 0!==n?n:{})})},br=function(n){var e,e={url:(e=Ae().getCurrentPages().pop())?(e?fe(e):"")+o(e.options):"",timestamp:tn()};return m(m({},n),{extra:m(m({},e),null!==(n=n.extra)&&void 0!==n?n:{})})},yr=1e3;n.AppLaunchPerfIntegration=function(){return{name:"AppLaunchPerfIntegration",setup:function(n){St(n)}}},n.BreadcrumbIntegration=function(){return{name:"BreadcrumbIntegration",setup:function(n){_t(n)}}},n.CustomIntegration=function(){return{name:"CustomIntegration",setup:function(n){B(n)}}},n.FrameworksAdapterIntegration=function(t){return{name:"FrameworksAdapterIntegration",setup:function(n){var e=t.Taro;e&&"my"===Ae().miniPlatform&&n.on("init",function(){Oe(["request"],e)})}}},n.HttpIntegration=function(){return{name:"HttpIntegration",setup:function(n){ft(n)}}},n.JsErrorIntegration=function(){return{name:"JsErrorIntegration",setup:function(n){yt(n)}}},n.LarkAdapter=Yn,n.MarsAdapter=Xn,n.MyAdapter=wn,n.PagePerfIntegration=function(){return{name:"PagePerfIntegration",setup:function(n){Et(n)}}},n.PageviewIntegration=function(){return{name:"PageviewIntegration",setup:function(n){bt(n)}}},n.PerformanceIntegration=function(){return{name:"PerformanceIntegration",setup:function(n){Pt(n)}}},n.SetDataIntegration=function(){return{name:"SetDataIntegration",setup:function(n){wt(n)}}},n.SwanAdapter=We,n.TtAdapter=dn,n.WxAdapter=ze,n.createBaseMiniProgramClient=hr,n.createMiniProgramClient=function(n){n=hr(n);if(n)return B(n),bt(n),yt(n),ft(n),wt(n),_t(n),St(n),Et(n),Pt(n),n},n.setPlatform=hn,Object.defineProperty(n,"__esModule",{value:!0})}); |
@@ -1,1 +0,1 @@ | ||
function n(n){var e,t=n.transport,r=n.endpoint,o=n.size,i=void 0===o?10:o,a=n.wait,u=void 0===a?1e3:a,c=[],s=0;function f(){if(c.length){var n=this.getBatchData();t.post({url:r,data:n,fail:function(t){e&&e(t,n)}}),c=[]}}return{getSize:function(){return i},getWait:function(){return u},setSize:function(n){i=n},setWait:function(n){u=n},getEndpoint:function(){return r},setEndpoint:function(n){r=n},send:function(n){c.push(n),c.length>=i&&f.call(this),clearTimeout(s),s=setTimeout(f.bind(this),u)},flush:function(){clearTimeout(s),f.call(this)},getBatchData:function(){return c.length?(n=c,JSON.stringify({ev_type:"batch",list:n})):"";var n},clear:function(){clearTimeout(s),c=[]},fail:function(n){e=n}}}var e=function(n,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])},e(n,t)};function t(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var r=function(){return r=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},r.apply(this,arguments)};function o(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(n);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(n,r[o])&&(t[r[o]]=n[r[o]])}return t}function i(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(n){o={error:n}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function a(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}var u=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],c=function(){return{}};function s(n){return n}function f(n){return"object"==typeof n&&null!==n}var l=Object.prototype;function p(n){if(f(n)){if("function"==typeof Object.getPrototypeOf){var e=Object.getPrototypeOf(n);return e===l||null===e}return"[object Object]"===l.toString.call(n)}return!1}function d(n){return"[object Array]"===l.toString.call(n)}function m(n){return"function"==typeof n}function v(n){return"number"==typeof n}function h(n){return"string"==typeof n}function g(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function b(n,e){var t=r({},n);for(var o in e)g(e,o)&&void 0!==e[o]&&(f(e[o])&&p(e[o])?t[o]=b(f(n[o])?n[o]:{},e[o]):d(e[o])&&d(n[o])?t[o]=y(n[o],e[o]):t[o]=e[o]);return t}function y(n,e){var t=d(n)?n:[],r=d(e)?e:[];return Array.prototype.concat.call(t,r).map((function(n){return n instanceof RegExp?n:f(n)&&p(n)?b({},n):d(n)?y([],n):n}))}function _(n,e){if(!d(n))return!1;if(0===n.length)return!1;for(var t=0;t<n.length;){if(n[t]===e)return!0;t++}return!1}function w(n){return d(n)&&n.length?function(n){for(var e=[],t=n.length,r=0;r<t;r++){var o=n[r];h(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}(n):null}function S(n){try{return h(n)?n:JSON.stringify(n)}catch(n){return"[FAILED_TO_STRINGIFY]:"+String(n)}}var E=function(n){return f(n)?Object.keys(n).reduce((function(e,t){return e+="&"+t+"="+n[t]}),"").replace("&","?"):""};var x=function(n,e,t,r){return void 0===r&&(r=!0),function(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];if(!n)return c;var s=n[e],f=t.apply(void 0,a([s],i(o),!1)),l=f;return m(l)&&r&&(l=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return f.apply(this,n)}catch(e){return m(s)&&s.apply(this,n)}}),n[e]=l,function(t){t||(l===n[e]?n[e]=s:f=s)}}},k=0,P=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.error.apply(console,a(["[SDK]",Date.now(),(""+k++).padStart(8," ")],i(n),!1))},O=0,I=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.warn.apply(console,a(["[SDK]",Date.now(),(""+O++).padStart(8," ")],i(n),!1))},j=function(n){return Math.random()<Number(n)},C=function(n,e){return n<Number(e)},D=function(n){return function(e){for(var t=e,r=0;r<n.length&&t;r++)try{t=n[r](t)}catch(n){P(n)}return t}};function T(){var n=function(){for(var n=new Array(16),e=0,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(n){for(var e=[],t=0;t<256;++t)e[t]=(t+256).toString(16).substr(1);var r=0,o=e;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]]].join("")}(n)}function R(n){var e,t,r=n.builder,o=n.createSender,c=n.createDefaultConfig,s=n.createConfigManager,l=n.userConfigNormalizer,p=n.initConfigNormalizer,m=n.validateInitConfig,v={};u.forEach((function(n){return v[n]=[]}));var h=!1,g=!1,b=!1,y=[],w=[],S={getBuilder:function(){return r},getSender:function(){return e},getPreStartQueue:function(){return y},init:function(n){if(h)I("already inited");else{if(!(n&&f(n)&&m(n)))throw new Error("invalid InitConfig, init failed");var r=c(n);if(!r)throw new Error("defaultConfig missing");var i=p(n);if((t=s(r)).setConfig(i),t.onChange((function(){E("config")})),!(e=o(t.getConfig())))throw new Error("sender missing");h=!0,E("init",!0)}},set:function(n){h&&n&&f(n)&&(E("beforeConfig",!1,n),null==t||t.setConfig(n))},config:function(n){if(h)return n&&f(n)&&(E("beforeConfig",!1,n),null==t||t.setConfig(l(n))),null==t?void 0:t.getConfig()},provide:function(n,e){_(w,n)?I("cannot provide "+n+", reserved"):(S[n]=e,E("provide",!1,n))},start:function(){var n=this;h&&(g||null==t||t.onReady((function(){g=!0,E("start",!0),y.forEach((function(e){return n.build(e)})),y=[]})))},report:function(n){if(n){var e=D(v.beforeReport)(n);if(e){var t=D(v.report)(e);t&&(g?this.build(t):y.push(t))}}},build:function(n){if(g){var e=D(v.beforeBuild)(n);if(e){var t=r.build(e);if(t){var o=D(v.build)(t);o&&this.send(o)}}}},send:function(n){if(g){var t=D(v.beforeSend)(n);t&&(e.send(t),E("send",!1,t))}},destroy:function(){b=!0,E("beforeDestroy",!0)},on:function(n,e){"init"===n&&h||"start"===n&&g||"beforeDestroy"===n&&b?e():v[n]&&v[n].push(e)},off:function(n,e){v[n]&&(v[n]=function(n,e){if(!d(n))return n;var t=n.indexOf(e);if(t>=0){var r=n.slice();return r.splice(t,1),r}return n}(v[n],e))}};return w=Object.keys(S),S;function E(n,e){void 0===e&&(e=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];v[n].forEach((function(n){try{n.apply(void 0,a([],i(t),!1))}catch(n){}})),e&&(v[n].length=0)}}var N=function(n){var e=function(){var n={},e={},t={set:function(r,o){return n[r]=o,e[r]=S(o),t},merge:function(o){return n=r(r({},n),o),Object.keys(o).forEach((function(n){e[n]=S(o[n])})),t},delete:function(r){return delete n[r],delete e[r],t},clear:function(){return n={},e={},t},get:function(n){return e[n]},toString:function(){return r({},e)}};return t}();n.provide("context",e),n.on("report",(function(n){return n.extra||(n.extra={}),n.extra.context=e.toString(),n}))};var V,A=function(n,e){var t=n.common||{};return t.sample_rate=e,n.common=t,n},M=function(n,e,t,r,o){return n?(i=o(r,e),function(){return i}):function(){return t(e)};var i},q=function(n,e,t,r){var o=function(n,e,t){for(var r,o=i(e.split(".")),a=o[0],u=o.slice(1);n&&u.length>0;)n=n[a],a=(r=i(u))[0],u=r.slice(1);if(n)return t(n,a)}(n,e,(function(n,e){return n[e]}));return void 0!==o&&function(n,e,t){switch(t){case"eq":return _(e,n);case"neq":return!_(e,n);case"gt":return n>e[0];case"gte":return n>=e[0];case"lt":return n<e[0];case"lte":return n<=e[0];case"regex":return Boolean(n.match(new RegExp(e.join("|"))));case"not_regex":return!n.match(new RegExp(e.join("|")));default:return!1}}(o,function(n,e){return n.map((function(n){switch(e){case"number":return Number(n);case"boolean":return"1"===n;default:return String(n)}}))}(r,"boolean"==typeof o?"bool":v(o)?"number":"string"),t)},L=function(n,e){try{return"rule"===e.type?q(n,e.field,e.op,e.values):"and"===e.type?e.children.every((function(e){return L(n,e)})):e.children.some((function(e){return L(n,e)}))}catch(n){return!1}},B=function(n,e,t,r){if(!e)return s;var o=e.sample_rate,i=e.include_users,a=e.sample_granularity,u=e.rules,c=e.r,f=void 0===c?Math.random():c;if(_(i,n))return function(n){return A(n,1)};var l="session"===a,p=M(l,o,t,f,r),d=function(n,e,t,r,o,i){var a={};return Object.keys(n).forEach((function(u){var c=n[u],s=c.enable,f=c.sample_rate,l=c.conditional_sample_rules;s?(a[u]={enable:s,sample_rate:f,effectiveSampleRate:f*t,hit:M(e,f,r,o,i)},l&&(a[u].conditional_hit_rules=l.map((function(n){var a=n.sample_rate,u=n.filter;return{sample_rate:a,hit:M(e,a,r,o,i),effectiveSampleRate:a*t,filter:u}})))):a[u]={enable:s,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}})),a}(u,l,o,t,f,r);return function(n){if(!p())return!1;if(!(n.ev_type in d))return A(n,o);if(!d[n.ev_type].enable)return!1;if(n.common&&n.common.sample_rate)return n;var e=d[n.ev_type],t=e.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(L(n,t[r].filter))return!!t[r].hit()&&A(n,t[r].effectiveSampleRate);return!!e.hit()&&A(n,e.effectiveSampleRate)}},F=function(n){n.provide("sendEvent",(function(e){var t=function(n){if(n&&f(n)&&n.name&&h(n.name)){var e={name:n.name,type:"event"};if("metrics"in n&&f(n.metrics)){var t=n.metrics,r={};for(var o in t)v(t[o])&&(r[o]=t[o]);e.metrics=r}if("categories"in n&&f(n.categories)){var i=n.categories,a={};for(var o in i)a[o]=S(i[o]);e.categories=a}return e}}(e);t&&n.report({ev_type:"custom",payload:t,extra:{timestamp:Date.now()}})})),n.provide("sendLog",(function(e){var t=function(n){if(n&&f(n)&&n.content&&h(n.content)){var e={content:S(n.content),type:"log",level:"info"};if("level"in n&&(e.level=n.level),"extra"in n&&f(n.extra)){var t=n.extra,r={},o={};for(var i in t)v(t[i])?r[i]=t[i]:o[i]=S(t[i]);e.metrics=r,e.categories=o}return e}}(e);t&&n.report({ev_type:"custom",payload:t,extra:{timestamp:Date.now()}})}))},H=["success","fail","complete"];!function(n){n.onLaunch="onLaunch",n.onShow="onShow",n.onHide="onHide",n.onError="onError",n.onPageNotFound="onPageNotFound",n.onUnhandledRejection="onUnhandledRejection"}(V||(V={}));var z=["request","downloadFile","uploadFile"],K=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],U=a(a([],i([V.onLaunch,V.onShow,V.onHide]),!1),[V.onError,V.onPageNotFound,V.onUnhandledRejection],!1),G=["attached","onInit"],W=["onLoad","onShow","onReady","onUnload","onHide"],J=function(n){return"[object Object]"===Object.prototype.toString.call(n)};var Y=function(){return Date.now()};function $(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];if(!m(n))return 0;var r=Y(),o=r;try{n.apply(this,e)}finally{o=Y()}return o-r}var Q,X=function(){},Z=i((Q="tt",[function(){return Q},function(n){return Q=n}]),2),nn=Z[0],en=Z[1],tn=function(n,e){function t(t){return e(t),n.call(this,t)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},rn=function(n,e,t){var r=n[e];if(!r||!r.__HOOKED__)return Object.defineProperty(n,e,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{var o=t.apply(this,n);o&&(n=o)}catch(n){P(n)}return r.apply(this,n)}}),n[e]&&(n[e].__HOOKED__=!0),function(){n[e].__HOOKED__=!1,t=X}},on=function(){var n={instance:null};return n.instance||("undefined"!=typeof tt?n={instance:tt,platform:nn()}:"undefined"!=typeof my?n={instance:my,platform:"my"}:"undefined"!=typeof swan?n={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(n={instance:wx,platform:"wx"})),n},an={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},un=function(n,e){void 0===n&&(n={}),void 0===e&&(e=on().instance);var t=e?e["__slardar__global__0.2.2"]||(e["__slardar__global__0.2.2"]=n):n;return{setGlobalValue:function(n,e){t[n]=e},mergeGlobalValue:function(n,e){t[n]=r(r({},t[n]),e)},getGlobalValue:function(n){return t[n]},getGlobalEntirely:function(){return t},destroy:function(){t=r({},an),e&&(e["__slardar__global__0.2.2"]=t)}}}(r({},an)),cn=un.setGlobalValue,sn=un.mergeGlobalValue,fn=un.getGlobalValue,ln=function(n,e){Object.keys(e).forEach((function(t){e[t].addTearDown((function(){var e;return sn(n,((e={})[t]=null,e))}))}))},pn=function(n,e){e.addTearDown((function(){return cn(n,null)}))},dn=function(n){return fn("app")[n]},mn=function(n){return fn("page")[n]},vn=function(n){return fn("route")[n]},hn=function(n){return!!fn("route")[n]},gn=function(n){K.forEach((function(e){hn(e)&&vn(e).subscribe((function(t){return n(t,e)}))}))},bn=function(n){return fn("http")[n]},yn=function(n){return!!fn("http")[n]},_n=function(){return fn("setData")},wn=function(){return fn("performance")},Sn=function(){return!!fn("performance")},En=function(n){return fn("component")[n]},xn=function(){return fn("instance")},kn=function(n){cn("instance",n)};function Pn(n){return"function"==typeof n}function On(n,e){if(n){var t=n.indexOf(e);0<=t&&n.splice(t,1)}}function In(n){return n}function jn(n){return function(e){if(function(n){return n&&Pn(n.lift)}(e))return e.lift((function(e){try{return n(e,this)}catch(n){this.error(n)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Cn(n){return 0===n.length?In:1===n.length?n[0]:function(e){return n.reduce((function(n,e){return e(n)}),e)}}var Dn=function(n){Pn(n)?n():null==n||n.unsubscribe()},Tn=function(){function n(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}return n.prototype.unsubscribe=function(){var n=this;if(!this.closed){this.closed=!0;var e=this,t=e._parentage,r=e._finalizers,o=e.initialTeardown;t&&(this._parentage=null,t.forEach((function(e){return e.remove(n)}))),Pn(o)&&o(),r&&(this._finalizers=null,r.forEach(Dn))}},n.prototype.remove=function(e){this._finalizers&&On(this._finalizers,e),e instanceof n&&e._removeParent(this)},n.prototype.add=function(e){if(e&&e!==this)if(this.closed)Dn(e);else{if(e instanceof n){if(e.closed||e._hasParent(this))return;e._addParent(this)}var t=this._finalizers;this._finalizers=t?(t.push(e),t):[e]}},n.prototype._addParent=function(n){var e=this._parentage;this._parentage=e?(e.push(n),e):[n]},n.prototype._hasParent=function(n){return this._parentage&&~this._parentage.indexOf(n)},n.prototype._removeParent=function(n){this._parentage&&On(this._parentage,n)},n}(),Rn=function(n){function e(e){var t,r=n.call(this)||this;return r.isStopped=!1,r.destination=Vn(e)?e:new Nn(!(t=e)||Pn(t)?{next:null!=t?t:void 0}:t),r}return t(e,n),e.prototype.next=function(n){this.isStopped||this.destination.next(n)},e.prototype.error=function(n){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(n)}finally{this.unsubscribe()}}},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Tn),Nn=function(){function n(n){this.partialObserver=n}return n.prototype.next=function(n){var e=this.partialObserver;if(e.next)try{e.next(n)}catch(n){console.error("ConsumerObserver.next error",n)}},n.prototype.error=function(n){var e=this.partialObserver;if(e.error)try{e.error(n)}catch(n){console.error("ConsumerObserver.error error",n)}},n.prototype.complete=function(){var n=this.partialObserver;if(n.complete)try{n.complete()}catch(n){console.error("ConsumerObserver.complete error",n)}},n}();function Vn(n){return n instanceof Rn||n&&function(n){return n&&Pn(n.next)&&Pn(n.error)&&Pn(n.complete)}(n)&&function(n){return n instanceof Tn||n&&"closed"in n&&Pn(n.remove)&&Pn(n.add)&&Pn(n.unsubscribe)}(n)}var An=function(){function n(n){n&&(this._subscribe=n)}return n.prototype.subscribe=function(n){var e=Vn(n)?n:new Rn(n),t=this.operator,r=this.source;return e.add(t?t.call(e,r):this._trySubscribe(e)),e},n.prototype.lift=function(e){var t=new n;return t.source=this,t.operator=e,t},n.prototype.pipe=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return Cn(n)(this)},n.prototype._subscribe=function(n){},n.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},n}(),Mn=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var r;return t(e,n),e.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach((function(e){return e.next(n)}))},e.prototype.commonJudgement=function(n){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,n())},e.prototype.error=function(n){var e=this;this.commonJudgement((function(){var t=e.observers;for(e.hasError=!0,e.thrownError=n;t.length;)t.shift().error(n)}))},Object.defineProperty(e.prototype,"observed",{get:function(){return this.observers&&this.observers.length>0},enumerable:!1,configurable:!0}),e.prototype.complete=function(){var n=this;this.commonJudgement((function(){for(var e=n.observers;e.length;)e.shift().complete()}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},e.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._checkFinalizedStatuses=function(n){var e=this,t=e.hasError,r=e.thrownError,o=e.isStopped;t?n.error(r):o&&n.complete()},e.prototype._innerSubscribe=function(n){var t=this.isStopped,r=this.observers;return t?e.EMPTY:(r.push(n),new Tn((function(){On(r,n)})))},e.EMPTY=((r=new Tn).closed=!0,r),e}(An),qn=new An((function(n){return n.complete()}));function Ln(n){return n<=0?function(){return qn}:jn((function(e,t){var r=0;e.subscribe((function(e){++r<=n&&(t.next(e),n<=r&&t.complete())}))}))}function Bn(n,e){return jn((function(t,r){var o=0;t.subscribe((function(t){return n.call(e,t,o++)&&r.next(t)}))}))}function Fn(n){return Bn((function(e,t){return n<=t}))}var Hn,zn=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.tearDownFns=[],e}return t(e,n),e.prototype.subscribe=function(e){var t=this,r=n.prototype.subscribe.call(this,e),o=function(){t.observed||t.unsubscribe()};xn()&&xn()._subscriptions.push(r);var i=r.unsubscribe;return r.unsubscribe=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];i.apply(this,n),o()},r},e.prototype.unsubscribe=function(){n.prototype.unsubscribe.call(this),this.tearDownFns.forEach((function(n){return n()}))},e.prototype.addTearDown=function(n){this.tearDownFns.push(n)},e}(Mn),Kn=function(n){var e=n.reduce((function(n,e){return n[e]=new zn,n}),{});return{getSubject:function(n){return e[n]},subjectMap:e}},Un=function(n){return n.length>1?n:n.length&&n[0]||{}},Gn=function(n){var e=n.filter((function(n){return e=n,!fn("app")[e];var e}));!function(n){sn("app",n),ln("app",n)}(Kn(e).subjectMap),App=tn(App,(function(n){e.forEach((function(e){var t=dn(e),r=x(n,e,(function(n){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];t.next({that:this,param:Un(e),time:Y()}),m(n)&&n.apply(this,e)}}))();r&&t.addTearDown(r)}))}))},Wn=i((Hn={},[function(n){if(!on().platform)throw Error("Not support current Mini Program");if(!Array.isArray(n)||!n.length)return null;var e=n.find((function(n){return n.platform===on().platform}));return e&&(Hn=e.adapterCtor())},function(){return Hn}]),2),Jn=Wn[0],Yn=Wn[1],$n=function(n){return"SLARDAR"+n},Qn=function(n){return n.route||n.__route__||n.url||n.path||""},Xn=function(n){return void 0===n&&(n=on().instance),{instance:n,request:function(e){return n.request(e)},getStorage:function(e){return n.getStorageSync(e)},setStorage:function(e,t){return n.setStorageSync(e,t)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(n){return n},monitorNetworkType:function(e){n.getNetworkType({success:function(n){e&&e({networkType:n.networkType})}}),n.onNetworkStatusChange((function(n){e&&e({networkType:n.networkType})}))},performanceSubscriber:c,getSystemInfo:c,buildRequestProfile:c,componentSubject:c,setDataSubject:c,pagePerfSubscriber:c}},Zn=function(n){var e=["attached"],t=n.filter((function(n){return~e.indexOf(n)})),r=function(n,e){t.forEach((function(t){x(n,t,(function(n){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];En(t).next({that:this,param:null,time:Y()});var i=e[t];if(m(i)&&i.apply(this,r),m(n))return n.apply(this,r)}}))()}))};try{Component=tn(Component,(function(n){f(n.lifetimes)?r(n.lifetimes,n):void 0!==n.lifetimes&&null!==n.lifetimes||(n.lifetimes={},r(n.lifetimes,n))}))}catch(n){}},ne=function(n){var e={},t=null,o=function(){e.navigate_name=e.navigate_name||"native",e.load_start=e.load_start||0,e.dom_end=e.dom_end||0,e.render_end=e.render_end||0},i=function(){e.navigate_start&&(n(r({},e)),e.navigate_name="",e.navigate_start=0,t=!0)};gn((function(n,r){"invoke"===n.param.name&&(t=!1,e={navigate_start:n.time,navigate_name:r})})),mn("onLoad").pipe(Fn(1)).subscribe((function(n){e.load_start=n.time})),mn("onShow").pipe(Fn(1)).subscribe((function(n){e.dom_end=n.time})),mn("onReady").pipe(Fn(1)).subscribe((function(n){e.render_end=n.time,o(),i()})),dn(V.onHide).subscribe((function(){!1===t&&(o(),i())}))},ee=function(n){var e=["downloadPackage","evaluateScript","fcp","fp","fr"];wn().subscribe((function(t){~e.indexOf(t.name)&&n(t)}))},te=function(n){En("attached").subscribe((function(e){var t=e.that;return n.call(t)}))},re=function(n){return"android"===n.toLowerCase()},oe=["darwin","macs","mac"],ie=["windows_nt","windows","window"],ae=function(n){return re(n)?"Android":function(n){return"ios"===n.toLowerCase()}(n)?"iOS":function(n){return~oe.indexOf(n.toLowerCase())}(n)?"Mac":function(n){return~ie.indexOf(n.toLowerCase())}(n)?"windows":"unknown"},ue=function(n){var e=n.systemPlatform,t=n.pixelRatio,r=n.width,o=n.height;return e&&re(e)&&t?r/t+" * "+o/t:r+" * "+o},ce=function(n){return function(n){var e={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&void 0!==n[t]&&null!==n[t]&&(e[t]=n[t]);return e}({domainLookupStart:n.domainLookupStart,domainLookupEnd:n.domainLookupEnd,connectStart:n.connectStart,secureConnectionStart:n.SSLconnectionStart,connectEnd:n.connectEnd,requestStart:n.requestStart,requestEnd:n.requestEnd,responseStart:n.responseStart,responseEnd:n.responseEnd,socketReused:n.socketReused,redirectStart:n.redirectStart,redirectEnd:n.redirectEnd,fetchStart:n.fetchStart,sendBytesCount:n.sendBytesCount,throughputKbps:n.throughputKbps,receivedBytedCount:n.receivedBytedCount})},se=function(n){return{name:"unknown_error_name",message:S(n)}},fe=function(){var n=wx.getAccountInfoSync().miniProgram,e=wx.getSystemInfoSync(),t=e.model,r=e.brand,o=e.pixelRatio,i=e.screenHeight,a=e.screenWidth,u=e.windowHeight,c=e.windowWidth,s=e.language,f=e.version,l=e.system,p=e.platform,d=e.SDKVersion;return{model:t,brand:r,pixelRatio:o,screenArea:ue({width:a,height:i}),windowArea:ue({width:c,height:u}),language:s,osName:ae(p),osVersion:l,SDKVersion:d,appId:n.appId,miniEnv:n.envVersion,miniVersion:n.version,hostName:"wx",hostVersion:f,platform:"wx"}},le=function(n){switch(n){case"appLaunch":return"appClick";case"firstRender":return"fr";case"firstPaint":return"fp";case"firstContentfulPaint":return"fcp";case"largestContentfulPaint":return"lcp";default:return n}},pe={platform:"wx",adapterCtor:function(){return r(r({},Xn()),{miniPlatform:"wx",buildError:function(n){return h(n)?function(n){var e=n.split("\n");return{name:i((e[2]&&e[2].split(":")||[]).map((function(n){return n.trim()})),1)[0],message:e&&e[1]&&e[1].trim(),stack:e.slice(2).join("\n")}}(n):se(n)},getSystemInfo:fe,observePerformance:function(n){var e=wx.getPerformance&&wx.getPerformance();if(e){var t=e.createObserver((function(e){var t=e.getEntries().map((function(n){return r(r({},n),{name:le(n.name)})}));n(t)}));return t.observe({entryTypes:t.supportedEntryTypes}),t}},performanceSubscriber:ee,buildRequestProfile:function(n){return function(n){var e=ce(n);return n.protocol&&(e.protocol=n.protocol),e}(n)},componentSubject:Zn,pagePerfSubscriber:ne,setDataSubject:te})}},de=function(n){return h(n)?function(n){var e=n.split("\n"),t=i((e[0]&&e[0].split(":")||[]).map((function(n){return n.trim()})),2);return{name:t[0],message:t[1],stack:n}}(n):se(n)},me=function(){var n=tt.getSystemInfoSync(),e=n.model,t=n.brand,r=n.pixelRatio,o=n.screenHeight,i=n.screenWidth,a=n.windowHeight,u=n.windowWidth,c=n.language,s=n.version,f=n.system,l=n.platform,p=n.SDKVersion,d=n.appName;return{model:e,brand:t,pixelRatio:r,screenArea:ue({width:i,height:o}),windowArea:ue({width:u,height:a}),language:c,osName:ae(l),osVersion:f,SDKVersion:p,hostName:d,hostVersion:s}},ve=function(n){void 0===n&&(n="tt");var e="",t="",o="";if(tt.getEnvInfoSync){var i=tt.getEnvInfoSync().microapp;t=i.envType,e=i.appId,o=i.mpVersion}else t=tt.env.VERSION,e="";return r({appId:e,miniEnv:t,miniVersion:o,platform:n},me())},he=function(n){var e=mn("onReady").subscribe((function(){if(tt.performance){var e=(tt.performance.getCurrentPageEntries()||[]).map((function(n){n.name,n.entryType;var e=o(n,["name","entryType"]),t=function(n){if("navigation"===n.entryType)return{name:"route",entryType:"navigation",path:n.name};switch(n.name){case"app-click":return{name:"appClick",entryType:"navigation"};case"miniprogram-package\t":return{name:"downloadPackage",entryType:"loadPackage"};case"first-paint":return{name:"fp",entryType:"render"};default:return null}}(n);return t?r(r({},e),t):n}));n(e)}}));return{disconnect:function(){return e.unsubscribe()}}},ge={platform:"tt",adapterCtor:function(){return r(r({},Xn()),{miniPlatform:"tt",buildError:function(n){return de(n)},getSystemInfo:ve,observePerformance:he,performanceSubscriber:ee,buildRequestProfile:function(n){return function(n){return ce(n)}(n)},componentSubject:Zn,pagePerfSubscriber:ne,setDataSubject:te})}},be=function(){var n="",e="",t="";if(my.getAccountInfoSync){var r=my.getAccountInfoSync().miniProgram;e=r.envVersion,n=r.appId,t=r.version}else n=my.getAppIdSync().appId,my.getRunScene({success:function(n){e=n.envVersion}});var o=my.getSystemInfoSync(),i=o.model,a=o.brand,u=o.pixelRatio,c=o.screenHeight,s=o.screenWidth,f=o.windowHeight,l=o.windowWidth,p=o.language,d=o.version,m=o.system,v=o.platform,h=o.app;return{model:i,brand:a,pixelRatio:u,screenArea:ue({pixelRatio:u,width:s,height:c,systemPlatform:v}),windowArea:ue({width:l,height:f}),language:p,osName:ae(v),osVersion:m,SDKVersion:my.SDKVersion,appId:n,miniEnv:e,miniVersion:t,hostName:h,hostVersion:d,platform:"my"}},ye={platform:"my",adapterCtor:function(){return r(r({},Xn()),{miniPlatform:"my",buildError:function(n){return d(n)?function(n,e){var t={message:n};if(e){t.stack=e;var r=e.split("\n"),o=i(r[0]&&r[0].split(":"),1)[0];o&&(t.name=o)}return t}(n[0],n[1]):se(n)},setStorage:function(n,e){return my.setStorageSync({key:n,data:e})},getStorage:function(n){return my.getStorageSync({key:n}).data},getSystemInfo:be,componentSubject:function(n){var e=["onInit"],t=n.filter((function(n){return~e.indexOf(n)})),r=function(n){t.forEach((function(e){x(n,e,(function(n){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(En(e).next({that:this,param:null,time:Y()}),m(n))return n.apply(this,t)}}))()}))};Component=tn(Component,(function(n){f(n)?r(n):null==n&&r(n={})}))},setDataSubject:function(n){En("onInit").subscribe((function(e){var t=e.that;return n.call(t)}))},pagePerfSubscriber:ne})}},_e=function(n){return n&&function(n){switch(Object.prototype.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return n instanceof Error}}(n)?{name:n.name,message:n.message,stack:n.stack}:se(n)},we=function(){var n="",e="";if(swan.getEnvInfoSync){var t=swan.getEnvInfoSync();e=t.env,n=t.appKey}var r=swan.getSystemInfoSync(),o=r.model,i=r.brand,a=r.pixelRatio,u=r.screenHeight,c=r.screenWidth,s=r.windowHeight,f=r.windowWidth,l=r.language,p=r.version,d=r.system,m=r.platform,v=r.SDKVersion,h=r.host;return{model:o,brand:i,pixelRatio:a,screenArea:ue({width:c,height:u}),windowArea:ue({width:f,height:s}),language:l,osName:ae(m),osVersion:d,SDKVersion:v,appId:n,miniEnv:e,miniVersion:"",hostName:h,hostVersion:p,platform:"swan"}},Se={platform:"swan",adapterCtor:function(){return r(r({},Xn()),{miniPlatform:"swan",buildError:function(n){return _e(n)},getSystemInfo:we,componentSubject:Zn,setDataSubject:te,pagePerfSubscriber:function(n){var e={},t={},o=!1,i=!0,a=function(e){e.navigate_name=e.navigate_name||"native",e.load_start=e.load_start||0,e.dom_end=e.dom_end||0,e.render_end=e.render_end||0,e.navigate_start&&0!==e.load_start&&(n(r({},e)),e.load_start=0,o=!0)};gn((function(n,r){"invoke"===n.param.name&&(o=!1,e={navigate_start:n.time,navigate_name:r},t={navigate_start:n.time,navigate_name:r})})),mn("onLoad").pipe(Fn(1)).subscribe((function(n){n.that.componentName?t.dom_end=n.time:e.load_start=n.time})),mn("onShow").pipe(Fn(1)).subscribe((function(n){n.that.componentName?(t.load_start=n.time,e.load_start=0):e.dom_end=n.time})),mn("onReady").pipe(Fn(1)).subscribe((function(n){if(n.that.componentName){if(i)return void(i=!1);t.render_end=n.time,a(t)}else e.render_end=n.time,a(e),i=!1})),dn(V.onHide).subscribe((function(){o||(a(e),a(t))}))}})}},Ee=function(){return r({appId:"",miniEnv:"",miniVersion:"",platform:"lark"},me())},xe={platform:"lark",adapterCtor:function(){return r(r({},Xn()),{miniPlatform:"lark",buildError:de,getSystemInfo:Ee,componentSubject:Zn,pagePerfSubscriber:ne,setDataSubject:te})}},ke={platform:"mars",adapterCtor:function(){return r(r({},Xn()),{miniPlatform:"mars",buildError:de,getSystemInfo:ve.bind(null,"mars"),observePerformance:he,performanceSubscriber:ee,componentSubject:Zn,pagePerfSubscriber:ne,setDataSubject:te})}},Pe=function(n){var e=n.filter((function(n){return e=n,!fn("component")[e];var e}));!function(n){sn("component",n),ln("component",n)}(Kn(e).subjectMap),Yn().componentSubject(e)},Oe=function(n,e){var t=n.filter((function(n){return e=n,!fn("page")[e];var e}));!function(n){sn("page",n),ln("page",n)}(Kn(t).subjectMap);var r=function(n){t.forEach((function(e){var t=mn(e),r=x(n,e,(function(n){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(Qn(this)&&t.next({that:this,param:Un(e),time:Y()}),m(n))return n.apply(this,e)}}))();r&&t.addTearDown(r)}))};!function(n){Page=tn(Page,n)}(r),function(n){var e=function(e){J(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))};try{Component=tn(Component,e),Behavior=tn(Behavior,e)}catch(n){}}(r)},Ie=function(n){var e=n.filter((function(n){return!hn(n)})),t=Kn(e).subjectMap;!function(n){sn("route",n),ln("route",n)}(t),e.forEach((function(n){var e=rn(Yn().instance,n,(function(e){vn(n).next({that:this,param:{url:e.url,delta:e.delta,name:"invoke",value:{errMsg:"invoke"}},time:Y()}),H.forEach((function(t){x(e,t,(function(r){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];vn(n).next({that:this,param:{url:e.url,delta:e.delta,name:t,value:Un(o)||{}},time:Y()}),m(r)&&r.apply(this,o)}}))()}))}));e&&t[n].addTearDown(e)}))},je=function(n,e){return"uploadFile"===n?"POST":"downloadFile"===n?"GET":e||"GET"},Ce=function(n,e){void 0===e&&(e=Yn().instance);var t=n.filter((function(n){return!yn(n)})),r=Kn(t).subjectMap;!function(n){sn("http",n),ln("http",n)}(r),t.forEach((function(n){var t=rn(e,n,(function(e){!function(n,e){var t=e.url,r=e.method,o=e.data,i=e.header,a=e.headers,u={api:n,request:{url:t,method:je(n,r),headers:i||a||{},body:S(o),timestamp:Y()},response:{}};x(e,"complete",(function(e){return function(t){var r=u.response.timestamp||Y();u.duration=r-u.request.timestamp,u.completeCallbackTime=$(e,t);var o,i,a,c=t.errMsg||t.errorMessage||t.error;u.response={status:(o=t.status,i=t.statusCode,a=u.response.status,o>=0?o:i>=0?i:a),timestamp:r,headers:t.header||t.headers||{},body:S(t.data),errMsg:c,timing:Yn().buildRequestProfile(t.profile||{})},bn(n).next(u)}}))(),x(e,"success",(function(n){return function(e){u.response.timestamp=Y(),u.response.status=200,u.successCallbackTime=$(n,e)}}))(),x(e,"fail",(function(n){return function(e){u.response.timestamp=Y(),u.response.status=-1,u.failCallbackTime=$(n,e)}}))()}(n,e)}));t&&r[n].addTearDown(t)}))};function De(){var n=Qn(this),e=_n();var t=rn(this,"setData",(function(){for(var t=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=r[0],a=Y(),u=function(){var o=r[1],u=Y()-a;e.next({renderTime:u,url:n,data:i,startTime:a}),o&&o.call(t)};return[i,u]}));t&&e.addTearDown(t)}var Te=function(){if(!fn("setData")){var n,e=Kn(["setData"]).getSubject;n=e("setData"),cn("setData",n),pn("setData",n)}},Re=function(n){n.on("init",(function(){var n=Yn();if(n.observePerformance&&!Sn()){var e=(0,Kn(["performance"]).getSubject)("performance");!function(n){cn("performance",n),pn("performance",n)}(e);var t=n.observePerformance((function(n){n.forEach((function(n){e.next(n)}))}));t&&t.disconnect&&e.addTearDown((function(){return t.disconnect()}))}}))},Ne=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),Ve=new RegExp("(bearer|session)","i"),Ae=function(n){return Object.keys(n).reduce((function(e,t){var r,o;return r=t,o=n[t],r&&o&&(Ne.test(r)||Ve.test(o))||(e[t]=n[t]),e}),{})},Me=function(){return function(n,e){var t=n.hookRequest,i=n.hookDownloadFile,a=n.hookUploadFile,u=n.ignoreUrls,c=n.collectBodyOnError,s=n.extraExtractor,f=function(n){if(!function(n,e){var t=w(n||[]);return!!t&&t.test(e)}(u,n.request.url)){var t=n.response,i=n.request,a=n.api,f=n.duration,l=n.failCallbackTime,p=n.successCallbackTime,d=n.completeCallbackTime;i.headers=Ae(i.headers||{}),t.headers=Ae(t.headers||{});var v=t.errMsg,h=o(t,["errMsg"]),g=r(r({},h),{is_custom_error:!1});v&&(g.err_msg=v);var b,y={api:a,request:i,duration:f,cbTime:d+(l||0)+(p||0),response:g};if(m(s)){var _=s(t.body,y);_&&(y.extra=_,y.response.is_custom_error=!0)}c&&(0===(b=t.status)||b>=400)||(delete y.request.body,delete y.response.body),e({ev_type:"http",payload:y})}};t&&bn("request").subscribe(f),i&&bn("downloadFile").subscribe(f),a&&bn("uploadFile").subscribe(f)}},qe=function(n,e,t,r){void 0===e&&(e={}),void 0===r&&(r=[]);try{var o=n.apply(void 0,a([],i(r),!1));return o&&o(e,t)||[]}catch(n){return P("applyMonitor",n),[]}};function Le(n,e,t){var o;kn(n);var i=null===(o=n.config())||void 0===o?void 0:o.plugins[e];return f(i)?r(r({},t),i):!!i&&t}var Be,Fe={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},He=function(n){n.on("init",(function(){var e=Le(n,"http",Fe);if(e){var t=e.hookRequest,r=e.hookDownloadFile,o=e.hookUploadFile,i=[];t&&i.push("request"),r&&i.push("downloadFile"),o&&i.push("uploadFile"),function(n,e){void 0===e&&(e=z),n.on("init",(function(){Ce(e)}))}(n,i),qe(Me,e,n.report.bind(n))}}))},ze=function(n,e){return n&&e&&n===e},Ke=function(){var n;return function(e){try{if(function(n,e){return!(!n||!e||!ze(n.message,e.message)&&!ze(n.stack,e.stack))}(e,n))return void(n=e)}catch(n){}return n=e,e}},Ue=function(n){return void 0===n&&(n=Yn()),function(e,t){var r=e.ignoreErrors,o=e.hookOnError,i=e.hookOnUnhandledRejection,a=e.hookRouteError,u=e.dedupe,c=w(r),f=Ke(),l=function(n,e,r){var o=u?f(n):n;if(o){if(c&&c.test(o.message))return;var i={error:o};e&&(i.extra=e),r&&(i.react=r),t(i)}};o&&dn(V.onError).subscribe((function(e){var t=e.param,r=n.buildError(t);c&&c.test(r.message)||l(r)})),i&&dn(V.onUnhandledRejection).subscribe((function(n){var e=n.param||{},t=e.promise,r=S(e.reason);c&&c.test(r)||t.catch(s).then((function(n){var e={name:"UnhandledRejection",message:r};n&&n.stack&&(e.stack=n.stack),l(e)}))}));if(a&&~["tt","wx","lark"].indexOf(n.miniPlatform)){gn((function(n){return function(n){"fail"===n.name&&l({name:"RouteError",message:n.value.errMsg})}(n.param)}))}return[l]}};!function(n){n.history="history",n.manual="manual"}(Be||(Be={}));var Ge=function(){return function(n,e){var t=n.extractPid,r=n.routeMode,o=n.setPidAndViewId,a=i(function(n,e,t){var r=e,o=null,i=0,a="launch";dn(V.onShow).pipe(Fn(1)).subscribe((function(){a="show"})),gn((function(){a="history"}));var u=function(e,a){r=a,i=Y(),t(a,o=a+"_"+i),n(e,a)};return[u,function(n){n&&(u(a,n),a="history")},function(e){void 0===e&&(e="hide"),o&&(t(r,o),o=null,n(e,r,Y()-i))}]}((function(n,t,r){!function(n,t,r){e({ev_type:"pageview",payload:{pid:t,source:n,duration:r}})}(n,t,r)}),"",o),3),u=a[0],c=a[1],s=a[2];if(r!==Be.manual){var f=function(n){var e,r=Qn(n),o=(e=r,t?t(e):e);c(o)};mn("onShow").subscribe((function(n){var e=n.that;return f(e)})),mn("onUnload").subscribe(s.bind(null,"unload")),mn("onHide").subscribe(s.bind(null,"hide"))}return[u.bind(null,"user_set"),s]}},We=function(){return function(n){var e=i(function(n,e,t){void 0===n&&(n=20),void 0===e&&(e=s),void 0===t&&(t=function(n,e){return n.slice(-e)});var o=[];return[function(){return o},function(u){if(e(u)){var c=r(r({},u),{timestamp:u.timestamp||Date.now()});o=n>=0&&o.length+1>n?t(a(a([],i(o),!1),[c],!1),n):a(a([],i(o),!1),[c],!1)}}]}(n.maxBreadcrumbs,n.onAddBreadcrumb,n.onMaxBreadcrumbs),2),t=e[0],o=e[1];return z.forEach((function(n){yn(n)&&bn(n).subscribe((function(n){o({type:"http",category:n.api,message:"",data:{method:n.request.method,url:n.request.url,status_code:String(n.response.status)},timestamp:n.request.timestamp})}))})),gn((function(n,e){var t=n.param,r=n.time;"complete"===t.name&&o({type:"route",category:e,message:t.value.errMsg||t.value.errorMessage||"",timestamp:r,data:{url:t.url||""}})})),[t,o]}},Je=function(){return function(n,e){var t=n.isCalculateSize;_n().subscribe((function(n){var r,o={duration:n.renderTime,start_time:n.startTime};t&&(o.size=(r=n.data,TextEncoder?(new TextEncoder).encode(S(r)).length:2*S(r).length)),e({ev_type:"set_data",payload:o})}))}},Ye=function(){return function(n,e){var t={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},r=!1,o=function(){e({ev_type:"app_launch_perf",payload:t}),r=!0};dn(V.onLaunch).pipe(Ln(1)).subscribe((function(n){t.activate_start=n.time})),dn(V.onShow).pipe(Ln(1)).subscribe((function(n){t.init_end=n.time})),mn("onLoad").pipe(Ln(1)).subscribe((function(n){t.page_load_start=n.time})),mn("onShow").pipe(Ln(1)).subscribe((function(n){t.page_dom_end=n.time}));var i=Sn();mn("onReady").pipe(Ln(1)).subscribe((function(n){t.page_render_end=n.time,i&&!t.trigger||o()})),i&&wn().pipe(Bn((function(n){return"appClick"===n.name})),Ln(1)).subscribe((function(n){t.trigger=n.startTime,t.page_render_end&&o()})),dn(V.onHide).subscribe((function(){r||o()}))}},$e=function(){return function(n,e){Yn().pagePerfSubscriber((function(n){return e({ev_type:"page_perf",payload:n})}))}},Qe=function(n){return void 0===n&&(n=Yn()),function(e,t){if(Sn()&&n.performanceSubscriber){var r,o=0;mn("onLoad").subscribe((function(n){r=n.time,o++}));n.performanceSubscriber((function(n){var e={is_custom:!1,name:n.name,value:n.startTime,type:"perf",count:o};e.duration=n.duration||(r?n.startTime-r:0),e.is_support=e.duration>=0,t({ev_type:"performance",payload:e})}))}}},Xe={routeMode:Be.history,setPidAndViewId:function(n,e){}},Ze=function(n){return n.on("init",(function(){var e=Le(n,"pageview",Xe);if(e){var t=i(qe(Ge,r(r({},e),{setPidAndViewId:function(e,t){n.set({pid:e,viewId:t,actionId:void 0})}}),n.report.bind(n)),2),o=t[0],a=t[1];n.provide("sendPageview",o),n.provide("sendPageviewWithHide",a)}})),n},nt={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},et=function(n){n.on("init",(function(){var e=Le(n,"jsError",nt);if(e){var t=function(n){return function(e){var t=n.getBreadcrumbs&&n.getBreadcrumbs()||[];n.report({ev_type:"js_error",payload:r(r({},e),{breadcrumbs:t})})}}(n),o=i(qe(Ue,e,t),1)[0];n.provide("captureException",o)}}))},rt={maxBreadcrumbs:20,tap:!0},ot=function(n){n.on("init",(function(){var e=Le(n,"breadcrumb",rt);if(e){var t=i(qe(We,e,(function(n){})),2),r=t[0],o=t[1];n.provide("getBreadcrumbs",r),n.provide("addBreadcrumb",o)}}))},it=function(n){n.on("init",(function(){n.provide("_subscriptions",[]),kn(n),function(n){n.on("init",(function(){Gn(U),Oe(W),Pe(G)}))}(n),function(n){n.on("init",(function(){Ie(K)}))}(n)})),n.on("beforeDestroy",(function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]}))},at={isCalculateSize:!1},ut=function(n){n.on("init",(function(){var e=Le(n,"setData",at);e&&(!function(n){n.on("init",(function(){Te(),mn("onLoad").subscribe((function(n){var e=n.that;De.call(e)})),Yn().setDataSubject(De)}))}(n),qe(Je,e,n.report.bind(n)))}))},ct={},st=function(n){n.on("init",(function(){var e=Le(n,"appLaunchPerf",ct);e&&(Re(n),qe(Ye,e,n.report.bind(n)))}))},ft={},lt=function(n){n.on("init",(function(){var e=Le(n,"pagePerf",ft);e&&qe($e,e,n.report.bind(n))}))},pt={},dt=function(n){n.on("init",(function(){var e=Le(n,"performance",pt);e&&(Re(n),qe(Qe,e,n.report.bind(n)))}))},mt=function(n,e,t){void 0===t&&(t=Yn());var r,o=e.url,i=e.data,a=e.success,u=void 0===a?c:a,s=e.fail,f=void 0===s?c:s,l=e.header,p={"Content-Type":"application/json"};J(r=l)&&0!==Object.keys(r).length&&Object.assign(p,l),t.request({method:n,url:o,data:i,header:p,headers:p,success:function(n){u(n)},fail:function(n){var e=n.errMsg||"Network request failed";f(new Error(e))}})},vt=function(n){return void 0===n&&(n=Yn()),n?{get:function(e){return mt("GET",e,n)},post:function(e){return mt("POST",e,n)}}:{get:c,post:c}};var ht=function(n){return{name:"FrameworksAdapterIntegration",setup:function(e){var t=n.Taro;t&&"my"===Yn().miniPlatform&&e.on("init",(function(){Ce(["request"],t)}))}}},gt=function(){return{name:"AppLaunchPerfIntegration",setup:function(n){st(n)}}},bt=function(){return{name:"BreadcrumbIntegration",setup:function(n){ot(n)}}},yt=function(){return{name:"CustomIntegration",setup:function(n){F(n)}}},_t=function(){return{name:"HttpIntegration",setup:function(n){He(n)}}},wt=function(){return{name:"JsErrorIntegration",setup:function(n){et(n)}}},St=function(){return{name:"PagePerfIntegration",setup:function(n){lt(n)}}},Et=function(){return{name:"PageviewIntegration",setup:function(n){Ze(n)}}},xt=function(){return{name:"PerformanceIntegration",setup:function(n){dt(n)}}},kt=function(){return{name:"SetDataIntegration",setup:function(n){ut(n)}}},Pt={build:function(n){return{ev_type:n.ev_type,payload:n.payload,common:r(r({},n.extra||{}),n.overrides||{})}}},Ot={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},It=["/monitor_mini/collect","/settings/minipro"],jt=function(n,e){return void 0===e&&(e="/settings/minipro"),(n&&n.indexOf("//")>=0?"":"https://")+n+e},Ct=function(n){var e=function(n){try{return Yn().getStorage(n)}catch(n){return}}($n(String(n)));return e&&e.userId&&e.deviceId?e:{userId:T(),deviceId:T()}},Dt=function(n){var e=n.aid,t=n.userId,r=n.deviceId;!function(n,e){try{Yn().setStorage(n,e)}catch(n){}}($n(String(e)),{userId:t,deviceId:r})};function Tt(n){var e,t=Ct(n.aid);return{aid:0,token:"",pid:"",viewId:(e="_",e+"_"+Date.now()),userId:t.userId,deviceId:t.deviceId,sessionId:T(),domain:"apmplus.volces.com",plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:It},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:Ot,sdkName:"APM_PLUS_MINI_PROGRAM",sdkVersion:"0.2.2"}}function Rt(n){var e=n.plugins||{};for(var t in e)e[t]&&!f(e[t])&&(e[t]={});return r(r({},n),{plugins:e})}function Nt(n){return f(n)&&"aid"in n&&"token"in n}function Vt(n){return r({},n)}var At=function(n){var e,t,o=n,i={},a=void 0,u=c,s=c;return{getConfig:function(){return o},setConfig:function(n){var c,s,p;return i=r(r({},i),n||{}),f(),e||(e=n,o.useLocalConfig||!o.aid?(t={},u()):a?l():(c=o.domain,s=o.aid,p=function(n){a=n,l()},vt().get({url:jt(c)+"?biz_id="+s,success:function(n){p(n&&n.data&&n.data.data||{})},fail:function(){p({sample:{sample_rate:.001}})}}))),o},onChange:function(n){s=n},onReady:function(n){u=function(){Dt(o),n()},t&&u()}};function f(){var e=r(r(r({},n),t||{}),i);e.plugins=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t={},r=0;r<n.length;)t=b(t,n[r++]);return t}(n.plugins,(null==t?void 0:t.plugins)||{},i.plugins||{}),e.sample=Mt(Mt(n.sample,null==t?void 0:t.sample),i.sample),o=e,s()}function l(){var e,i;t=function(n){if(!n)return{};var e=n.sample,t=n.user_id,o=n.timestamp,i=t?{userId:t}:{};if(!e)return i;var a=e.sample_rate,u=e.sample_granularity,c=void 0===u?"session":u,s=e.include_users,f=e.rules,l=void 0===f?[]:f;return r(r({},i),{sample:{include_users:s,sample_rate:a,sample_granularity:c,rules:l.reduce((function(n,e){var t=e.name,r=e.enable,o=e.sample_rate,i=e.conditional_sample_rules;return n[t]={enable:r,sample_rate:o,conditional_sample_rules:i},n}),{})},serverTimestamp:o})}(a),e=String(o.aid),i=$n(e),Yn().getStorage(i)&&(t.userId=n.userId),f(),u()}};function Mt(n,e){if(!n||!e)return n||e;var t=r(r({},n),e);return t.include_users=a(a([],i(n.include_users||[]),!1),i(e.include_users||[]),!1),t.rules=a(a([],i(Object.keys(n.rules||{})),!1),i(Object.keys(e.rules||{})),!1).reduce((function(t,o){var u,c;return o in t||(o in(n.rules||{})&&o in(e.rules||{})?(t[o]=r(r({},n.rules[o]),e.rules[o]),t[o].conditional_sample_rules=a(a([],i(n.rules[o].conditional_sample_rules||[]),!1),i(e.rules[o].conditional_sample_rules||[]),!1)):t[o]=(null===(u=n.rules)||void 0===u?void 0:u[o])||(null===(c=e.rules)||void 0===c?void 0:c[o])),t}),{}),t}var qt=function(n){var e=!1,t=function(n){var e="";return function(){var t=n.getSender();e||(e=t.getEndpoint());var r=n.config(),o={did:r.deviceId,sid:r.sessionId,sname:r.sdkName,sver:r.sdkVersion,soffset:r.offset||0,model:r.model,brand:r.brand,ratio:r.pixelRatio,screen:r.screenArea,window:r.windowArea,lang:r.language,osname:r.osName,osver:r.osVersion,libver:r.SDKVersion,scene:r.scene||-1,menv:r.miniEnv,mver:r.miniVersion,hostname:r.hostName,hostver:r.hostVersion,platform:r.platform,biz_id:r.aid,x_auth_token:r.token};t.setEndpoint(e+E(o))}}(n),o=function(e){return void 0===e&&(e=Yn().getSystemInfo()),n.set(r({},e))},i=function(){o(),t()};n.on("start",(function(){i(),e=!0})),n.on("init",(function(){dn(V.onLaunch).pipe(Ln(1)).subscribe((function(n){var t=n.param.scene||-1;o({scene:t}),e&&i()})),Yn().monitorNetworkType((function(e){var t=e.networkType;n.set({networkType:t})}))}))},Lt=function(n){n.on("beforeBuild",(function(e){return function(n,e){var t,o={};return o.aid=e.aid,o.pid=e.pid,o.view_id=e.viewId,o.user_id=e.userId,o.network_type=e.networkType,r(r({},n),{extra:r(r({},o),null!==(t=n.extra)&&void 0!==t?t:{})})}(e,n.config())}))},Bt=function(n){n.on("report",(function(n){return function(n){var e,t,o={url:(t=Yn().getCurrentPages().pop(),t?(t?Qn(t):"")+E(t.options):""),timestamp:Y()};return r(r({},n),{extra:r(r({},o),null!==(e=n.extra)&&void 0!==e?e:{})})}(n)}))},Ft=function(e){if(!Jn(e))throw Error("Adapters imported incorrectly");var t=R({validateInitConfig:Nt,initConfigNormalizer:Rt,userConfigNormalizer:Vt,createSender:function(e){return function(e){return n(e)}({size:20,endpoint:(t=e.domain,void 0===r&&(r="/monitor_mini/collect"),(t&&t.indexOf("//")>=0?"":"https://")+t+r),transport:vt()});var t,r},builder:Pt,createDefaultConfig:Tt,createConfigManager:At});return N(t),function(n){var e,t=!1;n.on("init",(function(){e=Y(),n.on("config",(function(){var r,o=null===(r=n.config())||void 0===r?void 0:r.serverTimestamp;if(!(isNaN(o)||Number(o)<=0||t)){t=!0;var i=Y();if(i-e<1e3&&o){var a=o-(i+e)/2;!isNaN(a)&&n.set({offset:a})}}}))}))}(t),Lt(t),Bt(t),function(n){n.on("start",(function(){var e=n.config(),t=e.userId,r=e.sample,o=B(t,r,j,C);n.on("build",o)}))}(t),it(t),function(n){n.on("init",(function(){var e=[],t=n.config();t&&t.integrations&&t.integrations.forEach((function(t){_(e,t.name)||(e.push(t.name),t.setup(n),t.tearDown&&n.on("beforeDestroy",t.tearDown))}))}))}(t),function(n){n.on("init",(function(){dn(V.onHide).subscribe((function(){var e=n.getSender();e&&e.flush()}))}))}(t),qt(t),t},Ht=function(n){var e=Ft(n);if(e)return F(e),Ze(e),et(e),He(e),ut(e),ot(e),st(e),lt(e),dt(e),e};export{gt as AppLaunchPerfIntegration,bt as BreadcrumbIntegration,yt as CustomIntegration,ht as FrameworksAdapterIntegration,_t as HttpIntegration,wt as JsErrorIntegration,xe as LarkAdapter,ke as MarsAdapter,ye as MyAdapter,St as PagePerfIntegration,Et as PageviewIntegration,xt as PerformanceIntegration,kt as SetDataIntegration,Se as SwanAdapter,ge as TtAdapter,pe as WxAdapter,Ft as createBaseMiniProgramClient,Ht as createMiniProgramClient,en as setPlatform}; | ||
function n(n){var e,t=n.transport,r=n.endpoint,o=n.size,i=void 0===o?10:o,a=n.wait,u=void 0===a?1e3:a,c=[],s=0;function f(){if(c.length){var n=this.getBatchData();t.post({url:r,data:n,fail:function(t){e&&e(t,n)}}),c=[]}}return{getSize:function(){return i},getWait:function(){return u},setSize:function(n){i=n},setWait:function(n){u=n},getEndpoint:function(){return r},setEndpoint:function(n){r=n},send:function(n){c.push(n),c.length>=i&&f.call(this),clearTimeout(s),s=setTimeout(f.bind(this),u)},flush:function(){clearTimeout(s),f.call(this)},getBatchData:function(){return c.length?(n=c,JSON.stringify({ev_type:"batch",list:n})):"";var n},clear:function(){clearTimeout(s),c=[]},fail:function(n){e=n}}}var e=function(n,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])},e(n,t)};function t(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var r=function(){return r=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},r.apply(this,arguments)};function o(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(n);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(n,r[o])&&(t[r[o]]=n[r[o]])}return t}function i(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(n){o={error:n}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function a(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}var u=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],c=function(){return{}};function s(n){return n}function f(n){return"object"==typeof n&&null!==n}var l=Object.prototype;function p(n){if(f(n)){if("function"==typeof Object.getPrototypeOf){var e=Object.getPrototypeOf(n);return e===l||null===e}return"[object Object]"===l.toString.call(n)}return!1}function d(n){return"[object Array]"===l.toString.call(n)}function m(n){return"function"==typeof n}function v(n){return"number"==typeof n}function h(n){return"string"==typeof n}function g(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function b(n,e){var t=r({},n);for(var o in e)g(e,o)&&void 0!==e[o]&&(f(e[o])&&p(e[o])?t[o]=b(f(n[o])?n[o]:{},e[o]):d(e[o])&&d(n[o])?t[o]=y(n[o],e[o]):t[o]=e[o]);return t}function y(n,e){var t=d(n)?n:[],r=d(e)?e:[];return Array.prototype.concat.call(t,r).map((function(n){return n instanceof RegExp?n:f(n)&&p(n)?b({},n):d(n)?y([],n):n}))}function _(n,e){if(!d(n))return!1;if(0===n.length)return!1;for(var t=0;t<n.length;){if(n[t]===e)return!0;t++}return!1}function w(n){return d(n)&&n.length?function(n){for(var e=[],t=n.length,r=0;r<t;r++){var o=n[r];h(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}(n):null}function S(n){try{return h(n)?n:JSON.stringify(n)}catch(n){return"[FAILED_TO_STRINGIFY]:"+String(n)}}var E=function(n){return f(n)?Object.keys(n).reduce((function(e,t){return e+="&"+t+"="+n[t]}),"").replace("&","?"):""};var x=function(n,e,t,r){return void 0===r&&(r=!0),function(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];if(!n)return c;var s=n[e],f=t.apply(void 0,a([s],i(o),!1)),l=f;return m(l)&&r&&(l=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return f.apply(this,n)}catch(e){return m(s)&&s.apply(this,n)}}),n[e]=l,function(t){t||(l===n[e]?n[e]=s:f=s)}}},k=0,P=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.error.apply(console,a(["[SDK]",Date.now(),(""+k++).padStart(8," ")],i(n),!1))},O=0,I=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.warn.apply(console,a(["[SDK]",Date.now(),(""+O++).padStart(8," ")],i(n),!1))},j=function(n){return Math.random()<Number(n)},C=function(n,e){return n<Number(e)},D=function(n){return function(e){for(var t=e,r=0;r<n.length&&t;r++)try{t=n[r](t)}catch(n){P(n)}return t}};function T(){var n=function(){for(var n=new Array(16),e=0,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(n){for(var e=[],t=0;t<256;++t)e[t]=(t+256).toString(16).substr(1);var r=0,o=e;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]]].join("")}(n)}function R(n){var e,t,r=n.builder,o=n.createSender,c=n.createDefaultConfig,s=n.createConfigManager,l=n.userConfigNormalizer,p=n.initConfigNormalizer,m=n.validateInitConfig,v={};u.forEach((function(n){return v[n]=[]}));var h=!1,g=!1,b=!1,y=[],w=[],S={getBuilder:function(){return r},getSender:function(){return e},getPreStartQueue:function(){return y},init:function(n){if(h)I("already inited");else{if(!(n&&f(n)&&m(n)))throw new Error("invalid InitConfig, init failed");var r=c(n);if(!r)throw new Error("defaultConfig missing");var i=p(n);if((t=s(r)).setConfig(i),t.onChange((function(){E("config")})),!(e=o(t.getConfig())))throw new Error("sender missing");h=!0,E("init",!0)}},set:function(n){h&&n&&f(n)&&(E("beforeConfig",!1,n),null==t||t.setConfig(n))},config:function(n){if(h)return n&&f(n)&&(E("beforeConfig",!1,n),null==t||t.setConfig(l(n))),null==t?void 0:t.getConfig()},provide:function(n,e){_(w,n)?I("cannot provide "+n+", reserved"):(S[n]=e,E("provide",!1,n))},start:function(){var n=this;h&&(g||null==t||t.onReady((function(){g=!0,E("start",!0),y.forEach((function(e){return n.build(e)})),y=[]})))},report:function(n){if(n){var e=D(v.beforeReport)(n);if(e){var t=D(v.report)(e);t&&(g?this.build(t):y.push(t))}}},build:function(n){if(g){var e=D(v.beforeBuild)(n);if(e){var t=r.build(e);if(t){var o=D(v.build)(t);o&&this.send(o)}}}},send:function(n){if(g){var t=D(v.beforeSend)(n);t&&(e.send(t),E("send",!1,t))}},destroy:function(){b=!0,E("beforeDestroy",!0)},on:function(n,e){"init"===n&&h||"start"===n&&g||"beforeDestroy"===n&&b?e():v[n]&&v[n].push(e)},off:function(n,e){v[n]&&(v[n]=function(n,e){if(!d(n))return n;var t=n.indexOf(e);if(t>=0){var r=n.slice();return r.splice(t,1),r}return n}(v[n],e))}};return w=Object.keys(S),S;function E(n,e){void 0===e&&(e=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];v[n].forEach((function(n){try{n.apply(void 0,a([],i(t),!1))}catch(n){}})),e&&(v[n].length=0)}}var N=function(n){var e=function(){var n={},e={},t={set:function(r,o){return n[r]=o,e[r]=S(o),t},merge:function(o){return n=r(r({},n),o),Object.keys(o).forEach((function(n){e[n]=S(o[n])})),t},delete:function(r){return delete n[r],delete e[r],t},clear:function(){return n={},e={},t},get:function(n){return e[n]},toString:function(){return r({},e)}};return t}();n.provide("context",e),n.on("report",(function(n){return n.extra||(n.extra={}),n.extra.context=e.toString(),n}))};var V,A=function(n,e){var t=n.common||{};return t.sample_rate=e,n.common=t,n},M=function(n,e,t,r,o){return n?(i=o(r,e),function(){return i}):function(){return t(e)};var i},q=function(n,e,t,r){var o=function(n,e,t){for(var r,o=i(e.split(".")),a=o[0],u=o.slice(1);n&&u.length>0;)n=n[a],a=(r=i(u))[0],u=r.slice(1);if(n)return t(n,a)}(n,e,(function(n,e){return n[e]}));return void 0!==o&&function(n,e,t){switch(t){case"eq":return _(e,n);case"neq":return!_(e,n);case"gt":return n>e[0];case"gte":return n>=e[0];case"lt":return n<e[0];case"lte":return n<=e[0];case"regex":return Boolean(n.match(new RegExp(e.join("|"))));case"not_regex":return!n.match(new RegExp(e.join("|")));default:return!1}}(o,function(n,e){return n.map((function(n){switch(e){case"number":return Number(n);case"boolean":return"1"===n;default:return String(n)}}))}(r,"boolean"==typeof o?"bool":v(o)?"number":"string"),t)},L=function(n,e){try{return"rule"===e.type?q(n,e.field,e.op,e.values):"and"===e.type?e.children.every((function(e){return L(n,e)})):e.children.some((function(e){return L(n,e)}))}catch(n){return!1}},B=function(n,e,t,r){if(!e)return s;var o=e.sample_rate,i=e.include_users,a=e.sample_granularity,u=e.rules,c=e.r,f=void 0===c?Math.random():c;if(_(i,n))return function(n){return A(n,1)};var l="session"===a,p=M(l,o,t,f,r),d=function(n,e,t,r,o,i){var a={};return Object.keys(n).forEach((function(u){var c=n[u],s=c.enable,f=c.sample_rate,l=c.conditional_sample_rules;s?(a[u]={enable:s,sample_rate:f,effectiveSampleRate:f*t,hit:M(e,f,r,o,i)},l&&(a[u].conditional_hit_rules=l.map((function(n){var a=n.sample_rate,u=n.filter;return{sample_rate:a,hit:M(e,a,r,o,i),effectiveSampleRate:a*t,filter:u}})))):a[u]={enable:s,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}})),a}(u,l,o,t,f,r);return function(n){if(!p())return!1;if(!(n.ev_type in d))return A(n,o);if(!d[n.ev_type].enable)return!1;if(n.common&&n.common.sample_rate)return n;var e=d[n.ev_type],t=e.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(L(n,t[r].filter))return!!t[r].hit()&&A(n,t[r].effectiveSampleRate);return!!e.hit()&&A(n,e.effectiveSampleRate)}},F=function(n){n.provide("sendEvent",(function(e){var t=function(n){if(n&&f(n)&&n.name&&h(n.name)){var e={name:n.name,type:"event"};if("metrics"in n&&f(n.metrics)){var t=n.metrics,r={};for(var o in t)v(t[o])&&(r[o]=t[o]);e.metrics=r}if("categories"in n&&f(n.categories)){var i=n.categories,a={};for(var o in i)a[o]=S(i[o]);e.categories=a}return e}}(e);t&&n.report({ev_type:"custom",payload:t,extra:{timestamp:Date.now()}})})),n.provide("sendLog",(function(e){var t=function(n){if(n&&f(n)&&n.content&&h(n.content)){var e={content:S(n.content),type:"log",level:"info"};if("level"in n&&(e.level=n.level),"extra"in n&&f(n.extra)){var t=n.extra,r={},o={};for(var i in t)v(t[i])?r[i]=t[i]:o[i]=S(t[i]);e.metrics=r,e.categories=o}return e}}(e);t&&n.report({ev_type:"custom",payload:t,extra:{timestamp:Date.now()}})}))},H=["success","fail","complete"];!function(n){n.onLaunch="onLaunch",n.onShow="onShow",n.onHide="onHide",n.onError="onError",n.onPageNotFound="onPageNotFound",n.onUnhandledRejection="onUnhandledRejection"}(V||(V={}));var z=["request","downloadFile","uploadFile"],K=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],U=a(a([],i([V.onLaunch,V.onShow,V.onHide]),!1),[V.onError,V.onPageNotFound,V.onUnhandledRejection],!1),G=["attached","onInit"],W=["onLoad","onShow","onReady","onUnload","onHide"],J=function(n){return"[object Object]"===Object.prototype.toString.call(n)};var Y=function(){return Date.now()};function $(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];if(!m(n))return 0;var r=Y(),o=r;try{n.apply(this,e)}finally{o=Y()}return o-r}var Q,X=function(){},Z=i((Q="tt",[function(){return Q},function(n){return Q=n}]),2),nn=Z[0],en=Z[1],tn=function(n,e){function t(t){return e(t),n.call(this,t)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},rn=function(n,e,t){var r=n[e];if(!r||!r.__HOOKED__)return Object.defineProperty(n,e,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{var o=t.apply(this,n);o&&(n=o)}catch(n){P(n)}return r.apply(this,n)}}),n[e]&&(n[e].__HOOKED__=!0),function(){n[e].__HOOKED__=!1,t=X}},on=function(){var n={instance:null};return n.instance||("undefined"!=typeof tt?n={instance:tt,platform:nn()}:"undefined"!=typeof my?n={instance:my,platform:"my"}:"undefined"!=typeof swan?n={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(n={instance:wx,platform:"wx"})),n},an="__slardar__global__0.2.3-alpha.0",un={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},cn=function(n,e){void 0===n&&(n={}),void 0===e&&(e=on().instance);var t=e?e[an]||(e[an]=n):n;return{setGlobalValue:function(n,e){t[n]=e},mergeGlobalValue:function(n,e){t[n]=r(r({},t[n]),e)},getGlobalValue:function(n){return t[n]},getGlobalEntirely:function(){return t},destroy:function(){t=r({},un),e&&(e[an]=t)}}}(r({},un)),sn=cn.setGlobalValue,fn=cn.mergeGlobalValue,ln=cn.getGlobalValue,pn=function(n,e){Object.keys(e).forEach((function(t){e[t].addTearDown((function(){var e;return fn(n,((e={})[t]=null,e))}))}))},dn=function(n,e){e.addTearDown((function(){return sn(n,null)}))},mn=function(n){return ln("app")[n]},vn=function(n){return ln("page")[n]},hn=function(n){return ln("route")[n]},gn=function(n){return!!ln("route")[n]},bn=function(n){K.forEach((function(e){gn(e)&&hn(e).subscribe((function(t){return n(t,e)}))}))},yn=function(n){return ln("http")[n]},_n=function(n){return!!ln("http")[n]},wn=function(){return ln("setData")},Sn=function(){return ln("performance")},En=function(){return!!ln("performance")},xn=function(n){return ln("component")[n]},kn=function(){return ln("instance")},Pn=function(n){sn("instance",n)};function On(n){return"function"==typeof n}function In(n,e){if(n){var t=n.indexOf(e);0<=t&&n.splice(t,1)}}function jn(n){return n}function Cn(n){return function(e){if(function(n){return n&&On(n.lift)}(e))return e.lift((function(e){try{return n(e,this)}catch(n){this.error(n)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Dn(n){return 0===n.length?jn:1===n.length?n[0]:function(e){return n.reduce((function(n,e){return e(n)}),e)}}var Tn=function(n){On(n)?n():null==n||n.unsubscribe()},Rn=function(){function n(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}return n.prototype.unsubscribe=function(){var n=this;if(!this.closed){this.closed=!0;var e=this,t=e._parentage,r=e._finalizers,o=e.initialTeardown;t&&(this._parentage=null,t.forEach((function(e){return e.remove(n)}))),On(o)&&o(),r&&(this._finalizers=null,r.forEach(Tn))}},n.prototype.remove=function(e){this._finalizers&&In(this._finalizers,e),e instanceof n&&e._removeParent(this)},n.prototype.add=function(e){if(e&&e!==this)if(this.closed)Tn(e);else{if(e instanceof n){if(e.closed||e._hasParent(this))return;e._addParent(this)}var t=this._finalizers;this._finalizers=t?(t.push(e),t):[e]}},n.prototype._addParent=function(n){var e=this._parentage;this._parentage=e?(e.push(n),e):[n]},n.prototype._hasParent=function(n){return this._parentage&&~this._parentage.indexOf(n)},n.prototype._removeParent=function(n){this._parentage&&In(this._parentage,n)},n}(),Nn=function(n){function e(e){var t,r=n.call(this)||this;return r.isStopped=!1,r.destination=An(e)?e:new Vn(!(t=e)||On(t)?{next:null!=t?t:void 0}:t),r}return t(e,n),e.prototype.next=function(n){this.isStopped||this.destination.next(n)},e.prototype.error=function(n){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(n)}finally{this.unsubscribe()}}},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Rn),Vn=function(){function n(n){this.partialObserver=n}return n.prototype.next=function(n){var e=this.partialObserver;if(e.next)try{e.next(n)}catch(n){console.error("ConsumerObserver.next error",n)}},n.prototype.error=function(n){var e=this.partialObserver;if(e.error)try{e.error(n)}catch(n){console.error("ConsumerObserver.error error",n)}},n.prototype.complete=function(){var n=this.partialObserver;if(n.complete)try{n.complete()}catch(n){console.error("ConsumerObserver.complete error",n)}},n}();function An(n){return n instanceof Nn||n&&function(n){return n&&On(n.next)&&On(n.error)&&On(n.complete)}(n)&&function(n){return n instanceof Rn||n&&"closed"in n&&On(n.remove)&&On(n.add)&&On(n.unsubscribe)}(n)}var Mn=function(){function n(n){n&&(this._subscribe=n)}return n.prototype.subscribe=function(n){var e=An(n)?n:new Nn(n),t=this.operator,r=this.source;return e.add(t?t.call(e,r):this._trySubscribe(e)),e},n.prototype.lift=function(e){var t=new n;return t.source=this,t.operator=e,t},n.prototype.pipe=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return Dn(n)(this)},n.prototype._subscribe=function(n){},n.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},n}(),qn=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var r;return t(e,n),e.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach((function(e){return e.next(n)}))},e.prototype.commonJudgement=function(n){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,n())},e.prototype.error=function(n){var e=this;this.commonJudgement((function(){var t=e.observers;for(e.hasError=!0,e.thrownError=n;t.length;)t.shift().error(n)}))},Object.defineProperty(e.prototype,"observed",{get:function(){return this.observers&&this.observers.length>0},enumerable:!1,configurable:!0}),e.prototype.complete=function(){var n=this;this.commonJudgement((function(){for(var e=n.observers;e.length;)e.shift().complete()}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},e.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._checkFinalizedStatuses=function(n){var e=this,t=e.hasError,r=e.thrownError,o=e.isStopped;t?n.error(r):o&&n.complete()},e.prototype._innerSubscribe=function(n){var t=this.isStopped,r=this.observers;return t?e.EMPTY:(r.push(n),new Rn((function(){In(r,n)})))},e.EMPTY=((r=new Rn).closed=!0,r),e}(Mn),Ln=new Mn((function(n){return n.complete()}));function Bn(n){return n<=0?function(){return Ln}:Cn((function(e,t){var r=0;e.subscribe((function(e){++r<=n&&(t.next(e),n<=r&&t.complete())}))}))}function Fn(n,e){return Cn((function(t,r){var o=0;t.subscribe((function(t){return n.call(e,t,o++)&&r.next(t)}))}))}function Hn(n){return Fn((function(e,t){return n<=t}))}var zn,Kn=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.tearDownFns=[],e}return t(e,n),e.prototype.subscribe=function(e){var t=this,r=n.prototype.subscribe.call(this,e),o=function(){t.observed||t.unsubscribe()};kn()&&kn()._subscriptions.push(r);var i=r.unsubscribe;return r.unsubscribe=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];i.apply(this,n),o()},r},e.prototype.unsubscribe=function(){n.prototype.unsubscribe.call(this),this.tearDownFns.forEach((function(n){return n()}))},e.prototype.addTearDown=function(n){this.tearDownFns.push(n)},e}(qn),Un=function(n){var e=n.reduce((function(n,e){return n[e]=new Kn,n}),{});return{getSubject:function(n){return e[n]},subjectMap:e}},Gn=function(n){return n.length>1?n:n.length&&n[0]||{}},Wn=function(n){var e=n.filter((function(n){return e=n,!ln("app")[e];var e}));!function(n){fn("app",n),pn("app",n)}(Un(e).subjectMap),App=tn(App,(function(n){e.forEach((function(e){var t=mn(e),r=x(n,e,(function(n){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];t.next({that:this,param:Gn(e),time:Y()}),m(n)&&n.apply(this,e)}}))();r&&t.addTearDown(r)}))}))},Jn=i((zn={},[function(n){if(!on().platform)throw Error("Not support current Mini Program");if(!Array.isArray(n)||!n.length)return null;var e=n.find((function(n){return n.platform===on().platform}));return e&&(zn=e.adapterCtor())},function(){return zn}]),2),Yn=Jn[0],$n=Jn[1],Qn=function(n){return"SLARDAR"+n},Xn=function(n){return n.route||n.__route__||n.url||n.path||""},Zn=function(n){return void 0===n&&(n=on().instance),{instance:n,request:function(e){return n.request(e)},getStorage:function(e){return n.getStorageSync(e)},setStorage:function(e,t){return n.setStorageSync(e,t)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(n){return n},monitorNetworkType:function(e){n.getNetworkType({success:function(n){e&&e({networkType:n.networkType})}}),n.onNetworkStatusChange((function(n){e&&e({networkType:n.networkType})}))},performanceSubscriber:c,getSystemInfo:c,buildRequestProfile:c,componentSubject:c,setDataSubject:c,pagePerfSubscriber:c}},ne=function(n){var e=["attached"],t=n.filter((function(n){return~e.indexOf(n)})),r=function(n,e){t.forEach((function(t){x(n,t,(function(n){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];xn(t).next({that:this,param:null,time:Y()});var i=e[t];if(m(i)&&i.apply(this,r),m(n))return n.apply(this,r)}}))()}))};try{Component=tn(Component,(function(n){f(n.lifetimes)?r(n.lifetimes,n):void 0!==n.lifetimes&&null!==n.lifetimes||(n.lifetimes={},r(n.lifetimes,n))}))}catch(n){}},ee=function(n){var e={},t=null,o=function(){e.navigate_name=e.navigate_name||"native",e.load_start=e.load_start||0,e.dom_end=e.dom_end||0,e.render_end=e.render_end||0},i=function(){e.navigate_start&&(n(r({},e)),e.navigate_name="",e.navigate_start=0,t=!0)};bn((function(n,r){"invoke"===n.param.name&&(t=!1,e={navigate_start:n.time,navigate_name:r})})),vn("onLoad").pipe(Hn(1)).subscribe((function(n){e.load_start=n.time})),vn("onShow").pipe(Hn(1)).subscribe((function(n){e.dom_end=n.time})),vn("onReady").pipe(Hn(1)).subscribe((function(n){e.render_end=n.time,o(),i()})),mn(V.onHide).subscribe((function(){!1===t&&(o(),i())}))},te=function(n){var e=["downloadPackage","evaluateScript","fcp","fp","fr"];Sn().subscribe((function(t){~e.indexOf(t.name)&&n(t)}))},re=function(n){xn("attached").subscribe((function(e){var t=e.that;return n.call(t)}))},oe=function(n){return"android"===n.toLowerCase()},ie=["darwin","macs","mac"],ae=["windows_nt","windows","window"],ue=function(n){return oe(n)?"Android":function(n){return"ios"===n.toLowerCase()}(n)?"iOS":function(n){return~ie.indexOf(n.toLowerCase())}(n)?"Mac":function(n){return~ae.indexOf(n.toLowerCase())}(n)?"windows":"unknown"},ce=function(n){var e=n.systemPlatform,t=n.pixelRatio,r=n.width,o=n.height;return e&&oe(e)&&t?r/t+" * "+o/t:r+" * "+o},se=function(n){return function(n){var e={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&void 0!==n[t]&&null!==n[t]&&(e[t]=n[t]);return e}({domainLookupStart:n.domainLookupStart,domainLookupEnd:n.domainLookupEnd,connectStart:n.connectStart,secureConnectionStart:n.SSLconnectionStart,connectEnd:n.connectEnd,requestStart:n.requestStart,requestEnd:n.requestEnd,responseStart:n.responseStart,responseEnd:n.responseEnd,socketReused:n.socketReused,redirectStart:n.redirectStart,redirectEnd:n.redirectEnd,fetchStart:n.fetchStart,sendBytesCount:n.sendBytesCount,throughputKbps:n.throughputKbps,receivedBytedCount:n.receivedBytedCount})},fe=function(n){return{name:"unknown_error_name",message:S(n)}},le=function(){var n=wx.getAccountInfoSync().miniProgram,e=wx.getSystemInfoSync(),t=e.model,r=e.brand,o=e.pixelRatio,i=e.screenHeight,a=e.screenWidth,u=e.windowHeight,c=e.windowWidth,s=e.language,f=e.version,l=e.system,p=e.platform,d=e.SDKVersion;return{model:t,brand:r,pixelRatio:o,screenArea:ce({width:a,height:i}),windowArea:ce({width:c,height:u}),language:s,osName:ue(p),osVersion:l,SDKVersion:d,appId:n.appId,miniEnv:n.envVersion,miniVersion:n.version,hostName:"wx",hostVersion:f,platform:"wx"}},pe=function(n){switch(n){case"appLaunch":return"appClick";case"firstRender":return"fr";case"firstPaint":return"fp";case"firstContentfulPaint":return"fcp";case"largestContentfulPaint":return"lcp";default:return n}},de={platform:"wx",adapterCtor:function(){return r(r({},Zn()),{miniPlatform:"wx",buildError:function(n){return h(n)?function(n){var e=n.split("\n");return{name:i((e[2]&&e[2].split(":")||[]).map((function(n){return n.trim()})),1)[0],message:e&&e[1]&&e[1].trim(),stack:e.slice(2).join("\n")}}(n):fe(n)},getSystemInfo:le,observePerformance:function(n){var e=wx.getPerformance&&wx.getPerformance();if(e){var t=e.createObserver((function(e){var t=e.getEntries().map((function(n){return r(r({},n),{name:pe(n.name)})}));n(t)}));return t.observe({entryTypes:t.supportedEntryTypes}),t}},performanceSubscriber:te,buildRequestProfile:function(n){return function(n){var e=se(n);return n.protocol&&(e.protocol=n.protocol),e}(n)},componentSubject:ne,pagePerfSubscriber:ee,setDataSubject:re})}},me=function(n){return h(n)?function(n){var e=n.split("\n"),t=i((e[0]&&e[0].split(":")||[]).map((function(n){return n.trim()})),2);return{name:t[0],message:t[1],stack:n}}(n):fe(n)},ve=function(){var n=tt.getSystemInfoSync(),e=n.model,t=n.brand,r=n.pixelRatio,o=n.screenHeight,i=n.screenWidth,a=n.windowHeight,u=n.windowWidth,c=n.language,s=n.version,f=n.system,l=n.platform,p=n.SDKVersion,d=n.appName;return{model:e,brand:t,pixelRatio:r,screenArea:ce({width:i,height:o}),windowArea:ce({width:u,height:a}),language:c,osName:ue(l),osVersion:f,SDKVersion:p,hostName:d,hostVersion:s}},he=function(n){void 0===n&&(n="tt");var e="",t="",o="";if(tt.getEnvInfoSync){var i=tt.getEnvInfoSync().microapp;t=i.envType,e=i.appId,o=i.mpVersion}else t=tt.env.VERSION,e="";return r({appId:e,miniEnv:t,miniVersion:o,platform:n},ve())},ge=function(n){var e=vn("onReady").subscribe((function(){if(tt.performance){var e=(tt.performance.getCurrentPageEntries()||[]).map((function(n){n.name,n.entryType;var e=o(n,["name","entryType"]),t=function(n){if("navigation"===n.entryType)return{name:"route",entryType:"navigation",path:n.name};switch(n.name){case"app-click":return{name:"appClick",entryType:"navigation"};case"miniprogram-package\t":return{name:"downloadPackage",entryType:"loadPackage"};case"first-paint":return{name:"fp",entryType:"render"};default:return null}}(n);return t?r(r({},e),t):n}));n(e)}}));return{disconnect:function(){return e.unsubscribe()}}},be={platform:"tt",adapterCtor:function(){return r(r({},Zn()),{miniPlatform:"tt",buildError:function(n){return me(n)},getSystemInfo:he,observePerformance:ge,performanceSubscriber:te,buildRequestProfile:function(n){return function(n){return se(n)}(n)},componentSubject:ne,pagePerfSubscriber:ee,setDataSubject:re})}},ye=function(){var n="",e="",t="";if(my.getAccountInfoSync){var r=my.getAccountInfoSync().miniProgram;e=r.envVersion,n=r.appId,t=r.version}else n=my.getAppIdSync().appId,my.getRunScene({success:function(n){e=n.envVersion}});var o=my.getSystemInfoSync(),i=o.model,a=o.brand,u=o.pixelRatio,c=o.screenHeight,s=o.screenWidth,f=o.windowHeight,l=o.windowWidth,p=o.language,d=o.version,m=o.system,v=o.platform,h=o.app;return{model:i,brand:a,pixelRatio:u,screenArea:ce({pixelRatio:u,width:s,height:c,systemPlatform:v}),windowArea:ce({width:l,height:f}),language:p,osName:ue(v),osVersion:m,SDKVersion:my.SDKVersion,appId:n,miniEnv:e,miniVersion:t,hostName:h,hostVersion:d,platform:"my"}},_e={platform:"my",adapterCtor:function(){return r(r({},Zn()),{miniPlatform:"my",buildError:function(n){return d(n)?function(n,e){var t={message:n};if(e){t.stack=e;var r=e.split("\n"),o=i(r[0]&&r[0].split(":"),1)[0];o&&(t.name=o)}return t}(n[0],n[1]):fe(n)},setStorage:function(n,e){return my.setStorageSync({key:n,data:e})},getStorage:function(n){return my.getStorageSync({key:n}).data},getSystemInfo:ye,componentSubject:function(n){var e=["onInit"],t=n.filter((function(n){return~e.indexOf(n)})),r=function(n){t.forEach((function(e){x(n,e,(function(n){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(xn(e).next({that:this,param:null,time:Y()}),m(n))return n.apply(this,t)}}))()}))};Component=tn(Component,(function(n){f(n)?r(n):null==n&&r(n={})}))},setDataSubject:function(n){xn("onInit").subscribe((function(e){var t=e.that;return n.call(t)}))},pagePerfSubscriber:ee})}},we=function(n){return n&&function(n){switch(Object.prototype.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return n instanceof Error}}(n)?{name:n.name,message:n.message,stack:n.stack}:fe(n)},Se=function(){var n="",e="";if(swan.getEnvInfoSync){var t=swan.getEnvInfoSync();e=t.env,n=t.appKey}var r=swan.getSystemInfoSync(),o=r.model,i=r.brand,a=r.pixelRatio,u=r.screenHeight,c=r.screenWidth,s=r.windowHeight,f=r.windowWidth,l=r.language,p=r.version,d=r.system,m=r.platform,v=r.SDKVersion,h=r.host;return{model:o,brand:i,pixelRatio:a,screenArea:ce({width:c,height:u}),windowArea:ce({width:f,height:s}),language:l,osName:ue(m),osVersion:d,SDKVersion:v,appId:n,miniEnv:e,miniVersion:"",hostName:h,hostVersion:p,platform:"swan"}},Ee={platform:"swan",adapterCtor:function(){return r(r({},Zn()),{miniPlatform:"swan",buildError:function(n){return we(n)},getSystemInfo:Se,componentSubject:ne,setDataSubject:re,pagePerfSubscriber:function(n){var e={},t={},o=!1,i=!0,a=function(e){e.navigate_name=e.navigate_name||"native",e.load_start=e.load_start||0,e.dom_end=e.dom_end||0,e.render_end=e.render_end||0,e.navigate_start&&0!==e.load_start&&(n(r({},e)),e.load_start=0,o=!0)};bn((function(n,r){"invoke"===n.param.name&&(o=!1,e={navigate_start:n.time,navigate_name:r},t={navigate_start:n.time,navigate_name:r})})),vn("onLoad").pipe(Hn(1)).subscribe((function(n){n.that.componentName?t.dom_end=n.time:e.load_start=n.time})),vn("onShow").pipe(Hn(1)).subscribe((function(n){n.that.componentName?(t.load_start=n.time,e.load_start=0):e.dom_end=n.time})),vn("onReady").pipe(Hn(1)).subscribe((function(n){if(n.that.componentName){if(i)return void(i=!1);t.render_end=n.time,a(t)}else e.render_end=n.time,a(e),i=!1})),mn(V.onHide).subscribe((function(){o||(a(e),a(t))}))}})}},xe=function(){return r({appId:"",miniEnv:"",miniVersion:"",platform:"lark"},ve())},ke={platform:"lark",adapterCtor:function(){return r(r({},Zn()),{miniPlatform:"lark",buildError:me,getSystemInfo:xe,componentSubject:ne,pagePerfSubscriber:ee,setDataSubject:re})}},Pe={platform:"mars",adapterCtor:function(){return r(r({},Zn()),{miniPlatform:"mars",buildError:me,getSystemInfo:he.bind(null,"mars"),observePerformance:ge,performanceSubscriber:te,componentSubject:ne,pagePerfSubscriber:ee,setDataSubject:re})}},Oe=function(n){var e=n.filter((function(n){return e=n,!ln("component")[e];var e}));!function(n){fn("component",n),pn("component",n)}(Un(e).subjectMap),$n().componentSubject(e)},Ie=function(n,e){var t=n.filter((function(n){return e=n,!ln("page")[e];var e}));!function(n){fn("page",n),pn("page",n)}(Un(t).subjectMap);var r=function(n){t.forEach((function(e){var t=vn(e),r=x(n,e,(function(n){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(Xn(this)&&t.next({that:this,param:Gn(e),time:Y()}),m(n))return n.apply(this,e)}}))();r&&t.addTearDown(r)}))};!function(n){Page=tn(Page,n)}(r),function(n){var e=function(e){J(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))};try{Component=tn(Component,e),Behavior=tn(Behavior,e)}catch(n){}}(r)},je=function(n){var e=n.filter((function(n){return!gn(n)})),t=Un(e).subjectMap;!function(n){fn("route",n),pn("route",n)}(t),e.forEach((function(n){var e=rn($n().instance,n,(function(e){void 0===e&&(e={}),hn(n).next({that:this,param:{url:e.url,delta:e.delta,name:"invoke",value:{errMsg:"invoke"}},time:Y()}),H.forEach((function(t){x(e,t,(function(r){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];hn(n).next({that:this,param:{url:e.url,delta:e.delta,name:t,value:Gn(o)||{}},time:Y()}),m(r)&&r.apply(this,o)}}))()}))}));e&&t[n].addTearDown(e)}))},Ce=function(n,e){return"uploadFile"===n?"POST":"downloadFile"===n?"GET":e||"GET"},De=function(n,e){void 0===e&&(e=$n().instance);var t=n.filter((function(n){return!_n(n)})),r=Un(t).subjectMap;!function(n){fn("http",n),pn("http",n)}(r),t.forEach((function(n){var t=rn(e,n,(function(e){!function(n,e){var t=e.url,r=e.method,o=e.data,i=e.header,a=e.headers,u={api:n,request:{url:t,method:Ce(n,r),headers:i||a||{},body:S(o),timestamp:Y()},response:{}};x(e,"complete",(function(e){return function(t){var r=u.response.timestamp||Y();u.duration=r-u.request.timestamp,u.completeCallbackTime=$(e,t);var o,i,a,c=t.errMsg||t.errorMessage||t.error;u.response={status:(o=t.status,i=t.statusCode,a=u.response.status,o>=0?o:i>=0?i:a),timestamp:r,headers:t.header||t.headers||{},body:S(t.data),errMsg:c,timing:$n().buildRequestProfile(t.profile||{})},yn(n).next(u)}}))(),x(e,"success",(function(n){return function(e){u.response.timestamp=Y(),u.response.status=200,u.successCallbackTime=$(n,e)}}))(),x(e,"fail",(function(n){return function(e){u.response.timestamp=Y(),u.response.status=-1,u.failCallbackTime=$(n,e)}}))()}(n,e)}));t&&r[n].addTearDown(t)}))};function Te(){var n=Xn(this),e=wn();var t=rn(this,"setData",(function(){for(var t=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=r[0],a=Y(),u=function(){var o=r[1],u=Y()-a;e.next({renderTime:u,url:n,data:i,startTime:a}),o&&o.call(t)};return[i,u]}));t&&e.addTearDown(t)}var Re=function(){if(!ln("setData")){var n,e=Un(["setData"]).getSubject;n=e("setData"),sn("setData",n),dn("setData",n)}},Ne=function(n){n.on("init",(function(){var n=$n();if(n.observePerformance&&!En()){var e=(0,Un(["performance"]).getSubject)("performance");!function(n){sn("performance",n),dn("performance",n)}(e);var t=n.observePerformance((function(n){n.forEach((function(n){e.next(n)}))}));t&&t.disconnect&&e.addTearDown((function(){return t.disconnect()}))}}))},Ve=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),Ae=new RegExp("(bearer|session)","i"),Me=function(n){return Object.keys(n).reduce((function(e,t){var r,o;return r=t,o=n[t],r&&o&&(Ve.test(r)||Ae.test(o))||(e[t]=n[t]),e}),{})},qe=function(){return function(n,e){var t=n.hookRequest,i=n.hookDownloadFile,a=n.hookUploadFile,u=n.ignoreUrls,c=n.collectBodyOnError,s=n.extraExtractor,f=function(n){if(!function(n,e){var t=w(n||[]);return!!t&&t.test(e)}(u,n.request.url)){var t=n.response,i=n.request,a=n.api,f=n.duration,l=n.failCallbackTime,p=n.successCallbackTime,d=n.completeCallbackTime;i.headers=Me(i.headers||{}),t.headers=Me(t.headers||{});var v=t.errMsg,h=o(t,["errMsg"]),g=r(r({},h),{is_custom_error:!1});v&&(g.err_msg=v);var b,y={api:a,request:i,duration:f,cbTime:d+(l||0)+(p||0),response:g};if(m(s)){var _=s(t.body,y);_&&(y.extra=_,y.response.is_custom_error=!0)}c&&(0===(b=t.status)||b>=400)||(delete y.request.body,delete y.response.body),e({ev_type:"http",payload:y})}};t&&yn("request").subscribe(f),i&&yn("downloadFile").subscribe(f),a&&yn("uploadFile").subscribe(f)}},Le=function(n,e,t,r){void 0===e&&(e={}),void 0===r&&(r=[]);try{var o=n.apply(void 0,a([],i(r),!1));return o&&o(e,t)||[]}catch(n){return P("applyMonitor",n),[]}};function Be(n,e,t){var o;Pn(n);var i=null===(o=n.config())||void 0===o?void 0:o.plugins[e];return f(i)?r(r({},t),i):!!i&&t}var Fe,He={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},ze=function(n){n.on("init",(function(){var e=Be(n,"http",He);if(e){var t=e.hookRequest,r=e.hookDownloadFile,o=e.hookUploadFile,i=[];t&&i.push("request"),r&&i.push("downloadFile"),o&&i.push("uploadFile"),function(n,e){void 0===e&&(e=z),n.on("init",(function(){De(e)}))}(n,i),Le(qe,e,n.report.bind(n))}}))},Ke=function(n,e){return n&&e&&n===e},Ue=function(){var n;return function(e){try{if(function(n,e){return!(!n||!e||!Ke(n.message,e.message)&&!Ke(n.stack,e.stack))}(e,n))return void(n=e)}catch(n){}return n=e,e}},Ge=function(n){return void 0===n&&(n=$n()),function(e,t){var r=e.ignoreErrors,o=e.hookOnError,i=e.hookOnUnhandledRejection,a=e.hookRouteError,u=e.dedupe,c=w(r),f=Ue(),l=function(n,e,r){var o=u?f(n):n;if(o){if(c&&c.test(o.message))return;var i={error:o};e&&(i.extra=e),r&&(i.react=r),t(i)}};o&&mn(V.onError).subscribe((function(e){var t=e.param,r=n.buildError(t);c&&c.test(r.message)||l(r)})),i&&mn(V.onUnhandledRejection).subscribe((function(n){var e=n.param||{},t=e.promise,r=S(e.reason);c&&c.test(r)||t.catch(s).then((function(n){var e={name:"UnhandledRejection",message:r};n&&n.stack&&(e.stack=n.stack),l(e)}))}));if(a&&~["tt","wx","lark"].indexOf(n.miniPlatform)){bn((function(n){return function(n){"fail"===n.name&&l({name:"RouteError",message:n.value.errMsg})}(n.param)}))}return[l]}};!function(n){n.history="history",n.manual="manual"}(Fe||(Fe={}));var We=function(){return function(n,e){var t=n.extractPid,r=n.routeMode,o=n.setPidAndViewId,a=i(function(n,e,t){var r=e,o=null,i=0,a="launch";mn(V.onShow).pipe(Hn(1)).subscribe((function(){a="show"})),bn((function(){a="history"}));var u=function(e,a){r=a,i=Y(),t(a,o=a+"_"+i),n(e,a)};return[u,function(n){n&&(u(a,n),a="history")},function(e){void 0===e&&(e="hide"),o&&(t(r,o),o=null,n(e,r,Y()-i))}]}((function(n,t,r){!function(n,t,r){e({ev_type:"pageview",payload:{pid:t,source:n,duration:r}})}(n,t,r)}),"",o),3),u=a[0],c=a[1],s=a[2];if(r!==Fe.manual){var f=function(n){var e,r=Xn(n),o=(e=r,t?t(e):e);c(o)};vn("onShow").subscribe((function(n){var e=n.that;return f(e)})),vn("onUnload").subscribe(s.bind(null,"unload")),vn("onHide").subscribe(s.bind(null,"hide"))}return[u.bind(null,"user_set"),s]}},Je=function(){return function(n){var e=i(function(n,e,t){void 0===n&&(n=20),void 0===e&&(e=s),void 0===t&&(t=function(n,e){return n.slice(-e)});var o=[];return[function(){return o},function(u){if(e(u)){var c=r(r({},u),{timestamp:u.timestamp||Date.now()});o=n>=0&&o.length+1>n?t(a(a([],i(o),!1),[c],!1),n):a(a([],i(o),!1),[c],!1)}}]}(n.maxBreadcrumbs,n.onAddBreadcrumb,n.onMaxBreadcrumbs),2),t=e[0],o=e[1];return z.forEach((function(n){_n(n)&&yn(n).subscribe((function(n){o({type:"http",category:n.api,message:"",data:{method:n.request.method,url:n.request.url,status_code:String(n.response.status)},timestamp:n.request.timestamp})}))})),bn((function(n,e){var t=n.param,r=n.time;"complete"===t.name&&o({type:"route",category:e,message:t.value.errMsg||t.value.errorMessage||"",timestamp:r,data:{url:t.url||""}})})),[t,o]}},Ye=function(){return function(n,e){var t=n.isCalculateSize;wn().subscribe((function(n){var r,o={duration:n.renderTime,start_time:n.startTime};t&&(o.size=(r=n.data,TextEncoder?(new TextEncoder).encode(S(r)).length:2*S(r).length)),e({ev_type:"set_data",payload:o})}))}},$e=function(){return function(n,e){var t={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},r=!1,o=function(){e({ev_type:"app_launch_perf",payload:t}),r=!0};mn(V.onLaunch).pipe(Bn(1)).subscribe((function(n){t.activate_start=n.time})),mn(V.onShow).pipe(Bn(1)).subscribe((function(n){t.init_end=n.time})),vn("onLoad").pipe(Bn(1)).subscribe((function(n){t.page_load_start=n.time})),vn("onShow").pipe(Bn(1)).subscribe((function(n){t.page_dom_end=n.time}));var i=En();vn("onReady").pipe(Bn(1)).subscribe((function(n){t.page_render_end=n.time,i&&!t.trigger||o()})),i&&Sn().pipe(Fn((function(n){return"appClick"===n.name})),Bn(1)).subscribe((function(n){t.trigger=n.startTime,t.page_render_end&&o()})),mn(V.onHide).subscribe((function(){r||o()}))}},Qe=function(){return function(n,e){$n().pagePerfSubscriber((function(n){return e({ev_type:"page_perf",payload:n})}))}},Xe=function(n){return void 0===n&&(n=$n()),function(e,t){if(En()&&n.performanceSubscriber){var r,o=0;vn("onLoad").subscribe((function(n){r=n.time,o++}));n.performanceSubscriber((function(n){var e={is_custom:!1,name:n.name,value:n.startTime,type:"perf",count:o};e.duration=n.duration||(r?n.startTime-r:0),e.is_support=e.duration>=0,t({ev_type:"performance",payload:e})}))}}},Ze={routeMode:Fe.history,setPidAndViewId:function(n,e){}},nt=function(n){return n.on("init",(function(){var e=Be(n,"pageview",Ze);if(e){var t=i(Le(We,r(r({},e),{setPidAndViewId:function(e,t){n.set({pid:e,viewId:t,actionId:void 0})}}),n.report.bind(n)),2),o=t[0],a=t[1];n.provide("sendPageview",o),n.provide("sendPageviewWithHide",a)}})),n},et={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},rt=function(n){n.on("init",(function(){var e=Be(n,"jsError",et);if(e){var t=function(n){return function(e){var t=n.getBreadcrumbs&&n.getBreadcrumbs()||[];n.report({ev_type:"js_error",payload:r(r({},e),{breadcrumbs:t})})}}(n),o=i(Le(Ge,e,t),1)[0];n.provide("captureException",o)}}))},ot={maxBreadcrumbs:20,tap:!0},it=function(n){n.on("init",(function(){var e=Be(n,"breadcrumb",ot);if(e){var t=i(Le(Je,e,(function(n){})),2),r=t[0],o=t[1];n.provide("getBreadcrumbs",r),n.provide("addBreadcrumb",o)}}))},at=function(n){n.on("init",(function(){n.provide("_subscriptions",[]),Pn(n),function(n){n.on("init",(function(){Wn(U),Ie(W),Oe(G)}))}(n),function(n){n.on("init",(function(){je(K)}))}(n)})),n.on("beforeDestroy",(function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]}))},ut={isCalculateSize:!1},ct=function(n){n.on("init",(function(){var e=Be(n,"setData",ut);e&&(!function(n){n.on("init",(function(){Re(),vn("onLoad").subscribe((function(n){var e=n.that;Te.call(e)})),$n().setDataSubject(Te)}))}(n),Le(Ye,e,n.report.bind(n)))}))},st={},ft=function(n){n.on("init",(function(){var e=Be(n,"appLaunchPerf",st);e&&(Ne(n),Le($e,e,n.report.bind(n)))}))},lt={},pt=function(n){n.on("init",(function(){var e=Be(n,"pagePerf",lt);e&&Le(Qe,e,n.report.bind(n))}))},dt={},mt=function(n){n.on("init",(function(){var e=Be(n,"performance",dt);e&&(Ne(n),Le(Xe,e,n.report.bind(n)))}))},vt=function(n,e,t){void 0===t&&(t=$n());var r,o=e.url,i=e.data,a=e.success,u=void 0===a?c:a,s=e.fail,f=void 0===s?c:s,l=e.header,p={"Content-Type":"application/json"};J(r=l)&&0!==Object.keys(r).length&&Object.assign(p,l),t.request({method:n,url:o,data:i,header:p,headers:p,success:function(n){u(n)},fail:function(n){var e=n.errMsg||"Network request failed";f(new Error(e))}})},ht=function(n){return void 0===n&&(n=$n()),n?{get:function(e){return vt("GET",e,n)},post:function(e){return vt("POST",e,n)}}:{get:c,post:c}};var gt=function(n){return{name:"FrameworksAdapterIntegration",setup:function(e){var t=n.Taro;t&&"my"===$n().miniPlatform&&e.on("init",(function(){De(["request"],t)}))}}},bt=function(){return{name:"AppLaunchPerfIntegration",setup:function(n){ft(n)}}},yt=function(){return{name:"BreadcrumbIntegration",setup:function(n){it(n)}}},_t=function(){return{name:"CustomIntegration",setup:function(n){F(n)}}},wt=function(){return{name:"HttpIntegration",setup:function(n){ze(n)}}},St=function(){return{name:"JsErrorIntegration",setup:function(n){rt(n)}}},Et=function(){return{name:"PagePerfIntegration",setup:function(n){pt(n)}}},xt=function(){return{name:"PageviewIntegration",setup:function(n){nt(n)}}},kt=function(){return{name:"PerformanceIntegration",setup:function(n){mt(n)}}},Pt=function(){return{name:"SetDataIntegration",setup:function(n){ct(n)}}},Ot={build:function(n){return{ev_type:n.ev_type,payload:n.payload,common:r(r({},n.extra||{}),n.overrides||{})}}},It={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},jt=["/monitor_mini/collect","/settings/minipro"],Ct=function(n,e){return void 0===e&&(e="/settings/minipro"),(n&&n.indexOf("//")>=0?"":"https://")+n+e},Dt=function(n){var e=function(n){try{return $n().getStorage(n)}catch(n){return}}(Qn(String(n)));return e&&e.userId&&e.deviceId?e:{userId:T(),deviceId:T()}},Tt=function(n){var e=n.aid,t=n.userId,r=n.deviceId;!function(n,e){try{$n().setStorage(n,e)}catch(n){}}(Qn(String(e)),{userId:t,deviceId:r})};function Rt(n){var e,t=Dt(n.aid);return{aid:0,token:"",pid:"",viewId:(e="_",e+"_"+Date.now()),userId:t.userId,deviceId:t.deviceId,sessionId:T(),domain:"apmplus.volces.com",plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:jt},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:It,sdkName:"APM_PLUS_MINI_PROGRAM",sdkVersion:"0.2.3-alpha.0"}}function Nt(n){var e=n.plugins||{};for(var t in e)e[t]&&!f(e[t])&&(e[t]={});return r(r({},n),{plugins:e})}function Vt(n){return f(n)&&"aid"in n&&"token"in n}function At(n){return r({},n)}var Mt=function(n){var e,t,o=n,i={},a=void 0,u=c,s=c;return{getConfig:function(){return o},setConfig:function(n){var c,s,p;return i=r(r({},i),n||{}),f(),e||(e=n,o.useLocalConfig||!o.aid?(t={},u()):a?l():(c=o.domain,s=o.aid,p=function(n){a=n,l()},ht().get({url:Ct(c)+"?biz_id="+s,success:function(n){p(n&&n.data&&n.data.data||{})},fail:function(){p({sample:{sample_rate:.001}})}}))),o},onChange:function(n){s=n},onReady:function(n){u=function(){Tt(o),n()},t&&u()}};function f(){var e=r(r(r({},n),t||{}),i);e.plugins=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t={},r=0;r<n.length;)t=b(t,n[r++]);return t}(n.plugins,(null==t?void 0:t.plugins)||{},i.plugins||{}),e.sample=qt(qt(n.sample,null==t?void 0:t.sample),i.sample),o=e,s()}function l(){var e,i;t=function(n){if(!n)return{};var e=n.sample,t=n.user_id,o=n.timestamp,i=t?{userId:t}:{};if(!e)return i;var a=e.sample_rate,u=e.sample_granularity,c=void 0===u?"session":u,s=e.include_users,f=e.rules,l=void 0===f?[]:f;return r(r({},i),{sample:{include_users:s,sample_rate:a,sample_granularity:c,rules:l.reduce((function(n,e){var t=e.name,r=e.enable,o=e.sample_rate,i=e.conditional_sample_rules;return n[t]={enable:r,sample_rate:o,conditional_sample_rules:i},n}),{})},serverTimestamp:o})}(a),e=String(o.aid),i=Qn(e),$n().getStorage(i)&&(t.userId=n.userId),f(),u()}};function qt(n,e){if(!n||!e)return n||e;var t=r(r({},n),e);return t.include_users=a(a([],i(n.include_users||[]),!1),i(e.include_users||[]),!1),t.rules=a(a([],i(Object.keys(n.rules||{})),!1),i(Object.keys(e.rules||{})),!1).reduce((function(t,o){var u,c;return o in t||(o in(n.rules||{})&&o in(e.rules||{})?(t[o]=r(r({},n.rules[o]),e.rules[o]),t[o].conditional_sample_rules=a(a([],i(n.rules[o].conditional_sample_rules||[]),!1),i(e.rules[o].conditional_sample_rules||[]),!1)):t[o]=(null===(u=n.rules)||void 0===u?void 0:u[o])||(null===(c=e.rules)||void 0===c?void 0:c[o])),t}),{}),t}var Lt=function(n){var e=!1,t=function(n){var e="";return function(){var t=n.getSender();e||(e=t.getEndpoint());var r=n.config(),o={did:r.deviceId,sid:r.sessionId,sname:r.sdkName,sver:r.sdkVersion,soffset:r.offset||0,model:r.model,brand:r.brand,ratio:r.pixelRatio,screen:r.screenArea,window:r.windowArea,lang:r.language,osname:r.osName,osver:r.osVersion,libver:r.SDKVersion,scene:r.scene||-1,menv:r.miniEnv,mver:r.miniVersion,hostname:r.hostName,hostver:r.hostVersion,platform:r.platform,biz_id:r.aid,x_auth_token:r.token};t.setEndpoint(e+E(o))}}(n),o=function(e){return void 0===e&&(e=$n().getSystemInfo()),n.set(r({},e))},i=function(){o(),t()};n.on("start",(function(){i(),e=!0})),n.on("init",(function(){mn(V.onLaunch).pipe(Bn(1)).subscribe((function(n){var t=n.param.scene||-1;o({scene:t}),e&&i()})),$n().monitorNetworkType((function(e){var t=e.networkType;n.set({networkType:t})}))}))},Bt=function(n){n.on("beforeBuild",(function(e){return function(n,e){var t,o={};return o.aid=e.aid,o.pid=e.pid,o.view_id=e.viewId,o.user_id=e.userId,o.network_type=e.networkType,r(r({},n),{extra:r(r({},o),null!==(t=n.extra)&&void 0!==t?t:{})})}(e,n.config())}))},Ft=function(n){n.on("report",(function(n){return function(n){var e,t,o={url:(t=$n().getCurrentPages().pop(),t?(t?Xn(t):"")+E(t.options):""),timestamp:Y()};return r(r({},n),{extra:r(r({},o),null!==(e=n.extra)&&void 0!==e?e:{})})}(n)}))},Ht=function(e){if(!Yn(e))throw Error("Adapters imported incorrectly");var t=R({validateInitConfig:Vt,initConfigNormalizer:Nt,userConfigNormalizer:At,createSender:function(e){return function(e){return n(e)}({size:20,endpoint:(t=e.domain,void 0===r&&(r="/monitor_mini/collect"),(t&&t.indexOf("//")>=0?"":"https://")+t+r),transport:ht()});var t,r},builder:Ot,createDefaultConfig:Rt,createConfigManager:Mt});return N(t),function(n){var e,t=!1;n.on("init",(function(){e=Y(),n.on("config",(function(){var r,o=null===(r=n.config())||void 0===r?void 0:r.serverTimestamp;if(!(isNaN(o)||Number(o)<=0||t)){t=!0;var i=Y();if(i-e<1e3&&o){var a=o-(i+e)/2;!isNaN(a)&&n.set({offset:a})}}}))}))}(t),Bt(t),Ft(t),function(n){n.on("start",(function(){var e=n.config(),t=e.userId,r=e.sample,o=B(t,r,j,C);n.on("build",o)}))}(t),at(t),function(n){n.on("init",(function(){var e=[],t=n.config();t&&t.integrations&&t.integrations.forEach((function(t){_(e,t.name)||(e.push(t.name),t.setup(n),t.tearDown&&n.on("beforeDestroy",t.tearDown))}))}))}(t),function(n){n.on("init",(function(){mn(V.onHide).subscribe((function(){var e=n.getSender();e&&e.flush()}))}))}(t),Lt(t),t},zt=function(n){var e=Ht(n);if(e)return F(e),nt(e),rt(e),ze(e),ct(e),it(e),ft(e),pt(e),mt(e),e};export{bt as AppLaunchPerfIntegration,yt as BreadcrumbIntegration,_t as CustomIntegration,gt as FrameworksAdapterIntegration,wt as HttpIntegration,St as JsErrorIntegration,ke as LarkAdapter,Pe as MarsAdapter,_e as MyAdapter,Et as PagePerfIntegration,xt as PageviewIntegration,kt as PerformanceIntegration,Pt as SetDataIntegration,Ee as SwanAdapter,be as TtAdapter,de as WxAdapter,Ht as createBaseMiniProgramClient,zt as createMiniProgramClient,en as setPlatform}; |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).larkClient=n()}(this,function(){"use strict";function n(e){var t,r=e.transport,o=e.endpoint,n=e.size,i=void 0===n?10:n,e=e.wait,u=void 0===e?1e3:e,a=[],c=0;function s(){var n;a.length&&(n=this.getBatchData(),r.post({url:o,data:n,fail:function(e){t&&t(e,n)}}),a=[])}return{getSize:function(){return i},getWait:function(){return u},setSize:function(e){i=e},setWait:function(e){u=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){a.push(e),a.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),u)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return a.length?(e=a,JSON.stringify({ev_type:"batch",list:e})):"";var e},clear:function(){clearTimeout(c),a=[]},fail:function(e){t=e}}}var r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var d=function(){return(d=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function g(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),u=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||((r=r||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(e){return e}function w(e){return"object"==typeof e&&null!==e}var t=Object.prototype;function i(e){if(w(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(e);e=Object.getPrototypeOf(e);return e===t||null===e}}function u(e){return"[object Array]"===t.toString.call(e)}function h(e){return"function"==typeof e}function a(e){return"number"==typeof e}function c(e){return"string"==typeof e}function p(e,n){var t,r,o=d({},e);for(t in n)r=t,Object.prototype.hasOwnProperty.call(n,r)&&void 0!==n[t]&&(w(n[t])&&i(n[t])?o[t]=p(w(e[t])?e[t]:{},n[t]):u(n[t])&&u(e[t])?o[t]=function n(e,t){e=u(e)?e:[];t=u(t)?t:[];return Array.prototype.concat.call(e,t).map(function(e){return e instanceof RegExp?e:w(e)&&i(e)?p({},e):u(e)?n([],e):e})}(e[t],n[t]):o[t]=n[t]);return o}function S(e,n){if(!u(e))return!1;if(0===e.length)return!1;for(var t=0;t<e.length;){if(e[t]===n)return!0;t++}return!1}function x(e,n){if(!u(e))return e;var t=e.indexOf(n);if(0<=t){n=e.slice();return n.splice(t,1),n}return e}function m(e){return u(e)&&e.length?function(e){for(var n=[],t=e.length,r=0;r<t;r++){var o=e[r];c(o)?n.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return new RegExp(n.join("|"),"i")}(e):null}function v(e){try{return c(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function s(t){return w(t)?Object.keys(t).reduce(function(e,n){return e+="&"+n+"="+t[n]},"").replace("&","?"):""}function E(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,y(["[SDK]",Date.now(),(""+T++).padStart(8," ")],g(e),!1))}function o(e){return Math.random()<Number(e)}function f(e,n){return e<Number(n)}function k(r){return function(e){for(var n=e,t=0;t<r.length&&n;t++)try{n=r[t](n)}catch(e){C(e)}return n}}var O=function(i,u,a,c){return void 0===c&&(c=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return l;var t=i[u],r=a.apply(void 0,y([t],g(e),!1)),o=r;return h(o)&&c&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return r.apply(this,n)}catch(e){return h(t)&&t.apply(this,n)}}),i[u]=o,function(e){e||(o===i[u]?i[u]=t:r=t)}}},j=0,C=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,y(["[SDK]",Date.now(),(""+j++).padStart(8," ")],g(e),!1))},T=0;function P(){var e=function(){for(var e=new Array(16),n=0,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);var r=0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[+r]],o[e[15]]].join("")}(e)}var D=function(e){var t,r,o,n=(t={},r={},o={set:function(e,n){return t[e]=n,r[e]=v(n),o},merge:function(n){return t=d(d({},t),n),Object.keys(n).forEach(function(e){r[e]=v(n[e])}),o},delete:function(e){return delete t[e],delete r[e],o},clear:function(){return t={},r={},o},get:function(e){return r[e]},toString:function(){return d({},r)}});e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})};function I(e,n){var t=e.common||{};return t.sample_rate=n,e.common=t,e}function R(e,n,t,r,o){return e?(i=o(r,n),function(){return i}):function(){return t(n)};var i}function M(e,n,t,r){if(void 0===(e=function(e,n,t){for(var r,n=g(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(r=g(i))[0],i=r.slice(1);if(e)return t(e,o)}(e,n,function(e,n){return e[n]})))return!1;var o,n="boolean"==typeof e?"bool":a(e)?"number":"string";return function(e,n,t){switch(t){case"eq":return S(n,e);case"neq":return!S(n,e);case"gt":return e>n[0];case"gte":return e>=n[0];case"lt":return e<n[0];case"lte":return e<=n[0];case"regex":return Boolean(e.match(new RegExp(n.join("|"))));case"not_regex":return!e.match(new RegExp(n.join("|")));default:return!1}}(e,(o=n,r.map(function(e){switch(o){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}})),t)}function N(n,e){try{return"rule"===e.type?M(n,e.field,e.op,e.values):"and"===e.type?e.children.every(function(e){return N(n,e)}):e.children.some(function(e){return N(n,e)})}catch(e){return!1}}function A(e,n,t,r){if(!n)return b;var o=n.sample_rate,i=n.include_users,u=n.sample_granularity,a=n.rules,n=void 0===(n=n.r)?Math.random():n;if(S(i,e))return function(e){return I(e,1)};var c,s,f,l,p,d,h,m=R(u="session"===u,o,t,n,r),v=(c=a,s=u,f=o,l=t,p=n,d=r,h={},Object.keys(c).forEach(function(e){var n=c[e],t=n.enable,r=n.sample_rate,n=n.conditional_sample_rules;t?(h[e]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:R(s,r,l,p,d)},n&&(h[e].conditional_hit_rules=n.map(function(e){var n=e.sample_rate,e=e.filter;return{sample_rate:n,hit:R(s,n,l,p,d),effectiveSampleRate:n*f,filter:e}}))):h[e]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(e){if(!m())return!1;if(!(e.ev_type in v))return I(e,o);if(!v[e.ev_type].enable)return!1;if(e.common&&e.common.sample_rate)return e;var n=v[e.ev_type],t=n.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(N(e,t[r].filter))return!!t[r].hit()&&I(e,t[r].effectiveSampleRate);return!!n.hit()&&I(e,n.effectiveSampleRate)}}var F,q=function(t){t.on("start",function(){var e=t.config(),n=e.userId,e=e.sample,e=A(n,e,o,f);t.on("build",e)})},z="custom",L=function(e){if(e&&w(e)&&e.name&&c(e.name)){var n={name:e.name,type:"event"};if("metrics"in e&&w(e.metrics)){var t=e.metrics,r={};for(o in t)a(t[o])&&(r[o]=t[o]);n.metrics=r}if("categories"in e&&w(e.categories)){var o,i=e.categories,u={};for(o in i)u[o]=v(i[o]);n.categories=u}return n}},B=function(e){if(e&&w(e)&&e.content&&c(e.content)){var n={content:v(e.content),type:"log",level:"info"};if("level"in e&&(n.level=e.level),"extra"in e&&w(e.extra)){var t,r=e.extra,o={},i={};for(t in r)a(r[t])?o[t]=r[t]:i[t]=v(r[t]);n.metrics=o,n.categories=i}return n}},V="Adapters imported incorrectly",U=["success","fail","complete"],H=20;(_e=F=F||{}).onLaunch="onLaunch",_e.onShow="onShow",_e.onHide="onHide",_e.onError="onError",_e.onPageNotFound="onPageNotFound",_e.onUnhandledRejection="onUnhandledRejection";function G(e){return"[object Object]"===Object.prototype.toString.call(e)}var K=["request","downloadFile","uploadFile"],J=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],W=y(y([],g([F.onLaunch,F.onShow,F.onHide]),!1),[F.onError,F.onPageNotFound,F.onUnhandledRejection],!1),Y=["attached","onInit"],$=["onLoad","onShow","onReady","onUnload","onHide"],Q="__HOOKED__";var X=function(){return Date.now()};function Z(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!h(e))return 0;var r,o=X();try{e.apply(this,n)}finally{r=X()}return r-o}function ee(e,n,r){var o=e[n];if(!o||!o[Q])return Object.defineProperty(e,n,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{var t=r.apply(this,e);t&&(e=t)}catch(e){C(e)}return o.apply(this,e)}}),e[n]&&(e[n][Q]=!0),function(){e[n][Q]=!1,r=pe}}function ne(t,e){Object.keys(e).forEach(function(n){e[n].addTearDown(function(){var e;return Se(t,((e={})[n]=null,e))})})}function te(e,n){n.addTearDown(function(){return we(e,null)})}function re(e){return xe("route")[e]}function oe(e){return!!xe("route")[e]}function ie(e){return xe("http")[e]}function ue(e){return!!xe("http")[e]}function ae(){return xe("setData")}function ce(){return!!xe("performance")}function se(){return xe("instance")}function fe(e){we("instance",e)}var le,pe=function(){},de=g((le="tt",[function(){return le},function(e){return le=e}]),2),he=de[0],me=de[1],ve=function(n,t){function e(e){return t(e),n.call(this,e)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},be=function(){var e={instance:null};return e.instance||("undefined"!=typeof tt?e={instance:tt,platform:he()}:"undefined"!=typeof my?e={instance:my,platform:"my"}:"undefined"!=typeof swan?e={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(e={instance:wx,platform:"wx"})),e},ge="__slardar__global__0.2.2",ye={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},_e=function(e,n){void 0===e&&(e={});var t=(n=void 0===n?be().instance:n)?n[ge]||(n[ge]=e):e;return{setGlobalValue:function(e,n){t[e]=n},mergeGlobalValue:function(e,n){t[e]=d(d({},t[e]),n)},getGlobalValue:function(e){return t[e]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},ye),n&&(n[ge]=t)}}}(d({},ye)),we=_e.setGlobalValue,Se=_e.mergeGlobalValue,xe=_e.getGlobalValue,Ee=function(e){return xe("app")[e]},ke=function(e){return xe("page")[e]},Oe=function(t){J.forEach(function(n){oe(n)&&re(n).subscribe(function(e){return t(e,n)})})},je=function(e){return xe("component")[e]};function Ce(e){return"function"==typeof e}function Te(e,n){!e||0<=(n=e.indexOf(n))&&e.splice(n,1)}function Pe(e){return e}function De(t){return function(e){if((n=e)&&Ce(n.lift))return e.lift(function(e){try{return t(e,this)}catch(e){this.error(e)}});var n;throw new TypeError("Unable to lift unknown Observable type")}}function Ie(e){Ce(e)?e():null!=e&&e.unsubscribe()}var Re=function(e){return e instanceof Me||e&&"closed"in e&&Ce(e.remove)&&Ce(e.add)&&Ce(e.unsubscribe)},Me=(Ne.prototype.unsubscribe=function(){var e,n,t,r=this;this.closed||(this.closed=!0,e=this._parentage,n=this._finalizers,t=this.initialTeardown,e&&(this._parentage=null,e.forEach(function(e){return e.remove(r)})),Ce(t)&&t(),n&&(this._finalizers=null,n.forEach(Ie)))},Ne.prototype.remove=function(e){this._finalizers&&Te(this._finalizers,e),e instanceof Ne&&e._removeParent(this)},Ne.prototype.add=function(e){if(e&&e!==this)if(this.closed)Ie(e);else{if(e instanceof Ne){if(e.closed||e._hasParent(this))return;e._addParent(this)}var n=this._finalizers;this._finalizers=n?(n.push(e),n):[e]}},Ne.prototype._addParent=function(e){var n=this._parentage;this._parentage=n?(n.push(e),n):[e]},Ne.prototype._hasParent=function(e){return this._parentage&&~this._parentage.indexOf(e)},Ne.prototype._removeParent=function(e){this._parentage&&Te(this._parentage,e)},Ne);function Ne(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var Ae,Fe=(e(qe,Ae=Me),qe.prototype.next=function(e){this.isStopped||this.destination.next(e)},qe.prototype.error=function(e){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(e)}finally{this.unsubscribe()}}},qe.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},qe.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Ae.prototype.unsubscribe.call(this),this.destination=null)},qe.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},qe);function qe(e){var n=Ae.call(this)||this;return n.isStopped=!1,n.destination=Be(e)?e:new ze(!(e=e)||Ce(e)?{next:null!=e?e:void 0}:e),n}var ze=(Le.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(e){console.error("ConsumerObserver.next error",e)}},Le.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(e){console.error("ConsumerObserver.error error",e)}},Le.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){console.error("ConsumerObserver.complete error",e)}},Le);function Le(e){this.partialObserver=e}function Be(e){return e instanceof Fe||e&&((n=e)&&Ce(n.next)&&Ce(n.error)&&Ce(n.complete))&&Re(e);var n}Ve.prototype.subscribe=function(e){var n=Be(e)?e:new Fe(e),t=this.operator,e=this.source;return n.add(t?t.call(n,e):this._trySubscribe(n)),n},Ve.prototype.lift=function(e){var n=new Ve;return n.source=this,n.operator=e,n},Ve.prototype.pipe=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(n=e).length?Pe:1===n.length?n[0]:function(e){return n.reduce(function(e,n){return n(e)},e)})(this)},Ve.prototype._subscribe=function(e){},Ve.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},de=Ve;function Ve(e){e&&(this._subscribe=e)}var Ue,_e=(e(He,Ue=de),He.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(e){return e.next(n)})},He.prototype.commonJudgement=function(e){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,e())},He.prototype.error=function(n){var t=this;this.commonJudgement(function(){var e=t.observers;for(t.hasError=!0,t.thrownError=n;e.length;)e.shift().error(n)})},Object.defineProperty(He.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),He.prototype.complete=function(){var n=this;this.commonJudgement(function(){for(var e=n.observers;e.length;)e.shift().complete()})},He.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},He.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},He.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},He.prototype._checkFinalizedStatuses=function(e){var n=this.hasError,t=this.thrownError,r=this.isStopped;n?e.error(t):r&&e.complete()},He.prototype._innerSubscribe=function(e){var n=this.isStopped,t=this.observers;return n?He.EMPTY:(t.push(e),new Me(function(){Te(t,e)}))},He.EMPTY=((_e=new Me).closed=!0,_e),He);function He(){var e=null!==Ue&&Ue.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var Ge=new de(function(e){return e.complete()});function Ke(r){return r<=0?function(){return Ge}:De(function(e,n){var t=0;e.subscribe(function(e){++t<=r&&(n.next(e),r<=t&&n.complete())})})}function Je(r,o){return De(function(e,n){var t=0;e.subscribe(function(e){return r.call(o,e,t++)&&n.next(e)})})}function We(t){return Je(function(e,n){return t<=n})}var Ye,$e=(e(Qe,Ye=_e),Qe.prototype.subscribe=function(e){var t=this,e=Ye.prototype.subscribe.call(this,e);se()&&se()._subscriptions.push(e);var r=e.unsubscribe;return e.unsubscribe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(this,e),t.observed||t.unsubscribe()},e},Qe.prototype.unsubscribe=function(){Ye.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(e){return e()})},Qe.prototype.addTearDown=function(e){this.tearDownFns.push(e)},Qe);function Qe(){var e=null!==Ye&&Ye.apply(this,arguments)||this;return e.tearDownFns=[],e}function Xe(e){var n=e.reduce(function(e,n){return e[n]=new $e,e},{});return{getSubject:function(e){return n[e]},subjectMap:n}}function Ze(e){return 1<e.length?e:e.length&&e[0]||{}}function en(e){var t=e.filter(function(e){return e=e,!!!xe("app")[e]}),e=Xe(t).subjectMap;Se("app",e=e),ne("app",e),App=ve(App,function(n){t.forEach(function(e){var r=Ee(e),e=O(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.next({that:this,param:Ze(e),time:X()}),h(t)&&t.apply(this,e)}})();e&&r.addTearDown(e)})})}function nn(e){return e.route||e.__route__||e.url||e.path||""}function tn(e){function n(e,i){r.forEach(function(o){O(e,o,function(r){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];je(o).next({that:this,param:null,time:X()});var t=i[o];if(h(t)&&t.apply(this,e),h(r))return r.apply(this,e)}})()})}var t=["attached"],r=e.filter(function(e){return~t.indexOf(e)});try{Component=ve(Component,function(e){w(e.lifetimes)?n(e.lifetimes,e):void 0!==e.lifetimes&&null!==e.lifetimes||(e.lifetimes={},n(e.lifetimes,e))})}catch(e){}}function rn(e){function n(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(e(d({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;Oe(function(e,n){"invoke"===e.param.name&&(o=!1,r={navigate_start:e.time,navigate_name:n})}),ke("onLoad").pipe(We(1)).subscribe(function(e){r.load_start=e.time}),ke("onShow").pipe(We(1)).subscribe(function(e){r.dom_end=e.time}),ke("onReady").pipe(We(1)).subscribe(function(e){r.render_end=e.time,n(),t()}),Ee(F.onHide).subscribe(function(){!1===o&&(n(),t())})}function on(n){je("attached").subscribe(function(e){e=e.that;return n.call(e)})}function un(e){return"android"===e.toLowerCase()}function an(e){return un(e)?"Android":"ios"===e.toLowerCase()?"iOS":~Sn.indexOf(e.toLowerCase())?"Mac":~xn.indexOf(e.toLowerCase())?"windows":"unknown"}function cn(e){var n=e.systemPlatform,t=e.pixelRatio,r=e.width,e=e.height;return n&&un(n)&&t?r/t+" * "+e/t:r+" * "+e}function sn(e){return(c(e)?kn:En)(e)}function fn(){return d({appId:"",miniEnv:"",miniVersion:"",platform:jn},On())}function ln(e){var n=e.filter(function(e){return e=e,!!!xe("component")[e]}),e=Xe(n).subjectMap;Se("component",e=e),ne("component",e),yn().componentSubject(n)}function pn(n){function e(e){G(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))}try{Component=ve(Component,e),Behavior=ve(Behavior,e)}catch(e){}}function dn(e,n){var t=e.filter(function(e){return e=e,!!!xe("page")[e]}),e=Xe(t).subjectMap;Se("page",e=e),ne("page",e),e=function(n){t.forEach(function(e){var r=ke(e),e=O(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(nn(this)&&r.next({that:this,param:Ze(e),time:X()}),h(t))return t.apply(this,e)}})();e&&r.addTearDown(e)})},Page=ve(Page,e),pn(e)}function hn(e){var n=e.filter(function(e){return!oe(e)}),t=Xe(n).subjectMap;Se("route",e=t),ne("route",e),n.forEach(function(i){var e=ee(yn().instance,i,function(o){re(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:X()}),U.forEach(function(r){O(o,r,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];re(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:Ze(e)||{}},time:X()}),h(t)&&t.apply(this,e)}})()})});e&&t[i].addTearDown(e)})}function mn(a,e){var n=e.url,t=e.method,r=e.data,o=e.header,i=e.headers,c={api:a,request:{url:n,method:(n=t,"uploadFile"===(t=a)?"POST":"downloadFile"!==t&&n||"GET"),headers:o||i||{},body:v(r),timestamp:X()},response:{}};O(e,"complete",function(u){return function(e){var n=c.response.timestamp||X();c.duration=n-c.request.timestamp,c.completeCallbackTime=Z(u,e);var t,r,o,i=e.errMsg||e.errorMessage||e.error;c.response={status:(t=e.status,r=e.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:n,headers:e.header||e.headers||{},body:v(e.data),errMsg:i,timing:yn().buildRequestProfile(e.profile||{})},ie(a).next(c)}})(),O(e,"success",function(n){return function(e){c.response.timestamp=X(),c.response.status=200,c.successCallbackTime=Z(n,e)}})(),O(e,"fail",function(n){return function(e){c.response.timestamp=X(),c.response.status=-1,c.failCallbackTime=Z(n,e)}})()}function vn(e,t){void 0===t&&(t=yn().instance);var n=e.filter(function(e){return!ue(e)}),r=Xe(n).subjectMap;Se("http",e=r),ne("http",e),n.forEach(function(n){var e=ee(t,n,function(e){mn(n,e)});e&&r[n].addTearDown(e)})}var bn,de=g((bn={},[function(e){if(!be().platform)throw Error("Not support current Mini Program");if(!Array.isArray(e)||!e.length)return null;e=e.find(function(e){return e.platform===be().platform});return e&&(bn=e.adapterCtor())},function(){return bn}]),2),gn=de[0],yn=de[1],_n=function(e){return"SLARDAR"+e},wn=function(e){try{return yn().getStorage(e)}catch(e){return}},Sn=["darwin","macs","mac"],xn=["windows_nt","windows","window"],En=function(e){return{name:"unknown_error_name",message:v(e)}},kn=function(e){var n=e.split("\n"),n=g((n[0]&&n[0].split(":")||[]).map(function(e){return e.trim()}),2);return{name:n[0],message:n[1],stack:e}},On=function(){var e=tt.getSystemInfoSync(),n=e.model,t=e.brand,r=e.pixelRatio,o=e.screenHeight,i=e.screenWidth,u=e.windowHeight,a=e.windowWidth,c=e.language,s=e.version,f=e.system,l=e.platform,p=e.SDKVersion,e=e.appName;return{model:n,brand:t,pixelRatio:r,screenArea:cn({width:i,height:o}),windowArea:cn({width:a,height:u}),language:c,osName:an(l),osVersion:f,SDKVersion:p,hostName:e,hostVersion:s}},jn="lark",_e={platform:jn,adapterCtor:function(){return d(d({},{instance:t=void 0===t?be().instance:t,request:function(e){return t.request(e)},getStorage:function(e){return t.getStorageSync(e)},setStorage:function(e,n){return t.setStorageSync(e,n)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(e){return e},monitorNetworkType:function(n){t.getNetworkType({success:function(e){n&&n({networkType:e.networkType})}}),t.onNetworkStatusChange(function(e){n&&n({networkType:e.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:jn,buildError:sn,getSystemInfo:fn,componentSubject:tn,pagePerfSubscriber:rn,setDataSubject:on});var t}},Cn=function(e,n){void 0===n&&(n=K),e.on("init",function(){vn(n)})};function Tn(){var u=nn(this),a=ae();var e=ee(this,"setData",function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=r[0],i=X();return[o,function(){var e=r[1],n=X()-i;a.next({renderTime:n,url:u,data:o,startTime:i}),e&&e.call(t)}]});e&&a.addTearDown(e)}function Pn(){var e;xe("setData")||(e=(e=Xe(["setData"]).getSubject)("setData"),we("setData",e),te("setData",e))}function Dn(o){return Object.keys(o).reduce(function(e,n){var t,r;return r=o[t=n],t&&r&&(Mn.test(t)||Nn.test(r))||(e[n]=o[n]),e},{})}var In=function(e){e.on("init",function(){Pn(),ke("onLoad").subscribe(function(e){e=e.that;Tn.call(e)}),yn().setDataSubject(Tn)})},Rn=function(e){e.on("init",function(){var n,e,t,r=yn();r.observePerformance&&!ce()&&(n=(0,Xe(["performance"]).getSubject)("performance"),we("performance",e=n),te("performance",e),(t=r.observePerformance(function(e){e.forEach(function(e){n.next(e)})}))&&t.disconnect&&n.addTearDown(function(){return t.disconnect()}))})},Mn=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),Nn=new RegExp("(bearer|session)","i"),An=function(){return function(e,s){var n=e.hookRequest,t=e.hookDownloadFile,r=e.hookUploadFile,f=e.ignoreUrls,l=e.collectBodyOnError,p=e.extraExtractor,e=function(e){var n,t,r,o,i,u,a,c;!function(e,n){e=m(e||[]);return!!e&&e.test(n)}(f,e.request.url)&&(c=e.response,n=e.request,t=e.api,r=e.duration,o=e.failCallbackTime,a=e.successCallbackTime,i=e.completeCallbackTime,n.headers=Dn(n.headers||{}),c.headers=Dn(c.headers||{}),u=c.errMsg,e=function(e,n){var t={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}(c,["errMsg"]),e=d(d({},e),{is_custom_error:!1}),u&&(e.err_msg=u),a={api:t,request:n,duration:r,cbTime:i+(o||0)+(a||0),response:e},!h(p)||(e=p(c.body,a))&&(a.extra=e,a.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete a.request.body,delete a.response.body),s({ev_type:"http",payload:a}))};n&&ie("request").subscribe(e),t&&ie("downloadFile").subscribe(e),r&&ie("uploadFile").subscribe(e)}},Fn=function(e,n,t,r){void 0===n&&(n={}),void 0===r&&(r=[]);try{var o=e.apply(void 0,y([],g(r),!1));return o&&o(n,t)||[]}catch(e){return C("applyMonitor",e),[]}};function qn(e,n,t){fe(e);n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return w(n)?d(d({},t),n):!!n&&t}function zn(e,n){return e&&n&&e===n}function Ln(){var r;return function(e){try{if(t=r,!(!(n=e)||!t)&&!(!zn(n.message,t.message)&&!zn(n.stack,t.stack)))return void(r=e)}catch(e){}var n,t;return r=e}}var Bn,Vn="http",Un={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},Hn=function(f){return void 0===f&&(f=yn()),function(e,r){var n=e.ignoreErrors,t=e.hookOnError,o=e.hookOnUnhandledRejection,i=e.hookRouteError,u=e.dedupe,a=m(n),c=Ln(),s=function(e,n,t){e=u?c(e):e;e&&(a&&a.test(e.message)||(e={error:e},n&&(e.extra=n),t&&(e.react=t),r(e)))};t&&Ee(F.onError).subscribe(function(e){e=e.param,e=f.buildError(e);a&&a.test(e.message)||s(e)}),o&&Ee(F.onUnhandledRejection).subscribe(function(e){var n=e.param||{},e=n.promise,t=v(n.reason);a&&a.test(t)||e.catch(b).then(function(e){var n={name:"UnhandledRejection",message:t};e&&e.stack&&(n.stack=e.stack),s(n)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&Oe(function(e){e=e.param;"fail"===(e=e).name&&s({name:"RouteError",message:e.value.errMsg})}),[s]}};(de=Bn=Bn||{}).history="history",de.manual="manual";function Gn(t,e,r){var o=e,i=null,u=0,n="launch";function a(e,n){o=n,u=X(),r(n,i=n+"_"+u),t(e,n)}return Ee(F.onShow).pipe(We(1)).subscribe(function(){n="show"}),Oe(function(){n="history"}),[a,function(e){e&&(a(n,e),n="history")},function(e){void 0===e&&(e="hide"),i&&(r(o,i),i=null,t(e,o,X()-u))}]}var Kn=function(){return function(e,r){var n=e.extractPid,t=e.routeMode,o=e.setPidAndViewId,i=function(e){return n?n(e):e},e=g(Gn(function(e,n,t){r({ev_type:"pageview",payload:{pid:n,source:e,duration:t}})},"",o),3),o=e[0],u=e[1],e=e[2];return t!==Bn.manual&&(ke("onShow").subscribe(function(e){return function(e){e=nn(e),e=i(e);u(e)}(e.that)}),ke("onUnload").subscribe(e.bind(null,"unload")),ke("onHide").subscribe(e.bind(null,"hide"))),[o.bind(null,"user_set"),e]}},Jn=function(){return function(e){var n=g(function(n,t,r){void 0===n&&(n=20),void 0===t&&(t=b),void 0===r&&(r=function(e,n){return e.slice(-n)});var o=[];return[function(){return o},function(e){t(e)&&(e=d(d({},e),{timestamp:e.timestamp||Date.now()}),o=0<=n&&o.length+1>n?r(y(y([],g(o),!1),[e],!1),n):y(y([],g(o),!1),[e],!1))}]}(e.maxBreadcrumbs,e.onAddBreadcrumb,e.onMaxBreadcrumbs),2),e=n[0],r=n[1];return K.forEach(function(e){ue(e)&&ie(e).subscribe(function(e){r({type:"http",category:e.api,message:"",data:{method:e.request.method,url:e.request.url,status_code:String(e.response.status)},timestamp:e.request.timestamp})})}),Oe(function(e,n){var t=e.param,e=e.time;"complete"===t.name&&r({type:"route",category:n,message:t.value.errMsg||t.value.errorMessage||"",timestamp:e,data:{url:t.url||""}})}),[e,r]}},Wn=function(){return function(e,t){var r=e.isCalculateSize;ae().subscribe(function(e){var n={duration:e.renderTime,start_time:e.startTime};r&&(n.size=(e=e.data,TextEncoder?(new TextEncoder).encode(v(e)).length:2*v(e).length)),t({ev_type:"set_data",payload:n})})}},Yn=function(){return function(e,n){function t(){n({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;Ee(F.onLaunch).pipe(Ke(1)).subscribe(function(e){r.activate_start=e.time}),Ee(F.onShow).pipe(Ke(1)).subscribe(function(e){r.init_end=e.time}),ke("onLoad").pipe(Ke(1)).subscribe(function(e){r.page_load_start=e.time}),ke("onShow").pipe(Ke(1)).subscribe(function(e){r.page_dom_end=e.time});var i=ce();ke("onReady").pipe(Ke(1)).subscribe(function(e){r.page_render_end=e.time,i&&!r.trigger||t()}),i&&xe("performance").pipe(Je(function(e){return"appClick"===e.name}),Ke(1)).subscribe(function(e){r.trigger=e.startTime,r.page_render_end&&t()}),Ee(F.onHide).subscribe(function(){o||t()})}},$n=function(){return function(e,n){yn().pagePerfSubscriber(function(e){return n({ev_type:"page_perf",payload:e})})}},Qn=function(n){return void 0===n&&(n=yn()),function(e,t){var r,o;ce()&&n.performanceSubscriber&&(r=0,ke("onLoad").subscribe(function(e){o=e.time,r++}),n.performanceSubscriber(function(e){var n={is_custom:!1,name:e.name,value:e.startTime,type:"perf",count:r};n.duration=e.duration||(o?e.startTime-o:0),n.is_support=0<=n.duration,t({ev_type:"performance",payload:n})}))}},Xn="pageview",Zn={routeMode:Bn.history,setPidAndViewId:function(e,n){}},et="jsError",nt={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},rt=function(t){return function(e){var n=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},e),{breadcrumbs:n})})}},ot={maxBreadcrumbs:20,tap:!0},it="breadcrumb",ut=function(n){n.on("init",function(){n.provide("_subscriptions",[]),fe(n),n.on("init",function(){en(W),dn($),ln(Y)}),n.on("init",function(){hn(J)})}),n.on("beforeDestroy",function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]})},at="setData",ct={isCalculateSize:!1},st="appLaunchPerf",ft={},lt="pagePerf",pt={},dt="performance",ht={},mt=function(e,n,t){void 0===t&&(t=yn());var r=n.url,o=n.data,i=n.success,u=void 0===i?l:i,a=n.fail,c=void 0===a?l:a,i=n.header,a={"Content-Type":"application/json"};G(n=i)&&0!==Object.keys(n).length&&Object.assign(a,i),t.request({method:e,url:r,data:o,header:a,headers:a,success:function(e){u(e)},fail:function(e){e=e.errMsg||"Network request failed";c(new Error(e))}})},vt=function(n){return(n=void 0===n?yn():n)?{get:function(e){return mt("GET",e,n)},post:function(e){return mt("POST",e,n)}}:{get:l,post:l}};function bt(e){return e=_n(String(e)),(e=wn(e))&&e.userId&&e.deviceId?e:{userId:P(),deviceId:P()}}function gt(e){return e+"_"+Date.now()}function yt(e){var n=e.aid,t=e.userId,e=e.deviceId;!function(e,n){try{yn().setStorage(e,n)}catch(e){}}(_n(String(n)),{userId:t,deviceId:e})}var _t={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:d(d({},e.extra||{}),e.overrides||{})}}},wt="/monitor_mini/collect",St="/settings/minipro",xt="apmplus.volces.com",Et="session",kt={sample_rate:1,include_users:[],sample_granularity:Et,rules:{}},Ot=[wt,St],jt="0.2.2",Ct="APM_PLUS_MINI_PROGRAM",Tt=function(e,n){return void 0===n&&(n=wt),(e&&0<=e.indexOf("//")?"":"https://")+e+n};function Pt(e){e=bt(e.aid);return{aid:0,token:"",pid:"",viewId:gt("_"),userId:e.userId,deviceId:e.deviceId,sessionId:P(),domain:xt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:Ot},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:kt,sdkName:Ct,sdkVersion:jt}}function Dt(e){var n,t=e.plugins||{};for(n in t)t[n]&&!w(t[n])&&(t[n]={});return d(d({},e),{plugins:t})}function It(e){return w(e)&&"aid"in e&&"token"in e}function Rt(e){return d({},e)}var Mt=function(n){var r,o,i=n,u={},a=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(e){var n,t;return u=d(d({},u),e||{}),s(),r||(r=e,i.useLocalConfig||!i.aid?(o={},c()):a?f():(n=i.domain,e=i.aid,t=function(e){a=e,f()},vt().get({url:function(e,n){return void 0===n&&(n=St),(e&&0<=e.indexOf("//")?"":"https://")+e+n}(n)+"?biz_id="+e,success:function(e){t(e&&e.data&&e.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(e){t=e},onReady:function(e){c=function(){yt(i),e()},o&&c()}};function s(){var e=d(d(d({},n),o||{}),u);e.plugins=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t={},r=0;r<e.length;)t=p(t,e[r++]);return t}(n.plugins,(null==o?void 0:o.plugins)||{},u.plugins||{}),e.sample=Nt(Nt(n.sample,null==o?void 0:o.sample),u.sample),i=e,t()}function f(){o=function(e){if(!e)return{};var n=e.sample,t=e.user_id,r=e.timestamp,o=t?{userId:t}:{};if(!n)return o;var i=n.sample_rate,e=n.sample_granularity,t=void 0===e?Et:e,e=n.include_users,n=n.rules,n=void 0===n?[]:n;return d(d({},o),{sample:{include_users:e,sample_rate:i,sample_granularity:t,rules:n.reduce(function(e,n){var t=n.name,r=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[t]={enable:r,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r})}(a),function(e){e=_n(e);return!!yn().getStorage(e)}(String(i.aid))&&(o.userId=n.userId),s(),c()}};function Nt(r,o){if(!r||!o)return r||o;var e=d(d({},r),o);return e.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),e.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(e,n){var t;return n in e||(n in(r.rules||{})&&n in(o.rules||{})?(e[n]=d(d({},r.rules[n]),o.rules[n]),e[n].conditional_sample_rules=y(y([],g(r.rules[n].conditional_sample_rules||[]),!1),g(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(t=r.rules)||void 0===t?void 0:t[n])||(null===(t=o.rules)||void 0===t?void 0:t[n])),e},{}),e}function At(e){var n={url:(n=yn().getCurrentPages().pop())?(n?nn(n):"")+s(n.options):"",timestamp:X()};return d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})})}function Ft(e){if(!gn(e))throw Error(V);var t,e=function(e){var t,r,n=e.builder,o=e.createSender,i=e.createDefaultConfig,u=e.createConfigManager,a=e.userConfigNormalizer,c=e.initConfigNormalizer,s=e.validateInitConfig,f={};_.forEach(function(e){return f[e]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(e){if(l)E("already inited");else{if(!(e&&w(e)&&s(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=c(e);if((r=u(n)).setConfig(e),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(e){l&&e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(a(e))),null==r?void 0:r.getConfig()},provide:function(e,n){S(m,e)?E("cannot provide "+e+", reserved"):(v[e]=n,b("provide",!1,e))},start:function(){var n=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(e){return n.build(e)}),h=[]}))},report:function(e){e&&(!(e=k(f.beforeReport)(e))||(e=k(f.report)(e))&&(p?this.build(e):h.push(e)))},build:function(e){!p||(e=k(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=k(f.build)(e))&&this.send(e))},send:function(e){!p||(e=k(f.beforeSend)(e))&&(t.send(e),b("send",!1,e))},destroy:function(){b("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&p||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=x(f[e],n))}},m=Object.keys(v);return v;function b(e,n){void 0===n&&(n=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[e].forEach(function(e){try{e.apply(void 0,y([],g(t),!1))}catch(e){}}),n&&(f[e].length=0)}}({validateInitConfig:It,initConfigNormalizer:Dt,userConfigNormalizer:Rt,createSender:function(e){return n({size:H,endpoint:Tt(e.domain),transport:vt()})},builder:_t,createDefaultConfig:Pt,createConfigManager:Mt});return D(e),Vt(e),zt(e),Lt(e),q(e),ut(e),(t=e).on("init",function(){var n=[],e=t.config();e&&e.integrations&&e.integrations.forEach(function(e){S(n,e.name)||(n.push(e.name),e.setup(t),e.tearDown&&t.on("beforeDestroy",e.tearDown))})}),Bt(e),qt(e),e}var qt=function(n){function t(e){return void 0===e&&(e=yn().getSystemInfo()),n.set(d({},e))}function r(){t(),e()}var o,i,u=!1,e=(i="",function(){var e=o.getSender();i=i||e.getEndpoint();var n=o.config(),n={did:n.deviceId,sid:n.sessionId,sname:n.sdkName,sver:n.sdkVersion,soffset:n.offset||0,model:n.model,brand:n.brand,ratio:n.pixelRatio,screen:n.screenArea,window:n.windowArea,lang:n.language,osname:n.osName,osver:n.osVersion,libver:n.SDKVersion,scene:n.scene||-1,menv:n.miniEnv,mver:n.miniVersion,hostname:n.hostName,hostver:n.hostVersion,platform:n.platform,biz_id:n.aid,x_auth_token:n.token};e.setEndpoint(i+s(n))});(o=n).on("start",function(){r(),u=!0}),n.on("init",function(){Ee(F.onLaunch).pipe(Ke(1)).subscribe(function(e){e=e.param.scene||-1;t({scene:e}),u&&r()}),yn().monitorNetworkType(function(e){e=e.networkType;n.set({networkType:e})})})},zt=function(r){r.on("beforeBuild",function(e){return n=e,t=r.config(),(e={}).aid=t.aid,e.pid=t.pid,e.view_id=t.viewId,e.user_id=t.userId,e.network_type=t.networkType,d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})});var n,t})},Lt=function(e){e.on("report",At)},Bt=function(n){n.on("init",function(){Ee(F.onHide).subscribe(function(){var e=n.getSender();e&&e.flush()})})},Vt=function(t){var r,o=!1;t.on("init",function(){r=X(),t.on("config",function(){var e,n=null===(e=t.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=X())-r<1e3&&n&&(e=n-(e+r)/2,isNaN(e)||t.set({offset:e})))})})};return me("lark"),function(e){var n,t,r,i,o,u,a,c,s,e=Ft(e);if(e)return(n=e).provide("sendEvent",function(e){e=L(e);e&&n.report({ev_type:z,payload:e,extra:{timestamp:Date.now()}})}),n.provide("sendLog",function(e){e=B(e);e&&n.report({ev_type:z,payload:e,extra:{timestamp:Date.now()}})}),(t=e).on("init",function(){var e,n=qn(t,Xn,Zn);n&&(n=(e=g(Fn(Kn,d(d({},n),{setPidAndViewId:function(e,n){t.set({pid:e,viewId:n,actionId:void 0})}}),t.report.bind(t)),2))[0],e=e[1],t.provide("sendPageview",n),t.provide("sendPageviewWithHide",e))}),(r=e).on("init",function(){var e,n=qn(r,et,nt);n&&(e=rt(r),e=g(Fn(Hn,n,e),1)[0],r.provide("captureException",e))}),(i=e).on("init",function(){var e,n,t,r,o=qn(i,Vn,Un);o&&(e=o.hookRequest,n=o.hookDownloadFile,t=o.hookUploadFile,r=[],e&&r.push("request"),n&&r.push("downloadFile"),t&&r.push("uploadFile"),Cn(i,r),Fn(An,o,i.report.bind(i)))}),(o=e).on("init",function(){var e=qn(o,at,ct);e&&(In(o),Fn(Wn,e,o.report.bind(o)))}),(u=e).on("init",function(){var e,n=qn(u,it,ot);n&&(n=(e=g(Fn(Jn,n,function(e){}),2))[0],e=e[1],u.provide("getBreadcrumbs",n),u.provide("addBreadcrumb",e))}),(a=e).on("init",function(){var e=qn(a,st,ft);e&&(Rn(a),Fn(Yn,e,a.report.bind(a)))}),(c=e).on("init",function(){var e=qn(c,lt,pt);e&&Fn($n,e,c.report.bind(c))}),(s=e).on("init",function(){var e=qn(s,dt,ht);e&&(Rn(s),Fn(Qn,e,s.report.bind(s)))}),e}.bind(null,[_e])()}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).larkClient=n()}(this,function(){"use strict";function n(e){var t,r=e.transport,o=e.endpoint,n=e.size,i=void 0===n?10:n,e=e.wait,u=void 0===e?1e3:e,a=[],c=0;function s(){var n;a.length&&(n=this.getBatchData(),r.post({url:o,data:n,fail:function(e){t&&t(e,n)}}),a=[])}return{getSize:function(){return i},getWait:function(){return u},setSize:function(e){i=e},setWait:function(e){u=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){a.push(e),a.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),u)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return a.length?(e=a,JSON.stringify({ev_type:"batch",list:e})):"";var e},clear:function(){clearTimeout(c),a=[]},fail:function(e){t=e}}}var r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var d=function(){return(d=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function g(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),u=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||((r=r||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(e){return e}function w(e){return"object"==typeof e&&null!==e}var t=Object.prototype;function i(e){if(w(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(e);e=Object.getPrototypeOf(e);return e===t||null===e}}function u(e){return"[object Array]"===t.toString.call(e)}function h(e){return"function"==typeof e}function a(e){return"number"==typeof e}function c(e){return"string"==typeof e}function p(e,n){var t,r,o=d({},e);for(t in n)r=t,Object.prototype.hasOwnProperty.call(n,r)&&void 0!==n[t]&&(w(n[t])&&i(n[t])?o[t]=p(w(e[t])?e[t]:{},n[t]):u(n[t])&&u(e[t])?o[t]=function n(e,t){e=u(e)?e:[];t=u(t)?t:[];return Array.prototype.concat.call(e,t).map(function(e){return e instanceof RegExp?e:w(e)&&i(e)?p({},e):u(e)?n([],e):e})}(e[t],n[t]):o[t]=n[t]);return o}function S(e,n){if(!u(e))return!1;if(0===e.length)return!1;for(var t=0;t<e.length;){if(e[t]===n)return!0;t++}return!1}function x(e,n){if(!u(e))return e;var t=e.indexOf(n);if(0<=t){n=e.slice();return n.splice(t,1),n}return e}function m(e){return u(e)&&e.length?function(e){for(var n=[],t=e.length,r=0;r<t;r++){var o=e[r];c(o)?n.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return new RegExp(n.join("|"),"i")}(e):null}function v(e){try{return c(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function s(t){return w(t)?Object.keys(t).reduce(function(e,n){return e+="&"+n+"="+t[n]},"").replace("&","?"):""}function E(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,y(["[SDK]",Date.now(),(""+T++).padStart(8," ")],g(e),!1))}function o(e){return Math.random()<Number(e)}function f(e,n){return e<Number(n)}function k(r){return function(e){for(var n=e,t=0;t<r.length&&n;t++)try{n=r[t](n)}catch(e){C(e)}return n}}var O=function(i,u,a,c){return void 0===c&&(c=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return l;var t=i[u],r=a.apply(void 0,y([t],g(e),!1)),o=r;return h(o)&&c&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return r.apply(this,n)}catch(e){return h(t)&&t.apply(this,n)}}),i[u]=o,function(e){e||(o===i[u]?i[u]=t:r=t)}}},j=0,C=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,y(["[SDK]",Date.now(),(""+j++).padStart(8," ")],g(e),!1))},T=0;function P(){var e=function(){for(var e=new Array(16),n=0,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);var r=0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[+r]],o[e[15]]].join("")}(e)}var D=function(e){var t,r,o,n=(t={},r={},o={set:function(e,n){return t[e]=n,r[e]=v(n),o},merge:function(n){return t=d(d({},t),n),Object.keys(n).forEach(function(e){r[e]=v(n[e])}),o},delete:function(e){return delete t[e],delete r[e],o},clear:function(){return t={},r={},o},get:function(e){return r[e]},toString:function(){return d({},r)}});e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})};function I(e,n){var t=e.common||{};return t.sample_rate=n,e.common=t,e}function R(e,n,t,r,o){return e?(i=o(r,n),function(){return i}):function(){return t(n)};var i}function M(e,n,t,r){if(void 0===(e=function(e,n,t){for(var r,n=g(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(r=g(i))[0],i=r.slice(1);if(e)return t(e,o)}(e,n,function(e,n){return e[n]})))return!1;var o,n="boolean"==typeof e?"bool":a(e)?"number":"string";return function(e,n,t){switch(t){case"eq":return S(n,e);case"neq":return!S(n,e);case"gt":return e>n[0];case"gte":return e>=n[0];case"lt":return e<n[0];case"lte":return e<=n[0];case"regex":return Boolean(e.match(new RegExp(n.join("|"))));case"not_regex":return!e.match(new RegExp(n.join("|")));default:return!1}}(e,(o=n,r.map(function(e){switch(o){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}})),t)}function N(n,e){try{return"rule"===e.type?M(n,e.field,e.op,e.values):"and"===e.type?e.children.every(function(e){return N(n,e)}):e.children.some(function(e){return N(n,e)})}catch(e){return!1}}function A(e,n,t,r){if(!n)return b;var o=n.sample_rate,i=n.include_users,u=n.sample_granularity,a=n.rules,n=void 0===(n=n.r)?Math.random():n;if(S(i,e))return function(e){return I(e,1)};var c,s,f,l,p,d,h,m=R(u="session"===u,o,t,n,r),v=(c=a,s=u,f=o,l=t,p=n,d=r,h={},Object.keys(c).forEach(function(e){var n=c[e],t=n.enable,r=n.sample_rate,n=n.conditional_sample_rules;t?(h[e]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:R(s,r,l,p,d)},n&&(h[e].conditional_hit_rules=n.map(function(e){var n=e.sample_rate,e=e.filter;return{sample_rate:n,hit:R(s,n,l,p,d),effectiveSampleRate:n*f,filter:e}}))):h[e]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(e){if(!m())return!1;if(!(e.ev_type in v))return I(e,o);if(!v[e.ev_type].enable)return!1;if(e.common&&e.common.sample_rate)return e;var n=v[e.ev_type],t=n.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(N(e,t[r].filter))return!!t[r].hit()&&I(e,t[r].effectiveSampleRate);return!!n.hit()&&I(e,n.effectiveSampleRate)}}var F,q=function(t){t.on("start",function(){var e=t.config(),n=e.userId,e=e.sample,e=A(n,e,o,f);t.on("build",e)})},z="custom",L=function(e){if(e&&w(e)&&e.name&&c(e.name)){var n={name:e.name,type:"event"};if("metrics"in e&&w(e.metrics)){var t=e.metrics,r={};for(o in t)a(t[o])&&(r[o]=t[o]);n.metrics=r}if("categories"in e&&w(e.categories)){var o,i=e.categories,u={};for(o in i)u[o]=v(i[o]);n.categories=u}return n}},B=function(e){if(e&&w(e)&&e.content&&c(e.content)){var n={content:v(e.content),type:"log",level:"info"};if("level"in e&&(n.level=e.level),"extra"in e&&w(e.extra)){var t,r=e.extra,o={},i={};for(t in r)a(r[t])?o[t]=r[t]:i[t]=v(r[t]);n.metrics=o,n.categories=i}return n}},V="Adapters imported incorrectly",U=["success","fail","complete"],H=20;(_e=F=F||{}).onLaunch="onLaunch",_e.onShow="onShow",_e.onHide="onHide",_e.onError="onError",_e.onPageNotFound="onPageNotFound",_e.onUnhandledRejection="onUnhandledRejection";function G(e){return"[object Object]"===Object.prototype.toString.call(e)}var K=["request","downloadFile","uploadFile"],J=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],W=y(y([],g([F.onLaunch,F.onShow,F.onHide]),!1),[F.onError,F.onPageNotFound,F.onUnhandledRejection],!1),Y=["attached","onInit"],$=["onLoad","onShow","onReady","onUnload","onHide"],Q="__HOOKED__";var X=function(){return Date.now()};function Z(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!h(e))return 0;var r,o=X();try{e.apply(this,n)}finally{r=X()}return r-o}function ee(e,n,r){var o=e[n];if(!o||!o[Q])return Object.defineProperty(e,n,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{var t=r.apply(this,e);t&&(e=t)}catch(e){C(e)}return o.apply(this,e)}}),e[n]&&(e[n][Q]=!0),function(){e[n][Q]=!1,r=pe}}function ne(t,e){Object.keys(e).forEach(function(n){e[n].addTearDown(function(){var e;return Se(t,((e={})[n]=null,e))})})}function te(e,n){n.addTearDown(function(){return we(e,null)})}function re(e){return xe("route")[e]}function oe(e){return!!xe("route")[e]}function ie(e){return xe("http")[e]}function ue(e){return!!xe("http")[e]}function ae(){return xe("setData")}function ce(){return!!xe("performance")}function se(){return xe("instance")}function fe(e){we("instance",e)}var le,pe=function(){},de=g((le="tt",[function(){return le},function(e){return le=e}]),2),he=de[0],me=de[1],ve=function(n,t){function e(e){return t(e),n.call(this,e)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},be=function(){var e={instance:null};return e.instance||("undefined"!=typeof tt?e={instance:tt,platform:he()}:"undefined"!=typeof my?e={instance:my,platform:"my"}:"undefined"!=typeof swan?e={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(e={instance:wx,platform:"wx"})),e},ge="__slardar__global__0.2.3-alpha.0",ye={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},_e=function(e,n){void 0===e&&(e={});var t=(n=void 0===n?be().instance:n)?n[ge]||(n[ge]=e):e;return{setGlobalValue:function(e,n){t[e]=n},mergeGlobalValue:function(e,n){t[e]=d(d({},t[e]),n)},getGlobalValue:function(e){return t[e]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},ye),n&&(n[ge]=t)}}}(d({},ye)),we=_e.setGlobalValue,Se=_e.mergeGlobalValue,xe=_e.getGlobalValue,Ee=function(e){return xe("app")[e]},ke=function(e){return xe("page")[e]},Oe=function(t){J.forEach(function(n){oe(n)&&re(n).subscribe(function(e){return t(e,n)})})},je=function(e){return xe("component")[e]};function Ce(e){return"function"==typeof e}function Te(e,n){!e||0<=(n=e.indexOf(n))&&e.splice(n,1)}function Pe(e){return e}function De(t){return function(e){if((n=e)&&Ce(n.lift))return e.lift(function(e){try{return t(e,this)}catch(e){this.error(e)}});var n;throw new TypeError("Unable to lift unknown Observable type")}}function Ie(e){Ce(e)?e():null!=e&&e.unsubscribe()}var Re=function(e){return e instanceof Me||e&&"closed"in e&&Ce(e.remove)&&Ce(e.add)&&Ce(e.unsubscribe)},Me=(Ne.prototype.unsubscribe=function(){var e,n,t,r=this;this.closed||(this.closed=!0,e=this._parentage,n=this._finalizers,t=this.initialTeardown,e&&(this._parentage=null,e.forEach(function(e){return e.remove(r)})),Ce(t)&&t(),n&&(this._finalizers=null,n.forEach(Ie)))},Ne.prototype.remove=function(e){this._finalizers&&Te(this._finalizers,e),e instanceof Ne&&e._removeParent(this)},Ne.prototype.add=function(e){if(e&&e!==this)if(this.closed)Ie(e);else{if(e instanceof Ne){if(e.closed||e._hasParent(this))return;e._addParent(this)}var n=this._finalizers;this._finalizers=n?(n.push(e),n):[e]}},Ne.prototype._addParent=function(e){var n=this._parentage;this._parentage=n?(n.push(e),n):[e]},Ne.prototype._hasParent=function(e){return this._parentage&&~this._parentage.indexOf(e)},Ne.prototype._removeParent=function(e){this._parentage&&Te(this._parentage,e)},Ne);function Ne(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var Ae,Fe=(e(qe,Ae=Me),qe.prototype.next=function(e){this.isStopped||this.destination.next(e)},qe.prototype.error=function(e){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(e)}finally{this.unsubscribe()}}},qe.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},qe.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Ae.prototype.unsubscribe.call(this),this.destination=null)},qe.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},qe);function qe(e){var n=Ae.call(this)||this;return n.isStopped=!1,n.destination=Be(e)?e:new ze(!(e=e)||Ce(e)?{next:null!=e?e:void 0}:e),n}var ze=(Le.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(e){console.error("ConsumerObserver.next error",e)}},Le.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(e){console.error("ConsumerObserver.error error",e)}},Le.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){console.error("ConsumerObserver.complete error",e)}},Le);function Le(e){this.partialObserver=e}function Be(e){return e instanceof Fe||e&&((n=e)&&Ce(n.next)&&Ce(n.error)&&Ce(n.complete))&&Re(e);var n}Ve.prototype.subscribe=function(e){var n=Be(e)?e:new Fe(e),t=this.operator,e=this.source;return n.add(t?t.call(n,e):this._trySubscribe(n)),n},Ve.prototype.lift=function(e){var n=new Ve;return n.source=this,n.operator=e,n},Ve.prototype.pipe=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(n=e).length?Pe:1===n.length?n[0]:function(e){return n.reduce(function(e,n){return n(e)},e)})(this)},Ve.prototype._subscribe=function(e){},Ve.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},de=Ve;function Ve(e){e&&(this._subscribe=e)}var Ue,_e=(e(He,Ue=de),He.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(e){return e.next(n)})},He.prototype.commonJudgement=function(e){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,e())},He.prototype.error=function(n){var t=this;this.commonJudgement(function(){var e=t.observers;for(t.hasError=!0,t.thrownError=n;e.length;)e.shift().error(n)})},Object.defineProperty(He.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),He.prototype.complete=function(){var n=this;this.commonJudgement(function(){for(var e=n.observers;e.length;)e.shift().complete()})},He.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},He.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},He.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},He.prototype._checkFinalizedStatuses=function(e){var n=this.hasError,t=this.thrownError,r=this.isStopped;n?e.error(t):r&&e.complete()},He.prototype._innerSubscribe=function(e){var n=this.isStopped,t=this.observers;return n?He.EMPTY:(t.push(e),new Me(function(){Te(t,e)}))},He.EMPTY=((_e=new Me).closed=!0,_e),He);function He(){var e=null!==Ue&&Ue.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var Ge=new de(function(e){return e.complete()});function Ke(r){return r<=0?function(){return Ge}:De(function(e,n){var t=0;e.subscribe(function(e){++t<=r&&(n.next(e),r<=t&&n.complete())})})}function Je(r,o){return De(function(e,n){var t=0;e.subscribe(function(e){return r.call(o,e,t++)&&n.next(e)})})}function We(t){return Je(function(e,n){return t<=n})}var Ye,$e=(e(Qe,Ye=_e),Qe.prototype.subscribe=function(e){var t=this,e=Ye.prototype.subscribe.call(this,e);se()&&se()._subscriptions.push(e);var r=e.unsubscribe;return e.unsubscribe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(this,e),t.observed||t.unsubscribe()},e},Qe.prototype.unsubscribe=function(){Ye.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(e){return e()})},Qe.prototype.addTearDown=function(e){this.tearDownFns.push(e)},Qe);function Qe(){var e=null!==Ye&&Ye.apply(this,arguments)||this;return e.tearDownFns=[],e}function Xe(e){var n=e.reduce(function(e,n){return e[n]=new $e,e},{});return{getSubject:function(e){return n[e]},subjectMap:n}}function Ze(e){return 1<e.length?e:e.length&&e[0]||{}}function en(e){var t=e.filter(function(e){return e=e,!!!xe("app")[e]}),e=Xe(t).subjectMap;Se("app",e=e),ne("app",e),App=ve(App,function(n){t.forEach(function(e){var r=Ee(e),e=O(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.next({that:this,param:Ze(e),time:X()}),h(t)&&t.apply(this,e)}})();e&&r.addTearDown(e)})})}function nn(e){return e.route||e.__route__||e.url||e.path||""}function tn(e){function n(e,i){r.forEach(function(o){O(e,o,function(r){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];je(o).next({that:this,param:null,time:X()});var t=i[o];if(h(t)&&t.apply(this,e),h(r))return r.apply(this,e)}})()})}var t=["attached"],r=e.filter(function(e){return~t.indexOf(e)});try{Component=ve(Component,function(e){w(e.lifetimes)?n(e.lifetimes,e):void 0!==e.lifetimes&&null!==e.lifetimes||(e.lifetimes={},n(e.lifetimes,e))})}catch(e){}}function rn(e){function n(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(e(d({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;Oe(function(e,n){"invoke"===e.param.name&&(o=!1,r={navigate_start:e.time,navigate_name:n})}),ke("onLoad").pipe(We(1)).subscribe(function(e){r.load_start=e.time}),ke("onShow").pipe(We(1)).subscribe(function(e){r.dom_end=e.time}),ke("onReady").pipe(We(1)).subscribe(function(e){r.render_end=e.time,n(),t()}),Ee(F.onHide).subscribe(function(){!1===o&&(n(),t())})}function on(n){je("attached").subscribe(function(e){e=e.that;return n.call(e)})}function un(e){return"android"===e.toLowerCase()}function an(e){return un(e)?"Android":"ios"===e.toLowerCase()?"iOS":~Sn.indexOf(e.toLowerCase())?"Mac":~xn.indexOf(e.toLowerCase())?"windows":"unknown"}function cn(e){var n=e.systemPlatform,t=e.pixelRatio,r=e.width,e=e.height;return n&&un(n)&&t?r/t+" * "+e/t:r+" * "+e}function sn(e){return(c(e)?kn:En)(e)}function fn(){return d({appId:"",miniEnv:"",miniVersion:"",platform:jn},On())}function ln(e){var n=e.filter(function(e){return e=e,!!!xe("component")[e]}),e=Xe(n).subjectMap;Se("component",e=e),ne("component",e),yn().componentSubject(n)}function pn(n){function e(e){G(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))}try{Component=ve(Component,e),Behavior=ve(Behavior,e)}catch(e){}}function dn(e,n){var t=e.filter(function(e){return e=e,!!!xe("page")[e]}),e=Xe(t).subjectMap;Se("page",e=e),ne("page",e),e=function(n){t.forEach(function(e){var r=ke(e),e=O(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(nn(this)&&r.next({that:this,param:Ze(e),time:X()}),h(t))return t.apply(this,e)}})();e&&r.addTearDown(e)})},Page=ve(Page,e),pn(e)}function hn(e){var n=e.filter(function(e){return!oe(e)}),t=Xe(n).subjectMap;Se("route",e=t),ne("route",e),n.forEach(function(i){var e=ee(yn().instance,i,function(o){void 0===o&&(o={}),re(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:X()}),U.forEach(function(r){O(o,r,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];re(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:Ze(e)||{}},time:X()}),h(t)&&t.apply(this,e)}})()})});e&&t[i].addTearDown(e)})}function mn(a,e){var n=e.url,t=e.method,r=e.data,o=e.header,i=e.headers,c={api:a,request:{url:n,method:(n=t,"uploadFile"===(t=a)?"POST":"downloadFile"!==t&&n||"GET"),headers:o||i||{},body:v(r),timestamp:X()},response:{}};O(e,"complete",function(u){return function(e){var n=c.response.timestamp||X();c.duration=n-c.request.timestamp,c.completeCallbackTime=Z(u,e);var t,r,o,i=e.errMsg||e.errorMessage||e.error;c.response={status:(t=e.status,r=e.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:n,headers:e.header||e.headers||{},body:v(e.data),errMsg:i,timing:yn().buildRequestProfile(e.profile||{})},ie(a).next(c)}})(),O(e,"success",function(n){return function(e){c.response.timestamp=X(),c.response.status=200,c.successCallbackTime=Z(n,e)}})(),O(e,"fail",function(n){return function(e){c.response.timestamp=X(),c.response.status=-1,c.failCallbackTime=Z(n,e)}})()}function vn(e,t){void 0===t&&(t=yn().instance);var n=e.filter(function(e){return!ue(e)}),r=Xe(n).subjectMap;Se("http",e=r),ne("http",e),n.forEach(function(n){var e=ee(t,n,function(e){mn(n,e)});e&&r[n].addTearDown(e)})}var bn,de=g((bn={},[function(e){if(!be().platform)throw Error("Not support current Mini Program");if(!Array.isArray(e)||!e.length)return null;e=e.find(function(e){return e.platform===be().platform});return e&&(bn=e.adapterCtor())},function(){return bn}]),2),gn=de[0],yn=de[1],_n=function(e){return"SLARDAR"+e},wn=function(e){try{return yn().getStorage(e)}catch(e){return}},Sn=["darwin","macs","mac"],xn=["windows_nt","windows","window"],En=function(e){return{name:"unknown_error_name",message:v(e)}},kn=function(e){var n=e.split("\n"),n=g((n[0]&&n[0].split(":")||[]).map(function(e){return e.trim()}),2);return{name:n[0],message:n[1],stack:e}},On=function(){var e=tt.getSystemInfoSync(),n=e.model,t=e.brand,r=e.pixelRatio,o=e.screenHeight,i=e.screenWidth,u=e.windowHeight,a=e.windowWidth,c=e.language,s=e.version,f=e.system,l=e.platform,p=e.SDKVersion,e=e.appName;return{model:n,brand:t,pixelRatio:r,screenArea:cn({width:i,height:o}),windowArea:cn({width:a,height:u}),language:c,osName:an(l),osVersion:f,SDKVersion:p,hostName:e,hostVersion:s}},jn="lark",_e={platform:jn,adapterCtor:function(){return d(d({},{instance:t=void 0===t?be().instance:t,request:function(e){return t.request(e)},getStorage:function(e){return t.getStorageSync(e)},setStorage:function(e,n){return t.setStorageSync(e,n)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(e){return e},monitorNetworkType:function(n){t.getNetworkType({success:function(e){n&&n({networkType:e.networkType})}}),t.onNetworkStatusChange(function(e){n&&n({networkType:e.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:jn,buildError:sn,getSystemInfo:fn,componentSubject:tn,pagePerfSubscriber:rn,setDataSubject:on});var t}},Cn=function(e,n){void 0===n&&(n=K),e.on("init",function(){vn(n)})};function Tn(){var u=nn(this),a=ae();var e=ee(this,"setData",function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=r[0],i=X();return[o,function(){var e=r[1],n=X()-i;a.next({renderTime:n,url:u,data:o,startTime:i}),e&&e.call(t)}]});e&&a.addTearDown(e)}function Pn(){var e;xe("setData")||(e=(e=Xe(["setData"]).getSubject)("setData"),we("setData",e),te("setData",e))}function Dn(o){return Object.keys(o).reduce(function(e,n){var t,r;return r=o[t=n],t&&r&&(Mn.test(t)||Nn.test(r))||(e[n]=o[n]),e},{})}var In=function(e){e.on("init",function(){Pn(),ke("onLoad").subscribe(function(e){e=e.that;Tn.call(e)}),yn().setDataSubject(Tn)})},Rn=function(e){e.on("init",function(){var n,e,t,r=yn();r.observePerformance&&!ce()&&(n=(0,Xe(["performance"]).getSubject)("performance"),we("performance",e=n),te("performance",e),(t=r.observePerformance(function(e){e.forEach(function(e){n.next(e)})}))&&t.disconnect&&n.addTearDown(function(){return t.disconnect()}))})},Mn=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),Nn=new RegExp("(bearer|session)","i"),An=function(){return function(e,s){var n=e.hookRequest,t=e.hookDownloadFile,r=e.hookUploadFile,f=e.ignoreUrls,l=e.collectBodyOnError,p=e.extraExtractor,e=function(e){var n,t,r,o,i,u,a,c;!function(e,n){e=m(e||[]);return!!e&&e.test(n)}(f,e.request.url)&&(c=e.response,n=e.request,t=e.api,r=e.duration,o=e.failCallbackTime,a=e.successCallbackTime,i=e.completeCallbackTime,n.headers=Dn(n.headers||{}),c.headers=Dn(c.headers||{}),u=c.errMsg,e=function(e,n){var t={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}(c,["errMsg"]),e=d(d({},e),{is_custom_error:!1}),u&&(e.err_msg=u),a={api:t,request:n,duration:r,cbTime:i+(o||0)+(a||0),response:e},!h(p)||(e=p(c.body,a))&&(a.extra=e,a.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete a.request.body,delete a.response.body),s({ev_type:"http",payload:a}))};n&&ie("request").subscribe(e),t&&ie("downloadFile").subscribe(e),r&&ie("uploadFile").subscribe(e)}},Fn=function(e,n,t,r){void 0===n&&(n={}),void 0===r&&(r=[]);try{var o=e.apply(void 0,y([],g(r),!1));return o&&o(n,t)||[]}catch(e){return C("applyMonitor",e),[]}};function qn(e,n,t){fe(e);n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return w(n)?d(d({},t),n):!!n&&t}function zn(e,n){return e&&n&&e===n}function Ln(){var r;return function(e){try{if(t=r,!(!(n=e)||!t)&&!(!zn(n.message,t.message)&&!zn(n.stack,t.stack)))return void(r=e)}catch(e){}var n,t;return r=e}}var Bn,Vn="http",Un={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},Hn=function(f){return void 0===f&&(f=yn()),function(e,r){var n=e.ignoreErrors,t=e.hookOnError,o=e.hookOnUnhandledRejection,i=e.hookRouteError,u=e.dedupe,a=m(n),c=Ln(),s=function(e,n,t){e=u?c(e):e;e&&(a&&a.test(e.message)||(e={error:e},n&&(e.extra=n),t&&(e.react=t),r(e)))};t&&Ee(F.onError).subscribe(function(e){e=e.param,e=f.buildError(e);a&&a.test(e.message)||s(e)}),o&&Ee(F.onUnhandledRejection).subscribe(function(e){var n=e.param||{},e=n.promise,t=v(n.reason);a&&a.test(t)||e.catch(b).then(function(e){var n={name:"UnhandledRejection",message:t};e&&e.stack&&(n.stack=e.stack),s(n)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&Oe(function(e){e=e.param;"fail"===(e=e).name&&s({name:"RouteError",message:e.value.errMsg})}),[s]}};(de=Bn=Bn||{}).history="history",de.manual="manual";function Gn(t,e,r){var o=e,i=null,u=0,n="launch";function a(e,n){o=n,u=X(),r(n,i=n+"_"+u),t(e,n)}return Ee(F.onShow).pipe(We(1)).subscribe(function(){n="show"}),Oe(function(){n="history"}),[a,function(e){e&&(a(n,e),n="history")},function(e){void 0===e&&(e="hide"),i&&(r(o,i),i=null,t(e,o,X()-u))}]}var Kn=function(){return function(e,r){var n=e.extractPid,t=e.routeMode,o=e.setPidAndViewId,i=function(e){return n?n(e):e},e=g(Gn(function(e,n,t){r({ev_type:"pageview",payload:{pid:n,source:e,duration:t}})},"",o),3),o=e[0],u=e[1],e=e[2];return t!==Bn.manual&&(ke("onShow").subscribe(function(e){return function(e){e=nn(e),e=i(e);u(e)}(e.that)}),ke("onUnload").subscribe(e.bind(null,"unload")),ke("onHide").subscribe(e.bind(null,"hide"))),[o.bind(null,"user_set"),e]}},Jn=function(){return function(e){var n=g(function(n,t,r){void 0===n&&(n=20),void 0===t&&(t=b),void 0===r&&(r=function(e,n){return e.slice(-n)});var o=[];return[function(){return o},function(e){t(e)&&(e=d(d({},e),{timestamp:e.timestamp||Date.now()}),o=0<=n&&o.length+1>n?r(y(y([],g(o),!1),[e],!1),n):y(y([],g(o),!1),[e],!1))}]}(e.maxBreadcrumbs,e.onAddBreadcrumb,e.onMaxBreadcrumbs),2),e=n[0],r=n[1];return K.forEach(function(e){ue(e)&&ie(e).subscribe(function(e){r({type:"http",category:e.api,message:"",data:{method:e.request.method,url:e.request.url,status_code:String(e.response.status)},timestamp:e.request.timestamp})})}),Oe(function(e,n){var t=e.param,e=e.time;"complete"===t.name&&r({type:"route",category:n,message:t.value.errMsg||t.value.errorMessage||"",timestamp:e,data:{url:t.url||""}})}),[e,r]}},Wn=function(){return function(e,t){var r=e.isCalculateSize;ae().subscribe(function(e){var n={duration:e.renderTime,start_time:e.startTime};r&&(n.size=(e=e.data,TextEncoder?(new TextEncoder).encode(v(e)).length:2*v(e).length)),t({ev_type:"set_data",payload:n})})}},Yn=function(){return function(e,n){function t(){n({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;Ee(F.onLaunch).pipe(Ke(1)).subscribe(function(e){r.activate_start=e.time}),Ee(F.onShow).pipe(Ke(1)).subscribe(function(e){r.init_end=e.time}),ke("onLoad").pipe(Ke(1)).subscribe(function(e){r.page_load_start=e.time}),ke("onShow").pipe(Ke(1)).subscribe(function(e){r.page_dom_end=e.time});var i=ce();ke("onReady").pipe(Ke(1)).subscribe(function(e){r.page_render_end=e.time,i&&!r.trigger||t()}),i&&xe("performance").pipe(Je(function(e){return"appClick"===e.name}),Ke(1)).subscribe(function(e){r.trigger=e.startTime,r.page_render_end&&t()}),Ee(F.onHide).subscribe(function(){o||t()})}},$n=function(){return function(e,n){yn().pagePerfSubscriber(function(e){return n({ev_type:"page_perf",payload:e})})}},Qn=function(n){return void 0===n&&(n=yn()),function(e,t){var r,o;ce()&&n.performanceSubscriber&&(r=0,ke("onLoad").subscribe(function(e){o=e.time,r++}),n.performanceSubscriber(function(e){var n={is_custom:!1,name:e.name,value:e.startTime,type:"perf",count:r};n.duration=e.duration||(o?e.startTime-o:0),n.is_support=0<=n.duration,t({ev_type:"performance",payload:n})}))}},Xn="pageview",Zn={routeMode:Bn.history,setPidAndViewId:function(e,n){}},et="jsError",nt={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},rt=function(t){return function(e){var n=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},e),{breadcrumbs:n})})}},ot={maxBreadcrumbs:20,tap:!0},it="breadcrumb",ut=function(n){n.on("init",function(){n.provide("_subscriptions",[]),fe(n),n.on("init",function(){en(W),dn($),ln(Y)}),n.on("init",function(){hn(J)})}),n.on("beforeDestroy",function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]})},at="setData",ct={isCalculateSize:!1},st="appLaunchPerf",ft={},lt="pagePerf",pt={},dt="performance",ht={},mt=function(e,n,t){void 0===t&&(t=yn());var r=n.url,o=n.data,i=n.success,u=void 0===i?l:i,a=n.fail,c=void 0===a?l:a,i=n.header,a={"Content-Type":"application/json"};G(n=i)&&0!==Object.keys(n).length&&Object.assign(a,i),t.request({method:e,url:r,data:o,header:a,headers:a,success:function(e){u(e)},fail:function(e){e=e.errMsg||"Network request failed";c(new Error(e))}})},vt=function(n){return(n=void 0===n?yn():n)?{get:function(e){return mt("GET",e,n)},post:function(e){return mt("POST",e,n)}}:{get:l,post:l}};function bt(e){return e=_n(String(e)),(e=wn(e))&&e.userId&&e.deviceId?e:{userId:P(),deviceId:P()}}function gt(e){return e+"_"+Date.now()}function yt(e){var n=e.aid,t=e.userId,e=e.deviceId;!function(e,n){try{yn().setStorage(e,n)}catch(e){}}(_n(String(n)),{userId:t,deviceId:e})}var _t={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:d(d({},e.extra||{}),e.overrides||{})}}},wt="/monitor_mini/collect",St="/settings/minipro",xt="apmplus.volces.com",Et="session",kt={sample_rate:1,include_users:[],sample_granularity:Et,rules:{}},Ot=[wt,St],jt="0.2.3-alpha.0",Ct="APM_PLUS_MINI_PROGRAM",Tt=function(e,n){return void 0===n&&(n=wt),(e&&0<=e.indexOf("//")?"":"https://")+e+n};function Pt(e){e=bt(e.aid);return{aid:0,token:"",pid:"",viewId:gt("_"),userId:e.userId,deviceId:e.deviceId,sessionId:P(),domain:xt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:Ot},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:kt,sdkName:Ct,sdkVersion:jt}}function Dt(e){var n,t=e.plugins||{};for(n in t)t[n]&&!w(t[n])&&(t[n]={});return d(d({},e),{plugins:t})}function It(e){return w(e)&&"aid"in e&&"token"in e}function Rt(e){return d({},e)}var Mt=function(n){var r,o,i=n,u={},a=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(e){var n,t;return u=d(d({},u),e||{}),s(),r||(r=e,i.useLocalConfig||!i.aid?(o={},c()):a?f():(n=i.domain,e=i.aid,t=function(e){a=e,f()},vt().get({url:function(e,n){return void 0===n&&(n=St),(e&&0<=e.indexOf("//")?"":"https://")+e+n}(n)+"?biz_id="+e,success:function(e){t(e&&e.data&&e.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(e){t=e},onReady:function(e){c=function(){yt(i),e()},o&&c()}};function s(){var e=d(d(d({},n),o||{}),u);e.plugins=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t={},r=0;r<e.length;)t=p(t,e[r++]);return t}(n.plugins,(null==o?void 0:o.plugins)||{},u.plugins||{}),e.sample=Nt(Nt(n.sample,null==o?void 0:o.sample),u.sample),i=e,t()}function f(){o=function(e){if(!e)return{};var n=e.sample,t=e.user_id,r=e.timestamp,o=t?{userId:t}:{};if(!n)return o;var i=n.sample_rate,e=n.sample_granularity,t=void 0===e?Et:e,e=n.include_users,n=n.rules,n=void 0===n?[]:n;return d(d({},o),{sample:{include_users:e,sample_rate:i,sample_granularity:t,rules:n.reduce(function(e,n){var t=n.name,r=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[t]={enable:r,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r})}(a),function(e){e=_n(e);return!!yn().getStorage(e)}(String(i.aid))&&(o.userId=n.userId),s(),c()}};function Nt(r,o){if(!r||!o)return r||o;var e=d(d({},r),o);return e.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),e.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(e,n){var t;return n in e||(n in(r.rules||{})&&n in(o.rules||{})?(e[n]=d(d({},r.rules[n]),o.rules[n]),e[n].conditional_sample_rules=y(y([],g(r.rules[n].conditional_sample_rules||[]),!1),g(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(t=r.rules)||void 0===t?void 0:t[n])||(null===(t=o.rules)||void 0===t?void 0:t[n])),e},{}),e}function At(e){var n={url:(n=yn().getCurrentPages().pop())?(n?nn(n):"")+s(n.options):"",timestamp:X()};return d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})})}function Ft(e){if(!gn(e))throw Error(V);var t,e=function(e){var t,r,n=e.builder,o=e.createSender,i=e.createDefaultConfig,u=e.createConfigManager,a=e.userConfigNormalizer,c=e.initConfigNormalizer,s=e.validateInitConfig,f={};_.forEach(function(e){return f[e]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(e){if(l)E("already inited");else{if(!(e&&w(e)&&s(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=c(e);if((r=u(n)).setConfig(e),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(e){l&&e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(a(e))),null==r?void 0:r.getConfig()},provide:function(e,n){S(m,e)?E("cannot provide "+e+", reserved"):(v[e]=n,b("provide",!1,e))},start:function(){var n=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(e){return n.build(e)}),h=[]}))},report:function(e){e&&(!(e=k(f.beforeReport)(e))||(e=k(f.report)(e))&&(p?this.build(e):h.push(e)))},build:function(e){!p||(e=k(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=k(f.build)(e))&&this.send(e))},send:function(e){!p||(e=k(f.beforeSend)(e))&&(t.send(e),b("send",!1,e))},destroy:function(){b("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&p||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=x(f[e],n))}},m=Object.keys(v);return v;function b(e,n){void 0===n&&(n=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[e].forEach(function(e){try{e.apply(void 0,y([],g(t),!1))}catch(e){}}),n&&(f[e].length=0)}}({validateInitConfig:It,initConfigNormalizer:Dt,userConfigNormalizer:Rt,createSender:function(e){return n({size:H,endpoint:Tt(e.domain),transport:vt()})},builder:_t,createDefaultConfig:Pt,createConfigManager:Mt});return D(e),Vt(e),zt(e),Lt(e),q(e),ut(e),(t=e).on("init",function(){var n=[],e=t.config();e&&e.integrations&&e.integrations.forEach(function(e){S(n,e.name)||(n.push(e.name),e.setup(t),e.tearDown&&t.on("beforeDestroy",e.tearDown))})}),Bt(e),qt(e),e}var qt=function(n){function t(e){return void 0===e&&(e=yn().getSystemInfo()),n.set(d({},e))}function r(){t(),e()}var o,i,u=!1,e=(i="",function(){var e=o.getSender();i=i||e.getEndpoint();var n=o.config(),n={did:n.deviceId,sid:n.sessionId,sname:n.sdkName,sver:n.sdkVersion,soffset:n.offset||0,model:n.model,brand:n.brand,ratio:n.pixelRatio,screen:n.screenArea,window:n.windowArea,lang:n.language,osname:n.osName,osver:n.osVersion,libver:n.SDKVersion,scene:n.scene||-1,menv:n.miniEnv,mver:n.miniVersion,hostname:n.hostName,hostver:n.hostVersion,platform:n.platform,biz_id:n.aid,x_auth_token:n.token};e.setEndpoint(i+s(n))});(o=n).on("start",function(){r(),u=!0}),n.on("init",function(){Ee(F.onLaunch).pipe(Ke(1)).subscribe(function(e){e=e.param.scene||-1;t({scene:e}),u&&r()}),yn().monitorNetworkType(function(e){e=e.networkType;n.set({networkType:e})})})},zt=function(r){r.on("beforeBuild",function(e){return n=e,t=r.config(),(e={}).aid=t.aid,e.pid=t.pid,e.view_id=t.viewId,e.user_id=t.userId,e.network_type=t.networkType,d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})});var n,t})},Lt=function(e){e.on("report",At)},Bt=function(n){n.on("init",function(){Ee(F.onHide).subscribe(function(){var e=n.getSender();e&&e.flush()})})},Vt=function(t){var r,o=!1;t.on("init",function(){r=X(),t.on("config",function(){var e,n=null===(e=t.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=X())-r<1e3&&n&&(e=n-(e+r)/2,isNaN(e)||t.set({offset:e})))})})};return me("lark"),function(e){var n,t,r,i,o,u,a,c,s,e=Ft(e);if(e)return(n=e).provide("sendEvent",function(e){e=L(e);e&&n.report({ev_type:z,payload:e,extra:{timestamp:Date.now()}})}),n.provide("sendLog",function(e){e=B(e);e&&n.report({ev_type:z,payload:e,extra:{timestamp:Date.now()}})}),(t=e).on("init",function(){var e,n=qn(t,Xn,Zn);n&&(n=(e=g(Fn(Kn,d(d({},n),{setPidAndViewId:function(e,n){t.set({pid:e,viewId:n,actionId:void 0})}}),t.report.bind(t)),2))[0],e=e[1],t.provide("sendPageview",n),t.provide("sendPageviewWithHide",e))}),(r=e).on("init",function(){var e,n=qn(r,et,nt);n&&(e=rt(r),e=g(Fn(Hn,n,e),1)[0],r.provide("captureException",e))}),(i=e).on("init",function(){var e,n,t,r,o=qn(i,Vn,Un);o&&(e=o.hookRequest,n=o.hookDownloadFile,t=o.hookUploadFile,r=[],e&&r.push("request"),n&&r.push("downloadFile"),t&&r.push("uploadFile"),Cn(i,r),Fn(An,o,i.report.bind(i)))}),(o=e).on("init",function(){var e=qn(o,at,ct);e&&(In(o),Fn(Wn,e,o.report.bind(o)))}),(u=e).on("init",function(){var e,n=qn(u,it,ot);n&&(n=(e=g(Fn(Jn,n,function(e){}),2))[0],e=e[1],u.provide("getBreadcrumbs",n),u.provide("addBreadcrumb",e))}),(a=e).on("init",function(){var e=qn(a,st,ft);e&&(Rn(a),Fn(Yn,e,a.report.bind(a)))}),(c=e).on("init",function(){var e=qn(c,lt,pt);e&&Fn($n,e,c.report.bind(c))}),(s=e).on("init",function(){var e=qn(s,dt,ht);e&&(Rn(s),Fn(Qn,e,s.report.bind(s)))}),e}.bind(null,[_e])()}); |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).marsClient=n()}(this,function(){"use strict";function n(e){var t,r=e.transport,o=e.endpoint,n=e.size,i=void 0===n?10:n,e=e.wait,a=void 0===e?1e3:e,u=[],c=0;function s(){var n;u.length&&(n=this.getBatchData(),r.post({url:o,data:n,fail:function(e){t&&t(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),a)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return u.length?(e=u,JSON.stringify({ev_type:"batch",list:e})):"";var e},clear:function(){clearTimeout(c),u=[]},fail:function(e){t=e}}}var r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var d=function(){return(d=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function h(e,n){var t={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}function g(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||((r=r||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(e){return e}function w(e){return"object"==typeof e&&null!==e}var t=Object.prototype;function i(e){if(w(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(e);e=Object.getPrototypeOf(e);return e===t||null===e}}function a(e){return"[object Array]"===t.toString.call(e)}function m(e){return"function"==typeof e}function u(e){return"number"==typeof e}function c(e){return"string"==typeof e}function p(e,n){var t,r,o=d({},e);for(t in n)r=t,Object.prototype.hasOwnProperty.call(n,r)&&void 0!==n[t]&&(w(n[t])&&i(n[t])?o[t]=p(w(e[t])?e[t]:{},n[t]):a(n[t])&&a(e[t])?o[t]=function n(e,t){e=a(e)?e:[];t=a(t)?t:[];return Array.prototype.concat.call(e,t).map(function(e){return e instanceof RegExp?e:w(e)&&i(e)?p({},e):a(e)?n([],e):e})}(e[t],n[t]):o[t]=n[t]);return o}function S(e,n){if(!a(e))return!1;if(0===e.length)return!1;for(var t=0;t<e.length;){if(e[t]===n)return!0;t++}return!1}function E(e,n){if(!a(e))return e;var t=e.indexOf(n);if(0<=t){n=e.slice();return n.splice(t,1),n}return e}function v(e){return a(e)&&e.length?function(e){for(var n=[],t=e.length,r=0;r<t;r++){var o=e[r];c(o)?n.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return new RegExp(n.join("|"),"i")}(e):null}function x(e){try{return c(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function s(t){return w(t)?Object.keys(t).reduce(function(e,n){return e+="&"+n+"="+t[n]},"").replace("&","?"):""}function k(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,y(["[SDK]",Date.now(),(""+P++).padStart(8," ")],g(e),!1))}function o(e){return Math.random()<Number(e)}function f(e,n){return e<Number(n)}function O(r){return function(e){for(var n=e,t=0;t<r.length&&n;t++)try{n=r[t](n)}catch(e){C(e)}return n}}var T=function(i,a,u,c){return void 0===c&&(c=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return l;var t=i[a],r=u.apply(void 0,y([t],g(e),!1)),o=r;return m(o)&&c&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return r.apply(this,n)}catch(e){return m(t)&&t.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=t:r=t)}}},j=0,C=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,y(["[SDK]",Date.now(),(""+j++).padStart(8," ")],g(e),!1))},P=0;function D(){var e=function(){for(var e=new Array(16),n=0,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);var r=0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[+r]],o[e[15]]].join("")}(e)}var I=function(e){var t,r,o,n=(t={},r={},o={set:function(e,n){return t[e]=n,r[e]=x(n),o},merge:function(n){return t=d(d({},t),n),Object.keys(n).forEach(function(e){r[e]=x(n[e])}),o},delete:function(e){return delete t[e],delete r[e],o},clear:function(){return t={},r={},o},get:function(e){return r[e]},toString:function(){return d({},r)}});e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})};function R(e,n){var t=e.common||{};return t.sample_rate=n,e.common=t,e}function N(e,n,t,r,o){return e?(i=o(r,n),function(){return i}):function(){return t(n)};var i}function M(e,n,t,r){if(void 0===(e=function(e,n,t){for(var r,n=g(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(r=g(i))[0],i=r.slice(1);if(e)return t(e,o)}(e,n,function(e,n){return e[n]})))return!1;var o,n="boolean"==typeof e?"bool":u(e)?"number":"string";return function(e,n,t){switch(t){case"eq":return S(n,e);case"neq":return!S(n,e);case"gt":return e>n[0];case"gte":return e>=n[0];case"lt":return e<n[0];case"lte":return e<=n[0];case"regex":return Boolean(e.match(new RegExp(n.join("|"))));case"not_regex":return!e.match(new RegExp(n.join("|")));default:return!1}}(e,(o=n,r.map(function(e){switch(o){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}})),t)}function A(n,e){try{return"rule"===e.type?M(n,e.field,e.op,e.values):"and"===e.type?e.children.every(function(e){return A(n,e)}):e.children.some(function(e){return A(n,e)})}catch(e){return!1}}function F(e,n,t,r){if(!n)return b;var o=n.sample_rate,i=n.include_users,a=n.sample_granularity,u=n.rules,n=void 0===(n=n.r)?Math.random():n;if(S(i,e))return function(e){return R(e,1)};var c,s,f,l,p,d,h,m=N(a="session"===a,o,t,n,r),v=(c=u,s=a,f=o,l=t,p=n,d=r,h={},Object.keys(c).forEach(function(e){var n=c[e],t=n.enable,r=n.sample_rate,n=n.conditional_sample_rules;t?(h[e]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:N(s,r,l,p,d)},n&&(h[e].conditional_hit_rules=n.map(function(e){var n=e.sample_rate,e=e.filter;return{sample_rate:n,hit:N(s,n,l,p,d),effectiveSampleRate:n*f,filter:e}}))):h[e]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(e){if(!m())return!1;if(!(e.ev_type in v))return R(e,o);if(!v[e.ev_type].enable)return!1;if(e.common&&e.common.sample_rate)return e;var n=v[e.ev_type],t=n.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(A(e,t[r].filter))return!!t[r].hit()&&R(e,t[r].effectiveSampleRate);return!!n.hit()&&R(e,n.effectiveSampleRate)}}var q,z=function(t){t.on("start",function(){var e=t.config(),n=e.userId,e=e.sample,e=F(n,e,o,f);t.on("build",e)})},L="custom",V=function(e){if(e&&w(e)&&e.name&&c(e.name)){var n={name:e.name,type:"event"};if("metrics"in e&&w(e.metrics)){var t=e.metrics,r={};for(o in t)u(t[o])&&(r[o]=t[o]);n.metrics=r}if("categories"in e&&w(e.categories)){var o,i=e.categories,a={};for(o in i)a[o]=x(i[o]);n.categories=a}return n}},B=function(e){if(e&&w(e)&&e.content&&c(e.content)){var n={content:x(e.content),type:"log",level:"info"};if("level"in e&&(n.level=e.level),"extra"in e&&w(e.extra)){var t,r=e.extra,o={},i={};for(t in r)u(r[t])?o[t]=r[t]:i[t]=x(r[t]);n.metrics=o,n.categories=i}return n}},U="Adapters imported incorrectly",H=["success","fail","complete"],G=20;(we=q=q||{}).onLaunch="onLaunch",we.onShow="onShow",we.onHide="onHide",we.onError="onError",we.onPageNotFound="onPageNotFound",we.onUnhandledRejection="onUnhandledRejection";function K(e){return"[object Object]"===Object.prototype.toString.call(e)}var J=["request","downloadFile","uploadFile"],W=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],Y=y(y([],g([q.onLaunch,q.onShow,q.onHide]),!1),[q.onError,q.onPageNotFound,q.onUnhandledRejection],!1),$=["attached","onInit"],Q=["onLoad","onShow","onReady","onUnload","onHide"],X="__HOOKED__";var Z=function(){return Date.now()};function ee(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!m(e))return 0;var r,o=Z();try{e.apply(this,n)}finally{r=Z()}return r-o}function ne(e,n,r){var o=e[n];if(!o||!o[X])return Object.defineProperty(e,n,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{var t=r.apply(this,e);t&&(e=t)}catch(e){C(e)}return o.apply(this,e)}}),e[n]&&(e[n][X]=!0),function(){e[n][X]=!1,r=de}}function te(t,e){Object.keys(e).forEach(function(n){e[n].addTearDown(function(){var e;return Ee(t,((e={})[n]=null,e))})})}function re(e,n){n.addTearDown(function(){return Se(e,null)})}function oe(e){return xe("route")[e]}function ie(e){return!!xe("route")[e]}function ae(e){return xe("http")[e]}function ue(e){return!!xe("http")[e]}function ce(){return xe("setData")}function se(){return!!xe("performance")}function fe(){return xe("instance")}function le(e){Se("instance",e)}var pe,de=function(){},he=g((pe="tt",[function(){return pe},function(e){return pe=e}]),2),me=he[0],ve=he[1],be=function(n,t){function e(e){return t(e),n.call(this,e)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},ge=function(){var e={instance:null};return e.instance||("undefined"!=typeof tt?e={instance:tt,platform:me()}:"undefined"!=typeof my?e={instance:my,platform:"my"}:"undefined"!=typeof swan?e={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(e={instance:wx,platform:"wx"})),e},ye="__slardar__global__0.2.2",_e={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},we=function(e,n){void 0===e&&(e={});var t=(n=void 0===n?ge().instance:n)?n[ye]||(n[ye]=e):e;return{setGlobalValue:function(e,n){t[e]=n},mergeGlobalValue:function(e,n){t[e]=d(d({},t[e]),n)},getGlobalValue:function(e){return t[e]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},_e),n&&(n[ye]=t)}}}(d({},_e)),Se=we.setGlobalValue,Ee=we.mergeGlobalValue,xe=we.getGlobalValue,ke=function(e){return xe("app")[e]},Oe=function(e){return xe("page")[e]},Te=function(t){W.forEach(function(n){ie(n)&&oe(n).subscribe(function(e){return t(e,n)})})},je=function(){return xe("performance")},Ce=function(e){return xe("component")[e]};function Pe(e){return"function"==typeof e}function De(e,n){!e||0<=(n=e.indexOf(n))&&e.splice(n,1)}function Ie(e){return e}function Re(t){return function(e){if((n=e)&&Pe(n.lift))return e.lift(function(e){try{return t(e,this)}catch(e){this.error(e)}});var n;throw new TypeError("Unable to lift unknown Observable type")}}function Ne(e){Pe(e)?e():null!=e&&e.unsubscribe()}var Me=function(e){return e instanceof Ae||e&&"closed"in e&&Pe(e.remove)&&Pe(e.add)&&Pe(e.unsubscribe)},Ae=(Fe.prototype.unsubscribe=function(){var e,n,t,r=this;this.closed||(this.closed=!0,e=this._parentage,n=this._finalizers,t=this.initialTeardown,e&&(this._parentage=null,e.forEach(function(e){return e.remove(r)})),Pe(t)&&t(),n&&(this._finalizers=null,n.forEach(Ne)))},Fe.prototype.remove=function(e){this._finalizers&&De(this._finalizers,e),e instanceof Fe&&e._removeParent(this)},Fe.prototype.add=function(e){if(e&&e!==this)if(this.closed)Ne(e);else{if(e instanceof Fe){if(e.closed||e._hasParent(this))return;e._addParent(this)}var n=this._finalizers;this._finalizers=n?(n.push(e),n):[e]}},Fe.prototype._addParent=function(e){var n=this._parentage;this._parentage=n?(n.push(e),n):[e]},Fe.prototype._hasParent=function(e){return this._parentage&&~this._parentage.indexOf(e)},Fe.prototype._removeParent=function(e){this._parentage&&De(this._parentage,e)},Fe);function Fe(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var qe,ze=(e(Le,qe=Ae),Le.prototype.next=function(e){this.isStopped||this.destination.next(e)},Le.prototype.error=function(e){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(e)}finally{this.unsubscribe()}}},Le.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Le.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,qe.prototype.unsubscribe.call(this),this.destination=null)},Le.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Le);function Le(e){var n=qe.call(this)||this;return n.isStopped=!1,n.destination=Ue(e)?e:new Ve(!(e=e)||Pe(e)?{next:null!=e?e:void 0}:e),n}var Ve=(Be.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(e){console.error("ConsumerObserver.next error",e)}},Be.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(e){console.error("ConsumerObserver.error error",e)}},Be.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){console.error("ConsumerObserver.complete error",e)}},Be);function Be(e){this.partialObserver=e}function Ue(e){return e instanceof ze||e&&((n=e)&&Pe(n.next)&&Pe(n.error)&&Pe(n.complete))&&Me(e);var n}He.prototype.subscribe=function(e){var n=Ue(e)?e:new ze(e),t=this.operator,e=this.source;return n.add(t?t.call(n,e):this._trySubscribe(n)),n},He.prototype.lift=function(e){var n=new He;return n.source=this,n.operator=e,n},He.prototype.pipe=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(n=e).length?Ie:1===n.length?n[0]:function(e){return n.reduce(function(e,n){return n(e)},e)})(this)},He.prototype._subscribe=function(e){},He.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},he=He;function He(e){e&&(this._subscribe=e)}var Ge,we=(e(Ke,Ge=he),Ke.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(e){return e.next(n)})},Ke.prototype.commonJudgement=function(e){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,e())},Ke.prototype.error=function(n){var t=this;this.commonJudgement(function(){var e=t.observers;for(t.hasError=!0,t.thrownError=n;e.length;)e.shift().error(n)})},Object.defineProperty(Ke.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Ke.prototype.complete=function(){var n=this;this.commonJudgement(function(){for(var e=n.observers;e.length;)e.shift().complete()})},Ke.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Ke.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Ke.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},Ke.prototype._checkFinalizedStatuses=function(e){var n=this.hasError,t=this.thrownError,r=this.isStopped;n?e.error(t):r&&e.complete()},Ke.prototype._innerSubscribe=function(e){var n=this.isStopped,t=this.observers;return n?Ke.EMPTY:(t.push(e),new Ae(function(){De(t,e)}))},Ke.EMPTY=((we=new Ae).closed=!0,we),Ke);function Ke(){var e=null!==Ge&&Ge.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var Je=new he(function(e){return e.complete()});function We(r){return r<=0?function(){return Je}:Re(function(e,n){var t=0;e.subscribe(function(e){++t<=r&&(n.next(e),r<=t&&n.complete())})})}function Ye(r,o){return Re(function(e,n){var t=0;e.subscribe(function(e){return r.call(o,e,t++)&&n.next(e)})})}function $e(t){return Ye(function(e,n){return t<=n})}var Qe,Xe=(e(Ze,Qe=we),Ze.prototype.subscribe=function(e){var t=this,e=Qe.prototype.subscribe.call(this,e);fe()&&fe()._subscriptions.push(e);var r=e.unsubscribe;return e.unsubscribe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(this,e),t.observed||t.unsubscribe()},e},Ze.prototype.unsubscribe=function(){Qe.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(e){return e()})},Ze.prototype.addTearDown=function(e){this.tearDownFns.push(e)},Ze);function Ze(){var e=null!==Qe&&Qe.apply(this,arguments)||this;return e.tearDownFns=[],e}function en(e){var n=e.reduce(function(e,n){return e[n]=new Xe,e},{});return{getSubject:function(e){return n[e]},subjectMap:n}}function nn(e){return 1<e.length?e:e.length&&e[0]||{}}function tn(e){var t=e.filter(function(e){return e=e,!!!xe("app")[e]}),e=en(t).subjectMap;Ee("app",e=e),te("app",e),App=be(App,function(n){t.forEach(function(e){var r=ke(e),e=T(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.next({that:this,param:nn(e),time:Z()}),m(t)&&t.apply(this,e)}})();e&&r.addTearDown(e)})})}function rn(e){return e.route||e.__route__||e.url||e.path||""}function on(e){function n(e,i){r.forEach(function(o){T(e,o,function(r){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];Ce(o).next({that:this,param:null,time:Z()});var t=i[o];if(m(t)&&t.apply(this,e),m(r))return r.apply(this,e)}})()})}var t=["attached"],r=e.filter(function(e){return~t.indexOf(e)});try{Component=be(Component,function(e){w(e.lifetimes)?n(e.lifetimes,e):void 0!==e.lifetimes&&null!==e.lifetimes||(e.lifetimes={},n(e.lifetimes,e))})}catch(e){}}function an(e){function n(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(e(d({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;Te(function(e,n){"invoke"===e.param.name&&(o=!1,r={navigate_start:e.time,navigate_name:n})}),Oe("onLoad").pipe($e(1)).subscribe(function(e){r.load_start=e.time}),Oe("onShow").pipe($e(1)).subscribe(function(e){r.dom_end=e.time}),Oe("onReady").pipe($e(1)).subscribe(function(e){r.render_end=e.time,n(),t()}),ke(q.onHide).subscribe(function(){!1===o&&(n(),t())})}function un(n){var t=["downloadPackage","evaluateScript","fcp","fp","fr"];je().subscribe(function(e){~t.indexOf(e.name)&&n(e)})}function cn(n){Ce("attached").subscribe(function(e){e=e.that;return n.call(e)})}function sn(e){return"android"===e.toLowerCase()}function fn(e){return sn(e)?"Android":"ios"===e.toLowerCase()?"iOS":~kn.indexOf(e.toLowerCase())?"Mac":~On.indexOf(e.toLowerCase())?"windows":"unknown"}function ln(e){var n=e.systemPlatform,t=e.pixelRatio,r=e.width,e=e.height;return n&&sn(n)&&t?r/t+" * "+e/t:r+" * "+e}function pn(e){return(c(e)?jn:Tn)(e)}function dn(n){var e=Oe("onReady").subscribe(function(){var e;tt.performance&&(e=(tt.performance.getCurrentPageEntries()||[]).map(function(e){e.name,e.entryType;var n=h(e,["name","entryType"]),t=Pn(e);return t?d(d({},n),t):e}),n(e))});return{disconnect:function(){return e.unsubscribe()}}}function hn(e){var n=e.filter(function(e){return e=e,!!!xe("component")[e]}),e=en(n).subjectMap;Ee("component",e=e),te("component",e),Sn().componentSubject(n)}function mn(n){function e(e){K(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))}try{Component=be(Component,e),Behavior=be(Behavior,e)}catch(e){}}function vn(e,n){var t=e.filter(function(e){return e=e,!!!xe("page")[e]}),e=en(t).subjectMap;Ee("page",e=e),te("page",e),e=function(n){t.forEach(function(e){var r=Oe(e),e=T(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(rn(this)&&r.next({that:this,param:nn(e),time:Z()}),m(t))return t.apply(this,e)}})();e&&r.addTearDown(e)})},Page=be(Page,e),mn(e)}function bn(e){var n=e.filter(function(e){return!ie(e)}),t=en(n).subjectMap;Ee("route",e=t),te("route",e),n.forEach(function(i){var e=ne(Sn().instance,i,function(o){oe(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:Z()}),H.forEach(function(r){T(o,r,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];oe(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:nn(e)||{}},time:Z()}),m(t)&&t.apply(this,e)}})()})});e&&t[i].addTearDown(e)})}function gn(u,e){var n=e.url,t=e.method,r=e.data,o=e.header,i=e.headers,c={api:u,request:{url:n,method:(n=t,"uploadFile"===(t=u)?"POST":"downloadFile"!==t&&n||"GET"),headers:o||i||{},body:x(r),timestamp:Z()},response:{}};T(e,"complete",function(a){return function(e){var n=c.response.timestamp||Z();c.duration=n-c.request.timestamp,c.completeCallbackTime=ee(a,e);var t,r,o,i=e.errMsg||e.errorMessage||e.error;c.response={status:(t=e.status,r=e.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:n,headers:e.header||e.headers||{},body:x(e.data),errMsg:i,timing:Sn().buildRequestProfile(e.profile||{})},ae(u).next(c)}})(),T(e,"success",function(n){return function(e){c.response.timestamp=Z(),c.response.status=200,c.successCallbackTime=ee(n,e)}})(),T(e,"fail",function(n){return function(e){c.response.timestamp=Z(),c.response.status=-1,c.failCallbackTime=ee(n,e)}})()}function yn(e,t){void 0===t&&(t=Sn().instance);var n=e.filter(function(e){return!ue(e)}),r=en(n).subjectMap;Ee("http",e=r),te("http",e),n.forEach(function(n){var e=ne(t,n,function(e){gn(n,e)});e&&r[n].addTearDown(e)})}var _n,he=g((_n={},[function(e){if(!ge().platform)throw Error("Not support current Mini Program");if(!Array.isArray(e)||!e.length)return null;e=e.find(function(e){return e.platform===ge().platform});return e&&(_n=e.adapterCtor())},function(){return _n}]),2),wn=he[0],Sn=he[1],En=function(e){return"SLARDAR"+e},xn=function(e){try{return Sn().getStorage(e)}catch(e){return}},kn=["darwin","macs","mac"],On=["windows_nt","windows","window"],Tn=function(e){return{name:"unknown_error_name",message:x(e)}},jn=function(e){var n=e.split("\n"),n=g((n[0]&&n[0].split(":")||[]).map(function(e){return e.trim()}),2);return{name:n[0],message:n[1],stack:e}},Cn=function(){var e=tt.getSystemInfoSync(),n=e.model,t=e.brand,r=e.pixelRatio,o=e.screenHeight,i=e.screenWidth,a=e.windowHeight,u=e.windowWidth,c=e.language,s=e.version,f=e.system,l=e.platform,p=e.SDKVersion,e=e.appName;return{model:n,brand:t,pixelRatio:r,screenArea:ln({width:i,height:o}),windowArea:ln({width:u,height:a}),language:c,osName:fn(l),osVersion:f,SDKVersion:p,hostName:e,hostVersion:s}},Pn=function(e){if("navigation"===e.entryType)return{name:"route",entryType:"navigation",path:e.name};switch(e.name){case"app-click":return{name:"appClick",entryType:"navigation"};case"miniprogram-package\t":return{name:"downloadPackage",entryType:"loadPackage"};case"first-paint":return{name:"fp",entryType:"render"};default:return null}},Dn="mars",we={platform:Dn,adapterCtor:function(){return d(d({},{instance:t=void 0===t?ge().instance:t,request:function(e){return t.request(e)},getStorage:function(e){return t.getStorageSync(e)},setStorage:function(e,n){return t.setStorageSync(e,n)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(e){return e},monitorNetworkType:function(n){t.getNetworkType({success:function(e){n&&n({networkType:e.networkType})}}),t.onNetworkStatusChange(function(e){n&&n({networkType:e.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:Dn,buildError:pn,getSystemInfo:function(e){void 0===e&&(e="tt");var n,t="",r="",o="";return tt.getEnvInfoSync?(r=(n=tt.getEnvInfoSync().microapp).envType,t=n.appId,o=n.mpVersion):(r=tt.env.VERSION,t=""),d({appId:t,miniEnv:r,miniVersion:o,platform:e},Cn())}.bind(null,Dn),observePerformance:dn,performanceSubscriber:un,componentSubject:on,pagePerfSubscriber:an,setDataSubject:cn});var t}},In=function(e,n){void 0===n&&(n=J),e.on("init",function(){yn(n)})};function Rn(){var a=rn(this),u=ce();var e=ne(this,"setData",function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=r[0],i=Z();return[o,function(){var e=r[1],n=Z()-i;u.next({renderTime:n,url:a,data:o,startTime:i}),e&&e.call(t)}]});e&&u.addTearDown(e)}function Nn(){var e;xe("setData")||(e=(e=en(["setData"]).getSubject)("setData"),Se("setData",e),re("setData",e))}function Mn(o){return Object.keys(o).reduce(function(e,n){var t,r;return r=o[t=n],t&&r&&(qn.test(t)||zn.test(r))||(e[n]=o[n]),e},{})}var An=function(e){e.on("init",function(){Nn(),Oe("onLoad").subscribe(function(e){e=e.that;Rn.call(e)}),Sn().setDataSubject(Rn)})},Fn=function(e){e.on("init",function(){var n,e,t,r=Sn();r.observePerformance&&!se()&&(n=(0,en(["performance"]).getSubject)("performance"),Se("performance",e=n),re("performance",e),(t=r.observePerformance(function(e){e.forEach(function(e){n.next(e)})}))&&t.disconnect&&n.addTearDown(function(){return t.disconnect()}))})},qn=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),zn=new RegExp("(bearer|session)","i"),Ln=function(){return function(e,s){var n=e.hookRequest,t=e.hookDownloadFile,r=e.hookUploadFile,f=e.ignoreUrls,l=e.collectBodyOnError,p=e.extraExtractor,e=function(e){var n,t,r,o,i,a,u,c;!function(e,n){e=v(e||[]);return!!e&&e.test(n)}(f,e.request.url)&&(c=e.response,n=e.request,t=e.api,r=e.duration,o=e.failCallbackTime,u=e.successCallbackTime,i=e.completeCallbackTime,n.headers=Mn(n.headers||{}),c.headers=Mn(c.headers||{}),a=c.errMsg,e=h(c,["errMsg"]),e=d(d({},e),{is_custom_error:!1}),a&&(e.err_msg=a),u={api:t,request:n,duration:r,cbTime:i+(o||0)+(u||0),response:e},!m(p)||(e=p(c.body,u))&&(u.extra=e,u.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete u.request.body,delete u.response.body),s({ev_type:"http",payload:u}))};n&&ae("request").subscribe(e),t&&ae("downloadFile").subscribe(e),r&&ae("uploadFile").subscribe(e)}},Vn=function(e,n,t,r){void 0===n&&(n={}),void 0===r&&(r=[]);try{var o=e.apply(void 0,y([],g(r),!1));return o&&o(n,t)||[]}catch(e){return C("applyMonitor",e),[]}};function Bn(e,n,t){le(e);n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return w(n)?d(d({},t),n):!!n&&t}function Un(e,n){return e&&n&&e===n}function Hn(){var r;return function(e){try{if(t=r,!(!(n=e)||!t)&&!(!Un(n.message,t.message)&&!Un(n.stack,t.stack)))return void(r=e)}catch(e){}var n,t;return r=e}}var Gn,Kn="http",Jn={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},Wn=function(f){return void 0===f&&(f=Sn()),function(e,r){var n=e.ignoreErrors,t=e.hookOnError,o=e.hookOnUnhandledRejection,i=e.hookRouteError,a=e.dedupe,u=v(n),c=Hn(),s=function(e,n,t){e=a?c(e):e;e&&(u&&u.test(e.message)||(e={error:e},n&&(e.extra=n),t&&(e.react=t),r(e)))};t&&ke(q.onError).subscribe(function(e){e=e.param,e=f.buildError(e);u&&u.test(e.message)||s(e)}),o&&ke(q.onUnhandledRejection).subscribe(function(e){var n=e.param||{},e=n.promise,t=x(n.reason);u&&u.test(t)||e.catch(b).then(function(e){var n={name:"UnhandledRejection",message:t};e&&e.stack&&(n.stack=e.stack),s(n)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&Te(function(e){e=e.param;"fail"===(e=e).name&&s({name:"RouteError",message:e.value.errMsg})}),[s]}};(he=Gn=Gn||{}).history="history",he.manual="manual";function Yn(t,e,r){var o=e,i=null,a=0,n="launch";function u(e,n){o=n,a=Z(),r(n,i=n+"_"+a),t(e,n)}return ke(q.onShow).pipe($e(1)).subscribe(function(){n="show"}),Te(function(){n="history"}),[u,function(e){e&&(u(n,e),n="history")},function(e){void 0===e&&(e="hide"),i&&(r(o,i),i=null,t(e,o,Z()-a))}]}var $n=function(){return function(e,r){var n=e.extractPid,t=e.routeMode,o=e.setPidAndViewId,i=function(e){return n?n(e):e},e=g(Yn(function(e,n,t){r({ev_type:"pageview",payload:{pid:n,source:e,duration:t}})},"",o),3),o=e[0],a=e[1],e=e[2];return t!==Gn.manual&&(Oe("onShow").subscribe(function(e){return function(e){e=rn(e),e=i(e);a(e)}(e.that)}),Oe("onUnload").subscribe(e.bind(null,"unload")),Oe("onHide").subscribe(e.bind(null,"hide"))),[o.bind(null,"user_set"),e]}},Qn=function(){return function(e){var n=g(function(n,t,r){void 0===n&&(n=20),void 0===t&&(t=b),void 0===r&&(r=function(e,n){return e.slice(-n)});var o=[];return[function(){return o},function(e){t(e)&&(e=d(d({},e),{timestamp:e.timestamp||Date.now()}),o=0<=n&&o.length+1>n?r(y(y([],g(o),!1),[e],!1),n):y(y([],g(o),!1),[e],!1))}]}(e.maxBreadcrumbs,e.onAddBreadcrumb,e.onMaxBreadcrumbs),2),e=n[0],r=n[1];return J.forEach(function(e){ue(e)&&ae(e).subscribe(function(e){r({type:"http",category:e.api,message:"",data:{method:e.request.method,url:e.request.url,status_code:String(e.response.status)},timestamp:e.request.timestamp})})}),Te(function(e,n){var t=e.param,e=e.time;"complete"===t.name&&r({type:"route",category:n,message:t.value.errMsg||t.value.errorMessage||"",timestamp:e,data:{url:t.url||""}})}),[e,r]}},Xn=function(){return function(e,t){var r=e.isCalculateSize;ce().subscribe(function(e){var n={duration:e.renderTime,start_time:e.startTime};r&&(n.size=(e=e.data,TextEncoder?(new TextEncoder).encode(x(e)).length:2*x(e).length)),t({ev_type:"set_data",payload:n})})}},Zn=function(){return function(e,n){function t(){n({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;ke(q.onLaunch).pipe(We(1)).subscribe(function(e){r.activate_start=e.time}),ke(q.onShow).pipe(We(1)).subscribe(function(e){r.init_end=e.time}),Oe("onLoad").pipe(We(1)).subscribe(function(e){r.page_load_start=e.time}),Oe("onShow").pipe(We(1)).subscribe(function(e){r.page_dom_end=e.time});var i=se();Oe("onReady").pipe(We(1)).subscribe(function(e){r.page_render_end=e.time,i&&!r.trigger||t()}),i&&je().pipe(Ye(function(e){return"appClick"===e.name}),We(1)).subscribe(function(e){r.trigger=e.startTime,r.page_render_end&&t()}),ke(q.onHide).subscribe(function(){o||t()})}},et=function(){return function(e,n){Sn().pagePerfSubscriber(function(e){return n({ev_type:"page_perf",payload:e})})}},nt=function(n){return void 0===n&&(n=Sn()),function(e,t){var r,o;se()&&n.performanceSubscriber&&(r=0,Oe("onLoad").subscribe(function(e){o=e.time,r++}),n.performanceSubscriber(function(e){var n={is_custom:!1,name:e.name,value:e.startTime,type:"perf",count:r};n.duration=e.duration||(o?e.startTime-o:0),n.is_support=0<=n.duration,t({ev_type:"performance",payload:n})}))}},rt="pageview",ot={routeMode:Gn.history,setPidAndViewId:function(e,n){}},it="jsError",at={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},ut=function(t){return function(e){var n=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},e),{breadcrumbs:n})})}},ct={maxBreadcrumbs:20,tap:!0},st="breadcrumb",ft=function(n){n.on("init",function(){n.provide("_subscriptions",[]),le(n),n.on("init",function(){tn(Y),vn(Q),hn($)}),n.on("init",function(){bn(W)})}),n.on("beforeDestroy",function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]})},lt="setData",pt={isCalculateSize:!1},dt="appLaunchPerf",ht={},mt="pagePerf",vt={},bt="performance",gt={},yt=function(e,n,t){void 0===t&&(t=Sn());var r=n.url,o=n.data,i=n.success,a=void 0===i?l:i,u=n.fail,c=void 0===u?l:u,i=n.header,u={"Content-Type":"application/json"};K(n=i)&&0!==Object.keys(n).length&&Object.assign(u,i),t.request({method:e,url:r,data:o,header:u,headers:u,success:function(e){a(e)},fail:function(e){e=e.errMsg||"Network request failed";c(new Error(e))}})},_t=function(n){return(n=void 0===n?Sn():n)?{get:function(e){return yt("GET",e,n)},post:function(e){return yt("POST",e,n)}}:{get:l,post:l}};function wt(e){return e=En(String(e)),(e=xn(e))&&e.userId&&e.deviceId?e:{userId:D(),deviceId:D()}}function St(e){return e+"_"+Date.now()}function Et(e){var n=e.aid,t=e.userId,e=e.deviceId;!function(e,n){try{Sn().setStorage(e,n)}catch(e){}}(En(String(n)),{userId:t,deviceId:e})}var xt={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:d(d({},e.extra||{}),e.overrides||{})}}},kt="/monitor_mini/collect",Ot="/settings/minipro",Tt="apmplus.volces.com",jt="session",Ct={sample_rate:1,include_users:[],sample_granularity:jt,rules:{}},Pt=[kt,Ot],Dt="0.2.2",It="APM_PLUS_MINI_PROGRAM",Rt=function(e,n){return void 0===n&&(n=kt),(e&&0<=e.indexOf("//")?"":"https://")+e+n};function Nt(e){e=wt(e.aid);return{aid:0,token:"",pid:"",viewId:St("_"),userId:e.userId,deviceId:e.deviceId,sessionId:D(),domain:Tt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:Pt},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:Ct,sdkName:It,sdkVersion:Dt}}function Mt(e){var n,t=e.plugins||{};for(n in t)t[n]&&!w(t[n])&&(t[n]={});return d(d({},e),{plugins:t})}function At(e){return w(e)&&"aid"in e&&"token"in e}function Ft(e){return d({},e)}var qt=function(n){var r,o,i=n,a={},u=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(e){var n,t;return a=d(d({},a),e||{}),s(),r||(r=e,i.useLocalConfig||!i.aid?(o={},c()):u?f():(n=i.domain,e=i.aid,t=function(e){u=e,f()},_t().get({url:function(e,n){return void 0===n&&(n=Ot),(e&&0<=e.indexOf("//")?"":"https://")+e+n}(n)+"?biz_id="+e,success:function(e){t(e&&e.data&&e.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(e){t=e},onReady:function(e){c=function(){Et(i),e()},o&&c()}};function s(){var e=d(d(d({},n),o||{}),a);e.plugins=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t={},r=0;r<e.length;)t=p(t,e[r++]);return t}(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=zt(zt(n.sample,null==o?void 0:o.sample),a.sample),i=e,t()}function f(){o=function(e){if(!e)return{};var n=e.sample,t=e.user_id,r=e.timestamp,o=t?{userId:t}:{};if(!n)return o;var i=n.sample_rate,e=n.sample_granularity,t=void 0===e?jt:e,e=n.include_users,n=n.rules,n=void 0===n?[]:n;return d(d({},o),{sample:{include_users:e,sample_rate:i,sample_granularity:t,rules:n.reduce(function(e,n){var t=n.name,r=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[t]={enable:r,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r})}(u),function(e){e=En(e);return!!Sn().getStorage(e)}(String(i.aid))&&(o.userId=n.userId),s(),c()}};function zt(r,o){if(!r||!o)return r||o;var e=d(d({},r),o);return e.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),e.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(e,n){var t;return n in e||(n in(r.rules||{})&&n in(o.rules||{})?(e[n]=d(d({},r.rules[n]),o.rules[n]),e[n].conditional_sample_rules=y(y([],g(r.rules[n].conditional_sample_rules||[]),!1),g(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(t=r.rules)||void 0===t?void 0:t[n])||(null===(t=o.rules)||void 0===t?void 0:t[n])),e},{}),e}function Lt(e){var n={url:(n=Sn().getCurrentPages().pop())?(n?rn(n):"")+s(n.options):"",timestamp:Z()};return d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})})}function Vt(e){if(!wn(e))throw Error(U);var t,e=function(e){var t,r,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,c=e.initConfigNormalizer,s=e.validateInitConfig,f={};_.forEach(function(e){return f[e]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(e){if(l)k("already inited");else{if(!(e&&w(e)&&s(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=c(e);if((r=a(n)).setConfig(e),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(e){l&&e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(u(e))),null==r?void 0:r.getConfig()},provide:function(e,n){S(m,e)?k("cannot provide "+e+", reserved"):(v[e]=n,b("provide",!1,e))},start:function(){var n=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(e){return n.build(e)}),h=[]}))},report:function(e){e&&(!(e=O(f.beforeReport)(e))||(e=O(f.report)(e))&&(p?this.build(e):h.push(e)))},build:function(e){!p||(e=O(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=O(f.build)(e))&&this.send(e))},send:function(e){!p||(e=O(f.beforeSend)(e))&&(t.send(e),b("send",!1,e))},destroy:function(){b("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&p||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=E(f[e],n))}},m=Object.keys(v);return v;function b(e,n){void 0===n&&(n=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[e].forEach(function(e){try{e.apply(void 0,y([],g(t),!1))}catch(e){}}),n&&(f[e].length=0)}}({validateInitConfig:At,initConfigNormalizer:Mt,userConfigNormalizer:Ft,createSender:function(e){return n({size:G,endpoint:Rt(e.domain),transport:_t()})},builder:xt,createDefaultConfig:Nt,createConfigManager:qt});return I(e),Kt(e),Ut(e),Ht(e),z(e),ft(e),(t=e).on("init",function(){var n=[],e=t.config();e&&e.integrations&&e.integrations.forEach(function(e){S(n,e.name)||(n.push(e.name),e.setup(t),e.tearDown&&t.on("beforeDestroy",e.tearDown))})}),Gt(e),Bt(e),e}var Bt=function(n){function t(e){return void 0===e&&(e=Sn().getSystemInfo()),n.set(d({},e))}function r(){t(),e()}var o,i,a=!1,e=(i="",function(){var e=o.getSender();i=i||e.getEndpoint();var n=o.config(),n={did:n.deviceId,sid:n.sessionId,sname:n.sdkName,sver:n.sdkVersion,soffset:n.offset||0,model:n.model,brand:n.brand,ratio:n.pixelRatio,screen:n.screenArea,window:n.windowArea,lang:n.language,osname:n.osName,osver:n.osVersion,libver:n.SDKVersion,scene:n.scene||-1,menv:n.miniEnv,mver:n.miniVersion,hostname:n.hostName,hostver:n.hostVersion,platform:n.platform,biz_id:n.aid,x_auth_token:n.token};e.setEndpoint(i+s(n))});(o=n).on("start",function(){r(),a=!0}),n.on("init",function(){ke(q.onLaunch).pipe(We(1)).subscribe(function(e){e=e.param.scene||-1;t({scene:e}),a&&r()}),Sn().monitorNetworkType(function(e){e=e.networkType;n.set({networkType:e})})})},Ut=function(r){r.on("beforeBuild",function(e){return n=e,t=r.config(),(e={}).aid=t.aid,e.pid=t.pid,e.view_id=t.viewId,e.user_id=t.userId,e.network_type=t.networkType,d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})});var n,t})},Ht=function(e){e.on("report",Lt)},Gt=function(n){n.on("init",function(){ke(q.onHide).subscribe(function(){var e=n.getSender();e&&e.flush()})})},Kt=function(t){var r,o=!1;t.on("init",function(){r=Z(),t.on("config",function(){var e,n=null===(e=t.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=Z())-r<1e3&&n&&(e=n-(e+r)/2,isNaN(e)||t.set({offset:e})))})})};return ve("mars"),function(e){var n,t,r,i,o,a,u,c,s,e=Vt(e);if(e)return(n=e).provide("sendEvent",function(e){e=V(e);e&&n.report({ev_type:L,payload:e,extra:{timestamp:Date.now()}})}),n.provide("sendLog",function(e){e=B(e);e&&n.report({ev_type:L,payload:e,extra:{timestamp:Date.now()}})}),(t=e).on("init",function(){var e,n=Bn(t,rt,ot);n&&(n=(e=g(Vn($n,d(d({},n),{setPidAndViewId:function(e,n){t.set({pid:e,viewId:n,actionId:void 0})}}),t.report.bind(t)),2))[0],e=e[1],t.provide("sendPageview",n),t.provide("sendPageviewWithHide",e))}),(r=e).on("init",function(){var e,n=Bn(r,it,at);n&&(e=ut(r),e=g(Vn(Wn,n,e),1)[0],r.provide("captureException",e))}),(i=e).on("init",function(){var e,n,t,r,o=Bn(i,Kn,Jn);o&&(e=o.hookRequest,n=o.hookDownloadFile,t=o.hookUploadFile,r=[],e&&r.push("request"),n&&r.push("downloadFile"),t&&r.push("uploadFile"),In(i,r),Vn(Ln,o,i.report.bind(i)))}),(o=e).on("init",function(){var e=Bn(o,lt,pt);e&&(An(o),Vn(Xn,e,o.report.bind(o)))}),(a=e).on("init",function(){var e,n=Bn(a,st,ct);n&&(n=(e=g(Vn(Qn,n,function(e){}),2))[0],e=e[1],a.provide("getBreadcrumbs",n),a.provide("addBreadcrumb",e))}),(u=e).on("init",function(){var e=Bn(u,dt,ht);e&&(Fn(u),Vn(Zn,e,u.report.bind(u)))}),(c=e).on("init",function(){var e=Bn(c,mt,vt);e&&Vn(et,e,c.report.bind(c))}),(s=e).on("init",function(){var e=Bn(s,bt,gt);e&&(Fn(s),Vn(nt,e,s.report.bind(s)))}),e}.bind(null,[we])()}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).marsClient=n()}(this,function(){"use strict";function n(e){var t,r=e.transport,o=e.endpoint,n=e.size,i=void 0===n?10:n,e=e.wait,a=void 0===e?1e3:e,u=[],c=0;function s(){var n;u.length&&(n=this.getBatchData(),r.post({url:o,data:n,fail:function(e){t&&t(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),a)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return u.length?(e=u,JSON.stringify({ev_type:"batch",list:e})):"";var e},clear:function(){clearTimeout(c),u=[]},fail:function(e){t=e}}}var r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var d=function(){return(d=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function h(e,n){var t={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}function g(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||((r=r||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(e){return e}function w(e){return"object"==typeof e&&null!==e}var t=Object.prototype;function i(e){if(w(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(e);e=Object.getPrototypeOf(e);return e===t||null===e}}function a(e){return"[object Array]"===t.toString.call(e)}function m(e){return"function"==typeof e}function u(e){return"number"==typeof e}function c(e){return"string"==typeof e}function p(e,n){var t,r,o=d({},e);for(t in n)r=t,Object.prototype.hasOwnProperty.call(n,r)&&void 0!==n[t]&&(w(n[t])&&i(n[t])?o[t]=p(w(e[t])?e[t]:{},n[t]):a(n[t])&&a(e[t])?o[t]=function n(e,t){e=a(e)?e:[];t=a(t)?t:[];return Array.prototype.concat.call(e,t).map(function(e){return e instanceof RegExp?e:w(e)&&i(e)?p({},e):a(e)?n([],e):e})}(e[t],n[t]):o[t]=n[t]);return o}function S(e,n){if(!a(e))return!1;if(0===e.length)return!1;for(var t=0;t<e.length;){if(e[t]===n)return!0;t++}return!1}function E(e,n){if(!a(e))return e;var t=e.indexOf(n);if(0<=t){n=e.slice();return n.splice(t,1),n}return e}function v(e){return a(e)&&e.length?function(e){for(var n=[],t=e.length,r=0;r<t;r++){var o=e[r];c(o)?n.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return new RegExp(n.join("|"),"i")}(e):null}function x(e){try{return c(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function s(t){return w(t)?Object.keys(t).reduce(function(e,n){return e+="&"+n+"="+t[n]},"").replace("&","?"):""}function k(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,y(["[SDK]",Date.now(),(""+P++).padStart(8," ")],g(e),!1))}function o(e){return Math.random()<Number(e)}function f(e,n){return e<Number(n)}function O(r){return function(e){for(var n=e,t=0;t<r.length&&n;t++)try{n=r[t](n)}catch(e){C(e)}return n}}var T=function(i,a,u,c){return void 0===c&&(c=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return l;var t=i[a],r=u.apply(void 0,y([t],g(e),!1)),o=r;return m(o)&&c&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return r.apply(this,n)}catch(e){return m(t)&&t.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=t:r=t)}}},j=0,C=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,y(["[SDK]",Date.now(),(""+j++).padStart(8," ")],g(e),!1))},P=0;function D(){var e=function(){for(var e=new Array(16),n=0,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);var r=0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[+r]],o[e[15]]].join("")}(e)}var I=function(e){var t,r,o,n=(t={},r={},o={set:function(e,n){return t[e]=n,r[e]=x(n),o},merge:function(n){return t=d(d({},t),n),Object.keys(n).forEach(function(e){r[e]=x(n[e])}),o},delete:function(e){return delete t[e],delete r[e],o},clear:function(){return t={},r={},o},get:function(e){return r[e]},toString:function(){return d({},r)}});e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})};function R(e,n){var t=e.common||{};return t.sample_rate=n,e.common=t,e}function N(e,n,t,r,o){return e?(i=o(r,n),function(){return i}):function(){return t(n)};var i}function M(e,n,t,r){if(void 0===(e=function(e,n,t){for(var r,n=g(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(r=g(i))[0],i=r.slice(1);if(e)return t(e,o)}(e,n,function(e,n){return e[n]})))return!1;var o,n="boolean"==typeof e?"bool":u(e)?"number":"string";return function(e,n,t){switch(t){case"eq":return S(n,e);case"neq":return!S(n,e);case"gt":return e>n[0];case"gte":return e>=n[0];case"lt":return e<n[0];case"lte":return e<=n[0];case"regex":return Boolean(e.match(new RegExp(n.join("|"))));case"not_regex":return!e.match(new RegExp(n.join("|")));default:return!1}}(e,(o=n,r.map(function(e){switch(o){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}})),t)}function A(n,e){try{return"rule"===e.type?M(n,e.field,e.op,e.values):"and"===e.type?e.children.every(function(e){return A(n,e)}):e.children.some(function(e){return A(n,e)})}catch(e){return!1}}function F(e,n,t,r){if(!n)return b;var o=n.sample_rate,i=n.include_users,a=n.sample_granularity,u=n.rules,n=void 0===(n=n.r)?Math.random():n;if(S(i,e))return function(e){return R(e,1)};var c,s,f,l,p,d,h,m=N(a="session"===a,o,t,n,r),v=(c=u,s=a,f=o,l=t,p=n,d=r,h={},Object.keys(c).forEach(function(e){var n=c[e],t=n.enable,r=n.sample_rate,n=n.conditional_sample_rules;t?(h[e]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:N(s,r,l,p,d)},n&&(h[e].conditional_hit_rules=n.map(function(e){var n=e.sample_rate,e=e.filter;return{sample_rate:n,hit:N(s,n,l,p,d),effectiveSampleRate:n*f,filter:e}}))):h[e]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(e){if(!m())return!1;if(!(e.ev_type in v))return R(e,o);if(!v[e.ev_type].enable)return!1;if(e.common&&e.common.sample_rate)return e;var n=v[e.ev_type],t=n.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(A(e,t[r].filter))return!!t[r].hit()&&R(e,t[r].effectiveSampleRate);return!!n.hit()&&R(e,n.effectiveSampleRate)}}var q,z=function(t){t.on("start",function(){var e=t.config(),n=e.userId,e=e.sample,e=F(n,e,o,f);t.on("build",e)})},L="custom",V=function(e){if(e&&w(e)&&e.name&&c(e.name)){var n={name:e.name,type:"event"};if("metrics"in e&&w(e.metrics)){var t=e.metrics,r={};for(o in t)u(t[o])&&(r[o]=t[o]);n.metrics=r}if("categories"in e&&w(e.categories)){var o,i=e.categories,a={};for(o in i)a[o]=x(i[o]);n.categories=a}return n}},B=function(e){if(e&&w(e)&&e.content&&c(e.content)){var n={content:x(e.content),type:"log",level:"info"};if("level"in e&&(n.level=e.level),"extra"in e&&w(e.extra)){var t,r=e.extra,o={},i={};for(t in r)u(r[t])?o[t]=r[t]:i[t]=x(r[t]);n.metrics=o,n.categories=i}return n}},U="Adapters imported incorrectly",H=["success","fail","complete"],G=20;(we=q=q||{}).onLaunch="onLaunch",we.onShow="onShow",we.onHide="onHide",we.onError="onError",we.onPageNotFound="onPageNotFound",we.onUnhandledRejection="onUnhandledRejection";function K(e){return"[object Object]"===Object.prototype.toString.call(e)}var J=["request","downloadFile","uploadFile"],W=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],Y=y(y([],g([q.onLaunch,q.onShow,q.onHide]),!1),[q.onError,q.onPageNotFound,q.onUnhandledRejection],!1),$=["attached","onInit"],Q=["onLoad","onShow","onReady","onUnload","onHide"],X="__HOOKED__";var Z=function(){return Date.now()};function ee(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!m(e))return 0;var r,o=Z();try{e.apply(this,n)}finally{r=Z()}return r-o}function ne(e,n,r){var o=e[n];if(!o||!o[X])return Object.defineProperty(e,n,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{var t=r.apply(this,e);t&&(e=t)}catch(e){C(e)}return o.apply(this,e)}}),e[n]&&(e[n][X]=!0),function(){e[n][X]=!1,r=de}}function te(t,e){Object.keys(e).forEach(function(n){e[n].addTearDown(function(){var e;return Ee(t,((e={})[n]=null,e))})})}function re(e,n){n.addTearDown(function(){return Se(e,null)})}function oe(e){return xe("route")[e]}function ie(e){return!!xe("route")[e]}function ae(e){return xe("http")[e]}function ue(e){return!!xe("http")[e]}function ce(){return xe("setData")}function se(){return!!xe("performance")}function fe(){return xe("instance")}function le(e){Se("instance",e)}var pe,de=function(){},he=g((pe="tt",[function(){return pe},function(e){return pe=e}]),2),me=he[0],ve=he[1],be=function(n,t){function e(e){return t(e),n.call(this,e)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},ge=function(){var e={instance:null};return e.instance||("undefined"!=typeof tt?e={instance:tt,platform:me()}:"undefined"!=typeof my?e={instance:my,platform:"my"}:"undefined"!=typeof swan?e={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(e={instance:wx,platform:"wx"})),e},ye="__slardar__global__0.2.3-alpha.0",_e={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},we=function(e,n){void 0===e&&(e={});var t=(n=void 0===n?ge().instance:n)?n[ye]||(n[ye]=e):e;return{setGlobalValue:function(e,n){t[e]=n},mergeGlobalValue:function(e,n){t[e]=d(d({},t[e]),n)},getGlobalValue:function(e){return t[e]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},_e),n&&(n[ye]=t)}}}(d({},_e)),Se=we.setGlobalValue,Ee=we.mergeGlobalValue,xe=we.getGlobalValue,ke=function(e){return xe("app")[e]},Oe=function(e){return xe("page")[e]},Te=function(t){W.forEach(function(n){ie(n)&&oe(n).subscribe(function(e){return t(e,n)})})},je=function(){return xe("performance")},Ce=function(e){return xe("component")[e]};function Pe(e){return"function"==typeof e}function De(e,n){!e||0<=(n=e.indexOf(n))&&e.splice(n,1)}function Ie(e){return e}function Re(t){return function(e){if((n=e)&&Pe(n.lift))return e.lift(function(e){try{return t(e,this)}catch(e){this.error(e)}});var n;throw new TypeError("Unable to lift unknown Observable type")}}function Ne(e){Pe(e)?e():null!=e&&e.unsubscribe()}var Me=function(e){return e instanceof Ae||e&&"closed"in e&&Pe(e.remove)&&Pe(e.add)&&Pe(e.unsubscribe)},Ae=(Fe.prototype.unsubscribe=function(){var e,n,t,r=this;this.closed||(this.closed=!0,e=this._parentage,n=this._finalizers,t=this.initialTeardown,e&&(this._parentage=null,e.forEach(function(e){return e.remove(r)})),Pe(t)&&t(),n&&(this._finalizers=null,n.forEach(Ne)))},Fe.prototype.remove=function(e){this._finalizers&&De(this._finalizers,e),e instanceof Fe&&e._removeParent(this)},Fe.prototype.add=function(e){if(e&&e!==this)if(this.closed)Ne(e);else{if(e instanceof Fe){if(e.closed||e._hasParent(this))return;e._addParent(this)}var n=this._finalizers;this._finalizers=n?(n.push(e),n):[e]}},Fe.prototype._addParent=function(e){var n=this._parentage;this._parentage=n?(n.push(e),n):[e]},Fe.prototype._hasParent=function(e){return this._parentage&&~this._parentage.indexOf(e)},Fe.prototype._removeParent=function(e){this._parentage&&De(this._parentage,e)},Fe);function Fe(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var qe,ze=(e(Le,qe=Ae),Le.prototype.next=function(e){this.isStopped||this.destination.next(e)},Le.prototype.error=function(e){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(e)}finally{this.unsubscribe()}}},Le.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Le.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,qe.prototype.unsubscribe.call(this),this.destination=null)},Le.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Le);function Le(e){var n=qe.call(this)||this;return n.isStopped=!1,n.destination=Ue(e)?e:new Ve(!(e=e)||Pe(e)?{next:null!=e?e:void 0}:e),n}var Ve=(Be.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(e){console.error("ConsumerObserver.next error",e)}},Be.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(e){console.error("ConsumerObserver.error error",e)}},Be.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){console.error("ConsumerObserver.complete error",e)}},Be);function Be(e){this.partialObserver=e}function Ue(e){return e instanceof ze||e&&((n=e)&&Pe(n.next)&&Pe(n.error)&&Pe(n.complete))&&Me(e);var n}He.prototype.subscribe=function(e){var n=Ue(e)?e:new ze(e),t=this.operator,e=this.source;return n.add(t?t.call(n,e):this._trySubscribe(n)),n},He.prototype.lift=function(e){var n=new He;return n.source=this,n.operator=e,n},He.prototype.pipe=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(n=e).length?Ie:1===n.length?n[0]:function(e){return n.reduce(function(e,n){return n(e)},e)})(this)},He.prototype._subscribe=function(e){},He.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},he=He;function He(e){e&&(this._subscribe=e)}var Ge,we=(e(Ke,Ge=he),Ke.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(e){return e.next(n)})},Ke.prototype.commonJudgement=function(e){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,e())},Ke.prototype.error=function(n){var t=this;this.commonJudgement(function(){var e=t.observers;for(t.hasError=!0,t.thrownError=n;e.length;)e.shift().error(n)})},Object.defineProperty(Ke.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Ke.prototype.complete=function(){var n=this;this.commonJudgement(function(){for(var e=n.observers;e.length;)e.shift().complete()})},Ke.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Ke.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Ke.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},Ke.prototype._checkFinalizedStatuses=function(e){var n=this.hasError,t=this.thrownError,r=this.isStopped;n?e.error(t):r&&e.complete()},Ke.prototype._innerSubscribe=function(e){var n=this.isStopped,t=this.observers;return n?Ke.EMPTY:(t.push(e),new Ae(function(){De(t,e)}))},Ke.EMPTY=((we=new Ae).closed=!0,we),Ke);function Ke(){var e=null!==Ge&&Ge.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var Je=new he(function(e){return e.complete()});function We(r){return r<=0?function(){return Je}:Re(function(e,n){var t=0;e.subscribe(function(e){++t<=r&&(n.next(e),r<=t&&n.complete())})})}function Ye(r,o){return Re(function(e,n){var t=0;e.subscribe(function(e){return r.call(o,e,t++)&&n.next(e)})})}function $e(t){return Ye(function(e,n){return t<=n})}var Qe,Xe=(e(Ze,Qe=we),Ze.prototype.subscribe=function(e){var t=this,e=Qe.prototype.subscribe.call(this,e);fe()&&fe()._subscriptions.push(e);var r=e.unsubscribe;return e.unsubscribe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(this,e),t.observed||t.unsubscribe()},e},Ze.prototype.unsubscribe=function(){Qe.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(e){return e()})},Ze.prototype.addTearDown=function(e){this.tearDownFns.push(e)},Ze);function Ze(){var e=null!==Qe&&Qe.apply(this,arguments)||this;return e.tearDownFns=[],e}function en(e){var n=e.reduce(function(e,n){return e[n]=new Xe,e},{});return{getSubject:function(e){return n[e]},subjectMap:n}}function nn(e){return 1<e.length?e:e.length&&e[0]||{}}function tn(e){var t=e.filter(function(e){return e=e,!!!xe("app")[e]}),e=en(t).subjectMap;Ee("app",e=e),te("app",e),App=be(App,function(n){t.forEach(function(e){var r=ke(e),e=T(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.next({that:this,param:nn(e),time:Z()}),m(t)&&t.apply(this,e)}})();e&&r.addTearDown(e)})})}function rn(e){return e.route||e.__route__||e.url||e.path||""}function on(e){function n(e,i){r.forEach(function(o){T(e,o,function(r){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];Ce(o).next({that:this,param:null,time:Z()});var t=i[o];if(m(t)&&t.apply(this,e),m(r))return r.apply(this,e)}})()})}var t=["attached"],r=e.filter(function(e){return~t.indexOf(e)});try{Component=be(Component,function(e){w(e.lifetimes)?n(e.lifetimes,e):void 0!==e.lifetimes&&null!==e.lifetimes||(e.lifetimes={},n(e.lifetimes,e))})}catch(e){}}function an(e){function n(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(e(d({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;Te(function(e,n){"invoke"===e.param.name&&(o=!1,r={navigate_start:e.time,navigate_name:n})}),Oe("onLoad").pipe($e(1)).subscribe(function(e){r.load_start=e.time}),Oe("onShow").pipe($e(1)).subscribe(function(e){r.dom_end=e.time}),Oe("onReady").pipe($e(1)).subscribe(function(e){r.render_end=e.time,n(),t()}),ke(q.onHide).subscribe(function(){!1===o&&(n(),t())})}function un(n){var t=["downloadPackage","evaluateScript","fcp","fp","fr"];je().subscribe(function(e){~t.indexOf(e.name)&&n(e)})}function cn(n){Ce("attached").subscribe(function(e){e=e.that;return n.call(e)})}function sn(e){return"android"===e.toLowerCase()}function fn(e){return sn(e)?"Android":"ios"===e.toLowerCase()?"iOS":~kn.indexOf(e.toLowerCase())?"Mac":~On.indexOf(e.toLowerCase())?"windows":"unknown"}function ln(e){var n=e.systemPlatform,t=e.pixelRatio,r=e.width,e=e.height;return n&&sn(n)&&t?r/t+" * "+e/t:r+" * "+e}function pn(e){return(c(e)?jn:Tn)(e)}function dn(n){var e=Oe("onReady").subscribe(function(){var e;tt.performance&&(e=(tt.performance.getCurrentPageEntries()||[]).map(function(e){e.name,e.entryType;var n=h(e,["name","entryType"]),t=Pn(e);return t?d(d({},n),t):e}),n(e))});return{disconnect:function(){return e.unsubscribe()}}}function hn(e){var n=e.filter(function(e){return e=e,!!!xe("component")[e]}),e=en(n).subjectMap;Ee("component",e=e),te("component",e),Sn().componentSubject(n)}function mn(n){function e(e){K(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))}try{Component=be(Component,e),Behavior=be(Behavior,e)}catch(e){}}function vn(e,n){var t=e.filter(function(e){return e=e,!!!xe("page")[e]}),e=en(t).subjectMap;Ee("page",e=e),te("page",e),e=function(n){t.forEach(function(e){var r=Oe(e),e=T(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(rn(this)&&r.next({that:this,param:nn(e),time:Z()}),m(t))return t.apply(this,e)}})();e&&r.addTearDown(e)})},Page=be(Page,e),mn(e)}function bn(e){var n=e.filter(function(e){return!ie(e)}),t=en(n).subjectMap;Ee("route",e=t),te("route",e),n.forEach(function(i){var e=ne(Sn().instance,i,function(o){void 0===o&&(o={}),oe(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:Z()}),H.forEach(function(r){T(o,r,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];oe(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:nn(e)||{}},time:Z()}),m(t)&&t.apply(this,e)}})()})});e&&t[i].addTearDown(e)})}function gn(u,e){var n=e.url,t=e.method,r=e.data,o=e.header,i=e.headers,c={api:u,request:{url:n,method:(n=t,"uploadFile"===(t=u)?"POST":"downloadFile"!==t&&n||"GET"),headers:o||i||{},body:x(r),timestamp:Z()},response:{}};T(e,"complete",function(a){return function(e){var n=c.response.timestamp||Z();c.duration=n-c.request.timestamp,c.completeCallbackTime=ee(a,e);var t,r,o,i=e.errMsg||e.errorMessage||e.error;c.response={status:(t=e.status,r=e.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:n,headers:e.header||e.headers||{},body:x(e.data),errMsg:i,timing:Sn().buildRequestProfile(e.profile||{})},ae(u).next(c)}})(),T(e,"success",function(n){return function(e){c.response.timestamp=Z(),c.response.status=200,c.successCallbackTime=ee(n,e)}})(),T(e,"fail",function(n){return function(e){c.response.timestamp=Z(),c.response.status=-1,c.failCallbackTime=ee(n,e)}})()}function yn(e,t){void 0===t&&(t=Sn().instance);var n=e.filter(function(e){return!ue(e)}),r=en(n).subjectMap;Ee("http",e=r),te("http",e),n.forEach(function(n){var e=ne(t,n,function(e){gn(n,e)});e&&r[n].addTearDown(e)})}var _n,he=g((_n={},[function(e){if(!ge().platform)throw Error("Not support current Mini Program");if(!Array.isArray(e)||!e.length)return null;e=e.find(function(e){return e.platform===ge().platform});return e&&(_n=e.adapterCtor())},function(){return _n}]),2),wn=he[0],Sn=he[1],En=function(e){return"SLARDAR"+e},xn=function(e){try{return Sn().getStorage(e)}catch(e){return}},kn=["darwin","macs","mac"],On=["windows_nt","windows","window"],Tn=function(e){return{name:"unknown_error_name",message:x(e)}},jn=function(e){var n=e.split("\n"),n=g((n[0]&&n[0].split(":")||[]).map(function(e){return e.trim()}),2);return{name:n[0],message:n[1],stack:e}},Cn=function(){var e=tt.getSystemInfoSync(),n=e.model,t=e.brand,r=e.pixelRatio,o=e.screenHeight,i=e.screenWidth,a=e.windowHeight,u=e.windowWidth,c=e.language,s=e.version,f=e.system,l=e.platform,p=e.SDKVersion,e=e.appName;return{model:n,brand:t,pixelRatio:r,screenArea:ln({width:i,height:o}),windowArea:ln({width:u,height:a}),language:c,osName:fn(l),osVersion:f,SDKVersion:p,hostName:e,hostVersion:s}},Pn=function(e){if("navigation"===e.entryType)return{name:"route",entryType:"navigation",path:e.name};switch(e.name){case"app-click":return{name:"appClick",entryType:"navigation"};case"miniprogram-package\t":return{name:"downloadPackage",entryType:"loadPackage"};case"first-paint":return{name:"fp",entryType:"render"};default:return null}},Dn="mars",we={platform:Dn,adapterCtor:function(){return d(d({},{instance:t=void 0===t?ge().instance:t,request:function(e){return t.request(e)},getStorage:function(e){return t.getStorageSync(e)},setStorage:function(e,n){return t.setStorageSync(e,n)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(e){return e},monitorNetworkType:function(n){t.getNetworkType({success:function(e){n&&n({networkType:e.networkType})}}),t.onNetworkStatusChange(function(e){n&&n({networkType:e.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:Dn,buildError:pn,getSystemInfo:function(e){void 0===e&&(e="tt");var n,t="",r="",o="";return tt.getEnvInfoSync?(r=(n=tt.getEnvInfoSync().microapp).envType,t=n.appId,o=n.mpVersion):(r=tt.env.VERSION,t=""),d({appId:t,miniEnv:r,miniVersion:o,platform:e},Cn())}.bind(null,Dn),observePerformance:dn,performanceSubscriber:un,componentSubject:on,pagePerfSubscriber:an,setDataSubject:cn});var t}},In=function(e,n){void 0===n&&(n=J),e.on("init",function(){yn(n)})};function Rn(){var a=rn(this),u=ce();var e=ne(this,"setData",function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=r[0],i=Z();return[o,function(){var e=r[1],n=Z()-i;u.next({renderTime:n,url:a,data:o,startTime:i}),e&&e.call(t)}]});e&&u.addTearDown(e)}function Nn(){var e;xe("setData")||(e=(e=en(["setData"]).getSubject)("setData"),Se("setData",e),re("setData",e))}function Mn(o){return Object.keys(o).reduce(function(e,n){var t,r;return r=o[t=n],t&&r&&(qn.test(t)||zn.test(r))||(e[n]=o[n]),e},{})}var An=function(e){e.on("init",function(){Nn(),Oe("onLoad").subscribe(function(e){e=e.that;Rn.call(e)}),Sn().setDataSubject(Rn)})},Fn=function(e){e.on("init",function(){var n,e,t,r=Sn();r.observePerformance&&!se()&&(n=(0,en(["performance"]).getSubject)("performance"),Se("performance",e=n),re("performance",e),(t=r.observePerformance(function(e){e.forEach(function(e){n.next(e)})}))&&t.disconnect&&n.addTearDown(function(){return t.disconnect()}))})},qn=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),zn=new RegExp("(bearer|session)","i"),Ln=function(){return function(e,s){var n=e.hookRequest,t=e.hookDownloadFile,r=e.hookUploadFile,f=e.ignoreUrls,l=e.collectBodyOnError,p=e.extraExtractor,e=function(e){var n,t,r,o,i,a,u,c;!function(e,n){e=v(e||[]);return!!e&&e.test(n)}(f,e.request.url)&&(c=e.response,n=e.request,t=e.api,r=e.duration,o=e.failCallbackTime,u=e.successCallbackTime,i=e.completeCallbackTime,n.headers=Mn(n.headers||{}),c.headers=Mn(c.headers||{}),a=c.errMsg,e=h(c,["errMsg"]),e=d(d({},e),{is_custom_error:!1}),a&&(e.err_msg=a),u={api:t,request:n,duration:r,cbTime:i+(o||0)+(u||0),response:e},!m(p)||(e=p(c.body,u))&&(u.extra=e,u.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete u.request.body,delete u.response.body),s({ev_type:"http",payload:u}))};n&&ae("request").subscribe(e),t&&ae("downloadFile").subscribe(e),r&&ae("uploadFile").subscribe(e)}},Vn=function(e,n,t,r){void 0===n&&(n={}),void 0===r&&(r=[]);try{var o=e.apply(void 0,y([],g(r),!1));return o&&o(n,t)||[]}catch(e){return C("applyMonitor",e),[]}};function Bn(e,n,t){le(e);n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return w(n)?d(d({},t),n):!!n&&t}function Un(e,n){return e&&n&&e===n}function Hn(){var r;return function(e){try{if(t=r,!(!(n=e)||!t)&&!(!Un(n.message,t.message)&&!Un(n.stack,t.stack)))return void(r=e)}catch(e){}var n,t;return r=e}}var Gn,Kn="http",Jn={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},Wn=function(f){return void 0===f&&(f=Sn()),function(e,r){var n=e.ignoreErrors,t=e.hookOnError,o=e.hookOnUnhandledRejection,i=e.hookRouteError,a=e.dedupe,u=v(n),c=Hn(),s=function(e,n,t){e=a?c(e):e;e&&(u&&u.test(e.message)||(e={error:e},n&&(e.extra=n),t&&(e.react=t),r(e)))};t&&ke(q.onError).subscribe(function(e){e=e.param,e=f.buildError(e);u&&u.test(e.message)||s(e)}),o&&ke(q.onUnhandledRejection).subscribe(function(e){var n=e.param||{},e=n.promise,t=x(n.reason);u&&u.test(t)||e.catch(b).then(function(e){var n={name:"UnhandledRejection",message:t};e&&e.stack&&(n.stack=e.stack),s(n)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&Te(function(e){e=e.param;"fail"===(e=e).name&&s({name:"RouteError",message:e.value.errMsg})}),[s]}};(he=Gn=Gn||{}).history="history",he.manual="manual";function Yn(t,e,r){var o=e,i=null,a=0,n="launch";function u(e,n){o=n,a=Z(),r(n,i=n+"_"+a),t(e,n)}return ke(q.onShow).pipe($e(1)).subscribe(function(){n="show"}),Te(function(){n="history"}),[u,function(e){e&&(u(n,e),n="history")},function(e){void 0===e&&(e="hide"),i&&(r(o,i),i=null,t(e,o,Z()-a))}]}var $n=function(){return function(e,r){var n=e.extractPid,t=e.routeMode,o=e.setPidAndViewId,i=function(e){return n?n(e):e},e=g(Yn(function(e,n,t){r({ev_type:"pageview",payload:{pid:n,source:e,duration:t}})},"",o),3),o=e[0],a=e[1],e=e[2];return t!==Gn.manual&&(Oe("onShow").subscribe(function(e){return function(e){e=rn(e),e=i(e);a(e)}(e.that)}),Oe("onUnload").subscribe(e.bind(null,"unload")),Oe("onHide").subscribe(e.bind(null,"hide"))),[o.bind(null,"user_set"),e]}},Qn=function(){return function(e){var n=g(function(n,t,r){void 0===n&&(n=20),void 0===t&&(t=b),void 0===r&&(r=function(e,n){return e.slice(-n)});var o=[];return[function(){return o},function(e){t(e)&&(e=d(d({},e),{timestamp:e.timestamp||Date.now()}),o=0<=n&&o.length+1>n?r(y(y([],g(o),!1),[e],!1),n):y(y([],g(o),!1),[e],!1))}]}(e.maxBreadcrumbs,e.onAddBreadcrumb,e.onMaxBreadcrumbs),2),e=n[0],r=n[1];return J.forEach(function(e){ue(e)&&ae(e).subscribe(function(e){r({type:"http",category:e.api,message:"",data:{method:e.request.method,url:e.request.url,status_code:String(e.response.status)},timestamp:e.request.timestamp})})}),Te(function(e,n){var t=e.param,e=e.time;"complete"===t.name&&r({type:"route",category:n,message:t.value.errMsg||t.value.errorMessage||"",timestamp:e,data:{url:t.url||""}})}),[e,r]}},Xn=function(){return function(e,t){var r=e.isCalculateSize;ce().subscribe(function(e){var n={duration:e.renderTime,start_time:e.startTime};r&&(n.size=(e=e.data,TextEncoder?(new TextEncoder).encode(x(e)).length:2*x(e).length)),t({ev_type:"set_data",payload:n})})}},Zn=function(){return function(e,n){function t(){n({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;ke(q.onLaunch).pipe(We(1)).subscribe(function(e){r.activate_start=e.time}),ke(q.onShow).pipe(We(1)).subscribe(function(e){r.init_end=e.time}),Oe("onLoad").pipe(We(1)).subscribe(function(e){r.page_load_start=e.time}),Oe("onShow").pipe(We(1)).subscribe(function(e){r.page_dom_end=e.time});var i=se();Oe("onReady").pipe(We(1)).subscribe(function(e){r.page_render_end=e.time,i&&!r.trigger||t()}),i&&je().pipe(Ye(function(e){return"appClick"===e.name}),We(1)).subscribe(function(e){r.trigger=e.startTime,r.page_render_end&&t()}),ke(q.onHide).subscribe(function(){o||t()})}},et=function(){return function(e,n){Sn().pagePerfSubscriber(function(e){return n({ev_type:"page_perf",payload:e})})}},nt=function(n){return void 0===n&&(n=Sn()),function(e,t){var r,o;se()&&n.performanceSubscriber&&(r=0,Oe("onLoad").subscribe(function(e){o=e.time,r++}),n.performanceSubscriber(function(e){var n={is_custom:!1,name:e.name,value:e.startTime,type:"perf",count:r};n.duration=e.duration||(o?e.startTime-o:0),n.is_support=0<=n.duration,t({ev_type:"performance",payload:n})}))}},rt="pageview",ot={routeMode:Gn.history,setPidAndViewId:function(e,n){}},it="jsError",at={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},ut=function(t){return function(e){var n=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},e),{breadcrumbs:n})})}},ct={maxBreadcrumbs:20,tap:!0},st="breadcrumb",ft=function(n){n.on("init",function(){n.provide("_subscriptions",[]),le(n),n.on("init",function(){tn(Y),vn(Q),hn($)}),n.on("init",function(){bn(W)})}),n.on("beforeDestroy",function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]})},lt="setData",pt={isCalculateSize:!1},dt="appLaunchPerf",ht={},mt="pagePerf",vt={},bt="performance",gt={},yt=function(e,n,t){void 0===t&&(t=Sn());var r=n.url,o=n.data,i=n.success,a=void 0===i?l:i,u=n.fail,c=void 0===u?l:u,i=n.header,u={"Content-Type":"application/json"};K(n=i)&&0!==Object.keys(n).length&&Object.assign(u,i),t.request({method:e,url:r,data:o,header:u,headers:u,success:function(e){a(e)},fail:function(e){e=e.errMsg||"Network request failed";c(new Error(e))}})},_t=function(n){return(n=void 0===n?Sn():n)?{get:function(e){return yt("GET",e,n)},post:function(e){return yt("POST",e,n)}}:{get:l,post:l}};function wt(e){return e=En(String(e)),(e=xn(e))&&e.userId&&e.deviceId?e:{userId:D(),deviceId:D()}}function St(e){return e+"_"+Date.now()}function Et(e){var n=e.aid,t=e.userId,e=e.deviceId;!function(e,n){try{Sn().setStorage(e,n)}catch(e){}}(En(String(n)),{userId:t,deviceId:e})}var xt={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:d(d({},e.extra||{}),e.overrides||{})}}},kt="/monitor_mini/collect",Ot="/settings/minipro",Tt="apmplus.volces.com",jt="session",Ct={sample_rate:1,include_users:[],sample_granularity:jt,rules:{}},Pt=[kt,Ot],Dt="0.2.3-alpha.0",It="APM_PLUS_MINI_PROGRAM",Rt=function(e,n){return void 0===n&&(n=kt),(e&&0<=e.indexOf("//")?"":"https://")+e+n};function Nt(e){e=wt(e.aid);return{aid:0,token:"",pid:"",viewId:St("_"),userId:e.userId,deviceId:e.deviceId,sessionId:D(),domain:Tt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:Pt},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:Ct,sdkName:It,sdkVersion:Dt}}function Mt(e){var n,t=e.plugins||{};for(n in t)t[n]&&!w(t[n])&&(t[n]={});return d(d({},e),{plugins:t})}function At(e){return w(e)&&"aid"in e&&"token"in e}function Ft(e){return d({},e)}var qt=function(n){var r,o,i=n,a={},u=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(e){var n,t;return a=d(d({},a),e||{}),s(),r||(r=e,i.useLocalConfig||!i.aid?(o={},c()):u?f():(n=i.domain,e=i.aid,t=function(e){u=e,f()},_t().get({url:function(e,n){return void 0===n&&(n=Ot),(e&&0<=e.indexOf("//")?"":"https://")+e+n}(n)+"?biz_id="+e,success:function(e){t(e&&e.data&&e.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(e){t=e},onReady:function(e){c=function(){Et(i),e()},o&&c()}};function s(){var e=d(d(d({},n),o||{}),a);e.plugins=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t={},r=0;r<e.length;)t=p(t,e[r++]);return t}(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=zt(zt(n.sample,null==o?void 0:o.sample),a.sample),i=e,t()}function f(){o=function(e){if(!e)return{};var n=e.sample,t=e.user_id,r=e.timestamp,o=t?{userId:t}:{};if(!n)return o;var i=n.sample_rate,e=n.sample_granularity,t=void 0===e?jt:e,e=n.include_users,n=n.rules,n=void 0===n?[]:n;return d(d({},o),{sample:{include_users:e,sample_rate:i,sample_granularity:t,rules:n.reduce(function(e,n){var t=n.name,r=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[t]={enable:r,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r})}(u),function(e){e=En(e);return!!Sn().getStorage(e)}(String(i.aid))&&(o.userId=n.userId),s(),c()}};function zt(r,o){if(!r||!o)return r||o;var e=d(d({},r),o);return e.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),e.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(e,n){var t;return n in e||(n in(r.rules||{})&&n in(o.rules||{})?(e[n]=d(d({},r.rules[n]),o.rules[n]),e[n].conditional_sample_rules=y(y([],g(r.rules[n].conditional_sample_rules||[]),!1),g(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(t=r.rules)||void 0===t?void 0:t[n])||(null===(t=o.rules)||void 0===t?void 0:t[n])),e},{}),e}function Lt(e){var n={url:(n=Sn().getCurrentPages().pop())?(n?rn(n):"")+s(n.options):"",timestamp:Z()};return d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})})}function Vt(e){if(!wn(e))throw Error(U);var t,e=function(e){var t,r,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,c=e.initConfigNormalizer,s=e.validateInitConfig,f={};_.forEach(function(e){return f[e]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(e){if(l)k("already inited");else{if(!(e&&w(e)&&s(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=c(e);if((r=a(n)).setConfig(e),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(e){l&&e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(u(e))),null==r?void 0:r.getConfig()},provide:function(e,n){S(m,e)?k("cannot provide "+e+", reserved"):(v[e]=n,b("provide",!1,e))},start:function(){var n=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(e){return n.build(e)}),h=[]}))},report:function(e){e&&(!(e=O(f.beforeReport)(e))||(e=O(f.report)(e))&&(p?this.build(e):h.push(e)))},build:function(e){!p||(e=O(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=O(f.build)(e))&&this.send(e))},send:function(e){!p||(e=O(f.beforeSend)(e))&&(t.send(e),b("send",!1,e))},destroy:function(){b("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&p||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=E(f[e],n))}},m=Object.keys(v);return v;function b(e,n){void 0===n&&(n=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[e].forEach(function(e){try{e.apply(void 0,y([],g(t),!1))}catch(e){}}),n&&(f[e].length=0)}}({validateInitConfig:At,initConfigNormalizer:Mt,userConfigNormalizer:Ft,createSender:function(e){return n({size:G,endpoint:Rt(e.domain),transport:_t()})},builder:xt,createDefaultConfig:Nt,createConfigManager:qt});return I(e),Kt(e),Ut(e),Ht(e),z(e),ft(e),(t=e).on("init",function(){var n=[],e=t.config();e&&e.integrations&&e.integrations.forEach(function(e){S(n,e.name)||(n.push(e.name),e.setup(t),e.tearDown&&t.on("beforeDestroy",e.tearDown))})}),Gt(e),Bt(e),e}var Bt=function(n){function t(e){return void 0===e&&(e=Sn().getSystemInfo()),n.set(d({},e))}function r(){t(),e()}var o,i,a=!1,e=(i="",function(){var e=o.getSender();i=i||e.getEndpoint();var n=o.config(),n={did:n.deviceId,sid:n.sessionId,sname:n.sdkName,sver:n.sdkVersion,soffset:n.offset||0,model:n.model,brand:n.brand,ratio:n.pixelRatio,screen:n.screenArea,window:n.windowArea,lang:n.language,osname:n.osName,osver:n.osVersion,libver:n.SDKVersion,scene:n.scene||-1,menv:n.miniEnv,mver:n.miniVersion,hostname:n.hostName,hostver:n.hostVersion,platform:n.platform,biz_id:n.aid,x_auth_token:n.token};e.setEndpoint(i+s(n))});(o=n).on("start",function(){r(),a=!0}),n.on("init",function(){ke(q.onLaunch).pipe(We(1)).subscribe(function(e){e=e.param.scene||-1;t({scene:e}),a&&r()}),Sn().monitorNetworkType(function(e){e=e.networkType;n.set({networkType:e})})})},Ut=function(r){r.on("beforeBuild",function(e){return n=e,t=r.config(),(e={}).aid=t.aid,e.pid=t.pid,e.view_id=t.viewId,e.user_id=t.userId,e.network_type=t.networkType,d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})});var n,t})},Ht=function(e){e.on("report",Lt)},Gt=function(n){n.on("init",function(){ke(q.onHide).subscribe(function(){var e=n.getSender();e&&e.flush()})})},Kt=function(t){var r,o=!1;t.on("init",function(){r=Z(),t.on("config",function(){var e,n=null===(e=t.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=Z())-r<1e3&&n&&(e=n-(e+r)/2,isNaN(e)||t.set({offset:e})))})})};return ve("mars"),function(e){var n,t,r,i,o,a,u,c,s,e=Vt(e);if(e)return(n=e).provide("sendEvent",function(e){e=V(e);e&&n.report({ev_type:L,payload:e,extra:{timestamp:Date.now()}})}),n.provide("sendLog",function(e){e=B(e);e&&n.report({ev_type:L,payload:e,extra:{timestamp:Date.now()}})}),(t=e).on("init",function(){var e,n=Bn(t,rt,ot);n&&(n=(e=g(Vn($n,d(d({},n),{setPidAndViewId:function(e,n){t.set({pid:e,viewId:n,actionId:void 0})}}),t.report.bind(t)),2))[0],e=e[1],t.provide("sendPageview",n),t.provide("sendPageviewWithHide",e))}),(r=e).on("init",function(){var e,n=Bn(r,it,at);n&&(e=ut(r),e=g(Vn(Wn,n,e),1)[0],r.provide("captureException",e))}),(i=e).on("init",function(){var e,n,t,r,o=Bn(i,Kn,Jn);o&&(e=o.hookRequest,n=o.hookDownloadFile,t=o.hookUploadFile,r=[],e&&r.push("request"),n&&r.push("downloadFile"),t&&r.push("uploadFile"),In(i,r),Vn(Ln,o,i.report.bind(i)))}),(o=e).on("init",function(){var e=Bn(o,lt,pt);e&&(An(o),Vn(Xn,e,o.report.bind(o)))}),(a=e).on("init",function(){var e,n=Bn(a,st,ct);n&&(n=(e=g(Vn(Qn,n,function(e){}),2))[0],e=e[1],a.provide("getBreadcrumbs",n),a.provide("addBreadcrumb",e))}),(u=e).on("init",function(){var e=Bn(u,dt,ht);e&&(Fn(u),Vn(Zn,e,u.report.bind(u)))}),(c=e).on("init",function(){var e=Bn(c,mt,vt);e&&Vn(et,e,c.report.bind(c))}),(s=e).on("init",function(){var e=Bn(s,bt,gt);e&&(Fn(s),Vn(nt,e,s.report.bind(s)))}),e}.bind(null,[we])()}); |
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).myClient=e()}(this,function(){"use strict";function e(n){var t,r=n.transport,o=n.endpoint,e=n.size,i=void 0===e?10:e,n=n.wait,u=void 0===n?1e3:n,a=[],c=0;function s(){var e;a.length&&(e=this.getBatchData(),r.post({url:o,data:e,fail:function(n){t&&t(n,e)}}),a=[])}return{getSize:function(){return i},getWait:function(){return u},setSize:function(n){i=n},setWait:function(n){u=n},getEndpoint:function(){return o},setEndpoint:function(n){o=n},send:function(n){a.push(n),a.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),u)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return a.length?(n=a,JSON.stringify({ev_type:"batch",list:n})):"";var n},clear:function(){clearTimeout(c),a=[]},fail:function(n){t=n}}}var r=function(n,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])})(n,e)};function n(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}r(n,e),n.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}var d=function(){return(d=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}).apply(this,arguments)};function g(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),u=[];try{for(;(void 0===e||0<e--)&&!(r=i.next()).done;)u.push(r.value)}catch(n){o={error:n}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function y(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||((r=r||Array.prototype.slice.call(e,0,o))[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(n){return n}function w(n){return"object"==typeof n&&null!==n}var t=Object.prototype;function i(n){if(w(n)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(n);n=Object.getPrototypeOf(n);return n===t||null===n}}function u(n){return"[object Array]"===t.toString.call(n)}function h(n){return"function"==typeof n}function a(n){return"number"==typeof n}function c(n){return"string"==typeof n}function p(n,e){var t,r,o=d({},n);for(t in e)r=t,Object.prototype.hasOwnProperty.call(e,r)&&void 0!==e[t]&&(w(e[t])&&i(e[t])?o[t]=p(w(n[t])?n[t]:{},e[t]):u(e[t])&&u(n[t])?o[t]=function e(n,t){n=u(n)?n:[];t=u(t)?t:[];return Array.prototype.concat.call(n,t).map(function(n){return n instanceof RegExp?n:w(n)&&i(n)?p({},n):u(n)?e([],n):n})}(n[t],e[t]):o[t]=e[t]);return o}function S(n,e){if(!u(n))return!1;if(0===n.length)return!1;for(var t=0;t<n.length;){if(n[t]===e)return!0;t++}return!1}function x(n,e){if(!u(n))return n;var t=n.indexOf(e);if(0<=t){e=n.slice();return e.splice(t,1),e}return n}function m(n){return u(n)&&n.length?function(n){for(var e=[],t=n.length,r=0;r<t;r++){var o=n[r];c(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}(n):null}function v(n){try{return c(n)?n:JSON.stringify(n)}catch(n){return"[FAILED_TO_STRINGIFY]:"+String(n)}}function s(t){return w(t)?Object.keys(t).reduce(function(n,e){return n+="&"+e+"="+t[e]},"").replace("&","?"):""}function f(i,u,a,c){return void 0===c&&(c=!0),function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(!i)return l;var t=i[u],r=a.apply(void 0,y([t],g(n),!1)),o=r;return h(o)&&c&&(o=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{return r.apply(this,e)}catch(n){return h(t)&&t.apply(this,e)}}),i[u]=o,function(n){n||(o===i[u]?i[u]=t:r=t)}}}function E(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.warn.apply(console,y(["[SDK]",Date.now(),(""+T++).padStart(8," ")],g(n),!1))}function o(n){return Math.random()<Number(n)}function k(n,e){return n<Number(e)}function O(r){return function(n){for(var e=n,t=0;t<r.length&&e;t++)try{e=r[t](e)}catch(n){C(n)}return e}}var j=0,C=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.error.apply(console,y(["[SDK]",Date.now(),(""+j++).padStart(8," ")],g(n),!1))},T=0;function P(){var n=function(){for(var n=new Array(16),e=0,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(n){for(var e=[],t=0;t<256;++t)e[t]=(t+256).toString(16).substr(1);var r=0,o=e;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[+r]],o[n[15]]].join("")}(n)}var D=function(n){var t,r,o,e=(t={},r={},o={set:function(n,e){return t[n]=e,r[n]=v(e),o},merge:function(e){return t=d(d({},t),e),Object.keys(e).forEach(function(n){r[n]=v(e[n])}),o},delete:function(n){return delete t[n],delete r[n],o},clear:function(){return t={},r={},o},get:function(n){return r[n]},toString:function(){return d({},r)}});n.provide("context",e),n.on("report",function(n){return n.extra||(n.extra={}),n.extra.context=e.toString(),n})};function I(n,e){var t=n.common||{};return t.sample_rate=e,n.common=t,n}function R(n,e,t,r,o){return n?(i=o(r,e),function(){return i}):function(){return t(e)};var i}function M(n,e,t,r){if(void 0===(n=function(n,e,t){for(var r,e=g(e.split(".")),o=e[0],i=e.slice(1);n&&0<i.length;)n=n[o],o=(r=g(i))[0],i=r.slice(1);if(n)return t(n,o)}(n,e,function(n,e){return n[e]})))return!1;var o,e="boolean"==typeof n?"bool":a(n)?"number":"string";return function(n,e,t){switch(t){case"eq":return S(e,n);case"neq":return!S(e,n);case"gt":return n>e[0];case"gte":return n>=e[0];case"lt":return n<e[0];case"lte":return n<=e[0];case"regex":return Boolean(n.match(new RegExp(e.join("|"))));case"not_regex":return!n.match(new RegExp(e.join("|")));default:return!1}}(n,(o=e,r.map(function(n){switch(o){case"number":return Number(n);case"boolean":return"1"===n;default:return String(n)}})),t)}function N(e,n){try{return"rule"===n.type?M(e,n.field,n.op,n.values):"and"===n.type?n.children.every(function(n){return N(e,n)}):n.children.some(function(n){return N(e,n)})}catch(n){return!1}}function A(n,e,t,r){if(!e)return b;var o=e.sample_rate,i=e.include_users,u=e.sample_granularity,a=e.rules,e=void 0===(e=e.r)?Math.random():e;if(S(i,n))return function(n){return I(n,1)};var c,s,f,l,p,d,h,m=R(u="session"===u,o,t,e,r),v=(c=a,s=u,f=o,l=t,p=e,d=r,h={},Object.keys(c).forEach(function(n){var e=c[n],t=e.enable,r=e.sample_rate,e=e.conditional_sample_rules;t?(h[n]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:R(s,r,l,p,d)},e&&(h[n].conditional_hit_rules=e.map(function(n){var e=n.sample_rate,n=n.filter;return{sample_rate:e,hit:R(s,e,l,p,d),effectiveSampleRate:e*f,filter:n}}))):h[n]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(n){if(!m())return!1;if(!(n.ev_type in v))return I(n,o);if(!v[n.ev_type].enable)return!1;if(n.common&&n.common.sample_rate)return n;var e=v[n.ev_type],t=e.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(N(n,t[r].filter))return!!t[r].hit()&&I(n,t[r].effectiveSampleRate);return!!e.hit()&&I(n,e.effectiveSampleRate)}}var F,q=function(t){t.on("start",function(){var n=t.config(),e=n.userId,n=n.sample,n=A(e,n,o,k);t.on("build",n)})},z="custom",L=function(n){if(n&&w(n)&&n.name&&c(n.name)){var e={name:n.name,type:"event"};if("metrics"in n&&w(n.metrics)){var t=n.metrics,r={};for(o in t)a(t[o])&&(r[o]=t[o]);e.metrics=r}if("categories"in n&&w(n.categories)){var o,i=n.categories,u={};for(o in i)u[o]=v(i[o]);e.categories=u}return e}},V=function(n){if(n&&w(n)&&n.content&&c(n.content)){var e={content:v(n.content),type:"log",level:"info"};if("level"in n&&(e.level=n.level),"extra"in n&&w(n.extra)){var t,r=n.extra,o={},i={};for(t in r)a(r[t])?o[t]=r[t]:i[t]=v(r[t]);e.metrics=o,e.categories=i}return e}},B="Adapters imported incorrectly",U=["success","fail","complete"],H=20;(Sn=F=F||{}).onLaunch="onLaunch",Sn.onShow="onShow",Sn.onHide="onHide",Sn.onError="onError",Sn.onPageNotFound="onPageNotFound",Sn.onUnhandledRejection="onUnhandledRejection";function G(n){return"[object Object]"===Object.prototype.toString.call(n)}var K=["request","downloadFile","uploadFile"],J=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],W=y(y([],g([F.onLaunch,F.onShow,F.onHide]),!1),[F.onError,F.onPageNotFound,F.onUnhandledRejection],!1),Y=["attached","onInit"],$=["onLoad","onShow","onReady","onUnload","onHide"],Q="unknown_error_name",X="__HOOKED__";function Z(){return Date.now()}function nn(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];if(!h(n))return 0;var r,o=Z();try{n.apply(this,e)}finally{r=Z()}return r-o}var en,tn=function(){},rn=g((en="tt",[function(){return en},function(n){return en=n}]),2),on=rn[0];rn[1];function un(e,t){function n(n){return t(n),e.call(this,n)}for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function an(n,e,r){var o=n[e];if(!o||!o[X])return Object.defineProperty(n,e,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{var t=r.apply(this,n);t&&(n=t)}catch(n){C(n)}return o.apply(this,n)}}),n[e]&&(n[e][X]=!0),function(){n[e][X]=!1,r=tn}}function cn(t,n){Object.keys(n).forEach(function(e){n[e].addTearDown(function(){var n;return En(t,((n={})[e]=null,n))})})}function sn(n,e){e.addTearDown(function(){return xn(n,null)})}function fn(n){return kn("route")[n]}function ln(n){return!!kn("route")[n]}function pn(n){return kn("http")[n]}function dn(n){return!!kn("http")[n]}function hn(){return kn("setData")}function mn(){return!!kn("performance")}function vn(n){return kn("component")[n]}function bn(){return kn("instance")}function gn(n){xn("instance",n)}var yn=function(){var n={instance:null};return n.instance||("undefined"!=typeof tt?n={instance:tt,platform:on()}:"undefined"!=typeof my?n={instance:my,platform:"my"}:"undefined"!=typeof swan?n={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(n={instance:wx,platform:"wx"})),n},_n="__slardar__global__0.2.2",wn={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},Sn=function(n,e){void 0===n&&(n={});var t=(e=void 0===e?yn().instance:e)?e[_n]||(e[_n]=n):n;return{setGlobalValue:function(n,e){t[n]=e},mergeGlobalValue:function(n,e){t[n]=d(d({},t[n]),e)},getGlobalValue:function(n){return t[n]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},wn),e&&(e[_n]=t)}}}(d({},wn)),xn=Sn.setGlobalValue,En=Sn.mergeGlobalValue,kn=Sn.getGlobalValue,On=function(n){return kn("app")[n]},jn=function(n){return kn("page")[n]},Cn=function(t){J.forEach(function(e){ln(e)&&fn(e).subscribe(function(n){return t(n,e)})})};function Tn(n){return"function"==typeof n}function Pn(n,e){!n||0<=(e=n.indexOf(e))&&n.splice(e,1)}function Dn(n){return n}function In(t){return function(n){if((e=n)&&Tn(e.lift))return n.lift(function(n){try{return t(n,this)}catch(n){this.error(n)}});var e;throw new TypeError("Unable to lift unknown Observable type")}}function Rn(n){Tn(n)?n():null!=n&&n.unsubscribe()}var Mn=function(n){return n instanceof Nn||n&&"closed"in n&&Tn(n.remove)&&Tn(n.add)&&Tn(n.unsubscribe)},Nn=(An.prototype.unsubscribe=function(){var n,e,t,r=this;this.closed||(this.closed=!0,n=this._parentage,e=this._finalizers,t=this.initialTeardown,n&&(this._parentage=null,n.forEach(function(n){return n.remove(r)})),Tn(t)&&t(),e&&(this._finalizers=null,e.forEach(Rn)))},An.prototype.remove=function(n){this._finalizers&&Pn(this._finalizers,n),n instanceof An&&n._removeParent(this)},An.prototype.add=function(n){if(n&&n!==this)if(this.closed)Rn(n);else{if(n instanceof An){if(n.closed||n._hasParent(this))return;n._addParent(this)}var e=this._finalizers;this._finalizers=e?(e.push(n),e):[n]}},An.prototype._addParent=function(n){var e=this._parentage;this._parentage=e?(e.push(n),e):[n]},An.prototype._hasParent=function(n){return this._parentage&&~this._parentage.indexOf(n)},An.prototype._removeParent=function(n){this._parentage&&Pn(this._parentage,n)},An);function An(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}var Fn,qn=(n(zn,Fn=Nn),zn.prototype.next=function(n){this.isStopped||this.destination.next(n)},zn.prototype.error=function(n){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(n)}finally{this.unsubscribe()}}},zn.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},zn.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Fn.prototype.unsubscribe.call(this),this.destination=null)},zn.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},zn);function zn(n){var e=Fn.call(this)||this;return e.isStopped=!1,e.destination=Bn(n)?n:new Ln(!(n=n)||Tn(n)?{next:null!=n?n:void 0}:n),e}var Ln=(Vn.prototype.next=function(n){var e=this.partialObserver;if(e.next)try{e.next(n)}catch(n){console.error("ConsumerObserver.next error",n)}},Vn.prototype.error=function(n){var e=this.partialObserver;if(e.error)try{e.error(n)}catch(n){console.error("ConsumerObserver.error error",n)}},Vn.prototype.complete=function(){var n=this.partialObserver;if(n.complete)try{n.complete()}catch(n){console.error("ConsumerObserver.complete error",n)}},Vn);function Vn(n){this.partialObserver=n}function Bn(n){return n instanceof qn||n&&((e=n)&&Tn(e.next)&&Tn(e.error)&&Tn(e.complete))&&Mn(n);var e}Un.prototype.subscribe=function(n){var e=Bn(n)?n:new qn(n),t=this.operator,n=this.source;return e.add(t?t.call(e,n):this._trySubscribe(e)),e},Un.prototype.lift=function(n){var e=new Un;return e.source=this,e.operator=n,e},Un.prototype.pipe=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return(0===(e=n).length?Dn:1===e.length?e[0]:function(n){return e.reduce(function(n,e){return e(n)},n)})(this)},Un.prototype._subscribe=function(n){},Un.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},rn=Un;function Un(n){n&&(this._subscribe=n)}var Hn,Sn=(n(Gn,Hn=rn),Gn.prototype.next=function(e){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(n){return n.next(e)})},Gn.prototype.commonJudgement=function(n){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,n())},Gn.prototype.error=function(e){var t=this;this.commonJudgement(function(){var n=t.observers;for(t.hasError=!0,t.thrownError=e;n.length;)n.shift().error(e)})},Object.defineProperty(Gn.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Gn.prototype.complete=function(){var e=this;this.commonJudgement(function(){for(var n=e.observers;n.length;)n.shift().complete()})},Gn.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Gn.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Gn.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},Gn.prototype._checkFinalizedStatuses=function(n){var e=this.hasError,t=this.thrownError,r=this.isStopped;e?n.error(t):r&&n.complete()},Gn.prototype._innerSubscribe=function(n){var e=this.isStopped,t=this.observers;return e?Gn.EMPTY:(t.push(n),new Nn(function(){Pn(t,n)}))},Gn.EMPTY=((Sn=new Nn).closed=!0,Sn),Gn);function Gn(){var n=null!==Hn&&Hn.apply(this,arguments)||this;return n.closed=!1,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}var Kn=new rn(function(n){return n.complete()});function Jn(r){return r<=0?function(){return Kn}:In(function(n,e){var t=0;n.subscribe(function(n){++t<=r&&(e.next(n),r<=t&&e.complete())})})}function Wn(r,o){return In(function(n,e){var t=0;n.subscribe(function(n){return r.call(o,n,t++)&&e.next(n)})})}function Yn(t){return Wn(function(n,e){return t<=e})}var $n,Qn=(n(Xn,$n=Sn),Xn.prototype.subscribe=function(n){var t=this,n=$n.prototype.subscribe.call(this,n);bn()&&bn()._subscriptions.push(n);var r=n.unsubscribe;return n.unsubscribe=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];r.apply(this,n),t.observed||t.unsubscribe()},n},Xn.prototype.unsubscribe=function(){$n.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(n){return n()})},Xn.prototype.addTearDown=function(n){this.tearDownFns.push(n)},Xn);function Xn(){var n=null!==$n&&$n.apply(this,arguments)||this;return n.tearDownFns=[],n}function Zn(n){var e=n.reduce(function(n,e){return n[e]=new Qn,n},{});return{getSubject:function(n){return e[n]},subjectMap:e}}function ne(n){return 1<n.length?n:n.length&&n[0]||{}}function ee(n){var t=n.filter(function(n){return n=n,!!!kn("app")[n]}),n=Zn(t).subjectMap;En("app",n=n),cn("app",n),App=un(App,function(e){t.forEach(function(n){var r=On(n),n=f(e,n,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];r.next({that:this,param:ne(n),time:Z()}),h(t)&&t.apply(this,n)}})();n&&r.addTearDown(n)})})}function te(n){return n.route||n.__route__||n.url||n.path||""}function re(n){function e(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(n(d({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;Cn(function(n,e){"invoke"===n.param.name&&(o=!1,r={navigate_start:n.time,navigate_name:e})}),jn("onLoad").pipe(Yn(1)).subscribe(function(n){r.load_start=n.time}),jn("onShow").pipe(Yn(1)).subscribe(function(n){r.dom_end=n.time}),jn("onReady").pipe(Yn(1)).subscribe(function(n){r.render_end=n.time,e(),t()}),On(F.onHide).subscribe(function(){!1===o&&(e(),t())})}function oe(n){return"android"===n.toLowerCase()}function ie(){var n="",e="",t="";my.getAccountInfoSync?(d=my.getAccountInfoSync().miniProgram,e=d.envVersion,n=d.appId,t=d.version):(n=my.getAppIdSync().appId,my.getRunScene({success:function(n){e=n.envVersion}}));var r=(h=my.getSystemInfoSync()).model,o=h.brand,i=h.pixelRatio,u=h.screenHeight,a=h.screenWidth,c=h.windowHeight,s=h.windowWidth,f=h.language,l=h.version,p=h.system,d=h.platform,h=h.app;return{model:r,brand:o,pixelRatio:i,screenArea:_e({pixelRatio:i,width:a,height:u,systemPlatform:d}),windowArea:_e({width:s,height:c}),language:f,osName:ye(d),osVersion:p,SDKVersion:my.SDKVersion,appId:n,miniEnv:e,miniVersion:t,hostName:h,hostVersion:l,platform:"my"}}function ue(n){var e=n.filter(function(n){return n=n,!!!kn("component")[n]}),n=Zn(e).subjectMap;En("component",n=n),cn("component",n),he().componentSubject(e)}function ae(e){function n(n){G(n.methods)?e(n.methods):void 0!==n.methods&&null!==n.methods||(n.methods={},e(n.methods))}try{Component=un(Component,n),Behavior=un(Behavior,n)}catch(n){}}function ce(n,e){var t=n.filter(function(n){return n=n,!!!kn("page")[n]}),n=Zn(t).subjectMap;En("page",n=n),cn("page",n),n=function(e){t.forEach(function(n){var r=jn(n),n=f(e,n,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(te(this)&&r.next({that:this,param:ne(n),time:Z()}),h(t))return t.apply(this,n)}})();n&&r.addTearDown(n)})},Page=un(Page,n),ae(n)}function se(n){var e=n.filter(function(n){return!ln(n)}),t=Zn(e).subjectMap;En("route",n=t),cn("route",n),e.forEach(function(i){var n=an(he().instance,i,function(o){fn(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:Z()}),U.forEach(function(r){f(o,r,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];fn(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:ne(n)||{}},time:Z()}),h(t)&&t.apply(this,n)}})()})});n&&t[i].addTearDown(n)})}function fe(a,n){var e=n.url,t=n.method,r=n.data,o=n.header,i=n.headers,c={api:a,request:{url:e,method:(e=t,"uploadFile"===(t=a)?"POST":"downloadFile"!==t&&e||"GET"),headers:o||i||{},body:v(r),timestamp:Z()},response:{}};f(n,"complete",function(u){return function(n){var e=c.response.timestamp||Z();c.duration=e-c.request.timestamp,c.completeCallbackTime=nn(u,n);var t,r,o,i=n.errMsg||n.errorMessage||n.error;c.response={status:(t=n.status,r=n.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:e,headers:n.header||n.headers||{},body:v(n.data),errMsg:i,timing:he().buildRequestProfile(n.profile||{})},pn(a).next(c)}})(),f(n,"success",function(e){return function(n){c.response.timestamp=Z(),c.response.status=200,c.successCallbackTime=nn(e,n)}})(),f(n,"fail",function(e){return function(n){c.response.timestamp=Z(),c.response.status=-1,c.failCallbackTime=nn(e,n)}})()}function le(n,t){void 0===t&&(t=he().instance);var e=n.filter(function(n){return!dn(n)}),r=Zn(e).subjectMap;En("http",n=r),cn("http",n),e.forEach(function(e){var n=an(t,e,function(n){fe(e,n)});n&&r[e].addTearDown(n)})}var pe,rn=g((pe={},[function(n){if(!yn().platform)throw Error("Not support current Mini Program");if(!Array.isArray(n)||!n.length)return null;n=n.find(function(n){return n.platform===yn().platform});return n&&(pe=n.adapterCtor())},function(){return pe}]),2),de=rn[0],he=rn[1],me=function(n){return"SLARDAR"+n},ve=function(n){try{return he().getStorage(n)}catch(n){return}},be=["darwin","macs","mac"],ge=["windows_nt","windows","window"],ye=function(n){return oe(n)?"Android":"ios"===n.toLowerCase()?"iOS":~be.indexOf(n.toLowerCase())?"Mac":~ge.indexOf(n.toLowerCase())?"windows":"unknown"},_e=function(n){var e=n.systemPlatform,t=n.pixelRatio,r=n.width,n=n.height;return e&&oe(e)&&t?r/t+" * "+n/t:r+" * "+n},Sn={platform:"my",adapterCtor:function(){return d(d({},{instance:t=void 0===t?yn().instance:t,request:function(n){return t.request(n)},getStorage:function(n){return t.getStorageSync(n)},setStorage:function(n,e){return t.setStorageSync(n,e)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(n){return n},monitorNetworkType:function(e){t.getNetworkType({success:function(n){e&&e({networkType:n.networkType})}}),t.onNetworkStatusChange(function(n){e&&e({networkType:n.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:"my",buildError:function(n){return u(n)?function(n,e){n={message:n};return!e||(e=g((e=(n.stack=e).split("\n"))[0]&&e[0].split(":"),1)[0])&&(n.name=e),n}(n[0],n[1]):{name:Q,message:v(n)}},setStorage:function(n,e){return my.setStorageSync({key:n,data:e})},getStorage:function(n){return my.getStorageSync({key:n}).data},getSystemInfo:ie,componentSubject:function(n){var e=["onInit"],t=n.filter(function(n){return~e.indexOf(n)}),r=function(n){t.forEach(function(r){f(n,r,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(vn(r).next({that:this,param:null,time:Z()}),h(t))return t.apply(this,n)}})()})};Component=un(Component,function(n){w(n)?r(n):null==n&&r(n={})})},setDataSubject:function(e){vn("onInit").subscribe(function(n){n=n.that;return e.call(n)})},pagePerfSubscriber:re});var t}},we=function(n,e){void 0===e&&(e=K),n.on("init",function(){le(e)})};function Se(){var u=te(this),a=hn();var n=an(this,"setData",function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=r[0],i=Z();return[o,function(){var n=r[1],e=Z()-i;a.next({renderTime:e,url:u,data:o,startTime:i}),n&&n.call(t)}]});n&&a.addTearDown(n)}function xe(){var n;kn("setData")||(n=(n=Zn(["setData"]).getSubject)("setData"),xn("setData",n),sn("setData",n))}function Ee(o){return Object.keys(o).reduce(function(n,e){var t,r;return r=o[t=e],t&&r&&(je.test(t)||Ce.test(r))||(n[e]=o[e]),n},{})}var ke=function(n){n.on("init",function(){xe(),jn("onLoad").subscribe(function(n){n=n.that;Se.call(n)}),he().setDataSubject(Se)})},Oe=function(n){n.on("init",function(){var e,n,t,r=he();r.observePerformance&&!mn()&&(e=(0,Zn(["performance"]).getSubject)("performance"),xn("performance",n=e),sn("performance",n),(t=r.observePerformance(function(n){n.forEach(function(n){e.next(n)})}))&&t.disconnect&&e.addTearDown(function(){return t.disconnect()}))})},je=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),Ce=new RegExp("(bearer|session)","i"),Te=function(){return function(n,s){var e=n.hookRequest,t=n.hookDownloadFile,r=n.hookUploadFile,f=n.ignoreUrls,l=n.collectBodyOnError,p=n.extraExtractor,n=function(n){var e,t,r,o,i,u,a,c;!function(n,e){n=m(n||[]);return!!n&&n.test(e)}(f,n.request.url)&&(c=n.response,e=n.request,t=n.api,r=n.duration,o=n.failCallbackTime,a=n.successCallbackTime,i=n.completeCallbackTime,e.headers=Ee(e.headers||{}),c.headers=Ee(c.headers||{}),u=c.errMsg,n=function(n,e){var t={};for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&e.indexOf(o)<0&&(t[o]=n[o]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(n);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(n,o[r])&&(t[o[r]]=n[o[r]]);return t}(c,["errMsg"]),n=d(d({},n),{is_custom_error:!1}),u&&(n.err_msg=u),a={api:t,request:e,duration:r,cbTime:i+(o||0)+(a||0),response:n},!h(p)||(n=p(c.body,a))&&(a.extra=n,a.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete a.request.body,delete a.response.body),s({ev_type:"http",payload:a}))};e&&pn("request").subscribe(n),t&&pn("downloadFile").subscribe(n),r&&pn("uploadFile").subscribe(n)}},Pe=function(n,e,t,r){void 0===e&&(e={}),void 0===r&&(r=[]);try{var o=n.apply(void 0,y([],g(r),!1));return o&&o(e,t)||[]}catch(n){return C("applyMonitor",n),[]}};function De(n,e,t){gn(n);e=null===(n=n.config())||void 0===n?void 0:n.plugins[e];return w(e)?d(d({},t),e):!!e&&t}function Ie(n,e){return n&&e&&n===e}function Re(){var r;return function(n){try{if(t=r,!(!(e=n)||!t)&&!(!Ie(e.message,t.message)&&!Ie(e.stack,t.stack)))return void(r=n)}catch(n){}var e,t;return r=n}}var Me,Ne="http",Ae={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},Fe=function(f){return void 0===f&&(f=he()),function(n,r){var e=n.ignoreErrors,t=n.hookOnError,o=n.hookOnUnhandledRejection,i=n.hookRouteError,u=n.dedupe,a=m(e),c=Re(),s=function(n,e,t){n=u?c(n):n;n&&(a&&a.test(n.message)||(n={error:n},e&&(n.extra=e),t&&(n.react=t),r(n)))};t&&On(F.onError).subscribe(function(n){n=n.param,n=f.buildError(n);a&&a.test(n.message)||s(n)}),o&&On(F.onUnhandledRejection).subscribe(function(n){var e=n.param||{},n=e.promise,t=v(e.reason);a&&a.test(t)||n.catch(b).then(function(n){var e={name:"UnhandledRejection",message:t};n&&n.stack&&(e.stack=n.stack),s(e)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&Cn(function(n){n=n.param;"fail"===(n=n).name&&s({name:"RouteError",message:n.value.errMsg})}),[s]}};(rn=Me=Me||{}).history="history",rn.manual="manual";function qe(t,n,r){var o=n,i=null,u=0,e="launch";function a(n,e){o=e,u=Z(),r(e,i=e+"_"+u),t(n,e)}return On(F.onShow).pipe(Yn(1)).subscribe(function(){e="show"}),Cn(function(){e="history"}),[a,function(n){n&&(a(e,n),e="history")},function(n){void 0===n&&(n="hide"),i&&(r(o,i),i=null,t(n,o,Z()-u))}]}var ze=function(){return function(n,r){var e=n.extractPid,t=n.routeMode,o=n.setPidAndViewId,i=function(n){return e?e(n):n},n=g(qe(function(n,e,t){r({ev_type:"pageview",payload:{pid:e,source:n,duration:t}})},"",o),3),o=n[0],u=n[1],n=n[2];return t!==Me.manual&&(jn("onShow").subscribe(function(n){return function(n){n=te(n),n=i(n);u(n)}(n.that)}),jn("onUnload").subscribe(n.bind(null,"unload")),jn("onHide").subscribe(n.bind(null,"hide"))),[o.bind(null,"user_set"),n]}},Le=function(){return function(n){var e=g(function(e,t,r){void 0===e&&(e=20),void 0===t&&(t=b),void 0===r&&(r=function(n,e){return n.slice(-e)});var o=[];return[function(){return o},function(n){t(n)&&(n=d(d({},n),{timestamp:n.timestamp||Date.now()}),o=0<=e&&o.length+1>e?r(y(y([],g(o),!1),[n],!1),e):y(y([],g(o),!1),[n],!1))}]}(n.maxBreadcrumbs,n.onAddBreadcrumb,n.onMaxBreadcrumbs),2),n=e[0],r=e[1];return K.forEach(function(n){dn(n)&&pn(n).subscribe(function(n){r({type:"http",category:n.api,message:"",data:{method:n.request.method,url:n.request.url,status_code:String(n.response.status)},timestamp:n.request.timestamp})})}),Cn(function(n,e){var t=n.param,n=n.time;"complete"===t.name&&r({type:"route",category:e,message:t.value.errMsg||t.value.errorMessage||"",timestamp:n,data:{url:t.url||""}})}),[n,r]}},Ve=function(){return function(n,t){var r=n.isCalculateSize;hn().subscribe(function(n){var e={duration:n.renderTime,start_time:n.startTime};r&&(e.size=(n=n.data,TextEncoder?(new TextEncoder).encode(v(n)).length:2*v(n).length)),t({ev_type:"set_data",payload:e})})}},Be=function(){return function(n,e){function t(){e({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;On(F.onLaunch).pipe(Jn(1)).subscribe(function(n){r.activate_start=n.time}),On(F.onShow).pipe(Jn(1)).subscribe(function(n){r.init_end=n.time}),jn("onLoad").pipe(Jn(1)).subscribe(function(n){r.page_load_start=n.time}),jn("onShow").pipe(Jn(1)).subscribe(function(n){r.page_dom_end=n.time});var i=mn();jn("onReady").pipe(Jn(1)).subscribe(function(n){r.page_render_end=n.time,i&&!r.trigger||t()}),i&&kn("performance").pipe(Wn(function(n){return"appClick"===n.name}),Jn(1)).subscribe(function(n){r.trigger=n.startTime,r.page_render_end&&t()}),On(F.onHide).subscribe(function(){o||t()})}},Ue=function(){return function(n,e){he().pagePerfSubscriber(function(n){return e({ev_type:"page_perf",payload:n})})}},He=function(e){return void 0===e&&(e=he()),function(n,t){var r,o;mn()&&e.performanceSubscriber&&(r=0,jn("onLoad").subscribe(function(n){o=n.time,r++}),e.performanceSubscriber(function(n){var e={is_custom:!1,name:n.name,value:n.startTime,type:"perf",count:r};e.duration=n.duration||(o?n.startTime-o:0),e.is_support=0<=e.duration,t({ev_type:"performance",payload:e})}))}},Ge="pageview",Ke={routeMode:Me.history,setPidAndViewId:function(n,e){}},Je="jsError",We={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},Ye=function(t){return function(n){var e=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},n),{breadcrumbs:e})})}},$e={maxBreadcrumbs:20,tap:!0},Qe="breadcrumb",Xe=function(e){e.on("init",function(){e.provide("_subscriptions",[]),gn(e),e.on("init",function(){ee(W),ce($),ue(Y)}),e.on("init",function(){se(J)})}),e.on("beforeDestroy",function(){if(e._subscriptions)for(;e._subscriptions.length;)e._subscriptions.shift().unsubscribe();for(var n in e)delete e[n]})},Ze="setData",nt={isCalculateSize:!1},et="appLaunchPerf",rt={},ot="pagePerf",it={},ut="performance",at={},ct=function(n,e,t){void 0===t&&(t=he());var r=e.url,o=e.data,i=e.success,u=void 0===i?l:i,a=e.fail,c=void 0===a?l:a,i=e.header,a={"Content-Type":"application/json"};G(e=i)&&0!==Object.keys(e).length&&Object.assign(a,i),t.request({method:n,url:r,data:o,header:a,headers:a,success:function(n){u(n)},fail:function(n){n=n.errMsg||"Network request failed";c(new Error(n))}})},st=function(e){return(e=void 0===e?he():e)?{get:function(n){return ct("GET",n,e)},post:function(n){return ct("POST",n,e)}}:{get:l,post:l}};function ft(n){return n=me(String(n)),(n=ve(n))&&n.userId&&n.deviceId?n:{userId:P(),deviceId:P()}}function lt(n){return n+"_"+Date.now()}function pt(n){var e=n.aid,t=n.userId,n=n.deviceId;!function(n,e){try{he().setStorage(n,e)}catch(n){}}(me(String(e)),{userId:t,deviceId:n})}var dt={build:function(n){return{ev_type:n.ev_type,payload:n.payload,common:d(d({},n.extra||{}),n.overrides||{})}}},ht="/monitor_mini/collect",mt="/settings/minipro",vt="apmplus.volces.com",bt="session",gt={sample_rate:1,include_users:[],sample_granularity:bt,rules:{}},yt=[ht,mt],_t="0.2.2",wt="APM_PLUS_MINI_PROGRAM",St=function(n,e){return void 0===e&&(e=ht),(n&&0<=n.indexOf("//")?"":"https://")+n+e};function xt(n){n=ft(n.aid);return{aid:0,token:"",pid:"",viewId:lt("_"),userId:n.userId,deviceId:n.deviceId,sessionId:P(),domain:vt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:yt},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:gt,sdkName:wt,sdkVersion:_t}}function Et(n){var e,t=n.plugins||{};for(e in t)t[e]&&!w(t[e])&&(t[e]={});return d(d({},n),{plugins:t})}function kt(n){return w(n)&&"aid"in n&&"token"in n}function Ot(n){return d({},n)}var jt=function(e){var r,o,i=e,u={},a=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(n){var e,t;return u=d(d({},u),n||{}),s(),r||(r=n,i.useLocalConfig||!i.aid?(o={},c()):a?f():(e=i.domain,n=i.aid,t=function(n){a=n,f()},st().get({url:function(n,e){return void 0===e&&(e=mt),(n&&0<=n.indexOf("//")?"":"https://")+n+e}(e)+"?biz_id="+n,success:function(n){t(n&&n.data&&n.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(n){t=n},onReady:function(n){c=function(){pt(i),n()},o&&c()}};function s(){var n=d(d(d({},e),o||{}),u);n.plugins=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t={},r=0;r<n.length;)t=p(t,n[r++]);return t}(e.plugins,(null==o?void 0:o.plugins)||{},u.plugins||{}),n.sample=Ct(Ct(e.sample,null==o?void 0:o.sample),u.sample),i=n,t()}function f(){o=function(n){if(!n)return{};var e=n.sample,t=n.user_id,r=n.timestamp,o=t?{userId:t}:{};if(!e)return o;var i=e.sample_rate,n=e.sample_granularity,t=void 0===n?bt:n,n=e.include_users,e=e.rules,e=void 0===e?[]:e;return d(d({},o),{sample:{include_users:n,sample_rate:i,sample_granularity:t,rules:e.reduce(function(n,e){var t=e.name,r=e.enable,o=e.sample_rate,e=e.conditional_sample_rules;return n[t]={enable:r,sample_rate:o,conditional_sample_rules:e},n},{})},serverTimestamp:r})}(a),function(n){n=me(n);return!!he().getStorage(n)}(String(i.aid))&&(o.userId=e.userId),s(),c()}};function Ct(r,o){if(!r||!o)return r||o;var n=d(d({},r),o);return n.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),n.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(n,e){var t;return e in n||(e in(r.rules||{})&&e in(o.rules||{})?(n[e]=d(d({},r.rules[e]),o.rules[e]),n[e].conditional_sample_rules=y(y([],g(r.rules[e].conditional_sample_rules||[]),!1),g(o.rules[e].conditional_sample_rules||[]),!1)):n[e]=(null===(t=r.rules)||void 0===t?void 0:t[e])||(null===(t=o.rules)||void 0===t?void 0:t[e])),n},{}),n}function Tt(n){var e={url:(e=he().getCurrentPages().pop())?(e?te(e):"")+s(e.options):"",timestamp:Z()};return d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})})}function Pt(n){if(!de(n))throw Error(B);var t,n=function(n){var t,r,e=n.builder,o=n.createSender,i=n.createDefaultConfig,u=n.createConfigManager,a=n.userConfigNormalizer,c=n.initConfigNormalizer,s=n.validateInitConfig,f={};_.forEach(function(n){return f[n]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return e},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(n){if(l)E("already inited");else{if(!(n&&w(n)&&s(n)))throw new Error("invalid InitConfig, init failed");var e=i(n);if(!e)throw new Error("defaultConfig missing");n=c(n);if((r=u(e)).setConfig(n),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(n){l&&n&&w(n)&&(b("beforeConfig",!1,n),null!=r&&r.setConfig(n))},config:function(n){if(l)return n&&w(n)&&(b("beforeConfig",!1,n),null!=r&&r.setConfig(a(n))),null==r?void 0:r.getConfig()},provide:function(n,e){S(m,n)?E("cannot provide "+n+", reserved"):(v[n]=e,b("provide",!1,n))},start:function(){var e=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(n){return e.build(n)}),h=[]}))},report:function(n){n&&(!(n=O(f.beforeReport)(n))||(n=O(f.report)(n))&&(p?this.build(n):h.push(n)))},build:function(n){!p||(n=O(f.beforeBuild)(n))&&(!(n=e.build(n))||(n=O(f.build)(n))&&this.send(n))},send:function(n){!p||(n=O(f.beforeSend)(n))&&(t.send(n),b("send",!1,n))},destroy:function(){b("beforeDestroy",d=!0)},on:function(n,e){"init"===n&&l||"start"===n&&p||"beforeDestroy"===n&&d?e():f[n]&&f[n].push(e)},off:function(n,e){f[n]&&(f[n]=x(f[n],e))}},m=Object.keys(v);return v;function b(n,e){void 0===e&&(e=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[n].forEach(function(n){try{n.apply(void 0,y([],g(t),!1))}catch(n){}}),e&&(f[n].length=0)}}({validateInitConfig:kt,initConfigNormalizer:Et,userConfigNormalizer:Ot,createSender:function(n){return e({size:H,endpoint:St(n.domain),transport:st()})},builder:dt,createDefaultConfig:xt,createConfigManager:jt});return D(n),Nt(n),It(n),Rt(n),q(n),Xe(n),(t=n).on("init",function(){var e=[],n=t.config();n&&n.integrations&&n.integrations.forEach(function(n){S(e,n.name)||(e.push(n.name),n.setup(t),n.tearDown&&t.on("beforeDestroy",n.tearDown))})}),Mt(n),Dt(n),n}var Dt=function(e){function t(n){return void 0===n&&(n=he().getSystemInfo()),e.set(d({},n))}function r(){t(),n()}var o,i,u=!1,n=(i="",function(){var n=o.getSender();i=i||n.getEndpoint();var e=o.config(),e={did:e.deviceId,sid:e.sessionId,sname:e.sdkName,sver:e.sdkVersion,soffset:e.offset||0,model:e.model,brand:e.brand,ratio:e.pixelRatio,screen:e.screenArea,window:e.windowArea,lang:e.language,osname:e.osName,osver:e.osVersion,libver:e.SDKVersion,scene:e.scene||-1,menv:e.miniEnv,mver:e.miniVersion,hostname:e.hostName,hostver:e.hostVersion,platform:e.platform,biz_id:e.aid,x_auth_token:e.token};n.setEndpoint(i+s(e))});(o=e).on("start",function(){r(),u=!0}),e.on("init",function(){On(F.onLaunch).pipe(Jn(1)).subscribe(function(n){n=n.param.scene||-1;t({scene:n}),u&&r()}),he().monitorNetworkType(function(n){n=n.networkType;e.set({networkType:n})})})},It=function(r){r.on("beforeBuild",function(n){return e=n,t=r.config(),(n={}).aid=t.aid,n.pid=t.pid,n.view_id=t.viewId,n.user_id=t.userId,n.network_type=t.networkType,d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})});var e,t})},Rt=function(n){n.on("report",Tt)},Mt=function(e){e.on("init",function(){On(F.onHide).subscribe(function(){var n=e.getSender();n&&n.flush()})})},Nt=function(t){var r,o=!1;t.on("init",function(){r=Z(),t.on("config",function(){var n,e=null===(n=t.config())||void 0===n?void 0:n.serverTimestamp;isNaN(e)||Number(e)<=0||o||(o=!0,(n=Z())-r<1e3&&e&&(n=e-(n+r)/2,isNaN(n)||t.set({offset:n})))})})};return function(n){var e,t,r,i,o,u,a,c,s,n=Pt(n);if(n)return(e=n).provide("sendEvent",function(n){n=L(n);n&&e.report({ev_type:z,payload:n,extra:{timestamp:Date.now()}})}),e.provide("sendLog",function(n){n=V(n);n&&e.report({ev_type:z,payload:n,extra:{timestamp:Date.now()}})}),(t=n).on("init",function(){var n,e=De(t,Ge,Ke);e&&(e=(n=g(Pe(ze,d(d({},e),{setPidAndViewId:function(n,e){t.set({pid:n,viewId:e,actionId:void 0})}}),t.report.bind(t)),2))[0],n=n[1],t.provide("sendPageview",e),t.provide("sendPageviewWithHide",n))}),(r=n).on("init",function(){var n,e=De(r,Je,We);e&&(n=Ye(r),n=g(Pe(Fe,e,n),1)[0],r.provide("captureException",n))}),(i=n).on("init",function(){var n,e,t,r,o=De(i,Ne,Ae);o&&(n=o.hookRequest,e=o.hookDownloadFile,t=o.hookUploadFile,r=[],n&&r.push("request"),e&&r.push("downloadFile"),t&&r.push("uploadFile"),we(i,r),Pe(Te,o,i.report.bind(i)))}),(o=n).on("init",function(){var n=De(o,Ze,nt);n&&(ke(o),Pe(Ve,n,o.report.bind(o)))}),(u=n).on("init",function(){var n,e=De(u,Qe,$e);e&&(e=(n=g(Pe(Le,e,function(n){}),2))[0],n=n[1],u.provide("getBreadcrumbs",e),u.provide("addBreadcrumb",n))}),(a=n).on("init",function(){var n=De(a,et,rt);n&&(Oe(a),Pe(Be,n,a.report.bind(a)))}),(c=n).on("init",function(){var n=De(c,ot,it);n&&Pe(Ue,n,c.report.bind(c))}),(s=n).on("init",function(){var n=De(s,ut,at);n&&(Oe(s),Pe(He,n,s.report.bind(s)))}),n}.bind(null,[Sn])()}); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).myClient=e()}(this,function(){"use strict";function e(n){var t,r=n.transport,o=n.endpoint,e=n.size,i=void 0===e?10:e,n=n.wait,u=void 0===n?1e3:n,a=[],c=0;function s(){var e;a.length&&(e=this.getBatchData(),r.post({url:o,data:e,fail:function(n){t&&t(n,e)}}),a=[])}return{getSize:function(){return i},getWait:function(){return u},setSize:function(n){i=n},setWait:function(n){u=n},getEndpoint:function(){return o},setEndpoint:function(n){o=n},send:function(n){a.push(n),a.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),u)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return a.length?(n=a,JSON.stringify({ev_type:"batch",list:n})):"";var n},clear:function(){clearTimeout(c),a=[]},fail:function(n){t=n}}}var r=function(n,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])})(n,e)};function n(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}r(n,e),n.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}var d=function(){return(d=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}).apply(this,arguments)};function g(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),u=[];try{for(;(void 0===e||0<e--)&&!(r=i.next()).done;)u.push(r.value)}catch(n){o={error:n}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function y(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||((r=r||Array.prototype.slice.call(e,0,o))[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(n){return n}function w(n){return"object"==typeof n&&null!==n}var t=Object.prototype;function i(n){if(w(n)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(n);n=Object.getPrototypeOf(n);return n===t||null===n}}function u(n){return"[object Array]"===t.toString.call(n)}function h(n){return"function"==typeof n}function a(n){return"number"==typeof n}function c(n){return"string"==typeof n}function p(n,e){var t,r,o=d({},n);for(t in e)r=t,Object.prototype.hasOwnProperty.call(e,r)&&void 0!==e[t]&&(w(e[t])&&i(e[t])?o[t]=p(w(n[t])?n[t]:{},e[t]):u(e[t])&&u(n[t])?o[t]=function e(n,t){n=u(n)?n:[];t=u(t)?t:[];return Array.prototype.concat.call(n,t).map(function(n){return n instanceof RegExp?n:w(n)&&i(n)?p({},n):u(n)?e([],n):n})}(n[t],e[t]):o[t]=e[t]);return o}function S(n,e){if(!u(n))return!1;if(0===n.length)return!1;for(var t=0;t<n.length;){if(n[t]===e)return!0;t++}return!1}function x(n,e){if(!u(n))return n;var t=n.indexOf(e);if(0<=t){e=n.slice();return e.splice(t,1),e}return n}function m(n){return u(n)&&n.length?function(n){for(var e=[],t=n.length,r=0;r<t;r++){var o=n[r];c(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}(n):null}function v(n){try{return c(n)?n:JSON.stringify(n)}catch(n){return"[FAILED_TO_STRINGIFY]:"+String(n)}}function s(t){return w(t)?Object.keys(t).reduce(function(n,e){return n+="&"+e+"="+t[e]},"").replace("&","?"):""}function f(i,u,a,c){return void 0===c&&(c=!0),function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(!i)return l;var t=i[u],r=a.apply(void 0,y([t],g(n),!1)),o=r;return h(o)&&c&&(o=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{return r.apply(this,e)}catch(n){return h(t)&&t.apply(this,e)}}),i[u]=o,function(n){n||(o===i[u]?i[u]=t:r=t)}}}function E(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.warn.apply(console,y(["[SDK]",Date.now(),(""+T++).padStart(8," ")],g(n),!1))}function o(n){return Math.random()<Number(n)}function k(n,e){return n<Number(e)}function O(r){return function(n){for(var e=n,t=0;t<r.length&&e;t++)try{e=r[t](e)}catch(n){C(n)}return e}}var j=0,C=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.error.apply(console,y(["[SDK]",Date.now(),(""+j++).padStart(8," ")],g(n),!1))},T=0;function P(){var n=function(){for(var n=new Array(16),e=0,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(n){for(var e=[],t=0;t<256;++t)e[t]=(t+256).toString(16).substr(1);var r=0,o=e;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[+r]],o[n[15]]].join("")}(n)}var D=function(n){var t,r,o,e=(t={},r={},o={set:function(n,e){return t[n]=e,r[n]=v(e),o},merge:function(e){return t=d(d({},t),e),Object.keys(e).forEach(function(n){r[n]=v(e[n])}),o},delete:function(n){return delete t[n],delete r[n],o},clear:function(){return t={},r={},o},get:function(n){return r[n]},toString:function(){return d({},r)}});n.provide("context",e),n.on("report",function(n){return n.extra||(n.extra={}),n.extra.context=e.toString(),n})};function I(n,e){var t=n.common||{};return t.sample_rate=e,n.common=t,n}function R(n,e,t,r,o){return n?(i=o(r,e),function(){return i}):function(){return t(e)};var i}function M(n,e,t,r){if(void 0===(n=function(n,e,t){for(var r,e=g(e.split(".")),o=e[0],i=e.slice(1);n&&0<i.length;)n=n[o],o=(r=g(i))[0],i=r.slice(1);if(n)return t(n,o)}(n,e,function(n,e){return n[e]})))return!1;var o,e="boolean"==typeof n?"bool":a(n)?"number":"string";return function(n,e,t){switch(t){case"eq":return S(e,n);case"neq":return!S(e,n);case"gt":return n>e[0];case"gte":return n>=e[0];case"lt":return n<e[0];case"lte":return n<=e[0];case"regex":return Boolean(n.match(new RegExp(e.join("|"))));case"not_regex":return!n.match(new RegExp(e.join("|")));default:return!1}}(n,(o=e,r.map(function(n){switch(o){case"number":return Number(n);case"boolean":return"1"===n;default:return String(n)}})),t)}function N(e,n){try{return"rule"===n.type?M(e,n.field,n.op,n.values):"and"===n.type?n.children.every(function(n){return N(e,n)}):n.children.some(function(n){return N(e,n)})}catch(n){return!1}}function A(n,e,t,r){if(!e)return b;var o=e.sample_rate,i=e.include_users,u=e.sample_granularity,a=e.rules,e=void 0===(e=e.r)?Math.random():e;if(S(i,n))return function(n){return I(n,1)};var c,s,f,l,p,d,h,m=R(u="session"===u,o,t,e,r),v=(c=a,s=u,f=o,l=t,p=e,d=r,h={},Object.keys(c).forEach(function(n){var e=c[n],t=e.enable,r=e.sample_rate,e=e.conditional_sample_rules;t?(h[n]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:R(s,r,l,p,d)},e&&(h[n].conditional_hit_rules=e.map(function(n){var e=n.sample_rate,n=n.filter;return{sample_rate:e,hit:R(s,e,l,p,d),effectiveSampleRate:e*f,filter:n}}))):h[n]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(n){if(!m())return!1;if(!(n.ev_type in v))return I(n,o);if(!v[n.ev_type].enable)return!1;if(n.common&&n.common.sample_rate)return n;var e=v[n.ev_type],t=e.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(N(n,t[r].filter))return!!t[r].hit()&&I(n,t[r].effectiveSampleRate);return!!e.hit()&&I(n,e.effectiveSampleRate)}}var F,q=function(t){t.on("start",function(){var n=t.config(),e=n.userId,n=n.sample,n=A(e,n,o,k);t.on("build",n)})},z="custom",L=function(n){if(n&&w(n)&&n.name&&c(n.name)){var e={name:n.name,type:"event"};if("metrics"in n&&w(n.metrics)){var t=n.metrics,r={};for(o in t)a(t[o])&&(r[o]=t[o]);e.metrics=r}if("categories"in n&&w(n.categories)){var o,i=n.categories,u={};for(o in i)u[o]=v(i[o]);e.categories=u}return e}},V=function(n){if(n&&w(n)&&n.content&&c(n.content)){var e={content:v(n.content),type:"log",level:"info"};if("level"in n&&(e.level=n.level),"extra"in n&&w(n.extra)){var t,r=n.extra,o={},i={};for(t in r)a(r[t])?o[t]=r[t]:i[t]=v(r[t]);e.metrics=o,e.categories=i}return e}},B="Adapters imported incorrectly",U=["success","fail","complete"],H=20;(Sn=F=F||{}).onLaunch="onLaunch",Sn.onShow="onShow",Sn.onHide="onHide",Sn.onError="onError",Sn.onPageNotFound="onPageNotFound",Sn.onUnhandledRejection="onUnhandledRejection";function G(n){return"[object Object]"===Object.prototype.toString.call(n)}var K=["request","downloadFile","uploadFile"],J=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],W=y(y([],g([F.onLaunch,F.onShow,F.onHide]),!1),[F.onError,F.onPageNotFound,F.onUnhandledRejection],!1),Y=["attached","onInit"],$=["onLoad","onShow","onReady","onUnload","onHide"],Q="unknown_error_name",X="__HOOKED__";function Z(){return Date.now()}function nn(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];if(!h(n))return 0;var r,o=Z();try{n.apply(this,e)}finally{r=Z()}return r-o}var en,tn=function(){},rn=g((en="tt",[function(){return en},function(n){return en=n}]),2),on=rn[0];rn[1];function un(e,t){function n(n){return t(n),e.call(this,n)}for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function an(n,e,r){var o=n[e];if(!o||!o[X])return Object.defineProperty(n,e,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{var t=r.apply(this,n);t&&(n=t)}catch(n){C(n)}return o.apply(this,n)}}),n[e]&&(n[e][X]=!0),function(){n[e][X]=!1,r=tn}}function cn(t,n){Object.keys(n).forEach(function(e){n[e].addTearDown(function(){var n;return En(t,((n={})[e]=null,n))})})}function sn(n,e){e.addTearDown(function(){return xn(n,null)})}function fn(n){return kn("route")[n]}function ln(n){return!!kn("route")[n]}function pn(n){return kn("http")[n]}function dn(n){return!!kn("http")[n]}function hn(){return kn("setData")}function mn(){return!!kn("performance")}function vn(n){return kn("component")[n]}function bn(){return kn("instance")}function gn(n){xn("instance",n)}var yn=function(){var n={instance:null};return n.instance||("undefined"!=typeof tt?n={instance:tt,platform:on()}:"undefined"!=typeof my?n={instance:my,platform:"my"}:"undefined"!=typeof swan?n={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(n={instance:wx,platform:"wx"})),n},_n="__slardar__global__0.2.3-alpha.0",wn={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},Sn=function(n,e){void 0===n&&(n={});var t=(e=void 0===e?yn().instance:e)?e[_n]||(e[_n]=n):n;return{setGlobalValue:function(n,e){t[n]=e},mergeGlobalValue:function(n,e){t[n]=d(d({},t[n]),e)},getGlobalValue:function(n){return t[n]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},wn),e&&(e[_n]=t)}}}(d({},wn)),xn=Sn.setGlobalValue,En=Sn.mergeGlobalValue,kn=Sn.getGlobalValue,On=function(n){return kn("app")[n]},jn=function(n){return kn("page")[n]},Cn=function(t){J.forEach(function(e){ln(e)&&fn(e).subscribe(function(n){return t(n,e)})})};function Tn(n){return"function"==typeof n}function Pn(n,e){!n||0<=(e=n.indexOf(e))&&n.splice(e,1)}function Dn(n){return n}function In(t){return function(n){if((e=n)&&Tn(e.lift))return n.lift(function(n){try{return t(n,this)}catch(n){this.error(n)}});var e;throw new TypeError("Unable to lift unknown Observable type")}}function Rn(n){Tn(n)?n():null!=n&&n.unsubscribe()}var Mn=function(n){return n instanceof Nn||n&&"closed"in n&&Tn(n.remove)&&Tn(n.add)&&Tn(n.unsubscribe)},Nn=(An.prototype.unsubscribe=function(){var n,e,t,r=this;this.closed||(this.closed=!0,n=this._parentage,e=this._finalizers,t=this.initialTeardown,n&&(this._parentage=null,n.forEach(function(n){return n.remove(r)})),Tn(t)&&t(),e&&(this._finalizers=null,e.forEach(Rn)))},An.prototype.remove=function(n){this._finalizers&&Pn(this._finalizers,n),n instanceof An&&n._removeParent(this)},An.prototype.add=function(n){if(n&&n!==this)if(this.closed)Rn(n);else{if(n instanceof An){if(n.closed||n._hasParent(this))return;n._addParent(this)}var e=this._finalizers;this._finalizers=e?(e.push(n),e):[n]}},An.prototype._addParent=function(n){var e=this._parentage;this._parentage=e?(e.push(n),e):[n]},An.prototype._hasParent=function(n){return this._parentage&&~this._parentage.indexOf(n)},An.prototype._removeParent=function(n){this._parentage&&Pn(this._parentage,n)},An);function An(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}var Fn,qn=(n(zn,Fn=Nn),zn.prototype.next=function(n){this.isStopped||this.destination.next(n)},zn.prototype.error=function(n){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(n)}finally{this.unsubscribe()}}},zn.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},zn.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Fn.prototype.unsubscribe.call(this),this.destination=null)},zn.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},zn);function zn(n){var e=Fn.call(this)||this;return e.isStopped=!1,e.destination=Bn(n)?n:new Ln(!(n=n)||Tn(n)?{next:null!=n?n:void 0}:n),e}var Ln=(Vn.prototype.next=function(n){var e=this.partialObserver;if(e.next)try{e.next(n)}catch(n){console.error("ConsumerObserver.next error",n)}},Vn.prototype.error=function(n){var e=this.partialObserver;if(e.error)try{e.error(n)}catch(n){console.error("ConsumerObserver.error error",n)}},Vn.prototype.complete=function(){var n=this.partialObserver;if(n.complete)try{n.complete()}catch(n){console.error("ConsumerObserver.complete error",n)}},Vn);function Vn(n){this.partialObserver=n}function Bn(n){return n instanceof qn||n&&((e=n)&&Tn(e.next)&&Tn(e.error)&&Tn(e.complete))&&Mn(n);var e}Un.prototype.subscribe=function(n){var e=Bn(n)?n:new qn(n),t=this.operator,n=this.source;return e.add(t?t.call(e,n):this._trySubscribe(e)),e},Un.prototype.lift=function(n){var e=new Un;return e.source=this,e.operator=n,e},Un.prototype.pipe=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return(0===(e=n).length?Dn:1===e.length?e[0]:function(n){return e.reduce(function(n,e){return e(n)},n)})(this)},Un.prototype._subscribe=function(n){},Un.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},rn=Un;function Un(n){n&&(this._subscribe=n)}var Hn,Sn=(n(Gn,Hn=rn),Gn.prototype.next=function(e){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(n){return n.next(e)})},Gn.prototype.commonJudgement=function(n){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,n())},Gn.prototype.error=function(e){var t=this;this.commonJudgement(function(){var n=t.observers;for(t.hasError=!0,t.thrownError=e;n.length;)n.shift().error(e)})},Object.defineProperty(Gn.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Gn.prototype.complete=function(){var e=this;this.commonJudgement(function(){for(var n=e.observers;n.length;)n.shift().complete()})},Gn.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Gn.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Gn.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},Gn.prototype._checkFinalizedStatuses=function(n){var e=this.hasError,t=this.thrownError,r=this.isStopped;e?n.error(t):r&&n.complete()},Gn.prototype._innerSubscribe=function(n){var e=this.isStopped,t=this.observers;return e?Gn.EMPTY:(t.push(n),new Nn(function(){Pn(t,n)}))},Gn.EMPTY=((Sn=new Nn).closed=!0,Sn),Gn);function Gn(){var n=null!==Hn&&Hn.apply(this,arguments)||this;return n.closed=!1,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}var Kn=new rn(function(n){return n.complete()});function Jn(r){return r<=0?function(){return Kn}:In(function(n,e){var t=0;n.subscribe(function(n){++t<=r&&(e.next(n),r<=t&&e.complete())})})}function Wn(r,o){return In(function(n,e){var t=0;n.subscribe(function(n){return r.call(o,n,t++)&&e.next(n)})})}function Yn(t){return Wn(function(n,e){return t<=e})}var $n,Qn=(n(Xn,$n=Sn),Xn.prototype.subscribe=function(n){var t=this,n=$n.prototype.subscribe.call(this,n);bn()&&bn()._subscriptions.push(n);var r=n.unsubscribe;return n.unsubscribe=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];r.apply(this,n),t.observed||t.unsubscribe()},n},Xn.prototype.unsubscribe=function(){$n.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(n){return n()})},Xn.prototype.addTearDown=function(n){this.tearDownFns.push(n)},Xn);function Xn(){var n=null!==$n&&$n.apply(this,arguments)||this;return n.tearDownFns=[],n}function Zn(n){var e=n.reduce(function(n,e){return n[e]=new Qn,n},{});return{getSubject:function(n){return e[n]},subjectMap:e}}function ne(n){return 1<n.length?n:n.length&&n[0]||{}}function ee(n){var t=n.filter(function(n){return n=n,!!!kn("app")[n]}),n=Zn(t).subjectMap;En("app",n=n),cn("app",n),App=un(App,function(e){t.forEach(function(n){var r=On(n),n=f(e,n,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];r.next({that:this,param:ne(n),time:Z()}),h(t)&&t.apply(this,n)}})();n&&r.addTearDown(n)})})}function te(n){return n.route||n.__route__||n.url||n.path||""}function re(n){function e(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(n(d({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;Cn(function(n,e){"invoke"===n.param.name&&(o=!1,r={navigate_start:n.time,navigate_name:e})}),jn("onLoad").pipe(Yn(1)).subscribe(function(n){r.load_start=n.time}),jn("onShow").pipe(Yn(1)).subscribe(function(n){r.dom_end=n.time}),jn("onReady").pipe(Yn(1)).subscribe(function(n){r.render_end=n.time,e(),t()}),On(F.onHide).subscribe(function(){!1===o&&(e(),t())})}function oe(n){return"android"===n.toLowerCase()}function ie(){var n="",e="",t="";my.getAccountInfoSync?(d=my.getAccountInfoSync().miniProgram,e=d.envVersion,n=d.appId,t=d.version):(n=my.getAppIdSync().appId,my.getRunScene({success:function(n){e=n.envVersion}}));var r=(h=my.getSystemInfoSync()).model,o=h.brand,i=h.pixelRatio,u=h.screenHeight,a=h.screenWidth,c=h.windowHeight,s=h.windowWidth,f=h.language,l=h.version,p=h.system,d=h.platform,h=h.app;return{model:r,brand:o,pixelRatio:i,screenArea:_e({pixelRatio:i,width:a,height:u,systemPlatform:d}),windowArea:_e({width:s,height:c}),language:f,osName:ye(d),osVersion:p,SDKVersion:my.SDKVersion,appId:n,miniEnv:e,miniVersion:t,hostName:h,hostVersion:l,platform:"my"}}function ue(n){var e=n.filter(function(n){return n=n,!!!kn("component")[n]}),n=Zn(e).subjectMap;En("component",n=n),cn("component",n),he().componentSubject(e)}function ae(e){function n(n){G(n.methods)?e(n.methods):void 0!==n.methods&&null!==n.methods||(n.methods={},e(n.methods))}try{Component=un(Component,n),Behavior=un(Behavior,n)}catch(n){}}function ce(n,e){var t=n.filter(function(n){return n=n,!!!kn("page")[n]}),n=Zn(t).subjectMap;En("page",n=n),cn("page",n),n=function(e){t.forEach(function(n){var r=jn(n),n=f(e,n,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(te(this)&&r.next({that:this,param:ne(n),time:Z()}),h(t))return t.apply(this,n)}})();n&&r.addTearDown(n)})},Page=un(Page,n),ae(n)}function se(n){var e=n.filter(function(n){return!ln(n)}),t=Zn(e).subjectMap;En("route",n=t),cn("route",n),e.forEach(function(i){var n=an(he().instance,i,function(o){void 0===o&&(o={}),fn(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:Z()}),U.forEach(function(r){f(o,r,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];fn(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:ne(n)||{}},time:Z()}),h(t)&&t.apply(this,n)}})()})});n&&t[i].addTearDown(n)})}function fe(a,n){var e=n.url,t=n.method,r=n.data,o=n.header,i=n.headers,c={api:a,request:{url:e,method:(e=t,"uploadFile"===(t=a)?"POST":"downloadFile"!==t&&e||"GET"),headers:o||i||{},body:v(r),timestamp:Z()},response:{}};f(n,"complete",function(u){return function(n){var e=c.response.timestamp||Z();c.duration=e-c.request.timestamp,c.completeCallbackTime=nn(u,n);var t,r,o,i=n.errMsg||n.errorMessage||n.error;c.response={status:(t=n.status,r=n.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:e,headers:n.header||n.headers||{},body:v(n.data),errMsg:i,timing:he().buildRequestProfile(n.profile||{})},pn(a).next(c)}})(),f(n,"success",function(e){return function(n){c.response.timestamp=Z(),c.response.status=200,c.successCallbackTime=nn(e,n)}})(),f(n,"fail",function(e){return function(n){c.response.timestamp=Z(),c.response.status=-1,c.failCallbackTime=nn(e,n)}})()}function le(n,t){void 0===t&&(t=he().instance);var e=n.filter(function(n){return!dn(n)}),r=Zn(e).subjectMap;En("http",n=r),cn("http",n),e.forEach(function(e){var n=an(t,e,function(n){fe(e,n)});n&&r[e].addTearDown(n)})}var pe,rn=g((pe={},[function(n){if(!yn().platform)throw Error("Not support current Mini Program");if(!Array.isArray(n)||!n.length)return null;n=n.find(function(n){return n.platform===yn().platform});return n&&(pe=n.adapterCtor())},function(){return pe}]),2),de=rn[0],he=rn[1],me=function(n){return"SLARDAR"+n},ve=function(n){try{return he().getStorage(n)}catch(n){return}},be=["darwin","macs","mac"],ge=["windows_nt","windows","window"],ye=function(n){return oe(n)?"Android":"ios"===n.toLowerCase()?"iOS":~be.indexOf(n.toLowerCase())?"Mac":~ge.indexOf(n.toLowerCase())?"windows":"unknown"},_e=function(n){var e=n.systemPlatform,t=n.pixelRatio,r=n.width,n=n.height;return e&&oe(e)&&t?r/t+" * "+n/t:r+" * "+n},Sn={platform:"my",adapterCtor:function(){return d(d({},{instance:t=void 0===t?yn().instance:t,request:function(n){return t.request(n)},getStorage:function(n){return t.getStorageSync(n)},setStorage:function(n,e){return t.setStorageSync(n,e)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(n){return n},monitorNetworkType:function(e){t.getNetworkType({success:function(n){e&&e({networkType:n.networkType})}}),t.onNetworkStatusChange(function(n){e&&e({networkType:n.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:"my",buildError:function(n){return u(n)?function(n,e){n={message:n};return!e||(e=g((e=(n.stack=e).split("\n"))[0]&&e[0].split(":"),1)[0])&&(n.name=e),n}(n[0],n[1]):{name:Q,message:v(n)}},setStorage:function(n,e){return my.setStorageSync({key:n,data:e})},getStorage:function(n){return my.getStorageSync({key:n}).data},getSystemInfo:ie,componentSubject:function(n){var e=["onInit"],t=n.filter(function(n){return~e.indexOf(n)}),r=function(n){t.forEach(function(r){f(n,r,function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(vn(r).next({that:this,param:null,time:Z()}),h(t))return t.apply(this,n)}})()})};Component=un(Component,function(n){w(n)?r(n):null==n&&r(n={})})},setDataSubject:function(e){vn("onInit").subscribe(function(n){n=n.that;return e.call(n)})},pagePerfSubscriber:re});var t}},we=function(n,e){void 0===e&&(e=K),n.on("init",function(){le(e)})};function Se(){var u=te(this),a=hn();var n=an(this,"setData",function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=r[0],i=Z();return[o,function(){var n=r[1],e=Z()-i;a.next({renderTime:e,url:u,data:o,startTime:i}),n&&n.call(t)}]});n&&a.addTearDown(n)}function xe(){var n;kn("setData")||(n=(n=Zn(["setData"]).getSubject)("setData"),xn("setData",n),sn("setData",n))}function Ee(o){return Object.keys(o).reduce(function(n,e){var t,r;return r=o[t=e],t&&r&&(je.test(t)||Ce.test(r))||(n[e]=o[e]),n},{})}var ke=function(n){n.on("init",function(){xe(),jn("onLoad").subscribe(function(n){n=n.that;Se.call(n)}),he().setDataSubject(Se)})},Oe=function(n){n.on("init",function(){var e,n,t,r=he();r.observePerformance&&!mn()&&(e=(0,Zn(["performance"]).getSubject)("performance"),xn("performance",n=e),sn("performance",n),(t=r.observePerformance(function(n){n.forEach(function(n){e.next(n)})}))&&t.disconnect&&e.addTearDown(function(){return t.disconnect()}))})},je=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),Ce=new RegExp("(bearer|session)","i"),Te=function(){return function(n,s){var e=n.hookRequest,t=n.hookDownloadFile,r=n.hookUploadFile,f=n.ignoreUrls,l=n.collectBodyOnError,p=n.extraExtractor,n=function(n){var e,t,r,o,i,u,a,c;!function(n,e){n=m(n||[]);return!!n&&n.test(e)}(f,n.request.url)&&(c=n.response,e=n.request,t=n.api,r=n.duration,o=n.failCallbackTime,a=n.successCallbackTime,i=n.completeCallbackTime,e.headers=Ee(e.headers||{}),c.headers=Ee(c.headers||{}),u=c.errMsg,n=function(n,e){var t={};for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&e.indexOf(o)<0&&(t[o]=n[o]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(n);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(n,o[r])&&(t[o[r]]=n[o[r]]);return t}(c,["errMsg"]),n=d(d({},n),{is_custom_error:!1}),u&&(n.err_msg=u),a={api:t,request:e,duration:r,cbTime:i+(o||0)+(a||0),response:n},!h(p)||(n=p(c.body,a))&&(a.extra=n,a.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete a.request.body,delete a.response.body),s({ev_type:"http",payload:a}))};e&&pn("request").subscribe(n),t&&pn("downloadFile").subscribe(n),r&&pn("uploadFile").subscribe(n)}},Pe=function(n,e,t,r){void 0===e&&(e={}),void 0===r&&(r=[]);try{var o=n.apply(void 0,y([],g(r),!1));return o&&o(e,t)||[]}catch(n){return C("applyMonitor",n),[]}};function De(n,e,t){gn(n);e=null===(n=n.config())||void 0===n?void 0:n.plugins[e];return w(e)?d(d({},t),e):!!e&&t}function Ie(n,e){return n&&e&&n===e}function Re(){var r;return function(n){try{if(t=r,!(!(e=n)||!t)&&!(!Ie(e.message,t.message)&&!Ie(e.stack,t.stack)))return void(r=n)}catch(n){}var e,t;return r=n}}var Me,Ne="http",Ae={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},Fe=function(f){return void 0===f&&(f=he()),function(n,r){var e=n.ignoreErrors,t=n.hookOnError,o=n.hookOnUnhandledRejection,i=n.hookRouteError,u=n.dedupe,a=m(e),c=Re(),s=function(n,e,t){n=u?c(n):n;n&&(a&&a.test(n.message)||(n={error:n},e&&(n.extra=e),t&&(n.react=t),r(n)))};t&&On(F.onError).subscribe(function(n){n=n.param,n=f.buildError(n);a&&a.test(n.message)||s(n)}),o&&On(F.onUnhandledRejection).subscribe(function(n){var e=n.param||{},n=e.promise,t=v(e.reason);a&&a.test(t)||n.catch(b).then(function(n){var e={name:"UnhandledRejection",message:t};n&&n.stack&&(e.stack=n.stack),s(e)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&Cn(function(n){n=n.param;"fail"===(n=n).name&&s({name:"RouteError",message:n.value.errMsg})}),[s]}};(rn=Me=Me||{}).history="history",rn.manual="manual";function qe(t,n,r){var o=n,i=null,u=0,e="launch";function a(n,e){o=e,u=Z(),r(e,i=e+"_"+u),t(n,e)}return On(F.onShow).pipe(Yn(1)).subscribe(function(){e="show"}),Cn(function(){e="history"}),[a,function(n){n&&(a(e,n),e="history")},function(n){void 0===n&&(n="hide"),i&&(r(o,i),i=null,t(n,o,Z()-u))}]}var ze=function(){return function(n,r){var e=n.extractPid,t=n.routeMode,o=n.setPidAndViewId,i=function(n){return e?e(n):n},n=g(qe(function(n,e,t){r({ev_type:"pageview",payload:{pid:e,source:n,duration:t}})},"",o),3),o=n[0],u=n[1],n=n[2];return t!==Me.manual&&(jn("onShow").subscribe(function(n){return function(n){n=te(n),n=i(n);u(n)}(n.that)}),jn("onUnload").subscribe(n.bind(null,"unload")),jn("onHide").subscribe(n.bind(null,"hide"))),[o.bind(null,"user_set"),n]}},Le=function(){return function(n){var e=g(function(e,t,r){void 0===e&&(e=20),void 0===t&&(t=b),void 0===r&&(r=function(n,e){return n.slice(-e)});var o=[];return[function(){return o},function(n){t(n)&&(n=d(d({},n),{timestamp:n.timestamp||Date.now()}),o=0<=e&&o.length+1>e?r(y(y([],g(o),!1),[n],!1),e):y(y([],g(o),!1),[n],!1))}]}(n.maxBreadcrumbs,n.onAddBreadcrumb,n.onMaxBreadcrumbs),2),n=e[0],r=e[1];return K.forEach(function(n){dn(n)&&pn(n).subscribe(function(n){r({type:"http",category:n.api,message:"",data:{method:n.request.method,url:n.request.url,status_code:String(n.response.status)},timestamp:n.request.timestamp})})}),Cn(function(n,e){var t=n.param,n=n.time;"complete"===t.name&&r({type:"route",category:e,message:t.value.errMsg||t.value.errorMessage||"",timestamp:n,data:{url:t.url||""}})}),[n,r]}},Ve=function(){return function(n,t){var r=n.isCalculateSize;hn().subscribe(function(n){var e={duration:n.renderTime,start_time:n.startTime};r&&(e.size=(n=n.data,TextEncoder?(new TextEncoder).encode(v(n)).length:2*v(n).length)),t({ev_type:"set_data",payload:e})})}},Be=function(){return function(n,e){function t(){e({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;On(F.onLaunch).pipe(Jn(1)).subscribe(function(n){r.activate_start=n.time}),On(F.onShow).pipe(Jn(1)).subscribe(function(n){r.init_end=n.time}),jn("onLoad").pipe(Jn(1)).subscribe(function(n){r.page_load_start=n.time}),jn("onShow").pipe(Jn(1)).subscribe(function(n){r.page_dom_end=n.time});var i=mn();jn("onReady").pipe(Jn(1)).subscribe(function(n){r.page_render_end=n.time,i&&!r.trigger||t()}),i&&kn("performance").pipe(Wn(function(n){return"appClick"===n.name}),Jn(1)).subscribe(function(n){r.trigger=n.startTime,r.page_render_end&&t()}),On(F.onHide).subscribe(function(){o||t()})}},Ue=function(){return function(n,e){he().pagePerfSubscriber(function(n){return e({ev_type:"page_perf",payload:n})})}},He=function(e){return void 0===e&&(e=he()),function(n,t){var r,o;mn()&&e.performanceSubscriber&&(r=0,jn("onLoad").subscribe(function(n){o=n.time,r++}),e.performanceSubscriber(function(n){var e={is_custom:!1,name:n.name,value:n.startTime,type:"perf",count:r};e.duration=n.duration||(o?n.startTime-o:0),e.is_support=0<=e.duration,t({ev_type:"performance",payload:e})}))}},Ge="pageview",Ke={routeMode:Me.history,setPidAndViewId:function(n,e){}},Je="jsError",We={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},Ye=function(t){return function(n){var e=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},n),{breadcrumbs:e})})}},$e={maxBreadcrumbs:20,tap:!0},Qe="breadcrumb",Xe=function(e){e.on("init",function(){e.provide("_subscriptions",[]),gn(e),e.on("init",function(){ee(W),ce($),ue(Y)}),e.on("init",function(){se(J)})}),e.on("beforeDestroy",function(){if(e._subscriptions)for(;e._subscriptions.length;)e._subscriptions.shift().unsubscribe();for(var n in e)delete e[n]})},Ze="setData",nt={isCalculateSize:!1},et="appLaunchPerf",rt={},ot="pagePerf",it={},ut="performance",at={},ct=function(n,e,t){void 0===t&&(t=he());var r=e.url,o=e.data,i=e.success,u=void 0===i?l:i,a=e.fail,c=void 0===a?l:a,i=e.header,a={"Content-Type":"application/json"};G(e=i)&&0!==Object.keys(e).length&&Object.assign(a,i),t.request({method:n,url:r,data:o,header:a,headers:a,success:function(n){u(n)},fail:function(n){n=n.errMsg||"Network request failed";c(new Error(n))}})},st=function(e){return(e=void 0===e?he():e)?{get:function(n){return ct("GET",n,e)},post:function(n){return ct("POST",n,e)}}:{get:l,post:l}};function ft(n){return n=me(String(n)),(n=ve(n))&&n.userId&&n.deviceId?n:{userId:P(),deviceId:P()}}function lt(n){return n+"_"+Date.now()}function pt(n){var e=n.aid,t=n.userId,n=n.deviceId;!function(n,e){try{he().setStorage(n,e)}catch(n){}}(me(String(e)),{userId:t,deviceId:n})}var dt={build:function(n){return{ev_type:n.ev_type,payload:n.payload,common:d(d({},n.extra||{}),n.overrides||{})}}},ht="/monitor_mini/collect",mt="/settings/minipro",vt="apmplus.volces.com",bt="session",gt={sample_rate:1,include_users:[],sample_granularity:bt,rules:{}},yt=[ht,mt],_t="0.2.3-alpha.0",wt="APM_PLUS_MINI_PROGRAM",St=function(n,e){return void 0===e&&(e=ht),(n&&0<=n.indexOf("//")?"":"https://")+n+e};function xt(n){n=ft(n.aid);return{aid:0,token:"",pid:"",viewId:lt("_"),userId:n.userId,deviceId:n.deviceId,sessionId:P(),domain:vt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:yt},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:gt,sdkName:wt,sdkVersion:_t}}function Et(n){var e,t=n.plugins||{};for(e in t)t[e]&&!w(t[e])&&(t[e]={});return d(d({},n),{plugins:t})}function kt(n){return w(n)&&"aid"in n&&"token"in n}function Ot(n){return d({},n)}var jt=function(e){var r,o,i=e,u={},a=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(n){var e,t;return u=d(d({},u),n||{}),s(),r||(r=n,i.useLocalConfig||!i.aid?(o={},c()):a?f():(e=i.domain,n=i.aid,t=function(n){a=n,f()},st().get({url:function(n,e){return void 0===e&&(e=mt),(n&&0<=n.indexOf("//")?"":"https://")+n+e}(e)+"?biz_id="+n,success:function(n){t(n&&n.data&&n.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(n){t=n},onReady:function(n){c=function(){pt(i),n()},o&&c()}};function s(){var n=d(d(d({},e),o||{}),u);n.plugins=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t={},r=0;r<n.length;)t=p(t,n[r++]);return t}(e.plugins,(null==o?void 0:o.plugins)||{},u.plugins||{}),n.sample=Ct(Ct(e.sample,null==o?void 0:o.sample),u.sample),i=n,t()}function f(){o=function(n){if(!n)return{};var e=n.sample,t=n.user_id,r=n.timestamp,o=t?{userId:t}:{};if(!e)return o;var i=e.sample_rate,n=e.sample_granularity,t=void 0===n?bt:n,n=e.include_users,e=e.rules,e=void 0===e?[]:e;return d(d({},o),{sample:{include_users:n,sample_rate:i,sample_granularity:t,rules:e.reduce(function(n,e){var t=e.name,r=e.enable,o=e.sample_rate,e=e.conditional_sample_rules;return n[t]={enable:r,sample_rate:o,conditional_sample_rules:e},n},{})},serverTimestamp:r})}(a),function(n){n=me(n);return!!he().getStorage(n)}(String(i.aid))&&(o.userId=e.userId),s(),c()}};function Ct(r,o){if(!r||!o)return r||o;var n=d(d({},r),o);return n.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),n.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(n,e){var t;return e in n||(e in(r.rules||{})&&e in(o.rules||{})?(n[e]=d(d({},r.rules[e]),o.rules[e]),n[e].conditional_sample_rules=y(y([],g(r.rules[e].conditional_sample_rules||[]),!1),g(o.rules[e].conditional_sample_rules||[]),!1)):n[e]=(null===(t=r.rules)||void 0===t?void 0:t[e])||(null===(t=o.rules)||void 0===t?void 0:t[e])),n},{}),n}function Tt(n){var e={url:(e=he().getCurrentPages().pop())?(e?te(e):"")+s(e.options):"",timestamp:Z()};return d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})})}function Pt(n){if(!de(n))throw Error(B);var t,n=function(n){var t,r,e=n.builder,o=n.createSender,i=n.createDefaultConfig,u=n.createConfigManager,a=n.userConfigNormalizer,c=n.initConfigNormalizer,s=n.validateInitConfig,f={};_.forEach(function(n){return f[n]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return e},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(n){if(l)E("already inited");else{if(!(n&&w(n)&&s(n)))throw new Error("invalid InitConfig, init failed");var e=i(n);if(!e)throw new Error("defaultConfig missing");n=c(n);if((r=u(e)).setConfig(n),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(n){l&&n&&w(n)&&(b("beforeConfig",!1,n),null!=r&&r.setConfig(n))},config:function(n){if(l)return n&&w(n)&&(b("beforeConfig",!1,n),null!=r&&r.setConfig(a(n))),null==r?void 0:r.getConfig()},provide:function(n,e){S(m,n)?E("cannot provide "+n+", reserved"):(v[n]=e,b("provide",!1,n))},start:function(){var e=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(n){return e.build(n)}),h=[]}))},report:function(n){n&&(!(n=O(f.beforeReport)(n))||(n=O(f.report)(n))&&(p?this.build(n):h.push(n)))},build:function(n){!p||(n=O(f.beforeBuild)(n))&&(!(n=e.build(n))||(n=O(f.build)(n))&&this.send(n))},send:function(n){!p||(n=O(f.beforeSend)(n))&&(t.send(n),b("send",!1,n))},destroy:function(){b("beforeDestroy",d=!0)},on:function(n,e){"init"===n&&l||"start"===n&&p||"beforeDestroy"===n&&d?e():f[n]&&f[n].push(e)},off:function(n,e){f[n]&&(f[n]=x(f[n],e))}},m=Object.keys(v);return v;function b(n,e){void 0===e&&(e=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[n].forEach(function(n){try{n.apply(void 0,y([],g(t),!1))}catch(n){}}),e&&(f[n].length=0)}}({validateInitConfig:kt,initConfigNormalizer:Et,userConfigNormalizer:Ot,createSender:function(n){return e({size:H,endpoint:St(n.domain),transport:st()})},builder:dt,createDefaultConfig:xt,createConfigManager:jt});return D(n),Nt(n),It(n),Rt(n),q(n),Xe(n),(t=n).on("init",function(){var e=[],n=t.config();n&&n.integrations&&n.integrations.forEach(function(n){S(e,n.name)||(e.push(n.name),n.setup(t),n.tearDown&&t.on("beforeDestroy",n.tearDown))})}),Mt(n),Dt(n),n}var Dt=function(e){function t(n){return void 0===n&&(n=he().getSystemInfo()),e.set(d({},n))}function r(){t(),n()}var o,i,u=!1,n=(i="",function(){var n=o.getSender();i=i||n.getEndpoint();var e=o.config(),e={did:e.deviceId,sid:e.sessionId,sname:e.sdkName,sver:e.sdkVersion,soffset:e.offset||0,model:e.model,brand:e.brand,ratio:e.pixelRatio,screen:e.screenArea,window:e.windowArea,lang:e.language,osname:e.osName,osver:e.osVersion,libver:e.SDKVersion,scene:e.scene||-1,menv:e.miniEnv,mver:e.miniVersion,hostname:e.hostName,hostver:e.hostVersion,platform:e.platform,biz_id:e.aid,x_auth_token:e.token};n.setEndpoint(i+s(e))});(o=e).on("start",function(){r(),u=!0}),e.on("init",function(){On(F.onLaunch).pipe(Jn(1)).subscribe(function(n){n=n.param.scene||-1;t({scene:n}),u&&r()}),he().monitorNetworkType(function(n){n=n.networkType;e.set({networkType:n})})})},It=function(r){r.on("beforeBuild",function(n){return e=n,t=r.config(),(n={}).aid=t.aid,n.pid=t.pid,n.view_id=t.viewId,n.user_id=t.userId,n.network_type=t.networkType,d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})});var e,t})},Rt=function(n){n.on("report",Tt)},Mt=function(e){e.on("init",function(){On(F.onHide).subscribe(function(){var n=e.getSender();n&&n.flush()})})},Nt=function(t){var r,o=!1;t.on("init",function(){r=Z(),t.on("config",function(){var n,e=null===(n=t.config())||void 0===n?void 0:n.serverTimestamp;isNaN(e)||Number(e)<=0||o||(o=!0,(n=Z())-r<1e3&&e&&(n=e-(n+r)/2,isNaN(n)||t.set({offset:n})))})})};return function(n){var e,t,r,i,o,u,a,c,s,n=Pt(n);if(n)return(e=n).provide("sendEvent",function(n){n=L(n);n&&e.report({ev_type:z,payload:n,extra:{timestamp:Date.now()}})}),e.provide("sendLog",function(n){n=V(n);n&&e.report({ev_type:z,payload:n,extra:{timestamp:Date.now()}})}),(t=n).on("init",function(){var n,e=De(t,Ge,Ke);e&&(e=(n=g(Pe(ze,d(d({},e),{setPidAndViewId:function(n,e){t.set({pid:n,viewId:e,actionId:void 0})}}),t.report.bind(t)),2))[0],n=n[1],t.provide("sendPageview",e),t.provide("sendPageviewWithHide",n))}),(r=n).on("init",function(){var n,e=De(r,Je,We);e&&(n=Ye(r),n=g(Pe(Fe,e,n),1)[0],r.provide("captureException",n))}),(i=n).on("init",function(){var n,e,t,r,o=De(i,Ne,Ae);o&&(n=o.hookRequest,e=o.hookDownloadFile,t=o.hookUploadFile,r=[],n&&r.push("request"),e&&r.push("downloadFile"),t&&r.push("uploadFile"),we(i,r),Pe(Te,o,i.report.bind(i)))}),(o=n).on("init",function(){var n=De(o,Ze,nt);n&&(ke(o),Pe(Ve,n,o.report.bind(o)))}),(u=n).on("init",function(){var n,e=De(u,Qe,$e);e&&(e=(n=g(Pe(Le,e,function(n){}),2))[0],n=n[1],u.provide("getBreadcrumbs",e),u.provide("addBreadcrumb",n))}),(a=n).on("init",function(){var n=De(a,et,rt);n&&(Oe(a),Pe(Be,n,a.report.bind(a)))}),(c=n).on("init",function(){var n=De(c,ot,it);n&&Pe(Ue,n,c.report.bind(c))}),(s=n).on("init",function(){var n=De(s,ut,at);n&&(Oe(s),Pe(He,n,s.report.bind(s)))}),n}.bind(null,[Sn])()}); |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).swanClient=n()}(this,function(){"use strict";function n(e){var t,r=e.transport,o=e.endpoint,n=e.size,i=void 0===n?10:n,e=e.wait,a=void 0===e?1e3:e,u=[],c=0;function s(){var n;u.length&&(n=this.getBatchData(),r.post({url:o,data:n,fail:function(e){t&&t(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),a)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return u.length?(e=u,JSON.stringify({ev_type:"batch",list:e})):"";var e},clear:function(){clearTimeout(c),u=[]},fail:function(e){t=e}}}var r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var d=function(){return(d=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function g(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||((r=r||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(e){return e}function w(e){return"object"==typeof e&&null!==e}var t=Object.prototype;function i(e){if(w(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(e);e=Object.getPrototypeOf(e);return e===t||null===e}}function a(e){return"[object Array]"===t.toString.call(e)}function h(e){return"function"==typeof e}function u(e){return"number"==typeof e}function c(e){return"string"==typeof e}function p(e,n){var t,r,o=d({},e);for(t in n)r=t,Object.prototype.hasOwnProperty.call(n,r)&&void 0!==n[t]&&(w(n[t])&&i(n[t])?o[t]=p(w(e[t])?e[t]:{},n[t]):a(n[t])&&a(e[t])?o[t]=function n(e,t){e=a(e)?e:[];t=a(t)?t:[];return Array.prototype.concat.call(e,t).map(function(e){return e instanceof RegExp?e:w(e)&&i(e)?p({},e):a(e)?n([],e):e})}(e[t],n[t]):o[t]=n[t]);return o}function S(e,n){if(!a(e))return!1;if(0===e.length)return!1;for(var t=0;t<e.length;){if(e[t]===n)return!0;t++}return!1}function E(e,n){if(!a(e))return e;var t=e.indexOf(n);if(0<=t){n=e.slice();return n.splice(t,1),n}return e}function m(e){return a(e)&&e.length?function(e){for(var n=[],t=e.length,r=0;r<t;r++){var o=e[r];c(o)?n.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return new RegExp(n.join("|"),"i")}(e):null}function v(e){try{return c(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function s(t){return w(t)?Object.keys(t).reduce(function(e,n){return e+="&"+n+"="+t[n]},"").replace("&","?"):""}function x(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,y(["[SDK]",Date.now(),(""+T++).padStart(8," ")],g(e),!1))}function o(e){return Math.random()<Number(e)}function f(e,n){return e<Number(n)}function O(r){return function(e){for(var n=e,t=0;t<r.length&&n;t++)try{n=r[t](n)}catch(e){C(e)}return n}}var k=function(i,a,u,c){return void 0===c&&(c=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return l;var t=i[a],r=u.apply(void 0,y([t],g(e),!1)),o=r;return h(o)&&c&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return r.apply(this,n)}catch(e){return h(t)&&t.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=t:r=t)}}},j=0,C=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,y(["[SDK]",Date.now(),(""+j++).padStart(8," ")],g(e),!1))},T=0;function D(){var e=function(){for(var e=new Array(16),n=0,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);var r=0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[+r]],o[e[15]]].join("")}(e)}var P=function(e){var t,r,o,n=(t={},r={},o={set:function(e,n){return t[e]=n,r[e]=v(n),o},merge:function(n){return t=d(d({},t),n),Object.keys(n).forEach(function(e){r[e]=v(n[e])}),o},delete:function(e){return delete t[e],delete r[e],o},clear:function(){return t={},r={},o},get:function(e){return r[e]},toString:function(){return d({},r)}});e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})};function I(e,n){var t=e.common||{};return t.sample_rate=n,e.common=t,e}function R(e,n,t,r,o){return e?(i=o(r,n),function(){return i}):function(){return t(n)};var i}function M(e,n,t,r){if(void 0===(e=function(e,n,t){for(var r,n=g(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(r=g(i))[0],i=r.slice(1);if(e)return t(e,o)}(e,n,function(e,n){return e[n]})))return!1;var o,n="boolean"==typeof e?"bool":u(e)?"number":"string";return function(e,n,t){switch(t){case"eq":return S(n,e);case"neq":return!S(n,e);case"gt":return e>n[0];case"gte":return e>=n[0];case"lt":return e<n[0];case"lte":return e<=n[0];case"regex":return Boolean(e.match(new RegExp(n.join("|"))));case"not_regex":return!e.match(new RegExp(n.join("|")));default:return!1}}(e,(o=n,r.map(function(e){switch(o){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}})),t)}function N(n,e){try{return"rule"===e.type?M(n,e.field,e.op,e.values):"and"===e.type?e.children.every(function(e){return N(n,e)}):e.children.some(function(e){return N(n,e)})}catch(e){return!1}}function A(e,n,t,r){if(!n)return b;var o=n.sample_rate,i=n.include_users,a=n.sample_granularity,u=n.rules,n=void 0===(n=n.r)?Math.random():n;if(S(i,e))return function(e){return I(e,1)};var c,s,f,l,p,d,h,m=R(a="session"===a,o,t,n,r),v=(c=u,s=a,f=o,l=t,p=n,d=r,h={},Object.keys(c).forEach(function(e){var n=c[e],t=n.enable,r=n.sample_rate,n=n.conditional_sample_rules;t?(h[e]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:R(s,r,l,p,d)},n&&(h[e].conditional_hit_rules=n.map(function(e){var n=e.sample_rate,e=e.filter;return{sample_rate:n,hit:R(s,n,l,p,d),effectiveSampleRate:n*f,filter:e}}))):h[e]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(e){if(!m())return!1;if(!(e.ev_type in v))return I(e,o);if(!v[e.ev_type].enable)return!1;if(e.common&&e.common.sample_rate)return e;var n=v[e.ev_type],t=n.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(N(e,t[r].filter))return!!t[r].hit()&&I(e,t[r].effectiveSampleRate);return!!n.hit()&&I(e,n.effectiveSampleRate)}}var F,q=function(t){t.on("start",function(){var e=t.config(),n=e.userId,e=e.sample,e=A(n,e,o,f);t.on("build",e)})},z="custom",L=function(e){if(e&&w(e)&&e.name&&c(e.name)){var n={name:e.name,type:"event"};if("metrics"in e&&w(e.metrics)){var t=e.metrics,r={};for(o in t)u(t[o])&&(r[o]=t[o]);n.metrics=r}if("categories"in e&&w(e.categories)){var o,i=e.categories,a={};for(o in i)a[o]=v(i[o]);n.categories=a}return n}},B=function(e){if(e&&w(e)&&e.content&&c(e.content)){var n={content:v(e.content),type:"log",level:"info"};if("level"in e&&(n.level=e.level),"extra"in e&&w(e.extra)){var t,r=e.extra,o={},i={};for(t in r)u(r[t])?o[t]=r[t]:i[t]=v(r[t]);n.metrics=o,n.categories=i}return n}},V="Adapters imported incorrectly",U=["success","fail","complete"],H=20;(_e=F=F||{}).onLaunch="onLaunch",_e.onShow="onShow",_e.onHide="onHide",_e.onError="onError",_e.onPageNotFound="onPageNotFound",_e.onUnhandledRejection="onUnhandledRejection";function G(e){return"[object Object]"===Object.prototype.toString.call(e)}var K=["request","downloadFile","uploadFile"],J=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],W=y(y([],g([F.onLaunch,F.onShow,F.onHide]),!1),[F.onError,F.onPageNotFound,F.onUnhandledRejection],!1),Y=["attached","onInit"],$=["onLoad","onShow","onReady","onUnload","onHide"],Q="__HOOKED__";var X=function(){return Date.now()};function Z(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!h(e))return 0;var r,o=X();try{e.apply(this,n)}finally{r=X()}return r-o}var ee,ne=function(){},te=g((ee="tt",[function(){return ee},function(e){return ee=e}]),2),re=te[0];te[1];function oe(e,n,r){var o=e[n];if(!o||!o[Q])return Object.defineProperty(e,n,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{var t=r.apply(this,e);t&&(e=t)}catch(e){C(e)}return o.apply(this,e)}}),e[n]&&(e[n][Q]=!0),function(){e[n][Q]=!1,r=ne}}function ie(t,e){Object.keys(e).forEach(function(n){e[n].addTearDown(function(){var e;return Se(t,((e={})[n]=null,e))})})}function ae(e,n){n.addTearDown(function(){return we(e,null)})}function ue(e){return Ee("app")[e]}function ce(e){return Ee("page")[e]}function se(t){J.forEach(function(n){Oe(n)&&xe(n).subscribe(function(e){return t(e,n)})})}function fe(e){return Ee("http")[e]}function le(e){return!!Ee("http")[e]}function pe(){return Ee("setData")}function de(){return!!Ee("performance")}function he(){return Ee("instance")}function me(e){we("instance",e)}var ve=function(n,t){function e(e){return t(e),n.call(this,e)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},be=function(){var e={instance:null};return e.instance||("undefined"!=typeof tt?e={instance:tt,platform:re()}:"undefined"!=typeof my?e={instance:my,platform:"my"}:"undefined"!=typeof swan?e={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(e={instance:wx,platform:"wx"})),e},ge="__slardar__global__0.2.2",ye={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},_e=function(e,n){void 0===e&&(e={});var t=(n=void 0===n?be().instance:n)?n[ge]||(n[ge]=e):e;return{setGlobalValue:function(e,n){t[e]=n},mergeGlobalValue:function(e,n){t[e]=d(d({},t[e]),n)},getGlobalValue:function(e){return t[e]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},ye),n&&(n[ge]=t)}}}(d({},ye)),we=_e.setGlobalValue,Se=_e.mergeGlobalValue,Ee=_e.getGlobalValue,xe=function(e){return Ee("route")[e]},Oe=function(e){return!!Ee("route")[e]},ke=function(e){return Ee("component")[e]};function je(e){return"function"==typeof e}function Ce(e,n){!e||0<=(n=e.indexOf(n))&&e.splice(n,1)}function Te(e){return e}function De(t){return function(e){if((n=e)&&je(n.lift))return e.lift(function(e){try{return t(e,this)}catch(e){this.error(e)}});var n;throw new TypeError("Unable to lift unknown Observable type")}}function Pe(e){je(e)?e():null!=e&&e.unsubscribe()}var Ie=function(e){return e instanceof Re||e&&"closed"in e&&je(e.remove)&&je(e.add)&&je(e.unsubscribe)},Re=(Me.prototype.unsubscribe=function(){var e,n,t,r=this;this.closed||(this.closed=!0,e=this._parentage,n=this._finalizers,t=this.initialTeardown,e&&(this._parentage=null,e.forEach(function(e){return e.remove(r)})),je(t)&&t(),n&&(this._finalizers=null,n.forEach(Pe)))},Me.prototype.remove=function(e){this._finalizers&&Ce(this._finalizers,e),e instanceof Me&&e._removeParent(this)},Me.prototype.add=function(e){if(e&&e!==this)if(this.closed)Pe(e);else{if(e instanceof Me){if(e.closed||e._hasParent(this))return;e._addParent(this)}var n=this._finalizers;this._finalizers=n?(n.push(e),n):[e]}},Me.prototype._addParent=function(e){var n=this._parentage;this._parentage=n?(n.push(e),n):[e]},Me.prototype._hasParent=function(e){return this._parentage&&~this._parentage.indexOf(e)},Me.prototype._removeParent=function(e){this._parentage&&Ce(this._parentage,e)},Me);function Me(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var Ne,Ae=(e(Fe,Ne=Re),Fe.prototype.next=function(e){this.isStopped||this.destination.next(e)},Fe.prototype.error=function(e){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(e)}finally{this.unsubscribe()}}},Fe.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Fe.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Ne.prototype.unsubscribe.call(this),this.destination=null)},Fe.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Fe);function Fe(e){var n=Ne.call(this)||this;return n.isStopped=!1,n.destination=Le(e)?e:new qe(!(e=e)||je(e)?{next:null!=e?e:void 0}:e),n}var qe=(ze.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(e){console.error("ConsumerObserver.next error",e)}},ze.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(e){console.error("ConsumerObserver.error error",e)}},ze.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){console.error("ConsumerObserver.complete error",e)}},ze);function ze(e){this.partialObserver=e}function Le(e){return e instanceof Ae||e&&((n=e)&&je(n.next)&&je(n.error)&&je(n.complete))&&Ie(e);var n}Be.prototype.subscribe=function(e){var n=Le(e)?e:new Ae(e),t=this.operator,e=this.source;return n.add(t?t.call(n,e):this._trySubscribe(n)),n},Be.prototype.lift=function(e){var n=new Be;return n.source=this,n.operator=e,n},Be.prototype.pipe=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(n=e).length?Te:1===n.length?n[0]:function(e){return n.reduce(function(e,n){return n(e)},e)})(this)},Be.prototype._subscribe=function(e){},Be.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},te=Be;function Be(e){e&&(this._subscribe=e)}var Ve,_e=(e(Ue,Ve=te),Ue.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(e){return e.next(n)})},Ue.prototype.commonJudgement=function(e){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,e())},Ue.prototype.error=function(n){var t=this;this.commonJudgement(function(){var e=t.observers;for(t.hasError=!0,t.thrownError=n;e.length;)e.shift().error(n)})},Object.defineProperty(Ue.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Ue.prototype.complete=function(){var n=this;this.commonJudgement(function(){for(var e=n.observers;e.length;)e.shift().complete()})},Ue.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Ue.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Ue.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},Ue.prototype._checkFinalizedStatuses=function(e){var n=this.hasError,t=this.thrownError,r=this.isStopped;n?e.error(t):r&&e.complete()},Ue.prototype._innerSubscribe=function(e){var n=this.isStopped,t=this.observers;return n?Ue.EMPTY:(t.push(e),new Re(function(){Ce(t,e)}))},Ue.EMPTY=((_e=new Re).closed=!0,_e),Ue);function Ue(){var e=null!==Ve&&Ve.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var He=new te(function(e){return e.complete()});function Ge(r){return r<=0?function(){return He}:De(function(e,n){var t=0;e.subscribe(function(e){++t<=r&&(n.next(e),r<=t&&n.complete())})})}function Ke(r,o){return De(function(e,n){var t=0;e.subscribe(function(e){return r.call(o,e,t++)&&n.next(e)})})}function Je(t){return Ke(function(e,n){return t<=n})}var We,Ye=(e($e,We=_e),$e.prototype.subscribe=function(e){var t=this,e=We.prototype.subscribe.call(this,e);he()&&he()._subscriptions.push(e);var r=e.unsubscribe;return e.unsubscribe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(this,e),t.observed||t.unsubscribe()},e},$e.prototype.unsubscribe=function(){We.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(e){return e()})},$e.prototype.addTearDown=function(e){this.tearDownFns.push(e)},$e);function $e(){var e=null!==We&&We.apply(this,arguments)||this;return e.tearDownFns=[],e}function Qe(e){var n=e.reduce(function(e,n){return e[n]=new Ye,e},{});return{getSubject:function(e){return n[e]},subjectMap:n}}function Xe(e){return 1<e.length?e:e.length&&e[0]||{}}function Ze(e){var t=e.filter(function(e){return e=e,!!!Ee("app")[e]}),e=Qe(t).subjectMap;Se("app",e=e),ie("app",e),App=ve(App,function(n){t.forEach(function(e){var r=ue(e),e=k(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.next({that:this,param:Xe(e),time:X()}),h(t)&&t.apply(this,e)}})();e&&r.addTearDown(e)})})}function en(e){return e.route||e.__route__||e.url||e.path||""}function nn(e){function n(e,i){r.forEach(function(o){k(e,o,function(r){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];ke(o).next({that:this,param:null,time:X()});var t=i[o];if(h(t)&&t.apply(this,e),h(r))return r.apply(this,e)}})()})}var t=["attached"],r=e.filter(function(e){return~t.indexOf(e)});try{Component=ve(Component,function(e){w(e.lifetimes)?n(e.lifetimes,e):void 0!==e.lifetimes&&null!==e.lifetimes||(e.lifetimes={},n(e.lifetimes,e))})}catch(e){}}function tn(n){ke("attached").subscribe(function(e){e=e.that;return n.call(e)})}function rn(e){return"android"===e.toLowerCase()}function on(e){return e&&function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return 1;default:return e instanceof Error}}(e)?{name:e.name,message:e.message,stack:e.stack}:Sn(e)}function an(){var e="",n="";swan.getEnvInfoSync&&(n=(d=swan.getEnvInfoSync()).env,e=d.appKey);var t=(h=swan.getSystemInfoSync()).model,r=h.brand,o=h.pixelRatio,i=h.screenHeight,a=h.screenWidth,u=h.windowHeight,c=h.windowWidth,s=h.language,f=h.version,l=h.system,p=h.platform,d=h.SDKVersion,h=h.host;return{model:t,brand:r,pixelRatio:o,screenArea:wn({width:a,height:i}),windowArea:wn({width:c,height:u}),language:s,osName:_n(p),osVersion:l,SDKVersion:d,appId:e,miniEnv:n,miniVersion:"",hostName:h,hostVersion:f,platform:"swan"}}function un(e){var n=e.filter(function(e){return e=e,!!!Ee("component")[e]}),e=Qe(n).subjectMap;Se("component",e=e),ie("component",e),mn().componentSubject(n)}function cn(n){function e(e){G(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))}try{Component=ve(Component,e),Behavior=ve(Behavior,e)}catch(e){}}function sn(e,n){var t=e.filter(function(e){return e=e,!!!Ee("page")[e]}),e=Qe(t).subjectMap;Se("page",e=e),ie("page",e),e=function(n){t.forEach(function(e){var r=ce(e),e=k(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(en(this)&&r.next({that:this,param:Xe(e),time:X()}),h(t))return t.apply(this,e)}})();e&&r.addTearDown(e)})},Page=ve(Page,e),cn(e)}function fn(e){var n=e.filter(function(e){return!Oe(e)}),t=Qe(n).subjectMap;Se("route",e=t),ie("route",e),n.forEach(function(i){var e=oe(mn().instance,i,function(o){xe(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:X()}),U.forEach(function(r){k(o,r,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];xe(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:Xe(e)||{}},time:X()}),h(t)&&t.apply(this,e)}})()})});e&&t[i].addTearDown(e)})}function ln(u,e){var n=e.url,t=e.method,r=e.data,o=e.header,i=e.headers,c={api:u,request:{url:n,method:(n=t,"uploadFile"===(t=u)?"POST":"downloadFile"!==t&&n||"GET"),headers:o||i||{},body:v(r),timestamp:X()},response:{}};k(e,"complete",function(a){return function(e){var n=c.response.timestamp||X();c.duration=n-c.request.timestamp,c.completeCallbackTime=Z(a,e);var t,r,o,i=e.errMsg||e.errorMessage||e.error;c.response={status:(t=e.status,r=e.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:n,headers:e.header||e.headers||{},body:v(e.data),errMsg:i,timing:mn().buildRequestProfile(e.profile||{})},fe(u).next(c)}})(),k(e,"success",function(n){return function(e){c.response.timestamp=X(),c.response.status=200,c.successCallbackTime=Z(n,e)}})(),k(e,"fail",function(n){return function(e){c.response.timestamp=X(),c.response.status=-1,c.failCallbackTime=Z(n,e)}})()}function pn(e,t){void 0===t&&(t=mn().instance);var n=e.filter(function(e){return!le(e)}),r=Qe(n).subjectMap;Se("http",e=r),ie("http",e),n.forEach(function(n){var e=oe(t,n,function(e){ln(n,e)});e&&r[n].addTearDown(e)})}var dn,te=g((dn={},[function(e){if(!be().platform)throw Error("Not support current Mini Program");if(!Array.isArray(e)||!e.length)return null;e=e.find(function(e){return e.platform===be().platform});return e&&(dn=e.adapterCtor())},function(){return dn}]),2),hn=te[0],mn=te[1],vn=function(e){return"SLARDAR"+e},bn=function(e){try{return mn().getStorage(e)}catch(e){return}},gn=["darwin","macs","mac"],yn=["windows_nt","windows","window"],_n=function(e){return rn(e)?"Android":"ios"===e.toLowerCase()?"iOS":~gn.indexOf(e.toLowerCase())?"Mac":~yn.indexOf(e.toLowerCase())?"windows":"unknown"},wn=function(e){var n=e.systemPlatform,t=e.pixelRatio,r=e.width,e=e.height;return n&&rn(n)&&t?r/t+" * "+e/t:r+" * "+e},Sn=function(e){return{name:"unknown_error_name",message:v(e)}},_e={platform:"swan",adapterCtor:function(){return d(d({},{instance:t=void 0===t?be().instance:t,request:function(e){return t.request(e)},getStorage:function(e){return t.getStorageSync(e)},setStorage:function(e,n){return t.setStorageSync(e,n)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(e){return e},monitorNetworkType:function(n){t.getNetworkType({success:function(e){n&&n({networkType:e.networkType})}}),t.onNetworkStatusChange(function(e){n&&n({networkType:e.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:"swan",buildError:on,getSystemInfo:an,componentSubject:nn,setDataSubject:tn,pagePerfSubscriber:function(n){function t(e){e.navigate_name=e.navigate_name||"native",e.load_start=e.load_start||0,e.dom_end=e.dom_end||0,e.render_end=e.render_end||0,e.navigate_start&&0!==e.load_start&&(n(d({},e)),e.load_start=0,i=!0)}var r={},o={},i=!1,a=!0;se(function(e,n){"invoke"===e.param.name&&(i=!1,r={navigate_start:e.time,navigate_name:n},o={navigate_start:e.time,navigate_name:n})}),ce("onLoad").pipe(Je(1)).subscribe(function(e){e.that.componentName?o.dom_end=e.time:r.load_start=e.time}),ce("onShow").pipe(Je(1)).subscribe(function(e){e.that.componentName?(o.load_start=e.time,r.load_start=0):r.dom_end=e.time}),ce("onReady").pipe(Je(1)).subscribe(function(e){e.that.componentName?a?a=!1:(o.render_end=e.time,t(o)):(r.render_end=e.time,t(r),a=!1)}),ue(F.onHide).subscribe(function(){i||(t(r),t(o))})}});var t}},En=function(e,n){void 0===n&&(n=K),e.on("init",function(){pn(n)})};function xn(){var a=en(this),u=pe();var e=oe(this,"setData",function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=r[0],i=X();return[o,function(){var e=r[1],n=X()-i;u.next({renderTime:n,url:a,data:o,startTime:i}),e&&e.call(t)}]});e&&u.addTearDown(e)}function On(){var e;Ee("setData")||(e=(e=Qe(["setData"]).getSubject)("setData"),we("setData",e),ae("setData",e))}function kn(o){return Object.keys(o).reduce(function(e,n){var t,r;return r=o[t=n],t&&r&&(Tn.test(t)||Dn.test(r))||(e[n]=o[n]),e},{})}var jn=function(e){e.on("init",function(){On(),ce("onLoad").subscribe(function(e){e=e.that;xn.call(e)}),mn().setDataSubject(xn)})},Cn=function(e){e.on("init",function(){var n,e,t,r=mn();r.observePerformance&&!de()&&(n=(0,Qe(["performance"]).getSubject)("performance"),we("performance",e=n),ae("performance",e),(t=r.observePerformance(function(e){e.forEach(function(e){n.next(e)})}))&&t.disconnect&&n.addTearDown(function(){return t.disconnect()}))})},Tn=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),Dn=new RegExp("(bearer|session)","i"),Pn=function(){return function(e,s){var n=e.hookRequest,t=e.hookDownloadFile,r=e.hookUploadFile,f=e.ignoreUrls,l=e.collectBodyOnError,p=e.extraExtractor,e=function(e){var n,t,r,o,i,a,u,c;!function(e,n){e=m(e||[]);return!!e&&e.test(n)}(f,e.request.url)&&(c=e.response,n=e.request,t=e.api,r=e.duration,o=e.failCallbackTime,u=e.successCallbackTime,i=e.completeCallbackTime,n.headers=kn(n.headers||{}),c.headers=kn(c.headers||{}),a=c.errMsg,e=function(e,n){var t={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}(c,["errMsg"]),e=d(d({},e),{is_custom_error:!1}),a&&(e.err_msg=a),u={api:t,request:n,duration:r,cbTime:i+(o||0)+(u||0),response:e},!h(p)||(e=p(c.body,u))&&(u.extra=e,u.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete u.request.body,delete u.response.body),s({ev_type:"http",payload:u}))};n&&fe("request").subscribe(e),t&&fe("downloadFile").subscribe(e),r&&fe("uploadFile").subscribe(e)}},In=function(e,n,t,r){void 0===n&&(n={}),void 0===r&&(r=[]);try{var o=e.apply(void 0,y([],g(r),!1));return o&&o(n,t)||[]}catch(e){return C("applyMonitor",e),[]}};function Rn(e,n,t){me(e);n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return w(n)?d(d({},t),n):!!n&&t}function Mn(e,n){return e&&n&&e===n}function Nn(){var r;return function(e){try{if(t=r,!(!(n=e)||!t)&&!(!Mn(n.message,t.message)&&!Mn(n.stack,t.stack)))return void(r=e)}catch(e){}var n,t;return r=e}}var An,Fn="http",qn={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},zn=function(f){return void 0===f&&(f=mn()),function(e,r){var n=e.ignoreErrors,t=e.hookOnError,o=e.hookOnUnhandledRejection,i=e.hookRouteError,a=e.dedupe,u=m(n),c=Nn(),s=function(e,n,t){e=a?c(e):e;e&&(u&&u.test(e.message)||(e={error:e},n&&(e.extra=n),t&&(e.react=t),r(e)))};t&&ue(F.onError).subscribe(function(e){e=e.param,e=f.buildError(e);u&&u.test(e.message)||s(e)}),o&&ue(F.onUnhandledRejection).subscribe(function(e){var n=e.param||{},e=n.promise,t=v(n.reason);u&&u.test(t)||e.catch(b).then(function(e){var n={name:"UnhandledRejection",message:t};e&&e.stack&&(n.stack=e.stack),s(n)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&se(function(e){e=e.param;"fail"===(e=e).name&&s({name:"RouteError",message:e.value.errMsg})}),[s]}};(te=An=An||{}).history="history",te.manual="manual";function Ln(t,e,r){var o=e,i=null,a=0,n="launch";function u(e,n){o=n,a=X(),r(n,i=n+"_"+a),t(e,n)}return ue(F.onShow).pipe(Je(1)).subscribe(function(){n="show"}),se(function(){n="history"}),[u,function(e){e&&(u(n,e),n="history")},function(e){void 0===e&&(e="hide"),i&&(r(o,i),i=null,t(e,o,X()-a))}]}var Bn=function(){return function(e,r){var n=e.extractPid,t=e.routeMode,o=e.setPidAndViewId,i=function(e){return n?n(e):e},e=g(Ln(function(e,n,t){r({ev_type:"pageview",payload:{pid:n,source:e,duration:t}})},"",o),3),o=e[0],a=e[1],e=e[2];return t!==An.manual&&(ce("onShow").subscribe(function(e){return function(e){e=en(e),e=i(e);a(e)}(e.that)}),ce("onUnload").subscribe(e.bind(null,"unload")),ce("onHide").subscribe(e.bind(null,"hide"))),[o.bind(null,"user_set"),e]}},Vn=function(){return function(e){var n=g(function(n,t,r){void 0===n&&(n=20),void 0===t&&(t=b),void 0===r&&(r=function(e,n){return e.slice(-n)});var o=[];return[function(){return o},function(e){t(e)&&(e=d(d({},e),{timestamp:e.timestamp||Date.now()}),o=0<=n&&o.length+1>n?r(y(y([],g(o),!1),[e],!1),n):y(y([],g(o),!1),[e],!1))}]}(e.maxBreadcrumbs,e.onAddBreadcrumb,e.onMaxBreadcrumbs),2),e=n[0],r=n[1];return K.forEach(function(e){le(e)&&fe(e).subscribe(function(e){r({type:"http",category:e.api,message:"",data:{method:e.request.method,url:e.request.url,status_code:String(e.response.status)},timestamp:e.request.timestamp})})}),se(function(e,n){var t=e.param,e=e.time;"complete"===t.name&&r({type:"route",category:n,message:t.value.errMsg||t.value.errorMessage||"",timestamp:e,data:{url:t.url||""}})}),[e,r]}},Un=function(){return function(e,t){var r=e.isCalculateSize;pe().subscribe(function(e){var n={duration:e.renderTime,start_time:e.startTime};r&&(n.size=(e=e.data,TextEncoder?(new TextEncoder).encode(v(e)).length:2*v(e).length)),t({ev_type:"set_data",payload:n})})}},Hn=function(){return function(e,n){function t(){n({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;ue(F.onLaunch).pipe(Ge(1)).subscribe(function(e){r.activate_start=e.time}),ue(F.onShow).pipe(Ge(1)).subscribe(function(e){r.init_end=e.time}),ce("onLoad").pipe(Ge(1)).subscribe(function(e){r.page_load_start=e.time}),ce("onShow").pipe(Ge(1)).subscribe(function(e){r.page_dom_end=e.time});var i=de();ce("onReady").pipe(Ge(1)).subscribe(function(e){r.page_render_end=e.time,i&&!r.trigger||t()}),i&&Ee("performance").pipe(Ke(function(e){return"appClick"===e.name}),Ge(1)).subscribe(function(e){r.trigger=e.startTime,r.page_render_end&&t()}),ue(F.onHide).subscribe(function(){o||t()})}},Gn=function(){return function(e,n){mn().pagePerfSubscriber(function(e){return n({ev_type:"page_perf",payload:e})})}},Kn=function(n){return void 0===n&&(n=mn()),function(e,t){var r,o;de()&&n.performanceSubscriber&&(r=0,ce("onLoad").subscribe(function(e){o=e.time,r++}),n.performanceSubscriber(function(e){var n={is_custom:!1,name:e.name,value:e.startTime,type:"perf",count:r};n.duration=e.duration||(o?e.startTime-o:0),n.is_support=0<=n.duration,t({ev_type:"performance",payload:n})}))}},Jn="pageview",Wn={routeMode:An.history,setPidAndViewId:function(e,n){}},Yn="jsError",$n={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},Qn=function(t){return function(e){var n=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},e),{breadcrumbs:n})})}},Xn={maxBreadcrumbs:20,tap:!0},Zn="breadcrumb",et=function(n){n.on("init",function(){n.provide("_subscriptions",[]),me(n),n.on("init",function(){Ze(W),sn($),un(Y)}),n.on("init",function(){fn(J)})}),n.on("beforeDestroy",function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]})},nt="setData",rt={isCalculateSize:!1},ot="appLaunchPerf",it={},at="pagePerf",ut={},ct="performance",st={},ft=function(e,n,t){void 0===t&&(t=mn());var r=n.url,o=n.data,i=n.success,a=void 0===i?l:i,u=n.fail,c=void 0===u?l:u,i=n.header,u={"Content-Type":"application/json"};G(n=i)&&0!==Object.keys(n).length&&Object.assign(u,i),t.request({method:e,url:r,data:o,header:u,headers:u,success:function(e){a(e)},fail:function(e){e=e.errMsg||"Network request failed";c(new Error(e))}})},lt=function(n){return(n=void 0===n?mn():n)?{get:function(e){return ft("GET",e,n)},post:function(e){return ft("POST",e,n)}}:{get:l,post:l}};function pt(e){return e=vn(String(e)),(e=bn(e))&&e.userId&&e.deviceId?e:{userId:D(),deviceId:D()}}function dt(e){return e+"_"+Date.now()}function ht(e){var n=e.aid,t=e.userId,e=e.deviceId;!function(e,n){try{mn().setStorage(e,n)}catch(e){}}(vn(String(n)),{userId:t,deviceId:e})}var mt={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:d(d({},e.extra||{}),e.overrides||{})}}},vt="/monitor_mini/collect",bt="/settings/minipro",gt="apmplus.volces.com",yt="session",_t={sample_rate:1,include_users:[],sample_granularity:yt,rules:{}},wt=[vt,bt],St="0.2.2",Et="APM_PLUS_MINI_PROGRAM",xt=function(e,n){return void 0===n&&(n=vt),(e&&0<=e.indexOf("//")?"":"https://")+e+n};function Ot(e){e=pt(e.aid);return{aid:0,token:"",pid:"",viewId:dt("_"),userId:e.userId,deviceId:e.deviceId,sessionId:D(),domain:gt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:wt},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:_t,sdkName:Et,sdkVersion:St}}function kt(e){var n,t=e.plugins||{};for(n in t)t[n]&&!w(t[n])&&(t[n]={});return d(d({},e),{plugins:t})}function jt(e){return w(e)&&"aid"in e&&"token"in e}function Ct(e){return d({},e)}var Tt=function(n){var r,o,i=n,a={},u=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(e){var n,t;return a=d(d({},a),e||{}),s(),r||(r=e,i.useLocalConfig||!i.aid?(o={},c()):u?f():(n=i.domain,e=i.aid,t=function(e){u=e,f()},lt().get({url:function(e,n){return void 0===n&&(n=bt),(e&&0<=e.indexOf("//")?"":"https://")+e+n}(n)+"?biz_id="+e,success:function(e){t(e&&e.data&&e.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(e){t=e},onReady:function(e){c=function(){ht(i),e()},o&&c()}};function s(){var e=d(d(d({},n),o||{}),a);e.plugins=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t={},r=0;r<e.length;)t=p(t,e[r++]);return t}(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=Dt(Dt(n.sample,null==o?void 0:o.sample),a.sample),i=e,t()}function f(){o=function(e){if(!e)return{};var n=e.sample,t=e.user_id,r=e.timestamp,o=t?{userId:t}:{};if(!n)return o;var i=n.sample_rate,e=n.sample_granularity,t=void 0===e?yt:e,e=n.include_users,n=n.rules,n=void 0===n?[]:n;return d(d({},o),{sample:{include_users:e,sample_rate:i,sample_granularity:t,rules:n.reduce(function(e,n){var t=n.name,r=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[t]={enable:r,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r})}(u),function(e){e=vn(e);return!!mn().getStorage(e)}(String(i.aid))&&(o.userId=n.userId),s(),c()}};function Dt(r,o){if(!r||!o)return r||o;var e=d(d({},r),o);return e.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),e.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(e,n){var t;return n in e||(n in(r.rules||{})&&n in(o.rules||{})?(e[n]=d(d({},r.rules[n]),o.rules[n]),e[n].conditional_sample_rules=y(y([],g(r.rules[n].conditional_sample_rules||[]),!1),g(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(t=r.rules)||void 0===t?void 0:t[n])||(null===(t=o.rules)||void 0===t?void 0:t[n])),e},{}),e}function Pt(e){var n={url:(n=mn().getCurrentPages().pop())?(n?en(n):"")+s(n.options):"",timestamp:X()};return d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})})}function It(e){if(!hn(e))throw Error(V);var t,e=function(e){var t,r,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,c=e.initConfigNormalizer,s=e.validateInitConfig,f={};_.forEach(function(e){return f[e]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(e){if(l)x("already inited");else{if(!(e&&w(e)&&s(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=c(e);if((r=a(n)).setConfig(e),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(e){l&&e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(u(e))),null==r?void 0:r.getConfig()},provide:function(e,n){S(m,e)?x("cannot provide "+e+", reserved"):(v[e]=n,b("provide",!1,e))},start:function(){var n=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(e){return n.build(e)}),h=[]}))},report:function(e){e&&(!(e=O(f.beforeReport)(e))||(e=O(f.report)(e))&&(p?this.build(e):h.push(e)))},build:function(e){!p||(e=O(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=O(f.build)(e))&&this.send(e))},send:function(e){!p||(e=O(f.beforeSend)(e))&&(t.send(e),b("send",!1,e))},destroy:function(){b("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&p||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=E(f[e],n))}},m=Object.keys(v);return v;function b(e,n){void 0===n&&(n=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[e].forEach(function(e){try{e.apply(void 0,y([],g(t),!1))}catch(e){}}),n&&(f[e].length=0)}}({validateInitConfig:jt,initConfigNormalizer:kt,userConfigNormalizer:Ct,createSender:function(e){return n({size:H,endpoint:xt(e.domain),transport:lt()})},builder:mt,createDefaultConfig:Ot,createConfigManager:Tt});return P(e),Ft(e),Mt(e),Nt(e),q(e),et(e),(t=e).on("init",function(){var n=[],e=t.config();e&&e.integrations&&e.integrations.forEach(function(e){S(n,e.name)||(n.push(e.name),e.setup(t),e.tearDown&&t.on("beforeDestroy",e.tearDown))})}),At(e),Rt(e),e}var Rt=function(n){function t(e){return void 0===e&&(e=mn().getSystemInfo()),n.set(d({},e))}function r(){t(),e()}var o,i,a=!1,e=(i="",function(){var e=o.getSender();i=i||e.getEndpoint();var n=o.config(),n={did:n.deviceId,sid:n.sessionId,sname:n.sdkName,sver:n.sdkVersion,soffset:n.offset||0,model:n.model,brand:n.brand,ratio:n.pixelRatio,screen:n.screenArea,window:n.windowArea,lang:n.language,osname:n.osName,osver:n.osVersion,libver:n.SDKVersion,scene:n.scene||-1,menv:n.miniEnv,mver:n.miniVersion,hostname:n.hostName,hostver:n.hostVersion,platform:n.platform,biz_id:n.aid,x_auth_token:n.token};e.setEndpoint(i+s(n))});(o=n).on("start",function(){r(),a=!0}),n.on("init",function(){ue(F.onLaunch).pipe(Ge(1)).subscribe(function(e){e=e.param.scene||-1;t({scene:e}),a&&r()}),mn().monitorNetworkType(function(e){e=e.networkType;n.set({networkType:e})})})},Mt=function(r){r.on("beforeBuild",function(e){return n=e,t=r.config(),(e={}).aid=t.aid,e.pid=t.pid,e.view_id=t.viewId,e.user_id=t.userId,e.network_type=t.networkType,d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})});var n,t})},Nt=function(e){e.on("report",Pt)},At=function(n){n.on("init",function(){ue(F.onHide).subscribe(function(){var e=n.getSender();e&&e.flush()})})},Ft=function(t){var r,o=!1;t.on("init",function(){r=X(),t.on("config",function(){var e,n=null===(e=t.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=X())-r<1e3&&n&&(e=n-(e+r)/2,isNaN(e)||t.set({offset:e})))})})};return function(e){var n,t,r,i,o,a,u,c,s,e=It(e);if(e)return(n=e).provide("sendEvent",function(e){e=L(e);e&&n.report({ev_type:z,payload:e,extra:{timestamp:Date.now()}})}),n.provide("sendLog",function(e){e=B(e);e&&n.report({ev_type:z,payload:e,extra:{timestamp:Date.now()}})}),(t=e).on("init",function(){var e,n=Rn(t,Jn,Wn);n&&(n=(e=g(In(Bn,d(d({},n),{setPidAndViewId:function(e,n){t.set({pid:e,viewId:n,actionId:void 0})}}),t.report.bind(t)),2))[0],e=e[1],t.provide("sendPageview",n),t.provide("sendPageviewWithHide",e))}),(r=e).on("init",function(){var e,n=Rn(r,Yn,$n);n&&(e=Qn(r),e=g(In(zn,n,e),1)[0],r.provide("captureException",e))}),(i=e).on("init",function(){var e,n,t,r,o=Rn(i,Fn,qn);o&&(e=o.hookRequest,n=o.hookDownloadFile,t=o.hookUploadFile,r=[],e&&r.push("request"),n&&r.push("downloadFile"),t&&r.push("uploadFile"),En(i,r),In(Pn,o,i.report.bind(i)))}),(o=e).on("init",function(){var e=Rn(o,nt,rt);e&&(jn(o),In(Un,e,o.report.bind(o)))}),(a=e).on("init",function(){var e,n=Rn(a,Zn,Xn);n&&(n=(e=g(In(Vn,n,function(e){}),2))[0],e=e[1],a.provide("getBreadcrumbs",n),a.provide("addBreadcrumb",e))}),(u=e).on("init",function(){var e=Rn(u,ot,it);e&&(Cn(u),In(Hn,e,u.report.bind(u)))}),(c=e).on("init",function(){var e=Rn(c,at,ut);e&&In(Gn,e,c.report.bind(c))}),(s=e).on("init",function(){var e=Rn(s,ct,st);e&&(Cn(s),In(Kn,e,s.report.bind(s)))}),e}.bind(null,[_e])()}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).swanClient=n()}(this,function(){"use strict";function n(e){var t,r=e.transport,o=e.endpoint,n=e.size,i=void 0===n?10:n,e=e.wait,a=void 0===e?1e3:e,u=[],c=0;function s(){var n;u.length&&(n=this.getBatchData(),r.post({url:o,data:n,fail:function(e){t&&t(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),a)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return u.length?(e=u,JSON.stringify({ev_type:"batch",list:e})):"";var e},clear:function(){clearTimeout(c),u=[]},fail:function(e){t=e}}}var r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var d=function(){return(d=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function g(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||((r=r||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(e){return e}function w(e){return"object"==typeof e&&null!==e}var t=Object.prototype;function i(e){if(w(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(e);e=Object.getPrototypeOf(e);return e===t||null===e}}function a(e){return"[object Array]"===t.toString.call(e)}function h(e){return"function"==typeof e}function u(e){return"number"==typeof e}function c(e){return"string"==typeof e}function p(e,n){var t,r,o=d({},e);for(t in n)r=t,Object.prototype.hasOwnProperty.call(n,r)&&void 0!==n[t]&&(w(n[t])&&i(n[t])?o[t]=p(w(e[t])?e[t]:{},n[t]):a(n[t])&&a(e[t])?o[t]=function n(e,t){e=a(e)?e:[];t=a(t)?t:[];return Array.prototype.concat.call(e,t).map(function(e){return e instanceof RegExp?e:w(e)&&i(e)?p({},e):a(e)?n([],e):e})}(e[t],n[t]):o[t]=n[t]);return o}function S(e,n){if(!a(e))return!1;if(0===e.length)return!1;for(var t=0;t<e.length;){if(e[t]===n)return!0;t++}return!1}function E(e,n){if(!a(e))return e;var t=e.indexOf(n);if(0<=t){n=e.slice();return n.splice(t,1),n}return e}function m(e){return a(e)&&e.length?function(e){for(var n=[],t=e.length,r=0;r<t;r++){var o=e[r];c(o)?n.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return new RegExp(n.join("|"),"i")}(e):null}function v(e){try{return c(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function s(t){return w(t)?Object.keys(t).reduce(function(e,n){return e+="&"+n+"="+t[n]},"").replace("&","?"):""}function x(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,y(["[SDK]",Date.now(),(""+T++).padStart(8," ")],g(e),!1))}function o(e){return Math.random()<Number(e)}function f(e,n){return e<Number(n)}function O(r){return function(e){for(var n=e,t=0;t<r.length&&n;t++)try{n=r[t](n)}catch(e){C(e)}return n}}var k=function(i,a,u,c){return void 0===c&&(c=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return l;var t=i[a],r=u.apply(void 0,y([t],g(e),!1)),o=r;return h(o)&&c&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return r.apply(this,n)}catch(e){return h(t)&&t.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=t:r=t)}}},j=0,C=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,y(["[SDK]",Date.now(),(""+j++).padStart(8," ")],g(e),!1))},T=0;function D(){var e=function(){for(var e=new Array(16),n=0,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);var r=0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[+r]],o[e[15]]].join("")}(e)}var P=function(e){var t,r,o,n=(t={},r={},o={set:function(e,n){return t[e]=n,r[e]=v(n),o},merge:function(n){return t=d(d({},t),n),Object.keys(n).forEach(function(e){r[e]=v(n[e])}),o},delete:function(e){return delete t[e],delete r[e],o},clear:function(){return t={},r={},o},get:function(e){return r[e]},toString:function(){return d({},r)}});e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})};function I(e,n){var t=e.common||{};return t.sample_rate=n,e.common=t,e}function R(e,n,t,r,o){return e?(i=o(r,n),function(){return i}):function(){return t(n)};var i}function M(e,n,t,r){if(void 0===(e=function(e,n,t){for(var r,n=g(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(r=g(i))[0],i=r.slice(1);if(e)return t(e,o)}(e,n,function(e,n){return e[n]})))return!1;var o,n="boolean"==typeof e?"bool":u(e)?"number":"string";return function(e,n,t){switch(t){case"eq":return S(n,e);case"neq":return!S(n,e);case"gt":return e>n[0];case"gte":return e>=n[0];case"lt":return e<n[0];case"lte":return e<=n[0];case"regex":return Boolean(e.match(new RegExp(n.join("|"))));case"not_regex":return!e.match(new RegExp(n.join("|")));default:return!1}}(e,(o=n,r.map(function(e){switch(o){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}})),t)}function N(n,e){try{return"rule"===e.type?M(n,e.field,e.op,e.values):"and"===e.type?e.children.every(function(e){return N(n,e)}):e.children.some(function(e){return N(n,e)})}catch(e){return!1}}function A(e,n,t,r){if(!n)return b;var o=n.sample_rate,i=n.include_users,a=n.sample_granularity,u=n.rules,n=void 0===(n=n.r)?Math.random():n;if(S(i,e))return function(e){return I(e,1)};var c,s,f,l,p,d,h,m=R(a="session"===a,o,t,n,r),v=(c=u,s=a,f=o,l=t,p=n,d=r,h={},Object.keys(c).forEach(function(e){var n=c[e],t=n.enable,r=n.sample_rate,n=n.conditional_sample_rules;t?(h[e]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:R(s,r,l,p,d)},n&&(h[e].conditional_hit_rules=n.map(function(e){var n=e.sample_rate,e=e.filter;return{sample_rate:n,hit:R(s,n,l,p,d),effectiveSampleRate:n*f,filter:e}}))):h[e]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(e){if(!m())return!1;if(!(e.ev_type in v))return I(e,o);if(!v[e.ev_type].enable)return!1;if(e.common&&e.common.sample_rate)return e;var n=v[e.ev_type],t=n.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(N(e,t[r].filter))return!!t[r].hit()&&I(e,t[r].effectiveSampleRate);return!!n.hit()&&I(e,n.effectiveSampleRate)}}var F,q=function(t){t.on("start",function(){var e=t.config(),n=e.userId,e=e.sample,e=A(n,e,o,f);t.on("build",e)})},z="custom",L=function(e){if(e&&w(e)&&e.name&&c(e.name)){var n={name:e.name,type:"event"};if("metrics"in e&&w(e.metrics)){var t=e.metrics,r={};for(o in t)u(t[o])&&(r[o]=t[o]);n.metrics=r}if("categories"in e&&w(e.categories)){var o,i=e.categories,a={};for(o in i)a[o]=v(i[o]);n.categories=a}return n}},B=function(e){if(e&&w(e)&&e.content&&c(e.content)){var n={content:v(e.content),type:"log",level:"info"};if("level"in e&&(n.level=e.level),"extra"in e&&w(e.extra)){var t,r=e.extra,o={},i={};for(t in r)u(r[t])?o[t]=r[t]:i[t]=v(r[t]);n.metrics=o,n.categories=i}return n}},V="Adapters imported incorrectly",U=["success","fail","complete"],H=20;(_e=F=F||{}).onLaunch="onLaunch",_e.onShow="onShow",_e.onHide="onHide",_e.onError="onError",_e.onPageNotFound="onPageNotFound",_e.onUnhandledRejection="onUnhandledRejection";function G(e){return"[object Object]"===Object.prototype.toString.call(e)}var K=["request","downloadFile","uploadFile"],J=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],W=y(y([],g([F.onLaunch,F.onShow,F.onHide]),!1),[F.onError,F.onPageNotFound,F.onUnhandledRejection],!1),Y=["attached","onInit"],$=["onLoad","onShow","onReady","onUnload","onHide"],Q="__HOOKED__";var X=function(){return Date.now()};function Z(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!h(e))return 0;var r,o=X();try{e.apply(this,n)}finally{r=X()}return r-o}var ee,ne=function(){},te=g((ee="tt",[function(){return ee},function(e){return ee=e}]),2),re=te[0];te[1];function oe(e,n,r){var o=e[n];if(!o||!o[Q])return Object.defineProperty(e,n,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{var t=r.apply(this,e);t&&(e=t)}catch(e){C(e)}return o.apply(this,e)}}),e[n]&&(e[n][Q]=!0),function(){e[n][Q]=!1,r=ne}}function ie(t,e){Object.keys(e).forEach(function(n){e[n].addTearDown(function(){var e;return Se(t,((e={})[n]=null,e))})})}function ae(e,n){n.addTearDown(function(){return we(e,null)})}function ue(e){return Ee("app")[e]}function ce(e){return Ee("page")[e]}function se(t){J.forEach(function(n){Oe(n)&&xe(n).subscribe(function(e){return t(e,n)})})}function fe(e){return Ee("http")[e]}function le(e){return!!Ee("http")[e]}function pe(){return Ee("setData")}function de(){return!!Ee("performance")}function he(){return Ee("instance")}function me(e){we("instance",e)}var ve=function(n,t){function e(e){return t(e),n.call(this,e)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},be=function(){var e={instance:null};return e.instance||("undefined"!=typeof tt?e={instance:tt,platform:re()}:"undefined"!=typeof my?e={instance:my,platform:"my"}:"undefined"!=typeof swan?e={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(e={instance:wx,platform:"wx"})),e},ge="__slardar__global__0.2.3-alpha.0",ye={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},_e=function(e,n){void 0===e&&(e={});var t=(n=void 0===n?be().instance:n)?n[ge]||(n[ge]=e):e;return{setGlobalValue:function(e,n){t[e]=n},mergeGlobalValue:function(e,n){t[e]=d(d({},t[e]),n)},getGlobalValue:function(e){return t[e]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},ye),n&&(n[ge]=t)}}}(d({},ye)),we=_e.setGlobalValue,Se=_e.mergeGlobalValue,Ee=_e.getGlobalValue,xe=function(e){return Ee("route")[e]},Oe=function(e){return!!Ee("route")[e]},ke=function(e){return Ee("component")[e]};function je(e){return"function"==typeof e}function Ce(e,n){!e||0<=(n=e.indexOf(n))&&e.splice(n,1)}function Te(e){return e}function De(t){return function(e){if((n=e)&&je(n.lift))return e.lift(function(e){try{return t(e,this)}catch(e){this.error(e)}});var n;throw new TypeError("Unable to lift unknown Observable type")}}function Pe(e){je(e)?e():null!=e&&e.unsubscribe()}var Ie=function(e){return e instanceof Re||e&&"closed"in e&&je(e.remove)&&je(e.add)&&je(e.unsubscribe)},Re=(Me.prototype.unsubscribe=function(){var e,n,t,r=this;this.closed||(this.closed=!0,e=this._parentage,n=this._finalizers,t=this.initialTeardown,e&&(this._parentage=null,e.forEach(function(e){return e.remove(r)})),je(t)&&t(),n&&(this._finalizers=null,n.forEach(Pe)))},Me.prototype.remove=function(e){this._finalizers&&Ce(this._finalizers,e),e instanceof Me&&e._removeParent(this)},Me.prototype.add=function(e){if(e&&e!==this)if(this.closed)Pe(e);else{if(e instanceof Me){if(e.closed||e._hasParent(this))return;e._addParent(this)}var n=this._finalizers;this._finalizers=n?(n.push(e),n):[e]}},Me.prototype._addParent=function(e){var n=this._parentage;this._parentage=n?(n.push(e),n):[e]},Me.prototype._hasParent=function(e){return this._parentage&&~this._parentage.indexOf(e)},Me.prototype._removeParent=function(e){this._parentage&&Ce(this._parentage,e)},Me);function Me(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var Ne,Ae=(e(Fe,Ne=Re),Fe.prototype.next=function(e){this.isStopped||this.destination.next(e)},Fe.prototype.error=function(e){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(e)}finally{this.unsubscribe()}}},Fe.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Fe.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Ne.prototype.unsubscribe.call(this),this.destination=null)},Fe.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Fe);function Fe(e){var n=Ne.call(this)||this;return n.isStopped=!1,n.destination=Le(e)?e:new qe(!(e=e)||je(e)?{next:null!=e?e:void 0}:e),n}var qe=(ze.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(e){console.error("ConsumerObserver.next error",e)}},ze.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(e){console.error("ConsumerObserver.error error",e)}},ze.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){console.error("ConsumerObserver.complete error",e)}},ze);function ze(e){this.partialObserver=e}function Le(e){return e instanceof Ae||e&&((n=e)&&je(n.next)&&je(n.error)&&je(n.complete))&&Ie(e);var n}Be.prototype.subscribe=function(e){var n=Le(e)?e:new Ae(e),t=this.operator,e=this.source;return n.add(t?t.call(n,e):this._trySubscribe(n)),n},Be.prototype.lift=function(e){var n=new Be;return n.source=this,n.operator=e,n},Be.prototype.pipe=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(n=e).length?Te:1===n.length?n[0]:function(e){return n.reduce(function(e,n){return n(e)},e)})(this)},Be.prototype._subscribe=function(e){},Be.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},te=Be;function Be(e){e&&(this._subscribe=e)}var Ve,_e=(e(Ue,Ve=te),Ue.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(e){return e.next(n)})},Ue.prototype.commonJudgement=function(e){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,e())},Ue.prototype.error=function(n){var t=this;this.commonJudgement(function(){var e=t.observers;for(t.hasError=!0,t.thrownError=n;e.length;)e.shift().error(n)})},Object.defineProperty(Ue.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Ue.prototype.complete=function(){var n=this;this.commonJudgement(function(){for(var e=n.observers;e.length;)e.shift().complete()})},Ue.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Ue.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Ue.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},Ue.prototype._checkFinalizedStatuses=function(e){var n=this.hasError,t=this.thrownError,r=this.isStopped;n?e.error(t):r&&e.complete()},Ue.prototype._innerSubscribe=function(e){var n=this.isStopped,t=this.observers;return n?Ue.EMPTY:(t.push(e),new Re(function(){Ce(t,e)}))},Ue.EMPTY=((_e=new Re).closed=!0,_e),Ue);function Ue(){var e=null!==Ve&&Ve.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var He=new te(function(e){return e.complete()});function Ge(r){return r<=0?function(){return He}:De(function(e,n){var t=0;e.subscribe(function(e){++t<=r&&(n.next(e),r<=t&&n.complete())})})}function Ke(r,o){return De(function(e,n){var t=0;e.subscribe(function(e){return r.call(o,e,t++)&&n.next(e)})})}function Je(t){return Ke(function(e,n){return t<=n})}var We,Ye=(e($e,We=_e),$e.prototype.subscribe=function(e){var t=this,e=We.prototype.subscribe.call(this,e);he()&&he()._subscriptions.push(e);var r=e.unsubscribe;return e.unsubscribe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(this,e),t.observed||t.unsubscribe()},e},$e.prototype.unsubscribe=function(){We.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(e){return e()})},$e.prototype.addTearDown=function(e){this.tearDownFns.push(e)},$e);function $e(){var e=null!==We&&We.apply(this,arguments)||this;return e.tearDownFns=[],e}function Qe(e){var n=e.reduce(function(e,n){return e[n]=new Ye,e},{});return{getSubject:function(e){return n[e]},subjectMap:n}}function Xe(e){return 1<e.length?e:e.length&&e[0]||{}}function Ze(e){var t=e.filter(function(e){return e=e,!!!Ee("app")[e]}),e=Qe(t).subjectMap;Se("app",e=e),ie("app",e),App=ve(App,function(n){t.forEach(function(e){var r=ue(e),e=k(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.next({that:this,param:Xe(e),time:X()}),h(t)&&t.apply(this,e)}})();e&&r.addTearDown(e)})})}function en(e){return e.route||e.__route__||e.url||e.path||""}function nn(e){function n(e,i){r.forEach(function(o){k(e,o,function(r){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];ke(o).next({that:this,param:null,time:X()});var t=i[o];if(h(t)&&t.apply(this,e),h(r))return r.apply(this,e)}})()})}var t=["attached"],r=e.filter(function(e){return~t.indexOf(e)});try{Component=ve(Component,function(e){w(e.lifetimes)?n(e.lifetimes,e):void 0!==e.lifetimes&&null!==e.lifetimes||(e.lifetimes={},n(e.lifetimes,e))})}catch(e){}}function tn(n){ke("attached").subscribe(function(e){e=e.that;return n.call(e)})}function rn(e){return"android"===e.toLowerCase()}function on(e){return e&&function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return 1;default:return e instanceof Error}}(e)?{name:e.name,message:e.message,stack:e.stack}:Sn(e)}function an(){var e="",n="";swan.getEnvInfoSync&&(n=(d=swan.getEnvInfoSync()).env,e=d.appKey);var t=(h=swan.getSystemInfoSync()).model,r=h.brand,o=h.pixelRatio,i=h.screenHeight,a=h.screenWidth,u=h.windowHeight,c=h.windowWidth,s=h.language,f=h.version,l=h.system,p=h.platform,d=h.SDKVersion,h=h.host;return{model:t,brand:r,pixelRatio:o,screenArea:wn({width:a,height:i}),windowArea:wn({width:c,height:u}),language:s,osName:_n(p),osVersion:l,SDKVersion:d,appId:e,miniEnv:n,miniVersion:"",hostName:h,hostVersion:f,platform:"swan"}}function un(e){var n=e.filter(function(e){return e=e,!!!Ee("component")[e]}),e=Qe(n).subjectMap;Se("component",e=e),ie("component",e),mn().componentSubject(n)}function cn(n){function e(e){G(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))}try{Component=ve(Component,e),Behavior=ve(Behavior,e)}catch(e){}}function sn(e,n){var t=e.filter(function(e){return e=e,!!!Ee("page")[e]}),e=Qe(t).subjectMap;Se("page",e=e),ie("page",e),e=function(n){t.forEach(function(e){var r=ce(e),e=k(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(en(this)&&r.next({that:this,param:Xe(e),time:X()}),h(t))return t.apply(this,e)}})();e&&r.addTearDown(e)})},Page=ve(Page,e),cn(e)}function fn(e){var n=e.filter(function(e){return!Oe(e)}),t=Qe(n).subjectMap;Se("route",e=t),ie("route",e),n.forEach(function(i){var e=oe(mn().instance,i,function(o){void 0===o&&(o={}),xe(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:X()}),U.forEach(function(r){k(o,r,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];xe(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:Xe(e)||{}},time:X()}),h(t)&&t.apply(this,e)}})()})});e&&t[i].addTearDown(e)})}function ln(u,e){var n=e.url,t=e.method,r=e.data,o=e.header,i=e.headers,c={api:u,request:{url:n,method:(n=t,"uploadFile"===(t=u)?"POST":"downloadFile"!==t&&n||"GET"),headers:o||i||{},body:v(r),timestamp:X()},response:{}};k(e,"complete",function(a){return function(e){var n=c.response.timestamp||X();c.duration=n-c.request.timestamp,c.completeCallbackTime=Z(a,e);var t,r,o,i=e.errMsg||e.errorMessage||e.error;c.response={status:(t=e.status,r=e.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:n,headers:e.header||e.headers||{},body:v(e.data),errMsg:i,timing:mn().buildRequestProfile(e.profile||{})},fe(u).next(c)}})(),k(e,"success",function(n){return function(e){c.response.timestamp=X(),c.response.status=200,c.successCallbackTime=Z(n,e)}})(),k(e,"fail",function(n){return function(e){c.response.timestamp=X(),c.response.status=-1,c.failCallbackTime=Z(n,e)}})()}function pn(e,t){void 0===t&&(t=mn().instance);var n=e.filter(function(e){return!le(e)}),r=Qe(n).subjectMap;Se("http",e=r),ie("http",e),n.forEach(function(n){var e=oe(t,n,function(e){ln(n,e)});e&&r[n].addTearDown(e)})}var dn,te=g((dn={},[function(e){if(!be().platform)throw Error("Not support current Mini Program");if(!Array.isArray(e)||!e.length)return null;e=e.find(function(e){return e.platform===be().platform});return e&&(dn=e.adapterCtor())},function(){return dn}]),2),hn=te[0],mn=te[1],vn=function(e){return"SLARDAR"+e},bn=function(e){try{return mn().getStorage(e)}catch(e){return}},gn=["darwin","macs","mac"],yn=["windows_nt","windows","window"],_n=function(e){return rn(e)?"Android":"ios"===e.toLowerCase()?"iOS":~gn.indexOf(e.toLowerCase())?"Mac":~yn.indexOf(e.toLowerCase())?"windows":"unknown"},wn=function(e){var n=e.systemPlatform,t=e.pixelRatio,r=e.width,e=e.height;return n&&rn(n)&&t?r/t+" * "+e/t:r+" * "+e},Sn=function(e){return{name:"unknown_error_name",message:v(e)}},_e={platform:"swan",adapterCtor:function(){return d(d({},{instance:t=void 0===t?be().instance:t,request:function(e){return t.request(e)},getStorage:function(e){return t.getStorageSync(e)},setStorage:function(e,n){return t.setStorageSync(e,n)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(e){return e},monitorNetworkType:function(n){t.getNetworkType({success:function(e){n&&n({networkType:e.networkType})}}),t.onNetworkStatusChange(function(e){n&&n({networkType:e.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:"swan",buildError:on,getSystemInfo:an,componentSubject:nn,setDataSubject:tn,pagePerfSubscriber:function(n){function t(e){e.navigate_name=e.navigate_name||"native",e.load_start=e.load_start||0,e.dom_end=e.dom_end||0,e.render_end=e.render_end||0,e.navigate_start&&0!==e.load_start&&(n(d({},e)),e.load_start=0,i=!0)}var r={},o={},i=!1,a=!0;se(function(e,n){"invoke"===e.param.name&&(i=!1,r={navigate_start:e.time,navigate_name:n},o={navigate_start:e.time,navigate_name:n})}),ce("onLoad").pipe(Je(1)).subscribe(function(e){e.that.componentName?o.dom_end=e.time:r.load_start=e.time}),ce("onShow").pipe(Je(1)).subscribe(function(e){e.that.componentName?(o.load_start=e.time,r.load_start=0):r.dom_end=e.time}),ce("onReady").pipe(Je(1)).subscribe(function(e){e.that.componentName?a?a=!1:(o.render_end=e.time,t(o)):(r.render_end=e.time,t(r),a=!1)}),ue(F.onHide).subscribe(function(){i||(t(r),t(o))})}});var t}},En=function(e,n){void 0===n&&(n=K),e.on("init",function(){pn(n)})};function xn(){var a=en(this),u=pe();var e=oe(this,"setData",function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=r[0],i=X();return[o,function(){var e=r[1],n=X()-i;u.next({renderTime:n,url:a,data:o,startTime:i}),e&&e.call(t)}]});e&&u.addTearDown(e)}function On(){var e;Ee("setData")||(e=(e=Qe(["setData"]).getSubject)("setData"),we("setData",e),ae("setData",e))}function kn(o){return Object.keys(o).reduce(function(e,n){var t,r;return r=o[t=n],t&&r&&(Tn.test(t)||Dn.test(r))||(e[n]=o[n]),e},{})}var jn=function(e){e.on("init",function(){On(),ce("onLoad").subscribe(function(e){e=e.that;xn.call(e)}),mn().setDataSubject(xn)})},Cn=function(e){e.on("init",function(){var n,e,t,r=mn();r.observePerformance&&!de()&&(n=(0,Qe(["performance"]).getSubject)("performance"),we("performance",e=n),ae("performance",e),(t=r.observePerformance(function(e){e.forEach(function(e){n.next(e)})}))&&t.disconnect&&n.addTearDown(function(){return t.disconnect()}))})},Tn=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),Dn=new RegExp("(bearer|session)","i"),Pn=function(){return function(e,s){var n=e.hookRequest,t=e.hookDownloadFile,r=e.hookUploadFile,f=e.ignoreUrls,l=e.collectBodyOnError,p=e.extraExtractor,e=function(e){var n,t,r,o,i,a,u,c;!function(e,n){e=m(e||[]);return!!e&&e.test(n)}(f,e.request.url)&&(c=e.response,n=e.request,t=e.api,r=e.duration,o=e.failCallbackTime,u=e.successCallbackTime,i=e.completeCallbackTime,n.headers=kn(n.headers||{}),c.headers=kn(c.headers||{}),a=c.errMsg,e=function(e,n){var t={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}(c,["errMsg"]),e=d(d({},e),{is_custom_error:!1}),a&&(e.err_msg=a),u={api:t,request:n,duration:r,cbTime:i+(o||0)+(u||0),response:e},!h(p)||(e=p(c.body,u))&&(u.extra=e,u.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete u.request.body,delete u.response.body),s({ev_type:"http",payload:u}))};n&&fe("request").subscribe(e),t&&fe("downloadFile").subscribe(e),r&&fe("uploadFile").subscribe(e)}},In=function(e,n,t,r){void 0===n&&(n={}),void 0===r&&(r=[]);try{var o=e.apply(void 0,y([],g(r),!1));return o&&o(n,t)||[]}catch(e){return C("applyMonitor",e),[]}};function Rn(e,n,t){me(e);n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return w(n)?d(d({},t),n):!!n&&t}function Mn(e,n){return e&&n&&e===n}function Nn(){var r;return function(e){try{if(t=r,!(!(n=e)||!t)&&!(!Mn(n.message,t.message)&&!Mn(n.stack,t.stack)))return void(r=e)}catch(e){}var n,t;return r=e}}var An,Fn="http",qn={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},zn=function(f){return void 0===f&&(f=mn()),function(e,r){var n=e.ignoreErrors,t=e.hookOnError,o=e.hookOnUnhandledRejection,i=e.hookRouteError,a=e.dedupe,u=m(n),c=Nn(),s=function(e,n,t){e=a?c(e):e;e&&(u&&u.test(e.message)||(e={error:e},n&&(e.extra=n),t&&(e.react=t),r(e)))};t&&ue(F.onError).subscribe(function(e){e=e.param,e=f.buildError(e);u&&u.test(e.message)||s(e)}),o&&ue(F.onUnhandledRejection).subscribe(function(e){var n=e.param||{},e=n.promise,t=v(n.reason);u&&u.test(t)||e.catch(b).then(function(e){var n={name:"UnhandledRejection",message:t};e&&e.stack&&(n.stack=e.stack),s(n)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&se(function(e){e=e.param;"fail"===(e=e).name&&s({name:"RouteError",message:e.value.errMsg})}),[s]}};(te=An=An||{}).history="history",te.manual="manual";function Ln(t,e,r){var o=e,i=null,a=0,n="launch";function u(e,n){o=n,a=X(),r(n,i=n+"_"+a),t(e,n)}return ue(F.onShow).pipe(Je(1)).subscribe(function(){n="show"}),se(function(){n="history"}),[u,function(e){e&&(u(n,e),n="history")},function(e){void 0===e&&(e="hide"),i&&(r(o,i),i=null,t(e,o,X()-a))}]}var Bn=function(){return function(e,r){var n=e.extractPid,t=e.routeMode,o=e.setPidAndViewId,i=function(e){return n?n(e):e},e=g(Ln(function(e,n,t){r({ev_type:"pageview",payload:{pid:n,source:e,duration:t}})},"",o),3),o=e[0],a=e[1],e=e[2];return t!==An.manual&&(ce("onShow").subscribe(function(e){return function(e){e=en(e),e=i(e);a(e)}(e.that)}),ce("onUnload").subscribe(e.bind(null,"unload")),ce("onHide").subscribe(e.bind(null,"hide"))),[o.bind(null,"user_set"),e]}},Vn=function(){return function(e){var n=g(function(n,t,r){void 0===n&&(n=20),void 0===t&&(t=b),void 0===r&&(r=function(e,n){return e.slice(-n)});var o=[];return[function(){return o},function(e){t(e)&&(e=d(d({},e),{timestamp:e.timestamp||Date.now()}),o=0<=n&&o.length+1>n?r(y(y([],g(o),!1),[e],!1),n):y(y([],g(o),!1),[e],!1))}]}(e.maxBreadcrumbs,e.onAddBreadcrumb,e.onMaxBreadcrumbs),2),e=n[0],r=n[1];return K.forEach(function(e){le(e)&&fe(e).subscribe(function(e){r({type:"http",category:e.api,message:"",data:{method:e.request.method,url:e.request.url,status_code:String(e.response.status)},timestamp:e.request.timestamp})})}),se(function(e,n){var t=e.param,e=e.time;"complete"===t.name&&r({type:"route",category:n,message:t.value.errMsg||t.value.errorMessage||"",timestamp:e,data:{url:t.url||""}})}),[e,r]}},Un=function(){return function(e,t){var r=e.isCalculateSize;pe().subscribe(function(e){var n={duration:e.renderTime,start_time:e.startTime};r&&(n.size=(e=e.data,TextEncoder?(new TextEncoder).encode(v(e)).length:2*v(e).length)),t({ev_type:"set_data",payload:n})})}},Hn=function(){return function(e,n){function t(){n({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;ue(F.onLaunch).pipe(Ge(1)).subscribe(function(e){r.activate_start=e.time}),ue(F.onShow).pipe(Ge(1)).subscribe(function(e){r.init_end=e.time}),ce("onLoad").pipe(Ge(1)).subscribe(function(e){r.page_load_start=e.time}),ce("onShow").pipe(Ge(1)).subscribe(function(e){r.page_dom_end=e.time});var i=de();ce("onReady").pipe(Ge(1)).subscribe(function(e){r.page_render_end=e.time,i&&!r.trigger||t()}),i&&Ee("performance").pipe(Ke(function(e){return"appClick"===e.name}),Ge(1)).subscribe(function(e){r.trigger=e.startTime,r.page_render_end&&t()}),ue(F.onHide).subscribe(function(){o||t()})}},Gn=function(){return function(e,n){mn().pagePerfSubscriber(function(e){return n({ev_type:"page_perf",payload:e})})}},Kn=function(n){return void 0===n&&(n=mn()),function(e,t){var r,o;de()&&n.performanceSubscriber&&(r=0,ce("onLoad").subscribe(function(e){o=e.time,r++}),n.performanceSubscriber(function(e){var n={is_custom:!1,name:e.name,value:e.startTime,type:"perf",count:r};n.duration=e.duration||(o?e.startTime-o:0),n.is_support=0<=n.duration,t({ev_type:"performance",payload:n})}))}},Jn="pageview",Wn={routeMode:An.history,setPidAndViewId:function(e,n){}},Yn="jsError",$n={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},Qn=function(t){return function(e){var n=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},e),{breadcrumbs:n})})}},Xn={maxBreadcrumbs:20,tap:!0},Zn="breadcrumb",et=function(n){n.on("init",function(){n.provide("_subscriptions",[]),me(n),n.on("init",function(){Ze(W),sn($),un(Y)}),n.on("init",function(){fn(J)})}),n.on("beforeDestroy",function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]})},nt="setData",rt={isCalculateSize:!1},ot="appLaunchPerf",it={},at="pagePerf",ut={},ct="performance",st={},ft=function(e,n,t){void 0===t&&(t=mn());var r=n.url,o=n.data,i=n.success,a=void 0===i?l:i,u=n.fail,c=void 0===u?l:u,i=n.header,u={"Content-Type":"application/json"};G(n=i)&&0!==Object.keys(n).length&&Object.assign(u,i),t.request({method:e,url:r,data:o,header:u,headers:u,success:function(e){a(e)},fail:function(e){e=e.errMsg||"Network request failed";c(new Error(e))}})},lt=function(n){return(n=void 0===n?mn():n)?{get:function(e){return ft("GET",e,n)},post:function(e){return ft("POST",e,n)}}:{get:l,post:l}};function pt(e){return e=vn(String(e)),(e=bn(e))&&e.userId&&e.deviceId?e:{userId:D(),deviceId:D()}}function dt(e){return e+"_"+Date.now()}function ht(e){var n=e.aid,t=e.userId,e=e.deviceId;!function(e,n){try{mn().setStorage(e,n)}catch(e){}}(vn(String(n)),{userId:t,deviceId:e})}var mt={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:d(d({},e.extra||{}),e.overrides||{})}}},vt="/monitor_mini/collect",bt="/settings/minipro",gt="apmplus.volces.com",yt="session",_t={sample_rate:1,include_users:[],sample_granularity:yt,rules:{}},wt=[vt,bt],St="0.2.3-alpha.0",Et="APM_PLUS_MINI_PROGRAM",xt=function(e,n){return void 0===n&&(n=vt),(e&&0<=e.indexOf("//")?"":"https://")+e+n};function Ot(e){e=pt(e.aid);return{aid:0,token:"",pid:"",viewId:dt("_"),userId:e.userId,deviceId:e.deviceId,sessionId:D(),domain:gt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:wt},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:_t,sdkName:Et,sdkVersion:St}}function kt(e){var n,t=e.plugins||{};for(n in t)t[n]&&!w(t[n])&&(t[n]={});return d(d({},e),{plugins:t})}function jt(e){return w(e)&&"aid"in e&&"token"in e}function Ct(e){return d({},e)}var Tt=function(n){var r,o,i=n,a={},u=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(e){var n,t;return a=d(d({},a),e||{}),s(),r||(r=e,i.useLocalConfig||!i.aid?(o={},c()):u?f():(n=i.domain,e=i.aid,t=function(e){u=e,f()},lt().get({url:function(e,n){return void 0===n&&(n=bt),(e&&0<=e.indexOf("//")?"":"https://")+e+n}(n)+"?biz_id="+e,success:function(e){t(e&&e.data&&e.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(e){t=e},onReady:function(e){c=function(){ht(i),e()},o&&c()}};function s(){var e=d(d(d({},n),o||{}),a);e.plugins=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t={},r=0;r<e.length;)t=p(t,e[r++]);return t}(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=Dt(Dt(n.sample,null==o?void 0:o.sample),a.sample),i=e,t()}function f(){o=function(e){if(!e)return{};var n=e.sample,t=e.user_id,r=e.timestamp,o=t?{userId:t}:{};if(!n)return o;var i=n.sample_rate,e=n.sample_granularity,t=void 0===e?yt:e,e=n.include_users,n=n.rules,n=void 0===n?[]:n;return d(d({},o),{sample:{include_users:e,sample_rate:i,sample_granularity:t,rules:n.reduce(function(e,n){var t=n.name,r=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[t]={enable:r,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r})}(u),function(e){e=vn(e);return!!mn().getStorage(e)}(String(i.aid))&&(o.userId=n.userId),s(),c()}};function Dt(r,o){if(!r||!o)return r||o;var e=d(d({},r),o);return e.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),e.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(e,n){var t;return n in e||(n in(r.rules||{})&&n in(o.rules||{})?(e[n]=d(d({},r.rules[n]),o.rules[n]),e[n].conditional_sample_rules=y(y([],g(r.rules[n].conditional_sample_rules||[]),!1),g(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(t=r.rules)||void 0===t?void 0:t[n])||(null===(t=o.rules)||void 0===t?void 0:t[n])),e},{}),e}function Pt(e){var n={url:(n=mn().getCurrentPages().pop())?(n?en(n):"")+s(n.options):"",timestamp:X()};return d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})})}function It(e){if(!hn(e))throw Error(V);var t,e=function(e){var t,r,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,c=e.initConfigNormalizer,s=e.validateInitConfig,f={};_.forEach(function(e){return f[e]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(e){if(l)x("already inited");else{if(!(e&&w(e)&&s(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=c(e);if((r=a(n)).setConfig(e),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(e){l&&e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(u(e))),null==r?void 0:r.getConfig()},provide:function(e,n){S(m,e)?x("cannot provide "+e+", reserved"):(v[e]=n,b("provide",!1,e))},start:function(){var n=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(e){return n.build(e)}),h=[]}))},report:function(e){e&&(!(e=O(f.beforeReport)(e))||(e=O(f.report)(e))&&(p?this.build(e):h.push(e)))},build:function(e){!p||(e=O(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=O(f.build)(e))&&this.send(e))},send:function(e){!p||(e=O(f.beforeSend)(e))&&(t.send(e),b("send",!1,e))},destroy:function(){b("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&p||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=E(f[e],n))}},m=Object.keys(v);return v;function b(e,n){void 0===n&&(n=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[e].forEach(function(e){try{e.apply(void 0,y([],g(t),!1))}catch(e){}}),n&&(f[e].length=0)}}({validateInitConfig:jt,initConfigNormalizer:kt,userConfigNormalizer:Ct,createSender:function(e){return n({size:H,endpoint:xt(e.domain),transport:lt()})},builder:mt,createDefaultConfig:Ot,createConfigManager:Tt});return P(e),Ft(e),Mt(e),Nt(e),q(e),et(e),(t=e).on("init",function(){var n=[],e=t.config();e&&e.integrations&&e.integrations.forEach(function(e){S(n,e.name)||(n.push(e.name),e.setup(t),e.tearDown&&t.on("beforeDestroy",e.tearDown))})}),At(e),Rt(e),e}var Rt=function(n){function t(e){return void 0===e&&(e=mn().getSystemInfo()),n.set(d({},e))}function r(){t(),e()}var o,i,a=!1,e=(i="",function(){var e=o.getSender();i=i||e.getEndpoint();var n=o.config(),n={did:n.deviceId,sid:n.sessionId,sname:n.sdkName,sver:n.sdkVersion,soffset:n.offset||0,model:n.model,brand:n.brand,ratio:n.pixelRatio,screen:n.screenArea,window:n.windowArea,lang:n.language,osname:n.osName,osver:n.osVersion,libver:n.SDKVersion,scene:n.scene||-1,menv:n.miniEnv,mver:n.miniVersion,hostname:n.hostName,hostver:n.hostVersion,platform:n.platform,biz_id:n.aid,x_auth_token:n.token};e.setEndpoint(i+s(n))});(o=n).on("start",function(){r(),a=!0}),n.on("init",function(){ue(F.onLaunch).pipe(Ge(1)).subscribe(function(e){e=e.param.scene||-1;t({scene:e}),a&&r()}),mn().monitorNetworkType(function(e){e=e.networkType;n.set({networkType:e})})})},Mt=function(r){r.on("beforeBuild",function(e){return n=e,t=r.config(),(e={}).aid=t.aid,e.pid=t.pid,e.view_id=t.viewId,e.user_id=t.userId,e.network_type=t.networkType,d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})});var n,t})},Nt=function(e){e.on("report",Pt)},At=function(n){n.on("init",function(){ue(F.onHide).subscribe(function(){var e=n.getSender();e&&e.flush()})})},Ft=function(t){var r,o=!1;t.on("init",function(){r=X(),t.on("config",function(){var e,n=null===(e=t.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=X())-r<1e3&&n&&(e=n-(e+r)/2,isNaN(e)||t.set({offset:e})))})})};return function(e){var n,t,r,i,o,a,u,c,s,e=It(e);if(e)return(n=e).provide("sendEvent",function(e){e=L(e);e&&n.report({ev_type:z,payload:e,extra:{timestamp:Date.now()}})}),n.provide("sendLog",function(e){e=B(e);e&&n.report({ev_type:z,payload:e,extra:{timestamp:Date.now()}})}),(t=e).on("init",function(){var e,n=Rn(t,Jn,Wn);n&&(n=(e=g(In(Bn,d(d({},n),{setPidAndViewId:function(e,n){t.set({pid:e,viewId:n,actionId:void 0})}}),t.report.bind(t)),2))[0],e=e[1],t.provide("sendPageview",n),t.provide("sendPageviewWithHide",e))}),(r=e).on("init",function(){var e,n=Rn(r,Yn,$n);n&&(e=Qn(r),e=g(In(zn,n,e),1)[0],r.provide("captureException",e))}),(i=e).on("init",function(){var e,n,t,r,o=Rn(i,Fn,qn);o&&(e=o.hookRequest,n=o.hookDownloadFile,t=o.hookUploadFile,r=[],e&&r.push("request"),n&&r.push("downloadFile"),t&&r.push("uploadFile"),En(i,r),In(Pn,o,i.report.bind(i)))}),(o=e).on("init",function(){var e=Rn(o,nt,rt);e&&(jn(o),In(Un,e,o.report.bind(o)))}),(a=e).on("init",function(){var e,n=Rn(a,Zn,Xn);n&&(n=(e=g(In(Vn,n,function(e){}),2))[0],e=e[1],a.provide("getBreadcrumbs",n),a.provide("addBreadcrumb",e))}),(u=e).on("init",function(){var e=Rn(u,ot,it);e&&(Cn(u),In(Hn,e,u.report.bind(u)))}),(c=e).on("init",function(){var e=Rn(c,at,ut);e&&In(Gn,e,c.report.bind(c))}),(s=e).on("init",function(){var e=Rn(s,ct,st);e&&(Cn(s),In(Kn,e,s.report.bind(s)))}),e}.bind(null,[_e])()}); |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).ttClient=n()}(this,function(){"use strict";function n(e){var t,r=e.transport,o=e.endpoint,n=e.size,i=void 0===n?10:n,e=e.wait,a=void 0===e?1e3:e,u=[],c=0;function s(){var n;u.length&&(n=this.getBatchData(),r.post({url:o,data:n,fail:function(e){t&&t(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),a)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return u.length?(e=u,JSON.stringify({ev_type:"batch",list:e})):"";var e},clear:function(){clearTimeout(c),u=[]},fail:function(e){t=e}}}var r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var d=function(){return(d=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function h(e,n){var t={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}function g(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||((r=r||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(e){return e}function w(e){return"object"==typeof e&&null!==e}var t=Object.prototype;function i(e){if(w(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(e);e=Object.getPrototypeOf(e);return e===t||null===e}}function a(e){return"[object Array]"===t.toString.call(e)}function m(e){return"function"==typeof e}function u(e){return"number"==typeof e}function c(e){return"string"==typeof e}function p(e,n){var t,r,o=d({},e);for(t in n)r=t,Object.prototype.hasOwnProperty.call(n,r)&&void 0!==n[t]&&(w(n[t])&&i(n[t])?o[t]=p(w(e[t])?e[t]:{},n[t]):a(n[t])&&a(e[t])?o[t]=function n(e,t){e=a(e)?e:[];t=a(t)?t:[];return Array.prototype.concat.call(e,t).map(function(e){return e instanceof RegExp?e:w(e)&&i(e)?p({},e):a(e)?n([],e):e})}(e[t],n[t]):o[t]=n[t]);return o}function S(e,n){if(!a(e))return!1;if(0===e.length)return!1;for(var t=0;t<e.length;){if(e[t]===n)return!0;t++}return!1}function E(e,n){if(!a(e))return e;var t=e.indexOf(n);if(0<=t){n=e.slice();return n.splice(t,1),n}return e}function v(e){return a(e)&&e.length?function(e){for(var n=[],t=e.length,r=0;r<t;r++){var o=e[r];c(o)?n.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return new RegExp(n.join("|"),"i")}(e):null}function k(e){try{return c(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function s(t){return w(t)?Object.keys(t).reduce(function(e,n){return e+="&"+n+"="+t[n]},"").replace("&","?"):""}function x(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,y(["[SDK]",Date.now(),(""+P++).padStart(8," ")],g(e),!1))}function o(e){return Math.random()<Number(e)}function f(e,n){return e<Number(n)}function O(r){return function(e){for(var n=e,t=0;t<r.length&&n;t++)try{n=r[t](n)}catch(e){C(e)}return n}}var j=function(i,a,u,c){return void 0===c&&(c=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return l;var t=i[a],r=u.apply(void 0,y([t],g(e),!1)),o=r;return m(o)&&c&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return r.apply(this,n)}catch(e){return m(t)&&t.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=t:r=t)}}},T=0,C=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,y(["[SDK]",Date.now(),(""+T++).padStart(8," ")],g(e),!1))},P=0;function D(){var e=function(){for(var e=new Array(16),n=0,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);var r=0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[+r]],o[e[15]]].join("")}(e)}var I=function(e){var t,r,o,n=(t={},r={},o={set:function(e,n){return t[e]=n,r[e]=k(n),o},merge:function(n){return t=d(d({},t),n),Object.keys(n).forEach(function(e){r[e]=k(n[e])}),o},delete:function(e){return delete t[e],delete r[e],o},clear:function(){return t={},r={},o},get:function(e){return r[e]},toString:function(){return d({},r)}});e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})};function R(e,n){var t=e.common||{};return t.sample_rate=n,e.common=t,e}function N(e,n,t,r,o){return e?(i=o(r,n),function(){return i}):function(){return t(n)};var i}function M(e,n,t,r){if(void 0===(e=function(e,n,t){for(var r,n=g(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(r=g(i))[0],i=r.slice(1);if(e)return t(e,o)}(e,n,function(e,n){return e[n]})))return!1;var o,n="boolean"==typeof e?"bool":u(e)?"number":"string";return function(e,n,t){switch(t){case"eq":return S(n,e);case"neq":return!S(n,e);case"gt":return e>n[0];case"gte":return e>=n[0];case"lt":return e<n[0];case"lte":return e<=n[0];case"regex":return Boolean(e.match(new RegExp(n.join("|"))));case"not_regex":return!e.match(new RegExp(n.join("|")));default:return!1}}(e,(o=n,r.map(function(e){switch(o){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}})),t)}function q(n,e){try{return"rule"===e.type?M(n,e.field,e.op,e.values):"and"===e.type?e.children.every(function(e){return q(n,e)}):e.children.some(function(e){return q(n,e)})}catch(e){return!1}}function L(e,n,t,r){if(!n)return b;var o=n.sample_rate,i=n.include_users,a=n.sample_granularity,u=n.rules,n=void 0===(n=n.r)?Math.random():n;if(S(i,e))return function(e){return R(e,1)};var c,s,f,l,p,d,h,m=N(a="session"===a,o,t,n,r),v=(c=u,s=a,f=o,l=t,p=n,d=r,h={},Object.keys(c).forEach(function(e){var n=c[e],t=n.enable,r=n.sample_rate,n=n.conditional_sample_rules;t?(h[e]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:N(s,r,l,p,d)},n&&(h[e].conditional_hit_rules=n.map(function(e){var n=e.sample_rate,e=e.filter;return{sample_rate:n,hit:N(s,n,l,p,d),effectiveSampleRate:n*f,filter:e}}))):h[e]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(e){if(!m())return!1;if(!(e.ev_type in v))return R(e,o);if(!v[e.ev_type].enable)return!1;if(e.common&&e.common.sample_rate)return e;var n=v[e.ev_type],t=n.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(q(e,t[r].filter))return!!t[r].hit()&&R(e,t[r].effectiveSampleRate);return!!n.hit()&&R(e,n.effectiveSampleRate)}}var A,B=function(t){t.on("start",function(){var e=t.config(),n=e.userId,e=e.sample,e=L(n,e,o,f);t.on("build",e)})},F="custom",z=function(e){if(e&&w(e)&&e.name&&c(e.name)){var n={name:e.name,type:"event"};if("metrics"in e&&w(e.metrics)){var t=e.metrics,r={};for(o in t)u(t[o])&&(r[o]=t[o]);n.metrics=r}if("categories"in e&&w(e.categories)){var o,i=e.categories,a={};for(o in i)a[o]=k(i[o]);n.categories=a}return n}},V=function(e){if(e&&w(e)&&e.content&&c(e.content)){var n={content:k(e.content),type:"log",level:"info"};if("level"in e&&(n.level=e.level),"extra"in e&&w(e.extra)){var t,r=e.extra,o={},i={};for(t in r)u(r[t])?o[t]=r[t]:i[t]=k(r[t]);n.metrics=o,n.categories=i}return n}},U="Adapters imported incorrectly",H=["success","fail","complete"],G=20;(_e=A=A||{}).onLaunch="onLaunch",_e.onShow="onShow",_e.onHide="onHide",_e.onError="onError",_e.onPageNotFound="onPageNotFound",_e.onUnhandledRejection="onUnhandledRejection";function K(e){return"[object Object]"===Object.prototype.toString.call(e)}var J=["request","downloadFile","uploadFile"],W=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],Y=y(y([],g([A.onLaunch,A.onShow,A.onHide]),!1),[A.onError,A.onPageNotFound,A.onUnhandledRejection],!1),$=["attached","onInit"],Q=["onLoad","onShow","onReady","onUnload","onHide"],X="__HOOKED__";var Z=function(){return Date.now()};function ee(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!m(e))return 0;var r,o=Z();try{e.apply(this,n)}finally{r=Z()}return r-o}var ne,te=function(){},re=g((ne="tt",[function(){return ne},function(e){return ne=e}]),2),oe=re[0];re[1];function ie(e,n,r){var o=e[n];if(!o||!o[X])return Object.defineProperty(e,n,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{var t=r.apply(this,e);t&&(e=t)}catch(e){C(e)}return o.apply(this,e)}}),e[n]&&(e[n][X]=!0),function(){e[n][X]=!1,r=te}}function ae(t,e){Object.keys(e).forEach(function(n){e[n].addTearDown(function(){var e;return Se(t,((e={})[n]=null,e))})})}function ue(e,n){n.addTearDown(function(){return we(e,null)})}function ce(e){return Ee("route")[e]}function se(e){return!!Ee("route")[e]}function fe(e){return Ee("http")[e]}function le(e){return!!Ee("http")[e]}function pe(){return Ee("setData")}function de(){return!!Ee("performance")}function he(){return Ee("instance")}function me(e){we("instance",e)}var ve=function(n,t){function e(e){return t(e),n.call(this,e)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},be=function(){var e={instance:null};return e.instance||("undefined"!=typeof tt?e={instance:tt,platform:oe()}:"undefined"!=typeof my?e={instance:my,platform:"my"}:"undefined"!=typeof swan?e={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(e={instance:wx,platform:"wx"})),e},ge="__slardar__global__0.2.2",ye={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},_e=function(e,n){void 0===e&&(e={});var t=(n=void 0===n?be().instance:n)?n[ge]||(n[ge]=e):e;return{setGlobalValue:function(e,n){t[e]=n},mergeGlobalValue:function(e,n){t[e]=d(d({},t[e]),n)},getGlobalValue:function(e){return t[e]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},ye),n&&(n[ge]=t)}}}(d({},ye)),we=_e.setGlobalValue,Se=_e.mergeGlobalValue,Ee=_e.getGlobalValue,ke=function(e){return Ee("app")[e]},xe=function(e){return Ee("page")[e]},Oe=function(t){W.forEach(function(n){se(n)&&ce(n).subscribe(function(e){return t(e,n)})})},je=function(){return Ee("performance")},Te=function(e){return Ee("component")[e]};function Ce(e){return"function"==typeof e}function Pe(e,n){!e||0<=(n=e.indexOf(n))&&e.splice(n,1)}function De(e){return e}function Ie(t){return function(e){if((n=e)&&Ce(n.lift))return e.lift(function(e){try{return t(e,this)}catch(e){this.error(e)}});var n;throw new TypeError("Unable to lift unknown Observable type")}}function Re(e){Ce(e)?e():null!=e&&e.unsubscribe()}var Ne=function(e){return e instanceof Me||e&&"closed"in e&&Ce(e.remove)&&Ce(e.add)&&Ce(e.unsubscribe)},Me=(qe.prototype.unsubscribe=function(){var e,n,t,r=this;this.closed||(this.closed=!0,e=this._parentage,n=this._finalizers,t=this.initialTeardown,e&&(this._parentage=null,e.forEach(function(e){return e.remove(r)})),Ce(t)&&t(),n&&(this._finalizers=null,n.forEach(Re)))},qe.prototype.remove=function(e){this._finalizers&&Pe(this._finalizers,e),e instanceof qe&&e._removeParent(this)},qe.prototype.add=function(e){if(e&&e!==this)if(this.closed)Re(e);else{if(e instanceof qe){if(e.closed||e._hasParent(this))return;e._addParent(this)}var n=this._finalizers;this._finalizers=n?(n.push(e),n):[e]}},qe.prototype._addParent=function(e){var n=this._parentage;this._parentage=n?(n.push(e),n):[e]},qe.prototype._hasParent=function(e){return this._parentage&&~this._parentage.indexOf(e)},qe.prototype._removeParent=function(e){this._parentage&&Pe(this._parentage,e)},qe);function qe(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var Le,Ae=(e(Be,Le=Me),Be.prototype.next=function(e){this.isStopped||this.destination.next(e)},Be.prototype.error=function(e){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(e)}finally{this.unsubscribe()}}},Be.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Be.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Le.prototype.unsubscribe.call(this),this.destination=null)},Be.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Be);function Be(e){var n=Le.call(this)||this;return n.isStopped=!1,n.destination=Ve(e)?e:new Fe(!(e=e)||Ce(e)?{next:null!=e?e:void 0}:e),n}var Fe=(ze.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(e){console.error("ConsumerObserver.next error",e)}},ze.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(e){console.error("ConsumerObserver.error error",e)}},ze.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){console.error("ConsumerObserver.complete error",e)}},ze);function ze(e){this.partialObserver=e}function Ve(e){return e instanceof Ae||e&&((n=e)&&Ce(n.next)&&Ce(n.error)&&Ce(n.complete))&&Ne(e);var n}Ue.prototype.subscribe=function(e){var n=Ve(e)?e:new Ae(e),t=this.operator,e=this.source;return n.add(t?t.call(n,e):this._trySubscribe(n)),n},Ue.prototype.lift=function(e){var n=new Ue;return n.source=this,n.operator=e,n},Ue.prototype.pipe=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(n=e).length?De:1===n.length?n[0]:function(e){return n.reduce(function(e,n){return n(e)},e)})(this)},Ue.prototype._subscribe=function(e){},Ue.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},re=Ue;function Ue(e){e&&(this._subscribe=e)}var He,_e=(e(Ge,He=re),Ge.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(e){return e.next(n)})},Ge.prototype.commonJudgement=function(e){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,e())},Ge.prototype.error=function(n){var t=this;this.commonJudgement(function(){var e=t.observers;for(t.hasError=!0,t.thrownError=n;e.length;)e.shift().error(n)})},Object.defineProperty(Ge.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Ge.prototype.complete=function(){var n=this;this.commonJudgement(function(){for(var e=n.observers;e.length;)e.shift().complete()})},Ge.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Ge.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Ge.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},Ge.prototype._checkFinalizedStatuses=function(e){var n=this.hasError,t=this.thrownError,r=this.isStopped;n?e.error(t):r&&e.complete()},Ge.prototype._innerSubscribe=function(e){var n=this.isStopped,t=this.observers;return n?Ge.EMPTY:(t.push(e),new Me(function(){Pe(t,e)}))},Ge.EMPTY=((_e=new Me).closed=!0,_e),Ge);function Ge(){var e=null!==He&&He.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var Ke=new re(function(e){return e.complete()});function Je(r){return r<=0?function(){return Ke}:Ie(function(e,n){var t=0;e.subscribe(function(e){++t<=r&&(n.next(e),r<=t&&n.complete())})})}function We(r,o){return Ie(function(e,n){var t=0;e.subscribe(function(e){return r.call(o,e,t++)&&n.next(e)})})}function Ye(t){return We(function(e,n){return t<=n})}var $e,Qe=(e(Xe,$e=_e),Xe.prototype.subscribe=function(e){var t=this,e=$e.prototype.subscribe.call(this,e);he()&&he()._subscriptions.push(e);var r=e.unsubscribe;return e.unsubscribe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(this,e),t.observed||t.unsubscribe()},e},Xe.prototype.unsubscribe=function(){$e.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(e){return e()})},Xe.prototype.addTearDown=function(e){this.tearDownFns.push(e)},Xe);function Xe(){var e=null!==$e&&$e.apply(this,arguments)||this;return e.tearDownFns=[],e}function Ze(e){var n=e.reduce(function(e,n){return e[n]=new Qe,e},{});return{getSubject:function(e){return n[e]},subjectMap:n}}function en(e){return 1<e.length?e:e.length&&e[0]||{}}function nn(e){var t=e.filter(function(e){return e=e,!!!Ee("app")[e]}),e=Ze(t).subjectMap;Se("app",e=e),ae("app",e),App=ve(App,function(n){t.forEach(function(e){var r=ke(e),e=j(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.next({that:this,param:en(e),time:Z()}),m(t)&&t.apply(this,e)}})();e&&r.addTearDown(e)})})}function tn(e){return e.route||e.__route__||e.url||e.path||""}function rn(e){function n(e,i){r.forEach(function(o){j(e,o,function(r){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];Te(o).next({that:this,param:null,time:Z()});var t=i[o];if(m(t)&&t.apply(this,e),m(r))return r.apply(this,e)}})()})}var t=["attached"],r=e.filter(function(e){return~t.indexOf(e)});try{Component=ve(Component,function(e){w(e.lifetimes)?n(e.lifetimes,e):void 0!==e.lifetimes&&null!==e.lifetimes||(e.lifetimes={},n(e.lifetimes,e))})}catch(e){}}function on(e){function n(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(e(d({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;Oe(function(e,n){"invoke"===e.param.name&&(o=!1,r={navigate_start:e.time,navigate_name:n})}),xe("onLoad").pipe(Ye(1)).subscribe(function(e){r.load_start=e.time}),xe("onShow").pipe(Ye(1)).subscribe(function(e){r.dom_end=e.time}),xe("onReady").pipe(Ye(1)).subscribe(function(e){r.render_end=e.time,n(),t()}),ke(A.onHide).subscribe(function(){!1===o&&(n(),t())})}function an(n){var t=["downloadPackage","evaluateScript","fcp","fp","fr"];je().subscribe(function(e){~t.indexOf(e.name)&&n(e)})}function un(n){Te("attached").subscribe(function(e){e=e.that;return n.call(e)})}function cn(e){return"android"===e.toLowerCase()}function sn(e){return cn(e)?"Android":"ios"===e.toLowerCase()?"iOS":~kn.indexOf(e.toLowerCase())?"Mac":~xn.indexOf(e.toLowerCase())?"windows":"unknown"}function fn(e){var n=e.systemPlatform,t=e.pixelRatio,r=e.width,e=e.height;return n&&cn(n)&&t?r/t+" * "+e/t:r+" * "+e}function ln(e){void 0===e&&(e="tt");var n,t="",r="",o="";return tt.getEnvInfoSync?(r=(n=tt.getEnvInfoSync().microapp).envType,t=n.appId,o=n.mpVersion):(r=tt.env.VERSION,t=""),d({appId:t,miniEnv:r,miniVersion:o,platform:e},Cn())}function pn(n){var e=xe("onReady").subscribe(function(){var e;tt.performance&&(e=(tt.performance.getCurrentPageEntries()||[]).map(function(e){e.name,e.entryType;var n=h(e,["name","entryType"]),t=Pn(e);return t?d(d({},n),t):e}),n(e))});return{disconnect:function(){return e.unsubscribe()}}}function dn(e){var n=e.filter(function(e){return e=e,!!!Ee("component")[e]}),e=Ze(n).subjectMap;Se("component",e=e),ae("component",e),wn().componentSubject(n)}function hn(n){function e(e){K(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))}try{Component=ve(Component,e),Behavior=ve(Behavior,e)}catch(e){}}function mn(e,n){var t=e.filter(function(e){return e=e,!!!Ee("page")[e]}),e=Ze(t).subjectMap;Se("page",e=e),ae("page",e),e=function(n){t.forEach(function(e){var r=xe(e),e=j(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(tn(this)&&r.next({that:this,param:en(e),time:Z()}),m(t))return t.apply(this,e)}})();e&&r.addTearDown(e)})},Page=ve(Page,e),hn(e)}function vn(e){var n=e.filter(function(e){return!se(e)}),t=Ze(n).subjectMap;Se("route",e=t),ae("route",e),n.forEach(function(i){var e=ie(wn().instance,i,function(o){ce(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:Z()}),H.forEach(function(r){j(o,r,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];ce(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:en(e)||{}},time:Z()}),m(t)&&t.apply(this,e)}})()})});e&&t[i].addTearDown(e)})}function bn(u,e){var n=e.url,t=e.method,r=e.data,o=e.header,i=e.headers,c={api:u,request:{url:n,method:(n=t,"uploadFile"===(t=u)?"POST":"downloadFile"!==t&&n||"GET"),headers:o||i||{},body:k(r),timestamp:Z()},response:{}};j(e,"complete",function(a){return function(e){var n=c.response.timestamp||Z();c.duration=n-c.request.timestamp,c.completeCallbackTime=ee(a,e);var t,r,o,i=e.errMsg||e.errorMessage||e.error;c.response={status:(t=e.status,r=e.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:n,headers:e.header||e.headers||{},body:k(e.data),errMsg:i,timing:wn().buildRequestProfile(e.profile||{})},fe(u).next(c)}})(),j(e,"success",function(n){return function(e){c.response.timestamp=Z(),c.response.status=200,c.successCallbackTime=ee(n,e)}})(),j(e,"fail",function(n){return function(e){c.response.timestamp=Z(),c.response.status=-1,c.failCallbackTime=ee(n,e)}})()}function gn(e,t){void 0===t&&(t=wn().instance);var n=e.filter(function(e){return!le(e)}),r=Ze(n).subjectMap;Se("http",e=r),ae("http",e),n.forEach(function(n){var e=ie(t,n,function(e){bn(n,e)});e&&r[n].addTearDown(e)})}var yn,re=g((yn={},[function(e){if(!be().platform)throw Error("Not support current Mini Program");if(!Array.isArray(e)||!e.length)return null;e=e.find(function(e){return e.platform===be().platform});return e&&(yn=e.adapterCtor())},function(){return yn}]),2),_n=re[0],wn=re[1],Sn=function(e){return"SLARDAR"+e},En=function(e){try{return wn().getStorage(e)}catch(e){return}},kn=["darwin","macs","mac"],xn=["windows_nt","windows","window"],On=function(e){return function(e){var n,t={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&void 0!==e[n]&&null!==e[n]&&(t[n]=e[n]);return t}({domainLookupStart:e.domainLookupStart,domainLookupEnd:e.domainLookupEnd,connectStart:e.connectStart,secureConnectionStart:e.SSLconnectionStart,connectEnd:e.connectEnd,requestStart:e.requestStart,requestEnd:e.requestEnd,responseStart:e.responseStart,responseEnd:e.responseEnd,socketReused:e.socketReused,redirectStart:e.redirectStart,redirectEnd:e.redirectEnd,fetchStart:e.fetchStart,sendBytesCount:e.sendBytesCount,throughputKbps:e.throughputKbps,receivedBytedCount:e.receivedBytedCount})},jn=function(e){return{name:"unknown_error_name",message:k(e)}},Tn=function(e){var n=e.split("\n"),n=g((n[0]&&n[0].split(":")||[]).map(function(e){return e.trim()}),2);return{name:n[0],message:n[1],stack:e}},Cn=function(){var e=tt.getSystemInfoSync(),n=e.model,t=e.brand,r=e.pixelRatio,o=e.screenHeight,i=e.screenWidth,a=e.windowHeight,u=e.windowWidth,c=e.language,s=e.version,f=e.system,l=e.platform,p=e.SDKVersion,e=e.appName;return{model:n,brand:t,pixelRatio:r,screenArea:fn({width:i,height:o}),windowArea:fn({width:u,height:a}),language:c,osName:sn(l),osVersion:f,SDKVersion:p,hostName:e,hostVersion:s}},Pn=function(e){if("navigation"===e.entryType)return{name:"route",entryType:"navigation",path:e.name};switch(e.name){case"app-click":return{name:"appClick",entryType:"navigation"};case"miniprogram-package\t":return{name:"downloadPackage",entryType:"loadPackage"};case"first-paint":return{name:"fp",entryType:"render"};default:return null}},_e={platform:"tt",adapterCtor:function(){return d(d({},{instance:t=void 0===t?be().instance:t,request:function(e){return t.request(e)},getStorage:function(e){return t.getStorageSync(e)},setStorage:function(e,n){return t.setStorageSync(e,n)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(e){return e},monitorNetworkType:function(n){t.getNetworkType({success:function(e){n&&n({networkType:e.networkType})}}),t.onNetworkStatusChange(function(e){n&&n({networkType:e.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:"tt",buildError:function(e){return(c(e=e)?Tn:jn)(e)},getSystemInfo:ln,observePerformance:pn,performanceSubscriber:an,buildRequestProfile:function(e){return On(e)},componentSubject:rn,pagePerfSubscriber:on,setDataSubject:un});var t}},Dn=function(e,n){void 0===n&&(n=J),e.on("init",function(){gn(n)})};function In(){var a=tn(this),u=pe();var e=ie(this,"setData",function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=r[0],i=Z();return[o,function(){var e=r[1],n=Z()-i;u.next({renderTime:n,url:a,data:o,startTime:i}),e&&e.call(t)}]});e&&u.addTearDown(e)}function Rn(){var e;Ee("setData")||(e=(e=Ze(["setData"]).getSubject)("setData"),we("setData",e),ue("setData",e))}function Nn(o){return Object.keys(o).reduce(function(e,n){var t,r;return r=o[t=n],t&&r&&(Ln.test(t)||An.test(r))||(e[n]=o[n]),e},{})}var Mn=function(e){e.on("init",function(){Rn(),xe("onLoad").subscribe(function(e){e=e.that;In.call(e)}),wn().setDataSubject(In)})},qn=function(e){e.on("init",function(){var n,e,t,r=wn();r.observePerformance&&!de()&&(n=(0,Ze(["performance"]).getSubject)("performance"),we("performance",e=n),ue("performance",e),(t=r.observePerformance(function(e){e.forEach(function(e){n.next(e)})}))&&t.disconnect&&n.addTearDown(function(){return t.disconnect()}))})},Ln=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),An=new RegExp("(bearer|session)","i"),Bn=function(){return function(e,s){var n=e.hookRequest,t=e.hookDownloadFile,r=e.hookUploadFile,f=e.ignoreUrls,l=e.collectBodyOnError,p=e.extraExtractor,e=function(e){var n,t,r,o,i,a,u,c;!function(e,n){e=v(e||[]);return!!e&&e.test(n)}(f,e.request.url)&&(c=e.response,n=e.request,t=e.api,r=e.duration,o=e.failCallbackTime,u=e.successCallbackTime,i=e.completeCallbackTime,n.headers=Nn(n.headers||{}),c.headers=Nn(c.headers||{}),a=c.errMsg,e=h(c,["errMsg"]),e=d(d({},e),{is_custom_error:!1}),a&&(e.err_msg=a),u={api:t,request:n,duration:r,cbTime:i+(o||0)+(u||0),response:e},!m(p)||(e=p(c.body,u))&&(u.extra=e,u.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete u.request.body,delete u.response.body),s({ev_type:"http",payload:u}))};n&&fe("request").subscribe(e),t&&fe("downloadFile").subscribe(e),r&&fe("uploadFile").subscribe(e)}},Fn=function(e,n,t,r){void 0===n&&(n={}),void 0===r&&(r=[]);try{var o=e.apply(void 0,y([],g(r),!1));return o&&o(n,t)||[]}catch(e){return C("applyMonitor",e),[]}};function zn(e,n,t){me(e);n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return w(n)?d(d({},t),n):!!n&&t}function Vn(e,n){return e&&n&&e===n}function Un(){var r;return function(e){try{if(t=r,!(!(n=e)||!t)&&!(!Vn(n.message,t.message)&&!Vn(n.stack,t.stack)))return void(r=e)}catch(e){}var n,t;return r=e}}var Hn,Gn="http",Kn={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},Jn=function(f){return void 0===f&&(f=wn()),function(e,r){var n=e.ignoreErrors,t=e.hookOnError,o=e.hookOnUnhandledRejection,i=e.hookRouteError,a=e.dedupe,u=v(n),c=Un(),s=function(e,n,t){e=a?c(e):e;e&&(u&&u.test(e.message)||(e={error:e},n&&(e.extra=n),t&&(e.react=t),r(e)))};t&&ke(A.onError).subscribe(function(e){e=e.param,e=f.buildError(e);u&&u.test(e.message)||s(e)}),o&&ke(A.onUnhandledRejection).subscribe(function(e){var n=e.param||{},e=n.promise,t=k(n.reason);u&&u.test(t)||e.catch(b).then(function(e){var n={name:"UnhandledRejection",message:t};e&&e.stack&&(n.stack=e.stack),s(n)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&Oe(function(e){e=e.param;"fail"===(e=e).name&&s({name:"RouteError",message:e.value.errMsg})}),[s]}};(re=Hn=Hn||{}).history="history",re.manual="manual";function Wn(t,e,r){var o=e,i=null,a=0,n="launch";function u(e,n){o=n,a=Z(),r(n,i=n+"_"+a),t(e,n)}return ke(A.onShow).pipe(Ye(1)).subscribe(function(){n="show"}),Oe(function(){n="history"}),[u,function(e){e&&(u(n,e),n="history")},function(e){void 0===e&&(e="hide"),i&&(r(o,i),i=null,t(e,o,Z()-a))}]}var Yn=function(){return function(e,r){var n=e.extractPid,t=e.routeMode,o=e.setPidAndViewId,i=function(e){return n?n(e):e},e=g(Wn(function(e,n,t){r({ev_type:"pageview",payload:{pid:n,source:e,duration:t}})},"",o),3),o=e[0],a=e[1],e=e[2];return t!==Hn.manual&&(xe("onShow").subscribe(function(e){return function(e){e=tn(e),e=i(e);a(e)}(e.that)}),xe("onUnload").subscribe(e.bind(null,"unload")),xe("onHide").subscribe(e.bind(null,"hide"))),[o.bind(null,"user_set"),e]}},$n=function(){return function(e){var n=g(function(n,t,r){void 0===n&&(n=20),void 0===t&&(t=b),void 0===r&&(r=function(e,n){return e.slice(-n)});var o=[];return[function(){return o},function(e){t(e)&&(e=d(d({},e),{timestamp:e.timestamp||Date.now()}),o=0<=n&&o.length+1>n?r(y(y([],g(o),!1),[e],!1),n):y(y([],g(o),!1),[e],!1))}]}(e.maxBreadcrumbs,e.onAddBreadcrumb,e.onMaxBreadcrumbs),2),e=n[0],r=n[1];return J.forEach(function(e){le(e)&&fe(e).subscribe(function(e){r({type:"http",category:e.api,message:"",data:{method:e.request.method,url:e.request.url,status_code:String(e.response.status)},timestamp:e.request.timestamp})})}),Oe(function(e,n){var t=e.param,e=e.time;"complete"===t.name&&r({type:"route",category:n,message:t.value.errMsg||t.value.errorMessage||"",timestamp:e,data:{url:t.url||""}})}),[e,r]}},Qn=function(){return function(e,t){var r=e.isCalculateSize;pe().subscribe(function(e){var n={duration:e.renderTime,start_time:e.startTime};r&&(n.size=(e=e.data,TextEncoder?(new TextEncoder).encode(k(e)).length:2*k(e).length)),t({ev_type:"set_data",payload:n})})}},Xn=function(){return function(e,n){function t(){n({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;ke(A.onLaunch).pipe(Je(1)).subscribe(function(e){r.activate_start=e.time}),ke(A.onShow).pipe(Je(1)).subscribe(function(e){r.init_end=e.time}),xe("onLoad").pipe(Je(1)).subscribe(function(e){r.page_load_start=e.time}),xe("onShow").pipe(Je(1)).subscribe(function(e){r.page_dom_end=e.time});var i=de();xe("onReady").pipe(Je(1)).subscribe(function(e){r.page_render_end=e.time,i&&!r.trigger||t()}),i&&je().pipe(We(function(e){return"appClick"===e.name}),Je(1)).subscribe(function(e){r.trigger=e.startTime,r.page_render_end&&t()}),ke(A.onHide).subscribe(function(){o||t()})}},Zn=function(){return function(e,n){wn().pagePerfSubscriber(function(e){return n({ev_type:"page_perf",payload:e})})}},et=function(n){return void 0===n&&(n=wn()),function(e,t){var r,o;de()&&n.performanceSubscriber&&(r=0,xe("onLoad").subscribe(function(e){o=e.time,r++}),n.performanceSubscriber(function(e){var n={is_custom:!1,name:e.name,value:e.startTime,type:"perf",count:r};n.duration=e.duration||(o?e.startTime-o:0),n.is_support=0<=n.duration,t({ev_type:"performance",payload:n})}))}},nt="pageview",rt={routeMode:Hn.history,setPidAndViewId:function(e,n){}},ot="jsError",it={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},at=function(t){return function(e){var n=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},e),{breadcrumbs:n})})}},ut={maxBreadcrumbs:20,tap:!0},ct="breadcrumb",st=function(n){n.on("init",function(){n.provide("_subscriptions",[]),me(n),n.on("init",function(){nn(Y),mn(Q),dn($)}),n.on("init",function(){vn(W)})}),n.on("beforeDestroy",function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]})},ft="setData",lt={isCalculateSize:!1},pt="appLaunchPerf",dt={},ht="pagePerf",mt={},vt="performance",bt={},gt=function(e,n,t){void 0===t&&(t=wn());var r=n.url,o=n.data,i=n.success,a=void 0===i?l:i,u=n.fail,c=void 0===u?l:u,i=n.header,u={"Content-Type":"application/json"};K(n=i)&&0!==Object.keys(n).length&&Object.assign(u,i),t.request({method:e,url:r,data:o,header:u,headers:u,success:function(e){a(e)},fail:function(e){e=e.errMsg||"Network request failed";c(new Error(e))}})},yt=function(n){return(n=void 0===n?wn():n)?{get:function(e){return gt("GET",e,n)},post:function(e){return gt("POST",e,n)}}:{get:l,post:l}};function _t(e){return e=Sn(String(e)),(e=En(e))&&e.userId&&e.deviceId?e:{userId:D(),deviceId:D()}}function wt(e){return e+"_"+Date.now()}function St(e){var n=e.aid,t=e.userId,e=e.deviceId;!function(e,n){try{wn().setStorage(e,n)}catch(e){}}(Sn(String(n)),{userId:t,deviceId:e})}var Et={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:d(d({},e.extra||{}),e.overrides||{})}}},kt="/monitor_mini/collect",xt="/settings/minipro",Ot="apmplus.volces.com",jt="session",Tt={sample_rate:1,include_users:[],sample_granularity:jt,rules:{}},Ct=[kt,xt],Pt="0.2.2",Dt="APM_PLUS_MINI_PROGRAM",It=function(e,n){return void 0===n&&(n=kt),(e&&0<=e.indexOf("//")?"":"https://")+e+n};function Rt(e){e=_t(e.aid);return{aid:0,token:"",pid:"",viewId:wt("_"),userId:e.userId,deviceId:e.deviceId,sessionId:D(),domain:Ot,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:Ct},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:Tt,sdkName:Dt,sdkVersion:Pt}}function Nt(e){var n,t=e.plugins||{};for(n in t)t[n]&&!w(t[n])&&(t[n]={});return d(d({},e),{plugins:t})}function Mt(e){return w(e)&&"aid"in e&&"token"in e}function qt(e){return d({},e)}var Lt=function(n){var r,o,i=n,a={},u=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(e){var n,t;return a=d(d({},a),e||{}),s(),r||(r=e,i.useLocalConfig||!i.aid?(o={},c()):u?f():(n=i.domain,e=i.aid,t=function(e){u=e,f()},yt().get({url:function(e,n){return void 0===n&&(n=xt),(e&&0<=e.indexOf("//")?"":"https://")+e+n}(n)+"?biz_id="+e,success:function(e){t(e&&e.data&&e.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(e){t=e},onReady:function(e){c=function(){St(i),e()},o&&c()}};function s(){var e=d(d(d({},n),o||{}),a);e.plugins=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t={},r=0;r<e.length;)t=p(t,e[r++]);return t}(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=At(At(n.sample,null==o?void 0:o.sample),a.sample),i=e,t()}function f(){o=function(e){if(!e)return{};var n=e.sample,t=e.user_id,r=e.timestamp,o=t?{userId:t}:{};if(!n)return o;var i=n.sample_rate,e=n.sample_granularity,t=void 0===e?jt:e,e=n.include_users,n=n.rules,n=void 0===n?[]:n;return d(d({},o),{sample:{include_users:e,sample_rate:i,sample_granularity:t,rules:n.reduce(function(e,n){var t=n.name,r=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[t]={enable:r,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r})}(u),function(e){e=Sn(e);return!!wn().getStorage(e)}(String(i.aid))&&(o.userId=n.userId),s(),c()}};function At(r,o){if(!r||!o)return r||o;var e=d(d({},r),o);return e.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),e.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(e,n){var t;return n in e||(n in(r.rules||{})&&n in(o.rules||{})?(e[n]=d(d({},r.rules[n]),o.rules[n]),e[n].conditional_sample_rules=y(y([],g(r.rules[n].conditional_sample_rules||[]),!1),g(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(t=r.rules)||void 0===t?void 0:t[n])||(null===(t=o.rules)||void 0===t?void 0:t[n])),e},{}),e}function Bt(e){var n={url:(n=wn().getCurrentPages().pop())?(n?tn(n):"")+s(n.options):"",timestamp:Z()};return d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})})}function Ft(e){if(!_n(e))throw Error(U);var t,e=function(e){var t,r,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,c=e.initConfigNormalizer,s=e.validateInitConfig,f={};_.forEach(function(e){return f[e]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(e){if(l)x("already inited");else{if(!(e&&w(e)&&s(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=c(e);if((r=a(n)).setConfig(e),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(e){l&&e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(u(e))),null==r?void 0:r.getConfig()},provide:function(e,n){S(m,e)?x("cannot provide "+e+", reserved"):(v[e]=n,b("provide",!1,e))},start:function(){var n=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(e){return n.build(e)}),h=[]}))},report:function(e){e&&(!(e=O(f.beforeReport)(e))||(e=O(f.report)(e))&&(p?this.build(e):h.push(e)))},build:function(e){!p||(e=O(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=O(f.build)(e))&&this.send(e))},send:function(e){!p||(e=O(f.beforeSend)(e))&&(t.send(e),b("send",!1,e))},destroy:function(){b("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&p||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=E(f[e],n))}},m=Object.keys(v);return v;function b(e,n){void 0===n&&(n=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[e].forEach(function(e){try{e.apply(void 0,y([],g(t),!1))}catch(e){}}),n&&(f[e].length=0)}}({validateInitConfig:Mt,initConfigNormalizer:Nt,userConfigNormalizer:qt,createSender:function(e){return n({size:G,endpoint:It(e.domain),transport:yt()})},builder:Et,createDefaultConfig:Rt,createConfigManager:Lt});return I(e),Gt(e),Vt(e),Ut(e),B(e),st(e),(t=e).on("init",function(){var n=[],e=t.config();e&&e.integrations&&e.integrations.forEach(function(e){S(n,e.name)||(n.push(e.name),e.setup(t),e.tearDown&&t.on("beforeDestroy",e.tearDown))})}),Ht(e),zt(e),e}var zt=function(n){function t(e){return void 0===e&&(e=wn().getSystemInfo()),n.set(d({},e))}function r(){t(),e()}var o,i,a=!1,e=(i="",function(){var e=o.getSender();i=i||e.getEndpoint();var n=o.config(),n={did:n.deviceId,sid:n.sessionId,sname:n.sdkName,sver:n.sdkVersion,soffset:n.offset||0,model:n.model,brand:n.brand,ratio:n.pixelRatio,screen:n.screenArea,window:n.windowArea,lang:n.language,osname:n.osName,osver:n.osVersion,libver:n.SDKVersion,scene:n.scene||-1,menv:n.miniEnv,mver:n.miniVersion,hostname:n.hostName,hostver:n.hostVersion,platform:n.platform,biz_id:n.aid,x_auth_token:n.token};e.setEndpoint(i+s(n))});(o=n).on("start",function(){r(),a=!0}),n.on("init",function(){ke(A.onLaunch).pipe(Je(1)).subscribe(function(e){e=e.param.scene||-1;t({scene:e}),a&&r()}),wn().monitorNetworkType(function(e){e=e.networkType;n.set({networkType:e})})})},Vt=function(r){r.on("beforeBuild",function(e){return n=e,t=r.config(),(e={}).aid=t.aid,e.pid=t.pid,e.view_id=t.viewId,e.user_id=t.userId,e.network_type=t.networkType,d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})});var n,t})},Ut=function(e){e.on("report",Bt)},Ht=function(n){n.on("init",function(){ke(A.onHide).subscribe(function(){var e=n.getSender();e&&e.flush()})})},Gt=function(t){var r,o=!1;t.on("init",function(){r=Z(),t.on("config",function(){var e,n=null===(e=t.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=Z())-r<1e3&&n&&(e=n-(e+r)/2,isNaN(e)||t.set({offset:e})))})})};return function(e){var n,t,r,i,o,a,u,c,s,e=Ft(e);if(e)return(n=e).provide("sendEvent",function(e){e=z(e);e&&n.report({ev_type:F,payload:e,extra:{timestamp:Date.now()}})}),n.provide("sendLog",function(e){e=V(e);e&&n.report({ev_type:F,payload:e,extra:{timestamp:Date.now()}})}),(t=e).on("init",function(){var e,n=zn(t,nt,rt);n&&(n=(e=g(Fn(Yn,d(d({},n),{setPidAndViewId:function(e,n){t.set({pid:e,viewId:n,actionId:void 0})}}),t.report.bind(t)),2))[0],e=e[1],t.provide("sendPageview",n),t.provide("sendPageviewWithHide",e))}),(r=e).on("init",function(){var e,n=zn(r,ot,it);n&&(e=at(r),e=g(Fn(Jn,n,e),1)[0],r.provide("captureException",e))}),(i=e).on("init",function(){var e,n,t,r,o=zn(i,Gn,Kn);o&&(e=o.hookRequest,n=o.hookDownloadFile,t=o.hookUploadFile,r=[],e&&r.push("request"),n&&r.push("downloadFile"),t&&r.push("uploadFile"),Dn(i,r),Fn(Bn,o,i.report.bind(i)))}),(o=e).on("init",function(){var e=zn(o,ft,lt);e&&(Mn(o),Fn(Qn,e,o.report.bind(o)))}),(a=e).on("init",function(){var e,n=zn(a,ct,ut);n&&(n=(e=g(Fn($n,n,function(e){}),2))[0],e=e[1],a.provide("getBreadcrumbs",n),a.provide("addBreadcrumb",e))}),(u=e).on("init",function(){var e=zn(u,pt,dt);e&&(qn(u),Fn(Xn,e,u.report.bind(u)))}),(c=e).on("init",function(){var e=zn(c,ht,mt);e&&Fn(Zn,e,c.report.bind(c))}),(s=e).on("init",function(){var e=zn(s,vt,bt);e&&(qn(s),Fn(et,e,s.report.bind(s)))}),e}.bind(null,[_e])()}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).ttClient=n()}(this,function(){"use strict";function n(e){var t,r=e.transport,o=e.endpoint,n=e.size,i=void 0===n?10:n,e=e.wait,a=void 0===e?1e3:e,u=[],c=0;function s(){var n;u.length&&(n=this.getBatchData(),r.post({url:o,data:n,fail:function(e){t&&t(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),a)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return u.length?(e=u,JSON.stringify({ev_type:"batch",list:e})):"";var e},clear:function(){clearTimeout(c),u=[]},fail:function(e){t=e}}}var r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var d=function(){return(d=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function h(e,n){var t={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}function g(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||((r=r||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(e){return e}function w(e){return"object"==typeof e&&null!==e}var t=Object.prototype;function i(e){if(w(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(e);e=Object.getPrototypeOf(e);return e===t||null===e}}function a(e){return"[object Array]"===t.toString.call(e)}function m(e){return"function"==typeof e}function u(e){return"number"==typeof e}function c(e){return"string"==typeof e}function p(e,n){var t,r,o=d({},e);for(t in n)r=t,Object.prototype.hasOwnProperty.call(n,r)&&void 0!==n[t]&&(w(n[t])&&i(n[t])?o[t]=p(w(e[t])?e[t]:{},n[t]):a(n[t])&&a(e[t])?o[t]=function n(e,t){e=a(e)?e:[];t=a(t)?t:[];return Array.prototype.concat.call(e,t).map(function(e){return e instanceof RegExp?e:w(e)&&i(e)?p({},e):a(e)?n([],e):e})}(e[t],n[t]):o[t]=n[t]);return o}function S(e,n){if(!a(e))return!1;if(0===e.length)return!1;for(var t=0;t<e.length;){if(e[t]===n)return!0;t++}return!1}function E(e,n){if(!a(e))return e;var t=e.indexOf(n);if(0<=t){n=e.slice();return n.splice(t,1),n}return e}function v(e){return a(e)&&e.length?function(e){for(var n=[],t=e.length,r=0;r<t;r++){var o=e[r];c(o)?n.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return new RegExp(n.join("|"),"i")}(e):null}function k(e){try{return c(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function s(t){return w(t)?Object.keys(t).reduce(function(e,n){return e+="&"+n+"="+t[n]},"").replace("&","?"):""}function x(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,y(["[SDK]",Date.now(),(""+P++).padStart(8," ")],g(e),!1))}function o(e){return Math.random()<Number(e)}function f(e,n){return e<Number(n)}function O(r){return function(e){for(var n=e,t=0;t<r.length&&n;t++)try{n=r[t](n)}catch(e){C(e)}return n}}var j=function(i,a,u,c){return void 0===c&&(c=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return l;var t=i[a],r=u.apply(void 0,y([t],g(e),!1)),o=r;return m(o)&&c&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return r.apply(this,n)}catch(e){return m(t)&&t.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=t:r=t)}}},T=0,C=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,y(["[SDK]",Date.now(),(""+T++).padStart(8," ")],g(e),!1))},P=0;function D(){var e=function(){for(var e=new Array(16),n=0,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);var r=0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[+r]],o[e[15]]].join("")}(e)}var I=function(e){var t,r,o,n=(t={},r={},o={set:function(e,n){return t[e]=n,r[e]=k(n),o},merge:function(n){return t=d(d({},t),n),Object.keys(n).forEach(function(e){r[e]=k(n[e])}),o},delete:function(e){return delete t[e],delete r[e],o},clear:function(){return t={},r={},o},get:function(e){return r[e]},toString:function(){return d({},r)}});e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})};function R(e,n){var t=e.common||{};return t.sample_rate=n,e.common=t,e}function N(e,n,t,r,o){return e?(i=o(r,n),function(){return i}):function(){return t(n)};var i}function M(e,n,t,r){if(void 0===(e=function(e,n,t){for(var r,n=g(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(r=g(i))[0],i=r.slice(1);if(e)return t(e,o)}(e,n,function(e,n){return e[n]})))return!1;var o,n="boolean"==typeof e?"bool":u(e)?"number":"string";return function(e,n,t){switch(t){case"eq":return S(n,e);case"neq":return!S(n,e);case"gt":return e>n[0];case"gte":return e>=n[0];case"lt":return e<n[0];case"lte":return e<=n[0];case"regex":return Boolean(e.match(new RegExp(n.join("|"))));case"not_regex":return!e.match(new RegExp(n.join("|")));default:return!1}}(e,(o=n,r.map(function(e){switch(o){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}})),t)}function q(n,e){try{return"rule"===e.type?M(n,e.field,e.op,e.values):"and"===e.type?e.children.every(function(e){return q(n,e)}):e.children.some(function(e){return q(n,e)})}catch(e){return!1}}function L(e,n,t,r){if(!n)return b;var o=n.sample_rate,i=n.include_users,a=n.sample_granularity,u=n.rules,n=void 0===(n=n.r)?Math.random():n;if(S(i,e))return function(e){return R(e,1)};var c,s,f,l,p,d,h,m=N(a="session"===a,o,t,n,r),v=(c=u,s=a,f=o,l=t,p=n,d=r,h={},Object.keys(c).forEach(function(e){var n=c[e],t=n.enable,r=n.sample_rate,n=n.conditional_sample_rules;t?(h[e]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:N(s,r,l,p,d)},n&&(h[e].conditional_hit_rules=n.map(function(e){var n=e.sample_rate,e=e.filter;return{sample_rate:n,hit:N(s,n,l,p,d),effectiveSampleRate:n*f,filter:e}}))):h[e]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(e){if(!m())return!1;if(!(e.ev_type in v))return R(e,o);if(!v[e.ev_type].enable)return!1;if(e.common&&e.common.sample_rate)return e;var n=v[e.ev_type],t=n.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(q(e,t[r].filter))return!!t[r].hit()&&R(e,t[r].effectiveSampleRate);return!!n.hit()&&R(e,n.effectiveSampleRate)}}var A,B=function(t){t.on("start",function(){var e=t.config(),n=e.userId,e=e.sample,e=L(n,e,o,f);t.on("build",e)})},F="custom",z=function(e){if(e&&w(e)&&e.name&&c(e.name)){var n={name:e.name,type:"event"};if("metrics"in e&&w(e.metrics)){var t=e.metrics,r={};for(o in t)u(t[o])&&(r[o]=t[o]);n.metrics=r}if("categories"in e&&w(e.categories)){var o,i=e.categories,a={};for(o in i)a[o]=k(i[o]);n.categories=a}return n}},V=function(e){if(e&&w(e)&&e.content&&c(e.content)){var n={content:k(e.content),type:"log",level:"info"};if("level"in e&&(n.level=e.level),"extra"in e&&w(e.extra)){var t,r=e.extra,o={},i={};for(t in r)u(r[t])?o[t]=r[t]:i[t]=k(r[t]);n.metrics=o,n.categories=i}return n}},U="Adapters imported incorrectly",H=["success","fail","complete"],G=20;(_e=A=A||{}).onLaunch="onLaunch",_e.onShow="onShow",_e.onHide="onHide",_e.onError="onError",_e.onPageNotFound="onPageNotFound",_e.onUnhandledRejection="onUnhandledRejection";function K(e){return"[object Object]"===Object.prototype.toString.call(e)}var J=["request","downloadFile","uploadFile"],W=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],Y=y(y([],g([A.onLaunch,A.onShow,A.onHide]),!1),[A.onError,A.onPageNotFound,A.onUnhandledRejection],!1),$=["attached","onInit"],Q=["onLoad","onShow","onReady","onUnload","onHide"],X="__HOOKED__";var Z=function(){return Date.now()};function ee(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!m(e))return 0;var r,o=Z();try{e.apply(this,n)}finally{r=Z()}return r-o}var ne,te=function(){},re=g((ne="tt",[function(){return ne},function(e){return ne=e}]),2),oe=re[0];re[1];function ie(e,n,r){var o=e[n];if(!o||!o[X])return Object.defineProperty(e,n,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{var t=r.apply(this,e);t&&(e=t)}catch(e){C(e)}return o.apply(this,e)}}),e[n]&&(e[n][X]=!0),function(){e[n][X]=!1,r=te}}function ae(t,e){Object.keys(e).forEach(function(n){e[n].addTearDown(function(){var e;return Se(t,((e={})[n]=null,e))})})}function ue(e,n){n.addTearDown(function(){return we(e,null)})}function ce(e){return Ee("route")[e]}function se(e){return!!Ee("route")[e]}function fe(e){return Ee("http")[e]}function le(e){return!!Ee("http")[e]}function pe(){return Ee("setData")}function de(){return!!Ee("performance")}function he(){return Ee("instance")}function me(e){we("instance",e)}var ve=function(n,t){function e(e){return t(e),n.call(this,e)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},be=function(){var e={instance:null};return e.instance||("undefined"!=typeof tt?e={instance:tt,platform:oe()}:"undefined"!=typeof my?e={instance:my,platform:"my"}:"undefined"!=typeof swan?e={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(e={instance:wx,platform:"wx"})),e},ge="__slardar__global__0.2.3-alpha.0",ye={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},_e=function(e,n){void 0===e&&(e={});var t=(n=void 0===n?be().instance:n)?n[ge]||(n[ge]=e):e;return{setGlobalValue:function(e,n){t[e]=n},mergeGlobalValue:function(e,n){t[e]=d(d({},t[e]),n)},getGlobalValue:function(e){return t[e]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},ye),n&&(n[ge]=t)}}}(d({},ye)),we=_e.setGlobalValue,Se=_e.mergeGlobalValue,Ee=_e.getGlobalValue,ke=function(e){return Ee("app")[e]},xe=function(e){return Ee("page")[e]},Oe=function(t){W.forEach(function(n){se(n)&&ce(n).subscribe(function(e){return t(e,n)})})},je=function(){return Ee("performance")},Te=function(e){return Ee("component")[e]};function Ce(e){return"function"==typeof e}function Pe(e,n){!e||0<=(n=e.indexOf(n))&&e.splice(n,1)}function De(e){return e}function Ie(t){return function(e){if((n=e)&&Ce(n.lift))return e.lift(function(e){try{return t(e,this)}catch(e){this.error(e)}});var n;throw new TypeError("Unable to lift unknown Observable type")}}function Re(e){Ce(e)?e():null!=e&&e.unsubscribe()}var Ne=function(e){return e instanceof Me||e&&"closed"in e&&Ce(e.remove)&&Ce(e.add)&&Ce(e.unsubscribe)},Me=(qe.prototype.unsubscribe=function(){var e,n,t,r=this;this.closed||(this.closed=!0,e=this._parentage,n=this._finalizers,t=this.initialTeardown,e&&(this._parentage=null,e.forEach(function(e){return e.remove(r)})),Ce(t)&&t(),n&&(this._finalizers=null,n.forEach(Re)))},qe.prototype.remove=function(e){this._finalizers&&Pe(this._finalizers,e),e instanceof qe&&e._removeParent(this)},qe.prototype.add=function(e){if(e&&e!==this)if(this.closed)Re(e);else{if(e instanceof qe){if(e.closed||e._hasParent(this))return;e._addParent(this)}var n=this._finalizers;this._finalizers=n?(n.push(e),n):[e]}},qe.prototype._addParent=function(e){var n=this._parentage;this._parentage=n?(n.push(e),n):[e]},qe.prototype._hasParent=function(e){return this._parentage&&~this._parentage.indexOf(e)},qe.prototype._removeParent=function(e){this._parentage&&Pe(this._parentage,e)},qe);function qe(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var Le,Ae=(e(Be,Le=Me),Be.prototype.next=function(e){this.isStopped||this.destination.next(e)},Be.prototype.error=function(e){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(e)}finally{this.unsubscribe()}}},Be.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Be.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Le.prototype.unsubscribe.call(this),this.destination=null)},Be.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Be);function Be(e){var n=Le.call(this)||this;return n.isStopped=!1,n.destination=Ve(e)?e:new Fe(!(e=e)||Ce(e)?{next:null!=e?e:void 0}:e),n}var Fe=(ze.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(e){console.error("ConsumerObserver.next error",e)}},ze.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(e){console.error("ConsumerObserver.error error",e)}},ze.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){console.error("ConsumerObserver.complete error",e)}},ze);function ze(e){this.partialObserver=e}function Ve(e){return e instanceof Ae||e&&((n=e)&&Ce(n.next)&&Ce(n.error)&&Ce(n.complete))&&Ne(e);var n}Ue.prototype.subscribe=function(e){var n=Ve(e)?e:new Ae(e),t=this.operator,e=this.source;return n.add(t?t.call(n,e):this._trySubscribe(n)),n},Ue.prototype.lift=function(e){var n=new Ue;return n.source=this,n.operator=e,n},Ue.prototype.pipe=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(n=e).length?De:1===n.length?n[0]:function(e){return n.reduce(function(e,n){return n(e)},e)})(this)},Ue.prototype._subscribe=function(e){},Ue.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},re=Ue;function Ue(e){e&&(this._subscribe=e)}var He,_e=(e(Ge,He=re),Ge.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(e){return e.next(n)})},Ge.prototype.commonJudgement=function(e){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,e())},Ge.prototype.error=function(n){var t=this;this.commonJudgement(function(){var e=t.observers;for(t.hasError=!0,t.thrownError=n;e.length;)e.shift().error(n)})},Object.defineProperty(Ge.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Ge.prototype.complete=function(){var n=this;this.commonJudgement(function(){for(var e=n.observers;e.length;)e.shift().complete()})},Ge.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Ge.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Ge.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},Ge.prototype._checkFinalizedStatuses=function(e){var n=this.hasError,t=this.thrownError,r=this.isStopped;n?e.error(t):r&&e.complete()},Ge.prototype._innerSubscribe=function(e){var n=this.isStopped,t=this.observers;return n?Ge.EMPTY:(t.push(e),new Me(function(){Pe(t,e)}))},Ge.EMPTY=((_e=new Me).closed=!0,_e),Ge);function Ge(){var e=null!==He&&He.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var Ke=new re(function(e){return e.complete()});function Je(r){return r<=0?function(){return Ke}:Ie(function(e,n){var t=0;e.subscribe(function(e){++t<=r&&(n.next(e),r<=t&&n.complete())})})}function We(r,o){return Ie(function(e,n){var t=0;e.subscribe(function(e){return r.call(o,e,t++)&&n.next(e)})})}function Ye(t){return We(function(e,n){return t<=n})}var $e,Qe=(e(Xe,$e=_e),Xe.prototype.subscribe=function(e){var t=this,e=$e.prototype.subscribe.call(this,e);he()&&he()._subscriptions.push(e);var r=e.unsubscribe;return e.unsubscribe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(this,e),t.observed||t.unsubscribe()},e},Xe.prototype.unsubscribe=function(){$e.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(e){return e()})},Xe.prototype.addTearDown=function(e){this.tearDownFns.push(e)},Xe);function Xe(){var e=null!==$e&&$e.apply(this,arguments)||this;return e.tearDownFns=[],e}function Ze(e){var n=e.reduce(function(e,n){return e[n]=new Qe,e},{});return{getSubject:function(e){return n[e]},subjectMap:n}}function en(e){return 1<e.length?e:e.length&&e[0]||{}}function nn(e){var t=e.filter(function(e){return e=e,!!!Ee("app")[e]}),e=Ze(t).subjectMap;Se("app",e=e),ae("app",e),App=ve(App,function(n){t.forEach(function(e){var r=ke(e),e=j(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.next({that:this,param:en(e),time:Z()}),m(t)&&t.apply(this,e)}})();e&&r.addTearDown(e)})})}function tn(e){return e.route||e.__route__||e.url||e.path||""}function rn(e){function n(e,i){r.forEach(function(o){j(e,o,function(r){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];Te(o).next({that:this,param:null,time:Z()});var t=i[o];if(m(t)&&t.apply(this,e),m(r))return r.apply(this,e)}})()})}var t=["attached"],r=e.filter(function(e){return~t.indexOf(e)});try{Component=ve(Component,function(e){w(e.lifetimes)?n(e.lifetimes,e):void 0!==e.lifetimes&&null!==e.lifetimes||(e.lifetimes={},n(e.lifetimes,e))})}catch(e){}}function on(e){function n(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(e(d({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;Oe(function(e,n){"invoke"===e.param.name&&(o=!1,r={navigate_start:e.time,navigate_name:n})}),xe("onLoad").pipe(Ye(1)).subscribe(function(e){r.load_start=e.time}),xe("onShow").pipe(Ye(1)).subscribe(function(e){r.dom_end=e.time}),xe("onReady").pipe(Ye(1)).subscribe(function(e){r.render_end=e.time,n(),t()}),ke(A.onHide).subscribe(function(){!1===o&&(n(),t())})}function an(n){var t=["downloadPackage","evaluateScript","fcp","fp","fr"];je().subscribe(function(e){~t.indexOf(e.name)&&n(e)})}function un(n){Te("attached").subscribe(function(e){e=e.that;return n.call(e)})}function cn(e){return"android"===e.toLowerCase()}function sn(e){return cn(e)?"Android":"ios"===e.toLowerCase()?"iOS":~kn.indexOf(e.toLowerCase())?"Mac":~xn.indexOf(e.toLowerCase())?"windows":"unknown"}function fn(e){var n=e.systemPlatform,t=e.pixelRatio,r=e.width,e=e.height;return n&&cn(n)&&t?r/t+" * "+e/t:r+" * "+e}function ln(e){void 0===e&&(e="tt");var n,t="",r="",o="";return tt.getEnvInfoSync?(r=(n=tt.getEnvInfoSync().microapp).envType,t=n.appId,o=n.mpVersion):(r=tt.env.VERSION,t=""),d({appId:t,miniEnv:r,miniVersion:o,platform:e},Cn())}function pn(n){var e=xe("onReady").subscribe(function(){var e;tt.performance&&(e=(tt.performance.getCurrentPageEntries()||[]).map(function(e){e.name,e.entryType;var n=h(e,["name","entryType"]),t=Pn(e);return t?d(d({},n),t):e}),n(e))});return{disconnect:function(){return e.unsubscribe()}}}function dn(e){var n=e.filter(function(e){return e=e,!!!Ee("component")[e]}),e=Ze(n).subjectMap;Se("component",e=e),ae("component",e),wn().componentSubject(n)}function hn(n){function e(e){K(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))}try{Component=ve(Component,e),Behavior=ve(Behavior,e)}catch(e){}}function mn(e,n){var t=e.filter(function(e){return e=e,!!!Ee("page")[e]}),e=Ze(t).subjectMap;Se("page",e=e),ae("page",e),e=function(n){t.forEach(function(e){var r=xe(e),e=j(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(tn(this)&&r.next({that:this,param:en(e),time:Z()}),m(t))return t.apply(this,e)}})();e&&r.addTearDown(e)})},Page=ve(Page,e),hn(e)}function vn(e){var n=e.filter(function(e){return!se(e)}),t=Ze(n).subjectMap;Se("route",e=t),ae("route",e),n.forEach(function(i){var e=ie(wn().instance,i,function(o){void 0===o&&(o={}),ce(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:Z()}),H.forEach(function(r){j(o,r,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];ce(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:en(e)||{}},time:Z()}),m(t)&&t.apply(this,e)}})()})});e&&t[i].addTearDown(e)})}function bn(u,e){var n=e.url,t=e.method,r=e.data,o=e.header,i=e.headers,c={api:u,request:{url:n,method:(n=t,"uploadFile"===(t=u)?"POST":"downloadFile"!==t&&n||"GET"),headers:o||i||{},body:k(r),timestamp:Z()},response:{}};j(e,"complete",function(a){return function(e){var n=c.response.timestamp||Z();c.duration=n-c.request.timestamp,c.completeCallbackTime=ee(a,e);var t,r,o,i=e.errMsg||e.errorMessage||e.error;c.response={status:(t=e.status,r=e.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:n,headers:e.header||e.headers||{},body:k(e.data),errMsg:i,timing:wn().buildRequestProfile(e.profile||{})},fe(u).next(c)}})(),j(e,"success",function(n){return function(e){c.response.timestamp=Z(),c.response.status=200,c.successCallbackTime=ee(n,e)}})(),j(e,"fail",function(n){return function(e){c.response.timestamp=Z(),c.response.status=-1,c.failCallbackTime=ee(n,e)}})()}function gn(e,t){void 0===t&&(t=wn().instance);var n=e.filter(function(e){return!le(e)}),r=Ze(n).subjectMap;Se("http",e=r),ae("http",e),n.forEach(function(n){var e=ie(t,n,function(e){bn(n,e)});e&&r[n].addTearDown(e)})}var yn,re=g((yn={},[function(e){if(!be().platform)throw Error("Not support current Mini Program");if(!Array.isArray(e)||!e.length)return null;e=e.find(function(e){return e.platform===be().platform});return e&&(yn=e.adapterCtor())},function(){return yn}]),2),_n=re[0],wn=re[1],Sn=function(e){return"SLARDAR"+e},En=function(e){try{return wn().getStorage(e)}catch(e){return}},kn=["darwin","macs","mac"],xn=["windows_nt","windows","window"],On=function(e){return function(e){var n,t={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&void 0!==e[n]&&null!==e[n]&&(t[n]=e[n]);return t}({domainLookupStart:e.domainLookupStart,domainLookupEnd:e.domainLookupEnd,connectStart:e.connectStart,secureConnectionStart:e.SSLconnectionStart,connectEnd:e.connectEnd,requestStart:e.requestStart,requestEnd:e.requestEnd,responseStart:e.responseStart,responseEnd:e.responseEnd,socketReused:e.socketReused,redirectStart:e.redirectStart,redirectEnd:e.redirectEnd,fetchStart:e.fetchStart,sendBytesCount:e.sendBytesCount,throughputKbps:e.throughputKbps,receivedBytedCount:e.receivedBytedCount})},jn=function(e){return{name:"unknown_error_name",message:k(e)}},Tn=function(e){var n=e.split("\n"),n=g((n[0]&&n[0].split(":")||[]).map(function(e){return e.trim()}),2);return{name:n[0],message:n[1],stack:e}},Cn=function(){var e=tt.getSystemInfoSync(),n=e.model,t=e.brand,r=e.pixelRatio,o=e.screenHeight,i=e.screenWidth,a=e.windowHeight,u=e.windowWidth,c=e.language,s=e.version,f=e.system,l=e.platform,p=e.SDKVersion,e=e.appName;return{model:n,brand:t,pixelRatio:r,screenArea:fn({width:i,height:o}),windowArea:fn({width:u,height:a}),language:c,osName:sn(l),osVersion:f,SDKVersion:p,hostName:e,hostVersion:s}},Pn=function(e){if("navigation"===e.entryType)return{name:"route",entryType:"navigation",path:e.name};switch(e.name){case"app-click":return{name:"appClick",entryType:"navigation"};case"miniprogram-package\t":return{name:"downloadPackage",entryType:"loadPackage"};case"first-paint":return{name:"fp",entryType:"render"};default:return null}},_e={platform:"tt",adapterCtor:function(){return d(d({},{instance:t=void 0===t?be().instance:t,request:function(e){return t.request(e)},getStorage:function(e){return t.getStorageSync(e)},setStorage:function(e,n){return t.setStorageSync(e,n)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(e){return e},monitorNetworkType:function(n){t.getNetworkType({success:function(e){n&&n({networkType:e.networkType})}}),t.onNetworkStatusChange(function(e){n&&n({networkType:e.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:"tt",buildError:function(e){return(c(e=e)?Tn:jn)(e)},getSystemInfo:ln,observePerformance:pn,performanceSubscriber:an,buildRequestProfile:function(e){return On(e)},componentSubject:rn,pagePerfSubscriber:on,setDataSubject:un});var t}},Dn=function(e,n){void 0===n&&(n=J),e.on("init",function(){gn(n)})};function In(){var a=tn(this),u=pe();var e=ie(this,"setData",function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=r[0],i=Z();return[o,function(){var e=r[1],n=Z()-i;u.next({renderTime:n,url:a,data:o,startTime:i}),e&&e.call(t)}]});e&&u.addTearDown(e)}function Rn(){var e;Ee("setData")||(e=(e=Ze(["setData"]).getSubject)("setData"),we("setData",e),ue("setData",e))}function Nn(o){return Object.keys(o).reduce(function(e,n){var t,r;return r=o[t=n],t&&r&&(Ln.test(t)||An.test(r))||(e[n]=o[n]),e},{})}var Mn=function(e){e.on("init",function(){Rn(),xe("onLoad").subscribe(function(e){e=e.that;In.call(e)}),wn().setDataSubject(In)})},qn=function(e){e.on("init",function(){var n,e,t,r=wn();r.observePerformance&&!de()&&(n=(0,Ze(["performance"]).getSubject)("performance"),we("performance",e=n),ue("performance",e),(t=r.observePerformance(function(e){e.forEach(function(e){n.next(e)})}))&&t.disconnect&&n.addTearDown(function(){return t.disconnect()}))})},Ln=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),An=new RegExp("(bearer|session)","i"),Bn=function(){return function(e,s){var n=e.hookRequest,t=e.hookDownloadFile,r=e.hookUploadFile,f=e.ignoreUrls,l=e.collectBodyOnError,p=e.extraExtractor,e=function(e){var n,t,r,o,i,a,u,c;!function(e,n){e=v(e||[]);return!!e&&e.test(n)}(f,e.request.url)&&(c=e.response,n=e.request,t=e.api,r=e.duration,o=e.failCallbackTime,u=e.successCallbackTime,i=e.completeCallbackTime,n.headers=Nn(n.headers||{}),c.headers=Nn(c.headers||{}),a=c.errMsg,e=h(c,["errMsg"]),e=d(d({},e),{is_custom_error:!1}),a&&(e.err_msg=a),u={api:t,request:n,duration:r,cbTime:i+(o||0)+(u||0),response:e},!m(p)||(e=p(c.body,u))&&(u.extra=e,u.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete u.request.body,delete u.response.body),s({ev_type:"http",payload:u}))};n&&fe("request").subscribe(e),t&&fe("downloadFile").subscribe(e),r&&fe("uploadFile").subscribe(e)}},Fn=function(e,n,t,r){void 0===n&&(n={}),void 0===r&&(r=[]);try{var o=e.apply(void 0,y([],g(r),!1));return o&&o(n,t)||[]}catch(e){return C("applyMonitor",e),[]}};function zn(e,n,t){me(e);n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return w(n)?d(d({},t),n):!!n&&t}function Vn(e,n){return e&&n&&e===n}function Un(){var r;return function(e){try{if(t=r,!(!(n=e)||!t)&&!(!Vn(n.message,t.message)&&!Vn(n.stack,t.stack)))return void(r=e)}catch(e){}var n,t;return r=e}}var Hn,Gn="http",Kn={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},Jn=function(f){return void 0===f&&(f=wn()),function(e,r){var n=e.ignoreErrors,t=e.hookOnError,o=e.hookOnUnhandledRejection,i=e.hookRouteError,a=e.dedupe,u=v(n),c=Un(),s=function(e,n,t){e=a?c(e):e;e&&(u&&u.test(e.message)||(e={error:e},n&&(e.extra=n),t&&(e.react=t),r(e)))};t&&ke(A.onError).subscribe(function(e){e=e.param,e=f.buildError(e);u&&u.test(e.message)||s(e)}),o&&ke(A.onUnhandledRejection).subscribe(function(e){var n=e.param||{},e=n.promise,t=k(n.reason);u&&u.test(t)||e.catch(b).then(function(e){var n={name:"UnhandledRejection",message:t};e&&e.stack&&(n.stack=e.stack),s(n)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&Oe(function(e){e=e.param;"fail"===(e=e).name&&s({name:"RouteError",message:e.value.errMsg})}),[s]}};(re=Hn=Hn||{}).history="history",re.manual="manual";function Wn(t,e,r){var o=e,i=null,a=0,n="launch";function u(e,n){o=n,a=Z(),r(n,i=n+"_"+a),t(e,n)}return ke(A.onShow).pipe(Ye(1)).subscribe(function(){n="show"}),Oe(function(){n="history"}),[u,function(e){e&&(u(n,e),n="history")},function(e){void 0===e&&(e="hide"),i&&(r(o,i),i=null,t(e,o,Z()-a))}]}var Yn=function(){return function(e,r){var n=e.extractPid,t=e.routeMode,o=e.setPidAndViewId,i=function(e){return n?n(e):e},e=g(Wn(function(e,n,t){r({ev_type:"pageview",payload:{pid:n,source:e,duration:t}})},"",o),3),o=e[0],a=e[1],e=e[2];return t!==Hn.manual&&(xe("onShow").subscribe(function(e){return function(e){e=tn(e),e=i(e);a(e)}(e.that)}),xe("onUnload").subscribe(e.bind(null,"unload")),xe("onHide").subscribe(e.bind(null,"hide"))),[o.bind(null,"user_set"),e]}},$n=function(){return function(e){var n=g(function(n,t,r){void 0===n&&(n=20),void 0===t&&(t=b),void 0===r&&(r=function(e,n){return e.slice(-n)});var o=[];return[function(){return o},function(e){t(e)&&(e=d(d({},e),{timestamp:e.timestamp||Date.now()}),o=0<=n&&o.length+1>n?r(y(y([],g(o),!1),[e],!1),n):y(y([],g(o),!1),[e],!1))}]}(e.maxBreadcrumbs,e.onAddBreadcrumb,e.onMaxBreadcrumbs),2),e=n[0],r=n[1];return J.forEach(function(e){le(e)&&fe(e).subscribe(function(e){r({type:"http",category:e.api,message:"",data:{method:e.request.method,url:e.request.url,status_code:String(e.response.status)},timestamp:e.request.timestamp})})}),Oe(function(e,n){var t=e.param,e=e.time;"complete"===t.name&&r({type:"route",category:n,message:t.value.errMsg||t.value.errorMessage||"",timestamp:e,data:{url:t.url||""}})}),[e,r]}},Qn=function(){return function(e,t){var r=e.isCalculateSize;pe().subscribe(function(e){var n={duration:e.renderTime,start_time:e.startTime};r&&(n.size=(e=e.data,TextEncoder?(new TextEncoder).encode(k(e)).length:2*k(e).length)),t({ev_type:"set_data",payload:n})})}},Xn=function(){return function(e,n){function t(){n({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;ke(A.onLaunch).pipe(Je(1)).subscribe(function(e){r.activate_start=e.time}),ke(A.onShow).pipe(Je(1)).subscribe(function(e){r.init_end=e.time}),xe("onLoad").pipe(Je(1)).subscribe(function(e){r.page_load_start=e.time}),xe("onShow").pipe(Je(1)).subscribe(function(e){r.page_dom_end=e.time});var i=de();xe("onReady").pipe(Je(1)).subscribe(function(e){r.page_render_end=e.time,i&&!r.trigger||t()}),i&&je().pipe(We(function(e){return"appClick"===e.name}),Je(1)).subscribe(function(e){r.trigger=e.startTime,r.page_render_end&&t()}),ke(A.onHide).subscribe(function(){o||t()})}},Zn=function(){return function(e,n){wn().pagePerfSubscriber(function(e){return n({ev_type:"page_perf",payload:e})})}},et=function(n){return void 0===n&&(n=wn()),function(e,t){var r,o;de()&&n.performanceSubscriber&&(r=0,xe("onLoad").subscribe(function(e){o=e.time,r++}),n.performanceSubscriber(function(e){var n={is_custom:!1,name:e.name,value:e.startTime,type:"perf",count:r};n.duration=e.duration||(o?e.startTime-o:0),n.is_support=0<=n.duration,t({ev_type:"performance",payload:n})}))}},nt="pageview",rt={routeMode:Hn.history,setPidAndViewId:function(e,n){}},ot="jsError",it={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},at=function(t){return function(e){var n=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},e),{breadcrumbs:n})})}},ut={maxBreadcrumbs:20,tap:!0},ct="breadcrumb",st=function(n){n.on("init",function(){n.provide("_subscriptions",[]),me(n),n.on("init",function(){nn(Y),mn(Q),dn($)}),n.on("init",function(){vn(W)})}),n.on("beforeDestroy",function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]})},ft="setData",lt={isCalculateSize:!1},pt="appLaunchPerf",dt={},ht="pagePerf",mt={},vt="performance",bt={},gt=function(e,n,t){void 0===t&&(t=wn());var r=n.url,o=n.data,i=n.success,a=void 0===i?l:i,u=n.fail,c=void 0===u?l:u,i=n.header,u={"Content-Type":"application/json"};K(n=i)&&0!==Object.keys(n).length&&Object.assign(u,i),t.request({method:e,url:r,data:o,header:u,headers:u,success:function(e){a(e)},fail:function(e){e=e.errMsg||"Network request failed";c(new Error(e))}})},yt=function(n){return(n=void 0===n?wn():n)?{get:function(e){return gt("GET",e,n)},post:function(e){return gt("POST",e,n)}}:{get:l,post:l}};function _t(e){return e=Sn(String(e)),(e=En(e))&&e.userId&&e.deviceId?e:{userId:D(),deviceId:D()}}function wt(e){return e+"_"+Date.now()}function St(e){var n=e.aid,t=e.userId,e=e.deviceId;!function(e,n){try{wn().setStorage(e,n)}catch(e){}}(Sn(String(n)),{userId:t,deviceId:e})}var Et={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:d(d({},e.extra||{}),e.overrides||{})}}},kt="/monitor_mini/collect",xt="/settings/minipro",Ot="apmplus.volces.com",jt="session",Tt={sample_rate:1,include_users:[],sample_granularity:jt,rules:{}},Ct=[kt,xt],Pt="0.2.3-alpha.0",Dt="APM_PLUS_MINI_PROGRAM",It=function(e,n){return void 0===n&&(n=kt),(e&&0<=e.indexOf("//")?"":"https://")+e+n};function Rt(e){e=_t(e.aid);return{aid:0,token:"",pid:"",viewId:wt("_"),userId:e.userId,deviceId:e.deviceId,sessionId:D(),domain:Ot,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:Ct},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:Tt,sdkName:Dt,sdkVersion:Pt}}function Nt(e){var n,t=e.plugins||{};for(n in t)t[n]&&!w(t[n])&&(t[n]={});return d(d({},e),{plugins:t})}function Mt(e){return w(e)&&"aid"in e&&"token"in e}function qt(e){return d({},e)}var Lt=function(n){var r,o,i=n,a={},u=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(e){var n,t;return a=d(d({},a),e||{}),s(),r||(r=e,i.useLocalConfig||!i.aid?(o={},c()):u?f():(n=i.domain,e=i.aid,t=function(e){u=e,f()},yt().get({url:function(e,n){return void 0===n&&(n=xt),(e&&0<=e.indexOf("//")?"":"https://")+e+n}(n)+"?biz_id="+e,success:function(e){t(e&&e.data&&e.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(e){t=e},onReady:function(e){c=function(){St(i),e()},o&&c()}};function s(){var e=d(d(d({},n),o||{}),a);e.plugins=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t={},r=0;r<e.length;)t=p(t,e[r++]);return t}(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=At(At(n.sample,null==o?void 0:o.sample),a.sample),i=e,t()}function f(){o=function(e){if(!e)return{};var n=e.sample,t=e.user_id,r=e.timestamp,o=t?{userId:t}:{};if(!n)return o;var i=n.sample_rate,e=n.sample_granularity,t=void 0===e?jt:e,e=n.include_users,n=n.rules,n=void 0===n?[]:n;return d(d({},o),{sample:{include_users:e,sample_rate:i,sample_granularity:t,rules:n.reduce(function(e,n){var t=n.name,r=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[t]={enable:r,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r})}(u),function(e){e=Sn(e);return!!wn().getStorage(e)}(String(i.aid))&&(o.userId=n.userId),s(),c()}};function At(r,o){if(!r||!o)return r||o;var e=d(d({},r),o);return e.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),e.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(e,n){var t;return n in e||(n in(r.rules||{})&&n in(o.rules||{})?(e[n]=d(d({},r.rules[n]),o.rules[n]),e[n].conditional_sample_rules=y(y([],g(r.rules[n].conditional_sample_rules||[]),!1),g(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(t=r.rules)||void 0===t?void 0:t[n])||(null===(t=o.rules)||void 0===t?void 0:t[n])),e},{}),e}function Bt(e){var n={url:(n=wn().getCurrentPages().pop())?(n?tn(n):"")+s(n.options):"",timestamp:Z()};return d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})})}function Ft(e){if(!_n(e))throw Error(U);var t,e=function(e){var t,r,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,c=e.initConfigNormalizer,s=e.validateInitConfig,f={};_.forEach(function(e){return f[e]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(e){if(l)x("already inited");else{if(!(e&&w(e)&&s(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=c(e);if((r=a(n)).setConfig(e),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(e){l&&e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(u(e))),null==r?void 0:r.getConfig()},provide:function(e,n){S(m,e)?x("cannot provide "+e+", reserved"):(v[e]=n,b("provide",!1,e))},start:function(){var n=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(e){return n.build(e)}),h=[]}))},report:function(e){e&&(!(e=O(f.beforeReport)(e))||(e=O(f.report)(e))&&(p?this.build(e):h.push(e)))},build:function(e){!p||(e=O(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=O(f.build)(e))&&this.send(e))},send:function(e){!p||(e=O(f.beforeSend)(e))&&(t.send(e),b("send",!1,e))},destroy:function(){b("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&p||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=E(f[e],n))}},m=Object.keys(v);return v;function b(e,n){void 0===n&&(n=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[e].forEach(function(e){try{e.apply(void 0,y([],g(t),!1))}catch(e){}}),n&&(f[e].length=0)}}({validateInitConfig:Mt,initConfigNormalizer:Nt,userConfigNormalizer:qt,createSender:function(e){return n({size:G,endpoint:It(e.domain),transport:yt()})},builder:Et,createDefaultConfig:Rt,createConfigManager:Lt});return I(e),Gt(e),Vt(e),Ut(e),B(e),st(e),(t=e).on("init",function(){var n=[],e=t.config();e&&e.integrations&&e.integrations.forEach(function(e){S(n,e.name)||(n.push(e.name),e.setup(t),e.tearDown&&t.on("beforeDestroy",e.tearDown))})}),Ht(e),zt(e),e}var zt=function(n){function t(e){return void 0===e&&(e=wn().getSystemInfo()),n.set(d({},e))}function r(){t(),e()}var o,i,a=!1,e=(i="",function(){var e=o.getSender();i=i||e.getEndpoint();var n=o.config(),n={did:n.deviceId,sid:n.sessionId,sname:n.sdkName,sver:n.sdkVersion,soffset:n.offset||0,model:n.model,brand:n.brand,ratio:n.pixelRatio,screen:n.screenArea,window:n.windowArea,lang:n.language,osname:n.osName,osver:n.osVersion,libver:n.SDKVersion,scene:n.scene||-1,menv:n.miniEnv,mver:n.miniVersion,hostname:n.hostName,hostver:n.hostVersion,platform:n.platform,biz_id:n.aid,x_auth_token:n.token};e.setEndpoint(i+s(n))});(o=n).on("start",function(){r(),a=!0}),n.on("init",function(){ke(A.onLaunch).pipe(Je(1)).subscribe(function(e){e=e.param.scene||-1;t({scene:e}),a&&r()}),wn().monitorNetworkType(function(e){e=e.networkType;n.set({networkType:e})})})},Vt=function(r){r.on("beforeBuild",function(e){return n=e,t=r.config(),(e={}).aid=t.aid,e.pid=t.pid,e.view_id=t.viewId,e.user_id=t.userId,e.network_type=t.networkType,d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})});var n,t})},Ut=function(e){e.on("report",Bt)},Ht=function(n){n.on("init",function(){ke(A.onHide).subscribe(function(){var e=n.getSender();e&&e.flush()})})},Gt=function(t){var r,o=!1;t.on("init",function(){r=Z(),t.on("config",function(){var e,n=null===(e=t.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=Z())-r<1e3&&n&&(e=n-(e+r)/2,isNaN(e)||t.set({offset:e})))})})};return function(e){var n,t,r,i,o,a,u,c,s,e=Ft(e);if(e)return(n=e).provide("sendEvent",function(e){e=z(e);e&&n.report({ev_type:F,payload:e,extra:{timestamp:Date.now()}})}),n.provide("sendLog",function(e){e=V(e);e&&n.report({ev_type:F,payload:e,extra:{timestamp:Date.now()}})}),(t=e).on("init",function(){var e,n=zn(t,nt,rt);n&&(n=(e=g(Fn(Yn,d(d({},n),{setPidAndViewId:function(e,n){t.set({pid:e,viewId:n,actionId:void 0})}}),t.report.bind(t)),2))[0],e=e[1],t.provide("sendPageview",n),t.provide("sendPageviewWithHide",e))}),(r=e).on("init",function(){var e,n=zn(r,ot,it);n&&(e=at(r),e=g(Fn(Jn,n,e),1)[0],r.provide("captureException",e))}),(i=e).on("init",function(){var e,n,t,r,o=zn(i,Gn,Kn);o&&(e=o.hookRequest,n=o.hookDownloadFile,t=o.hookUploadFile,r=[],e&&r.push("request"),n&&r.push("downloadFile"),t&&r.push("uploadFile"),Dn(i,r),Fn(Bn,o,i.report.bind(i)))}),(o=e).on("init",function(){var e=zn(o,ft,lt);e&&(Mn(o),Fn(Qn,e,o.report.bind(o)))}),(a=e).on("init",function(){var e,n=zn(a,ct,ut);n&&(n=(e=g(Fn($n,n,function(e){}),2))[0],e=e[1],a.provide("getBreadcrumbs",n),a.provide("addBreadcrumb",e))}),(u=e).on("init",function(){var e=zn(u,pt,dt);e&&(qn(u),Fn(Xn,e,u.report.bind(u)))}),(c=e).on("init",function(){var e=zn(c,ht,mt);e&&Fn(Zn,e,c.report.bind(c))}),(s=e).on("init",function(){var e=zn(s,vt,bt);e&&(qn(s),Fn(et,e,s.report.bind(s)))}),e}.bind(null,[_e])()}); |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).wxClient=n()}(this,function(){"use strict";function n(e){var t,r=e.transport,o=e.endpoint,n=e.size,i=void 0===n?10:n,e=e.wait,u=void 0===e?1e3:e,a=[],c=0;function s(){var n;a.length&&(n=this.getBatchData(),r.post({url:o,data:n,fail:function(e){t&&t(e,n)}}),a=[])}return{getSize:function(){return i},getWait:function(){return u},setSize:function(e){i=e},setWait:function(e){u=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){a.push(e),a.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),u)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return a.length?(e=a,JSON.stringify({ev_type:"batch",list:e})):"";var e},clear:function(){clearTimeout(c),a=[]},fail:function(e){t=e}}}var r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var d=function(){return(d=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function g(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),u=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||((r=r||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(e){return e}function w(e){return"object"==typeof e&&null!==e}var t=Object.prototype;function i(e){if(w(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(e);e=Object.getPrototypeOf(e);return e===t||null===e}}function u(e){return"[object Array]"===t.toString.call(e)}function h(e){return"function"==typeof e}function a(e){return"number"==typeof e}function c(e){return"string"==typeof e}function p(e,n){var t,r,o=d({},e);for(t in n)r=t,Object.prototype.hasOwnProperty.call(n,r)&&void 0!==n[t]&&(w(n[t])&&i(n[t])?o[t]=p(w(e[t])?e[t]:{},n[t]):u(n[t])&&u(e[t])?o[t]=function n(e,t){e=u(e)?e:[];t=u(t)?t:[];return Array.prototype.concat.call(e,t).map(function(e){return e instanceof RegExp?e:w(e)&&i(e)?p({},e):u(e)?n([],e):e})}(e[t],n[t]):o[t]=n[t]);return o}function S(e,n){if(!u(e))return!1;if(0===e.length)return!1;for(var t=0;t<e.length;){if(e[t]===n)return!0;t++}return!1}function x(e,n){if(!u(e))return e;var t=e.indexOf(n);if(0<=t){n=e.slice();return n.splice(t,1),n}return e}function m(e){return u(e)&&e.length?function(e){for(var n=[],t=e.length,r=0;r<t;r++){var o=e[r];c(o)?n.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return new RegExp(n.join("|"),"i")}(e):null}function v(e){try{return c(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function s(t){return w(t)?Object.keys(t).reduce(function(e,n){return e+="&"+n+"="+t[n]},"").replace("&","?"):""}function E(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,y(["[SDK]",Date.now(),(""+P++).padStart(8," ")],g(e),!1))}function o(e){return Math.random()<Number(e)}function f(e,n){return e<Number(n)}function k(r){return function(e){for(var n=e,t=0;t<r.length&&n;t++)try{n=r[t](n)}catch(e){C(e)}return n}}var O=function(i,u,a,c){return void 0===c&&(c=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return l;var t=i[u],r=a.apply(void 0,y([t],g(e),!1)),o=r;return h(o)&&c&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return r.apply(this,n)}catch(e){return h(t)&&t.apply(this,n)}}),i[u]=o,function(e){e||(o===i[u]?i[u]=t:r=t)}}},j=0,C=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,y(["[SDK]",Date.now(),(""+j++).padStart(8," ")],g(e),!1))},P=0;function T(){var e=function(){for(var e=new Array(16),n=0,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);var r=0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[+r]],o[e[15]]].join("")}(e)}var D=function(e){var t,r,o,n=(t={},r={},o={set:function(e,n){return t[e]=n,r[e]=v(n),o},merge:function(n){return t=d(d({},t),n),Object.keys(n).forEach(function(e){r[e]=v(n[e])}),o},delete:function(e){return delete t[e],delete r[e],o},clear:function(){return t={},r={},o},get:function(e){return r[e]},toString:function(){return d({},r)}});e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})};function I(e,n){var t=e.common||{};return t.sample_rate=n,e.common=t,e}function R(e,n,t,r,o){return e?(i=o(r,n),function(){return i}):function(){return t(n)};var i}function M(e,n,t,r){if(void 0===(e=function(e,n,t){for(var r,n=g(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(r=g(i))[0],i=r.slice(1);if(e)return t(e,o)}(e,n,function(e,n){return e[n]})))return!1;var o,n="boolean"==typeof e?"bool":a(e)?"number":"string";return function(e,n,t){switch(t){case"eq":return S(n,e);case"neq":return!S(n,e);case"gt":return e>n[0];case"gte":return e>=n[0];case"lt":return e<n[0];case"lte":return e<=n[0];case"regex":return Boolean(e.match(new RegExp(n.join("|"))));case"not_regex":return!e.match(new RegExp(n.join("|")));default:return!1}}(e,(o=n,r.map(function(e){switch(o){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}})),t)}function N(n,e){try{return"rule"===e.type?M(n,e.field,e.op,e.values):"and"===e.type?e.children.every(function(e){return N(n,e)}):e.children.some(function(e){return N(n,e)})}catch(e){return!1}}function q(e,n,t,r){if(!n)return b;var o=n.sample_rate,i=n.include_users,u=n.sample_granularity,a=n.rules,n=void 0===(n=n.r)?Math.random():n;if(S(i,e))return function(e){return I(e,1)};var c,s,f,l,p,d,h,m=R(u="session"===u,o,t,n,r),v=(c=a,s=u,f=o,l=t,p=n,d=r,h={},Object.keys(c).forEach(function(e){var n=c[e],t=n.enable,r=n.sample_rate,n=n.conditional_sample_rules;t?(h[e]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:R(s,r,l,p,d)},n&&(h[e].conditional_hit_rules=n.map(function(e){var n=e.sample_rate,e=e.filter;return{sample_rate:n,hit:R(s,n,l,p,d),effectiveSampleRate:n*f,filter:e}}))):h[e]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(e){if(!m())return!1;if(!(e.ev_type in v))return I(e,o);if(!v[e.ev_type].enable)return!1;if(e.common&&e.common.sample_rate)return e;var n=v[e.ev_type],t=n.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(N(e,t[r].filter))return!!t[r].hit()&&I(e,t[r].effectiveSampleRate);return!!n.hit()&&I(e,n.effectiveSampleRate)}}var L,A=function(t){t.on("start",function(){var e=t.config(),n=e.userId,e=e.sample,e=q(n,e,o,f);t.on("build",e)})},B="custom",F=function(e){if(e&&w(e)&&e.name&&c(e.name)){var n={name:e.name,type:"event"};if("metrics"in e&&w(e.metrics)){var t=e.metrics,r={};for(o in t)a(t[o])&&(r[o]=t[o]);n.metrics=r}if("categories"in e&&w(e.categories)){var o,i=e.categories,u={};for(o in i)u[o]=v(i[o]);n.categories=u}return n}},z=function(e){if(e&&w(e)&&e.content&&c(e.content)){var n={content:v(e.content),type:"log",level:"info"};if("level"in e&&(n.level=e.level),"extra"in e&&w(e.extra)){var t,r=e.extra,o={},i={};for(t in r)a(r[t])?o[t]=r[t]:i[t]=v(r[t]);n.metrics=o,n.categories=i}return n}},V="Adapters imported incorrectly",U=["success","fail","complete"],H=20;(_e=L=L||{}).onLaunch="onLaunch",_e.onShow="onShow",_e.onHide="onHide",_e.onError="onError",_e.onPageNotFound="onPageNotFound",_e.onUnhandledRejection="onUnhandledRejection";function G(e){return"[object Object]"===Object.prototype.toString.call(e)}var K=["request","downloadFile","uploadFile"],J=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],W=y(y([],g([L.onLaunch,L.onShow,L.onHide]),!1),[L.onError,L.onPageNotFound,L.onUnhandledRejection],!1),Y=["attached","onInit"],$=["onLoad","onShow","onReady","onUnload","onHide"],Q="unknown_error_name",X="__HOOKED__";var Z=function(){return Date.now()};function ee(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!h(e))return 0;var r,o=Z();try{e.apply(this,n)}finally{r=Z()}return r-o}var ne,te=function(){},re=g((ne="tt",[function(){return ne},function(e){return ne=e}]),2),oe=re[0];re[1];function ie(e,n,r){var o=e[n];if(!o||!o[X])return Object.defineProperty(e,n,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{var t=r.apply(this,e);t&&(e=t)}catch(e){C(e)}return o.apply(this,e)}}),e[n]&&(e[n][X]=!0),function(){e[n][X]=!1,r=te}}function ue(t,e){Object.keys(e).forEach(function(n){e[n].addTearDown(function(){var e;return Se(t,((e={})[n]=null,e))})})}function ae(e,n){n.addTearDown(function(){return we(e,null)})}function ce(e){return xe("route")[e]}function se(e){return!!xe("route")[e]}function fe(e){return xe("http")[e]}function le(e){return!!xe("http")[e]}function pe(){return xe("setData")}function de(){return!!xe("performance")}function he(){return xe("instance")}function me(e){we("instance",e)}var ve=function(n,t){function e(e){return t(e),n.call(this,e)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},be=function(){var e={instance:null};return e.instance||("undefined"!=typeof tt?e={instance:tt,platform:oe()}:"undefined"!=typeof my?e={instance:my,platform:"my"}:"undefined"!=typeof swan?e={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(e={instance:wx,platform:"wx"})),e},ge="__slardar__global__0.2.2",ye={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},_e=function(e,n){void 0===e&&(e={});var t=(n=void 0===n?be().instance:n)?n[ge]||(n[ge]=e):e;return{setGlobalValue:function(e,n){t[e]=n},mergeGlobalValue:function(e,n){t[e]=d(d({},t[e]),n)},getGlobalValue:function(e){return t[e]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},ye),n&&(n[ge]=t)}}}(d({},ye)),we=_e.setGlobalValue,Se=_e.mergeGlobalValue,xe=_e.getGlobalValue,Ee=function(e){return xe("app")[e]},ke=function(e){return xe("page")[e]},Oe=function(t){J.forEach(function(n){se(n)&&ce(n).subscribe(function(e){return t(e,n)})})},je=function(){return xe("performance")},Ce=function(e){return xe("component")[e]};function Pe(e){return"function"==typeof e}function Te(e,n){!e||0<=(n=e.indexOf(n))&&e.splice(n,1)}function De(e){return e}function Ie(t){return function(e){if((n=e)&&Pe(n.lift))return e.lift(function(e){try{return t(e,this)}catch(e){this.error(e)}});var n;throw new TypeError("Unable to lift unknown Observable type")}}function Re(e){Pe(e)?e():null!=e&&e.unsubscribe()}var Me=function(e){return e instanceof Ne||e&&"closed"in e&&Pe(e.remove)&&Pe(e.add)&&Pe(e.unsubscribe)},Ne=(qe.prototype.unsubscribe=function(){var e,n,t,r=this;this.closed||(this.closed=!0,e=this._parentage,n=this._finalizers,t=this.initialTeardown,e&&(this._parentage=null,e.forEach(function(e){return e.remove(r)})),Pe(t)&&t(),n&&(this._finalizers=null,n.forEach(Re)))},qe.prototype.remove=function(e){this._finalizers&&Te(this._finalizers,e),e instanceof qe&&e._removeParent(this)},qe.prototype.add=function(e){if(e&&e!==this)if(this.closed)Re(e);else{if(e instanceof qe){if(e.closed||e._hasParent(this))return;e._addParent(this)}var n=this._finalizers;this._finalizers=n?(n.push(e),n):[e]}},qe.prototype._addParent=function(e){var n=this._parentage;this._parentage=n?(n.push(e),n):[e]},qe.prototype._hasParent=function(e){return this._parentage&&~this._parentage.indexOf(e)},qe.prototype._removeParent=function(e){this._parentage&&Te(this._parentage,e)},qe);function qe(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var Le,Ae=(e(Be,Le=Ne),Be.prototype.next=function(e){this.isStopped||this.destination.next(e)},Be.prototype.error=function(e){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(e)}finally{this.unsubscribe()}}},Be.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Be.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Le.prototype.unsubscribe.call(this),this.destination=null)},Be.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Be);function Be(e){var n=Le.call(this)||this;return n.isStopped=!1,n.destination=Ve(e)?e:new Fe(!(e=e)||Pe(e)?{next:null!=e?e:void 0}:e),n}var Fe=(ze.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(e){console.error("ConsumerObserver.next error",e)}},ze.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(e){console.error("ConsumerObserver.error error",e)}},ze.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){console.error("ConsumerObserver.complete error",e)}},ze);function ze(e){this.partialObserver=e}function Ve(e){return e instanceof Ae||e&&((n=e)&&Pe(n.next)&&Pe(n.error)&&Pe(n.complete))&&Me(e);var n}Ue.prototype.subscribe=function(e){var n=Ve(e)?e:new Ae(e),t=this.operator,e=this.source;return n.add(t?t.call(n,e):this._trySubscribe(n)),n},Ue.prototype.lift=function(e){var n=new Ue;return n.source=this,n.operator=e,n},Ue.prototype.pipe=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(n=e).length?De:1===n.length?n[0]:function(e){return n.reduce(function(e,n){return n(e)},e)})(this)},Ue.prototype._subscribe=function(e){},Ue.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},re=Ue;function Ue(e){e&&(this._subscribe=e)}var He,_e=(e(Ge,He=re),Ge.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(e){return e.next(n)})},Ge.prototype.commonJudgement=function(e){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,e())},Ge.prototype.error=function(n){var t=this;this.commonJudgement(function(){var e=t.observers;for(t.hasError=!0,t.thrownError=n;e.length;)e.shift().error(n)})},Object.defineProperty(Ge.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Ge.prototype.complete=function(){var n=this;this.commonJudgement(function(){for(var e=n.observers;e.length;)e.shift().complete()})},Ge.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Ge.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Ge.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},Ge.prototype._checkFinalizedStatuses=function(e){var n=this.hasError,t=this.thrownError,r=this.isStopped;n?e.error(t):r&&e.complete()},Ge.prototype._innerSubscribe=function(e){var n=this.isStopped,t=this.observers;return n?Ge.EMPTY:(t.push(e),new Ne(function(){Te(t,e)}))},Ge.EMPTY=((_e=new Ne).closed=!0,_e),Ge);function Ge(){var e=null!==He&&He.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var Ke=new re(function(e){return e.complete()});function Je(r){return r<=0?function(){return Ke}:Ie(function(e,n){var t=0;e.subscribe(function(e){++t<=r&&(n.next(e),r<=t&&n.complete())})})}function We(r,o){return Ie(function(e,n){var t=0;e.subscribe(function(e){return r.call(o,e,t++)&&n.next(e)})})}function Ye(t){return We(function(e,n){return t<=n})}var $e,Qe=(e(Xe,$e=_e),Xe.prototype.subscribe=function(e){var t=this,e=$e.prototype.subscribe.call(this,e);he()&&he()._subscriptions.push(e);var r=e.unsubscribe;return e.unsubscribe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(this,e),t.observed||t.unsubscribe()},e},Xe.prototype.unsubscribe=function(){$e.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(e){return e()})},Xe.prototype.addTearDown=function(e){this.tearDownFns.push(e)},Xe);function Xe(){var e=null!==$e&&$e.apply(this,arguments)||this;return e.tearDownFns=[],e}function Ze(e){var n=e.reduce(function(e,n){return e[n]=new Qe,e},{});return{getSubject:function(e){return n[e]},subjectMap:n}}function en(e){return 1<e.length?e:e.length&&e[0]||{}}function nn(e){var t=e.filter(function(e){return e=e,!!!xe("app")[e]}),e=Ze(t).subjectMap;Se("app",e=e),ue("app",e),App=ve(App,function(n){t.forEach(function(e){var r=Ee(e),e=O(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.next({that:this,param:en(e),time:Z()}),h(t)&&t.apply(this,e)}})();e&&r.addTearDown(e)})})}function tn(e){return e.route||e.__route__||e.url||e.path||""}function rn(e){function n(e,i){r.forEach(function(o){O(e,o,function(r){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];Ce(o).next({that:this,param:null,time:Z()});var t=i[o];if(h(t)&&t.apply(this,e),h(r))return r.apply(this,e)}})()})}var t=["attached"],r=e.filter(function(e){return~t.indexOf(e)});try{Component=ve(Component,function(e){w(e.lifetimes)?n(e.lifetimes,e):void 0!==e.lifetimes&&null!==e.lifetimes||(e.lifetimes={},n(e.lifetimes,e))})}catch(e){}}function on(e){function n(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(e(d({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;Oe(function(e,n){"invoke"===e.param.name&&(o=!1,r={navigate_start:e.time,navigate_name:n})}),ke("onLoad").pipe(Ye(1)).subscribe(function(e){r.load_start=e.time}),ke("onShow").pipe(Ye(1)).subscribe(function(e){r.dom_end=e.time}),ke("onReady").pipe(Ye(1)).subscribe(function(e){r.render_end=e.time,n(),t()}),Ee(L.onHide).subscribe(function(){!1===o&&(n(),t())})}function un(n){var t=["downloadPackage","evaluateScript","fcp","fp","fr"];je().subscribe(function(e){~t.indexOf(e.name)&&n(e)})}function an(n){Ce("attached").subscribe(function(e){e=e.that;return n.call(e)})}function cn(e){return"android"===e.toLowerCase()}function sn(){var e=wx.getAccountInfoSync().miniProgram,n=(p=wx.getSystemInfoSync()).model,t=p.brand,r=p.pixelRatio,o=p.screenHeight,i=p.screenWidth,u=p.windowHeight,a=p.windowWidth,c=p.language,s=p.version,f=p.system,l=p.platform,p=p.SDKVersion;return{model:n,brand:t,pixelRatio:r,screenArea:En({width:i,height:o}),windowArea:En({width:a,height:u}),language:c,osName:xn(l),osVersion:f,SDKVersion:p,appId:e.appId,miniEnv:e.envVersion,miniVersion:e.version,hostName:"wx",hostVersion:s,platform:"wx"}}function fn(e){var n=e.filter(function(e){return e=e,!!!xe("component")[e]}),e=Ze(n).subjectMap;Se("component",e=e),ue("component",e),gn().componentSubject(n)}function ln(n){function e(e){G(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))}try{Component=ve(Component,e),Behavior=ve(Behavior,e)}catch(e){}}function pn(e,n){var t=e.filter(function(e){return e=e,!!!xe("page")[e]}),e=Ze(t).subjectMap;Se("page",e=e),ue("page",e),e=function(n){t.forEach(function(e){var r=ke(e),e=O(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(tn(this)&&r.next({that:this,param:en(e),time:Z()}),h(t))return t.apply(this,e)}})();e&&r.addTearDown(e)})},Page=ve(Page,e),ln(e)}function dn(e){var n=e.filter(function(e){return!se(e)}),t=Ze(n).subjectMap;Se("route",e=t),ue("route",e),n.forEach(function(i){var e=ie(gn().instance,i,function(o){ce(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:Z()}),U.forEach(function(r){O(o,r,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];ce(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:en(e)||{}},time:Z()}),h(t)&&t.apply(this,e)}})()})});e&&t[i].addTearDown(e)})}function hn(a,e){var n=e.url,t=e.method,r=e.data,o=e.header,i=e.headers,c={api:a,request:{url:n,method:(n=t,"uploadFile"===(t=a)?"POST":"downloadFile"!==t&&n||"GET"),headers:o||i||{},body:v(r),timestamp:Z()},response:{}};O(e,"complete",function(u){return function(e){var n=c.response.timestamp||Z();c.duration=n-c.request.timestamp,c.completeCallbackTime=ee(u,e);var t,r,o,i=e.errMsg||e.errorMessage||e.error;c.response={status:(t=e.status,r=e.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:n,headers:e.header||e.headers||{},body:v(e.data),errMsg:i,timing:gn().buildRequestProfile(e.profile||{})},fe(a).next(c)}})(),O(e,"success",function(n){return function(e){c.response.timestamp=Z(),c.response.status=200,c.successCallbackTime=ee(n,e)}})(),O(e,"fail",function(n){return function(e){c.response.timestamp=Z(),c.response.status=-1,c.failCallbackTime=ee(n,e)}})()}function mn(e,t){void 0===t&&(t=gn().instance);var n=e.filter(function(e){return!le(e)}),r=Ze(n).subjectMap;Se("http",e=r),ue("http",e),n.forEach(function(n){var e=ie(t,n,function(e){hn(n,e)});e&&r[n].addTearDown(e)})}var vn,re=g((vn={},[function(e){if(!be().platform)throw Error("Not support current Mini Program");if(!Array.isArray(e)||!e.length)return null;e=e.find(function(e){return e.platform===be().platform});return e&&(vn=e.adapterCtor())},function(){return vn}]),2),bn=re[0],gn=re[1],yn=function(e){return"SLARDAR"+e},_n=function(e){try{return gn().getStorage(e)}catch(e){return}},wn=["darwin","macs","mac"],Sn=["windows_nt","windows","window"],xn=function(e){return cn(e)?"Android":"ios"===e.toLowerCase()?"iOS":~wn.indexOf(e.toLowerCase())?"Mac":~Sn.indexOf(e.toLowerCase())?"windows":"unknown"},En=function(e){var n=e.systemPlatform,t=e.pixelRatio,r=e.width,e=e.height;return n&&cn(n)&&t?r/t+" * "+e/t:r+" * "+e},kn=function(e){return function(e){var n,t={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&void 0!==e[n]&&null!==e[n]&&(t[n]=e[n]);return t}({domainLookupStart:e.domainLookupStart,domainLookupEnd:e.domainLookupEnd,connectStart:e.connectStart,secureConnectionStart:e.SSLconnectionStart,connectEnd:e.connectEnd,requestStart:e.requestStart,requestEnd:e.requestEnd,responseStart:e.responseStart,responseEnd:e.responseEnd,socketReused:e.socketReused,redirectStart:e.redirectStart,redirectEnd:e.redirectEnd,fetchStart:e.fetchStart,sendBytesCount:e.sendBytesCount,throughputKbps:e.throughputKbps,receivedBytedCount:e.receivedBytedCount})},_e={platform:"wx",adapterCtor:function(){return d(d({},{instance:t=void 0===t?be().instance:t,request:function(e){return t.request(e)},getStorage:function(e){return t.getStorageSync(e)},setStorage:function(e,n){return t.setStorageSync(e,n)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(e){return e},monitorNetworkType:function(n){t.getNetworkType({success:function(e){n&&n({networkType:e.networkType})}}),t.onNetworkStatusChange(function(e){n&&n({networkType:e.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:"wx",buildError:function(e){return c(e)?function(e){e=e.split("\n");return{name:g((e[2]&&e[2].split(":")||[]).map(function(e){return e.trim()}),1)[0],message:e&&e[1]&&e[1].trim(),stack:e.slice(2).join("\n")}}(e):{name:Q,message:v(e)}},getSystemInfo:sn,observePerformance:function(n){var e=wx.getPerformance&&wx.getPerformance();if(e){e=e.createObserver(function(e){e=e.getEntries().map(function(e){return d(d({},e),{name:function(e){switch(e){case"appLaunch":return"appClick";case"firstRender":return"fr";case"firstPaint":return"fp";case"firstContentfulPaint":return"fcp";case"largestContentfulPaint":return"lcp";default:return e}}(e.name)})});n(e)});return e.observe({entryTypes:e.supportedEntryTypes}),e}},performanceSubscriber:un,buildRequestProfile:function(e){return e=kn(n=e),n.protocol&&(e.protocol=n.protocol),e;var n},componentSubject:rn,pagePerfSubscriber:on,setDataSubject:an});var t}},On=function(e,n){void 0===n&&(n=K),e.on("init",function(){mn(n)})};function jn(){var u=tn(this),a=pe();var e=ie(this,"setData",function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=r[0],i=Z();return[o,function(){var e=r[1],n=Z()-i;a.next({renderTime:n,url:u,data:o,startTime:i}),e&&e.call(t)}]});e&&a.addTearDown(e)}function Cn(){var e;xe("setData")||(e=(e=Ze(["setData"]).getSubject)("setData"),we("setData",e),ae("setData",e))}function Pn(o){return Object.keys(o).reduce(function(e,n){var t,r;return r=o[t=n],t&&r&&(In.test(t)||Rn.test(r))||(e[n]=o[n]),e},{})}var Tn=function(e){e.on("init",function(){Cn(),ke("onLoad").subscribe(function(e){e=e.that;jn.call(e)}),gn().setDataSubject(jn)})},Dn=function(e){e.on("init",function(){var n,e,t,r=gn();r.observePerformance&&!de()&&(n=(0,Ze(["performance"]).getSubject)("performance"),we("performance",e=n),ae("performance",e),(t=r.observePerformance(function(e){e.forEach(function(e){n.next(e)})}))&&t.disconnect&&n.addTearDown(function(){return t.disconnect()}))})},In=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),Rn=new RegExp("(bearer|session)","i"),Mn=function(){return function(e,s){var n=e.hookRequest,t=e.hookDownloadFile,r=e.hookUploadFile,f=e.ignoreUrls,l=e.collectBodyOnError,p=e.extraExtractor,e=function(e){var n,t,r,o,i,u,a,c;!function(e,n){e=m(e||[]);return!!e&&e.test(n)}(f,e.request.url)&&(c=e.response,n=e.request,t=e.api,r=e.duration,o=e.failCallbackTime,a=e.successCallbackTime,i=e.completeCallbackTime,n.headers=Pn(n.headers||{}),c.headers=Pn(c.headers||{}),u=c.errMsg,e=function(e,n){var t={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}(c,["errMsg"]),e=d(d({},e),{is_custom_error:!1}),u&&(e.err_msg=u),a={api:t,request:n,duration:r,cbTime:i+(o||0)+(a||0),response:e},!h(p)||(e=p(c.body,a))&&(a.extra=e,a.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete a.request.body,delete a.response.body),s({ev_type:"http",payload:a}))};n&&fe("request").subscribe(e),t&&fe("downloadFile").subscribe(e),r&&fe("uploadFile").subscribe(e)}},Nn=function(e,n,t,r){void 0===n&&(n={}),void 0===r&&(r=[]);try{var o=e.apply(void 0,y([],g(r),!1));return o&&o(n,t)||[]}catch(e){return C("applyMonitor",e),[]}};function qn(e,n,t){me(e);n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return w(n)?d(d({},t),n):!!n&&t}function Ln(e,n){return e&&n&&e===n}function An(){var r;return function(e){try{if(t=r,!(!(n=e)||!t)&&!(!Ln(n.message,t.message)&&!Ln(n.stack,t.stack)))return void(r=e)}catch(e){}var n,t;return r=e}}var Bn,Fn="http",zn={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},Vn=function(f){return void 0===f&&(f=gn()),function(e,r){var n=e.ignoreErrors,t=e.hookOnError,o=e.hookOnUnhandledRejection,i=e.hookRouteError,u=e.dedupe,a=m(n),c=An(),s=function(e,n,t){e=u?c(e):e;e&&(a&&a.test(e.message)||(e={error:e},n&&(e.extra=n),t&&(e.react=t),r(e)))};t&&Ee(L.onError).subscribe(function(e){e=e.param,e=f.buildError(e);a&&a.test(e.message)||s(e)}),o&&Ee(L.onUnhandledRejection).subscribe(function(e){var n=e.param||{},e=n.promise,t=v(n.reason);a&&a.test(t)||e.catch(b).then(function(e){var n={name:"UnhandledRejection",message:t};e&&e.stack&&(n.stack=e.stack),s(n)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&Oe(function(e){e=e.param;"fail"===(e=e).name&&s({name:"RouteError",message:e.value.errMsg})}),[s]}};(re=Bn=Bn||{}).history="history",re.manual="manual";function Un(t,e,r){var o=e,i=null,u=0,n="launch";function a(e,n){o=n,u=Z(),r(n,i=n+"_"+u),t(e,n)}return Ee(L.onShow).pipe(Ye(1)).subscribe(function(){n="show"}),Oe(function(){n="history"}),[a,function(e){e&&(a(n,e),n="history")},function(e){void 0===e&&(e="hide"),i&&(r(o,i),i=null,t(e,o,Z()-u))}]}var Hn=function(){return function(e,r){var n=e.extractPid,t=e.routeMode,o=e.setPidAndViewId,i=function(e){return n?n(e):e},e=g(Un(function(e,n,t){r({ev_type:"pageview",payload:{pid:n,source:e,duration:t}})},"",o),3),o=e[0],u=e[1],e=e[2];return t!==Bn.manual&&(ke("onShow").subscribe(function(e){return function(e){e=tn(e),e=i(e);u(e)}(e.that)}),ke("onUnload").subscribe(e.bind(null,"unload")),ke("onHide").subscribe(e.bind(null,"hide"))),[o.bind(null,"user_set"),e]}},Gn=function(){return function(e){var n=g(function(n,t,r){void 0===n&&(n=20),void 0===t&&(t=b),void 0===r&&(r=function(e,n){return e.slice(-n)});var o=[];return[function(){return o},function(e){t(e)&&(e=d(d({},e),{timestamp:e.timestamp||Date.now()}),o=0<=n&&o.length+1>n?r(y(y([],g(o),!1),[e],!1),n):y(y([],g(o),!1),[e],!1))}]}(e.maxBreadcrumbs,e.onAddBreadcrumb,e.onMaxBreadcrumbs),2),e=n[0],r=n[1];return K.forEach(function(e){le(e)&&fe(e).subscribe(function(e){r({type:"http",category:e.api,message:"",data:{method:e.request.method,url:e.request.url,status_code:String(e.response.status)},timestamp:e.request.timestamp})})}),Oe(function(e,n){var t=e.param,e=e.time;"complete"===t.name&&r({type:"route",category:n,message:t.value.errMsg||t.value.errorMessage||"",timestamp:e,data:{url:t.url||""}})}),[e,r]}},Kn=function(){return function(e,t){var r=e.isCalculateSize;pe().subscribe(function(e){var n={duration:e.renderTime,start_time:e.startTime};r&&(n.size=(e=e.data,TextEncoder?(new TextEncoder).encode(v(e)).length:2*v(e).length)),t({ev_type:"set_data",payload:n})})}},Jn=function(){return function(e,n){function t(){n({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;Ee(L.onLaunch).pipe(Je(1)).subscribe(function(e){r.activate_start=e.time}),Ee(L.onShow).pipe(Je(1)).subscribe(function(e){r.init_end=e.time}),ke("onLoad").pipe(Je(1)).subscribe(function(e){r.page_load_start=e.time}),ke("onShow").pipe(Je(1)).subscribe(function(e){r.page_dom_end=e.time});var i=de();ke("onReady").pipe(Je(1)).subscribe(function(e){r.page_render_end=e.time,i&&!r.trigger||t()}),i&&je().pipe(We(function(e){return"appClick"===e.name}),Je(1)).subscribe(function(e){r.trigger=e.startTime,r.page_render_end&&t()}),Ee(L.onHide).subscribe(function(){o||t()})}},Wn=function(){return function(e,n){gn().pagePerfSubscriber(function(e){return n({ev_type:"page_perf",payload:e})})}},Yn=function(n){return void 0===n&&(n=gn()),function(e,t){var r,o;de()&&n.performanceSubscriber&&(r=0,ke("onLoad").subscribe(function(e){o=e.time,r++}),n.performanceSubscriber(function(e){var n={is_custom:!1,name:e.name,value:e.startTime,type:"perf",count:r};n.duration=e.duration||(o?e.startTime-o:0),n.is_support=0<=n.duration,t({ev_type:"performance",payload:n})}))}},$n="pageview",Qn={routeMode:Bn.history,setPidAndViewId:function(e,n){}},Xn="jsError",Zn={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},et=function(t){return function(e){var n=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},e),{breadcrumbs:n})})}},nt={maxBreadcrumbs:20,tap:!0},rt="breadcrumb",ot=function(n){n.on("init",function(){n.provide("_subscriptions",[]),me(n),n.on("init",function(){nn(W),pn($),fn(Y)}),n.on("init",function(){dn(J)})}),n.on("beforeDestroy",function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]})},it="setData",ut={isCalculateSize:!1},at="appLaunchPerf",ct={},st="pagePerf",ft={},lt="performance",pt={},dt=function(e,n,t){void 0===t&&(t=gn());var r=n.url,o=n.data,i=n.success,u=void 0===i?l:i,a=n.fail,c=void 0===a?l:a,i=n.header,a={"Content-Type":"application/json"};G(n=i)&&0!==Object.keys(n).length&&Object.assign(a,i),t.request({method:e,url:r,data:o,header:a,headers:a,success:function(e){u(e)},fail:function(e){e=e.errMsg||"Network request failed";c(new Error(e))}})},ht=function(n){return(n=void 0===n?gn():n)?{get:function(e){return dt("GET",e,n)},post:function(e){return dt("POST",e,n)}}:{get:l,post:l}};function mt(e){return e=yn(String(e)),(e=_n(e))&&e.userId&&e.deviceId?e:{userId:T(),deviceId:T()}}function vt(e){return e+"_"+Date.now()}function bt(e){var n=e.aid,t=e.userId,e=e.deviceId;!function(e,n){try{gn().setStorage(e,n)}catch(e){}}(yn(String(n)),{userId:t,deviceId:e})}var gt={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:d(d({},e.extra||{}),e.overrides||{})}}},yt="/monitor_mini/collect",_t="/settings/minipro",wt="apmplus.volces.com",St="session",xt={sample_rate:1,include_users:[],sample_granularity:St,rules:{}},Et=[yt,_t],kt="0.2.2",Ot="APM_PLUS_MINI_PROGRAM",jt=function(e,n){return void 0===n&&(n=yt),(e&&0<=e.indexOf("//")?"":"https://")+e+n};function Ct(e){e=mt(e.aid);return{aid:0,token:"",pid:"",viewId:vt("_"),userId:e.userId,deviceId:e.deviceId,sessionId:T(),domain:wt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:Et},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:xt,sdkName:Ot,sdkVersion:kt}}function Pt(e){var n,t=e.plugins||{};for(n in t)t[n]&&!w(t[n])&&(t[n]={});return d(d({},e),{plugins:t})}function Tt(e){return w(e)&&"aid"in e&&"token"in e}function Dt(e){return d({},e)}var It=function(n){var r,o,i=n,u={},a=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(e){var n,t;return u=d(d({},u),e||{}),s(),r||(r=e,i.useLocalConfig||!i.aid?(o={},c()):a?f():(n=i.domain,e=i.aid,t=function(e){a=e,f()},ht().get({url:function(e,n){return void 0===n&&(n=_t),(e&&0<=e.indexOf("//")?"":"https://")+e+n}(n)+"?biz_id="+e,success:function(e){t(e&&e.data&&e.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(e){t=e},onReady:function(e){c=function(){bt(i),e()},o&&c()}};function s(){var e=d(d(d({},n),o||{}),u);e.plugins=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t={},r=0;r<e.length;)t=p(t,e[r++]);return t}(n.plugins,(null==o?void 0:o.plugins)||{},u.plugins||{}),e.sample=Rt(Rt(n.sample,null==o?void 0:o.sample),u.sample),i=e,t()}function f(){o=function(e){if(!e)return{};var n=e.sample,t=e.user_id,r=e.timestamp,o=t?{userId:t}:{};if(!n)return o;var i=n.sample_rate,e=n.sample_granularity,t=void 0===e?St:e,e=n.include_users,n=n.rules,n=void 0===n?[]:n;return d(d({},o),{sample:{include_users:e,sample_rate:i,sample_granularity:t,rules:n.reduce(function(e,n){var t=n.name,r=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[t]={enable:r,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r})}(a),function(e){e=yn(e);return!!gn().getStorage(e)}(String(i.aid))&&(o.userId=n.userId),s(),c()}};function Rt(r,o){if(!r||!o)return r||o;var e=d(d({},r),o);return e.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),e.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(e,n){var t;return n in e||(n in(r.rules||{})&&n in(o.rules||{})?(e[n]=d(d({},r.rules[n]),o.rules[n]),e[n].conditional_sample_rules=y(y([],g(r.rules[n].conditional_sample_rules||[]),!1),g(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(t=r.rules)||void 0===t?void 0:t[n])||(null===(t=o.rules)||void 0===t?void 0:t[n])),e},{}),e}function Mt(e){var n={url:(n=gn().getCurrentPages().pop())?(n?tn(n):"")+s(n.options):"",timestamp:Z()};return d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})})}function Nt(e){if(!bn(e))throw Error(V);var t,e=function(e){var t,r,n=e.builder,o=e.createSender,i=e.createDefaultConfig,u=e.createConfigManager,a=e.userConfigNormalizer,c=e.initConfigNormalizer,s=e.validateInitConfig,f={};_.forEach(function(e){return f[e]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(e){if(l)E("already inited");else{if(!(e&&w(e)&&s(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=c(e);if((r=u(n)).setConfig(e),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(e){l&&e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(a(e))),null==r?void 0:r.getConfig()},provide:function(e,n){S(m,e)?E("cannot provide "+e+", reserved"):(v[e]=n,b("provide",!1,e))},start:function(){var n=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(e){return n.build(e)}),h=[]}))},report:function(e){e&&(!(e=k(f.beforeReport)(e))||(e=k(f.report)(e))&&(p?this.build(e):h.push(e)))},build:function(e){!p||(e=k(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=k(f.build)(e))&&this.send(e))},send:function(e){!p||(e=k(f.beforeSend)(e))&&(t.send(e),b("send",!1,e))},destroy:function(){b("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&p||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=x(f[e],n))}},m=Object.keys(v);return v;function b(e,n){void 0===n&&(n=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[e].forEach(function(e){try{e.apply(void 0,y([],g(t),!1))}catch(e){}}),n&&(f[e].length=0)}}({validateInitConfig:Tt,initConfigNormalizer:Pt,userConfigNormalizer:Dt,createSender:function(e){return n({size:H,endpoint:jt(e.domain),transport:ht()})},builder:gt,createDefaultConfig:Ct,createConfigManager:It});return D(e),Ft(e),Lt(e),At(e),A(e),ot(e),(t=e).on("init",function(){var n=[],e=t.config();e&&e.integrations&&e.integrations.forEach(function(e){S(n,e.name)||(n.push(e.name),e.setup(t),e.tearDown&&t.on("beforeDestroy",e.tearDown))})}),Bt(e),qt(e),e}var qt=function(n){function t(e){return void 0===e&&(e=gn().getSystemInfo()),n.set(d({},e))}function r(){t(),e()}var o,i,u=!1,e=(i="",function(){var e=o.getSender();i=i||e.getEndpoint();var n=o.config(),n={did:n.deviceId,sid:n.sessionId,sname:n.sdkName,sver:n.sdkVersion,soffset:n.offset||0,model:n.model,brand:n.brand,ratio:n.pixelRatio,screen:n.screenArea,window:n.windowArea,lang:n.language,osname:n.osName,osver:n.osVersion,libver:n.SDKVersion,scene:n.scene||-1,menv:n.miniEnv,mver:n.miniVersion,hostname:n.hostName,hostver:n.hostVersion,platform:n.platform,biz_id:n.aid,x_auth_token:n.token};e.setEndpoint(i+s(n))});(o=n).on("start",function(){r(),u=!0}),n.on("init",function(){Ee(L.onLaunch).pipe(Je(1)).subscribe(function(e){e=e.param.scene||-1;t({scene:e}),u&&r()}),gn().monitorNetworkType(function(e){e=e.networkType;n.set({networkType:e})})})},Lt=function(r){r.on("beforeBuild",function(e){return n=e,t=r.config(),(e={}).aid=t.aid,e.pid=t.pid,e.view_id=t.viewId,e.user_id=t.userId,e.network_type=t.networkType,d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})});var n,t})},At=function(e){e.on("report",Mt)},Bt=function(n){n.on("init",function(){Ee(L.onHide).subscribe(function(){var e=n.getSender();e&&e.flush()})})},Ft=function(t){var r,o=!1;t.on("init",function(){r=Z(),t.on("config",function(){var e,n=null===(e=t.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=Z())-r<1e3&&n&&(e=n-(e+r)/2,isNaN(e)||t.set({offset:e})))})})},re=function(e){var n,t,r,i,o,u,a,c,s,e=Nt(e);if(e)return(n=e).provide("sendEvent",function(e){e=F(e);e&&n.report({ev_type:B,payload:e,extra:{timestamp:Date.now()}})}),n.provide("sendLog",function(e){e=z(e);e&&n.report({ev_type:B,payload:e,extra:{timestamp:Date.now()}})}),(t=e).on("init",function(){var e,n=qn(t,$n,Qn);n&&(n=(e=g(Nn(Hn,d(d({},n),{setPidAndViewId:function(e,n){t.set({pid:e,viewId:n,actionId:void 0})}}),t.report.bind(t)),2))[0],e=e[1],t.provide("sendPageview",n),t.provide("sendPageviewWithHide",e))}),(r=e).on("init",function(){var e,n=qn(r,Xn,Zn);n&&(e=et(r),e=g(Nn(Vn,n,e),1)[0],r.provide("captureException",e))}),(i=e).on("init",function(){var e,n,t,r,o=qn(i,Fn,zn);o&&(e=o.hookRequest,n=o.hookDownloadFile,t=o.hookUploadFile,r=[],e&&r.push("request"),n&&r.push("downloadFile"),t&&r.push("uploadFile"),On(i,r),Nn(Mn,o,i.report.bind(i)))}),(o=e).on("init",function(){var e=qn(o,it,ut);e&&(Tn(o),Nn(Kn,e,o.report.bind(o)))}),(u=e).on("init",function(){var e,n=qn(u,rt,nt);n&&(n=(e=g(Nn(Gn,n,function(e){}),2))[0],e=e[1],u.provide("getBreadcrumbs",n),u.provide("addBreadcrumb",e))}),(a=e).on("init",function(){var e=qn(a,at,ct);e&&(Dn(a),Nn(Jn,e,a.report.bind(a)))}),(c=e).on("init",function(){var e=qn(c,st,ft);e&&Nn(Wn,e,c.report.bind(c))}),(s=e).on("init",function(){var e=qn(s,lt,pt);e&&(Dn(s),Nn(Yn,e,s.report.bind(s)))}),e}.bind(null,[_e]),_e=re();return _e.createClient=re,_e}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).wxClient=n()}(this,function(){"use strict";function n(e){var t,r=e.transport,o=e.endpoint,n=e.size,i=void 0===n?10:n,e=e.wait,u=void 0===e?1e3:e,a=[],c=0;function s(){var n;a.length&&(n=this.getBatchData(),r.post({url:o,data:n,fail:function(e){t&&t(e,n)}}),a=[])}return{getSize:function(){return i},getWait:function(){return u},setSize:function(e){i=e},setWait:function(e){u=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){a.push(e),a.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),u)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return a.length?(e=a,JSON.stringify({ev_type:"batch",list:e})):"";var e},clear:function(){clearTimeout(c),a=[]},fail:function(e){t=e}}}var r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var d=function(){return(d=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function g(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),u=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||((r=r||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var _=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],l=function(){return{}};function b(e){return e}function w(e){return"object"==typeof e&&null!==e}var t=Object.prototype;function i(e){if(w(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===t.toString.call(e);e=Object.getPrototypeOf(e);return e===t||null===e}}function u(e){return"[object Array]"===t.toString.call(e)}function h(e){return"function"==typeof e}function a(e){return"number"==typeof e}function c(e){return"string"==typeof e}function p(e,n){var t,r,o=d({},e);for(t in n)r=t,Object.prototype.hasOwnProperty.call(n,r)&&void 0!==n[t]&&(w(n[t])&&i(n[t])?o[t]=p(w(e[t])?e[t]:{},n[t]):u(n[t])&&u(e[t])?o[t]=function n(e,t){e=u(e)?e:[];t=u(t)?t:[];return Array.prototype.concat.call(e,t).map(function(e){return e instanceof RegExp?e:w(e)&&i(e)?p({},e):u(e)?n([],e):e})}(e[t],n[t]):o[t]=n[t]);return o}function S(e,n){if(!u(e))return!1;if(0===e.length)return!1;for(var t=0;t<e.length;){if(e[t]===n)return!0;t++}return!1}function x(e,n){if(!u(e))return e;var t=e.indexOf(n);if(0<=t){n=e.slice();return n.splice(t,1),n}return e}function m(e){return u(e)&&e.length?function(e){for(var n=[],t=e.length,r=0;r<t;r++){var o=e[r];c(o)?n.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return new RegExp(n.join("|"),"i")}(e):null}function v(e){try{return c(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function s(t){return w(t)?Object.keys(t).reduce(function(e,n){return e+="&"+n+"="+t[n]},"").replace("&","?"):""}function E(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,y(["[SDK]",Date.now(),(""+P++).padStart(8," ")],g(e),!1))}function o(e){return Math.random()<Number(e)}function f(e,n){return e<Number(n)}function k(r){return function(e){for(var n=e,t=0;t<r.length&&n;t++)try{n=r[t](n)}catch(e){C(e)}return n}}var O=function(i,u,a,c){return void 0===c&&(c=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return l;var t=i[u],r=a.apply(void 0,y([t],g(e),!1)),o=r;return h(o)&&c&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return r.apply(this,n)}catch(e){return h(t)&&t.apply(this,n)}}),i[u]=o,function(e){e||(o===i[u]?i[u]=t:r=t)}}},j=0,C=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,y(["[SDK]",Date.now(),(""+j++).padStart(8," ")],g(e),!1))},P=0;function T(){var e=function(){for(var e=new Array(16),n=0,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);var r=0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[+r]],o[e[15]]].join("")}(e)}var D=function(e){var t,r,o,n=(t={},r={},o={set:function(e,n){return t[e]=n,r[e]=v(n),o},merge:function(n){return t=d(d({},t),n),Object.keys(n).forEach(function(e){r[e]=v(n[e])}),o},delete:function(e){return delete t[e],delete r[e],o},clear:function(){return t={},r={},o},get:function(e){return r[e]},toString:function(){return d({},r)}});e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})};function I(e,n){var t=e.common||{};return t.sample_rate=n,e.common=t,e}function R(e,n,t,r,o){return e?(i=o(r,n),function(){return i}):function(){return t(n)};var i}function M(e,n,t,r){if(void 0===(e=function(e,n,t){for(var r,n=g(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(r=g(i))[0],i=r.slice(1);if(e)return t(e,o)}(e,n,function(e,n){return e[n]})))return!1;var o,n="boolean"==typeof e?"bool":a(e)?"number":"string";return function(e,n,t){switch(t){case"eq":return S(n,e);case"neq":return!S(n,e);case"gt":return e>n[0];case"gte":return e>=n[0];case"lt":return e<n[0];case"lte":return e<=n[0];case"regex":return Boolean(e.match(new RegExp(n.join("|"))));case"not_regex":return!e.match(new RegExp(n.join("|")));default:return!1}}(e,(o=n,r.map(function(e){switch(o){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}})),t)}function N(n,e){try{return"rule"===e.type?M(n,e.field,e.op,e.values):"and"===e.type?e.children.every(function(e){return N(n,e)}):e.children.some(function(e){return N(n,e)})}catch(e){return!1}}function q(e,n,t,r){if(!n)return b;var o=n.sample_rate,i=n.include_users,u=n.sample_granularity,a=n.rules,n=void 0===(n=n.r)?Math.random():n;if(S(i,e))return function(e){return I(e,1)};var c,s,f,l,p,d,h,m=R(u="session"===u,o,t,n,r),v=(c=a,s=u,f=o,l=t,p=n,d=r,h={},Object.keys(c).forEach(function(e){var n=c[e],t=n.enable,r=n.sample_rate,n=n.conditional_sample_rules;t?(h[e]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:R(s,r,l,p,d)},n&&(h[e].conditional_hit_rules=n.map(function(e){var n=e.sample_rate,e=e.filter;return{sample_rate:n,hit:R(s,n,l,p,d),effectiveSampleRate:n*f,filter:e}}))):h[e]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),h);return function(e){if(!m())return!1;if(!(e.ev_type in v))return I(e,o);if(!v[e.ev_type].enable)return!1;if(e.common&&e.common.sample_rate)return e;var n=v[e.ev_type],t=n.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(N(e,t[r].filter))return!!t[r].hit()&&I(e,t[r].effectiveSampleRate);return!!n.hit()&&I(e,n.effectiveSampleRate)}}var L,A=function(t){t.on("start",function(){var e=t.config(),n=e.userId,e=e.sample,e=q(n,e,o,f);t.on("build",e)})},B="custom",F=function(e){if(e&&w(e)&&e.name&&c(e.name)){var n={name:e.name,type:"event"};if("metrics"in e&&w(e.metrics)){var t=e.metrics,r={};for(o in t)a(t[o])&&(r[o]=t[o]);n.metrics=r}if("categories"in e&&w(e.categories)){var o,i=e.categories,u={};for(o in i)u[o]=v(i[o]);n.categories=u}return n}},z=function(e){if(e&&w(e)&&e.content&&c(e.content)){var n={content:v(e.content),type:"log",level:"info"};if("level"in e&&(n.level=e.level),"extra"in e&&w(e.extra)){var t,r=e.extra,o={},i={};for(t in r)a(r[t])?o[t]=r[t]:i[t]=v(r[t]);n.metrics=o,n.categories=i}return n}},V="Adapters imported incorrectly",U=["success","fail","complete"],H=20;(_e=L=L||{}).onLaunch="onLaunch",_e.onShow="onShow",_e.onHide="onHide",_e.onError="onError",_e.onPageNotFound="onPageNotFound",_e.onUnhandledRejection="onUnhandledRejection";function G(e){return"[object Object]"===Object.prototype.toString.call(e)}var K=["request","downloadFile","uploadFile"],J=["navigateTo","navigateBack","redirectTo","switchTab","reLaunch"],W=y(y([],g([L.onLaunch,L.onShow,L.onHide]),!1),[L.onError,L.onPageNotFound,L.onUnhandledRejection],!1),Y=["attached","onInit"],$=["onLoad","onShow","onReady","onUnload","onHide"],Q="unknown_error_name",X="__HOOKED__";var Z=function(){return Date.now()};function ee(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!h(e))return 0;var r,o=Z();try{e.apply(this,n)}finally{r=Z()}return r-o}var ne,te=function(){},re=g((ne="tt",[function(){return ne},function(e){return ne=e}]),2),oe=re[0];re[1];function ie(e,n,r){var o=e[n];if(!o||!o[X])return Object.defineProperty(e,n,{writable:!0,enumerable:!0,configurable:!0,value:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{var t=r.apply(this,e);t&&(e=t)}catch(e){C(e)}return o.apply(this,e)}}),e[n]&&(e[n][X]=!0),function(){e[n][X]=!1,r=te}}function ue(t,e){Object.keys(e).forEach(function(n){e[n].addTearDown(function(){var e;return Se(t,((e={})[n]=null,e))})})}function ae(e,n){n.addTearDown(function(){return we(e,null)})}function ce(e){return xe("route")[e]}function se(e){return!!xe("route")[e]}function fe(e){return xe("http")[e]}function le(e){return!!xe("http")[e]}function pe(){return xe("setData")}function de(){return!!xe("performance")}function he(){return xe("instance")}function me(e){we("instance",e)}var ve=function(n,t){function e(e){return t(e),n.call(this,e)}for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},be=function(){var e={instance:null};return e.instance||("undefined"!=typeof tt?e={instance:tt,platform:oe()}:"undefined"!=typeof my?e={instance:my,platform:"my"}:"undefined"!=typeof swan?e={instance:swan,platform:"swan"}:"undefined"!=typeof wx&&(e={instance:wx,platform:"wx"})),e},ge="__slardar__global__0.2.3-alpha.0",ye={app:{},page:{},route:{},http:{},component:{},setData:null,performance:null,instance:null},_e=function(e,n){void 0===e&&(e={});var t=(n=void 0===n?be().instance:n)?n[ge]||(n[ge]=e):e;return{setGlobalValue:function(e,n){t[e]=n},mergeGlobalValue:function(e,n){t[e]=d(d({},t[e]),n)},getGlobalValue:function(e){return t[e]},getGlobalEntirely:function(){return t},destroy:function(){t=d({},ye),n&&(n[ge]=t)}}}(d({},ye)),we=_e.setGlobalValue,Se=_e.mergeGlobalValue,xe=_e.getGlobalValue,Ee=function(e){return xe("app")[e]},ke=function(e){return xe("page")[e]},Oe=function(t){J.forEach(function(n){se(n)&&ce(n).subscribe(function(e){return t(e,n)})})},je=function(){return xe("performance")},Ce=function(e){return xe("component")[e]};function Pe(e){return"function"==typeof e}function Te(e,n){!e||0<=(n=e.indexOf(n))&&e.splice(n,1)}function De(e){return e}function Ie(t){return function(e){if((n=e)&&Pe(n.lift))return e.lift(function(e){try{return t(e,this)}catch(e){this.error(e)}});var n;throw new TypeError("Unable to lift unknown Observable type")}}function Re(e){Pe(e)?e():null!=e&&e.unsubscribe()}var Me=function(e){return e instanceof Ne||e&&"closed"in e&&Pe(e.remove)&&Pe(e.add)&&Pe(e.unsubscribe)},Ne=(qe.prototype.unsubscribe=function(){var e,n,t,r=this;this.closed||(this.closed=!0,e=this._parentage,n=this._finalizers,t=this.initialTeardown,e&&(this._parentage=null,e.forEach(function(e){return e.remove(r)})),Pe(t)&&t(),n&&(this._finalizers=null,n.forEach(Re)))},qe.prototype.remove=function(e){this._finalizers&&Te(this._finalizers,e),e instanceof qe&&e._removeParent(this)},qe.prototype.add=function(e){if(e&&e!==this)if(this.closed)Re(e);else{if(e instanceof qe){if(e.closed||e._hasParent(this))return;e._addParent(this)}var n=this._finalizers;this._finalizers=n?(n.push(e),n):[e]}},qe.prototype._addParent=function(e){var n=this._parentage;this._parentage=n?(n.push(e),n):[e]},qe.prototype._hasParent=function(e){return this._parentage&&~this._parentage.indexOf(e)},qe.prototype._removeParent=function(e){this._parentage&&Te(this._parentage,e)},qe);function qe(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var Le,Ae=(e(Be,Le=Ne),Be.prototype.next=function(e){this.isStopped||this.destination.next(e)},Be.prototype.error=function(e){if(!this.isStopped){this.isStopped=!0;try{this.destination.error(e)}finally{this.unsubscribe()}}},Be.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Be.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Le.prototype.unsubscribe.call(this),this.destination=null)},Be.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Be);function Be(e){var n=Le.call(this)||this;return n.isStopped=!1,n.destination=Ve(e)?e:new Fe(!(e=e)||Pe(e)?{next:null!=e?e:void 0}:e),n}var Fe=(ze.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(e){console.error("ConsumerObserver.next error",e)}},ze.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(e){console.error("ConsumerObserver.error error",e)}},ze.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){console.error("ConsumerObserver.complete error",e)}},ze);function ze(e){this.partialObserver=e}function Ve(e){return e instanceof Ae||e&&((n=e)&&Pe(n.next)&&Pe(n.error)&&Pe(n.complete))&&Me(e);var n}Ue.prototype.subscribe=function(e){var n=Ve(e)?e:new Ae(e),t=this.operator,e=this.source;return n.add(t?t.call(n,e):this._trySubscribe(n)),n},Ue.prototype.lift=function(e){var n=new Ue;return n.source=this,n.operator=e,n},Ue.prototype.pipe=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(n=e).length?De:1===n.length?n[0]:function(e){return n.reduce(function(e,n){return n(e)},e)})(this)},Ue.prototype._subscribe=function(e){},Ue.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(e){n.error(e)}},re=Ue;function Ue(e){e&&(this._subscribe=e)}var He,_e=(e(Ge,He=re),Ge.prototype.next=function(n){this._throwIfClosed(),this.isStopped||this.observers.forEach(function(e){return e.next(n)})},Ge.prototype.commonJudgement=function(e){this._throwIfClosed(),this.isStopped||(this.isStopped=!0,e())},Ge.prototype.error=function(n){var t=this;this.commonJudgement(function(){var e=t.observers;for(t.hasError=!0,t.thrownError=n;e.length;)e.shift().error(n)})},Object.defineProperty(Ge.prototype,"observed",{get:function(){return this.observers&&0<this.observers.length},enumerable:!1,configurable:!0}),Ge.prototype.complete=function(){var n=this;this.commonJudgement(function(){for(var e=n.observers;e.length;)e.shift().complete()})},Ge.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Ge.prototype._throwIfClosed=function(){this.closed&&console.error("current subject is closed")},Ge.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},Ge.prototype._checkFinalizedStatuses=function(e){var n=this.hasError,t=this.thrownError,r=this.isStopped;n?e.error(t):r&&e.complete()},Ge.prototype._innerSubscribe=function(e){var n=this.isStopped,t=this.observers;return n?Ge.EMPTY:(t.push(e),new Ne(function(){Te(t,e)}))},Ge.EMPTY=((_e=new Ne).closed=!0,_e),Ge);function Ge(){var e=null!==He&&He.apply(this,arguments)||this;return e.closed=!1,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}var Ke=new re(function(e){return e.complete()});function Je(r){return r<=0?function(){return Ke}:Ie(function(e,n){var t=0;e.subscribe(function(e){++t<=r&&(n.next(e),r<=t&&n.complete())})})}function We(r,o){return Ie(function(e,n){var t=0;e.subscribe(function(e){return r.call(o,e,t++)&&n.next(e)})})}function Ye(t){return We(function(e,n){return t<=n})}var $e,Qe=(e(Xe,$e=_e),Xe.prototype.subscribe=function(e){var t=this,e=$e.prototype.subscribe.call(this,e);he()&&he()._subscriptions.push(e);var r=e.unsubscribe;return e.unsubscribe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(this,e),t.observed||t.unsubscribe()},e},Xe.prototype.unsubscribe=function(){$e.prototype.unsubscribe.call(this),this.tearDownFns.forEach(function(e){return e()})},Xe.prototype.addTearDown=function(e){this.tearDownFns.push(e)},Xe);function Xe(){var e=null!==$e&&$e.apply(this,arguments)||this;return e.tearDownFns=[],e}function Ze(e){var n=e.reduce(function(e,n){return e[n]=new Qe,e},{});return{getSubject:function(e){return n[e]},subjectMap:n}}function en(e){return 1<e.length?e:e.length&&e[0]||{}}function nn(e){var t=e.filter(function(e){return e=e,!!!xe("app")[e]}),e=Ze(t).subjectMap;Se("app",e=e),ue("app",e),App=ve(App,function(n){t.forEach(function(e){var r=Ee(e),e=O(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.next({that:this,param:en(e),time:Z()}),h(t)&&t.apply(this,e)}})();e&&r.addTearDown(e)})})}function tn(e){return e.route||e.__route__||e.url||e.path||""}function rn(e){function n(e,i){r.forEach(function(o){O(e,o,function(r){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];Ce(o).next({that:this,param:null,time:Z()});var t=i[o];if(h(t)&&t.apply(this,e),h(r))return r.apply(this,e)}})()})}var t=["attached"],r=e.filter(function(e){return~t.indexOf(e)});try{Component=ve(Component,function(e){w(e.lifetimes)?n(e.lifetimes,e):void 0!==e.lifetimes&&null!==e.lifetimes||(e.lifetimes={},n(e.lifetimes,e))})}catch(e){}}function on(e){function n(){r.navigate_name=r.navigate_name||"native",r.load_start=r.load_start||0,r.dom_end=r.dom_end||0,r.render_end=r.render_end||0}function t(){r.navigate_start&&(e(d({},r)),r.navigate_name="",r.navigate_start=0,o=!0)}var r={},o=null;Oe(function(e,n){"invoke"===e.param.name&&(o=!1,r={navigate_start:e.time,navigate_name:n})}),ke("onLoad").pipe(Ye(1)).subscribe(function(e){r.load_start=e.time}),ke("onShow").pipe(Ye(1)).subscribe(function(e){r.dom_end=e.time}),ke("onReady").pipe(Ye(1)).subscribe(function(e){r.render_end=e.time,n(),t()}),Ee(L.onHide).subscribe(function(){!1===o&&(n(),t())})}function un(n){var t=["downloadPackage","evaluateScript","fcp","fp","fr"];je().subscribe(function(e){~t.indexOf(e.name)&&n(e)})}function an(n){Ce("attached").subscribe(function(e){e=e.that;return n.call(e)})}function cn(e){return"android"===e.toLowerCase()}function sn(){var e=wx.getAccountInfoSync().miniProgram,n=(p=wx.getSystemInfoSync()).model,t=p.brand,r=p.pixelRatio,o=p.screenHeight,i=p.screenWidth,u=p.windowHeight,a=p.windowWidth,c=p.language,s=p.version,f=p.system,l=p.platform,p=p.SDKVersion;return{model:n,brand:t,pixelRatio:r,screenArea:En({width:i,height:o}),windowArea:En({width:a,height:u}),language:c,osName:xn(l),osVersion:f,SDKVersion:p,appId:e.appId,miniEnv:e.envVersion,miniVersion:e.version,hostName:"wx",hostVersion:s,platform:"wx"}}function fn(e){var n=e.filter(function(e){return e=e,!!!xe("component")[e]}),e=Ze(n).subjectMap;Se("component",e=e),ue("component",e),gn().componentSubject(n)}function ln(n){function e(e){G(e.methods)?n(e.methods):void 0!==e.methods&&null!==e.methods||(e.methods={},n(e.methods))}try{Component=ve(Component,e),Behavior=ve(Behavior,e)}catch(e){}}function pn(e,n){var t=e.filter(function(e){return e=e,!!!xe("page")[e]}),e=Ze(t).subjectMap;Se("page",e=e),ue("page",e),e=function(n){t.forEach(function(e){var r=ke(e),e=O(n,e,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(tn(this)&&r.next({that:this,param:en(e),time:Z()}),h(t))return t.apply(this,e)}})();e&&r.addTearDown(e)})},Page=ve(Page,e),ln(e)}function dn(e){var n=e.filter(function(e){return!se(e)}),t=Ze(n).subjectMap;Se("route",e=t),ue("route",e),n.forEach(function(i){var e=ie(gn().instance,i,function(o){void 0===o&&(o={}),ce(i).next({that:this,param:{url:o.url,delta:o.delta,name:"invoke",value:{errMsg:"invoke"}},time:Z()}),U.forEach(function(r){O(o,r,function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];ce(i).next({that:this,param:{url:o.url,delta:o.delta,name:r,value:en(e)||{}},time:Z()}),h(t)&&t.apply(this,e)}})()})});e&&t[i].addTearDown(e)})}function hn(a,e){var n=e.url,t=e.method,r=e.data,o=e.header,i=e.headers,c={api:a,request:{url:n,method:(n=t,"uploadFile"===(t=a)?"POST":"downloadFile"!==t&&n||"GET"),headers:o||i||{},body:v(r),timestamp:Z()},response:{}};O(e,"complete",function(u){return function(e){var n=c.response.timestamp||Z();c.duration=n-c.request.timestamp,c.completeCallbackTime=ee(u,e);var t,r,o,i=e.errMsg||e.errorMessage||e.error;c.response={status:(t=e.status,r=e.statusCode,o=c.response.status,0<=t?t:0<=r?r:o),timestamp:n,headers:e.header||e.headers||{},body:v(e.data),errMsg:i,timing:gn().buildRequestProfile(e.profile||{})},fe(a).next(c)}})(),O(e,"success",function(n){return function(e){c.response.timestamp=Z(),c.response.status=200,c.successCallbackTime=ee(n,e)}})(),O(e,"fail",function(n){return function(e){c.response.timestamp=Z(),c.response.status=-1,c.failCallbackTime=ee(n,e)}})()}function mn(e,t){void 0===t&&(t=gn().instance);var n=e.filter(function(e){return!le(e)}),r=Ze(n).subjectMap;Se("http",e=r),ue("http",e),n.forEach(function(n){var e=ie(t,n,function(e){hn(n,e)});e&&r[n].addTearDown(e)})}var vn,re=g((vn={},[function(e){if(!be().platform)throw Error("Not support current Mini Program");if(!Array.isArray(e)||!e.length)return null;e=e.find(function(e){return e.platform===be().platform});return e&&(vn=e.adapterCtor())},function(){return vn}]),2),bn=re[0],gn=re[1],yn=function(e){return"SLARDAR"+e},_n=function(e){try{return gn().getStorage(e)}catch(e){return}},wn=["darwin","macs","mac"],Sn=["windows_nt","windows","window"],xn=function(e){return cn(e)?"Android":"ios"===e.toLowerCase()?"iOS":~wn.indexOf(e.toLowerCase())?"Mac":~Sn.indexOf(e.toLowerCase())?"windows":"unknown"},En=function(e){var n=e.systemPlatform,t=e.pixelRatio,r=e.width,e=e.height;return n&&cn(n)&&t?r/t+" * "+e/t:r+" * "+e},kn=function(e){return function(e){var n,t={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&void 0!==e[n]&&null!==e[n]&&(t[n]=e[n]);return t}({domainLookupStart:e.domainLookupStart,domainLookupEnd:e.domainLookupEnd,connectStart:e.connectStart,secureConnectionStart:e.SSLconnectionStart,connectEnd:e.connectEnd,requestStart:e.requestStart,requestEnd:e.requestEnd,responseStart:e.responseStart,responseEnd:e.responseEnd,socketReused:e.socketReused,redirectStart:e.redirectStart,redirectEnd:e.redirectEnd,fetchStart:e.fetchStart,sendBytesCount:e.sendBytesCount,throughputKbps:e.throughputKbps,receivedBytedCount:e.receivedBytedCount})},_e={platform:"wx",adapterCtor:function(){return d(d({},{instance:t=void 0===t?be().instance:t,request:function(e){return t.request(e)},getStorage:function(e){return t.getStorageSync(e)},setStorage:function(e,n){return t.setStorageSync(e,n)},getCurrentPages:function(){return getCurrentPages()},buildHttpPayload:function(e){return e},monitorNetworkType:function(n){t.getNetworkType({success:function(e){n&&n({networkType:e.networkType})}}),t.onNetworkStatusChange(function(e){n&&n({networkType:e.networkType})})},performanceSubscriber:l,getSystemInfo:l,buildRequestProfile:l,componentSubject:l,setDataSubject:l,pagePerfSubscriber:l}),{miniPlatform:"wx",buildError:function(e){return c(e)?function(e){e=e.split("\n");return{name:g((e[2]&&e[2].split(":")||[]).map(function(e){return e.trim()}),1)[0],message:e&&e[1]&&e[1].trim(),stack:e.slice(2).join("\n")}}(e):{name:Q,message:v(e)}},getSystemInfo:sn,observePerformance:function(n){var e=wx.getPerformance&&wx.getPerformance();if(e){e=e.createObserver(function(e){e=e.getEntries().map(function(e){return d(d({},e),{name:function(e){switch(e){case"appLaunch":return"appClick";case"firstRender":return"fr";case"firstPaint":return"fp";case"firstContentfulPaint":return"fcp";case"largestContentfulPaint":return"lcp";default:return e}}(e.name)})});n(e)});return e.observe({entryTypes:e.supportedEntryTypes}),e}},performanceSubscriber:un,buildRequestProfile:function(e){return e=kn(n=e),n.protocol&&(e.protocol=n.protocol),e;var n},componentSubject:rn,pagePerfSubscriber:on,setDataSubject:an});var t}},On=function(e,n){void 0===n&&(n=K),e.on("init",function(){mn(n)})};function jn(){var u=tn(this),a=pe();var e=ie(this,"setData",function(){for(var t=this,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=r[0],i=Z();return[o,function(){var e=r[1],n=Z()-i;a.next({renderTime:n,url:u,data:o,startTime:i}),e&&e.call(t)}]});e&&a.addTearDown(e)}function Cn(){var e;xe("setData")||(e=(e=Ze(["setData"]).getSubject)("setData"),we("setData",e),ae("setData",e))}function Pn(o){return Object.keys(o).reduce(function(e,n){var t,r;return r=o[t=n],t&&r&&(In.test(t)||Rn.test(r))||(e[n]=o[n]),e},{})}var Tn=function(e){e.on("init",function(){Cn(),ke("onLoad").subscribe(function(e){e=e.that;jn.call(e)}),gn().setDataSubject(jn)})},Dn=function(e){e.on("init",function(){var n,e,t,r=gn();r.observePerformance&&!de()&&(n=(0,Ze(["performance"]).getSubject)("performance"),we("performance",e=n),ae("performance",e),(t=r.observePerformance(function(e){e.forEach(function(e){n.next(e)})}))&&t.disconnect&&n.addTearDown(function(){return t.disconnect()}))})},In=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),Rn=new RegExp("(bearer|session)","i"),Mn=function(){return function(e,s){var n=e.hookRequest,t=e.hookDownloadFile,r=e.hookUploadFile,f=e.ignoreUrls,l=e.collectBodyOnError,p=e.extraExtractor,e=function(e){var n,t,r,o,i,u,a,c;!function(e,n){e=m(e||[]);return!!e&&e.test(n)}(f,e.request.url)&&(c=e.response,n=e.request,t=e.api,r=e.duration,o=e.failCallbackTime,a=e.successCallbackTime,i=e.completeCallbackTime,n.headers=Pn(n.headers||{}),c.headers=Pn(c.headers||{}),u=c.errMsg,e=function(e,n){var t={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);return t}(c,["errMsg"]),e=d(d({},e),{is_custom_error:!1}),u&&(e.err_msg=u),a={api:t,request:n,duration:r,cbTime:i+(o||0)+(a||0),response:e},!h(p)||(e=p(c.body,a))&&(a.extra=e,a.response.is_custom_error=!0),l&&(0===(c=c.status)||400<=c)||(delete a.request.body,delete a.response.body),s({ev_type:"http",payload:a}))};n&&fe("request").subscribe(e),t&&fe("downloadFile").subscribe(e),r&&fe("uploadFile").subscribe(e)}},Nn=function(e,n,t,r){void 0===n&&(n={}),void 0===r&&(r=[]);try{var o=e.apply(void 0,y([],g(r),!1));return o&&o(n,t)||[]}catch(e){return C("applyMonitor",e),[]}};function qn(e,n,t){me(e);n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return w(n)?d(d({},t),n):!!n&&t}function Ln(e,n){return e&&n&&e===n}function An(){var r;return function(e){try{if(t=r,!(!(n=e)||!t)&&!(!Ln(n.message,t.message)&&!Ln(n.stack,t.stack)))return void(r=e)}catch(e){}var n,t;return r=e}}var Bn,Fn="http",zn={hookRequest:!0,hookDownloadFile:!0,hookUploadFile:!0,ignoreUrls:[],collectBodyOnError:!1},Vn=function(f){return void 0===f&&(f=gn()),function(e,r){var n=e.ignoreErrors,t=e.hookOnError,o=e.hookOnUnhandledRejection,i=e.hookRouteError,u=e.dedupe,a=m(n),c=An(),s=function(e,n,t){e=u?c(e):e;e&&(a&&a.test(e.message)||(e={error:e},n&&(e.extra=n),t&&(e.react=t),r(e)))};t&&Ee(L.onError).subscribe(function(e){e=e.param,e=f.buildError(e);a&&a.test(e.message)||s(e)}),o&&Ee(L.onUnhandledRejection).subscribe(function(e){var n=e.param||{},e=n.promise,t=v(n.reason);a&&a.test(t)||e.catch(b).then(function(e){var n={name:"UnhandledRejection",message:t};e&&e.stack&&(n.stack=e.stack),s(n)})});return i&&~["tt","wx","lark"].indexOf(f.miniPlatform)&&Oe(function(e){e=e.param;"fail"===(e=e).name&&s({name:"RouteError",message:e.value.errMsg})}),[s]}};(re=Bn=Bn||{}).history="history",re.manual="manual";function Un(t,e,r){var o=e,i=null,u=0,n="launch";function a(e,n){o=n,u=Z(),r(n,i=n+"_"+u),t(e,n)}return Ee(L.onShow).pipe(Ye(1)).subscribe(function(){n="show"}),Oe(function(){n="history"}),[a,function(e){e&&(a(n,e),n="history")},function(e){void 0===e&&(e="hide"),i&&(r(o,i),i=null,t(e,o,Z()-u))}]}var Hn=function(){return function(e,r){var n=e.extractPid,t=e.routeMode,o=e.setPidAndViewId,i=function(e){return n?n(e):e},e=g(Un(function(e,n,t){r({ev_type:"pageview",payload:{pid:n,source:e,duration:t}})},"",o),3),o=e[0],u=e[1],e=e[2];return t!==Bn.manual&&(ke("onShow").subscribe(function(e){return function(e){e=tn(e),e=i(e);u(e)}(e.that)}),ke("onUnload").subscribe(e.bind(null,"unload")),ke("onHide").subscribe(e.bind(null,"hide"))),[o.bind(null,"user_set"),e]}},Gn=function(){return function(e){var n=g(function(n,t,r){void 0===n&&(n=20),void 0===t&&(t=b),void 0===r&&(r=function(e,n){return e.slice(-n)});var o=[];return[function(){return o},function(e){t(e)&&(e=d(d({},e),{timestamp:e.timestamp||Date.now()}),o=0<=n&&o.length+1>n?r(y(y([],g(o),!1),[e],!1),n):y(y([],g(o),!1),[e],!1))}]}(e.maxBreadcrumbs,e.onAddBreadcrumb,e.onMaxBreadcrumbs),2),e=n[0],r=n[1];return K.forEach(function(e){le(e)&&fe(e).subscribe(function(e){r({type:"http",category:e.api,message:"",data:{method:e.request.method,url:e.request.url,status_code:String(e.response.status)},timestamp:e.request.timestamp})})}),Oe(function(e,n){var t=e.param,e=e.time;"complete"===t.name&&r({type:"route",category:n,message:t.value.errMsg||t.value.errorMessage||"",timestamp:e,data:{url:t.url||""}})}),[e,r]}},Kn=function(){return function(e,t){var r=e.isCalculateSize;pe().subscribe(function(e){var n={duration:e.renderTime,start_time:e.startTime};r&&(n.size=(e=e.data,TextEncoder?(new TextEncoder).encode(v(e)).length:2*v(e).length)),t({ev_type:"set_data",payload:n})})}},Jn=function(){return function(e,n){function t(){n({ev_type:"app_launch_perf",payload:r}),o=!0}var r={activate_start:0,init_end:0,page_load_start:0,page_dom_end:0,page_render_end:0},o=!1;Ee(L.onLaunch).pipe(Je(1)).subscribe(function(e){r.activate_start=e.time}),Ee(L.onShow).pipe(Je(1)).subscribe(function(e){r.init_end=e.time}),ke("onLoad").pipe(Je(1)).subscribe(function(e){r.page_load_start=e.time}),ke("onShow").pipe(Je(1)).subscribe(function(e){r.page_dom_end=e.time});var i=de();ke("onReady").pipe(Je(1)).subscribe(function(e){r.page_render_end=e.time,i&&!r.trigger||t()}),i&&je().pipe(We(function(e){return"appClick"===e.name}),Je(1)).subscribe(function(e){r.trigger=e.startTime,r.page_render_end&&t()}),Ee(L.onHide).subscribe(function(){o||t()})}},Wn=function(){return function(e,n){gn().pagePerfSubscriber(function(e){return n({ev_type:"page_perf",payload:e})})}},Yn=function(n){return void 0===n&&(n=gn()),function(e,t){var r,o;de()&&n.performanceSubscriber&&(r=0,ke("onLoad").subscribe(function(e){o=e.time,r++}),n.performanceSubscriber(function(e){var n={is_custom:!1,name:e.name,value:e.startTime,type:"perf",count:r};n.duration=e.duration||(o?e.startTime-o:0),n.is_support=0<=n.duration,t({ev_type:"performance",payload:n})}))}},$n="pageview",Qn={routeMode:Bn.history,setPidAndViewId:function(e,n){}},Xn="jsError",Zn={ignoreErrors:[],hookOnError:!0,hookOnUnhandledRejection:!0,hookRouteError:!0,dedupe:!0},et=function(t){return function(e){var n=t.getBreadcrumbs&&t.getBreadcrumbs()||[];t.report({ev_type:"js_error",payload:d(d({},e),{breadcrumbs:n})})}},nt={maxBreadcrumbs:20,tap:!0},rt="breadcrumb",ot=function(n){n.on("init",function(){n.provide("_subscriptions",[]),me(n),n.on("init",function(){nn(W),pn($),fn(Y)}),n.on("init",function(){dn(J)})}),n.on("beforeDestroy",function(){if(n._subscriptions)for(;n._subscriptions.length;)n._subscriptions.shift().unsubscribe();for(var e in n)delete n[e]})},it="setData",ut={isCalculateSize:!1},at="appLaunchPerf",ct={},st="pagePerf",ft={},lt="performance",pt={},dt=function(e,n,t){void 0===t&&(t=gn());var r=n.url,o=n.data,i=n.success,u=void 0===i?l:i,a=n.fail,c=void 0===a?l:a,i=n.header,a={"Content-Type":"application/json"};G(n=i)&&0!==Object.keys(n).length&&Object.assign(a,i),t.request({method:e,url:r,data:o,header:a,headers:a,success:function(e){u(e)},fail:function(e){e=e.errMsg||"Network request failed";c(new Error(e))}})},ht=function(n){return(n=void 0===n?gn():n)?{get:function(e){return dt("GET",e,n)},post:function(e){return dt("POST",e,n)}}:{get:l,post:l}};function mt(e){return e=yn(String(e)),(e=_n(e))&&e.userId&&e.deviceId?e:{userId:T(),deviceId:T()}}function vt(e){return e+"_"+Date.now()}function bt(e){var n=e.aid,t=e.userId,e=e.deviceId;!function(e,n){try{gn().setStorage(e,n)}catch(e){}}(yn(String(n)),{userId:t,deviceId:e})}var gt={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:d(d({},e.extra||{}),e.overrides||{})}}},yt="/monitor_mini/collect",_t="/settings/minipro",wt="apmplus.volces.com",St="session",xt={sample_rate:1,include_users:[],sample_granularity:St,rules:{}},Et=[yt,_t],kt="0.2.3-alpha.0",Ot="APM_PLUS_MINI_PROGRAM",jt=function(e,n){return void 0===n&&(n=yt),(e&&0<=e.indexOf("//")?"":"https://")+e+n};function Ct(e){e=mt(e.aid);return{aid:0,token:"",pid:"",viewId:vt("_"),userId:e.userId,deviceId:e.deviceId,sessionId:T(),domain:wt,plugins:{breadcrumb:{},pageview:{},jsError:{},http:{ignoreUrls:Et},setData:{},appLaunchPerf:{},pagePerf:{},performance:{}},sample:xt,sdkName:Ot,sdkVersion:kt}}function Pt(e){var n,t=e.plugins||{};for(n in t)t[n]&&!w(t[n])&&(t[n]={});return d(d({},e),{plugins:t})}function Tt(e){return w(e)&&"aid"in e&&"token"in e}function Dt(e){return d({},e)}var It=function(n){var r,o,i=n,u={},a=void 0,c=l,t=l;return{getConfig:function(){return i},setConfig:function(e){var n,t;return u=d(d({},u),e||{}),s(),r||(r=e,i.useLocalConfig||!i.aid?(o={},c()):a?f():(n=i.domain,e=i.aid,t=function(e){a=e,f()},ht().get({url:function(e,n){return void 0===n&&(n=_t),(e&&0<=e.indexOf("//")?"":"https://")+e+n}(n)+"?biz_id="+e,success:function(e){t(e&&e.data&&e.data.data||{})},fail:function(){t({sample:{sample_rate:.001}})}}))),i},onChange:function(e){t=e},onReady:function(e){c=function(){bt(i),e()},o&&c()}};function s(){var e=d(d(d({},n),o||{}),u);e.plugins=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t={},r=0;r<e.length;)t=p(t,e[r++]);return t}(n.plugins,(null==o?void 0:o.plugins)||{},u.plugins||{}),e.sample=Rt(Rt(n.sample,null==o?void 0:o.sample),u.sample),i=e,t()}function f(){o=function(e){if(!e)return{};var n=e.sample,t=e.user_id,r=e.timestamp,o=t?{userId:t}:{};if(!n)return o;var i=n.sample_rate,e=n.sample_granularity,t=void 0===e?St:e,e=n.include_users,n=n.rules,n=void 0===n?[]:n;return d(d({},o),{sample:{include_users:e,sample_rate:i,sample_granularity:t,rules:n.reduce(function(e,n){var t=n.name,r=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[t]={enable:r,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r})}(a),function(e){e=yn(e);return!!gn().getStorage(e)}(String(i.aid))&&(o.userId=n.userId),s(),c()}};function Rt(r,o){if(!r||!o)return r||o;var e=d(d({},r),o);return e.include_users=y(y([],g(r.include_users||[]),!1),g(o.include_users||[]),!1),e.rules=y(y([],g(Object.keys(r.rules||{})),!1),g(Object.keys(o.rules||{})),!1).reduce(function(e,n){var t;return n in e||(n in(r.rules||{})&&n in(o.rules||{})?(e[n]=d(d({},r.rules[n]),o.rules[n]),e[n].conditional_sample_rules=y(y([],g(r.rules[n].conditional_sample_rules||[]),!1),g(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(t=r.rules)||void 0===t?void 0:t[n])||(null===(t=o.rules)||void 0===t?void 0:t[n])),e},{}),e}function Mt(e){var n={url:(n=gn().getCurrentPages().pop())?(n?tn(n):"")+s(n.options):"",timestamp:Z()};return d(d({},e),{extra:d(d({},n),null!==(e=e.extra)&&void 0!==e?e:{})})}function Nt(e){if(!bn(e))throw Error(V);var t,e=function(e){var t,r,n=e.builder,o=e.createSender,i=e.createDefaultConfig,u=e.createConfigManager,a=e.userConfigNormalizer,c=e.initConfigNormalizer,s=e.validateInitConfig,f={};_.forEach(function(e){return f[e]=[]});var l=!1,p=!1,d=!1,h=[],m=[],v={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return h},init:function(e){if(l)E("already inited");else{if(!(e&&w(e)&&s(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=c(e);if((r=u(n)).setConfig(e),r.onChange(function(){b("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");b("init",l=!0)}},set:function(e){l&&e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&w(e)&&(b("beforeConfig",!1,e),null!=r&&r.setConfig(a(e))),null==r?void 0:r.getConfig()},provide:function(e,n){S(m,e)?E("cannot provide "+e+", reserved"):(v[e]=n,b("provide",!1,e))},start:function(){var n=this;l&&(p||null!=r&&r.onReady(function(){b("start",p=!0),h.forEach(function(e){return n.build(e)}),h=[]}))},report:function(e){e&&(!(e=k(f.beforeReport)(e))||(e=k(f.report)(e))&&(p?this.build(e):h.push(e)))},build:function(e){!p||(e=k(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=k(f.build)(e))&&this.send(e))},send:function(e){!p||(e=k(f.beforeSend)(e))&&(t.send(e),b("send",!1,e))},destroy:function(){b("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&p||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=x(f[e],n))}},m=Object.keys(v);return v;function b(e,n){void 0===n&&(n=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[e].forEach(function(e){try{e.apply(void 0,y([],g(t),!1))}catch(e){}}),n&&(f[e].length=0)}}({validateInitConfig:Tt,initConfigNormalizer:Pt,userConfigNormalizer:Dt,createSender:function(e){return n({size:H,endpoint:jt(e.domain),transport:ht()})},builder:gt,createDefaultConfig:Ct,createConfigManager:It});return D(e),Ft(e),Lt(e),At(e),A(e),ot(e),(t=e).on("init",function(){var n=[],e=t.config();e&&e.integrations&&e.integrations.forEach(function(e){S(n,e.name)||(n.push(e.name),e.setup(t),e.tearDown&&t.on("beforeDestroy",e.tearDown))})}),Bt(e),qt(e),e}var qt=function(n){function t(e){return void 0===e&&(e=gn().getSystemInfo()),n.set(d({},e))}function r(){t(),e()}var o,i,u=!1,e=(i="",function(){var e=o.getSender();i=i||e.getEndpoint();var n=o.config(),n={did:n.deviceId,sid:n.sessionId,sname:n.sdkName,sver:n.sdkVersion,soffset:n.offset||0,model:n.model,brand:n.brand,ratio:n.pixelRatio,screen:n.screenArea,window:n.windowArea,lang:n.language,osname:n.osName,osver:n.osVersion,libver:n.SDKVersion,scene:n.scene||-1,menv:n.miniEnv,mver:n.miniVersion,hostname:n.hostName,hostver:n.hostVersion,platform:n.platform,biz_id:n.aid,x_auth_token:n.token};e.setEndpoint(i+s(n))});(o=n).on("start",function(){r(),u=!0}),n.on("init",function(){Ee(L.onLaunch).pipe(Je(1)).subscribe(function(e){e=e.param.scene||-1;t({scene:e}),u&&r()}),gn().monitorNetworkType(function(e){e=e.networkType;n.set({networkType:e})})})},Lt=function(r){r.on("beforeBuild",function(e){return n=e,t=r.config(),(e={}).aid=t.aid,e.pid=t.pid,e.view_id=t.viewId,e.user_id=t.userId,e.network_type=t.networkType,d(d({},n),{extra:d(d({},e),null!==(n=n.extra)&&void 0!==n?n:{})});var n,t})},At=function(e){e.on("report",Mt)},Bt=function(n){n.on("init",function(){Ee(L.onHide).subscribe(function(){var e=n.getSender();e&&e.flush()})})},Ft=function(t){var r,o=!1;t.on("init",function(){r=Z(),t.on("config",function(){var e,n=null===(e=t.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=Z())-r<1e3&&n&&(e=n-(e+r)/2,isNaN(e)||t.set({offset:e})))})})},re=function(e){var n,t,r,i,o,u,a,c,s,e=Nt(e);if(e)return(n=e).provide("sendEvent",function(e){e=F(e);e&&n.report({ev_type:B,payload:e,extra:{timestamp:Date.now()}})}),n.provide("sendLog",function(e){e=z(e);e&&n.report({ev_type:B,payload:e,extra:{timestamp:Date.now()}})}),(t=e).on("init",function(){var e,n=qn(t,$n,Qn);n&&(n=(e=g(Nn(Hn,d(d({},n),{setPidAndViewId:function(e,n){t.set({pid:e,viewId:n,actionId:void 0})}}),t.report.bind(t)),2))[0],e=e[1],t.provide("sendPageview",n),t.provide("sendPageviewWithHide",e))}),(r=e).on("init",function(){var e,n=qn(r,Xn,Zn);n&&(e=et(r),e=g(Nn(Vn,n,e),1)[0],r.provide("captureException",e))}),(i=e).on("init",function(){var e,n,t,r,o=qn(i,Fn,zn);o&&(e=o.hookRequest,n=o.hookDownloadFile,t=o.hookUploadFile,r=[],e&&r.push("request"),n&&r.push("downloadFile"),t&&r.push("uploadFile"),On(i,r),Nn(Mn,o,i.report.bind(i)))}),(o=e).on("init",function(){var e=qn(o,it,ut);e&&(Tn(o),Nn(Kn,e,o.report.bind(o)))}),(u=e).on("init",function(){var e,n=qn(u,rt,nt);n&&(n=(e=g(Nn(Gn,n,function(e){}),2))[0],e=e[1],u.provide("getBreadcrumbs",n),u.provide("addBreadcrumb",e))}),(a=e).on("init",function(){var e=qn(a,at,ct);e&&(Dn(a),Nn(Jn,e,a.report.bind(a)))}),(c=e).on("init",function(){var e=qn(c,st,ft);e&&Nn(Wn,e,c.report.bind(c))}),(s=e).on("init",function(){var e=qn(s,lt,pt);e&&(Dn(s),Nn(Yn,e,s.report.bind(s)))}),e}.bind(null,[_e]),_e=re();return _e.createClient=re,_e}); |
{ | ||
"name": "@apmplus/mini-program", | ||
"version": "0.2.2", | ||
"version": "0.2.3-alpha.0", | ||
"description": "apmplus for mini program", | ||
@@ -17,4 +17,4 @@ "main": "cn/index.cjs.js", | ||
"@slardar/rollup": "0.0.3-alpha.0", | ||
"@slardar/sdk-mini-program": "0.0.16", | ||
"@slardar/sdk-template": "1.1.10" | ||
"@slardar/sdk-mini-program": "0.0.17", | ||
"@slardar/sdk-template": "1.1.11" | ||
}, | ||
@@ -29,9 +29,2 @@ "ava": { | ||
}, | ||
"nyc": { | ||
"extends": "@istanbuljs/nyc-config-typescript", | ||
"extension": [".ts"], | ||
"include": ["**/*.ts"], | ||
"exclude": ["**/__tests__/**/*.*", "**/__test__/**/*.*", "**/vendors/**/*.*"], | ||
"check-coverage": false | ||
}, | ||
"scripts": { | ||
@@ -42,7 +35,6 @@ "test": "ava", | ||
"build-local": "NODE_ENV=development batch-rollup -d ./rollup -f platforms", | ||
"cover-c8": "c8 ava", | ||
"cover": "c8 -c='../../tools/sub-c8rc.json' ava", | ||
"testHelper": "ava ./src/__test__/client.spec.ts", | ||
"cover": "nyc --reporter=json ava && nyc report", | ||
"benchmark-mini": "run-benchmark -p ./.benchmark/index.js -t 6000 -o -d" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
675057
3625