@smart100/spu-web-plugin 0.0.15 → 0.0.16
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.
- package/dist/spu-web-plugin.mjs +6840 -349
- package/package.json +1 -1
- package/src/apaasSpuTrack.ts +190 -0
- package/src/components/expandexp/index.ts +52 -3
- package/src/install.ts +7 -47
- package/src/oss/downloadService.ts +43 -17
- package/src/package/apaas-track/apaas-spu/index.js +11 -0
- package/src/package/apaas-track/apaas-spu/index.mjs +4956 -0
- package/src/package/apaas-track/apaas-spu/index.umd.js +11 -0
- package/src/package/apaas-track/apaas-spu/lzma_worker.js +2668 -0
- package/src/storageProxy.ts +2 -0
- package/src/types/shims-lib.d.ts +3 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
(function(X,mt){typeof exports=="object"&&typeof module<"u"?mt(exports):typeof define=="function"&&define.amd?define(["exports"],mt):(X=typeof globalThis<"u"?globalThis:X||self,mt(X.ApaasSpuTrack={}))})(this,function(X){"use strict";function mt(){return((1+Math.random())*65536|0).toString(16).substring(1)}function ae(){return mt()+mt()+"-"+mt()+"-"+mt()+"-"+mt()+"-"+mt()+mt()+mt()}function rs(){return ae().replace(/-/g,"").slice(0,16)}function is(n){let e=n>0?new Date(n):new Date,s=e.getDate()<10?"0"+e.getDate():e.getDate(),r=e.getMonth()<9?"0"+(e.getMonth()+1):e.getMonth()+1,i=e.getFullYear(),a=e.getHours()<10?"0"+e.getHours():e.getHours(),u=e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes(),l=e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds(),w=e.getMilliseconds()<10?"0"+e.getMilliseconds():e.getMilliseconds();return w<100&&(w="0"+w),{time:+e,year:i,month:r,day:s,hour:a,minute:u,second:l,millisecond:w}}function as(n){return Object.prototype.toString.call(n)==="[object Number]"}function os(n){return typeof n=="bigint"}function Pe(n){return typeof n=="string"}function Pt(n){return Object.prototype.toString.call(n)==="[object Array]"}function zr(n){return typeof n=="boolean"}function Fr(n){return n===void 0}function Hr(n){return n===null}function yn(n){return typeof n=="symbol"}function Gt(n){return Object.prototype.toString.call(n)==="[object Object]"||!as(n)&&!os(n)&&!Pe(n)&&!zr(n)&&!Pt(n)&&!Hr(n)&&!cs(n)&&!Fr(n)&&!yn(n)}function cs(n){return typeof n=="function"}function Ir(n){const e=Object.prototype.toString.call(n);return e==="[object Window]"||e==="[object DOMWindow]"||e==="[object global]"}function Nr(n){return n==null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||typeof n=="function"||typeof n=="symbol"||typeof n=="bigint"?!1:typeof Symbol<"u"&&typeof n[Symbol.iterator]=="function"}function jr(n){return Object.prototype.toString.call(n).replace(/\[object (.*)\]/,"$1")}function Ur(n){let e=Object.prototype.hasOwnProperty;if(!n||typeof n!="object"||n.nodeType||Ir(n))return!1;try{if(n.constructor&&!e.call(n,"constructor")&&!e.call(n.constructor.prototype,"isPrototypeOf"))return!1}catch{return!1}let s;for(s in n);return s===void 0||e.call(n,s)}const qr=/[\n\t]/g,$r=n=>({"\n":"\\n"," ":"\\t"})[n];function Jr(n){return typeof n!="string"?n:String(n).replace(qr,$r)}const Gr=()=>{const n=new WeakSet;return e=>{if(typeof e=="object"&&e!==null){if(n.has(e))return!0;n.add(e)}return!1}},us=(n,e=0)=>{let s="";return Pe(n)?(e>0&&(n=ls(n,e)),s+='"'+Jr(n)+'"'):yn(n)?s+=String(n).replace(/^Symbol\((.*)\)$/i,'Symbol("$1")'):cs(n)?s+=(n.name||"function")+"()":os(n)?s+=String(n)+"n":s+=String(n),s},kn=(n,e,s=0)=>{var r,i;if(!Gt(n)&&!Pt(n)){e.ret+=us(n,e.keyMaxLen);return}if(e.circularFinder(n)){let f="";Pt(n)?f="(Circular Array)":Gt(n)&&(f=`(Circular ${((r=n.constructor)==null?void 0:r.name)||"Object"})`),e.ret+=e.standardJSON?`"${f}"`:f;return}let a="",u="";if(e.pretty){for(let f=0;f<=s;f++)a+=" ";u=`
|
|
2
|
+
`}let l="{",w="}";Pt(n)&&(l="[",w="]"),e.ret+=l+u;const p=Wr(n);for(let f=0;f<p.length;f++){const v=p[f];e.ret+=a;try{Pt(n)||(Gt(v)||Pt(v)||yn(v)?e.ret+=Object.prototype.toString.call(v):Pe(v)&&e.standardJSON?e.ret+='"'+v+'"':e.ret+=v,e.ret+=": ")}catch{continue}try{const h=n[v];Pt(h)?e.maxDepth>-1&&s>=e.maxDepth?e.ret+="Array("+h.length+")":kn(h,e,s+1):Gt(h)?e.maxDepth>-1&&s>=e.maxDepth?e.ret+=(((i=h.constructor)==null?void 0:i.name)||"Object")+" {}":kn(h,e,s+1):e.ret+=us(h,e.keyMaxLen)}catch{e.ret+=e.standardJSON?'"(PARSE_ERROR)"':"(PARSE_ERROR)"}if(e.keyMaxLen>0&&e.ret.length>=e.keyMaxLen*10){e.ret+=", (...)";break}f<p.length-1&&(e.ret+=", "),e.ret+=u}e.ret+=a.substring(0,a.length-2)+w};function hs(n,e={maxDepth:-1,keyMaxLen:-1,pretty:!1,standardJSON:!1}){const s=Object.assign({ret:"",maxDepth:-1,keyMaxLen:-1,pretty:!1,standardJSON:!1,circularFinder:Gr()},e);return kn(n,s),s.ret}function Xr(n){try{return self.Blob?new self.Blob([n],{type:"text/plain"}).size:encodeURI(n).split(/%(?:u[0-9A-F]{2})?[0-9A-F]{2}|./).length-1}catch{return 0}}function Le(n){return n<=0?"":n>=1e3*1e3?(n/1e3/1e3).toFixed(1)+" MB":n>=1e3*1?(n/1e3).toFixed(1)+" KB":n+" B"}function ls(n,e){return n.length>e&&(n=n.substring(0,e)+`...(${Le(Xr(n))})`),n}function Wr(n){return!Gt(n)&&!Pt(n)?[]:Object.keys(n)}function Qr(n=[],e=1024*1024){if(!n.length)return[];if(JSON.stringify(n).length<=e)return[n];let s=[],r=[],i=0;for(let a=0;a<n.length;a++){const u=n[a],l=JSON.stringify(u).length;i+l<e?(r.push(u),i+=l):r.length?(s.push(r),r=[u],i=l):(s.push([u]),i=0)}return s}const Vr=n=>typeof n=="object"?(n.config&&n.request&&(n.config=void 0,n.request=void 0),n.status!==void 0?n.data?(n.detail=typeof n.data=="object"?JSON.stringify(n.data):n.data,n=new Error(n.detail)):n.body?(n.detail=typeof n.body=="object"?JSON.stringify(n.body):n.body,n=new Error(n.detail)):(n.message=`${n.statusText||n.bodyText||""}`,n=new Error(n.message)):n=new Error(JSON.stringify(n)),n):new Error(n),Tn=n=>{var e;let s=null;n?n&&n instanceof Error?s=n:s=Vr(n):(n=new Error("error"),s=n);const r={message:"",detail:"",name:"",stack:[]};if(r.message=s.message,r.name=s.name,r.detail=((e=s.stack)==null?void 0:e.toString())||s.message,s.stack){let i=s.stack.split(/\n\s+at/);i.length&&(i=i.slice(1)),r.stack=i}return r},Sn=n=>new Promise(e=>{setTimeout(()=>{e(void 0),n&&n()},0)}),oe=()=>{if(typeof wx<"u"&&!window){const n=getCurrentPages();return n.length?n[n.length-1].route:"applaunch"}else return window.location.href};var Kr=Object.defineProperty,Zr=(n,e,s)=>e in n?Kr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s,I=(n,e,s)=>(Zr(n,typeof e!="symbol"?e+"":e,s),s);class ps{constructor(e){I(this,"limit"),I(this,"runningSize"),I(this,"taskList"),this.limit=e,this.taskList=[],this.runningSize=0}addTask(e){this.taskList.push(e),this.run()}async run(){for(;this.taskList.length&&this.runningSize<this.limit;){const e=this.taskList.shift();e&&(this.runningSize++,await e(),this.runningSize--,this.run())}}}var Pn=(n=>(n[n.NORMAL=0]="NORMAL",n[n.HIGH=1]="HIGH",n[n.EMERGEN=2]="EMERGEN",n))(Pn||{});class rt{constructor(e,s,r){I(this,"_level",0),this.apaasTrack=e,this.type=s,r&&(this._level=r)}getProperties(){return{}}setProperties(e){}getEventLog(e){const s=e||Date.now();return{...this.apaasTrack.baseLog,types:this.type,logtime:String(s),epochnanos:String(s)+"000000",event:this.type,properties:this.getProperties(),url:oe()}}}I(rt,"eventOptions"),I(rt,"initApaasTrackHook"),I(rt,"startApaasTrackHook"),I(rt,"destroyApaasTrackHook");class ds extends rt{constructor(e){super(e,"init")}getProperties(){const e=this.apaasTrack.baseLog;return{system:e.system||"",systemver:e.systemver||"",manufacturer:e.manufacturer||"",browser:e.browser||"",browserver:e.browserver||"",terminalid:e.terminalid||"",client:e.client||"",clientver:e.clientver||""}}}class ms extends rt{constructor(e){super(e,"custom"),I(this,"info",{})}setCustomType(e){this.type=e}getProperties(){return{...this.info}}setProperties(e){this.info=e}}const Xt={init:ds,custom:ms},Lt=(n,e)=>{const s=Xt[e];return new s(n)},fs=(n,e,s)=>{const r=s||Date.now(),i=Lt(n,e);return{...n.baseLog,types:e,logtime:String(r),epochnanos:String(r)+"000000",event:e,properties:i.getProperties(),url:oe()}},Ln=(n,e,s)=>{const r=s||Date.now();return{...n.baseLog,types:e.type,logtime:String(r),epochnanos:String(r)+"000000",event:e.type,properties:e.getProperties(),url:oe()}},En=(n,e)=>{if(Xt[n])throw Error(`\u8BE5\u4E8B\u4EF6${n} \u5DF2\u5B58\u5728\uFF0C\u6CE8\u518C\u5931\u8D25`);Xt[n]=e};class gs{constructor(e,s){I(this,"name",""),I(this,"time",0),I(this,"info",{}),e&&(this.name=e),s&&(this.info=s),this.time=Date.now()}get epochnanos(){return this.time*1e6}get attributes(){return this.getAttributes()}getAttributes(){return{}}getJson(){return{name:this.name,epochnanos:this.time*1e6,attributes:this.getAttributes(),...this.info}}setInfo(e){this.info=e||{}}}class _s extends gs{constructor(){super(...arguments),I(this,"name","exception"),I(this,"exceptionType",""),I(this,"exceptionMessage",""),I(this,"exceptionStackTrace","")}getAttributes(){return{"exception.type":this.exceptionType,"exception.message":this.exceptionMessage,"exception.stacktrace":this.exceptionStackTrace}}setInfo(e){this.exceptionMessage=e.exceptionMessage,this.exceptionType=e.exceptionType,this.exceptionStackTrace=e.exceptionStackTrace}}class We extends rt{constructor(e,s,r){super(e,"span"),I(this,"spanid",""),I(this,"traceid",""),I(this,"parentspanid",""),I(this,"name",""),I(this,"attributes",{}),I(this,"events",[]),I(this,"statuscode","OK"),I(this,"statusmessage",""),I(this,"startTime",0),I(this,"endTime",0),this.name=s,this.traceid=ae(),this.spanid=rs(),this.parentspanid=r||"",this.start()}trackLog(){this.apaasTrack.addLogByEvent(this)}createSpanEvent(e,s){return new We(this.apaasTrack,e,s)}setAttribute(e){const s=e.getAttributes();this.attributes=s}addEvent(e){this.events.push(e)}exception(e){const s=new _s;let r="",i="",a="";if(e instanceof Error){const u=Tn(e);r=u.detail,i=u.name,a=u.stack.join(",")}else r=e.exceptionMessage,i=e.exceptionType,a=e.exceptionStackTrace;s.setInfo({exceptionMessage:r,exceptionType:i,exceptionStackTrace:a}),this.events.push(s)}start(){this.startTime=Date.now()}end(e,s){e&&(this.statusmessage=e),s&&(this.statuscode=s),this.endTime=Date.now()}getProperties(){return{traceid:this.traceid,spanid:this.spanid,parentspanid:this.parentspanid,name:this.name,attributes:this.attributes,events:this.events.map(e=>e.getJson()),statuscode:this.statuscode,statusmessage:this.statusmessage,startepochnanos:this.startTime*1e6,endepochnanos:this.endTime*1e6,duration:(this.endTime-this.startTime)*1e6}}}const Bn="1.0.17";class Ee{constructor(e){I(this,"_version",Bn),I(this,"commonLog",null),I(this,"browserLog",null),I(this,"options"),this.options=e,typeof window<"u"&&(window.__apaasTrackVersion__=Bn),typeof wx<"u"&&!window&&(wx.__apaasTrackVersion__=Bn),e.commonLog&&this.initCommonLog(e.commonLog),this.runEventInitHooks()}registerEvent(e,s){En(e,s),s.initApaasTrackHook&&s.initApaasTrackHook(this),s.startApaasTrackHook&&s.startApaasTrackHook(this)}get groupid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}runEventInitHooks(){Object.values(Xt).forEach(e=>{e.initApaasTrackHook&&e.initApaasTrackHook(this)})}runEventStartHooks(){Object.values(Xt).forEach(e=>{e.startApaasTrackHook&&e.startApaasTrackHook(this)})}runEventDestroyHooks(){Object.values(Xt).forEach(e=>{e.destroyApaasTrackHook&&e.destroyApaasTrackHook(this)})}get anonymousid(){var e;return(e=this.browserLog)==null?void 0:e.anonymousid}get distinctid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}get baseLog(){return{...this.browserLog,...this.commonLog}}initCommonLog(e){this.commonLog=e}createEventLog(e,s){return fs(this,e,s)}addLogByType(e,s){const r=this.createEventLog(e,s);this.addLogToQueue(r)}addLogByEvent(e,s){const r=Ln(this,e,s);this.addLogToQueue(r)}createCustomEvent(e){const s=Lt(this,"custom");return s.setCustomType(e),s}createSpanEvent(e,s){return new We(this,e,s)}addLogByCustomEvent(e,s={},r){const i=this.createCustomEvent(e);i.setProperties(s);const a=Ln(this,i,r);this.addLogToQueue(a)}executeInitEvent(){const e=Lt(this,"init");e.setProperties({groupid:this.groupid}),this.addLogByEvent(e)}updateCommonLog(e){this.commonLog={...this.commonLog,...e}}trackEvent(e,s={},r){const i=Lt(this,e);i.setProperties(s),this.addLogByEvent(i,r)}start(...e){this.executeInitEvent(),this.runEventStartHooks()}destroy(){this.runEventDestroyHooks()}transformLog(e){return e}async addLogToQueue(e,s=!1,r=!0){r&&(e=this.transformLog(e)),await this.sendLog(e,s)}}I(Ee,"registerEvent",En);class Yr{constructor(e){I(this,"name",""),I(this,"groupid",""),this.name=e.name,this.groupid=e.groupid}getJson(){return{name:this.name,attributes:this.getAttributes()}}}var ti=Object.defineProperty,ei=(n,e,s)=>e in n?ti(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s,b=(n,e,s)=>(ei(n,typeof e!="symbol"?e+"":e,s),s),ni=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},xn={exports:{}};(function(n,e){(function(s,r){var i="1.0.32",a="",u="?",l="function",w="undefined",p="object",f="string",v="major",h="model",_="name",y="type",k="vendor",T="version",R="architecture",et="console",M="mobile",C="tablet",K="smarttv",J="wearable",lt="embedded",bt=350,Nt="Amazon",ge="Apple",ze="ASUS",pn="BlackBerry",jt="Browser",Zt="Chrome",Kn="Edge",_e="Firefox",Yt="Google",dn="Huawei",tt="LG",xt="Microsoft",Ut="Motorola",ve="Opera",Fe="Samsung",He="Sharp",te="Sony",qt="Xiaomi",Ie="Zebra",mn="Facebook",Zn=function(z,q){var A={};for(var Q in z)q[Q]&&q[Q].length%2===0?A[Q]=q[Q].concat(z[Q]):A[Q]=z[Q];return A},At=function(z){for(var q={},A=0;A<z.length;A++)q[z[A].toUpperCase()]=z[A];return q},Ne=function(z,q){return typeof z===f?ee(q).indexOf(ee(z))!==-1:!1},ee=function(z){return z.toLowerCase()},Yn=function(z){return typeof z===f?z.replace(/[^\d\.]/g,a).split(".")[0]:r},ne=function(z,q){if(typeof z===f)return z=z.replace(/^\s\s*/,a).replace(/\s\s*$/,a),typeof q===w?z:z.substring(0,bt)},pt=function(z,q){for(var A=0,Q,O,we,G,_t,wt;A<q.length&&!_t;){var _n=q[A],Ue=q[A+1];for(Q=O=0;Q<_n.length&&!_t;)if(_t=_n[Q++].exec(z),_t)for(we=0;we<Ue.length;we++)wt=_t[++O],G=Ue[we],typeof G===p&&G.length>0?G.length===2?typeof G[1]==l?this[G[0]]=G[1].call(this,wt):this[G[0]]=G[1]:G.length===3?typeof G[1]===l&&!(G[1].exec&&G[1].test)?this[G[0]]=wt?G[1].call(this,wt,G[2]):r:this[G[0]]=wt?wt.replace(G[1],G[2]):r:G.length===4&&(this[G[0]]=wt?G[3].call(this,wt.replace(G[1],G[2])):r):this[G]=wt||r;A+=2}},je=function(z,q){for(var A in q)if(typeof q[A]===p&&q[A].length>0){for(var Q=0;Q<q[A].length;Q++)if(Ne(q[A][Q],z))return A===u?r:A}else if(Ne(q[A],z))return A===u?r:A;return z},fn={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},gn={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Ot={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[T,[_,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[T,[_,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[_,T],[/opios[\/ ]+([\w\.]+)/i],[T,[_,ve+" Mini"]],[/\bopr\/([\w\.]+)/i],[T,[_,ve]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[_,T],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[T,[_,"UC"+jt]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[T,[_,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[T,[_,"WeChat"]],[/konqueror\/([\w\.]+)/i],[T,[_,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[T,[_,"IE"]],[/yabrowser\/([\w\.]+)/i],[T,[_,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[_,/(.+)/,"$1 Secure "+jt],T],[/\bfocus\/([\w\.]+)/i],[T,[_,_e+" Focus"]],[/\bopt\/([\w\.]+)/i],[T,[_,ve+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[T,[_,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[T,[_,"Dolphin"]],[/coast\/([\w\.]+)/i],[T,[_,ve+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[T,[_,"MIUI "+jt]],[/fxios\/([-\w\.]+)/i],[T,[_,_e]],[/\bqihu|(qi?ho?o?|360)browser/i],[[_,"360 "+jt]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[_,/(.+)/,"$1 "+jt],T],[/(comodo_dragon)\/([\w\.]+)/i],[[_,/_/g," "],T],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[_,T],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[_],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[_,mn],T],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[_,T],[/\bgsa\/([\w\.]+) .*safari\//i],[T,[_,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[T,[_,Zt+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[_,Zt+" WebView"],T],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[T,[_,"Android "+jt]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[_,T],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[T,[_,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[T,_],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[_,[T,je,fn]],[/(webkit|khtml)\/([\w\.]+)/i],[_,T],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[_,"Netscape"],T],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[T,[_,_e+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[_,T]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[R,"amd64"]],[/(ia32(?=;))/i],[[R,ee]],[/((?:i[346]|x)86)[;\)]/i],[[R,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[R,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[R,"armhf"]],[/windows (ce|mobile); ppc;/i],[[R,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[R,/ower/,a,ee]],[/(sun4\w)[;\)]/i],[[R,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[R,ee]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[h,[k,Fe],[y,C]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[h,[k,Fe],[y,M]],[/\((ip(?:hone|od)[\w ]*);/i],[h,[k,ge],[y,M]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[k,ge],[y,C]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[h,[k,dn],[y,C]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[k,dn],[y,M]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[h,/_/g," "],[k,qt],[y,M]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[h,/_/g," "],[k,qt],[y,C]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[k,"OPPO"],[y,M]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[k,"Vivo"],[y,M]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[h,[k,"Realme"],[y,M]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[h,[k,Ut],[y,M]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[k,Ut],[y,C]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[k,tt],[y,C]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[k,tt],[y,M]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[h,[k,"Lenovo"],[y,C]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[h,/_/g," "],[k,"Nokia"],[y,M]],[/(pixel c)\b/i],[h,[k,Yt],[y,C]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[k,Yt],[y,M]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[h,[k,te],[y,M]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[k,te],[y,C]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[k,"OnePlus"],[y,M]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[k,Nt],[y,C]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[k,Nt],[y,M]],[/(playbook);[-\w\),; ]+(rim)/i],[h,k,[y,C]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[k,pn],[y,M]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[k,ze],[y,C]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[k,ze],[y,M]],[/(nexus 9)/i],[h,[k,"HTC"],[y,C]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[k,[h,/_/g," "],[y,M]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[k,"Acer"],[y,C]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[k,"Meizu"],[y,M]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[k,He],[y,M]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[k,h,[y,M]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[k,h,[y,C]],[/(surface duo)/i],[h,[k,xt],[y,C]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[k,"Fairphone"],[y,M]],[/(u304aa)/i],[h,[k,"AT&T"],[y,M]],[/\bsie-(\w*)/i],[h,[k,"Siemens"],[y,M]],[/\b(rct\w+) b/i],[h,[k,"RCA"],[y,C]],[/\b(venue[\d ]{2,7}) b/i],[h,[k,"Dell"],[y,C]],[/\b(q(?:mv|ta)\w+) b/i],[h,[k,"Verizon"],[y,C]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[k,"Barnes & Noble"],[y,C]],[/\b(tm\d{3}\w+) b/i],[h,[k,"NuVision"],[y,C]],[/\b(k88) b/i],[h,[k,"ZTE"],[y,C]],[/\b(nx\d{3}j) b/i],[h,[k,"ZTE"],[y,M]],[/\b(gen\d{3}) b.+49h/i],[h,[k,"Swiss"],[y,M]],[/\b(zur\d{3}) b/i],[h,[k,"Swiss"],[y,C]],[/\b((zeki)?tb.*\b) b/i],[h,[k,"Zeki"],[y,C]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[k,"Dragon Touch"],h,[y,C]],[/\b(ns-?\w{0,9}) b/i],[h,[k,"Insignia"],[y,C]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[k,"NextBook"],[y,C]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[k,"Voice"],h,[y,M]],[/\b(lvtel\-)?(v1[12]) b/i],[[k,"LvTel"],h,[y,M]],[/\b(ph-1) /i],[h,[k,"Essential"],[y,M]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[k,"Envizen"],[y,C]],[/\b(trio[-\w\. ]+) b/i],[h,[k,"MachSpeed"],[y,C]],[/\btu_(1491) b/i],[h,[k,"Rotor"],[y,C]],[/(shield[\w ]+) b/i],[h,[k,"Nvidia"],[y,C]],[/(sprint) (\w+)/i],[k,h,[y,M]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[k,xt],[y,M]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[k,Ie],[y,C]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[k,Ie],[y,M]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[k,h,[y,et]],[/droid.+; (shield) bui/i],[h,[k,"Nvidia"],[y,et]],[/(playstation [345portablevi]+)/i],[h,[k,te],[y,et]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[k,xt],[y,et]],[/smart-tv.+(samsung)/i],[k,[y,K]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[k,Fe],[y,K]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[k,tt],[y,K]],[/(apple) ?tv/i],[k,[h,ge+" TV"],[y,K]],[/crkey/i],[[h,Zt+"cast"],[k,Yt],[y,K]],[/droid.+aft(\w)( bui|\))/i],[h,[k,Nt],[y,K]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[k,He],[y,K]],[/(bravia[\w ]+)( bui|\))/i],[h,[k,te],[y,K]],[/(mitv-\w{5}) bui/i],[h,[k,qt],[y,K]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[k,ne],[h,ne],[y,K]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[y,K]],[/((pebble))app/i],[k,h,[y,J]],[/droid.+; (glass) \d/i],[h,[k,Yt],[y,J]],[/droid.+; (wt63?0{2,3})\)/i],[h,[k,Ie],[y,J]],[/(quest( 2)?)/i],[h,[k,mn],[y,J]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[k,[y,lt]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[h,[y,M]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[y,C]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[y,C]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[y,M]],[/(android[-\w\. ]{0,9});.+buil/i],[h,[k,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[T,[_,Kn+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[T,[_,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[_,T],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[T,_]],os:[[/microsoft (windows) (vista|xp)/i],[_,T],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[_,[T,je,gn]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[_,"Windows"],[T,je,gn]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[T,/_/g,"."],[_,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[_,"Mac OS"],[T,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[T,_],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[_,T],[/\(bb(10);/i],[T,[_,pn]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[T,[_,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[T,[_,_e+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[T,[_,"webOS"]],[/crkey\/([\d\.]+)/i],[T,[_,Zt+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[_,"Chromium OS"],T],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[_,T],[/(sunos) ?([\w\.\d]*)/i],[[_,"Solaris"],T],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[_,T]]},ct=function(z,q){if(typeof z===p&&(q=z,z=r),!(this instanceof ct))return new ct(z,q).getResult();var A=z||(typeof s!==w&&s.navigator&&s.navigator.userAgent?s.navigator.userAgent:a),Q=q?Zn(Ot,q):Ot;return this.getBrowser=function(){var O={};return O[_]=r,O[T]=r,pt.call(O,A,Q.browser),O.major=Yn(O.version),O},this.getCPU=function(){var O={};return O[R]=r,pt.call(O,A,Q.cpu),O},this.getDevice=function(){var O={};return O[k]=r,O[h]=r,O[y]=r,pt.call(O,A,Q.device),O},this.getEngine=function(){var O={};return O[_]=r,O[T]=r,pt.call(O,A,Q.engine),O},this.getOS=function(){var O={};return O[_]=r,O[T]=r,pt.call(O,A,Q.os),O},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return A},this.setUA=function(O){return A=typeof O===f&&O.length>bt?ne(O,bt):O,this},this.setUA(A),this};ct.VERSION=i,ct.BROWSER=At([_,T,v]),ct.CPU=At([R]),ct.DEVICE=At([h,k,y,et,M,K,C,J,lt]),ct.ENGINE=ct.OS=At([_,T]),n.exports&&(e=n.exports=ct),e.UAParser=ct;var $t=typeof s!==w&&(s.jQuery||s.Zepto);if($t&&!$t.ua){var be=new ct;$t.ua=be.getResult(),$t.ua.get=function(){return be.getUA()},$t.ua.set=function(z){be.setUA(z);var q=be.getResult();for(var A in q)$t.ua[A]=q[A]}}})(typeof window=="object"?window:ni)})(xn,xn.exports);var vs={exports:{}},bs={exports:{}};(function(){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(s,r){return s<<r|s>>>32-r},rotr:function(s,r){return s<<32-r|s>>>r},endian:function(s){if(s.constructor==Number)return e.rotl(s,8)&16711935|e.rotl(s,24)&4278255360;for(var r=0;r<s.length;r++)s[r]=e.endian(s[r]);return s},randomBytes:function(s){for(var r=[];s>0;s--)r.push(Math.floor(Math.random()*256));return r},bytesToWords:function(s){for(var r=[],i=0,a=0;i<s.length;i++,a+=8)r[a>>>5]|=s[i]<<24-a%32;return r},wordsToBytes:function(s){for(var r=[],i=0;i<s.length*32;i+=8)r.push(s[i>>>5]>>>24-i%32&255);return r},bytesToHex:function(s){for(var r=[],i=0;i<s.length;i++)r.push((s[i]>>>4).toString(16)),r.push((s[i]&15).toString(16));return r.join("")},hexToBytes:function(s){for(var r=[],i=0;i<s.length;i+=2)r.push(parseInt(s.substr(i,2),16));return r},bytesToBase64:function(s){for(var r=[],i=0;i<s.length;i+=3)for(var a=s[i]<<16|s[i+1]<<8|s[i+2],u=0;u<4;u++)i*8+u*6<=s.length*8?r.push(n.charAt(a>>>6*(3-u)&63)):r.push("=");return r.join("")},base64ToBytes:function(s){s=s.replace(/[^A-Z0-9+\/]/ig,"");for(var r=[],i=0,a=0;i<s.length;a=++i%4)a!=0&&r.push((n.indexOf(s.charAt(i-1))&Math.pow(2,-2*a+8)-1)<<a*2|n.indexOf(s.charAt(i))>>>6-a*2);return r}};bs.exports=e})();var Cn={utf8:{stringToBytes:function(n){return Cn.bin.stringToBytes(unescape(encodeURIComponent(n)))},bytesToString:function(n){return decodeURIComponent(escape(Cn.bin.bytesToString(n)))}},bin:{stringToBytes:function(n){for(var e=[],s=0;s<n.length;s++)e.push(n.charCodeAt(s)&255);return e},bytesToString:function(n){for(var e=[],s=0;s<n.length;s++)e.push(String.fromCharCode(n[s]));return e.join("")}}},ws=Cn;/*!
|
|
3
|
+
* Determine if an object is a Buffer
|
|
4
|
+
*
|
|
5
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/var si=function(n){return n!=null&&(ys(n)||ri(n)||!!n._isBuffer)};function ys(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function ri(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&ys(n.slice(0,0))}(function(){var n=bs.exports,e=ws.utf8,s=si,r=ws.bin,i=function(a,u){a.constructor==String?u&&u.encoding==="binary"?a=r.stringToBytes(a):a=e.stringToBytes(a):s(a)?a=Array.prototype.slice.call(a,0):!Array.isArray(a)&&a.constructor!==Uint8Array&&(a=a.toString());for(var l=n.bytesToWords(a),w=a.length*8,p=1732584193,f=-271733879,v=-1732584194,h=271733878,_=0;_<l.length;_++)l[_]=(l[_]<<8|l[_]>>>24)&16711935|(l[_]<<24|l[_]>>>8)&4278255360;l[w>>>5]|=128<<w%32,l[(w+64>>>9<<4)+14]=w;for(var y=i._ff,k=i._gg,T=i._hh,R=i._ii,_=0;_<l.length;_+=16){var et=p,M=f,C=v,K=h;p=y(p,f,v,h,l[_+0],7,-680876936),h=y(h,p,f,v,l[_+1],12,-389564586),v=y(v,h,p,f,l[_+2],17,606105819),f=y(f,v,h,p,l[_+3],22,-1044525330),p=y(p,f,v,h,l[_+4],7,-176418897),h=y(h,p,f,v,l[_+5],12,1200080426),v=y(v,h,p,f,l[_+6],17,-1473231341),f=y(f,v,h,p,l[_+7],22,-45705983),p=y(p,f,v,h,l[_+8],7,1770035416),h=y(h,p,f,v,l[_+9],12,-1958414417),v=y(v,h,p,f,l[_+10],17,-42063),f=y(f,v,h,p,l[_+11],22,-1990404162),p=y(p,f,v,h,l[_+12],7,1804603682),h=y(h,p,f,v,l[_+13],12,-40341101),v=y(v,h,p,f,l[_+14],17,-1502002290),f=y(f,v,h,p,l[_+15],22,1236535329),p=k(p,f,v,h,l[_+1],5,-165796510),h=k(h,p,f,v,l[_+6],9,-1069501632),v=k(v,h,p,f,l[_+11],14,643717713),f=k(f,v,h,p,l[_+0],20,-373897302),p=k(p,f,v,h,l[_+5],5,-701558691),h=k(h,p,f,v,l[_+10],9,38016083),v=k(v,h,p,f,l[_+15],14,-660478335),f=k(f,v,h,p,l[_+4],20,-405537848),p=k(p,f,v,h,l[_+9],5,568446438),h=k(h,p,f,v,l[_+14],9,-1019803690),v=k(v,h,p,f,l[_+3],14,-187363961),f=k(f,v,h,p,l[_+8],20,1163531501),p=k(p,f,v,h,l[_+13],5,-1444681467),h=k(h,p,f,v,l[_+2],9,-51403784),v=k(v,h,p,f,l[_+7],14,1735328473),f=k(f,v,h,p,l[_+12],20,-1926607734),p=T(p,f,v,h,l[_+5],4,-378558),h=T(h,p,f,v,l[_+8],11,-2022574463),v=T(v,h,p,f,l[_+11],16,1839030562),f=T(f,v,h,p,l[_+14],23,-35309556),p=T(p,f,v,h,l[_+1],4,-1530992060),h=T(h,p,f,v,l[_+4],11,1272893353),v=T(v,h,p,f,l[_+7],16,-155497632),f=T(f,v,h,p,l[_+10],23,-1094730640),p=T(p,f,v,h,l[_+13],4,681279174),h=T(h,p,f,v,l[_+0],11,-358537222),v=T(v,h,p,f,l[_+3],16,-722521979),f=T(f,v,h,p,l[_+6],23,76029189),p=T(p,f,v,h,l[_+9],4,-640364487),h=T(h,p,f,v,l[_+12],11,-421815835),v=T(v,h,p,f,l[_+15],16,530742520),f=T(f,v,h,p,l[_+2],23,-995338651),p=R(p,f,v,h,l[_+0],6,-198630844),h=R(h,p,f,v,l[_+7],10,1126891415),v=R(v,h,p,f,l[_+14],15,-1416354905),f=R(f,v,h,p,l[_+5],21,-57434055),p=R(p,f,v,h,l[_+12],6,1700485571),h=R(h,p,f,v,l[_+3],10,-1894986606),v=R(v,h,p,f,l[_+10],15,-1051523),f=R(f,v,h,p,l[_+1],21,-2054922799),p=R(p,f,v,h,l[_+8],6,1873313359),h=R(h,p,f,v,l[_+15],10,-30611744),v=R(v,h,p,f,l[_+6],15,-1560198380),f=R(f,v,h,p,l[_+13],21,1309151649),p=R(p,f,v,h,l[_+4],6,-145523070),h=R(h,p,f,v,l[_+11],10,-1120210379),v=R(v,h,p,f,l[_+2],15,718787259),f=R(f,v,h,p,l[_+9],21,-343485551),p=p+et>>>0,f=f+M>>>0,v=v+C>>>0,h=h+K>>>0}return n.endian([p,f,v,h])};i._ff=function(a,u,l,w,p,f,v){var h=a+(u&l|~u&w)+(p>>>0)+v;return(h<<f|h>>>32-f)+u},i._gg=function(a,u,l,w,p,f,v){var h=a+(u&w|l&~w)+(p>>>0)+v;return(h<<f|h>>>32-f)+u},i._hh=function(a,u,l,w,p,f,v){var h=a+(u^l^w)+(p>>>0)+v;return(h<<f|h>>>32-f)+u},i._ii=function(a,u,l,w,p,f,v){var h=a+(l^(u|~w))+(p>>>0)+v;return(h<<f|h>>>32-f)+u},i._blocksize=16,i._digestsize=16,vs.exports=function(a,u){if(a==null)throw new Error("Illegal argument "+a);var l=n.wordsToBytes(i(a,u));return u&&u.asBytes?l:u&&u.asString?r.bytesToString(l):n.bytesToHex(l)}})();const Qe="1.0.17";//! © 2015 Nathan Rugg <nmrugg@gmail.com> | MIT
|
|
8
|
+
function ii(n){var e=1,s=2,r=3,i={},a=new Worker(n||"./lzma_worker-min.js");return a.onmessage=function(u){u.data.action===r?i[u.data.cbn]&&typeof i[u.data.cbn].on_progress=="function"&&i[u.data.cbn].on_progress(u.data.result):i[u.data.cbn]&&typeof i[u.data.cbn].on_finish=="function"&&(i[u.data.cbn].on_finish(u.data.result,u.data.error),delete i[u.data.cbn])},a.onerror=function(u){var l=new Error(u.message+" ("+u.filename+":"+u.lineno+")");for(var w in i)i[w].on_finish(null,l);console.error("Uncaught error in lzma_worker",l)},function(){function u(l,w,p,f,v){var h;do h=Math.floor(Math.random()*1e7);while(typeof i[h]<"u");i[h]={on_finish:f,on_progress:v},a.postMessage({action:l,cbn:h,data:w,mode:p})}return{compress:function(l,w,p,f){u(e,l,w,p,f)},decompress:function(l,w,p){u(s,l,!1,w,p)},worker:function(){return a}}}()}var Mn=function(){var n=1,e=3,s=typeof setImmediate=="function"?setImmediate:setTimeout,r=4294967296,i=[4294967295,-r],a=[0,-9223372036854776e3],u=[0,0],l=[1,0];function w(t,o){postMessage({action:e,cbn:o,result:t})}function p(t){var o=[];return o[t-1]=void 0,o}function f(t,o){return _(t[0]+o[0],t[1]+o[1])}function v(t,o){return R(~~Math.max(Math.min(t[1]/r,2147483647),-2147483648)&~~Math.max(Math.min(o[1]/r,2147483647),-2147483648),T(t)&T(o))}function h(t,o){var c,d;return t[0]==o[0]&&t[1]==o[1]?0:(c=t[1]<0,d=o[1]<0,c&&!d?-1:!c&&d?1:J(t,o)[1]<0?-1:1)}function _(t,o){var c,d;for(o%=18446744073709552e3,t%=18446744073709552e3,c=o%r,d=Math.floor(t/r)*r,o=o-c+d,t=t-d+c;t<0;)t+=r,o-=r;for(;t>4294967295;)t-=r,o+=r;for(o=o%18446744073709552e3;o>9223372032559809e3;)o-=18446744073709552e3;for(;o<-9223372036854776e3;)o+=18446744073709552e3;return[t,o]}function y(t,o){return t[0]==o[0]&&t[1]==o[1]}function k(t){return t>=0?[t,0]:[t+r,-r]}function T(t){return t[0]>=2147483648?~~Math.max(Math.min(t[0]-r,2147483647),-2147483648):~~Math.max(Math.min(t[0],2147483647),-2147483648)}function R(t,o){var c,d;return c=t*r,d=o,o<0&&(d+=r),[d,c]}function et(t){return t<=30?1<<t:et(30)*et(t-30)}function M(t,o){var c,d,m,g;if(o&=63,y(t,a))return o?u:t;if(t[1]<0)throw new Error("Neg");return g=et(o),d=t[1]*g%18446744073709552e3,m=t[0]*g,c=m-m%r,d+=c,m-=c,d>=9223372036854776e3&&(d-=18446744073709552e3),[m,d]}function C(t,o){var c;return o&=63,c=et(o),_(Math.floor(t[0]/c),t[1]/c)}function K(t,o){var c;return o&=63,c=C(t,o),t[1]<0&&(c=f(c,M([2,0],63-o))),c}function J(t,o){return _(t[0]-o[0],t[1]-o[1])}function lt(t,o){return t.buf=o,t.pos=0,t.count=o.length,t}function bt(t,o,c,d){return t.pos>=t.count?-1:(d=Math.min(d,t.count-t.pos),Zt(t.buf,t.pos,o,c,d),t.pos+=d,d)}function Nt(t){return t.buf=p(32),t.count=0,t}function ge(t){var o=t.buf;return o.length=t.count,o}function ze(t,o){t.buf[t.count++]=o<<24>>24}function pn(t,o,c,d){Zt(o,c,t.buf,t.count,d),t.count+=d}function jt(t,o,c,d,m){var g;for(g=o;g<c;++g)d[m++]=t.charCodeAt(g)}function Zt(t,o,c,d,m){for(var g=0;g<m;++g)c[d+g]=t[o+g]}function Kn(t,o){Tc(o,1<<t.s),o._numFastBytes=t.f,Sc(o,t.m),o._numLiteralPosStateBits=0,o._numLiteralContextBits=3,o._posStateBits=2,o._posStateMask=3}function _e(t,o,c,d,m){var g,S;if(h(d,i)<0)throw new Error("invalid length "+d);for(t.length_0=d,g=q({}),Kn(m,g),g._writeEndMark=typeof Mn.disableEndMark>"u",Pc(g,c),S=0;S<64;S+=8)ze(c,T(C(d,S))&255);t.chunker=(g._needReleaseMFStream=0,g._inStream=o,g._finished=0,z(g),g._rangeEncoder.Stream=c,_n(g),Q(g),A(g),g._lenEncoder._tableSize=g._numFastBytes+1-2,kr(g._lenEncoder,1<<g._posStateBits),g._repMatchLenEncoder._tableSize=g._numFastBytes+1-2,kr(g._repMatchLenEncoder,1<<g._posStateBits),g.nowPos64=u,je({},g))}function Yt(t,o,c){return t.output=Nt({}),_e(t,lt({},o),t.output,k(o.length),c),t}function dn(t,o,c,d){var m;t._keepSizeBefore=o,t._keepSizeAfter=c,m=o+c+d,(t._bufferBase==null||t._blockSize!=m)&&(t._bufferBase=null,t._blockSize=m,t._bufferBase=p(t._blockSize)),t._pointerToLastSafePosition=t._blockSize-c}function tt(t,o){return t._bufferBase[t._bufferOffset+t._pos+o]}function xt(t,o,c,d){var m,g;for(t._streamEndWasReached&&t._pos+o+d>t._streamPos&&(d=t._streamPos-(t._pos+o)),++c,g=t._bufferOffset+t._pos+o,m=0;m<d&&t._bufferBase[g+m]==t._bufferBase[g+m-c];++m);return m}function Ut(t){return t._streamPos-t._pos}function ve(t){var o,c,d;for(d=t._bufferOffset+t._pos-t._keepSizeBefore,d>0&&--d,c=t._bufferOffset+t._streamPos-d,o=0;o<c;++o)t._bufferBase[o]=t._bufferBase[d+o];t._bufferOffset-=d}function Fe(t){var o;++t._pos,t._pos>t._posLimit&&(o=t._bufferOffset+t._pos,o>t._pointerToLastSafePosition&&ve(t),He(t))}function He(t){var o,c,d;if(!t._streamEndWasReached)for(;;){if(d=-t._bufferOffset+t._blockSize-t._streamPos,!d)return;if(o=bt(t._stream,t._bufferBase,t._bufferOffset+t._streamPos,d),o==-1){t._posLimit=t._streamPos,c=t._bufferOffset+t._posLimit,c>t._pointerToLastSafePosition&&(t._posLimit=t._pointerToLastSafePosition-t._bufferOffset),t._streamEndWasReached=1;return}t._streamPos+=o,t._streamPos>=t._pos+t._keepSizeAfter&&(t._posLimit=t._streamPos-t._keepSizeAfter)}}function te(t,o){t._bufferOffset+=o,t._posLimit-=o,t._pos-=o,t._streamPos-=o}var qt=function(){var t,o,c,d=[];for(t=0;t<256;++t){for(c=t,o=0;o<8;++o)(c&1)!=0?c=c>>>1^-306674912:c>>>=1;d[t]=c}return d}();function Ie(t,o,c,d,m){var g,S,x;o<1073741567&&(t._cutValue=16+(d>>1),x=~~((o+c+d+m)/2)+256,dn(t,o+c,d+m,x),t._matchMaxLen=d,g=o+1,t._cyclicBufferSize!=g&&(t._son=p((t._cyclicBufferSize=g)*2)),S=65536,t.HASH_ARRAY&&(S=o-1,S|=S>>1,S|=S>>2,S|=S>>4,S|=S>>8,S>>=1,S|=65535,S>16777216&&(S>>=1),t._hashMask=S,++S,S+=t.kFixHashSize),S!=t._hashSizeSum&&(t._hash=p(t._hashSizeSum=S)))}function mn(t,o){var c,d,m,g,S,x,D,L,B,W,F,H,nt,P,N,Z,j,yt,it,kt,Ct;if(t._pos+t._matchMaxLen<=t._streamPos)P=t._matchMaxLen;else if(P=t._streamPos-t._pos,P<t.kMinMatchCheck)return At(t),0;for(j=0,N=t._pos>t._cyclicBufferSize?t._pos-t._cyclicBufferSize:0,d=t._bufferOffset+t._pos,Z=1,L=0,B=0,t.HASH_ARRAY?(Ct=qt[t._bufferBase[d]&255]^t._bufferBase[d+1]&255,L=Ct&1023,Ct^=(t._bufferBase[d+2]&255)<<8,B=Ct&65535,W=(Ct^qt[t._bufferBase[d+3]&255]<<5)&t._hashMask):W=t._bufferBase[d]&255^(t._bufferBase[d+1]&255)<<8,m=t._hash[t.kFixHashSize+W]||0,t.HASH_ARRAY&&(g=t._hash[L]||0,S=t._hash[1024+B]||0,t._hash[L]=t._pos,t._hash[1024+B]=t._pos,g>N&&t._bufferBase[t._bufferOffset+g]==t._bufferBase[d]&&(o[j++]=Z=2,o[j++]=t._pos-g-1),S>N&&t._bufferBase[t._bufferOffset+S]==t._bufferBase[d]&&(S==g&&(j-=2),o[j++]=Z=3,o[j++]=t._pos-S-1,g=S),j!=0&&g==m&&(j-=2,Z=1)),t._hash[t.kFixHashSize+W]=t._pos,it=(t._cyclicBufferPos<<1)+1,kt=t._cyclicBufferPos<<1,H=nt=t.kNumHashDirectBytes,t.kNumHashDirectBytes!=0&&m>N&&t._bufferBase[t._bufferOffset+m+t.kNumHashDirectBytes]!=t._bufferBase[d+t.kNumHashDirectBytes]&&(o[j++]=Z=t.kNumHashDirectBytes,o[j++]=t._pos-m-1),c=t._cutValue;;){if(m<=N||c--==0){t._son[it]=t._son[kt]=0;break}if(D=t._pos-m,x=(D<=t._cyclicBufferPos?t._cyclicBufferPos-D:t._cyclicBufferPos-D+t._cyclicBufferSize)<<1,yt=t._bufferOffset+m,F=H<nt?H:nt,t._bufferBase[yt+F]==t._bufferBase[d+F]){for(;++F!=P&&t._bufferBase[yt+F]==t._bufferBase[d+F];);if(Z<F&&(o[j++]=Z=F,o[j++]=D-1,F==P)){t._son[kt]=t._son[x],t._son[it]=t._son[x+1];break}}(t._bufferBase[yt+F]&255)<(t._bufferBase[d+F]&255)?(t._son[kt]=m,kt=x+1,m=t._son[kt],nt=F):(t._son[it]=m,it=x,m=t._son[it],H=F)}return At(t),j}function Zn(t){t._bufferOffset=0,t._pos=0,t._streamPos=0,t._streamEndWasReached=0,He(t),t._cyclicBufferPos=0,te(t,-1)}function At(t){var o;++t._cyclicBufferPos>=t._cyclicBufferSize&&(t._cyclicBufferPos=0),Fe(t),t._pos==1073741823&&(o=t._pos-t._cyclicBufferSize,Ne(t._son,t._cyclicBufferSize*2,o),Ne(t._hash,t._hashSizeSum,o),te(t,o))}function Ne(t,o,c){var d,m;for(d=0;d<o;++d)m=t[d]||0,m<=c?m=0:m-=c,t[d]=m}function ee(t,o){t.HASH_ARRAY=o>2,t.HASH_ARRAY?(t.kNumHashDirectBytes=0,t.kMinMatchCheck=4,t.kFixHashSize=66560):(t.kNumHashDirectBytes=2,t.kMinMatchCheck=3,t.kFixHashSize=0)}function Yn(t,o){var c,d,m,g,S,x,D,L,B,W,F,H,nt,P,N,Z,j;do{if(t._pos+t._matchMaxLen<=t._streamPos)H=t._matchMaxLen;else if(H=t._streamPos-t._pos,H<t.kMinMatchCheck){At(t);continue}for(nt=t._pos>t._cyclicBufferSize?t._pos-t._cyclicBufferSize:0,d=t._bufferOffset+t._pos,t.HASH_ARRAY?(j=qt[t._bufferBase[d]&255]^t._bufferBase[d+1]&255,x=j&1023,t._hash[x]=t._pos,j^=(t._bufferBase[d+2]&255)<<8,D=j&65535,t._hash[1024+D]=t._pos,L=(j^qt[t._bufferBase[d+3]&255]<<5)&t._hashMask):L=t._bufferBase[d]&255^(t._bufferBase[d+1]&255)<<8,m=t._hash[t.kFixHashSize+L],t._hash[t.kFixHashSize+L]=t._pos,N=(t._cyclicBufferPos<<1)+1,Z=t._cyclicBufferPos<<1,W=F=t.kNumHashDirectBytes,c=t._cutValue;;){if(m<=nt||c--==0){t._son[N]=t._son[Z]=0;break}if(S=t._pos-m,g=(S<=t._cyclicBufferPos?t._cyclicBufferPos-S:t._cyclicBufferPos-S+t._cyclicBufferSize)<<1,P=t._bufferOffset+m,B=W<F?W:F,t._bufferBase[P+B]==t._bufferBase[d+B]){for(;++B!=H&&t._bufferBase[P+B]==t._bufferBase[d+B];);if(B==H){t._son[Z]=t._son[g],t._son[N]=t._son[g+1];break}}(t._bufferBase[P+B]&255)<(t._bufferBase[d+B]&255)?(t._son[Z]=m,Z=g+1,m=t._son[Z],F=B):(t._son[N]=m,N=g,m=t._son[N],W=B)}At(t)}while(--o!=0)}function ne(t){return t-=2,t<4?t:3}function pt(t){return t<4?0:t<10?t-3:t-6}function je(t,o){return t.encoder=o,t.decoder=null,t.alive=1,t}function fn(t){if(!t.alive)throw new Error("bad state");if(t.encoder)gn(t);else throw new Error("No decoding");return t.alive}function gn(t){be(t.encoder,t.encoder.processedInSize,t.encoder.processedOutSize,t.encoder.finished),t.inBytesProcessed=t.encoder.processedInSize[0],t.encoder.finished[0]&&(kc(t.encoder),t.alive=0)}var Ot=function(){var t,o,c,d=2,m=[0,1];for(c=2;c<22;++c)for(o=1<<(c>>1)-1,t=0;t<o;++t,++d)m[d]=c<<24>>24;return m}();function ct(t,o){var c,d,m,g;t._optimumEndIndex=o,m=t._optimum[o].PosPrev,d=t._optimum[o].BackPrev;do t._optimum[o].Prev1IsChar&&(Sr(t._optimum[m]),t._optimum[m].PosPrev=m-1,t._optimum[o].Prev2&&(t._optimum[m-1].Prev1IsChar=0,t._optimum[m-1].PosPrev=t._optimum[o].PosPrev2,t._optimum[m-1].BackPrev=t._optimum[o].BackPrev2)),g=m,c=d,d=t._optimum[g].BackPrev,m=t._optimum[g].PosPrev,t._optimum[g].BackPrev=c,t._optimum[g].PosPrev=o,o=g;while(o>0);return t.backRes=t._optimum[0].BackPrev,t._optimumCurrentIndex=t._optimum[0].PosPrev,t._optimumCurrentIndex}function $t(t){t._state=0,t._previousByte=0;for(var o=0;o<4;++o)t._repDistances[o]=0}function be(t,o,c,d){var m,g,S,x,D,L,B,W,F,H,nt,P,N,Z,j;if(o[0]=u,c[0]=u,d[0]=1,t._inStream&&(t._matchFinder._stream=t._inStream,Zn(t._matchFinder),t._needReleaseMFStream=1,t._inStream=null),!t._finished){if(t._finished=1,Z=t.nowPos64,y(t.nowPos64,u)){if(!Ut(t._matchFinder)){O(t,T(t.nowPos64));return}ts(t),N=T(t.nowPos64)&t._posStateMask,V(t._rangeEncoder,t._isMatch,(t._state<<4)+N,0),t._state=pt(t._state),S=tt(t._matchFinder,-t._additionalOffset),Tr(ye(t._literalEncoder,T(t.nowPos64),t._previousByte),t._rangeEncoder,S),t._previousByte=S,--t._additionalOffset,t.nowPos64=f(t.nowPos64,l)}if(!Ut(t._matchFinder)){O(t,T(t.nowPos64));return}for(;;){if(B=we(t,T(t.nowPos64)),H=t.backRes,N=T(t.nowPos64)&t._posStateMask,g=(t._state<<4)+N,B==1&&H==-1)V(t._rangeEncoder,t._isMatch,g,0),S=tt(t._matchFinder,-t._additionalOffset),j=ye(t._literalEncoder,T(t.nowPos64),t._previousByte),t._state<7?Tr(j,t._rangeEncoder,S):(F=tt(t._matchFinder,-t._repDistances[0]-1-t._additionalOffset),Rc(j,t._rangeEncoder,F,S)),t._previousByte=S,t._state=pt(t._state);else{if(V(t._rangeEncoder,t._isMatch,g,1),H<4){if(V(t._rangeEncoder,t._isRep,t._state,1),H?(V(t._rangeEncoder,t._isRepG0,t._state,1),H==1?V(t._rangeEncoder,t._isRepG1,t._state,0):(V(t._rangeEncoder,t._isRepG1,t._state,1),V(t._rangeEncoder,t._isRepG2,t._state,H-2))):(V(t._rangeEncoder,t._isRepG0,t._state,0),B==1?V(t._rangeEncoder,t._isRep0Long,g,0):V(t._rangeEncoder,t._isRep0Long,g,1)),B==1?t._state=t._state<7?9:11:(ns(t._repMatchLenEncoder,t._rangeEncoder,B-2,N),t._state=t._state<7?8:11),x=t._repDistances[H],H!=0){for(L=H;L>=1;--L)t._repDistances[L]=t._repDistances[L-1];t._repDistances[0]=x}}else{for(V(t._rangeEncoder,t._isRep,t._state,0),t._state=t._state<7?7:10,ns(t._lenEncoder,t._rangeEncoder,B-2,N),H-=4,P=es(H),W=ne(B),$e(t._posSlotEncoder[W],t._rangeEncoder,P),P>=4&&(D=(P>>1)-1,m=(2|P&1)<<D,nt=H-m,P<14?zc(t._posEncoders,m-P-1,t._rangeEncoder,D,nt):(Lr(t._rangeEncoder,nt>>4,D-4),Pr(t._posAlignEncoder,t._rangeEncoder,nt&15),++t._alignPriceCount)),x=H,L=3;L>=1;--L)t._repDistances[L]=t._repDistances[L-1];t._repDistances[0]=x,++t._matchPriceCount}t._previousByte=tt(t._matchFinder,B-1-t._additionalOffset)}if(t._additionalOffset-=B,t.nowPos64=f(t.nowPos64,k(B)),!t._additionalOffset){if(t._matchPriceCount>=128&&Q(t),t._alignPriceCount>=16&&A(t),o[0]=t.nowPos64,c[0]=Hc(t._rangeEncoder),!Ut(t._matchFinder)){O(t,T(t.nowPos64));return}if(h(J(t.nowPos64,Z),[4096,0])>=0){t._finished=0,d[0]=0;return}}}}}function z(t){var o,c;t._matchFinder||(o={},c=4,t._matchFinderType||(c=2),ee(o,c),t._matchFinder=o),Cc(t._literalEncoder,t._numLiteralPosStateBits,t._numLiteralContextBits),!(t._dictionarySize==t._dictionarySizePrev&&t._numFastBytesPrev==t._numFastBytes)&&(Ie(t._matchFinder,t._dictionarySize,4096,t._numFastBytes,274),t._dictionarySizePrev=t._dictionarySize,t._numFastBytesPrev=t._numFastBytes)}function q(t){var o;for(t._repDistances=p(4),t._optimum=[],t._rangeEncoder={},t._isMatch=p(192),t._isRep=p(12),t._isRepG0=p(12),t._isRepG1=p(12),t._isRepG2=p(12),t._isRep0Long=p(192),t._posSlotEncoder=[],t._posEncoders=p(114),t._posAlignEncoder=qe({},4),t._lenEncoder=yr({}),t._repMatchLenEncoder=yr({}),t._literalEncoder={},t._matchDistances=[],t._posSlotPrices=[],t._distancesPrices=[],t._alignPrices=p(16),t.reps=p(4),t.repLens=p(4),t.processedInSize=[u],t.processedOutSize=[u],t.finished=[0],t.properties=p(5),t.tempPrices=p(128),t._longestMatchLength=0,t._matchFinderType=1,t._numDistancePairs=0,t._numFastBytesPrev=-1,t.backRes=0,o=0;o<4096;++o)t._optimum[o]={};for(o=0;o<4;++o)t._posSlotEncoder[o]=qe({},6);return t}function A(t){for(var o=0;o<16;++o)t._alignPrices[o]=Oc(t._posAlignEncoder,o);t._alignPriceCount=0}function Q(t){var o,c,d,m,g,S,x,D;for(m=4;m<128;++m)S=es(m),d=(S>>1)-1,o=(2|S&1)<<d,t.tempPrices[m]=Fc(t._posEncoders,o-S-1,d,m-o);for(g=0;g<4;++g){for(c=t._posSlotEncoder[g],x=g<<6,S=0;S<t._distTableSize;++S)t._posSlotPrices[x+S]=bn(c,S);for(S=14;S<t._distTableSize;++S)t._posSlotPrices[x+S]+=(S>>1)-1-4<<6;for(D=g*128,m=0;m<4;++m)t._distancesPrices[D+m]=t._posSlotPrices[x+m];for(;m<128;++m)t._distancesPrices[D+m]=t._posSlotPrices[x+es(m)]+t.tempPrices[m]}t._matchPriceCount=0}function O(t,o){vr(t),Lc(t,o&t._posStateMask);for(var c=0;c<5;++c)ss(t._rangeEncoder)}function we(t,o){var c,d,m,g,S,x,D,L,B,W,F,H,nt,P,N,Z,j,yt,it,kt,Ct,dt,ke,wn,Tt,Mt,Rt,ht,zt,Y,E,Jt,re,at,ot,Cr,St,Ge,ie,Ft,Te,Xe,U,st,Se,Mr,Rr,Dr,Ar,Or;if(t._optimumEndIndex!=t._optimumCurrentIndex)return nt=t._optimum[t._optimumCurrentIndex].PosPrev-t._optimumCurrentIndex,t.backRes=t._optimum[t._optimumCurrentIndex].BackPrev,t._optimumCurrentIndex=t._optimum[t._optimumCurrentIndex].PosPrev,nt;if(t._optimumCurrentIndex=t._optimumEndIndex=0,t._longestMatchWasFound?(H=t._longestMatchLength,t._longestMatchWasFound=0):H=ts(t),Rt=t._numDistancePairs,Tt=Ut(t._matchFinder)+1,Tt<2)return t.backRes=-1,1;for(Tt>273&&(Tt=273),Ft=0,B=0;B<4;++B)t.reps[B]=t._repDistances[B],t.repLens[B]=xt(t._matchFinder,-1,t.reps[B],273),t.repLens[B]>t.repLens[Ft]&&(Ft=B);if(t.repLens[Ft]>=t._numFastBytes)return t.backRes=Ft,nt=t.repLens[Ft],Ue(t,nt-1),nt;if(H>=t._numFastBytes)return t.backRes=t._matchDistances[Rt-1]+4,Ue(t,H-1),H;if(D=tt(t._matchFinder,-1),j=tt(t._matchFinder,-t._repDistances[0]-1-1),H<2&&D!=j&&t.repLens[Ft]<2)return t.backRes=-1,1;if(t._optimum[0].State=t._state,at=o&t._posStateMask,t._optimum[1].Price=$[t._isMatch[(t._state<<4)+at]>>>2]+vn(ye(t._literalEncoder,o,t._previousByte),t._state>=7,j,D),Sr(t._optimum[1]),yt=$[2048-t._isMatch[(t._state<<4)+at]>>>2],ie=yt+$[2048-t._isRep[t._state]>>>2],j==D&&(Te=ie+wt(t,t._state,at),Te<t._optimum[1].Price&&(t._optimum[1].Price=Te,Ac(t._optimum[1]))),F=H>=t.repLens[Ft]?H:t.repLens[Ft],F<2)return t.backRes=t._optimum[1].BackPrev,1;t._optimum[1].PosPrev=0,t._optimum[0].Backs0=t.reps[0],t._optimum[0].Backs1=t.reps[1],t._optimum[0].Backs2=t.reps[2],t._optimum[0].Backs3=t.reps[3],W=F;do t._optimum[W--].Price=268435455;while(W>=2);for(B=0;B<4;++B)if(Ge=t.repLens[B],!(Ge<2)){Cr=ie+_t(t,B,t._state,at);do g=Cr+se(t._repMatchLenEncoder,Ge-2,at),E=t._optimum[Ge],g<E.Price&&(E.Price=g,E.PosPrev=0,E.BackPrev=B,E.Prev1IsChar=0);while(--Ge>=2)}if(wn=yt+$[t._isRep[t._state]>>>2],W=t.repLens[0]>=2?t.repLens[0]+1:2,W<=H){for(ht=0;W>t._matchDistances[ht];)ht+=2;for(;L=t._matchDistances[ht+1],g=wn+G(t,L,W,at),E=t._optimum[W],g<E.Price&&(E.Price=g,E.PosPrev=0,E.BackPrev=L+4,E.Prev1IsChar=0),!(W==t._matchDistances[ht]&&(ht+=2,ht==Rt));++W);}for(c=0;;){if(++c,c==F)return ct(t,c);if(it=ts(t),Rt=t._numDistancePairs,it>=t._numFastBytes)return t._longestMatchLength=it,t._longestMatchWasFound=1,ct(t,c);if(++o,re=t._optimum[c].PosPrev,t._optimum[c].Prev1IsChar?(--re,t._optimum[c].Prev2?(U=t._optimum[t._optimum[c].PosPrev2].State,t._optimum[c].BackPrev2<4?U=U<7?8:11:U=U<7?7:10):U=t._optimum[re].State,U=pt(U)):U=t._optimum[re].State,re==c-1?t._optimum[c].BackPrev?U=pt(U):U=U<7?9:11:(t._optimum[c].Prev1IsChar&&t._optimum[c].Prev2?(re=t._optimum[c].PosPrev2,Jt=t._optimum[c].BackPrev2,U=U<7?8:11):(Jt=t._optimum[c].BackPrev,Jt<4?U=U<7?8:11:U=U<7?7:10),Y=t._optimum[re],Jt<4?Jt?Jt==1?(t.reps[0]=Y.Backs1,t.reps[1]=Y.Backs0,t.reps[2]=Y.Backs2,t.reps[3]=Y.Backs3):Jt==2?(t.reps[0]=Y.Backs2,t.reps[1]=Y.Backs0,t.reps[2]=Y.Backs1,t.reps[3]=Y.Backs3):(t.reps[0]=Y.Backs3,t.reps[1]=Y.Backs0,t.reps[2]=Y.Backs1,t.reps[3]=Y.Backs2):(t.reps[0]=Y.Backs0,t.reps[1]=Y.Backs1,t.reps[2]=Y.Backs2,t.reps[3]=Y.Backs3):(t.reps[0]=Jt-4,t.reps[1]=Y.Backs0,t.reps[2]=Y.Backs1,t.reps[3]=Y.Backs2)),t._optimum[c].State=U,t._optimum[c].Backs0=t.reps[0],t._optimum[c].Backs1=t.reps[1],t._optimum[c].Backs2=t.reps[2],t._optimum[c].Backs3=t.reps[3],x=t._optimum[c].Price,D=tt(t._matchFinder,-1),j=tt(t._matchFinder,-t.reps[0]-1-1),at=o&t._posStateMask,d=x+$[t._isMatch[(U<<4)+at]>>>2]+vn(ye(t._literalEncoder,o,tt(t._matchFinder,-2)),U>=7,j,D),dt=t._optimum[c+1],kt=0,d<dt.Price&&(dt.Price=d,dt.PosPrev=c,dt.BackPrev=-1,dt.Prev1IsChar=0,kt=1),yt=x+$[2048-t._isMatch[(U<<4)+at]>>>2],ie=yt+$[2048-t._isRep[U]>>>2],j==D&&!(dt.PosPrev<c&&!dt.BackPrev)&&(Te=ie+($[t._isRepG0[U]>>>2]+$[t._isRep0Long[(U<<4)+at]>>>2]),Te<=dt.Price&&(dt.Price=Te,dt.PosPrev=c,dt.BackPrev=0,dt.Prev1IsChar=0,kt=1)),Mt=Ut(t._matchFinder)+1,Mt=4095-c<Mt?4095-c:Mt,Tt=Mt,!(Tt<2)){if(Tt>t._numFastBytes&&(Tt=t._numFastBytes),!kt&&j!=D&&(Se=Math.min(Mt-1,t._numFastBytes),N=xt(t._matchFinder,0,t.reps[0],Se),N>=2)){for(st=pt(U),ot=o+1&t._posStateMask,ke=d+$[2048-t._isMatch[(st<<4)+ot]>>>2]+$[2048-t._isRep[st]>>>2],zt=c+1+N;F<zt;)t._optimum[++F].Price=268435455;g=ke+(Mr=se(t._repMatchLenEncoder,N-2,ot),Mr+_t(t,0,st,ot)),E=t._optimum[zt],g<E.Price&&(E.Price=g,E.PosPrev=c+1,E.BackPrev=0,E.Prev1IsChar=1,E.Prev2=0)}for(Xe=2,St=0;St<4;++St)if(P=xt(t._matchFinder,-1,t.reps[St],Tt),!(P<2)){Z=P;do{for(;F<c+P;)t._optimum[++F].Price=268435455;g=ie+(Rr=se(t._repMatchLenEncoder,P-2,at),Rr+_t(t,St,U,at)),E=t._optimum[c+P],g<E.Price&&(E.Price=g,E.PosPrev=c,E.BackPrev=St,E.Prev1IsChar=0)}while(--P>=2);if(P=Z,St||(Xe=P+1),P<Mt&&(Se=Math.min(Mt-1-P,t._numFastBytes),N=xt(t._matchFinder,P,t.reps[St],Se),N>=2)){for(st=U<7?8:11,ot=o+P&t._posStateMask,m=ie+(Dr=se(t._repMatchLenEncoder,P-2,at),Dr+_t(t,St,U,at))+$[t._isMatch[(st<<4)+ot]>>>2]+vn(ye(t._literalEncoder,o+P,tt(t._matchFinder,P-1-1)),1,tt(t._matchFinder,P-1-(t.reps[St]+1)),tt(t._matchFinder,P-1)),st=pt(st),ot=o+P+1&t._posStateMask,Ct=m+$[2048-t._isMatch[(st<<4)+ot]>>>2],ke=Ct+$[2048-t._isRep[st]>>>2],zt=P+1+N;F<c+zt;)t._optimum[++F].Price=268435455;g=ke+(Ar=se(t._repMatchLenEncoder,N-2,ot),Ar+_t(t,0,st,ot)),E=t._optimum[c+zt],g<E.Price&&(E.Price=g,E.PosPrev=c+P+1,E.BackPrev=0,E.Prev1IsChar=1,E.Prev2=1,E.PosPrev2=c,E.BackPrev2=St)}}if(it>Tt){for(it=Tt,Rt=0;it>t._matchDistances[Rt];Rt+=2);t._matchDistances[Rt]=it,Rt+=2}if(it>=Xe){for(wn=yt+$[t._isRep[U]>>>2];F<c+it;)t._optimum[++F].Price=268435455;for(ht=0;Xe>t._matchDistances[ht];)ht+=2;for(P=Xe;;++P)if(S=t._matchDistances[ht+1],g=wn+G(t,S,P,at),E=t._optimum[c+P],g<E.Price&&(E.Price=g,E.PosPrev=c,E.BackPrev=S+4,E.Prev1IsChar=0),P==t._matchDistances[ht]){if(P<Mt&&(Se=Math.min(Mt-1-P,t._numFastBytes),N=xt(t._matchFinder,P,S,Se),N>=2)){for(st=U<7?7:10,ot=o+P&t._posStateMask,m=g+$[t._isMatch[(st<<4)+ot]>>>2]+vn(ye(t._literalEncoder,o+P,tt(t._matchFinder,P-1-1)),1,tt(t._matchFinder,P-(S+1)-1),tt(t._matchFinder,P-1)),st=pt(st),ot=o+P+1&t._posStateMask,Ct=m+$[2048-t._isMatch[(st<<4)+ot]>>>2],ke=Ct+$[2048-t._isRep[st]>>>2],zt=P+1+N;F<c+zt;)t._optimum[++F].Price=268435455;g=ke+(Or=se(t._repMatchLenEncoder,N-2,ot),Or+_t(t,0,st,ot)),E=t._optimum[c+zt],g<E.Price&&(E.Price=g,E.PosPrev=c+P+1,E.BackPrev=0,E.Prev1IsChar=1,E.Prev2=1,E.PosPrev2=c,E.BackPrev2=S+4)}if(ht+=2,ht==Rt)break}}}}}function G(t,o,c,d){var m,g=ne(c);return o<128?m=t._distancesPrices[g*128+o]:m=t._posSlotPrices[(g<<6)+Ec(o)]+t._alignPrices[o&15],m+se(t._lenEncoder,c-2,d)}function _t(t,o,c,d){var m;return o?(m=$[2048-t._isRepG0[c]>>>2],o==1?m+=$[t._isRepG1[c]>>>2]:(m+=$[2048-t._isRepG1[c]>>>2],m+=Je(t._isRepG2[c],o-2))):(m=$[t._isRepG0[c]>>>2],m+=$[2048-t._isRep0Long[(c<<4)+d]>>>2]),m}function wt(t,o,c){return $[t._isRepG0[o]>>>2]+$[t._isRep0Long[(o<<4)+c]>>>2]}function _n(t){$t(t),Ic(t._rangeEncoder),ut(t._isMatch),ut(t._isRep0Long),ut(t._isRep),ut(t._isRepG0),ut(t._isRepG1),ut(t._isRepG2),ut(t._posEncoders),Mc(t._literalEncoder);for(var o=0;o<4;++o)ut(t._posSlotEncoder[o].Models);br(t._lenEncoder,1<<t._posStateBits),br(t._repMatchLenEncoder,1<<t._posStateBits),ut(t._posAlignEncoder.Models),t._longestMatchWasFound=0,t._optimumEndIndex=0,t._optimumCurrentIndex=0,t._additionalOffset=0}function Ue(t,o){o>0&&(Yn(t._matchFinder,o),t._additionalOffset+=o)}function ts(t){var o=0;return t._numDistancePairs=mn(t._matchFinder,t._matchDistances),t._numDistancePairs>0&&(o=t._matchDistances[t._numDistancePairs-2],o==t._numFastBytes&&(o+=xt(t._matchFinder,o-1,t._matchDistances[t._numDistancePairs-1],273-o))),++t._additionalOffset,o}function vr(t){t._matchFinder&&t._needReleaseMFStream&&(t._matchFinder._stream=null,t._needReleaseMFStream=0)}function kc(t){vr(t),t._rangeEncoder.Stream=null}function Tc(t,o){t._dictionarySize=o;for(var c=0;o>1<<c;++c);t._distTableSize=c*2}function Sc(t,o){var c=t._matchFinderType;t._matchFinderType=o,t._matchFinder&&c!=t._matchFinderType&&(t._dictionarySizePrev=-1,t._matchFinder=null)}function Pc(t,o){t.properties[0]=(t._posStateBits*5+t._numLiteralPosStateBits)*9+t._numLiteralContextBits<<24>>24;for(var c=0;c<4;++c)t.properties[1+c]=t._dictionarySize>>8*c<<24>>24;pn(o,t.properties,0,5)}function Lc(t,o){if(t._writeEndMark){V(t._rangeEncoder,t._isMatch,(t._state<<4)+o,1),V(t._rangeEncoder,t._isRep,t._state,0),t._state=t._state<7?7:10,ns(t._lenEncoder,t._rangeEncoder,0,o);var c=ne(2);$e(t._posSlotEncoder[c],t._rangeEncoder,63),Lr(t._rangeEncoder,67108863,26),Pr(t._posAlignEncoder,t._rangeEncoder,15)}}function es(t){return t<2048?Ot[t]:t<2097152?Ot[t>>10]+20:Ot[t>>20]+40}function Ec(t){return t<131072?Ot[t>>6]+12:t<134217728?Ot[t>>16]+32:Ot[t>>26]+52}function Bc(t,o,c,d){c<8?(V(o,t._choice,0,0),$e(t._lowCoder[d],o,c)):(c-=8,V(o,t._choice,0,1),c<8?(V(o,t._choice,1,0),$e(t._midCoder[d],o,c)):(V(o,t._choice,1,1),$e(t._highCoder,o,c-8)))}function xc(t){t._choice=p(2),t._lowCoder=p(16),t._midCoder=p(16),t._highCoder=qe({},8);for(var o=0;o<16;++o)t._lowCoder[o]=qe({},3),t._midCoder[o]=qe({},3);return t}function br(t,o){ut(t._choice);for(var c=0;c<o;++c)ut(t._lowCoder[c].Models),ut(t._midCoder[c].Models);ut(t._highCoder.Models)}function wr(t,o,c,d,m){var g,S,x,D,L;for(g=$[t._choice[0]>>>2],S=$[2048-t._choice[0]>>>2],x=S+$[t._choice[1]>>>2],D=S+$[2048-t._choice[1]>>>2],L=0,L=0;L<8;++L){if(L>=c)return;d[m+L]=g+bn(t._lowCoder[o],L)}for(;L<16;++L){if(L>=c)return;d[m+L]=x+bn(t._midCoder[o],L-8)}for(;L<c;++L)d[m+L]=D+bn(t._highCoder,L-8-8)}function ns(t,o,c,d){Bc(t,o,c,d),--t._counters[d]==0&&(wr(t,d,t._tableSize,t._prices,d*272),t._counters[d]=t._tableSize)}function yr(t){return xc(t),t._prices=[],t._counters=[],t}function se(t,o,c){return t._prices[c*272+o]}function kr(t,o){for(var c=0;c<o;++c)wr(t,c,t._tableSize,t._prices,c*272),t._counters[c]=t._tableSize}function Cc(t,o,c){var d,m;if(!(t.m_Coders!=null&&t.m_NumPrevBits==c&&t.m_NumPosBits==o))for(t.m_NumPosBits=o,t.m_PosMask=(1<<o)-1,t.m_NumPrevBits=c,m=1<<t.m_NumPrevBits+t.m_NumPosBits,t.m_Coders=p(m),d=0;d<m;++d)t.m_Coders[d]=Dc({})}function ye(t,o,c){return t.m_Coders[((o&t.m_PosMask)<<t.m_NumPrevBits)+((c&255)>>>8-t.m_NumPrevBits)]}function Mc(t){var o,c=1<<t.m_NumPrevBits+t.m_NumPosBits;for(o=0;o<c;++o)ut(t.m_Coders[o].m_Encoders)}function Tr(t,o,c){var d,m,g=1;for(m=7;m>=0;--m)d=c>>m&1,V(o,t.m_Encoders,g,d),g=g<<1|d}function Rc(t,o,c,d){var m,g,S,x,D=1,L=1;for(g=7;g>=0;--g)m=d>>g&1,x=L,D&&(S=c>>g&1,x+=1+S<<8,D=S==m),V(o,t.m_Encoders,x,m),L=L<<1|m}function Dc(t){return t.m_Encoders=p(768),t}function vn(t,o,c,d){var m,g=1,S=7,x,D=0;if(o){for(;S>=0;--S)if(x=c>>S&1,m=d>>S&1,D+=Je(t.m_Encoders[(1+x<<8)+g],m),g=g<<1|m,x!=m){--S;break}}for(;S>=0;--S)m=d>>S&1,D+=Je(t.m_Encoders[g],m),g=g<<1|m;return D}function Sr(t){t.BackPrev=-1,t.Prev1IsChar=0}function Ac(t){t.BackPrev=0,t.Prev1IsChar=0}function qe(t,o){return t.NumBitLevels=o,t.Models=p(1<<o),t}function $e(t,o,c){var d,m,g=1;for(m=t.NumBitLevels;m!=0;)--m,d=c>>>m&1,V(o,t.Models,g,d),g=g<<1|d}function bn(t,o){var c,d,m=1,g=0;for(d=t.NumBitLevels;d!=0;)--d,c=o>>>d&1,g+=Je(t.Models[m],c),m=(m<<1)+c;return g}function Pr(t,o,c){var d,m,g=1;for(m=0;m<t.NumBitLevels;++m)d=c&1,V(o,t.Models,g,d),g=g<<1|d,c>>=1}function Oc(t,o){var c,d,m=1,g=0;for(d=t.NumBitLevels;d!=0;--d)c=o&1,o>>>=1,g+=Je(t.Models[m],c),m=m<<1|c;return g}function zc(t,o,c,d,m){var g,S,x=1;for(S=0;S<d;++S)g=m&1,V(c,t,o+x,g),x=x<<1|g,m>>=1}function Fc(t,o,c,d){var m,g,S=1,x=0;for(g=c;g!=0;--g)m=d&1,d>>>=1,x+=$[((t[o+S]-m^-m)&2047)>>>2],S=S<<1|m;return x}function ut(t){for(var o=t.length-1;o>=0;--o)t[o]=1024}var $=function(){var t,o,c,d,m=[];for(o=8;o>=0;--o)for(d=1<<9-o-1,t=1<<9-o,c=d;c<t;++c)m[c]=(o<<6)+(t-c<<6>>>9-o-1);return m}();function V(t,o,c,d){var m,g=o[c];m=(t.Range>>>11)*g,d?(t.Low=f(t.Low,v(k(m),[4294967295,0])),t.Range-=m,o[c]=g-(g>>>5)<<16>>16):(t.Range=m,o[c]=g+(2048-g>>>5)<<16>>16),t.Range&-16777216||(t.Range<<=8,ss(t))}function Lr(t,o,c){for(var d=c-1;d>=0;--d)t.Range>>>=1,(o>>>d&1)==1&&(t.Low=f(t.Low,k(t.Range))),t.Range&-16777216||(t.Range<<=8,ss(t))}function Hc(t){return f(f(k(t._cacheSize),t._position),[4,0])}function Ic(t){t._position=u,t.Low=u,t.Range=-1,t._cacheSize=1,t._cache=0}function ss(t){var o,c=T(K(t.Low,32));if(c!=0||h(t.Low,[4278190080,0])<0){t._position=f(t._position,k(t._cacheSize)),o=t._cache;do ze(t.Stream,o+c),o=255;while(--t._cacheSize!=0);t._cache=T(t.Low)>>>24}++t._cacheSize,t.Low=M(v(t.Low,[16777215,0]),8)}function Je(t,o){return $[((t-o^-o)&2047)>>>2]}function Er(t){var o,c=[],d,m=0,g,S=t.length;if(typeof t=="object")return t;for(jt(t,0,S,c,0),g=0;g<S;++g)o=c[g],o>=1&&o<=127?++m:!o||o>=128&&o<=2047?m+=2:m+=3;for(d=[],m=0,g=0;g<S;++g)o=c[g],o>=1&&o<=127?d[m++]=o<<24>>24:!o||o>=128&&o<=2047?(d[m++]=(192|o>>6&31)<<24>>24,d[m++]=(128|o&63)<<24>>24):(d[m++]=(224|o>>12&15)<<24>>24,d[m++]=(128|o>>6&63)<<24>>24,d[m++]=(128|o&63)<<24>>24);return d}function Br(t){return t[1]+t[0]}function Nc(t,o,c,d){var m={},g,S,x=typeof c>"u"&&typeof d>"u";if(typeof c!="function"&&(S=c,c=d=0),d=d||function(L){if(!(typeof S>"u"))return w(L,S)},c=c||function(L,B){if(!(typeof S>"u"))return postMessage({action:n,cbn:S,result:L,error:B})},x){for(m.c=Yt({},Er(t),xr(o));fn(m.c.chunker););return ge(m.c.output)}try{m.c=Yt({},Er(t),xr(o)),d(0)}catch(L){return c(null,L)}function D(){try{for(var L,B=new Date().getTime();fn(m.c.chunker);)if(g=Br(m.c.chunker.inBytesProcessed)/Br(m.c.length_0),new Date().getTime()-B>200)return d(g),s(D,0),0;d(1),L=ge(m.c.output),s(c.bind(null,L),0)}catch(W){c(null,W)}}s(D,0)}var xr=function(){var t=[{s:16,f:64,m:0},{s:20,f:64,m:0},{s:19,f:64,m:1},{s:20,f:64,m:1},{s:21,f:128,m:1},{s:22,f:128,m:1},{s:23,f:128,m:1},{s:24,f:255,m:1},{s:25,f:255,m:1}];return function(o){return t[o-1]||t[6]}}();return typeof onmessage<"u"&&(typeof window>"u"||typeof window.document>"u")&&function(){onmessage=function(t){t&&t.data&&t.data.action==n&&Mn.compress(t.data.data,t.data.mode,t.data.cbn)}}(),{compress:Nc}}();const ai=async n=>await ci(n);let Ve=null;const oi=async n=>(n=n||'"./lzma_worker-min.js"',Ve||(await ai(n)?Ve=ii(n):(console.error("lzma\u65E0\u6CD5\u627E\u5230"+n+": \u65E0\u6CD5\u542F\u52A8worker\u6A21\u5F0F\uFF0C\u5C06\u542F\u7528\u6D4F\u89C8\u5668\u8BA1\u7B97\u6A21\u5F0F\uFF0C\u6027\u80FD\u53D7\u5F71\u54CD"),Ve=Mn),Ve)),ci=n=>new Promise((e,s)=>{const r=new XMLHttpRequest;r.open("get",n,!0),r.addEventListener("error",i=>{e(!1)}),r.addEventListener("load",i=>{r.status===200&&e(!0),e(!1)}),r.send()}),ui=new ps(5);let ks="";const hi=n=>{ks=n};let Ts=null;const Ss=n=>{const e=typeof n=="string"?n:JSON.stringify(n);let s=location.pathname;s=s.replace(/[^\/\/.]+\.(html|html)$/,"").replace("//","/");const r=ks||location.origin+s+"static/lzma_worker.js";return console.log("lzma_worker",r),new Promise(async i=>{let a=Date.now();window.requestIdleCallback(async()=>{Ts=await oi(r),Ts.compress(e,5,(u,l)=>{if(!u)throw Error("static/lzma_worker.js \u65E0\u6CD5\u52A0\u8F7D\uFF0C\u8BF7\u68C0\u67E5\u8BE5\u6587\u4EF6");console.log("compress finish",Date.now()-a);const w=[...u],p=new Int8Array(w.length);for(let f=0;f<w.length;f++)p[f]=w[f];console.log("compress success",Date.now()-a),i(p)})})})},Ke=async(n,e,s)=>new Promise((r,i)=>{const a=new XMLHttpRequest;a.open("POST",n,!0),s?(a.setRequestHeader("xw-body-encoding","v1"),ui.addTask(()=>new Promise((u,l)=>{Ss(e).then(w=>{a.send(w.buffer)}).finally(()=>{u()})}))):a.send(JSON.stringify(e)),a.onreadystatechange=()=>{},a.addEventListener("readystatechange",u=>{a.readyState===4&&a.status===200?r(void 0):a.status===500&&i(a.statusText)}),a.addEventListener("error",u=>{console.error("\u957F\u5EA6",JSON.stringify(e).length),i(u)})}),li=(n,e,s)=>{window.navigator.sendBeacon!==void 0?s?Ss(e).then(r=>{window.navigator.sendBeacon(n,r.buffer)}):window.navigator.sendBeacon(n,JSON.stringify(e)):Ke(n,e,s)};class pi{constructor(){b(this,"logs",[])}get length(){return this.logs.length}async init(){}async push(e){try{this.logs.push(e)}catch(s){console.error(s)}}async compulsionSave(){}clearArray(){this.logs.length=0}async shift(e=1){let s=[[...this.logs]];return this.clearArray(),s}}async function di(n){const e=new pi;return await e.init(),e}var mi=typeof global=="object"&&global&&global.Object===Object&&global;const fi=mi;var gi=typeof self=="object"&&self&&self.Object===Object&&self,_i=fi||gi||Function("return this")();const Ze=_i;var vi=Ze.Symbol;const Ht=vi;var Ps=Object.prototype,bi=Ps.hasOwnProperty,wi=Ps.toString,Be=Ht?Ht.toStringTag:void 0;function yi(n){var e=bi.call(n,Be),s=n[Be];try{n[Be]=void 0;var r=!0}catch{}var i=wi.call(n);return r&&(e?n[Be]=s:delete n[Be]),i}var ki=Object.prototype,Ti=ki.toString;function Si(n){return Ti.call(n)}var Pi="[object Null]",Li="[object Undefined]",Ls=Ht?Ht.toStringTag:void 0;function Rn(n){return n==null?n===void 0?Li:Pi:Ls&&Ls in Object(n)?yi(n):Si(n)}function Dn(n){return n!=null&&typeof n=="object"}var Ei="[object Symbol]";function Ye(n){return typeof n=="symbol"||Dn(n)&&Rn(n)==Ei}function Bi(n,e){for(var s=-1,r=n==null?0:n.length,i=Array(r);++s<r;)i[s]=e(n[s],s,n);return i}var xi=Array.isArray;const tn=xi;var Ci=1/0,Es=Ht?Ht.prototype:void 0,Bs=Es?Es.toString:void 0;function xs(n){if(typeof n=="string")return n;if(tn(n))return Bi(n,xs)+"";if(Ye(n))return Bs?Bs.call(n):"";var e=n+"";return e=="0"&&1/n==-Ci?"-0":e}var Mi=/\s/;function Ri(n){for(var e=n.length;e--&&Mi.test(n.charAt(e)););return e}var Di=/^\s+/;function Ai(n){return n&&n.slice(0,Ri(n)+1).replace(Di,"")}function xe(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Cs=0/0,Oi=/^[-+]0x[0-9a-f]+$/i,zi=/^0b[01]+$/i,Fi=/^0o[0-7]+$/i,Hi=parseInt;function Ms(n){if(typeof n=="number")return n;if(Ye(n))return Cs;if(xe(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=xe(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Ai(n);var s=zi.test(n);return s||Fi.test(n)?Hi(n.slice(2),s?2:8):Oi.test(n)?Cs:+n}var Ii="[object AsyncFunction]",Ni="[object Function]",ji="[object GeneratorFunction]",Ui="[object Proxy]";function qi(n){if(!xe(n))return!1;var e=Rn(n);return e==Ni||e==ji||e==Ii||e==Ui}var $i=Ze["__core-js_shared__"];const An=$i;var Rs=function(){var n=/[^.]+$/.exec(An&&An.keys&&An.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function Ji(n){return!!Rs&&Rs in n}var Gi=Function.prototype,Xi=Gi.toString;function Wi(n){if(n!=null){try{return Xi.call(n)}catch{}try{return n+""}catch{}}return""}var Qi=/[\\^$.*+?()[\]{}|]/g,Vi=/^\[object .+?Constructor\]$/,Ki=Function.prototype,Zi=Object.prototype,Yi=Ki.toString,ta=Zi.hasOwnProperty,ea=RegExp("^"+Yi.call(ta).replace(Qi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function na(n){if(!xe(n)||Ji(n))return!1;var e=qi(n)?ea:Vi;return e.test(Wi(n))}function sa(n,e){return n==null?void 0:n[e]}function Ds(n,e){var s=sa(n,e);return na(s)?s:void 0}function ra(n,e){return n===e||n!==n&&e!==e}var ia="[object Arguments]";function As(n){return Dn(n)&&Rn(n)==ia}var Os=Object.prototype,aa=Os.hasOwnProperty,oa=Os.propertyIsEnumerable,ca=As(function(){return arguments}())?As:function(n){return Dn(n)&&aa.call(n,"callee")&&!oa.call(n,"callee")};const ua=ca;var ha=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,la=/^\w*$/;function pa(n,e){if(tn(n))return!1;var s=typeof n;return s=="number"||s=="symbol"||s=="boolean"||n==null||Ye(n)?!0:la.test(n)||!ha.test(n)||e!=null&&n in Object(e)}var da=Ds(Object,"create");const Ce=da;function ma(){this.__data__=Ce?Ce(null):{},this.size=0}function fa(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var ga="__lodash_hash_undefined__",_a=Object.prototype,va=_a.hasOwnProperty;function ba(n){var e=this.__data__;if(Ce){var s=e[n];return s===ga?void 0:s}return va.call(e,n)?e[n]:void 0}var wa=Object.prototype,ya=wa.hasOwnProperty;function ka(n){var e=this.__data__;return Ce?e[n]!==void 0:ya.call(e,n)}var Ta="__lodash_hash_undefined__";function Sa(n,e){var s=this.__data__;return this.size+=this.has(n)?0:1,s[n]=Ce&&e===void 0?Ta:e,this}function Wt(n){var e=-1,s=n==null?0:n.length;for(this.clear();++e<s;){var r=n[e];this.set(r[0],r[1])}}Wt.prototype.clear=ma,Wt.prototype.delete=fa,Wt.prototype.get=ba,Wt.prototype.has=ka,Wt.prototype.set=Sa;function Pa(){this.__data__=[],this.size=0}function en(n,e){for(var s=n.length;s--;)if(ra(n[s][0],e))return s;return-1}var La=Array.prototype,Ea=La.splice;function Ba(n){var e=this.__data__,s=en(e,n);if(s<0)return!1;var r=e.length-1;return s==r?e.pop():Ea.call(e,s,1),--this.size,!0}function xa(n){var e=this.__data__,s=en(e,n);return s<0?void 0:e[s][1]}function Ca(n){return en(this.__data__,n)>-1}function Ma(n,e){var s=this.__data__,r=en(s,n);return r<0?(++this.size,s.push([n,e])):s[r][1]=e,this}function ce(n){var e=-1,s=n==null?0:n.length;for(this.clear();++e<s;){var r=n[e];this.set(r[0],r[1])}}ce.prototype.clear=Pa,ce.prototype.delete=Ba,ce.prototype.get=xa,ce.prototype.has=Ca,ce.prototype.set=Ma;var Ra=Ds(Ze,"Map");const Da=Ra;function Aa(){this.size=0,this.__data__={hash:new Wt,map:new(Da||ce),string:new Wt}}function Oa(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function nn(n,e){var s=n.__data__;return Oa(e)?s[typeof e=="string"?"string":"hash"]:s.map}function za(n){var e=nn(this,n).delete(n);return this.size-=e?1:0,e}function Fa(n){return nn(this,n).get(n)}function Ha(n){return nn(this,n).has(n)}function Ia(n,e){var s=nn(this,n),r=s.size;return s.set(n,e),this.size+=s.size==r?0:1,this}function Qt(n){var e=-1,s=n==null?0:n.length;for(this.clear();++e<s;){var r=n[e];this.set(r[0],r[1])}}Qt.prototype.clear=Aa,Qt.prototype.delete=za,Qt.prototype.get=Fa,Qt.prototype.has=Ha,Qt.prototype.set=Ia;var Na="Expected a function";function On(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(Na);var s=function(){var r=arguments,i=e?e.apply(this,r):r[0],a=s.cache;if(a.has(i))return a.get(i);var u=n.apply(this,r);return s.cache=a.set(i,u)||a,u};return s.cache=new(On.Cache||Qt),s}On.Cache=Qt;var ja=500;function Ua(n){var e=On(n,function(r){return s.size===ja&&s.clear(),r}),s=e.cache;return e}var qa=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$a=/\\(\\)?/g,Ja=Ua(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(qa,function(s,r,i,a){e.push(i?a.replace($a,"$1"):r||s)}),e});const Ga=Ja;function Xa(n){return n==null?"":xs(n)}function Wa(n,e){return tn(n)?n:pa(n,e)?[n]:Ga(Xa(n))}var Qa=1/0;function Va(n){if(typeof n=="string"||Ye(n))return n;var e=n+"";return e=="0"&&1/n==-Qa?"-0":e}function Ka(n,e){e=Wa(e,n);for(var s=0,r=e.length;n!=null&&s<r;)n=n[Va(e[s++])];return s&&s==r?n:void 0}function zs(n,e,s){var r=n==null?void 0:Ka(n,e);return r===void 0?s:r}function Za(n,e){for(var s=-1,r=e.length,i=n.length;++s<r;)n[i+s]=e[s];return n}var Fs=Ht?Ht.isConcatSpreadable:void 0;function Ya(n){return tn(n)||ua(n)||!!(Fs&&n&&n[Fs])}function Hs(n,e,s,r,i){var a=-1,u=n.length;for(s||(s=Ya),i||(i=[]);++a<u;){var l=n[a];e>0&&s(l)?e>1?Hs(l,e-1,s,r,i):Za(i,l):r||(i[i.length]=l)}return i}function Is(n){var e=n==null?0:n.length;return e?Hs(n,1):[]}var to=function(){return Ze.Date.now()};const zn=to;var eo="Expected a function",no=Math.max,so=Math.min;function ro(n,e,s){var r,i,a,u,l,w,p=0,f=!1,v=!1,h=!0;if(typeof n!="function")throw new TypeError(eo);e=Ms(e)||0,xe(s)&&(f=!!s.leading,v="maxWait"in s,a=v?no(Ms(s.maxWait)||0,e):a,h="trailing"in s?!!s.trailing:h);function _(J){var lt=r,bt=i;return r=i=void 0,p=J,u=n.apply(bt,lt),u}function y(J){return p=J,l=setTimeout(R,e),f?_(J):u}function k(J){var lt=J-w,bt=J-p,Nt=e-lt;return v?so(Nt,a-bt):Nt}function T(J){var lt=J-w,bt=J-p;return w===void 0||lt>=e||lt<0||v&&bt>=a}function R(){var J=zn();if(T(J))return et(J);l=setTimeout(R,k(J))}function et(J){return l=void 0,h&&r?_(J):(r=i=void 0,u)}function M(){l!==void 0&&clearTimeout(l),p=0,r=w=i=l=void 0}function C(){return l===void 0?u:et(zn())}function K(){var J=zn(),lt=T(J);if(r=arguments,i=this,w=J,lt){if(l===void 0)return y(w);if(v)return clearTimeout(l),l=setTimeout(R,e),_(w)}return l===void 0&&(l=setTimeout(R,e)),u}return K.cancel=M,K.flush=C,K}class io{constructor(){b(this,"logsObj"),b(this,"initPromise"),this.initPromise=this.init()}async init(){return this.logsObj=await di(),this.logsObj}get length(){var e,s;return(s=(e=this.logsObj)==null?void 0:e.length)!=null?s:0}getLogs(){var e;return((e=this.logsObj)==null?void 0:e.logs)||[]}async cacheLog(e){var s;await this.initPromise,await((s=this.logsObj)==null?void 0:s.push(e))}async send(e){var s;await this.initPromise;const r=await((s=this.logsObj)==null?void 0:s.shift());r!=null&&r.length&&await e(Is(r))}async sendByBeacon(e){var s;await this.initPromise;const r=await((s=this.logsObj)==null?void 0:s.shift());r!=null&&r.length&&await e(r)}}function ao(n){return sn(n,"String")}function oo(n){return sn(n,"Array")}function co(n){return sn(n,"Object")}function uo(n){return typeof n=="function"}function Ns(n,e="Object"){return oo(n)?n.every(s=>sn(s,e)):!1}function sn(n,e="Object"){return Object.prototype.toString.call(n)===`[object ${e}]`}const ho=window.indexedDB,lo=new Set(["add","clear","count","delete","get","getAll","getAllKeys","getKey","openCursor","openKeyCursor","put"]);function po(n,e,...s){return new Promise(async(r,i)=>{try{const a=(await this.createTransaction(n)).objectStore(n);let u=a[e].call(a,...s);u?(u.onsuccess=function(l){r(zs(l,"target.result"))},u.onerror=function(l){console.log("---storeOperate onerror",n,e,l),i(l)}):r(void 0)}catch(a){i(a)}})}function mo(n){const e=this;let s={};return lo.forEach(r=>{s[r]=function(...i){var a;return(a=e==null?void 0:e.manager)==null?void 0:a.pushTask(()=>po.call(e,n,r,...i))}}),s}class fo{constructor(){b(this,"dbManagerMap",new Map)}getOrCreateDBManager(e){if(this.dbManagerMap.has(e))return this.dbManagerMap.get(e);const s=new go(e);return this.dbManagerMap.set(e,s),s}get(e){return this.getOrCreateDBManager(e)}clear(e){const s=this.dbManagerMap.get(e);!s||(s.close(),this.dbManagerMap.delete(e))}}class go{constructor(e){b(this,"initPromise",Promise.resolve()),b(this,"openStatus",""),b(this,"version",0),b(this,"dbName"),b(this,"db",null),b(this,"isClose",!0),b(this,"task",Promise.resolve()),this.dbName=e,this.init()}pushTask(e){if(this.isClose){console.log("----task error, IndexDB is close");return}let s=this.task.then(()=>{try{return uo(e)?e():e}catch(r){console.log("----task error",r)}});return this.task=s,s}close(){const e=()=>{this.openStatus="",this.version=0,this.db&&(this.db.close(),this.db=null)};if(this.isClose)e();else{let s=this.pushTask(e);return this.isClose=!0,s}}transTransactionParam(e){return ao(e)?[{storeName:e}]:Ns(e,"String")?e.map(s=>({storeName:s})):co(e)?[e]:Ns(e)?e:(console.warn("[transTransactionParam]\u5165\u53C2\u683C\u5F0F\u4E0D\u6B63\u786E",e),[])}async transaction(e,s="readonly"){await this.initPromise;const r=this.transTransactionParam(e);if(!r.length)return;const i=[];return r.forEach(a=>{!this.db||this.db.objectStoreNames.contains(a.storeName)||i.push(u=>{u.createObjectStore(a.storeName,a.option)})}),i.length>0&&await this.upgradeneeded(i),mo.bind({manager:this,createTransaction:async a=>{if(await this.initPromise,!!this.db)return this.db.transaction(a,s)}})}init(e,s){let r=this.initPromise;this.initPromise=new Promise(async(i,a)=>{await r,await this.close();const u=ho.open(this.dbName,e);let l=setTimeout(()=>{a(new Error("[IndexDB\u8FDE\u63A5\u8D85\u65F6] name: "+this.dbName+" \u8BF7\u5C1D\u8BD5\u5237\u65B0\u6216\u91CD\u542F\u6D4F\u89C8\u5668"))},1e4);u.onsuccess=()=>{clearTimeout(l),this.openStatus="success",this.db=u.result;const w=this.db;this.isClose=!1;const p=w.version;this.version=w.version,w.onclose=()=>{this.isClose=!0,console.log("[indexDB\u5173\u95ED]",p)},console.log(`[indexDB\u521D\u59CB\u5316]
|
|
9
|
+
onsuccess name: `+this.dbName+`
|
|
10
|
+
version: `+p),i()},u.onupgradeneeded=w=>{this.openStatus="upgradeneeded";const p=zs(w,"target.result");p?(s&&s(p),console.log("[indexDB\u521D\u59CB\u5316] onupgradeneeded name: "+this.dbName)):console.error("[indexDB\u521D\u59CB\u5316\u5931\u8D25] onupgradeneeded name: "+this.dbName)},u.onerror=w=>{clearTimeout(l),console.error("[indexDB\u521D\u59CB\u5316\u5931\u8D25] name: "+this.dbName,w),i()}})}async upgradeneeded(e){try{this.init(this.version+1,function(s){let r=e.length;for(;r--;)e[r](s)}),await this.initPromise}catch(s){console.error("[DBManager.upgradeneeded\u5931\u8D25]",s)}}}const Fn=new fo;class _o{constructor(e="logs"){b(this,"logs",[]),b(this,"thisSize",0),b(this,"dbLength",0),b(this,"dbName","apaas-track"),b(this,"storeName","logs"),b(this,"maxSize",1024*1024),this.storeName=e}get length(){return this.dbLength+this.logs.length}async init(){let e=[];const s=await(await Fn.get(this.dbName)).transaction(this.storeName,"readonly");s&&(e=await s(this.storeName).getAllKeys()),this.dbLength=e.length}async push(e){try{const s=JSON.stringify(e).length;this.thisSize+s>=this.maxSize?(await this.save(),this.logs.push(e),this.thisSize=s,s>=this.maxSize&&await this.save()):(this.logs.push(e),this.thisSize+=JSON.stringify(e).length)}catch(s){console.error(s)}}async compulsionSave(){this.logs.length!==0&&await this.save()}clearArray(){this.logs.length=0,this.thisSize=0}async save(){try{const e=this.logs;if(e.length===0)return;const s=await(await Fn.get(this.dbName)).transaction(this.storeName,"readwrite");s&&(await s(this.storeName).add(e,Date.now()),this.dbLength++,this.clearArray())}catch(e){console.error(e)}}async shift(e=1){let s=[];if(this.dbLength!==0&&(s=await this.shiftDB(e)),e-s.length>0&&this.logs.length>0){let r=[...this.logs];this.clearArray(),s.push(r)}return s}async shiftDB(e){try{let s=[];const r=await(await Fn.get(this.dbName)).transaction(this.storeName,"readwrite");if(r){const i=r(this.storeName);let a=await i.getAllKeys();if(a.length===0)return[];const u=this.getRange(e,a),l=[];u.forEach(p=>{l.push(i.get(p))}),s=await Promise.all(l);const w=[];u.forEach(p=>{w.push(i.delete(p))}),await Promise.all(w),a=await i.getAllKeys(),this.dbLength=a.length}return s}catch(s){return console.error(s),[]}}getRange(e,s){const r=[];for(let i=0;i<e&&i<s.length;i++)r.push(s[i]);return r}}async function vo(n){const e=new _o(n);return await e.init(),e}class bo{constructor(){b(this,"logsDB"),b(this,"initPromise"),this.initPromise=this.init()}async init(){return this.logsDB=await vo(),this.logsDB}get length(){var e,s;return(s=(e=this.logsDB)==null?void 0:e.length)!=null?s:0}getLogs(){var e;return((e=this.logsDB)==null?void 0:e.logs)||[]}async cacheLog(e){var s;await this.initPromise,await((s=this.logsDB)==null?void 0:s.push(e))}async send(e){var s;await this.initPromise;const r=await((s=this.logsDB)==null?void 0:s.shift(5));r!=null&&r.length&&e(Is(r))}async sendByBeacon(e){var s;await this.initPromise,await((s=this.logsDB)==null?void 0:s.compulsionSave())}}class Et extends Ee{constructor(e){super(e),b(this,"options"),b(this,"logsSender"),b(this,"nextTickLogs",[]),b(this,"isStart",!1),b(this,"listenPostMessageHandler"),this.options=e,this.initStorageData(),this.initBrowserLog(),e.commonLog&&this.initCommonLog(e.commonLog),console.log("this.options.useIndexDB",this.options.useIndexDB),this.options.useIndexDB?this.logsSender=new bo:this.logsSender=new io}initStorageData(){const e=JSON.parse(localStorage.getItem("apaas-track")||"{}");e.anonymousid||(e.anonymousid=ae()),e.logs||(e.logs=[]),e.distinctid=ae(),localStorage.setItem("apaas-track",JSON.stringify(e))}getStorageData(){return JSON.parse(localStorage.getItem("apaas-track")||"{}")}updateStorageData(e){localStorage.setItem("apaas-track",JSON.stringify(e))}get anonymousid(){var e;return((e=this.browserLog)==null?void 0:e.anonymousid)||this.getStorageData().anonymousid}get distinctid(){var e;return((e=this.browserLog)==null?void 0:e.distinctid)||this.getStorageData().distinctid}initBrowserLog(){const e=new xn.exports.UAParser;e.setUA(navigator.userAgent);const s=e.getResult(),r=s.os.version||"",i=s.os.name||"",a=s.browser.name||"",u=s.browser.version||"",l=navigator.vendor,w=vs.exports(`${i}${r}${l}${a}${u}`),p=location.href;this.browserLog={system:i,systemver:r,manufacturer:l,browser:a,browserver:u,terminalid:w,anonymousid:this.anonymousid,distinctid:this.distinctid,url:p,logsdkver:Qe}}start(...e){if(this.isStart)return;let s=0,r=60*5*1e3,i=null,a=window.setInterval(()=>{u()},this.options.timer||1e4);setTimeout(()=>{u()},2e3);const u=()=>{this.send().then(()=>{s&&(s=0),i&&(clearInterval(i),i=null),a||(a=window.setInterval(()=>{u()},this.options.timer||1e4))}).catch(l=>{console.error("track send error",l),s++,s>=5&&(a&&clearInterval(a),a=null,i||(i=window.setInterval(()=>{u()},r)))})};super.start(),this.sendLegancyLogs(),this.isStart=!0,this.listenPostMessage()}getLegancyLogs(){return this.getStorageData().logs||[]}clearLegancyLogs(){const e=this.getStorageData();delete e.logs,this.updateStorageData(e)}sendLegancyLogs(){this.getLegancyLogs().forEach(e=>{this.addLogToQueue(e,!1,!1)}),this.clearLegancyLogs()}addToLegancyLog(e){e=this.transformLog(e);const s=[...this.getLegancyLogs()||[],e],r=this.getStorageData();r.logs=s,this.updateStorageData(r)}listenPostMessage(){this.listenPostMessageHandler=e=>{var s;const r=(e==null?void 0:e.data)||{};if(r.type==="getWebCommonParams"){const i=Array.from(document.querySelectorAll("iframe"));for(let a of i)(s=a==null?void 0:a.contentWindow)==null||s.postMessage({type:"receiveWebCommonParams",data:{url:this.options.url,timer:this.options.timer||1e4,zip:this.options.zip,commonLog:this.commonLog}},"*")}else if(r.type==="sendApaasLog"){const i=r.data,{log:a,isImmediate:u}=i;this.sendLog(a,u)}},window.addEventListener("message",this.listenPostMessageHandler)}divideLogsSend(e){return this.options.useIndexDB?Ke(this.options.url,e,this.getZip()):wo(e,{url:this.options.url,zip:this.getZip(),maxSize:this.getMaxSize()})}async sendByNextTick(e){if(this.nextTickLogs.push(e),await Sn(),!this.nextTickLogs.length)return;const s=JSON.parse(JSON.stringify(this.nextTickLogs));this.divideLogsSend(this.nextTickLogs).catch(r=>{this.nextTickLogs=[...s,this.nextTickLogs]}),this.nextTickLogs.length=0}async send(){if(this.logsSender.length)try{await this.logsSender.send(this.divideLogsSend.bind(this))}catch{}}async sendLog(e,s=!1){try{e=JSON.parse(JSON.stringify(e))}catch{}s?this.sendByNextTick(e):await this.logsSender.cacheLog(e)}getZip(){return this.options.zip!==void 0?this.options.zip:!0}getMaxSize(){const e=this.options.zip!==void 0?this.options.zip:!0;return 1024*1024/(e?2:1)}async sendByBeacon(e){const s=async r=>li(`${this.options.url}`,r,e!==void 0?e:this.getZip());this.logsSender.length&&await this.logsSender.sendByBeacon(s.bind(this))}}function wo(n,e){const{url:s,zip:r,maxSize:i}=e;if(JSON.stringify(n).length<=i||n.length===1)return Ke(s,n,r);{const a=Qr(n,i),u=[];return a.forEach(l=>{u.push(Ke(s,l,r))}),Promise.all(u)}}class ue extends rt{constructor(e){super(e,"click"),b(this,"paths",""),b(this,"customProperties",{}),b(this,"name","")}getProperties(){return{name:this.name,paths:this.paths,customProperties:this.customProperties}}setProperties(e){e.paths&&(this.paths=e.paths),e.name&&(this.name=e.name),this.customProperties=e.customProperties}}const yo=n=>!n||n===document||n.tagName==="HTML"||!n.hasAttribute?!1:n.hasAttribute("apaas-track-click")&&n.getAttribute("apaas-track-click")!=="false",js=n=>{n.target;const e=n.composedPath();if(!e.length)return!1;for(let s=0;s<e.length;s++){const r=e[s];if(r===window)return!1;if(yo(r))return r}return!1},Hn=n=>{const e=n.tagName,s=n.id,r=n.className,i=(l,w,p)=>`${l}${w?"#"+w:""}${p?"."+p:""}`;let a=i(e,s,r)+" > ",u=n.parentElement;for(;u;){const l=u.tagName,w=u.id,p=u.className;a+=i(l,w,p)+" > ",u=u.parentElement}return a=a.replace(/\s>\s$/,""),a&&(a=a.split(" > ").reverse().join(" > ")),a},ko=(n,e)=>{const s=(r,i)=>r===i;if(n===document)return!0;{const r=e.target;if(s(n,r))return!0;let i=r.parentElement;if(!i)return!1;for(;i;){if(s(n,i))return!0;i=i.parentElement}return!1}},To=(n,e)=>{const s=()=>!0,r=a=>js(a),i=a=>{a.target;const u=(e==null?void 0:e.collectSelectors)||[];if(!u.length)return null;let l=[];for(let p=0;p<u.length;p++){const{selector:f,name:v}=u[p],h=document.querySelectorAll(f);!h||!h.length||h.forEach(_=>{l.push({name:v,selector:f,element:_})})}if(!l.length)return null;let w=[];for(let p=0;p<l.length;p++){const{element:f,name:v,selector:h}=l[p];f&&ko(f,a)&&w.push({name:v,selector:h,element:f})}return w};e&&document.addEventListener("click",a=>{if(!((e==null?void 0:e.collectUrl)||s)(location))return;const u=((e==null?void 0:e.collectElement)||r)(a),l=i(a);if(!u&&(!l||!l.length))return;const w=js(a);if(w){let p={};const f=(e==null?void 0:e.customProperty)||[],v=w.attributes;let h="";const _=v.getNamedItem("apaas-track-click");if(_&&_.nodeName==="apaas-track-click"){const T=_.nodeValue;T&&T!=="false"&&T!=="true"&&(h=T)}for(let T of v){let R=T.nodeName;const et=T.nodeValue;R.startsWith("data-apaastrack-")?p[R.replace("data-apaastrack-","")]=et||"":f.length&&f.forEach(M=>{if(R===M){const C=R.replace(/-[A-Za-z]/,K=>K[1].toUpperCase());p[C]=et||""}})}let y="";e!=null&&e.trackElementPath&&(y=Hn(w));const k=new ue(n);k.setProperties({name:p.name||h,paths:y,customProperties:p}),n.addLogByEvent(k)}if(l&&l.length)for(let p of l){let f="";e!=null&&e.trackElementPath&&(f=Hn(p.element));const v=new ue(n);v.setProperties({name:p.name,paths:f,customProperties:{selector:p.selector,name:p.name}}),n.addLogByEvent(v)}},!0)},So=(n,e,s,r)=>{const i={paths:"",customProperties:{}};"customProperties"in e?i.customProperties=e.customProperties:i.customProperties=e;const a=Lt(n,"click");let u=e.paths||"";r&&!u&&(s==null?void 0:s.trackElementPath)&&(u=Hn(r.target),i.paths=u),a.setProperties(i),n.addLogByEvent(a)},Po=n=>{n||(n={}),ue.eventOptions=n,ue.initApaasTrackHook=e=>{e.executeClickEvent=(s,r)=>{So(e,s,n,r)}},ue.startApaasTrackHook=e=>{To(e,n)},Et.registerEvent("click",ue)},he=[],Us=n=>{he.length||window.addEventListener("pagehide",(...e)=>{he.forEach(s=>{s(...e)})}),he.push(n)},Lo=n=>{for(let e=0;e<he.length;e++){const s=he[e];n===s&&he.splice(e,1)}},Dt=[],Eo=n=>{Dt.length||(document.addEventListener("click",(...e)=>{Dt.forEach(s=>{s(...e)})}),document.addEventListener("mouseover",(...e)=>{Dt.forEach(s=>{s(...e)})}),document.addEventListener("scroll",(...e)=>{Dt.forEach(s=>{s(...e)})}),document.addEventListener("keydown",(...e)=>{Dt.forEach(s=>{s(...e)})})),Dt.push(n)},Bo=n=>{for(let e=0;e<Dt.length;e++){const s=Dt[e];n===s&&Dt.splice(e,1)}};class qs extends rt{constructor(e){super(e,"close")}}const xo=n=>{Us(e=>{if(n){n.sendByBeacon();const s=Lt(n,"close").getEventLog();n.addToLegancyLog(s)}})},Co=()=>{qs.startApaasTrackHook=n=>{xo(n)},Et.registerEvent("close",qs)};class $s extends rt{constructor(e){super(e,"entermain"),b(this,"groupid",""),b(this,"localtime",""),b(this,"cheatinfo",{})}getProperties(){return{groupid:this.groupid,localtime:this.localtime,cheatinfo:this.cheatinfo}}setProperties(e){this.groupid=e.groupid,this.localtime=Date.now().toString()}}const Mo=()=>{$s.initApaasTrackHook=n=>{n.executeEnterMainEvent=()=>{const e=Lt(n,"entermain");e.setProperties({groupid:n.groupid}),n.addLogByEvent(e)}},Ee.registerEvent("entermain",$s)},Ro=(n,e={})=>{Gt(e)||(e={});let s=n?n.split("?"):[];if(s.shift(),s.length>0){s=s.join("?").split("&");for(const r of s){const i=r.split("=");try{e[i[0]]=decodeURIComponent(i[1])}catch{e[i[0]]=i[1]}}}return e},Me=(n,e)=>{let s="";switch(n){case"":case"text":case"json":if(Pe(e))try{s=JSON.parse(e),s=hs(s,{maxDepth:10,keyMaxLen:1e4,pretty:!0,standardJSON:!0})}catch{s=ls(String(e),1e4)}else Gt(e)||Pt(e)?s=hs(e,{maxDepth:10,keyMaxLen:1e4,pretty:!0,standardJSON:!0}):typeof e<"u"&&(s=Object.prototype.toString.call(e));break;case"blob":case"document":case"arraybuffer":case"formdata":default:typeof e<"u"&&(s=Object.prototype.toString.call(e));break}return s},Js=n=>{if(!n)return null;let e=null;if(typeof n=="string")try{e=JSON.parse(n)}catch{const s=n.split("&");if(s.length===1)e=n;else{e={};for(let r of s){const i=r.split("=");e[i[0]]=i[1]===void 0?"undefined":i[1]}}}else if(Nr(n))if(e={},Pt(n)&&as(n[0]))e=n;else for(const[s,r]of n)e[s]=typeof r=="string"?r:"[object Object]";else Ur(n)?e=n:e=`[object ${jr(n)}]`;return e},Gs=(n="")=>(n.startsWith("//")&&(n=`${new URL(window.location.href).protocol}${n}`),n.startsWith("http")?new URL(n):new URL(n,window.location.href));class Xs{constructor(){b(this,"id",""),b(this,"name",""),b(this,"method",""),b(this,"url",""),b(this,"status",0),b(this,"statusText",""),b(this,"cancelState",0),b(this,"readyState",0),b(this,"header",null),b(this,"responseType",""),b(this,"requestType","xhr"),b(this,"requestHeader",null),b(this,"response"),b(this,"responseSize",0),b(this,"responseSizeText",""),b(this,"startTime",0),b(this,"startTimeText",""),b(this,"endTime",0),b(this,"costTime",0),b(this,"getData",null),b(this,"postData",null),b(this,"postLength",0),b(this,"actived",!1),b(this,"noVConsole",!1),b(this,"_XMLReq",null),this.id=ae()}}class Do{constructor(e,s,r){b(this,"resp"),b(this,"item"),b(this,"onUpdateCallback"),this.resp=e,this.item=s,this.onUpdateCallback=r,this.mockReader()}set(e,s,r){return Reflect.set(e,s,r)}get(e,s){const r=Reflect.get(e,s);switch(s){case"arrayBuffer":case"blob":case"formData":case"json":case"text":return()=>(this.item.responseType=s.toLowerCase(),r.apply(e).then(i=>(this.item.response=Me(this.item.responseType,i),this.onUpdateCallback(this.item),i)))}return typeof r=="function"?r.bind(e):r}mockReader(){let e;if(!this.resp.body||typeof this.resp.body.getReader!="function")return;const s=this.resp.body.getReader;this.resp.body.getReader=()=>{const r=s.apply(this.resp.body);if(this.item.readyState===4)return r;const i=r.read,a=r.cancel;return this.item.responseType="arraybuffer",r.read=()=>i.apply(r).then(u=>{if(!e)e=new Uint8Array(u.value);else{const l=new Uint8Array(e.length+u.value.length);l.set(e),l.set(u.value,e.length),e=l}return this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.readyState=u.done?4:3,this.item.statusText=u.done?String(this.item.status):"Loading",this.item.responseSize=e.length,this.item.responseSizeText=Le(this.item.responseSize),u.done&&(this.item.response=Me(this.item.responseType,e)),this.onUpdateCallback(this.item),u}),r.cancel=(...u)=>(this.item.cancelState=2,this.item.statusText="Cancel",this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=Me(this.item.responseType,e),this.onUpdateCallback(this.item),a.apply(r,u)),r}}}class Ao{constructor(e){b(this,"onUpdateCallback"),this.onUpdateCallback=e}apply(e,s,r){const i=r[0],a=r[1],u=new Xs;return this.beforeFetch(u,i,a),e.apply(window,r).then(this.afterFetch(u)).catch(l=>{throw u.endTime=Date.now(),u.costTime=u.endTime-(u.startTime||u.endTime),this.onUpdateCallback(u),l})}beforeFetch(e,s,r){let i,a="GET",u=null;if(Pe(s)?(a=(r==null?void 0:r.method)||"GET",i=Gs(s),u=(r==null?void 0:r.headers)||null):(a=s.method||"GET",i=Gs(s.url),u=s.headers),e.method=a,e.requestType="fetch",e.requestHeader=u,e.url=i.toString(),e.name=(i.pathname.split("/").pop()||"")+i.search,e.status=0,e.statusText="Pending",e.readyState=1,!e.startTime){e.startTime=Date.now();const l=is(e.startTime);e.startTimeText=`${l.year}-${l.month}-${l.day} ${l.hour}:${l.minute}:${l.second}.${l.millisecond}`}if(Object.prototype.toString.call(u)==="[object Headers]"){e.requestHeader={};for(const[l,w]of u)e.requestHeader[l]=w}else e.requestHeader=u;if(i.search&&i.searchParams){e.getData={};for(const[l,w]of i.searchParams)e.getData[l]=w}r!=null&&r.body&&(e.postData=Js(r.body)),this.onUpdateCallback(e)}afterFetch(e){return s=>{e.endTime=Date.now(),e.costTime=e.endTime-(e.startTime||e.endTime),e.status=s.status,e.statusText=String(s.status);let r=!1;e.header={};for(const[i,a]of s.headers)e.header[i]=a,r=a.toLowerCase().indexOf("chunked")>-1?!0:r;return r?e.readyState=3:(e.readyState=4,this.handleResponseBody(s.clone(),e).then(i=>{e.responseSize=typeof i=="string"?i.length:i.byteLength,e.responseSizeText=Le(e.responseSize),e.response=Me(e.responseType,i),this.onUpdateCallback(e)})),this.onUpdateCallback(e),new Proxy(s,new Do(s,e,this.onUpdateCallback))}}handleResponseBody(e,s){const r=e.headers.get("content-type");return r&&r.includes("application/json")?(s.responseType="json",e.text()):r&&(r.includes("text/html")||r.includes("text/plain"))?(s.responseType="text",e.text()):(s.responseType="arraybuffer",e.arrayBuffer())}}class Ws{static create(e){return new Proxy(window.fetch,new Ao(e))}}b(Ws,"origFetch",window.fetch);class Oo{constructor(e,s){b(this,"XMLReq"),b(this,"item"),b(this,"onUpdateCallback"),this.XMLReq=e,this.XMLReq.onreadystatechange=()=>{this.onReadyStateChange()},this.XMLReq.onabort=()=>{this.onAbort()},this.XMLReq.ontimeout=()=>{this.onTimeout()},this.item=new Xs,this.item._XMLReq=e,this.item.requestType="xhr",this.onUpdateCallback=s}get(e,s){switch(s){case"_noVConsole":return this.item.noVConsole;case"open":return this.getOpen(e);case"send":return this.getSend(e);case"setRequestHeader":return this.getSetRequestHeader(e);default:const r=Reflect.get(e,s);return typeof r=="function"?r.bind(e):r}}set(e,s,r){switch(s){case"_noVConsole":return this.item.noVConsole=!!r,!1;case"onreadystatechange":return this.setOnReadyStateChange(e,s,r);case"onabort":return this.setOnAbort(e,s,r);case"ontimeout":return this.setOnTimeout(e,s,r)}return Reflect.set(e,s,r)}onReadyStateChange(){this.item.readyState=this.XMLReq.readyState,this.item.responseType=this.XMLReq.responseType,this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-this.item.startTime,this.updateItemByReadyState(),this.item.response=Me(this.item.responseType,this.item.response),this.triggerUpdate()}onAbort(){this.item.cancelState=1,this.item.statusText="Abort",this.triggerUpdate()}onTimeout(){this.item.cancelState=3,this.item.statusText="Timeout",this.triggerUpdate()}triggerUpdate(){this.item.noVConsole||this.onUpdateCallback(this.item)}getOpen(e){const s=Reflect.get(e,"open");return(...r)=>{const i=r[0],a=r[1];return this.item.method=i?i.toUpperCase():"GET",this.item.url=a||"",this.item.name=this.item.url.replace(new RegExp("[/]*$"),"").split("/").pop()||"",this.item.getData=Ro(this.item.url,{}),this.triggerUpdate(),s.apply(e,r)}}getSend(e){const s=Reflect.get(e,"send");return(...r)=>{const i=r[0];return i&&Object.prototype.hasOwnProperty.call(i,"length")&&(this.item.postLength=i.length),this.item.postData=Js(i),this.triggerUpdate(),s.apply(e,r)}}getSetRequestHeader(e){const s=Reflect.get(e,"setRequestHeader");return(...r)=>(this.item.requestHeader||(this.item.requestHeader={}),this.item.requestHeader[r[0]]=r[1],this.triggerUpdate(),s.apply(e,r))}setOnReadyStateChange(e,s,r){return Reflect.set(e,s,(...i)=>{this.onReadyStateChange(),r.apply(e,i)})}setOnAbort(e,s,r){return Reflect.set(e,s,(...i)=>{this.onAbort(),r.apply(e,i)})}setOnTimeout(e,s,r){return Reflect.set(e,s,(...i)=>{this.onTimeout(),r.apply(e,i)})}updateItemByReadyState(){switch(this.XMLReq.readyState){case 0:case 1:if(this.item.status=0,this.item.statusText="Pending",!this.item.startTime){this.item.startTime=Date.now();const r=is(this.item.startTime);this.item.startTimeText=`${r.year}-${r.month}-${r.day} ${r.hour}:${r.minute}:${r.second}.${r.millisecond}`}break;case 2:this.item.status=this.XMLReq.status,this.item.statusText="Loading",this.item.header={};const e=this.XMLReq.getAllResponseHeaders()||"",s=e.split(`
|
|
11
|
+
`);for(let r=0;r<s.length;r++){const i=s[r];if(!i)continue;const a=i.split(": "),u=a[0],l=a.slice(1).join(": ");this.item.header[u]=l}break;case 3:this.item.status=this.XMLReq.status,this.item.statusText="Loading",!!this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=Le(this.item.responseSize));break;case 4:this.item.status=this.XMLReq.status||this.item.status||0,this.item.statusText=String(this.item.status),this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=this.XMLReq.response,!!this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=Le(this.item.responseSize));break;default:this.item.status=this.XMLReq.status,this.item.statusText="Unknown";break}}}class Qs{static create(e){return new Proxy(XMLHttpRequest,{construct(s){const r=new s;return new Proxy(r,new Oo(r,e))}})}}b(Qs,"origXMLHttpRequest",XMLHttpRequest);class rn extends rt{constructor(e){super(e,"http"),b(this,"url",""),b(this,"method",""),b(this,"startTime",0),b(this,"endTime",0),b(this,"requestContentLength",0),b(this,"responseContentLength",0),b(this,"statusCode",0),b(this,"headers",{}),b(this,"trackOptions",{trackHeaders:!0})}setTrackOptions(e){this.trackOptions=e}getProperties(){return{url:this.url,method:this.method,header:this.trackOptions.trackHeaders?this.headers:void 0,code:this.statusCode,duration:(this.endTime-this.startTime)*1e6,reqcontentlength:this.requestContentLength,respcontentlength:this.responseContentLength,start:this.startTime*1e6,end:this.endTime*1e6}}start(e,s,r,i){this.startTime=Date.now(),this.url=e,this.method=s,this.headers=i,this.requestContentLength=r}end(e,s){this.endTime=Date.now(),this.responseContentLength=e,this.statusCode=s}setProperties(e){this.url=e.url,this.method=e.method,this.startTime=e.startTime,this.endTime=e.endTime,this.requestContentLength=e.requestContentLength,this.responseContentLength=e.responseContentLength,this.statusCode=e.statusCode;let s=e.headers;s&&(s={...s,token:""}),this.headers=s}}const zo=(n,e)=>{const s=(r,i)=>{if(i.readyState===4&&i.url!==r.options.url){const a=new rn(r);a.setTrackOptions(e),a.setProperties({url:i.url,method:i.method,startTime:i.startTime,endTime:i.endTime,requestContentLength:i.postLength,responseContentLength:i.responseSize,statusCode:i.status,headers:i.header||{}}),r.addLogByEvent(a)}};window.XMLHttpRequest=Qs.create(r=>{s(n,r)}),window.fetch=Ws.create(r=>{s(n,r)})},Fo=n=>{n||(n={trackHeaders:!0}),rn.eventOptions=n,rn.startApaasTrackHook=e=>{zo(e,n)},Ee.registerEvent("http",rn)},vt=(n,e=!1)=>{let s=location.href.replace(/#\/.+$/,n);return e&&(s=s.replace(/\?\S+$/,"")),s},Vs=(n,e)=>{let s=history.pushState,r=history.replaceState,i=vt(location.hash),a=null;history.pushState=function(...u){const l=vt(location.hash),w=vt(u[2]||"");return i=w,n&&(a={newURL:w,oldURL:l,type:"push"},Sn(()=>{a&&(e(a),a=null)})),s.apply(this,u)},history.replaceState=function(...u){if(n){const l=vt(location.hash),w=vt(u[2]||"");a={newURL:w,oldURL:l,type:"replace"},i=w,Sn(()=>{if(a&&a.oldURL===l&&a.newURL===w){let p=vt(location.hash);l===w?w!==p?(a.newURL=p,a.type="push"):a.type="onload":a.type="replace",e(a),a=null}})}return r.apply(this,u)},window.addEventListener("popstate",u=>{if(n){const l=vt(location.hash);u.state&&(a={newURL:l,oldURL:i,type:u.state.forward?"back":"forward"},i=l,e(a),a=null)}})};var Ho=function(n,e){e===!0&&(e=0);var s="";if(typeof n=="string")try{s=new URL(n).protocol}catch{}else n&&n.constructor===URL&&(s=n.protocol);var r=s.split(/\:|\+/).filter(Boolean);return typeof e=="number"?r[e]:r},Io=Ho;function No(n){var e={protocols:[],protocol:null,port:null,resource:"",host:"",user:"",password:"",pathname:"",hash:"",search:"",href:n,query:{},parse_failed:!1};try{var s=new URL(n);e.protocols=Io(s),e.protocol=e.protocols[0],e.port=s.port,e.resource=s.hostname,e.host=s.host,e.user=s.username||"",e.password=s.password||"",e.pathname=s.pathname,e.hash=s.hash.slice(1),e.search=s.search.slice(1),e.href=s.href,e.query=Object.fromEntries(s.searchParams)}catch{e.protocols=["file"],e.protocol=e.protocols[0],e.port="",e.resource="",e.user="",e.pathname="",e.hash="",e.search="",e.href=n,e.query={},e.parse_failed=!0}return e}var jo=No;const Uo="text/plain",qo="us-ascii",Ks=(n,e)=>e.some(s=>s instanceof RegExp?s.test(n):s===n),$o=(n,{stripHash:e})=>{const s=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(n);if(!s)throw new Error(`Invalid URL: ${n}`);let{type:r,data:i,hash:a}=s.groups;const u=r.split(";");a=e?"":a;let l=!1;u[u.length-1]==="base64"&&(u.pop(),l=!0);const w=(u.shift()||"").toLowerCase(),p=[...u.map(f=>{let[v,h=""]=f.split("=").map(_=>_.trim());return v==="charset"&&(h=h.toLowerCase(),h===qo)?"":`${v}${h?`=${h}`:""}`}).filter(Boolean)];return l&&p.push("base64"),(p.length>0||w&&w!==Uo)&&p.unshift(w),`data:${p.join(";")},${l?i.trim():i}${a?`#${a}`:""}`};function Jo(n,e){if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},n=n.trim(),/^data:/i.test(n))return $o(n,e);if(/^view-source:/i.test(n))throw new Error("`view-source:` is not supported as it is a non-standard protocol");const s=n.startsWith("//");!s&&/^\.*\//.test(n)||(n=n.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));const r=new URL(n);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&r.protocol==="https:"&&(r.protocol="http:"),e.forceHttps&&r.protocol==="http:"&&(r.protocol="https:"),e.stripAuthentication&&(r.username="",r.password=""),e.stripHash?r.hash="":e.stripTextFragment&&(r.hash=r.hash.replace(/#?:~:text.*?$/i,"")),r.pathname){const a=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let u=0,l="";for(;;){const w=a.exec(r.pathname);if(!w)break;const p=w[0],f=w.index;l+=r.pathname.slice(u,f).replace(/\/{2,}/g,"/"),l+=p,u=f+p.length}l+=r.pathname.slice(u,r.pathname.length).replace(/\/{2,}/g,"/"),r.pathname=l}if(r.pathname)try{r.pathname=decodeURI(r.pathname)}catch{}if(e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let a=r.pathname.split("/");const u=a[a.length-1];Ks(u,e.removeDirectoryIndex)&&(a=a.slice(0,-1),r.pathname=a.slice(1).join("/")+"/")}if(r.hostname&&(r.hostname=r.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(r.hostname)&&(r.hostname=r.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(const a of[...r.searchParams.keys()])Ks(a,e.removeQueryParameters)&&r.searchParams.delete(a);if(e.removeQueryParameters===!0&&(r.search=""),e.sortQueryParameters){r.searchParams.sort();try{r.search=decodeURIComponent(r.search)}catch{}}e.removeTrailingSlash&&(r.pathname=r.pathname.replace(/\/$/,""));const i=n;return n=r.toString(),!e.removeSingleSlash&&r.pathname==="/"&&!i.endsWith("/")&&r.hash===""&&(n=n.replace(/\/$/,"")),(e.removeTrailingSlash||r.pathname==="/")&&r.hash===""&&e.removeSingleSlash&&(n=n.replace(/\/$/,"")),s&&!e.normalizeProtocol&&(n=n.replace(/^http:\/\//,"//")),e.stripProtocol&&(n=n.replace(/^(?:https?:)?\/\//,"")),n}const Re=(n,e=!1)=>{const s=/^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:]([\~,\.\w,\-,\_,\/]+?(?:\.git|\/)?)$/,r=a=>{const u=new Error(a);throw u.subject_url=n,u};(typeof n!="string"||!n.trim())&&r("Invalid url."),n.length>Re.MAX_INPUT_LENGTH&&r("Input exceeds maximum length. If needed, change the value of parseUrl.MAX_INPUT_LENGTH."),e&&(typeof e!="object"&&(e={stripHash:!1}),n=Jo(n,e));const i=jo(n);if(i.parse_failed){const a=i.href.match(s);a?(i.protocols=["ssh"],i.protocol="ssh",i.resource=a[2],i.host=a[2],i.user=a[1],i.pathname=`/${a[3]}`,i.parse_failed=!1):r("URL parsing failed.")}return i};Re.MAX_INPUT_LENGTH=2048,Re.MAX_INPUT_LENGTH=2048*1024;class le extends rt{constructor(e){super(e,"online"),b(this,"url",""),b(this,"duration",0),b(this,"startTime",0),b(this,"endTime",0),b(this,"views",[])}getProperties(){return{url:this.url,duration:this.duration,startTime:this.startTime,endTime:this.endTime}}setProperties(e){this.duration=e.duration,this.url=e.url,this.startTime=e.startTime,this.endTime=e.endTime,e.views&&(this.views=e.views)}}let De=null;const Zs=(n,e)=>{const s=()=>!0;let r=typeof e=="object"&&e.collectUrl?e.collectUrl:s;return i=>{let a=Re(i.newURL),u=Re(i.oldURL),l=vt(`#${a.hash}`,!0);i.oldURL&&vt(`#${u.hash}`,!0),De&&(De.stop(),De.destroy(),De=null),r(location)&&(De=new Go(n,l))}};class Go{constructor(e,s,r){b(this,"url",""),b(this,"duration",0),b(this,"startTime",0),b(this,"onlineOptions"),b(this,"apaasTrack"),b(this,"visibleChangeHandler"),b(this,"beforeUnLoadHandler"),b(this,"userActionHandler"),b(this,"onlineTimer",null),b(this,"stopTimeout",null),this.url=s,this.apaasTrack=e,this.onlineOptions=r||{collectUrl:void 0},this.visibleChangeHandler=i=>{const a=i.target.visibilityState;this.stopUserActionMonitor(),a==="visible"?this.start():this.startUserActionMonitor()},this.beforeUnLoadHandler=i=>{if(this.apaasTrack){const a=Date.now()-this.startTime;this.saveOnlineData(a);const u=this.apaasTrack.getStorageData();if(u.onlineData)for(let l in u.onlineData){const w=u.onlineData[l],p=new le(this.apaasTrack);p.setProperties({duration:w.duration,url:l,startTime:w.startTime,endTime:w.lastTime,views:w.views});const f=p.getEventLog();e.addToLegancyLog(f)}this.cleanOnlineData()}},this.userActionHandler=ro(i=>{console.log("\u6709\u7528\u6237\u884C\u4E3A"),this.stopUserActionMonitor(),this.start(),this.startUserActionMonitor()},60*1e3,{leading:!0,trailing:!1}),Us(this.beforeUnLoadHandler),Eo(this.userActionHandler),this.init()}startUserActionMonitor(){console.log("startUserActionMonitor"),!this.stopTimeout&&(this.stopTimeout=window.setTimeout(()=>{this.onlineTimer&&(console.log("\u65E0\u6548\u64CD\u4F5C\u65F6\u957F\uFF0C\u7528\u6237\u5DF2\u4E0B\u7EBF..."),clearInterval(this.onlineTimer),this.onlineTimer=null,this.saveOnlineData(this.duration),this.sendRecord(!1,this.url))},1e3*60))}stopUserActionMonitor(){console.log("stopUserActionMonitor"),this.stopTimeout&&(clearTimeout(this.stopTimeout),this.stopTimeout=null)}init(){let e=this.apaasTrack.getStorageData();e||(this.apaasTrack.initStorageData(),e=this.apaasTrack.getStorageData()),e.onlineData?this.cleanOnlineData():e.onlineData={},localStorage.setItem("apaas-track",JSON.stringify(e)),document.addEventListener("visibilitychange",this.visibleChangeHandler),this.start();const s=window.document.createEvent("MouseEvent");this.userActionHandler(s)}saveOnlineData(e,s){const r=this.apaasTrack.getStorageData();let i=r.onlineData,a=i[this.url]||(i[this.url]={duration:0,lastTime:Date.now()});a.duration=e,a.lastTime=Date.now(),a.startTime=this.startTime,s&&(a.views||(a.views=[]),a.views.push({name:s.name,duration:s.duration})),r.onlineData[this.url]=a,localStorage.setItem("apaas-track",JSON.stringify(r))}getStorageOnlineData(){return this.apaasTrack.getStorageData().onlineData}cleanOnlineData(e){const s=this.apaasTrack.getStorageData();!s.onlineData||(e?delete s.onlineData[e]:s.onlineData={},localStorage.setItem("apaas-track",JSON.stringify(s)))}start(){if(this.onlineTimer)return;this.startTime=Date.now(),this.duration=0;let e=10*1e3;this.onlineTimer=window.setInterval(()=>{console.log("onlineTimer---"),this.duration+=e,this.saveOnlineData(this.duration)},e)}stop(){if(this.onlineTimer){clearInterval(this.onlineTimer),this.onlineTimer=null;const e=Date.now()-this.startTime;this.duration=e,this.saveOnlineData(e),this.sendRecord(!1,this.url)}}destroy(){this.stopUserActionMonitor(),document.removeEventListener("visibilitychange",this.visibleChangeHandler),this.beforeUnLoadHandler&&Lo(this.beforeUnLoadHandler),this.userActionHandler&&Bo(this.userActionHandler)}sendRecord(e=!1,s){const r=this.getStorageOnlineData();if(r)if(s){const i=r[s];if(i!=null&&i.duration){const a=new le(this.apaasTrack);a.setProperties({duration:i.duration,url:s,startTime:i.startTime,endTime:i.lastTime,views:i.views}),this.apaasTrack.addLogByEvent(a),e&&this.apaasTrack.sendByBeacon()}this.cleanOnlineData(s)}else{for(let i in r){const a=r[i];if(a.duration){const u=new le(this.apaasTrack);u.setProperties({duration:a.duration,url:i,startTime:a.startTime,endTime:a.lastTime,views:a.views}),this.apaasTrack.addLogByEvent(u),e&&this.apaasTrack.sendByBeacon()}}this.cleanOnlineData()}this.duration=0,this.startTime=0}}const Xo=n=>{console.log("registerOnlineEvent"),n||(n={}),le.eventOptions=n,le.startApaasTrackHook=e=>{console.log("registerOnlineEvent startApaasTrackHook");let s=null;Vs(e,a=>{console.log("online listenHistoryChange"),s||(s=Zs(e)),s(a)});const r=()=>{i&&clearTimeout(i),s||(s=Zs(e));const a={newURL:vt(location.hash),oldURL:vt(location.hash),type:"onload"};s(a),window.removeEventListener("load",r)};let i=null;window.self!==window.top&&(window.addEventListener("load",r),i=setTimeout(()=>{r(),clearTimeout(i)},3e3))},Et.registerEvent("online",le)};class In extends rt{constructor(e){super(e,"pageview",Pn.HIGH),b(this,"oldURL",""),b(this,"newURL",""),b(this,"entertype","")}getProperties(){return{from:this.oldURL,to:this.newURL,entertype:this.entertype}}setProperties(e){this.oldURL=e.oldURL,this.newURL=e.newURL,this.entertype=e.type}}const Wo=(n,e)=>{const s=new In(n);s.setProperties(e);const r=s.getEventLog();n.addLogToQueue(r,!0)},Qo=()=>{In.startApaasTrackHook=n=>{Vs(n,e=>{Wo(n,e)})},Et.registerEvent("pageview",In)};var It,Ae,Ys,an,Nn,tr=-1,Vt=function(n){addEventListener("pageshow",function(e){e.persisted&&(tr=e.timeStamp,n(e))},!0)},jn=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},on=function(){var n=jn();return n&&n.activationStart||0},ft=function(n,e){var s=jn(),r="navigate";return tr>=0?r="back-forward-cache":s&&(r=document.prerendering||on()>0?"prerender":document.wasDiscarded?"restore":s.type.replace(/_/g,"-")),{name:n,value:e===void 0?-1:e,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},pe=function(n,e,s){try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var r=new PerformanceObserver(function(i){Promise.resolve().then(function(){e(i.getEntries())})});return r.observe(Object.assign({type:n,buffered:!0},s||{})),r}}catch{}},cn=function(n,e){var s=function r(i){i.type!=="pagehide"&&document.visibilityState!=="hidden"||(n(i),e&&(removeEventListener("visibilitychange",r,!0),removeEventListener("pagehide",r,!0)))};addEventListener("visibilitychange",s,!0),addEventListener("pagehide",s,!0)},gt=function(n,e,s,r){var i,a;return function(u){e.value>=0&&(u||r)&&((a=e.value-(i||0))||i===void 0)&&(i=e.value,e.delta=a,e.rating=function(l,w){return l>w[1]?"poor":l>w[0]?"needs-improvement":"good"}(e.value,s),n(e))}},Un=function(n){requestAnimationFrame(function(){return requestAnimationFrame(function(){return n()})})},de=function(n){document.prerendering?addEventListener("prerenderingchange",function(){return n()},!0):n()},me=-1,er=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},un=function(n){document.visibilityState==="hidden"&&me>-1&&(me=n.type==="visibilitychange"?n.timeStamp:0,Vo())},nr=function(){addEventListener("visibilitychange",un,!0),addEventListener("prerenderingchange",un,!0)},Vo=function(){removeEventListener("visibilitychange",un,!0),removeEventListener("prerenderingchange",un,!0)},qn=function(){return me<0&&(me=er(),nr(),Vt(function(){setTimeout(function(){me=er(),nr()},0)})),{get firstHiddenTime(){return me}}},sr=function(n,e){e=e||{},de(function(){var s,r=[1800,3e3],i=qn(),a=ft("FCP"),u=pe("paint",function(l){l.forEach(function(w){w.name==="first-contentful-paint"&&(u.disconnect(),w.startTime<i.firstHiddenTime&&(a.value=Math.max(w.startTime-on(),0),a.entries.push(w),s(!0)))})});u&&(s=gt(n,a,r,e.reportAllChanges),Vt(function(l){a=ft("FCP"),s=gt(n,a,r,e.reportAllChanges),Un(function(){a.value=performance.now()-l.timeStamp,s(!0)})}))})},Ko=function(n,e){e=e||{},de(function(){var s,r=[.1,.25],i=ft("CLS"),a=-1,u=0,l=[],w=function(v){a>-1&&n(v)},p=function(v){v.forEach(function(h){if(!h.hadRecentInput){var _=l[0],y=l[l.length-1];u&&h.startTime-y.startTime<1e3&&h.startTime-_.startTime<5e3?(u+=h.value,l.push(h)):(u=h.value,l=[h]),u>i.value&&(i.value=u,i.entries=l,s())}})},f=pe("layout-shift",p);f&&(s=gt(w,i,r,e.reportAllChanges),sr(function(v){a=v.value,i.value<0&&(i.value=0,s())}),cn(function(){p(f.takeRecords()),s(!0)}),Vt(function(){u=0,a=-1,i=ft("CLS",0),s=gt(w,i,r,e.reportAllChanges),Un(function(){return s()})}))})},Oe={passive:!0,capture:!0},Zo=new Date,rr=function(n,e){It||(It=e,Ae=n,Ys=new Date,ar(removeEventListener),ir())},ir=function(){if(Ae>=0&&Ae<Ys-Zo){var n={entryType:"first-input",name:It.type,target:It.target,cancelable:It.cancelable,startTime:It.timeStamp,processingStart:It.timeStamp+Ae};an.forEach(function(e){e(n)}),an=[]}},Yo=function(n){if(n.cancelable){var e=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;n.type=="pointerdown"?function(s,r){var i=function(){rr(s,r),u()},a=function(){u()},u=function(){removeEventListener("pointerup",i,Oe),removeEventListener("pointercancel",a,Oe)};addEventListener("pointerup",i,Oe),addEventListener("pointercancel",a,Oe)}(e,n):rr(e,n)}},ar=function(n){["mousedown","keydown","touchstart","pointerdown"].forEach(function(e){return n(e,Yo,Oe)})},tc=function(n,e){e=e||{},de(function(){var s,r=[100,300],i=qn(),a=ft("FID"),u=function(p){p.startTime<i.firstHiddenTime&&(a.value=p.processingStart-p.startTime,a.entries.push(p),s(!0))},l=function(p){p.forEach(u)},w=pe("first-input",l);s=gt(n,a,r,e.reportAllChanges),w&&cn(function(){l(w.takeRecords()),w.disconnect()},!0),w&&Vt(function(){var p;a=ft("FID"),s=gt(n,a,r,e.reportAllChanges),an=[],Ae=-1,It=null,ar(addEventListener),p=u,an.push(p),ir()})})},or=0,$n=1/0,hn=0,ec=function(n){n.forEach(function(e){e.interactionId&&($n=Math.min($n,e.interactionId),hn=Math.max(hn,e.interactionId),or=hn?(hn-$n)/7+1:0)})},cr=function(){return Nn?or:performance.interactionCount||0},nc=function(){"interactionCount"in performance||Nn||(Nn=pe("event",ec,{type:"event",buffered:!0,durationThreshold:0}))},ur=0,hr=function(){return cr()-ur},Bt=[],Jn={},lr=function(n){var e=Bt[Bt.length-1],s=Jn[n.interactionId];if(s||Bt.length<10||n.duration>e.latency){if(s)s.entries.push(n),s.latency=Math.max(s.latency,n.duration);else{var r={id:n.interactionId,latency:n.duration,entries:[n]};Jn[r.id]=r,Bt.push(r)}Bt.sort(function(i,a){return a.latency-i.latency}),Bt.splice(10).forEach(function(i){delete Jn[i.id]})}},sc=function(n,e){e=e||{},de(function(){var s=[200,500];nc();var r,i=ft("INP"),a=function(l){l.forEach(function(f){f.interactionId&&lr(f),f.entryType==="first-input"&&!Bt.some(function(v){return v.entries.some(function(h){return f.duration===h.duration&&f.startTime===h.startTime})})&&lr(f)});var w,p=(w=Math.min(Bt.length-1,Math.floor(hr()/50)),Bt[w]);p&&p.latency!==i.value&&(i.value=p.latency,i.entries=p.entries,r())},u=pe("event",a,{durationThreshold:e.durationThreshold||40});r=gt(n,i,s,e.reportAllChanges),u&&(u.observe({type:"first-input",buffered:!0}),cn(function(){a(u.takeRecords()),i.value<0&&hr()>0&&(i.value=0,i.entries=[]),r(!0)}),Vt(function(){Bt=[],ur=cr(),i=ft("INP"),r=gt(n,i,s,e.reportAllChanges)}))})},Gn={},rc=function(n,e){e=e||{},de(function(){var s,r=[2500,4e3],i=qn(),a=ft("LCP"),u=function(p){var f=p[p.length-1];if(f){var v=Math.max(f.startTime-on(),0);v<i.firstHiddenTime&&(a.value=v,a.entries=[f],s())}},l=pe("largest-contentful-paint",u);if(l){s=gt(n,a,r,e.reportAllChanges);var w=function(){Gn[a.id]||(u(l.takeRecords()),l.disconnect(),Gn[a.id]=!0,s(!0))};["keydown","click"].forEach(function(p){addEventListener(p,w,{once:!0,capture:!0})}),cn(w,!0),Vt(function(p){a=ft("LCP"),s=gt(n,a,r,e.reportAllChanges),Un(function(){a.value=performance.now()-p.timeStamp,Gn[a.id]=!0,s(!0)})})}})},ic=function n(e){document.prerendering?de(function(){return n(e)}):document.readyState!=="complete"?addEventListener("load",function(){return n(e)},!0):setTimeout(e,0)},ac=function(n,e){e=e||{};var s=[800,1800],r=ft("TTFB"),i=gt(n,r,s,e.reportAllChanges);ic(function(){var a=jn();if(a){var u=a.responseStart;if(u<=0||u>performance.now())return;r.value=Math.max(u-on(),0),r.entries=[a],i(!0),Vt(function(){r=ft("TTFB",0),(i=gt(n,r,s,e.reportAllChanges))(!0)})}})};class Xn extends rt{constructor(e){super(e,"performance"),b(this,"performanceData",null)}getProperties(){return{...this.performanceData}}setProperties(e){this.performanceData=e}track(){return new Promise((e,s)=>{let r={cls:null,lcp:null,ttfb:null,fcp:null,fid:null,inp:null};setTimeout(()=>{const a=performance.timing,u={...r,connectEnd:a.connectEnd,connectStart:a.connectStart,domComplete:a.domComplete,domContentLoadedEventEnd:a.domContentLoadedEventEnd,domContentLoadedEventStart:a.domContentLoadedEventStart,domInteractive:a.domInteractive,domLoading:a.domLoading,domainLookupEnd:a.domainLookupEnd,domainLookupStart:a.domainLookupStart,fetchStart:a.fetchStart,loadEventEnd:a.loadEventEnd,loadEventStart:a.loadEventStart,navigationStart:a.navigationStart,redirectEnd:a.redirectEnd,redirectStart:a.redirectStart,requestStart:a.requestStart,responseEnd:a.responseEnd,responseStart:a.responseStart,secureConnectionStart:a.secureConnectionStart,unloadEventEnd:a.unloadEventEnd,unloadEventStart:a.unloadEventStart};this.setProperties(u),e(u)},1e4),rc(a=>{i(a)}),Ko(a=>{i(a)}),ac(a=>{i(a)}),sr(a=>{i(a)}),tc(a=>{i(a)}),sc(a=>{i(a)});const i=a=>{a.name==="FID"?r.fid=a.value:a.name==="CLS"?r.cls=a.value:a.name==="FCP"?r.fcp=a.value:a.name==="TTFB"?r.ttfb=a.value:a.name==="LCP"?r.lcp=a.value:a.name==="INP"&&(r.inp=a.value)}})}}const oc=async n=>{const e=new Xn(n);await e.track(),n.addLogByEvent(e)},cc=()=>{Xn.startApaasTrackHook=n=>{oc(n)},Et.registerEvent("performance",Xn)};class pr extends rt{constructor(e){super(e,"throw"),b(this,"message",""),b(this,"detailmessage",""),b(this,"name",""),b(this,"stack",[]),b(this,"cause",{})}getProperties(){return{message:this.message,detailmessage:this.detailmessage,name:this.name,stack:this.stack,cause:this.cause}}setError(e){const s=Tn(e);this.message=s.message,this.detailmessage=s.detail,this.name=s.name,this.stack=s.stack}}const uc=n=>{window.addEventListener("error",e=>{const s=Lt(n,"throw");s.setError(e.error),n.addLogByEvent(s)}),window.addEventListener("unhandledrejection",e=>{const s=Lt(n,"throw");s.setError(e.reason),n.addLogByEvent(s)})},hc=()=>{pr.startApaasTrackHook=n=>{uc(n)},Et.registerEvent("throw",pr)},lc=()=>{cc(),hc(),Mo()},pc=n=>{lc(),Qo(),Co(),(n==null?void 0:n.http)!==!1&&Fo(),n!=null&&n.click&&Po(typeof n.click=="object"?n.click:void 0),n!=null&&n.online&&Xo(typeof n.online=="object"?n.online:void 0)},dc=n=>(pc(n),mc(n)),mc=n=>new Et(n);class Kt{constructor(e,s,r){b(this,"_level",0),this.apaasTrack=e,this.type=s,r&&(this._level=r)}getProperties(){return{}}setProperties(e){}getEventLog(e){const s=e||Date.now();return{...this.apaasTrack.baseLog,types:this.type,logtime:String(s),epochnanos:String(s)+"000000",event:this.type,properties:this.getProperties(),url:oe()}}}b(Kt,"eventOptions"),b(Kt,"initApaasTrackHook"),b(Kt,"startApaasTrackHook"),b(Kt,"destroyApaasTrackHook");class fc extends Kt{constructor(e){super(e,"init")}getProperties(){const e=this.apaasTrack.baseLog;return{system:e.system||"",systemver:e.systemver||"",manufacturer:e.manufacturer||"",browser:e.browser||"",browserver:e.browserver||"",terminalid:e.terminalid||"",client:e.client||"",clientver:e.clientver||""}}}class gc extends Kt{constructor(e){super(e,"custom"),b(this,"info",{})}setCustomType(e){this.type=e}getProperties(){return{...this.info}}setProperties(e){this.info=e}}const fe={init:fc,custom:gc},ln=(n,e)=>{const s=fe[e];return new s(n)},_c=(n,e,s)=>{const r=s||Date.now(),i=ln(n,e);return{...n.baseLog,types:e,logtime:String(r),epochnanos:String(r)+"000000",event:e,properties:i.getProperties(),url:oe()}},dr=(n,e,s)=>{const r=s||Date.now();return{...n.baseLog,types:e.type,logtime:String(r),epochnanos:String(r)+"000000",event:e.type,properties:e.getProperties(),url:oe()}},mr=(n,e)=>{if(fe[n])throw Error(`\u8BE5\u4E8B\u4EF6${n} \u5DF2\u5B58\u5728\uFF0C\u6CE8\u518C\u5931\u8D25`);fe[n]=e};class vc{constructor(e,s){b(this,"name",""),b(this,"time",0),b(this,"info",{}),e&&(this.name=e),s&&(this.info=s),this.time=Date.now()}get epochnanos(){return this.time*1e6}get attributes(){return this.getAttributes()}getAttributes(){return{}}getJson(){return{name:this.name,epochnanos:this.time*1e6,attributes:this.getAttributes(),...this.info}}setInfo(e){this.info=e||{}}}class bc extends vc{constructor(){super(...arguments),b(this,"name","exception"),b(this,"exceptionType",""),b(this,"exceptionMessage",""),b(this,"exceptionStackTrace","")}getAttributes(){return{"exception.type":this.exceptionType,"exception.message":this.exceptionMessage,"exception.stacktrace":this.exceptionStackTrace}}setInfo(e){this.exceptionMessage=e.exceptionMessage,this.exceptionType=e.exceptionType,this.exceptionStackTrace=e.exceptionStackTrace}}class Wn extends Kt{constructor(e,s,r){super(e,"span"),b(this,"spanid",""),b(this,"traceid",""),b(this,"parentspanid",""),b(this,"name",""),b(this,"attributes",{}),b(this,"events",[]),b(this,"statuscode","OK"),b(this,"statusmessage",""),b(this,"startTime",0),b(this,"endTime",0),this.name=s,this.traceid=ae(),this.spanid=rs(),this.parentspanid=r||"",this.start()}trackLog(){this.apaasTrack.addLogByEvent(this)}createSpanEvent(e,s){return new Wn(this.apaasTrack,e,s)}setAttribute(e){const s=e.getAttributes();this.attributes=s}addEvent(e){this.events.push(e)}exception(e){const s=new bc;let r="",i="",a="";if(e instanceof Error){const u=Tn(e);r=u.detail,i=u.name,a=u.stack.join(",")}else r=e.exceptionMessage,i=e.exceptionType,a=e.exceptionStackTrace;s.setInfo({exceptionMessage:r,exceptionType:i,exceptionStackTrace:a}),this.events.push(s)}start(){this.startTime=Date.now()}end(e,s){e&&(this.statusmessage=e),s&&(this.statuscode=s),this.endTime=Date.now()}getProperties(){return{traceid:this.traceid,spanid:this.spanid,parentspanid:this.parentspanid,name:this.name,attributes:this.attributes,events:this.events.map(e=>e.getJson()),statuscode:this.statuscode,statusmessage:this.statusmessage,startepochnanos:this.startTime*1e6,endepochnanos:this.endTime*1e6,duration:(this.endTime-this.startTime)*1e6}}}class fr{constructor(e){b(this,"_version",Qe),b(this,"commonLog",null),b(this,"browserLog",null),b(this,"options"),this.options=e,typeof window<"u"&&(window.__apaasTrackVersion__=Qe),typeof wx<"u"&&!window&&(wx.__apaasTrackVersion__=Qe),e.commonLog&&this.initCommonLog(e.commonLog),this.runEventInitHooks()}registerEvent(e,s){mr(e,s),s.initApaasTrackHook&&s.initApaasTrackHook(this),s.startApaasTrackHook&&s.startApaasTrackHook(this)}get groupid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}runEventInitHooks(){Object.values(fe).forEach(e=>{e.initApaasTrackHook&&e.initApaasTrackHook(this)})}runEventStartHooks(){Object.values(fe).forEach(e=>{e.startApaasTrackHook&&e.startApaasTrackHook(this)})}runEventDestroyHooks(){Object.values(fe).forEach(e=>{e.destroyApaasTrackHook&&e.destroyApaasTrackHook(this)})}get anonymousid(){var e;return(e=this.browserLog)==null?void 0:e.anonymousid}get distinctid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}get baseLog(){return{...this.browserLog,...this.commonLog}}initCommonLog(e){this.commonLog=e}createEventLog(e,s){return _c(this,e,s)}addLogByType(e,s){const r=this.createEventLog(e,s);this.addLogToQueue(r)}addLogByEvent(e,s){const r=dr(this,e,s);this.addLogToQueue(r)}createCustomEvent(e){const s=ln(this,"custom");return s.setCustomType(e),s}createSpanEvent(e,s){return new Wn(this,e,s)}addLogByCustomEvent(e,s={},r){const i=this.createCustomEvent(e);i.setProperties(s);const a=dr(this,i,r);this.addLogToQueue(a)}executeInitEvent(){const e=ln(this,"init");e.setProperties({groupid:this.groupid}),this.addLogByEvent(e)}updateCommonLog(e){this.commonLog={...this.commonLog,...e}}trackEvent(e,s={},r){const i=ln(this,e);i.setProperties(s),this.addLogByEvent(i,r)}start(...e){this.executeInitEvent(),this.runEventStartHooks()}destroy(){this.runEventDestroyHooks()}transformLog(e){return e}async addLogToQueue(e,s=!1,r=!0){r&&(e=this.transformLog(e)),await this.sendLog(e,s)}}b(fr,"registerEvent",mr);const gr=async n=>{var i;let e=await n.getWebInitParams();const s=location.origin+"/static/apaas-track/apaas-spu/lzma_worker.js";console.log("createApaasTrack lzma_worker",s),hi(s);const r=dc({url:n.url||"",click:{trackElementPath:!0},commonLog:{client:"Web",...e},online:(n==null?void 0:n.online)||!1,pageview:!0,http:!0,zip:n.zip!==void 0?n.zip:!0,useIndexDB:(i=n==null?void 0:n.useIndexDB)!=null?i:!1});return r.sendLog=n.sendLog,r.start=function(...a){return fr.prototype.start.call(this,...a)},n.sendLog===Vn&&(r.start=function(...a){return Et.prototype.start.call(this,...a)}),n.startFn&&(r.start=n.startFn),r};let Qn=null;const wc=async n=>{var s,r;if(Qn)return Qn;const e=await gr({url:(n==null?void 0:n.url)||"",sendLog:(n==null?void 0:n.sendLog)||Vn,startFn:(n==null?void 0:n.startFn)||null,online:(n==null?void 0:n.online)||!1,getWebInitParams:(n==null?void 0:n.getWebInitParams)||_r,zip:(s=n==null?void 0:n.zip)!=null?s:!0,useIndexDB:(r=n==null?void 0:n.useIndexDB)!=null?r:!1});return Qn=e,e},_r=()=>new Promise((n,e)=>{if(window.aPaaS&&window.aPaaS.getWebInitParams){const s=window.aPaaS.getWebInitParams(r=>{n(r)});s&&s.then&&s.then(r=>{n(r)})}else{window.parent.postMessage({type:"getWebInitParams"},"*");const s=i=>{const a=(i==null?void 0:i.data)||{};if(a.type==="receiveWebInitParams")if(a.data){const u=a.data;n(u),r&&(clearTimeout(r),r=null),window.removeEventListener("message",s)}else e(Error("receiveWebInitParams response null"))};window.addEventListener("message",s);let r=window.setTimeout(()=>{e(Error("postMessage getWebInitParams timeout"))},2e3)}});function yc(...n){return Et.prototype.start.call(this,n)}function Vn(n,e){var s;return(s=window.aPaaS)!=null&&s.sendLog?window.aPaaS.sendLog(n,e):Et.prototype.sendLog.call(this,n,e)}X.BaseEvent=rt,X.BaseSpanAttribute=Yr,X.BaseTrack=Ee,X.CustomEvent=ms,X.EventLevel=Pn,X.EventMap=Xt,X.ExceptionSpanEvent=_s,X.InitEvent=ds,X.SpanEvent=We,X.SpanPropertyEvent=gs,X.TaskQueue=ps,X.createApaasTrack=gr,X.createEvent=Lt,X.defaultGetWebInitParams=_r,X.defaultWebSendFunction=Vn,X.defaultWebStartFunction=yc,X.getApaasSpuTrack=wc,X.getEventLog=Ln,X.getEventLogByType=fs,X.registerEvent=En,Object.defineProperties(X,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|