@seaverse/track-sdk 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,606 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SeaVerseTrack={})}(this,function(e){"use strict";function t(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}var r;e.TrackProvider=void 0,(r=e.TrackProvider||(e.TrackProvider={})).FIREBASE="firebase",r.SENSORS="sensors";const n=function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return t},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const i=e[t],a=t+1<e.length,s=a?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0,l=i>>2,u=(3&i)<<4|s>>4;let d=(15&s)<<2|c>>6,p=63&c;o||(p=64,a||(d=64)),n.push(r[l],r[u],r[d],r[p])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(n(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){const i=e[r++];if(i<128)t[n++]=String.fromCharCode(i);else if(i>191&&i<224){const a=e[r++];t[n++]=String.fromCharCode((31&i)<<6|63&a)}else if(i>239&&i<365){const a=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(a>>10)),t[n++]=String.fromCharCode(56320+(1023&a))}else{const a=e[r++],s=e[r++];t[n++]=String.fromCharCode((15&i)<<12|(63&a)<<6|63&s)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const i=r[e.charAt(t++)],s=t<e.length?r[e.charAt(t)]:0;++t;const o=t<e.length?r[e.charAt(t)]:64;++t;const c=t<e.length?r[e.charAt(t)]:64;if(++t,null==i||null==s||null==o||null==c)throw new a;const l=i<<2|s>>4;if(n.push(l),64!==o){const e=s<<4&240|o>>2;if(n.push(e),64!==c){const e=o<<6&192|c;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};
2
+ /**
3
+ * @license
4
+ * Copyright 2017 Google LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */class a extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const s=function(e){return function(e){const t=n(e);return i.encodeByteArray(t,!0)}(e).replace(/\./g,"")};
18
+ /**
19
+ * @license
20
+ * Copyright 2022 Google LLC
21
+ *
22
+ * Licensed under the Apache License, Version 2.0 (the "License");
23
+ * you may not use this file except in compliance with the License.
24
+ * You may obtain a copy of the License at
25
+ *
26
+ * http://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software
29
+ * distributed under the License is distributed on an "AS IS" BASIS,
30
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
+ * See the License for the specific language governing permissions and
32
+ * limitations under the License.
33
+ */
34
+ const c=()=>
35
+ /**
36
+ * @license
37
+ * Copyright 2022 Google LLC
38
+ *
39
+ * Licensed under the Apache License, Version 2.0 (the "License");
40
+ * you may not use this file except in compliance with the License.
41
+ * You may obtain a copy of the License at
42
+ *
43
+ * http://www.apache.org/licenses/LICENSE-2.0
44
+ *
45
+ * Unless required by applicable law or agreed to in writing, software
46
+ * distributed under the License is distributed on an "AS IS" BASIS,
47
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48
+ * See the License for the specific language governing permissions and
49
+ * limitations under the License.
50
+ */
51
+ function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,l=()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&function(e){try{return i.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}(e[1]);return t&&JSON.parse(t)},u=()=>{try{return c()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||l()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},d=()=>{var e;return null===(e=u())||void 0===e?void 0:e.config};
52
+ /**
53
+ * @license
54
+ * Copyright 2017 Google LLC
55
+ *
56
+ * Licensed under the Apache License, Version 2.0 (the "License");
57
+ * you may not use this file except in compliance with the License.
58
+ * You may obtain a copy of the License at
59
+ *
60
+ * http://www.apache.org/licenses/LICENSE-2.0
61
+ *
62
+ * Unless required by applicable law or agreed to in writing, software
63
+ * distributed under the License is distributed on an "AS IS" BASIS,
64
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
65
+ * See the License for the specific language governing permissions and
66
+ * limitations under the License.
67
+ */
68
+ class p{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,r))}}}function f(){try{return"object"==typeof indexedDB}catch(e){return!1}}function g(){return new Promise((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=()=>{i.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=()=>{r=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})}class h extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,h.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,_.prototype.create)}}class _{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},n=`${this.service}/${e}`,i=this.errors[e],a=i?function(e,t){return e.replace(v,(e,r)=>{const n=t[r];return null!=n?String(n):`<${r}?>`})}(i,r):"Error",s=`${this.serviceName}: ${a} (${n}).`;return new h(n,s,r)}}const v=/\{\$([^}]+)}/g;function y(e,t){if(e===t)return!0;const r=Object.keys(e),n=Object.keys(t);for(const i of r){if(!n.includes(i))return!1;const r=e[i],a=t[i];if(b(r)&&b(a)){if(!y(r,a))return!1}else if(r!==a)return!1}for(const e of n)if(!r.includes(e))return!1;return!0}function b(e){return null!==e&&"object"==typeof e}
69
+ /**
70
+ * @license
71
+ * Copyright 2019 Google LLC
72
+ *
73
+ * Licensed under the Apache License, Version 2.0 (the "License");
74
+ * you may not use this file except in compliance with the License.
75
+ * You may obtain a copy of the License at
76
+ *
77
+ * http://www.apache.org/licenses/LICENSE-2.0
78
+ *
79
+ * Unless required by applicable law or agreed to in writing, software
80
+ * distributed under the License is distributed on an "AS IS" BASIS,
81
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
82
+ * See the License for the specific language governing permissions and
83
+ * limitations under the License.
84
+ */function w(e,t=1e3,r=2){const n=t*Math.pow(r,e),i=Math.round(.5*n*(Math.random()-.5)*2);return Math.min(144e5,n+i)}
85
+ /**
86
+ * @license
87
+ * Copyright 2021 Google LLC
88
+ *
89
+ * Licensed under the Apache License, Version 2.0 (the "License");
90
+ * you may not use this file except in compliance with the License.
91
+ * You may obtain a copy of the License at
92
+ *
93
+ * http://www.apache.org/licenses/LICENSE-2.0
94
+ *
95
+ * Unless required by applicable law or agreed to in writing, software
96
+ * distributed under the License is distributed on an "AS IS" BASIS,
97
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
98
+ * See the License for the specific language governing permissions and
99
+ * limitations under the License.
100
+ */function S(e){return e&&e._delegate?e._delegate:e}class k{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}
101
+ /**
102
+ * @license
103
+ * Copyright 2019 Google LLC
104
+ *
105
+ * Licensed under the Apache License, Version 2.0 (the "License");
106
+ * you may not use this file except in compliance with the License.
107
+ * You may obtain a copy of the License at
108
+ *
109
+ * http://www.apache.org/licenses/LICENSE-2.0
110
+ *
111
+ * Unless required by applicable law or agreed to in writing, software
112
+ * distributed under the License is distributed on an "AS IS" BASIS,
113
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
+ * See the License for the specific language governing permissions and
115
+ * limitations under the License.
116
+ */const I="[DEFAULT]";
117
+ /**
118
+ * @license
119
+ * Copyright 2019 Google LLC
120
+ *
121
+ * Licensed under the Apache License, Version 2.0 (the "License");
122
+ * you may not use this file except in compliance with the License.
123
+ * You may obtain a copy of the License at
124
+ *
125
+ * http://www.apache.org/licenses/LICENSE-2.0
126
+ *
127
+ * Unless required by applicable law or agreed to in writing, software
128
+ * distributed under the License is distributed on an "AS IS" BASIS,
129
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130
+ * See the License for the specific language governing permissions and
131
+ * limitations under the License.
132
+ */class C{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new p;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const r=this.getOrInitializeService({instanceIdentifier:t});r&&e.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),n=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(r)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:r})}catch(e){if(n)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}
133
+ /**
134
+ * @license
135
+ * Copyright 2019 Google LLC
136
+ *
137
+ * Licensed under the Apache License, Version 2.0 (the "License");
138
+ * you may not use this file except in compliance with the License.
139
+ * You may obtain a copy of the License at
140
+ *
141
+ * http://www.apache.org/licenses/LICENSE-2.0
142
+ *
143
+ * Unless required by applicable law or agreed to in writing, software
144
+ * distributed under the License is distributed on an "AS IS" BASIS,
145
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
146
+ * See the License for the specific language governing permissions and
147
+ * limitations under the License.
148
+ */(e))try{this.getOrInitializeService({instanceIdentifier:I})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:r});t.resolve(e)}catch(e){}}}}clearInstance(e=I){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=I){return this.instances.has(e)}getOptions(e=I){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const n=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[e,t]of this.instancesDeferred.entries()){r===this.normalizeInstanceIdentifier(e)&&t.resolve(n)}return n}onInit(e,t){var r;const n=this.normalizeInstanceIdentifier(t),i=null!==(r=this.onInitCallbacks.get(n))&&void 0!==r?r:new Set;i.add(e),this.onInitCallbacks.set(n,i);const a=this.instances.get(n);return a&&e(a,n),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const n of r)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e,n===I?void 0:n),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch(e){}var n;return r||null}normalizeInstanceIdentifier(e=I){return this.component?this.component.multipleInstances?e:I:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class P{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new C(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}
149
+ /**
150
+ * @license
151
+ * Copyright 2017 Google LLC
152
+ *
153
+ * Licensed under the Apache License, Version 2.0 (the "License");
154
+ * you may not use this file except in compliance with the License.
155
+ * You may obtain a copy of the License at
156
+ *
157
+ * http://www.apache.org/licenses/LICENSE-2.0
158
+ *
159
+ * Unless required by applicable law or agreed to in writing, software
160
+ * distributed under the License is distributed on an "AS IS" BASIS,
161
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
162
+ * See the License for the specific language governing permissions and
163
+ * limitations under the License.
164
+ */var T;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(T||(T={}));const D={debug:T.DEBUG,verbose:T.VERBOSE,info:T.INFO,warn:T.WARN,error:T.ERROR,silent:T.SILENT},O=T.INFO,E={[T.DEBUG]:"log",[T.VERBOSE]:"log",[T.INFO]:"info",[T.WARN]:"warn",[T.ERROR]:"error"},N=(e,t,...r)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),i=E[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${n}] ${e.name}:`,...r)};class j{constructor(e){this.name=e,this._logLevel=O,this._logHandler=N,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in T))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?D[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,T.DEBUG,...e),this._logHandler(this,T.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,T.VERBOSE,...e),this._logHandler(this,T.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,T.INFO,...e),this._logHandler(this,T.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,T.WARN,...e),this._logHandler(this,T.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,T.ERROR,...e),this._logHandler(this,T.ERROR,...e)}}let A,$;const x=new WeakMap,L=new WeakMap,U=new WeakMap,R=new WeakMap,B=new WeakMap;let M={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return L.get(e);if("objectStoreNames"===t)return e.objectStoreNames||U.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return z(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function H(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?($||($=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(J(this),t),z(x.get(this))}:function(...t){return z(e.apply(J(this),t))}:function(t,...r){const n=e.call(J(this),t,...r);return U.set(n,t.sort?t.sort():[t]),z(n)}}function F(e){return"function"==typeof e?H(e):(e instanceof IDBTransaction&&function(e){if(L.has(e))return;const t=new Promise((t,r)=>{const n=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=()=>{t(),n()},a=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)});L.set(e,t)}(e),t=e,(A||(A=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,M):e);var t}function z(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,r)=>{const n=()=>{e.removeEventListener("success",i),e.removeEventListener("error",a)},i=()=>{t(z(e.result)),n()},a=()=>{r(e.error),n()};e.addEventListener("success",i),e.addEventListener("error",a)});return t.then(t=>{t instanceof IDBCursor&&x.set(t,e)}).catch(()=>{}),B.set(t,e),t}(e);if(R.has(e))return R.get(e);const t=F(e);return t!==e&&(R.set(e,t),B.set(t,e)),t}const J=e=>B.get(e);function V(e,t,{blocked:r,upgrade:n,blocking:i,terminated:a}={}){const s=indexedDB.open(e,t),o=z(s);return n&&s.addEventListener("upgradeneeded",e=>{n(z(s.result),e.oldVersion,e.newVersion,z(s.transaction),e)}),r&&s.addEventListener("blocked",e=>r(e.oldVersion,e.newVersion,e)),o.then(e=>{a&&e.addEventListener("close",()=>a()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o}const W=["get","getKey","getAll","getAllKeys","count"],q=["put","add","delete","clear"],K=new Map;function Z(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(K.get(t))return K.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,i=q.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!i&&!W.includes(r))return;const a=async function(e,...t){const a=this.transaction(e,i?"readwrite":"readonly");let s=a.store;return n&&(s=s.index(t.shift())),(await Promise.all([s[r](...t),i&&a.done]))[0]};return K.set(t,a),a}M=(e=>({...e,get:(t,r,n)=>Z(t,r)||e.get(t,r,n),has:(t,r)=>!!Z(t,r)||e.has(t,r)}))(M);
165
+ /**
166
+ * @license
167
+ * Copyright 2019 Google LLC
168
+ *
169
+ * Licensed under the Apache License, Version 2.0 (the "License");
170
+ * you may not use this file except in compliance with the License.
171
+ * You may obtain a copy of the License at
172
+ *
173
+ * http://www.apache.org/licenses/LICENSE-2.0
174
+ *
175
+ * Unless required by applicable law or agreed to in writing, software
176
+ * distributed under the License is distributed on an "AS IS" BASIS,
177
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
178
+ * See the License for the specific language governing permissions and
179
+ * limitations under the License.
180
+ */
181
+ class X{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const Y="@firebase/app",G="0.13.2",Q=new j("@firebase/app"),ee="@firebase/app-compat",te="@firebase/analytics-compat",re="@firebase/analytics",ne="@firebase/app-check-compat",ie="@firebase/app-check",ae="@firebase/auth",se="@firebase/auth-compat",oe="@firebase/database",ce="@firebase/data-connect",le="@firebase/database-compat",ue="@firebase/functions",de="@firebase/functions-compat",pe="@firebase/installations",fe="@firebase/installations-compat",ge="@firebase/messaging",he="@firebase/messaging-compat",_e="@firebase/performance",me="@firebase/performance-compat",ve="@firebase/remote-config",ye="@firebase/remote-config-compat",be="@firebase/storage",we="@firebase/storage-compat",Se="@firebase/firestore",ke="@firebase/ai",Ie="@firebase/firestore-compat",Ce="firebase",Pe="[DEFAULT]",Te={[Y]:"fire-core",[ee]:"fire-core-compat",[re]:"fire-analytics",[te]:"fire-analytics-compat",[ie]:"fire-app-check",[ne]:"fire-app-check-compat",[ae]:"fire-auth",[se]:"fire-auth-compat",[oe]:"fire-rtdb",[ce]:"fire-data-connect",[le]:"fire-rtdb-compat",[ue]:"fire-fn",[de]:"fire-fn-compat",[pe]:"fire-iid",[fe]:"fire-iid-compat",[ge]:"fire-fcm",[he]:"fire-fcm-compat",[_e]:"fire-perf",[me]:"fire-perf-compat",[ve]:"fire-rc",[ye]:"fire-rc-compat",[be]:"fire-gcs",[we]:"fire-gcs-compat",[Se]:"fire-fst",[Ie]:"fire-fst-compat",[ke]:"fire-vertex","fire-js":"fire-js",[Ce]:"fire-js-all"},De=new Map,Oe=new Map,Ee=new Map;function Ne(e,t){try{e.container.addComponent(t)}catch(r){Q.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function je(e){const t=e.name;if(Ee.has(t))return Q.debug(`There were multiple attempts to register component ${t}.`),!1;Ee.set(t,e);for(const t of De.values())Ne(t,e);for(const t of Oe.values())Ne(t,e);return!0}function Ae(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}
182
+ /**
183
+ * @license
184
+ * Copyright 2019 Google LLC
185
+ *
186
+ * Licensed under the Apache License, Version 2.0 (the "License");
187
+ * you may not use this file except in compliance with the License.
188
+ * You may obtain a copy of the License at
189
+ *
190
+ * http://www.apache.org/licenses/LICENSE-2.0
191
+ *
192
+ * Unless required by applicable law or agreed to in writing, software
193
+ * distributed under the License is distributed on an "AS IS" BASIS,
194
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
195
+ * See the License for the specific language governing permissions and
196
+ * limitations under the License.
197
+ */const $e=new _("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});
198
+ /**
199
+ * @license
200
+ * Copyright 2019 Google LLC
201
+ *
202
+ * Licensed under the Apache License, Version 2.0 (the "License");
203
+ * you may not use this file except in compliance with the License.
204
+ * You may obtain a copy of the License at
205
+ *
206
+ * http://www.apache.org/licenses/LICENSE-2.0
207
+ *
208
+ * Unless required by applicable law or agreed to in writing, software
209
+ * distributed under the License is distributed on an "AS IS" BASIS,
210
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
211
+ * See the License for the specific language governing permissions and
212
+ * limitations under the License.
213
+ */
214
+ class xe{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new k("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw $e.create("app-deleted",{appName:this._name})}}function Le(e,t={}){let r=e;if("object"!=typeof t){t={name:t}}const n=Object.assign({name:Pe,automaticDataCollectionEnabled:!0},t),i=n.name;if("string"!=typeof i||!i)throw $e.create("bad-app-name",{appName:String(i)});if(r||(r=d()),!r)throw $e.create("no-options");const a=De.get(i);if(a){if(y(r,a.options)&&y(n,a.config))return a;throw $e.create("duplicate-app",{appName:i})}const s=new P(i);for(const e of Ee.values())s.addComponent(e);const o=new xe(r,n,s);return De.set(i,o),o}function Ue(e,t,r){var n;let i=null!==(n=Te[e])&&void 0!==n?n:e;r&&(i+=`-${r}`);const a=i.match(/\s|\//),s=t.match(/\s|\//);if(a||s){const e=[`Unable to register library "${i}" with version "${t}":`];return a&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),a&&s&&e.push("and"),s&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void Q.warn(e.join(" "))}je(new k(`${i}-version`,()=>({library:i,version:t}),"VERSION"))}
215
+ /**
216
+ * @license
217
+ * Copyright 2021 Google LLC
218
+ *
219
+ * Licensed under the Apache License, Version 2.0 (the "License");
220
+ * you may not use this file except in compliance with the License.
221
+ * You may obtain a copy of the License at
222
+ *
223
+ * http://www.apache.org/licenses/LICENSE-2.0
224
+ *
225
+ * Unless required by applicable law or agreed to in writing, software
226
+ * distributed under the License is distributed on an "AS IS" BASIS,
227
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
228
+ * See the License for the specific language governing permissions and
229
+ * limitations under the License.
230
+ */const Re="firebase-heartbeat-store";let Be=null;function Me(){return Be||(Be=V("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Re)}catch(e){console.warn(e)}}}).catch(e=>{throw $e.create("idb-open",{originalErrorMessage:e.message})})),Be}async function He(e,t){try{const r=(await Me()).transaction(Re,"readwrite"),n=r.objectStore(Re);await n.put(t,Fe(e)),await r.done}catch(e){if(e instanceof h)Q.warn(e.message);else{const t=$e.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});Q.warn(t.message)}}}function Fe(e){return`${e.name}!${e.options.appId}`}
231
+ /**
232
+ * @license
233
+ * Copyright 2021 Google LLC
234
+ *
235
+ * Licensed under the Apache License, Version 2.0 (the "License");
236
+ * you may not use this file except in compliance with the License.
237
+ * You may obtain a copy of the License at
238
+ *
239
+ * http://www.apache.org/licenses/LICENSE-2.0
240
+ *
241
+ * Unless required by applicable law or agreed to in writing, software
242
+ * distributed under the License is distributed on an "AS IS" BASIS,
243
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
244
+ * See the License for the specific language governing permissions and
245
+ * limitations under the License.
246
+ */class ze{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Ve(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),n=Je();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===n||this._heartbeatsCache.heartbeats.some(e=>e.date===n))return;if(this._heartbeatsCache.heartbeats.push({date:n,agent:r}),this._heartbeatsCache.heartbeats.length>30){const e=function(e){if(0===e.length)return-1;let t=0,r=e[0].date;for(let n=1;n<e.length;n++)e[n].date<r&&(r=e[n].date,t=n);return t}
247
+ /**
248
+ * @license
249
+ * Copyright 2019 Google LLC
250
+ *
251
+ * Licensed under the Apache License, Version 2.0 (the "License");
252
+ * you may not use this file except in compliance with the License.
253
+ * You may obtain a copy of the License at
254
+ *
255
+ * http://www.apache.org/licenses/LICENSE-2.0
256
+ *
257
+ * Unless required by applicable law or agreed to in writing, software
258
+ * distributed under the License is distributed on an "AS IS" BASIS,
259
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
260
+ * See the License for the specific language governing permissions and
261
+ * limitations under the License.
262
+ */(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){Q.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=Je(),{heartbeatsToSend:r,unsentEntries:n}=function(e,t=1024){const r=[];let n=e.slice();for(const i of e){const e=r.find(e=>e.agent===i.agent);if(e){if(e.dates.push(i.date),We(r)>t){e.dates.pop();break}}else if(r.push({agent:i.agent,dates:[i.date]}),We(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}(this._heartbeatsCache.heartbeats),i=s(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return Q.warn(e),""}}}function Je(){return(new Date).toISOString().substring(0,10)}class Ve{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!f()&&g().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await Me()).transaction(Re),r=await t.objectStore(Re).get(Fe(e));return await t.done,r}catch(e){if(e instanceof h)Q.warn(e.message);else{const t=$e.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});Q.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return He(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return He(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}}}function We(e){return s(JSON.stringify({version:2,heartbeats:e})).length}var qe;qe="",je(new k("platform-logger",e=>new X(e),"PRIVATE")),je(new k("heartbeat",e=>new ze(e),"PRIVATE")),Ue(Y,G,qe),Ue(Y,G,"esm2017"),Ue("fire-js","");
263
+ /**
264
+ * @license
265
+ * Copyright 2020 Google LLC
266
+ *
267
+ * Licensed under the Apache License, Version 2.0 (the "License");
268
+ * you may not use this file except in compliance with the License.
269
+ * You may obtain a copy of the License at
270
+ *
271
+ * http://www.apache.org/licenses/LICENSE-2.0
272
+ *
273
+ * Unless required by applicable law or agreed to in writing, software
274
+ * distributed under the License is distributed on an "AS IS" BASIS,
275
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
276
+ * See the License for the specific language governing permissions and
277
+ * limitations under the License.
278
+ */
279
+ Ue("firebase","11.10.0","app");const Ke="@firebase/installations",Ze="0.6.18",Xe=1e4,Ye=`w:${Ze}`,Ge="FIS_v2",Qe=36e5,et=new _("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function tt(e){return e instanceof h&&e.code.includes("request-failed")}
280
+ /**
281
+ * @license
282
+ * Copyright 2019 Google LLC
283
+ *
284
+ * Licensed under the Apache License, Version 2.0 (the "License");
285
+ * you may not use this file except in compliance with the License.
286
+ * You may obtain a copy of the License at
287
+ *
288
+ * http://www.apache.org/licenses/LICENSE-2.0
289
+ *
290
+ * Unless required by applicable law or agreed to in writing, software
291
+ * distributed under the License is distributed on an "AS IS" BASIS,
292
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
293
+ * See the License for the specific language governing permissions and
294
+ * limitations under the License.
295
+ */function rt({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function nt(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function it(e,t){const r=(await t.json()).error;return et.create("request-failed",{requestName:e,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function at({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function st(e,{refreshToken:t}){const r=at(e);return r.append("Authorization",function(e){return`${Ge} ${e}`}
296
+ /**
297
+ * @license
298
+ * Copyright 2019 Google LLC
299
+ *
300
+ * Licensed under the Apache License, Version 2.0 (the "License");
301
+ * you may not use this file except in compliance with the License.
302
+ * You may obtain a copy of the License at
303
+ *
304
+ * http://www.apache.org/licenses/LICENSE-2.0
305
+ *
306
+ * Unless required by applicable law or agreed to in writing, software
307
+ * distributed under the License is distributed on an "AS IS" BASIS,
308
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
309
+ * See the License for the specific language governing permissions and
310
+ * limitations under the License.
311
+ */(t)),r}async function ot(e){const t=await e();return t.status>=500&&t.status<600?e():t}
312
+ /**
313
+ * @license
314
+ * Copyright 2019 Google LLC
315
+ *
316
+ * Licensed under the Apache License, Version 2.0 (the "License");
317
+ * you may not use this file except in compliance with the License.
318
+ * You may obtain a copy of the License at
319
+ *
320
+ * http://www.apache.org/licenses/LICENSE-2.0
321
+ *
322
+ * Unless required by applicable law or agreed to in writing, software
323
+ * distributed under the License is distributed on an "AS IS" BASIS,
324
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
325
+ * See the License for the specific language governing permissions and
326
+ * limitations under the License.
327
+ */
328
+ function ct(e){return new Promise(t=>{setTimeout(t,e)})}
329
+ /**
330
+ * @license
331
+ * Copyright 2019 Google LLC
332
+ *
333
+ * Licensed under the Apache License, Version 2.0 (the "License");
334
+ * you may not use this file except in compliance with the License.
335
+ * You may obtain a copy of the License at
336
+ *
337
+ * http://www.apache.org/licenses/LICENSE-2.0
338
+ *
339
+ * Unless required by applicable law or agreed to in writing, software
340
+ * distributed under the License is distributed on an "AS IS" BASIS,
341
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
342
+ * See the License for the specific language governing permissions and
343
+ * limitations under the License.
344
+ */
345
+ /**
346
+ * @license
347
+ * Copyright 2019 Google LLC
348
+ *
349
+ * Licensed under the Apache License, Version 2.0 (the "License");
350
+ * you may not use this file except in compliance with the License.
351
+ * You may obtain a copy of the License at
352
+ *
353
+ * http://www.apache.org/licenses/LICENSE-2.0
354
+ *
355
+ * Unless required by applicable law or agreed to in writing, software
356
+ * distributed under the License is distributed on an "AS IS" BASIS,
357
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
358
+ * See the License for the specific language governing permissions and
359
+ * limitations under the License.
360
+ */
361
+ const lt=/^[cdef][\w-]{21}$/;function ut(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(r=e,btoa(String.fromCharCode(...r)).replace(/\+/g,"-").replace(/\//g,"_"));var r;return t.substr(0,22)}
362
+ /**
363
+ * @license
364
+ * Copyright 2019 Google LLC
365
+ *
366
+ * Licensed under the Apache License, Version 2.0 (the "License");
367
+ * you may not use this file except in compliance with the License.
368
+ * You may obtain a copy of the License at
369
+ *
370
+ * http://www.apache.org/licenses/LICENSE-2.0
371
+ *
372
+ * Unless required by applicable law or agreed to in writing, software
373
+ * distributed under the License is distributed on an "AS IS" BASIS,
374
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
375
+ * See the License for the specific language governing permissions and
376
+ * limitations under the License.
377
+ */(e);return lt.test(t)?t:""}catch(e){return""}}function dt(e){return`${e.appName}!${e.appId}`}
378
+ /**
379
+ * @license
380
+ * Copyright 2019 Google LLC
381
+ *
382
+ * Licensed under the Apache License, Version 2.0 (the "License");
383
+ * you may not use this file except in compliance with the License.
384
+ * You may obtain a copy of the License at
385
+ *
386
+ * http://www.apache.org/licenses/LICENSE-2.0
387
+ *
388
+ * Unless required by applicable law or agreed to in writing, software
389
+ * distributed under the License is distributed on an "AS IS" BASIS,
390
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
391
+ * See the License for the specific language governing permissions and
392
+ * limitations under the License.
393
+ */const pt=new Map;function ft(e,t){const r=dt(e);gt(r,t),function(e,t){const r=function(){!ht&&"BroadcastChannel"in self&&(ht=new BroadcastChannel("[Firebase] FID Change"),ht.onmessage=e=>{gt(e.data.key,e.data.fid)});return ht}();r&&r.postMessage({key:e,fid:t});0===pt.size&&ht&&(ht.close(),ht=null)}(r,t)}function gt(e,t){const r=pt.get(e);if(r)for(const e of r)e(t)}let ht=null;
394
+ /**
395
+ * @license
396
+ * Copyright 2019 Google LLC
397
+ *
398
+ * Licensed under the Apache License, Version 2.0 (the "License");
399
+ * you may not use this file except in compliance with the License.
400
+ * You may obtain a copy of the License at
401
+ *
402
+ * http://www.apache.org/licenses/LICENSE-2.0
403
+ *
404
+ * Unless required by applicable law or agreed to in writing, software
405
+ * distributed under the License is distributed on an "AS IS" BASIS,
406
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
407
+ * See the License for the specific language governing permissions and
408
+ * limitations under the License.
409
+ */
410
+ const _t="firebase-installations-store";let mt=null;function vt(){return mt||(mt=V("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(_t)}})),mt}async function yt(e,t){const r=dt(e),n=(await vt()).transaction(_t,"readwrite"),i=n.objectStore(_t),a=await i.get(r);return await i.put(t,r),await n.done,a&&a.fid===t.fid||ft(e,t.fid),t}async function bt(e){const t=dt(e),r=(await vt()).transaction(_t,"readwrite");await r.objectStore(_t).delete(t),await r.done}async function wt(e,t){const r=dt(e),n=(await vt()).transaction(_t,"readwrite"),i=n.objectStore(_t),a=await i.get(r),s=t(a);return void 0===s?await i.delete(r):await i.put(s,r),await n.done,!s||a&&a.fid===s.fid||ft(e,s.fid),s}
411
+ /**
412
+ * @license
413
+ * Copyright 2019 Google LLC
414
+ *
415
+ * Licensed under the Apache License, Version 2.0 (the "License");
416
+ * you may not use this file except in compliance with the License.
417
+ * You may obtain a copy of the License at
418
+ *
419
+ * http://www.apache.org/licenses/LICENSE-2.0
420
+ *
421
+ * Unless required by applicable law or agreed to in writing, software
422
+ * distributed under the License is distributed on an "AS IS" BASIS,
423
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
424
+ * See the License for the specific language governing permissions and
425
+ * limitations under the License.
426
+ */async function St(e){let t;const r=await wt(e.appConfig,r=>{const n=function(e){const t=e||{fid:ut(),registrationStatus:0};return Ct(t)}(r),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(et.create("app-offline"))}}const r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=async function(e,t){try{const r=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:r}){const n=rt(e),i=at(e),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const s={fid:r,authVersion:Ge,appId:e.appId,sdkVersion:Ye},o={method:"POST",headers:i,body:JSON.stringify(s)},c=await ot(()=>fetch(n,o));if(c.ok){const e=await c.json();return{fid:e.fid||r,registrationStatus:2,refreshToken:e.refreshToken,authToken:nt(e.authToken)}}throw await it("Create Installation",c)}(e,t);return yt(e.appConfig,r)}catch(r){throw tt(r)&&409===r.customData.serverCode?await bt(e.appConfig):await yt(e.appConfig,{fid:t.fid,registrationStatus:0}),r}}(e,r);return{installationEntry:r,registrationPromise:n}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:kt(e)}:{installationEntry:t}}(e,n);return t=i.registrationPromise,i.installationEntry});return""===r.fid?{installationEntry:await t}:{installationEntry:r,registrationPromise:t}}async function kt(e){let t=await It(e.appConfig);for(;1===t.registrationStatus;)await ct(100),t=await It(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:r}=await St(e);return r||t}return t}function It(e){return wt(e,e=>{if(!e)throw et.create("installation-not-found");return Ct(e)})}function Ct(e){return 1===(t=e).registrationStatus&&t.registrationTime+Xe<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t;
427
+ /**
428
+ * @license
429
+ * Copyright 2019 Google LLC
430
+ *
431
+ * Licensed under the Apache License, Version 2.0 (the "License");
432
+ * you may not use this file except in compliance with the License.
433
+ * You may obtain a copy of the License at
434
+ *
435
+ * http://www.apache.org/licenses/LICENSE-2.0
436
+ *
437
+ * Unless required by applicable law or agreed to in writing, software
438
+ * distributed under the License is distributed on an "AS IS" BASIS,
439
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
440
+ * See the License for the specific language governing permissions and
441
+ * limitations under the License.
442
+ */}async function Pt({appConfig:e,heartbeatServiceProvider:t},r){const n=function(e,{fid:t}){return`${rt(e)}/${t}/authTokens:generate`}
443
+ /**
444
+ * @license
445
+ * Copyright 2019 Google LLC
446
+ *
447
+ * Licensed under the Apache License, Version 2.0 (the "License");
448
+ * you may not use this file except in compliance with the License.
449
+ * You may obtain a copy of the License at
450
+ *
451
+ * http://www.apache.org/licenses/LICENSE-2.0
452
+ *
453
+ * Unless required by applicable law or agreed to in writing, software
454
+ * distributed under the License is distributed on an "AS IS" BASIS,
455
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
456
+ * See the License for the specific language governing permissions and
457
+ * limitations under the License.
458
+ */(e,r),i=st(e,r),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const s={installation:{sdkVersion:Ye,appId:e.appId}},o={method:"POST",headers:i,body:JSON.stringify(s)},c=await ot(()=>fetch(n,o));if(c.ok){return nt(await c.json())}throw await it("Generate Auth Token",c)}async function Tt(e,t=!1){let r;const n=await wt(e.appConfig,n=>{if(!Ot(n))throw et.create("not-registered");const i=n.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+Qe}(e)}(i))return n;if(1===i.requestStatus)return r=async function(e,t){let r=await Dt(e.appConfig);for(;1===r.authToken.requestStatus;)await ct(100),r=await Dt(e.appConfig);const n=r.authToken;return 0===n.requestStatus?Tt(e,t):n}(e,t),n;{if(!navigator.onLine)throw et.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(n);return r=async function(e,t){try{const r=await Pt(e,t),n=Object.assign(Object.assign({},t),{authToken:r});return await yt(e.appConfig,n),r}catch(r){if(!tt(r)||401!==r.customData.serverCode&&404!==r.customData.serverCode){const r=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await yt(e.appConfig,r)}else await bt(e.appConfig);throw r}}(e,t),t}});return r?await r:n.authToken}function Dt(e){return wt(e,e=>{if(!Ot(e))throw et.create("not-registered");const t=e.authToken;return 1===(r=t).requestStatus&&r.requestTime+Xe<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var r;
459
+ /**
460
+ * @license
461
+ * Copyright 2019 Google LLC
462
+ *
463
+ * Licensed under the Apache License, Version 2.0 (the "License");
464
+ * you may not use this file except in compliance with the License.
465
+ * You may obtain a copy of the License at
466
+ *
467
+ * http://www.apache.org/licenses/LICENSE-2.0
468
+ *
469
+ * Unless required by applicable law or agreed to in writing, software
470
+ * distributed under the License is distributed on an "AS IS" BASIS,
471
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
472
+ * See the License for the specific language governing permissions and
473
+ * limitations under the License.
474
+ */})}function Ot(e){return void 0!==e&&2===e.registrationStatus}
475
+ /**
476
+ * @license
477
+ * Copyright 2019 Google LLC
478
+ *
479
+ * Licensed under the Apache License, Version 2.0 (the "License");
480
+ * you may not use this file except in compliance with the License.
481
+ * You may obtain a copy of the License at
482
+ *
483
+ * http://www.apache.org/licenses/LICENSE-2.0
484
+ *
485
+ * Unless required by applicable law or agreed to in writing, software
486
+ * distributed under the License is distributed on an "AS IS" BASIS,
487
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
488
+ * See the License for the specific language governing permissions and
489
+ * limitations under the License.
490
+ */
491
+ async function Et(e,t=!1){const r=e;await async function(e){const{registrationPromise:t}=await St(e);t&&await t}
492
+ /**
493
+ * @license
494
+ * Copyright 2019 Google LLC
495
+ *
496
+ * Licensed under the Apache License, Version 2.0 (the "License");
497
+ * you may not use this file except in compliance with the License.
498
+ * You may obtain a copy of the License at
499
+ *
500
+ * http://www.apache.org/licenses/LICENSE-2.0
501
+ *
502
+ * Unless required by applicable law or agreed to in writing, software
503
+ * distributed under the License is distributed on an "AS IS" BASIS,
504
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
505
+ * See the License for the specific language governing permissions and
506
+ * limitations under the License.
507
+ */(r);return(await Tt(r,t)).token}function Nt(e){return et.create("missing-app-config-values",{valueName:e})}
508
+ /**
509
+ * @license
510
+ * Copyright 2020 Google LLC
511
+ *
512
+ * Licensed under the Apache License, Version 2.0 (the "License");
513
+ * you may not use this file except in compliance with the License.
514
+ * You may obtain a copy of the License at
515
+ *
516
+ * http://www.apache.org/licenses/LICENSE-2.0
517
+ *
518
+ * Unless required by applicable law or agreed to in writing, software
519
+ * distributed under the License is distributed on an "AS IS" BASIS,
520
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
521
+ * See the License for the specific language governing permissions and
522
+ * limitations under the License.
523
+ */const jt="installations",At=e=>{const t=Ae(e.getProvider("app").getImmediate(),jt).getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:r,registrationPromise:n}=await St(t);return n?n.catch(console.error):Tt(t).catch(console.error),r.fid}(t),getToken:e=>Et(t,e)}};je(new k(jt,e=>{const t=e.getProvider("app").getImmediate(),r=function(e){if(!e||!e.options)throw Nt("App Configuration");if(!e.name)throw Nt("App Name");const t=["projectId","apiKey","appId"];for(const r of t)if(!e.options[r])throw Nt(r);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:r,heartbeatServiceProvider:Ae(t,"heartbeat"),_delete:()=>Promise.resolve()}},"PUBLIC")),je(new k("installations-internal",At,"PRIVATE")),Ue(Ke,Ze),Ue(Ke,Ze,"esm2017");
524
+ /**
525
+ * @license
526
+ * Copyright 2019 Google LLC
527
+ *
528
+ * Licensed under the Apache License, Version 2.0 (the "License");
529
+ * you may not use this file except in compliance with the License.
530
+ * You may obtain a copy of the License at
531
+ *
532
+ * http://www.apache.org/licenses/LICENSE-2.0
533
+ *
534
+ * Unless required by applicable law or agreed to in writing, software
535
+ * distributed under the License is distributed on an "AS IS" BASIS,
536
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
537
+ * See the License for the specific language governing permissions and
538
+ * limitations under the License.
539
+ */
540
+ const $t="analytics",xt="https://www.googletagmanager.com/gtag/js",Lt=new j("@firebase/analytics"),Ut=new _("analytics","Analytics",{"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-initialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."});
541
+ /**
542
+ * @license
543
+ * Copyright 2019 Google LLC
544
+ *
545
+ * Licensed under the Apache License, Version 2.0 (the "License");
546
+ * you may not use this file except in compliance with the License.
547
+ * You may obtain a copy of the License at
548
+ *
549
+ * http://www.apache.org/licenses/LICENSE-2.0
550
+ *
551
+ * Unless required by applicable law or agreed to in writing, software
552
+ * distributed under the License is distributed on an "AS IS" BASIS,
553
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
554
+ * See the License for the specific language governing permissions and
555
+ * limitations under the License.
556
+ */
557
+ function Rt(e){if(!e.startsWith(xt)){const t=Ut.create("invalid-gtag-resource",{gtagURL:e});return Lt.warn(t.message),""}return e}function Bt(e){return Promise.all(e.map(e=>e.catch(e=>e)))}function Mt(e,t){const r=function(e,t){let r;return window.trustedTypes&&(r=window.trustedTypes.createPolicy(e,t)),r}("firebase-js-sdk-policy",{createScriptURL:Rt}),n=document.createElement("script"),i=`${xt}?l=${e}&id=${t}`;n.src=r?null==r?void 0:r.createScriptURL(i):i,n.async=!0,document.head.appendChild(n)}function Ht(e,t,r,n){return async function(i,...a){try{if("event"===i){const[n,i]=a;await async function(e,t,r,n,i){try{let a=[];if(i&&i.send_to){let e=i.send_to;Array.isArray(e)||(e=[e]);const n=await Bt(r);for(const r of e){const e=n.find(e=>e.measurementId===r),i=e&&t[e.appId];if(!i){a=[];break}a.push(i)}}0===a.length&&(a=Object.values(t)),await Promise.all(a),e("event",n,i||{})}catch(e){Lt.error(e)}}(e,t,r,n,i)}else if("config"===i){const[i,s]=a;await async function(e,t,r,n,i,a){const s=n[i];try{if(s)await t[s];else{const e=(await Bt(r)).find(e=>e.measurementId===i);e&&await t[e.appId]}}catch(e){Lt.error(e)}e("config",i,a)}(e,t,r,n,i,s)}else if("consent"===i){const[t,r]=a;e("consent",t,r)}else if("get"===i){const[t,r,n]=a;e("get",t,r,n)}else if("set"===i){const[t]=a;e("set",t)}else e(i,...a)}catch(e){Lt.error(e)}}}const Ft=new class{constructor(e={},t=1e3){this.throttleMetadata=e,this.intervalMillis=t}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}};function zt(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function Jt(e,t=Ft,r){const{appId:n,apiKey:i,measurementId:a}=e.options;if(!n)throw Ut.create("no-app-id");if(!i){if(a)return{measurementId:a,appId:n};throw Ut.create("no-api-key")}const s=t.getThrottleMetadata(n)||{backoffCount:0,throttleEndTimeMillis:Date.now()},o=new Wt;return setTimeout(async()=>{o.abort()},6e4),Vt({appId:n,apiKey:i,measurementId:a},s,o,t)}async function Vt(e,{throttleEndTimeMillis:t,backoffCount:r},n,i=Ft){var a;const{appId:s,measurementId:o}=e;try{await function(e,t){return new Promise((r,n)=>{const i=Math.max(t-Date.now(),0),a=setTimeout(r,i);e.addEventListener(()=>{clearTimeout(a),n(Ut.create("fetch-throttle",{throttleEndTimeMillis:t}))})})}(n,t)}catch(e){if(o)return Lt.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${o} provided in the "measurementId" field in the local Firebase config. [${null==e?void 0:e.message}]`),{appId:s,measurementId:o};throw e}try{const t=await async function(e){var t;const{appId:r,apiKey:n}=e,i={method:"GET",headers:zt(n)},a="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",r),s=await fetch(a,i);if(200!==s.status&&304!==s.status){let e="";try{const r=await s.json();(null===(t=r.error)||void 0===t?void 0:t.message)&&(e=r.error.message)}catch(e){}throw Ut.create("config-fetch-failed",{httpStatus:s.status,responseMessage:e})}return s.json()}(e);return i.deleteThrottleMetadata(s),t}catch(t){const c=t;if(!function(e){if(!(e instanceof h&&e.customData))return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(c)){if(i.deleteThrottleMetadata(s),o)return Lt.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${o} provided in the "measurementId" field in the local Firebase config. [${null==c?void 0:c.message}]`),{appId:s,measurementId:o};throw t}const l=503===Number(null===(a=null==c?void 0:c.customData)||void 0===a?void 0:a.httpStatus)?w(r,i.intervalMillis,30):w(r,i.intervalMillis),u={throttleEndTimeMillis:Date.now()+l,backoffCount:r+1};return i.setThrottleMetadata(s,u),Lt.debug(`Calling attemptFetch again in ${l} millis`),Vt(e,u,n,i)}}class Wt{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}async function qt(e,t,r,n,i,a,s){var o;const c=Jt(e);c.then(t=>{r[t.measurementId]=t.appId,e.options.measurementId&&t.measurementId!==e.options.measurementId&&Lt.warn(`The measurement ID in the local Firebase config (${e.options.measurementId}) does not match the measurement ID fetched from the server (${t.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)}).catch(e=>Lt.error(e)),t.push(c);const l=
558
+ /**
559
+ * @license
560
+ * Copyright 2020 Google LLC
561
+ *
562
+ * Licensed under the Apache License, Version 2.0 (the "License");
563
+ * you may not use this file except in compliance with the License.
564
+ * You may obtain a copy of the License at
565
+ *
566
+ * http://www.apache.org/licenses/LICENSE-2.0
567
+ *
568
+ * Unless required by applicable law or agreed to in writing, software
569
+ * distributed under the License is distributed on an "AS IS" BASIS,
570
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
571
+ * See the License for the specific language governing permissions and
572
+ * limitations under the License.
573
+ */
574
+ async function(){if(!f())return Lt.warn(Ut.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await g()}catch(e){return Lt.warn(Ut.create("indexeddb-unavailable",{errorInfo:null==e?void 0:e.toString()}).message),!1}return!0}().then(e=>e?n.getId():void 0),[u,d]=await Promise.all([c,l]);(function(e){const t=window.document.getElementsByTagName("script");for(const r of Object.values(t))if(r.src&&r.src.includes(xt)&&r.src.includes(e))return r;return null}
575
+ /**
576
+ * @license
577
+ * Copyright 2020 Google LLC
578
+ *
579
+ * Licensed under the Apache License, Version 2.0 (the "License");
580
+ * you may not use this file except in compliance with the License.
581
+ * You may obtain a copy of the License at
582
+ *
583
+ * http://www.apache.org/licenses/LICENSE-2.0
584
+ *
585
+ * Unless required by applicable law or agreed to in writing, software
586
+ * distributed under the License is distributed on an "AS IS" BASIS,
587
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
588
+ * See the License for the specific language governing permissions and
589
+ * limitations under the License.
590
+ */)(a)||Mt(a,u.measurementId),i("js",new Date);const p=null!==(o=null==s?void 0:s.config)&&void 0!==o?o:{};return p.origin="firebase",p.update=!0,null!=d&&(p.firebase_id=d),i("config",u.measurementId,p),u.measurementId}
591
+ /**
592
+ * @license
593
+ * Copyright 2019 Google LLC
594
+ *
595
+ * Licensed under the Apache License, Version 2.0 (the "License");
596
+ * you may not use this file except in compliance with the License.
597
+ * You may obtain a copy of the License at
598
+ *
599
+ * http://www.apache.org/licenses/LICENSE-2.0
600
+ *
601
+ * Unless required by applicable law or agreed to in writing, software
602
+ * distributed under the License is distributed on an "AS IS" BASIS,
603
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
604
+ * See the License for the specific language governing permissions and
605
+ * limitations under the License.
606
+ */class Kt{constructor(e){this.app=e}_delete(){return delete Zt[this.app.options.appId],Promise.resolve()}}let Zt={},Xt=[];const Yt={};let Gt,Qt,er="dataLayer",tr=!1;function rr(){const e=[];if(function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}()&&e.push("This is a browser extension environment."),"undefined"!=typeof navigator&&navigator.cookieEnabled||e.push("Cookies are not available."),e.length>0){const t=e.map((e,t)=>`(${t+1}) ${e}`).join(" "),r=Ut.create("invalid-analytics-context",{errorInfo:t});Lt.warn(r.message)}}function nr(e,t,r){rr();const n=e.options.appId;if(!n)throw Ut.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw Ut.create("no-api-key");Lt.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${e.options.measurementId} provided in the "measurementId" field in the local Firebase config.`)}if(null!=Zt[n])throw Ut.create("already-exists",{id:n});if(!tr){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(er);const{wrappedGtag:e,gtagCore:t}=function(e,t,r,n,i){let a=function(...e){window[n].push(arguments)};return window[i]&&"function"==typeof window[i]&&(a=window[i]),window[i]=Ht(a,e,t,r),{gtagCore:a,wrappedGtag:window[i]}}(Zt,Xt,Yt,er,"gtag");Qt=e,Gt=t,tr=!0}Zt[n]=qt(e,Xt,Yt,t,Gt,er,r);return new Kt(e)}function ir(e=function(e=Pe){const t=De.get(e);if(!t&&e===Pe&&d())return Le();if(!t)throw $e.create("no-app",{appName:e});return t}()){const t=Ae(e=S(e),$t);return t.isInitialized()?t.getImmediate():function(e,t={}){const r=Ae(e,$t);if(r.isInitialized()){const e=r.getImmediate();if(y(t,r.getOptions()))return e;throw Ut.create("already-initialized")}const n=r.initialize({options:t});return n}(e)}function ar(e,t,r,n){e=S(e),async function(e,t,r,n,i){if(i&&i.global)e("event",r,n);else{const i=await t;e("event",r,Object.assign(Object.assign({},n),{send_to:i}))}}(Qt,Zt[e.app.options.appId],t,r,n).catch(e=>Lt.error(e))}const sr="@firebase/analytics",or="0.10.17";function cr(){return"undefined"!=typeof window&&"undefined"!=typeof document}function lr(e){const t=document.createElement("noscript"),r=document.createElement("iframe");r.src=`https://www.googletagmanager.com/ns.html?id=${e}`,r.height="0",r.width="0",r.style.display="none",r.style.visibility="hidden",t.appendChild(r),document.body.firstChild?document.body.insertBefore(t,document.body.firstChild):document.body.appendChild(t)}function ur(e,t=!1){if(cr())if(e)if(function(e){if(!cr())return!1;const t=!!window.dataLayer,r=document.querySelectorAll("script"),n=Array.from(r).some(t=>t.src.includes(`gtm.js?id=${e}`));return t&&n}(e))t&&console.log("[GTM] Already injected, skip");else try{!function(e){window.dataLayer=window.dataLayer||[],window.dataLayer.push({"gtm.start":(new Date).getTime(),event:"gtm.js"});const t=document.createElement("script");t.async=!0,t.src=`https://www.googletagmanager.com/gtm.js?id=${e}`;const r=document.getElementsByTagName("script")[0];r&&r.parentNode?r.parentNode.insertBefore(t,r):document.head.appendChild(t)}(e),document.body?lr(e):document.addEventListener("DOMContentLoaded",()=>{lr(e)}),t&&console.log(`[GTM] Injected successfully: ${e}`)}catch(e){console.error("[GTM] Injection failed:",e)}else t&&console.warn("[GTM] GTM ID is empty, skip injection");else t&&console.warn("[GTM] Not in browser environment, skip injection")}je(new k($t,(e,{options:t})=>nr(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t),"PUBLIC")),je(new k("analytics-internal",function(e){try{const t=e.getProvider($t).getImmediate();return{logEvent:(e,r,n)=>ar(t,e,r,n)}}catch(e){throw Ut.create("interop-component-reg-failed",{reason:e})}},"PRIVATE")),Ue(sr,or),Ue(sr,or,"esm2017");const dr=(e,t)=>{if(!e||"string"!=typeof e)return void console.error("[GoogleTagManager] Invalid event name:",e);(e=>{if("undefined"!=typeof window&&window.dataLayer)try{window.dataLayer.push(e),console.log("[GoogleTagManager] Pushed to dataLayer:",e)}catch(e){console.error("[GoogleTagManager] Error pushing to dataLayer:",e)}else console.error("[GoogleTagManager] dataLayer not initialized")})({event:e,...t||{}})};class pr{constructor(e,t,r=!1){this.analytics=null,this.initialized=!1,this.config=e,this.gtmId=t,this.debug=r}async initialize(){if(!this.initialized)try{const e=Le(this.config);this.analytics=ir(e),this.gtmId&&ur(this.gtmId,this.debug),this.initialized=!0}catch(e){throw console.error("firebase initialize failed:",e),e}}async track(e,t){}async setUserId(e){}async setUserProperties(e){}async clearUserId(){}}function fr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gr,hr={exports:{}};var _r=(gr||(gr=1,function(e){e.exports=function(){var e,t={};function r(e){if(!e)return!1;var t=Object.prototype.toString.call(e);return"[object Function]"==t||"[object AsyncFunction]"==t}function n(){return Date.now&&r(Date.now)?Date.now():(new Date).getTime()}t.DEFAULT_SEND_TYPE="image",function(){var e={function:!0,object:!0},t=e[typeof window]&&window||this,r=t.JSON,n=t.JSON3,i=!1,a=function r(n,i){n||(n=t.Object()),i||(i=t.Object());var a=n.Number||t.Number,s=n.String||t.String,o=n.Object||t.Object,c=n.Date||t.Date,l=n.SyntaxError||t.SyntaxError,u=n.TypeError||t.TypeError,d=n.Math||t.Math,p=n.JSON||t.JSON;if("object"==typeof p&&p)return i.stringify=p.stringify,i.parse=p.parse,i.runInContext=r,i;var f,g=o.prototype,h=g.toString,_=g.hasOwnProperty;function m(e,t){try{e()}catch(e){t&&t()}}var v=new c(-0xc782b5b800cec);function y(e){if(null!=y[e])return y[e];var t;if("bug-string-char-index"==e)t="a"!="a"[0];else if("json"==e)t=y("json-stringify")&&y("date-serialization")&&y("json-parse");else if("date-serialization"==e){if(t=y("json-stringify")&&v){var r=i.stringify;m(function(){t='"-271821-04-20T00:00:00.000Z"'==r(new c(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==r(new c(864e13))&&'"-000001-01-01T00:00:00.000Z"'==r(new c(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==r(new c(-1))})}}else{var n,o='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==e){var l="function"==typeof(r=i.stringify);l&&((n=function(){return 1}).toJSON=n,m(function(){l="0"===r(0)&&"0"===r(new a)&&'""'==r(new s)&&r(h)===f&&r(f)===f&&r()===f&&"1"===r(n)&&"[1]"==r([n])&&"[null]"==r([f])&&"null"==r(null)&&"[null,null,null]"==r([f,h,null])&&r({a:[n,!0,!1,null,"\0\b\n\f\r\t"]})==o&&"1"===r(null,n)&&"[\n 1,\n 2\n]"==r([1,2],null,1)},function(){l=!1})),t=l}if("json-parse"==e){var u,d=i.parse;"function"==typeof d&&m(function(){0!==d("0")||d(!1)||(n=d(o),(u=5==n.a.length&&1===n.a[0])&&(m(function(){u=!d('"\t"')}),u&&m(function(){u=1!==d("01")}),u&&m(function(){u=1!==d("1.")})))},function(){u=!1}),t=u}}return y[e]=!!t}if(m(function(){v=-109252==v.getUTCFullYear()&&0===v.getUTCMonth()&&1===v.getUTCDate()&&10==v.getUTCHours()&&37==v.getUTCMinutes()&&6==v.getUTCSeconds()&&708==v.getUTCMilliseconds()}),y["bug-string-char-index"]=y["date-serialization"]=y.json=y["json-stringify"]=y["json-parse"]=null,!y("json")){var b=y("bug-string-char-index"),w=function(t,r){var n,i,a,s=0;for(a in(n=function(){this.valueOf=0}).prototype.valueOf=0,i=new n)_.call(i,a)&&s++;return n=i=null,s?w=function(e,t){var r,n,i="[object Function]"==h.call(e);for(r in e)i&&"prototype"==r||!_.call(e,r)||(n="constructor"===r)||t(r);(n||_.call(e,r="constructor"))&&t(r)}:(i=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],w=function(t,r){var n,a,s="[object Function]"==h.call(t),o=!s&&"function"!=typeof t.constructor&&e[typeof t.hasOwnProperty]&&t.hasOwnProperty||_;for(n in t)s&&"prototype"==n||!o.call(t,n)||r(n);for(a=i.length;n=i[--a];)o.call(t,n)&&r(n)}),w(t,r)};if(!y("json-stringify")&&!y("date-serialization")){var S={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},k=function(e,t){return("000000"+(t||0)).slice(-e)},I=function(e){var t,r,n,i,a,s,o,c,l;if(v)t=function(e){r=e.getUTCFullYear(),n=e.getUTCMonth(),i=e.getUTCDate(),s=e.getUTCHours(),o=e.getUTCMinutes(),c=e.getUTCSeconds(),l=e.getUTCMilliseconds()};else{var u=d.floor,p=[0,31,59,90,120,151,181,212,243,273,304,334],f=function(e,t){return p[t]+365*(e-1970)+u((e-1969+(t=+(t>1)))/4)-u((e-1901+t)/100)+u((e-1601+t)/400)};t=function(e){for(i=u(e/864e5),r=u(i/365.2425)+1970-1;f(r+1,0)<=i;r++);for(n=u((i-f(r,0))/30.42);f(r,n+1)<=i;n++);i=1+i-f(r,n),s=u((a=(e%864e5+864e5)%864e5)/36e5)%24,o=u(a/6e4)%60,c=u(a/1e3)%60,l=a%1e3}}return(I=function(e){return e>-1/0&&e<1/0?(t(e),e=(r<=0||r>=1e4?(r<0?"-":"+")+k(6,r<0?-r:r):k(4,r))+"-"+k(2,n+1)+"-"+k(2,i)+"T"+k(2,s)+":"+k(2,o)+":"+k(2,c)+"."+k(3,l)+"Z",r=n=i=s=o=c=l=null):e=null,e})(e)};if(y("json-stringify")&&!y("date-serialization")){function B(e){return I(this)}var C=i.stringify;i.stringify=function(e,t,r){var n=c.prototype.toJSON;c.prototype.toJSON=B;var i=C(e,t,r);return c.prototype.toJSON=n,i}}else{var P=function(e){var t=e.charCodeAt(0);return S[t]||"\\u00"+k(2,t.toString(16))},T=/[\x00-\x1f\x22\x5c]/g,D=function(e){return T.lastIndex=0,'"'+(T.test(e)?e.replace(T,P):e)+'"'},O=function(e,t,r,n,i,a,s){var o,l,d,p,g,_,v,y,b;if(m(function(){o=t[e]}),"object"==typeof o&&o&&(o.getUTCFullYear&&"[object Date]"==h.call(o)&&o.toJSON===c.prototype.toJSON?o=I(o):"function"==typeof o.toJSON&&(o=o.toJSON(e))),r&&(o=r.call(t,e,o)),o==f)return o===f?o:"null";switch("object"==(l=typeof o)&&(d=h.call(o)),d||l){case"boolean":case"[object Boolean]":return""+o;case"number":case"[object Number]":return o>-1/0&&o<1/0?""+o:"null";case"string":case"[object String]":return D(""+o)}if("object"==typeof o){for(v=s.length;v--;)if(s[v]===o)throw u();if(s.push(o),p=[],y=a,a+=i,"[object Array]"==d){for(_=0,v=o.length;_<v;_++)g=O(_,o,r,n,i,a,s),p.push(g===f?"null":g);b=p.length?i?"[\n"+a+p.join(",\n"+a)+"\n"+y+"]":"["+p.join(",")+"]":"[]"}else w(n||o,function(e){var t=O(e,o,r,n,i,a,s);t!==f&&p.push(D(e)+":"+(i?" ":"")+t)}),b=p.length?i?"{\n"+a+p.join(",\n"+a)+"\n"+y+"}":"{"+p.join(",")+"}":"{}";return s.pop(),b}};i.stringify=function(t,r,n){var i,a,s,o;if(e[typeof r]&&r)if("[object Function]"==(o=h.call(r)))a=r;else if("[object Array]"==o){s={};for(var c,l=0,u=r.length;l<u;)c=r[l++],"[object String]"!=(o=h.call(c))&&"[object Number]"!=o||(s[c]=1)}if(n)if("[object Number]"==(o=h.call(n))){if((n-=n%1)>0)for(n>10&&(n=10),i="";i.length<n;)i+=" "}else"[object String]"==o&&(i=n.length<=10?n:n.slice(0,10));return O("",((c={})[""]=t,c),a,s,i,"",[])}}}if(!y("json-parse")){var E,N,j=s.fromCharCode,A={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},$=function(){throw E=N=null,l()},x=function(){for(var e,t,r,n,i,a=N,s=a.length;E<s;)switch(i=a.charCodeAt(E)){case 9:case 10:case 13:case 32:E++;break;case 123:case 125:case 91:case 93:case 58:case 44:return e=b?a.charAt(E):a[E],E++,e;case 34:for(e="@",E++;E<s;)if((i=a.charCodeAt(E))<32)$();else if(92==i)switch(i=a.charCodeAt(++E)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:e+=A[i],E++;break;case 117:for(t=++E,r=E+4;E<r;E++)(i=a.charCodeAt(E))>=48&&i<=57||i>=97&&i<=102||i>=65&&i<=70||$();e+=j("0x"+a.slice(t,E));break;default:$()}else{if(34==i)break;for(i=a.charCodeAt(E),t=E;i>=32&&92!=i&&34!=i;)i=a.charCodeAt(++E);e+=a.slice(t,E)}if(34==a.charCodeAt(E))return E++,e;$();default:if(t=E,45==i&&(n=!0,i=a.charCodeAt(++E)),i>=48&&i<=57){for(48==i&&(i=a.charCodeAt(E+1))>=48&&i<=57&&$(),n=!1;E<s&&(i=a.charCodeAt(E))>=48&&i<=57;E++);if(46==a.charCodeAt(E)){for(r=++E;r<s&&!((i=a.charCodeAt(r))<48||i>57);r++);r==E&&$(),E=r}if(101==(i=a.charCodeAt(E))||69==i){for(43!=(i=a.charCodeAt(++E))&&45!=i||E++,r=E;r<s&&!((i=a.charCodeAt(r))<48||i>57);r++);r==E&&$(),E=r}return+a.slice(t,E)}n&&$();var o=a.slice(E,E+4);if("true"==o)return E+=4,!0;if("fals"==o&&101==a.charCodeAt(E+4))return E+=5,!1;if("null"==o)return E+=4,null;$()}return"$"},L=function(e){var t,r;if("$"==e&&$(),"string"==typeof e){if("@"==(b?e.charAt(0):e[0]))return e.slice(1);if("["==e){for(t=[];"]"!=(e=x());)r?","==e?"]"==(e=x())&&$():$():r=!0,","==e&&$(),t.push(L(e));return t}if("{"==e){for(t={};"}"!=(e=x());)r?","==e?"}"==(e=x())&&$():$():r=!0,","!=e&&"string"==typeof e&&"@"==(b?e.charAt(0):e[0])&&":"==x()||$(),t[e.slice(1)]=L(x());return t}$()}return e},U=function(e,t,r){var n=R(e,t,r);n===f?delete e[t]:e[t]=n},R=function(e,t,r){var n,i=e[t];if("object"==typeof i&&i)if("[object Array]"==h.call(i))for(n=i.length;n--;)U(h,w,i);else w(i,function(e){U(i,e,r)});return r.call(e,t,i)};i.parse=function(e,t){var r,n;return E=0,N=""+e,r=L(x()),"$"!=x()&&$(),E=N=null,t&&"[object Function]"==h.call(t)?R(((n={})[""]=r,n),"",t):r}}}return i.runInContext=r,i}(t,t.JSON3={noConflict:function(){return i||(i=!0,t.JSON=r,t.JSON3=n,r=n=null),a}});t.JSON?(t.JSON.parse=a.parse,t.JSON.stringify=a.stringify):t.JSON={parse:a.parse,stringify:a.stringify}}.call(window),function(e){if(e.atob)try{e.atob(" ")}catch(n){e.atob=(t=e.atob,(r=function(e){return t(String(e).replace(/[\t\n\f\r ]+/g,""))}).original=t,r)}else{var t,r,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;e.btoa=function(e){for(var t,r,i,a,s="",o=0,c=(e=String(e)).length%3;o<e.length;){if((r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255||(a=e.charCodeAt(o++))>255)return"";s+=n.charAt((t=r<<16|i<<8|a)>>18&63)+n.charAt(t>>12&63)+n.charAt(t>>6&63)+n.charAt(63&t)}return c?s.slice(0,c-3)+"===".substring(c):s},e.atob=function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!i.test(e))return"";e+="==".slice(2-(3&e.length));for(var t,r,a,s="",o=0;o<e.length;)t=n.indexOf(e.charAt(o++))<<18|n.indexOf(e.charAt(o++))<<12|(r=n.indexOf(e.charAt(o++)))<<6|(a=n.indexOf(e.charAt(o++))),s+=64===r?String.fromCharCode(t>>16&255):64===a?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return s}}}(window);var i={setup:function(t){e=t},log:function(){(e||console&&console.log||function(){}).apply(null,arguments)}},a={get:function(e){return window.localStorage.getItem(e)},parse:function(e){var t;try{t=JSON.parse(a.get(e))||null}catch(e){i.log(e)}return t},set:function(e,t){try{window.localStorage.setItem(e,t)}catch(e){i.log(e)}},remove:function(e){window.localStorage.removeItem(e)},isSupport:function(){var e=!0;try{var t="__local_store_support__",r="testIsSupportStorage";a.set(t,r),a.get(t)!==r&&(e=!1),a.remove(t)}catch(t){e=!1}return e}};function s(e){return null!=e&&"[object Object]"==Object.prototype.toString.call(e)}var c=function(){var e=(new Date).getTime();return function(t){return Math.ceil((e=(9301*e+49297)%233280)/233280*t)}}();function l(){if("function"==typeof Uint32Array){var e="";if("undefined"!=typeof crypto?e=crypto:"undefined"!=typeof msCrypto&&(e=msCrypto),s(e)&&e.getRandomValues){var t=new Uint32Array(1);return e.getRandomValues(t)[0]/Math.pow(2,32)}}return c(1e19)/1e19}function u(e){var t=null;try{t=JSON.parse(e)}catch(e){}return t}function d(e,t){this.lockGetPrefix=e||"lock-get-prefix",this.lockSetPrefix=t||"lock-set-prefix"}function p(e){return"function"==typeof e||!(!e||"object"!=typeof e)&&p(e.listener)}function f(){this._events={}}function g(e){var t=e;try{t=decodeURIComponent(e)}catch(r){t=e}return t}function h(e){e=e||"";for(var t=function(){function e(){}return"function"!=typeof Object.create?(e.prototype=null,new e):Object.create(null)}(),r=e.substring(1).split("&"),n=0;n<r.length;n++){var i=r[n].indexOf("=");if(-1!==i){var a=r[n].substring(0,i),s=r[n].substring(i+1);a=g(a),s=g(s),"__proto__"!==a&&"constructor"!==a&&"prototype"!==a&&(t[a]=s)}}return t}function _(e){return"[object String]"==Object.prototype.toString.call(e)}function v(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}function y(e){var t=function(e){this._fields={Username:4,Password:5,Port:7,Protocol:2,Host:6,Path:8,URL:0,QueryString:9,Fragment:10},this._values={},this._regex=/^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/,void 0!==e&&this._parse(e)};return t.prototype.setUrl=function(e){this._parse(e)},t.prototype._initValues=function(){for(var e in this._fields)this._values[e]=""},t.prototype.addQueryString=function(e){if("object"!=typeof e)return!1;var t=this._values.QueryString||"";for(var r in e)t=new RegExp(r+"[^&]+").test(t)?t.replace(new RegExp(r+"[^&]+"),r+"="+e[r]):"&"===t.slice(-1)?t+r+"="+e[r]:""===t?r+"="+e[r]:t+"&"+r+"="+e[r];this._values.QueryString=t},t.prototype.getUrl=function(){var e="";return e+=this._values.Origin,e+=this._values.Port?":"+this._values.Port:"",e+=this._values.Path,(e+=this._values.QueryString?"?"+this._values.QueryString:"")+(this._values.Fragment?"#"+this._values.Fragment:"")},t.prototype._parse=function(e){this._initValues();var t=this._regex.exec(e);t||i.log("URLParser::_parse -> Invalid URL");var r=e.split("#"),n=r[0],a=r.slice(1).join("#");for(var s in t=this._regex.exec(n),this._fields)void 0!==t[this._fields[s]]&&(this._values[s]=t[this._fields[s]]);this._values.Hostname=this._values.Host.replace(/:\d+$/,""),this._values.Origin=this._values.Protocol+"://"+this._values.Hostname,this._values.Fragment=a},new t(e)}function b(e){var t,r={};if("function"==typeof window.URL&&function(){try{return"http://modernizr.com/"===new URL("http://modernizr.com/").href}catch(e){return!1}}())(r=new URL(e)).searchParams||(r.searchParams=(t=h(r.search),{get:function(e){return t[e]}}));else{if(_(e)||(e=String(e)),e=v(e),!1===/^https?:\/\/.+/.test(e))return void i.log("Invalid URL");var n=y(e);r.hash=n._values.Fragment,r.host=n._values.Host?n._values.Host+(n._values.Port?":"+n._values.Port:""):"",r.href=n._values.URL,r.password=n._values.Password,r.pathname=n._values.Path,r.port=n._values.Port,r.search=n._values.QueryString?"?"+n._values.QueryString:"",r.username=n._values.Username,r.hostname=n._values.Hostname,r.protocol=n._values.Protocol?n._values.Protocol+":":"",r.origin=n._values.Origin?n._values.Origin+(n._values.Port?":"+n._values.Port:""):"",r.searchParams=function(){var e=h("?"+n._values.QueryString);return{get:function(t){return e[t]}}}()}return r}d.prototype.get=function(e,t,r,i){if(!e)throw new Error("key is must");t=t||1e4,r=r||1e3,i=i||function(){};var s=this.lockGetPrefix+e,o=a.get(s),c=String(l());if(o&&(o=u(o)||{randomNum:0,expireTime:0}).expireTime>n())return i(null);a.set(s,JSON.stringify({randomNum:c,expireTime:n()+t})),setTimeout(function(){(o=u(a.get(s))||{randomNum:0,expireTime:0})&&o.randomNum===c?(i(a.get(e)),a.remove(e),a.remove(s)):i(null)},r)},d.prototype.set=function(e,t,r,i,s){if(!e||!t)throw new Error("key and val is must");r=r||1e4,i=i||1e3,s=s||function(){};var o=this.lockSetPrefix+e,c=a.get(o),d=String(l());if(c&&(c=u(c)||{randomNum:0,expireTime:0}).expireTime>n())return s({status:"fail",reason:"This key is locked"});a.set(o,JSON.stringify({randomNum:d,expireTime:n()+r})),setTimeout(function(){(c=u(a.get(o))||{randomNum:0,expireTime:0}).randomNum===d?a.set(e,t)&&s({status:"success"}):s({status:"fail",reason:"This key is locked"})},i)},f.prototype.on=function(e,t){if(!e||!t)return!1;if(!p(t))throw new Error("listener must be a function");this._events[e]=this._events[e]||[];var r="object"==typeof t;return this._events[e].push(r?t:{listener:t,once:!1}),this},f.prototype.prepend=function(e,t){if(!e||!t)return!1;if(!p(t))throw new Error("listener must be a function");this._events[e]=this._events[e]||[];var r="object"==typeof t;return this._events[e].unshift(r?t:{listener:t,once:!1}),this},f.prototype.prependOnce=function(e,t){return this.prepend(e,{listener:t,once:!0})},f.prototype.once=function(e,t){return this.on(e,{listener:t,once:!0})},f.prototype.off=function(e,t){var r=this._events[e];if(!r)return!1;if("number"==typeof t)r.splice(t,1);else if("function"==typeof t)for(var n=0,i=r.length;n<i;n++)r[n]&&r[n].listener===t&&r.splice(n,1);return this},f.prototype.emit=function(e,t){var r=this._events[e];if(!r)return!1;for(var n=0;n<r.length;n++){var i=r[n];i&&(i.listener.call(this,t||{}),i.once&&this.off(e,n))}return this},f.prototype.removeAllListeners=function(e){e&&this._events[e]?this._events[e]=[]:this._events={}},f.prototype.listeners=function(e){return e&&"string"==typeof e?this._events[e]:this._events};var w,S=(w=function(){for(var e=1*new Date,t=0;e==1*new Date;)t++;return e.toString(16)+t.toString(16)},function(){var e=String(screen.height*screen.width);e=e&&/\d{5,}/.test(e)?e.toString(16):String(31242*l()).replace(".","").slice(0,8);var t=w()+"-"+l().toString(16).replace(".","")+"-"+function(){var e,t,r=navigator.userAgent,n=[],i=0;function a(e,t){var r,i=0;for(r=0;r<t.length;r++)i|=n[r]<<8*r;return e^i}for(e=0;e<r.length;e++)t=r.charCodeAt(e),n.unshift(255&t),n.length>=4&&(i=a(i,n),n=[]);return n.length>0&&(i=a(i,n)),i.toString(16)}()+"-"+e+"-"+w();return t||(String(l())+String(l())+String(l())).slice(2,15)});function k(e){return!(!e||1!==e.nodeType)}function I(e){return void 0===e}function C(e){return Array.isArray&&r(C)?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function P(e){return new T(e)}var T=function(e){this.ele=e},D=function(e,t){for(var r=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&r.push(e);return r};function O(e,t,r,n){function i(e){return e&&(e.preventDefault=i.preventDefault,e.stopPropagation=i.stopPropagation,e._getPath=i._getPath),e}i._getPath=function(){return this.path||this.composedPath&&this.composedPath()||P(this.target).getParents()},i.preventDefault=function(){this.returnValue=!1},i.stopPropagation=function(){this.cancelBubble=!0},function(e,t,r){if(void 0===n&&"click"===t&&(n=!0),e&&e.addEventListener)e.addEventListener(t,function(e){e._getPath=i._getPath,r.call(this,e)},n);else{var a="on"+t,s=e[a];e[a]=function(e,t,r,n){return function(a){if(a=a||i(window.event)){a.target=a.srcElement;var s,o,c=!0;return"function"==typeof r&&(s=r(a)),o=t.call(e,a),"beforeunload"!==n?(!1!==s&&!1!==o||(c=!1),c):void 0}}}(e,r,s,t)}}.apply(null,arguments)}function E(e){var t="pushState"in window.history?"popstate":"hashchange";O(window,t,e)}function N(e){if(e)return void 0!==window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:null;if(void 0!==window.XMLHttpRequest)return new XMLHttpRequest;if(window.ActiveXObject)try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){i.log(e)}}}function j(e,t,r){if("object"==typeof e&&"number"==typeof e.length&&e.length>0)if(Array.prototype.forEach&&e.forEach)e.forEach(t,r);else for(var n=0;n<e.length;n++)t.call(r,e[n],n,e);else if("[object Object]"===Object.prototype.toString.call(e))for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(r,e[i],i,e)}function A(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];if("[object Object]"===Object.prototype.toString.call(r))for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&void 0!==r[n]&&(e[n]=r[n])}return e}function $(e){function t(e){if(!e)return"";try{return JSON.parse(e)}catch(e){return{}}}e.timeout=e.timeout||2e4,e.credentials=void 0===e.credentials||e.credentials;var r=N(e.cors);if(!r)return!1;e.type||(e.type=e.data?"POST":"GET");var n,a=(e=A({success:function(){},error:function(){}},e)).success,o=e.error;e.success=function(e){a(e),n&&(clearTimeout(n),n=null)},e.error=function(e){o(e),n&&(clearTimeout(n),n=null)},n=setTimeout(function(){!function(){try{r&&"object"==typeof r&&r.abort&&r.abort()}catch(e){i.log(e)}n&&(clearTimeout(n),n=null,e.error&&e.error(),r.onreadystatechange=null,r.onload=null,r.onerror=null)}()},e.timeout),"undefined"!=typeof XDomainRequest&&r instanceof XDomainRequest&&(r.onload=function(){e.success&&e.success(t(r.responseText)),r.onreadystatechange=null,r.onload=null,r.onerror=null},r.onerror=function(){e.error&&e.error(t(r.responseText),r.status),r.onreadystatechange=null,r.onerror=null,r.onload=null}),r.onreadystatechange=function(){try{4==r.readyState&&(r.status>=200&&r.status<300||304==r.status?e.success(t(r.responseText)):e.error(t(r.responseText),r.status),r.onreadystatechange=null,r.onload=null)}catch(e){r.onreadystatechange=null,r.onload=null}},r.open(e.type,e.url,!0);try{e.credentials&&(r.withCredentials=!0),s(e.header)&&j(e.header,function(e,t){r.setRequestHeader&&r.setRequestHeader(t,e)}),e.data&&(e.cors||r.setRequestHeader&&r.setRequestHeader("X-Requested-With","XMLHttpRequest"),"application/json"===e.contentType?r.setRequestHeader&&r.setRequestHeader("Content-type","application/json; charset=UTF-8"):r.setRequestHeader&&r.setRequestHeader("Content-type","application/x-www-form-urlencoded"))}catch(e){i.log(e)}r.send(e.data||null)}function x(e,t){var r=[];return null==e?r:Array.prototype.map&&e.map===Array.prototype.map?e.map(t):(j(e,function(e,n,i){r.push(t(e,n,i))}),r)}function L(e){var t=[];try{t=x(atob(e).split(""),function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})}catch(e){t=[]}try{return decodeURIComponent(t.join(""))}catch(e){return t.join("")}}function U(e){var t="";try{t=btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}catch(r){t=e}return t}T.prototype={addClass:function(e){return-1===(" "+this.ele.className+" ").indexOf(" "+e+" ")&&(this.ele.className=this.ele.className+(""===this.ele.className?"":" ")+e),this},removeClass:function(e){var t=" "+this.ele.className+" ";return-1!==t.indexOf(" "+e+" ")&&(this.ele.className=t.replace(" "+e+" "," ").slice(1,-1)),this},hasClass:function(e){return-1!==(" "+this.ele.className+" ").indexOf(" "+e+" ")},attr:function(e,t){return"string"==typeof e&&I(t)?this.ele.getAttribute(e):("string"==typeof e&&(t=String(t),this.ele.setAttribute(e,t)),this)},offset:function(){var e=this.ele.getBoundingClientRect();if(e.width||e.height){var t=this.ele.ownerDocument.documentElement;return{top:e.top+window.pageYOffset-t.clientTop,left:e.left+window.pageXOffset-t.clientLeft}}return{top:0,left:0}},getSize:function(){if(!window.getComputedStyle)return{width:this.ele.offsetWidth,height:this.ele.offsetHeight};try{var e=this.ele.getBoundingClientRect();return{width:e.width,height:e.height}}catch(e){return{width:0,height:0}}},getStyle:function(e){return this.ele.currentStyle?this.ele.currentStyle[e]:this.ele.ownerDocument.defaultView.getComputedStyle(this.ele,null).getPropertyValue(e)},wrap:function(e){var t=document.createElement(e);return this.ele.parentNode.insertBefore(t,this.ele),t.appendChild(this.ele),P(t)},getCssStyle:function(e){var t=this.ele.style.getPropertyValue(e);if(t)return t;var r=null;if("function"==typeof window.getMatchedCSSRules&&(r=window.getMatchedCSSRules(this.ele)),!r||!C(r))return null;for(var n=r.length-1;n>=0;n--)if(t=r[n].style.getPropertyValue(e))return t},sibling:function(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e},next:function(){return this.sibling(this.ele,"nextSibling")},prev:function(){return this.sibling(this.ele,"previousSibling")},siblings:function(){return D((this.ele.parentNode||{}).firstChild,this.ele)},children:function(){return D(this.ele.firstChild)},parent:function(){var e=this.ele.parentNode;return P(e=e&&11!==e.nodeType?e:null)},previousElementSibling:function(){var e=this.ele;if("previousElementSibling"in document.documentElement)return P(e.previousElementSibling);for(;e=e.previousSibling;)if(1===e.nodeType)return P(e);return P(null)},getSameTypeSiblings:function(){for(var e=this.ele,t=e.parentNode,r=e.tagName.toLowerCase(),n=[],i=0;i<t.children.length;i++){var a=t.children[i];1===a.nodeType&&a.tagName.toLowerCase()===r&&n.push(t.children[i])}return n},getParents:function(){try{var e=this.ele;if(!k(e))return[];var t=[e];if(null===e||null===e.parentElement)return[];for(;null!==e.parentElement;)e=e.parentElement,t.push(e);return t}catch(e){return[]}}};var R={get:function(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var i=r[n];" "==i.charAt(0);)i=i.substring(1,i.length);if(0==i.indexOf(t))return g(i.substring(t.length,i.length))}return null},set:function(e,t,r,n,i,a){var s=a,o="",c="",l="";if(0!==(r=null==r?73e3:r)){var u=new Date;"s"===String(r).slice(-1)?u.setTime(u.getTime()+1e3*Number(String(r).slice(0,-1))):u.setTime(u.getTime()+24*r*60*60*1e3),o="; expires="+u.toGMTString()}function d(e){return!!e&&e.replace(/\r\n/g,"")}n&&""!==n&&(l="; SameSite="+n),i&&(c="; secure");var p="",f="",g="";e&&(p=d(e)),t&&(f=d(t)),s&&(g=d(s)),p&&f&&(document.cookie=p+"="+encodeURIComponent(f)+o+"; path=/"+g+l+c)},remove:function(e,t){this.set(e,"1",-1,t)},isSupport:function(e,t,r,n,i){e=e||"cookie_support_test",t=t||"1";var a=this;return navigator.cookieEnabled&&(a.set(e,t,r,n,i),a.get(e)===t&&(a.remove(e),!0))}};function B(e){return j(Array.prototype.slice.call(arguments,1),function(t){for(var r in t)void 0!==t[r]&&void 0===e[r]&&(e[r]=t[r])}),e}function M(e){var t=e;try{t=decodeURI(e)}catch(r){t=e}return t}function H(e){return"[object Date]"==Object.prototype.toString.call(e)}function F(e){function t(e){return e<10?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+"."+t(e.getMilliseconds())}function z(e){return j(Array.prototype.slice.call(arguments,1),function(t){for(var r in t)void 0!==t[r]&&(s(t[r])&&s(e[r])?A(e[r],t[r]):e[r]=t[r])}),e}function J(e,t,r){var n=Object.prototype.hasOwnProperty;if(e.filter)return e.filter(t);for(var i=[],a=0;a<e.length;a++)if(n.call(e,a)){var s=e[a];t.call(r,s,a,e)&&i.push(s)}return i}function V(e,t,r){t=t||"domain_test";var n=function(e){return"string"==typeof e&&e.match(/^[a-zA-Z0-9\u4e00-\u9fa5\-\.]+$/)?e:""}(e=e||location.hostname),i=n.split(".");if(C(i)&&i.length>=2&&!/^(\d+\.)+\d+$/.test(n))for(var a="."+i.splice(i.length-1,1);i.length>0;)if(a="."+i.splice(i.length-1,1)+a,R.set(t,"true",0,null,r,"; domain="+a),-1!==document.cookie.indexOf(t+"=true"))return R.set(t,"true","-1s",null,r,"; domain="+a),a;return""}function W(e){if(!_(e))return null;var t,r=e.split(">");return(t=function e(t){var n,a=r.shift();if(!a)return t;try{n=function(e,t){var r;if("body"===(e=v(e)))return document.getElementsByTagName("body")[0];if(0===e.indexOf("#"))e=e.slice(1),r=document.getElementById(e);else if(e.indexOf(":nth-of-type")>-1){var n=e.split(":nth-of-type");if(!n[0]||!n[1])return null;var i=n[0],a=n[1].match(/\(([0-9]+)\)/);if(!a||!a[1])return null;var s=Number(a[1]);if(!(k(t)&&t.children&&t.children.length>0))return null;for(var o=t.children,c=0;c<o.length;c++)if(k(o[c])&&o[c].tagName.toLowerCase()===i&&0==--s){r=o[c];break}if(s>0)return null}return r||null}(a,t)}catch(e){i.log(e)}return n&&k(n)?e(n):null}())&&k(t)?t:null}function q(e,t){var r="",n="";return e.textContent?r=v(e.textContent):e.innerText&&(r=v(e.innerText)),r&&(r=r.replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)),n=r||"","input"!==t&&"INPUT"!==t||(n=e.value||""),n}function K(e,t){t&&"string"==typeof t||(t="hostname解析异常");var r=null;try{r=b(e).hostname}catch(e){i.log("getHostname传入的url参数不合法!")}return r||t}function Z(){try{var e=navigator.appVersion.match(/OS (\d+)[._](\d+)[._]?(\d+)?/);return e&&e[1]?Number.parseInt(e[1],10):""}catch(e){return""}}function X(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),e=g(e);var r=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null===r||r&&"string"!=typeof r[1]&&r[1].length?"":g(r[1])}function Y(e){var t={},r=e.split("?")[1]||"";return r&&(t=h("?"+r)),t}function G(){return void 0!==window.matchMedia||void 0!==window.msMatchMedia}function Q(){var e,t={},r=navigator.userAgent.toLowerCase();return(e=r.match(/ qq\/([\d.]+)/))?t.qqBuildinBrowser=Number(e[1].split(".")[0]):(e=r.match(/mqqbrowser\/([\d.]+)/))?t.qqBrowser=Number(e[1].split(".")[0]):(e=r.match(/opera.([\d.]+)/))?t.opera=Number(e[1].split(".")[0]):(e=r.match(/msie ([\d.]+)/))?t.ie=Number(e[1].split(".")[0]):(e=r.match(/edge.([\d.]+)/))?t.edge=Number(e[1].split(".")[0]):(e=r.match(/firefox\/([\d.]+)/))?t.firefox=Number(e[1].split(".")[0]):(e=r.match(/chrome\/([\d.]+)/))?t.chrome=Number(e[1].split(".")[0]):(e=r.match(/version\/([\d.]+).*safari/))?t.safari=Number(e[1].match(/^\d*.\d*/)):(e=r.match(/trident\/([\d.]+)/))&&(t.ie=11),t}function ee(e){return _(e)?M(e=v(e)):M(location.href)}function te(e){return _(e)?M(e=v(e)):M(location.pathname)}function re(e,t){return e.hasAttribute?e.hasAttribute(t):e.attributes?!(!e.attributes[t]||!e.attributes[t].specified):void 0}function ne(e,t){if("string"==typeof t)return re(e,t);if(C(t)){for(var r=!1,n=0;n<t.length;n++)if(re(e,t[n])){r=!0;break}return r}}function ie(e){if("string"!=typeof e)return 0;var t=0;if(0==e.length)return t;for(var r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}function ae(e){var t=9007199254740992,r=-9007199254740992,n=0;if(e.length>0)for(var i=e.split(""),a=0;a<i.length;a++){var s=i[a].charCodeAt(),o=31*n+s;if(o>t)for(n=r+n;(o=31*n+s)<r;)n=n/2+s;if(o<r)for(n=t+n;(o=31*n+s)>t;)n=n/2+s;n=31*n+s}return n}function se(e,t){var r=e.indexOf;if(r)return r.call(e,t);for(var n=0;n<e.length;n++)if(t===e[n])return n;return-1}var oe=Object.prototype.hasOwnProperty;function ce(e){return!(!e||!oe.call(e,"callee"))}function le(e){return"[object Boolean]"==Object.prototype.toString.call(e)}function ue(e){if(s(e)){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1}function de(e){return"string"==typeof e&&(!1!==/^https?:\/\/.+/.test(e)||(i.log("Invalid URL"),!1))}function pe(){return!!navigator.userAgent.match(/iPhone|iPad|iPod/i)}function fe(e){try{JSON.parse(e)}catch(e){return!1}return!0}function ge(e){return"[object Number]"==Object.prototype.toString.call(e)&&/[\d\.]+/.test(String(e))}function he(e){if(!s(e)||!_(e.callbackName))return i.log("JSONP 请求缺少 callbackName"),!1;e.success=r(e.success)?e.success:function(){},e.error=r(e.error)?e.error:function(){},e.data=e.data||"";var t=document.createElement("script"),n=document.getElementsByTagName("head")[0],a=null,o=!1;n.appendChild(t),ge(e.timeout)&&(a=setTimeout(function(){if(o)return!1;e.error("timeout"),window[e.callbackName]=function(){i.log("call jsonp error")},a=null,n.removeChild(t),o=!0},Math.min(e.timeout,3e4))),window[e.callbackName]=function(){clearTimeout(a),a=null,e.success.apply(null,arguments),window[e.callbackName]=function(){i.log("call jsonp error")},n.removeChild(t)};var c=encodeURIComponent(e.callbackName),l="";if(e.url.indexOf("?")>-1?e.url+="&callbackName="+c:e.url+="?callbackName="+c,s(e.data)){var u=[];j(e.data,function(e,t){u.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}),(l=u.join("&"))&&(e.url+="&"+l)}t.onerror=function(r){if(o)return!1;window[e.callbackName]=function(){i.log("call jsonp error")},clearTimeout(a),a=null,n.removeChild(t),e.error(r),o=!0},t.src=e.url}function _e(e){({visibleHandler:r(e.visible)?e.visible:function(){},hiddenHandler:r(e.hidden)?e.hidden:function(){},visibilityChange:null,hidden:null,isSupport:function(){return void 0!==document[this.hidden]},init:function(){void 0!==document.hidden?(this.hidden="hidden",this.visibilityChange="visibilitychange"):void 0!==document.mozHidden?(this.hidden="mozHidden",this.visibilityChange="mozvisibilitychange"):void 0!==document.msHidden?(this.hidden="msHidden",this.visibilityChange="msvisibilitychange"):void 0!==document.webkitHidden&&(this.hidden="webkitHidden",this.visibilityChange="webkitvisibilitychange"),this.listen()},listen:function(){if(this.isSupport()){var e=this;O(document,this.visibilityChange,function(){document[e.hidden]?e.hiddenHandler():e.visibleHandler()},1)}else O(window,"focus",this.visibleHandler),O(window,"blur",this.hiddenHandler)}}).init()}function me(e){e=A({success:function(){},error:function(){},appendCall:function(e){document.getElementsByTagName("head")[0].appendChild(e)}},e);var t=null;"css"===e.type&&((t=document.createElement("link")).rel="stylesheet",t.href=e.url),"js"===e.type&&((t=document.createElement("script")).async="async",t.setAttribute("charset","UTF-8"),t.src=e.url,t.type="text/javascript"),t.onload=t.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(e.success(),t.onload=t.onreadystatechange=null)},t.onerror=function(){e.error(),t.onerror=null},e.appendCall(t)}function ve(e,t){t="number"==typeof t?t:13;for(var r=(e=String(e)).split(""),n=0;n<r.length;n++)r[n].charCodeAt(0)<126&&(r[n]=String.fromCharCode((r[n].charCodeAt(0)+t)%126));return r.join("")}function ye(e){return ve(e=String(e),113)}function be(e){s(e)&&j(e,function(t,r){s(t)?be(e[r]):H(t)&&(e[r]=F(t))})}var we={isSupport:function(){var e=!0,t="testIsSupportStorage";try{sessionStorage&&sessionStorage.setItem?(sessionStorage.setItem("__session_storage_support__",t),sessionStorage.removeItem("__session_storage_support__",t),e=!0):e=!1}catch(t){e=!1}return e}};function Se(e){var t=document.createElement("style");t.type="text/css";try{t.appendChild(document.createTextNode(e))}catch(r){t.styleSheet.cssText=e}var r=document.getElementsByTagName("head")[0],n=document.getElementsByTagName("script")[0];r?r.children.length?r.insertBefore(t,r.children[0]):r.appendChild(t):n.parentNode.insertBefore(t,n)}function ke(e){var t=[];return null==e||j(e,function(e){t[t.length]=e}),t}function Ie(e){for(var t,r=[],n={},i=0;i<e.length;i++)(t=e[i])in n||(n[t]=!0,r.push(t));return r}var Ce={"+":"-","/":"_","=":"."},Pe={"-":"+",_:"/",".":"="};function Te(e,t,r){return r=r||0,e.substr(r,t.length)===t}function De(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e}var Oe={__proto__:null,noPrototypePollution:De,ConcurrentStorage:d,EventEmitter:f,URL:b,UUID:S,addEvent:O,addHashEvent:E,ajax:$,base64Decode:L,base64Encode:U,bindReady:function(e,t){t=t||window;var r=!1,n=!0,a=t.document,s=a.documentElement,o=a.addEventListener,c=o?"addEventListener":"attachEvent",l=o?"removeEventListener":"detachEvent",u=o?"":"on",d=function(n){"readystatechange"==n.type&&"complete"!=a.readyState||(("load"==n.type?t:a)[l](u+n.type,d,!1),!r&&(r=!0)&&e.call(t,n.type||n))},p=function(){try{s.doScroll("left")}catch(e){return void setTimeout(p,50)}d("poll")};if("complete"==a.readyState)e.call(t,"lazy");else{if(!o&&s.doScroll){try{n=!t.frameElement}catch(e){i.log(e)}n&&p()}a[c](u+"DOMContentLoaded",d,!1),a[c](u+"readystatechange",d,!1),t[c](u+"load",d,!1)}},cookie:R,coverExtend:B,decodeURI:M,decodeURIComponent:g,dfmapping:function(e){var t="t6KJCZa5pDdQ9khoEM3Tj70fbP2eLSyc4BrsYugARqFIw1mzlGNVXOHiWvxUn8",r=t.length-1,n={},i=0;for(i=0;i<t.length;i++)n[t.charAt(i)]=t.charAt(r-i);var a="";for(i=0;i<e.length;i++)e.charAt(i)in n?a+=n[e.charAt(i)]:a+=e.charAt(i);return a},each:j,encodeDates:function e(t){return j(t,function(r,n){H(r)?t[n]=F(r):s(r)&&(t[n]=e(r))}),t},extend:A,extend2Lev:z,filter:J,formatDate:F,formatJsonString:function(e){try{return JSON.stringify(e,null," ")}catch(t){return JSON.stringify(e)}},getCookieTopLevelDomain:V,getDomBySelector:W,getElementContent:q,getHostname:K,getIOSVersion:Z,getQueryParam:X,getQueryParamsFromUrl:Y,getRandom:l,getRandomBasic:c,getScreenOrientation:function(){var e=screen.msOrientation||screen.mozOrientation||(screen.orientation||{}).type,t="未取到值";if(e)t=e.indexOf("landscape")>-1?"landscape":"portrait";else if(G()){var r=window.matchMedia||window.msMatchMedia;r("(orientation: landscape)").matches?t="landscape":r("(orientation: portrait)").matches&&(t="portrait")}return t},getUA:Q,getURL:ee,getURLPath:te,getURLSearchParams:h,hasAttribute:re,hasAttributes:ne,hashCode:ie,hashCode53:ae,indexOf:se,inherit:function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},isArguments:ce,isArray:C,isBoolean:le,isDate:H,isElement:k,isEmptyObject:ue,isFunction:r,isHttpUrl:de,isIOS:pe,isJSONString:fe,isNumber:ge,isObject:s,isString:_,isSupportBeaconSend:function(){var e=!1;if("object"!=typeof navigator||"function"!=typeof navigator.sendBeacon)return e;var t=Q(),r=navigator.userAgent.toLowerCase();if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)){var n=(r.match(/os [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".").split(".");void 0===t.safari&&(t.safari=n[0]),n[0]&&(t.qqBuildinBrowser||t.qqBrowser)?e=!1:n[0]&&n[0]<13?(t.chrome>41||t.firefox>30||t.opera>25||t.safari>12)&&(e=!0):(t.chrome>41||t.firefox>30||t.opera>25||t.safari>11.3)&&(e=!0)}else(t.chrome>38||t.edge>13||t.firefox>30||t.opera>25||t.safari>11)&&(e=!0);return e},isSupportCors:function(){return void 0!==window.XMLHttpRequest&&("withCredentials"in new XMLHttpRequest||"undefined"!=typeof XDomainRequest)},isUndefined:I,jsonp:he,listenPageState:_e,loadScript:me,localStorage:a,logger:i,map:x,mediaQueriesSupported:G,now:n,removeScriptProtocol:function(e){if("string"!=typeof e)return"";for(var t=/^\s*javascript/i;t.test(e);)e=e.replace(t,"");return e},rot13defs:ye,rot13obfs:ve,ry:P,safeJSONParse:u,searchObjDate:be,sessionStorage:we,setCssStyle:Se,strToUnicode:function(e){if("string"!=typeof e)return i.log("转换unicode错误",e),e;for(var t="",r=0;r<e.length;r++)t+="\\"+e.charCodeAt(r).toString(16);return t},throttle:function(e,t,r){var i,a,s,o=null,c=0;r||(r={});var l=function(){c=!1===r.leading?0:n(),o=null,s=e.apply(i,a),o||(i=a=null)};return function(){var u=n();c||!1!==r.leading||(c=u);var d=t-(u-c);return i=this,a=arguments,d<=0||d>t?(o&&(clearTimeout(o),o=null),c=u,s=e.apply(i,a),o||(i=a=null)):o||!1===r.trailing||(o=setTimeout(l,d)),s}},toArray:function(e){return e?e.toArray?e.toArray():C(e)||ce(e)?Array.prototype.slice.call(e):ke(e):[]},trim:v,unique:Ie,urlParse:y,urlSafeBase64:{encode:function(e){return e.replace(/[+\/=]/g,function(e){return Ce[e]})},decode:function(e){return e.replace(/[-_.]/g,function(e){return Pe[e]})},trim:function(e){return e.replace(/[.=]{1,2}$/,"")},isBase64:function(e){return/^[A-Za-z0-9+\/]*[=]{0,2}$/.test(e)},isUrlSafeBase64:function(e){return/^[A-Za-z0-9_-]*[.]{0,2}$/.test(e)}},values:ke,xhr:N,startsWith:Te},Ee=[],Ne={appendWriter:function(e){Ee.push(e)},msg:function(){var e={module:"",level:"log",brand:"web-sdk",content:null};return e.content=Array.prototype.slice.call(arguments),{module:function(t){return _(t)&&(e.module=t),this},level:function(t){return _(t)&&(e.level=t),this},brand:function(t){return _(t)&&(e.brand=t),this},log:function(){if(e.content&&e.content.length)for(var t=0;t<Ee.length;t++)if("function"==typeof Ee[t])try{Ee[t].call(null,e)}catch(e){}return this}}}};function je(){Ne.msg.apply(Ne,arguments).log()}function Ae(){Ne.msg.apply(Ne,arguments).level("warn").log()}function $e(){Ne.msg.apply(Ne,arguments).level("error").log()}var xe={},Le={preset_properties:{search_keyword_baidu:!1,latest_utm:!0,latest_traffic_source_type:!0,latest_search_keyword:!0,latest_referrer:!0,latest_referrer_host:!1,latest_landing_page:!1,latest_wx_ad_click_id:void 0,url:!0,title:!0},encrypt_cookie:!1,enc_cookie:!1,img_use_crossorigin:!1,name:"sa",max_referrer_string_length:200,max_string_length:1024,max_id_length:255,max_key_length:100,cross_subdomain:!0,show_log:!1,is_debug:!1,source_channel:[],sdk_id:"",auto_init:!0,is_track_single_page:!1,is_single_page:!1,batch_send:!1,custom_server_url:"",source_type:{},callback_timeout:200,datasend_timeout:8e3,is_track_device_id:!1,ignore_oom:!0,app_js_bridge:!1,white_list:{}};Le.white_list[location.host]=b(location.href).hostname;var Ue="utm_source utm_medium utm_campaign utm_content utm_term",Re="1.27.11",Be="sensorsdata_domain_test",Me={LOGIN:"$identity_login_id"};function He(e){var t=xe.current_domain;switch(typeof t){case"function":var r=t();return""===r||""===v(r)?"url解析失败":-1!==r.indexOf(".")?r:"url解析失败";case"string":return""===t||""===v(t)?"url解析失败":-1!==t.indexOf(".")?t:"url解析失败";default:var n=V(null,Be,xe.is_secure_cookie);return""===e||""===n?"url解析失败":n}}var Fe={get:function(e){return R.get(e)},set:function(e,t,r,n){var i="";if(n=I(n)?xe.cross_subdomain:n){var a=He(location.href);"url解析失败"===a&&(a=""),i=a?"; domain="+a:""}return R.set(e,t,r,xe.set_cookie_samesite,xe.is_secure_cookie,i)},remove:function(e,t){return t=I(t)?xe.cross_subdomain:t,R.remove(e,t)},isSupport:function(e,t){return e=e||"sajssdk_2015_cookie_access_test",t=t||"1",R.isSupport(e,t,0,null,xe.is_secure_cookie)}};function ze(e,r){var n="";if(!1===xe.cross_subdomain){try{if(r);else{var i=location.host;I(t.para.white_list[i])||(n=t.para.white_list[i])}}catch(e){$e(e)}n="string"==typeof n&&""!==n?"sajssdk_2015_"+xe.sdk_id+e+"_"+n.replace(/\./g,"_"):"sajssdk_2015_root_"+xe.sdk_id+e}else n="sajssdk_2015_cross_"+xe.sdk_id+e;return n}function Je(){return Fe.isSupport()?null!==Fe.get("sensorsdata_is_new_user")||null!==Fe.get(ze("new_user")):null!==Ve.get(Ve.getNewUserFlagMemoryKey("new_user"))}Fe.getNewUser=Je;var Ve={data:{},get:function(e){var t=this.data[e];return void 0===t?null:void 0!==t._expirationTimestamp_?(new Date).getTime()>t._expirationTimestamp_?null:t.value:t},set:function(e,t,r){if(r){var n=new Date;t={value:t,_expirationTimestamp_:"s"===String(r).slice(-1)?n.getTime()+1e3*Number(String(r).slice(0,-1)):n.getTime()+24*r*60*60*1e3}}this.data[e]=t},getNewUserFlagMemoryKey:function(e){return"sajssdk_2015_"+xe.sdk_id+e}},We={checkIsAddSign:function(e){"track"===e.type&&(Je()?e.properties.$is_first_day=!0:e.properties.$is_first_day=!1)},is_first_visit_time:!1,is_page_first_visited:!1,checkIsFirstTime:function(e){"track"===e.type&&"$pageview"===e.event&&(this.is_first_visit_time?(e.properties.$is_first_time=!0,this.is_first_visit_time=!1):e.properties.$is_first_time=!1)},setDeviceId:function(){},storeInitCheck:function(){if(t.is_first_visitor){var e=new Date,r={h:23-e.getHours(),m:59-e.getMinutes(),s:59-e.getSeconds()};Fe.isSupport()?Fe.set(ze("new_user"),"1",3600*r.h+60*r.m+r.s+"s"):Ve.set(Ve.getNewUserFlagMemoryKey("new_user"),"1",3600*r.h+60*r.m+r.s+"s"),this.is_first_visit_time=!0,this.is_page_first_visited=!0}else Je()||(this.checkIsAddSign=function(e){"track"===e.type&&(e.properties.$is_first_day=!1)}),this.checkIsFirstTime=function(e){"track"===e.type&&"$pageview"===e.event&&(e.properties.$is_first_time=!1)}}};function qe(e,t,r){var n=!(!s(xe.heatmap)||!xe.heatmap.useCapture);return s(xe.heatmap)&&I(xe.heatmap.useCapture)&&"click"===t&&(n=!0),O(e,t,r,n)}var Ke=function(){this._events=[],this.pendingEvents=[]};function Ze(){var e=document.referrer;if(!e)return!1;try{var t=b(e).hostname;return t&&"baidu.com"===t.substring(t.length-9)}catch(e){return!1}}Ke.prototype={emit:function(e){var t=[].slice.call(arguments,1);j(this._events,function(r){r.type===e&&r.callback.apply(r.context,t)}),this.pendingEvents.push({type:e,data:t}),this.pendingEvents.length>20&&this.pendingEvents.shift()},on:function(e,t,n,i){r(t)&&(this._events.push({type:e,callback:t,context:n||this}),i=!1!==i,this.pendingEvents.length>0&&i&&j(this.pendingEvents,function(r){r.type===e&&t.apply(n,r.data)}))},tempAdd:function(e,t){if(t&&e)return this.emit(e,t)},isReady:function(){}};var Xe={data:{},id:function(){return this.data.id||(this.data.id=Ge()),this.data.id},type:function(){return this.data.type||(this.data.type=Ye()),this.data.type}};function Ye(){var e=Y(document.referrer);if(ue(e)||!e.eqid){var t=Y(location.href);return e.ck||t.utm_source?"baidu_sem_keyword_id":"baidu_other_keyword_id"}return"baidu_seo_keyword_id"}function Ge(){var e=Y(document.referrer);return ue(e)||!e.eqid?S().replace(/-/g,""):e.eqid}function Qe(e,t){return _(e=e||document.referrer)?(0!==(e=M(e=v(e))).indexOf("https://www.baidu.com/")||t||(e=e.split("?")[0]),_(e=e.slice(0,xe.max_referrer_string_length))?e:""):"取值异常_referrer异常_"+String(e)}function et(e){if(""===(e=e||document.referrer))return!0;var t=V(null,Be,xe.is_secure_cookie),r=K(e);return-1===(r="."+r).indexOf(t)&&""!==t}function tt(e,t){e=e||document.referrer;var r=xe.source_type.keyword;if(document&&_(e)){if(0===e.indexOf("http")){var n=rt(e),i=Y(e);if(ue(i))return xe.preset_properties.search_keyword_baidu&&Ze()?void 0:"未取到值";var a=null;for(var o in r)if(n===o&&s(i))if(C(a=r[o]))for(o=0;o<a.length;o++){var c=i[a[o]];if(c)return t?{active:c}:c}else if(i[a])return t?{active:i[a]}:i[a];return xe.preset_properties.search_keyword_baidu&&Ze()?void 0:"未取到值"}return""===e?"未取到值_直接打开":"未取到值_非http的url"}return"取值异常_referrer异常_"+String(e)}function rt(e){var t=K(e);if(!t||"hostname解析异常"===t)return"";var r={baidu:[/^.*\.baidu\.com$/],bing:[/^.*\.bing\.com$/],google:[/^www\.google\.com$/,/^www\.google\.com\.[a-z]{2}$/,/^www\.google\.[a-z]{2}$/],sm:[/^m\.sm\.cn$/],so:[/^.+\.so\.com$/],sogou:[/^.*\.sogou\.com$/],yahoo:[/^.*\.yahoo\.com$/]};for(var n in r)for(var i=r[n],a=0,s=i.length;a<s;a++)if(i[a].test(t))return n;return"未知搜索引擎"}var nt={distinct_id:function(){},jssdkDebug:function(){},_sendDebug:function(e){},apph5:function(e){var t="app_h5打通失败-",r={1:t+"use_app_track为false",2:t+"Android或者iOS,没有暴露相应方法",3.1:t+"Android校验server_url失败",3.2:t+"iOS校验server_url失败",4.1:t+"H5 校验 iOS server_url 失败",4.2:t+"H5 校验 Android server_url 失败"},n=e.output,i=e.step,a=e.data||"";"all"!==n&&"console"!==n||je(r[i]),("all"===n||"code"===n)&&s(xe.is_debug)&&xe.is_debug.apph5&&(a.type&&"profile"===a.type.slice(0,7)||(a.properties._jssdk_debug_info="apph5-"+String(i)))},defineMode:function(e){var t={1:{title:"当前页面无法进行可视化全埋点",message:"App SDK 与 Web JS SDK 没有进行打通,请联系贵方技术人员修正 App SDK 的配置,详细信息请查看文档。",link_text:"",link_url:""},2:{title:"当前页面无法进行可视化全埋点",message:"App SDK 与 Web JS SDK 没有进行打通,请联系贵方技术人员修正 Web JS SDK 的配置,详细信息请查看文档。",link_text:"",link_url:""},3:{title:"当前页面无法进行可视化全埋点",message:"Web JS SDK 没有开启全埋点配置,请联系贵方工作人员修正 SDK 的配置,详细信息请查看文档。",link_text:"",link_url:""},4:{title:"当前页面无法进行可视化全埋点",message:"Web JS SDK 配置的数据校验地址与 App SDK 配置的数据校验地址不一致,请联系贵方工作人员修正 SDK 的配置,详细信息请查看文档。",link_text:"",link_url:""}};return!(!e||!t[e])&&t[e]},protocol:{protocolIsSame:function(e,t){try{if(b(e).protocol!==b(t).protocol)return!1}catch(e){return Ae("不支持 _.URL 方法"),!1}return!0},serverUrl:function(){_(xe.server_url)&&""!==xe.server_url&&!this.protocolIsSame(xe.server_url,location.href)&&Ae("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。\n因为:1、https 下面发送 http 的图片请求会失败。2、http 页面使用 https + ajax 方式发数据,在 ie9 及以下会丢失数据。")},ajax:function(e){if(e===xe.server_url)return!1;_(e)&&""!==e&&!this.protocolIsSame(e,location.href)&&Ae("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。因为 http 页面使用 https + ajax 方式发数据,在 ie9 及以下会丢失数据。")}}},it={initPage:function(){var e=Qe(),t=ee(),r=He(t);r||nt.jssdkDebug("url_domain异常_"+t+"_"+r),this.pageProp={referrer:e,referrer_host:e?K(e):"",url:t,url_host:K(t,"url_host取值异常"),url_domain:r}},pageProp:{},campaignParams:function(){return t.kit.getUtmData()},campaignParamsStandard:function(e,t){e=e||"",t=t||"";var r=it.campaignParams(),n={},i={};return j(r,function(r,a,s){-1!==(" "+Ue+" ").indexOf(" "+a+" ")?n[e+a]=s[a]:i[t+a]=s[a]}),{$utms:n,otherUtms:i}},properties:function(){var e=window.innerHeight||document.documentElement.clientHeight||document.body&&document.body.clientHeight||0,t=window.innerWidth||document.documentElement.clientWidth||document.body&&document.body.clientWidth||0;return{$timezone_offset:(new Date).getTimezoneOffset(),$screen_height:Number(screen.height)||0,$screen_width:Number(screen.width)||0,$viewport_height:e,$viewport_width:t,$lib:"js",$lib_version:Re}},currentProps:{},register:function(e){A(it.currentProps,e)}};function at(){function e(e,t){for(var r=0;r<e.length;r++)if(-1!==t.split("?")[0].indexOf(e[r]))return!0}var t="("+xe.source_type.utm.join("|")+")\\=[^&]+",r=xe.source_type.search,n=xe.source_type.social,i=document.referrer||"",a=it.pageProp.url;if(a){var s=a.match(new RegExp(t));return s&&s[0]?"付费广告流量":e(r,i)?"自然搜索流量":e(n,i)?"社交网站流量":""===i?"直接流量":"引荐流量"}return"获取url异常"}function st(e){var t=X(e,"gdt_vid"),r=X(e,"hash_key"),n=X(e,"callbacks"),i={click_id:"",hash_key:"",callbacks:""};return _(t)&&t.length&&(i.click_id=16==t.length||18==t.length?t:"参数解析不合法",_(r)&&r.length&&(i.hash_key=r),_(n)&&n.length&&(i.callbacks=n)),i}function ot(e){var t=e.properties,n=JSON.parse(JSON.stringify(e));s(t)&&j(t,function(e,i){if(r(e))try{t[i]=e(n),r(t[i])&&(Ae("您的属性- "+i+" 格式不满足要求,我们已经将其删除"),delete t[i])}catch(e){delete t[i],Ae("您的属性- "+i+" 抛出了异常,我们已经将其删除")}})}function ct(e){if(s(e)&&e.$option){var t=e.$option;return delete e.$option,t}return{}}function lt(e){var t={};return j(e,function(e,r){null!=e&&(t[r]=e)}),t}function ut(e){if(!k(e.target))return!1;var t=e.target,r=_(t.tagName)?t.tagName.toLowerCase():"unknown",n={};return n.$element_type=r,n.$element_name=t.getAttribute("name"),n.$element_id=t.getAttribute("id"),n.$element_class_name=_(t.className)?t.className:null,n.$element_target_url=t.getAttribute("href"),n.$element_content=dt(t,r),(n=lt(n)).$url=ee(),n.$url_path=te(),n.$title=document.title,n}function dt(e,t){return _(t)&&"input"===t.toLowerCase()?(n=e,i=xe.heatmap&&r(xe.heatmap.collect_input)&&xe.heatmap.collect_input(n),("button"===n.type||"submit"===n.type||i)&&n.value||""):q(e,t);var n,i}function pt(e){return nt.protocol.ajax(e.url),$(e)}function ft(e,t){if("string"==typeof e&&(e=v(e))&&("://"===e.slice(0,3)?e=location.protocol.slice(0,-1)+e:"//"===e.slice(0,2)?e=location.protocol+e:"http"!==e.slice(0,4)&&(e="")),C(e)&&e.length)for(var r=0;r<e.length;r++)/sa\.gif[^\/]*$/.test(e[r])||(e[r]=e[r].replace(/\/sa$/,"/sa.gif").replace(/(\/sa)(\?[^\/]+)$/,"/sa.gif$2"));else/sa\.gif[^\/]*$/.test(e)||"string"!=typeof e||(e=e.replace(/\/sa$/,"/sa.gif").replace(/(\/sa)(\?[^\/]+)$/,"/sa.gif$2"));return t&&"string"==typeof t&&(e=t),e}function gt(e){_(e)||(e=JSON.stringify(e));var t=U(e),r="crc="+ie(t);return"data="+encodeURIComponent(t)+"&ext="+encodeURIComponent(r)}var ht={},_t=new f;function mt(e,t){var r=[];"string"==typeof e&&e in ht.EVENT_LIST&&(r=ht.EVENT_LIST[e],ht[r[0]].on(r[1],t))}ht.spa=_t,ht.sdk=new f,ht.data=new f,ht.initSystemEvent=function(){var e,t,n,i,a;e=function(e){_t.emit("switch",e)},n=location.href,i=window.history.pushState,a=window.history.replaceState,r(window.history.pushState)&&(window.history.pushState=function(){i.apply(window.history,arguments),e(n),n=location.href}),r(window.history.replaceState)&&(window.history.replaceState=function(){a.apply(window.history,arguments),e(n),n=location.href}),t=window.document.documentMode?"hashchange":i?"popstate":"hashchange",O(window,t,function(){e(n),n=location.href})},ht.EVENT_LIST={spaSwitch:["spa","switch"],sdkBeforeInit:["sdk","beforeInit"],sdkInitPara:["sdk","initPara"],sdkAfterInitPara:["sdk","afterInitPara"],sdkInitAPI:["sdk","initAPI"],sdkAfterInitAPI:["sdk","afterInitAPI"],sdkAfterInit:["sdk","afterInit"],sdkReady:["sdk","ready"],dataSendSuccess:["data","sendSuccess"],dataSendFail:["data","sendFail"]};var vt=function(e){this.callback=e.callback,this.server_url=e.server_url,this.data=e.data,this.origin_data=e.origin_data};function yt(){this.sendTimeStamp=0,this.timer=null,this.serverUrl="",this.hasTabStorage=!1}vt.prototype.start=function(){var e=this,t=new Date;pt({url:this.server_url,type:"POST",data:e.data,credentials:!1,timeout:xe.datasend_timeout,cors:!0,success:function(r,n){ht.data.emit("sendSuccess",{status:String(n),resText:r,type:"ajax_single",timeout_config:xe.datasend_timeout,request_timeout:new Date-t,data:e.origin_data}),e.end()},error:function(r,n){ht.data.emit("sendFail",{status:String(n),resText:r,type:"ajax_single",timeout_config:xe.datasend_timeout,request_timeout:new Date-t,data:e.origin_data}),e.end()}})},vt.prototype.end=function(){if(this.callback){if(je("warning: sdk callback is deprecated."),!r(this.callback))return void je("error: sdk callback must be function.");this.callback()}},yt.prototype={batchInterval:function(){""===this.serverUrl&&this.getServerUrl(),this.hasTabStorage||(this.generateTabStorage(),this.hasTabStorage=!0);var e=this;e.timer=setTimeout(function(){e.updateExpireTime(),e.recycle(),e.send(),clearTimeout(e.timer),e.batchInterval()},xe.batch_send.send_interval)},getServerUrl:function(){if(!(_(xe.server_url)&&""!==xe.server_url||C(xe.server_url)&&xe.server_url.length))return $e("当前 server_url 为空或不正确,只在控制台打印日志,network 中不会发数据,请配置正确的 server_url!");this.serverUrl=C(xe.server_url)?xe.server_url[0]:xe.server_url},send:function(){if(this.sendTimeStamp&&n()-this.sendTimeStamp<xe.batch_send.send_interval)return!1;var e=a.get(this.tabKey);if(e){this.sendTimeStamp=n();var r=Ie((e=u(e)||this.generateTabStorageVal()).data);if(r.length){for(var i=[],s=0;s<r.length;s++){var o=t.store.readObjectVal(r[s]);o&&(o._flush_time=(new Date).getTime(),i.push(o))}i.length&&this.request(i,e.data)}}},updateExpireTime:function(){var e=a.get(this.tabKey);e&&((e=u(e)||this.generateTabStorageVal()).expireTime=n()+2*xe.batch_send.send_interval,e.serverUrl=this.serverUrl,a.set(this.tabKey,JSON.stringify(e)))},request:function(e,t){var r=this,n=new Date;pt({url:this.serverUrl,type:"POST",data:"data_list="+encodeURIComponent(U(JSON.stringify(e))),credentials:!1,timeout:xe.batch_send.datasend_timeout,cors:!0,success:function(i,a){ht.data.emit("sendSuccess",{status:String(a),resText:i,type:"ajax_batch",timeout_config:xe.batch_send.datasend_timeout,request_timeout:new Date-n,data:e}),r.remove(t),r.sendTimeStamp=0},error:function(t,i){ht.data.emit("sendFail",{status:String(i),resText:t,type:"ajax_batch",timeout_config:xe.batch_send.datasend_timeout,request_timeout:new Date-n,data:e}),r.sendTimeStamp=0}})},remove:function(e){var t=a.get(this.tabKey);if(t){for(var r=(u(t)||this.generateTabStorageVal()).data,n=0;n<e.length;n++){var i=se(r,e[n]);i>-1&&r.splice(i,1),a.remove(e[n])}r=Ie(r),a.set(this.tabKey,JSON.stringify(this.generateTabStorageVal(r)))}},add:function(e){var r="sawebjssdk-"+String(l()),i=a.get(this.tabKey);null===i?(this.tabKey="tab-sawebjssdk-"+String(l()),i=this.generateTabStorageVal()):i=u(i)||this.generateTabStorageVal(),i.data.push(r),i.expireTime=n()+2*xe.batch_send.send_interval,a.set(this.tabKey,JSON.stringify(i)),t.store.saveObjectVal(r,e),"track_signup"!==e.type&&"$pageview"!==e.event||this.sendImmediately()},generateTabStorage:function(){this.tabKey="tab-sawebjssdk-"+String(l()),a.set(this.tabKey,JSON.stringify(this.generateTabStorageVal()))},generateTabStorageVal:function(e){return{data:e=e||[],expireTime:n()+2*xe.batch_send.send_interval,serverUrl:this.serverUrl}},sendImmediately:function(){this.send()},recycle:function(){for(var e={},t=0;t<localStorage.length;t++){var r=localStorage.key(t),i=this;if(0===r.indexOf("tab-sawebjssdk-")){for(var s=u(a.get(r))||this.generateTabStorageVal(),o=0;o<s.data.length;o++)e[s.data[o]]=!0;r!==i.tabKey&&n()>s.expireTime&&this.serverUrl===s.serverUrl&&new d("sajssdk-lock-get-").get(r,1e4,1e3,function(e){if(e){null===a.get(i.tabKey)&&i.generateTabStorage();var t=u(e)||i.generateTabStorageVal(),r=u(a.get(i.tabKey))||i.generateTabStorageVal();r.data=Ie(r.data.concat(t.data)),a.set(i.tabKey,JSON.stringify(r))}})}else if(0===r.indexOf("sajssdk-lock-get-")){var c=u(a.get(r))||{expireTime:0};n()-c.expireTime>1e4&&a.remove(r)}}for(var l=0;l<localStorage.length;l++){var p=localStorage.key(l);0!==p.indexOf("sawebjssdk-")||e[p]||a.remove(p)}}};var bt=function(e){this.callback=e.callback,this.server_url=e.server_url,this.data=e.data};bt.prototype.start=function(){var e=this;"object"==typeof navigator&&"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(this.server_url,this.data),setTimeout(function(){e.end()},40)},bt.prototype.end=function(){if(this.callback){if(je("warning: sdk callback is deprecated."),!r(this.callback))return void je("error: sdk callback must be function.");this.callback()}};var wt=function(e){this.callback=e.callback,this.img=document.createElement("img"),this.img.width=1,this.img.height=1,xe.img_use_crossorigin&&(this.img.crossOrigin="anonymous"),this.server_url=e.data};wt.prototype.start=function(){var e=this;xe.ignore_oom&&(this.img.onload=function(){this.onload=null,this.onerror=null,this.onabort=null,e.end()},this.img.onerror=function(){this.onload=null,this.onerror=null,this.onabort=null,e.end()},this.img.onabort=function(){this.onload=null,this.onerror=null,this.onabort=null,e.end()}),this.img.src=this.server_url},wt.prototype.lastClear=function(){void 0!==Q().ie?this.img.src="about:blank":this.img.src=""},wt.prototype.end=function(){if(this.callback){if(je("warning: sdk callback is deprecated."),!r(this.callback))return void je("error: sdk callback must be function.");this.callback()}self.lastClear&&self.lastClear()};var St={__proto__:null,addEvent:qe,EventEmitterSa:Ke,cookie:Fe,info:it,getReferrer:Qe,getCurrentDomain:He,isBaiduTraffic:Ze,getReferrerEqid:Ge,getReferrerEqidType:Ye,getBaiduKeyword:Xe,isReferralTraffic:et,getKeywordFromReferrer:tt,getReferSearchEngine:rt,getSourceFromReferrer:at,getWxAdIdFromUrl:st,parseSuperProperties:ot,searchConfigData:ct,strip_empty_properties:lt,getEleInfo:ut,getElementContent:dt,ajax:pt,optimizeServerUrl:ft,encodeTrackData:gt,AjaxSend:vt,BatchSend:yt,BeaconSend:bt,ImageSend:wt},kt=new Ke,It={requests:[],_sessionState:{},_state:{distinct_id:"",first_id:"",props:{},identities:{}},getProps:function(){return this._state.props||{}},getSessionProps:function(){},getOriginDistinctId:function(){return this._state._distinct_id||this._state.distinct_id},getOriginUnionId:function(e){var t={},r=(e=e||this._state)._first_id||e.first_id,n=e._distinct_id||e.distinct_id;return r&&n?(t.login_id=n,t.anonymous_id=r):t.anonymous_id=n,t},getIdentities:function(){var e=JSON.parse(JSON.stringify(this._state.identities));return e.$identity_anonymous_id=this.getAnonymousId(),e},getAnonymousId:function(){return It._state._first_id||It._state.first_id||It._state._distinct_id||It._state.distinct_id},getDistinctId:function(){var e=this.getUnionId();return e.login_id||e.anonymous_id},getUnionId:function(e){var t=this.getOriginUnionId(e);return t.login_id&&this._state.history_login_id&&this._state.history_login_id.name&&this._state.history_login_id.name!==Me.LOGIN&&(t.login_id=this._state.history_login_id.name+"+"+t.login_id),t},getFirstId:function(){return this._state._first_id||this._state.first_id},initSessionState:function(){},setOnce:function(e,t){e in this._state||this.set(e,t)},set:function(e,t){this._state=this._state||{};var r=this._state.distinct_id;this._state[e]=t,"first_id"===e?delete this._state._first_id:"distinct_id"===e&&delete this._state._distinct_id,this.save(),"distinct_id"===e&&r&&kt.tempAdd("changeDistinctId",t)},change:function(e,t){this._state["_"+e]=t},setSessionProps:function(){t.log("initSessionState 方法已经弃用,请不要使用该功能,如有需求联系技术顾问")},setSessionPropsOnce:function(){t.log("initSessionState 方法已经弃用,请不要使用该功能,如有需求联系技术顾问")},setProps:function(e,r){var n={};for(var i in n=r?e:A(this._state.props||{},e))"string"==typeof n[i]&&(n[i]=n[i].slice(0,t.para.max_referrer_string_length));this.set("props",n)},setPropsOnce:function(e){var t=this._state.props||{};B(t,e),this.set("props",t)},clearAllProps:function(e){var t;if(C(e)&&e.length>0)for(t=0;t<e.length;t++)_(e[t])&&-1===e[t].indexOf("latest_")&&s(this._state.props)&&e[t]in this._state.props&&delete this._state.props[e[t]];else if(s(this._state.props))for(t in this._state.props)1!==t.indexOf("latest_")&&delete this._state.props[t];this.sessionSave({}),this.save()},sessionSave:function(){t.log("initSessionState 方法已经弃用,请不要使用该功能,如有需求联系技术顾问")},save:function(){var e=JSON.parse(JSON.stringify(this._state));delete e._first_id,delete e._distinct_id,e.identities&&(e.identities=U(JSON.stringify(e.identities)));var r=JSON.stringify(e);t.para.encrypt_cookie&&(r=t.kit.userEncrypt(r)),Fe.set(this.getCookieName(),r,360,t.para.cross_subdomain)},getCookieName:function(){var e="";if(!1===t.para.cross_subdomain){try{var r=location.host;I(t.para.white_list[r])||(e=t.para.white_list[r])}catch(e){Ae(e)}e="string"==typeof e&&""!==e?"sa_jssdk_2015_"+t.para.sdk_id+e.replace(/\./g,"_"):"sa_jssdk_2015_root"+t.para.sdk_id}else e="sensorsdata2015jssdkcross"+t.para.sdk_id;return e},init:function(){this.initSessionState();var e,r,n=S();Fe.isSupport()&&(e=Fe.get(this.getCookieName()),r=u(e=t.kit.userDecryptIfNeeded(e))),Fe.isSupport()&&null!==e&&fe(e)&&s(r)&&(!s(r)||r.distinct_id)?(It._state=A(function(e){var t;e.identities&&(0===e.identities.indexOf("\n/")?e.identities=u(ye(e.identities)):e.identities=u(L(e.identities)));var r=It.getOriginUnionId(e);e.identities&&s(e.identities)&&!ue(e.identities)||(e.identities={},e.identities.$identity_cookie_id=S()),e.history_login_id=e.history_login_id||{};var n=e.history_login_id.name;if(r.login_id)if(n&&e.identities.hasOwnProperty(n)){if(e.identities[n]!==r.login_id){for(t in e.identities[n]=r.login_id,e.identities)e.identities.hasOwnProperty(t)&&"$identity_cookie_id"!==t&&t!==n&&delete e.identities[t];e.history_login_id.value=r.login_id}}else{var i=n||Me.LOGIN;for(t in e.identities[i]=r.login_id,e.identities)e.identities.hasOwnProperty(t)&&"$identity_cookie_id"!==t&&t!==i&&delete e.identities[t];e.history_login_id={name:i,value:r.login_id}}else{if(e.identities.hasOwnProperty("$identity_login_id")||e.identities.hasOwnProperty(n))for(t in e.identities)e.identities.hasOwnProperty(t)&&"$identity_cookie_id"!==t&&"$identity_anonymous_id"!==t&&delete e.identities[t];e.history_login_id={name:"",value:""}}return e}(r)),It.save()):(t.is_first_visitor=!0,function(e){It.set("distinct_id",e),It.set("identities",{$identity_cookie_id:e}),It.set("history_login_id",{name:"",value:""})}(n)),We.setDeviceId(n,this),We.storeInitCheck()},saveObjectVal:function(e,r){_(r)||(r=JSON.stringify(r)),1==t.para.encrypt_cookie&&(r=t.kit.userEncrypt(r)),a.set(e,r)},readObjectVal:function(e){var r=a.get(e);return r?u(r=t.kit.userDecryptIfNeeded(r)):null}},Ct={string:function(e){Ae(e+" must be string")},emptyString:function(e){Ae(e+"'s is empty")},regexTest:function(e){Ae(e+" is invalid")},idLength:function(e){Ae(e+" length is longer than "+xe.max_id_length)},keyLength:function(e){Ae(e+" length is longer than "+xe.max_key_length)},stringLength:function(e){Ae(e+" length is longer than "+xe.max_string_length)},voidZero:function(e){Ae(e+"'s is undefined")},reservedLoginId:function(e){Ae(e+" is invalid")},reservedBind:function(e){Ae(e+" is invalid")},reservedUnbind:function(e){Ae(e+" is invalid")}},Pt={regName:/^((?!^distinct_id$|^original_id$|^time$|^properties$|^id$|^first_id$|^second_id$|^users$|^events$|^event$|^user_id$|^date$|^datetime$|^user_tag.*|^user_group.*)[a-zA-Z_$][a-zA-Z\d_$]*)$/i,loginIDReservedNames:["$identity_anonymous_id","$identity_cookie_id"],bindReservedNames:["$identity_login_id","$identity_anonymous_id","$identity_cookie_id"],unbindReservedNames:["$identity_anonymous_id",Me.LOGIN],string:function(e){return!!_(e)},emptyString:function(e){return!(!_(e)||0===v(e).length)},regexTest:function(e){return!(!_(e)||!this.regName.test(e))},idLength:function(e){return!(!_(e)||e.length>xe.max_id_length)},keyLength:function(e){return!(!_(e)||e.length>xe.max_key_length)},stringLength:function(e){return!(!_(e)||e.length>xe.max_string_length)},voidZero:function(e){return void 0!==e},reservedLoginId:function(e){return!(se(this.loginIDReservedNames,e)>-1)},reservedUnbind:function(e){return!(se(this.unbindReservedNames,e)>-1)},reservedBind:function(e){var t=It._state.history_login_id;return!(t&&t.name&&t.name===e||se(this.bindReservedNames,e)>-1)}},Tt={distinct_id:{rules:["string","emptyString","idLength"],onComplete:function(e,t,n){return!e&&("emptyString"===n&&(t="Id"),r(Ct[n])&&Ct[n](t),"idLength"===n)||e}},event:{rules:["string","emptyString","keyLength","regexTest"],onComplete:function(e,t,n){return e||("emptyString"===n&&(t="eventName"),r(Ct[n])&&Ct[n](t)),!0}},propertyKey:{rules:["string","emptyString","keyLength","regexTest"],onComplete:function(e,t,n){return e||("emptyString"===n&&(t="Property key"),r(Ct[n])&&Ct[n](t)),!0}},propertyValue:{rules:["voidZero"],onComplete:function(e,t,n){return e||r(Ct[n])&&Ct[n]("Property Value"),!0}},properties:function(e){return s(e)?j(e,function(e,t){Dt({propertyKey:t}),Dt({propertyValue:e},function(e,n,i){return e||(n=t+"'s Value",r(Ct[i])&&Ct[i](n)),!0})}):Pt.voidZero(e)&&Ae("properties可以没有,但有的话必须是对象"),!0},propertiesMust:function(e){return void 0!==e&&s(e)&&!ue(e)?this.properties.call(this,e):Ae("properties必须是对象"),!0},item_type:{rules:["string","emptyString","keyLength","regexTest"],onComplete:function(e,t,n){return e||("emptyString"===n&&(t="item_type"),r(Ct[n])&&Ct[n](t)),!0}},item_id:{rules:["string","emptyString","stringLength"],onComplete:function(e,t,n){return e||("emptyString"===n&&(t="item_id"),r(Ct[n])&&Ct[n](t)),!0}},loginIdKey:{rules:["string","emptyString","keyLength","regexTest","reservedLoginId"],onComplete:function(e,t,n){return!e&&("emptyString"===n&&(t="login_id_key"),r(Ct[n])&&Ct[n](t),"keyLength"===n)||e}},bindKey:{rules:["string","emptyString","keyLength","regexTest","reservedBind"],onComplete:function(e,t,n){return!e&&("emptyString"===n&&(t="Key"),r(Ct[n])&&Ct[n](t),"keyLength"===n)||e}},unbindKey:{rules:["string","emptyString","keyLength","regexTest","reservedUnbind"],onComplete:function(e,t,n){return!e&&("emptyString"===n&&(t="Key"),r(Ct[n])&&Ct[n](t),"keyLength"===n)||e}},bindValue:{rules:["string","emptyString","idLength"],onComplete:function(e,t,n){return!e&&("emptyString"===n&&(t="Value"),r(Ct[n])&&Ct[n](t),"idLength"===n)||e}},check:function(e,t,n){var i=this[e];if(r(i))return i.call(this,t);if(!i)return!1;for(var a=0;a<i.rules.length;a++){var s=i.rules[a],o=Pt[s](t),c=r(n)?n(o,t,s):i.onComplete(o,t,s);if(!o)return c}return!0}};function Dt(e,t){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&!Tt.check(r,e[r],t))return!1;return!0}function Ot(e){var t=["$element_selector","$element_path"],r=["sensorsdata_app_visual_properties"];s(e)&&j(e,function(n,i){if(s(n))Ot(e[i]);else if(_(n)){if(se(r,i)>-1)return;e[i]=(a=n,ge(o=se(t,i)>-1?1024:xe.max_string_length)&&a.length>o?(Ae("字符串长度超过限制,已经做截取--"+a),a.slice(0,o)):a)}var a,o})}var Et={initUrl:function(){var e,r,n={server_url:{project:"",host:""},page_url:{host:"",pathname:""}};if(!de(t.para.server_url))return $e("----vcollect---server_url必须为有效 URL 字符串"),!1;try{e=b(t.para.server_url),n.server_url.project=e.searchParams.get("project")||"default",n.server_url.host=e.host}catch(e){return $e("----vcollect---server_url解析异常",e),!1}try{r=b(location.href),n.page_url.host=r.hostname,n.page_url.pathname=r.pathname}catch(e){return $e("----vcollect---页面地址解析异常",e),!1}return n},isDiv:function(e){return!e.element_path||"div"===v(e.element_path.split(">").pop()).slice(0,3)},configIsMatchNew:function(e,t){if(_(e.$element_selector)&&_(t.element_selector)){if("element_selector"===t.element_field&&"equal"===t.function)return e.$element_selector===t.element_selector;if("element_selector"===t.element_field&&"contain"===t.function)return e.$element_selector.indexOf(t.element_selector)>-1}if(_(e.$element_path)&&_(t.element_path)){if("element_path"===t.element_field&&"equal"===t.function)return e.$element_path===t.element_path;if("element_path"===t.element_field&&"contain"===t.function)return e.$element_path.indexOf(t.element_path)>-1}return!1},configIsMatch:function(e,t){return(!t.limit_element_content||t.element_content===e.$element_content)&&(!t.limit_element_position||t.element_position===String(e.$element_position))&&(t.element_field&&t.function?Et.configIsMatchNew(e,t):Et.configIsMatchOldVersion(e,t))},configIsMatchOldVersion:function(e,t){if(!t.element_path)return!1;if(void 0!==e.$element_position){if(t.element_path!==e.$element_path)return!1}else if(Et.isDiv({element_path:t.element_path})){if(e.$element_path.indexOf(t.element_path)<0)return!1}else if(t.element_path!==e.$element_path)return!1;return!0},filterConfig:function(e,t,r){var n=[];if(!r){var i=Et.initUrl();if(!i)return[];r=i.page_url}return"$WebClick"===e.event&&j(t,function(t){s(t)&&("webclick"===t.event_type||"appclick"===t.event_type)&&s(t.event)&&t.event.url_host===r.host&&t.event.url_path===r.pathname&&Et.configIsMatch(e.properties,t.event)&&n.push(t)}),n},getPropElInLi:function(e,r){if(!(e&&k(e)&&_(r)))return null;if("li"!==e.tagName.toLowerCase())return null;var n=t.heatmap.getDomSelector(e);return n?W(n+r)||null:(Ae("----custom---获取同级属性元素失败,selector信息异常",n,r),null)},getProp:function(e,r){if(!s(e))return!1;if(!(_(e.name)&&e.name.length>0))return Ae("----vcustom----属性名不合法,属性抛弃",e.name),!1;var n,i,a={};if("content"===e.method){var o;if(_(e.element_selector)&&e.element_selector.length>0)o=W(e.element_selector);else{if(!r||!_(e.list_selector))return Ae("----vcustom----属性配置异常,属性抛弃",e.name),!1;var c=W(r.properties.$element_selector);if(!c)return Ae("----vcustom----点击元素获取异常,属性抛弃",e.name),!1;var l=t.heatmap.getClosestLi(c);o=Et.getPropElInLi(l,e.list_selector)}if(!o||!k(o))return Ae("----vcustom----属性元素获取失败,属性抛弃",e.name),!1;if("input"===o.tagName.toLowerCase())n=o.value||"";else if("select"===o.tagName.toLowerCase()){var u=o.selectedIndex;ge(u)&&k(o[u])&&(n=dt(o[u],"select"))}else n=dt(o,o.tagName.toLowerCase());if(e.regular){try{i=new RegExp(e.regular).exec(n)}catch(t){return Ae("----vcustom----正则处理失败,属性抛弃",e.name),!1}if(null===i)return Ae("----vcustom----属性规则处理,未匹配到结果,属性抛弃",e.name),!1;if(!C(i)||!_(i[0]))return Ae("----vcustom----正则处理异常,属性抛弃",e.name,i),!1;n=i[0]}if("STRING"===e.type)a[e.name]=n;else if("NUMBER"===e.type){if(n.length<1)return Ae("----vcustom----未获取到数字内容,属性抛弃",e.name,n),!1;if(isNaN(Number(n)))return Ae("----vcustom----数字类型属性转换失败,属性抛弃",e.name,n),!1;a[e.name]=Number(n)}return a}return $e("----vcustom----属性不支持此获取方式",e.name,e.method),!1},getAssignConfigs:function(e,t){var r=Et.initUrl();if(!r||!r.page_url)return[];if(!s(t))return[];var n=[];return t.events=t.events||t.eventList,C(t.events)&&t.events.length>0?(j(t.events,function(t){s(t)&&s(t.event)&&t.event.url_host===r.page_url.host&&t.event.url_path===r.page_url.pathname&&e(t)&&n.push(t)}),n):[]}},Nt={events:[],customProp:{events:[],getAssignConfigs:Et.getAssignConfigs,filterConfig:Et.filterConfig,getProp:Et.getProp,initUrl:Et.initUrl,updateEvents:function(e){C(e)&&(this.events=e)},init:function(){this.initAppGetPropsBridge()},geth5Props:function(e){var r={},n=[],i=this;if(!this.events.length)return{};if("$WebClick"===e.event){var a=this.filterConfig(e,this.events);if(!a.length)return{};j(a,function(t){s(t)&&(C(t.properties)&&t.properties.length>0&&j(t.properties,function(t){if(s(t))if(!1===t.h5)C(r.sensorsdata_app_visual_properties)||(r.sensorsdata_app_visual_properties=[]),r.sensorsdata_app_visual_properties.push(t);else{var n=i.getProp(t,e);s(n)&&(r=A(r,n))}}),_(t.event_name)&&n.push(t.event_name))}),t.bridge.hasVisualModeBridge()&&(r.sensorsdata_web_visual_eventName=n)}return r.sensorsdata_app_visual_properties&&(r.sensorsdata_app_visual_properties=U(JSON.stringify(r.sensorsdata_app_visual_properties))),r},initAppGetPropsBridge:function(){var e=this,r=new t.SDKJSBridge("getJSVisualProperties");return r.onAppNotify(function(n){var i={};try{n=JSON.parse(L(n))}catch(e){$e("getJSVisualProperties data parse error!")}if(s(n)){var a=n.sensorsdata_js_visual_properties,o=e.initUrl();o&&(o=o.page_url,C(a)&&a.length>0&&j(a,function(t){if(s(t)&&t.url_host===o.host&&t.url_path===o.pathname&&t.h5){var r=e.getProp(t);s(r)&&(i=A(i,r))}}))}return"android"===t.bridge.bridge_info.platform&&r.notifyApp({data:i},n.message_id),i}),r}},getAssignConfigs:Et.getAssignConfigs,initUrl:Et.initUrl,init:function(){if(this.initUrl()){var e=this.getConfigFromApp();e&&this.updateConfigs(e),this.customProp.init(),this.initAppUpdateConfigBridge()}},initAppUpdateConfigBridge:function(){var e=this;return new t.SDKJSBridge("updateH5VisualConfig").onAppNotify(function(t){if(t){try{t=JSON.parse(L(t))}catch(e){return void $e("updateH5VisualConfig result parse error!")}e.updateConfigs(t)}})},getConfigFromApp:function(){var e=new t.SDKJSBridge("sensorsdata_get_app_visual_config").notifyApp();if(e)try{e=JSON.parse(L(e))}catch(t){e=null,$e("getAppVisualConfig result parse error!")}return e},updateConfigs:function(e){this.events=this.filterConfigs(e),this.customProp.updateEvents(this.events)},filterConfigs:function(e){return this.getAssignConfigs(function(e){return!(!s(e)||!1===e.h5)},e)}},jt={events:[],init:function(e){this.filterWebClickEvents(e)},filterWebClickEvents:function(e){this.events=$t.getAssignConfigs(function(e){return!(!s(e)||!0!==e.event.unlimited_div||"webclick"!==e.event_type)},e)},isTargetEle:function(e){var r=t.heatmap.getEleDetail(e);if(!s(r)||!_(r.$element_path))return!1;for(var n=0;n<this.events.length;n++)if(s(this.events[n])&&s(this.events[n].event)&&$t.configIsMatch(r,this.events[n].event))return!0;return!1}},At={events:[],configSwitch:!1,collectAble:function(){return this.configSwitch&&s(t.para.heatmap)&&t.para.heatmap.get_vtrack_config},updateEvents:function(e){this.events=$t.getAssignConfigs(function(e){return!!(s(e)&&C(e.properties)&&e.properties.length>0)},e),this.events.length?this.configSwitch=!0:this.configSwitch=!1},getVtrackProps:function(e){var t={};return this.collectAble()?("$WebClick"===e.event&&(t=this.clickCustomPropMaker(e,this.events)),t):{}},clickCustomPropMaker:function(e,t,r){var n=this;r=r||this.filterConfig(e,t,$t.url_info.page_url);var i={};return r.length?(j(r,function(t){C(t.properties)&&t.properties.length>0&&j(t.properties,function(t){var r=n.getProp(t,e);s(r)&&A(i,r)})}),i):{}},getProp:Et.getProp,getPropElInLi:Et.getPropElInLi,filterConfig:Et.filterConfig},$t={unlimitedDiv:jt,config:{},storageEnable:!0,storage_name:"webjssdkvtrackcollect",para:{session_time:18e5,timeout:5e3,update_interval:18e5},url_info:{},timer:null,update_time:null,customProp:At,initUrl:function(){var e=Et.initUrl();if(e){var r;try{(r=new y(t.para.server_url))._values.Path="/config/visualized/Web.conf",e.api_url=r.getUrl()}catch(e){return $e("----vtrackcollect---API地址解析异常",e),!1}this.url_info=e}return e},init:function(){if(!s(t.para.heatmap)||!t.para.heatmap.get_vtrack_config)return!1;if(a.isSupport()||(this.storageEnable=!1),!this.initUrl())return $e("----vtrackcustom----初始化失败,url信息解析失败"),!1;if(this.storageEnable){var e=It.readObjectVal(this.storage_name);if(s(e)&&s(e.data))if(this.serverUrlIsSame(e.serverUrl)){this.config=e.data,this.update_time=e.updateTime,this.updateConfig(e.data);var r=(new Date).getTime()-this.update_time;if(ge(r)&&r>0&&r<this.para.session_time){var n=this.para.update_interval-r;this.setNextFetch(n)}else this.getConfigFromServer()}else this.getConfigFromServer();else this.getConfigFromServer()}else this.getConfigFromServer();this.pageStateListenner()},serverUrlIsSame:function(e){return!!s(e)&&e.host===this.url_info.server_url.host&&e.project===this.url_info.server_url.project},getConfigFromServer:function(){var e=this;this.sendRequest(function(t,r){e.update_time=(new Date).getTime();var n={};200===t?r&&s(r)&&"Web"===r.os&&(n=r,e.updateConfig(n)):205===t?e.updateConfig(n):304===t?n=e.config:($e("----vtrackcustom----数据异常",t),e.updateConfig(n)),e.updateStorage(n),e.setNextFetch()},function(t){e.update_time=(new Date).getTime(),$e("----vtrackcustom----配置拉取失败",t),e.setNextFetch()})},setNextFetch:function(e){var t=this;this.timer&&(clearTimeout(this.timer),this.timer=null),e=e||this.para.update_interval,this.timer=setTimeout(function(){t.getConfigFromServer()},e)},pageStateListenner:function(){var e=this;_e({visible:function(){var t=(new Date).getTime()-e.update_time;if(ge(t)&&t>0&&t<e.para.update_interval){var r=e.para.update_interval-t;e.setNextFetch(r)}else e.getConfigFromServer()},hidden:function(){e.timer&&(clearTimeout(e.timer),e.timer=null)}})},updateConfig:function(e){if(!s(e))return!1;this.config=e,this.customProp.updateEvents(e),this.unlimitedDiv.init(e)},updateStorage:function(e){if(!this.storageEnable)return!1;if(!s(e))return!1;var t;if(this.url_info.server_url)t=this.url_info.server_url;else{var r=$t.initUrl();if(!r)return!1;t=r.server_url}var n={updateTime:(new Date).getTime(),data:e,serverUrl:t};It.saveObjectVal(this.storage_name,n)},sendRequest:function(e,t){var r={app_id:this.url_info.page_url.host};this.config.version&&(r.v=this.config.version),he({url:this.url_info.api_url,callbackName:"saJSSDKVtrackCollectConfig",data:r,timeout:this.para.timeout,success:function(t,r){e(t,r)},error:function(e){t(e)}})},getAssignConfigs:Et.getAssignConfigs,configIsMatch:Et.configIsMatch},xt={stage:null,init:function(e){this.stage=e},interceptor:{basicProps:{priority:0,entry:function(e,t){try{var r=t.sensors,n={};s(e)&&s(e.identities)&&!ue(e.identities)?A(n,e.identities):A(n,It.getIdentities());var i={identities:n,distinct_id:It.getDistinctId(),lib:{$lib:"js",$lib_method:"code",$lib_version:String(r.lib_version)},properties:{}};return s(e)&&s(e.properties)&&!ue(e.properties)&&(e.properties.$lib_detail&&(i.lib.$lib_detail=e.properties.$lib_detail,delete e.properties.$lib_detail),e.properties.$lib_method&&(i.lib.$lib_method=e.properties.$lib_method,delete e.properties.$lib_method)),z(i,It.getUnionId(),e),s(e.properties)&&!ue(e.properties)&&A(i.properties,e.properties),"$UnbindID"===i.event&&(i.login_id&&delete i.login_id,i.anonymous_id&&delete i.anonymous_id),e.type&&"profile"===e.type.slice(0,7)||(r.para.properties_priority&&3===r.para.properties_priority?i.properties=A({},it.properties(),It.getSessionProps(),it.currentProps,It.getProps(),i.properties):i.properties=A({},it.properties(),It.getProps(),It.getSessionProps(),it.currentProps,i.properties),r.para.preset_properties.latest_referrer&&!_(i.properties.$latest_referrer)&&(i.properties.$latest_referrer="取值异常"),r.para.preset_properties.latest_search_keyword&&!_(i.properties.$latest_search_keyword)&&(r.para.preset_properties.search_keyword_baidu&&_(i.properties.$search_keyword_id)&&ge(i.properties.$search_keyword_id_hash)&&_(i.properties.$search_keyword_id_type)||(i.properties.$latest_search_keyword="取值异常")),r.para.preset_properties.latest_traffic_source_type&&!_(i.properties.$latest_traffic_source_type)&&(i.properties.$latest_traffic_source_type="取值异常"),r.para.preset_properties.latest_landing_page&&!_(i.properties.$latest_landing_page)&&(i.properties.$latest_landing_page="取值异常"),"not_collect"===r.para.preset_properties.latest_wx_ad_click_id?(delete i.properties._latest_wx_ad_click_id,delete i.properties._latest_wx_ad_hash_key,delete i.properties._latest_wx_ad_callbacks):r.para.preset_properties.latest_wx_ad_click_id&&!_(i.properties._latest_wx_ad_click_id)&&(i.properties._latest_wx_ad_click_id="取值异常",i.properties._latest_wx_ad_hash_key="取值异常",i.properties._latest_wx_ad_callbacks="取值异常"),_(i.properties._latest_wx_ad_click_id)&&(i.properties.$url=ee())),i.properties.$time&&H(i.properties.$time)?(i.time=1*i.properties.$time,delete i.properties.$time):i.time=1*new Date,function(e){if(r.bridge&&"success"===r.bridge.bridge_info.verify_success){var t=Nt.customProp.geth5Props(JSON.parse(JSON.stringify(e)));s(t)&&!ue(t)&&(e.properties=A(e.properties,t))}var n=$t.customProp.getVtrackProps(JSON.parse(JSON.stringify(e)));s(n)&&!ue(n)&&(e.properties=A(e.properties,n))}(i),ot(i),We.checkIsAddSign(i),We.checkIsFirstTime(i),function(e){var t=!e.type||"profile"!==e.type.slice(0,7);s(e.properties)&&t&&("$referrer"in e.properties&&(e.properties.$referrer_host=""===e.properties.$referrer?"":K(e.properties.$referrer,"取值异常")),xe.preset_properties.latest_referrer&&xe.preset_properties.latest_referrer_host&&(e.properties.$latest_referrer_host=""===e.properties.$latest_referrer?"":K(e.properties.$latest_referrer,"取值异常")))}(i),function(e){var t=!e.type||"profile"!==e.type.slice(0,7),r=xe.preset_properties&&t;r&&xe.preset_properties.url&&I(e.properties.$url)&&(e.properties.$url=ee()),r&&xe.preset_properties.title&&I(e.properties.$title)&&(e.properties.$title=document.title)}(i),i}catch(e){return{_debug_web_msg:String(e)}}}},formatData:{priority:0,entry:function(e){var t,n=e.properties;be(e),s(n)?(function(e){s(e)&&j(e,function(t,n){if(C(t)){var i=[];j(t,function(e){if(_(e))i.push(e);else if(I(e))i.push("null");else try{i.push(JSON.stringify(e))}catch(e){Ae("您的数据-",n,t,"数组里值有错误,已将其删除")}}),e[n]=i}var a=se([],n)>-1;if(s(t)&&"$option"!==n&&!a)try{e[n]=JSON.stringify(t)}catch(r){delete e[n],Ae("您的数据-",n,t,"数据值有错误,已将其删除")}else _(t)||ge(t)||H(t)||le(t)||C(t)||r(t)||"$option"===n||a||(Ae("您的数据-",n,t,"-格式不满足要求,我们已经将其删除"),delete e[n])})}(n),s(t=n)&&j(["distinct_id","user_id","id","date","datetime","event","events","first_id","original_id","device_id","properties","second_id","time","users"],function(e,r){e in t&&(se([],e)>-1||(r<3?(delete t[e],Ae("您的属性- "+e+"是保留字段,我们已经将其删除")):Ae("您的属性- "+e+"是保留字段,请避免其作为属性名")))}),function(e){void 0!==e.properties.$project&&(e.project=e.properties.$project,delete e.properties.$project),void 0!==e.properties.$token&&(e.token=e.properties.$token,delete e.properties.$token)}(e),function(e){j(e,function(t,r){-1===se([],r)&&Dt({propertyKey:r},function(t,n,i){return t||"keyLength"===i||delete e[r],!0})})}(n),Ot(n)):"properties"in e&&(e.properties={}),function(e){"item_type"in e&&Dt({item_type:e.item_type},function(t){return t||delete e.item_type,!0}),"item_id"in e&&Dt({item_id:e.item_id},function(t,r,n){return t||"string"!==n||delete e.item_id,!0})}(e)}},finalAdjustData:{priority:0,entry:function(e,t){var r=t.sensors;return e._track_id=Number(String(l()).slice(2,5)+String(l()).slice(2,4)+String((new Date).getTime()).slice(-4)),e._flush_time=(new Date).getTime(),r.events.tempAdd("send",e),e}}}},Lt={};function Ut(e,t,r,n){var i=null;if((e=e||{}).ele&&(i=e.ele),e.event&&(i=e.target?e.target:e.event.target),r=r||{},!i||"object"!=typeof i)return!1;if(!i.href||/^javascript/.test(i.href)||i.target||i.download||i.onclick)return n(t,r),!1;function a(e){e.stopPropagation(),e.preventDefault();var a=!1;function s(){a||(a=!0,location.href=i.href)}setTimeout(s,1e3),n(t,r,s)}e.event&&a(e.event),e.ele&&qe(e.ele,"click",function(e){a(e)})}function Rt(){var e=location.protocol;return"http:"===e||"https:"===e?e:"http:"}Lt.check=Dt,Lt.sendItem=function(e){var r={lib:{$lib:"js",$lib_method:"code",$lib_version:String(t.lib_version)},time:1*new Date};A(r,e),function(e){xt.stage.process("formatData",e)}(r),t.kit.sendData(r)},Lt.send=function(e,r){var n=t.kit.buildData(e);t.kit.sendData(n,r)};var Bt={stage:null,init:function(e){this.stage=e}},Mt={label:!1,li:!1,a:!0,button:!0},Ht={otherTags:[],initUnlimitedTags:function(){j(Ht.otherTags,function(e){e in Mt&&(Mt[e]=!0)})},isUnlimitedTag:function(e){if(!e||1!==e.nodeType)return!1;var r=e.nodeName.toLowerCase();return Mt[r]||ne(e,t.para.heatmap.track_attr)},getTargetElement:function(e,r){var n=this,i=e;if("object"!=typeof i)return null;if("string"!=typeof i.tagName)return null;var a=i.tagName.toLowerCase();if("body"===a.toLowerCase()||"html"===a.toLowerCase())return null;if(!i||!i.parentNode||!i.parentNode.children)return null;var s=i.parentNode,o=n.otherTags;if("a"===a||"button"===a||"input"===a||"textarea"===a)return i;if(se(o,a)>-1)return i;if("area"===a&&"map"===s.tagName.toLowerCase()&&P(s).prev().tagName&&"img"===P(s).prev().tagName.toLowerCase())return P(s).prev();if("div"===a&&t.para.heatmap.collect_tags.div&&n.isDivLevelValid(i)&&((t.para.heatmap&&t.para.heatmap.collect_tags&&t.para.heatmap.collect_tags.div&&t.para.heatmap.collect_tags.div.max_level||1)>1||n.isCollectableDiv(i)))return i;if(n.isStyleTag(a)&&t.para.heatmap.collect_tags.div){var c=n.getCollectableParent(i);if(c&&n.isDivLevelValid(c))return c}return n.hasElement({event:r&&r.originalEvent||r,element:e},function(e){return n.isUnlimitedTag(e)})||null},getDivLevels:function(e,t){var r=Ht.getElementPath(e,!0,t).split(" > "),n=0;return j(r,function(e){"div"===e&&n++}),n},isDivLevelValid:function(e){for(var r=t.para.heatmap&&t.para.heatmap.collect_tags&&t.para.heatmap.collect_tags.div&&t.para.heatmap.collect_tags.div.max_level||1,n=e.getElementsByTagName("div"),i=n.length-1;i>=0;i--)if(Ht.getDivLevels(n[i],e)>r)return!1;return!0},getElementPath:function(e,t,r){for(var n=[];e.parentNode&&k(e);){if(!_(e.tagName))return"unknown";if(e.id&&!t&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(e.id)){n.unshift(e.tagName.toLowerCase()+"#"+e.id);break}if(r&&e===r){n.unshift(e.tagName.toLowerCase());break}if(e===document.body){n.unshift("body");break}n.unshift(e.tagName.toLowerCase()),e=e.parentNode}return n.join(" > ")},getClosestLi:function(e){return function(e,t){for(;e&&e!==document&&1===e.nodeType;e=e.parentNode)if(e.tagName&&_(e.tagName)&&e.tagName.toLowerCase()===t)return e;return null}(e,"li")},getElementPosition:function(e,r,n){var i=t.heatmap.getClosestLi(e);if(!i||!k(e)||!_(e.tagName))return null;var a=e.tagName.toLowerCase(),s=i.getElementsByTagName(a),o=s.length,c=[];if(o>1){for(var l=0;l<o;l++)t.heatmap.getElementPath(s[l],n)===r&&c.push(s[l]);if(c.length>1)return se(c,e)}return function(e){if(!e.parentNode)return"";if(1===P(e).getSameTypeSiblings().length)return 0;for(var t=0,r=e;P(r).previousElementSibling().ele;r=P(r).previousElementSibling().ele,t++);return t}(i)},setNotice:function(e){t.is_heatmap_render_mode=!0,t.para.heatmap||(t.errorMsg="您 SDK 没有配置开启点击图 !"),e&&"http:"===e.slice(0,5)&&"https:"===location.protocol&&(t.errorMsg="您的当前页面是 https 的地址,神策分析环境也必须是 https !"),t.para.heatmap_url||(t.para.heatmap_url=Rt()+"//static.sensorsdata.cn/sdk/"+t.lib_version+"/heatmap.min.js")},getDomIndex:function(e){if(!e.parentNode)return-1;for(var t=0,r=e.tagName,n=e.parentNode.children,i=0;i<n.length;i++)if(n[i].tagName===r){if(e===n[i])return t;t++}return-1},selector:function(e,r){if(!e||!k(e)||!_(e.tagName))return"";var n=e.parentNode&&9==e.parentNode.nodeType?-1:this.getDomIndex(e);return e.getAttribute&&e.getAttribute("id")&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(e.getAttribute("id"))&&(!t.para.heatmap||t.para.heatmap&&"not_use_id"!==t.para.heatmap.element_selector)&&!r?"#"+e.getAttribute("id"):e.tagName.toLowerCase()+(~n?":nth-of-type("+(n+1)+")":"")},getDomSelector:function(e,r,n){if(!(e&&e.parentNode&&e.parentNode.children&&_(e.tagName)))return"unknown";r=r&&r.join?r:[];var i=e.nodeName.toLowerCase();return e&&"body"!==i&&1==e.nodeType?(r.unshift(this.selector(e,n)),e.getAttribute&&e.getAttribute("id")&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(e.getAttribute("id"))&&t.para.heatmap&&"not_use_id"!==t.para.heatmap.element_selector&&!n?r.join(" > "):this.getDomSelector(e.parentNode,r,n)):(r.unshift("body"),r.join(" > "))},na:function(){var e=document.documentElement.scrollLeft||window.pageXOffset;return parseInt(isNaN(e)?0:e,10)},i:function(){var e=0;try{e=o.documentElement&&o.documentElement.scrollTop||m.pageYOffset,e=isNaN(e)?0:e}catch(t){e=0}return parseInt(e,10)},getBrowserWidth:function(){var e=window.innerWidth||document.body.clientWidth;return isNaN(e)?0:parseInt(e,10)},getBrowserHeight:function(){var e=window.innerHeight||document.body.clientHeight;return isNaN(e)?0:parseInt(e,10)},getScrollWidth:function(){var e=parseInt(document.body.scrollWidth,10);return isNaN(e)?0:e},getEleDetail:function(e){var r=this.getDomSelector(e),n=ut({target:e});n.$element_selector=r||"",n.$element_path=t.heatmap.getElementPath(e,t.para.heatmap&&"not_use_id"===t.para.heatmap.element_selector);var i=t.heatmap.getElementPosition(e,n.$element_path,t.para.heatmap&&"not_use_id"===t.para.heatmap.element_selector);return ge(i)&&(n.$element_position=i),n},getPointerEventProp:function(e,t){if(!e)return{};function r(){return{scrollLeft:document.body.scrollLeft||document.documentElement.scrollLeft||0,scrollTop:document.body.scrollTop||document.documentElement.scrollTop||0}}function n(e){if(document.documentElement.getBoundingClientRect){var t=e.getBoundingClientRect();return{targetEleX:t.left+r().scrollLeft||0,targetEleY:t.top+r().scrollTop||0}}}function i(e){return Number(Number(e).toFixed(3))}return function(e){var a=e.pageX||e.clientX+r().scrollLeft||e.offsetX+n(t).targetEleX||0,s=e.pageY||e.clientY+r().scrollTop||e.offsetY+n(t).targetEleY||0;return{$page_x:i(a),$page_y:i(s)}}(e)},start:function(e,n,i,a,o){if(s(t.para.heatmap)&&r(t.para.heatmap.collect_element)&&!t.para.heatmap.collect_element(n))return!1;var c;c=Ht.getBasicEleInfo(e,n,i,a,o),Bt.stage.process("webClickEvent",c)},getBasicEleInfo:function(e,n,i,a,o){var c=s(a)?a:{},l=r(o)?o:r(a)?a:void 0,u=this.getEleDetail(n);if(t.para.heatmap&&t.para.heatmap.custom_property){var d=t.para.heatmap.custom_property(n);s(d)&&(u=A(u,d))}return{event:e,target:n,props:u=A(u,this.getPointerEventProp(e,n),c),tagName:i,callback:l}},hasElement:function(e,t){var r;if(e.event){var n=e.event;r=n.path||n._getPath&&n._getPath()}else e.element&&(r=P(e.element).getParents());if(r&&C(r)&&r.length>0)for(var i=0;i<r.length;i++)if("object"==typeof r[i]&&1===r[i].nodeType&&t(r[i]))return r[i]},isStyleTag:function(e,r){return!(se(["a","div","input","button","textarea"],e)>-1)&&(!r||t.para.heatmap&&t.para.heatmap.collect_tags&&t.para.heatmap.collect_tags.div?!!(s(t.para.heatmap)&&s(t.para.heatmap.collect_tags)&&s(t.para.heatmap.collect_tags.div)&&C(t.para.heatmap.collect_tags.div.ignore_tags)&&se(t.para.heatmap.collect_tags.div.ignore_tags,e)>-1):se(["mark","/mark","strong","b","em","i","u","abbr","ins","del","s","sup"],e)>-1)},isCollectableDiv:function(e,r){try{if(0===e.children.length)return!0;for(var n=0;n<e.children.length;n++)if(1===e.children[n].nodeType){var i=_(e.children[n].tagName)?e.children[n].tagName.toLowerCase():"unknown",a=t.para&&t.para.heatmap&&t.para.heatmap.collect_tags&&t.para.heatmap.collect_tags.div&&t.para.heatmap.collect_tags.div.max_level;if(!("div"===i&&a>1||this.isStyleTag(i,r)))return!1;if(!this.isCollectableDiv(e.children[n],r))return!1}return!0}catch(e){$e("isCollectableDiv:"+e)}return!1},getCollectableParent:function(e,r){try{var n=e.parentNode,i=n?n.tagName.toLowerCase():"";if("body"===i)return!1;var a=t.para&&t.para.heatmap&&t.para.heatmap.collect_tags&&t.para.heatmap.collect_tags.div&&t.para.heatmap.collect_tags.div.max_level;if(i&&"div"===i&&(a>1||this.isCollectableDiv(n,r)))return n;if(n&&this.isStyleTag(i,r))return this.getCollectableParent(n,r)}catch(e){$e("getCollectableParent:"+e)}return!1},listenUrlChange:function(e){e(),t.ee.spa.on("switch",function(){e()})},initScrollmap:function(){if(!s(t.para.heatmap)||"default"!==t.para.heatmap.scroll_notice_map)return!1;var e=!0;t.para.scrollmap&&r(t.para.scrollmap.collect_url)&&this.listenUrlChange(function(){e=!!t.para.scrollmap.collect_url()});var n=function(e){var t={};return t.timeout=e.timeout||1e3,t.func=e.func,t.hasInit=!1,t.inter=null,t.main=function(e,t){this.func(e,t),this.inter=null},t.go=function(e){var r={};this.inter||(r.$viewport_position=document.documentElement&&document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop||0,r.$viewport_position=Math.round(r.$viewport_position)||0,e?t.main(r,!0):this.inter=setTimeout(function(){t.main(r)},this.timeout))},t}({timeout:1e3,func:function(e,r){var n,i=document.documentElement&&document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop||0,a=new Date,s=a-this.current_time;(s>t.para.heatmap.scroll_delay_time&&i-e.$viewport_position!=0||r)&&(e.$url=ee(),e.$title=document.title,e.$url_path=te(),e.event_duration=Math.min(t.para.heatmap.scroll_event_duration,parseInt(s)/1e3),e.event_duration=e.event_duration<0?0:e.event_duration,n=e,Bt.stage.process("webStayEvent",n)),this.current_time=a}});n.current_time=new Date,qe(window,"scroll",function(){if(!e)return!1;n.go()}),qe(window,"beforeunload",function(){if(!e)return!1;n.go("notime")})},initHeatmap:function(){var e=this,n=!0;if(!s(t.para.heatmap)||"default"!==t.para.heatmap.clickmap)return!1;r(t.para.heatmap.collect_url)&&this.listenUrlChange(function(){n=!!t.para.heatmap.collect_url()}),"all"===t.para.heatmap.collect_elements?t.para.heatmap.collect_elements="all":t.para.heatmap.collect_elements="interact","all"===t.para.heatmap.collect_elements?qe(document,"click",function(t){if(!n)return!1;var r=t||window.event;if(!r)return!1;var i=r.target||r.srcElement;if("object"!=typeof i)return!1;if("string"!=typeof i.tagName)return!1;var a=i.tagName.toLowerCase();if("body"===a||"html"===a)return!1;if(!i||!i.parentNode||!i.parentNode.children)return!1;var s=_(i.parentNode.tagName)?i.parentNode.tagName.toLowerCase():"unknown";"a"===s||"button"===s?e.start(r,i.parentNode,s):e.start(r,i,a)}):qe(document,"click",function(r){if(!n)return!1;var i=r||window.event;if(!i)return!1;var a=i.target||i.srcElement,o=t.heatmap.getTargetElement(a,r);if(!k(o)&&!_(a.tagName))return!1;k(o)&&_(o.tagName)?e.start(i,o,o.tagName.toLowerCase()):k(a)&&"div"===a.tagName.toLowerCase()&&s(t.para.heatmap)&&t.para.heatmap.get_vtrack_config&&jt.events.length>0&&jt.isTargetEle(a)&&e.start(i,a,a.tagName.toLowerCase(),{$lib_method:"vtrack"})})}};function Ft(){var e=it.campaignParams(),r={};return j(e,function(e,n,i){-1!==(" "+t.source_channel_standard+" ").indexOf(" "+n+" ")?r["$"+n]=i[n]:r[n]=i[n]}),r}function zt(e,r,n){if(t.is_first_visitor&&n){var i={};t.para.preset_properties.search_keyword_baidu&&et(document.referrer)&&Ze()&&(i.$search_keyword_id=Xe.id(),i.$search_keyword_id_type=Xe.type(),i.$search_keyword_id_hash=ae(i.$search_keyword_id));var a=document.characterSet||document.charset,s=Qe(null,r);e(A({$first_visit_time:new Date,$first_referrer:s,$first_referrer_host:s?K(s,"取值异常"):"",$first_browser_language:_(navigator.language)?navigator.language.toLowerCase():"取值异常",$first_browser_charset:_(a)?a.toUpperCase():"取值异常",$first_traffic_source_type:at(),$first_search_keyword:tt(),$timezone_offset:(new Date).getTimezoneOffset()},Ft(),i)),t.is_first_visitor=!1}}var Jt={autoTrackIsUsed:!1,isReady:function(e){r(e)?e():t.log("error: isReady callback must be function")},getUtm:function(){return it.campaignParams()},getStayTime:function(){return(new Date-t._t)/1e3},setProfileLocal:function(e){if(!a.isSupport())return t.setProfile(e),!1;if(!s(e)||ue(e))return!1;var r=It.readObjectVal("sensorsdata_2015_jssdk_profile"),n=!1;if(s(r)&&!ue(r)){for(var i in e)(!(i in r)||r[i]===e[i])&&i in r||(r[i]=e[i],n=!0);n&&(It.saveObjectVal("sensorsdata_2015_jssdk_profile",r),t.setProfile(e))}else It.saveObjectVal("sensorsdata_2015_jssdk_profile",e),t.setProfile(e)},setInitReferrer:function(){var e=Qe();t.setOnceProfile({_init_referrer:e,_init_referrer_host:it.pageProp.referrer_host})},setSessionReferrer:function(){var e=Qe();It.setSessionPropsOnce({_session_referrer:e,_session_referrer_host:it.pageProp.referrer_host})},setDefaultAttr:function(){it.register({_current_url:location.href,_referrer:Qe(),_referring_host:it.pageProp.referrer_host})},trackHeatMap:function(e,r,n){if("object"==typeof e&&e.tagName&&k(e.parentNode)){var i=e.tagName.toLowerCase(),a=e.parentNode.tagName.toLowerCase(),s=t.para.heatmap&&t.para.heatmap.track_attr?t.para.heatmap.track_attr:["data-sensors-click"];"button"===i||"a"===i||"a"===a||"button"===a||"input"===i||"textarea"===i||ne(e,s)||Ht.start(null,e,i,r,n)}},trackAllHeatMap:function(e,t,r){if("object"==typeof e&&e.tagName){var n=e.tagName.toLowerCase();Ht.start(null,e,n,t,r)}},autoTrackSinglePage:function(e,r){var n;n=this.autoTrackIsUsed?it.pageProp.url:it.pageProp.referrer;var i=!(e=s(e)?e:{}).not_set_profile;function a(e,r){t.track("$pageview",A({$referrer:n,$url:ee(),$url_path:te(),$title:document.title},e,Ft()),r),n=ee()}e.not_set_profile&&delete e.not_set_profile,a(e,r),this.autoTrackSinglePage=a,zt(t.setOnceProfile,!1,i)},autoTrackWithoutProfile:function(e,t){e=s(e)?e:{},this.autoTrack(A(e,{not_set_profile:!0}),t)},autoTrack:function(e,r){e=s(e)?e:{};var n=Ft(),i=!e.not_set_profile;e.not_set_profile&&delete e.not_set_profile;var a=location.href;t.para.is_single_page&&E(function(){var i=Qe(a,!0);t.track("$pageview",A({$referrer:i,$url:ee(),$url_path:te(),$title:document.title},n,e),r),a=ee()}),t.track("$pageview",A({$referrer:Qe(null,!0),$url:ee(),$url_path:te(),$title:document.title},n,e),r),zt(t.setOnceProfile,!0,i),this.autoTrackIsUsed=!0},getAnonymousID:function(){return ue(It._state)?"SDK is not initialized.":It.getAnonymousId()},setPlugin:function(e){if(!s(e))return!1;j(e,function(e,n){r(e)&&(s(window.SensorsDataWebJSSDKPlugin)&&window.SensorsDataWebJSSDKPlugin[n]?e(window.SensorsDataWebJSSDKPlugin[n]):s(t.modules)&&t.modules[n]?e(t.modules[n]):Ae(n+"is not found,please check sensorsdata documents."))})},useModulePlugin:function(){t.use.apply(t,arguments)},useAppPlugin:function(){this.setPlugin.apply(this,arguments)}};function Vt(e,t){var r=e.id,n=e.callback,i=e.name,a=It.getFirstId(),o=It.getOriginDistinctId();if(!Dt({distinct_id:r}))return $e("login id is invalid"),!1;if(r===It.getOriginDistinctId()&&!a)return $e("login id is equal to distinct_id"),!1;if(s(It._state.identities)&&It._state.identities.hasOwnProperty(i)&&r===It._state.first_id)return!1;if(It._state.history_login_id.name!==i||r!==It._state.history_login_id.value){It._state.identities[i]=r,It.set("history_login_id",{name:i,value:r}),a||It.set("first_id",o),t(r,"$SignUp",{},n);var c={$identity_cookie_id:It._state.identities.$identity_cookie_id};return c[i]=r,Wt(c),!0}return!1}function Wt(e){var t={};for(var r in e)t[r]=e[r];It._state.identities=t,It.save()}var qt=1;function Kt(e,n){if(_(e)||s(e)){var i;if(s(e)){var a=t.modules&&t.modules[e.plugin_name];a&&a!==e&&Ae(e.name+" is conflict with builtin plugin, and sdk uses builtin plugin."),i=a||e}return _(e)&&(s(t.modules)&&s(t.modules[e])?i=t.modules[e]:s(window.SensorsDataWebJSSDKPlugin)&&s(window.SensorsDataWebJSSDKPlugin[e])?i=window.SensorsDataWebJSSDKPlugin[e]:window.sensorsDataAnalytic201505&&window.sensorsDataAnalytic201505.modules[e]&&(i=window.sensorsDataAnalytic201505.modules[e])),i&&r(i.init)?(i.plugin_is_init||(i.plugin_name||Ae("warning: invalid plugin, plugin_name required."),i.plugin_version?i.plugin_version!==t.lib_version&&Ae("warning: plugin version not match SDK version. plugin may not work correctly. "):Ae("warning: invalid plugin, plugin version required."),!i.plugin_is_init&&i.init(t,n),i.plugin_is_init=!0,t.modules=t.modules||{},t.modules[i.plugin_name||"unnamed_"+qt++]=i),i):(Ae((e.plugin_name||e)+" is not found or it's not a standard plugin. Please check sensorsdata official documents."),i)}$e("use's first arguments must be string or object.")}function Zt(e,t,r,n){var i=It.getFirstId()||It.getDistinctId();It.set("distinct_id",e),Lt.send({original_id:i,distinct_id:It.getDistinctId(),type:"track_signup",event:t,properties:r},n)}function Xt(e){Dt({properties:e})?It.setProps(e):$e("register输入的参数有误")}function Yt(e,t){"number"==typeof e&&(e=String(e)),!Vt({id:e,callback:t,name:Me.LOGIN},Zt)&&r(t)&&t()}var Gt={__proto__:null,setInitVar:function(){t._t=t._t||1*new Date,t.is_first_visitor=!1,t.source_channel_standard=Ue},initPara:function(e){A(xe,e||t.para||{}),t.para=xe;var r,n={};if(s(t.para.is_track_latest))for(var i in t.para.is_track_latest)n["latest_"+i]=t.para.is_track_latest[i];for(r in t.para.preset_properties=A({},Le.preset_properties,n,t.para.preset_properties||{}),Le)void 0===t.para[r]&&(t.para[r]=Le[r]);"string"!=typeof t.para.web_url||"://"!==t.para.web_url.slice(0,3)&&"//"!==t.para.web_url.slice(0,2)||("://"===t.para.web_url.slice(0,3)?t.para.web_url=location.protocol.slice(0,-1)+t.para.web_url:t.para.web_url=location.protocol+t.para.web_url),nt.protocol.serverUrl(),t.bridge&&t.bridge.initPara();var a=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],o=["www.baidu.","m.baidu.","m.sm.cn","so.com","sogou.com","youdao.com","google.","yahoo.com/","bing.com/","ask.com/"],c=["weibo.com","renren.com","kaixin001.com","douban.com","qzone.qq.com","zhihu.com","tieba.baidu.com","weixin.qq.com"],l={baidu:["wd","word","kw","keyword"],google:"q",bing:"q",yahoo:"p",sogou:["query","keyword"],so:"q",sm:"q"};"object"==typeof t.para.source_type&&(t.para.source_type.utm=C(t.para.source_type.utm)?t.para.source_type.utm.concat(a):a,t.para.source_type.search=C(t.para.source_type.search)?t.para.source_type.search.concat(o):o,t.para.source_type.social=C(t.para.source_type.social)?t.para.source_type.social.concat(c):c,t.para.source_type.keyword=s(t.para.source_type.keyword)?A(l,t.para.source_type.keyword):l);var u=["mark","/mark","strong","b","em","i","u","abbr","ins","del","s","sup"];if(t.para.heatmap&&!s(t.para.heatmap)&&(t.para.heatmap={}),s(t.para.heatmap)){t.para.heatmap.clickmap=t.para.heatmap.clickmap||"default",t.para.heatmap.scroll_notice_map=t.para.heatmap.scroll_notice_map||"default",t.para.heatmap.scroll_delay_time=t.para.heatmap.scroll_delay_time||4e3,t.para.heatmap.scroll_event_duration=t.para.heatmap.scroll_event_duration||18e3,t.para.heatmap.renderRefreshTime=t.para.heatmap.renderRefreshTime||1e3,t.para.heatmap.loadTimeout=t.para.heatmap.loadTimeout||1e3,t.para.heatmap.request_timeout=t.para.heatmap.request_timeout||1e4,!0!==t.para.heatmap.get_vtrack_config&&(t.para.heatmap.get_vtrack_config=!1);var d=C(t.para.heatmap.track_attr)?J(t.para.heatmap.track_attr,function(e){return e&&"string"==typeof e}):[];d.push("data-sensors-click"),t.para.heatmap.track_attr=d,s(t.para.heatmap.collect_tags)?!0===t.para.heatmap.collect_tags.div?t.para.heatmap.collect_tags.div={ignore_tags:u,max_level:1}:s(t.para.heatmap.collect_tags.div)?(t.para.heatmap.collect_tags.div.ignore_tags?C(t.para.heatmap.collect_tags.div.ignore_tags)||(Ae("ignore_tags 参数必须是数组格式"),t.para.heatmap.collect_tags.div.ignore_tags=u):t.para.heatmap.collect_tags.div.ignore_tags=u,t.para.heatmap.collect_tags.div.max_level&&-1===se([1,2,3],t.para.heatmap.collect_tags.div.max_level)&&(t.para.heatmap.collect_tags.div.max_level=1)):t.para.heatmap.collect_tags.div=!1:t.para.heatmap.collect_tags={div:!1}}t.para.server_url=ft(t.para.server_url,t.para.custom_server_url),!0===t.para.noCache?t.para.noCache="?"+(new Date).getTime():t.para.noCache="",t.para.callback_timeout>t.para.datasend_timeout&&(t.para.datasend_timeout=t.para.callback_timeout),t.para.heatmap&&t.para.heatmap.collect_tags&&s(t.para.heatmap.collect_tags)&&j(t.para.heatmap.collect_tags,function(e,r){"div"!==r&&e&&t.heatmap.otherTags.push(r)}),t.para.heatmap&&"default"===t.para.heatmap.clickmap&&t.heatmap.initUnlimitedTags()},quick:function(){var e=Array.prototype.slice.call(arguments),r=e[0],n=e.slice(1);if("string"==typeof r&&Jt[r])return Jt[r].apply(Jt,n);"function"==typeof r?r.apply(t,n):Ae("quick方法中没有这个功能"+e[0])},use:Kt,track:function(e,t,r){Dt({event:e,properties:t})&&Lt.send({type:"track",event:e,properties:t},r)},bind:function(e,t){if(!Dt({bindKey:e,bindValue:t}))return!1;It._state.identities[e]=t,It.save(),Lt.send({type:"track_id_bind",event:"$BindID",properties:{}})},unbind:function(e,t){var r=function(e,t){if(!Dt({unbindKey:e,bindValue:t}))return!1;if(s(It._state.identities)&&It._state.identities.hasOwnProperty(e)&&It._state.identities[e]===t){var r=It.getUnionId().login_id;r&&e+"+"+t===r&&(It._state.distinct_id=It._state.first_id,It._state.first_id="",It.set("history_login_id",{name:"",value:""})),"$identity_cookie_id"!==e&&(delete It._state.identities[e],It.save())}var n={};return n[e]=t,n}(e,t);r&&Lt.send({identities:r,type:"track_id_unbind",event:"$UnbindID",properties:{}})},trackLink:function(e,r,n){"object"==typeof e&&e.tagName?Ut({ele:e},r,n,t.track):"object"==typeof e&&e.target&&e.event&&Ut(e,r,n,t.track)},trackLinks:function(e,r,n){return n=n||{},!(!e||"object"!=typeof e)&&!(!e.href||/^javascript/.test(e.href)||e.target)&&void qe(e,"click",function(i){i.preventDefault();var a=!1;function s(){a||(a=!0,location.href=e.href)}setTimeout(s,1e3),t.track(r,n,s)})},setItem:function(e,t,r){Dt({item_type:e,item_id:t,properties:r})&&Lt.sendItem({type:"item_set",item_type:e,item_id:t,properties:r||{}})},deleteItem:function(e,t){Dt({item_type:e,item_id:t})&&Lt.sendItem({type:"item_delete",item_type:e,item_id:t})},setProfile:function(e,t){Dt({propertiesMust:e})&&Lt.send({type:"profile_set",properties:e},t)},setOnceProfile:function(e,t){Dt({propertiesMust:e})&&Lt.send({type:"profile_set_once",properties:e},t)},appendProfile:function(e,t){Dt({propertiesMust:e})&&(j(e,function(t,r){_(t)&&De(r)?e[r]=[t]:C(t)&&De(r)?e[r]=t:(delete e[r],Ae("appendProfile属性的值必须是字符串或者数组"))}),ue(e)||Lt.send({type:"profile_append",properties:e},t))},incrementProfile:function(e,t){var r=e;_(e)&&((e={})[r]=1),Dt({propertiesMust:e})&&(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&!/-*\d+/.test(String(e[t])))return!1;return!0}(e)?Lt.send({type:"profile_increment",properties:e},t):$e("profile_increment的值只能是数字"))},deleteProfile:function(e){Lt.send({type:"profile_delete"},e),It.set("distinct_id",S()),It.set("first_id","")},unsetProfile:function(e,t){var r=e,n={};_(e)&&(e=[]).push(r),C(e)?(j(e,function(e){_(e)?n[e]=!0:Ae("profile_unset给的数组里面的值必须时string,已经过滤掉",e)}),Lt.send({type:"profile_unset",properties:n},t)):$e("profile_unset的参数必须是数组")},identify:function(e){"number"==typeof e&&(e=String(e));var t=It.getFirstId();if(void 0===e){var r=S();t?It.set("first_id",r):It.set("distinct_id",r)}else Dt({distinct_id:e})&&(t?It.set("first_id",e):It.set("distinct_id",e))},resetAnonymousIdentity:function(e){if(It.getFirstId())return $e("resetAnonymousIdentity must be used in a logout state !"),!1;if("number"==typeof e&&(e=String(e)),void 0===e){var t=S();It._state.identities.$identity_cookie_id=t,It.set("distinct_id",t)}else Dt({distinct_id:e})&&(It._state.identities.$identity_cookie_id=e,It.set("distinct_id",e))},trackSignup:function(e,t,r,n){"number"==typeof e&&(e=String(e)),Dt({distinct_id:e,event:t,properties:r})&&Zt(e,t,r,n)},registerPage:function(e){Dt({properties:e})?A(it.currentProps,e):$e("register输入的参数有误")},clearAllRegister:function(e){It.clearAllProps(e)},clearPageRegister:function(e){var t;if(C(e)&&e.length>0)for(t=0;t<e.length;t++)_(e[t])&&e[t]in it.currentProps&&delete it.currentProps[e[t]];else if(!0===e)for(t in it.currentProps)delete it.currentProps[t]},register:Xt,registerOnce:function(e){Dt({properties:e})?It.setPropsOnce(e):$e("registerOnce输入的参数有误")},registerSession:function(e){t.log("registerSession 方法已经弃用,有问题联系技术顾问"),Dt({properties:e})?It.setSessionProps(e):$e("registerSession输入的参数有误")},registerSessionOnce:function(e){t.log("registerSessionOnce 方法已经弃用,有问题联系技术顾问"),Dt({properties:e})?It.setSessionPropsOnce(e):$e("registerSessionOnce输入的参数有误")},login:Yt,loginWithKey:function(e,t){return Ae("loginWithKey is deprecated !!!"),"number"==typeof t&&(t=String(t)),"number"==typeof e&&(e=String(e)),!!Dt({loginIdKey:e})&&(Me.LOGIN===e?(Yt(t),!1):void Vt({id:t,callback:null,name:e},Zt))},logout:function(e){var t=It.getFirstId();if(t)if(It.set("first_id",""),!0===e){var r=S();It.set("distinct_id",r)}else It.set("distinct_id",t);Wt({$identity_cookie_id:It._state.identities.$identity_cookie_id}),It.set("history_login_id",{name:"",value:""})},getPresetProperties:function(){var e,r,n={$is_first_day:Je(),$is_first_time:We.is_page_first_visited,$referrer:it.pageProp.referrer||"",$referrer_host:it.pageProp.referrer?K(it.pageProp.referrer):"",$url:ee(),$url_path:te(),$title:document.title||"",_distinct_id:It.getDistinctId(),identities:It.getIdentities()},i=A({},it.properties(),It.getProps(),(e=it.campaignParams(),r={},j(e,function(e,n,i){-1!==(" "+t.source_channel_standard+" ").indexOf(" "+n+" ")?r["$"+n]=i[n]:r[n]=i[n]}),r),n);return t.para.preset_properties.latest_referrer&&t.para.preset_properties.latest_referrer_host&&(i.$latest_referrer_host=""===i.$latest_referrer?"":K(i.$latest_referrer)),i},readyState:{state:0,historyState:[],stateType:{1:"1-init未开始",2:"2-init开始",3:"3-store完成"},getState:function(){return this.historyState.join("\n")},setState:function(e){String(e)in this.stateType&&(this.state=e),this.historyState.push(this.stateType[e])}},debug:nt,on:mt,log:je};i.setup(je);var Qt=A({},Oe,St),er={bridge_info:{touch_app_bridge:!1,verify_success:!1,platform:"",support_two_way_call:!1},is_verify_success:!1,initPara:function(){var e={is_send:!1!==t.para.use_app_track_is_send&&"only"!==t.para.use_app_track,white_list:[],is_mui:"mui"===t.para.use_app_track};"object"==typeof t.para.app_js_bridge?t.para.app_js_bridge=A({},e,t.para.app_js_bridge):!0!==t.para.use_app_track&&!0!==t.para.app_js_bridge&&"only"!==t.para.use_app_track&&"mui"!==t.para.use_app_track||(t.para.app_js_bridge=A({},e)),!1===t.para.app_js_bridge.is_send&&Ae("设置了 is_send:false,如果打通失败,数据将被丢弃!")},app_js_bridge_v1:function(){var e=null,r=null;window.sensorsdata_app_js_bridge_call_js=function(t){!function(t){fe(e=t)&&(e=JSON.parse(e)),r&&(r(e),r=null,e=null)}(t)},t.getAppStatus=function(t){if(function(){if(/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream){var e=document.createElement("iframe");e.setAttribute("src","sensorsanalytics://getAppInfo"),document.documentElement.appendChild(e),e.parentNode.removeChild(e),e=null}}(),"object"==typeof window.SensorsData_APP_JS_Bridge&&window.SensorsData_APP_JS_Bridge.sensorsdata_call_app&&fe(e=window.SensorsData_APP_JS_Bridge.sensorsdata_call_app())&&(e=JSON.parse(e)),!t)return e;null===e?r=t:(t(e),e=null)}},hasVisualModeBridge:function(){var e=window.SensorsData_App_Visual_Bridge,t="sensorsdata_visualized_mode";return s(e)&&e[t]&&(!0===e[t]||e[t]())},validateAppUrl:function(e){function r(e){var t={hostname:"",project:""};try{e=b(e),t.hostname=e.hostname,t.project=e.searchParams.get("project")||"default"}catch(e){$e("validateAppUrl:"+e)}return t}var n=r(e),i=r(t.para.server_url);if(n.hostname===i.hostname&&n.project===i.project)return!0;if(C(t.para.app_js_bridge.white_list))for(var a=0;a<t.para.app_js_bridge.white_list.length;a++){var s=r(t.para.app_js_bridge.white_list[a]);if(s.hostname===n.hostname&&s.project===n.project)return!0}return!1}};function tr(e){var t=this;this.type=e,this.resultCbs={},this.timeoutCbs={},this.timerId=null,this.appCallJsCallback=null,window.sensorsdata_app_call_js||(window.sensorsdata_app_call_js=function(e,t){if(e in window.sensorsdata_app_call_js.modules)return window.sensorsdata_app_call_js.modules[e](t)}),window.sensorsdata_app_call_js.modules=window.sensorsdata_app_call_js.modules||{},window.sensorsdata_app_call_js.modules[this.type]=function(e){try{var r=L(e)||e;try{r=JSON.parse(r)}catch(e){}var n=r&&r.message_id;if(n&&t.resultCbs[n]){if(e=r,t.timeoutCbs[n]&&t.timeoutCbs[n].isTimeout)return void(t.resultCbs[n].callbacks.length=0);if(t.resultCbs[n])for(var i in t.resultCbs[n].result=e,clearTimeout(t.timerId),t.timeoutCbs[n].callbacks.length=0,t.resultCbs[n].callbacks)t.resultCbs[n].callbacks[i].call(null,e),t.resultCbs[n].callbacks.splice(i,1);return}return t.appCallJsCallback&&t.appCallJsCallback.call(null,e)}catch(t){$e("app 回调 js 异常",e)}}}function rr(e){try{if(t.bridge.activeBridge&&r(t.bridge.activeBridge.handleCommand))return t.bridge.activeBridge.handleCommand(e)}catch(e){$e("Error: handle command exception:"+e)}return $e("数据发往App失败,App没有暴露bridge,type:"+e.callType),!1}function nr(e){this.bridge=new tr(e.type)}function ir(e){var t=null;try{var r=JSON.parse(window.name);t=r[e]?g(r[e]):null}catch(e){t=null}return null===t&&(t=X(location.href,e)||null),t}tr.prototype.call=function(e,t){var r=this,n=(new Date).getTime().toString(16)+String(l()).replace(".","").slice(1,8);this.resultCbs[n]=r.resultCbs[n]||{result:null,callbacks:[]},this.timeoutCbs[n]=r.timeoutCbs[n]||{isTimeout:!1,callbacks:[]},(e=e.data?e:{data:e}).data.message_id=n;var i=A({callType:this.type},e);return t&&(this.timerId=setTimeout(function(){for(var e in r.timeoutCbs[n].isTimeout=!0,r.timeoutCbs[n].callbacks)r.timeoutCbs[n].callbacks[e].call(null),r.timeoutCbs[n].callbacks.splice(e,1)},t)),rr(i),{onResult:function(e){return r.resultCbs[n].result?(e(r.resultCbs[n].result),this):(!r.timeoutCbs[n].isTimeout&&r.resultCbs[n].callbacks.push(e),this)},onTimeout:function(e){return r.timeoutCbs[n].isTimeout?(e(),this):(!r.resultCbs[n].result&&r.timeoutCbs[n].callbacks.push(e),this)}}},tr.prototype.onAppNotify=function(e){this.appCallJsCallback=e},tr.prototype.notifyApp=function(e,t){var r=A({callType:this.type},e);return t&&(r.message_id=t),rr(r)},nr.prototype={double:function(){},getAppData:function(){},hasAppBridge:function(){return t.bridge.bridge_info.support_two_way_call},init:function(){},jsCallApp:function(){},requestToApp:function(e){this.bridge.call(e,e.timeout.time).onResult(function(t){r(e.callback)&&e.callback(t)}).onTimeout(function(){r(e.timeout.callback)&&e.timeout.callback()})}};var ar={isSeachHasKeyword:function(){return""!==X(location.href,"sa-request-id")&&("string"==typeof sessionStorage.getItem("sensors-visual-mode")&&sessionStorage.removeItem("sensors-visual-mode"),!0)},hasKeywordHandle:function(){var e=location.href,t=X(e,"sa-request-id")||null,r=X(e,"sa-request-type")||null,n=X(e,"sa-request-url")||null;if(Ht.setNotice(n),we.isSupport())if(null!==n&&sessionStorage.setItem("sensors_heatmap_url",n),sessionStorage.setItem("sensors_heatmap_id",t),null!==r)"1"===r||"2"===r||"3"===r?sessionStorage.setItem("sensors_heatmap_type",r):r=null;else{var i=sessionStorage.getItem("sensors_heatmap_type");r=null!==i?i:null}this.isReady(t,r)},isReady:function(e,r,n){t.para.heatmap_url&&t.para.heatmap?me({success:function(){setTimeout(function(){"undefined"!=typeof sa_jssdk_heatmap_render&&(sa_jssdk_heatmap_render(t,e,r,n),"object"==typeof console&&"function"==typeof console.log&&(t.heatmap_version&&t.heatmap_version===t.lib_version||Ae("heatmap.js与sensorsdata.js版本号不一致,可能存在风险!")))},0)},error:function(){},type:"js",url:t.para.heatmap_url}):Ae("没有配置 heatmap 开启点击图,或者没有指定 heatmap_url 的路径")},isStorageHasKeyword:function(){return we.isSupport()&&"string"==typeof sessionStorage.getItem("sensors_heatmap_id")},storageHasKeywordHandle:function(){Ht.setNotice(),ar.isReady(sessionStorage.getItem("sensors_heatmap_id"),sessionStorage.getItem("sensors_heatmap_type"),location.href)},isWindowNameHasKeyword:function(){try{var e=JSON.parse(window.name),t=_(e["sa-heatmap-src"])?g(e["sa-heatmap-src"]):null;return e["sa-request-id"]&&_(e["sa-request-id"])&&t===location.href}catch(e){return!1}},windowNameHasKeywordHandle:function(){var e=JSON.parse(window.name);function t(t){var r=e[t];return _(r)?g(r):null}var r=t("sa-request-id"),n=t("sa-request-type"),i=t("sa-request-url"),s=t("sa-request-language");Ht.setNotice(i),a.isSupport()&&_(s)&&a.set("web_sdk_heatmap_language",s),we.isSupport()&&(null!==i&&sessionStorage.setItem("sensors_heatmap_url",i),sessionStorage.setItem("sensors_heatmap_id",r),null!==n?"1"===n||"2"===n||"3"===n?sessionStorage.setItem("sensors_heatmap_type",n):n=null:n=null!==sessionStorage.getItem("sensors_heatmap_type")?sessionStorage.getItem("sensors_heatmap_type"):null),ar.isReady(r,n)}},sr={isStorageHasKeyword:function(){return we.isSupport()&&"string"==typeof sessionStorage.getItem("sensors-visual-mode")},isSearchHasKeyword:function(){return(!0===ir("sa-visual-mode")||"true"===ir("sa-visual-mode"))&&("string"==typeof sessionStorage.getItem("sensors_heatmap_id")&&sessionStorage.removeItem("sensors_heatmap_id"),!0)},loadVtrack:function(){me({success:function(){},error:function(){},type:"js",url:t.para.vtrack_url?t.para.vtrack_url:Rt()+"//static.sensorsdata.cn/sdk/"+t.lib_version+"/vtrack.min.js"})},messageListener:function(e){if(!e||!e.data||"sa-fe"!==e.data.source)return!1;if("v-track-mode"===e.data.type){if(e.data.data&&e.data.data.isVtrack)if(we.isSupport()&&sessionStorage.setItem("sensors-visual-mode","true"),e.data.data.userURL&&location.href.match(/sa-visual-mode=true/)){var t=e.data.data.userURL;_(t)&&(Te(t,"http://")||Te(t,"https://"))&&(window.location.href=encodeURI(t),setTimeout(function(){window.location.reload(!0)},1e3))}else sr.loadVtrack();window.removeEventListener("message",sr.messageListener,!1)}},removeMessageHandle:function(){window.removeEventListener&&window.removeEventListener("message",sr.messageListener,!1)},verifyVtrackMode:function(){window.addEventListener&&window.addEventListener("message",sr.messageListener,!1),sr.postMessage()},postMessage:function(){try{window.parent&&window.parent.postMessage&&window.parent.postMessage({source:"sa-web-sdk",type:"v-is-vtrack",data:{sdkversion:Re}},"*")}catch(e){$e("浏览器版本过低,不支持 postMessage API")}},notifyUser:function(){var e=function(t){if(!t||!t.data||"sa-fe"!==t.data.source)return!1;"v-track-mode"===t.data.type&&(t.data.data&&t.data.data.isVtrack&&alert("当前版本不支持,请升级部署神策数据治理"),window.removeEventListener("message",e,!1))};window.addEventListener&&window.addEventListener("message",e,!1),sr.postMessage()}};function or(e){var r=t.bridge.bridge_info;function n(){var e=[];r.touch_app_bridge||e.push(nt.defineMode("1")),s(t.para.app_js_bridge)||(e.push(nt.defineMode("2")),r.verify_success=!1),s(t.para.heatmap)&&"default"==t.para.heatmap.clickmap||e.push(nt.defineMode("3")),"fail"===r.verify_success&&e.push(nt.defineMode("4")),new t.SDKJSBridge("app_alert").notifyApp({data:e})}if(t.bridge.hasVisualModeBridge())if(s(t.para.heatmap)&&"default"==t.para.heatmap.clickmap)if(s(t.para.app_js_bridge)&&"success"===r.verify_success)if(e)window.sa_jssdk_app_define_mode(t,e);else{var i=location.protocol;me({success:function(){setTimeout(function(){"undefined"!=typeof sa_jssdk_app_define_mode&&window.sa_jssdk_app_define_mode(t,e)},0)},error:function(){},type:"js",url:(i=se(["http:","https:"],i)>-1?i:"https:")+"//static.sensorsdata.cn/sdk/"+t.lib_version+"/vapph5define.min.js"})}else n();else n()}function cr(){var e;t.readyState.setState(3),new t.SDKJSBridge("visualized").onAppNotify(function(){"undefined"!=typeof sa_jssdk_app_define_mode?or(!0):or(!1)}),or(!1),t.bridge.app_js_bridge_v1(),it.initPage(),t.para.is_track_single_page&&_t.on("switch",function(n){var i=function(i){if(i=i||{},n!==location.href){it.pageProp.referrer=ee(n);var a=A({$url:ee(),$referrer:ee(n)},i);r(e)?e(a):t.quick&&t.quick("autoTrack",a)}};if("boolean"==typeof t.para.is_track_single_page)i();else if("function"==typeof t.para.is_track_single_page){var a=t.para.is_track_single_page();s(a)?i(a):!0===a&&i()}}),It.init(),function(){var e=it.pageProp.url_domain,t={};""===e&&(e="url解析失败");var r=tt(document.referrer,!0);if(xe.preset_properties.search_keyword_baidu?et(document.referrer)&&(!Ze()||s(r)&&r.active?It._state&&It._state.props&&(It._state.props.$search_keyword_id&&delete It._state.props.$search_keyword_id,It._state.props.$search_keyword_id_type&&delete It._state.props.$search_keyword_id_type,It._state.props.$search_keyword_id_hash&&delete It._state.props.$search_keyword_id_hash):(t.$search_keyword_id=Xe.id(),t.$search_keyword_id_type=Xe.type(),t.$search_keyword_id_hash=ae(t.$search_keyword_id))):It._state&&It._state.props&&(It._state.props.$search_keyword_id&&delete It._state.props.$search_keyword_id,It._state.props.$search_keyword_id_type&&delete It._state.props.$search_keyword_id_type,It._state.props.$search_keyword_id_hash&&delete It._state.props.$search_keyword_id_hash),It.save(),j(xe.preset_properties,function(r,n){if(-1===n.indexOf("latest_"))return!1;if(n=n.slice(7),r){if("wx_ad_click_id"===n&&"not_collect"===r)return!1;if("utm"!==n&&"url解析失败"===e)"wx_ad_click_id"===n?(t._latest_wx_ad_click_id="url的domain解析失败",t._latest_wx_ad_hash_key="url的domain解析失败",t._latest_wx_ad_callbacks="url的domain解析失败"):t["$latest_"+n]="url的domain解析失败";else if(et(document.referrer))switch(n){case"traffic_source_type":t.$latest_traffic_source_type=at();break;case"referrer":t.$latest_referrer=it.pageProp.referrer;break;case"search_keyword":tt()?t.$latest_search_keyword=tt():s(It._state)&&s(It._state.props)&&It._state.props.$latest_search_keyword&&delete It._state.props.$latest_search_keyword;break;case"landing_page":t.$latest_landing_page=ee();break;case"wx_ad_click_id":var i=st(location.href);t._latest_wx_ad_click_id=i.click_id,t._latest_wx_ad_hash_key=i.hash_key,t._latest_wx_ad_callbacks=i.callbacks}}else if("utm"===n&&It._state&&It._state.props)for(var a in It._state.props)(0===a.indexOf("$latest_utm")||0===a.indexOf("_latest_")&&a.indexOf("_latest_wx_ad_")<0)&&delete It._state.props[a];else It._state&&It._state.props&&"$latest_"+n in It._state.props?delete It._state.props["$latest_"+n]:"wx_ad_click_id"==n&&It._state&&It._state.props&&!1===r&&j(["_latest_wx_ad_click_id","_latest_wx_ad_hash_key","_latest_wx_ad_callbacks"],function(e){e in It._state.props&&delete It._state.props[e]})}),xe.preset_properties.latest_utm){var n=it.campaignParamsStandard("$latest_","_latest_"),i=n.$utms,a=n.otherUtms;ue(i)||A(t,i),ue(a)||A(t,a)}Xt(t)}(),$t.init(),"success"===t.bridge.bridge_info.verify_success&&Nt.init(),t.readyState.setState(4),t._q&&C(t._q)&&t._q.length>0&&j(t._q,function(e){t[e[0]].apply(t,Array.prototype.slice.call(e[1]))}),s(t.para.heatmap)&&(Ht.initHeatmap(),Ht.initScrollmap())}function lr(){ar.isWindowNameHasKeyword()?ar.windowNameHasKeywordHandle():ar.isSeachHasKeyword()?ar.hasKeywordHandle():window.parent!==self&&sr.isSearchHasKeyword()?sr.verifyVtrackMode():ar.isStorageHasKeyword()?ar.storageHasKeywordHandle():window.parent!==self&&sr.isStorageHasKeyword()?sr.verifyVtrackMode():(cr(),sr.notifyUser())}var ur=["setItem","deleteItem","getAppStatus","track","quick","register","registerPage","registerOnce","trackSignup","setProfile","setOnceProfile","appendProfile","incrementProfile","deleteProfile","unsetProfile","identify","resetAnonymousIdentity","login","logout","trackLink","clearAllRegister","clearPageRegister","bind","unbind","loginWithKey"];function dr(){j(ur,function(e){var n=t[e];t[e]=function(){if(t.readyState.state<3)return C(t._q)||(t._q=[]),Ae("calling sdk api before init is deprecated."),t._q.push([e,arguments]),!1;if(!r(t.getDisabled)||!t.getDisabled()){if(t.readyState.getState())return n.apply(t,arguments);$e("请先初始化神策JS SDK")}}})}var pr={track:function(e,t,r){},quick:function(e,t,r,n){},register:function(e){},registerPage:function(e){},registerOnce:function(e){},clearAllRegister:function(e){},trackSignup:function(e,t,r,n){},setProfile:function(e,t){},setOnceProfile:function(e,t){},appendProfile:function(e,t){},incrementProfile:function(e,t){},deleteProfile:function(e){},unsetProfile:function(e,t){},identify:function(e,t){},resetAnonymousIdentity:function(e){},login:function(e,t){},logout:function(e){},trackLink:function(e,t,r){},deleteItem:function(e,t){},setItem:function(e,t,r){},getAppStatus:function(e){},clearPageRegister:function(e){},bind:function(e,t){},unbind:function(e,t){},registerPropertyPlugin:function(e){}};function fr(e,t){this.cancel=function(){e=!0},this.getCanceled=function(){return e||!1},this.stop=function(){t=!0},this.getStopped=function(){return t||!1}}function gr(e,t,r){var n=null;try{n=JSON.parse(JSON.stringify(e||null))}catch(e){}this.getOriginalData=function(){return n},this.getPosition=function(){return t},this.cancellationToken=new fr,this.sensors=r}function hr(e){if(!s(e))throw"error: Stage constructor requires arguments.";this.processDef=e,this.registeredInterceptors={}}hr.prototype.process=function(e,r){if(e&&e in this.processDef){var n=this.registeredInterceptors[e];if(n&&C(n)&&n.length>0)for(var i={current:0,total:n.length},a=new gr(r,i,t),s=0;s<n.length;s++)try{if(i.current=s+1,r=n[s].call(null,r,a)||r,a.cancellationToken.getCanceled())break;if(a.cancellationToken.getStopped())return}catch(e){$e("interceptor error:"+e)}return this.processDef[e]&&this.processDef[e]in this.processDef&&(r=this.process(this.processDef[e],r)),r}$e("process ["+e+"] is not supported")},hr.prototype.registerStageImplementation=function(e){e&&e.init&&r(e.init)&&(e.init(this),e.interceptor&&this.registerInterceptor(e.interceptor))},hr.prototype.registerInterceptor=function(e){if(e)for(var t in e){var n=e[t];if(n&&s(n)&&r(n.entry)){ge(n.priority)||(n.priority=Number.MAX_VALUE),this.registeredInterceptors[t]||(this.registeredInterceptors[t]=[]);var i=this.registeredInterceptors[t];n.entry.priority=n.priority,i.push(n.entry),i.sort(function(e,t){return e.priority-t.priority})}}};var _r=new hr({basicProps:"extendProps",extendProps:"formatData",formatData:"finalAdjustData",finalAdjustData:null}),mr=new hr({send:null}),vr=new hr({getUtmData:null,callSchema:null}),yr=new hr({webClickEvent:null,webStayEvent:null});function br(e){e&&e.buildDataStage&&_r.registerStageImplementation(e.buildDataStage),e&&e.businessStage&&vr.registerStageImplementation(e.businessStage),e&&e.sendDataStage&&mr.registerStageImplementation(e.sendDataStage),e&&e.viewStage&&yr.registerStageImplementation(e.viewStage)}var wr={buildDataStage:function(e){e&&_r.registerInterceptor(e)},businessStage:function(e){e&&vr.registerInterceptor(e)},sendDataStage:function(e){e&&mr.registerInterceptor(e)},viewStage:function(e){e&&yr.registerInterceptor(e)}};function Sr(e,t){wr[e]&&wr[e](t)}var kr={stage:null,init:function(e){this.stage=e}},Ir={stage:null,init:function(e){this.stage=e},interceptor:{send:{entry:function(e){return e}}}},Cr={};function Pr(e){e.kit=Cr,e.saEvent=Lt,this.buildDataStage=xt,this.sendDataStage=Ir,this.businessStage=kr}function Tr(e){e.heatmap=Ht,this.viewStage=Bt}Cr.buildData=function(e){return t=e,xt.stage.process("basicProps",t);var t},Cr.sendData=function(e,r){var n=ct(e.properties);!function(e){Ir.stage.process("send",e)}({origin_data:e,server_url:t.para.server_url,data:e,config:n||{},callback:r}),t.log(e)},Cr.encodeTrackData=function(e){return gt(e)},Cr.getUtmData=function(){return kr.stage&&kr.stage.process("getUtmData")};var Dr={webClickEvent:{entry:function(e,t){var r=t.sensors;"a"===e.tagName&&r.para.heatmap&&!0===r.para.heatmap.isTrackLink?r.trackLink({event:e.event,target:e.target},"$WebClick",e.props):r.track("$WebClick",e.props,e.callback)}},webStayEvent:{entry:function(e,t){t.sensors.track("$WebStay",e)}}};function Or(e){r(e.properties)?!e.isMatchedWithFilter||r(e.isMatchedWithFilter)?Sr("buildDataStage",{finalAdjustData:{priority:100,entry:function(t){try{if(r(e.isMatchedWithFilter))return e.isMatchedWithFilter(t)&&e.properties(t);e.properties(t)}catch(e){$e("execute registerPropertyPlugin callback error:"+e)}}}}):$e("registerPropertyPlugin arguments error, isMatchedWithFilter must be function"):$e("registerPropertyPlugin arguments error, properties must be function")}var Er=window.sensors_data_pre_config,Nr=!!Qt.isObject(Er)&&Er.is_compliance_enabled;function jr(e){e&&(t.events=kt,t.bridge=er,t.SDKJSBridge=tr,t.JSBridge=nr,t.store=It,t.unlimitedDiv=jt,t.customProp=At,t.vtrackcollect=$t,t.vapph5collect=Nt,t.detectMode=lr,t.registerFeature=br,t.registerInterceptor=Sr,t.commonWays=Jt,br(new Pr(t)),br(new Tr(t)),Sr("viewStage",Dr));var r=e?Gt:pr;for(var n in r)t[n]=r[n];t.logger=Ne,t.log=je,t._=Qt,t.on=mt,t.ee=ht,t.use=Kt,t.lib_version=Re,t.registerPropertyPlugin=Or}t.init=function(e){if(ht.sdk.emit("beforeInit"),t.readyState&&t.readyState.state&&t.readyState.state>=2)return!1;var r,n;Nr&&(jr(!0),dr()),ht.initSystemEvent(),t.setInitVar(),t.readyState.setState(2),t.initPara(e),ht.sdk.emit("initPara"),ht.sdk.emit("afterInitPara"),ht.sdk.emit("initAPI"),ht.sdk.emit("afterInitAPI"),t.detectMode(),r="",n=" { cursor: pointer; -webkit-tap-highlight-color: rgba(0,0,0,0); }",t.heatmap&&C(t.heatmap.otherTags)&&j(t.heatmap.otherTags,function(e){r+=e+n}),pe()&&Z()&&Z()<13&&(t.para.heatmap&&t.para.heatmap.collect_tags&&t.para.heatmap.collect_tags.div&&Se("div, [data-sensors-click]"+n),t.para.heatmap&&t.para.heatmap.track_attr&&Se("["+t.para.heatmap.track_attr.join("], [")+"]"+n),""!==r&&Se(r)),ht.sdk.emit("afterInit"),ht.sdk.emit("ready")},Nr?jr(!1):(jr(!0),dr());var Ar,$r="1.27.11",xr=(Ar={init:function(e){var t=e._.isString,r=e._.rot13defs,n=e._.dfmapping,i="data:enc;";e.ee.sdk.on("afterInitPara",function(){e.kit.userEncrypt=function(e){return"dfm-enc-"+n(e)},e.kit.userDecrypt=function(e){return 0===e.indexOf(i)?(e=e.substring(i.length),e=r(e)):0===e.indexOf("dfm-enc-")&&(e=e.substring(8),e=n(e)),e},e.kit.userDecryptIfNeeded=function(r){return!t(r)||0!==r.indexOf(i)&&0!==r.indexOf("dfm-enc-")||(r=e.kit.userDecrypt(r)),r}})},plugin_name:"UserEncryptDefault"},Ar.plugin_version=$r,Ar),Lr="1.27.11",Ur=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"Amp","sdkReady"),e.plugin_version=Lr,e}({sd:null,init:function(e){if(this.sd)return!1;if(this.sd=e,!this.sd||!this.sd._)return!1;var t=this.sd._.cookie.get("sensors_amp_id"),r=this.sd.store._state.distinct_id;if(t&&t.length>0){var n="amp-"===t.slice(0,4);if(t!==r){if(!n)return!1;this.sd.store._state.first_id?(this.sd.identify(t,!0),this.sd.saEvent.send({original_id:t,distinct_id:r,type:"track_signup",event:"$SignUp",properties:{}},null),this.setAmpId(r)):this.sd.identify(t,!0)}}else this.setAmpId(r);this.addListener()},addListener:function(){var e=this;this.sd.events.on("changeDistinctId",function(t){e.setAmpId(t)}),this.sd.events.isReady()},setAmpId:function(e){this.sd._.cookie.set("sensors_amp_id",e)}}),Rr=window.SensorsData_App_Visual_Bridge,Br=Rr&&Rr.sensorsdata_visualized_mode,Mr=Rr&&Rr.sensorsdata_visualized_alert_info,Hr=Rr&&Rr.sensorsdata_hover_web_nodes;function Fr(e){return Br.call(Rr)&&Hr&&Hr.call(Rr,JSON.stringify(e))}var zr,Jr,Vr,Wr,qr,Kr,Zr={commands:{app_alert:function(e){return Mr&&Mr.call(Rr,JSON.stringify(e))},visualized_track:Fr,page_info:Fr,sensorsdata_get_app_visual_config:function(e,t){return t&&"function"==typeof t[e.callType]&&t[e.callType]()}}},Xr="1.27.11",Yr={init:function(e){qr=(Wr=e)&&Wr._,Kr=Wr&&Wr.log||console&&console.log||function(){},zr=window.SensorsData_APP_New_H5_Bridge,Jr=zr&&zr.sensorsdata_track,Vr=Jr&&zr.sensorsdata_get_server_url&&zr.sensorsdata_get_server_url(),Kr("---test---fail---",!Wr,Wr.bridge.activeBridge,!Vr),Wr&&!Wr.bridge.activeBridge&&Vr&&(Wr.bridge.activeBridge=Yr,Wr.para.app_js_bridge&&!Wr.para.app_js_bridge.is_mui&&(Wr.bridge.is_verify_success=Vr&&Wr.bridge.validateAppUrl(Vr),Kr("---test---bridge-verify-",Wr.bridge.is_verify_success)),Wr.bridge.bridge_info={touch_app_bridge:!0,platform:"android",verify_success:Wr.bridge.is_verify_success?"success":"fail",support_two_way_call:!!zr.sensorsdata_js_call_app},Wr.para.app_js_bridge?Wr.registerInterceptor("sendDataStage",{send:{priority:60,entry:Gr}}):Kr("---test---app_js_bridge is not configured, data will not be sent by android bridge."))},handleCommand:function(e){var t=e.callType;if(t in Zr.commands)return Zr.commands[t](e,zr);zr&&qr.isFunction(zr.sensorsdata_js_call_app)&&zr.sensorsdata_js_call_app(JSON.stringify(e))}};function Gr(e,t){if(Kr("---test---datasend-",Wr.bridge.is_verify_success),Wr.para.app_js_bridge.is_mui||"item_set"===e.data.type||"item_delete"===e.data.type)return e;var r=e.callback;return Wr.bridge.is_verify_success?(Kr("---test---bridge-verify-success---",e.data),Jr&&Jr.call(zr,JSON.stringify(qr.extend({server_url:Wr.para.server_url},e.data))),qr.isFunction(r)&&r(),t.cancellationToken.cancel(),e):(Kr("---test---bridge-verify-fail-----",Wr.bridge.is_verify_success),Wr.para.app_js_bridge.is_send?(Wr.debug.apph5({data:e.data,step:"4.2",output:"all"}),e):(qr.isFunction(r)&&r(),t.cancellationToken.cancel(),e))}var Qr=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"AndroidBridge","sdkAfterInitPara"),e.plugin_version=Xr,e}(Yr),en=window.SensorsData_App_Visual_Bridge,tn=en&&en.sensorsdata_visualized_mode,rn=en&&en.sensorsdata_visualized_alert_info,nn=en&&en.sensorsdata_hover_web_nodes;function an(e){return tn.call(en)&&nn&&nn.call(en,JSON.stringify(e))}var sn,on,cn,ln,un,dn,pn,fn={commands:{app_alert:function(e){return rn&&rn.call(en,JSON.stringify(e))},visualized_track:an,page_info:an,sensorsdata_get_app_visual_config:function(e,t){return t&&"function"==typeof t[e.callType]&&t[e.callType]()}}},gn="1.27.11",hn={init:function(e){dn=(un=e)&&un._,pn=un&&un.log||console&&console.log||function(){},function(){if(pn("ObsoleteBridge---test---init---"),sn=window.SensorsData_APP_JS_Bridge,on=sn&&sn.sensorsdata_track,cn=sn&&sn.sensorsdata_verify,ln=sn&&sn.sensorsdata_visual_verify,pn("ObsoleteBridge-",un.bridge.activeBridge,cn,on,ln),un&&!un.bridge.activeBridge&&(cn||on||ln)){un.bridge.activeBridge=hn;var e=cn||on;ln&&(e=!!ln.call(sn,JSON.stringify({server_url:un.para.server_url})),pn("ObsoleteBridge---called-return",e)),un.bridge.bridge_info={touch_app_bridge:!0,platform:"android",verify_success:e?"success":"fail"},un.para.app_js_bridge?(un.registerInterceptor("sendDataStage",{send:{priority:80,entry:_n}}),pn("Android obsolete bridge inits succeed.")):pn("app_js_bridge is not configured, data will not be sent by android obsolete bridge.")}}()},handleCommand:function(e){pn("ObsoleteBridge---handleCommadn");var t=e.callType;return t in fn.commands?(pn("ObsoleteBridge---",t,fn.commands),fn.commands[t](e,sn)):sn&&dn.isFunction(sn.sensorsdata_js_call_app)?(pn("ObsoleteBridge---handleCommadn-abridge"),sn.sensorsdata_js_call_app(JSON.stringify(e))):void 0}};function _n(e,t){if(pn("ObsoleteBridge---senddata"),un.para.app_js_bridge.is_mui||"item_set"===e.data.type||"item_delete"===e.data.type)return e;var r=e.callback;if(cn){var n=cn&&cn.call(sn,JSON.stringify(dn.extend({server_url:un.para.server_url},e.data)));return pn("ObsoleteBridge---anVerify-success",n),n?(dn.isFunction(r)&&r(),t.cancellationToken.cancel(),e):un.para.app_js_bridge.is_send?(un.debug.apph5({data:e.data,step:"3.1",output:"all"}),e):(dn.isFunction(r)&&r(),t.cancellationToken.cancel(),e)}return pn("ObsoleteBridge---is-send-old-way",un.para.app_js_bridge.is_send),on&&on.call(sn,JSON.stringify(dn.extend({server_url:un.para.server_url},e.data))),dn.isFunction(r)&&r(),t.cancellationToken.cancel(),e}var mn,vn,yn,bn,wn,Sn=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"AndroidObsoleteBridge","sdkAfterInitPara"),e.plugin_version=gn,e}(hn),kn="1.27.11",In={event_list:[],latest_event_initial_time:null,max_save_time:2592e6,init:function(e,t){if(vn||!e)return!1;bn=(t=t||{}).cookie_name||"sensorsdata2015jssdkchannel",vn=e;var r=this;!function(){if(mn=vn._,yn=vn.store,!mn.localStorage.isSupport())return!1;r.eventList.init(),r.addLatestChannelUrl(),r.addIsChannelCallbackEvent()}()},addIsChannelCallbackEvent:function(){vn.registerPage({$is_channel_callback_event:function(e){if(mn.isObject(e)&&e.event&&"$WebClick"!==e.event&&"$pageview"!==e.event&&"$WebStay"!==e.event&&"$SignUp"!==e.event)return!In.eventList.hasEvent(e.event)&&(In.eventList.add(e.event),!0)}})},addLatestChannelUrl:function(){var e=this.getUrlDomain(),t=this.cookie.getChannel();if("url解析失败"===e)this.registerAndSave({_sa_channel_landing_url:"",_sa_channel_landing_url_error:"url的domain解析失败"});else if(mn.isReferralTraffic(document.referrer)){var r=mn.getQueryParam(location.href,"sat_cf");mn.isString(r)&&r.length>0?(this.registerAndSave({_sa_channel_landing_url:location.href}),In.channelLinkHandler()):this.registerAndSave({_sa_channel_landing_url:""})}else t?vn.registerPage(t):vn.registerPage({_sa_channel_landing_url:"",_sa_channel_landing_url_error:"取值异常"})},registerAndSave:function(e){vn.registerPage(e),this.cookie.saveChannel(e)},cookie:{getChannel:function(){var e=vn.kit.userDecryptIfNeeded(mn.cookie.get(bn));return e=mn.safeJSONParse(e),!(!mn.isObject(e)||!e.prop)&&e.prop},saveChannel:function(e){var t={prop:e},r=JSON.stringify(t);vn.para.encrypt_cookie&&(r=vn.kit.userEncrypt(r)),mn.cookie.set(bn,r)}},channelLinkHandler:function(){this.eventList.reset(),vn.track("$ChannelLinkReaching")},getUrlDomain:function(){var e=mn.info.pageProp.url_domain;return""===e&&(e="url解析失败"),e},eventList:{init:function(){var e=this.get(),t=(new Date).getTime();if(e&&mn.isNumber(e.latest_event_initial_time)&&mn.isArray(e.eventList)){var r=t-e.latest_event_initial_time;r>0&&r<In.max_save_time?(In.event_list=e.eventList,In.latest_event_initial_time=e.latest_event_initial_time):this.reset()}else this.reset()},get:function(){var e={};try{e=yn.readObjectVal("sawebjssdkchannel")}catch(e){vn.log(e)}return e},add:function(e){In.event_list.push(e),this.save()},save:function(){var e={latest_event_initial_time:In.latest_event_initial_time,eventList:In.event_list};yn.saveObjectVal("sawebjssdkchannel",e)},reset:function(){In.event_list=[],In.latest_event_initial_time=(new Date).getTime(),this.save()},hasEvent:function(e){var t=!1;return mn.each(In.event_list,function(r){r===e&&(t=!0)}),t}}},Cn=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"SensorsChannel","sdkAfterInitAPI"),e.plugin_version=kn,e}(In),Pn="1.27.11",Tn=function(){var e={};return void 0!==document.hidden?(e.hidden="hidden",e.visibilityChange="visibilitychange"):void 0!==document.msHidden?(e.hidden="msHidden",e.visibilityChange="msvisibilitychange"):void 0!==document.webkitHidden&&(e.hidden="webkitHidden",e.visibilityChange="webkitvisibilitychange"),e};function Dn(){return void 0!==wn&&document[wn]}wn=Tn().hidden;var On,En,Nn,jn,An,$n={android:/Android/i,iOS:/iPhone|iPad|iPod/i,harmony:/OpenHarmony/i},xn=function(){for(var e in $n)if(navigator.userAgent.match($n[e]))return e;return""}(),Ln=function(e){return null!=e&&"[object Object]"==Object.prototype.toString.call(e)},Un=function(e,t,r){e.log("尝试唤起 android app");var n=t;e.log("唤起APP的地址:"+n),window.location=n,e.timer=setTimeout(function(){var t=Dn();if(e.log("hide:"+wn+":"+document[wn]),t)return e.log("The page is hidden, stop navigating to download page"),!1;e.log("App可能未安装,跳转到下载地址"),window.location=r},e.timeout)},Rn={plugin_name:["deeplink","Deeplink"],key:null,timer:null,sd:null,data:null,timeout:2500,apiURL:"{origin}/sdk/deeplink/param?key={key}&system_type=JS&project={project}",init:function(e){if(this.sd)return this.logger("deeplink已经初始化"),!1;arguments[0]?Ln(arguments[0])&&"number"==typeof arguments[0].timeout?this.sd=window.sensorsDataAnalytic201505:this.sd=e:this.sd=window.sensorsDataAnalytic201505;var t={};if(arguments.length>0&&(1===arguments.length&&Ln(arguments[0])?t=arguments[0]:arguments.length>=2&&Ln(arguments[1])&&(t=arguments[1])),!$n.hasOwnProperty(xn))return this.logger("不支持当前系统,目前只支持Android和iOS"),!1;if(Ln(t)&&this.sd._.isNumber(t.timeout)&&t.timeout>=2500&&(this.timeout=t.timeout),!this.sd.para.server_url)return this.logger("神策JS SDK配置项server_url未正确配置"),!1;var r=function(e){var t=e._.URL(e.para.server_url);return{origin:t.origin,project:t.searchParams.get("project")||"default"}}(this.sd);this.apiURL=this.apiURL.replace("{origin}",r.origin).replace("{project}",r.project);var n=this.sd._.getQueryParam(window.location.href,"deeplink");if(!n)return this.logger("当前页面缺少deeplink参数"),!1;var i=(n=window.decodeURIComponent(n)).match(/\/sd\/(\w+)\/(\w+)$/);if(!i)return this.logger("当前页面的deeplink参数无效"),!1;this.key=i[2],this.apiURL=this.apiURL.replace("{key}",window.encodeURIComponent(i[2])),this.sd._.ajax({url:this.apiURL,type:"GET",cors:!0,credentials:!1,success:function(e){if(e.errorMsg)return Rn.logger("API报错:"+e.errorMsg),!1;Rn.data=e,Rn.logger("API查询成功,数据:"+JSON.stringify(e,null," ")),this.data.app_key&&(this.data.android_info&&this.data.android_info.url_schemes&&(this.data.android_info.url_schemes+="://sensorsdata/sd/"+this.data.app_key+"/"+this.key),this.data.ios_info&&this.data.ios_info.url_schemes&&(this.data.ios_info.url_schemes+="://sensorsdata/sd/"+this.data.app_key+"/"+this.key),this.data.harmony_info&&this.data.harmony_info.url_schemes&&(this.data.harmony_info.url_schemes+="://sensorsdata/sd/"+this.data.app_key+"/"+this.key))}.bind(this),error:function(){Rn.logger("API查询出错")}}),this.addListeners()},openDeepLink:function(){if(this.logger("openDeeplink()"),!this.data)return this.logger("没有Deep link数据!"),!1;if("iOS"===xn){this.logger("当前系统是iOS");var e=this.sd&&this.sd._&&this.sd._.getIOSVersion()>=9&&this.data.ios_info.ios_wake_url?this.data.ios_info.ios_wake_url:this.data.ios_info.url_schemes;this.logger("唤起APP的地址:"+e),r=this,n=e,i=this.data.ios_info.download_url,r.log("尝试唤起 iOS app:"+n),window.location.href=n,r.timer=setTimeout(function(){if(Dn())return r.log("The page is hidden, stop navigating to download page"),!1;r.log("App可能未安装,跳转到下载地址"),window.location.href=i},r.timeout),r.log("new timer:"+r.timer)}else if("android"===xn)this.logger("当前系统是 android"),Un(this,this.data.android_info.url_schemes,this.data.android_info.download_url);else if("harmony"===xn){var t=this.data.harmony_info.app_linking_url||this.data.harmony_info.url_schemes;this.logger("当前系统是 HarmonyOS"),Un(this,t,this.data.harmony_info.download_url)}var r,n,i},logger:function(e){this.sd&&this.sd.log(e)},addListeners:function(){var e=Tn().visibilityChange,t=this;e&&document.addEventListener(e,function(){clearTimeout(t.timer),t.logger("visibilitychange, clear timeout:"+t.timer)},!1),window.addEventListener("pagehide",function(){t.logger("page hide, clear timeout:"+t.timer),clearTimeout(t.timer)},!1)}},Bn=function(e){return function(e,t,r){if(e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,null,"sdkReady"),e.plugin_version=Pn,e}(Rn),Mn="1.27.11",Hn={init:function(e){jn=(Nn=e)&&Nn._,An=Nn&&Nn.log||console&&console.log||function(){},On=window.SensorsData_iOS_JS_Bridge&&window.SensorsData_iOS_JS_Bridge.sensorsdata_app_server_url,En=function(){return window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.sensorsdataNativeTracker},Nn&&!Nn.bridge.activeBridge&&En()&&En().postMessage&&(Nn.bridge.activeBridge=Hn,Nn.para.app_js_bridge&&!Nn.para.app_js_bridge.is_mui&&(Nn.bridge.is_verify_success=On&&Nn.bridge.validateAppUrl(On)),Nn.bridge.bridge_info={touch_app_bridge:!0,platform:"ios",verify_success:Nn.bridge.is_verify_success?"success":"fail",support_two_way_call:!0},Nn.para.app_js_bridge?(Nn.registerInterceptor("sendDataStage",{send:{priority:70,entry:Fn}}),An("IOS bridge inits succeed.")):An("app_js_bridge is not configured, data will not be sent by iOS bridge."))},handleCommand:function(e){var t=e.callType;return"page_info"!==t&&"visualized_track"!==t||Nn.bridge.hasVisualModeBridge()?"sensorsdata_get_app_visual_config"===t?jn.isObject(window.SensorsData_APP_New_H5_Bridge)&&window.SensorsData_APP_New_H5_Bridge[t]:En()&&En().postMessage(JSON.stringify(e)):null}};function Fn(e,t){if(Nn.para.app_js_bridge.is_mui||"item_set"===e.data.type||"item_delete"===e.data.type)return e;var r=e.callback;return Nn.bridge.is_verify_success?(En()&&En().postMessage(JSON.stringify({callType:"app_h5_track",data:jn.extend({server_url:Nn.para.server_url},e.data)})),jn.isFunction(r)&&r(),t.cancellationToken.cancel(),e):Nn.para.app_js_bridge.is_send?(Nn.debug.apph5({data:e.data,step:"4.1",output:"all"}),e):(jn.isFunction(r)&&r(),t.cancellationToken.cancel(),e)}var zn,Jn,Vn,Wn=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"IOSBridge","sdkAfterInitPara"),e.plugin_version=Mn,e}(Hn),qn="1.27.11",Kn={init:function(e){Jn=(zn=e)&&zn._,Vn=zn&&zn.log||console&&console.log||function(){},!zn||zn.bridge.activeBridge||!/sensors-verify/.test(navigator.userAgent)&&!/sa-sdk-ios/.test(navigator.userAgent)||window.MSStream||(zn.bridge.activeBridge=Kn,zn.bridge.bridge_info={touch_app_bridge:!0,platform:"ios",verify_success:Zn()?"success":"fail"},zn.para.app_js_bridge?(zn.registerInterceptor("sendDataStage",{send:{priority:90,entry:Xn}}),Vn("IOS obsolete bridge inits succeed.")):Vn("app_js_bridge is not configured, data will not be sent by iOS obsolete bridge."))}};function Zn(){if(/sensors-verify/.test(navigator.userAgent)){var e=navigator.userAgent.match(/sensors-verify\/([^\s]+)/);if(e&&e[0]&&"string"==typeof e[1]&&2===e[1].split("?").length){e=e[1].split("?");var t=null,r=null;try{t=Jn.URL(zn.para.server_url).hostname,r=Jn.URL(zn.para.server_url).searchParams.get("project")||"default"}catch(e){zn.log(e)}return!(!t||t!==e[0]||!r||r!==e[1])}return!1}return!!/sa-sdk-ios/.test(navigator.userAgent)}function Xn(e,t){if(zn.para.app_js_bridge.is_mui||"item_set"===e.data.type||"item_delete"===e.data.type)return e;var r,n,i=e.callback;if(zn.bridge.bridge_info.verify_success){var a=document.createElement("iframe"),s=(r=e.data,n=(n=JSON.stringify(Jn.extend({server_url:zn.para.server_url},r))).replace(/\r\n/g,""),"sensorsanalytics://trackEvent?event="+(n=encodeURIComponent(n)));return a.setAttribute("src",s),document.documentElement.appendChild(a),a.parentNode.removeChild(a),a=null,Jn.isFunction(i)&&i(),t.cancellationToken.cancel(),!0}return zn.para.app_js_bridge.is_send?(zn.debug.apph5({data:e.data,step:"3.2",output:"all"}),e):(Jn.isFunction(i)&&i(),t.cancellationToken.cancel(),e)}var Yn=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"IOSObsoleteBridge","sdkAfterInitPara"),e.plugin_version=qn,e}(Kn),Gn="1.27.11",Qn=432e3;function ei(){this.sd=null,this.start_time=+new Date,this.page_show_status=!0,this.page_hidden_status=!1,this._={},this.timer=null,this.current_page_url=document.referrer,this.url=location.href,this.title=document.title||"",this.option={},this.heartbeat_interval_time=5e3,this.heartbeat_interval_timer=null,this.page_id=null,this.storage_name="sawebjssdkpageleave",this.max_duration=Qn}ei.prototype.init=function(e,t){if(e){if(this.sd=e,this._=this.sd._,t){this.option=t;var r=t.heartbeat_interval_time;r&&(this._.isNumber(r)||this._.isNumber(1*r))&&1*r>0&&(this.heartbeat_interval_time=1e3*r);var n=t.max_duration;n&&(this._.isNumber(n)||this._.isNumber(1*n))&&1*n>0&&(this.max_duration=n)}this.page_id=Number(String(this._.getRandom()).slice(2,5)+String(this._.getRandom()).slice(2,4)+String((new Date).getTime()).slice(-4)),this.addEventListener(),!0===document.hidden?this.page_show_status=!1:this.addHeartBeatInterval(),this.log("PageLeave初始化完毕")}else this.log("神策JS SDK未成功引入")},ei.prototype.log=function(e){this.sd&&this.sd.log(e)},ei.prototype.refreshPageEndTimer=function(){var e=this;this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(function(){e.page_hidden_status=!1},5e3)},ei.prototype.hiddenStatusHandler=function(){clearTimeout(this.timer),this.timer=null,this.page_hidden_status=!1},ei.prototype.pageStartHandler=function(){this.start_time=+new Date,1==!document.hidden?this.page_show_status=!0:this.page_show_status=!1,this.url=location.href,this.title=document.title},ei.prototype.pageEndHandler=function(){if(!0!==this.page_hidden_status){var e=this.getPageLeaveProperties();!1===this.page_show_status&&delete e.event_duration,this.page_show_status=!1,this.page_hidden_status=!0,this.isCollectUrl(this.url)&&this.sd.track("$WebPageLeave",e),this.refreshPageEndTimer(),this.delHeartBeatData()}},ei.prototype.addEventListener=function(){this.addPageStartListener(),this.addPageSwitchListener(),this.addSinglePageListener(),this.addPageEndListener()},ei.prototype.addPageStartListener=function(){var e=this;"onpageshow"in window&&this._.addEvent(window,"pageshow",function(){e.pageStartHandler(),e.hiddenStatusHandler()})},ei.prototype.isCollectUrl=function(e){return"function"!=typeof this.option.isCollectUrl||"string"!=typeof e||""===e||this.option.isCollectUrl(e)},ei.prototype.addSinglePageListener=function(){var e=this;this.sd.ee&&this.sd.ee.spa.prepend("switch",function(t){t!==location.href&&(e.url=t,e.pageEndHandler(),e.stopHeartBeatInterval(),e.current_page_url=e.url,e.pageStartHandler(),e.hiddenStatusHandler(),e.addHeartBeatInterval())})},ei.prototype.addPageEndListener=function(){var e=this;this._.each(["pagehide","beforeunload","unload"],function(t){"on"+t in window&&e._.addEvent(window,t,function(){e.pageEndHandler(),e.stopHeartBeatInterval()})})},ei.prototype.addPageSwitchListener=function(){var e=this;this._.listenPageState({visible:function(){e.pageStartHandler(),e.hiddenStatusHandler(),e.addHeartBeatInterval()},hidden:function(){e.url=location.href,e.title=document.title,e.pageEndHandler(),e.stopHeartBeatInterval()}})},ei.prototype.addHeartBeatInterval=function(){this._.localStorage.isSupport()&&this.startHeartBeatInterval()},ei.prototype.startHeartBeatInterval=function(){var e=this;this.heartbeat_interval_timer&&this.stopHeartBeatInterval();var t=!0;this.isCollectUrl(this.url)||(t=!1),this.heartbeat_interval_timer=setInterval(function(){t&&e.saveHeartBeatData()},this.heartbeat_interval_time),t&&this.saveHeartBeatData("is_first_heartbeat"),this.reissueHeartBeatData()},ei.prototype.stopHeartBeatInterval=function(){clearInterval(this.heartbeat_interval_timer),this.heartbeat_interval_timer=null},ei.prototype.saveHeartBeatData=function(e){var t=this.getPageLeaveProperties(),r=new Date;t.$time=r,"is_first_heartbeat"===e&&(t.event_duration=3.14);var n=this.sd.kit.buildData({type:"track",event:"$WebPageLeave",properties:t});n.heartbeat_interval_time=this.heartbeat_interval_time,this.sd.store.saveObjectVal(this.storage_name+"-"+this.page_id,n)},ei.prototype.delHeartBeatData=function(e){this._.localStorage.isSupport()&&this._.localStorage.remove(e||this.storage_name+"-"+this.page_id)},ei.prototype.reissueHeartBeatData=function(){for(var e=window.localStorage.length-1;e>=0;e--){var t=window.localStorage.key(e);if(t&&t!==this.storage_name+"-"+this.page_id&&0===t.indexOf(this.storage_name+"-")){var r=this.sd.store.readObjectVal(t);this._.isObject(r)&&1*new Date-r.time>r.heartbeat_interval_time+5e3&&(delete r.heartbeat_interval_time,r._flush_time=(new Date).getTime(),this.sd.kit.sendData(r),this.delHeartBeatData(t))}}},ei.prototype.getPageLeaveProperties=function(){var e=(+new Date-this.start_time)/1e3;(isNaN(e)||e<0||e>this.max_duration)&&(e=0),e=Number(e.toFixed(3));var t=this._.getReferrer(this.current_page_url),r=document.documentElement&&document.documentElement.scrollTop||window.pageYOffset||document.body&&document.body.scrollTop||0;r=Math.round(r)||0;var n={$title:this.title,$url:this._.getURL(this.url),$url_path:this._.getURLPath(this._.URL(this.url).pathname),$referrer_host:t?this._.getHostname(t):"",$referrer:t,$viewport_position:r};return 0!==e&&(n.event_duration=e),this._.extend(n,this.option.custom_props)};var ti=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"PageLeave","sdkReady"),e.plugin_version=Gn,e}(new ei),ri="1.27.11",ni=!1,ii=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"PageLoad","sdkReady"),e.plugin_version=ri,e}({init:function(e,t){function r(){var n=0,i=window.performance||window.webkitPerformance||window.msPerformance||window.mozPerformance,a={$url:e._.getURL(),$title:document.title,$url_path:e._.getURLPath(),$referrer:e._.getReferrer(null,!0)};if(i?(n=function(t){var r=0;return e._.isFunction(t.getEntriesByType)&&(r=((t.getEntriesByType("navigation")||[{}])[0]||{}).domContentLoadedEventEnd||0),r}(i)||function(t){var r=0;if(t.timing){var n=t.timing;0!==n.fetchStart&&e._.isNumber(n.fetchStart)&&0!==n.domContentLoadedEventEnd&&e._.isNumber(n.domContentLoadedEventEnd)?r=n.domContentLoadedEventEnd-n.fetchStart:e.log("performance 数据获取异常")}return r}(i),function(t,r){if(t.getEntries&&"function"==typeof t.getEntries){for(var n=t.getEntries(),i=null,a=0;a<n.length;a++)"transferSize"in n[a]&&(i+=n[a].transferSize);e._.isNumber(i)&&i>=0&&i<10737418240&&(r.$page_resource_size=Number((i/1024).toFixed(3)))}}(i,a)):e.log("浏览器未支持 performance API."),n>0){var s=e._.isObject(t)&&t.max_duration||1800;n=Number((n/1e3).toFixed(3)),(!e._.isNumber(s)||s<=0||n<=s)&&(a.event_duration=n)}ni||(e.track("$WebPageLoad",a),ni=!0),window.removeEventListener?window.removeEventListener("load",r):window.detachEvent&&window.detachEvent("onload",r)}"complete"==document.readyState?r():window.addEventListener?window.addEventListener("load",r):window.attachEvent&&window.attachEvent("onload",r)}});function ai(){this.sd=null,this.log=window.console&&window.console.log||function(){},this.customRegister=[]}ai.prototype.init=function(e){if(e){this.sd=e,this._=e._,this.log=e.log;var t=this;e.registerInterceptor("buildDataStage",{extendProps:{priority:0,entry:function(e){return function(e,t){if("track"!==e.type)return e;var r=t.sd,n=r._,i=r.saEvent.check,a=n.extend2Lev({properties:{}},e),s=t.customRegister,o=a.properties,c=a.event,l={};return n.each(s,function(e){if(n.isObject(e))n.indexOf(e.events,c)>-1&&i({properties:e.properties})&&(l=n.extend(l,e.properties));else if(n.isFunction(e)){var t=e({event:c,properties:o,data:a});n.isObject(t)&&!n.isEmptyObject(t)&&i({properties:t})&&(l=n.extend(l,t))}}),e.properties=n.extend(o,l),e}(e,t)}}})}else this.log("神策JS SDK未成功引入")},ai.prototype.register=function(e){this.sd?this._.isObject(e)&&this._.isArray(e.events)&&e.events.length>0&&this._.isObject(e.properties)&&!this._.isEmptyObject(e.properties)?this.customRegister.push(e):this.log("RegisterProperties: register 参数错误"):this.log("神策JS SDK未成功引入")},ai.prototype.hookRegister=function(e){this.sd?this._.isFunction(e)?this.customRegister.push(e):this.log("RegisterProperties: hookRegister 参数错误"):this.log("神策JS SDK未成功引入")};var si="1.27.11";ai.prototype.plugin_name="RegisterProperties";var oi,ci,li=function(e){return e.plugin_version=si,e}(new ai),ui="1.27.11",di=window.console&&window.console.log||function(){};function pi(e){try{if("$pageview"!==e.event&&(!e.type||"profile"!==e.type.slice(0,7))){var t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0,r=document.documentElement.scrollHeight||0,n={$page_height:Math.max(t,r)||0};e.properties=oi._.extend(e.properties||{},n)}}catch(e){di("页面高度获取异常。")}return ci.call(oi.kit,e)}var fi,gi=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"RegisterPropertyPageHeight","sdkReady"),e.plugin_version=ui,e}({init:function(e){di=(oi=e)&&oi.log||di,e&&e.kit&&e.kit.buildData?(ci=oi.kit.buildData,oi.kit.buildData=pi,di("RegisterPropertyPageHeight 插件初始化完成")):di("RegisterPropertyPageHeight 插件初始化失败,当前主sdk不支持 RegisterPropertyPageHeight 插件,请升级主sdk")}}),hi="1.27.11",_i={getPart:function(e){var t=this.option.length;if(t)for(var r=0;r<t;r++)if(e.indexOf(this.option[r].part_url)>-1)return!0;return!1},getPartHash:function(e){var t=this.option.length;if(t)for(var r=0;r<t;r++)if(e.indexOf(this.option[r].part_url)>-1)return this.option[r].after_hash;return!1},getCurrenId:function(){var e=this.store.getDistinctId()||"",t=this.store.getFirstId()||"";return this._.urlSafeBase64&&this._.urlSafeBase64.encode?e=e?this._.urlSafeBase64.trim(this._.urlSafeBase64.encode(this._.base64Encode(e))):"":this._.rot13obfs&&(e=e?this._.rot13obfs(e):""),encodeURIComponent(t?"f"+e:"d"+e)},rewriteUrl:function(e,t){var r=this,n=/([^?#]+)(\?[^#]*)?(#.*)?/.exec(e),i="";if(n){var a,s=n[1]||"",o=n[2]||"",c=n[3]||"",l="_sasdk="+this.getCurrenId(),u=function(e){var t=e.split("&"),n=[];return r._.each(t,function(e){e.indexOf("_sasdk=")>-1?n.push(l):n.push(e)}),n.join("&")};return this.getPartHash(e)?(a=c.indexOf("_sasdk"),i=c.indexOf("?")>-1?a>-1?s+o+"#"+c.substring(1,a)+u(c.substring(a,c.length)):s+o+c+"&"+l:s+o+"#"+c.substring(1)+"?"+l):(a=o.indexOf("_sasdk"),i=/^\?(\w)+/.test(o)?a>-1?s+"?"+u(o.substring(1))+c:s+o+"&"+l+c:s+"?"+l+c),t&&(t.href=i),i}},getUrlId:function(){var e=location.href.match(/_sasdk=([aufd][^\?\#\&\=]+)/);if(this._.isArray(e)&&e[1]){var t=decodeURIComponent(e[1]);return!t||"f"!==t.substring(0,1)&&"d"!==t.substring(0,1)||(this._.urlSafeBase64&&this._.urlSafeBase64.isUrlSafeBase64&&this._.urlSafeBase64.isUrlSafeBase64(t)?t=t.substring(0,1)+this._.base64Decode(this._.urlSafeBase64.decode(t.substring(1))):this._.rot13defs&&(t=t.substring(0,1)+this._.rot13defs(t.substring(1)))),t}return""},setRefferId:function(e){var t=this.store.getDistinctId(),r=this.getUrlId();if(r&&""!==r){var n="a"===r.substring(0,1)||"d"===r.substring(0,1);(r=r.substring(1))!==t&&(n?(this.sd.identify(r,!0),this.store.getFirstId()&&this.sd.saEvent.send({original_id:r,distinct_id:t,type:"track_signup",event:"$SignUp",properties:{}},null)):this.store.getFirstId()&&!e.re_login||this.sd.login(r))}},addListen:function(){var e=this,t=function(t){var r,n,i=t.target,a=i.tagName.toLowerCase(),s=i.parentNode;if("a"===a&&i.href||s&&s.tagName&&"a"===s.tagName.toLowerCase()&&s.href){"a"===a&&i.href?(r=i.href,n=i):(r=s.href,n=s);var o=e._.URL(r).protocol;"http:"!==o&&"https:"!==o||e.getPart(r)&&e.rewriteUrl(r,n)}};e._.addEvent(document,"mousedown",t),window.PointerEvent&&"maxTouchPoints"in window.navigator&&window.navigator.maxTouchPoints>=0&&e._.addEvent(document,"pointerdown",t)},init:function(e,t){this.sd=e,this._=e._,this.store=e.store,this.para=e.para,this._.isObject(t)&&this._.isArray(t.linker)&&t.linker.length>0?(this.setRefferId(t),this.addListen(),this.option=t.linker,this.option=function(t){for(var r=t.length,n=[],i=0;i<r;i++)/[A-Za-z0-9]+\./.test(t[i].part_url)&&"[object Boolean]"==Object.prototype.toString.call(t[i].after_hash)?n.push(t[i]):e.log("linker 配置的第 "+(i+1)+" 项格式不正确,请检查参数格式!");return n}(this.option)):e.log("请配置打通域名参数!")}},mi=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"SiteLinker","sdkReady"),e.plugin_version=hi,e}(_i),vi="utm_source utm_medium utm_campaign utm_content utm_term",yi="1.27.11",bi=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"Utm","sdkAfterInitPara"),e.plugin_version=yi,e}({init:function(e){e&&!fi&&(fi=e).registerInterceptor("businessStage",{getUtmData:{priority:0,entry:function(){return function(){var e=vi.split(" "),t="",r={};return fi._.isArray(fi.para.source_channel)&&fi.para.source_channel.length>0&&(e=e.concat(fi.para.source_channel),e=fi._.unique(e)),fi._.each(e,function(e){(t=fi._.getQueryParam(location.href,e)).length&&(r[e]=t)}),r}()}}})}}),wi="1.27.11",Si=!1,ki=null;function Ii(){Si=!0}function Ci(){Si=!1}function Pi(){return Si}var Ti,Di,Oi=function(e){return function(e,t,r){if(e.plugin_name=t,e.init){var n=e.init;e.init=function(i,a){if(function(e,t,r){function n(t,n){e.logger?e.logger.msg.apply(e.logger,n).module(r+"").level(t).log():e.log&&e.log.apply(e,n)}t.log=function(){n("log",arguments)},t.warn=function(){n("warn",arguments)},t.error=function(){n("error",arguments)}}(i,e,t),i.readyState&&i.readyState.state>=3||!i.on)return s();function s(){n.call(e,i,a)}i.on(r,s)}}}(e,"DisableSDK","sdkInitAPI"),e.plugin_version=wi,e}({init:function(e){(ki=e).disableSDK=Ii,ki.enableSDK=Ci,ki.getDisabled=Pi}}),Ei="1.27.11";function Ni(e,t){if(!0===Ti.para.debug_mode){var r=e.data;e.callback,function(e){var t=e,r="";r=-1!==Ti.para.debug_mode_url.indexOf("?")?Ti.para.debug_mode_url+"&"+Ti.kit.encodeTrackData(e):Ti.para.debug_mode_url+"?"+Ti.kit.encodeTrackData(e),Di.ajax({url:r,type:"GET",cors:!0,header:{"Dry-Run":String(Ti.para.debug_mode_upload)},success:function(e){!0===Di.isEmptyObject(e)?alert("debug数据发送成功"+t):alert("debug失败 错误原因"+JSON.stringify(e))}})}(JSON.stringify(r)),t.cancellationToken.stop()}return e}function ji(){Ti.on("sdkInitPara",function(){!0===Ti.para.debug_mode&&(Ti.para.debug_mode_upload=Ti.para.debug_mode_upload||!1,Di.isString(Ti.para.debug_mode_url)||(Di.isString(Ti.para.server_url)?Ti.para.debug_mode_url=Ti.para.server_url.replace("sa.gif","debug"):Di.isArray(Ti.para.server_url)&&Di.isString(Ti.para.server_url[0])?Ti.para.debug_mode_url=Ti.para.server_url[0].replace("sa.gif","debug"):Ti.para.debug_mode=!1))}),Ti.on("sdkAfterInitPara",function(){Ti.registerInterceptor("sendDataStage",{send:{priority:30,entry:Ni}})})}var Ai,$i,xi=function(e){return e.plugin_version=Ei,e}({plugin_name:"DebugSender",init:function(e){Di=(Ti=e)._,ji()}}),Li="1.27.11";function Ui(e,t){if($i.isObject(Ai.para.jsapp)&&!Ai.para.jsapp.isOnline&&"function"==typeof Ai.para.jsapp.setData){var r=e;delete r.callback,r=JSON.stringify(r),Ai.para.jsapp.setData(r),t.cancellationToken.stop()}return e}function Ri(e){if(!0===e&&$i.isObject(Ai.para.jsapp)&&"function"==typeof Ai.para.jsapp.getData){Ai.para.jsapp.isOnline=!0;var t=Ai.para.jsapp.getData();$i.isArray(t)&&t.length>0&&$i.each(t,function(e){$i.isJSONString(e)&&Ai.kit.sendData(JSON.parse(e))})}else Ai.para.jsapp.isOnline=!1}var Bi,Mi,Hi=function(e){return e.plugin_version=Li,e}({plugin_name:"JsappSender",init:function(e){$i=(Ai=e)._,Ai.on("sdkAfterInitAPI",function(){$i.isObject(Ai.commonWays)&&(Ai.commonWays.setOnlineState=Ri),Ai.registerInterceptor("sendDataStage",{send:{priority:40,entry:Ui}})})}}),Fi="1.27.11",zi=null;function Ji(e,t){return!Bi.para.app_js_bridge&&Bi.para.batch_send&&Mi.localStorage.isSupport()&&localStorage.length<Bi.para.batch_send.storage_length&&(zi.add(e.data),t.cancellationToken.stop()),e}function Vi(){Bi.on("sdkInitPara",function(){var e;e={datasend_timeout:6e3,send_interval:6e3,storage_length:200},Mi.localStorage.isSupport()&&Mi.isSupportCors()&&"object"==typeof localStorage?!0===Bi.para.batch_send?Bi.para.batch_send=Mi.extend({},e):"object"==typeof Bi.para.batch_send&&(Bi.para.batch_send=Mi.extend({},e,Bi.para.batch_send)):Bi.para.batch_send=!1}),Bi.on("sdkAfterInitPara",function(){!Bi.para.app_js_bridge&&Bi.para.batch_send&&Mi.localStorage.isSupport()&&(zi||(zi=new Mi.BatchSend),zi.batchInterval(),Bi.registerInterceptor("sendDataStage",{send:{priority:100,entry:Ji}}))})}var Wi,qi,Ki=function(e){return e.plugin_version=Fi,e}({plugin_name:"BatchSender",init:function(e){Mi=(Bi=e)._,Vi()}}),Zi="1.27.11";function Xi(e){new qi.BeaconSend(e).start()}function Yi(e,t){var r=null,n=null;if(qi.isObject(e.config)&&(r=e.config.send_type,n=qi.optimizeServerUrl(e.config.server_url)),("beacon"===r||!r&&"beacon"===Wi.para.send_type)&&qi.isSupportBeaconSend()){var i=n||e.server_url;e.server_url=i,e.data=Wi.kit.encodeTrackData(e.data),qi.isArray(i)&&i.length?qi.each(i,function(t){e.callback=null,e.server_url=t,Xi(e)}):"string"==typeof i&&""!==i?Xi(e):Wi.log("当前 server_url 为空或不正确,只在控制台打印日志,network 中不会发数据,请配置正确的 server_url!"),t.cancellationToken.stop()}return e}function Gi(){Wi.on("sdkInitPara",function(){"beacon"!==Wi.para.send_type||qi.isSupportBeaconSend()||(Wi.para.send_type=Wi.DEFAULT_SEND_TYPE)}),Wi.on("sdkAfterInitPara",function(){Wi.registerInterceptor("sendDataStage",{send:{priority:110,entry:Yi}})})}var Qi,ea,ta=function(e){return e.plugin_version=Zi,e}({plugin_name:"BeaconSender",init:function(e){qi=(Wi=e)._,Gi()}}),ra="1.27.11";function na(e){new ea.AjaxSend(e).start()}function ia(e,t){var r=null,n=null;if(ea.isObject(e.config)&&(r=e.config.send_type,n=ea.optimizeServerUrl(e.config.server_url)),("ajax"===r||!r&&"ajax"===Qi.para.send_type)&&ea.isSupportCors()){var i=n||e.server_url;e.server_url=i,e.data=Qi.kit.encodeTrackData(e.data),ea.isArray(i)&&i.length?ea.each(i,function(t){e.callback=null,e.server_url=t,na(e)}):"string"==typeof i&&""!==i?na(e):Qi.log("当前 server_url 为空或不正确,只在控制台打印日志,network 中不会发数据,请配置正确的 server_url!"),t.cancellationToken.stop()}return e}function aa(){Qi.on("sdkInitPara",function(){"ajax"!==Qi.para.send_type||ea.isSupportCors()||(Qi.para.send_type=Qi.DEFAULT_SEND_TYPE)}),Qi.on("sdkAfterInitPara",function(){Qi.registerInterceptor("sendDataStage",{send:{priority:120,entry:ia}})})}var sa,oa,ca=function(e){return e.plugin_version=ra,e}({plugin_name:"AjaxSender",init:function(e){ea=(Qi=e)._,aa()}}),la="1.27.11";function ua(e,t){var r=sa.kit.encodeTrackData(t);return-1!==e.indexOf("?")?e+"&"+r:e+"?"+r}function da(e){new oa.ImageSend(e).start()}function pa(e,t){var r=null;oa.isObject(e.config)&&(r=oa.optimizeServerUrl(e.config.server_url));var n=r||e.server_url,i=e.data;e.server_url=n,oa.isArray(n)&&n.length?oa.each(n,function(t){t&&(e.data=ua(t,i),e.callback=null,e.server_url=t,da(e))}):"string"==typeof n&&""!==n?(e.data=ua(n,i),da(e)):sa.logger&&sa.logger.msg("当前 server_url 为空或不正确,只在控制台打印日志,network 中不会发数据,请配置正确的 server_url!").level("warn").log(),t.cancellationToken.stop()}function fa(){sa.on("sdkInitPara",function(){"image"!==sa.para.send_type&&"ajax"!==sa.para.send_type&&"beacon"!==sa.para.send_type&&(sa.para.send_type="image")}),sa.on("sdkAfterInitPara",function(){sa.registerInterceptor("sendDataStage",{send:{priority:130,entry:pa}})})}var ga=function(e){return e.plugin_version=la,e}({plugin_name:"ImageSender",init:function(e){oa=(sa=e)._,fa()}}),ha=null,_a=null,ma=[],va=function(e){return function(e,t){e.plugin_name=t}(e,"ConsoleLogger"),e.plugin_version=Re,e}({init:function(e){e&&(_a=(ha=e)._,ha.logger&&ha.logger.appendWriter(ya),ha.on&&ha.on("sdkAfterInitPara",function(){for(var e=0;e<ma.length;e++)ba(ma[e]);ma=null}),ha.on&&ha.on("sdkInitAPI",function(){ha.enableLocalLog=Ia,ha.disableLocalLog=Ca}))}});function ya(e){null!==ma?ma.push(e):ba(e)}function ba(e){try{if("log"===e.level&&wa())return void Sa(e);if("warn"===e.level&&(Pa()||wa()||_a.isObject(ha.para.show_log)&&"warn"===ha.para.show_log.level))return void Sa(e);if("error"===e.level&&(Pa()||!_a.isObject(ha.para.show_log)||"none"!==ha.para.show_log.level))return void Sa(e)}catch(e){}}function wa(){return!!Pa()||!0===ha.para.show_log||_a.isObject(ha.para.show_log)&&"log"===ha.para.show_log.level}function Sa(e){var t=e.content,r=_a.isObject(t[0])?_a.formatJsonString(t[0]):t[0],n=function(e){var t="",r="",n=ha.para.show_log;return _a.isObject(n)&&!1===n.show_brand||(t+=e.brand),_a.isObject(n)&&!1===n.show_level||(t+=(t.length>0?"-":"")+e.level),t.length>0&&(t="["+t+"]"),_a.isObject(n)&&!1===n.show_module||(r=e.module),t+r}(e);t[0]=n+(n.length>0?": ":"")+r;try{console&&(_a.isFunction(console[e.level])?console[e.level].apply(console,t):_a.isObject(console[e.level])&&console[e.level](t[0]))}catch(e){}}var ka="sensorsdata_jssdk_debug";function Ia(){_a.sessionStorage.isSupport()&&sessionStorage.setItem(ka,"true")}function Ca(){_a.sessionStorage.isSupport()&&sessionStorage.removeItem(ka)}function Pa(){return _a.sessionStorage.isSupport()&&"true"===sessionStorage.getItem(ka)}t.modules=t.modules||{};for(var Ta=[va,Ur,Qr,Sn,Cn,Bn,Wn,Yn,ti,ii,li,gi,mi,bi,Oi,xi,Hi,Ki,ta,ca,ga],Da=[va,xr,bi,Oi,Hi,xi,Qr,Wn,Sn,Yn,Ki,ta,ca,ga],Oa=0;Oa<Ta.length;Oa++){var Ea=Ta[Oa];t._.isString(Ea.plugin_name)?t.modules[Ea.plugin_name]=Ea:t._.isArray(Ea.plugin_name)&&t._.each(Ea.plugin_name,function(e){t.modules[e]=Ea})}for(Oa=0;Oa<Da.length;Oa++)t.use(Da[Oa]);var Na=t;try{"string"==typeof window.sensorsDataAnalytic201505?(t.para=window[sensorsDataAnalytic201505].para,t._q=window[sensorsDataAnalytic201505]._q,window[sensorsDataAnalytic201505]=t,window.sensorsDataAnalytic201505=t,t.init()):void 0===window.sensorsDataAnalytic201505?window.sensorsDataAnalytic201505=t:Na=window.sensorsDataAnalytic201505}catch(e){$e(e)}var ja=Na;return ja.DEFAULT_SEND_TYPE="image",ja}()}(hr)),hr.exports),mr=t({__proto__:null,default:fr(_r)},[_r]);class vr{constructor(e,t,r,n){this.sensors=null,this.initialized=!1,this.token=e,this.platform=t,this.version=r,this.config=n}async initialize(){if(!this.initialized)try{if(!mr)throw new Error("sensors sdk not found, please install it by running");this.sensors=mr;const e=encodeURIComponent(this.token),t=encodeURIComponent(this.platform),r=encodeURIComponent(this.version);this.sensors.init({server_url:this.config.serverUrl+`?t=${e}&p=${t}&v=${r}`,show_log:this.config.showLog??!1,heatmap:this.config.heatmap??{},is_track_single_page:!0,send_type:"ajax"}),this.initialized=!0,this.sensors.quick("autoTrack")}catch(e){throw console.error("sensors sdk init failed:",e),e}}async track(e,t){if(this.initialized&&this.sensors)try{this.sensors.track(e,t??{})}catch(e){console.error("sensors sdk track failed:",e)}else console.warn("sensors sdk not initialized, skip track")}async setUserId(e){if(this.initialized&&this.sensors)try{this.sensors.login(e)}catch(e){console.error("sensors sdk setUserId failed:",e)}else console.warn("sensors sdk not initialized, skip setUserId")}async setUserProperties(e){if(this.initialized&&this.sensors)try{this.sensors.setProfile(e)}catch(e){console.error("sensors sdk setUserProperties failed:",e)}else console.warn("sensors sdk not initialized, skip setUserProperties")}async clearUserId(){if(this.initialized&&this.sensors)try{this.sensors.logout()}catch(e){console.error("sensors sdk clearUserId failed:",e)}}}function yr(e){return"undefined"!=typeof window&&window.btoa?window.btoa(e):Buffer.from(e,"utf-8").toString("base64")}function br(e){return JSON.parse(function(e){return"undefined"!=typeof window&&window.atob?window.atob(e):Buffer.from(e,"base64").toString("utf-8")}(e))}const wr={"MDE5YjUzNTEyMWJhNzc1ZmIwYTQ1MzY3Njg1NzU1MTU=":{providers:[e.TrackProvider.FIREBASE,e.TrackProvider.SENSORS],firebaseConfig:br("eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjo2NmI2ZTNmNmEwZjM2MDkwNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctN0gySjFTQ05QRCJ9"),sensorsConfig:br("eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19"),gtmId:"GTM-MJDRW2W4"},"MDE5YjUzNTE3ZmFiN2YxZDkwNjg5OWVhMGQyMWJlZGI=":{providers:[e.TrackProvider.FIREBASE,e.TrackProvider.SENSORS],firebaseConfig:br("eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjpkMTQ4OGM3MzI0MWIyZWMzNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctR0gxNk1CQ1NOVyJ9"),sensorsConfig:br("eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19")}};e.TrackClient=class{constructor(e){this.adapters=new Map,this.initialized=!1,this.config=e,this.validateConfig(),this.platformConfig=function(e){const t=yr(e),r=wr[t];if(!r)throw new Error(`invalid token: ${e}`);return r}(e.token)}validateConfig(){if(!this.config.token)throw new Error("Must provide a token");if(!this.config.platform)throw new Error("Must provide a platform");if(!this.config.version)throw new Error("Must provide a version");if(!(yr(this.config.token)in wr))throw new Error(`Invalid token: ${this.config.token}`)}async initialize(){if(this.initialized)return;const t=[],r=!1!==this.config.initializeFirebase;for(const n of this.platformConfig.providers)try{if(n===e.TrackProvider.FIREBASE&&!r){this.config.debug&&console.log("[Track] Skip Firebase initialization (initializeFirebase = false)");continue}let i;switch(n){case e.TrackProvider.FIREBASE:i=new pr(this.platformConfig.firebaseConfig,this.platformConfig.gtmId,this.config.debug);break;case e.TrackProvider.SENSORS:i=new vr(this.config.token,this.config.platform,this.config.version,this.platformConfig.sensorsConfig);break;default:console.warn(`unknown provider: ${n}`);continue}this.adapters.set(n,i),t.push(i.initialize())}catch(e){console.error(`initialize ${n} adapter failed:`,e)}await Promise.allSettled(t),this.initialized=!0,this.config.debug&&console.log("Track SDK initialized, enabled providers:",Array.from(this.adapters.keys()))}async track(e,t){if(!this.initialized)return void console.warn("track SDK not initialized, please call initialize() first");this.config.debug&&console.log(`[Track] ${e}`,t);const r=[];for(const n of this.adapters.values())r.push(n.track(e,t));await Promise.allSettled(r)}async setUserId(e){if(!this.initialized)return void console.warn("track SDK not initialized, please call initialize() first");this.config.debug&&console.log("[Track] Set User ID:",e);const t=[];for(const r of this.adapters.values())t.push(r.setUserId(e));await Promise.allSettled(t)}async setUserProperties(e){if(!this.initialized)return void console.warn("track SDK not initialized, please call initialize() first");this.config.debug&&console.log("[Track] Set User Properties:",e);const t=[];for(const r of this.adapters.values())t.push(r.setUserProperties(e));await Promise.allSettled(t)}async clearUserId(){if(!this.initialized)return void console.warn("track SDK not initialized, please call initialize() first");this.config.debug&&console.log("[Track] Clear User ID");const e=[];for(const t of this.adapters.values())e.push(t.clearUserId());await Promise.allSettled(e)}getInitializedProviders(){return Array.from(this.adapters.keys())}trackGTMEvent(e,t){dr(e,t)}}});