mono/reference/tiktok/files/npm-dp-byted-tea-sdk-oversea.5fea89cf.js
2026-01-29 18:35:51 +01:00

1 line
218 KiB
JavaScript

"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([["63657"],{80249:function(e,t,n){let i,r,o;n.r(t),n.d(t,{Collector:function(){return iw}});var a,s=function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function c(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,s)}c((i=i.apply(e,t||[])).next())})}function l(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){var c=[o,s];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&c[0]?i.return:c[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,c[1])).done)return r;switch(i=0,r&&(c=[2&c[0],r.value]),c[0]){case 0:case 1:r=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,i=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]<r[3])){a.label=c[1];break}if(6===c[0]&&a.label<r[1]){a.label=r[1],r=c;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(c);break}r[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],i=0}finally{n=r=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function u(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}(arguments[t]));return e}var h,d=function(){function e(){this._hooks={},this._cache=[],this._hooksCache={}}return e.prototype.on=function(e,t){e&&t&&"function"==typeof t&&(this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t))},e.prototype.once=function(e,t){var n=this;e&&t&&"function"==typeof t&&this.on(e,function i(r){t(r),n.off(e,i)})},e.prototype.off=function(e,t){if(e&&this._hooks[e]&&this._hooks[e].length)if(t){var n=this._hooks[e].indexOf(t);-1!==n&&this._hooks[e].splice(n,1)}else this._hooks[e]=[]},e.prototype.emit=function(e,t,n){n?e&&(-1!==this._cache.indexOf(n)?this._emit(e,t):(this._hooksCache.hasOwnProperty(n)||(this._hooksCache[n]={}),this._hooksCache[n].hasOwnProperty(e)||(this._hooksCache[n][e]=[]),this._hooksCache[n][e].push(t))):this._emit(e,t)},e.prototype._emit=function(e,t){e&&this._hooks[e]&&this._hooks[e].length&&u(this._hooks[e]).forEach(function(e){try{e(t)}catch(e){}})},e.prototype.set=function(e){e&&-1===this._cache.indexOf(e)&&this._cache.push(e)},e}(),f=function(e){return null!=e&&"[object Object]"==Object.prototype.toString.call(e)},p=function(e){return Array.isArray(e)},g=(h=+Date.now()+Number((""+Math.random()).slice(2,8)),function(){return h+=1}),_=function(e){return function(e,t,n){if("string"==typeof e&&"number"==typeof n){var i,r=[],o=String.fromCharCode((n=n<=25?n:n%25)+97);i=e.split(o);for(var a=0;a<i.length;a++){var s=parseInt(i[a],n),c=String.fromCharCode(s^=64);r.push(c)}return r.join("")}}(e,64,25)},m=function(){return!!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)},v=function(e){m()?window.addEventListener("pagehide",e,!1):window.addEventListener("beforeunload",e,!1)},y=function(){var e=0;return["hidden","msHidden","webkitHidden"].forEach(function(t){void 0!==document[t]&&(e=1)}),e},b=function(e){var t=document.createElement("a");return t.href=e,t},E=function(e){var t={};try{var n=b(e).search;(n=n.slice(1)).split("&").forEach(function(e){var n,i,r=e.split("=");r.length&&(n=r[0],i=r[1]);try{t[n]=decodeURIComponent(void 0===i?"":i)}catch(e){t[n]=i}})}catch(e){}return t},w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function S(){throw Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function z(e,t){return e(t={exports:{}},t.exports),t.exports}var k,D,T=z(function(e,t){e.exports=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var i in n)t[i]=n[i]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(i){function r(){}function o(t,n,o){if("undefined"!=typeof document){"number"==typeof(o=e({path:"/"},r.defaults,o)).expires&&(o.expires=new Date(+new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var a=JSON.stringify(n);/^[\{\[]/.test(a)&&(n=a)}catch(e){}n=i.write?i.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var c in o)o[c]&&(s+="; "+c,!0!==o[c]&&(s+="="+o[c].split(";")[0]));return document.cookie=t+"="+n+s}}function a(e,n){if("undefined"!=typeof document){for(var r={},o=document.cookie?document.cookie.split("; "):[],a=0;a<o.length;a++){var s=o[a].split("="),c=s.slice(1).join("=");n||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var l=t(s[0]);if(c=(i.read||i)(c,l)||t(c),n)try{c=JSON.parse(c)}catch(e){}if(r[l]=c,e===l)break}catch(e){}}return e?r[e]:r}}return r.set=o,r.get=function(e){return a(e,!1)},r.getJSON=function(e){return a(e,!0)},r.remove=function(t,n){o(t,"",e(n,{expires:-1}))},r.defaults={},r.withConverter=n,r}(function(){})}()}),A=z(function(e,t){e.exports=(function e(t,n,i){function r(a,s){if(!n[a]){if(!t[a]){if(!s&&S)return S();if(o)return o(a,!0);var c=Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){return r(t[a][1][e]||e)},l,l.exports,e,t,n,i)}return n[a].exports}for(var o=S,a=0;a<i.length;a++)r(i[a]);return r})({1:[function(e,t,n){(function(e){var n,i,r=e.MutationObserver||e.WebKitMutationObserver;if(r){var o=0,a=new r(u),s=e.document.createTextNode("");a.observe(s,{characterData:!0}),n=function(){s.data=o=++o%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var c=new e.MessageChannel;c.port1.onmessage=u,n=function(){c.port2.postMessage(0)}}var l=[];function u(){var e,t;i=!0;for(var n=l.length;n;){for(t=l,l=[],e=-1;++e<n;)t[e]();n=l.length}i=!1}t.exports=function(e){1!==l.push(e)||i||n()}}).call(this,void 0!==w?w:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var i=e(1);function r(){}var o={},a=["REJECTED"],s=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==r&&f(this,e)}function u(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(e,t,n){i(function(){var i;try{i=t(n)}catch(t){return o.reject(e,t)}i===e?o.reject(e,TypeError("Cannot resolve promise with itself")):o.resolve(e,i)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var n=!1;function i(t){n||(n=!0,o.reject(e,t))}function r(t){n||(n=!0,o.resolve(e,t))}var a=p(function(){t(r,i)});"error"===a.status&&i(a.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=l,l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===a)return this;var n=new this.constructor(r);return this.state!==c?h(n,this.state===s?e:t,this.outcome):this.queue.push(new u(n,e,t)),n},u.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},u.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},u.prototype.callRejected=function(e){o.reject(this.promise,e)},u.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},o.resolve=function(e,t){var n=p(d,t);if("error"===n.status)return o.reject(e,n.value);var i=n.value;if(i)f(e,i);else{e.state=s,e.outcome=t;for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callFulfilled(t)}return e},o.reject=function(e,t){e.state=a,e.outcome=t;for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:o.resolve(new this(r),e)},l.reject=function(e){var t=new this(r);return o.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var a=Array(n),s=0,c=-1,l=new this(r);++c<n;)!function(e,r){t.resolve(e).then(function(e){a[r]=e,++s!==n||i||(i=!0,o.resolve(l,a))},function(e){i||(i=!0,o.reject(l,e))})}(e[c],c);return l},l.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(TypeError("must be an array"));var t=e.length,n=!1;if(!t)return this.resolve([]);for(var i,a=-1,s=new this(r);++a<t;)i=e[a],this.resolve(i).then(function(e){n||(n=!0,o.resolve(s,e))},function(e){n||(n=!0,o.reject(s,e))});return s}},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==w?w:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function o(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(r){if("TypeError"!==r.name)throw r;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),i=0;i<e.length;i+=1)n.append(e[i]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function s(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function l(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function u(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var h=void 0,d={},f=Object.prototype.toString;function p(e){var t=d[e.name],n={};n.promise=new a(function(e,t){n.resolve=e,n.reject=t}),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then(function(){return n.promise}):t.dbReady=n.promise}function g(e){var t=d[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var n=d[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function m(e,t){return new a(function(n,i){if(d[e.name]=d[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);p(e),e.db.close()}var o=[e.name];t&&o.push(e.version);var a=r.open.apply(r,o);t&&(a.onupgradeneeded=function(t){var n=a.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore("local-forage-detect-blob-support")}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),i(a.error)},a.onsuccess=function(){var t=a.result;t.onversionchange=function(e){e.target.close()},n(t),g(e)}})}function v(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,r=e.version>e.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),r||n){if(n){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function y(e){return o([function(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),r=0;r<t;r++)i[r]=e.charCodeAt(r);return n}(atob(e.data))],{type:e.type})}function b(e){return e&&e.__local_forage_encoded_blob}function E(e){var t=this,n=t._initReady().then(function(){var e=d[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return c(n,e,e),n}function w(e,t,n,i){void 0===i&&(i=1);try{var r=e.db.transaction(e.storeName,t);n(null,r)}catch(r){if(i>0&&(!e.db||"InvalidStateError"===r.name||"NotFoundError"===r.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===r.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),m(e,!0)}).then(function(){return(function(e){p(e);for(var t=d[e.name],n=t.forages,i=0;i<n.length;i++){var r=n[i];r._dbInfo.db&&(r._dbInfo.db.close(),r._dbInfo.db=null)}return e.db=null,m(e,!1).then(function(t){return e.db=t,v(e)?m(e,!0):t}).then(function(i){e.db=t.db=i;for(var r=0;r<n.length;r++)n[r]._dbInfo.db=i}).catch(function(t){throw _(e,t),t})})(e).then(function(){w(e,t,n,i-1)})}).catch(n);n(r)}}var S={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var r=d[n.name];r||(r={forages:[],db:null,dbReady:null,deferredOperations:[]},d[n.name]=r),r.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=E);var o=[];function s(){return a.resolve()}for(var c=0;c<r.forages.length;c++){var l=r.forages[c];l!==t&&o.push(l._initReady().catch(s))}var u=r.forages.slice(0);return a.all(o).then(function(){return n.db=r.db,m(n,!1)}).then(function(e){return n.db=e,v(n,t._defaultConfig.version)?m(n,!0):e}).then(function(e){n.db=r.db=e,t._dbInfo=n;for(var i=0;i<u.length;i++){var o=u[i];o!==t&&(o._dbInfo.db=n.db,o._dbInfo.version=n.version)}})},_support:function(){try{if(!r||!r.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,i=new a(function(t,i){n.ready().then(function(){w(n._dbInfo,"readonly",function(r,o){if(r)return i(r);try{var a=o.objectStore(n._dbInfo.storeName).openCursor(),s=1;a.onsuccess=function(){var n=a.result;if(n){var i=n.value;b(i)&&(i=y(i));var r=e(i,n.key,s++);void 0!==r?t(r):n.continue()}else t()},a.onerror=function(){i(a.error)}}catch(e){i(e)}})}).catch(i)});return s(i,t),i},getItem:function(e,t){var n=this;e=l(e);var i=new a(function(t,i){n.ready().then(function(){w(n._dbInfo,"readonly",function(r,o){if(r)return i(r);try{var a=o.objectStore(n._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),b(e)&&(e=y(e)),t(e)},a.onerror=function(){i(a.error)}}catch(e){i(e)}})}).catch(i)});return s(i,t),i},setItem:function(e,t,n){var i=this;e=l(e);var r=new a(function(n,r){var s;i.ready().then(function(){var e;return s=i._dbInfo,"[object Blob]"===f.call(t)?(e=s.db,"boolean"==typeof h?a.resolve(h):new a(function(t){var n=e.transaction("local-forage-detect-blob-support","readwrite"),i=o([""]);n.objectStore("local-forage-detect-blob-support").put(i,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/);t(navigator.userAgent.match(/Edge\//)||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1}).then(function(e){return h=e})).then(function(e){return e?t:new a(function(e,n){var i=new FileReader;i.onerror=n,i.onloadend=function(n){e({__local_forage_encoded_blob:!0,data:btoa(n.target.result||""),type:t.type})},i.readAsBinaryString(t)})}):t}).then(function(t){w(i._dbInfo,"readwrite",function(o,a){if(o)return r(o);try{var s=a.objectStore(i._dbInfo.storeName);null===t&&(t=void 0);var c=s.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){try{var e=c.error?c.error:c.transaction.error;r(e)}catch(e){r(e)}}}catch(e){r(e)}})}).catch(r)});return s(r,n),r},removeItem:function(e,t){var n=this;e=l(e);var i=new a(function(t,i){n.ready().then(function(){w(n._dbInfo,"readwrite",function(r,o){if(r)return i(r);try{var a=o.objectStore(n._dbInfo.storeName).delete(e);o.oncomplete=function(){t()},o.onerror=function(){i(a.error)},o.onabort=function(){try{var e=a.error?a.error:a.transaction.error;i(e)}catch(e){i(e)}}}catch(e){i(e)}})}).catch(i)});return s(i,t),i},clear:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){w(t._dbInfo,"readwrite",function(i,r){if(i)return n(i);try{var o=r.objectStore(t._dbInfo.storeName).clear();r.oncomplete=function(){e()},r.onabort=r.onerror=function(){try{var e=o.error?o.error:o.transaction.error;n(e)}catch(e){n(e)}}}catch(e){n(e)}})}).catch(n)});return s(n,e),n},length:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){w(t._dbInfo,"readonly",function(i,r){if(i)return n(i);try{var o=r.objectStore(t._dbInfo.storeName).count();o.onsuccess=function(){e(o.result)},o.onerror=function(){n(o.error)}}catch(e){n(e)}})}).catch(n)});return s(n,e),n},key:function(e,t){var n=this,i=new a(function(t,i){e<0?t(null):n.ready().then(function(){w(n._dbInfo,"readonly",function(r,o){if(r)return i(r);try{var a=o.objectStore(n._dbInfo.storeName),s=!1,c=(a.openKeyCursor||a.openCursor).call(a);c.onsuccess=function(){var n=c.result;n?0===e||s?t(n.key):(s=!0,n.advance(e)):t(null)},c.onerror=function(){i(c.error)}}catch(e){i(e)}})}).catch(i)});return s(i,t),i},keys:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){w(t._dbInfo,"readonly",function(i,r){if(i)return n(i);try{var o=r.objectStore(t._dbInfo.storeName),a=(o.openKeyCursor||o.openCursor).call(o),s=[];a.onsuccess=function(){var t=a.result;t?(s.push(t.key),t.continue()):e(s)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return s(n,e),n},dropInstance:function(e,t){t=u.apply(this,arguments);var n,i=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||i.name,e.storeName=e.storeName||i.storeName),e.name){var o=e.name===i.name&&this._dbInfo.db?a.resolve(this._dbInfo.db):m(e,!1).then(function(t){var n=d[e.name],i=n.forages;n.db=t;for(var r=0;r<i.length;r++)i[r]._dbInfo.db=t;return t});n=e.storeName?o.then(function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;p(e);var i=d[e.name],o=i.forages;t.close();for(var s=0;s<o.length;s++){var c=o[s];c._dbInfo.db=null,c._dbInfo.version=n}return new a(function(t,i){var o=r.open(e.name,n);o.onerror=function(e){o.result.close(),i(e)},o.onupgradeneeded=function(){o.result.deleteObjectStore(e.storeName)},o.onsuccess=function(){var e=o.result;e.close(),t(e)}}).then(function(e){i.db=e;for(var t=0;t<o.length;t++){var n=o[t];n._dbInfo.db=e,g(n._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}):o.then(function(t){p(e);var n=d[e.name],i=n.forages;t.close();for(var o=0;o<i.length;o++)i[o]._dbInfo.db=null;return new a(function(t,n){var i=r.deleteDatabase(e.name);i.onerror=function(){var e=i.result;e&&e.close(),n(i.error)},i.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},i.onsuccess=function(){var e=i.result;e&&e.close(),t(e)}}).then(function(e){n.db=e;for(var t=0;t<i.length;t++)g(i[t]._dbInfo)}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else n=a.reject("Invalid arguments");return s(n,t),n}},z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=/^~~local_forage_type~([^~]+)~/,D=Object.prototype.toString;function T(e){var t,n,i,r,o,a=.75*e.length,s=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var l=new ArrayBuffer(a),u=new Uint8Array(l);for(t=0;t<s;t+=4)n=z.indexOf(e[t]),i=z.indexOf(e[t+1]),r=z.indexOf(e[t+2]),o=z.indexOf(e[t+3]),u[c++]=n<<2|i>>4,u[c++]=(15&i)<<4|r>>2,u[c++]=(3&r)<<6|63&o;return l}function A(e){var t,n=new Uint8Array(e),i="";for(t=0;t<n.length;t+=3)i+=z[n[t]>>2],i+=z[(3&n[t])<<4|n[t+1]>>4],i+=z[(15&n[t+1])<<2|n[t+2]>>6],i+=z[63&n[t+2]];return n.length%3==2?i=i.substring(0,i.length-1)+"=":n.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}var R={serialize:function(e,t){var n="";if(e&&(n=D.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===D.call(e.buffer))){var i,r="__lfsc__:";e instanceof ArrayBuffer?(i=e,r+="arbf"):(i=e.buffer,"[object Int8Array]"===n?r+="si08":"[object Uint8Array]"===n?r+="ui08":"[object Uint8ClampedArray]"===n?r+="uic8":"[object Int16Array]"===n?r+="si16":"[object Uint16Array]"===n?r+="ur16":"[object Int32Array]"===n?r+="si32":"[object Uint32Array]"===n?r+="ui32":"[object Float32Array]"===n?r+="fl32":"[object Float64Array]"===n?r+="fl64":t(Error("Failed to get type for BinaryArray"))),t(r+A(i))}else if("[object Blob]"===n){var o=new FileReader;o.onload=function(){t("__lfsc__:blob"+("~~local_forage_type~"+e.type+"~")+A(this.result))},o.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if("__lfsc__:"!==e.substring(0,9))return JSON.parse(e);var t,n=e.substring(13),i=e.substring(9,13);if("blob"===i&&k.test(n)){var r=n.match(k);t=r[1],n=n.substring(r[0].length)}var a=T(n);switch(i){case"arbf":return a;case"blob":return o([a],{type:t});case"si08":return new Int8Array(a);case"ui08":return new Uint8Array(a);case"uic8":return new Uint8ClampedArray(a);case"si16":return new Int16Array(a);case"ur16":return new Uint16Array(a);case"si32":return new Int32Array(a);case"ui32":return new Uint32Array(a);case"fl32":return new Float32Array(a);case"fl64":return new Float64Array(a);default:throw Error("Unkown type: "+i)}},stringToBuffer:T,bufferToString:A};function x(e,t,n,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,i)}function I(e,t,n,i,r,o){e.executeSql(n,i,r,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,s){s.rows.length?o(e,a):x(e,t,function(){e.executeSql(n,i,r,o)},o)},o):o(e,a)},o)}function G(e,t,n,i){var r=this;e=l(e);var o=new a(function(o,a){r.ready().then(function(){void 0===t&&(t=null);var s=t,c=r._dbInfo;c.serializer.serialize(t,function(t,l){l?a(l):c.db.transaction(function(n){I(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){o(s)},function(e,t){a(t)})},function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void o(G.apply(r,[e,s,n,i-1]));a(t)}})})}).catch(a)});return s(o,n),o}var M={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var i in e)n[i]="string"!=typeof e[i]?e[i].toString():e[i];var r=new a(function(e,i){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return i(e)}n.db.transaction(function(r){x(r,n,function(){t._dbInfo=n,e()},function(e,t){i(t)})},i)});return n.serializer=R,r},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,i=new a(function(t,i){n.ready().then(function(){var r=n._dbInfo;r.db.transaction(function(n){I(n,r,"SELECT * FROM "+r.storeName,[],function(n,i){for(var o=i.rows,a=o.length,s=0;s<a;s++){var c=o.item(s),l=c.value;if(l&&(l=r.serializer.deserialize(l)),void 0!==(l=e(l,c.key,s+1)))return void t(l)}t()},function(e,t){i(t)})})}).catch(i)});return s(i,t),i},getItem:function(e,t){var n=this;e=l(e);var i=new a(function(t,i){n.ready().then(function(){var r=n._dbInfo;r.db.transaction(function(n){I(n,r,"SELECT * FROM "+r.storeName+" WHERE key = ? LIMIT 1",[e],function(e,n){var i=n.rows.length?n.rows.item(0).value:null;i&&(i=r.serializer.deserialize(i)),t(i)},function(e,t){i(t)})})}).catch(i)});return s(i,t),i},setItem:function(e,t,n){return G.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=l(e);var i=new a(function(t,i){n.ready().then(function(){var r=n._dbInfo;r.db.transaction(function(n){I(n,r,"DELETE FROM "+r.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){i(t)})})}).catch(i)});return s(i,t),i},clear:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(t){I(t,i,"DELETE FROM "+i.storeName,[],function(){e()},function(e,t){n(t)})})}).catch(n)});return s(n,e),n},length:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(t){I(t,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],function(t,n){e(n.rows.item(0).c)},function(e,t){n(t)})})}).catch(n)});return s(n,e),n},key:function(e,t){var n=this,i=new a(function(t,i){n.ready().then(function(){var r=n._dbInfo;r.db.transaction(function(n){I(n,r,"SELECT key FROM "+r.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,n){t(n.rows.length?n.rows.item(0).key:null)},function(e,t){i(t)})})}).catch(i)});return s(i,t),i},keys:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(t){I(t,i,"SELECT key FROM "+i.storeName,[],function(t,n){for(var i=[],r=0;r<n.rows.length;r++)i.push(n.rows.item(r).key);e(i)},function(e,t){n(t)})})}).catch(n)});return s(n,e),n},dropInstance:function(e,t){t=u.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;return s(i=e.name?new a(function(t){var i;i=e.name===n.name?r._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:i,storeNames:[e.storeName]}:new a(function(e,t){i.transaction(function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(t,n){for(var r=[],o=0;o<n.rows.length;o++)r.push(n.rows.item(o).name);e({db:i,storeNames:r})},function(e,n){t(n)})},function(e){t(e)})}))}).then(function(e){return new a(function(t,n){e.db.transaction(function(i){for(var r=[],o=0,s=e.storeNames.length;o<s;o++)r.push(function(e){return new a(function(t,n){i.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){n(t)})})}(e.storeNames[o]));a.all(r).then(function(){t()}).catch(function(e){n(e)})},function(e){n(e)})})}):a.reject("Invalid arguments"),t),i}};function O(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}var C={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=O(e,this._defaultConfig),!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=R,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,i=n.ready().then(function(){for(var t=n._dbInfo,i=t.keyPrefix,r=i.length,o=localStorage.length,a=1,s=0;s<o;s++){var c=localStorage.key(s);if(0===c.indexOf(i)){var l=localStorage.getItem(c);if(l&&(l=t.serializer.deserialize(l)),void 0!==(l=e(l,c.substring(r),a++)))return l}}});return s(i,t),i},getItem:function(e,t){var n=this;e=l(e);var i=n.ready().then(function(){var t=n._dbInfo,i=localStorage.getItem(t.keyPrefix+e);return i&&(i=t.serializer.deserialize(i)),i});return s(i,t),i},setItem:function(e,t,n){var i=this;e=l(e);var r=i.ready().then(function(){void 0===t&&(t=null);var n=t;return new a(function(r,o){var a=i._dbInfo;a.serializer.serialize(t,function(t,i){if(i)o(i);else try{localStorage.setItem(a.keyPrefix+e,t),r(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||o(e),o(e)}})})});return s(r,n),r},removeItem:function(e,t){var n=this;e=l(e);var i=n.ready().then(function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)});return s(i,t),i},clear:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var i=localStorage.key(n);0===i.indexOf(e)&&localStorage.removeItem(i)}});return s(n,e),n},length:function(e){var t=this.keys().then(function(e){return e.length});return s(t,e),t},key:function(e,t){var n=this,i=n.ready().then(function(){var t,i=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(i.keyPrefix.length)),t});return s(i,t),i},keys:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo,n=localStorage.length,i=[],r=0;r<n;r++){var o=localStorage.key(r);0===o.indexOf(e.keyPrefix)&&i.push(o.substring(e.keyPrefix.length))}return i});return s(n,e),n},dropInstance:function(e,t){if(t=u.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var i,r=this;return s(i=e.name?new a(function(t){t(e.storeName?O(e,r._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}}):a.reject("Invalid arguments"),t),i}},U=function(e,t){for(var n,i=e.length,r=0;r<i;){if((n=e[r])===t||"number"==typeof n&&"number"==typeof t&&isNaN(n)&&isNaN(t))return!0;r++}return!1},B=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},L={},N={},P={INDEXEDDB:S,WEBSQL:M,LOCALSTORAGE:C},j=[P.INDEXEDDB._driver,P.WEBSQL._driver,P.LOCALSTORAGE._driver],K=["dropInstance"],V=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(K),q={description:"",driver:j.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function F(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(B(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}t.exports=new(function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e),P)if(P.hasOwnProperty(n)){var i=P[n],r=i._driver;this[n]=r,L[r]||this.defineDriver(i)}this._defaultConfig=F({},q),this._config=F({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":i(e))){if(this._ready)return Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var i=new a(function(t,n){try{var i=e._driver,r=Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(r);for(var o=V.concat("_initStorage"),c=0,l=o.length;c<l;c++){var u=o[c];if((!U(K,u)||e[u])&&"function"!=typeof e[u])return void n(r)}for(var h=function(e){return function(){var t=Error("Method "+e+" is not implemented by the current driver"),n=a.reject(t);return s(n,arguments[arguments.length-1]),n}},d=0,f=K.length;d<f;d++){var p=K[d];e[p]||(e[p]=h(p))}var g=function(n){L[i]&&console.info("Redefining LocalForage driver: "+i),L[i]=e,N[i]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(g,n):g(!!e._support):g(!0)}catch(e){n(e)}});return c(i,t,n),i},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var i=L[e]?a.resolve(L[e]):a.reject(Error("Driver not found."));return c(i,t,n),i},e.prototype.getSerializer=function(e){var t=a.resolve(R);return c(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return c(n,e,e),n},e.prototype.setDriver=function(e,t,n){var i=this;B(e)||(e=[e]);var r=this._getSupportedDrivers(e);function o(){i._config.driver=i.driver()}function s(e){return i._extend(e),o(),i._ready=i._initStorage(i._config),i._ready}var l=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve();return this._driverSet=l.then(function(){var e=r[0];return i._dbInfo=null,i._ready=null,i.getDriver(e).then(function(e){i._driver=e._driver,o(),i._wrapLibraryMethodsWithReady(),i._initDriver=function(){var e=0;return function t(){for(;e<r.length;){var n=r[e];return e++,i._dbInfo=null,i._ready=null,i.getDriver(n).then(s).catch(t)}o();var c=Error("No available storage method found.");return i._driverSet=a.reject(c),i._driverSet}()}})}).catch(function(){o();var e=Error("No available storage method found.");return i._driverSet=a.reject(e),i._driverSet}),c(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!N[e]},e.prototype._extend=function(e){F(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];this.supports(r)&&t.push(r)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=V.length;e<t;e++)!function(e,t){e[t]=function(){var n=arguments;return e.ready().then(function(){return e[t].apply(e,n)})}}(this,V[e])},e.prototype.createInstance=function(t){return new e(t)},e}())},{3:3}]},{},[4])(4)}),R=function(){function e(){this.cache={}}return e.prototype.setItem=function(e,t){this.cache[e]=t},e.prototype.getItem=function(e){return this.cache[e]},e.prototype.removeItem=function(e){this.cache[e]=void 0},e}(),x=function(){function e(){this.support=this.isSupportLS()}return e.prototype.isSupportLS=function(){try{return localStorage.setItem("_applogtest-test-key","hi"),localStorage.getItem("_applogtest-test-key"),localStorage.removeItem("_applogtest-test-key"),!0}catch(e){return!1}},e.prototype.getItem=function(e){try{var t=localStorage.getItem(e),n=t;try{t&&"string"==typeof t&&(n=JSON.parse(t))}catch(e){}return n||{}}catch(e){}return{}},e.prototype.setItem=function(e,t){try{var n="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,n)}catch(e){}},e.prototype.removeItem=function(e){try{localStorage.removeItem(e)}catch(e){}},e}(),I=function(){function e(){this.support=this.isSupportSession()}return e.prototype.isSupportSession=function(){try{return sessionStorage.setItem("_applogtest-test-key","hi"),sessionStorage.getItem("_applogtest-test-key"),sessionStorage.removeItem("_applogtest-test-key"),!0}catch(e){return!1}},e.prototype.getItem=function(e){try{var t=sessionStorage.getItem(e),n=t;try{t&&"string"==typeof t&&(n=JSON.parse(t))}catch(e){}return n||{}}catch(e){}return{}},e.prototype.setItem=function(e,t){try{var n="string"==typeof t?t:JSON.stringify(t);sessionStorage.setItem(e,n)}catch(e){}},e.prototype.removeItem=function(e){try{sessionStorage.removeItem(e)}catch(e){}},e}(),G=function(){function e(e,t){return this.dbStorage=A.createInstance({driver:[A.INDEXEDDB,A.LOCALSTORAGE],name:e,storeName:t}),this.dbStorage}return e.prototype.getItem=function(e){return c(this,void 0,void 0,function(){var t,n;return l(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.dbStorage.getItem(e)];case 1:n=t=i.sent();try{t&&"string"==typeof t&&(n=JSON.parse(t))}catch(e){}return[2,n||void 0];case 2:return i.sent(),console.warn("db get storage error"),[3,3];case 3:return[2,void 0]}})})},e.prototype.setItem=function(e,t){try{this.dbStorage.setItem(e,t)}catch(e){console.warn("db set storage error")}},e.prototype.removeItem=function(e){try{this.dbStorage.removeItem(e)}catch(e){console.warn("db remove storage error")}},e}(),M=function(){function e(){this.defaultExpireTime=6048e5,this.local=new x,this.session=new I,this.cache=new R}return e.prototype.getLocalItem=function(e){return this.local.getItem(e)},e.prototype.setLocalItem=function(e,t){this.local.setItem(e,t)},e.prototype.removeLocalItem=function(e){this.local.removeItem(e)},e.prototype.getSessionItem=function(e){return this.session.getItem(e)},e.prototype.setSessionItem=function(e,t){this.session.setItem(e,t)},e.prototype.removeSessionItem=function(e){this.session.removeItem(e)},e.prototype.getCacheItem=function(e){return this.cache.getItem(e)},e.prototype.setCacheItem=function(e,t){this.cache.setItem(e,t)},e.prototype.removeCacheItem=function(e){this.cache.removeItem(e)},e.prototype.getCookie=function(e,t){try{return T.get(e)}catch(e){return""}},e.prototype.setCookie=function(e,t,n,i){void 0===n&&(n=this.defaultExpireTime);try{var r=i||document.domain,o=+new Date+n;T.set(e,t,{expires:new Date(o),path:"/",domain:r})}catch(e){}},e.prototype.removeCookie=function(e,t){try{T.remove(e,{path:"/",domain:t||""})}catch(e){}},e}(),O=function(){function e(e,t,n){this.appid=e,this.domain=t,this.userAgent=window.navigator.userAgent,this.appVersion=window.navigator.appVersion,this.cookie_expire=n}return e.prototype.init=function(){var e,t=window.navigator.userAgent,n=window.navigator.language,i=document.referrer,r=i?b(i).hostname:"",o=E(window.location.href),a=/Mobile|htc|mini|Android|iP(ad|od|hone)/.test(this.appVersion)?"wap":"web",s=(null==(e=window.navigator.connection)?void 0:e.effectiveType)||"";this.utm=function(e,t,n,i){var r=new M,o=e?"_tea_utm_cache_"+e:"_tea_utm_cache",a=e?"_$utm_from_url_"+e:"_$utm_from_url",s={},c=["tr_shareuser","tr_admaster","tr_param1","tr_param2","tr_param3","tr_param4","$utm_from_url"],l={ad_id:Number(t.ad_id)||void 0,campaign_id:Number(t.campaign_id)||void 0,creative_id:Number(t.creative_id)||void 0,utm_source:t.utm_source,utm_medium:t.utm_medium,utm_campaign:t.utm_campaign,utm_term:t.utm_term,utm_content:t.utm_content,tr_shareuser:t.tr_shareuser,tr_admaster:t.tr_admaster,tr_param1:t.tr_param1,tr_param2:t.tr_param2,tr_param3:t.tr_param3,tr_param4:t.tr_param4};try{var u=!1;for(var h in l)l[h]&&(-1!==c.indexOf(h)?(s.hasOwnProperty("tracer_data")||(s.tracer_data={}),s.tracer_data[h]=l[h]):s[h]=l[h],u=!0);if(u)r.setSessionItem(a,"1"),r.setCookie(o,JSON.stringify(s),i,n);else{var d=r.getCookie(o,n);d&&(s=JSON.parse(d))}1==r.getSessionItem(a)&&(s.hasOwnProperty("tracer_data")||(s.tracer_data={}),s.tracer_data.$utm_from_url=1)}catch(e){return l}return s}(this.appid,o,this.domain,this.cookie_expire);var c=this.browser(),l=this.os();return{browser:c.browser,browser_version:c.browser_version,platform:a,os_name:l.os_name,os_version:l.os_version,userAgent:t,screen_width:window.screen&&window.screen.width,screen_height:window.screen&&window.screen.height,device_model:this.getDeviceModel(l.os_name),language:n,referrer:i,referrer_host:r,network_type:s,utm:this.utm,latest_data:this.last(i,r)}},e.prototype.last=function(e,t){var n="",i="",r="",o=location.hostname,a=!1;if(e&&t&&o!==t){n=e,i=t,a=!0;var s=E(e);s.keyword&&(r=s.keyword)}return{$latest_referrer:n,$latest_referrer_host:i,$latest_search_keyword:r,isLast:a}},e.prototype.browser=function(){var e,t,n="",i=""+parseFloat(this.appVersion),r=this.userAgent;return -1!==r.indexOf("Edge")||-1!==r.indexOf("Edg")?(n="Microsoft Edge",-1!==r.indexOf("Edge")?(e=r.indexOf("Edge"),i=r.substring(e+5)):(e=r.indexOf("Edg"),i=r.substring(e+4))):-1!==(e=r.indexOf("MSIE"))?(n="Microsoft Internet Explorer",i=r.substring(e+5)):-1!==(e=r.indexOf("Lark"))?(n="Lark",i=r.substring(e+5,e+11)):-1!==r.indexOf("Chrome")?-1!==(e=r.indexOf("TTWebView"))?(n="TTWebView",i=r.substring(e+10,e+23)):(-1!==(e=r.indexOf("Chrome"))||-1!==(e=r.indexOf("Chrome")))&&(n="Chrome",i=r.substring(e+7)):-1!==r.indexOf("Safari")?-1!==(e=r.indexOf("Safari"))&&(n="Safari",i=r.substring(e+7),-1!==(e=r.indexOf("Version"))&&(i=r.substring(e+8))):-1!==(e=r.indexOf("Firefox"))&&(n="Firefox",i=r.substring(e+8)),-1!==(t=i.indexOf(";"))&&(i=i.substring(0,t)),-1!==(t=i.indexOf(" "))&&(i=i.substring(0,t)),-1!==(t=i.indexOf(")"))&&(i=i.substring(0,t)),{browser:n,browser_version:i}},e.prototype.os=function(){for(var e,t,n="",i="",r=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0|Windows NT 10.1)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Android",r:/Android/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:"ChromeOS",r:/CrOS/},{s:"Linux",r:/(Linux|X11)/},{s:"Sun OS",r:/SunOS/}],o=0;o<r.length;o++){var a=r[o];if(a.r.test(this.userAgent)){"Mac OS X"===(n=a.s)&&this.isNewIpad()&&(n="iOS");break}}var s=function(e,t){var n=e.exec(t);return n&&n[1]?n[1]:""},c=function(e,t){var n=RegExp("(?:^|[^A-Z0-9-_]|[^A-Z0-9-]_|sprd-)(?:"+e+")","i").exec(t);return n?n.slice(1)[0]:""};switch(/Windows/.test(n)&&(i=s(/Windows (.*)/,n),n="windows"),n){case"Mac OS X":i=c("Mac[ +]OS[ +]X(?:[ /](?:Version )?(\\d+(?:[_\\.]\\d+)+))?",this.userAgent),n="mac";break;case"Android":(t=s(/Android ([\.\_\d]+)/,e=this.userAgent))||(t=s(/Android\/([\.\_\d]+)/,e)),i=t,n="android";break;case"iOS":i=this.isNewIpad()?c("Mac[ +]OS[ +]X(?:[ /](?:Version )?(\\d+(?:[_\\.]\\d+)+))?",this.userAgent):(i=/OS (\d+)_(\d+)_?(\d+)?/.exec(this.appVersion))?i[1]+"."+i[2]+"."+(0|i[3]):"",n="ios";break;case"chromeOS":var l=this.userAgent.indexOf("x86_64");i=this.userAgent.substring(l+7,l+16)}return{os_name:n,os_version:i}},e.prototype.getDeviceModel=function(e){var t="";try{if("android"===e)navigator.userAgent.split(";").forEach(function(e){e.indexOf("Build/")>-1&&(t=e.slice(0,e.indexOf("Build/")))});else if("ios"===e||"mac"===e||"windows"===e)if(this.isNewIpad())t="iPad";else{var n=navigator.userAgent.replace("Mozilla/5.0 (",""),i=n.indexOf(";");t=n.slice(0,i)}}catch(e){}return t.trim()},e.prototype.isNewIpad=function(){return void 0!==this.userAgent&&"MacIntel"===navigator.platform&&"number"==typeof navigator.maxTouchPoints&&navigator.maxTouchPoints>1},e}(),C=function(e,t){try{return T.get(e)}catch(e){return""}},U=function(e,t,n,i){try{var r=i||document.domain,o=+new Date+(n||6048e5);T.set(e,t,{expires:new Date(o),path:"/",domain:r})}catch(e){}},B=function(){function e(){this.cache={}}return e.prototype.setItem=function(e,t){this.cache[e]=t},e.prototype.getItem=function(e){return this.cache[e]},e.prototype.removeItem=function(e){this.cache[e]=void 0},e.prototype.getCookie=function(e,t){return C(e)},e.prototype.setCookie=function(e,t,n,i){U(e,t,n,i)},e}(),L={getItem:function(e){try{var t=localStorage.getItem(e),n=t;try{t&&"string"==typeof t&&(n=JSON.parse(t))}catch(e){}return n||{}}catch(e){}return{}},setItem:function(e,t){try{var n="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,n)}catch(e){}},removeItem:function(e){try{localStorage.removeItem(e)}catch(e){}},getCookie:function(e,t){return C(e)},setCookie:function(e,t,n,i){U(e,t,n,i)},isSupportLS:function(){try{return localStorage.setItem("_ranger-test-key","hi"),localStorage.getItem("_ranger-test-key"),localStorage.removeItem("_ranger-test-key"),!0}catch(e){return!1}}()},N={getItem:function(e){try{var t=sessionStorage.getItem(e),n=t;try{t&&"string"==typeof t&&(n=JSON.parse(t))}catch(e){}return n||{}}catch(e){}return{}},setItem:function(e,t){try{var n="string"==typeof t?t:JSON.stringify(t);sessionStorage.setItem(e,n)}catch(e){}},removeItem:function(e){try{sessionStorage.removeItem(e)}catch(e){}},getCookie:function(e,t){return C(e)},setCookie:function(e,t,n,i){U(e,t,n,i)},isSupportSession:function(){try{return sessionStorage.setItem("_ranger-test-key","hi"),sessionStorage.getItem("_ranger-test-key"),sessionStorage.removeItem("_ranger-test-key"),!0}catch(e){return!1}}()},P=function(){function e(e,t){this._storage=t&&"session"===t?N:!e&&L.isSupportLS?L:new B}return e.prototype.getItem=function(e){return this._storage.getItem(e)},e.prototype.setItem=function(e,t){this._storage.setItem(e,t)},e.prototype.getCookie=function(e,t){return this._storage.getCookie(e,t)},e.prototype.setCookie=function(e,t,n,i){this._storage.setCookie(e,t,n,i)},e.prototype.removeItem=function(e){this._storage.removeItem(e)},e}(),j={sg_central:"1fz22z22z1nz21z4mz4bz4bz21z1ez18z1jz1gz49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k",us_east:"1fz22z22z1nz21z4mz4bz4bz1kz18z1jz1gz24z18z49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k",sg_central_tt:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z21z1ez4az22z1gz1iz22z1mz1iz24z4az1az1mz1k",us_east_tt:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z24z18z4az22z1gz1iz22z1mz1iz24z4az1az1mz1k",us_ttp:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az22z1gz1iz22z1mz1iz24z4az23z21",us_ttp_w:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az22z1gz1iz22z1mz1iz25z4az23z21",us_ttp2:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z22z22z1nz4ez4az23z21z4az22z1gz1iz22z1mz1iz4az1az1mz1k",eu_ttp_gcp:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z24z18z49z23z21z1cz18z21z22z4ez18z4az22z1gz1iz22z1mz1iz24z4az1az1mz1k",eu_central:"1fz22z22z1nz21z4mz4bz4bz18z25z21z1dz20z49z1kz1az21z4az19z27z22z1cz1gz1lz22z1jz18z1nz1gz4az1az1mz1k",eu_ttp_ie2:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z1gz1cz4ez4az22z1gz1iz22z1mz1iz25z4az1cz23",eu_ttp2:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4dz4iz49z1lz1mz20z1kz18z1jz49z1lz1mz4dz18z4az22z1gz1iz22z1mz1iz25z4az1cz23"},K=function(){return new Set(Object.keys(j))},V=function(){return Object.keys(j)},q={sg:"1fz22z22z1nz21z4mz4bz4bz21z1ez18z1jz1gz49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k",va:"1fz22z22z1nz21z4mz4bz4bz1kz18z1jz1gz24z18z49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k",my:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z19z1bz49z1kz27z4az1jz18z20z1iz1mz1dz1dz1gz1az1cz4az1az1mz1k"},F={va:"1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az1gz22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k",sg:"1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k",in:"1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az1gz22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k"},H={sg:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z21z1ez4az22z1gz1iz22z1mz1iz24z4az1az1mz1k",va:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z24z18z4az22z1gz1iz22z1mz1iz24z4az1az1mz1k",in:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z24z18z49z23z21z1cz18z21z22z4ez18z4az22z1gz1iz22z1mz1iz24z4az1az1mz1k",ie2:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z1gz1cz4ez4az22z1gz1iz22z1mz1iz25z4az1cz23"},J={sg:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az22z1gz1iz22z1mz1iz25z4az23z21",va:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az22z1gz1iz22z1mz1iz24z4az23z21",ie2:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z1gz1cz4ez4az22z1gz1iz22z1mz1iz25z4az1cz23"},W=["1fz22z22z1nz21z4mz4bz4bz1bz18z22z18z4az19z27z22z1cz1bz18z1lz1az1cz4az1lz1cz22","1fz22z22z1nz21z4mz4bz4bz22z1cz18z49z24z18z4az22z1gz1iz22z1mz1iz49z20z1mz25z4az1lz1cz22","1fz22z22z1nz21z4mz4bz4bz22z1cz18z4az22z1gz1iz22z1mz1iz49z1cz23z4az1lz1cz22","1fz22z22z1nz21z4mz4bz4bz22z1cz18z4az22z1gz1iz22z1mz1iz49z23z21z22z21z4az1lz1cz22","1fz22z22z1nz21z4mz4bz4bz1gz1mz49z21z1ez4az22z1gz1iz22z1mz1iz49z20z1mz25z4az1lz1cz22","1fz22z22z1nz21z4mz4bz4bz1gz1mz49z24z18z4az22z1gz1iz22z1mz1iz49z20z1mz25z4az1lz1cz22"].map(function(e){return _(e)});(nP=k||(k={})).Init="init",nP.Config="config",nP.Start="start",nP.Ready="ready",nP.TokenComplete="token-complete",nP.TokenStorage="token-storage",nP.TokenFetch="token-fetch",nP.TokenError="token-error",nP.ConfigUuid="config-uuid",nP.ConfigWebId="config-webid",nP.ConfigDiD="config-deviceid",nP.ConfigDomain="config-domain",nP.CustomWebId="custom-webid",nP.TokenChange="token-change",nP.TokenReset="token-reset",nP.ConfigTransform="config-transform",nP.EnvTransform="env-transform",nP.SessionReset="session-reset",nP.SessionResetTime="session-reset-time",nP.Event="event",nP.Events="events",nP.EventNow="event-now",nP.CleanEvents="clean-events",nP.BeconEvent="becon-event",nP.SubmitBefore="submit-before",nP.SubmitScuess="submit-scuess",nP.SubmitAfter="submit-after",nP.SubmitError="submit-error",nP.SubmitVerify="submit-verify",nP.DestoryInstance="destory-instance",nP.LogSettingReady="log-setting-ready",nP.Stay="stay",nP.ResetStay="reset-stay",nP.StayReady="stay-ready",nP.SetStay="set-stay",nP.RouteChange="route-change",nP.RouteReady="route-ready",nP.Ab="ab",nP.AbVar="ab-var",nP.AbAllVars="ab-all-vars",nP.AbConfig="ab-config",nP.AbExternalVersion="ab-external-version",nP.AbVersionChangeOn="ab-version-change-on",nP.AbVersionChangeOff="ab-version-change-off",nP.AbOpenLayer="ab-open-layer",nP.AbCloseLayer="ab-close-layer",nP.AbReady="ab-ready",nP.AbComplete="ab-complete",nP.AbTimeout="ab-timeout",nP.AbVerify="ab-verify",nP.Profile="profile",nP.ProfileSet="profile-set",nP.ProfileSetOnce="profile-set-once",nP.ProfileUnset="profile-unset",nP.ProfileIncrement="profile-increment",nP.ProfileAppend="profile-append",nP.ProfileClear="profile-clear",nP.Autotrack="autotrack",nP.AutotrackReady="autotrack-ready",nP.CepReady="cep-ready",nP.TracerReady="tracer-ready",nP.sessionRecord="session-record",nP.SessionRecordStart="session-record-start",nP.SessionRecordPause="session-record-pause",nP.SessionRecordEnd="session-record-end",nP.SessionRecordReport="session-record-report",nP.TrackEventDuration="track-event-duration",nP.TrackEventDurationStart="track-event-duration-start",nP.TrackEventDurationEnd="track-event-duration-end",nP.TrackEventDurationPause="track-event-duration-pause",nP.TrackEventDurationResume="tracl-event-duration-resume",nP.VisualCollectReady="visual-collect-ready",nP.VisualApiReady="visual-api-ready",nP.VisualApiUpdate="visual-api-update",(nj=D||(D={})).DEBUGGER_MESSAGE="debugger-message",nj.DEBUGGER_MESSAGE_SDK="debugger-message-sdk",nj.DEBUGGER_MESSAGE_FETCH="debugger-message-fetch",nj.DEBUGGER_MESSAGE_FETCH_RESULT="debugger-message-fetch-result",nj.DEBUGGER_MESSAGE_EVENT="debugger-message-event",nj.DEVTOOL_WEB_READY="devtool-web-ready";var Z=k,X=void 0,Y=(new Date).getTimezoneOffset(),$=parseInt(""+-Y/60,10),Q=60*Y,ee=function(){function e(e,t){var n=this;this.is_first_time=!0,this.configPersist=!1,this.initConfig=t,this.collect=e;var i=new O(t.app_id,t.cookie_domain||"",t.cookie_expire||6048e5).init(),r="__tea_cache_first_"+t.app_id;this.configKey="__tea_cache_config_"+t.app_id,this.sessionStorage=new P(!1,"session"),this.localStorage=new P(!1,"local"),this.channelUrl=this.getChannelForUrl(),this.current_env="row",t.configPersist&&(this.configPersist=!0,this.storage=1===t.configPersist?this.sessionStorage:this.localStorage);var o=this.localStorage.getItem(r);o&&1==o?this.is_first_time=!1:(this.is_first_time=!0,this.localStorage.setItem(r,"1")),this.envInfo={user:{user_unique_id:X,user_type:X,user_id:X,user_is_auth:X,user_is_login:X,device_id:X,web_id:X,ip_addr_id:X,user_unique_id_type:X},header:{app_id:X,app_name:X,app_install_id:X,install_id:X,app_package:X,app_channel:X,app_version:X,ab_version:X,os_name:i.os_name,os_version:i.os_version,device_model:i.device_model,ab_client:X,traffic_type:X,network_type:i.network_type,client_ip:X,device_brand:X,os_api:X,access:X,language:i.language,region:X,app_language:X,app_region:X,creative_id:i.utm.creative_id,ad_id:i.utm.ad_id,campaign_id:i.utm.campaign_id,log_type:X,rnd:X,platform:i.platform,sdk_version:"5.3.9_oversea",sdk_lib:"js",province:X,city:X,timezone:$,tz_offset:Q,tz_name:X,sim_region:X,carrier:X,resolution:i.screen_width+"x"+i.screen_height,browser:i.browser,browser_version:i.browser_version,referrer:i.referrer,referrer_host:i.referrer_host,width:i.screen_width,height:i.screen_height,screen_width:i.screen_width,screen_height:i.screen_height,utm_term:i.utm.utm_term,utm_content:i.utm.utm_content,utm_source:i.utm.utm_source,utm_medium:i.utm.utm_medium,utm_campaign:i.utm.utm_campaign,tracer_data:JSON.stringify(i.utm.tracer_data),custom:i.network_type?{network_type:i.network_type}:{}}},this.ab_version="",this.ab_uuid_cache={},this.evtParams={},this.reportErrorCallback=function(){},this.isLast=!1,this.setCustom(i),this.initDomain(),this.initABData(),this.collect.on("route-change",function(e){n.changeReferInfo(e.config)})}return e.prototype.initDomain=function(e){var t=this.initConfig.channel_domain;if(t)this.domain=t;else{var n=e||this.initConfig.report_channel||this.initConfig.channel,i=this.getChannelDomain(n);i||(console.warn("current channel: "+n+" is not exist, use va instead, please check!!!!"),i=q.sg),this.domain=_(i),this.setCurrentEnv(this.domain)}},e.prototype.setDomain=function(e){this.customDomain=!0,this.domain=e,this.setCurrentEnv(this.domain)},e.prototype.getDomain=function(e){return this.customDomain||e&&this.initDomain(e),this.domain},e.prototype.getChannelDomain=function(e){var t,n,i=e||this.initConfig.report_channel||this.initConfig.channel;return K().has(i)?j[i]:"tcpy"===(null==(t=this.initConfig)?void 0:t.channel_type)?H[i]:"ttp"===(null==(n=this.initConfig)?void 0:n.channel_type)?J[i]:q[i]},e.prototype.getChannelForUrl=function(){return this.initConfig.channel_type?{WEBID_URL:"/v1/user/webid",TOB_URL:"",REPORT_URL:"/v1/list"}:this.initConfig.report_channel?-1!==["sg_central","us_east"].indexOf(this.initConfig.report_channel)?{WEBID_URL:"/webid",TOB_URL:"/tobid",REPORT_URL:"/list"}:{WEBID_URL:"/v1/user/webid",TOB_URL:"",REPORT_URL:"/v1/list"}:{WEBID_URL:"/webid",TOB_URL:"/tobid",REPORT_URL:"/list"}},e.prototype.setCurrentEnv=function(e){this.getDomain().includes("byteoversea")?this.current_env="row":this.current_env="other"},e.prototype.getCurrentEnv=function(){return this.current_env},e.prototype.initABData=function(){var e,t="__tea_sdk_ab_version_"+this.initConfig.app_id;e=this.localStorage.getItem(t),this.setAbCache(e)},e.prototype.setAbCache=function(e){this.ab_cache=e},e.prototype.getAbCache=function(){return this.ab_cache},e.prototype.clearAbCache=function(){this.ab_cache={},this.ab_version=""},e.prototype.setAbVersion=function(e){this.ab_version=e},e.prototype.getAbVersion=function(){return this.ab_version},e.prototype.setAbUuidCache=function(e,t){var n=t||this.envInfo.user.user_unique_id;this.ab_uuid_cache[""+n]||(this.ab_uuid_cache[""+n]=[]),-1===this.ab_uuid_cache[""+n].indexOf(e)&&this.ab_uuid_cache[""+n].push(e)},e.prototype.getAbUuidCache=function(e){return this.ab_uuid_cache[""+e]},e.prototype.getUrl=function(e){var t="";switch(e){case"event":t=this.channelUrl.REPORT_URL;break;case"webid":t=this.channelUrl.WEBID_URL;break;case"tobid":t=this.channelUrl.TOB_URL}var n="";return this.initConfig.caller&&(n="?sdk_version=5.3.9_oversea&sdk_name=web&app_id="+this.initConfig.app_id+"&caller="+this.initConfig.caller),""+this.getDomain()+t+n},e.prototype.setCustom=function(e){if(e&&e.latest_data&&e.latest_data.isLast)for(var t in delete e.latest_data.isLast,this.isLast=!0,e.latest_data)this.envInfo.header.custom[t]=e.latest_data[t]},e.prototype.setAppid=function(e){this.envInfo.header.app_id=e},e.prototype.changeReferInfo=function(e){this.set({referrer:e.referrer});var t="";try{t=new URL(e.referrer).host}catch(e){}this.set({referrer_host:t||this.envInfo.header.referrer_host})},e.prototype.set=function(e){var t=this;Object.keys(e).forEach(function(n){if(void 0!==e[n]&&null!==e[n]||t.delete(n),"traffic_type"===n&&t.isLast&&(t.envInfo.header.custom.$latest_traffic_source_type=e[n]),"evtParams"===n)t.evtParams=s(s({},t.evtParams||{}),e.evtParams||{});else if("_staging_flag"===n)t.evtParams=s(s({},t.evtParams||{}),{_staging_flag:e._staging_flag});else if("reportErrorCallback"===n&&"function"==typeof e[n])t.reportErrorCallback=e[n];else{var i="",r="";if(n.indexOf(".")>-1){var o=n.split(".");i=o[0],r=o[1]}i?"user"===i||"header"===i?t.envInfo[i][r]=e[n]:(t.envInfo.header.custom[r]=e[n],t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Add Custom Params",level:"info",time:Date.now(),infoType:"sdk",secType:"HEADER",common:"custom"})):Object.hasOwnProperty.call(t.envInfo.user,n)?(["user_type","ip_addr_id"].indexOf(n)>-1?t.envInfo.user[n]=e[n]?Number(e[n]):e[n]:["user_id","web_id","user_unique_id","user_unique_id_type"].indexOf(n)>-1?t.envInfo.user[n]=e[n]?String(e[n]):e[n]:["user_is_auth","user_is_login"].indexOf(n)>-1?t.envInfo.user[n]=!!e[n]:"device_id"===n&&(t.envInfo.user[n]=e[n]),t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Set Common Params",level:"info",time:Date.now(),infoType:"sdk",secType:"USER",common:n})):Object.hasOwnProperty.call(t.envInfo.header,n)?(t.envInfo.header[n]=e[n],t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Set Common Params",level:"info",time:Date.now(),infoType:"sdk",secType:"HEADER",common:n})):(t.envInfo.header.custom[n]=e[n],t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Add Custom Params",level:"info",time:Date.now(),infoType:"sdk",secType:"HEADER",common:"custom"}))}})},e.prototype.get=function(e){try{return e?"evtParams"===e?this.evtParams:"reportErrorCallback"===e?this[e]:Object.hasOwnProperty.call(this.envInfo.user,e)?this.envInfo.user[e]:Object.hasOwnProperty.call(this.envInfo.header,e)?this.envInfo.header[e]:JSON.parse(JSON.stringify(this.envInfo[e])):JSON.parse(JSON.stringify(this.envInfo))}catch(e){console.log("get config stringify error "),this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Something Error",level:"error",time:Date.now(),data:e.message,infoType:"sdk"})}},e.prototype.setStore=function(e){try{if(!this.configPersist)return;var t=this.storage.getItem(this.configKey)||{};if(t&&Object.keys(e).length){var n=Object.assign(e,t);this.storage.setItem(this.configKey,n)}}catch(e){console.log("setStore error"),this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Something Error",level:"error",time:Date.now(),data:e.message,infoType:"sdk"})}},e.prototype.getStore=function(){try{if(!this.configPersist)return null;var e=this.storage.getItem(this.configKey)||{};return e&&Object.keys(e).length?e:null}catch(e){return this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Something Error",level:"error",time:Date.now(),data:e.message,infoType:"sdk"}),null}},e.prototype.delete=function(e){try{if(!this.configPersist)return;var t=this.storage.getItem(this.configKey)||{};t&&Object.hasOwnProperty.call(t,e)&&(delete t[e],this.storage.setItem(this.configKey,t))}catch(e){this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Something Error",level:"error",time:Date.now(),data:e.message,infoType:"sdk"}),console.log("delete error")}},e}(),et=function(){function e(e,t){this.isLog=t||!1,this.name=e||""}return e.prototype.info=function(e){this.isLog&&console.log("%c %s","color: yellow; background-color: black;","[Tea instance: "+this.name+"] "+e)},e.prototype.warn=function(e){this.isLog&&console.warn("%c %s","color: #4D1B00;","[Tea instance: "+this.name+"] "+e)},e.prototype.error=function(e){this.isLog&&console.error("%c %s","color: #FFF; background-color: #F53F3F;","[Tea instance: "+this.name+"] "+e)},e.prototype.throw=function(e){throw this.error(this.name),Error(e)},e}(),en=function(){function e(){this.spiderBot=["Baiduspider","googlebot","360Spider","haosouspider","YoudaoBot","Yisouspider","Googlebot","Headless","Applebot","Bingbot","PetalBot"]}return e.prototype.checkSpider=function(e){if(!e.enable_spider)return!1;var t=window.navigator.userAgent;if(!t)return!0;var n=!1;return this.spiderBot.forEach(function(e){-1!==t.indexOf(e)&&(n=!0)}),n},e}(),ei=function(){function e(e,t){this.collect=e,this.native=t}var t=e.prototype;return t.bridgeInject=function(){try{return!!this.native&&(AppLogBridge?(console.log("AppLogBridge is injected"),!0):(console.log("AppLogBridge is not inject"),!1))}catch(e){return console.log("AppLogBridge is not inject"),!1}},t.bridgeReady=function(){var e=this;return new Promise(function(t,n){try{e.bridgeInject()?AppLogBridge.hasStarted(function(e){console.log("AppLogBridge is started? : "+e),e?t(!0):n(!1)}):n(!1)}catch(e){console.log("AppLogBridge, error:"+JSON.stringify(e.stack)),n(!1)}})},t.setNativeAppId=function(e){try{AppLogBridge.setNativeAppId(JSON.stringify(e)),console.log("change bridge appid, event report with appid: "+e)}catch(e){console.error("setNativeAppId error")}},t.setConfig=function(e){var t=this;try{Object.keys(e).forEach(function(n){"user_unique_id"===n?t.setUserUniqueId(e[n]):e[n]?t.addHeaderInfo(n,e[n]):t.removeHeaderInfo(n)})}catch(e){console.error("setConfig error")}},t.setUserUniqueId=function(e){try{AppLogBridge.setUserUniqueId(e)}catch(e){console.error("setUserUniqueId error")}},t.addHeaderInfo=function(e,t){try{AppLogBridge.addHeaderInfo(e,t)}catch(e){console.error("addHeaderInfo error")}},t.setHeaderInfo=function(e){try{AppLogBridge.setHeaderInfo(JSON.stringify(e))}catch(e){console.error("setHeaderInfo error")}},t.removeHeaderInfo=function(e){try{AppLogBridge.removeHeaderInfo(e)}catch(e){console.error("removeHeaderInfo error")}},t.reportPv=function(e){this.onEventV3("predefine_pageview",e)},t.onEventV3=function(e,t){try{AppLogBridge.onEventV3(e,t),this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_EVENT,info:"bridge report success",time:Date.now(),data:[{events:[{event:e,params:t}]}],code:200,status:"success"})}catch(e){console.error("onEventV3 error")}},t.profileSet=function(e){try{AppLogBridge.profileSet(e)}catch(e){console.error("profileSet error")}},t.profileSetOnce=function(e){try{AppLogBridge.profileSetOnce(e)}catch(e){console.error("profileSetOnce error")}},t.profileIncrement=function(e){try{AppLogBridge.profileIncrement(e)}catch(e){console.error("profileIncrement error")}},t.profileUnset=function(e){try{AppLogBridge.profileUnset(e)}catch(e){console.error("profileUnset error")}},t.profileAppend=function(e){try{AppLogBridge.profileAppend(e)}catch(e){console.error("profileAppend error")}},e}(),er=function(){function e(){this.setUrl="/service/2/web_sdk_settings/",this.expireTime=216e5}return e.prototype.apply=function(e,t){if(t.enable_logsetting){this.collect=e,this.config=t;var n=e.adapters.storage;this.setKey="applog_web_logsetting_"+t.app_id,this.uniqueKey="web_logsetting_data",this.cacheStorgae=new n(!1),this.dbStorage=new G(this.setKey,"LOGSETTING_DATA_STORE"),this.domain=t.logsetting_domain||this.collect.configManager.getDomain(),this.check()}else e.emit(Z.LogSettingReady)},e.prototype.check=function(){return c(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.getLocalData()];case 1:return(e=t.sent())&&Object.keys(e).length?(null==e?void 0:e.timestamp)<Date.now()-this.expireTime?this.fetchSetting():(this.setSettingData(e.settingConfig),this.collect.emit(Z.LogSettingReady)):this.fetchSetting(),[3,3];case 2:return t.sent(),this.collect.emit(Z.LogSettingReady),this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Check LogSetting Data Error",logType:"fetch",level:"error",time:Date.now(),infoType:"sdk"}),[3,3];case 3:return[2]}})})},e.prototype.fetchSetting=function(e){var t=this;if(e)this.collect.emit(Z.LogSettingReady);else{var n=this.collect.configManager.get("header");n.custom=JSON.stringify(n.custom);var i=this.collect.configManager.get("user"),r={event_filter:0,header:s(s({aid:this.config.app_id},n),i),options:{params_block_enable:+!!this.config.enable_logsetting_params,header_custom_allow_enable:+!!this.config.enable_logsetting_header_custom}};this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Fetch LogSetting Request",logType:"fetch",level:"info",time:Date.now(),data:r,infoType:"sdk"}),this.collect.requestManager.useRequest({url:""+this.domain+this.setUrl+"?device_platform=web",data:r,timeout:5e3,success:function(e){(null==e?void 0:e.config)?(t.setLocalData(e.config),t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"LogSetting Request Success",logType:"fetch",level:"info",time:Date.now(),data:e,infoType:"sdk"})):t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"LogSetting Request Response No Data",logType:"fetch",level:"error",time:Date.now(),infoType:"sdk"}),t.collect.emit(Z.LogSettingReady)},fail:function(){t.collect.emit(Z.LogSettingReady),t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"LogSetting Request Fail",logType:"fetch",level:"error",time:Date.now(),infoType:"sdk"})}})}},e.prototype.getLocalData=function(){return c(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.dbStorage.getItem(this.uniqueKey)];case 1:return[2,e.sent()];case 2:return e.sent(),[2,null];case 3:return[2]}})})},e.prototype.setLocalData=function(e){try{var t={timestamp:Date.now(),settingConfig:e};this.setSettingData(e),this.dbStorage.setItem(this.uniqueKey,t),this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Update LogSetting Cache",logType:"info",level:"info",time:Date.now(),infoType:"sdk",data:e})}catch(e){this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Set LogSetting Data Error",logType:"info",level:"error",time:Date.now(),infoType:"sdk"})}},e.prototype.getSettingData=function(e){return e?this.logSettingConfig[e]:this.logSettingConfig},e.prototype.setSettingData=function(e){this.logSettingConfig=e},e.prototype.getPredefineEventList=function(){return new Set(["predefine_pageview","onload","bav2b_click","bav2b_page","bav2b_beat","bav2b_page_statistics","bav2b_exposure","predefine_page_alive","predefine_page_close","_be_active","__bav_click","__bav_page","__bav_beat","__bav_page_statistics","__bav_page_exposure"])},e.prototype.getPredefineParamsList=function(){return new Set(["event_index"])},e}(),eo=function(){function e(){this.eventLimit=50,this.enable_ttwebid=!1,this.eventCache=[],this.beconEventCache=[]}return e.prototype.apply=function(e,t){var n=this;this.collect=e,this.config=t,this.configManager=e.configManager,this.cacheStorgae=new P(!0),this.localStorage=new P(!1),this.logSetting=new er,this.maxReport=t.max_report||10,this.reportTime=t.reportTime||30,this.timeout=t.timeout||1e5,this.enable_ttwebid=t.enable_ttwebid,this.reportUrl=t.report_url||this.configManager.getUrl("event"),this.eventKey="__tea_cache_events_"+this.configManager.get("app_id"),this.beconKey="__tea_cache_events_becon_"+this.configManager.get("app_id"),this.abKey="__tea_sdk_ab_version_"+this.configManager.get("app_id"),this.refer_key="__tea_cache_refer_"+this.configManager.get("app_id"),this.logSetting.apply(e,t),this.collect.on(Z.Ready,function(){n.reportAll(!1)}),this.collect.on(Z.ConfigDomain,function(){n.reportUrl=n.configManager.getUrl("event")}),this.collect.on(Z.Event,function(e){n.event(e)}),this.collect.on(Z.BeconEvent,function(e){n.beconEvent(e)}),this.collect.on(Z.CleanEvents,function(){n.reportAll(!1)}),this.linster()},e.prototype.linster=function(){var e=this;window.addEventListener("unload",function(){e.reportAll(!0)},!1),v(function(){e.reportAll(!0)}),document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e.reportAll(!0)},!1)},e.prototype.reportAll=function(e){this.report(e),this.reportBecon()},e.prototype.event=function(e){var t=this;if(!this.collect.destroy&&!this.collect.sdkStop)try{if(this.config.enable_ios_sendbeacon&&m())return void this.beconEvent(e);var n=u(e,this.cacheStorgae.getItem(this.eventKey)||[]);if(this.cacheStorgae.setItem(this.eventKey,n),this.reportTimeout&&clearTimeout(this.reportTimeout),n.length>=this.maxReport)this.report(!1);else{var i=this.reportTime;this.reportTimeout=setTimeout(function(){t.report(!1),t.reportTimeout=null},i)}}catch(e){this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Something Error",level:"error",time:Date.now(),data:e.message,infoType:"sdk"})}},e.prototype.beconEvent=function(e){if(!this.collect.destroy&&!this.collect.sdkStop){var t=u(e,this.cacheStorgae.getItem(this.beconKey)||[]);if(this.cacheStorgae.setItem(this.beconKey,t),this.collect.tokenManager.getReady()&&this.collect.sdkReady){this.cacheStorgae.removeItem(this.beconKey);try{var n=JSON.parse(JSON.stringify(t));if(this.send(this.split(this.merge(t)),!0),this.config.event_verify_url){var i=this.split(this.merge(n,!0));this.collect.emit(Z.SubmitVerify,i)}}catch(e){this.send(this.split(this.merge(t)),!0)}}}},e.prototype.reportBecon=function(){if(!this.collect.destroy&&!this.collect.sdkStop&&this.collect.tokenManager.getReady()&&this.collect.sdkReady){var e=this.cacheStorgae.getItem(this.beconKey)||[];if(e&&e.length){this.cacheStorgae.removeItem(this.beconKey);try{var t=JSON.parse(JSON.stringify(e));if(this.send(this.split(this.merge(e)),!0),this.config.event_verify_url){var n=this.split(this.merge(t,!0));this.collect.emit(Z.SubmitVerify,n)}}catch(t){this.send(this.split(this.merge(e)),!0)}}}},e.prototype.report=function(e){if(!this.collect.destroy&&!this.collect.sdkStop&&this.collect.tokenManager.getReady()&&this.collect.sdkReady){var t=this.cacheStorgae.getItem(this.eventKey)||[];t.length&&(this.cacheStorgae.removeItem(this.eventKey),this.sliceEvent(t,e))}},e.prototype.sliceEvent=function(e,t){if(e.length>this.eventLimit)for(var n,i=0;i<e.length;i+=this.eventLimit){n=e.slice(i,i+this.eventLimit);try{var r=JSON.parse(JSON.stringify(n));if(this.send(this.split(this.merge(n)),t),this.config.event_verify_url){var o=this.split(this.merge(r,!0));this.collect.emit(Z.SubmitVerify,o)}}catch(e){this.send(this.split(this.merge(n)),t)}}else try{r=JSON.parse(JSON.stringify(e)),this.send(this.split(this.merge(e)),t),this.config.event_verify_url&&(o=this.split(this.merge(r,!0)),this.collect.emit(Z.SubmitVerify,o))}catch(n){this.send(this.split(this.merge(e)),t)}},e.prototype.handleRefer=function(){var e="";try{if(this.config.spa||this.config.autotrack){var t=this.localStorage.getItem(this.refer_key)||{};e=t.routeChange?t.refer_key:this.configManager.get("referrer")}else e=this.configManager.get("referrer")}catch(t){e=document.referrer}return e},e.prototype.merge=function(e,t){var n=this;void 0===t&&(t=!1);var i=this.configManager.get(),r=i.header,o=i.user;r.custom=this.customAllow(r.custom,t);var a=this.configManager.get("evtParams"),c=this.configManager.get("user_unique_id_type"),l=[];try{var u=e.filter(function(e){try{Object.keys(a).length&&(e.params=s(s({},a),e.params)),c&&(e.params.$user_unique_id_type=c);var i=n.configManager.getAbCache(),r=o[n.config.ab_user_mode]||o.user_unique_id,l=n.configManager.getAbUuidCache(r);if(i&&i.uuid&&i.uuid===r){var u=n.configManager.getAbVersion();if(n.config.enable_ab_uuid){if(l&&l.length){var h=l.join(",");u&&u.includes(h)&&(e.ab_sdk_version=u)}}else u&&(e.ab_sdk_version=u)}return e.session_id=n.collect.sessionManager.getSessionId(),e.params=n.paramsAllow(e,t),e}catch(t){return console.warn("filter merge event: "+(e&&e.event)+" error, pls check",t&&t.message),n.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Merge Event Something Error",level:"error",time:Date.now(),data:t.message,infoType:"sdk"}),!1}}),h=JSON.parse(JSON.stringify({events:u,user:o,header:r}));h.local_time=Math.floor(Date.now()/1e3),h.user_unique_type=this.config.enable_ttwebid?this.config.user_unique_type:void 0,h.verbose=1,l.push(h)}catch(e){console.warn("event merge error, pls check",e&&e.message)}return l},e.prototype.split=function(e){return e.map(function(e){var t=[];return t.push(e),t})},e.prototype.blockEvent=function(e){try{var t=this.blockList;if(this.config.enable_logsetting){var n=this.blockList,i=this.logSetting.getSettingData("blocklist_events").block_event;t=n.concat(i.filter(function(e){return -1===n.indexOf(e)}))}return!(t&&t.length&&t.includes(e))}catch(e){return!0}},e.prototype.whiteEvent=function(e){var t;try{return!(null==(t=this.whiteList)?void 0:t.length)||!!this.whiteList.includes(e)}catch(e){return!0}},e.prototype.customAllow=function(e,t){try{if(t||!this.config.enable_logsetting||!this.config.enable_logsetting_header_custom)return JSON.stringify(e);var n=this.logSetting.getSettingData().header_custom_allow;if(n){var i={};if(n.length&&Object.keys(e).length){var r=new Set(n);for(var o in e)r.has(o)&&(i[o]=e[o])}return JSON.stringify(i)}return JSON.stringify(e)}catch(t){return this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute customAllow Something Error",level:"error",time:Date.now(),data:t.message,infoType:"sdk"}),JSON.stringify(e)}},e.prototype.paramsAllow=function(e,t){try{if(t||!this.config.enable_logsetting||!this.config.enable_logsetting_params)return JSON.stringify(e.params);var n=this.logSetting.getSettingData().params_block,i=e.event,r=e.params;if(!n)return JSON.stringify(e.params);if(n[i]&&n[i].length){var o={},a=new Set(n[i]);for(var s in r)!this.logSetting.getPredefineParamsList().has(s)&&a.has(s)||(o[s]=r[s]);return JSON.stringify(o)}return JSON.stringify(e.params)}catch(t){return this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute paramsAllow Something Error",level:"error",time:Date.now(),data:t.message,infoType:"sdk"}),JSON.stringify(e.params)}},e.prototype.send=function(e,t){var n=this;e.length&&(this.config.disable_track_event||e.forEach(function(e){try{var i=JSON.parse(JSON.stringify(e));n.config.filter&&((i=n.config.filter(i))||console.warn("filter must return data !!")),n.collect.eventFilter&&i&&((i=n.collect.eventFilter(i))||console.warn("filterEvent api must return data !!"));var r=i||e,o=JSON.parse(JSON.stringify(r));if(!r.length)return;var a=!0;if(r.forEach(function(e){e.events.length||(a=!1)}),!a)return;n.collect.emit(Z.SubmitBefore,r),n.collect.requestManager.useRequest({url:n.reportUrl,data:r,success:function(e,t){e&&0!==e.e?(n.collect.emit(Z.SubmitError,{type:"f_data",eventData:t,errorCode:e.e,response:e}),n.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_EVENT,info:"Event Report Fail",time:Date.now(),data:o,code:e.e,failType:"event data error",status:"fail"})):(n.collect.emit(Z.SubmitScuess,{eventData:t,res:e}),n.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_EVENT,info:"Event Report Success",time:Date.now(),data:o,code:200,status:"success"}))},fail:function(e,t){n.configManager.get("reportErrorCallback")(e,t),n.collect.emit(Z.SubmitError,{type:"f_net",eventData:e,errorCode:t}),n.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_EVENT,info:"Event Report Network Fail",time:Date.now(),data:o,code:t,failType:"network error",status:"fail"})},timeout:n.timeout,useBeacon:!n.config.disable_sendbeacon&&t,withCredentials:n.enable_ttwebid,zip:!0}),n.collect.emit(Z.SubmitAfter,r)}catch(e){console.warn("something error, "+JSON.stringify(e.stack)),n.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Report Event Something Error",level:"error",time:Date.now(),data:e.message})}}))},e}(),ea=function(){return(function e(t){return t?(t^16*Math.random()>>t/4).toString(10):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e)})().replace(/-/g,"").slice(0,19)},es=function(){function e(){this.cacheToken={},this.enableCookie=!1,this.enable_ttwebid=!1,this.enableCustomWebid=!1}return e.prototype.apply=function(e,t){var n=this;this.collect=e,this.config=t,this.configManager=this.collect.configManager,this.storage=new P(!1),this.tokenKey="__tea_cache_tokens_"+t.app_id,this.enable_ttwebid=t.enable_ttwebid,this.enableCustomWebid=t.enable_custom_webid,this.collect.on(Z.ConfigUuid,function(e){n.setUuid(e)}),this.collect.on(Z.ConfigWebId,function(e){n.setWebId(e)}),this.collect.on(Z.ConfigDiD,function(e){n.setDeviceId(e)}),this.enableCookie=t.cross_subdomain,this.expiresTime=t.cookie_expire||6048e5,this.cookieDomain=t.cookie_domain||"",this.checkStorage()},e.prototype.checkStorage=function(){var e=this;this.cacheToken=this.storage.getItem(this.tokenKey)||{},this.tokenType=this.cacheToken&&this.cacheToken._type_?this.cacheToken._type_:"default","custom"!==this.tokenType||this.enableCustomWebid?this.enableCustomWebid?this.collect.on(Z.CustomWebId,function(){e.tokenReady=!0,e.collect.emit(Z.TokenComplete)}):this.checkEnv()||(this.enable_ttwebid?this.completeTtWid(this.cacheToken):this.check()):this.remoteWebid()},e.prototype.check=function(){this.cacheToken&&this.cacheToken.web_id?this.complete(this.cacheToken):this.config.disable_webid?this.complete({web_id:ea(),user_unique_id:this.configManager.get("user_unique_id")||ea()}):this.remoteWebid()},e.prototype.checkEnv=function(){var e=window.navigator.userAgent;if(-1!==e.indexOf("miniProgram")||-1!==e.indexOf("MiniProgram")){var t=E(window.location.href);return!(!t||!t.Web_ID)&&(this.complete({web_id:""+t.Web_ID,user_unique_id:this.configManager.get("user_unique_id")||""+t.Web_ID}),!0)}return!1},e.prototype.remoteWebid=function(){var e=this,t=this.configManager.getUrl("webid"),n={app_key:this.config.app_key,app_id:this.config.app_id,url:location.href,user_agent:window.navigator.userAgent,referer:document.referrer,user_unique_id:""};this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Fetch WebID Request",logType:"fetch",level:"info",time:Date.now(),data:n});var i=ea();this.collect.requestManager.useRequest({url:t,data:n,success:function(t){var n;t&&0===t.e?(n=t.web_id,e.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"Fetch WebID Request Success",logType:"fetch",level:"info",time:Date.now(),data:t})):(n=i,e.collect.configManager.set({localWebId:i}),e.collect.emit(Z.TokenError),e.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"Fetch WebID Request Data Error, Use LocalId",logType:"fetch",level:"warn",time:Date.now(),data:t}),e.collect.logger.warn("appid: "+e.config.app_id+" get webid error, use local webid~")),e.complete({web_id:e.configManager.get("web_id")||n,user_unique_id:e.configManager.get("user_unique_id")||n})},fail:function(){e.complete({web_id:e.configManager.get("web_id")||i,user_unique_id:e.configManager.get("user_unique_id")||i}),e.collect.configManager.set({localWebId:i}),e.collect.emit(Z.TokenError),e.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"Fetch WebID Request Network Fail, Use LocalId",logType:"fetch",level:"error",time:Date.now(),data:null}),e.collect.logger.warn("appid: "+e.config.app_id+", get webid error, use local webid~")},timeout:3e5})},e.prototype.complete=function(e){var t=e.web_id,n=e.user_unique_id,i=e.device_id;if(e.timestamp=Date.now(),this.collect.configManager.set({web_id:t,user_unique_id:n}),this.config.enable_device_id){var r=this.configManager.get("device_id")||i||t;this.collect.configManager.set({device_id:r}),e=s(s({},e),{device_id:r})}else delete e.device_id;this.setStorage(e),this.tokenReady=!0,this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK UserInfo Complete",logType:"info",secType:"USER",level:"info",time:Date.now(),data:{web_id:t,user_unique_id:n},infoType:"sdk"}),this.collect.emit(Z.TokenComplete)},e.prototype.completeTtWid=function(e){var t=e.user_unique_id||"",n=this.configManager.get("user_unique_id");(n||t)&&this.configManager.set({user_unique_id:n||t}),this.setStorage(e),this.tokenReady=!0,this.collect.emit(Z.TokenComplete)},e.prototype.setUuid=function(e){if(e&&-1===["null","undefined","Null","None"].indexOf(e)){var t=String(e),n=this.configManager.get("user_unique_id"),i=this.cacheToken&&this.cacheToken.user_unique_id;(t!==n||t!==i)&&(this.configManager.set({user_unique_id:t}),this.cacheToken||(this.cacheToken={}),this.cacheToken.user_unique_id=t,this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken),this.collect.emit(Z.TokenChange,"uuid"),this.collect.emit(Z.SessionReset))}else this.clearUuid()},e.prototype.clearUuid=function(){this.config.enable_ttwebid||this.configManager.get("web_id")&&(this.configManager.set({user_unique_id:this.configManager.get("web_id")}),this.cacheToken&&this.cacheToken.web_id&&(this.cacheToken.user_unique_id=this.cacheToken.web_id,this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken)),this.collect.emit(Z.TokenReset))},e.prototype.setWebId=function(e){if(e&&!this.config.enable_ttwebid){this.cacheToken&&this.cacheToken.web_id?this.cacheToken.web_id!==e&&(this.cacheToken.user_unique_id=this.cacheToken.web_id===this.cacheToken.user_unique_id?e:this.cacheToken.user_unique_id,this.cacheToken.web_id=e):(this.cacheToken={},this.cacheToken.web_id=e,this.cacheToken.user_unique_id=e),this.cacheToken.timestamp=Date.now();var t=this.configManager.get("web_id"),n=this.configManager.get("user_unique_id");n&&n!==t||(this.configManager.set({user_unique_id:e}),this.collect.emit(Z.TokenChange,"uuid")),t!==e&&(this.configManager.set({web_id:e}),this.collect.emit(Z.TokenChange,"webid")),this.setStorage(this.cacheToken)}},e.prototype.setDeviceId=function(e){this.configManager.set({device_id:e}),this.config.enable_device_id&&this.cacheToken&&(this.cacheToken.device_id=e,this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken))},e.prototype.setStorage=function(e){e._type_=this.enableCustomWebid?"custom":"default",delete e["diss".split("").reverse().join("")],this.storage.setItem(this.tokenKey,e),this.cacheToken=e},e.prototype.getReady=function(){return this.tokenReady},e.prototype.getTobId=function(){var e=this;return new Promise(function(t){if("tcpy"!==e.config.channel_type&&"ttp"!==e.config.channel_type){var n={app_id:e.config.app_id,user_unique_id:e.configManager.get("user_unique_id"),web_id:e.configManager.get("web_id"),user_unique_id_type:e.configManager.get("user_unique_id_type")};e.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Fetch GetToken Request",logType:"fetch",level:"info",time:Date.now(),data:n,infoType:"sdk"}),e.collect.requestManager.useRequest({url:e.configManager.getUrl("tobid"),data:n,success:function(n){n&&0===n.e?(t(n.tobid),e.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"Fetch GetToken Request Success",logType:"fetch",level:"info",time:Date.now(),data:n,infoType:"sdk"})):(t(""),e.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"Fetch GetToken Request Fail",logType:"fetch",level:"error",time:Date.now(),data:n,infoType:"sdk"}))},fail:function(){t(""),e.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"Fetch GetToken Request Network Error",logType:"fetch",level:"error",time:Date.now(),infoType:"sdk"})},time:3e4,withCredentials:e.enable_ttwebid})}else t("")})},e}(),ec=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},el=function(){function e(){}return e.prototype.apply=function(e,t){var n=this;this.collect=e,this.storage=new P(!1,"session"),this.sessionKey="__tea_session_id_"+t.app_id,this.expireTime=t.expireTime||18e5,this.disableSession=t.disable_session,this.disableSessionTimeCheck=t.disable_session_check,this.disableSession||(this.setSessionId(),this.collect.on(Z.SessionReset,function(e){n.resetSessionId(e)}),this.collect.on(Z.SessionResetTime,function(){n.updateSessionIdTime()}))},e.prototype.updateSessionIdTime=function(){var e=this.storage.getItem(this.sessionKey);if(e&&e.sessionId){var t=e.timestamp;Date.now()-t>this.expireTime?e={sessionId:ec(),timestamp:Date.now()}:e.timestamp=Date.now(),this.storage.setItem(this.sessionKey,e),this.resetExpTime()}},e.prototype.setSessionId=function(){var e=this,t=this.storage.getItem(this.sessionKey);t&&t.sessionId?t.timestamp=Date.now():t={sessionId:ec(),timestamp:Date.now()},this.storage.setItem(this.sessionKey,t),this.disableSessionTimeCheck||(this.sessionExp=setInterval(function(){e.checkEXp()},this.expireTime))},e.prototype.getSessionId=function(){var e=this.storage.getItem(this.sessionKey);return this.disableSession?"":e&&e.sessionId?e.sessionId:""},e.prototype.resetExpTime=function(){var e=this;this.sessionExp&&(clearInterval(this.sessionExp),this.sessionExp=setInterval(function(){e.checkEXp()},this.expireTime))},e.prototype.resetSessionId=function(e){var t={sessionId:e||ec(),timestamp:Date.now()};this.storage.setItem(this.sessionKey,t)},e.prototype.checkEXp=function(){var e=this.storage.getItem(this.sessionKey);e&&e.sessionId&&Date.now()-e.timestamp+30>=this.expireTime&&(e={sessionId:ec(),timestamp:Date.now()},this.storage.setItem(this.sessionKey,e))},e}();function eu(e){let t=e.length;for(;--t>=0;)e[t]=0}let eh=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ed=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),ef=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ep=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),eg=Array(576);eu(eg);let e_=Array(60);eu(e_);let em=Array(512);eu(em);let ev=Array(256);eu(ev);let ey=Array(29);eu(ey);let eb=Array(30);function eE(e,t,n,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}function ew(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}eu(eb);let eS=e=>e<256?em[e]:em[256+(e>>>7)],ez=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},ek=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,ez(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},eD=(e,t,n)=>{ek(e,n[2*t],n[2*t+1])},eT=(e,t)=>{let n=0;do n|=1&e,e>>>=1,n<<=1;while(--t>0);return n>>>1},eA=(e,t,n)=>{let i=Array(16),r,o,a=0;for(r=1;r<=15;r++)a=a+n[r-1]<<1,i[r]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=eT(i[t]++,t))}},eR=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},ex=e=>{e.bi_valid>8?ez(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},eI=(e,t,n,i)=>{let r=2*t,o=2*n;return e[r]<e[o]||e[r]===e[o]&&i[t]<=i[n]},eG=(e,t,n)=>{let i=e.heap[n],r=n<<1;for(;r<=e.heap_len&&(r<e.heap_len&&eI(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!eI(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i},eM=(e,t,n)=>{let i,r,o,a,s=0;if(0!==e.sym_next)do i=(255&e.pending_buf[e.sym_buf+s++])+((255&e.pending_buf[e.sym_buf+s++])<<8),r=e.pending_buf[e.sym_buf+s++],0===i?eD(e,r,t):(eD(e,(o=ev[r])+256+1,t),0!==(a=eh[o])&&ek(e,r-=ey[o],a),eD(e,o=eS(--i),n),0!==(a=ed[o])&&ek(e,i-=eb[o],a));while(s<e.sym_next);eD(e,256,t)},eO=(e,t)=>{let n=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.elems,a,s,c,l=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<o;a++)0!==n[2*a]?(e.heap[++e.heap_len]=l=a,e.depth[a]=0):n[2*a+1]=0;for(;e.heap_len<2;)n[2*(c=e.heap[++e.heap_len]=l<2?++l:0)]=1,e.depth[c]=0,e.opt_len--,r&&(e.static_len-=i[2*c+1]);for(t.max_code=l,a=e.heap_len>>1;a>=1;a--)eG(e,n,a);c=o;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],eG(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[2*c]=n[2*a]+n[2*s],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[2*a+1]=n[2*s+1]=c,e.heap[1]=c++,eG(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{let n=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,h,d,f,p,g=0;for(d=0;d<=15;d++)e.bl_count[d]=0;for(n[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)(d=n[2*n[2*(u=e.heap[l])+1]+1]+1)>c&&(d=c,g++),n[2*u+1]=d,u>i||(e.bl_count[d]++,f=0,u>=s&&(f=a[u-s]),p=n[2*u],e.opt_len+=p*(d+f),o&&(e.static_len+=p*(r[2*u+1]+f)));if(0!==g){do{for(d=c-1;0===e.bl_count[d];)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[c]--,g-=2}while(g>0);for(d=c;0!==d;d--)for(u=e.bl_count[d];0!==u;)(h=e.heap[--l])>i||(n[2*h+1]!==d&&(e.opt_len+=(d-n[2*h+1])*n[2*h],n[2*h+1]=d),u--)}})(e,t),eA(n,l,e.bl_count)},eC=(e,t,n)=>{let i,r,o=-1,a=t[1],s=0,c=7,l=4;for(0===a&&(c=138,l=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)r=a,a=t[2*(i+1)+1],++s<c&&r===a||(s<l?e.bl_tree[2*r]+=s:0!==r?(r!==o&&e.bl_tree[2*r]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=r,0===a?(c=138,l=3):r===a?(c=6,l=3):(c=7,l=4))},eU=(e,t,n)=>{let i,r,o=-1,a=t[1],s=0,c=7,l=4;for(0===a&&(c=138,l=3),i=0;i<=n;i++)if(r=a,a=t[2*(i+1)+1],!(++s<c&&r===a)){if(s<l)do eD(e,r,e.bl_tree);while(0!=--s);else 0!==r?(r!==o&&(eD(e,r,e.bl_tree),s--),eD(e,16,e.bl_tree),ek(e,s-3,2)):s<=10?(eD(e,17,e.bl_tree),ek(e,s-3,3)):(eD(e,18,e.bl_tree),ek(e,s-11,7));s=0,o=r,0===a?(c=138,l=3):r===a?(c=6,l=3):(c=7,l=4)}},eB=!1,eL=(e,t,n,i)=>{ek(e,0+ +!!i,3),ex(e),ez(e,n),ez(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var eN={_tr_init:e=>{eB||((()=>{let e,t,n,a,s,c=Array(16);for(n=0,a=0;a<28;a++)for(ey[a]=n,e=0;e<1<<eh[a];e++)ev[n++]=a;for(ev[n-1]=a,s=0,a=0;a<16;a++)for(eb[a]=s,e=0;e<1<<ed[a];e++)em[s++]=a;for(s>>=7;a<30;a++)for(eb[a]=s<<7,e=0;e<1<<ed[a]-7;e++)em[256+s++]=a;for(t=0;t<=15;t++)c[t]=0;for(e=0;e<=143;)eg[2*e+1]=8,e++,c[8]++;for(;e<=255;)eg[2*e+1]=9,e++,c[9]++;for(;e<=279;)eg[2*e+1]=7,e++,c[7]++;for(;e<=287;)eg[2*e+1]=8,e++,c[8]++;for(eA(eg,287,c),e=0;e<30;e++)e_[2*e+1]=5,e_[2*e]=eT(e,5);i=new eE(eg,eh,257,286,15),r=new eE(e_,ed,0,30,15),o=new eE([],ef,0,19,7)})(),eB=!0),e.l_desc=new ew(e.dyn_ltree,i),e.d_desc=new ew(e.dyn_dtree,r),e.bl_desc=new ew(e.bl_tree,o),e.bi_buf=0,e.bi_valid=0,eR(e)},_tr_stored_block:eL,_tr_flush_block:(e,t,n,i)=>{let r,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=0xf3ffc07f;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),eO(e,e.l_desc),eO(e,e.d_desc),a=(e=>{let t;for(eC(e,e.dyn_ltree,e.l_desc.max_code),eC(e,e.dyn_dtree,e.d_desc.max_code),eO(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*ep[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=r&&(r=o)):r=o=n+5,n+4<=r&&-1!==t?eL(e,t,n,i):4===e.strategy||o===r?(ek(e,2+ +!!i,3),eM(e,eg,e_)):(ek(e,4+ +!!i,3),((e,t,n,i)=>{let r;for(ek(e,t-257,5),ek(e,n-1,5),ek(e,i-4,4),r=0;r<i;r++)ek(e,e.bl_tree[2*ep[r]+1],3);eU(e,e.dyn_ltree,t-1),eU(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),eM(e,e.dyn_ltree,e.dyn_dtree)),eR(e),i&&ex(e)},_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(ev[n]+256+1)]++,e.dyn_dtree[2*eS(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{ek(e,2,3),eD(e,256,eg),16===e.bi_valid?(ez(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},eP=(e,t,n,i)=>{let r=65535&e,o=e>>>16&65535,a=0;for(;0!==n;){a=n>2e3?2e3:n,n-=a;do o=o+(r=r+t[i++]|0)|0;while(--a);r%=65521,o%=65521}return r|o<<16};let ej=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?0xedb88320^e>>>1:e>>>1;t[n]=e}return t})());var eK=(e,t,n,i)=>{let r=i+n;e^=-1;for(let n=i;n<r;n++)e=e>>>8^ej[255&(e^t[n])];return -1^e},eV={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},eq={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};let{_tr_init:eF,_tr_stored_block:eH,_tr_flush_block:eJ,_tr_tally:eW,_tr_align:eZ}=eN,{Z_NO_FLUSH:eX,Z_PARTIAL_FLUSH:eY,Z_FULL_FLUSH:e$,Z_FINISH:eQ,Z_BLOCK:e1,Z_OK:e0,Z_STREAM_END:e2,Z_STREAM_ERROR:e5,Z_DATA_ERROR:e4,Z_BUF_ERROR:e6,Z_DEFAULT_COMPRESSION:e3,Z_FILTERED:e8,Z_HUFFMAN_ONLY:e9,Z_RLE:e7,Z_FIXED:te,Z_DEFAULT_STRATEGY:tt,Z_UNKNOWN:tn,Z_DEFLATED:ti}=eq,tr=(e,t)=>(e.msg=eV[t],t),to=e=>2*e-9*(e>4),ta=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ts=e=>{let t,n,i,r=e.w_size;i=t=e.hash_size;do n=e.head[--i],e.head[i]=n>=r?n-r:0;while(--t);i=t=r;do n=e.prev[--i],e.prev[i]=n>=r?n-r:0;while(--t)},tc=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,tl=e=>{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},tu=(e,t)=>{eJ(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,tl(e.strm)},th=(e,t)=>{e.pending_buf[e.pending++]=t},td=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},tf=(e,t,n,i)=>{let r=e.avail_in;return r>i&&(r=i),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),n),1===e.state.wrap?e.adler=eP(e.adler,t,r,n):2===e.state.wrap&&(e.adler=eK(e.adler,t,r,n)),e.next_in+=r,e.total_in+=r,r)},tp=(e,t)=>{let n,i,r=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,l=e.window,u=e.w_mask,h=e.prev,d=e.strstart+258,f=l[o+a-1],p=l[o+a];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do if(l[(n=t)+a]===p&&l[n+a-1]===f&&l[n]===l[o]&&l[++n]===l[o+1]){o+=2,n++;do;while(l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&o<d);if(i=258-(d-o),o=d-258,i>a){if(e.match_start=t,a=i,i>=s)break;f=l[o+a-1],p=l[o+a]}}while((t=h[t&u])>c&&0!=--r);return a<=e.lookahead?a:e.lookahead},tg=e=>{let t,n,i,r=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=r+(r-262)&&(e.window.set(e.window.subarray(r,r+r-n),0),e.match_start-=r,e.strstart-=r,e.block_start-=r,e.insert>e.strstart&&(e.insert=e.strstart),ts(e),n+=r),0===e.strm.avail_in)break;if(t=tf(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=t,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=tc(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=tc(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)},t_=(e,t)=>{let n,i,r,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(n=65535,r=e.bi_valid+42>>3,e.strm.avail_out<r||(r=e.strm.avail_out-r,n>(i=e.strstart-e.block_start)+e.strm.avail_in&&(n=i+e.strm.avail_in),n>r&&(n=r),n<o&&(0===n&&t!==eQ||t===eX||n!==i+e.strm.avail_in)))break;a=+(t===eQ&&n===i+e.strm.avail_in),eH(e,0,0,a),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,tl(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&(tf(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===a);return(s-=e.strm.avail_in)&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==eX&&t!==eQ&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(r=e.window_size-e.strstart,e.strm.avail_in>r&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(tf(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water<e.strstart&&(e.high_water=e.strstart),r=e.bi_valid+42>>3,o=(r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r)>e.w_size?e.w_size:r,((i=e.strstart-e.block_start)>=o||(i||t===eQ)&&t!==eX&&0===e.strm.avail_in&&i<=r)&&(n=i>r?r:i,a=+(t===eQ&&0===e.strm.avail_in&&n===i),eH(e,e.block_start,n,a),e.block_start+=n,tl(e.strm)),a?3:1)},tm=(e,t)=>{let n,i;for(;;){if(e.lookahead<262){if(tg(e),e.lookahead<262&&t===eX)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=tc(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-262&&(e.match_length=tp(e,n)),e.match_length>=3)if(i=eW(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do e.strstart++,e.ins_h=tc(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=tc(e,e.ins_h,e.window[e.strstart+1]);else i=eW(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(tu(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===eQ?(tu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(tu(e,!1),0===e.strm.avail_out)?1:2},tv=(e,t)=>{let n,i,r;for(;;){if(e.lookahead<262){if(tg(e),e.lookahead<262&&t===eX)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=tc(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-262&&(e.match_length=tp(e,n),e.match_length<=5&&(e.strategy===e8||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,i=eW(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=r&&(e.ins_h=tc(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(tu(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=eW(e,0,e.window[e.strstart-1]))&&tu(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=eW(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===eQ?(tu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(tu(e,!1),0===e.strm.avail_out)?1:2};function ty(e,t,n,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=r}let tb=[new ty(0,0,0,0,t_),new ty(4,4,8,4,tm),new ty(4,5,16,8,tm),new ty(4,6,32,32,tm),new ty(4,4,16,16,tv),new ty(8,16,32,32,tv),new ty(8,16,128,128,tv),new ty(8,32,128,256,tv),new ty(32,128,258,1024,tv),new ty(32,258,258,4096,tv)];function tE(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ti,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),ta(this.dyn_ltree),ta(this.dyn_dtree),ta(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),ta(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ta(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}let tw=e=>{if(!e)return 1;let t=e.state;return t&&t.strm===e&&(42===t.status||57===t.status||69===t.status||73===t.status||91===t.status||103===t.status||113===t.status||666===t.status)?0:1};var tS=(e,t)=>{if(tw(e)||t>e1||t<0)return e?tr(e,e5):e5;let n=e.state;if(!e.output||0!==e.avail_in&&!e.input||666===n.status&&t!==eQ)return tr(e,0===e.avail_out?e6:e5);let i=n.last_flush;if(n.last_flush=t,0!==n.pending){if(tl(e),0===e.avail_out)return n.last_flush=-1,e0}else if(0===e.avail_in&&to(t)<=to(i)&&t!==eQ)return tr(e,e6);if(666===n.status&&0!==e.avail_in)return tr(e,e6);if(42===n.status&&0===n.wrap&&(n.status=113),42===n.status){let t=ti+(n.w_bits-8<<4)<<8;if(t|=(n.strategy>=e9||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(t|=32),td(n,t+=31-t%31),0!==n.strstart&&(td(n,e.adler>>>16),td(n,65535&e.adler)),e.adler=1,n.status=113,tl(e),0!==n.pending)return n.last_flush=-1,e0}if(57===n.status){if(e.adler=0,th(n,31),th(n,139),th(n,8),n.gzhead)th(n,+!!n.gzhead.text+2*!!n.gzhead.hcrc+4*!!n.gzhead.extra+8*!!n.gzhead.name+16*!!n.gzhead.comment),th(n,255&n.gzhead.time),th(n,n.gzhead.time>>8&255),th(n,n.gzhead.time>>16&255),th(n,n.gzhead.time>>24&255),th(n,9===n.level?2:4*(n.strategy>=e9||n.level<2)),th(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(th(n,255&n.gzhead.extra.length),th(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=eK(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(th(n,0),th(n,0),th(n,0),th(n,0),th(n,0),th(n,9===n.level?2:4*(n.strategy>=e9||n.level<2)),th(n,3),n.status=113,tl(e),0!==n.pending)return n.last_flush=-1,e0}if(69===n.status){if(n.gzhead.extra){let t=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let r=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=eK(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=r,tl(e),0!==n.pending)return n.last_flush=-1,e0;t=0,i-=r}let r=new Uint8Array(n.gzhead.extra);n.pending_buf.set(r.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>t&&(e.adler=eK(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=eK(e.adler,n.pending_buf,n.pending-i,i)),tl(e),0!==n.pending)return n.last_flush=-1,e0;i=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,th(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=eK(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=eK(e.adler,n.pending_buf,n.pending-i,i)),tl(e),0!==n.pending)return n.last_flush=-1,e0;i=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,th(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=eK(e.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(tl(e),0!==n.pending))return n.last_flush=-1,e0;th(n,255&e.adler),th(n,e.adler>>8&255),e.adler=0}if(n.status=113,tl(e),0!==n.pending)return n.last_flush=-1,e0}if(0!==e.avail_in||0!==n.lookahead||t!==eX&&666!==n.status){let i=0===n.level?t_(n,t):n.strategy===e9?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(tg(e),0===e.lookahead)){if(t===eX)return 1;break}if(e.match_length=0,n=eW(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(tu(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===eQ?(tu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(tu(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===e7?((e,t)=>{let n,i,r,o,a=e.window;for(;;){if(e.lookahead<=258){if(tg(e),e.lookahead<=258&&t===eX)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=a[r=e.strstart-1])===a[++r]&&i===a[++r]&&i===a[++r]){o=e.strstart+258;do;while(i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&r<o);e.match_length=258-(o-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=eW(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=eW(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(tu(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===eQ?(tu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(tu(e,!1),0===e.strm.avail_out)?1:2})(n,t):tb[n.level].func(n,t);if(3!==i&&4!==i||(n.status=666),1===i||3===i)return 0===e.avail_out&&(n.last_flush=-1),e0;if(2===i&&(t===eY?eZ(n):t!==e1&&(eH(n,0,0,!1),t===e$&&(ta(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),tl(e),0===e.avail_out))return n.last_flush=-1,e0}return t!==eQ?e0:n.wrap<=0?e2:(2===n.wrap?(th(n,255&e.adler),th(n,e.adler>>8&255),th(n,e.adler>>16&255),th(n,e.adler>>24&255),th(n,255&e.total_in),th(n,e.total_in>>8&255),th(n,e.total_in>>16&255),th(n,e.total_in>>24&255)):(td(n,e.adler>>>16),td(n,65535&e.adler)),tl(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?e0:e2)},tz=e=>{if(tw(e))return e5;let t=e.state.status;return e.state=null,113===t?tr(e,e4):e0};let tk=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var tD=function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let n=t.shift();if(n){if("object"!=typeof n)throw TypeError(n+"must be non-object");for(let t in n)tk(n,t)&&(e[t]=n[t])}}return e},tT=e=>{let t=0;for(let n=0,i=e.length;n<i;n++)t+=e[n].length;let n=new Uint8Array(t);for(let t=0,i=0,r=e.length;t<r;t++){let r=e[t];n.set(r,i),i+=r.length}return n};let tA=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){tA=!1}let tR=new Uint8Array(256);for(let e=0;e<256;e++)tR[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;tR[254]=tR[254]=1;var tx=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,i,r,o,a=e.length,s=0;for(r=0;r<a;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),o=0,r=0;o<s;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),n<128?t[o++]=n:(n<2048?t[o++]=192|n>>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},tI=(e,t)=>{let n,i,r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let o=Array(2*r);for(i=0,n=0;n<r;){let t=e[n++];if(t<128){o[i++]=t;continue}let a=tR[t];if(a>4)o[i++]=65533,n+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&n<r;)t=t<<6|63&e[n++],a--;a>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}var a=i;if(a<65534&&o.subarray&&tA)return String.fromCharCode.apply(null,o.length===a?o:o.subarray(0,a));let s="";for(let e=0;e<a;e++)s+=String.fromCharCode(o[e]);return s},tG=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+tR[e[n]]>t?n:t},tM=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};let tO=Object.prototype.toString,{Z_NO_FLUSH:tC,Z_SYNC_FLUSH:tU,Z_FULL_FLUSH:tB,Z_FINISH:tL,Z_OK:tN,Z_STREAM_END:tP,Z_DEFAULT_COMPRESSION:tj,Z_DEFAULT_STRATEGY:tK,Z_DEFLATED:tV}=eq;function tq(e){let t,n;this.options=tD({level:tj,method:tV,chunkSize:16384,windowBits:15,memLevel:8,strategy:tK},e||{});let i=this.options;i.raw&&i.windowBits>0?i.windowBits=-i.windowBits:i.gzip&&i.windowBits>0&&i.windowBits<16&&(i.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new tM,this.strm.avail_out=0;let r=((e,t,n,i,r,o)=>{if(!e)return e5;let a=1;if(t===e3&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),r<1||r>9||n!==ti||i<8||i>15||t<0||t>9||o<0||o>te||8===i&&1!==a)return tr(e,e5);8===i&&(i=9);let s=new tE;return e.state=s,s.strm=e,s.status=42,s.wrap=a,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=r+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<r+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=o,s.method=n,(e=>{var t;let n=(e=>{if(tw(e))return tr(e,e5);e.total_in=e.total_out=0,e.data_type=tn;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?42:113,e.adler=+(2!==t.wrap),t.last_flush=-2,eF(t),e0})(e);return n===e0&&((t=e.state).window_size=2*t.w_size,ta(t.head),t.max_lazy_match=tb[t.level].max_lazy,t.good_match=tb[t.level].good_length,t.nice_match=tb[t.level].nice_length,t.max_chain_length=tb[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n})(e)})(this.strm,i.level,i.method,i.windowBits,i.memLevel,i.strategy);if(r!==tN)throw Error(eV[r]);if(i.header&&(t=this.strm,n=i.header,tw(t)||2!==t.state.wrap||(t.state.gzhead=n)),i.dictionary){let e;if(e="string"==typeof i.dictionary?tx(i.dictionary):"[object ArrayBuffer]"===tO.call(i.dictionary)?new Uint8Array(i.dictionary):i.dictionary,(r=((e,t)=>{let n=t.length;if(tw(e))return e5;let i=e.state,r=i.wrap;if(2===r||1===r&&42!==i.status||i.lookahead)return e5;if(1===r&&(e.adler=eP(e.adler,t,n,0)),i.wrap=0,n>=i.w_size){0===r&&(ta(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(n-i.w_size,n),0),t=e,n=i.w_size}let o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,tg(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do i.ins_h=tc(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++;while(--t);i.strstart=e,i.lookahead=2,tg(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,i.wrap=r,e0})(this.strm,e))!==tN)throw Error(eV[r]);this._dict_set=!0}}function tF(e,t){let n=new tq(t);if(n.push(e,!0),n.err)throw n.msg||eV[n.err];return n.result}tq.prototype.push=function(e,t){let n,i,r=this.strm,o=this.options.chunkSize;if(this.ended)return!1;for(i=t===~~t?t:!0===t?tL:tC,"string"==typeof e?r.input=tx(e):"[object ArrayBuffer]"===tO.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(o),r.next_out=0,r.avail_out=o),(i===tU||i===tB)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if((n=tS(r,i))===tP)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=tz(this.strm),this.onEnd(n),this.ended=!0,n===tN;if(0!==r.avail_out){if(i>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},tq.prototype.onData=function(e){this.chunks.push(e)},tq.prototype.onEnd=function(e){e===tN&&(this.result=tT(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var tH=function(e,t){let n,i,r,o,a,s,c,l,u,h,d,f,p,g,_,m,v,y,b,E,w,S,z,k,D=e.state;n=e.next_in,z=e.input,i=n+(e.avail_in-5),r=e.next_out,k=e.output,o=r-(t-e.avail_out),a=r+(e.avail_out-257),s=D.dmax,c=D.wsize,l=D.whave,u=D.wnext,h=D.window,d=D.hold,f=D.bits,p=D.lencode,g=D.distcode,_=(1<<D.lenbits)-1,m=(1<<D.distbits)-1;e:do for(f<15&&(d+=z[n++]<<f,f+=8,d+=z[n++]<<f,f+=8),v=p[d&_];;){if(d>>>=y=v>>>24,f-=y,0==(y=v>>>16&255))k[r++]=65535&v;else{if(!(16&y)){if(0==(64&y)){v=p[(65535&v)+(d&(1<<y)-1)];continue}if(32&y){D.mode=16191;break e}e.msg="invalid literal/length code",D.mode=16209;break e}for(b=65535&v,(y&=15)&&(f<y&&(d+=z[n++]<<f,f+=8),b+=d&(1<<y)-1,d>>>=y,f-=y),f<15&&(d+=z[n++]<<f,f+=8,d+=z[n++]<<f,f+=8),v=g[d&m];;){if(d>>>=y=v>>>24,f-=y,!(16&(y=v>>>16&255))){if(0==(64&y)){v=g[(65535&v)+(d&(1<<y)-1)];continue}e.msg="invalid distance code",D.mode=16209;break e}if(E=65535&v,f<(y&=15)&&(d+=z[n++]<<f,(f+=8)<y&&(d+=z[n++]<<f,f+=8)),(E+=d&(1<<y)-1)>s){e.msg="invalid distance too far back",D.mode=16209;break e}if(d>>>=y,f-=y,E>(y=r-o)){if((y=E-y)>l&&D.sane){e.msg="invalid distance too far back",D.mode=16209;break e}if(w=0,S=h,0===u){if(w+=c-y,y<b){b-=y;do k[r++]=h[w++];while(--y);w=r-E,S=k}}else if(u<y){if(w+=c+u-y,(y-=u)<b){b-=y;do k[r++]=h[w++];while(--y);if(w=0,u<b){b-=y=u;do k[r++]=h[w++];while(--y);w=r-E,S=k}}}else if(w+=u-y,y<b){b-=y;do k[r++]=h[w++];while(--y);w=r-E,S=k}for(;b>2;)k[r++]=S[w++],k[r++]=S[w++],k[r++]=S[w++],b-=3;b&&(k[r++]=S[w++],b>1&&(k[r++]=S[w++]))}else{w=r-E;do k[r++]=k[w++],k[r++]=k[w++],k[r++]=k[w++],b-=3;while(b>2);b&&(k[r++]=k[w++],b>1&&(k[r++]=k[w++]))}break}}break}while(n<i&&r<a);n-=b=f>>3,f-=b<<3,d&=(1<<f)-1,e.next_in=n,e.next_out=r,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=r<a?a-r+257:257-(r-a),D.hold=d,D.bits=f};let tJ=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),tW=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),tZ=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),tX=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var tY=(e,t,n,i,r,o,a,s)=>{let c=s.bits,l,u,h,d,f,p,g=0,_=0,m=0,v=0,y=0,b=0,E=0,w=0,S=0,z=0,k=null,D=new Uint16Array(16),T=new Uint16Array(16),A,R,x,I=null;for(g=0;g<=15;g++)D[g]=0;for(_=0;_<i;_++)D[t[n+_]]++;for(y=c,v=15;v>=1&&0===D[v];v--);if(y>v&&(y=v),0===v)return r[o++]=0x1400000,r[o++]=0x1400000,s.bits=1,0;for(m=1;m<v&&0===D[m];m++);for(y<m&&(y=m),w=1,g=1;g<=15;g++)if(w<<=1,(w-=D[g])<0)return -1;if(w>0&&(0===e||1!==v))return -1;for(T[1]=0,g=1;g<15;g++)T[g+1]=T[g]+D[g];for(_=0;_<i;_++)0!==t[n+_]&&(a[T[t[n+_]]++]=_);if(0===e?(k=I=a,p=20):1===e?(k=tJ,I=tW,p=257):(k=tZ,I=tX,p=0),z=0,_=0,g=m,f=o,b=y,E=0,h=-1,d=(S=1<<y)-1,1===e&&S>852||2===e&&S>592)return 1;for(;;){A=g-E,a[_]+1<p?(R=0,x=a[_]):a[_]>=p?(R=I[a[_]-p],x=k[a[_]-p]):(R=96,x=0),l=1<<g-E,m=u=1<<b;do r[f+(z>>E)+(u-=l)]=A<<24|R<<16|x;while(0!==u);for(l=1<<g-1;z&l;)l>>=1;if(0!==l?(z&=l-1,z+=l):z=0,_++,0==--D[g]){if(g===v)break;g=t[n+a[_]]}if(g>y&&(z&d)!==h){for(0===E&&(E=y),f+=m,w=1<<(b=g-E);b+E<v&&!((w-=D[b+E])<=0);)b++,w<<=1;if(S+=1<<b,1===e&&S>852||2===e&&S>592)return 1;r[h=z&d]=y<<24|b<<16|f-o}}return 0!==z&&(r[f+z]=g-E<<24|4194304),s.bits=y,0};let{Z_FINISH:t$,Z_BLOCK:tQ,Z_TREES:t1,Z_OK:t0,Z_STREAM_END:t2,Z_NEED_DICT:t5,Z_STREAM_ERROR:t4,Z_DATA_ERROR:t6,Z_MEM_ERROR:t3,Z_BUF_ERROR:t8,Z_DEFLATED:t9}=eq,t7=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function ne(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}let nt=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.mode<16180||t.mode>16211)},nn=e=>{if(nt(e))return t4;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,(e=>{if(nt(e))return t4;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=16180,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,t0})(e)},ni,nr,no=!0,na=e=>{if(no){ni=new Int32Array(512),nr=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(tY(1,e.lens,0,288,ni,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;tY(2,e.lens,0,32,nr,0,e.work,{bits:5}),no=!1}e.lencode=ni,e.lenbits=9,e.distcode=nr,e.distbits=5},ns=(e,t,n,i)=>{let r,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),i>=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):((r=o.wsize-o.wnext)>i&&(r=i),o.window.set(t.subarray(n-i,n-i+r),o.wnext),(i-=r)?(o.window.set(t.subarray(n-i,n),0),o.wnext=i,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=r))),0};var nc=(e,t)=>{let n,i,r,o,a,s,c,l,u,h,d,f,p,g,_,m,v,y,b,E,w,S,z,k,D=0,T=new Uint8Array(4),A=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(nt(e)||!e.output||!e.input&&0!==e.avail_in)return t4;16191===(r=e.state).mode&&(r.mode=16192),c=e.next_out,a=e.output,u=e.avail_out,s=e.next_in,o=e.input,l=e.avail_in,h=r.hold,d=r.bits,f=l,p=u,k=t0;e:for(;;)switch(r.mode){case 16180:if(0===r.wrap){r.mode=16192;break}for(;d<16;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}if(2&r.wrap&&35615===h){0===r.wbits&&(r.wbits=15),r.check=0,T[0]=255&h,T[1]=h>>>8&255,r.check=eK(r.check,T,2,0),h=0,d=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&h)<<8)+(h>>8))%31){e.msg="incorrect header check",r.mode=16209;break}if((15&h)!==t9){e.msg="unknown compression method",r.mode=16209;break}if(h>>>=4,d-=4,z=8+(15&h),0===r.wbits&&(r.wbits=z),z>15||z>r.wbits){e.msg="invalid window size",r.mode=16209;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&h?16189:16191,h=0,d=0;break;case 16181:for(;d<16;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}if(r.flags=h,(255&r.flags)!==t9){e.msg="unknown compression method",r.mode=16209;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=16209;break}r.head&&(r.head.text=h>>8&1),512&r.flags&&4&r.wrap&&(T[0]=255&h,T[1]=h>>>8&255,r.check=eK(r.check,T,2,0)),h=0,d=0,r.mode=16182;case 16182:for(;d<32;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}r.head&&(r.head.time=h),512&r.flags&&4&r.wrap&&(T[0]=255&h,T[1]=h>>>8&255,T[2]=h>>>16&255,T[3]=h>>>24&255,r.check=eK(r.check,T,4,0)),h=0,d=0,r.mode=16183;case 16183:for(;d<16;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}r.head&&(r.head.xflags=255&h,r.head.os=h>>8),512&r.flags&&4&r.wrap&&(T[0]=255&h,T[1]=h>>>8&255,r.check=eK(r.check,T,2,0)),h=0,d=0,r.mode=16184;case 16184:if(1024&r.flags){for(;d<16;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}r.length=h,r.head&&(r.head.extra_len=h),512&r.flags&&4&r.wrap&&(T[0]=255&h,T[1]=h>>>8&255,r.check=eK(r.check,T,2,0)),h=0,d=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&((g=r.length)>l&&(g=l),g&&(r.head&&(z=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(o.subarray(s,s+g),z)),512&r.flags&&4&r.wrap&&(r.check=eK(r.check,o,g,s)),l-=g,s+=g,r.length-=g),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===l)break e;g=0;do z=o[s+g++],r.head&&z&&r.length<65536&&(r.head.name+=String.fromCharCode(z));while(z&&g<l);if(512&r.flags&&4&r.wrap&&(r.check=eK(r.check,o,g,s)),l-=g,s+=g,z)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===l)break e;g=0;do z=o[s+g++],r.head&&z&&r.length<65536&&(r.head.comment+=String.fromCharCode(z));while(z&&g<l);if(512&r.flags&&4&r.wrap&&(r.check=eK(r.check,o,g,s)),l-=g,s+=g,z)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;d<16;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}if(4&r.wrap&&h!==(65535&r.check)){e.msg="header crc mismatch",r.mode=16209;break}h=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=16191;break;case 16189:for(;d<32;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}e.adler=r.check=t7(h),h=0,d=0,r.mode=16190;case 16190:if(0===r.havedict)return e.next_out=c,e.avail_out=u,e.next_in=s,e.avail_in=l,r.hold=h,r.bits=d,t5;e.adler=r.check=1,r.mode=16191;case 16191:if(t===tQ||t===t1)break e;case 16192:if(r.last){h>>>=7&d,d-=7&d,r.mode=16206;break}for(;d<3;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}switch(r.last=1&h,d-=1,3&(h>>>=1)){case 0:r.mode=16193;break;case 1:if(na(r),r.mode=16199,t===t1){h>>>=2,d-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=16209}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}if((65535&h)!=(h>>>16^65535)){e.msg="invalid stored block lengths",r.mode=16209;break}if(r.length=65535&h,h=0,d=0,r.mode=16194,t===t1)break e;case 16194:r.mode=16195;case 16195:if(g=r.length){if(g>l&&(g=l),g>u&&(g=u),0===g)break e;a.set(o.subarray(s,s+g),c),l-=g,s+=g,u-=g,c+=g,r.length-=g;break}r.mode=16191;break;case 16196:for(;d<14;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}if(r.nlen=257+(31&h),d-=5,r.ndist=1+(31&(h>>>=5)),d-=5,r.ncode=4+(15&(h>>>=5)),h>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=16209;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;d<3;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}r.lens[A[r.have++]]=7&h,h>>>=3,d-=3}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,n={bits:r.lenbits},k=tY(0,r.lens,0,19,r.lencode,0,r.work,n),r.lenbits=n.bits,k){e.msg="invalid code lengths set",r.mode=16209;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;v=(D=r.lencode[h&(1<<r.lenbits)-1])>>>24,y=D>>>16&255,b=65535&D,!(v<=d);){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}if(b<16)h>>>=v,d-=v,r.lens[r.have++]=b;else{if(16===b){for(i=v+2;d<i;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}if(h>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=16209;break}z=r.lens[r.have-1],g=3+(3&h),h>>>=2,d-=2}else if(17===b){for(i=v+3;d<i;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}h>>>=v,d-=v,z=0,g=3+(7&h),h>>>=3,d-=3}else{for(i=v+7;d<i;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}h>>>=v,d-=v,z=0,g=11+(127&h),h>>>=7,d-=7}if(r.have+g>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=16209;break}for(;g--;)r.lens[r.have++]=z}}if(16209===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=16209;break}if(r.lenbits=9,n={bits:r.lenbits},k=tY(1,r.lens,0,r.nlen,r.lencode,0,r.work,n),r.lenbits=n.bits,k){e.msg="invalid literal/lengths set",r.mode=16209;break}if(r.distbits=6,r.distcode=r.distdyn,n={bits:r.distbits},k=tY(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,n),r.distbits=n.bits,k){e.msg="invalid distances set",r.mode=16209;break}if(r.mode=16199,t===t1)break e;case 16199:r.mode=16200;case 16200:if(l>=6&&u>=258){e.next_out=c,e.avail_out=u,e.next_in=s,e.avail_in=l,r.hold=h,r.bits=d,tH(e,p),c=e.next_out,a=e.output,u=e.avail_out,s=e.next_in,o=e.input,l=e.avail_in,h=r.hold,d=r.bits,16191===r.mode&&(r.back=-1);break}for(r.back=0;v=(D=r.lencode[h&(1<<r.lenbits)-1])>>>24,y=D>>>16&255,b=65535&D,!(v<=d);){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}if(y&&0==(240&y)){for(E=v,w=y,S=b;v=(D=r.lencode[S+((h&(1<<E+w)-1)>>E)])>>>24,y=D>>>16&255,b=65535&D,!(E+v<=d);){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}h>>>=E,d-=E,r.back+=E}if(h>>>=v,d-=v,r.back+=v,r.length=b,0===y){r.mode=16205;break}if(32&y){r.back=-1,r.mode=16191;break}if(64&y){e.msg="invalid literal/length code",r.mode=16209;break}r.extra=15&y,r.mode=16201;case 16201:if(r.extra){for(i=r.extra;d<i;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}r.length+=h&(1<<r.extra)-1,h>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;v=(D=r.distcode[h&(1<<r.distbits)-1])>>>24,y=D>>>16&255,b=65535&D,!(v<=d);){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}if(0==(240&y)){for(E=v,w=y,S=b;v=(D=r.distcode[S+((h&(1<<E+w)-1)>>E)])>>>24,y=D>>>16&255,b=65535&D,!(E+v<=d);){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}h>>>=E,d-=E,r.back+=E}if(h>>>=v,d-=v,r.back+=v,64&y){e.msg="invalid distance code",r.mode=16209;break}r.offset=b,r.extra=15&y,r.mode=16203;case 16203:if(r.extra){for(i=r.extra;d<i;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}r.offset+=h&(1<<r.extra)-1,h>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=16209;break}r.mode=16204;case 16204:if(0===u)break e;if(g=p-u,r.offset>g){if((g=r.offset-g)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=16209;break}g>r.wnext?(g-=r.wnext,_=r.wsize-g):_=r.wnext-g,g>r.length&&(g=r.length),m=r.window}else m=a,_=c-r.offset,g=r.length;g>u&&(g=u),u-=g,r.length-=g;do a[c++]=m[_++];while(--g);0===r.length&&(r.mode=16200);break;case 16205:if(0===u)break e;a[c++]=r.length,u--,r.mode=16200;break;case 16206:if(r.wrap){for(;d<32;){if(0===l)break e;l--,h|=o[s++]<<d,d+=8}if(p-=u,e.total_out+=p,r.total+=p,4&r.wrap&&p&&(e.adler=r.check=r.flags?eK(r.check,a,p,c-p):eP(r.check,a,p,c-p)),p=u,4&r.wrap&&(r.flags?h:t7(h))!==r.check){e.msg="incorrect data check",r.mode=16209;break}h=0,d=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;d<32;){if(0===l)break e;l--,h+=o[s++]<<d,d+=8}if(4&r.wrap&&h!==(0|r.total)){e.msg="incorrect length check",r.mode=16209;break}h=0,d=0}r.mode=16208;case 16208:k=t2;break e;case 16209:k=t6;break e;case 16210:return t3;default:return t4}return e.next_out=c,e.avail_out=u,e.next_in=s,e.avail_in=l,r.hold=h,r.bits=d,(r.wsize||p!==e.avail_out&&r.mode<16209&&(r.mode<16206||t!==t$))&&ns(e,e.output,e.next_out,p-e.avail_out),f-=e.avail_in,p-=e.avail_out,e.total_in+=f,e.total_out+=p,r.total+=p,4&r.wrap&&p&&(e.adler=r.check=r.flags?eK(r.check,a,p,e.next_out-p):eP(r.check,a,p,e.next_out-p)),e.data_type=r.bits+64*!!r.last+128*(16191===r.mode)+256*(16199===r.mode||16194===r.mode),(0===f&&0===p||t===t$)&&k===t0&&(k=t8),k},nl=e=>{if(nt(e))return t4;let t=e.state;return t.window&&(t.window=null),e.state=null,t0},nu=(e,t)=>{let n,i=t.length;return nt(e)||0!==(n=e.state).wrap&&16190!==n.mode?t4:16190===n.mode&&eP(1,t,i,0)!==n.check?t6:ns(e,t,i,i)?(n.mode=16210,t3):(n.havedict=1,t0)},nh=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};let nd=Object.prototype.toString,{Z_NO_FLUSH:nf,Z_FINISH:np,Z_OK:ng,Z_STREAM_END:n_,Z_NEED_DICT:nm,Z_STREAM_ERROR:nv,Z_DATA_ERROR:ny,Z_MEM_ERROR:nb}=eq;function nE(e){this.options=tD({chunkSize:65536,windowBits:15,to:""},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new tM,this.strm.avail_out=0;let n=((e,t)=>{if(!e)return t4;let n=new ne;e.state=n,n.strm=e,n.window=null,n.mode=16180;let i=((e,t)=>{let n;if(nt(e))return t4;let i=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?t4:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,nn(e))})(e,t);return i!==t0&&(e.state=null),i})(this.strm,t.windowBits);if(n!==ng||(this.header=new nh,((e,t)=>{if(nt(e))return;let n=e.state;return 0==(2&n.wrap)||(n.head=t,t.done=!1)})(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=tx(t.dictionary):"[object ArrayBuffer]"===nd.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=nu(this.strm,t.dictionary))!==ng)))throw Error(eV[n])}function nw(e,t){let n=new nE(t);if(n.push(e),n.err)throw n.msg||eV[n.err];return n.result}nE.prototype.push=function(e,t){let n,i,r,o=this.strm,a=this.options.chunkSize,s=this.options.dictionary;if(this.ended)return!1;for(i=t===~~t?t:!0===t?np:nf,"[object ArrayBuffer]"===nd.call(e)?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;;){for(0===o.avail_out&&(o.output=new Uint8Array(a),o.next_out=0,o.avail_out=a),(n=nc(o,i))===nm&&s&&((n=nu(o,s))===ng?n=nc(o,i):n===ny&&(n=nm));o.avail_in>0&&n===n_&&o.state.wrap>0&&0!==e[o.next_in];)nn(o),n=nc(o,i);switch(n){case nv:case ny:case nm:case nb:return this.onEnd(n),this.ended=!0,!1}if(r=o.avail_out,o.next_out&&(0===o.avail_out||n===n_))if("string"===this.options.to){let e=tG(o.output,o.next_out),t=o.next_out-e,n=tI(o.output,e);o.next_out=t,o.avail_out=a-t,t&&o.output.set(o.output.subarray(e,e+t),0),this.onData(n)}else this.onData(o.output.length===o.next_out?o.output:o.output.subarray(0,o.next_out));if(n!==ng||0!==r){if(n===n_)return n=nl(this.strm),this.onEnd(n),this.ended=!0,!0;if(0===o.avail_in)break}}return!0},nE.prototype.onData=function(e){this.chunks.push(e)},nE.prototype.onEnd=function(e){e===ng&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=tT(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};let{Deflate:nS,deflate:nz,deflateRaw:nk,gzip:nD}={Deflate:tq,deflate:tF,deflateRaw:function(e,t){return(t=t||{}).raw=!0,tF(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,tF(e,t)},constants:eq},{Inflate:nT,inflate:nA,inflateRaw:nR,ungzip:nx}={Inflate:nE,inflate:nw,inflateRaw:function(e,t){return(t=t||{}).raw=!0,nw(e,t)},ungzip:nw,constants:eq};var nI=function(){function e(e,t){this.collector=e,this.config=t,this.requestType=t.request_type,this.supportBeacon=!(!window.navigator||!window.navigator.sendBeacon),this.errorCode={NO_URL:4001,IMG_ON:4e3,IMG_CATCH:4002,BEACON_FALSE:4003,XHR_ON:500,RESPONSE:5001,TIMEOUT:5005},this.customHeader=t.custom_request_header||{}}return e.prototype.useFetch=function(e){var t=e.url,n=e.data,i=e.method,r=e.success,o=e.fail,a={"Content-Type":"application/json; charset=utf-8"};if(Object.keys(this.customHeader).length)for(var s in this.customHeader)a[s]=this.customHeader[s];window.fetch?fetch(t,{method:i||"POST",headers:a,body:JSON.stringify(n)}).then(function(e){return e.json()}).then(function(e){r&&r(e)}).catch(function(e){o&&o(n,e)}):(this.requestType="xhr",console.log("your brwoser not support fetch, use xhr"),this.useRequest({url:t,data:n,method:i,success:r,fail:o}))},e.prototype.useBeacon=function(e){var t=e.url,n=e.data,i=e.success,r=e.fail;"xhr"!==this.requestType?window.navigator.sendBeacon(t,JSON.stringify(n))?i&&i():r&&r(n,this.errorCode.BEACON_FALSE):this.useXhr(e)},e.prototype.useXhr=function(e){var t=this,n=e.url,i=e.data,r=e.method,o=e.success,a=e.fail,s=e.timeout,c=e.withCredentials,l=e.app_key,u=e.zip;try{var h=new XMLHttpRequest;if(h.open(r||"POST",""+n,!0),h.setRequestHeader("Content-Type","application/json; charset=utf-8"),l&&h.setRequestHeader("X-MCS-AppKey",""+l),Object.keys(this.customHeader).length)for(var d in this.customHeader)h.setRequestHeader(d,this.customHeader[d]);c&&(h.withCredentials=!0),s&&(h.timeout=s,h.ontimeout=function(){a&&a(i,t.errorCode.TIMEOUT)}),h.onload=function(){if(o){var e=null;if(h.responseText){try{e=JSON.parse(h.responseText)}catch(t){e={}}o(e,i)}}},h.onerror=function(){h.abort(),a&&a(i,t.errorCode.XHR_ON)};try{var f=JSON.stringify(i),p=this.collector.configManager.getCurrentEnv();if(this.config.need_zip&&u)if("row"===p){var g=(new TextEncoder).encode(f),_=nD(g);h.setRequestHeader("Content-Encoding","gzip"),h.send(_)}else h.send(f),this.collector.logger.warn("your channel do not support gzip, use normal data!");else h.send(f)}catch(e){this.collector.emit("sdk-inner-error",{type:"sdk_error_send",eventData:i,errorCode:1e3,msg:e.message||e.stack||"sdk_error_send"})}}catch(e){this.collector.emit("sdk-inner-error",{type:"sdk_error_request",eventData:i,errorCode:1001,msg:e.message||e.stack||"sdk_error_request"})}},e.prototype.useRequest=function(e){var t=e.useBeacon,n=e.forceXhr;if("xhr"===this.requestType)this.useXhr(e);else{if(t&&this.supportBeacon)return void this.useBeacon(e);if("fetch"===this.requestType&&!n)return void this.useFetch(e);this.useXhr(e)}},e}(),nG=function(){function e(e,t){if(this.devToolReady=!1,this.sendAlready=!1,t.enable_debug&&"Microsoft Internet Explorer"!==e.configManager.get("browser")){this.collect=e,this.config=t,this.app_id=t.app_id;var n=e.adapters.storage;this.cacheStorgae=new n(!1),this.devToolOrigin=window.location.origin,this.currentInstance=t.current_instance||"",this.loadUrl=t.devtool_url||"https://sf16-website-login.neutral.ttwstatic.com/obj/tiktok_web_login_static/log-sdk/collect/devtool/debug-web.v2.0.0.js",this.filterEvent=new Set(["__bav_page","__bav_beat","__bav_page_statistics","__bav_click","__bav_page_exposure","bav2b_page","bav2b_beat","bav2b_page_statistics","bav2b_click","bav2b_page_exposure","_be_active","predefine_pageview","__profile_set","__profile_set_once","__profile_increment","__profile_unset","__profile_append","predefine_page_alive","predefine_page_close","abtest_exposure"]),this.load()}}return e.prototype.loadScript=function(e){try{var t=document.createElement("script");t.src=e,t.onerror=function(){console.log("load DevTool render fail")},t.onload=function(){console.log("load DevTool render success")},document.getElementsByTagName("body")[0].appendChild(t)}catch(e){console.log("devTool load fail, "+e.message)}},e.prototype.parseUrl=function(){var e={};try{var t=window.location.href.split("?")[1].split("&");t.length&&t.forEach(function(t){var n=t.split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])})}catch(e){}return e},e.prototype.load=function(){try{var e=this.parseUrl();if(e.open_devtool_web&&e.app_id){if(parseInt(e.app_id)!==this.app_id||e.current_instance&&e.current_instance!==this.currentInstance)return}else if(!this.getStorage())return;this.loadBaseInfo(),this.loadHook(),this.setStorage(),this.addLintener(),this.loadDebuggerModule(),this.loadDevTool()}catch(e){console.log("debug fail, "+e.message)}},e.prototype.getStorage=function(){var e=this.cacheStorgae.getItem("__applog_open_devtool_web");return e&&parseInt(e)===this.app_id},e.prototype.setStorage=function(){this.cacheStorgae.setItem("__applog_open_devtool_web",this.app_id)},e.prototype.loadDevTool=function(){this.loadScript(this.loadUrl)},e.prototype.loadBaseInfo=function(){if(this.log=[],this.event=[],this.info=[{title:"BaseInfo",key:"base",type:1,content:[{name:"app_id",desc:"APPID",value:this.config.app_id},{name:"channel",desc:"CHANNEL",value:this.config.channel},{name:"domain",desc:"Domain",value:this.collect.configManager.getDomain()},{name:"sdk_version",desc:"SDK Version",value:"5.3.9_oversea"},{name:"sdk_type",desc:"SDK Import Type",value:"npm"}]},{title:"UserInfo",key:"user",type:2,content:[{name:"uuid",desc:"UserUniqueId",value:this.collect.configManager.get("user").user_unique_id||""},{name:"web_id",desc:"WEB_ID",value:this.collect.configManager.get("user").web_id||""}]},{title:"CommonInfo",type:2,key:"common",content:[{name:"browser",desc:"Browser",value:this.collect.configManager.get("browser")},{name:"browser_version",desc:"Browser Version",value:this.collect.configManager.get("browser_version")},{name:"platform",desc:"Platform",value:this.collect.configManager.get("platform")},{name:"device_model",desc:"Devide Model",value:this.collect.configManager.get("device_model")},{name:"os_name",desc:"Os Name",value:this.collect.configManager.get("os_name")},{name:"os_version",desc:"Os Version",value:this.collect.configManager.get("os_version")},{name:"resolution",desc:"Screen Resolution",value:this.collect.configManager.get("resolution")},{name:"referrer",desc:"Referrer",value:this.collect.configManager.get("referrer")},{name:"custom",desc:"Custom Info",value:JSON.stringify(this.collect.configManager.get("custom"))}]},{title:"Config Info",key:"config",type:3,content:[{name:"autotrack",desc:"AutoTrackEvent",value:!!this.config.autotrack},{name:"stay",desc:"StayDuration",value:!!this.config.enable_stay_duration}]},{title:"A/B Config Info",key:"ab",type:4,content:[{name:"ab",desc:"A/BTester",value:!!this.config.enable_ab_test}]}],this.config.enable_ab_test){var e=this.getInfo("ab");e.content=[{name:"ab",desc:"A/BTester",value:!!this.config.enable_ab_test},{name:"vid",desc:"A/B VID",value:this.collect.configManager.getAbVersion()},{name:"ab_domain",desc:"Domain",value:this.config.ab_channel_domain||_(F[this.config.channel])},{name:"all_values",desc:"A/B ALL Values",value:this.collect.configManager.getAbCache()}],this.setInfo("ab",e)}},e.prototype.getInfo=function(e){var t=null;return this.info.forEach(function(n){n.key===e&&(t=n)}),t},e.prototype.setInfo=function(e,t){var n=!1;this.info.forEach(function(i){i.key===e&&(n=!0,i=t)}),n||this.info.push(t)},e.prototype.getSecondInfo=function(e,t){var n=this.getInfo(e),i=null;return n.content.forEach(function(e){e.name===t&&(i=e)}),i},e.prototype.setSecondInfo=function(e,t,n){var i=this.getInfo(e),r=!1;if(i.content.forEach(function(e){e.name===t&&(e.value=n,r=!0)}),!r){var o={name:t,value:n,desc:t.toLocaleUpperCase()};i.content.push(o)}this.setInfo(e,i)},e.prototype.loadHook=function(){var e=this;this.collect.on(D.DEBUGGER_MESSAGE,function(t){switch(t.type){case D.DEBUGGER_MESSAGE_SDK:var n={time:t.time,type:t.logType||"sdk",infoType:t.infoType||"sdk",level:t.level,name:t.info,show:!0,levelShow:!0,needDesc:!!t.data};if(t.data&&(n.desc={content:JSON.stringify(t.data)}),e.updateLog(n),t.secType&&"AB"===t.secType)e.setSecondInfo("ab","vid",e.collect.configManager.getAbVersion()),e.setSecondInfo("ab","all_values",e.collect.configManager.getAbCache());else if("USER"===t.secType)e.setSecondInfo("user","user_unique_id"===t.common?"uuid":t.common,e.collect.configManager.get(t.common));else if("HEADER"===t.secType){var i=e.collect.configManager.get(t.common);e.setSecondInfo("common",t.common,"custom"===t.common?JSON.stringify(i):i)}return void e.updateInfo();case D.DEBUGGER_MESSAGE_EVENT:if(t.data&&t.data.length){var r=t.data[0],o=r.events;if(!o.length)return;o.forEach(function(n){n.checkShow=!0,n.searchShow=!0,n.focusShow=!0,n.status=t.status,n.type=e.filterEvent.has(n.event)?"sdk":"cus",n.verifyType=t.verifyType?"verify":"no",n.info="","fail"===t.status&&(n.info={message:"code: "+t.code+"\uFF0C msg: "+(t.msg||t.failType)})}),e.updateEvent(r)}return}})},e.prototype.addLintener=function(){var e=this;window.addEventListener("message",function(t){if(e.devToolOrigin===t.origin){if(t&&t.data&&"devtool:web:ready"===t.data.type){if(e.devToolOrigin=t.origin,e.devToolReady=!0,e.sendAlready)return;e.sendData("devtool:web:init",{info:e.info,log:e.log,event:e.event,sdk_type:"5.3.9_oversea".includes("tob")?"tob":"inner",appId:e.app_id}),e.sendAlready=!0}t&&t.data&&"devtool:web:ssid"===t.data.type&&e.collect.getToken(function(t){e.setSecondInfo("user","sid",t.tobid),e.updateInfo()})}})},e.prototype.sendData=function(e,t){try{window&&window.postMessage({type:e,payload:t},this.devToolOrigin)}catch(e){}},e.prototype.updateInfo=function(){this.devToolReady&&this.sendData("devtool:web:info",this.info)},e.prototype.updateLog=function(e){this.devToolReady?this.sendData("devtool:web:log",e):this.log.push(e)},e.prototype.updateEvent=function(e){this.devToolReady?this.sendData("devtool:web:event",e):this.event.push(e)},e.prototype.loadDebuggerModule=function(){var e="#debugger-applog-web {\n position: fixed;\n width: 45px;\n height: 45px;\n background-image: url("+_("1fz22z22z1nz21z4mz4bz4bz21z1dz4dz4iz49z25z1cz19z21z1gz22z1cz49z1jz1mz1ez1gz1lz4az1lz1cz23z22z20z18z1jz4az22z22z25z21z22z18z22z1gz1az4az1az1mz1kz4bz1mz19z1hz4bz22z1gz1iz22z1mz1iz16z25z1cz19z16z1jz1mz1ez1gz1lz16z21z22z18z22z1gz1az4bz1jz1mz1ez49z21z1bz1iz4bz1az1mz1jz1jz1cz1az22z4bz1bz1cz24z22z1mz1mz1jz4bz18z1nz1nz1jz1mz1ez4az1nz1lz1e")+");\n bottom: 5%;\n right: 10%;\n cursor: pointer;\n z-index:100;\n background-size: 45px;\n }",t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.appendChild(document.createTextNode(e)),t.appendChild(n);var i=document.createElement("div");i.innerHTML='<div id="debugger-applog-web" class="debugger-applog-web"></div>';var r=document.createElement("div");r.innerHTML='<div id="debugger-container" class="debugger-container"></div>',document.getElementsByTagName("body")[0].appendChild(i),document.getElementsByTagName("body")[0].appendChild(r);var o=document.getElementById("debugger-applog-web");o&&o.addEventListener("click",function(){window&&window.postMessage({type:"devtool:web:open-draw"},location.origin)})},e}(),nM={autotrack:{src:{sg:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-sg/log-sdk/collect/5/plugin/autotrack.js",va:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-us/log-sdk/collect/5/plugin/autotrack.js"},object:"LogAutoTrack"},ab:{src:{sg:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-sg/log-sdk/collect/5/plugin/ab.js",va:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-us/log-sdk/collect/5/plugin/ab.js"},object:"LogAb"},stay:{src:{sg:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-sg/log-sdk/collect/5/plugin/stay.js",va:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-us/log-sdk/collect/5/plugin/stay.js"},object:"LogStay"},route:{src:{sg:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-sg/log-sdk/collect/5/plugin/route.js",va:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-us/log-sdk/collect/5/plugin/route.js"},object:"LogRoute"},tracer:{src:{sg:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-sg/log-sdk/collect/5/plugin/tracer.js",va:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-us/log-sdk/collect/5/plugin/tracer.js"},object:"LogTracer"},retry:{src:{sg:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-sg/log-sdk/collect/5/plugin/retry.js",va:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-us/log-sdk/collect/5/plugin/retry.js"},object:"LogRetry"},visual:{src:{sg:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-sg/log-sdk/collect/5/plugin/visual.js",va:"https://lf-global-static.iapplogcdn.com/obj/applog-sdk-static-us/log-sdk/collect/5/plugin/visual.js"},object:"LogVisual"}},nO=["ab","autotrack","Stay","store","et","profile","cep","heartbeat","monitor","route","tracer"],nC=function(){function e(e){this.disableAutoPageView=!1,this.bridgeReport=!1,this.staging=!1,this.pluginInstances=[],this.sended=!1,this.started=!1,this.destroy=!1,this.sdkReady=!1,this.adapters={},this.loadType="base",this.sdkStop=!1,this.name=e,this.hook=new d,this.remotePlugin=new Map,this.Types=Z,this.adapters.storage=P,this.loadType="full"}return e.usePlugin=function(t,n,i){if(n){for(var r=!1,o=0,a=e.plugins.length;o<a;o++)if(e.plugins[o].name===n){e.plugins[o].plugin=t,e.plugins[o].options=i||{},r=!0;break}r||e.plugins.push({name:n,plugin:t,options:i})}else e.plugins.push({plugin:t})},e.prototype.usePlugin=function(e,t,n){e&&("full"===this.loadType&&nO.includes(e)?console.info("your sdk version has "+e+" already ~"):t?"string"==typeof t?this.remotePlugin.get(e)||this.remotePlugin.set(e,{src:t,call:n}):this.remotePlugin.get(e)||this.remotePlugin.set(e,{instance:t}):this.remotePlugin.get(e)||this.remotePlugin.set(e,"sdk"))},e.prototype.init=function(t){var n,i,r=this;try{n=JSON.parse(JSON.stringify(t))}catch(e){n=t}if(this.logger=new et(this.name,n.log),this.inited)this.logger.warn("[instance: "+this.name+"], every instance's api: init, can be call only one time!");else if(n&&f(n))if(n.app_id&&"number"==typeof(i=n.app_id)&&!isNaN(i))if(n.app_key&&"string"!=typeof n.app_key)this.logger.warn("app_key param is error, must be string, please check!");else{if(!n.channel_domain){if("eu_ttp_ie"===n.report_channel||"ie"===n.channel)return void this.logger.error("ie dc will be deprecated in the future, please use other dc instead");n.report_channel&&!K().has(n.report_channel)?(this.logger.warn("your report_channel: "+n.channel+" is not exist. report_channel must be one of "+V().join(",")+", use default report_channel: us_east instead, please check!!!"),n.report_channel="us_east"):n.report_channel||-1!==["sg","va","in","my","ie","ie2"].indexOf(n.channel)||(this.logger.warn("your channel: "+n.channel+" is not exist. use report_channel instead and report_channel must be one of "+V().join(",")+", use default report_channel: us_east instead, please check!!!"),n.report_channel="us_east"),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK set channel warning",level:"error",time:Date.now(),data:"your report_channel: "+n.channel+" is not exist. report_channel must be one of "+V().join(",")+", use us_east instead, please check!!!",infoType:"sdk"})}if(this.spider=new en,this.spider.checkSpider(n))return this.logger.warn("The current environment may be a spider, can not report!"),void this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK hit spider",level:"error",time:Date.now(),data:"The current environment may be a spider, can not report!",infoType:"sdk"});this.appBridge=new ei(this,n.enable_native),this.requestManager=new nI(this,n),this.bridgeReport=this.appBridge.bridgeInject(),this.configManager=new ee(this,n),this.debugger=new nG(this,n),this.initConfig=n,this.emit(Z.Init),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute Init",data:n,level:"info",time:Date.now(),infoType:"cus"}),n.disable_auto_pv&&(this.disableAutoPageView=!0),this.bridgeReport||(this.configManager.setAppid(n.app_id),this.eventManager=new eo,this.tokenManager=new es,this.sessionManager=new el,Promise.all([new Promise(function(e){r.once(Z.TokenComplete,function(){e(!0)})}),new Promise(function(e){r.once(Z.Start,function(){e(!0)})}),new Promise(function(e){r.once(Z.LogSettingReady,function(){e(!0)})})]).then(function(){try{e.plugins.reduce(function(e,t){var n=t.plugin,i=t.options,o=Object.assign(r.initConfig,i);r.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Load "+t.name+" Plugin",level:"info",time:Date.now(),infoType:"sdk"});var a=new n;return a.apply(r,o),e.push(a),e},r.pluginInstances)}catch(e){console.warn("load plugin error, "+e.message),r.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Load Plugin Error",level:"error",time:Date.now(),data:e.message,infoType:"sdk"})}r.sdkReady=!0,r.emit(Z.Ready),r.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK UserInfo Init Completed",time:Date.now(),secType:"USER",level:"info",data:r.configManager.get("user"),infoType:"sdk"}),r.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Initialization Completed",time:Date.now(),level:"info",data:r.configManager.get("user"),infoType:"sdk"}),r.logger.info("appid: "+n.app_id+", userInfo:"+JSON.stringify(r.configManager.get("user"))),r.logger.info("appid: "+n.app_id+", sdk is ready, version is 5.3.9_oversea, you can report now !!!"),n.disable_auto_pv&&(r.disableAutoPageView=!0);try{("full"===r.loadType&&n.enable_ab_test||n.autotrack)&&(window.opener||window.parent).postMessage("[tea-sdk]ready","*")}catch(e){r.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"Something Error",level:"error",time:Date.now(),data:e.message,infoType:"sdk"})}r.pageView(),r.on(Z.TokenChange,function(e){"webid"===e&&r.pageView(),r.logger.info("appid: "+n.app_id+" token change, new userInfo:"+JSON.stringify(r.configManager.get("user"))),r.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Set UserInfo",time:Date.now(),secType:"USER",level:"info",data:r.configManager.get("user"),infoType:"sdk"})}),r.on(Z.TokenReset,function(){r.logger.info("appid: "+n.app_id+" token reset, new userInfo:"+JSON.stringify(r.configManager.get("user"))),r.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Reset UserInfo",time:Date.now(),secType:"USER",level:"info",data:r.configManager.get("user"),infoType:"sdk"})}),r.on(Z.RouteChange,function(e){e.init||n.disable_route_report||r.pageView()})}),this.tokenManager.apply(this,n),this.eventManager.apply(this,n),this.sessionManager.apply(this,n)),this.inited=!0}else this.logger.warn("app_id param is error, must be number, please check!");else this.logger.warn("init params error,please check")},e.prototype.config=function(e){if(!this.inited)return console.warn("config must be use after function init"),void this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Config Error",level:"error",time:Date.now(),data:"config must be use after function init",infoType:"sdk"});if(!e||!f(e))return console.warn("config params is error, please check"),void this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Config Error",level:"error",time:Date.now(),data:"config params is error, please check",infoType:"sdk"});try{t=JSON.parse(JSON.stringify(t))}catch(n){t=e}if(this.bridgeReport)this.appBridge.setConfig(t);else{t._staging_flag&&1===t._staging_flag&&(this.staging=!0),t.disable_auto_pv&&(this.disableAutoPageView=!0,delete t.disable_auto_pv);var t,n=s({},t);if(this.initConfig&&this.initConfig.configPersist){var i=this.configManager.getStore();i&&(n=Object.assign(i,t)),this.configManager.setStore(t)}n.web_id,n.user_unique_id,n.device_id;var r=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)0>t.indexOf(i[r])&&(n[i[r]]=e[i[r]])}return n}(n,["web_id","user_unique_id","device_id"]);n.hasOwnProperty("web_id")&&this.emit(Z.ConfigWebId,n.web_id),n.hasOwnProperty("user_unique_id")&&this.emit(Z.ConfigUuid,n.user_unique_id),n.hasOwnProperty("device_id")&&this.emit(Z.ConfigDiD,n.device_id),this.configManager.set(r),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute Config",level:"info",time:Date.now(),data:n,infoType:"cus"})}},e.prototype.setDomain=function(e){this.configManager&&this.configManager.setDomain(e),this.emit(Z.ConfigDomain)},e.prototype.getConfig=function(e){return this.configManager.get(e)},e.prototype.send=function(){this.start()},e.prototype.start=function(){this.inited&&!this.sended&&(this.sended=!0,this.emit(Z.Start),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute Start",level:"info",time:Date.now(),infoType:"cus"}),this.bridgeReport&&(this.pageView(),this.emit(Z.Ready)))},e.prototype.event=function(e,t){var n=this;try{var i=[];if(Array.isArray(e))e.forEach(function(e){var t=n.processEvent(e[0],e[1]||{});t&&i.push(t)});else{var r=this.processEvent(e,t);if(!r)return;i.push(r)}this.bridgeReport?i.forEach(function(e){var t=e.event,i=e.params;n.appBridge.onEventV3(t,JSON.stringify(i))}):i.length&&(this.emit(Z.Event,i),this.emit(Z.SessionResetTime)),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute Event",level:"info",time:Date.now(),data:e,infoType:"cus"})}catch(e){this.logger.warn("something error, please check"),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute Event Something Error",level:"error",time:Date.now(),data:e.message,infoType:"sdk"})}},e.prototype.beconEvent=function(e,t){if(Array.isArray(e))return this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK BeconEvent Error",level:"error",time:Date.now(),data:"beconEvent not support batch report, please check",infoType:"sdk"}),void this.logger.warn("beconEvent not support batch report, please check");var n=[],i=this.processEvent(e,t||{});i&&(n.push(i),n.length&&(this.emit(Z.BeconEvent,n),this.emit(Z.SessionResetTime)),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute Beacon Event",level:"info",time:Date.now(),data:e,infoType:"sdk"}))},e.prototype.beaconEvent=function(e,t){this.beconEvent(e,t)},e.prototype.processEvent=function(e,t){void 0===t&&(t={});try{if(!e)return console.warn("eventName is null\uFF0C please check"),null;var n=e;/^event\./.test(e)&&(n=e.slice(6));var i=t;"object"!=typeof i&&(i={}),i.profile?delete i.profile:i.event_index=g();var r=void 0;return i.local_ms?(r=i.local_ms,delete i.local_ms):r=+new Date,{event:n,params:i,local_time_ms:r,is_bav:this.initConfig&&this.initConfig.autotrack?1:0}}catch(n){return this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Something Error",level:"error",time:Date.now(),data:n.message,infoType:"sdk"}),{event:e,params:t}}},e.prototype.filterEvent=function(e){this.eventFilter=e},e.prototype.on=function(e,t){this.hook.on(e,t)},e.prototype.once=function(e,t){this.hook.once(e,t)},e.prototype.off=function(e,t){this.hook.off(e,t)},e.prototype.emit=function(e,t,n){this.hook.emit(e,t,n)},e.prototype.set=function(e){this.hook.set(e)},e.prototype.stop=function(){this.sdkStop=!0},e.prototype.reStart=function(){this.sdkStop=!1},e.prototype.pageView=function(){this.disableAutoPageView||this.predefinePageView()},e.prototype.predefinePageView=function(e){if(void 0===e&&(e={}),this.inited){var t={title:document.title||location.pathname,url:location.href,url_path:location.pathname,time:Date.now(),referrer:window.document.referrer,$is_first_time:""+(this.configManager&&this.configManager.is_first_time||!1)},n=s(s({},t),e);this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Report PV",level:"info",time:Date.now(),infoType:"sdk"}),this.event("predefine_pageview",n)}else console.warn("predefinePageView should call after init")},e.prototype.clearEventCache=function(){this.emit(Z.CleanEvents)},e.prototype.setWebId=function(e){this.config({web_id:""+e})},e.prototype.setNativeAppId=function(e){this.bridgeReport&&this.appBridge.setNativeAppId(e)},e.prototype.getSessionId=function(){return ec()},e.prototype.setSessionId=function(e){this.emit(Z.SessionReset,e)},e.prototype.resetStayDuration=function(e,t,n){this.emit(Z.ResetStay,{url_path:e,title:t,url:n},Z.Stay)},e.prototype.resetStayParams=function(e,t,n){void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),this.emit(Z.SetStay,{url_path:e,title:t,url:n},Z.Stay)},e.prototype.getToken=function(e,t){var n=this;if(this.inited){var i=!1,r=function(t){if(!i){i=!0;var r=n.configManager.get().user;return t&&(r.tobid=t,r["diss".split("").reverse().join("")]=t),e(s({},r))}},o=function(){n.tokenManager.getTobId().then(function(e){r(e)})};this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute GetToken",level:"info",time:Date.now(),infoType:"cus"}),this.sdkReady?o():(t&&setTimeout(function(){r()},t),this.on(Z.Ready,function(){o()}))}else console.warn("predefinePageView should call after init")},e.prototype.startTrackEvent=function(e){e&&this.emit(Z.TrackEventDurationStart,e,Z.TrackEventDuration)},e.prototype.endTrackEvent=function(e,t){void 0===t&&(t={}),e&&this.emit(Z.TrackEventDurationEnd,{eventName:e,params:t},Z.TrackEventDuration)},e.prototype.pauseTrackEvent=function(e){e&&this.emit(Z.TrackEventDurationPause,e,Z.TrackEventDuration)},e.prototype.resumeTrackEvent=function(e){e&&this.emit(Z.TrackEventDurationResume,e,Z.TrackEventDuration)},e.prototype.profileSet=function(e){this.bridgeReport?this.appBridge.profileSet(JSON.stringify(e)):this.emit(Z.ProfileSet,e,Z.Profile),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute profileSet",level:"info",time:Date.now(),data:e})},e.prototype.profileSetOnce=function(e){this.bridgeReport?this.appBridge.profileSetOnce(JSON.stringify(e)):this.emit(Z.ProfileSetOnce,e,Z.Profile),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute profileSetOnce",level:"info",time:Date.now(),data:e})},e.prototype.profileIncrement=function(e){this.bridgeReport?this.appBridge.profileIncrement(JSON.stringify(e)):this.emit(Z.ProfileIncrement,e,Z.Profile),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute profileIncrement",level:"info",time:Date.now(),data:e})},e.prototype.profileUnset=function(e){this.bridgeReport?this.appBridge.profileUnset(e):this.emit(Z.ProfileUnset,e,Z.Profile),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute profileUnset",level:"info",time:Date.now(),data:e})},e.prototype.profileAppend=function(e){this.bridgeReport?this.appBridge.profileAppend(JSON.stringify(e)):this.emit(Z.ProfileAppend,e,Z.Profile),this.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute profileAppend",level:"info",time:Date.now(),data:e})},e.prototype.setExternalAbVersion=function(e){this.emit(Z.AbExternalVersion,"string"==typeof e&&e?(""+e).trim():null,Z.Ab)},e.prototype.getVar=function(e,t,n,i){this.emit(Z.AbVar,{name:e,defaultValue:t,callback:n,uuid:i},Z.Ab)},e.prototype.getABconfig=function(e,t){this.emit(Z.AbConfig,{params:e,callback:t},Z.Ab)},e.prototype.getABConfig=function(e,t){this.emit(Z.AbConfig,{params:e,callback:t},Z.Ab)},e.prototype.getAbSdkVersion=function(){return this.configManager.getAbVersion()},e.prototype.onAbSdkVersionChange=function(e){var t=this;return this.emit(Z.AbVersionChangeOn,e,Z.Ab),function(){t.emit(Z.AbVersionChangeOff,e,Z.Ab)}},e.prototype.offAbSdkVersionChange=function(e){this.emit(Z.AbVersionChangeOff,e,Z.Ab)},e.prototype.openOverlayer=function(){this.emit(Z.AbOpenLayer,"",Z.Ab)},e.prototype.closeOverlayer=function(){this.emit(Z.AbCloseLayer,"",Z.Ab)},e.prototype.getAllVars=function(e,t){this.emit(Z.AbAllVars,{callback:e,timeout:t},Z.Ab)},e.prototype.destoryInstace=function(){this.destroy||(this.destroy=!0,this.off(Z.TokenComplete),this.emit(Z.DestoryInstance))},e.prototype.destroyInstance=function(){this.destroy||(this.destroy=!0,this.off(Z.TokenComplete),this.emit(Z.DestoryInstance))},e.plugins=[],e}(),nU={},nB=[];function nL(e,t,n,i){var r=e&&e.source||window.opener||window.parent,o=e&&e.origin||i||window.location.origin;r.postMessage(JSON.stringify({type:t,payload:n}),o)}function nN(e){if(nB.some(function(e){return"*"===e})||nB.some(function(t){return e.origin.indexOf(t)>-1})){var t=e.data;if("string"==typeof e.data)try{t=JSON.parse(e.data)}catch(e){t=void 0}if(t){var n=t.type,i=t.payload;nU[n]&&nU[n].forEach(function(t){"function"==typeof t&&t(e,i)})}}}var nP,nj,nK,nV="__rangers_ab_style__";(n0=nK||(nK={}))[n0.Var=0]="Var",n0[n0.All=1]="All";var nq=function(){function e(){this.fetchStatus="no",this.refreshFetchStatus="no",this.versions=[],this.extVersions=[],this.mulilinkVersions=[],this.enable_multilink=!1,this.enable_ab_visual=!1,this.editMode=!1,this.callbacks=[],this.data={},this.changeListener=new Map,this.readyStatus=!1,this.exposureCache=[],this.fetchQueueMap=new Map}return e.prototype.apply=function(e,t){var n=this;if(this.collect=e,this.config=t,this.config.enable_ab_test){var i=t.enable_multilink,r=t.ab_channel_domain,o=t.enable_ab_visual,a=t.ab_cross,s=t.ab_cookie_domain,c=t.ab_timeout,l=t.disable_auto_ab,u=F[t.channel||"sg"]||F.sg,h=r||_(u),d=e.adapters.storage;this.cacheStorgae=new d(!1),this.timeout=c||3e3,this.enable_multilink=i,this.enable_ab_visual=o,this.abKey="__tea_sdk_ab_version_"+t.app_id,this.ab_cross=a,this.ab_cookie_domain=s||"",this.fetchUrl=h+"/service/2/abtest_config/",this.reportUrl=this.collect.configManager.getUrl("event"),this.exposureLimit=t.exposure_limit||20,this.ab_batch_time=t.ab_batch_time||500,this.ab_user_mode=t.ab_user_mode||"user_unique_id",this.callbackMap=new Map,this.fetchQueueMap=new Map;var f=this.collect.Types;this.types=f,this.collect.on(f.TokenChange,function(e){"uuid"===e&&n.readyStatus&&(n.clearCache(),n.fetchAB())}),this.collect.on(f.AbVar,function(e){var t=e.name,i=e.defaultValue,r=e.callback;n.getVar(t,i,r)}),this.collect.on(f.AbAllVars,function(e){var t=e.callback,i=e.timeout;n.getAllVars(t,i)}),this.collect.on(f.AbConfig,function(e){var t=e.params,i=e.callback;n.getABconfig(t,i)}),this.collect.on(f.AbExternalVersion,function(e){n.setExternalAbVersion(e)}),this.collect.on(f.AbOpenLayer,function(){n.openOverlayer()}),this.collect.on(f.AbCloseLayer,function(){n.closeOverlayer()}),this.collect.on(f.AbVersionChangeOn,function(e){n.changeListener.set(e,e)}),this.collect.on(f.AbVersionChangeOff,function(e){n.changeListener.get(e)&&n.changeListener.delete(e)}),this.loadMode(),(this.enable_ab_visual||this.enable_multilink)&&this.openOverlayer(this.config.multilink_timeout_ms||500),this.checkLocal(),this.ready("ab"),this.readyStatus||(l||this.fetchAB(),this.readyStatus=!0),this.collect.emit(f.AbReady)}},e.prototype.ready=function(e){var t=this;if(this.collect.set(e),this.collect.hook._hooksCache.hasOwnProperty(e)){var n=this.collect.hook._hooksCache[e];if(!Object.keys(n).length)return;var i=function(e){n[e].length&&n[e].forEach(function(n){t.collect.hook.emit(e,n)})};for(var r in n)i(r)}},e.prototype.loadMode=function(){var e=function(){try{return JSON.parse(atob(window.name))||void 0}catch(e){return}}(),t="";if(e){var n=e.scenario,i=e.href;n?(this.editMode=!0,t=n):i&&(-1!==i.indexOf("datatester")||-1!==i.indexOf("visual-editor"))&&(this.editMode=!0,t="visual-editor")}this.enable_ab_visual&&"visual-editor"===t&&this.collect.destoryInstace()},e.prototype.checkLocal=function(){var e=this.getABCache(),t=e.ab_version,n=e.ab_ext_version,i=e.ab_version_multilink,r=(e.data,this.checkFromUrl());r?this.mulilinkVersions.push(r):this.mulilinkVersions=i||[],this.extVersions=n||[],this.versions=t||[];var o=this.versions.concat(this.extVersions);this.enable_multilink&&(o=o.concat(this.mulilinkVersions))},e.prototype.checkFromUrl=function(){var e=E(window.location.href);return e&&e.vid?e.vid:""},e.prototype.updateVersions=function(){var e=this.extVersions.length?this.versions.concat(this.extVersions):this.versions;this.enable_multilink&&(e=e.concat(this.mulilinkVersions)),this.configVersions(e.join(",")),this.updateABCache(),this.changeListener.size>0&&this.changeListener.forEach(function(t){"function"==typeof t&&t(e)})},e.prototype.configVersions=function(e){this.collect.configManager.setAbVersion(e)},e.prototype.getVar=function(e,t,n,i){if(!e)throw Error("getVar key must not be empty");if(void 0===t&&console.warn("getVar defaultValue is illegal, please check!"),"function"!=typeof n)throw Error("getVar callback must be a function");var r={name:e,defaultValue:t,callback:n,type:nK.Var};this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"SDK Execute GetVar",level:"info",time:Date.now(),data:e,infoType:"cus"}),"complete"===this.fetchStatus&&"complete"===this.refreshFetchStatus?this.getRealVar(r,e,i):this.callbackMap.set(e,r)},e.prototype.setAbUuid=function(e,t){this.collect.configManager.setAbUuidCache(e,t)},e.prototype.getRealVar=function(e,t,n){var i=e.name,r=e.defaultValue,o=e.callback,a=this.data;if(a){var s=a[i];if(s&&f(s)){var c=s.vid;return"$ab_url"===t?this.mulilinkVersions.includes(c)||this.mulilinkVersions.push(c):this.versions.includes(c)||this.versions.push(c),this.setAbUuid(c,n),this.updateVersions(),this.fechEvent(c,t||i,r,o,s.val),void this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"SDK Execute GetVar, Exposure Experiment "+i,level:"info",time:Date.now(),data:a[i],infoType:"sdk"})}this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"SDK Execute GerVar Default Callback",level:"info",time:Date.now(),data:this.data,infoType:"sdk"}),o(r)}else o(r)},e.prototype.getAllVars=function(e,t){var n=this;if("function"!=typeof e)throw Error("getAllVars callback must be a function");var i=null,r={callback:e,type:nK.All,timer:i};this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"SDK Execute GetAllVars",level:"info",time:Date.now(),infoType:"cus"}),t&&(i=setTimeout(function(){r.timer=null,n.getRealAllVars(r),clearTimeout(i)},t),r.timer=i),"complete"===this.fetchStatus&&"complete"===this.refreshFetchStatus?(r.timer=null,this.getRealAllVars(r),i&&clearTimeout(i)):this.callbackMap.set("allVars",r)},e.prototype.getRealAllVars=function(e,t){var n=e.callback,i=e.timer;i&&(clearTimeout(i),e.timer=null);var r=(null!=t?t:this.data)||{};try{n(JSON.parse(JSON.stringify(r)))}catch(e){n(r)}this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"SDK Execute GetAllVars Callback",level:"info",time:Date.now(),data:this.data,infoType:"sdk"})},e.prototype.fechEvent=function(e,t,n,i,r){try{if(this.config.disable_track_event||!e)return;var o=this.collect.configManager.get(),a=o.header,s=o.user,c=this.getABCache(),l=s[this.ab_user_mode]||s.user_unique_id;if(c&&c.uuid&&c.uuid!==l)return;var u={event:"abtest_exposure",ab_sdk_version:""+e,params:JSON.stringify({app_id:this.config.appId,ab_url:"$ab_url"===t?n:window.location.href,data:this.data}),local_time_ms:Date.now()};a.custom=JSON.stringify(a.custom),this.reportExposure({events:[u],user:s,header:a},t),i&&i(r)}catch(e){this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Something Error",level:"error",time:Date.now(),data:e.message,infoType:"sdk"})}},e.prototype.reportExposure=function(e,t){var n=this;this.exposureCache.push(e),this.reportTimeout&&clearTimeout(this.reportTimeout),this.exposureCache.length>=this.exposureLimit?this.report(t):this.reportTimeout=setTimeout(function(){n.report(t),clearTimeout(n.reportTimeout)},this.ab_batch_time)},e.prototype.report=function(e){var t=this;this.collect.requestManager.useRequest({url:this.reportUrl,data:this.exposureCache,timeout:2e4,useBeacon:"$ab_url"===e,zip:!0}),this.exposureCache.forEach(function(e){t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_EVENT,info:"SDK Report Exposure Event Success",time:Date.now(),data:[e],code:200,status:"success",infoType:"sdk"})}),this.collect.emit(this.types.AbVerify,[this.exposureCache]),this.exposureCache=[]},e.prototype.setExternalAbVersion=function(e){this.extVersions=[e],this.updateVersions()},e.prototype.getABconfig=function(e,t){var n=Object.keys(e);n&&n.length&&this.collect.configManager.set(e),this.fetchAB(t)},e.prototype.get=function(e){return this.cacheStorgae.getItem(e)},e.prototype.set=function(e,t){this.cacheStorgae.setItem(e,t),this.collect.configManager.setAbCache(t)},e.prototype.getABCache=function(e){var t={ab_version:[],ab_ext_version:[],ab_version_multilink:[],data:null,timestamp:+new Date,uuid:""};return t=this.get(this.abKey)||t,e?t[e]:t},e.prototype.updateABCache=function(){var e=this.getABCache();e.ab_version_multilink=this.mulilinkVersions,e.ab_ext_version=this.extVersions,e.ab_version=this.versions,e.timestamp=Date.now(),this.set(this.abKey,e)},e.prototype.setAbCache=function(e){var t=this.getABCache();t.data=this.data,t.uuid=e,t.timestamp=Date.now(),this.set(this.abKey,t)},e.prototype.clearCache=function(){this.refreshFetchStatus="ing",this.data={},this.extVersions=[],this.mulilinkVersions=[],this.versions=[],this.collect.configManager.clearAbCache()},e.prototype.openOverlayer=function(e){var t=this;if(function(){if(!document.getElementById(nV)){var e="body { opacity: 0 !important; }",t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id=nV,n.type="text/css",n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e)),t.appendChild(n)}}(),e)var n=setTimeout(function(){t.closeOverlayer(),clearTimeout(n)},e)},e.prototype.closeOverlayer=function(){var e;(e=document.getElementById(nV))&&e.parentElement.removeChild(e)},e.prototype.fetchComplete=function(e,t){var n=this;this.changeFetchQueueStatus(t);try{if(e&&"[object Object]"==Object.prototype.toString.call(e)){var i=this.collect.configManager.get().user;if(t&&t!==i.user_unique_id)return;this.data=e,this.setAbCache(t);var r=[];Object.keys(e).forEach(function(t){var n=e[t].vid;n&&r.push(n)}),this.versions=this.versions.filter(function(e){return r.includes(e)});var o=e.$ab_url,a=e.$ab_modification;if(a&&a.val&&this.enable_ab_visual){if(this.collect.destroy)return}else if(o&&this.enable_multilink){this.mulilinkVersions=this.mulilinkVersions.filter(function(e){return r.includes(e)});var s=o.val,c=o.vid;s&&c&&this.getVar("$ab_url",s,function(){n.editMode||(s!==window.location.href?setTimeout(function(){if(!n.collect.destroy){var e=""+s;e=-1===e.indexOf("http")?"https://"+e:e,b(e).host!==location.host?e=e+"&vid="+c:window.history.replaceState("","",e),window.location.href=e}},100):n.closeOverlayer())})}this.updateVersions()}else this.closeOverlayer();this.callbackMap.forEach(function(t){t.type===nK.Var?n.getRealVar(t,""):n.getRealAllVars(t,e)})}catch(e){}},e.prototype.pushFetchToQueue=function(e){var t=this.fetchQueueMap.get(e);t?t.fetchStatus="ing":t={current_user_id:e,fetchStatus:"ing"},this.fetchQueueMap.set(e,t)},e.prototype.changeFetchQueueStatus=function(e){var t=this.fetchQueueMap.get(e);t&&(t.fetchStatus="complete",this.fetchQueueMap.set(e,t))},e.prototype.checkFetchQueueStatus=function(){if(0===this.fetchQueueMap.size)return!1;var e=!0;return this.fetchQueueMap.forEach(function(t){"complete"!==t.fetchStatus&&(e=!1)}),e},e.prototype.clearFetchQueue=function(e){this.fetchQueueMap.delete(e)},e.prototype.fetchAB=function(e){var t=this,n=this.collect.configManager.get(),i={header:s(s(s({aid:this.config.app_id},n.user||{}),n.header||{}),{ab_sdk_version:this.collect.configManager.getAbVersion(),ab_url:window.location.href})};this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Fetch AB Request",level:"info",logType:"fetch",time:Date.now(),data:i,infoType:"sdk"});var r=n.user[this.ab_user_mode]||n.user.user_unique_id;this.pushFetchToQueue(r),this.collect.requestManager.useRequest({url:this.fetchUrl,data:i,success:function(n){t.fetchStatus="complete",t.refreshFetchStatus="complete";var i=n.data;"success"===n.message?(t.fetchComplete(i,r),e&&e(i)):(t.fetchComplete(null,r),e&&e(null)),t.collect.emit(t.types.AbComplete,i),t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"SDK Fetch AB Request Success",level:"info",logType:"fetch",time:Date.now(),data:i,infoType:"sdk"})},fail:function(){t.fetchStatus="complete",t.refreshFetchStatus="complete",t.fetchComplete(null,r),t.collect.emit(t.types.AbTimeout),e&&e(null),t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"SDK Fetch AB Request Network Error",level:"error",logType:"fetch",time:Date.now(),infoType:"sdk"})},timeout:this.timeout})},e.prototype.filterUrl=function(e){try{var t="";-1!==e.indexOf("&multilink=true")?t="&multilink=true[\0-\xff]*":-1!==e.indexOf("?multilink=true")&&(t="\\?multilink=true[\0-\xff]*");var n=RegExp(t,"g");e=e.replace(n,"")}catch(e){}return e},e}(),nF=function(){function e(){}return e.prototype.apply=function(e,t){var n=this;if(this.collect=e,this.config=t,t.event_verify_url)if("string"==typeof t.event_verify_url){if(this.url=t.event_verify_url+"/v1/list_test",this.url){var i=e.Types;e.on(i.SubmitVerify,function(e){n.verify(e)}),e.on(i.AbVerify,function(e){n.verify(e)})}}else console.log("please use correct et_test url")},e.prototype.verify=function(e){var t=this;e.forEach(function(e){try{var n=JSON.parse(JSON.stringify(e));t.config.filter&&((n=t.config.filter(n))||console.warn("filter must return data !!")),t.collect.eventFilter&&n&&((n=t.collect.eventFilter(n))||console.warn("filterEvent api must return data !!"));var i=n||e,r=JSON.parse(JSON.stringify(i));if(!i.length)return;var o=!0;if(i.forEach(function(e){e.events.length||(o=!1)}),!o)return;t.collect.requestManager.useBeacon({url:t.url,data:i}),t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_EVENT,info:"SDK Report ByteIo Verify Request",time:Date.now(),data:r,code:200,status:"success",verifyType:!0})}catch(e){console.warn("something error, "+JSON.stringify(e.stack)),t.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Report ByteIo Verify Request Error",level:"error",time:Date.now(),data:e.message})}})},e}(),nH=function(){function e(e,t){this.maxDuration=432e5,this.aliveDTime=6e4,this.options={aliveName:"predefine_page_alive",params:{}},this.focusState=!0,this.collect=e,this.config=t,this.pageStartTime=Date.now(),this.sessionStartTime=this.pageStartTime,this.timerHandler=null,f(t.enable_stay_duration)&&(this.options=Object.assign(this.options,t.enable_stay_duration)),this.hard=this.options.mode&&"hard"===this.options.mode,this.focusState=document.hasFocus()}return e.prototype.setParams=function(e,t,n){this.set_path=e,this.set_url=n,this.set_title=t},e.prototype.enable=function(e,t,n){this.url_path=e,this.url=n,this.title=t,this.disableCallback=this.enablePageAlive(),this.hard&&(this.removeMode=this.hardMode())},e.prototype.disable=function(){this.disableCallback(),this.pageStartTime=Date.now()},e.prototype.sendEvent=function(e,t){void 0===t&&(t=!1);var n=t?this.aliveDTime:Date.now()-this.sessionStartTime;n<0||n>this.aliveDTime||Date.now()-this.pageStartTime>this.maxDuration||t&&"hidden"===document.visibilityState||this.hard&&!this.focusState||(this.collect.beconEvent(this.options.aliveName,s({url_path:this.getParams("url_path"),title:this.getParams("title"),url:this.getParams("url"),duration:n,is_support_visibility_change:y(),startTime:this.sessionStartTime,hidden:document.visibilityState,leave:e,mode:this.hard?"hard":"normal",focusState:this.focusState},this.options.params)),this.sessionStartTime=Date.now())},e.prototype.getParams=function(e){switch(e){case"url_path":return this.set_path||this.url_path||location.pathname;case"title":return this.set_title||this.title||document.title||location.pathname;case"url":return this.set_url||this.url||location.href}},e.prototype.setUpTimer=function(){var e=this;return this.timerHandler&&clearInterval(this.timerHandler),setInterval(function(){Date.now()-e.sessionStartTime>e.aliveDTime&&e.sendEvent(!1,!0)},1e3)},e.prototype.visibilitychange=function(){"hidden"===document.visibilityState?this.timerHandler&&(clearInterval(this.timerHandler),this.sendEvent(!1)):"visible"===document.visibilityState&&(this.sessionStartTime=Date.now(),this.timerHandler=this.setUpTimer())},e.prototype.beforeunload=function(){document.hidden||this.sendEvent(!0)},e.prototype.enablePageAlive=function(){var e=this;this.timerHandler=this.setUpTimer();var t=this.visibilitychange.bind(this),n=this.beforeunload.bind(this);return document.addEventListener("visibilitychange",t),v(n),function(){e.beforeunload(),document.removeEventListener("visibilitychange",t),window.removeEventListener("beforeunload",n),window.removeEventListener("pagehide",n)}},e.prototype.hardMode=function(){var e=this,t=function(){e.timerHandler&&(clearInterval(e.timerHandler),e.sendEvent(!1)),e.focusState=!1},n=function(){e.focusState=!0,e.sessionStartTime=Date.now(),e.timerHandler=e.setUpTimer()};return window.addEventListener("blur",t),window.addEventListener("focus",n),function(){window.removeEventListener("blur",t),window.removeEventListener("focus",n)}},e}(),nJ=function(){function e(e,t){var n=this;this.maxDuration=432e5,this.aliveDTime=6e4,this.options={closeName:"predefine_page_close",params:{}},this.focusState=!0,this.visibilitychange=function(){"hidden"===document.visibilityState?n.activeEndTime=Date.now():"visible"===document.visibilityState&&(n.activeEndTime&&(n.totalTime+=n.activeEndTime-n.activeStartTime,n.activeTimes+=1),n.activeEndTime=void 0,n.activeStartTime=Date.now())},this.beforeunload=function(){if(n.totalTime+=(n.activeEndTime||Date.now())-n.activeStartTime,n.config.autotrack)try{window.sessionStorage.setItem("_tea_cache_duration",JSON.stringify({duration:n.totalTime,page_title:document.title||location.pathname}))}catch(e){}n.sendEventPageClose()},this.collect=e,this.config=t,this.maxDuration=t.maxDuration||864e5,this.pageStartTime=Date.now(),f(t.enable_stay_duration)&&(this.options=Object.assign(this.options,t.enable_stay_duration)),this.hard=this.options.mode&&"hard"===this.options.mode,this.focusState=document.hasFocus(),this.resetData()}return e.prototype.setParams=function(e,t,n){this.set_path=e,this.set_url=n,this.set_title=t},e.prototype.resetParams=function(e,t,n){this.url_path=e,this.url=n,this.title=t},e.prototype.enable=function(e,t,n){this.url_path=e,this.url=n,this.title=t,this.disableCallback=this.enablePageClose(),this.hard&&(this.removeMode=this.hardMode())},e.prototype.disable=function(){this.disableCallback()},e.prototype.resetData=function(){this.activeStartTime=void 0===this.activeStartTime?this.pageStartTime:Date.now(),this.activeEndTime=void 0,this.activeTimes=1,this.totalTime=0,this.resetParams(location.pathname,document.title,location.href)},e.prototype.sendEventPageClose=function(){var e=Date.now()-this.pageStartTime;this.totalTime<0||e<0||this.totalTime>=this.maxDuration||this.hard&&!this.focusState||(this.collect.beconEvent(this.options.closeName,s({url_path:this.getParams("url_path"),title:this.getParams("title"),url:this.getParams("url"),active_times:this.activeTimes,duration:this.totalTime,total_duration:e,is_support_visibility_change:y(),mode:this.hard?"hard":"normal",focusState:this.focusState},this.options.params)),this.pageStartTime=Date.now(),this.resetData())},e.prototype.getParams=function(e){switch(e){case"url_path":return this.set_path||this.url_path||location.pathname;case"title":return this.set_title||this.title||document.title||location.pathname;case"url":return this.set_url||this.url||location.href}},e.prototype.enablePageClose=function(){var e=this,t=this.visibilitychange.bind(this),n=this.beforeunload.bind(this);return document.addEventListener("visibilitychange",t),v(n),function(){e.beforeunload(),document.removeEventListener("visibilitychange",t),window.removeEventListener("beforeunload",n),window.removeEventListener("pagehide",n)}},e.prototype.hardMode=function(){var e=this,t=function(){e.focusState=!1},n=function(){e.focusState=!0};return window.addEventListener("blur",t),window.addEventListener("focus",n),function(){window.removeEventListener("blur",t),window.removeEventListener("focus",n)}},e}(),nW=function(){function e(){}return e.prototype.apply=function(e,t){var n=this;if(this.collect=e,this.config=t,this.config.enable_stay_duration){this.title=document.title||location.pathname,this.url=location.href,this.url_path=location.pathname,this.pageAlive=new nH(e,t),this.pageClose=new nJ(e,t);var i=this.collect.Types;this.collect.on(i.ResetStay,function(e){var t=e.url_path,i=e.title,r=e.url;n.resetStayDuration(t,i,r)}),this.collect.on(i.RouteChange,function(e){e.init||t.disable_route_report||n.resetStayDuration()}),this.collect.on(i.SetStay,function(e){var t=e.url_path,i=e.title,r=e.url;n.setStayParmas(t,i,r)}),this.enable(this.url_path,this.title,this.url),this.ready(i.Stay),this.collect.emit(i.StayReady)}},e.prototype.ready=function(e){var t=this;if(this.collect.set(e),this.collect.hook._hooksCache.hasOwnProperty(e)){var n=this.collect.hook._hooksCache[e];if(!Object.keys(n).length)return;var i=function(e){n[e].length&&n[e].forEach(function(n){t.collect.hook.emit(e,n)})};for(var r in n)i(r)}},e.prototype.enable=function(e,t,n){this.pageAlive.enable(e,t,n),this.pageClose.enable(e,t,n)},e.prototype.disable=function(){this.pageAlive.disable(),this.pageClose.disable()},e.prototype.setStayParmas=function(e,t,n){void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),this.pageAlive.setParams(e,t,n),this.pageClose.setParams(e,t,n),this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute resetStayParams",level:"info",time:Date.now(),data:{url_path:e,title:t,url:n}})},e.prototype.reset=function(e,t,n){this.disable(),this.enable(e,t,n)},e.prototype.resetStayDuration=function(e,t,n){this.reset(e,t,n),this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"SDK Execute resetStayDuration",level:"info",time:Date.now(),data:{url_path:e,title:t,url:n}})},e}(),nZ=function(){function e(){var e=this;this.setInterval=function(){var t,n,i,r;t=function(){e.isSessionhasEvent&&e.endCurrentSession()},n=e.sessionInterval,void 0===t&&(t=function(){}),void 0===n&&(n=1e3),r=Date.now()+n,i=window.setTimeout(function e(){var o=Date.now()-r;t(),r+=n,i=window.setTimeout(e,Math.max(0,n-o))},n),e.clearIntervalFunc=function(){window.clearTimeout(i)}},this.clearInterval=function(){e.clearIntervalFunc&&e.clearIntervalFunc()}}return e.prototype.apply=function(e,t){var n=this;if(this.collect=e,!t.disable_heartbeat){this.sessionInterval=6e4,this.startTime=0,this.lastTime=0,this.setInterval();var i=this.collect.Types;this.collect.on(i.SessionReset,function(){n.process()})}},e.prototype.endCurrentSession=function(){this.collect.event("_be_active",{start_time:this.startTime,end_time:this.lastTime,url:window.location.href,referrer:window.document.referrer,title:document.title||location.pathname}),this.isSessionhasEvent=!1,this.startTime=0},e.prototype.process=function(){this.isSessionhasEvent||(this.isSessionhasEvent=!0,this.startTime=+new Date);var e=this.lastTime||+new Date;this.lastTime=+new Date,this.lastTime-e>this.sessionInterval&&(this.clearInterval(),this.endCurrentSession(),this.setInterval())},e}(),nX=function(){function e(){}return e.prototype.apply=function(e,t){var n=this;if(this.collect=e,this.config=t,!this.config.channel_domain&&!t.disable_track_event&&!t.disable_sdk_monitor){this.url=e.configManager.getUrl("event");var i=this.collect.Types;this.collect.on(i.Ready,function(){n.sdkOnload()}),this.collect.on(i.SubmitError,function(e){var t=e.type,i=e.eventData,r=e.errorCode,o=e.response;"f_data"===t&&n.sdkError(i,r,o)}),this.collect.on(e.Types.SDKInnerError,function(e){var t=e.type,i=e.eventData,r=e.errorCode,o=e.msg;n.sdkInnerError(t,i,r,o)})}},e.prototype.sdkOnload=function(){var e=this;try{var t=this.collect.configManager.get(),n=t.header,i=t.user,r=n.app_id,o=n.app_name,a=n.sdk_version,s=(i.web_id,{events:[{event:"onload",params:JSON.stringify({app_id:r,app_name:o||"",sdk_version:a,sdk_type:"npm",sdk_config:this.config,sdk_desc:"TOC_OVERSEA",url:location.href,is_setting:this.config.enable_logsetting||!1,enable_logsetting_params:this.config.enable_logsetting_params||!1,enable_logsetting_header_custom:this.config.enable_logsetting_header_custom||!1}),local_time_ms:Date.now()}],user:{user_unique_id:i.user_unique_id},header:{app_id:6656}});setTimeout(function(){e.collect.requestManager.useRequest({url:e.url,data:[s],timeout:3e4,forceXhr:!0})},16)}catch(e){}},e.prototype.sdkError=function(e,t,n){var i=this;try{var r=e[0],o=r.user,a=r.header,s=[];e.forEach(function(e){e.events.forEach(function(e){s.push(e)})});var c={events:s.map(function(e){return{event:"on_error",params:JSON.stringify({type:"sdk_event_error",error_code:t,app_id:a.app_id,app_name:a.app_name||"",error_event:e.event,sdk_version:a.sdk_version,local_time_ms:e.local_time_ms,tea_event_index:Date.now(),params:e.params,header:a,user:o,err_msg:n.m||""}),local_time_ms:Date.now()}}),user:{user_unique_id:o.user_unique_id},header:{app_id:6656}};setTimeout(function(){i.collect.requestManager.useRequest({url:i.url,data:[c],timeout:3e4,forceXhr:!0})},16)}catch(e){}},e.prototype.sdkInnerError=function(e,t,n,i){var r=this;try{var o=t[0],a=o.user,s=o.header,c=[];t.forEach(function(e){e.events.forEach(function(e){c.push(e)})});var l={events:c.map(function(t){return{event:"on_error",params:JSON.stringify({type:e,error_code:n,app_id:s.app_id,app_name:s.app_name||"",error_event:t.event,sdk_version:s.sdk_version,local_time_ms:t.local_time_ms,tea_event_index:Date.now(),params:t.params,header:s,user:a,ua:window.navigator.userAgent,err_msg:i}),local_time_ms:Date.now()}}),user:a,header:{}};setTimeout(function(){r.collect.requestManager.useRequest({url:r.url,data:[l],timeout:3e4,app_key:"566f58151b0ed37e",forceXhr:!0})},16)}catch(e){}},e}();function nY(e,t){if(void 0===t&&(t="list"),!e)return!1;if(t&&"list"===t){if(["LI","TR","DL"].includes(e.nodeName)||e.dataset&&e.dataset.hasOwnProperty("teaIdx")||e.hasAttribute&&e.hasAttribute("data-tea-idx"))return!0}else if(["A","BUTTON"].includes(e.nodeName)||e.dataset&&e.dataset.hasOwnProperty("teaContainer")||e.hasAttribute&&e.hasAttribute("data-tea-container"))return!0;return!1}function n$(e){for(var t=e;t&&!nY(t,"container");){if("HTML"===t.nodeName||"BODY"===t.nodeName)return e;t=t.parentElement}return t||e}function nQ(e){var t="";return 3===e.nodeType?t=e.textContent.trim():e.dataset&&e.dataset.hasOwnProperty("teaTitle")||e.hasAttribute("ata-tea-title")?t=e.getAttribute("data-tea-title"):e.hasAttribute("title")?t=e.getAttribute("title"):"INPUT"===e.nodeName&&["button","submit"].includes(e.getAttribute("type"))?t=e.getAttribute("value"):"IMG"===e.nodeName&&e.getAttribute("alt")&&(t=e.getAttribute("alt")),t.slice(0,200)}function n1(e){for(var t=e;t&&t.parentNode;){if(t.hasAttribute("data-tea-ignore"))return!0;if("HTML"===t.nodeName||"body"===t.nodeName)break;t=t.parentNode}return!1}var n0,n2,n5=function(e,t){return e.hasAttribute?e.hasAttribute(t):e.attributes?!(!e.attributes[t]||!e.attributes[t].specified):void 0},n4=function(e,t){if("string"==typeof t)return n5(e,t);if(p(t)){for(var n=!1,i=0;i<t.length;i++)if(n5(e,t[i])){n=!0;break}return n}},n6=function(){function e(e,t,n){var i=this;this.statistics=!1,this.pageView=!1,this.clickEvent=function(e){var t,n;t=e.target,n=i.options,!(1!==t.nodeType||!n.svg&&function(e){if("svg"===e.tagName.toLowerCase())return!0;for(var t=e.parentElement,n=!1;t;)"svg"===t.tagName.toLowerCase()?(t=null,n=!0):t=t.parentElement;return n}(t)||["HTML","BODY"].includes(t.tagName.toUpperCase()))&&"none"!==t.style.display&&(nY(t,"container")||!(!function(e){if(e.children.length){var t=e.children;return![].slice.call(t).some(function(e){return e.children.length>0})}return!0}(t)&&!n.svg))&&i.eventHandel({eventType:"dom",eventName:"click"},e)},this.changeEvent=function(e){i.eventHandel({eventType:"dom",eventName:"change"},e)},this.submitEvent=function(e){i.eventHandel({eventType:"dom",eventName:"submit"},e)},this.getPageViewEvent=function(e,t){t&&"pushState"===t&&i.eventHandel({eventType:"dom",eventName:"beat"},s({beat_type:0},e)),i.eventHandel({eventType:"dom",eventName:"page_view"},e)},this.getPageLoadEvent=function(e){i.eventHandel({eventType:"dom",eventName:"page_statistics"},{lcp:e})},this.config=n.getConfig().eventConfig,this.collect=t,this.options=e,this.beatTime=e.beat}return e.prototype.init=function(e){this.eventHandel=e;var t=this.config.mode;this.addListener(t)},e.prototype.addListener=function(e){var t=this;if("proxy-capturing"===e){if(this.config.click&&window.document.addEventListener("click",this.clickEvent,!0),this.config.change&&window.document.addEventListener("change",this.changeEvent,!0),this.config.submit&&window.document.addEventListener("submit",this.submitEvent,!0),this.config.pv){this.collect.on("route-change",function(e){var n=e.config,i=e.name;t.getPageViewEvent(n,i),t.pageView=!0});var n=setTimeout(function(){t.pageView||(t.getPageViewEvent(t.getDefaultConfig()),t.pageView=!0,clearTimeout(n))},2e3)}if(this.config.beat){try{"complete"===document.readyState?this.beatEvent(this.beatTime):window.addEventListener("load",function(){t.beatEvent(t.beatTime)});var i=0,r=null;window.addEventListener("scroll",function(){clearTimeout(r),r=setTimeout(o,500),i=document.documentElement.scrollTop||document.body.scrollTop});var o=function(){(document.documentElement.scrollTop||document.body.scrollTop)==i&&t.eventHandel({eventType:"dom",eventName:"beat"},{beat_type:1})}}catch(e){}try{var a=window.performance&&window.performance.getEntriesByType("paint");a&&a.length?(new PerformanceObserver(function(e){var n=e.getEntries(),i=n[n.length-1],r=i.renderTime||i.loadTime;t.statistics||(t.getPageLoadEvent(r),t.statistics=!0)}).observe({entryTypes:["largest-contentful-paint"]}),setTimeout(function(){t.statistics||(t.getPageLoadEvent(a[0].startTime||0),t.statistics=!0)},2e3)):this.getPageLoadEvent(0)}catch(e){this.getPageLoadEvent(0)}}}},e.prototype.removeListener=function(){window.document.removeEventListener("click",this.clickEvent,!0),window.document.removeEventListener("change",this.changeEvent,!0),window.document.removeEventListener("submit",this.submitEvent,!0)},e.prototype.beatEvent=function(e){var t,n=this;try{this.eventHandel({eventType:"dom",eventName:"beat"},{beat_type:3}),this.beatTime&&(t=setInterval(function(){n.eventHandel({eventType:"dom",eventName:"beat"},{beat_type:2})},e)),v(function(){n.eventHandel({eventType:"dom",eventName:"beat",eventSend:"becon"},{beat_type:0}),n.beatTime&&clearInterval(t)})}catch(e){}},e.prototype.getDefaultConfig=function(){return{is_html:1,url:location.href,referrer:document.referrer,page_key:location.href,refer_page_key:document.referrer,page_title:document.title||location.pathname,page_manual_key:"",refer_page_manual_key:"",refer_page_title:"",page_path:location.pathname,page_host:location.host}},e}(),n3={eventConfig:{mode:"proxy-capturing",submit:!1,click:!0,change:!1,pv:!0,beat:!0,hashTag:!1,impr:!1},scoutConfig:{mode:"xpath"}},n8=function(){function e(e,t){this.config=e,this.config.eventConfig=Object.assign(this.config.eventConfig,t)}return e.prototype.getConfig=function(){return this.config},e.prototype.setConfig=function(e){return this.config=e},e}(),n9=function(e,t,n,i,r){return s(s({event:e},function(e,t,n,i){var r,o,a,s,c,l,u,h,d,f,g={},_=function(e){if(e){var t=e.getBoundingClientRect(),n=t.width,i=t.height;return{left:t.left,top:t.top,element_width:n,element_height:i}}}(t),m=(void 0===(r=e)&&(r={}),void 0===(o=_)&&(o={}),a=r.clientX,s=r.clientY,{touch_x:Math.floor(a-(c=o.left)>=0?a-c:0),touch_y:Math.floor(s-(l=o.top)>=0?s-l:0)}),v=_.element_width,y=_.element_height,b=m.touch_x,E=m.touch_y,w=function(e){for(var t=[];null!==e.parentElement;)t.push(e),e=e.parentElement;var n=[],i=[];return t.forEach(function(e){var t=function(e){if(null===e)return{str:"",index:0};var t=0,n=e.parentElement;if(n)for(var i=n.children,r=0;r<i.length&&i[r]!==e;r++)i[r].nodeName===e.nodeName&&t++;return{str:[e.nodeName.toLowerCase(),nY(e,"list")?"[]":""].join(""),index:t}}(e),r=t.str,o=t.index;n.unshift(r),i.unshift(o)}),{element_path:"/"+n.join("/"),positions:i}}(t),S=w.element_path,z=w.positions,k=(u=n$(t),h=[],function e(t){var n=nQ(t);if(n&&-1===h.indexOf(n)&&h.push(n),t.childNodes.length>0)for(var i=t.childNodes,r=0;r<i.length;r++)8!==i[r].nodeType&&e(i[r])}(u),h),D=window.performance.timing.navigationStart,T=Date.now()-D,A=z.map(function(e){return""+e}),R=null;if(window.TEAVisualEditor&&window.TEAVisualEditor.getOriginXpath&&(R=window.TEAVisualEditor.getOriginXpath({xpath:S,positions:A})),g.element_path=R&&R.xpath||S,g.positions=R&&R.positions||A,i&&!i.text&&(g.texts=k,d=n$(t),f="",function e(t){var n=nQ(t);if(n&&(f+=n),t.childNodes.length>0)for(var i=t.childNodes,r=0;r<i.length;r++)3===i[r].nodeType&&e(i[r])}(d),g.element_title=f),g.element_id=t.getAttribute("id")||"",g.element_class_name=t.getAttribute("class")||"",g.element_type=t.nodeType,g.element_width=Math.floor(v),g.element_height=Math.floor(y),g.touch_x=b,g.touch_y=E,g.page_manual_key="",g.elememt_manual_key="",g.since_page_start_ms=T,g.page_start_ms=D,g.page_path=location.pathname,g.page_host=location.host,n.track_attr&&n4(t,n.track_attr)){var x=function(e,t){var n={};if("string"==typeof t)n5(e,t)&&(n.attrs=e.getAttribute(t));else if(p(t))for(var i=0;i<t.length;i++)n5(e,t[i])&&(n[t[i]]=e.getAttribute(t[i]));return n}(t,n.track_attr);for(var I in x)g[I]=x[I]}var G=n$(t);return"A"===G.tagName&&(g.href=G.getAttribute("href")),"IMG"===t.tagName&&(g.src=t.getAttribute("src")),g}(t,n,i,r)),{is_html:1,page_key:window.location.href,page_title:document.title})},n7=function(){function e(e,t){this.ignore={text:!0},this.initConfig=e,this.options=t,this.eventName=t&&"tea"===t.custom?{click:"__bav_click",page:"__bav_page",beat:"__bav_beat",static:"__bav_page_statistics",exposure:"__bav_page_exposure"}:{click:"bav2b_click",page:"bav2b_page",beat:"bav2b_beat",static:"bav2b_page_statistics",exposure:"bav2b_exposure"},t&&!0===t.text&&(this.ignore.text=!1),t&&t.exposure&&t.exposure.eventName&&(this.eventName.exposure=t.exposure.eventName)}return e.prototype.handleEvent=function(e,t){try{if(n1(e.target))return null;var n="bav2b_click";switch(t){case"click":return n=e.target.getAttribute("data-applog-click-event")||this.eventName.click,n9(n,e,e.target,this.options,this.ignore);case"change":return s(s({},n9(n="bav2b_change",e,e.target,this.options)),function(e,t){try{if("bav2b_change"===e)return t.hasAttribute("data-tea-track")?{value:t.value}:{}}catch(e){return{}}}(n,e.target));case"submit":return n9(n="bav2b_submit",e,e.target,this.options)}}catch(e){return console.error(e),null}},e.prototype.handleViewEvent=function(e){e.event=this.eventName.page,e.page_title=document.title,e.page_total_width=window.innerWidth,e.page_total_height=window.innerHeight;try{var t=window.sessionStorage.getItem("_tea_cache_duration");if(t){var n=JSON.parse(t);e.refer_page_duration_ms=n?n.duration:""}e.scroll_width=document.documentElement.scrollLeft?document.documentElement.scrollLeft+window.innerWidth:window.innerWidth,e.scroll_height=document.documentElement.scrollTop?document.documentElement.scrollTop+window.innerHeight:window.innerHeight,e.page_start_ms=window.performance.timing.navigationStart}catch(e){console.log("page event error "+JSON.stringify(e))}return e},e.prototype.handleStatisticsEvent=function(e){var t={};t.event=this.eventName.static,t.is_html=1,t.page_key=location.href,t.refer_page_key=document.referrer||"",t.page_title=document.title,t.page_manual_key=this.initConfig.autotrack.page_manual_key||"",t.refer_page_manual_key="";try{var n=e.lcp,i=window.performance.timing,r=i.loadEventEnd-i.navigationStart;t.page_init_cost_ms=parseInt(n||(r>0?r:0)),t.page_start_ms=i.navigationStart}catch(e){console.log("page_statistics event error "+JSON.stringify(e))}return t},e.prototype.handleBeadtEvent=function(e){e.event=this.eventName.beat,e.page_key=window.location.href,e.is_html=1,e.page_title=document.title,e.page_manual_key=this.initConfig.autotrack.page_manual_key||"";try{e.page_viewport_width=window.innerWidth,e.page_viewport_height=window.innerHeight,e.page_total_width=document.documentElement.scrollWidth,e.page_total_height=document.documentElement.scrollHeight,e.scroll_width=document.documentElement.scrollLeft+window.innerWidth,e.scroll_height=document.documentElement.scrollTop+window.innerHeight,e.since_page_start_ms=Date.now()-window.performance.timing.navigationStart,e.page_start_ms=window.performance.timing.navigationStart}catch(e){console.log("beat event error "+JSON.stringify(e))}return e},e.prototype.handleExposureEvent=function(e,t){if(n1(t.target))return null;var n=n9(e.event||this.eventName.exposure,t,t.target||t,this.options,this.ignore);if(n.$exposure_type=e.exposureType,this.options.exposure.callback){var i=this.options.exposure.callback(n);return i||Object.keys(i).length?i:(console.warn("exposure callback must return data!"),n)}return n},e.prototype.handleScrollEvent=function(e,t){var n=n9(e.event||this.eventName.scroll,t,t.target||t,this.options,this.ignore);if(n=Object.assign(n,e.params),!this.options.scroll.callback||(n=this.options.scroll.callback(n))||Object.keys(n).length)return n;console.warn("scroll callback must return data!")},e}(),ie=function(){function e(e){this.collect=e,this.eventNameList=["report_click_event","report_change_event","report_submit_event","report_exposure_event","report_page_view_event","report_page_statistics_event","report_beat_event"]}return e.prototype.send=function(e,t){var n=e.eventSend,i=t.event;delete t.event,n&&"becon"===n?this.collect.beconEvent(i,t):this.collect.event(i,t)},e.prototype.get=function(e,t){fetch(e,Object.assign({headers:{"content-type":"application/json"},method:"GET"},t))},e.prototype.post=function(e,t){fetch(e,Object.assign({headers:{"content-type":"application/json"},method:"POST"},t))},e}(),it=!1,ii=function(){function e(e,t){this._instance=null,this._intersection=e,this.config=t,this._intersection&&this.init()}return e.prototype.init=function(){var e=this;if(window.MutationObserver)try{if(this._instance=new MutationObserver(function(t){t.forEach(function(t){"attributes"===t.type&&e.attributeChangeObserve(t),"childList"===t.type&&e.modifyNodeObserve(t)})}),!document||!document.body)return void console.warn("please use sdk api init after body element");var t=!1!==this.config.autotrack.exposure.attributes;this._instance.observe(document.body,{childList:!0,attributes:t,subtree:!0,attributeOldValue:!1})}catch(e){console.log("your browser cannot support MutationObserver\uFF0Cso cannot report exposure event, please update")}else console.log("your browser cannot support MutationObserver\uFF0Cso cannot report exposure event, please update")},e.prototype.attributeChangeObserve=function(e){e.target.hasAttribute("data-exposure")?this.exposureAdd(e,"mutation"):this.exposureRemove(e)},e.prototype.modifyNodeObserve=function(e){var t=this;Array.prototype.forEach.call(e.addedNodes,function(e){1===e.nodeType&&e.hasAttribute("data-exposure")&&t.exposureAdd(e,"intersect"),t.mapChild(e,t.exposureAdd.bind(t))}),Array.prototype.forEach.call(e.removedNodes,function(e){1===e.nodeType&&e.hasAttribute("data-exposure")&&t.exposureRemove(e),t.mapChild(e,t.exposureRemove.bind(t))})},e.prototype.mapChild=function(e,t){var n=this;1===e.nodeType&&e.children.length&&Array.prototype.forEach.call(e.children,function(e){1===e.nodeType&&e.hasAttribute("data-exposure")&&t(e),n.mapChild(e,t)})},e.prototype.exposureAdd=function(e,t){try{this._intersection&&this._intersection.exposureAdd(e,t)}catch(e){console.log("intersection error",JSON.stringify(e.message))}},e.prototype.exposureRemove=function(e){try{this._intersection&&this._intersection.exposureRemove(e)}catch(e){console.log("intersection error",JSON.stringify(e.message))}},e._exposure_observer=null,e}();(ir=n2||(n2={}))[ir.EXPOSURE_ONCE=0]="EXPOSURE_ONCE",ir[ir.LIFECYCLE_SHOW_NEW=3]="LIFECYCLE_SHOW_NEW",ir[ir.RESUME_FORM_PAGE=6]="RESUME_FORM_PAGE",ir[ir.RESUME_FORM_BACK=7]="RESUME_FORM_BACK",ir[ir.NOT_EXPOSURE=-1]="NOT_EXPOSURE";var ir,io,ia=function(){function e(t,n,i){var r=this;this.backStatus=!1,this.instance=this.buildObserver(),this.collect=t,this.observeMap=e._observer_map,n.autotrack.exposure.ratio?this.ratio=n.autotrack.exposure.ratio:0===n.autotrack.exposure.ratio?this.ratio=0:this.ratio=.5,this.timeLimit=n.autotrack.exposure.stay||0,this.exposureType=n2.NOT_EXPOSURE,this.eventHandle=i,this.hashMap=new Map,this.backStatus=!1,this.lastState=null,this.collect.on("re-start-sdk",function(){r.visibilitychange()}),this.addListen()}return e.prototype.buildObserver=function(){var t=this;if(e._observer_instance)return console.log("your browser cannot support IntersectionObserver\uFF0C so cannot report exposure event, please update"),null;if(window.IntersectionObserver){for(var n=[],i=0;i<=1;i+=.01)n.push(i);n.push(1);try{e._observer_instance=new IntersectionObserver(function(e){e.forEach(function(e){var n=e.target.observeId,i=t.observeMap.get(n),r=(e.target,e.isIntersecting,e.intersectionRatio);if(i.intersectionRatio=r,r<=.1&&(e.target.backStatus=!1),t.observeMap.set(n,i),r<t.ratio)return i.isIntersecting=!1,i.added=!1,i.exposured=!1,i.startTime=Date.now(),void t.observeMap.set(n,i);if(!i.added){if(i.startTime=Date.now(),i.added=!0,i.isIntersecting=!0,t.timeLimit){var o=setTimeout(function(){try{if(i.isIntersecting&&!i.exposured&&t.observeMap.get(n)){var r=t.observeMap.get(n).intersectionRatio;t.exposureEvent(e,r,n,i)}}catch(e){console.log("IntersectionObserver setTimeout error\uFF0Cmsg: "+JSON.stringify(e))}},t.timeLimit);i.wait=o}t.observeMap.set(n,i)}Date.now()-i.startTime>=t.timeLimit&&!i.exposured&&t.exposureEvent(e,r,n,i)})},{threshold:n})}catch(e){console.log("IntersectionObserver error\uFF0Cmsg: "+JSON.stringify(e))}return e._observer_instance}return console.log("your browser cannot support IntersectionObserver\uFF0C so cannot report exposure event, please update"),null},e.prototype.exposureAdd=function(e,t){var n="mutation"===t?e.target:e,i=n.observeId,r=ea();if(i||this.observeMap.has(i)){var o=this.observeMap.get(i);if(o&&n!==o.instance)this.unobserve(n),this.observeMap.delete(i),n.observeId=r,n.visible=!1,this.observeMap.set(r,{instance:n.cloneNode(!0),isIntersecting:!1}),this.observe(n);else{if(!0===n.visible)return;this.handleBoundingExposure(n)}}else n.observeId=r,n.visible=!1,this.observeMap.set(r,{instance:n.cloneNode(!0),isIntersecting:!1}),this.observe(n)},e.prototype.exposureRemove=function(e){this.observeMap.has(e.observeId)&&(this.observeMap.delete(e.observeId),this.unobserve(e),e.observeId="",e.visible=!1)},e.prototype.exposureEvent=function(e,t,n,i){if(t>=this.ratio){if("0"===e.target.style.opacity||"hidden"===e.target.style.visibility||!0===i.exposured)return;i.startWait&&clearTimeout(i.startWait);var r=e.target.getAttribute("data-applog-exposure-event");this.eventHandle({eventType:"dom",eventName:"exposure",event:r,exposureType:this.getExposureType(e.target)},e),e.target.visible=!0,e.target.hasExposure=!0,i.startTime=Date.now(),i.exposured=!0}else i.startTime=Date.now(),i.exposured=!1;this.observeMap.set(n,i)},e.prototype.observe=function(e){this.instance&&this.instance.observe(e)},e.prototype.unobserve=function(e){this.instance&&this.instance.unobserve(e)},e.prototype.getExposureDomToExposure=function(){var e=this;Array.prototype.forEach.call(document.querySelectorAll("[data-exposure]"),function(t){e.handleBoundingExposure(t)})},e.prototype.visibilitychange=function(){var e=this,t=null;"visible"===document.visibilityState?this.timeLimit?t=setTimeout(function(){e.getExposureDomToExposure()},this.timeLimit):this.getExposureDomToExposure():(clearTimeout(t),this.customType=void 0)},e.prototype.handleBoundingExposure=function(e){if(this.getBoundingRatio(e)>=this.ratio){e.visible=!0;var t=e.getAttribute&&e.getAttribute("data-exposure-event");this.eventHandle({eventType:"dom",eventName:"exposure",event:t,exposureType:this.customType||n2.RESUME_FORM_BACK},e)}},e.prototype.getBoundingRatio=function(e){var t=e.getBoundingClientRect(),n=t.top,i=t.left,r=t.width,o=t.height,a=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return n>=0&&i>=0&&n<=s&&i<=a?(r>a?a:r)*(s-n)/(r*o):0},e.prototype.getExposureType=function(e){return e.visible?!1!==e.backStatus&&(this.backStatus||this.customType||2===window.performance.navigation.type)?this.exposureType=n2.RESUME_FORM_PAGE:this.exposureType=n2.LIFECYCLE_SHOW_NEW:(e.hasExposure,!1!==e.backStatus&&(this.backStatus||this.customType||2===window.performance.navigation.type)?this.exposureType=n2.RESUME_FORM_PAGE:this.exposureType=n2.EXPOSURE_ONCE),this.exposureType},e.prototype.addListen=function(){var e=this;this.collect.on("set-exposure-type",function(t){e.customType=t});var t,n,i=this.visibilitychange.bind(this);return n="visibilitychange",(t=document).addEventListener?t.addEventListener(n,i,!1):t.attachEven?t.attachEven("on"+n,i):t["on"+n]=i,window.addEventListener("hashchange",function(t){var n=e.hashMap.get(t.oldURL);n&&location.href===n.prev?(e.backStatus=!0,e.exposureType=n2.RESUME_FORM_PAGE):(e.backStatus=!1,e.hashMap.set(location.href,{current:t.newURL,prev:t.oldURL}))}),this.collect.on("STATE_CHANGE",function(t){e.lastState=t}),window.addEventListener("popstate",function(t){var n=t.state;n&&n.current&&e.lastState&&e.lastState.back&&n.current===e.lastState.back?(e.backStatus=!0,e.exposureType=n2.RESUME_FORM_PAGE):e.backStatus=!1}),function(){var e;(e=document).addEventListener?e.removeEventListener("visibilitychange",i,!1):e.attachEven&&e.detachEven("onvisibilitychange",i)}},e._observer_instance=null,e._observer_map=new Map,e}(),is=function(){function e(e,t,n){t.autotrack&&t.autotrack.exposure&&(this._intersection=new ia(e,t,n),this._observer=new ii(this._intersection,t),this._intersection&&this._observer?this.initObserver():console.log("your browser version cannot support exposure event, please update~"))}return e.prototype.initObserver=function(){var e=this;Array.prototype.forEach.call(document.querySelectorAll("[data-exposure]"),function(t){e._intersection.exposureAdd(t,"intersect")})},e}();(ic=io||(io={}))[ic.SCROLL_UP=1]="SCROLL_UP",ic[ic.SCROLL_DOWN=2]="SCROLL_DOWN",ic[ic.SCROLL_LEFT=3]="SCROLL_LEFT",ic[ic.SCROLL_RIGHT=4]="SCROLL_RIGHT",ic[ic.NOT_SCROLL=-1]="NOT_SCROLL";var ic,il,iu=function(){function e(e,t){this.distance=30,e.autotrack&&e.autotrack.scroll&&(e.autotrack.scroll.distance&&(this.distance=e.autotrack.scroll.distance),this.eventHandle=t,this.addLinstenr(),this.mutation())}return e.prototype.addLinstenr=function(){var e=this;Array.prototype.forEach.call(document.querySelectorAll("[data-scroll]"),function(t){e.scrollHandle(t)})},e.prototype.mutation=function(){var e=this;if(window.MutationObserver)try{var t=new MutationObserver(function(t){t.forEach(function(t){"childList"===t.type&&e.modifyNodeObserve(t)})});if(!document||!document.body)return void console.warn("please use sdk api init after body element");t.observe(document.body,{childList:!0,attributes:!0,subtree:!0,attributeOldValue:!1})}catch(e){console.log("your browser cannot support MutationObserver")}else console.log("your browser cannot support MutationObserver")},e.prototype.modifyNodeObserve=function(e){var t=this;Array.prototype.forEach.call(e.addedNodes,function(e){1===e.nodeType&&e.hasAttribute("data-scroll")&&t.scrollHandle(e),t.mapChild(e,t.scrollHandle.bind(t))}),Array.prototype.forEach.call(e.removedNodes,function(e){1===e.nodeType&&e.hasAttribute("data-scroll")&&t.scrollHandle(e,"remove"),t.mapChild(e,t.scrollHandle.bind(t))})},e.prototype.mapChild=function(e,t){var n=this;1===e.nodeType&&e.children.length&&Array.prototype.forEach.call(e.children,function(e){1===e.nodeType&&e.hasAttribute("data-scroll")&&t(e),n.mapChild(e,t)})},e.prototype.scrollHandle=function(e,t){var n=this;try{var i=e.scrollTop,r=e.scrollLeft,o=null,a=0,s=0,c=function(t){clearTimeout(o),o=setTimeout(function(){var o=e.scrollTop,h=e.scrollLeft,d=t.target&&t.target.getAttribute("data-scroll-event")||"";1===u||2===u?o===c&&(s=c-i,Math.abs(s)>=n.distance&&n.distance&&n.eventHandle({eventType:"dom",eventName:"scroll",event:d,params:{$direction:u,$offsetY:s,$offsetX:a}},t)):3!==u&&4!==u||h===l&&(a=l-r,Math.abs(a)>=n.distance&&n.distance&&n.eventHandle({eventType:"dom",eventName:"scroll",event:d,params:{$direction:u,$offsetY:s,$offsetX:a}},t)),i=c,r=l},100);var c=e.scrollTop,l=e.scrollLeft,u=io.NOT_SCROLL;c>i?u=io.SCROLL_DOWN:c<i?u=io.SCROLL_UP:l>r?u=io.SCROLL_LEFT:l<r&&(u=io.SCROLL_RIGHT)};return"remove"===t?e.removeEventListener("scroll",c,!1):e.addEventListener("scroll",c,!1),function(){e.removeEventListener("scroll",c,!1)}}catch(e){console.warn("scroll event error",JSON.stringify(e))}},e}(),ih={hashTag:!1,impr:!1},id=function(){function e(){}return e.prototype.apply=function(e,t){if(this.autoTrackStart=!1,this.collect=e,this.config=t,t.autotrack){var n=e.Types;this.ready(n.Autotrack),this.collect.emit(n.AutotrackReady)}},e.prototype.ready=function(e){this.collect.set(e);var t=this.config.autotrack;t=Object.assign(ih,t="object"==typeof t?t:{}),this.destroyed=!1,this.options=t,this.Config=new n8(n3,this.options),this.Exposure=new is(this.collect,this.config,this.handle.bind(this)),this.Scroll=new iu(this.config,this.handle.bind(this)),this.Listener=new n6(t,this.collect,this.Config),this.EventHandle=new n7(this.config,t),this.Request=new ie(this.collect),this.autoTrackStart=!0,this.init(),function(e,t){window.TEAVisualEditor=window.TEAVisualEditor||{},window.TEAVisualEditor.appId=t.app_id;var n,i=t.channel_domain,r="";if(W.length&&W.forEach(function(e){nB.push(e)}),i){var o=void 0,a="";try{var s=window.performance.getEntriesByType("resource");if(s&&s.length&&(s.forEach(function(e){"script"===e.initiatorType&&e.name&&-1!==e.name.indexOf("collect")&&(a=e.name)}),a&&(o=a.split("/"))&&o.length)){r="https:/";for(var c=2;c<o.length&&c!==o.length-1;c++)r=r+"/"+o[c];r&&r.indexOf("/5.0")&&(r=r.split("/5.0")[0]||r)}}catch(e){}}window.addEventListener("message",nN,!1);try{nU[n="tea:openHeatMapCore"]=nU[n]||[],nU[n].push(function(n){var i,r,o,a,s,c,l,u=n.data.app_id;u&&u!==t.app_id||(s=(i={event:n,editorUrl:"https://sf16-website-login.neutral.ttwstatic.com/obj/tiktok_web_login_static/log-sdk/collect/heatmap-core.js?query="+Date.now(),autoTrackInstance:e}).event,c=i.editorUrl,l=i.autoTrackInstance,it||(it=!0,r=function(){nL(s,"editorScriptloadSuccess"),l.destroy()},o=function(){s&&nL(s,"editorScriptloadError"),it=!1},(a=document.createElement("script")).src=c,a.onerror=function(){o(c)},a.onload=function(){r()},document.getElementsByTagName("head")[0].appendChild(a)))})}catch(e){console.log("openHeatMapCore error")}}(this,this.config)},e.prototype.init=function(){this.Listener.init(this.handle.bind(this)),"base"===this.collect.loadType&&(window.opener||window.parent).postMessage("[tea-sdk]ready","*")},e.prototype.handle=function(e,t){try{if(this.config.autotrack.collect_url&&!this.config.autotrack.collect_url())return}catch(e){}"dom"===e.eventType&&this.handleDom(e,t)},e.prototype.handleDom=function(e,t){try{var n,i=e.eventName;if("click"===i||"change"===i||"submit"===i)(n=this.EventHandle.handleEvent(t,i))&&this.Request.send({eventType:"custom"},n);else if("page_view"===i||"page_statistics"===i){var r=void 0;(r="page_view"===i?this.EventHandle.handleViewEvent(t):this.EventHandle.handleStatisticsEvent(t))&&this.Request.send({eventType:"custom"},r)}else if("beat"===i){var o=this.EventHandle.handleBeadtEvent(t),a=e.eventSend;o&&this.Request.send({eventType:"custom",eventSend:a},o)}else"exposure"===i?(n=this.EventHandle.handleExposureEvent(e,t))&&this.Request.send({eventType:"custom"},n):"scroll"===i&&(n=this.EventHandle.handleScrollEvent(e,t))&&this.Request.send({eventType:"custom"},n)}catch(e){console.log("handel dom event error "+JSON.stringify(e))}},e.prototype.destroy=function(){if(!this.autoTrackStart)return console.warn("engine is undefined, make sure you have called autoTrack.start()");this.autoTrackStart=!1,this.Listener.removeListener()},e}();(a=il||(il={})).Net="net",a.FailNet="f_net",a.FailData="f_data";var ip={pv:["predefine_pageview"],sdk:["_be_active","predefine_page_alive","predefine_page_close","__profile_set","__profile_set_once","__profile_increment","__profile_unset","__profile_append"],autotrack:["bav2b_click","bav2b_page","bav2b_beat","bav2b_page_statistics","__bav_click","__bav_page","__bav_beat","__bav_page_statistics"]},ig=function(){function e(){}return e.prototype.apply=function(e,t){var n=this;if(this.ready=t.app_id&&t.enable_tracer&&!t.disable_track_event,this.ready){this.limit={pv:1,sdk:3,autotrack:3,log:3},this.errorCode={f_net:0,f_data:0},this.tracerCache=new Map,this.collect=e,this.appid=t.app_id,this.reportUrl=e.configManager.getUrl("event");var i=this.collect.Types;e.adapters.fetch,this.collect.on(i.Event,function(e){p(e)?e.forEach(function(e){n.addCount("log")}):n.addCount("log")}),this.collect.on(i.SubmitError,function(e){var t=e.type,i=e.eventDate,r=e.errorCode,o=e.response;n.addErrorCount(i,t,r,o)}),this.listener(),this.collect.emit(i.TracerReady)}},e.prototype.addCount=function(e,t,n){void 0===t&&(t="net"),void 0===n&&(n=1);try{this.tracerCache||(this.tracerCache=new Map);var i=void 0;if(this.tracerCache.has(e))(r=this.tracerCache.get(e)).has(t)?(i=r.get(t).params.count,i++,r.set(t,this.processTracer(i,e,t))):(i=n,r.set(t,this.processTracer(n,e,t)));else{var r=new Map;i=n,r.set(t,this.processTracer(n,e,t)),this.tracerCache.set(e,r)}"net"===t&&i>=this.limit[e]&&this.report(!1)}catch(e){console.log(e)}},e.prototype.addErrorCount=function(e,t,n,i){var r=this;try{if(e&&e.length){var o=e[0].events;o&&o.length&&("f_data"===t?(i&&i.hasOwnProperty("sc")?this.addCount("log",t,o.length-i.sc):this.addCount("log",t,o.length),this.errorCode[t]=n):o.forEach(function(e){var i="log";for(var o in ip)if(-1!==ip[o].indexOf(e.event)){i=o;break}r.addCount(i,t,1),r.errorCode[t]=n}))}}catch(e){}},e.prototype.report=function(e){if(this.tracerCache){var t=[];this.tracerCache.forEach(function(e){console.log(e),e.forEach(function(e){t.push(e)})}),t&&t.length&&this.sendTracer(t,e)}},e.prototype.sendTracer=function(e,t){try{var n=this.collect.eventManager.merge(e);this.collect.requestManager.useRequest({url:this.reportUrl,data:n,useBeacon:t}),this.tracerCache=null}catch(e){}},e.prototype.processTracer=function(e,t,n){try{var i={count:e,state:n,key:t,params_for_special:"applog_trace",aid:this.appid,platform:"web",_staging_flag:1,sdk_version:"5.3.9_oversea"};"f_net"!==n&&"f_data"!==n||(i.errorCode=this.errorCode[n]);var r=this.collect.processEvent("applog_trace",i);if(r&&r.event)return delete r.is_bav,r}catch(e){console.warn("something error")}},e.prototype.listener=function(){var e=this;document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e.leavePage()}),v(function(){e.leavePage()})},e.prototype.leavePage=function(){this.report(!0)},e}(),i_=function(){function e(){this.retryWaitTime=3e3,this.retryStatus=!1,this.retryCacheStatus=!1}return e.prototype.apply=function(e,t){var n=this;if(t.enable_storage&&!t.disable_storage&&(this.collect=e,this.config=t,!this.collect.destroy)){var i=e.Types,r=e.adapters.storage;this.storage=new r(!1),this.eventUrl=this.collect.configManager.getUrl("event"),this.eventKey="__tea_cache_events_"+t.app_id,this.storageNum=t.storage_num||50,this.retryNum=t.retry_num||3,this.retryInterval=1e3,e.on(i.SubmitError,function(e){"f_data"!==e.type&&n.storeData(e)}),e.on(i.Ready,function(){n.checkStorage()})}},e.prototype.retryRightNow=function(e){var t=this;if(this.retryStatus)this.errorCache.push(e);else{var n=0;this.retryStatus=!0;var i=setInterval(function(){if(3===n)return t.storeData(t.errorCache),t.retryStatus=!1,void clearInterval(i);var r=e.eventData;t.fetchData(r,function(){t.retryStatus=!1,clearInterval(i),t.retryCacheStatus&&t.errorCache.splice(0,1),t.errorCache.length&&(t.retryCacheStatus=!0,t.retryRightNow(t.errorCache[0]))},function(){n++})},this.retryInterval)}},e.prototype.storeData=function(e){var t=this.storage.getItem(this.eventKey),n=e.eventData;Object.keys(t).length!==this.storageNum&&(t[Date.now()]=n,this.storage.setItem(this.eventKey,t))},e.prototype.checkStorage=function(){var e=this;try{if(!window.navigator.onLine)return;var t=this.storage.getItem(this.eventKey);if(!t||!Object.keys(t).length)return;var n={events:[{event:"ontest",params:{app_id:this.config.app_id},local_time_ms:Date.now()}],user:{user_unique_id:this.collect.configManager.get("web_id")},header:{}};this.fetchData([n],function(){var n=JSON.parse(JSON.stringify(t)),i=function(i){e.fetchData(t[i],function(){delete n[i],e.storage.setItem(e.eventKey,n)},function(){},!1)};for(var r in t)i(r)},function(){},!0)}catch(e){console.warn("error check storage")}},e.prototype.fetchData=function(e,t,n,i){this.collect.requestManager.useRequest({url:this.eventUrl,data:e,timeout:3e4,success:t,fail:n,app_key:i?"566f58151b0ed37e":""})},e}(),im="undefined"!=typeof window?(window.LogPluginObject||(window.LogPluginObject={}),window.LogPluginObject):null,iv=function(){function e(){}return e.prototype.apply=function(e,t){this._plugin={},this.config=t,this.collect=e,this.channel=t.channel||"cn",this.loadExtend()},e.prototype.loadExtend=function(){var e=this;try{this.collect.remotePlugin.forEach(function(t,n){if("sdk"===t)if(nM.hasOwnProperty(n)){var i=nM[n].object,r=""+nM[n].src[e.channel];e.exist(n,i,r)}else console.warn("your "+n+" is not exist\uFF0Cplease check plugin name");else"object"==typeof t&&(t.src?e.exist(n,t.call,t.src):e.process(n,t.instance,"INSTANCE"))})}catch(e){this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"LoadExtend Fail",level:"error",time:Date.now(),data:e.message}),console.log("load extend error")}},e.prototype.exist=function(e,t,n){var i=this;im[t]?(this.process(e,im[t]),console.log("already has "+e+" plugin~")):this.loadPlugin(e,n,function(){i.process(e,im[t]),console.log(" %c %s %s %s","color: yellow; background-color: black;","\u2013","load plugin:"+e+" success","-")},function(){console.log(" %c %s %s %s","color: red; background-color: yellow;","\u2013","load plugin:"+e+" error","-")})},e.prototype.process=function(e,t,n){try{if(n){var i=new t;i.apply&&i.apply(this.collect,this.config),console.log("excude "+e+" success")}else t&&t(this.collect,this.config)}catch(t){this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"Extend Process Fail",level:"error",time:Date.now(),data:t.message}),console.log("excude "+e+" error, message:"+t.message)}},e.prototype.loadPlugin=function(e,t,n,i){var r=this;try{var o=document.createElement("script");o.src=t,this._plugin[e]||(this._plugin[e]=[]),this._plugin[e].push(n),o.onerror=function(){i(t)},o.onload=function(){r._plugin[e].forEach(function(e){e()})},document.getElementsByTagName("head")[0].appendChild(o)}catch(e){this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"Extend LoadPlugin Fail",level:"error",time:Date.now(),data:e.message})}},e}(),iy=function(){function e(){this.autotrack=!1,this.spa=!1,this.cache={},this.allowHash=!1}return e.prototype.apply=function(e,t){if(t.spa||t.autotrack){var n=e.Types;this.collect=e,this.config=t,this.appid=t.app_id,this.allowHash=t.allow_hash,this.fncArray=new Map,this.setKey(),this.setLocation(),this.hack(),this.init(),this.listener(),e.emit(n.RouteReady)}},e.prototype.setKey=function(){var e=this.collect.adapters.storage;this.storage=new e(!1),this.cache_key="__tea_cache_refer_"+this.appid,this.cache={refer_key:"",refer_title:document.title||location.pathname,refer_manual_key:"",routeChange:!1},this.config.autotrack&&"object"==typeof this.config.autotrack&&this.config.autotrack.page_manual_key&&(this.cache.refer_manual_key=this.config.autotrack.page_manual_key),this.storage.setItem(this.cache_key,this.cache)},e.prototype.hack=function(){var e=this,t=window.history.pushState;history.pushState=function(n){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];"function"==typeof history.onpushstate&&history.onpushstate({state:n});var o=t.call.apply(t,u([history,n],i));if(e.collect.sdkStop||e.collect.destroy)return o;if(!(e.lastLocation===location.href||e.config.disable_spa_query&&e.pathEquel())){e.setReferCache(e.lastLocation);var a=e.getPopStateChangeEventData();return e.lastLocation=location.href,e.sendPv(a,"pushState"),o}};var n=history.replaceState;history.replaceState=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];"function"==typeof history.onreplacestate&&history.onreplacestate({state:t});var o=n.call.apply(n,u([history,t],i));if(e.collect.sdkStop||e.collect.destroy)return o;if(!(e.lastLocation===location.href||e.config.disable_spa_query&&e.pathEquel())){e.setReferCache(e.lastLocation);var a=e.getPopStateChangeEventData();return e.lastLocation=location.href,e.sendPv(a),o}}},e.prototype.setLocation=function(){"undefined"!=typeof window&&(this.lastLocation=window.location.href)},e.prototype.getLocation=function(){return this.lastLocation},e.prototype.pathEquel=function(){try{return new URL(this.lastLocation).origin+new URL(this.lastLocation).pathname===new URL(location.href).origin+new URL(location.href).pathname}catch(e){return!1}},e.prototype.init=function(){var e=this.getPopStateChangeEventData();this.collect.emit("route-change",{config:e,init:!0})},e.prototype.listener=function(){var e=this;window.addEventListener("hashchange",function(t){if(!e.collect.sdkStop&&!e.collect.destroy&&e.lastLocation!==window.location.href&&(!e.config.disable_spa_query||!e.pathEquel())&&e.allowHash){e.setReferCache(e.lastLocation),e.lastLocation=window.location.href;var n=e.getPopStateChangeEventData();e.sendPv(n)}}),window.addEventListener("popstate",function(t){if(!e.collect.sdkStop&&!e.collect.destroy&&!(e.lastLocation===window.location.href||e.config.disable_spa_query&&e.pathEquel())){e.setReferCache(e.lastLocation),e.lastLocation=window.location.href;var n=e.getPopStateChangeEventData();e.sendPv(n)}})},e.prototype.getPopStateChangeEventData=function(){var e=this.pageConfig();return e.is_back=0,e},e.prototype.pageConfig=function(){try{var e=this.storage.getItem(this.cache_key)||{},t=!1,n=this.storage.getItem("__tea_cache_first_"+this.appid);return t=!n||1!=n,{is_html:1,url:location.href,referrer:this.handleRefer(),page_key:location.href,refer_page_key:this.handleRefer(),page_title:document.title||location.pathname,page_manual_key:this.config.autotrack&&this.config.autotrack.page_manual_key||"",refer_page_manual_key:e&&e.refer_manual_key||"",refer_page_title:e&&e.refer_title||"",page_path:location.pathname,page_host:location.host,is_first_time:""+t}}catch(e){return this.collect.emit(D.DEBUGGER_MESSAGE,{type:D.DEBUGGER_MESSAGE_SDK,info:"something error",level:"error",time:Date.now(),data:e.message}),{}}},e.prototype.sendPv=function(e,t){this.collect.emit("route-change",{config:e,init:!1})},e.prototype.handleRefer=function(){var e="";try{var t=this.storage.getItem(this.cache_key)||{};e=t.routeChange?t.refer_key:this.collect.configManager.get("referrer")}catch(t){e=document.referrer}return e},e.prototype.setReferCache=function(e){var t=this.storage.getItem(this.cache_key)||{};t.refer_key=e,t.routeChange=!0,this.storage.setItem(this.cache_key,t)},e}(),ib=function(){function e(){}return e.prototype.apply=function(e,t){var n=this;this.collect=e,this.config=t;var i=e.Types;e.on(i.TrackDurationStart,function(e){n.trackEventStart(e)}),e.on(i.TrackDurationEnd,function(e){n.trackEventEnd(e)}),e.on(i.TrackDurationPause,function(e){n.trackEventPause(e)}),e.on(i.TrackDurationResume,function(e){n.trackEventResume(e)}),this.Types=i,this.TrackEventMap=new Map,this.ready(i.TrackDuration)},e.prototype.ready=function(e){var t=this;if(this.collect.set(e),this.collect.hook._hooksCache.hasOwnProperty(e)){var n=this.collect.hook._hooksCache[e];if(!Object.keys(n).length)return;var i=function(e){n[e].length&&n[e].forEach(function(n){t.collect.hook.emit(e,n)})};for(var r in n)i(r)}},e.prototype.trackEventStart=function(e){this.TrackEventMap.set(e,{startTime:Date.now(),isPause:!1,pauseTime:0,resumeTime:0})},e.prototype.trackEventEnd=function(e){var t=e.eventName,n=e.params;if(this.TrackEventMap.has(t)){var i=this.TrackEventMap.get(t),r=Object.assign(n,{event_duration:i.isPause?i.pauseTime-i.startTime:i.resumeTime?i.pauseTime-i.startTime+(Date.now()-i.resumeTime):Date.now()-i.startTime});this.collect.event(t,r),this.cleanEventTrack(t)}},e.prototype.trackEventPause=function(e){if(this.TrackEventMap.has(e)){var t=this.TrackEventMap.get(e);t.isPause||(t.isPause=!0,t.pauseTime=Date.now(),this.TrackEventMap.set(e,t))}},e.prototype.trackEventResume=function(e){if(this.TrackEventMap.has(e)){var t=this.TrackEventMap.get(e);t.isPause&&(t.isPause=!1,t.resumeTime=Date.now(),this.TrackEventMap.set(e,t))}},e.prototype.cleanEventTrack=function(e){this.TrackEventMap.delete(e)},e}();nC.usePlugin(iv,"extend"),nC.usePlugin(nF,"et"),nC.usePlugin(i_,"retry"),nC.usePlugin(nq,"ab"),nC.usePlugin(nW,"stay"),nC.usePlugin(id,"autotrack"),nC.usePlugin(ib,"trackeventduration"),nC.usePlugin(nZ,"heartbeat"),nC.usePlugin(nX,"monitor"),nC.usePlugin(iy,"route"),nC.usePlugin(ig,"tracer");var iE=new nC("default"),iw=nC;t.default=iE}}]);