@incodetech/tri-sdk 0.4.0-rc.0 → 0.4.0
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/chunks/browser-BS2-bItW.cjs +1 -0
- package/dist/chunks/browser-DlFgHpoC.js +1 -0
- package/dist/index.d.ts +9 -41
- package/dist/tri.cjs.js +1 -1
- package/dist/tri.esm.js +1 -1
- package/dist/tri.umd.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/browser-8Za96B1X.js +0 -1
- package/dist/chunks/browser-D1C751kT.cjs +0 -1
package/dist/tri.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).IncodeTRI={})}(this,function(t){"use strict";class n{constructor(){this.T=0}static get instance(){return n._||(n._=new n),n._}get DEBUG(){return this.T}set DEBUG(t){this.T=t}warn(t,n,...e){this.T&&this.S("warn",t,n,...e)}error(t,n,...e){this.T&&this.S("error",t,n,...e)}info(t,n,...e){this.T&&this.S("info",t,n,...e)}fatal(t,n,e,...i){this.S(t,n,e,...i)}S(t,n,e,...i){const r=n?`[${n}]`:"",o=console?.[t];o&&o(`[IncodeTRI]${r} ${e}`,...i)}}const e=n.instance;function i(t,n,e){let i=t,r=n;if("devicepixelratiochange"===n){const t=window.devicePixelRatio;i=window.matchMedia(`(resolution: ${t}dppx)`),r="change"}i.addEventListener(r,e,{capture:1,passive:1})}function r(t,n,e){let i=t,r=n;if("devicepixelratiochange"===n){const t=window.devicePixelRatio;i=window.matchMedia(`(resolution: ${t}dppx)`),r="change"}i.removeEventListener(r,e,{capture:1})}const o=globalThis.setTimeout.bind(globalThis),s=globalThis.clearTimeout.bind(globalThis);function a(t,n){try{return t()}catch(t){e.warn("utils","safeSync swallowed error:",t)}}async function c(t){try{return await t()}catch(t){e.warn("utils","safeAsync swallowed error:",t)}}function u(t){return n=>a(()=>t(n))}function l(t){return(...n)=>{try{t(...n)}catch(t){e.warn("utils","safeTimer swallowed error:",t)}}}function f(t,n){return o(l(t),n)}function h(t){if(null!==t)try{s(t)}catch(t){e.warn("utils","safeClearTimeout swallowed error:",t)}}const d=new Set(["xmlhttprequest","fetch","beacon","navigation","script","link","css","img","iframe","video","audio"]),v=new Set(["xmlhttprequest","fetch","beacon"]);function p(t,n){return n?t:null}function w(t,n){const e=t,i=t.responseStart>0,r=p(t.domainLookupEnd-t.domainLookupStart,i),o=p(t.connectEnd-t.connectStart,i),s=p(t.connectEnd>0&&t.secureConnectionStart>0?t.connectEnd-t.secureConnectionStart:0,i),a=p(t.responseStart-t.requestStart,i),c=p(t.responseEnd-t.responseStart,i),u=i?t.transferSize:null,l=i?t.encodedBodySize:null,f=i?t.decodedBodySize:null,h=i&&t.nextHopProtocol||null,v=i&&void 0!==e.deliveryType?e.deliveryType:null,w=e.responseStatus,m=void 0!==w&&0!==w?w:null;return{name:"network_request",timestamp:Date.now(),performanceTime:t.startTime+t.duration,url:n(t.name),initiatorType:(y=t.initiatorType,d.has(y)?y:"other"),startTime:t.startTime,durationMs:t.duration,dnsLookupMs:r,tcpConnectMs:o,tlsHandshakeMs:s,ttfbMs:a,responseDownloadMs:c,transferSize:u,encodedBodySize:l,decodedBodySize:f,nextHopProtocol:h,deliveryType:v,responseStatus:m};var y}function m(){}const y=2e3;function g(t){return!!t&&t.nodeType===Node.TEXT_NODE}function b(t,n){return t.tagName?.toLowerCase()===n.toLowerCase()}function k(t){return!!t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function T(t){return t?t.hasAttribute("data-tri-ignore"):0}function _(t){return t?t.hasAttribute("data-tri-redact"):0}function I(t,n){return n?.includes(t.toLowerCase())??0}function S(t){try{return new URL(t).origin!==window.location.origin}catch{return 0}}function x(t,n){return t?t[n]?.enabled??0:1}function M(){const t=document.activeElement;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){const n=t.selectionStart,e=t.selectionEnd;return null==n||null==e||n===e?null:t.value.substring(n,e)}const n=window.getSelection();return!n||n.isCollapsed?null:n.toString()||null}function E(t,n){return"off"===n||T(t)||_(t)?0:1}function A(t){const n=document.activeElement;if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)return n;const e=window.getSelection();return(i=("start"===t?e?.anchorNode:e?.focusNode)??null)?g(i)?i.parentElement:i instanceof Element?i:null:null;var i}function z(){const t=window,n="__fpjs_p_l_b",e=t[n];if(function(t,n){var e;const i=null===(e=Object.getOwnPropertyDescriptor)||void 0===e?void 0:e.call(Object,t,n);(null==i?void 0:i.configurable)?delete t[n]:i&&!i.writable||(t[n]=void 0)}(t,n),"function"!=typeof(null==e?void 0:e.load))throw new Error($);return e}const D="Blocked by CSP",P="The endpoint parameter is not a valid URL";function C(t){return function(t,n){const e=document,i="securitypolicyviolation";let r;const o=n=>{const e=new URL(t,location.href),{blockedURI:i}=n;i!==e.href&&i!==e.protocol.slice(0,-1)&&i!==e.origin||(r=n,s())};e.addEventListener(i,o);const s=()=>e.removeEventListener(i,o);return Promise.resolve().then(n).then(t=>(s(),t),t=>new Promise(t=>{const n=new MessageChannel;n.port1.onmessage=()=>t(),n.port2.postMessage(null)}).then(()=>{if(s(),r)return(()=>{throw new Error(D)})();throw t}))}(t,()=>function(t){return new Promise((n,e)=>{if(function(t){if(URL.prototype)try{return new URL(t,location.href),0}catch(t){if(t instanceof Error&&"TypeError"===t.name)return 1;throw t}}(t))throw new Error(P);const i=document.createElement("script"),r=()=>{var t;return null===(t=i.parentNode)||void 0===t?void 0:t.removeChild(i)},o=document.head||document.getElementsByTagName("head")[0];i.onload=()=>{r(),n()},i.onerror=()=>{r(),e(new Error(R))},i.async=1,i.src=t,o.appendChild(i)})}(t)).then(z)}const U="API key required";var L="3.12.9";const R="Failed to load the JS script of the agent",$="9319",O={scriptUrl:"https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js"};function B(t){function n(){return globalThis.window&&globalThis.window[t]&&void 0!==globalThis.window[t]}return{get:function(e){if(!n())return null;try{const n=window[t].getItem(e)??"null";return"null"===n?null:JSON.parse(n)}catch{return null}},set:function(e,i){n()&&a(()=>window[t].setItem(e,JSON.stringify(i)))},remove:function(e){n()&&a(()=>window[t].removeItem(e))},key:function(e){return n()?window[t].key(e):null},get length(){return n()?window[t].length:0}}}const j=B("localStorage"),q=B("sessionStorage"),F="__tri_fingerprint";let H=null,N=null;async function Z(t){try{const n=await function(t){return H||(H=function(t){var n,e;const{picked:i,rest:r}=function(t,n){const e={},i={};for(const[r,o]of Object.entries(t))n.includes(r)?e[r]=o:i[r]=o;return{picked:e,rest:i}}(t,["scriptUrlPattern","token","apiKey"]),o=null!==(n=i.apiKey)&&void 0!==n?n:i.token,s=null!==(e=function(t,n){return function(t,n){return Object.prototype.hasOwnProperty.call(t,n)}(t,n)?t[n]:void 0}(t,"scriptUrlPattern"))&&void 0!==e?e:O.scriptUrl,[a,c]=function(){const t=[],n=()=>{t.push({time:new Date,state:document.visibilityState})},e=((i=document).addEventListener("visibilitychange",r=n,o),()=>i.removeEventListener("visibilitychange",r,o));var i,r,o;return n(),[t,e]}();return Promise.resolve().then(()=>{if(!o||"string"!=typeof o)throw new Error(U);return function(t,n){const e=[],[i,r]=function(t){const n=function(t){const n=[...t];return{current:()=>n[0],postpone(){const t=n.shift();void 0!==t&&n.push(t)},exclude(){n.shift()}}}(t),e=function(){let t=0;return()=>Math.random()*Math.min(3e3,100*Math.pow(2,t++))}(),i=new Set;return[n.current(),(t,r)=>{let o;const s=r instanceof Error?r.message:"";if(s===D||s===P)n.exclude(),o=0;else if(s===$)n.exclude();else if(s===R){const e=Date.now()-t.getTime()<50,r=n.current();r&&e&&!i.has(r)&&(i.add(r),o=0),n.postpone()}else n.postpone();const a=n.current();return void 0===a?void 0:[a,null!=o?o:t.getTime()+e()-Date.now()]}]}(t);let o;if(void 0===i)return Promise.reject(new TypeError("The list of script URL patterns is empty"));const s=t=>{const i=new Date,a=n=>e.push({url:t,startedAt:i,finishedAt:new Date,error:n}),c=n(t);return c.then(()=>a(),a),c.catch(t=>{if(null!=o||(o=t),e.length>=5)throw o;const n=r(i,t);if(!n)throw o;const[a,c]=n;return(u=c,new Promise(t=>setTimeout(t,u))).then(()=>s(a));var u})};return s(i).then(t=>[t,e])}(function(t,n){return(Array.isArray(t)?t:[t]).map(t=>function(t,n){const e=encodeURIComponent;return t.replace(/<[^<>]+>/g,t=>"<version>"===t?"3":"<apiKey>"===t?e(n):"<loaderVersion>"===t?e(L):t)}(String(t),n))}(s,o),C)}).catch(t=>{throw c(),function(t){return t instanceof Error&&t.message===$?new Error(R):t}(t)}).then(([t,n])=>(c(),t.load({...r,ldi:{attempts:n,visibilityStates:a}})))}({apiKey:t.apiKey,region:t.region,endpoint:t.endpoint,scriptUrlPattern:t.scriptUrlPattern}).catch(t=>{throw H=null,t}),H)}(t),e=await n.get({timeout:t.timeoutMs,extendedResult:1});if(!e.visitorId)return null;const i=t.cacheTtlMs??2592e6;return i>0&&function(t,n,e){const i={visitorId:t,requestId:n,expiresAt:Date.now()+e};j.set(F,i)}(e.visitorId,e.requestId,i),{visitorId:e.visitorId,requestId:e.requestId}}catch{return null}}const X={apiKey:"5uYRiI0XM6p8k4124ELX",endpoint:"https://fingerprint.incodesmile.com",scriptUrlPattern:"https://fingerprint.incodesmile.com/web/v<version>/<apiKey>/loader_v<loaderVersion>.js"},G={focusin:"in",focusout:"out"};function K(t){return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement}const V=new Set(["Shift","Control","Alt","Meta","Backspace","Delete","Enter","Tab","CapsLock","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]),Y={mouse:"mouse",touch:"touch",pen:"pen"},J={pointerdown:"down",pointerup:"up",click:"click",dblclick:"dblclick",contextmenu:"contextmenu"};function Q(t,n,e,i,r){return{name:"navigation",timestamp:Date.now(),phase:t,type:n,from:e.from,to:e.to,timeOrigin:i,timing:r}}const W={fingerprint:{create:function(t){let n=0;return c(async()=>{const e=await async function(t){const n=function(){const t=j.get(F);return t?"string"!=typeof t.visitorId||"number"!=typeof t.expiresAt||t.expiresAt<=Date.now()?(j.remove(F),null):{visitorId:t.visitorId,requestId:"string"==typeof t.requestId?t.requestId:""}:null}();return n?{visitorId:n.visitorId,requestId:n.requestId||null}:N||(N=Z(t).finally(()=>{N=null}),N)}(X);!n&&e&&t.push({name:"fingerprint",deviceId:e.visitorId,requestId:e.requestId,timestamp:Date.now()})}),()=>{n=1}},layer:"device-fingerprinting"},pointer:{create:function(t,n,e){const o=u(n=>{const e=function(n){const e=n,i=function(t){if("mouse"===t.pointerType)return{button:t.button,buttons:t.buttons};const n={force:t.pressure,contact:Math.min(t.width,t.height)};return"pen"===t.pointerType&&(n.tiltX=t.tiltX,n.tiltY=t.tiltY,n.twist=t.twist),n}(e);return{id:e.pointerId,name:"pointer",timestamp:Date.now(),type:Y[e.pointerType]??"unknown",phase:J[n.type],isTrusted:e.isTrusted,element:t.resolveElement(e.target),isPrimary:e.isPrimary,modifiers:{shift:e.shiftKey,ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey},coordinates:{x:e.clientX,y:e.clientY},...i}}(n);t.push(e)});return x(e,"pointer")&&(i(document,"pointerdown",o),i(document,"pointerup",o)),x(e,"click")&&i(document,"click",o),x(e,"dblclick")&&i(document,"dblclick",o),x(e,"contextmenu")&&i(document,"contextmenu",o),()=>{r(document,"pointerdown",o),r(document,"pointerup",o),r(document,"click",o),r(document,"dblclick",o),r(document,"contextmenu",o)}},layer:"behavioral",events:["pointer","click","dblclick","contextmenu"]},pointermove:{create:function(t){let n=null,e=null;const o=u(e=>{const i=e;return n&&n.id!==i.pointerId&&(t.push(n),n=null),n?n.samples.ts.length>=50?(t.push(n),n=s(i),void a(t)):(n.samples.x.push(i.clientX),n.samples.y.push(i.clientY),n.samples.ts.push(i.timeStamp),"pen"===i.pointerType&&(n.samples.tiltX?.push(i.tiltX),n.samples.tiltY?.push(i.tiltY)),"mouse"!==i.pointerType&&(n.samples.force?.push(i.pressure),n.samples.radius?.push(Math.max(i.width,i.height))),void a(t)):(n=s(i),void a(t))});function s(t){const n=function(t){if("mouse"===t.pointerType)return null;const n={force:[t.pressure],radius:[Math.max(t.width,t.height)]};return"pen"===t.pointerType&&(n.tiltX=[t.tiltX],n.tiltY=[t.tiltY]),n}(t);return{name:"pointer",timestamp:Date.now(),id:t.pointerId,type:t.pointerType,phase:"move",isTrusted:t.isTrusted,isPrimary:t.isPrimary,samples:{x:[t.clientX],y:[t.clientY],ts:[t.timeStamp],...n??{}}}}function a(t){e&&clearTimeout(e),e=setTimeout(()=>{n&&(t.push(n),n=null),e=null},y)}return i(document,"pointermove",o),()=>{r(document,"pointermove",o),e&&(clearTimeout(e),e=null),n&&(t.push(n),n=null)}},layer:"behavioral"},focus:{create:function(t){const n=u(n=>{const e=function(n){const e=n;return{name:"focus",type:G[n.type]??"unknown",timestamp:Date.now(),isTrusted:e.isTrusted,element:t.resolveElement(e.target),relatedTarget:t.resolveElement(e.relatedTarget)}}(n);t.push(e)});return i(document,"focusin",n),i(document,"focusout",n),()=>{r(document,"focusin",n),r(document,"focusout",n)}},layer:"behavioral"},input:{create:function(t){const n=u(n=>{const e=n;t.push(function(n){return{name:"keystroke",type:"input",timestamp:Date.now(),isTrusted:n.isTrusted,element:t.resolveElement(n.target),inputType:n.inputType??"",isComposing:n.isComposing??0,length:(e=n.target,e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?e.value.length:0)};var e}(e)),function(t){if("insertReplacementText"===t.inputType)return 1;const n=t.target;return K(n)?function(t){try{return t.matches(":-webkit-autofill")}catch{return 0}}(n):0}(e)&&t.push(function(t,n){const e=t.target;let i=0;return K(e)&&(i=e.value.length),{name:"autofill",timestamp:Date.now(),element:n.resolveElement(e),length:i}}(e,t))});return i(document,"input",n),function(){r(document,"input",n)}},layer:"behavioral"},keystroke:{create:function(t){const{resolve:n,reset:e}=function(){let t=0;const n=new Map;return{resolve:function(e,i){if("keydown"===i){const i=n.get(e);if(void 0!==i)return i;const r=++t;if(n.size>=32){const t=n.keys().next().value;void 0!==t&&n.delete(t)}return n.set(e,r),r}const r=n.get(e);return void 0!==r?(n.delete(e),r):++t},reset:function(){n.clear()}}}(),o=u(e=>{const i=function(t){const e=t,i=t.type;return{name:"keystroke",type:i,id:n(e.code,i),timestamp:Date.now(),isTrusted:e.isTrusted,keys:V.has(e.key)?[e.key]:[]}}(e);t.push(i)}),s=u(()=>{e()});return i(document,"keydown",o),i(document,"keyup",o),i(window,"blur",s),()=>{r(document,"keydown",o),r(document,"keyup",o),r(window,"blur",s)}},layer:"behavioral"},clipboard:{create:function(t,n="on",e){const o=u(e=>{const i=function(e){const i=e,r=e.type,o=("paste"===e.type?i.clipboardData?.getData("text/plain"):M())??null,s=E(i.target,n);return{name:"clipboard",type:r,timestamp:Date.now(),isTrusted:i.isTrusted,element:t.resolveElement(i.target),length:o?.length??0,...s&&o?{content:o}:{}}}(e);t.push(i)});return x(e,"paste")&&i(document,"paste",o),x(e,"cut")&&i(document,"cut",o),x(e,"copy")&&i(document,"copy",o),()=>{r(document,"paste",o),r(document,"cut",o),r(document,"copy",o)}},layer:"behavioral",events:["paste","cut","copy"]},form:{create:function(t,n,e){const o=u(n=>{const e={name:"form",type:(i=n).type,timestamp:Date.now(),isTrusted:i.isTrusted,element:t.resolveElement(i.target)};var i;t.push(e)});return x(e,"submit")&&i(document,"submit",o),x(e,"invalid")&&i(document,"invalid",o),()=>{r(document,"submit",o),r(document,"invalid",o)}},layer:"behavioral",events:["submit","invalid"]},change:{create:function(t){const n=u(n=>{const e=(i=n,{name:"change",timestamp:Date.now(),isTrusted:i.isTrusted,element:t.resolveElement(i.target)});var i;t.push(e)});return i(document,"change",n),()=>{r(document,"change",n)}},layer:"behavioral"},selection:{create:function(t,n){let e=0,o=0,s=null,a=0,c=0;function l(){s&&(clearTimeout(s),s=null)}function f(){l(),a||c||(s=setTimeout(()=>{s=null,e&&h("timeout")},250))}function h(i){e&&(e=0,l(),function(e){const i=A("end"),r=i&&E(i,n),o=M();t.push({name:"selection",phase:"end",timestamp:Date.now(),trigger:e,isTrusted:1,element:t.resolveElement(i),length:o?.length??0,...r&&o?{content:o}:{}})}(i))}const d=u(()=>{const n=function(){const t=document.getSelection();return!t||t.isCollapsed||0===t.rangeCount}();if(!e&&!n)return e=1,o=Date.now(),t.push({name:"selection",phase:"start",timestamp:o,element:t.resolveElement(A("start"))}),void f();e&&n?h("collapse"):e&&f()}),v=u(t=>{0===t.button&&(a=1,l())}),p=u(t=>{0===t.button&&(a=0,e&&h("pointer"))}),w=u(t=>{"Shift"===t.key&&(c=1,l())}),m=u(t=>{"Shift"===t.key&&(c=0,e&&h("keyboard"))}),y=u(()=>{a=0}),g=u(()=>{"hidden"===document.visibilityState&&(a=0,c=0,e&&h("timeout"))}),b=u(()=>{a=0,e&&h("pointer")});return i(document,"selectionchange",d),i(document,"pointerdown",v),i(document,"pointerup",p),i(document,"keydown",w),i(document,"keyup",m),i(document,"contextmenu",y),i(document,"visibilitychange",g),i(document,"dragend",b),()=>{l(),r(document,"selectionchange",d),r(document,"pointerdown",v),r(document,"pointerup",p),r(document,"keydown",w),r(document,"keyup",m),r(document,"contextmenu",y),r(document,"visibilitychange",g),r(document,"dragend",b)}},layer:"behavioral"},tab:{create:()=>()=>{},layer:"session",events:["state","count"]},visibility:{create:function(t){const n=u(n=>{const e=document.visibilityState;if("visible"!==e&&"hidden"!==e)return;const i={name:"visibility",type:e,timestamp:Date.now(),isTrusted:n.isTrusted};t.push(i)});return i(document,"visibilitychange",n),()=>{r(document,"visibilitychange",n)}},layer:"session"},navigation:{create:function(t){let n=t.sanitizeUrl(document.referrer||"");function e(e){t.push(e),n=e.to??""}const o=u(()=>{const[n]=performance.getEntriesByType("navigation");var i;e(Q("load",n?.type??"navigate",{from:document.referrer?t.sanitizeUrl(document.referrer):null,to:t.sanitizeUrl(location.href)},performance.timeOrigin,n?{fetchStart:(i=n).fetchStart,domainLookupStart:i.domainLookupStart,domainLookupEnd:i.domainLookupEnd,connectStart:i.connectStart,connectEnd:i.connectEnd,requestStart:i.requestStart,responseStart:i.responseStart,responseEnd:i.responseEnd,domInteractive:i.domInteractive,domContentLoadedEventStart:i.domContentLoadedEventStart,domContentLoadedEventEnd:i.domContentLoadedEventEnd,domComplete:i.domComplete,loadEventStart:i.loadEventStart,loadEventEnd:i.loadEventEnd,redirectCount:i.redirectCount,transferSize:i.transferSize,encodedBodySize:i.encodedBodySize,decodedBodySize:i.decodedBodySize}:void 0))}),s=u(i=>{const r=i;if(null===r.navigationType)return;const o=t.sanitizeUrl(location.href);o!==n&&e(Q("change",r.navigationType,{from:n,to:o},performance.timeOrigin))}),c=u(()=>f("traverse")),l=u(()=>f("hashchange"));function f(i){const r=t.sanitizeUrl(location.href);"hashchange"===i&&r===n||e(Q("change",i,{from:n,to:r},performance.timeOrigin))}const h=history.pushState,d=history.replaceState,v=function(...t){const n=h.apply(this,t);return a(()=>f("push")),n},p=function(...t){const n=d.apply(this,t);return a(()=>f("replace")),n};return window.navigation?i(window.navigation,"currententrychange",s):(history.pushState=v,history.replaceState=p,i(window,"popstate",c),i(window,"hashchange",l)),"complete"===document.readyState?o(new Event("load")):i(window,"load",o),()=>{window.navigation?r(window.navigation,"currententrychange",s):(history.pushState===v&&(history.pushState=h),history.replaceState===p&&(history.replaceState=d),r(window,"popstate",c),r(window,"hashchange",l)),r(window,"load",o)}},layer:"session"},networkconnection:{create:function(t){const n=u(()=>{const n={name:"network",type:"connection",state:navigator.onLine?"online":"offline",timestamp:Date.now()};t.push(n)});return i(window,"online",n),i(window,"offline",n),()=>{r(window,"online",n),r(window,"offline",n)}},layer:"session"},scroll:{create:function(t){let n=null,e=null;const o=u(e=>n?n.samples.ts.length>=50?(t.push(n),n=s(e),void a(t)):(n.samples.x.push(window.scrollX),n.samples.y.push(window.scrollY),n.samples.ts.push(e.timeStamp),void a(t)):(n=s(e),void a(t)));function s(t){return{name:"scroll",timestamp:Date.now(),samples:{x:[window.scrollX],y:[window.scrollY],ts:[t.timeStamp]},height:window.innerHeight,width:window.innerWidth,scrollX:window.scrollX,scrollY:window.scrollY,pageX:window.pageXOffset,pageY:window.pageYOffset}}function a(t){e&&clearTimeout(e),e=setTimeout(()=>{n&&(t.push(n),n=null),e=null},y)}return i(window,"scroll",o),()=>{r(window,"scroll",o),e&&(clearTimeout(e),e=null),n&&(t.push(n),n=null)}},layer:"behavioral"},viewportresize:{create:function(t){let n=null,e=null;const o=u(e=>n?n.samples.ts.length>=50?(t.push(n),n=s(e),void a(t)):(n.samples.height.push(window.innerHeight),n.samples.width.push(window.innerWidth),n.samples.ts.push(e.timeStamp),n.samples.scrollX.push(window.scrollX),n.samples.scrollY.push(window.scrollY),n.samples.dpr.push(window.devicePixelRatio),void a(t)):(n=s(e),void a(t)));function s(t){return{name:"viewport",type:"resize",timestamp:Date.now(),samples:{height:[window.innerHeight],width:[window.innerWidth],ts:[t.timeStamp],scrollX:[window.scrollX],scrollY:[window.scrollY],dpr:[window.devicePixelRatio]}}}function a(t){e&&clearTimeout(e),e=setTimeout(()=>{n&&(t.push(n),n=null),e=null},y)}return i(window,"resize",o),()=>{r(window,"resize",o),e&&(clearTimeout(e),e=null),n&&(t.push(n),n=null)}},layer:"behavioral"},viewport:{create:function(t,n,e){const o=u(n=>{const e=a(n,"orientation");t.push(e)}),s=u(n=>{const e=a(n,"ratiochange");t.push(e)});function a(t,n){return{name:"viewport",type:n,timestamp:Date.now(),isTrusted:t.isTrusted,height:window.innerHeight,width:window.innerWidth,scrollX:window.scrollX,scrollY:window.scrollY,dpr:window.devicePixelRatio}}return x(e,"orientationchange")&&i(window,"orientationchange",o),x(e,"devicepixelratiochange")&&i(window,"devicepixelratiochange",s),()=>{r(window,"orientationchange",o),r(window,"devicepixelratiochange",s)}},layer:"behavioral",events:["orientationchange","devicepixelratiochange"]},sensors:{create:function(t,n,e){let o=null,s=null,a=null,c=null,f=0;function d(){c&&h(c),c=setTimeout(l(()=>{v(),c=null}),y)}function v(){o&&(t.push(o),o=null),s&&(t.push(s),s=null),a&&(t.push(a),a=null)}const p=u(n=>{const e=n,i=e.timeStamp,r=e.acceleration,s=e.accelerationIncludingGravity,a=e.rotationRate;if(!r&&!s&&!a||null===r?.x&&null===r?.y&&null===r?.z&&null===s?.x&&null===s?.y&&null===s?.z&&null===a?.alpha&&null===a?.beta&&null===a?.gamma)return;if(!o)return o={name:"sensors",type:"motion",timestamp:Date.now(),interval:e.interval??null,samples:{ax:[r?.x??0],ay:[r?.y??0],az:[r?.z??0],agx:[s?.x??0],agy:[s?.y??0],agz:[s?.z??0],rrAlpha:[a?.alpha??0],rrBeta:[a?.beta??0],rrGamma:[a?.gamma??0],ts:[i]}},void d();if(o.samples.ts.length>=50)return t.push(o),o={name:"sensors",type:"motion",timestamp:Date.now(),interval:e.interval??null,samples:{ax:[r?.x??0],ay:[r?.y??0],az:[r?.z??0],agx:[s?.x??0],agy:[s?.y??0],agz:[s?.z??0],rrAlpha:[a?.alpha??0],rrBeta:[a?.beta??0],rrGamma:[a?.gamma??0],ts:[i]}},void d();const c=o.samples;c.ax.push(r?.x??0),c.ay.push(r?.y??0),c.az.push(r?.z??0),c.agx.push(s?.x??0),c.agy.push(s?.y??0),c.agz.push(s?.z??0),c.rrAlpha.push(a?.alpha??0),c.rrBeta.push(a?.beta??0),c.rrGamma.push(a?.gamma??0),c.ts.push(i),d()}),w=u(n=>{const e=n;if(null==e.alpha&&null==e.beta&&null==e.gamma)return;const i=e.timeStamp,r=e.webkitCompassHeading??0;if(!s)return s={name:"sensors",type:"orientation",timestamp:Date.now(),absolute:f||e.absolute,samples:{alpha:[e.alpha??0],beta:[e.beta??0],gamma:[e.gamma??0],compassHeading:[r],ts:[i]}},void d();if(s.samples.ts.length>=50)return t.push(s),s={name:"sensors",type:"orientation",timestamp:Date.now(),absolute:f||e.absolute,samples:{alpha:[e.alpha??0],beta:[e.beta??0],gamma:[e.gamma??0],compassHeading:[r],ts:[i]}},void d();const o=s.samples;o.alpha.push(e.alpha??0),o.beta.push(e.beta??0),o.gamma.push(e.gamma??0),o.compassHeading.push(r),o.ts.push(i),d()}),m=u(n=>{const e=n.value;if(null==e)return;const i=n.timeStamp;return a?a.samples.ts.length>=50?(t.push(a),a={name:"sensors",type:"light",timestamp:Date.now(),samples:{lux:[e],ts:[i]}},void d()):(a.samples.lux.push(e),a.samples.ts.push(i),void d()):(a={name:"sensors",type:"light",timestamp:Date.now(),samples:{lux:[e],ts:[i]}},void d())});return x(e,"motion")&&i(window,"devicemotion",p),x(e,"orientation")&&("ondeviceorientationabsolute"in window?(f=1,i(window,"deviceorientationabsolute",w)):i(window,"deviceorientation",w)),x(e,"light")&&i(window,"devicelight",m),function(){r(window,"devicemotion",p),r(window,f?"deviceorientationabsolute":"deviceorientation",w),r(window,"devicelight",m),c&&(h(c),c=null),v()}},layer:"behavioral",events:["motion","orientation","light"]},"network-request":{create:function(t){var n;const i=function(t,n,i,r=v){if("undefined"==typeof PerformanceObserver)return m;let o=null;try{o=new PerformanceObserver(e=>{for(const o of e.getEntries()){const e=o;r.has(e.initiatorType)&&(n(e.name)||t(w(e,i)))}}),o.observe({type:"resource",buffered:1})}catch{return e.warn("network-request","PerformanceObserver failed to start"),m}return function(){o?.disconnect(),o=null}}(function(n){a(()=>t.push(n))},(n=t.ignoredOrigins,function(t){try{return n.has(new URL(t).origin)}catch{return 0}}),t.sanitizeUrl);return function(){i()}},layer:"session"},screen:{create:function(t){const n=a(()=>function(){const t=window.screen;return{name:"screen",timestamp:Date.now(),availWidth:t.availWidth,availHeight:t.availHeight,width:t.width,height:t.height,colorDepth:t.colorDepth,pixelDepth:t.pixelDepth,availLeft:t.availLeft??0,availTop:t.availTop??0,orientation:t.orientation?{type:t.orientation.type,angle:t.orientation.angle}:null,isExtended:t.isExtended??0,viewport:{height:window.innerHeight,width:window.innerWidth,scrollX:window.scrollX,scrollY:window.scrollY,dpr:window.devicePixelRatio}}}());return n&&t.push(n),()=>{}},layer:"session"}},tt=Object.keys(W),nt=[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,/^0b[01]+$/i,/^0o[0-7]+$/i,/^0x[0-9a-f]+$/i,/^[a-z][a-z0-9]{1,12}:[A-Za-z0-9+/=_-]{6,}$/i,/^[a-z]{2,8}_(?=.*\d)[A-Za-z0-9]{3,}$/,/^\d{4,}$/,/@/,/^[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{10,}$/,/^[A-Za-z0-9_-]{20,}={0,2}$/,/^[0-9a-f]{7,}$/i];function et(t){try{const n=new URL(t,location.href);n.username="",n.password="",n.hash="";const e=[...n.searchParams.keys()],i=e.length>0?"?"+e.map(t=>`${encodeURIComponent(t)}=<redacted>`).join("&"):"";n.search="",n.pathname=n.pathname.split("/").map(t=>""!==t&&function(t){for(const n of nt)if(n.test(t))return 1;return 0}(t)?":param":t).join("/");const r=n.origin+n.pathname+i;return r.length>2048?r.slice(0,2048):r}catch{return""}}const it={flush:{intervalMs:2e3,maxIntervalMs:3e4,size:50,backoffFailureThreshold:2},queue:{size:100}};function rt(){const t={};for(const n of tt)t[n]=at(n,void 0,1);return t}function ot(t){const n={};for(const e of tt)n[e]=at(e,void 0,t[W[e].layer]??0);return n}function st(t){const n={};for(const e of tt){const i=t[e];n[e]=at(e,i,i?.enabled??0)}return n}function at(t,n,e){const i=W[t]?.events??[];if(0===i.length)return{enabled:e};const r=n?.events,o={};for(const t of i)o[t]={enabled:r?.[t]??1};return{enabled:e,events:o}}function ct(t){if(!t)return null;const n=t.split(".")[1],e=atob(n.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(e)}const ut=function(t,n=30){if(!t)return 1;const e=ct(t);return e&&"number"==typeof e.exp?1e3*e.exp<=Date.now()+1e3*n:1};async function lt(t,n){return globalThis.navigator&&"locks"in globalThis.navigator&&"request"in globalThis.navigator.locks&&"query"in globalThis.navigator.locks?navigator.locks.request(t,{mode:"exclusive"},async()=>c(n)):c(n)}const ft="__tri",ht=`${ft}_activity_token`,dt=`${ft}_activity_id`,vt=`${ft}_activity_status`,pt="__tri_activity_lock";class wt{constructor(t){this.context=t,this.M=null,this.A=null,this.D=null,this.P=null,this.C=0}getToken(){return this.M}getActivityId(){return this.A??""}isActive(){return"ACTIVE"===this.D&&null!==this.M}async start(){return this.C=1,this.P||(this.P=this.U()),this.P}async stop(){this.C=0,this.L(null),this.P=null,this.M&&await this.context.stopActivity(),this.R(null)}async refresh(){if(!this.C)return;const t=this.M;await lt(pt,async()=>{if(this.M&&this.M!==t&&!ut(this.M)&&"ACTIVE"===this.D)return;const n=this.$();n&&n.token!==t&&!ut(n.token)&&"ACTIVE"===n.activityStatus?this.R(n):(this.O(),await this.B())})}async U(){try{if(this.M&&!ut(this.M))return;await lt(pt,async()=>{await this.B()})}finally{this.P=null}}async B(){const t=this.$();if(t&&!ut(t.token)&&"ACTIVE"===t.activityStatus)return void this.R(t);t&&this.O();const n=await this.context.startActivity();if(!n.ok)return;if(!n.data.token)return;const e=n.data;this.R(e),this.j(e)}$(){const[t,n,e]=[j.get(ht),j.get(dt),j.get(vt)];return t&&n&&e?{token:t,activityId:n,activityStatus:e}:((t||n||e)&&this.O(),null)}j(t){j.set(ht,t.token),j.set(dt,t.activityId),j.set(vt,t.activityStatus)}O(){this.L(null),this.R(null)}L(t){if(!t)return j.remove(ht),j.remove(dt),void j.remove(vt);j.set(ht,t.token),j.set(dt,t.activityId),j.set(vt,t.activityStatus)}R(t){if(!t)return this.M=null,this.A=null,void(this.D=null);this.M=t.token,this.A=t.activityId,this.D=t.activityStatus}}const mt=[401,403,409],yt=Object.freeze({tab:80,navigation:80,visibility:80,network:80,screen:80,fingerprint:80,pointer:60,keystroke:60,autofill:60,change:60,form:60,clipboard:60,selection:60,focus:60,viewport:60,network_request:60,scroll:40,sensors:40});function gt(t){return"pointer"===t.name&&"move"===t.phase||"viewport"===t.name&&"resize"===t.type?40:yt[t.name]}const bt=new Array(256);for(let t=0;t<256;t++)bt[t]=(t+256).toString(16).slice(1);const kt=new Uint8Array(16);function Tt(t){return bt[t[0]]+bt[t[1]]+bt[t[2]]+bt[t[3]]+"-"+bt[t[4]]+bt[t[5]]+"-"+bt[t[6]]+bt[t[7]]+"-"+bt[t[8]]+bt[t[9]]+"-"+bt[t[10]]+bt[t[11]]+bt[t[12]]+bt[t[13]]+bt[t[14]]+bt[t[15]]}function _t(){return crypto.randomUUID()}function It(){return crypto.getRandomValues(kt),kt[6]=15&kt[6]|64,kt[8]=63&kt[8]|128,Tt(kt)}function St(){for(let t=0;t<16;t++)kt[t]=256*Math.random()|0;return kt[6]=15&kt[6]|64,kt[8]=63&kt[8]|128,Tt(kt)}const xt=function(){if("undefined"!=typeof crypto){if("function"==typeof crypto.randomUUID)return _t;if("function"==typeof crypto.getRandomValues)return It}return St}();function Mt(){return xt()}class Et{constructor(t,n){this.q=t,this.F=n,this.H=[],this.N=null,this.X=[],this.K=null,this.C=0,this.V=1,this.Y=0,this.J=0,this.W=t.flush.intervalMs}push(t){if(this.C){if(this.H.length<this.tt()?this.H.push(t):this.nt(t),this.V)return this.H.length>=this.q.flush.size?(h(this.N),this.N=null,void this.flush("capacity")):void this.et()}else e.warn("Transport","push() called before start() — event dropped")}flush(t){if(this.C&&this.F.isActivityActive())try{if("lifecycle"===t)return void this.it();if(0===this.H.length)return;const n=this.rt(t);this.F.ingest(n,0).then(t=>this.ot(t,n)).catch(()=>{e.warn("Transport","ingest threw unexpectedly — batch dropped")}),this.H.length>0&&this.et()}catch(t){e.warn("Transport","flush() threw unexpectedly:",t)}}start(){this.C||(this.C=1,this.V="undefined"!=typeof navigator?navigator.onLine:1)}stop(){if(!this.C)return Promise.resolve();h(this.N),this.N=null,h(this.K),this.K=null;const t=this.it();return this.C=0,t}onConnectionChange(){const t="undefined"!=typeof navigator?navigator.onLine:1;if(t!==this.V){if(this.V=t,!this.V)return h(this.N),this.N=null,h(this.K),void(this.K=null);this.H.length>0&&this.et(),this.X.length>0&&this.st()}}et(){this.C&&this.V&&null===this.N&&(this.N=f(()=>{this.N=null,this.flush("interval")},this.W))}st(){this.C&&this.V&&null===this.K&&(this.K=f(()=>{this.K=null,this.ct()},this.W))}ct(){if(!this.C||!this.V||0===this.X.length||!this.F.isActivityActive())return;const t=this.X.shift();this.F.ingest(t.batch,0).then(n=>this.ut(n,t)).catch(()=>{e.warn("Transport","retry drain ingest threw unexpectedly — batch dropped"),this.X.length>0&&this.st()})}lt(t,n){this.X.length>=5&&(this.X.shift(),e.warn("Transport","retry queue full — oldest batch evicted")),this.X.push({batch:t,attempts:n}),this.st()}ot(t,n){t.ok?this.ft():this.ht(t)&&this.lt(n,1)}ut(t,n){if(t.ok)return this.ft(),void(this.X.length>0&&this.st());if(this.ht(t)){if(n.attempts>=3)return this.dt(),e.warn("Transport","batch dropped after MAX_RETRY_ATTEMPTS",n.batch.batchId),void(this.X.length>0&&this.st());this.dt(),this.lt(n.batch,n.attempts+1)}else this.X.length>0&&this.st()}dt(){this.Y++,this.Y%this.q.flush.backoffFailureThreshold===0&&(this.W=Math.min(2*this.W,this.q.flush.maxIntervalMs))}ft(){this.Y=0,this.W=this.q.flush.intervalMs}tt(){return this.q.queue.size*(this.V?1:2)}async it(){if(!this.F.isActivityActive())return Promise.resolve();const t=[];for(const n of this.X)t.push(this.F.ingest(n.batch,1).catch(()=>{e.warn("Transport","lifecycle retry ingest threw — batch dropped")}));if(this.X=[],this.H.length>0){const n=this.rt("lifecycle");t.push(this.F.ingest(n,1).catch(()=>{e.warn("Transport","lifecycle ingest threw — batch dropped")}))}return Promise.allSettled(t).then(()=>{})}nt(t){const n=gt(t);for(let e=0;e<this.H.length;e++)if(gt(this.H[e])<n){for(let t=e;t<this.H.length-1;t++)this.H[t]=this.H[t+1];return this.H.length-=1,void this.H.push(t)}}rt(t){const n="lifecycle"===t?this.H.splice(-this.q.flush.size):this.H.splice(0,this.q.flush.size);return{activityId:"",batchId:Mt(),batchSequence:this.J++,clientTimestamp:Date.now(),schemaVersion:"0.1.0",sdkVersion:"0.4.0-rc.0",sdkPlatform:"web",tabId:this.F.getTabId(),events:n}}ht(t){if(t.ok)return 0;switch(t.kind){case"timeout":case"server":case"rate_limited":return 1;default:return 0}}}const At="tri:bcast:";const zt="function"==typeof BroadcastChannel?BroadcastChannel:function(){if("undefined"==typeof Storage||"undefined"==typeof window)return 0;try{const t="__tri_bcast_probe__";localStorage.setItem(t,"1");const n="1"===localStorage.getItem(t);return localStorage.removeItem(t),n}catch{return 0}}()?class{constructor(t){this.seq=0,this.closed=0,this.listeners=new Set,this.onStorageEvent=t=>{if(this.closed)return;if(!t.key||!t.key.startsWith(`${At}${this.channelName}:`))return;if(null===t.newValue)return;let n;a(()=>j.remove(t.key));try{n=JSON.parse(t.newValue)}catch{return}const e={data:n};for(const t of this.listeners)a(()=>t(e))},this.channelName=t,this.senderId=Mt(),window.addEventListener("storage",this.onStorageEvent)}postMessage(t){if(this.closed)return;const n=`${At}${this.channelName}:${this.senderId}:${this.seq++}`;a(()=>{j.set(n,t),j.remove(n)})}addEventListener(t,n){this.listeners.add(n)}removeEventListener(t,n){this.listeners.delete(n)}close(){this.closed||(this.closed=1,window.removeEventListener("storage",this.onStorageEvent),this.listeners.clear())}}:class{constructor(t){e.warn("BroadcastChannel","BroadcastChannel is unavailable and localStorage is not writable in this context. Cross-tab discovery is disabled; tab count will always be reported as 1.")}postMessage(t){}addEventListener(t,n){}removeEventListener(t,n){}close(){}},Dt="__tri_tabId";class Pt{constructor(t){this.context=t,this.vt="",this.C=0,this.wt=null,this.yt=null,this.gt=null,this.bt=new Map,this.kt=-1,this.Tt=null}async start(){this.C||(this.C=1,this.vt=this._t(),this.It(),this.St({type:"hello",tabId:this.vt,ts:Date.now()}),this.xt(),this.Mt("active"),this.Et())}stop(){this.C&&(this.C=0,this.Mt("inactive"),this.St({type:"bye",tabId:this.vt,ts:Date.now()}),this.At(this.zt()),this.Dt(),this.Pt(),this.Ct())}getTabId(){return this.vt}queryTabsNumber(){return this.bt.size+1}It(){try{this.wt=new zt("__tri_tab_channel"),this.Tt=this.Ut.bind(this),this.wt.addEventListener("message",this.Tt)}catch(t){e.warn("TabManager","failed to open broadcast channel:",t)}}Ct(){try{if(!this.wt)return;this.Tt&&this.wt.removeEventListener("message",this.Tt),this.wt.close()}catch{}finally{this.wt=null,this.Tt=null}}xt(){this.yt=setInterval(()=>{const t=Date.now();this.St({type:"heartbeat",tabId:this.vt,ts:t})},1e3)}Dt(){null!=this.yt&&(clearInterval(this.yt),this.yt=null)}Et(){null!=this.gt&&clearTimeout(this.gt),this.gt=setTimeout(()=>{this.gt=null;const t=this.zt()+1;t!==this.kt&&(this.kt=t,this.At(t))},1e3)}Pt(){null!=this.gt&&(clearTimeout(this.gt),this.gt=null)}St(t){try{if(!this.wt)return;this.wt.postMessage(t)}catch{e.warn("TabManager","failed to broadcast message:",t)}}Ut(t){const{type:n,tabId:e}=t.data;if(e===this.vt)return;const i=Date.now();"hello"===n?(this.St({type:"ack",tabId:this.vt,ts:i,to:e}),this.bt.set(e,i)):"heartbeat"===n||"ack"===n?this.bt.set(e,i):"bye"===n&&this.bt.delete(e)}At(t){this.context.events.count&&this.context.push({name:"tab",type:"count",tabId:this.vt,timestamp:Date.now(),value:t})}Mt(t){this.context.events.state&&this.context.push({name:"tab",type:"state",tabId:this.vt,timestamp:Date.now(),value:t})}_t(){const t=q.get(Dt);if(t)return t;const n=Mt();return q.set(Dt,n),n}zt(t=Date.now()){let n=0;for(const[e,i]of this.bt.entries())t-i>=3e3?this.bt.delete(e):n++;return n}}const Ct=globalThis.CompressionStream,Ut=globalThis.Response,Lt=globalThis.Blob,Rt=new TextEncoder;let $t=null;async function Ot(t){const n=await async function(t){if("function"!=typeof Ct)return null;try{const n=Rt.encode(t),e=new Lt([n]).stream().pipeThrough(new Ct("gzip"));return await new Ut(e).arrayBuffer()}catch(t){return e.warn("compression","Native gzip failed:",t),null}}(t);return null!==n?n:async function(t){try{const n=await function(){if(null===$t){const t=function(t,n=1e4){let i=null;const r=new Promise(t=>{i=f(()=>{e.warn("import",`Import timed out after ${n}ms`),t(null)},n)}),o=Promise.resolve().then(t).catch(t=>(e.warn("import","Import failed:",t),null));return Promise.race([o,r]).finally(()=>{h(i)})}(()=>Promise.resolve().then(function(){return Ti}),1e4);$t=t,t.then(n=>{null===n&&f(()=>{$t===t&&($t=null)},1e4)})}return $t}();if(null===n)return null;const{gzipSync:i}=n,r=i(Rt.encode(t));return r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}catch(t){return e.warn("compression","fflate gzip failed:",t),null}}(t)}function Bt(t){const n={Accept:"application/json"};return t?.hasBody&&("json"===t.contentType?n["Content-Type"]="application/json":"ndjson"===t.contentType&&(n["Content-Type"]="application/x-ndjson"),"gzip"===t.contentEncoding&&(n["Content-Encoding"]="gzip")),t?.token&&(n.Authorization=`Bearer ${t.token}`),t?.profileId&&(n["x-profile-id"]=t.profileId),t?.api?.version&&(n["x-api-version"]=t.api.version),t?.customHeaders&&Object.entries(t.customHeaders).forEach(([t,e])=>{n[t]=e}),n}const jt="function"==typeof globalThis.fetch?globalThis.fetch.bind(globalThis):void 0;class qt{constructor(t){this.context=t}stop(){}async report(t,n){const i={name:t,metadata:n,timestamp:Date.now(),activityId:this.context.getActivityId()??""};try{const r=await this.context.reportEvent(i);if(r.ok)return r;e.warn("EventReport","Failed to report event:",t,n,"with result:",r)}catch(i){e.warn("EventReport","Failed to report event:",t,n,"with error:",i)}}}const Ft=new Set(["A","BUTTON","INPUT","SELECT","TEXTAREA","SUMMARY","DETAILS","LABEL","OPTION","FIELDSET"]),Ht=new Set(["button","link","tab","menuitem","menuitemcheckbox","menuitemradio","checkbox","radio","switch","slider","spinbutton","combobox","listbox","option","searchbox","textbox","treeitem"]),Nt=255;function Zt(t,n,e){const i=t.tagName.toLowerCase(),r=function(t){const n=t.parentElement?.children??[],e=Math.min(n.length,1e3);let i=e-1,r=0,o=0;for(let i=0;i<e;i++){o++;const e=n[i];if(b(e,t.tagName)&&r++,e===t)break}return{siblings:i,ofType:r,child:o}}(t),o=function(t,n){const e=function(t){if(!t)return null;const n=t.getAttribute("data-tri-redact-attrs");return n?n.split(",").map(t=>t.trim().toLowerCase()):null}(t),i={},r=t.id;r&&!I("id",e)&&(i.id=r);const o=t.getAttribute("autocomplete");o&&!I("autocomplete",e)&&(i.autocomplete=o);const s=t.getAttribute("aria-invalid");s&&!I("aria-invalid",e)&&(i.ariaInvalid=s);const a=t.getAttribute("tabindex");a&&!I("tabindex",e)&&(i.tabIndex=parseInt(a,10));const c=function(t){return t.getAttribute("data-testid")??t.getAttribute("data-cy")??null}(t);c&&!I("data-testid",e)&&(i.testId=c);const u=t.hasAttribute("readonly");u&&!I("readonly",e)&&(i.readOnly=u);const l=t.hasAttribute("required");l&&!I("required",e)&&(i.required=l);const f=t.getAttribute("contenteditable");f&&!I("contenteditable",e)&&(i.contentEditable="true"===f||""===f);const h=t.getAttribute("href");h&&!I("href",e)&&(i.href={...n?{}:{url:h},external:S(h)});const d=t.getAttribute("role");d&&!I("role",e)&&(i.role=d);const v=t.getAttribute("type");v&&!I("type",e)&&(i.type=v);const p=t.getAttribute("name");p&&!I("name",e)&&(i.name=p);const w=t.getAttribute("placeholder");!w||n||I("placeholder",e)||(i.placeholder=w);const m=Array.from(t.classList).slice(0,5);m.length>0&&!I("class",e)&&(i.classes=m);const y=t.getAttribute("alt");return!y||n||I("alt",e)||(i.alt=y),Object.keys(i).length?i:null}(t,n);return{tagName:i,frame:e,...o?{attributes:o}:{},...r?{nth:r}:{}}}function Xt(t,n){let e=0;const i=[];return function(t){return Ft.has(t.tagName)}(t)&&(e+=40,i.push("native")),function(t){return t.hasAttribute("data-tri-interactive")}(t)&&(e+=40,i.push("tri-interactive")),function(t){return b(t,"a")&&t.hasAttribute("href")}(t)&&(e+=15,i.push("has-href")),function(t){const n=t.getAttribute("role");return null!==n&&Ht.has(n)}(t)&&(e+=30,i.push("role")),function(t){return t.hasAttribute("onclick")||t.hasAttribute("ng-click")||t.hasAttribute("data-action")||t.hasAttribute("@click")}(t)&&(e+=20,i.push("click-handler")),function(t){const n=t.getAttribute("tabindex");if(null===n)return 0;const e=parseInt(n,10);return null!==e&&e>=0}(t)&&(e+=10,i.push("tabindex")),(t.id||t.getAttribute("data-testid"))&&(e+=5,i.push("has-id")),n>0&&(e+=Math.round(15/n),i.push("depth")),{score:e,reasons:i}}function Gt(t){return t>=20}function Kt(t){return null!==t&&t.width>0&&t.height>0&&t.y<window.innerHeight&&t.y+t.height>0&&t.x<window.innerWidth&&t.x+t.width>0}function Vt(t){return 1==t.disabled||"true"===t.getAttribute("aria-disabled")}function Yt(t,n=0){if(n)return null;const e=Qt(t,"labelledby");if(e)return{text:tn(e),resolutionMethod:"aria-labelledby",confidence:"high"};const i=Wt(t);if(i)return{text:tn(i),resolutionMethod:"aria-label",confidence:"high"};const r=function(t){if(!t.id)return null;const n=document.querySelector(`label[for="${CSS.escape(t.id)}"]`);return n?Jt(n):null}(t);if(r)return{text:tn(r),resolutionMethod:"html-for",confidence:"high"};const o=function(t){const n=t.closest("label");return n?Jt(n):null}(t);if(o)return{text:tn(o),resolutionMethod:"wrapping-label",confidence:"high"};const s=function(t){const n=t.getAttribute("placeholder");return n?.trim()??null}(t);if(s)return{text:tn(s),resolutionMethod:"placeholder",confidence:"low"};const a=function(t){const n=t.getAttribute("title");return n?.trim()??null}(t);if(a)return{text:tn(a),resolutionMethod:"title",confidence:"low"};const c=Qt(t,"describedby");if(c)return{text:tn(c),resolutionMethod:"aria-describedby",confidence:"low"};const u=Jt(t);return u?{text:u,resolutionMethod:"text-content",confidence:"low"}:null}function Jt(t,n=0){if(n>8)return"";if(g(t))return function(t){return t?t.trim().split(/(\s+)/).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,Nt):null}(t.textContent)??"";if(!t.childNodes?.length)return"";let e="";for(const i of t.childNodes){const t=Jt(i,n+1);if(t&&(e=e?`${e} ${t}`:t,e.length>=Nt))break}return tn(e)}function Qt(t,n){const e="labelledby"===n?"aria-labelledby":"aria-describedby",i=t?.getAttribute(e);if(!i)return null;const r=i.split(/\s+/),o=[];for(const t of r){const n=document.getElementById(t);if(!n)continue;const e=Wt(n)??Jt(n);e.length&&o.push(e)}return o.length?o.join(" "):null}function Wt(t){return t?.getAttribute("aria-label")?.trim()??null}function tn(t){return t.length>Nt?t.slice(0,Nt)+"...":t}function nn(t){const n=t.getBoundingClientRect();return{x:n.x,y:n.y,width:n.width,height:n.height}}class en{constructor(t){this.capacity=t,this.cache=new Map}get(t){return this.cache.get(t)}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.capacity){const t=this.cache.keys().next().value;t&&this.cache.delete(t)}this.cache.set(t,n)}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}size(){return this.cache.size}}async function rn(t,n){const{collectors:o,sdk:s}=t;let a=null,c=null,l=null,d=null;try{a=function(t){"undefined"!=typeof document&&"function"==typeof globalThis.fetch||e.warn("FalconService","createFalconServiceManager called in a non-browser environment — all requests will resolve with { ok: false, kind: 'network' }.");const n=function(t){const n=t?.timeout,e=t?.baseUrl??"",i=t?.api;async function r(t,r,o){if(void 0===jt)return{ok:0,kind:"network"};const s=e?`${e}${r}`:r,a=new AbortController;let c=null,u=0;c=f(()=>{u=1,a.abort()},n);const l=o?.signal;let d,v=()=>{};if(l)if(l.aborted)a.abort();else{const t=()=>a.abort();l.addEventListener("abort",t,{once:1}),v=()=>l.removeEventListener("abort",t)}if(null!=o&&"body"in o&&null!=o.body){const t=function(t){if(null==t)return{ok:1,body:void 0};if("string"==typeof t||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof Blob||t instanceof FormData||t instanceof URLSearchParams||t instanceof ReadableStream)return{ok:1,body:t};try{return{ok:1,body:JSON.stringify(t)}}catch{return{ok:0}}}(o.body);if(!t.ok)return h(c),v(),{ok:0,kind:"serialize"};d=t.body}try{const n=await jt(s,{method:t,headers:Bt({token:o?.token,profileId:o?.profileId,contentType:o?.contentType,contentEncoding:o?.contentEncoding,api:i,hasBody:void 0!==d,customHeaders:o?.customHeaders}),body:d,signal:a.signal,keepalive:o?.keepalive});if(!n.ok)return 429===(p=n.status)?{ok:0,kind:"rate_limited",status:p}:p>=400&&p<500?{ok:0,kind:"client",status:p}:{ok:0,kind:"server",status:p};if(204===n.status)return{ok:1,data:void 0,status:204};try{return{ok:1,data:await n.json(),status:n.status}}catch{return a.signal.aborted?u?{ok:0,kind:"timeout"}:{ok:0,kind:"abort"}:{ok:0,kind:"parse",status:n.status}}}catch{return u?{ok:0,kind:"timeout"}:a.signal.aborted?{ok:0,kind:"abort"}:{ok:0,kind:"network"}}finally{h(c),v()}var p}return{post:async function(t,n){return r("POST",t,n)},get:async function(t,n){return r("GET",t,n)}}}({baseUrl:`${t.api.url}/api/v1`,timeout:1e4,api:{version:t.api.version}}),i=function(t){const{getToken:n,refresh:i}=t;let r=null;return{withAuth:async function(t,o){if(r){const n=await r;if(n)return t(n)}const s=n()??"",a=await t(s);if((c=a).ok||"client"!==c.kind||!mt.includes(c.status)||0==o?.refreshable)return a;var c;const u=await(r||(r=async function(){try{return await i(),n()}catch(t){return e.warn("AuthMiddleware","auth refresh failed",t),null}}().finally(()=>{r=null}),r));return u&&u!==s?t(u):a}}}(t),r=()=>({profileId:t.getProfileId()??void 0});return{api:{ingest:async function(e,o){return i.withAuth(async i=>{const{events:s,...a}=e,c={...a,activityId:t.getActivityId()};let u;try{u=await async function(t,n){const e=function(t,n){const e=[JSON.stringify(t)];for(let t=0;t<n.length;t++)try{e.push(JSON.stringify(n[t]))}catch{}return e.join("\n")}(t,n),i=await Ot(e);return i?{type:"gzip",body:i}:{type:"ndjson",body:e}}(c,s)}catch{return{ok:0,kind:"serialize"}}return n.post("/events/capture",{body:u.body,token:i,keepalive:o,contentType:"ndjson",contentEncoding:"gzip"===u.type?"gzip":void 0,...r()})},{refreshable:!o})},reportEvent:async function(t){return i.withAuth(e=>n.post("/events/report-event",{body:t,token:e,contentType:"json",...r()}))},startActivity:async function(){return n.post("/events/start-activity",{token:t.getSdkToken(),...r()})},stopActivity:async function(){return i.withAuth(t=>n.post("/events/end-activity",{token:t,keepalive:1,...r()}),{refreshable:0})},collectionStatus:async function(){return n.get("/sdk/collection-status",{token:t.getSdkToken(),...r()})},linkInterview:async function(t){return i.withAuth(e=>n.post("/events/link-interview",{token:e,contentType:"json",...r(),customHeaders:{"X-Incode-Hardware-Id":t}}))}}}}({api:{version:s.api.version,url:s.api.url},getSdkToken:()=>s.token,getProfileId:()=>n.getProfileId(),getToken:()=>c?.getToken()??null,refresh:async()=>c?.refresh()??Promise.resolve(),getActivityId:()=>c?.getActivityId()??""});const t=await a.api.collectionStatus();if(!t.ok||1!=t.data.eventsCollectionEnabled)return{status:"collection-disabled"};c=new wt({startActivity:()=>a.api.startActivity(),stopActivity:()=>a.api.stopActivity()}),l=new Et(it,{ingest:(t,n)=>a.api.ingest(t,n),getTabId:()=>d?.getTabId()??"unknown",isActivityActive:()=>c?.isActive()??0});const v=o.tab;d=new Pt({push:t=>l?.push(t),events:{state:v.enabled&&v.events.state.enabled,count:v.enabled&&v.events.count.enabled}});const p=function(t){function n(n){"hidden"===document.visibilityState&&t.flush()}function e(n){t.flush(),t.stopTab(),t.getShouldSkipStopActivity()||t.stopActivity()}const o=u(()=>t.onConnectionChange());return{start:function(){i(document,"visibilitychange",n),i(window,"pagehide",e),i(window,"online",o),i(window,"offline",o)},stop:function(){r(document,"visibilitychange",n),r(window,"pagehide",e),r(window,"online",o),r(window,"offline",o)}}}({flush:()=>l?.flush("lifecycle"),stopActivity:async()=>c?.stop(),stopTab:()=>d?.stop(),getShouldSkipStopActivity:()=>(d?.queryTabsNumber()??0)>1,onConnectionChange:()=>l?.onConnectionChange()}),w=function(t){const n=t||"redact",e=new en(6),i=new en(6);return{resolve:function(t){if(!t||T(t)||"off"===n)return null;let r=e.get(t);if(r||(r=function(t){if(!t||T(t))return{chain:[],redaction:{level:"ignore",index:-1}};const n=[];let e=t,i=-1;for(;e;){if(T(e))return{chain:[],redaction:{level:"ignore",index:-1}};_(e)&&(i=n.length),n.push(e);const t=e.parentNode;if(!t||b(e,"body"))break;e=k(t)?t.host:t}return{chain:n,redaction:{level:-1===i?"full":"redact",index:i}}}(t.parentElement),e.set(t,r)),"ignore"===r.redaction.level)return null;const o="redact"===r.redaction.level||"redact"===n||_(t);let s=i.get(t);return s||(s=function(t,n,e,i){const r=getComputedStyle(t),o=nn(t),s=function(t,n){const e=[],i=[];for(let r=t.length-1;r>=0;r--){const o=t[r],s=r<=n,a=r+1,c=Zt(o,s,nn(o)),{score:u,reasons:l}=Xt(o,a);if(e.push(c),!Gt(u))continue;const f=Yt(o,s);i.push({...c,...f?{label:f}:{},depth:a,score:u,reasons:l})}return{ancestors:e,interactiveCandidates:i.reverse()}}(n,i),a=Zt(t,e,o),c=function(t,n,e){const{score:i,reasons:r}=Xt(t,0);return{interactive:Gt(i),...r.length>0?{reasons:r}:{},disabled:Vt(t),rendered:"none"!==n?.display,visible:"hidden"!==n?.visibility,inViewport:Kt(e),acceptsPointer:"none"!==n?.pointerEvents,opacity:parseFloat(n?.opacity||"1")}}(t,r,o);let u=null;return e||(u=c.interactive?Yt(t):null),{tagName:a.tagName,frame:a.frame,viewport:{height:window.innerHeight,width:window.innerWidth,scrollX:window.scrollX,scrollY:window.scrollY,dpr:window.devicePixelRatio},attributes:a.attributes,nth:a.nth,...u?{label:u}:{},ancestors:s.ancestors,interactiveCandidates:s.interactiveCandidates,interactivity:c}}(t,r.chain,o,r.redaction.index),i.set(t,s)),s}}}(s.capture?.element),m=new Set;try{m.add(new URL(s.api.url).origin)}catch{}const y=function(t,n,e="on"){const i=new Map;function r(r){if(i.has(r))return;const o=W[r];if(!o||!function(t,n){return n[t]?.enabled??0}(r,n))return;const s=n[r],a=o.create(t,e,s&&"events"in s?s.events:void 0);i.set(r,a)}return{start:r,stopCollector:function(t){const n=i.get(t);n&&(n(),i.delete(t))},stop:function(){for(const[,t]of i)t();i.clear()},isRunning:function(t){return i.has(t)},autocapture:function(){for(const t of tt)r(t)}}}({push:t=>l?.push(t),resolveElement:t=>w.resolve(t),sanitizeUrl:s.sanitizeUrl,ignoredOrigins:m},o,s.capture?.content),g=new qt({getActivityId:()=>c?.getActivityId()??"",reportEvent:t=>a.api.reportEvent(t)});return{status:"ready",managers:{falconServiceManager:a,activityManager:c,transportManager:l,tabManager:d,lifecycleManager:p,collectorManager:y,eventReportManager:g}}}catch(t){return e.warn("IncodeTRI","setup() failed during construction:",t),{status:"init-failed"}}}let on=class t{constructor(){this.Lt=0,this.q=null,this.Rt=null,this.$t="idle"}static get instance(){return t._||(t._=new t),t._}async setup(t){if("idle"!==this.$t)return e.fatal("error","setup()","called more than once — ignoring."),"init-failed";try{const n=function(t){if("undefined"==typeof document)return e.fatal("error","IncodeTRI","TRI is not available in a non-browser environment."),null;if(!t?.token)return e.fatal("error","SDK","token is required."),null;if(!t.apiURL)return e.fatal("error","SDK","Couldn't initialise SDK — apiURL isn't provided."),null;const{element:n,content:i}=t.capture??{},r={token:t.token,capture:{element:n??"redact",content:i??"off"},profileId:t.profileId,api:{version:t.apiVersion??"1.0",url:t.apiURL},sanitizeUrl:(o=t.sanitizeUrl,o?function(t){return a(()=>o(t,et))??et(t)}:et),DEBUG:t.DEBUG??0};var o;return void 0===t.collectors&&void 0===t.layers?{sdk:r,collectors:rt()}:void 0!==t.collectors?{sdk:r,collectors:st(t.collectors)}:{sdk:r,collectors:ot(t.layers)}}(t);if(!n)return"init-failed";e.DEBUG=n.sdk.DEBUG;const i=await rn(n,{getProfileId:()=>this.Ot()});return"collection-disabled"===i.status?(e.fatal("warn","setup()","Collection is disabled for the provided API Key."),"collection-disabled"):"init-failed"===i.status?"init-failed":(this.q=n,this.Rt=i.managers,this.$t="ready",this.Bt(n.sdk.profileId),"ready")}catch(t){return e.warn("setup()","failed:",t),"init-failed"}}async start(){if("idle"===this.$t)return e.warn("start()","start() requires a prior successful setup() — ignoring."),this.$t;if("ready"!==this.$t)return e.fatal("warn","start()","TRI is either already started or isn't ready — ignoring."),this.$t;this.$t="starting";const t=++this.Lt;return await this.U(t),this.$t}async stop(){e.warn("stop()","called");const t=this.Rt;return t?(++this.Lt,t.lifecycleManager.stop(),t.collectorManager.stop(),t.tabManager.stop(),t.eventReportManager.stop(),this.$t="ready",this.jt(t)):Promise.resolve(this.$t)}async reset(){const t=this.stop();return this.$t="idle",this.q=null,this.Rt=null,j.remove("__tri_profile_id"),t.then(()=>this.$t)}async jt(t){return await function(t){let n=null;const e=new Promise(t=>{n=f(t,2e3)});return Promise.race([t.finally(()=>h(n)),e])}(Promise.resolve(t.transportManager.stop())),await t.activityManager.stop(),this.$t}reportEvent(t,n){"started"===this.$t?this.Rt?c(()=>this.Rt.eventReportManager.report(t,n)):e.warn("reportEvent()","reportEvent() called but managers are unavailable — dropping event."):e.warn("reportEvent()","reportEvent() called before start() completed — dropping event.")}setProfileId(t){"started"===this.$t?this.q?.sdk&&(this.q.sdk.profileId=t,this.Bt(t)):e.warn("setProfileId()","setProfileId() called before start() completed — ignoring.")}async linkInterview(t){if("started"!==this.$t||!this.Rt)return e.warn("linkInterview()","linkInterview() called before start() completed — ignoring."),0;if(!t)return e.warn("linkInterview()","linkInterview() called without sessionToken — ignoring."),0;try{return(await this.Rt.falconServiceManager.api.linkInterview(t)).ok}catch(t){return e.warn("linkInterview()","failed:",t),0}}Ot(){return this.q?.sdk?.profileId??j.get("__tri_profile_id")??null}Bt(t){t&&j.set("__tri_profile_id",t)}async U(t){const n=this.Rt;if(n){try{if(await n.activityManager.start(),t!==this.Lt)return;if(n.transportManager.start(),await n.tabManager.start(),t!==this.Lt)return;n.lifecycleManager.start(),n.collectorManager.autocapture()}catch(n){return e.warn("start()","failed during monitoring start:",n),void(t===this.Lt&&(this.$t="ready"))}t===this.Lt&&(this.$t="started")}}};on._=null;const sn=on.instance;var an={},cn=Uint8Array,un=Uint16Array,ln=Int32Array,fn=new cn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),hn=new cn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),dn=new cn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vn=function(t,n){for(var e=new un(31),i=0;i<31;++i)e[i]=n+=1<<t[i-1];var r=new ln(e[30]);for(i=1;i<30;++i)for(var o=e[i];o<e[i+1];++o)r[o]=o-e[i]<<5|i;return{b:e,r:r}},pn=vn(fn,2),wn=pn.b,mn=pn.r;wn[28]=258,mn[258]=28;for(var yn=vn(hn,0),gn=yn.b,bn=yn.r,kn=new un(32768),Tn=0;Tn<32768;++Tn){var _n=(43690&Tn)>>1|(21845&Tn)<<1;kn[Tn]=((65280&(_n=(61680&(_n=(52428&_n)>>2|(13107&_n)<<2))>>4|(3855&_n)<<4))>>8|(255&_n)<<8)>>1}var In=function(t,n,e){for(var i=t.length,r=0,o=new un(n);r<i;++r)t[r]&&++o[t[r]-1];var s,a=new un(n);for(r=1;r<n;++r)a[r]=a[r-1]+o[r-1]<<1;if(e){s=new un(1<<n);var c=15-n;for(r=0;r<i;++r)if(t[r])for(var u=r<<4|t[r],l=n-t[r],f=a[t[r]-1]++<<l,h=f|(1<<l)-1;f<=h;++f)s[kn[f]>>c]=u}else for(s=new un(i),r=0;r<i;++r)t[r]&&(s[r]=kn[a[t[r]-1]++]>>15-t[r]);return s},Sn=new cn(288);for(Tn=0;Tn<144;++Tn)Sn[Tn]=8;for(Tn=144;Tn<256;++Tn)Sn[Tn]=9;for(Tn=256;Tn<280;++Tn)Sn[Tn]=7;for(Tn=280;Tn<288;++Tn)Sn[Tn]=8;var xn=new cn(32);for(Tn=0;Tn<32;++Tn)xn[Tn]=5;var Mn=In(Sn,9,0),En=In(Sn,9,1),An=In(xn,5,0),zn=In(xn,5,1),Dn=function(t){for(var n=t[0],e=1;e<t.length;++e)t[e]>n&&(n=t[e]);return n},Pn=function(t,n,e){var i=n/8|0;return(t[i]|t[i+1]<<8)>>(7&n)&e},Cn=function(t,n){var e=n/8|0;return(t[e]|t[e+1]<<8|t[e+2]<<16)>>(7&n)},Un=function(t){return(t+7)/8|0},Ln=function(t,n,e){return(null==n||n<0)&&(n=0),(null==e||e>t.length)&&(e=t.length),new cn(t.subarray(n,e))},Rn=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],$n=function(t,n,e){var i=new Error(n||Rn[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,$n),!e)throw i;return i},On=function(t,n,e,i){var r=t.length,o=i?i.length:0;if(!r||n.f&&!n.l)return e||new cn(0);var s=!e,a=s||2!=n.i,c=n.i;s&&(e=new cn(3*r));var u=function(t){var n=e.length;if(t>n){var i=new cn(Math.max(2*n,t));i.set(e),e=i}},l=n.f||0,f=n.p||0,h=n.b||0,d=n.l,v=n.d,p=n.m,w=n.n,m=8*r;do{if(!d){l=Pn(t,f,1);var y=Pn(t,f+1,3);if(f+=3,!y){var g=t[(z=Un(f)+4)-4]|t[z-3]<<8,b=z+g;if(b>r){c&&$n(0);break}a&&u(h+g),e.set(t.subarray(z,b),h),n.b=h+=g,n.p=f=8*b,n.f=l;continue}if(1==y)d=En,v=zn,p=9,w=5;else if(2==y){var k=Pn(t,f,31)+257,T=Pn(t,f+10,15)+4,_=k+Pn(t,f+5,31)+1;f+=14;for(var I=new cn(_),S=new cn(19),x=0;x<T;++x)S[dn[x]]=Pn(t,f+3*x,7);f+=3*T;var M=Dn(S),E=(1<<M)-1,A=In(S,M,1);for(x=0;x<_;){var z,D=A[Pn(t,f,E)];if(f+=15&D,(z=D>>4)<16)I[x++]=z;else{var P=0,C=0;for(16==z?(C=3+Pn(t,f,3),f+=2,P=I[x-1]):17==z?(C=3+Pn(t,f,7),f+=3):18==z&&(C=11+Pn(t,f,127),f+=7);C--;)I[x++]=P}}var U=I.subarray(0,k),L=I.subarray(k);p=Dn(U),w=Dn(L),d=In(U,p,1),v=In(L,w,1)}else $n(1);if(f>m){c&&$n(0);break}}a&&u(h+131072);for(var R=(1<<p)-1,$=(1<<w)-1,O=f;;O=f){var B=(P=d[Cn(t,f)&R])>>4;if((f+=15&P)>m){c&&$n(0);break}if(P||$n(2),B<256)e[h++]=B;else{if(256==B){O=f,d=null;break}var j=B-254;B>264&&(j=Pn(t,f,(1<<(H=fn[x=B-257]))-1)+wn[x],f+=H);var q=v[Cn(t,f)&$],F=q>>4;if(q||$n(3),f+=15&q,L=gn[F],F>3){var H=hn[F];L+=Cn(t,f)&(1<<H)-1,f+=H}if(f>m){c&&$n(0);break}a&&u(h+131072);var N=h+j;if(h<L){var Z=o-L,X=Math.min(L,N);for(Z+h<0&&$n(3);h<X;++h)e[h]=i[Z+h]}for(;h<N;++h)e[h]=e[h-L]}}n.l=d,n.p=O,n.b=h,n.f=l,d&&(l=1,n.m=p,n.d=v,n.n=w)}while(!l);return h!=e.length&&s?Ln(e,0,h):e.subarray(0,h)},Bn=function(t,n,e){var i=n/8|0;t[i]|=e<<=7&n,t[i+1]|=e>>8},jn=function(t,n,e){var i=n/8|0;t[i]|=e<<=7&n,t[i+1]|=e>>8,t[i+2]|=e>>16},qn=function(t,n){for(var e=[],i=0;i<t.length;++i)t[i]&&e.push({s:i,f:t[i]});var r=e.length,o=e.slice();if(!r)return{t:Kn,l:0};if(1==r){var s=new cn(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(t,n){return t.f-n.f}),e.push({s:-1,f:25001});var a=e[0],c=e[1],u=0,l=1,f=2;for(e[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=r-1;)a=e[e[u].f<e[f].f?u++:f++],c=e[u!=l&&e[u].f<e[f].f?u++:f++],e[l++]={s:-1,f:a.f+c.f,l:a,r:c};var h=o[0].s;for(i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var d=new un(h+1),v=Fn(e[l-1],d,0);if(v>n){i=0;var p=0,w=v-n,m=1<<w;for(o.sort(function(t,n){return d[n.s]-d[t.s]||t.f-n.f});i<r;++i){var y=o[i].s;if(!(d[y]>n))break;p+=m-(1<<v-d[y]),d[y]=n}for(p>>=w;p>0;){var g=o[i].s;d[g]<n?p-=1<<n-d[g]++-1:++i}for(;i>=0&&p;--i){var b=o[i].s;d[b]==n&&(--d[b],++p)}v=n}return{t:new cn(d),l:v}},Fn=function(t,n,e){return-1==t.s?Math.max(Fn(t.l,n,e+1),Fn(t.r,n,e+1)):n[t.s]=e},Hn=function(t){for(var n=t.length;n&&!t[--n];);for(var e=new un(++n),i=0,r=t[0],o=1,s=function(t){e[i++]=t},a=1;a<=n;++a)if(t[a]==r&&a!=n)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=t[a]}return{c:e.subarray(0,i),n:n}},Nn=function(t,n){for(var e=0,i=0;i<n.length;++i)e+=t[i]*n[i];return e},Zn=function(t,n,e){var i=e.length,r=Un(n+2);t[r]=255&i,t[r+1]=i>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var o=0;o<i;++o)t[r+o+4]=e[o];return 8*(r+4+i)},Xn=function(t,n,e,i,r,o,s,a,c,u,l){Bn(n,l++,e),++r[256];for(var f=qn(r,15),h=f.t,d=f.l,v=qn(o,15),p=v.t,w=v.l,m=Hn(h),y=m.c,g=m.n,b=Hn(p),k=b.c,T=b.n,_=new un(19),I=0;I<y.length;++I)++_[31&y[I]];for(I=0;I<k.length;++I)++_[31&k[I]];for(var S=qn(_,7),x=S.t,M=S.l,E=19;E>4&&!x[dn[E-1]];--E);var A,z,D,P,C=u+5<<3,U=Nn(r,Sn)+Nn(o,xn)+s,L=Nn(r,h)+Nn(o,p)+s+14+3*E+Nn(_,x)+2*_[16]+3*_[17]+7*_[18];if(c>=0&&C<=U&&C<=L)return Zn(n,l,t.subarray(c,c+u));if(Bn(n,l,1+(L<U)),l+=2,L<U){A=In(h,d,0),z=h,D=In(p,w,0),P=p;var R=In(x,M,0);for(Bn(n,l,g-257),Bn(n,l+5,T-1),Bn(n,l+10,E-4),l+=14,I=0;I<E;++I)Bn(n,l+3*I,x[dn[I]]);l+=3*E;for(var $=[y,k],O=0;O<2;++O){var B=$[O];for(I=0;I<B.length;++I)Bn(n,l,R[q=31&B[I]]),l+=x[q],q>15&&(Bn(n,l,B[I]>>5&127),l+=B[I]>>12)}}else A=Mn,z=Sn,D=An,P=xn;for(I=0;I<a;++I){var j=i[I];if(j>255){var q;jn(n,l,A[257+(q=j>>18&31)]),l+=z[q+257],q>7&&(Bn(n,l,j>>23&31),l+=fn[q]);var F=31&j;jn(n,l,D[F]),l+=P[F],F>3&&(jn(n,l,j>>5&8191),l+=hn[F])}else jn(n,l,A[j]),l+=z[j]}return jn(n,l,A[256]),l+z[256]},Gn=new ln([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Kn=new cn(0),Vn=function(t,n,e,i,r,o){var s=o.z||t.length,a=new cn(i+s+5*(1+Math.ceil(s/7e3))+r),c=a.subarray(i,a.length-r),u=o.l,l=7&(o.r||0);if(n){l&&(c[0]=o.r>>3);for(var f=Gn[n-1],h=f>>13,d=8191&f,v=(1<<e)-1,p=o.p||new un(32768),w=o.h||new un(v+1),m=Math.ceil(e/3),y=2*m,g=function(n){return(t[n]^t[n+1]<<m^t[n+2]<<y)&v},b=new ln(25e3),k=new un(288),T=new un(32),_=0,I=0,S=o.i||0,x=0,M=o.w||0,E=0;S+2<s;++S){var A=g(S),z=32767&S,D=w[A];if(p[z]=D,w[A]=z,M<=S){var P=s-S;if((_>7e3||x>24576)&&(P>423||!u)){l=Xn(t,c,0,b,k,T,I,x,E,S-E,l),x=_=I=0,E=S;for(var C=0;C<286;++C)k[C]=0;for(C=0;C<30;++C)T[C]=0}var U=2,L=0,R=d,$=z-D&32767;if(P>2&&A==g(S-$))for(var O=Math.min(h,P)-1,B=Math.min(32767,S),j=Math.min(258,P);$<=B&&--R&&z!=D;){if(t[S+U]==t[S+U-$]){for(var q=0;q<j&&t[S+q]==t[S+q-$];++q);if(q>U){if(U=q,L=$,q>O)break;var F=Math.min($,q-2),H=0;for(C=0;C<F;++C){var N=S-$+C&32767,Z=N-p[N]&32767;Z>H&&(H=Z,D=N)}}}$+=(z=D)-(D=p[z])&32767}if(L){b[x++]=268435456|mn[U]<<18|bn[L];var X=31&mn[U],G=31&bn[L];I+=fn[X]+hn[G],++k[257+X],++T[G],M=S+U,++_}else b[x++]=t[S],++k[t[S]]}}for(S=Math.max(S,M);S<s;++S)b[x++]=t[S],++k[t[S]];l=Xn(t,c,u,b,k,T,I,x,E,S-E,l),u||(o.r=7&l|c[l/8|0]<<3,l-=7,o.h=w,o.p=p,o.i=S,o.w=M)}else{for(S=o.w||0;S<s+u;S+=65535){var K=S+65535;K>=s&&(c[l/8|0]=u,K=s),l=Zn(c,l+1,t.subarray(S,K))}o.i=s}return Ln(a,0,i+Un(l)+r)},Yn=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var e=n,i=9;--i;)e=(1&e&&-306674912)^e>>>1;t[n]=e}return t}(),Jn=function(){var t=-1;return{p:function(n){for(var e=t,i=0;i<n.length;++i)e=Yn[255&e^n[i]]^e>>>8;t=e},d:function(){return~t}}},Qn=function(){var t=1,n=0;return{p:function(e){for(var i=t,r=n,o=0|e.length,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)r+=i+=e[s];i=(65535&i)+15*(i>>16),r=(65535&r)+15*(r>>16)}t=i,n=r},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},Wn=function(t,n,e,i,r){if(!r&&(r={l:1},n.dictionary)){var o=n.dictionary.subarray(-32768),s=new cn(o.length+t.length);s.set(o),s.set(t,o.length),t=s,r.w=o.length}return Vn(t,null==n.level?6:n.level,null==n.mem?r.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+n.mem,e,i,r)},te=function(t,n){var e={};for(var i in t)e[i]=t[i];for(var i in n)e[i]=n[i];return e},ne=function(t,n,e){for(var i=t(),r=t.toString(),o=r.slice(r.indexOf("[")+1,r.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<i.length;++s){var a=i[s],c=o[s];if("function"==typeof a){n+=";"+c+"=";var u=a.toString();if(a.prototype)if(-1!=u.indexOf("[native code]")){var l=u.indexOf(" ",8)+1;n+=u.slice(l,u.indexOf("(",l))}else for(var f in n+=u,a.prototype)n+=";"+c+".prototype."+f+"="+a.prototype[f].toString();else n+=u}else e[c]=a}return n},ee=[],ie=function(t,n,e,i){if(!ee[e]){for(var r="",o={},s=t.length-1,a=0;a<s;++a)r=ne(t[a],r,o);ee[e]={c:ne(t[s],r,o),e:o}}var c=te({},ee[e].e);return function(t,n,e,i,r){var o=new Worker(an[n]||(an[n]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return o.onmessage=function(t){var n=t.data,e=n.$e$;if(e){var i=new Error(e[0]);i.code=e[1],i.stack=e[2],r(i,null)}else r(null,n)},o.postMessage(e,i),o}(ee[e].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+n.toString()+"}",e,c,function(t){var n=[];for(var e in t)t[e].buffer&&n.push((t[e]=new t[e].constructor(t[e])).buffer);return n}(c),i)},re=function(){return[cn,un,ln,fn,hn,dn,wn,gn,En,zn,kn,Rn,In,Dn,Pn,Cn,Un,Ln,$n,On,Ce,le,fe]},oe=function(){return[cn,un,ln,fn,hn,dn,mn,bn,Mn,Sn,An,xn,kn,Gn,Kn,In,Bn,jn,qn,Fn,Hn,Nn,Zn,Xn,Un,Ln,Vn,Wn,Ae,le]},se=function(){return[ge,Te,ye,Jn,Yn]},ae=function(){return[be,ke]},ce=function(){return[_e,ye,Qn]},ue=function(){return[Ie]},le=function(t){return postMessage(t,[t.buffer])},fe=function(t){return t&&{out:t.size&&new cn(t.size),dictionary:t.dictionary}},he=function(t,n,e,i,r,o){var s=ie(e,i,r,function(t,n){s.terminate(),o(t,n)});return s.postMessage([t,n],n.consume?[t.buffer]:[]),function(){s.terminate()}},de=function(t){return t.ondata=function(t,n){return postMessage([t,n],[t.buffer])},function(n){n.data.length?(t.push(n.data[0],n.data[1]),postMessage([n.data[0].length])):t.flush()}},ve=function(t,n,e,i,r,o,s){var a,c=ie(t,i,r,function(t,e){t?(c.terminate(),n.ondata.call(n,t)):Array.isArray(e)?1==e.length?(n.queuedSize-=e[0],n.ondrain&&n.ondrain(e[0])):(e[1]&&c.terminate(),n.ondata.call(n,t,e[0],e[1])):s(e)});c.postMessage(e),n.queuedSize=0,n.push=function(t,e){n.ondata||$n(5),a&&n.ondata($n(4,0,1),null,!!e),n.queuedSize+=t.length,c.postMessage([t,a=e],[t.buffer])},n.terminate=function(){c.terminate()},o&&(n.flush=function(){c.postMessage([])})},pe=function(t,n){return t[n]|t[n+1]<<8},we=function(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24)>>>0},me=function(t,n){return we(t,n)+4294967296*we(t,n+4)},ye=function(t,n,e){for(;e;++n)t[n]=e,e>>>=8},ge=function(t,n){var e=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&ye(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),e){t[3]=8;for(var i=0;i<=e.length;++i)t[i+10]=e.charCodeAt(i)}},be=function(t){31==t[0]&&139==t[1]&&8==t[2]||$n(6,"invalid gzip data");var n=t[3],e=10;4&n&&(e+=2+(t[10]|t[11]<<8));for(var i=(n>>3&1)+(n>>4&1);i>0;i-=!t[e++]);return e+(2&n)},ke=function(t){var n=t.length;return(t[n-4]|t[n-3]<<8|t[n-2]<<16|t[n-1]<<24)>>>0},Te=function(t){return 10+(t.filename?t.filename.length+1:0)},_e=function(t,n){var e=n.level,i=0==e?0:e<6?1:9==e?3:2;if(t[0]=120,t[1]=i<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var r=Qn();r.p(n.dictionary),ye(t,2,r.d())}},Ie=function(t,n){return(8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31)&&$n(6,"invalid zlib data"),(t[1]>>5&1)==+!n&&$n(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)};function Se(t,n){return"function"==typeof t&&(n=t,t={}),this.ondata=n,t}var xe=function(){function t(t,n){if("function"==typeof t&&(n=t,t={}),this.ondata=n,this.o=t||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new cn(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return t.prototype.p=function(t,n){this.ondata(Wn(t,this.o,0,0,this.s),n)},t.prototype.push=function(t,n){this.ondata||$n(5),this.s.l&&$n(4);var e=t.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new cn(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var r=this.b.length-this.s.z;this.b.set(t.subarray(0,r),this.s.z),this.s.z=this.b.length,this.p(this.b,0),this.b.set(this.b.subarray(-32768)),this.b.set(t.subarray(r),32768),this.s.z=t.length-r+32768,this.s.i=32766,this.s.w=32768}else this.b.set(t,this.s.z),this.s.z+=t.length;this.s.l=1&n,(this.s.z>this.s.w+8191||n)&&(this.p(this.b,n||0),this.s.w=this.s.i,this.s.i-=2)},t.prototype.flush=function(){this.ondata||$n(5),this.s.l&&$n(4),this.p(this.b,0),this.s.w=this.s.i,this.s.i-=2},t}(),Me=function(){return function(t,n){ve([oe,function(){return[de,xe]}],this,Se.call(this,t,n),function(t){var n=new xe(t.data);onmessage=de(n)},6,1)}}();function Ee(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&$n(7),he(t,n,[oe],function(t){return le(Ae(t.data[0],t.data[1]))},0,e)}function Ae(t,n){return Wn(t,n||{},0,0)}var ze=function(){function t(t,n){"function"==typeof t&&(n=t,t={}),this.ondata=n;var e=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:e?e.length:0},this.o=new cn(32768),this.p=new cn(0),e&&this.o.set(e)}return t.prototype.e=function(t){if(this.ondata||$n(5),this.d&&$n(4),this.p.length){if(t.length){var n=new cn(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length),this.p=n}}else this.p=t},t.prototype.c=function(t){this.s.i=+(this.d=t||0);var n=this.s.b,e=On(this.p,this.s,this.o);this.ondata(Ln(e,n,this.s.b),this.d),this.o=Ln(e,this.s.b-32768),this.s.b=this.o.length,this.p=Ln(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,n){this.e(t),this.c(n)},t}(),De=function(){return function(t,n){ve([re,function(){return[de,ze]}],this,Se.call(this,t,n),function(t){var n=new ze(t.data);onmessage=de(n)},7,0)}}();function Pe(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&$n(7),he(t,n,[re],function(t){return le(Ce(t.data[0],fe(t.data[1])))},1,e)}function Ce(t,n){return On(t,{i:2},n&&n.out,n&&n.dictionary)}var Ue=function(){function t(t,n){this.c=Jn(),this.l=0,this.v=1,xe.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),this.l+=t.length,xe.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var e=Wn(t,this.o,this.v&&Te(this.o),n&&8,this.s);this.v&&(ge(e,this.o),this.v=0),n&&(ye(e,e.length-8,this.c.d()),ye(e,e.length-4,this.l)),this.ondata(e,n)},t.prototype.flush=function(){xe.prototype.flush.call(this)},t}(),Le=function(){return function(t,n){ve([oe,se,function(){return[de,xe,Ue]}],this,Se.call(this,t,n),function(t){var n=new Ue(t.data);onmessage=de(n)},8,1)}}();function Re(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&$n(7),he(t,n,[oe,se,function(){return[$e]}],function(t){return le($e(t.data[0],t.data[1]))},2,e)}function $e(t,n){n||(n={});var e=Jn(),i=t.length;e.p(t);var r=Wn(t,n,Te(n),8),o=r.length;return ge(r,n),ye(r,o-8,e.d()),ye(r,o-4,i),r}var Oe=function(){function t(t,n){this.v=1,this.r=0,ze.call(this,t,n)}return t.prototype.push=function(t,n){if(ze.prototype.e.call(this,t),this.r+=t.length,this.v){var e=this.p.subarray(this.v-1),i=e.length>3?be(e):4;if(i>e.length){if(!n)return}else this.v>1&&this.onmember&&this.onmember(this.r-e.length);this.p=e.subarray(i),this.v=0}ze.prototype.c.call(this,n),!this.s.f||this.s.l||n||(this.v=Un(this.s.p)+9,this.s={i:0},this.o=new cn(0),this.push(new cn(0),n))},t}(),Be=function(){return function(t,n){var e=this;ve([re,ae,function(){return[de,ze,Oe]}],this,Se.call(this,t,n),function(t){var n=new Oe(t.data);n.onmember=function(t){return postMessage(t)},onmessage=de(n)},9,0,function(t){return e.onmember&&e.onmember(t)})}}();function je(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&$n(7),he(t,n,[re,ae,function(){return[qe]}],function(t){return le(qe(t.data[0],t.data[1]))},3,e)}function qe(t,n){var e=be(t);return e+8>t.length&&$n(6,"invalid gzip data"),On(t.subarray(e,-8),{i:2},n&&n.out||new cn(ke(t)),n&&n.dictionary)}var Fe=function(){function t(t,n){this.c=Qn(),this.v=1,xe.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),xe.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var e=Wn(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(_e(e,this.o),this.v=0),n&&ye(e,e.length-4,this.c.d()),this.ondata(e,n)},t.prototype.flush=function(){xe.prototype.flush.call(this)},t}(),He=function(){return function(t,n){ve([oe,ce,function(){return[de,xe,Fe]}],this,Se.call(this,t,n),function(t){var n=new Fe(t.data);onmessage=de(n)},10,1)}}();function Ne(t,n){n||(n={});var e=Qn();e.p(t);var i=Wn(t,n,n.dictionary?6:2,4);return _e(i,n),ye(i,i.length-4,e.d()),i}var Ze=function(){function t(t,n){ze.call(this,t,n),this.v=t&&t.dictionary?2:1}return t.prototype.push=function(t,n){if(ze.prototype.e.call(this,t),this.v){if(this.p.length<6&&!n)return;this.p=this.p.subarray(Ie(this.p,this.v-1)),this.v=0}n&&(this.p.length<4&&$n(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),ze.prototype.c.call(this,n)},t}(),Xe=function(){return function(t,n){ve([re,ue,function(){return[de,ze,Ze]}],this,Se.call(this,t,n),function(t){var n=new Ze(t.data);onmessage=de(n)},11,0)}}();function Ge(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&$n(7),he(t,n,[re,ue,function(){return[Ke]}],function(t){return le(Ke(t.data[0],fe(t.data[1])))},5,e)}function Ke(t,n){return On(t.subarray(Ie(t,n&&n.dictionary),-4),{i:2},n&&n.out,n&&n.dictionary)}var Ve=function(){function t(t,n){this.o=Se.call(this,t,n)||{},this.G=Oe,this.I=ze,this.Z=Ze}return t.prototype.i=function(){var t=this;this.s.ondata=function(n,e){t.ondata(n,e)}},t.prototype.push=function(t,n){if(this.ondata||$n(5),this.s)this.s.push(t,n);else{if(this.p&&this.p.length){var e=new cn(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length)}else this.p=t;this.p.length>2&&(this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,n),this.p=null)}},t}(),Ye=function(){function t(t,n){Ve.call(this,t,n),this.queuedSize=0,this.G=Be,this.I=De,this.Z=Xe}return t.prototype.i=function(){var t=this;this.s.ondata=function(n,e,i){t.ondata(n,e,i)},this.s.ondrain=function(n){t.queuedSize-=n,t.ondrain&&t.ondrain(n)}},t.prototype.push=function(t,n){this.queuedSize+=t.length,Ve.prototype.push.call(this,t,n)},t}(),Je=function(t,n,e,i){for(var r in t){var o=t[r],s=n+r,a=i;Array.isArray(o)&&(a=te(i,o[1]),o=o[0]),o instanceof cn?e[s]=[o,a]:(e[s+="/"]=[new cn(0),a],Je(o,s,e,i))}},Qe="undefined"!=typeof TextEncoder&&new TextEncoder,We="undefined"!=typeof TextDecoder&&new TextDecoder,ti=0;try{We.decode(Kn,{stream:1}),ti=1}catch(t){}var ni=function(t){for(var n="",e=0;;){var i=t[e++],r=(i>127)+(i>223)+(i>239);if(e+r>t.length)return{s:n,r:Ln(t,e-1)};r?3==r?(i=((15&i)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i)):n+=String.fromCharCode(1&r?(31&i)<<6|63&t[e++]:(15&i)<<12|(63&t[e++])<<6|63&t[e++]):n+=String.fromCharCode(i)}},ei=function(){function t(t){this.ondata=t,ti?this.t=new TextDecoder:this.p=Kn}return t.prototype.push=function(t,n){if(this.ondata||$n(5),n=!!n,this.t)return this.ondata(this.t.decode(t,{stream:1}),n),void(n&&(this.t.decode().length&&$n(8),this.t=null));this.p||$n(4);var e=new cn(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length);var i=ni(e),r=i.s,o=i.r;n?(o.length&&$n(8),this.p=null):this.p=o,this.ondata(r,n)},t}(),ii=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||$n(5),this.d&&$n(4),this.ondata(ri(t),this.d=n||0)},t}();function ri(t,n){if(n){for(var e=new cn(t.length),i=0;i<t.length;++i)e[i]=t.charCodeAt(i);return e}if(Qe)return Qe.encode(t);var r=t.length,o=new cn(t.length+(t.length>>1)),s=0,a=function(t){o[s++]=t};for(i=0;i<r;++i){if(s+5>o.length){var c=new cn(s+8+(r-i<<1));c.set(o),o=c}var u=t.charCodeAt(i);u<128||n?a(u):u<2048?(a(192|u>>6),a(128|63&u)):u>55295&&u<57344?(a(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++i))>>18),a(128|u>>12&63),a(128|u>>6&63),a(128|63&u)):(a(224|u>>12),a(128|u>>6&63),a(128|63&u))}return Ln(o,0,s)}function oi(t,n){if(n){for(var e="",i=0;i<t.length;i+=16384)e+=String.fromCharCode.apply(null,t.subarray(i,i+16384));return e}if(We)return We.decode(t);var r=ni(t),o=r.s;return(e=r.r).length&&$n(8),o}var si=function(t){return 1==t?3:t<6?2:9==t?1:0},ai=function(t,n){return n+30+pe(t,n+26)+pe(t,n+28)},ci=function(t,n,e){var i=pe(t,n+28),r=oi(t.subarray(n+46,n+46+i),!(2048&pe(t,n+8))),o=n+46+i,s=we(t,n+20),a=e&&4294967295==s?ui(t,o):[s,we(t,n+24),we(t,n+42)],c=a[0],u=a[1],l=a[2];return[pe(t,n+10),c,u,r,o+pe(t,n+30)+pe(t,n+32),l]},ui=function(t,n){for(;1!=pe(t,n);n+=4+pe(t,n+2));return[me(t,n+12),me(t,n+4),me(t,n+20)]},li=function(t){var n=0;if(t)for(var e in t){var i=t[e].length;i>65535&&$n(9),n+=i+4}return n},fi=function(t,n,e,i,r,o,s,a){var c=i.length,u=e.extra,l=a&&a.length,f=li(u);ye(t,n,null!=s?33639248:67324752),n+=4,null!=s&&(t[n++]=20,t[n++]=e.os),t[n]=20,n+=2,t[n++]=e.flag<<1|(o<0&&8),t[n++]=r&&8,t[n++]=255&e.compression,t[n++]=e.compression>>8;var h=new Date(null==e.mtime?Date.now():e.mtime),d=h.getFullYear()-1980;if((d<0||d>119)&&$n(10),ye(t,n,d<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),n+=4,-1!=o&&(ye(t,n,e.crc),ye(t,n+4,o<0?-o-2:o),ye(t,n+8,e.size)),ye(t,n+12,c),ye(t,n+14,f),n+=16,null!=s&&(ye(t,n,l),ye(t,n+6,e.attrs),ye(t,n+10,s),n+=14),t.set(i,n),n+=c,f)for(var v in u){var p=u[v],w=p.length;ye(t,n,+v),ye(t,n+2,w),t.set(p,n+4),n+=4+w}return l&&(t.set(a,n),n+=l),n},hi=function(t,n,e,i,r){ye(t,n,101010256),ye(t,n+8,e),ye(t,n+10,e),ye(t,n+12,i),ye(t,n+16,r)},di=function(){function t(t){this.filename=t,this.c=Jn(),this.size=0,this.compression=0}return t.prototype.process=function(t,n){this.ondata(null,t,n)},t.prototype.push=function(t,n){this.ondata||$n(5),this.c.p(t),this.size+=t.length,n&&(this.crc=this.c.d()),this.process(t,n||0)},t}(),vi=function(){function t(t,n){var e=this;n||(n={}),di.call(this,t),this.d=new xe(n,function(t,n){e.ondata(null,t,n)}),this.compression=8,this.flag=si(n.level)}return t.prototype.process=function(t,n){try{this.d.push(t,n)}catch(t){this.ondata(t,null,n)}},t.prototype.push=function(t,n){di.prototype.push.call(this,t,n)},t}(),pi=function(){function t(t,n){var e=this;n||(n={}),di.call(this,t),this.d=new Me(n,function(t,n,i){e.ondata(t,n,i)}),this.compression=8,this.flag=si(n.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,n){this.d.push(t,n)},t.prototype.push=function(t,n){di.prototype.push.call(this,t,n)},t}(),wi=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var n=this;if(this.ondata||$n(5),2&this.d)this.ondata($n(4+8*(1&this.d),0,1),null,0);else{var e=ri(t.filename),i=e.length,r=t.comment,o=r&&ri(r),s=i!=t.filename.length||o&&r.length!=o.length,a=i+li(t.extra)+30;i>65535&&this.ondata($n(11,0,1),null,0);var c=new cn(a);fi(c,0,t,e,s,-1);var u=[c],l=function(){for(var t=0,e=u;t<e.length;t++)n.ondata(null,e[t],0);u=[]},f=this.d;this.d=0;var h=this.u.length,d=te(t,{f:e,u:s,o:o,t:function(){t.terminate&&t.terminate()},r:function(){if(l(),f){var t=n.u[h+1];t?t.r():n.d=1}f=1}}),v=0;t.ondata=function(e,i,r){if(e)n.ondata(e,i,r),n.terminate();else if(v+=i.length,u.push(i),r){var o=new cn(16);ye(o,0,134695760),ye(o,4,t.crc),ye(o,8,v),ye(o,12,t.size),u.push(o),d.c=v,d.b=a+v+16,d.crc=t.crc,d.size=t.size,f&&d.r(),f=1}else f&&l()},this.u.push(d)}},t.prototype.end=function(){var t=this;2&this.d?this.ondata($n(4+8*(1&this.d),0,1),null,1):(this.d?this.e():this.u.push({r:function(){1&t.d&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3)},t.prototype.e=function(){for(var t=0,n=0,e=0,i=0,r=this.u;i<r.length;i++)e+=46+(c=r[i]).f.length+li(c.extra)+(c.o?c.o.length:0);for(var o=new cn(e+22),s=0,a=this.u;s<a.length;s++){var c;fi(o,t,c=a[s],c.f,c.u,-c.c-2,n,c.o),t+=46+c.f.length+li(c.extra)+(c.o?c.o.length:0),n+=c.b}hi(o,t,this.u.length,e,n),this.ondata(null,o,1),this.d=2},t.prototype.terminate=function(){for(var t=0,n=this.u;t<n.length;t++)n[t].t();this.d=2},t}(),mi=function(){function t(){}return t.prototype.push=function(t,n){this.ondata(null,t,n)},t.compression=0,t}(),yi=function(){function t(){var t=this;this.i=new ze(function(n,e){t.ondata(null,n,e)})}return t.prototype.push=function(t,n){try{this.i.push(t,n)}catch(t){this.ondata(t,null,n)}},t.compression=8,t}(),gi=function(){function t(t,n){var e=this;n<32e4?this.i=new ze(function(t,n){e.ondata(null,t,n)}):(this.i=new De(function(t,n,i){e.ondata(t,n,i)}),this.terminate=this.i.terminate)}return t.prototype.push=function(t,n){this.i.terminate&&(t=Ln(t,0)),this.i.push(t,n)},t.compression=8,t}(),bi=function(){function t(t){this.onfile=t,this.k=[],this.o={0:mi},this.p=Kn}return t.prototype.push=function(t,n){var e=this;if(this.onfile||$n(5),this.p||$n(4),this.c>0){var i=Math.min(this.c,t.length),r=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(r,!this.c):this.k[0].push(r),(t=t.subarray(i)).length)return this.push(t,n)}else{var o=0,s=0,a=void 0,c=void 0;this.p.length?t.length?((c=new cn(this.p.length+t.length)).set(this.p),c.set(t,this.p.length)):c=this.p:c=t;for(var u=c.length,l=this.c,f=l&&this.d,h=function(){var t,n=we(c,s);if(67324752==n){o=1,a=s,d.d=null,d.c=0;var i=pe(c,s+6),r=pe(c,s+8),f=2048&i,h=8&i,v=pe(c,s+26),p=pe(c,s+28);if(u>s+30+v+p){var w=[];d.k.unshift(w),o=2;var m,y=we(c,s+18),g=we(c,s+22),b=oi(c.subarray(s+30,s+=30+v),!f);4294967295==y?(t=h?[-2]:ui(c,s),y=t[0],g=t[1]):h&&(y=-1),s+=p,d.c=y;var k={name:b,compression:r,start:function(){if(k.ondata||$n(5),y){var t=e.o[r];t||k.ondata($n(14,"unknown compression type "+r,1),null,0),(m=y<0?new t(b):new t(b,y,g)).ondata=function(t,n,e){k.ondata(t,n,e)};for(var n=0,i=w;n<i.length;n++)m.push(i[n],0);e.k[0]==w&&e.c?e.d=m:m.push(Kn,1)}else k.ondata(null,Kn,1)},terminate:function(){m&&m.terminate&&m.terminate()}};y>=0&&(k.size=y,k.originalSize=g),d.onfile(k)}return"break"}if(l){if(134695760==n)return a=s+=12+(-2==l&&8),o=3,d.c=0,"break";if(33639248==n)return a=s-=4,o=3,d.c=0,"break"}},d=this;s<u-4&&"break"!==h();++s);if(this.p=Kn,l<0){var v=c.subarray(0,o?a-12-(-2==l&&8)-(134695760==we(c,a-16)&&4):s);f?f.push(v,!!o):this.k[+(2==o)].push(v)}if(2&o)return this.push(c.subarray(s),n);this.p=c.subarray(s)}n&&(this.c&&$n(13),this.p=null)},t.prototype.register=function(t){this.o[t.compression]=t},t}(),ki="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(t){t()},Ti=Object.freeze({__proto__:null,AsyncCompress:Le,AsyncDecompress:Ye,AsyncDeflate:Me,AsyncGunzip:Be,AsyncGzip:Le,AsyncInflate:De,AsyncUnzipInflate:gi,AsyncUnzlib:Xe,AsyncZipDeflate:pi,AsyncZlib:He,Compress:Ue,DecodeUTF8:ei,Decompress:Ve,Deflate:xe,EncodeUTF8:ii,FlateErrorCode:{UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14},Gunzip:Oe,Gzip:Ue,Inflate:ze,Unzip:bi,UnzipInflate:yi,UnzipPassThrough:mi,Unzlib:Ze,Zip:wi,ZipDeflate:vi,ZipPassThrough:di,Zlib:Fe,compress:Re,compressSync:$e,decompress:function(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&$n(7),31==t[0]&&139==t[1]&&8==t[2]?je(t,n,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Pe(t,n,e):Ge(t,n,e)},decompressSync:function(t,n){return 31==t[0]&&139==t[1]&&8==t[2]?qe(t,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Ce(t,n):Ke(t,n)},deflate:Ee,deflateSync:Ae,gunzip:je,gunzipSync:qe,gzip:Re,gzipSync:$e,inflate:Pe,inflateSync:Ce,strFromU8:oi,strToU8:ri,unzip:function(t,n,e){e||(e=n,n={}),"function"!=typeof e&&$n(7);var i=[],r=function(){for(var t=0;t<i.length;++t)i[t]()},o={},s=function(t,n){ki(function(){e(t,n)})};ki(function(){s=e});for(var a=t.length-22;101010256!=we(t,a);--a)if(!a||t.length-a>65558)return s($n(13,0,1),null),r;var c=pe(t,a+8);if(c){var u=c,l=we(t,a+16),f=4294967295==l||65535==u;if(f){var h=we(t,a-12);(f=101075792==we(t,h))&&(u=c=we(t,h+32),l=we(t,h+48))}for(var d=n&&n.filter,v=function(n){var e=ci(t,l,f),a=e[0],u=e[1],h=e[2],v=e[3],p=e[4],w=ai(t,e[5]);l=p;var m=function(t,n){t?(r(),s(t,null)):(n&&(o[v]=n),--c||s(null,o))};if(!d||d({name:v,size:u,originalSize:h,compression:a}))if(a)if(8==a){var y=t.subarray(w,w+u);if(h<524288||u>.8*h)try{m(null,Ce(y,{out:new cn(h)}))}catch(t){m(t,null)}else i.push(Pe(y,{size:h},m))}else m($n(14,"unknown compression type "+a,1),null);else m(null,Ln(t,w,w+u));else m(null,null)},p=0;p<u;++p)v()}else s(null,{});return r},unzipSync:function(t,n){for(var e={},i=t.length-22;101010256!=we(t,i);--i)(!i||t.length-i>65558)&&$n(13);var r=pe(t,i+8);if(!r)return{};var o=we(t,i+16),s=4294967295==o||65535==r;if(s){var a=we(t,i-12);(s=101075792==we(t,a))&&(r=we(t,a+32),o=we(t,a+48))}for(var c=n&&n.filter,u=0;u<r;++u){var l=ci(t,o,s),f=l[0],h=l[1],d=l[2],v=l[3],p=l[4],w=ai(t,l[5]);o=p,c&&!c({name:v,size:h,originalSize:d,compression:f})||(f?8==f?e[v]=Ce(t.subarray(w,w+h),{out:new cn(d)}):$n(14,"unknown compression type "+f):e[v]=Ln(t,w,w+h))}return e},unzlib:Ge,unzlibSync:Ke,zip:function(t,n,e){e||(e=n,n={}),"function"!=typeof e&&$n(7);var i={};Je(t,"",i,n);var r=Object.keys(i),o=r.length,s=0,a=0,c=o,u=new Array(o),l=[],f=function(){for(var t=0;t<l.length;++t)l[t]()},h=function(t,n){ki(function(){e(t,n)})};ki(function(){h=e});var d=function(){var t=new cn(a+22),n=s,e=a-s;a=0;for(var i=0;i<c;++i){var r=u[i];try{var o=r.c.length;fi(t,a,r,r.f,r.u,o);var l=30+r.f.length+li(r.extra),f=a+l;t.set(r.c,f),fi(t,s,r,r.f,r.u,o,a,r.m),s+=16+l+(r.m?r.m.length:0),a=f+o}catch(t){return h(t,null)}}hi(t,s,u.length,e,n),h(null,t)};o||d();for(var v=function(t){var n=r[t],e=i[n],c=e[0],v=e[1],p=Jn(),w=c.length;p.p(c);var m=ri(n),y=m.length,g=v.comment,b=g&&ri(g),k=b&&b.length,T=li(v.extra),_=0==v.level?0:8,I=function(e,i){if(e)f(),h(e,null);else{var r=i.length;u[t]=te(v,{size:w,crc:p.d(),c:i,f:m,m:b,u:y!=n.length||b&&g.length!=k,compression:_}),s+=30+y+T+r,a+=76+2*(y+T)+(k||0)+r,--o||d()}};if(y>65535&&I($n(11,0,1),null),_)if(w<16e4)try{I(null,Ae(c,v))}catch(t){I(t,null)}else l.push(Ee(c,v,I));else I(null,c)},p=0;p<c;++p)v(p);return f},zipSync:function(t,n){n||(n={});var e={},i=[];Je(t,"",e,n);var r=0,o=0;for(var s in e){var a=e[s],c=a[0],u=a[1],l=0==u.level?0:8,f=(_=ri(s)).length,h=u.comment,d=h&&ri(h),v=d&&d.length,p=li(u.extra);f>65535&&$n(11);var w=l?Ae(c,u):c,m=w.length,y=Jn();y.p(c),i.push(te(u,{size:c.length,crc:y.d(),c:w,f:_,m:d,u:f!=s.length||d&&h.length!=v,o:r,compression:l})),r+=30+f+p+m,o+=76+2*(f+p)+(v||0)+m}for(var g=new cn(o+22),b=r,k=o-r,T=0;T<i.length;++T){var _;fi(g,(_=i[T]).o,_,_.f,_.u,_.c.length);var I=30+_.f.length+li(_.extra);g.set(_.c,_.o+I),fi(g,r,_,_.f,_.u,_.c.length,_.o,_.m),r+=16+I+(_.m?_.m.length:0)}return hi(g,r,i.length,k,b),g},zlib:function(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&$n(7),he(t,n,[oe,ce,function(){return[Ne]}],function(t){return le(Ne(t.data[0],t.data[1]))},4,e)},zlibSync:Ne});t.createSession=async function(t,n){const e=n?.apiURL??"https://falcon-ingest-k8s.stage.incodetest.com",i=n?.timeout??1e4,r=new AbortController;let o=null,s=0,a=()=>{};i&&(o=f(()=>{s=1,r.abort()},i));const c=n?.signal;if(c)if(c.aborted)r.abort();else{const t=()=>r.abort();c.addEventListener("abort",t,{once:1}),a=()=>c.removeEventListener("abort",t)}try{const n=await fetch(`${e}/api/v1/sdk/init`,{method:"POST",headers:{"content-type":"application/json","x-api-key":t,"x-api-version":"1.0"},signal:r.signal});if(!n.ok){let t=n.statusText;try{const e=await n.json();e.errorMessage&&(t=e.errorMessage)}catch{}return{token:null,eventsCollectionEnabled:0,error:{status:n.status,message:t}}}return await n.json()}catch(t){throw new Error((s?"[TRI] createSession timed out":"[TRI] Failed to create session:")+" "+t.message)}finally{h(o),a()}},t.default=sn,Object.defineProperty(t,"qt",{value:1})});
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).IncodeTRI={})}(this,function(t){"use strict";class n{constructor(){this.T=!1}static get instance(){return n.S||(n.S=new n),n.S}get DEBUG(){return this.T}set DEBUG(t){this.T=t}warn(t,n,...e){this.T&&this._("warn",t,n,...e)}error(t,n,...e){this.T&&this._("error",t,n,...e)}info(t,n,...e){this.T&&this._("info",t,n,...e)}fatal(t,n,e,...i){this._(t,n,e,...i)}_(t,n,e,...i){const r=n?`[${n}]`:"",o=console?.[t];o&&o(`[IncodeTRI]${r} ${e}`,...i)}}const e=n.instance;function i(t,n,e){let i=t,r=n;if("devicepixelratiochange"===n){const t=window.devicePixelRatio;i=window.matchMedia(`(resolution: ${t}dppx)`),r="change"}i.addEventListener(r,e,{capture:!0,passive:!0})}function r(t,n,e){let i=t,r=n;if("devicepixelratiochange"===n){const t=window.devicePixelRatio;i=window.matchMedia(`(resolution: ${t}dppx)`),r="change"}i.removeEventListener(r,e,{capture:!0})}const o=globalThis.setTimeout.bind(globalThis),s=globalThis.clearTimeout.bind(globalThis);function a(t,n){try{return t()}catch(t){e.warn("utils","safeSync swallowed error:",t)}}async function c(t){try{return await t()}catch(t){e.warn("utils","safeAsync swallowed error:",t)}}function u(t){return n=>a(()=>t(n))}function l(t){return(...n)=>{try{t(...n)}catch(t){e.warn("utils","safeTimer swallowed error:",t)}}}function f(t,n){return o(l(t),n)}function h(t){if(null!==t)try{s(t)}catch(t){e.warn("utils","safeClearTimeout swallowed error:",t)}}const d=new Set(["xmlhttprequest","fetch","beacon","navigation","script","link","css","img","iframe","video","audio"]),v=new Set(["xmlhttprequest","fetch","beacon"]);function p(t,n){return n?t:null}function w(t,n){const e=t,i=t.responseStart>0,r=p(t.domainLookupEnd-t.domainLookupStart,i),o=p(t.connectEnd-t.connectStart,i),s=p(t.connectEnd>0&&t.secureConnectionStart>0?t.connectEnd-t.secureConnectionStart:0,i),a=p(t.responseStart-t.requestStart,i),c=p(t.responseEnd-t.responseStart,i),u=i?t.transferSize:null,l=i?t.encodedBodySize:null,f=i?t.decodedBodySize:null,h=i&&t.nextHopProtocol||null,v=i&&void 0!==e.deliveryType?e.deliveryType:null,w=e.responseStatus,m=void 0!==w&&0!==w?w:null;return{name:"network_request",timestamp:Date.now(),performanceTime:t.startTime+t.duration,url:n(t.name),initiatorType:(y=t.initiatorType,d.has(y)?y:"other"),startTime:t.startTime,durationMs:t.duration,dnsLookupMs:r,tcpConnectMs:o,tlsHandshakeMs:s,ttfbMs:a,responseDownloadMs:c,transferSize:u,encodedBodySize:l,decodedBodySize:f,nextHopProtocol:h,deliveryType:v,responseStatus:m};var y}function m(){}const y=2e3;function g(t){return!!t&&t.nodeType===Node.TEXT_NODE}function b(t,n){return t.tagName?.toLowerCase()===n.toLowerCase()}function k(t){return!!t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function T(t){return!!t&&t.hasAttribute("data-tri-ignore")}function S(t){return!!t&&t.hasAttribute("data-tri-redact")}function x(t,n){return n?.includes(t.toLowerCase())??!1}function I(t){try{return new URL(t).origin!==window.location.origin}catch{return!1}}function _(t,n){return!t||(t[n]?.enabled??!1)}function M(){const t=document.activeElement;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){const n=t.selectionStart,e=t.selectionEnd;return null==n||null==e||n===e?null:t.value.substring(n,e)}const n=window.getSelection();return!n||n.isCollapsed?null:n.toString()||null}function E(t,n){return"off"!==n&&!T(t)&&!S(t)}function A(t){const n=document.activeElement;if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)return n;const e=window.getSelection();return(i=("start"===t?e?.anchorNode:e?.focusNode)??null)?g(i)?i.parentElement:i instanceof Element?i:null:null;var i}function z(){const t=window,n="__fpjs_p_l_b",e=t[n];if(function(t,n){var e;const i=null===(e=Object.getOwnPropertyDescriptor)||void 0===e?void 0:e.call(Object,t,n);(null==i?void 0:i.configurable)?delete t[n]:i&&!i.writable||(t[n]=void 0)}(t,n),"function"!=typeof(null==e?void 0:e.load))throw new Error($);return e}const D="Blocked by CSP",C="The endpoint parameter is not a valid URL";function U(t){return function(t,n){const e=document,i="securitypolicyviolation";let r;const o=n=>{const e=new URL(t,location.href),{blockedURI:i}=n;i!==e.href&&i!==e.protocol.slice(0,-1)&&i!==e.origin||(r=n,s())};e.addEventListener(i,o);const s=()=>e.removeEventListener(i,o);return Promise.resolve().then(n).then(t=>(s(),t),t=>new Promise(t=>{const n=new MessageChannel;n.port1.onmessage=()=>t(),n.port2.postMessage(null)}).then(()=>{if(s(),r)return(()=>{throw new Error(D)})();throw t}))}(t,()=>function(t){return new Promise((n,e)=>{if(function(t){if(URL.prototype)try{return new URL(t,location.href),!1}catch(t){if(t instanceof Error&&"TypeError"===t.name)return!0;throw t}}(t))throw new Error(C);const i=document.createElement("script"),r=()=>{var t;return null===(t=i.parentNode)||void 0===t?void 0:t.removeChild(i)},o=document.head||document.getElementsByTagName("head")[0];i.onload=()=>{r(),n()},i.onerror=()=>{r(),e(new Error(R))},i.async=!0,i.src=t,o.appendChild(i)})}(t)).then(z)}const L="API key required";var P="3.12.9";const R="Failed to load the JS script of the agent",$="9319",O={scriptUrl:"https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js"};function B(t){function n(){return globalThis.window&&globalThis.window[t]&&void 0!==globalThis.window[t]}return{get:function(e){if(!n())return null;try{const n=window[t].getItem(e)??"null";return"null"===n?null:JSON.parse(n)}catch{return null}},set:function(e,i){n()&&a(()=>window[t].setItem(e,JSON.stringify(i)))},remove:function(e){n()&&a(()=>window[t].removeItem(e))},key:function(e){return n()?window[t].key(e):null},get length(){return n()?window[t].length:0}}}const j=B("localStorage"),q=B("sessionStorage"),F="__tri_fingerprint";let H=null,N=null;async function Z(t){try{const n=await function(t){return H||(H=function(t){var n,e;const{picked:i,rest:r}=function(t,n){const e={},i={};for(const[r,o]of Object.entries(t))n.includes(r)?e[r]=o:i[r]=o;return{picked:e,rest:i}}(t,["scriptUrlPattern","token","apiKey"]),o=null!==(n=i.apiKey)&&void 0!==n?n:i.token,s=null!==(e=function(t,n){return function(t,n){return Object.prototype.hasOwnProperty.call(t,n)}(t,n)?t[n]:void 0}(t,"scriptUrlPattern"))&&void 0!==e?e:O.scriptUrl,[a,c]=function(){const t=[],n=()=>{t.push({time:new Date,state:document.visibilityState})},e=((i=document).addEventListener("visibilitychange",r=n,o),()=>i.removeEventListener("visibilitychange",r,o));var i,r,o;return n(),[t,e]}();return Promise.resolve().then(()=>{if(!o||"string"!=typeof o)throw new Error(L);return function(t,n){const e=[],[i,r]=function(t){const n=function(t){const n=[...t];return{current:()=>n[0],postpone(){const t=n.shift();void 0!==t&&n.push(t)},exclude(){n.shift()}}}(t),e=function(){let t=0;return()=>Math.random()*Math.min(3e3,100*Math.pow(2,t++))}(),i=new Set;return[n.current(),(t,r)=>{let o;const s=r instanceof Error?r.message:"";if(s===D||s===C)n.exclude(),o=0;else if(s===$)n.exclude();else if(s===R){const e=Date.now()-t.getTime()<50,r=n.current();r&&e&&!i.has(r)&&(i.add(r),o=0),n.postpone()}else n.postpone();const a=n.current();return void 0===a?void 0:[a,null!=o?o:t.getTime()+e()-Date.now()]}]}(t);let o;if(void 0===i)return Promise.reject(new TypeError("The list of script URL patterns is empty"));const s=t=>{const i=new Date,a=n=>e.push({url:t,startedAt:i,finishedAt:new Date,error:n}),c=n(t);return c.then(()=>a(),a),c.catch(t=>{if(null!=o||(o=t),e.length>=5)throw o;const n=r(i,t);if(!n)throw o;const[a,c]=n;return(u=c,new Promise(t=>setTimeout(t,u))).then(()=>s(a));var u})};return s(i).then(t=>[t,e])}(function(t,n){return(Array.isArray(t)?t:[t]).map(t=>function(t,n){const e=encodeURIComponent;return t.replace(/<[^<>]+>/g,t=>"<version>"===t?"3":"<apiKey>"===t?e(n):"<loaderVersion>"===t?e(P):t)}(String(t),n))}(s,o),U)}).catch(t=>{throw c(),function(t){return t instanceof Error&&t.message===$?new Error(R):t}(t)}).then(([t,n])=>(c(),t.load({...r,ldi:{attempts:n,visibilityStates:a}})))}({apiKey:t.apiKey,region:t.region,endpoint:t.endpoint,scriptUrlPattern:t.scriptUrlPattern}).catch(t=>{throw H=null,t}),H)}(t),e=await n.get({timeout:t.timeoutMs,extendedResult:!0});if(!e.visitorId)return null;const i=t.cacheTtlMs??2592e6;return i>0&&function(t,n,e){const i={visitorId:t,requestId:n,expiresAt:Date.now()+e};j.set(F,i)}(e.visitorId,e.requestId,i),{visitorId:e.visitorId,requestId:e.requestId}}catch{return null}}const X={apiKey:"5uYRiI0XM6p8k4124ELX",endpoint:"https://fingerprint.incodesmile.com",scriptUrlPattern:"https://fingerprint.incodesmile.com/web/v<version>/<apiKey>/loader_v<loaderVersion>.js"},G={focusin:"in",focusout:"out"};function K(t){return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement}const V=new Set(["Shift","Control","Alt","Meta","Backspace","Delete","Enter","Tab","CapsLock","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]),Y={mouse:"mouse",touch:"touch",pen:"pen"},J={pointerdown:"down",pointerup:"up",click:"click",dblclick:"dblclick",contextmenu:"contextmenu"};function Q(t,n,e,i,r){return{name:"navigation",timestamp:Date.now(),phase:t,type:n,from:e.from,to:e.to,timeOrigin:i,timing:r}}const W={fingerprint:{create:function(t){let n=!1;return c(async()=>{const e=await async function(t){const n=function(){const t=j.get(F);return t?"string"!=typeof t.visitorId||"number"!=typeof t.expiresAt||t.expiresAt<=Date.now()?(j.remove(F),null):{visitorId:t.visitorId,requestId:"string"==typeof t.requestId?t.requestId:""}:null}();return n?{visitorId:n.visitorId,requestId:n.requestId||null}:N||(N=Z(t).finally(()=>{N=null}),N)}(X);!n&&e&&t.push({name:"fingerprint",deviceId:e.visitorId,requestId:e.requestId,timestamp:Date.now()})}),()=>{n=!0}},layer:"device-fingerprinting"},pointer:{create:function(t,n,e){const o=u(n=>{const e=function(n){const e=n,i=function(t){if("mouse"===t.pointerType)return{button:t.button,buttons:t.buttons};const n={force:t.pressure,contact:Math.min(t.width,t.height)};return"pen"===t.pointerType&&(n.tiltX=t.tiltX,n.tiltY=t.tiltY,n.twist=t.twist),n}(e);return{id:e.pointerId,name:"pointer",timestamp:Date.now(),type:Y[e.pointerType]??"unknown",phase:J[n.type],isTrusted:e.isTrusted,element:t.resolveElement(e.target),isPrimary:e.isPrimary,modifiers:{shift:e.shiftKey,ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey},coordinates:{x:e.clientX,y:e.clientY},...i}}(n);t.push(e)});return _(e,"pointer")&&(i(document,"pointerdown",o),i(document,"pointerup",o)),_(e,"click")&&i(document,"click",o),_(e,"dblclick")&&i(document,"dblclick",o),_(e,"contextmenu")&&i(document,"contextmenu",o),()=>{r(document,"pointerdown",o),r(document,"pointerup",o),r(document,"click",o),r(document,"dblclick",o),r(document,"contextmenu",o)}},layer:"behavioral",events:["pointer","click","dblclick","contextmenu"]},pointermove:{create:function(t){let n=null,e=null;const o=u(e=>{const i=e;return n&&n.id!==i.pointerId&&(t.push(n),n=null),n?n.samples.ts.length>=50?(t.push(n),n=s(i),void a(t)):(n.samples.x.push(i.clientX),n.samples.y.push(i.clientY),n.samples.ts.push(i.timeStamp),"pen"===i.pointerType&&(n.samples.tiltX?.push(i.tiltX),n.samples.tiltY?.push(i.tiltY)),"mouse"!==i.pointerType&&(n.samples.force?.push(i.pressure),n.samples.radius?.push(Math.max(i.width,i.height))),void a(t)):(n=s(i),void a(t))});function s(t){const n=function(t){if("mouse"===t.pointerType)return null;const n={force:[t.pressure],radius:[Math.max(t.width,t.height)]};return"pen"===t.pointerType&&(n.tiltX=[t.tiltX],n.tiltY=[t.tiltY]),n}(t);return{name:"pointer",timestamp:Date.now(),id:t.pointerId,type:t.pointerType,phase:"move",isTrusted:t.isTrusted,isPrimary:t.isPrimary,samples:{x:[t.clientX],y:[t.clientY],ts:[t.timeStamp],...n??{}}}}function a(t){e&&clearTimeout(e),e=setTimeout(()=>{n&&(t.push(n),n=null),e=null},y)}return i(document,"pointermove",o),()=>{r(document,"pointermove",o),e&&(clearTimeout(e),e=null),n&&(t.push(n),n=null)}},layer:"behavioral"},focus:{create:function(t){const n=u(n=>{const e=function(n){const e=n;return{name:"focus",type:G[n.type]??"unknown",timestamp:Date.now(),isTrusted:e.isTrusted,element:t.resolveElement(e.target),relatedTarget:t.resolveElement(e.relatedTarget)}}(n);t.push(e)});return i(document,"focusin",n),i(document,"focusout",n),()=>{r(document,"focusin",n),r(document,"focusout",n)}},layer:"behavioral"},input:{create:function(t){const n=u(n=>{const e=n;t.push(function(n){return{name:"keystroke",type:"input",timestamp:Date.now(),isTrusted:n.isTrusted,element:t.resolveElement(n.target),inputType:n.inputType??"",isComposing:n.isComposing??!1,length:(e=n.target,e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?e.value.length:0)};var e}(e)),function(t){if("insertReplacementText"===t.inputType)return!0;const n=t.target;return!!K(n)&&function(t){try{return t.matches(":-webkit-autofill")}catch{return!1}}(n)}(e)&&t.push(function(t,n){const e=t.target;let i=0;return K(e)&&(i=e.value.length),{name:"autofill",timestamp:Date.now(),element:n.resolveElement(e),length:i}}(e,t))});return i(document,"input",n),function(){r(document,"input",n)}},layer:"behavioral"},keystroke:{create:function(t){const{resolve:n,reset:e}=function(){let t=0;const n=new Map;return{resolve:function(e,i){if("keydown"===i){const i=n.get(e);if(void 0!==i)return i;const r=++t;if(n.size>=32){const t=n.keys().next().value;void 0!==t&&n.delete(t)}return n.set(e,r),r}const r=n.get(e);return void 0!==r?(n.delete(e),r):++t},reset:function(){n.clear()}}}(),o=u(e=>{const i=function(t){const e=t,i=t.type;return{name:"keystroke",type:i,id:n(e.code,i),timestamp:Date.now(),isTrusted:e.isTrusted,keys:V.has(e.key)?[e.key]:[]}}(e);t.push(i)}),s=u(()=>{e()});return i(document,"keydown",o),i(document,"keyup",o),i(window,"blur",s),()=>{r(document,"keydown",o),r(document,"keyup",o),r(window,"blur",s)}},layer:"behavioral"},clipboard:{create:function(t,n="on",e){const o=u(e=>{const i=function(e){const i=e,r=e.type,o=("paste"===e.type?i.clipboardData?.getData("text/plain"):M())??null,s=E(i.target,n);return{name:"clipboard",type:r,timestamp:Date.now(),isTrusted:i.isTrusted,element:t.resolveElement(i.target),length:o?.length??0,...s&&o?{content:o}:{}}}(e);t.push(i)});return _(e,"paste")&&i(document,"paste",o),_(e,"cut")&&i(document,"cut",o),_(e,"copy")&&i(document,"copy",o),()=>{r(document,"paste",o),r(document,"cut",o),r(document,"copy",o)}},layer:"behavioral",events:["paste","cut","copy"]},form:{create:function(t,n,e){const o=u(n=>{const e={name:"form",type:(i=n).type,timestamp:Date.now(),isTrusted:i.isTrusted,element:t.resolveElement(i.target)};var i;t.push(e)});return _(e,"submit")&&i(document,"submit",o),_(e,"invalid")&&i(document,"invalid",o),()=>{r(document,"submit",o),r(document,"invalid",o)}},layer:"behavioral",events:["submit","invalid"]},change:{create:function(t){const n=u(n=>{const e=(i=n,{name:"change",timestamp:Date.now(),isTrusted:i.isTrusted,element:t.resolveElement(i.target)});var i;t.push(e)});return i(document,"change",n),()=>{r(document,"change",n)}},layer:"behavioral"},selection:{create:function(t,n){let e=!1,o=0,s=null,a=!1,c=!1;function l(){s&&(clearTimeout(s),s=null)}function f(){l(),a||c||(s=setTimeout(()=>{s=null,e&&h("timeout")},250))}function h(i){e&&(e=!1,l(),function(e){const i=A("end"),r=i&&E(i,n),o=M();t.push({name:"selection",phase:"end",timestamp:Date.now(),trigger:e,isTrusted:!0,element:t.resolveElement(i),length:o?.length??0,...r&&o?{content:o}:{}})}(i))}const d=u(()=>{const n=function(){const t=document.getSelection();return!t||t.isCollapsed||0===t.rangeCount}();if(!e&&!n)return e=!0,o=Date.now(),t.push({name:"selection",phase:"start",timestamp:o,element:t.resolveElement(A("start"))}),void f();e&&n?h("collapse"):e&&f()}),v=u(t=>{0===t.button&&(a=!0,l())}),p=u(t=>{0===t.button&&(a=!1,e&&h("pointer"))}),w=u(t=>{"Shift"===t.key&&(c=!0,l())}),m=u(t=>{"Shift"===t.key&&(c=!1,e&&h("keyboard"))}),y=u(()=>{a=!1}),g=u(()=>{"hidden"===document.visibilityState&&(a=!1,c=!1,e&&h("timeout"))}),b=u(()=>{a=!1,e&&h("pointer")});return i(document,"selectionchange",d),i(document,"pointerdown",v),i(document,"pointerup",p),i(document,"keydown",w),i(document,"keyup",m),i(document,"contextmenu",y),i(document,"visibilitychange",g),i(document,"dragend",b),()=>{l(),r(document,"selectionchange",d),r(document,"pointerdown",v),r(document,"pointerup",p),r(document,"keydown",w),r(document,"keyup",m),r(document,"contextmenu",y),r(document,"visibilitychange",g),r(document,"dragend",b)}},layer:"behavioral"},tab:{create:()=>()=>{},layer:"session",events:["state","count"]},visibility:{create:function(t){const n=u(n=>{const e=document.visibilityState;if("visible"!==e&&"hidden"!==e)return;const i={name:"visibility",type:e,timestamp:Date.now(),isTrusted:n.isTrusted};t.push(i)});return i(document,"visibilitychange",n),()=>{r(document,"visibilitychange",n)}},layer:"session"},navigation:{create:function(t){let n=t.sanitizeUrl(document.referrer||"");function e(e){t.push(e),n=e.to??""}const o=u(()=>{const[n]=performance.getEntriesByType("navigation");var i;e(Q("load",n?.type??"navigate",{from:document.referrer?t.sanitizeUrl(document.referrer):null,to:t.sanitizeUrl(location.href)},performance.timeOrigin,n?{fetchStart:(i=n).fetchStart,domainLookupStart:i.domainLookupStart,domainLookupEnd:i.domainLookupEnd,connectStart:i.connectStart,connectEnd:i.connectEnd,requestStart:i.requestStart,responseStart:i.responseStart,responseEnd:i.responseEnd,domInteractive:i.domInteractive,domContentLoadedEventStart:i.domContentLoadedEventStart,domContentLoadedEventEnd:i.domContentLoadedEventEnd,domComplete:i.domComplete,loadEventStart:i.loadEventStart,loadEventEnd:i.loadEventEnd,redirectCount:i.redirectCount,transferSize:i.transferSize,encodedBodySize:i.encodedBodySize,decodedBodySize:i.decodedBodySize}:void 0))}),s=u(i=>{const r=i;if(null===r.navigationType)return;const o=t.sanitizeUrl(location.href);o!==n&&e(Q("change",r.navigationType,{from:n,to:o},performance.timeOrigin))}),c=u(()=>f("traverse")),l=u(()=>f("hashchange"));function f(i){const r=t.sanitizeUrl(location.href);"hashchange"===i&&r===n||e(Q("change",i,{from:n,to:r},performance.timeOrigin))}const h=history.pushState,d=history.replaceState,v=function(...t){const n=h.apply(this,t);return a(()=>f("push")),n},p=function(...t){const n=d.apply(this,t);return a(()=>f("replace")),n};return window.navigation?i(window.navigation,"currententrychange",s):(history.pushState=v,history.replaceState=p,i(window,"popstate",c),i(window,"hashchange",l)),"complete"===document.readyState?o(new Event("load")):i(window,"load",o),()=>{window.navigation?r(window.navigation,"currententrychange",s):(history.pushState===v&&(history.pushState=h),history.replaceState===p&&(history.replaceState=d),r(window,"popstate",c),r(window,"hashchange",l)),r(window,"load",o)}},layer:"session"},networkconnection:{create:function(t){const n=u(()=>{const n={name:"network",type:"connection",state:navigator.onLine?"online":"offline",timestamp:Date.now()};t.push(n)});return i(window,"online",n),i(window,"offline",n),()=>{r(window,"online",n),r(window,"offline",n)}},layer:"session"},scroll:{create:function(t){let n=null,e=null;const o=u(e=>n?n.samples.ts.length>=50?(t.push(n),n=s(e),void a(t)):(n.samples.x.push(window.scrollX),n.samples.y.push(window.scrollY),n.samples.ts.push(e.timeStamp),void a(t)):(n=s(e),void a(t)));function s(t){return{name:"scroll",timestamp:Date.now(),samples:{x:[window.scrollX],y:[window.scrollY],ts:[t.timeStamp]},height:window.innerHeight,width:window.innerWidth,scrollX:window.scrollX,scrollY:window.scrollY,pageX:window.pageXOffset,pageY:window.pageYOffset}}function a(t){e&&clearTimeout(e),e=setTimeout(()=>{n&&(t.push(n),n=null),e=null},y)}return i(window,"scroll",o),()=>{r(window,"scroll",o),e&&(clearTimeout(e),e=null),n&&(t.push(n),n=null)}},layer:"behavioral"},viewportresize:{create:function(t){let n=null,e=null;const o=u(e=>n?n.samples.ts.length>=50?(t.push(n),n=s(e),void a(t)):(n.samples.height.push(window.innerHeight),n.samples.width.push(window.innerWidth),n.samples.ts.push(e.timeStamp),n.samples.scrollX.push(window.scrollX),n.samples.scrollY.push(window.scrollY),n.samples.dpr.push(window.devicePixelRatio),void a(t)):(n=s(e),void a(t)));function s(t){return{name:"viewport",type:"resize",timestamp:Date.now(),samples:{height:[window.innerHeight],width:[window.innerWidth],ts:[t.timeStamp],scrollX:[window.scrollX],scrollY:[window.scrollY],dpr:[window.devicePixelRatio]}}}function a(t){e&&clearTimeout(e),e=setTimeout(()=>{n&&(t.push(n),n=null),e=null},y)}return i(window,"resize",o),()=>{r(window,"resize",o),e&&(clearTimeout(e),e=null),n&&(t.push(n),n=null)}},layer:"behavioral"},viewport:{create:function(t,n,e){const o=u(n=>{const e=a(n,"orientation");t.push(e)}),s=u(n=>{const e=a(n,"ratiochange");t.push(e)});function a(t,n){return{name:"viewport",type:n,timestamp:Date.now(),isTrusted:t.isTrusted,height:window.innerHeight,width:window.innerWidth,scrollX:window.scrollX,scrollY:window.scrollY,dpr:window.devicePixelRatio}}return _(e,"orientationchange")&&i(window,"orientationchange",o),_(e,"devicepixelratiochange")&&i(window,"devicepixelratiochange",s),()=>{r(window,"orientationchange",o),r(window,"devicepixelratiochange",s)}},layer:"behavioral",events:["orientationchange","devicepixelratiochange"]},sensors:{create:function(t,n,e){let o=null,s=null,a=null,c=null,f=!1;function d(){c&&h(c),c=setTimeout(l(()=>{v(),c=null}),y)}function v(){o&&(t.push(o),o=null),s&&(t.push(s),s=null),a&&(t.push(a),a=null)}const p=u(n=>{const e=n,i=e.timeStamp,r=e.acceleration,s=e.accelerationIncludingGravity,a=e.rotationRate;if(!r&&!s&&!a||null===r?.x&&null===r?.y&&null===r?.z&&null===s?.x&&null===s?.y&&null===s?.z&&null===a?.alpha&&null===a?.beta&&null===a?.gamma)return;if(!o)return o={name:"sensors",type:"motion",timestamp:Date.now(),interval:e.interval??null,samples:{ax:[r?.x??0],ay:[r?.y??0],az:[r?.z??0],agx:[s?.x??0],agy:[s?.y??0],agz:[s?.z??0],rrAlpha:[a?.alpha??0],rrBeta:[a?.beta??0],rrGamma:[a?.gamma??0],ts:[i]}},void d();if(o.samples.ts.length>=50)return t.push(o),o={name:"sensors",type:"motion",timestamp:Date.now(),interval:e.interval??null,samples:{ax:[r?.x??0],ay:[r?.y??0],az:[r?.z??0],agx:[s?.x??0],agy:[s?.y??0],agz:[s?.z??0],rrAlpha:[a?.alpha??0],rrBeta:[a?.beta??0],rrGamma:[a?.gamma??0],ts:[i]}},void d();const c=o.samples;c.ax.push(r?.x??0),c.ay.push(r?.y??0),c.az.push(r?.z??0),c.agx.push(s?.x??0),c.agy.push(s?.y??0),c.agz.push(s?.z??0),c.rrAlpha.push(a?.alpha??0),c.rrBeta.push(a?.beta??0),c.rrGamma.push(a?.gamma??0),c.ts.push(i),d()}),w=u(n=>{const e=n;if(null==e.alpha&&null==e.beta&&null==e.gamma)return;const i=e.timeStamp,r=e.webkitCompassHeading??0;if(!s)return s={name:"sensors",type:"orientation",timestamp:Date.now(),absolute:f||e.absolute,samples:{alpha:[e.alpha??0],beta:[e.beta??0],gamma:[e.gamma??0],compassHeading:[r],ts:[i]}},void d();if(s.samples.ts.length>=50)return t.push(s),s={name:"sensors",type:"orientation",timestamp:Date.now(),absolute:f||e.absolute,samples:{alpha:[e.alpha??0],beta:[e.beta??0],gamma:[e.gamma??0],compassHeading:[r],ts:[i]}},void d();const o=s.samples;o.alpha.push(e.alpha??0),o.beta.push(e.beta??0),o.gamma.push(e.gamma??0),o.compassHeading.push(r),o.ts.push(i),d()}),m=u(n=>{const e=n.value;if(null==e)return;const i=n.timeStamp;return a?a.samples.ts.length>=50?(t.push(a),a={name:"sensors",type:"light",timestamp:Date.now(),samples:{lux:[e],ts:[i]}},void d()):(a.samples.lux.push(e),a.samples.ts.push(i),void d()):(a={name:"sensors",type:"light",timestamp:Date.now(),samples:{lux:[e],ts:[i]}},void d())});return _(e,"motion")&&i(window,"devicemotion",p),_(e,"orientation")&&("ondeviceorientationabsolute"in window?(f=!0,i(window,"deviceorientationabsolute",w)):i(window,"deviceorientation",w)),_(e,"light")&&i(window,"devicelight",m),function(){r(window,"devicemotion",p),r(window,f?"deviceorientationabsolute":"deviceorientation",w),r(window,"devicelight",m),c&&(h(c),c=null),v()}},layer:"behavioral",events:["motion","orientation","light"]},"network-request":{create:function(t){var n;const i=function(t,n,i,r=v){if("undefined"==typeof PerformanceObserver)return m;let o=null;try{o=new PerformanceObserver(e=>{for(const o of e.getEntries()){const e=o;r.has(e.initiatorType)&&(n(e.name)||t(w(e,i)))}}),o.observe({type:"resource",buffered:!0})}catch{return e.warn("network-request","PerformanceObserver failed to start"),m}return function(){o?.disconnect(),o=null}}(function(n){a(()=>t.push(n))},(n=t.ignoredOrigins,function(t){try{return n.has(new URL(t).origin)}catch{return!1}}),t.sanitizeUrl);return function(){i()}},layer:"session"},screen:{create:function(t){const n=a(()=>function(){const t=window.screen;return{name:"screen",timestamp:Date.now(),availWidth:t.availWidth,availHeight:t.availHeight,width:t.width,height:t.height,colorDepth:t.colorDepth,pixelDepth:t.pixelDepth,availLeft:t.availLeft??0,availTop:t.availTop??0,orientation:t.orientation?{type:t.orientation.type,angle:t.orientation.angle}:null,isExtended:t.isExtended??!1,viewport:{height:window.innerHeight,width:window.innerWidth,scrollX:window.scrollX,scrollY:window.scrollY,dpr:window.devicePixelRatio}}}());return n&&t.push(n),()=>{}},layer:"session"}},tt=Object.keys(W),nt=[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,/^0b[01]+$/i,/^0o[0-7]+$/i,/^0x[0-9a-f]+$/i,/^[a-z][a-z0-9]{1,12}:[A-Za-z0-9+/=_-]{6,}$/i,/^[a-z]{2,8}_(?=.*\d)[A-Za-z0-9]{3,}$/,/^\d{4,}$/,/@/,/^[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{10,}$/,/^[A-Za-z0-9_-]{20,}={0,2}$/,/^[0-9a-f]{7,}$/i];function et(t){try{const n=new URL(t,location.href);n.username="",n.password="",n.hash="";const e=[...n.searchParams.keys()],i=e.length>0?"?"+e.map(t=>`${encodeURIComponent(t)}=<redacted>`).join("&"):"";n.search="",n.pathname=n.pathname.split("/").map(t=>""!==t&&function(t){for(const n of nt)if(n.test(t))return!0;return!1}(t)?":param":t).join("/");const r=n.origin+n.pathname+i;return r.length>2048?r.slice(0,2048):r}catch{return""}}const it="idle",rt="ready",ot="collection-disabled",st="init-failed",at={flush:{intervalMs:2e3,maxIntervalMs:3e4,size:50,backoffFailureThreshold:2},queue:{size:100}};function ct(){const t={};for(const n of tt)t[n]=ft(n,void 0,!0);return t}function ut(t){const n={};for(const e of tt)n[e]=ft(e,void 0,t[W[e].layer]??!1);return n}function lt(t){const n={};for(const e of tt){const i=t[e];n[e]=ft(e,i,i?.enabled??!1)}return n}function ft(t,n,e){const i=W[t]?.events??[];if(0===i.length)return{enabled:e};const r=n?.events,o={};for(const t of i)o[t]={enabled:r?.[t]??!0};return{enabled:e,events:o}}function ht(t){if(!t)return null;const n=t.split(".")[1],e=atob(n.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(e)}const dt=function(t,n=30){if(!t)return!0;const e=ht(t);return!e||"number"!=typeof e.exp||1e3*e.exp<=Date.now()+1e3*n};async function vt(t,n){return globalThis.navigator&&"locks"in globalThis.navigator&&"request"in globalThis.navigator.locks&&"query"in globalThis.navigator.locks?navigator.locks.request(t,{mode:"exclusive"},async()=>c(n)):c(n)}const pt="__tri",wt=`${pt}_activity_token`,mt=`${pt}_activity_id`,yt=`${pt}_activity_status`,gt="__tri_activity_lock";class bt{constructor(t){this.context=t,this.M=null,this.A=null,this.D=null,this.C=null,this.U=!1}getToken(){return this.M}getActivityId(){return this.A??""}isActive(){return"ACTIVE"===this.D&&null!==this.M}async start(){return this.U=!0,this.C||(this.C=this.L()),this.C}async stop(){this.U=!1,this.P(null),this.C=null,this.M&&await this.context.stopActivity(),this.R(null)}async refresh(){if(!this.U)return;const t=this.M;await vt(gt,async()=>{if(this.M&&this.M!==t&&!dt(this.M)&&"ACTIVE"===this.D)return;const n=this.$();n&&n.token!==t&&!dt(n.token)&&"ACTIVE"===n.activityStatus?this.R(n):(this.O(),await this.B())})}async L(){try{if(this.M&&!dt(this.M))return;await vt(gt,async()=>{await this.B()})}finally{this.C=null}}async B(){const t=this.$();if(t&&!dt(t.token)&&"ACTIVE"===t.activityStatus)return void this.R(t);t&&this.O();const n=await this.context.startActivity();if(!n.ok)return;if(!n.data.token)return;const e=n.data;this.R(e),this.j(e)}$(){const[t,n,e]=[j.get(wt),j.get(mt),j.get(yt)];return t&&n&&e?{token:t,activityId:n,activityStatus:e}:((t||n||e)&&this.O(),null)}j(t){j.set(wt,t.token),j.set(mt,t.activityId),j.set(yt,t.activityStatus)}O(){this.P(null),this.R(null)}P(t){if(!t)return j.remove(wt),j.remove(mt),void j.remove(yt);j.set(wt,t.token),j.set(mt,t.activityId),j.set(yt,t.activityStatus)}R(t){if(!t)return this.M=null,this.A=null,void(this.D=null);this.M=t.token,this.A=t.activityId,this.D=t.activityStatus}}const kt=[401,403,409],Tt=Object.freeze({tab:80,navigation:80,visibility:80,network:80,screen:80,fingerprint:80,pointer:60,keystroke:60,autofill:60,change:60,form:60,clipboard:60,selection:60,focus:60,viewport:60,network_request:60,scroll:40,sensors:40});function St(t){return"pointer"===t.name&&"move"===t.phase||"viewport"===t.name&&"resize"===t.type?40:Tt[t.name]}const xt=new Array(256);for(let t=0;t<256;t++)xt[t]=(t+256).toString(16).slice(1);const It=new Uint8Array(16);function _t(t){return xt[t[0]]+xt[t[1]]+xt[t[2]]+xt[t[3]]+"-"+xt[t[4]]+xt[t[5]]+"-"+xt[t[6]]+xt[t[7]]+"-"+xt[t[8]]+xt[t[9]]+"-"+xt[t[10]]+xt[t[11]]+xt[t[12]]+xt[t[13]]+xt[t[14]]+xt[t[15]]}function Mt(){return crypto.randomUUID()}function Et(){return crypto.getRandomValues(It),It[6]=15&It[6]|64,It[8]=63&It[8]|128,_t(It)}function At(){for(let t=0;t<16;t++)It[t]=256*Math.random()|0;return It[6]=15&It[6]|64,It[8]=63&It[8]|128,_t(It)}const zt=function(){if("undefined"!=typeof crypto){if("function"==typeof crypto.randomUUID)return Mt;if("function"==typeof crypto.getRandomValues)return Et}return At}();function Dt(){return zt()}class Ct{constructor(t,n){this.q=t,this.F=n,this.H=[],this.N=null,this.X=[],this.K=null,this.U=!1,this.V=!0,this.Y=0,this.J=0,this.W=t.flush.intervalMs}push(t){if(this.U){if(this.H.length<this.tt()?this.H.push(t):this.nt(t),this.V)return this.H.length>=this.q.flush.size?(h(this.N),this.N=null,void this.flush("capacity")):void this.et()}else e.warn("Transport","push() called before start() — event dropped")}flush(t){if(this.U&&this.F.isActivityActive())try{if("lifecycle"===t)return void this.it();if(0===this.H.length)return;const n=this.rt(t);this.F.ingest(n,!1).then(t=>this.ot(t,n)).catch(()=>{e.warn("Transport","ingest threw unexpectedly — batch dropped")}),this.H.length>0&&this.et()}catch(t){e.warn("Transport","flush() threw unexpectedly:",t)}}start(){this.U||(this.U=!0,this.V="undefined"==typeof navigator||navigator.onLine)}stop(){if(!this.U)return Promise.resolve();h(this.N),this.N=null,h(this.K),this.K=null;const t=this.it();return this.U=!1,t}onConnectionChange(){const t="undefined"==typeof navigator||navigator.onLine;if(t!==this.V){if(this.V=t,!this.V)return h(this.N),this.N=null,h(this.K),void(this.K=null);this.H.length>0&&this.et(),this.X.length>0&&this.st()}}et(){this.U&&this.V&&null===this.N&&(this.N=f(()=>{this.N=null,this.flush("interval")},this.W))}st(){this.U&&this.V&&null===this.K&&(this.K=f(()=>{this.K=null,this.ct()},this.W))}ct(){if(!this.U||!this.V||0===this.X.length||!this.F.isActivityActive())return;const t=this.X.shift();this.F.ingest(t.batch,!1).then(n=>this.ut(n,t)).catch(()=>{e.warn("Transport","retry drain ingest threw unexpectedly — batch dropped"),this.X.length>0&&this.st()})}lt(t,n){this.X.length>=5&&(this.X.shift(),e.warn("Transport","retry queue full — oldest batch evicted")),this.X.push({batch:t,attempts:n}),this.st()}ot(t,n){t.ok?this.ft():this.ht(t)&&this.lt(n,1)}ut(t,n){if(t.ok)return this.ft(),void(this.X.length>0&&this.st());if(this.ht(t)){if(n.attempts>=3)return this.dt(),e.warn("Transport","batch dropped after MAX_RETRY_ATTEMPTS",n.batch.batchId),void(this.X.length>0&&this.st());this.dt(),this.lt(n.batch,n.attempts+1)}else this.X.length>0&&this.st()}dt(){this.Y++,this.Y%this.q.flush.backoffFailureThreshold===0&&(this.W=Math.min(2*this.W,this.q.flush.maxIntervalMs))}ft(){this.Y=0,this.W=this.q.flush.intervalMs}tt(){return this.q.queue.size*(this.V?1:2)}async it(){if(!this.F.isActivityActive())return Promise.resolve();const t=[];for(const n of this.X)t.push(this.F.ingest(n.batch,!0).catch(()=>{e.warn("Transport","lifecycle retry ingest threw — batch dropped")}));if(this.X=[],this.H.length>0){const n=this.rt("lifecycle");t.push(this.F.ingest(n,!0).catch(()=>{e.warn("Transport","lifecycle ingest threw — batch dropped")}))}return Promise.allSettled(t).then(()=>{})}nt(t){const n=St(t);for(let e=0;e<this.H.length;e++)if(St(this.H[e])<n){for(let t=e;t<this.H.length-1;t++)this.H[t]=this.H[t+1];return this.H.length-=1,void this.H.push(t)}}rt(t){const n="lifecycle"===t?this.H.splice(-this.q.flush.size):this.H.splice(0,this.q.flush.size);return{activityId:"",batchId:Dt(),batchSequence:this.J++,clientTimestamp:Date.now(),schemaVersion:"0.1.0",sdkVersion:"0.4.0",sdkPlatform:"web",tabId:this.F.getTabId(),events:n}}ht(t){if(t.ok)return!1;switch(t.kind){case"timeout":case"server":case"rate_limited":return!0;default:return!1}}}const Ut="tri:bcast:";const Lt="function"==typeof BroadcastChannel?BroadcastChannel:function(){if("undefined"==typeof Storage||"undefined"==typeof window)return!1;try{const t="__tri_bcast_probe__";localStorage.setItem(t,"1");const n="1"===localStorage.getItem(t);return localStorage.removeItem(t),n}catch{return!1}}()?class{constructor(t){this.seq=0,this.closed=!1,this.listeners=new Set,this.onStorageEvent=t=>{if(this.closed)return;if(!t.key||!t.key.startsWith(`${Ut}${this.channelName}:`))return;if(null===t.newValue)return;let n;a(()=>j.remove(t.key));try{n=JSON.parse(t.newValue)}catch{return}const e={data:n};for(const t of this.listeners)a(()=>t(e))},this.channelName=t,this.senderId=Dt(),window.addEventListener("storage",this.onStorageEvent)}postMessage(t){if(this.closed)return;const n=`${Ut}${this.channelName}:${this.senderId}:${this.seq++}`;a(()=>{j.set(n,t),j.remove(n)})}addEventListener(t,n){this.listeners.add(n)}removeEventListener(t,n){this.listeners.delete(n)}close(){this.closed||(this.closed=!0,window.removeEventListener("storage",this.onStorageEvent),this.listeners.clear())}}:class{constructor(t){e.warn("BroadcastChannel","BroadcastChannel is unavailable and localStorage is not writable in this context. Cross-tab discovery is disabled; tab count will always be reported as 1.")}postMessage(t){}addEventListener(t,n){}removeEventListener(t,n){}close(){}},Pt="__tri_tabId";class Rt{constructor(t){this.context=t,this.vt="",this.U=!1,this.wt=null,this.yt=null,this.gt=null,this.bt=new Map,this.kt=-1,this.Tt=null}async start(){this.U||(this.U=!0,this.vt=this.St(),this.xt(),this.It({type:"hello",tabId:this.vt,ts:Date.now()}),this._t(),this.Mt("active"),this.Et())}stop(){this.U&&(this.U=!1,this.Mt("inactive"),this.It({type:"bye",tabId:this.vt,ts:Date.now()}),this.At(this.zt()),this.Dt(),this.Ct(),this.Ut())}getTabId(){return this.vt}queryTabsNumber(){return this.bt.size+1}xt(){try{this.wt=new Lt("__tri_tab_channel"),this.Tt=this.Lt.bind(this),this.wt.addEventListener("message",this.Tt)}catch(t){e.warn("TabManager","failed to open broadcast channel:",t)}}Ut(){try{if(!this.wt)return;this.Tt&&this.wt.removeEventListener("message",this.Tt),this.wt.close()}catch{}finally{this.wt=null,this.Tt=null}}_t(){this.yt=setInterval(()=>{const t=Date.now();this.It({type:"heartbeat",tabId:this.vt,ts:t})},1e3)}Dt(){null!=this.yt&&(clearInterval(this.yt),this.yt=null)}Et(){null!=this.gt&&clearTimeout(this.gt),this.gt=setTimeout(()=>{this.gt=null;const t=this.zt()+1;t!==this.kt&&(this.kt=t,this.At(t))},1e3)}Ct(){null!=this.gt&&(clearTimeout(this.gt),this.gt=null)}It(t){try{if(!this.wt)return;this.wt.postMessage(t)}catch{e.warn("TabManager","failed to broadcast message:",t)}}Lt(t){const{type:n,tabId:e}=t.data;if(e===this.vt)return;const i=Date.now();"hello"===n?(this.It({type:"ack",tabId:this.vt,ts:i,to:e}),this.bt.set(e,i)):"heartbeat"===n||"ack"===n?this.bt.set(e,i):"bye"===n&&this.bt.delete(e)}At(t){this.context.events.count&&this.context.push({name:"tab",type:"count",tabId:this.vt,timestamp:Date.now(),value:t})}Mt(t){this.context.events.state&&this.context.push({name:"tab",type:"state",tabId:this.vt,timestamp:Date.now(),value:t})}St(){const t=q.get(Pt);if(t)return t;const n=Dt();return q.set(Pt,n),n}zt(t=Date.now()){let n=0;for(const[e,i]of this.bt.entries())t-i>=3e3?this.bt.delete(e):n++;return n}}const $t=globalThis.CompressionStream,Ot=globalThis.Response,Bt=globalThis.Blob,jt=new TextEncoder;let qt=null;async function Ft(t){const n=await async function(t){if("function"!=typeof $t)return null;try{const n=jt.encode(t),e=new Bt([n]).stream().pipeThrough(new $t("gzip"));return await new Ot(e).arrayBuffer()}catch(t){return e.warn("compression","Native gzip failed:",t),null}}(t);return null!==n?n:async function(t){try{const n=await function(){if(null===qt){const t=function(t,n=1e4){let i=null;const r=new Promise(t=>{i=f(()=>{e.warn("import",`Import timed out after ${n}ms`),t(null)},n)}),o=Promise.resolve().then(t).catch(t=>(e.warn("import","Import failed:",t),null));return Promise.race([o,r]).finally(()=>{h(i)})}(()=>Promise.resolve().then(function(){return _i}),1e4);qt=t,t.then(n=>{null===n&&f(()=>{qt===t&&(qt=null)},1e4)})}return qt}();if(null===n)return null;const{gzipSync:i}=n,r=i(jt.encode(t));return r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}catch(t){return e.warn("compression","fflate gzip failed:",t),null}}(t)}function Ht(t){const n={Accept:"application/json"};return t?.hasBody&&("json"===t.contentType?n["Content-Type"]="application/json":"ndjson"===t.contentType&&(n["Content-Type"]="application/x-ndjson"),"gzip"===t.contentEncoding&&(n["Content-Encoding"]="gzip")),t?.token&&(n.Authorization=`Bearer ${t.token}`),t?.profileId&&(n["x-profile-id"]=t.profileId),t?.api?.version&&(n["x-api-version"]=t.api.version),t?.customHeaders&&Object.entries(t.customHeaders).forEach(([t,e])=>{n[t]=e}),n}const Nt="function"==typeof globalThis.fetch?globalThis.fetch.bind(globalThis):void 0;class Zt{constructor(t){this.context=t}stop(){}async report(t,n){const i={name:t,metadata:n,timestamp:Date.now(),activityId:this.context.getActivityId()??""};try{const r=await this.context.reportEvent(i);if(r.ok)return r;e.warn("EventReport","Failed to report event:",t,n,"with result:",r)}catch(i){e.warn("EventReport","Failed to report event:",t,n,"with error:",i)}}}const Xt=new Set(["A","BUTTON","INPUT","SELECT","TEXTAREA","SUMMARY","DETAILS","LABEL","OPTION","FIELDSET"]),Gt=new Set(["button","link","tab","menuitem","menuitemcheckbox","menuitemradio","checkbox","radio","switch","slider","spinbutton","combobox","listbox","option","searchbox","textbox","treeitem"]),Kt=255;function Vt(t,n,e){const i=t.tagName.toLowerCase(),r=function(t){const n=t.parentElement?.children??[],e=Math.min(n.length,1e3);let i=e-1,r=0,o=0;for(let i=0;i<e;i++){o++;const e=n[i];if(b(e,t.tagName)&&r++,e===t)break}return{siblings:i,ofType:r,child:o}}(t),o=function(t,n){const e=function(t){if(!t)return null;const n=t.getAttribute("data-tri-redact-attrs");return n?n.split(",").map(t=>t.trim().toLowerCase()):null}(t),i={},r=t.id;r&&!x("id",e)&&(i.id=r);const o=t.getAttribute("autocomplete");o&&!x("autocomplete",e)&&(i.autocomplete=o);const s=t.getAttribute("aria-invalid");s&&!x("aria-invalid",e)&&(i.ariaInvalid=s);const a=t.getAttribute("tabindex");a&&!x("tabindex",e)&&(i.tabIndex=parseInt(a,10));const c=function(t){return t.getAttribute("data-testid")??t.getAttribute("data-cy")??null}(t);c&&!x("data-testid",e)&&(i.testId=c);const u=t.hasAttribute("readonly");u&&!x("readonly",e)&&(i.readOnly=u);const l=t.hasAttribute("required");l&&!x("required",e)&&(i.required=l);const f=t.getAttribute("contenteditable");f&&!x("contenteditable",e)&&(i.contentEditable="true"===f||""===f);const h=t.getAttribute("href");h&&!x("href",e)&&(i.href={...n?{}:{url:h},external:I(h)});const d=t.getAttribute("role");d&&!x("role",e)&&(i.role=d);const v=t.getAttribute("type");v&&!x("type",e)&&(i.type=v);const p=t.getAttribute("name");p&&!x("name",e)&&(i.name=p);const w=t.getAttribute("placeholder");!w||n||x("placeholder",e)||(i.placeholder=w);const m=Array.from(t.classList).slice(0,5);m.length>0&&!x("class",e)&&(i.classes=m);const y=t.getAttribute("alt");return!y||n||x("alt",e)||(i.alt=y),Object.keys(i).length?i:null}(t,n);return{tagName:i,frame:e,...o?{attributes:o}:{},...r?{nth:r}:{}}}function Yt(t,n){let e=0;const i=[];return function(t){return Xt.has(t.tagName)}(t)&&(e+=40,i.push("native")),function(t){return t.hasAttribute("data-tri-interactive")}(t)&&(e+=40,i.push("tri-interactive")),function(t){return b(t,"a")&&t.hasAttribute("href")}(t)&&(e+=15,i.push("has-href")),function(t){const n=t.getAttribute("role");return null!==n&&Gt.has(n)}(t)&&(e+=30,i.push("role")),function(t){return t.hasAttribute("onclick")||t.hasAttribute("ng-click")||t.hasAttribute("data-action")||t.hasAttribute("@click")}(t)&&(e+=20,i.push("click-handler")),function(t){const n=t.getAttribute("tabindex");if(null===n)return!1;const e=parseInt(n,10);return null!==e&&e>=0}(t)&&(e+=10,i.push("tabindex")),(t.id||t.getAttribute("data-testid"))&&(e+=5,i.push("has-id")),n>0&&(e+=Math.round(15/n),i.push("depth")),{score:e,reasons:i}}function Jt(t){return t>=20}function Qt(t){return null!==t&&t.width>0&&t.height>0&&t.y<window.innerHeight&&t.y+t.height>0&&t.x<window.innerWidth&&t.x+t.width>0}function Wt(t){return!0===t.disabled||"true"===t.getAttribute("aria-disabled")}function tn(t,n=!1){if(n)return null;const e=en(t,"labelledby");if(e)return{text:on(e),resolutionMethod:"aria-labelledby",confidence:"high"};const i=rn(t);if(i)return{text:on(i),resolutionMethod:"aria-label",confidence:"high"};const r=function(t){if(!t.id)return null;const n=document.querySelector(`label[for="${CSS.escape(t.id)}"]`);return n?nn(n):null}(t);if(r)return{text:on(r),resolutionMethod:"html-for",confidence:"high"};const o=function(t){const n=t.closest("label");return n?nn(n):null}(t);if(o)return{text:on(o),resolutionMethod:"wrapping-label",confidence:"high"};const s=function(t){const n=t.getAttribute("placeholder");return n?.trim()??null}(t);if(s)return{text:on(s),resolutionMethod:"placeholder",confidence:"low"};const a=function(t){const n=t.getAttribute("title");return n?.trim()??null}(t);if(a)return{text:on(a),resolutionMethod:"title",confidence:"low"};const c=en(t,"describedby");if(c)return{text:on(c),resolutionMethod:"aria-describedby",confidence:"low"};const u=nn(t);return u?{text:u,resolutionMethod:"text-content",confidence:"low"}:null}function nn(t,n=0){if(n>8)return"";if(g(t))return function(t){return t?t.trim().split(/(\s+)/).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,Kt):null}(t.textContent)??"";if(!t.childNodes?.length)return"";let e="";for(const i of t.childNodes){const t=nn(i,n+1);if(t&&(e=e?`${e} ${t}`:t,e.length>=Kt))break}return on(e)}function en(t,n){const e="labelledby"===n?"aria-labelledby":"aria-describedby",i=t?.getAttribute(e);if(!i)return null;const r=i.split(/\s+/),o=[];for(const t of r){const n=document.getElementById(t);if(!n)continue;const e=rn(n)??nn(n);e.length&&o.push(e)}return o.length?o.join(" "):null}function rn(t){return t?.getAttribute("aria-label")?.trim()??null}function on(t){return t.length>Kt?t.slice(0,Kt)+"...":t}function sn(t){const n=t.getBoundingClientRect();return{x:n.x,y:n.y,width:n.width,height:n.height}}class an{constructor(t){this.capacity=t,this.cache=new Map}get(t){return this.cache.get(t)}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.capacity){const t=this.cache.keys().next().value;t&&this.cache.delete(t)}this.cache.set(t,n)}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}size(){return this.cache.size}}async function cn(t,n){const{collectors:o,sdk:s}=t;let a=null,c=null,l=null,d=null;try{a=function(t){"undefined"!=typeof document&&"function"==typeof globalThis.fetch||e.warn("FalconService","createFalconServiceManager called in a non-browser environment — all requests will resolve with { ok: false, kind: 'network' }.");const n=function(t){const n=t?.timeout,e=t?.baseUrl??"",i=t?.api;async function r(t,r,o){if(void 0===Nt)return{ok:!1,kind:"network"};const s=e?`${e}${r}`:r,a=new AbortController;let c=null,u=!1;c=f(()=>{u=!0,a.abort()},n);const l=o?.signal;let d,v=()=>{};if(l)if(l.aborted)a.abort();else{const t=()=>a.abort();l.addEventListener("abort",t,{once:!0}),v=()=>l.removeEventListener("abort",t)}if(null!=o&&"body"in o&&null!=o.body){const t=function(t){if(null==t)return{ok:!0,body:void 0};if("string"==typeof t||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof Blob||t instanceof FormData||t instanceof URLSearchParams||t instanceof ReadableStream)return{ok:!0,body:t};try{return{ok:!0,body:JSON.stringify(t)}}catch{return{ok:!1}}}(o.body);if(!t.ok)return h(c),v(),{ok:!1,kind:"serialize"};d=t.body}try{const n=await Nt(s,{method:t,headers:Ht({token:o?.token,profileId:o?.profileId,contentType:o?.contentType,contentEncoding:o?.contentEncoding,api:i,hasBody:void 0!==d,customHeaders:o?.customHeaders}),body:d,signal:a.signal,keepalive:o?.keepalive});if(!n.ok)return 429===(p=n.status)?{ok:!1,kind:"rate_limited",status:p}:p>=400&&p<500?{ok:!1,kind:"client",status:p}:{ok:!1,kind:"server",status:p};if(204===n.status)return{ok:!0,data:void 0,status:204};try{return{ok:!0,data:await n.json(),status:n.status}}catch{return a.signal.aborted?u?{ok:!1,kind:"timeout"}:{ok:!1,kind:"abort"}:{ok:!1,kind:"parse",status:n.status}}}catch{return u?{ok:!1,kind:"timeout"}:a.signal.aborted?{ok:!1,kind:"abort"}:{ok:!1,kind:"network"}}finally{h(c),v()}var p}return{post:async function(t,n){return r("POST",t,n)},get:async function(t,n){return r("GET",t,n)}}}({baseUrl:`${t.api.url}/api/v1`,timeout:1e4,api:{version:t.api.version}}),i=function(t){const{getToken:n,refresh:i}=t;let r=null;return{withAuth:async function(t,o){if(r){const n=await r;if(n)return t(n)}const s=n()??"",a=await t(s);if((c=a).ok||"client"!==c.kind||!kt.includes(c.status)||!1===o?.refreshable)return a;var c;const u=await(r||(r=async function(){try{return await i(),n()}catch(t){return e.warn("AuthMiddleware","auth refresh failed",t),null}}().finally(()=>{r=null}),r));return u&&u!==s?t(u):a}}}(t),r=()=>({profileId:t.getProfileId()??void 0});return{api:{ingest:async function(e,o){return i.withAuth(async i=>{const{events:s,...a}=e,c={...a,activityId:t.getActivityId()};let u;try{u=await async function(t,n){const e=function(t,n){const e=[JSON.stringify(t)];for(let t=0;t<n.length;t++)try{e.push(JSON.stringify(n[t]))}catch{}return e.join("\n")}(t,n),i=await Ft(e);return i?{type:"gzip",body:i}:{type:"ndjson",body:e}}(c,s)}catch{return{ok:!1,kind:"serialize"}}return n.post("/events/capture",{body:u.body,token:i,keepalive:o,contentType:"ndjson",contentEncoding:"gzip"===u.type?"gzip":void 0,...r()})},{refreshable:!o})},reportEvent:async function(t){return i.withAuth(e=>n.post("/events/report-event",{body:t,token:e,contentType:"json",...r()}))},startActivity:async function(){return n.post("/events/start-activity",{token:t.getSdkToken(),...r()})},stopActivity:async function(){return i.withAuth(t=>n.post("/events/end-activity",{token:t,keepalive:!0,...r()}),{refreshable:!1})},collectionStatus:async function(){return n.get("/sdk/collection-status",{token:t.getSdkToken(),...r()})},linkInterview:async function(t){return i.withAuth(e=>n.post("/events/link-interview",{token:e,contentType:"json",...r(),customHeaders:{"X-Incode-Hardware-Id":t}}))}}}}({api:{version:s.api.version,url:s.api.url},getSdkToken:()=>s.token,getProfileId:()=>n.getProfileId(),getToken:()=>c?.getToken()??null,refresh:async()=>c?.refresh()??Promise.resolve(),getActivityId:()=>c?.getActivityId()??""});const t=await a.api.collectionStatus();if(!t.ok||!0!==t.data.eventsCollectionEnabled)return{status:"collection-disabled"};c=new bt({startActivity:()=>a.api.startActivity(),stopActivity:()=>a.api.stopActivity()}),l=new Ct(at,{ingest:(t,n)=>a.api.ingest(t,n),getTabId:()=>d?.getTabId()??"unknown",isActivityActive:()=>c?.isActive()??!1});const v=o.tab;d=new Rt({push:t=>l?.push(t),events:{state:v.enabled&&v.events.state.enabled,count:v.enabled&&v.events.count.enabled}});const p=function(t){function n(n){"hidden"===document.visibilityState&&t.flush()}function e(n){t.flush(),t.stopTab(),t.getShouldSkipStopActivity()||t.stopActivity()}const o=u(()=>t.onConnectionChange());return{start:function(){i(document,"visibilitychange",n),i(window,"pagehide",e),i(window,"online",o),i(window,"offline",o)},stop:function(){r(document,"visibilitychange",n),r(window,"pagehide",e),r(window,"online",o),r(window,"offline",o)}}}({flush:()=>l?.flush("lifecycle"),stopActivity:async()=>c?.stop(),stopTab:()=>d?.stop(),getShouldSkipStopActivity:()=>(d?.queryTabsNumber()??0)>1,onConnectionChange:()=>l?.onConnectionChange()}),w=function(t){const n=t||"redact",e=new an(6),i=new an(6);return{resolve:function(t){if(!t||T(t)||"off"===n)return null;let r=e.get(t);if(r||(r=function(t){if(!t||T(t))return{chain:[],redaction:{level:"ignore",index:-1}};const n=[];let e=t,i=-1;for(;e;){if(T(e))return{chain:[],redaction:{level:"ignore",index:-1}};S(e)&&(i=n.length),n.push(e);const t=e.parentNode;if(!t||b(e,"body"))break;e=k(t)?t.host:t}return{chain:n,redaction:{level:-1===i?"full":"redact",index:i}}}(t.parentElement),e.set(t,r)),"ignore"===r.redaction.level)return null;const o="redact"===r.redaction.level||"redact"===n||S(t);let s=i.get(t);return s||(s=function(t,n,e,i){const r=getComputedStyle(t),o=sn(t),s=function(t,n){const e=[],i=[];for(let r=t.length-1;r>=0;r--){const o=t[r],s=r<=n,a=r+1,c=Vt(o,s,sn(o)),{score:u,reasons:l}=Yt(o,a);if(e.push(c),!Jt(u))continue;const f=tn(o,s);i.push({...c,...f?{label:f}:{},depth:a,score:u,reasons:l})}return{ancestors:e,interactiveCandidates:i.reverse()}}(n,i),a=Vt(t,e,o),c=function(t,n,e){const{score:i,reasons:r}=Yt(t,0);return{interactive:Jt(i),...r.length>0?{reasons:r}:{},disabled:Wt(t),rendered:"none"!==n?.display,visible:"hidden"!==n?.visibility,inViewport:Qt(e),acceptsPointer:"none"!==n?.pointerEvents,opacity:parseFloat(n?.opacity||"1")}}(t,r,o);let u=null;return e||(u=c.interactive?tn(t):null),{tagName:a.tagName,frame:a.frame,viewport:{height:window.innerHeight,width:window.innerWidth,scrollX:window.scrollX,scrollY:window.scrollY,dpr:window.devicePixelRatio},attributes:a.attributes,nth:a.nth,...u?{label:u}:{},ancestors:s.ancestors,interactiveCandidates:s.interactiveCandidates,interactivity:c}}(t,r.chain,o,r.redaction.index),i.set(t,s)),s}}}(s.capture?.element),m=new Set;try{m.add(new URL(s.api.url).origin)}catch{}const y=function(t,n,e="on"){const i=new Map;function r(r){if(i.has(r))return;const o=W[r];if(!o||!function(t,n){return n[t]?.enabled??!1}(r,n))return;const s=n[r],a=o.create(t,e,s&&"events"in s?s.events:void 0);i.set(r,a)}return{start:r,stopCollector:function(t){const n=i.get(t);n&&(n(),i.delete(t))},stop:function(){for(const[,t]of i)t();i.clear()},isRunning:function(t){return i.has(t)},autocapture:function(){for(const t of tt)r(t)}}}({push:t=>l?.push(t),resolveElement:t=>w.resolve(t),sanitizeUrl:s.sanitizeUrl,ignoredOrigins:m},o,s.capture?.content),g=new Zt({getActivityId:()=>c?.getActivityId()??"",reportEvent:t=>a.api.reportEvent(t)});return{status:"ready",managers:{falconServiceManager:a,activityManager:c,transportManager:l,tabManager:d,lifecycleManager:p,collectorManager:y,eventReportManager:g}}}catch(t){return e.warn("IncodeTRI","setup() failed during construction:",t),{status:"init-failed"}}}let un=class t{constructor(){this.Pt=0,this.Rt=null,this.$t=it}static get instance(){return t.S||(t.S=new t),t.S}async setup(t){if(this.$t!==it)return e.fatal("error","setup()",`cannot set up from state '${this.$t}' — call reset() (or reload) first. Ignoring.`),st;try{const n=function(t){if("undefined"==typeof document)return e.fatal("error","IncodeTRI","TRI is not available in a non-browser environment."),null;if(!t?.token)return e.fatal("error","SDK","token is required."),null;if(!t.apiURL)return e.fatal("error","SDK","Couldn't initialise SDK — apiURL isn't provided."),null;const{element:n,content:i}=t.capture??{},r={token:t.token,capture:{element:n??"redact",content:i??"off"},api:{version:t.apiVersion??"1.0",url:t.apiURL},sanitizeUrl:(o=t.sanitizeUrl,o?function(t){return a(()=>o(t,et))??et(t)}:et),DEBUG:t.DEBUG??!1};var o;return void 0===t.collectors&&void 0===t.layers?{sdk:r,collectors:ct()}:void 0!==t.collectors?{sdk:r,collectors:lt(t.collectors)}:{sdk:r,collectors:ut(t.layers)}}(t);if(!n)return this.$t=st,st;e.DEBUG=n.sdk.DEBUG;const i=await cn(n,{getProfileId:()=>null});return"collection-disabled"===i.status?(e.fatal("warn","setup()","Collection is disabled for the provided API Key."),this.$t=ot,ot):"init-failed"===i.status?(this.$t=st,st):(this.Rt=i.managers,this.$t=rt,rt)}catch(t){return e.warn("setup()","failed:",t),this.$t=st,st}}async start(){if(this.$t===it)return e.warn("start()","start() requires a prior successful setup() — ignoring."),this.$t;if(this.$t!==rt)return e.fatal("warn","start()","TRI is either already started or isn't ready — ignoring."),this.$t;this.$t="starting";const t=++this.Pt;return await this.L(t),this.$t}async stop(){e.warn("stop()","called");const t=this.Rt;return t?(++this.Pt,t.lifecycleManager.stop(),t.collectorManager.stop(),t.tabManager.stop(),t.eventReportManager.stop(),this.$t=rt,this.Ot(t)):Promise.resolve(this.$t)}async reset(){const t=this.stop();return this.$t=it,this.Rt=null,t.then(()=>this.$t)}async Ot(t){return await function(t){let n=null;const e=new Promise(t=>{n=f(t,2e3)});return Promise.race([t.finally(()=>h(n)),e])}(Promise.resolve(t.transportManager.stop())),await t.activityManager.stop(),this.$t}async L(t){const n=this.Rt;if(n){try{if(await n.activityManager.start(),t!==this.Pt)return;if(n.transportManager.start(),await n.tabManager.start(),t!==this.Pt)return;n.lifecycleManager.start(),n.collectorManager.autocapture()}catch(n){return e.warn("start()","failed during monitoring start:",n),void(t===this.Pt&&(this.$t=rt))}t===this.Pt&&(this.$t="started")}}};un.S=null;const ln=un.instance;var fn={},hn=Uint8Array,dn=Uint16Array,vn=Int32Array,pn=new hn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),wn=new hn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),mn=new hn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yn=function(t,n){for(var e=new dn(31),i=0;i<31;++i)e[i]=n+=1<<t[i-1];var r=new vn(e[30]);for(i=1;i<30;++i)for(var o=e[i];o<e[i+1];++o)r[o]=o-e[i]<<5|i;return{b:e,r:r}},gn=yn(pn,2),bn=gn.b,kn=gn.r;bn[28]=258,kn[258]=28;for(var Tn=yn(wn,0),Sn=Tn.b,xn=Tn.r,In=new dn(32768),_n=0;_n<32768;++_n){var Mn=(43690&_n)>>1|(21845&_n)<<1;In[_n]=((65280&(Mn=(61680&(Mn=(52428&Mn)>>2|(13107&Mn)<<2))>>4|(3855&Mn)<<4))>>8|(255&Mn)<<8)>>1}var En=function(t,n,e){for(var i=t.length,r=0,o=new dn(n);r<i;++r)t[r]&&++o[t[r]-1];var s,a=new dn(n);for(r=1;r<n;++r)a[r]=a[r-1]+o[r-1]<<1;if(e){s=new dn(1<<n);var c=15-n;for(r=0;r<i;++r)if(t[r])for(var u=r<<4|t[r],l=n-t[r],f=a[t[r]-1]++<<l,h=f|(1<<l)-1;f<=h;++f)s[In[f]>>c]=u}else for(s=new dn(i),r=0;r<i;++r)t[r]&&(s[r]=In[a[t[r]-1]++]>>15-t[r]);return s},An=new hn(288);for(_n=0;_n<144;++_n)An[_n]=8;for(_n=144;_n<256;++_n)An[_n]=9;for(_n=256;_n<280;++_n)An[_n]=7;for(_n=280;_n<288;++_n)An[_n]=8;var zn=new hn(32);for(_n=0;_n<32;++_n)zn[_n]=5;var Dn=En(An,9,0),Cn=En(An,9,1),Un=En(zn,5,0),Ln=En(zn,5,1),Pn=function(t){for(var n=t[0],e=1;e<t.length;++e)t[e]>n&&(n=t[e]);return n},Rn=function(t,n,e){var i=n/8|0;return(t[i]|t[i+1]<<8)>>(7&n)&e},$n=function(t,n){var e=n/8|0;return(t[e]|t[e+1]<<8|t[e+2]<<16)>>(7&n)},On=function(t){return(t+7)/8|0},Bn=function(t,n,e){return(null==n||n<0)&&(n=0),(null==e||e>t.length)&&(e=t.length),new hn(t.subarray(n,e))},jn=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],qn=function(t,n,e){var i=new Error(n||jn[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,qn),!e)throw i;return i},Fn=function(t,n,e,i){var r=t.length,o=i?i.length:0;if(!r||n.f&&!n.l)return e||new hn(0);var s=!e,a=s||2!=n.i,c=n.i;s&&(e=new hn(3*r));var u=function(t){var n=e.length;if(t>n){var i=new hn(Math.max(2*n,t));i.set(e),e=i}},l=n.f||0,f=n.p||0,h=n.b||0,d=n.l,v=n.d,p=n.m,w=n.n,m=8*r;do{if(!d){l=Rn(t,f,1);var y=Rn(t,f+1,3);if(f+=3,!y){var g=t[(z=On(f)+4)-4]|t[z-3]<<8,b=z+g;if(b>r){c&&qn(0);break}a&&u(h+g),e.set(t.subarray(z,b),h),n.b=h+=g,n.p=f=8*b,n.f=l;continue}if(1==y)d=Cn,v=Ln,p=9,w=5;else if(2==y){var k=Rn(t,f,31)+257,T=Rn(t,f+10,15)+4,S=k+Rn(t,f+5,31)+1;f+=14;for(var x=new hn(S),I=new hn(19),_=0;_<T;++_)I[mn[_]]=Rn(t,f+3*_,7);f+=3*T;var M=Pn(I),E=(1<<M)-1,A=En(I,M,1);for(_=0;_<S;){var z,D=A[Rn(t,f,E)];if(f+=15&D,(z=D>>4)<16)x[_++]=z;else{var C=0,U=0;for(16==z?(U=3+Rn(t,f,3),f+=2,C=x[_-1]):17==z?(U=3+Rn(t,f,7),f+=3):18==z&&(U=11+Rn(t,f,127),f+=7);U--;)x[_++]=C}}var L=x.subarray(0,k),P=x.subarray(k);p=Pn(L),w=Pn(P),d=En(L,p,1),v=En(P,w,1)}else qn(1);if(f>m){c&&qn(0);break}}a&&u(h+131072);for(var R=(1<<p)-1,$=(1<<w)-1,O=f;;O=f){var B=(C=d[$n(t,f)&R])>>4;if((f+=15&C)>m){c&&qn(0);break}if(C||qn(2),B<256)e[h++]=B;else{if(256==B){O=f,d=null;break}var j=B-254;B>264&&(j=Rn(t,f,(1<<(H=pn[_=B-257]))-1)+bn[_],f+=H);var q=v[$n(t,f)&$],F=q>>4;if(q||qn(3),f+=15&q,P=Sn[F],F>3){var H=wn[F];P+=$n(t,f)&(1<<H)-1,f+=H}if(f>m){c&&qn(0);break}a&&u(h+131072);var N=h+j;if(h<P){var Z=o-P,X=Math.min(P,N);for(Z+h<0&&qn(3);h<X;++h)e[h]=i[Z+h]}for(;h<N;++h)e[h]=e[h-P]}}n.l=d,n.p=O,n.b=h,n.f=l,d&&(l=1,n.m=p,n.d=v,n.n=w)}while(!l);return h!=e.length&&s?Bn(e,0,h):e.subarray(0,h)},Hn=function(t,n,e){var i=n/8|0;t[i]|=e<<=7&n,t[i+1]|=e>>8},Nn=function(t,n,e){var i=n/8|0;t[i]|=e<<=7&n,t[i+1]|=e>>8,t[i+2]|=e>>16},Zn=function(t,n){for(var e=[],i=0;i<t.length;++i)t[i]&&e.push({s:i,f:t[i]});var r=e.length,o=e.slice();if(!r)return{t:Qn,l:0};if(1==r){var s=new hn(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(t,n){return t.f-n.f}),e.push({s:-1,f:25001});var a=e[0],c=e[1],u=0,l=1,f=2;for(e[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=r-1;)a=e[e[u].f<e[f].f?u++:f++],c=e[u!=l&&e[u].f<e[f].f?u++:f++],e[l++]={s:-1,f:a.f+c.f,l:a,r:c};var h=o[0].s;for(i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var d=new dn(h+1),v=Xn(e[l-1],d,0);if(v>n){i=0;var p=0,w=v-n,m=1<<w;for(o.sort(function(t,n){return d[n.s]-d[t.s]||t.f-n.f});i<r;++i){var y=o[i].s;if(!(d[y]>n))break;p+=m-(1<<v-d[y]),d[y]=n}for(p>>=w;p>0;){var g=o[i].s;d[g]<n?p-=1<<n-d[g]++-1:++i}for(;i>=0&&p;--i){var b=o[i].s;d[b]==n&&(--d[b],++p)}v=n}return{t:new hn(d),l:v}},Xn=function(t,n,e){return-1==t.s?Math.max(Xn(t.l,n,e+1),Xn(t.r,n,e+1)):n[t.s]=e},Gn=function(t){for(var n=t.length;n&&!t[--n];);for(var e=new dn(++n),i=0,r=t[0],o=1,s=function(t){e[i++]=t},a=1;a<=n;++a)if(t[a]==r&&a!=n)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=t[a]}return{c:e.subarray(0,i),n:n}},Kn=function(t,n){for(var e=0,i=0;i<n.length;++i)e+=t[i]*n[i];return e},Vn=function(t,n,e){var i=e.length,r=On(n+2);t[r]=255&i,t[r+1]=i>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var o=0;o<i;++o)t[r+o+4]=e[o];return 8*(r+4+i)},Yn=function(t,n,e,i,r,o,s,a,c,u,l){Hn(n,l++,e),++r[256];for(var f=Zn(r,15),h=f.t,d=f.l,v=Zn(o,15),p=v.t,w=v.l,m=Gn(h),y=m.c,g=m.n,b=Gn(p),k=b.c,T=b.n,S=new dn(19),x=0;x<y.length;++x)++S[31&y[x]];for(x=0;x<k.length;++x)++S[31&k[x]];for(var I=Zn(S,7),_=I.t,M=I.l,E=19;E>4&&!_[mn[E-1]];--E);var A,z,D,C,U=u+5<<3,L=Kn(r,An)+Kn(o,zn)+s,P=Kn(r,h)+Kn(o,p)+s+14+3*E+Kn(S,_)+2*S[16]+3*S[17]+7*S[18];if(c>=0&&U<=L&&U<=P)return Vn(n,l,t.subarray(c,c+u));if(Hn(n,l,1+(P<L)),l+=2,P<L){A=En(h,d,0),z=h,D=En(p,w,0),C=p;var R=En(_,M,0);for(Hn(n,l,g-257),Hn(n,l+5,T-1),Hn(n,l+10,E-4),l+=14,x=0;x<E;++x)Hn(n,l+3*x,_[mn[x]]);l+=3*E;for(var $=[y,k],O=0;O<2;++O){var B=$[O];for(x=0;x<B.length;++x)Hn(n,l,R[q=31&B[x]]),l+=_[q],q>15&&(Hn(n,l,B[x]>>5&127),l+=B[x]>>12)}}else A=Dn,z=An,D=Un,C=zn;for(x=0;x<a;++x){var j=i[x];if(j>255){var q;Nn(n,l,A[257+(q=j>>18&31)]),l+=z[q+257],q>7&&(Hn(n,l,j>>23&31),l+=pn[q]);var F=31&j;Nn(n,l,D[F]),l+=C[F],F>3&&(Nn(n,l,j>>5&8191),l+=wn[F])}else Nn(n,l,A[j]),l+=z[j]}return Nn(n,l,A[256]),l+z[256]},Jn=new vn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Qn=new hn(0),Wn=function(t,n,e,i,r,o){var s=o.z||t.length,a=new hn(i+s+5*(1+Math.ceil(s/7e3))+r),c=a.subarray(i,a.length-r),u=o.l,l=7&(o.r||0);if(n){l&&(c[0]=o.r>>3);for(var f=Jn[n-1],h=f>>13,d=8191&f,v=(1<<e)-1,p=o.p||new dn(32768),w=o.h||new dn(v+1),m=Math.ceil(e/3),y=2*m,g=function(n){return(t[n]^t[n+1]<<m^t[n+2]<<y)&v},b=new vn(25e3),k=new dn(288),T=new dn(32),S=0,x=0,I=o.i||0,_=0,M=o.w||0,E=0;I+2<s;++I){var A=g(I),z=32767&I,D=w[A];if(p[z]=D,w[A]=z,M<=I){var C=s-I;if((S>7e3||_>24576)&&(C>423||!u)){l=Yn(t,c,0,b,k,T,x,_,E,I-E,l),_=S=x=0,E=I;for(var U=0;U<286;++U)k[U]=0;for(U=0;U<30;++U)T[U]=0}var L=2,P=0,R=d,$=z-D&32767;if(C>2&&A==g(I-$))for(var O=Math.min(h,C)-1,B=Math.min(32767,I),j=Math.min(258,C);$<=B&&--R&&z!=D;){if(t[I+L]==t[I+L-$]){for(var q=0;q<j&&t[I+q]==t[I+q-$];++q);if(q>L){if(L=q,P=$,q>O)break;var F=Math.min($,q-2),H=0;for(U=0;U<F;++U){var N=I-$+U&32767,Z=N-p[N]&32767;Z>H&&(H=Z,D=N)}}}$+=(z=D)-(D=p[z])&32767}if(P){b[_++]=268435456|kn[L]<<18|xn[P];var X=31&kn[L],G=31&xn[P];x+=pn[X]+wn[G],++k[257+X],++T[G],M=I+L,++S}else b[_++]=t[I],++k[t[I]]}}for(I=Math.max(I,M);I<s;++I)b[_++]=t[I],++k[t[I]];l=Yn(t,c,u,b,k,T,x,_,E,I-E,l),u||(o.r=7&l|c[l/8|0]<<3,l-=7,o.h=w,o.p=p,o.i=I,o.w=M)}else{for(I=o.w||0;I<s+u;I+=65535){var K=I+65535;K>=s&&(c[l/8|0]=u,K=s),l=Vn(c,l+1,t.subarray(I,K))}o.i=s}return Bn(a,0,i+On(l)+r)},te=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var e=n,i=9;--i;)e=(1&e&&-306674912)^e>>>1;t[n]=e}return t}(),ne=function(){var t=-1;return{p:function(n){for(var e=t,i=0;i<n.length;++i)e=te[255&e^n[i]]^e>>>8;t=e},d:function(){return~t}}},ee=function(){var t=1,n=0;return{p:function(e){for(var i=t,r=n,o=0|e.length,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)r+=i+=e[s];i=(65535&i)+15*(i>>16),r=(65535&r)+15*(r>>16)}t=i,n=r},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},ie=function(t,n,e,i,r){if(!r&&(r={l:1},n.dictionary)){var o=n.dictionary.subarray(-32768),s=new hn(o.length+t.length);s.set(o),s.set(t,o.length),t=s,r.w=o.length}return Wn(t,null==n.level?6:n.level,null==n.mem?r.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+n.mem,e,i,r)},re=function(t,n){var e={};for(var i in t)e[i]=t[i];for(var i in n)e[i]=n[i];return e},oe=function(t,n,e){for(var i=t(),r=t.toString(),o=r.slice(r.indexOf("[")+1,r.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<i.length;++s){var a=i[s],c=o[s];if("function"==typeof a){n+=";"+c+"=";var u=a.toString();if(a.prototype)if(-1!=u.indexOf("[native code]")){var l=u.indexOf(" ",8)+1;n+=u.slice(l,u.indexOf("(",l))}else for(var f in n+=u,a.prototype)n+=";"+c+".prototype."+f+"="+a.prototype[f].toString();else n+=u}else e[c]=a}return n},se=[],ae=function(t,n,e,i){if(!se[e]){for(var r="",o={},s=t.length-1,a=0;a<s;++a)r=oe(t[a],r,o);se[e]={c:oe(t[s],r,o),e:o}}var c=re({},se[e].e);return function(t,n,e,i,r){var o=new Worker(fn[n]||(fn[n]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return o.onmessage=function(t){var n=t.data,e=n.$e$;if(e){var i=new Error(e[0]);i.code=e[1],i.stack=e[2],r(i,null)}else r(null,n)},o.postMessage(e,i),o}(se[e].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+n.toString()+"}",e,c,function(t){var n=[];for(var e in t)t[e].buffer&&n.push((t[e]=new t[e].constructor(t[e])).buffer);return n}(c),i)},ce=function(){return[hn,dn,vn,pn,wn,mn,bn,Sn,Cn,Ln,In,jn,En,Pn,Rn,$n,On,Bn,qn,Fn,$e,ve,pe]},ue=function(){return[hn,dn,vn,pn,wn,mn,kn,xn,Dn,An,Un,zn,In,Jn,Qn,En,Hn,Nn,Zn,Xn,Gn,Kn,Vn,Yn,On,Bn,Wn,ie,Ue,ve]},le=function(){return[Se,_e,Te,ne,te]},fe=function(){return[xe,Ie]},he=function(){return[Me,Te,ee]},de=function(){return[Ee]},ve=function(t){return postMessage(t,[t.buffer])},pe=function(t){return t&&{out:t.size&&new hn(t.size),dictionary:t.dictionary}},we=function(t,n,e,i,r,o){var s=ae(e,i,r,function(t,n){s.terminate(),o(t,n)});return s.postMessage([t,n],n.consume?[t.buffer]:[]),function(){s.terminate()}},me=function(t){return t.ondata=function(t,n){return postMessage([t,n],[t.buffer])},function(n){n.data.length?(t.push(n.data[0],n.data[1]),postMessage([n.data[0].length])):t.flush()}},ye=function(t,n,e,i,r,o,s){var a,c=ae(t,i,r,function(t,e){t?(c.terminate(),n.ondata.call(n,t)):Array.isArray(e)?1==e.length?(n.queuedSize-=e[0],n.ondrain&&n.ondrain(e[0])):(e[1]&&c.terminate(),n.ondata.call(n,t,e[0],e[1])):s(e)});c.postMessage(e),n.queuedSize=0,n.push=function(t,e){n.ondata||qn(5),a&&n.ondata(qn(4,0,1),null,!!e),n.queuedSize+=t.length,c.postMessage([t,a=e],[t.buffer])},n.terminate=function(){c.terminate()},o&&(n.flush=function(){c.postMessage([])})},ge=function(t,n){return t[n]|t[n+1]<<8},be=function(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24)>>>0},ke=function(t,n){return be(t,n)+4294967296*be(t,n+4)},Te=function(t,n,e){for(;e;++n)t[n]=e,e>>>=8},Se=function(t,n){var e=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&Te(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),e){t[3]=8;for(var i=0;i<=e.length;++i)t[i+10]=e.charCodeAt(i)}},xe=function(t){31==t[0]&&139==t[1]&&8==t[2]||qn(6,"invalid gzip data");var n=t[3],e=10;4&n&&(e+=2+(t[10]|t[11]<<8));for(var i=(n>>3&1)+(n>>4&1);i>0;i-=!t[e++]);return e+(2&n)},Ie=function(t){var n=t.length;return(t[n-4]|t[n-3]<<8|t[n-2]<<16|t[n-1]<<24)>>>0},_e=function(t){return 10+(t.filename?t.filename.length+1:0)},Me=function(t,n){var e=n.level,i=0==e?0:e<6?1:9==e?3:2;if(t[0]=120,t[1]=i<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var r=ee();r.p(n.dictionary),Te(t,2,r.d())}},Ee=function(t,n){return(8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31)&&qn(6,"invalid zlib data"),(t[1]>>5&1)==+!n&&qn(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)};function Ae(t,n){return"function"==typeof t&&(n=t,t={}),this.ondata=n,t}var ze=function(){function t(t,n){if("function"==typeof t&&(n=t,t={}),this.ondata=n,this.o=t||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new hn(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return t.prototype.p=function(t,n){this.ondata(ie(t,this.o,0,0,this.s),n)},t.prototype.push=function(t,n){this.ondata||qn(5),this.s.l&&qn(4);var e=t.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new hn(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var r=this.b.length-this.s.z;this.b.set(t.subarray(0,r),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(t.subarray(r),32768),this.s.z=t.length-r+32768,this.s.i=32766,this.s.w=32768}else this.b.set(t,this.s.z),this.s.z+=t.length;this.s.l=1&n,(this.s.z>this.s.w+8191||n)&&(this.p(this.b,n||!1),this.s.w=this.s.i,this.s.i-=2)},t.prototype.flush=function(){this.ondata||qn(5),this.s.l&&qn(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},t}(),De=function(){return function(t,n){ye([ue,function(){return[me,ze]}],this,Ae.call(this,t,n),function(t){var n=new ze(t.data);onmessage=me(n)},6,1)}}();function Ce(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&qn(7),we(t,n,[ue],function(t){return ve(Ue(t.data[0],t.data[1]))},0,e)}function Ue(t,n){return ie(t,n||{},0,0)}var Le=function(){function t(t,n){"function"==typeof t&&(n=t,t={}),this.ondata=n;var e=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:e?e.length:0},this.o=new hn(32768),this.p=new hn(0),e&&this.o.set(e)}return t.prototype.e=function(t){if(this.ondata||qn(5),this.d&&qn(4),this.p.length){if(t.length){var n=new hn(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length),this.p=n}}else this.p=t},t.prototype.c=function(t){this.s.i=+(this.d=t||!1);var n=this.s.b,e=Fn(this.p,this.s,this.o);this.ondata(Bn(e,n,this.s.b),this.d),this.o=Bn(e,this.s.b-32768),this.s.b=this.o.length,this.p=Bn(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,n){this.e(t),this.c(n)},t}(),Pe=function(){return function(t,n){ye([ce,function(){return[me,Le]}],this,Ae.call(this,t,n),function(t){var n=new Le(t.data);onmessage=me(n)},7,0)}}();function Re(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&qn(7),we(t,n,[ce],function(t){return ve($e(t.data[0],pe(t.data[1])))},1,e)}function $e(t,n){return Fn(t,{i:2},n&&n.out,n&&n.dictionary)}var Oe=function(){function t(t,n){this.c=ne(),this.l=0,this.v=1,ze.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),this.l+=t.length,ze.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var e=ie(t,this.o,this.v&&_e(this.o),n&&8,this.s);this.v&&(Se(e,this.o),this.v=0),n&&(Te(e,e.length-8,this.c.d()),Te(e,e.length-4,this.l)),this.ondata(e,n)},t.prototype.flush=function(){ze.prototype.flush.call(this)},t}(),Be=function(){return function(t,n){ye([ue,le,function(){return[me,ze,Oe]}],this,Ae.call(this,t,n),function(t){var n=new Oe(t.data);onmessage=me(n)},8,1)}}();function je(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&qn(7),we(t,n,[ue,le,function(){return[qe]}],function(t){return ve(qe(t.data[0],t.data[1]))},2,e)}function qe(t,n){n||(n={});var e=ne(),i=t.length;e.p(t);var r=ie(t,n,_e(n),8),o=r.length;return Se(r,n),Te(r,o-8,e.d()),Te(r,o-4,i),r}var Fe=function(){function t(t,n){this.v=1,this.r=0,Le.call(this,t,n)}return t.prototype.push=function(t,n){if(Le.prototype.e.call(this,t),this.r+=t.length,this.v){var e=this.p.subarray(this.v-1),i=e.length>3?xe(e):4;if(i>e.length){if(!n)return}else this.v>1&&this.onmember&&this.onmember(this.r-e.length);this.p=e.subarray(i),this.v=0}Le.prototype.c.call(this,n),!this.s.f||this.s.l||n||(this.v=On(this.s.p)+9,this.s={i:0},this.o=new hn(0),this.push(new hn(0),n))},t}(),He=function(){return function(t,n){var e=this;ye([ce,fe,function(){return[me,Le,Fe]}],this,Ae.call(this,t,n),function(t){var n=new Fe(t.data);n.onmember=function(t){return postMessage(t)},onmessage=me(n)},9,0,function(t){return e.onmember&&e.onmember(t)})}}();function Ne(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&qn(7),we(t,n,[ce,fe,function(){return[Ze]}],function(t){return ve(Ze(t.data[0],t.data[1]))},3,e)}function Ze(t,n){var e=xe(t);return e+8>t.length&&qn(6,"invalid gzip data"),Fn(t.subarray(e,-8),{i:2},n&&n.out||new hn(Ie(t)),n&&n.dictionary)}var Xe=function(){function t(t,n){this.c=ee(),this.v=1,ze.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),ze.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var e=ie(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(Me(e,this.o),this.v=0),n&&Te(e,e.length-4,this.c.d()),this.ondata(e,n)},t.prototype.flush=function(){ze.prototype.flush.call(this)},t}(),Ge=function(){return function(t,n){ye([ue,he,function(){return[me,ze,Xe]}],this,Ae.call(this,t,n),function(t){var n=new Xe(t.data);onmessage=me(n)},10,1)}}();function Ke(t,n){n||(n={});var e=ee();e.p(t);var i=ie(t,n,n.dictionary?6:2,4);return Me(i,n),Te(i,i.length-4,e.d()),i}var Ve=function(){function t(t,n){Le.call(this,t,n),this.v=t&&t.dictionary?2:1}return t.prototype.push=function(t,n){if(Le.prototype.e.call(this,t),this.v){if(this.p.length<6&&!n)return;this.p=this.p.subarray(Ee(this.p,this.v-1)),this.v=0}n&&(this.p.length<4&&qn(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Le.prototype.c.call(this,n)},t}(),Ye=function(){return function(t,n){ye([ce,de,function(){return[me,Le,Ve]}],this,Ae.call(this,t,n),function(t){var n=new Ve(t.data);onmessage=me(n)},11,0)}}();function Je(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&qn(7),we(t,n,[ce,de,function(){return[Qe]}],function(t){return ve(Qe(t.data[0],pe(t.data[1])))},5,e)}function Qe(t,n){return Fn(t.subarray(Ee(t,n&&n.dictionary),-4),{i:2},n&&n.out,n&&n.dictionary)}var We=function(){function t(t,n){this.o=Ae.call(this,t,n)||{},this.G=Fe,this.I=Le,this.Z=Ve}return t.prototype.i=function(){var t=this;this.s.ondata=function(n,e){t.ondata(n,e)}},t.prototype.push=function(t,n){if(this.ondata||qn(5),this.s)this.s.push(t,n);else{if(this.p&&this.p.length){var e=new hn(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length)}else this.p=t;this.p.length>2&&(this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,n),this.p=null)}},t}(),ti=function(){function t(t,n){We.call(this,t,n),this.queuedSize=0,this.G=He,this.I=Pe,this.Z=Ye}return t.prototype.i=function(){var t=this;this.s.ondata=function(n,e,i){t.ondata(n,e,i)},this.s.ondrain=function(n){t.queuedSize-=n,t.ondrain&&t.ondrain(n)}},t.prototype.push=function(t,n){this.queuedSize+=t.length,We.prototype.push.call(this,t,n)},t}(),ni=function(t,n,e,i){for(var r in t){var o=t[r],s=n+r,a=i;Array.isArray(o)&&(a=re(i,o[1]),o=o[0]),o instanceof hn?e[s]=[o,a]:(e[s+="/"]=[new hn(0),a],ni(o,s,e,i))}},ei="undefined"!=typeof TextEncoder&&new TextEncoder,ii="undefined"!=typeof TextDecoder&&new TextDecoder,ri=0;try{ii.decode(Qn,{stream:!0}),ri=1}catch(t){}var oi=function(t){for(var n="",e=0;;){var i=t[e++],r=(i>127)+(i>223)+(i>239);if(e+r>t.length)return{s:n,r:Bn(t,e-1)};r?3==r?(i=((15&i)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i)):n+=String.fromCharCode(1&r?(31&i)<<6|63&t[e++]:(15&i)<<12|(63&t[e++])<<6|63&t[e++]):n+=String.fromCharCode(i)}},si=function(){function t(t){this.ondata=t,ri?this.t=new TextDecoder:this.p=Qn}return t.prototype.push=function(t,n){if(this.ondata||qn(5),n=!!n,this.t)return this.ondata(this.t.decode(t,{stream:!0}),n),void(n&&(this.t.decode().length&&qn(8),this.t=null));this.p||qn(4);var e=new hn(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length);var i=oi(e),r=i.s,o=i.r;n?(o.length&&qn(8),this.p=null):this.p=o,this.ondata(r,n)},t}(),ai=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||qn(5),this.d&&qn(4),this.ondata(ci(t),this.d=n||!1)},t}();function ci(t,n){if(n){for(var e=new hn(t.length),i=0;i<t.length;++i)e[i]=t.charCodeAt(i);return e}if(ei)return ei.encode(t);var r=t.length,o=new hn(t.length+(t.length>>1)),s=0,a=function(t){o[s++]=t};for(i=0;i<r;++i){if(s+5>o.length){var c=new hn(s+8+(r-i<<1));c.set(o),o=c}var u=t.charCodeAt(i);u<128||n?a(u):u<2048?(a(192|u>>6),a(128|63&u)):u>55295&&u<57344?(a(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++i))>>18),a(128|u>>12&63),a(128|u>>6&63),a(128|63&u)):(a(224|u>>12),a(128|u>>6&63),a(128|63&u))}return Bn(o,0,s)}function ui(t,n){if(n){for(var e="",i=0;i<t.length;i+=16384)e+=String.fromCharCode.apply(null,t.subarray(i,i+16384));return e}if(ii)return ii.decode(t);var r=oi(t),o=r.s;return(e=r.r).length&&qn(8),o}var li=function(t){return 1==t?3:t<6?2:9==t?1:0},fi=function(t,n){return n+30+ge(t,n+26)+ge(t,n+28)},hi=function(t,n,e){var i=ge(t,n+28),r=ui(t.subarray(n+46,n+46+i),!(2048&ge(t,n+8))),o=n+46+i,s=be(t,n+20),a=e&&4294967295==s?di(t,o):[s,be(t,n+24),be(t,n+42)],c=a[0],u=a[1],l=a[2];return[ge(t,n+10),c,u,r,o+ge(t,n+30)+ge(t,n+32),l]},di=function(t,n){for(;1!=ge(t,n);n+=4+ge(t,n+2));return[ke(t,n+12),ke(t,n+4),ke(t,n+20)]},vi=function(t){var n=0;if(t)for(var e in t){var i=t[e].length;i>65535&&qn(9),n+=i+4}return n},pi=function(t,n,e,i,r,o,s,a){var c=i.length,u=e.extra,l=a&&a.length,f=vi(u);Te(t,n,null!=s?33639248:67324752),n+=4,null!=s&&(t[n++]=20,t[n++]=e.os),t[n]=20,n+=2,t[n++]=e.flag<<1|(o<0&&8),t[n++]=r&&8,t[n++]=255&e.compression,t[n++]=e.compression>>8;var h=new Date(null==e.mtime?Date.now():e.mtime),d=h.getFullYear()-1980;if((d<0||d>119)&&qn(10),Te(t,n,d<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),n+=4,-1!=o&&(Te(t,n,e.crc),Te(t,n+4,o<0?-o-2:o),Te(t,n+8,e.size)),Te(t,n+12,c),Te(t,n+14,f),n+=16,null!=s&&(Te(t,n,l),Te(t,n+6,e.attrs),Te(t,n+10,s),n+=14),t.set(i,n),n+=c,f)for(var v in u){var p=u[v],w=p.length;Te(t,n,+v),Te(t,n+2,w),t.set(p,n+4),n+=4+w}return l&&(t.set(a,n),n+=l),n},wi=function(t,n,e,i,r){Te(t,n,101010256),Te(t,n+8,e),Te(t,n+10,e),Te(t,n+12,i),Te(t,n+16,r)},mi=function(){function t(t){this.filename=t,this.c=ne(),this.size=0,this.compression=0}return t.prototype.process=function(t,n){this.ondata(null,t,n)},t.prototype.push=function(t,n){this.ondata||qn(5),this.c.p(t),this.size+=t.length,n&&(this.crc=this.c.d()),this.process(t,n||!1)},t}(),yi=function(){function t(t,n){var e=this;n||(n={}),mi.call(this,t),this.d=new ze(n,function(t,n){e.ondata(null,t,n)}),this.compression=8,this.flag=li(n.level)}return t.prototype.process=function(t,n){try{this.d.push(t,n)}catch(t){this.ondata(t,null,n)}},t.prototype.push=function(t,n){mi.prototype.push.call(this,t,n)},t}(),gi=function(){function t(t,n){var e=this;n||(n={}),mi.call(this,t),this.d=new De(n,function(t,n,i){e.ondata(t,n,i)}),this.compression=8,this.flag=li(n.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,n){this.d.push(t,n)},t.prototype.push=function(t,n){mi.prototype.push.call(this,t,n)},t}(),bi=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var n=this;if(this.ondata||qn(5),2&this.d)this.ondata(qn(4+8*(1&this.d),0,1),null,!1);else{var e=ci(t.filename),i=e.length,r=t.comment,o=r&&ci(r),s=i!=t.filename.length||o&&r.length!=o.length,a=i+vi(t.extra)+30;i>65535&&this.ondata(qn(11,0,1),null,!1);var c=new hn(a);pi(c,0,t,e,s,-1);var u=[c],l=function(){for(var t=0,e=u;t<e.length;t++)n.ondata(null,e[t],!1);u=[]},f=this.d;this.d=0;var h=this.u.length,d=re(t,{f:e,u:s,o:o,t:function(){t.terminate&&t.terminate()},r:function(){if(l(),f){var t=n.u[h+1];t?t.r():n.d=1}f=1}}),v=0;t.ondata=function(e,i,r){if(e)n.ondata(e,i,r),n.terminate();else if(v+=i.length,u.push(i),r){var o=new hn(16);Te(o,0,134695760),Te(o,4,t.crc),Te(o,8,v),Te(o,12,t.size),u.push(o),d.c=v,d.b=a+v+16,d.crc=t.crc,d.size=t.size,f&&d.r(),f=1}else f&&l()},this.u.push(d)}},t.prototype.end=function(){var t=this;2&this.d?this.ondata(qn(4+8*(1&this.d),0,1),null,!0):(this.d?this.e():this.u.push({r:function(){1&t.d&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3)},t.prototype.e=function(){for(var t=0,n=0,e=0,i=0,r=this.u;i<r.length;i++)e+=46+(c=r[i]).f.length+vi(c.extra)+(c.o?c.o.length:0);for(var o=new hn(e+22),s=0,a=this.u;s<a.length;s++){var c;pi(o,t,c=a[s],c.f,c.u,-c.c-2,n,c.o),t+=46+c.f.length+vi(c.extra)+(c.o?c.o.length:0),n+=c.b}wi(o,t,this.u.length,e,n),this.ondata(null,o,!0),this.d=2},t.prototype.terminate=function(){for(var t=0,n=this.u;t<n.length;t++)n[t].t();this.d=2},t}(),ki=function(){function t(){}return t.prototype.push=function(t,n){this.ondata(null,t,n)},t.compression=0,t}(),Ti=function(){function t(){var t=this;this.i=new Le(function(n,e){t.ondata(null,n,e)})}return t.prototype.push=function(t,n){try{this.i.push(t,n)}catch(t){this.ondata(t,null,n)}},t.compression=8,t}(),Si=function(){function t(t,n){var e=this;n<32e4?this.i=new Le(function(t,n){e.ondata(null,t,n)}):(this.i=new Pe(function(t,n,i){e.ondata(t,n,i)}),this.terminate=this.i.terminate)}return t.prototype.push=function(t,n){this.i.terminate&&(t=Bn(t,0)),this.i.push(t,n)},t.compression=8,t}(),xi=function(){function t(t){this.onfile=t,this.k=[],this.o={0:ki},this.p=Qn}return t.prototype.push=function(t,n){var e=this;if(this.onfile||qn(5),this.p||qn(4),this.c>0){var i=Math.min(this.c,t.length),r=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(r,!this.c):this.k[0].push(r),(t=t.subarray(i)).length)return this.push(t,n)}else{var o=0,s=0,a=void 0,c=void 0;this.p.length?t.length?((c=new hn(this.p.length+t.length)).set(this.p),c.set(t,this.p.length)):c=this.p:c=t;for(var u=c.length,l=this.c,f=l&&this.d,h=function(){var t,n=be(c,s);if(67324752==n){o=1,a=s,d.d=null,d.c=0;var i=ge(c,s+6),r=ge(c,s+8),f=2048&i,h=8&i,v=ge(c,s+26),p=ge(c,s+28);if(u>s+30+v+p){var w=[];d.k.unshift(w),o=2;var m,y=be(c,s+18),g=be(c,s+22),b=ui(c.subarray(s+30,s+=30+v),!f);4294967295==y?(t=h?[-2]:di(c,s),y=t[0],g=t[1]):h&&(y=-1),s+=p,d.c=y;var k={name:b,compression:r,start:function(){if(k.ondata||qn(5),y){var t=e.o[r];t||k.ondata(qn(14,"unknown compression type "+r,1),null,!1),(m=y<0?new t(b):new t(b,y,g)).ondata=function(t,n,e){k.ondata(t,n,e)};for(var n=0,i=w;n<i.length;n++)m.push(i[n],!1);e.k[0]==w&&e.c?e.d=m:m.push(Qn,!0)}else k.ondata(null,Qn,!0)},terminate:function(){m&&m.terminate&&m.terminate()}};y>=0&&(k.size=y,k.originalSize=g),d.onfile(k)}return"break"}if(l){if(134695760==n)return a=s+=12+(-2==l&&8),o=3,d.c=0,"break";if(33639248==n)return a=s-=4,o=3,d.c=0,"break"}},d=this;s<u-4&&"break"!==h();++s);if(this.p=Qn,l<0){var v=c.subarray(0,o?a-12-(-2==l&&8)-(134695760==be(c,a-16)&&4):s);f?f.push(v,!!o):this.k[+(2==o)].push(v)}if(2&o)return this.push(c.subarray(s),n);this.p=c.subarray(s)}n&&(this.c&&qn(13),this.p=null)},t.prototype.register=function(t){this.o[t.compression]=t},t}(),Ii="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(t){t()},_i=Object.freeze({__proto__:null,AsyncCompress:Be,AsyncDecompress:ti,AsyncDeflate:De,AsyncGunzip:He,AsyncGzip:Be,AsyncInflate:Pe,AsyncUnzipInflate:Si,AsyncUnzlib:Ye,AsyncZipDeflate:gi,AsyncZlib:Ge,Compress:Oe,DecodeUTF8:si,Decompress:We,Deflate:ze,EncodeUTF8:ai,FlateErrorCode:{UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14},Gunzip:Fe,Gzip:Oe,Inflate:Le,Unzip:xi,UnzipInflate:Ti,UnzipPassThrough:ki,Unzlib:Ve,Zip:bi,ZipDeflate:yi,ZipPassThrough:mi,Zlib:Xe,compress:je,compressSync:qe,decompress:function(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&qn(7),31==t[0]&&139==t[1]&&8==t[2]?Ne(t,n,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Re(t,n,e):Je(t,n,e)},decompressSync:function(t,n){return 31==t[0]&&139==t[1]&&8==t[2]?Ze(t,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?$e(t,n):Qe(t,n)},deflate:Ce,deflateSync:Ue,gunzip:Ne,gunzipSync:Ze,gzip:je,gzipSync:qe,inflate:Re,inflateSync:$e,strFromU8:ui,strToU8:ci,unzip:function(t,n,e){e||(e=n,n={}),"function"!=typeof e&&qn(7);var i=[],r=function(){for(var t=0;t<i.length;++t)i[t]()},o={},s=function(t,n){Ii(function(){e(t,n)})};Ii(function(){s=e});for(var a=t.length-22;101010256!=be(t,a);--a)if(!a||t.length-a>65558)return s(qn(13,0,1),null),r;var c=ge(t,a+8);if(c){var u=c,l=be(t,a+16),f=4294967295==l||65535==u;if(f){var h=be(t,a-12);(f=101075792==be(t,h))&&(u=c=be(t,h+32),l=be(t,h+48))}for(var d=n&&n.filter,v=function(n){var e=hi(t,l,f),a=e[0],u=e[1],h=e[2],v=e[3],p=e[4],w=fi(t,e[5]);l=p;var m=function(t,n){t?(r(),s(t,null)):(n&&(o[v]=n),--c||s(null,o))};if(!d||d({name:v,size:u,originalSize:h,compression:a}))if(a)if(8==a){var y=t.subarray(w,w+u);if(h<524288||u>.8*h)try{m(null,$e(y,{out:new hn(h)}))}catch(t){m(t,null)}else i.push(Re(y,{size:h},m))}else m(qn(14,"unknown compression type "+a,1),null);else m(null,Bn(t,w,w+u));else m(null,null)},p=0;p<u;++p)v()}else s(null,{});return r},unzipSync:function(t,n){for(var e={},i=t.length-22;101010256!=be(t,i);--i)(!i||t.length-i>65558)&&qn(13);var r=ge(t,i+8);if(!r)return{};var o=be(t,i+16),s=4294967295==o||65535==r;if(s){var a=be(t,i-12);(s=101075792==be(t,a))&&(r=be(t,a+32),o=be(t,a+48))}for(var c=n&&n.filter,u=0;u<r;++u){var l=hi(t,o,s),f=l[0],h=l[1],d=l[2],v=l[3],p=l[4],w=fi(t,l[5]);o=p,c&&!c({name:v,size:h,originalSize:d,compression:f})||(f?8==f?e[v]=$e(t.subarray(w,w+h),{out:new hn(d)}):qn(14,"unknown compression type "+f):e[v]=Bn(t,w,w+h))}return e},unzlib:Je,unzlibSync:Qe,zip:function(t,n,e){e||(e=n,n={}),"function"!=typeof e&&qn(7);var i={};ni(t,"",i,n);var r=Object.keys(i),o=r.length,s=0,a=0,c=o,u=new Array(o),l=[],f=function(){for(var t=0;t<l.length;++t)l[t]()},h=function(t,n){Ii(function(){e(t,n)})};Ii(function(){h=e});var d=function(){var t=new hn(a+22),n=s,e=a-s;a=0;for(var i=0;i<c;++i){var r=u[i];try{var o=r.c.length;pi(t,a,r,r.f,r.u,o);var l=30+r.f.length+vi(r.extra),f=a+l;t.set(r.c,f),pi(t,s,r,r.f,r.u,o,a,r.m),s+=16+l+(r.m?r.m.length:0),a=f+o}catch(t){return h(t,null)}}wi(t,s,u.length,e,n),h(null,t)};o||d();for(var v=function(t){var n=r[t],e=i[n],c=e[0],v=e[1],p=ne(),w=c.length;p.p(c);var m=ci(n),y=m.length,g=v.comment,b=g&&ci(g),k=b&&b.length,T=vi(v.extra),S=0==v.level?0:8,x=function(e,i){if(e)f(),h(e,null);else{var r=i.length;u[t]=re(v,{size:w,crc:p.d(),c:i,f:m,m:b,u:y!=n.length||b&&g.length!=k,compression:S}),s+=30+y+T+r,a+=76+2*(y+T)+(k||0)+r,--o||d()}};if(y>65535&&x(qn(11,0,1),null),S)if(w<16e4)try{x(null,Ue(c,v))}catch(t){x(t,null)}else l.push(Ce(c,v,x));else x(null,c)},p=0;p<c;++p)v(p);return f},zipSync:function(t,n){n||(n={});var e={},i=[];ni(t,"",e,n);var r=0,o=0;for(var s in e){var a=e[s],c=a[0],u=a[1],l=0==u.level?0:8,f=(S=ci(s)).length,h=u.comment,d=h&&ci(h),v=d&&d.length,p=vi(u.extra);f>65535&&qn(11);var w=l?Ue(c,u):c,m=w.length,y=ne();y.p(c),i.push(re(u,{size:c.length,crc:y.d(),c:w,f:S,m:d,u:f!=s.length||d&&h.length!=v,o:r,compression:l})),r+=30+f+p+m,o+=76+2*(f+p)+(v||0)+m}for(var g=new hn(o+22),b=r,k=o-r,T=0;T<i.length;++T){var S;pi(g,(S=i[T]).o,S,S.f,S.u,S.c.length);var x=30+S.f.length+vi(S.extra);g.set(S.c,S.o+x),pi(g,r,S,S.f,S.u,S.c.length,S.o,S.m),r+=16+x+(S.m?S.m.length:0)}return wi(g,r,i.length,k,b),g},zlib:function(t,n,e){return e||(e=n,n={}),"function"!=typeof e&&qn(7),we(t,n,[ue,he,function(){return[Ke]}],function(t){return ve(Ke(t.data[0],t.data[1]))},4,e)},zlibSync:Ke});t.createSession=async function(t,n){const e=n?.apiURL??"https://falcon-ingest-k8s.stage.incodetest.com",i=n?.timeout??1e4,r=new AbortController;let o=null,s=!1,a=()=>{};i&&(o=f(()=>{s=!0,r.abort()},i));const c=n?.signal;if(c)if(c.aborted)r.abort();else{const t=()=>r.abort();c.addEventListener("abort",t,{once:!0}),a=()=>c.removeEventListener("abort",t)}try{const n=await fetch(`${e}/api/v1/sdk/init`,{method:"POST",headers:{"content-type":"application/json","x-api-key":t,"x-api-version":"1.0"},signal:r.signal});if(!n.ok){let t=n.statusText;try{const e=await n.json();e.errorMessage&&(t=e.errorMessage)}catch{}return{token:null,expiresAt:null,tokenType:null,eventsCollectionEnabled:!1,error:{status:n.status,message:t}}}const i=await n.json();return{token:i.token,expiresAt:i.expiresAt,tokenType:i.tokenType,eventsCollectionEnabled:!0,error:null}}catch(t){throw new Error((s?"[TRI] createSession timed out":"[TRI] Failed to create session:")+" "+t.message)}finally{h(o),a()}},t.default=ln,Object.defineProperty(t,"Bt",{value:!0})});
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n={},t=Uint8Array,i=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),f=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),u=function(n,t){for(var e=new i(31),f=0;f<31;++f)e[f]=t+=1<<n[f-1];var s=new r(e[30]);for(f=1;f<30;++f)for(var u=e[f];u<e[f+1];++u)s[u]=u-e[f]<<5|f;return{b:e,r:s}},o=u(e,2),a=o.b,h=o.r;a[28]=258,h[258]=28;for(var c=u(f,0),v=c.b,l=c.r,w=new i(32768),d=0;d<32768;++d){var p=(43690&d)>>1|(21845&d)<<1;w[d]=((65280&(p=(61680&(p=(52428&p)>>2|(13107&p)<<2))>>4|(3855&p)<<4))>>8|(255&p)<<8)>>1}var y=function(n,t,r){for(var e=n.length,f=0,s=new i(t);f<e;++f)n[f]&&++s[n[f]-1];var u,o=new i(t);for(f=1;f<t;++f)o[f]=o[f-1]+s[f-1]<<1;if(r){u=new i(1<<t);var a=15-t;for(f=0;f<e;++f)if(n[f])for(var h=f<<4|n[f],c=t-n[f],v=o[n[f]-1]++<<c,l=v|(1<<c)-1;v<=l;++v)u[w[v]>>a]=h}else for(u=new i(e),f=0;f<e;++f)n[f]&&(u[f]=w[o[n[f]-1]++]>>15-n[f]);return u},m=new t(288);for(d=0;d<144;++d)m[d]=8;for(d=144;d<256;++d)m[d]=9;for(d=256;d<280;++d)m[d]=7;for(d=280;d<288;++d)m[d]=8;var g=new t(32);for(d=0;d<32;++d)g[d]=5;var k=y(m,9,0),M=y(m,9,1),b=y(g,5,0),z=y(g,5,1),x=function(n){for(var t=n[0],i=1;i<n.length;++i)n[i]>t&&(t=n[i]);return t},T=function(n,t,i){var r=t/8|0;return(n[r]|n[r+1]<<8)>>(7&t)&i},D=function(n,t){var i=t/8|0;return(n[i]|n[i+1]<<8|n[i+2]<<16)>>(7&t)},E=function(n){return(n+7)/8|0},S=function(n,i,r){return(null==i||i<0)&&(i=0),(null==r||r>n.length)&&(r=n.length),new t(n.subarray(i,r))},I={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14},A=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],F=function(n,t,i){var r=new Error(t||A[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,F),!i)throw r;return r},U=function(n,i,r,u){var o=n.length,h=u?u.length:0;if(!o||i.f&&!i.l)return r||new t(0);var c=!r,l=c||2!=i.i,w=i.i;c&&(r=new t(3*o));var d=function(n){var i=r.length;if(n>i){var e=new t(Math.max(2*i,n));e.set(r),r=e}},p=i.f||0,m=i.p||0,g=i.b||0,k=i.l,b=i.d,I=i.m,A=i.n,U=8*o;do{if(!k){p=T(n,m,1);var L=T(n,m+1,3);if(m+=3,!L){var C=n[(G=E(m)+4)-4]|n[G-3]<<8,O=G+C;if(O>o){w&&F(0);break}l&&d(g+C),r.set(n.subarray(G,O),g),i.b=g+=C,i.p=m=8*O,i.f=p;continue}if(1==L)k=M,b=z,I=9,A=5;else if(2==L){var j=T(n,m,31)+257,q=T(n,m+10,15)+4,B=j+T(n,m+5,31)+1;m+=14;for(var H=new t(B),N=new t(19),$=0;$<q;++$)N[s[$]]=T(n,m+3*$,7);m+=3*q;var R=x(N),W=(1<<R)-1,Z=y(N,R,1);for($=0;$<B;){var G,J=Z[T(n,m,W)];if(m+=15&J,(G=J>>4)<16)H[$++]=G;else{var K=0,P=0;for(16==G?(P=3+T(n,m,3),m+=2,K=H[$-1]):17==G?(P=3+T(n,m,7),m+=3):18==G&&(P=11+T(n,m,127),m+=7);P--;)H[$++]=K}}var Q=H.subarray(0,j),V=H.subarray(j);I=x(Q),A=x(V),k=y(Q,I,1),b=y(V,A,1)}else F(1);if(m>U){w&&F(0);break}}l&&d(g+131072);for(var X=(1<<I)-1,Y=(1<<A)-1,_=m;;_=m){var nn=(K=k[D(n,m)&X])>>4;if((m+=15&K)>U){w&&F(0);break}if(K||F(2),nn<256)r[g++]=nn;else{if(256==nn){_=m,k=null;break}var tn=nn-254;nn>264&&(tn=T(n,m,(1<<(fn=e[$=nn-257]))-1)+a[$],m+=fn);var rn=b[D(n,m)&Y],en=rn>>4;if(rn||F(3),m+=15&rn,V=v[en],en>3){var fn=f[en];V+=D(n,m)&(1<<fn)-1,m+=fn}if(m>U){w&&F(0);break}l&&d(g+131072);var sn=g+tn;if(g<V){var un=h-V,on=Math.min(V,sn);for(un+g<0&&F(3);g<on;++g)r[g]=u[un+g]}for(;g<sn;++g)r[g]=r[g-V]}}i.l=k,i.p=_,i.b=g,i.f=p,k&&(p=1,i.m=I,i.d=b,i.n=A)}while(!p);return g!=r.length&&c?S(r,0,g):r.subarray(0,g)},L=function(n,t,i){var r=t/8|0;n[r]|=i<<=7&t,n[r+1]|=i>>8},C=function(n,t,i){var r=t/8|0;n[r]|=i<<=7&t,n[r+1]|=i>>8,n[r+2]|=i>>16},O=function(n,r){for(var e=[],f=0;f<n.length;++f)n[f]&&e.push({s:f,f:n[f]});var s=e.length,u=e.slice();if(!s)return{t:R,l:0};if(1==s){var o=new t(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(n,t){return n.f-t.f}),e.push({s:-1,f:25001});var a=e[0],h=e[1],c=0,v=1,l=2;for(e[0]={s:-1,f:a.f+h.f,l:a,r:h};v!=s-1;)a=e[e[c].f<e[l].f?c++:l++],h=e[c!=v&&e[c].f<e[l].f?c++:l++],e[v++]={s:-1,f:a.f+h.f,l:a,r:h};var w=u[0].s;for(f=1;f<s;++f)u[f].s>w&&(w=u[f].s);var d=new i(w+1),p=j(e[v-1],d,0);if(p>r){f=0;var y=0,m=p-r,g=1<<m;for(u.sort(function(n,t){return d[t.s]-d[n.s]||n.f-t.f});f<s;++f){var k=u[f].s;if(!(d[k]>r))break;y+=g-(1<<p-d[k]),d[k]=r}for(y>>=m;y>0;){var M=u[f].s;d[M]<r?y-=1<<r-d[M]++-1:++f}for(;f>=0&&y;--f){var b=u[f].s;d[b]==r&&(--d[b],++y)}p=r}return{t:new t(d),l:p}},j=function(n,t,i){return-1==n.s?Math.max(j(n.l,t,i+1),j(n.r,t,i+1)):t[n.s]=i},q=function(n){for(var t=n.length;t&&!n[--t];);for(var r=new i(++t),e=0,f=n[0],s=1,u=function(n){r[e++]=n},o=1;o<=t;++o)if(n[o]==f&&o!=t)++s;else{if(!f&&s>2){for(;s>138;s-=138)u(32754);s>2&&(u(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(u(f),--s;s>6;s-=6)u(8304);s>2&&(u(s-3<<5|8208),s=0)}for(;s--;)u(f);s=1,f=n[o]}return{c:r.subarray(0,e),n:t}},B=function(n,t){for(var i=0,r=0;r<t.length;++r)i+=n[r]*t[r];return i},H=function(n,t,i){var r=i.length,e=E(t+2);n[e]=255&r,n[e+1]=r>>8,n[e+2]=255^n[e],n[e+3]=255^n[e+1];for(var f=0;f<r;++f)n[e+f+4]=i[f];return 8*(e+4+r)},N=function(n,t,r,u,o,a,h,c,v,l,w){L(t,w++,r),++o[256];for(var d=O(o,15),p=d.t,M=d.l,z=O(a,15),x=z.t,T=z.l,D=q(p),E=D.c,S=D.n,I=q(x),A=I.c,F=I.n,U=new i(19),j=0;j<E.length;++j)++U[31&E[j]];for(j=0;j<A.length;++j)++U[31&A[j]];for(var N=O(U,7),$=N.t,R=N.l,W=19;W>4&&!$[s[W-1]];--W);var Z,G,J,K,P=l+5<<3,Q=B(o,m)+B(a,g)+h,V=B(o,p)+B(a,x)+h+14+3*W+B(U,$)+2*U[16]+3*U[17]+7*U[18];if(v>=0&&P<=Q&&P<=V)return H(t,w,n.subarray(v,v+l));if(L(t,w,1+(V<Q)),w+=2,V<Q){Z=y(p,M,0),G=p,J=y(x,T,0),K=x;var X=y($,R,0);for(L(t,w,S-257),L(t,w+5,F-1),L(t,w+10,W-4),w+=14,j=0;j<W;++j)L(t,w+3*j,$[s[j]]);w+=3*W;for(var Y=[E,A],_=0;_<2;++_){var nn=Y[_];for(j=0;j<nn.length;++j)L(t,w,X[rn=31&nn[j]]),w+=$[rn],rn>15&&(L(t,w,nn[j]>>5&127),w+=nn[j]>>12)}}else Z=k,G=m,J=b,K=g;for(j=0;j<c;++j){var tn=u[j];if(tn>255){var rn;C(t,w,Z[257+(rn=tn>>18&31)]),w+=G[rn+257],rn>7&&(L(t,w,tn>>23&31),w+=e[rn]);var en=31&tn;C(t,w,J[en]),w+=K[en],en>3&&(C(t,w,tn>>5&8191),w+=f[en])}else C(t,w,Z[tn]),w+=G[tn]}return C(t,w,Z[256]),w+G[256]},$=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),R=new t(0),W=function(n,s,u,o,a,c){var v=c.z||n.length,w=new t(o+v+5*(1+Math.ceil(v/7e3))+a),d=w.subarray(o,w.length-a),p=c.l,y=7&(c.r||0);if(s){y&&(d[0]=c.r>>3);for(var m=$[s-1],g=m>>13,k=8191&m,M=(1<<u)-1,b=c.p||new i(32768),z=c.h||new i(M+1),x=Math.ceil(u/3),T=2*x,D=function(t){return(n[t]^n[t+1]<<x^n[t+2]<<T)&M},I=new r(25e3),A=new i(288),F=new i(32),U=0,L=0,C=c.i||0,O=0,j=c.w||0,q=0;C+2<v;++C){var B=D(C),R=32767&C,W=z[B];if(b[R]=W,z[B]=R,j<=C){var Z=v-C;if((U>7e3||O>24576)&&(Z>423||!p)){y=N(n,d,0,I,A,F,L,O,q,C-q,y),O=U=L=0,q=C;for(var G=0;G<286;++G)A[G]=0;for(G=0;G<30;++G)F[G]=0}var J=2,K=0,P=k,Q=R-W&32767;if(Z>2&&B==D(C-Q))for(var V=Math.min(g,Z)-1,X=Math.min(32767,C),Y=Math.min(258,Z);Q<=X&&--P&&R!=W;){if(n[C+J]==n[C+J-Q]){for(var _=0;_<Y&&n[C+_]==n[C+_-Q];++_);if(_>J){if(J=_,K=Q,_>V)break;var nn=Math.min(Q,_-2),tn=0;for(G=0;G<nn;++G){var rn=C-Q+G&32767,en=rn-b[rn]&32767;en>tn&&(tn=en,W=rn)}}}Q+=(R=W)-(W=b[R])&32767}if(K){I[O++]=268435456|h[J]<<18|l[K];var fn=31&h[J],sn=31&l[K];L+=e[fn]+f[sn],++A[257+fn],++F[sn],j=C+J,++U}else I[O++]=n[C],++A[n[C]]}}for(C=Math.max(C,j);C<v;++C)I[O++]=n[C],++A[n[C]];y=N(n,d,p,I,A,F,L,O,q,C-q,y),p||(c.r=7&y|d[y/8|0]<<3,y-=7,c.h=z,c.p=b,c.i=C,c.w=j)}else{for(C=c.w||0;C<v+p;C+=65535){var un=C+65535;un>=v&&(d[y/8|0]=p,un=v),y=H(d,y+1,n.subarray(C,un))}c.i=v}return S(w,0,o+E(y)+a)},Z=function(){for(var n=new Int32Array(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&-306674912)^i>>>1;n[t]=i}return n}(),G=function(){var n=-1;return{p:function(t){for(var i=n,r=0;r<t.length;++r)i=Z[255&i^t[r]]^i>>>8;n=i},d:function(){return~n}}},J=function(){var n=1,t=0;return{p:function(i){for(var r=n,e=t,f=0|i.length,s=0;s!=f;){for(var u=Math.min(s+2655,f);s<u;++s)e+=r+=i[s];r=(65535&r)+15*(r>>16),e=(65535&e)+15*(e>>16)}n=r,t=e},d:function(){return(255&(n%=65521))<<24|(65280&n)<<8|(255&(t%=65521))<<8|t>>8}}},K=function(n,i,r,e,f){if(!f&&(f={l:1},i.dictionary)){var s=i.dictionary.subarray(-32768),u=new t(s.length+n.length);u.set(s),u.set(n,s.length),n=u,f.w=s.length}return W(n,null==i.level?6:i.level,null==i.mem?f.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):20:12+i.mem,r,e,f)},P=function(n,t){var i={};for(var r in n)i[r]=n[r];for(var r in t)i[r]=t[r];return i},Q=function(n,t,i){for(var r=n(),e=n.toString(),f=e.slice(e.indexOf("[")+1,e.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<r.length;++s){var u=r[s],o=f[s];if("function"==typeof u){t+=";"+o+"=";var a=u.toString();if(u.prototype)if(-1!=a.indexOf("[native code]")){var h=a.indexOf(" ",8)+1;t+=a.slice(h,a.indexOf("(",h))}else for(var c in t+=a,u.prototype)t+=";"+o+".prototype."+c+"="+u.prototype[c].toString();else t+=a}else i[o]=u}return t},V=[],X=function(t,i,r,e){if(!V[r]){for(var f="",s={},u=t.length-1,o=0;o<u;++o)f=Q(t[o],f,s);V[r]={c:Q(t[u],f,s),e:s}}var a=P({},V[r].e);return function(t,i,r,e,f){var s=new Worker(n[i]||(n[i]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return s.onmessage=function(n){var t=n.data,i=t.$e$;if(i){var r=new Error(i[0]);r.code=i[1],r.stack=i[2],f(r,null)}else f(null,t)},s.postMessage(r,e),s}(V[r].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+i.toString()+"}",r,a,function(n){var t=[];for(var i in n)n[i].buffer&&t.push((n[i]=new n[i].constructor(n[i])).buffer);return t}(a),e)},Y=function(){return[t,i,r,e,f,s,a,v,M,z,w,A,y,x,T,D,E,S,F,U,Sn,fn,sn]},_=function(){return[t,i,r,e,f,s,h,l,k,m,b,g,w,$,R,y,L,C,O,j,q,B,H,N,E,S,W,K,xn,fn]},nn=function(){return[wn,yn,ln,G,Z]},tn=function(){return[dn,pn]},rn=function(){return[mn,ln,J]},en=function(){return[gn]},fn=function(n){return postMessage(n,[n.buffer])},sn=function(n){return n&&{out:n.size&&new t(n.size),dictionary:n.dictionary}},un=function(n,t,i,r,e,f){var s=X(i,r,e,function(n,t){s.terminate(),f(n,t)});return s.postMessage([n,t],t.consume?[n.buffer]:[]),function(){s.terminate()}},on=function(n){return n.ondata=function(n,t){return postMessage([n,t],[n.buffer])},function(t){t.data.length?(n.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):n.flush()}},an=function(n,t,i,r,e,f,s){var u,o=X(n,r,e,function(n,i){n?(o.terminate(),t.ondata.call(t,n)):Array.isArray(i)?1==i.length?(t.queuedSize-=i[0],t.ondrain&&t.ondrain(i[0])):(i[1]&&o.terminate(),t.ondata.call(t,n,i[0],i[1])):s(i)});o.postMessage(i),t.queuedSize=0,t.push=function(n,i){t.ondata||F(5),u&&t.ondata(F(4,0,1),null,!!i),t.queuedSize+=n.length,o.postMessage([n,u=i],[n.buffer])},t.terminate=function(){o.terminate()},f&&(t.flush=function(){o.postMessage([])})},hn=function(n,t){return n[t]|n[t+1]<<8},cn=function(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0},vn=function(n,t){return cn(n,t)+4294967296*cn(n,t+4)},ln=function(n,t,i){for(;i;++t)n[t]=i,i>>>=8},wn=function(n,t){var i=t.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=t.level<2?4:9==t.level?2:0,n[9]=3,0!=t.mtime&&ln(n,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){n[3]=8;for(var r=0;r<=i.length;++r)n[r+10]=i.charCodeAt(r)}},dn=function(n){31==n[0]&&139==n[1]&&8==n[2]||F(6,"invalid gzip data");var t=n[3],i=10;4&t&&(i+=2+(n[10]|n[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!n[i++]);return i+(2&t)},pn=function(n){var t=n.length;return(n[t-4]|n[t-3]<<8|n[t-2]<<16|n[t-1]<<24)>>>0},yn=function(n){return 10+(n.filename?n.filename.length+1:0)},mn=function(n,t){var i=t.level,r=0==i?0:i<6?1:9==i?3:2;if(n[0]=120,n[1]=r<<6|(t.dictionary&&32),n[1]|=31-(n[0]<<8|n[1])%31,t.dictionary){var e=J();e.p(t.dictionary),ln(n,2,e.d())}},gn=function(n,t){return(8!=(15&n[0])||n[0]>>4>7||(n[0]<<8|n[1])%31)&&F(6,"invalid zlib data"),(n[1]>>5&1)==+!t&&F(6,"invalid zlib data: "+(32&n[1]?"need":"unexpected")+" dictionary"),2+(n[1]>>3&4)};function kn(n,t){return"function"==typeof n&&(t=n,n={}),this.ondata=t,n}var Mn=function(){function n(n,i){if("function"==typeof n&&(i=n,n={}),this.ondata=i,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var r=this.o.dictionary.subarray(-32768);this.b.set(r,32768-r.length),this.s.i=32768-r.length}}return n.prototype.p=function(n,t){this.ondata(K(n,this.o,0,0,this.s),t)},n.prototype.push=function(n,i){this.ondata||F(5),this.s.l&&F(4);var r=n.length+this.s.z;if(r>this.b.length){if(r>2*this.b.length-32768){var e=new t(-32768&r);e.set(this.b.subarray(0,this.s.z)),this.b=e}var f=this.b.length-this.s.z;this.b.set(n.subarray(0,f),this.s.z),this.s.z=this.b.length,this.p(this.b,0),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(f),32768),this.s.z=n.length-f+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&i,(this.s.z>this.s.w+8191||i)&&(this.p(this.b,i||0),this.s.w=this.s.i,this.s.i-=2)},n.prototype.flush=function(){this.ondata||F(5),this.s.l&&F(4),this.p(this.b,0),this.s.w=this.s.i,this.s.i-=2},n}(),bn=function(){return function(n,t){an([_,function(){return[on,Mn]}],this,kn.call(this,n,t),function(n){var t=new Mn(n.data);onmessage=on(t)},6,1)}}();function zn(n,t,i){return i||(i=t,t={}),"function"!=typeof i&&F(7),un(n,t,[_],function(n){return fn(xn(n.data[0],n.data[1]))},0,i)}function xn(n,t){return K(n,t||{},0,0)}var Tn=function(){function n(n,i){"function"==typeof n&&(i=n,n={}),this.ondata=i;var r=n&&n.dictionary&&n.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new t(32768),this.p=new t(0),r&&this.o.set(r)}return n.prototype.e=function(n){if(this.ondata||F(5),this.d&&F(4),this.p.length){if(n.length){var i=new t(this.p.length+n.length);i.set(this.p),i.set(n,this.p.length),this.p=i}}else this.p=n},n.prototype.c=function(n){this.s.i=+(this.d=n||0);var t=this.s.b,i=U(this.p,this.s,this.o);this.ondata(S(i,t,this.s.b),this.d),this.o=S(i,this.s.b-32768),this.s.b=this.o.length,this.p=S(this.p,this.s.p/8|0),this.s.p&=7},n.prototype.push=function(n,t){this.e(n),this.c(t)},n}(),Dn=function(){return function(n,t){an([Y,function(){return[on,Tn]}],this,kn.call(this,n,t),function(n){var t=new Tn(n.data);onmessage=on(t)},7,0)}}();function En(n,t,i){return i||(i=t,t={}),"function"!=typeof i&&F(7),un(n,t,[Y],function(n){return fn(Sn(n.data[0],sn(n.data[1])))},1,i)}function Sn(n,t){return U(n,{i:2},t&&t.out,t&&t.dictionary)}var In=function(){function n(n,t){this.c=G(),this.l=0,this.v=1,Mn.call(this,n,t)}return n.prototype.push=function(n,t){this.c.p(n),this.l+=n.length,Mn.prototype.push.call(this,n,t)},n.prototype.p=function(n,t){var i=K(n,this.o,this.v&&yn(this.o),t&&8,this.s);this.v&&(wn(i,this.o),this.v=0),t&&(ln(i,i.length-8,this.c.d()),ln(i,i.length-4,this.l)),this.ondata(i,t)},n.prototype.flush=function(){Mn.prototype.flush.call(this)},n}(),An=function(){return function(n,t){an([_,nn,function(){return[on,Mn,In]}],this,kn.call(this,n,t),function(n){var t=new In(n.data);onmessage=on(t)},8,1)}}();function Fn(n,t,i){return i||(i=t,t={}),"function"!=typeof i&&F(7),un(n,t,[_,nn,function(){return[Un]}],function(n){return fn(Un(n.data[0],n.data[1]))},2,i)}function Un(n,t){t||(t={});var i=G(),r=n.length;i.p(n);var e=K(n,t,yn(t),8),f=e.length;return wn(e,t),ln(e,f-8,i.d()),ln(e,f-4,r),e}var Ln=function(){function n(n,t){this.v=1,this.r=0,Tn.call(this,n,t)}return n.prototype.push=function(n,i){if(Tn.prototype.e.call(this,n),this.r+=n.length,this.v){var r=this.p.subarray(this.v-1),e=r.length>3?dn(r):4;if(e>r.length){if(!i)return}else this.v>1&&this.onmember&&this.onmember(this.r-r.length);this.p=r.subarray(e),this.v=0}Tn.prototype.c.call(this,i),!this.s.f||this.s.l||i||(this.v=E(this.s.p)+9,this.s={i:0},this.o=new t(0),this.push(new t(0),i))},n}(),Cn=function(){return function(n,t){var i=this;an([Y,tn,function(){return[on,Tn,Ln]}],this,kn.call(this,n,t),function(n){var t=new Ln(n.data);t.onmember=function(n){return postMessage(n)},onmessage=on(t)},9,0,function(n){return i.onmember&&i.onmember(n)})}}();function On(n,t,i){return i||(i=t,t={}),"function"!=typeof i&&F(7),un(n,t,[Y,tn,function(){return[jn]}],function(n){return fn(jn(n.data[0],n.data[1]))},3,i)}function jn(n,i){var r=dn(n);return r+8>n.length&&F(6,"invalid gzip data"),U(n.subarray(r,-8),{i:2},i&&i.out||new t(pn(n)),i&&i.dictionary)}var qn=function(){function n(n,t){this.c=J(),this.v=1,Mn.call(this,n,t)}return n.prototype.push=function(n,t){this.c.p(n),Mn.prototype.push.call(this,n,t)},n.prototype.p=function(n,t){var i=K(n,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(mn(i,this.o),this.v=0),t&&ln(i,i.length-4,this.c.d()),this.ondata(i,t)},n.prototype.flush=function(){Mn.prototype.flush.call(this)},n}(),Bn=function(){return function(n,t){an([_,rn,function(){return[on,Mn,qn]}],this,kn.call(this,n,t),function(n){var t=new qn(n.data);onmessage=on(t)},10,1)}}();function Hn(n,t,i){return i||(i=t,t={}),"function"!=typeof i&&F(7),un(n,t,[_,rn,function(){return[Nn]}],function(n){return fn(Nn(n.data[0],n.data[1]))},4,i)}function Nn(n,t){t||(t={});var i=J();i.p(n);var r=K(n,t,t.dictionary?6:2,4);return mn(r,t),ln(r,r.length-4,i.d()),r}var $n=function(){function n(n,t){Tn.call(this,n,t),this.v=n&&n.dictionary?2:1}return n.prototype.push=function(n,t){if(Tn.prototype.e.call(this,n),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(gn(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&F(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Tn.prototype.c.call(this,t)},n}(),Rn=function(){return function(n,t){an([Y,en,function(){return[on,Tn,$n]}],this,kn.call(this,n,t),function(n){var t=new $n(n.data);onmessage=on(t)},11,0)}}();function Wn(n,t,i){return i||(i=t,t={}),"function"!=typeof i&&F(7),un(n,t,[Y,en,function(){return[Zn]}],function(n){return fn(Zn(n.data[0],sn(n.data[1])))},5,i)}function Zn(n,t){return U(n.subarray(gn(n,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var Gn=function(){function n(n,t){this.o=kn.call(this,n,t)||{},this.G=Ln,this.I=Tn,this.Z=$n}return n.prototype.i=function(){var n=this;this.s.ondata=function(t,i){n.ondata(t,i)}},n.prototype.push=function(n,i){if(this.ondata||F(5),this.s)this.s.push(n,i);else{if(this.p&&this.p.length){var r=new t(this.p.length+n.length);r.set(this.p),r.set(n,this.p.length)}else this.p=n;this.p.length>2&&(this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,i),this.p=null)}},n}(),Jn=function(){function n(n,t){Gn.call(this,n,t),this.queuedSize=0,this.G=Cn,this.I=Dn,this.Z=Rn}return n.prototype.i=function(){var n=this;this.s.ondata=function(t,i,r){n.ondata(t,i,r)},this.s.ondrain=function(t){n.queuedSize-=t,n.ondrain&&n.ondrain(t)}},n.prototype.push=function(n,t){this.queuedSize+=n.length,Gn.prototype.push.call(this,n,t)},n}();function Kn(n,t,i){return i||(i=t,t={}),"function"!=typeof i&&F(7),31==n[0]&&139==n[1]&&8==n[2]?On(n,t,i):8!=(15&n[0])||n[0]>>4>7||(n[0]<<8|n[1])%31?En(n,t,i):Wn(n,t,i)}function Pn(n,t){return 31==n[0]&&139==n[1]&&8==n[2]?jn(n,t):8!=(15&n[0])||n[0]>>4>7||(n[0]<<8|n[1])%31?Sn(n,t):Zn(n,t)}var Qn=function(n,i,r,e){for(var f in n){var s=n[f],u=i+f,o=e;Array.isArray(s)&&(o=P(e,s[1]),s=s[0]),s instanceof t?r[u]=[s,o]:(r[u+="/"]=[new t(0),o],Qn(s,u,r,e))}},Vn="undefined"!=typeof TextEncoder&&new TextEncoder,Xn="undefined"!=typeof TextDecoder&&new TextDecoder,Yn=0;try{Xn.decode(R,{stream:1}),Yn=1}catch(n){}var _n=function(n){for(var t="",i=0;;){var r=n[i++],e=(r>127)+(r>223)+(r>239);if(i+e>n.length)return{s:t,r:S(n,i-1)};e?3==e?(r=((15&r)<<18|(63&n[i++])<<12|(63&n[i++])<<6|63&n[i++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=String.fromCharCode(1&e?(31&r)<<6|63&n[i++]:(15&r)<<12|(63&n[i++])<<6|63&n[i++]):t+=String.fromCharCode(r)}},nt=function(){function n(n){this.ondata=n,Yn?this.t=new TextDecoder:this.p=R}return n.prototype.push=function(n,i){if(this.ondata||F(5),i=!!i,this.t)return this.ondata(this.t.decode(n,{stream:1}),i),void(i&&(this.t.decode().length&&F(8),this.t=null));this.p||F(4);var r=new t(this.p.length+n.length);r.set(this.p),r.set(n,this.p.length);var e=_n(r),f=e.s,s=e.r;i?(s.length&&F(8),this.p=null):this.p=s,this.ondata(f,i)},n}(),tt=function(){function n(n){this.ondata=n}return n.prototype.push=function(n,t){this.ondata||F(5),this.d&&F(4),this.ondata(it(n),this.d=t||0)},n}();function it(n,i){if(i){for(var r=new t(n.length),e=0;e<n.length;++e)r[e]=n.charCodeAt(e);return r}if(Vn)return Vn.encode(n);var f=n.length,s=new t(n.length+(n.length>>1)),u=0,o=function(n){s[u++]=n};for(e=0;e<f;++e){if(u+5>s.length){var a=new t(u+8+(f-e<<1));a.set(s),s=a}var h=n.charCodeAt(e);h<128||i?o(h):h<2048?(o(192|h>>6),o(128|63&h)):h>55295&&h<57344?(o(240|(h=65536+(1047552&h)|1023&n.charCodeAt(++e))>>18),o(128|h>>12&63),o(128|h>>6&63),o(128|63&h)):(o(224|h>>12),o(128|h>>6&63),o(128|63&h))}return S(s,0,u)}function rt(n,t){if(t){for(var i="",r=0;r<n.length;r+=16384)i+=String.fromCharCode.apply(null,n.subarray(r,r+16384));return i}if(Xn)return Xn.decode(n);var e=_n(n),f=e.s;return(i=e.r).length&&F(8),f}var et=function(n){return 1==n?3:n<6?2:9==n?1:0},ft=function(n,t){return t+30+hn(n,t+26)+hn(n,t+28)},st=function(n,t,i){var r=hn(n,t+28),e=rt(n.subarray(t+46,t+46+r),!(2048&hn(n,t+8))),f=t+46+r,s=cn(n,t+20),u=i&&4294967295==s?ut(n,f):[s,cn(n,t+24),cn(n,t+42)],o=u[0],a=u[1],h=u[2];return[hn(n,t+10),o,a,e,f+hn(n,t+30)+hn(n,t+32),h]},ut=function(n,t){for(;1!=hn(n,t);t+=4+hn(n,t+2));return[vn(n,t+12),vn(n,t+4),vn(n,t+20)]},ot=function(n){var t=0;if(n)for(var i in n){var r=n[i].length;r>65535&&F(9),t+=r+4}return t},at=function(n,t,i,r,e,f,s,u){var o=r.length,a=i.extra,h=u&&u.length,c=ot(a);ln(n,t,null!=s?33639248:67324752),t+=4,null!=s&&(n[t++]=20,n[t++]=i.os),n[t]=20,t+=2,n[t++]=i.flag<<1|(f<0&&8),n[t++]=e&&8,n[t++]=255&i.compression,n[t++]=i.compression>>8;var v=new Date(null==i.mtime?Date.now():i.mtime),l=v.getFullYear()-1980;if((l<0||l>119)&&F(10),ln(n,t,l<<25|v.getMonth()+1<<21|v.getDate()<<16|v.getHours()<<11|v.getMinutes()<<5|v.getSeconds()>>1),t+=4,-1!=f&&(ln(n,t,i.crc),ln(n,t+4,f<0?-f-2:f),ln(n,t+8,i.size)),ln(n,t+12,o),ln(n,t+14,c),t+=16,null!=s&&(ln(n,t,h),ln(n,t+6,i.attrs),ln(n,t+10,s),t+=14),n.set(r,t),t+=o,c)for(var w in a){var d=a[w],p=d.length;ln(n,t,+w),ln(n,t+2,p),n.set(d,t+4),t+=4+p}return h&&(n.set(u,t),t+=h),t},ht=function(n,t,i,r,e){ln(n,t,101010256),ln(n,t+8,i),ln(n,t+10,i),ln(n,t+12,r),ln(n,t+16,e)},ct=function(){function n(n){this.filename=n,this.c=G(),this.size=0,this.compression=0}return n.prototype.process=function(n,t){this.ondata(null,n,t)},n.prototype.push=function(n,t){this.ondata||F(5),this.c.p(n),this.size+=n.length,t&&(this.crc=this.c.d()),this.process(n,t||0)},n}(),vt=function(){function n(n,t){var i=this;t||(t={}),ct.call(this,n),this.d=new Mn(t,function(n,t){i.ondata(null,n,t)}),this.compression=8,this.flag=et(t.level)}return n.prototype.process=function(n,t){try{this.d.push(n,t)}catch(n){this.ondata(n,null,t)}},n.prototype.push=function(n,t){ct.prototype.push.call(this,n,t)},n}(),lt=function(){function n(n,t){var i=this;t||(t={}),ct.call(this,n),this.d=new bn(t,function(n,t,r){i.ondata(n,t,r)}),this.compression=8,this.flag=et(t.level),this.terminate=this.d.terminate}return n.prototype.process=function(n,t){this.d.push(n,t)},n.prototype.push=function(n,t){ct.prototype.push.call(this,n,t)},n}(),wt=function(){function n(n){this.ondata=n,this.u=[],this.d=1}return n.prototype.add=function(n){var i=this;if(this.ondata||F(5),2&this.d)this.ondata(F(4+8*(1&this.d),0,1),null,0);else{var r=it(n.filename),e=r.length,f=n.comment,s=f&&it(f),u=e!=n.filename.length||s&&f.length!=s.length,o=e+ot(n.extra)+30;e>65535&&this.ondata(F(11,0,1),null,0);var a=new t(o);at(a,0,n,r,u,-1);var h=[a],c=function(){for(var n=0,t=h;n<t.length;n++)i.ondata(null,t[n],0);h=[]},v=this.d;this.d=0;var l=this.u.length,w=P(n,{f:r,u:u,o:s,t:function(){n.terminate&&n.terminate()},r:function(){if(c(),v){var n=i.u[l+1];n?n.r():i.d=1}v=1}}),d=0;n.ondata=function(r,e,f){if(r)i.ondata(r,e,f),i.terminate();else if(d+=e.length,h.push(e),f){var s=new t(16);ln(s,0,134695760),ln(s,4,n.crc),ln(s,8,d),ln(s,12,n.size),h.push(s),w.c=d,w.b=o+d+16,w.crc=n.crc,w.size=n.size,v&&w.r(),v=1}else v&&c()},this.u.push(w)}},n.prototype.end=function(){var n=this;2&this.d?this.ondata(F(4+8*(1&this.d),0,1),null,1):(this.d?this.e():this.u.push({r:function(){1&n.d&&(n.u.splice(-1,1),n.e())},t:function(){}}),this.d=3)},n.prototype.e=function(){for(var n=0,i=0,r=0,e=0,f=this.u;e<f.length;e++)r+=46+(a=f[e]).f.length+ot(a.extra)+(a.o?a.o.length:0);for(var s=new t(r+22),u=0,o=this.u;u<o.length;u++){var a;at(s,n,a=o[u],a.f,a.u,-a.c-2,i,a.o),n+=46+a.f.length+ot(a.extra)+(a.o?a.o.length:0),i+=a.b}ht(s,n,this.u.length,r,i),this.ondata(null,s,1),this.d=2},n.prototype.terminate=function(){for(var n=0,t=this.u;n<t.length;n++)t[n].t();this.d=2},n}();function dt(n,i,r){r||(r=i,i={}),"function"!=typeof r&&F(7);var e={};Qn(n,"",e,i);var f=Object.keys(e),s=f.length,u=0,o=0,a=s,h=new Array(s),c=[],v=function(){for(var n=0;n<c.length;++n)c[n]()},l=function(n,t){Mt(function(){r(n,t)})};Mt(function(){l=r});var w=function(){var n=new t(o+22),i=u,r=o-u;o=0;for(var e=0;e<a;++e){var f=h[e];try{var s=f.c.length;at(n,o,f,f.f,f.u,s);var c=30+f.f.length+ot(f.extra),v=o+c;n.set(f.c,v),at(n,u,f,f.f,f.u,s,o,f.m),u+=16+c+(f.m?f.m.length:0),o=v+s}catch(n){return l(n,null)}}ht(n,u,h.length,r,i),l(null,n)};s||w();for(var d=function(n){var t=f[n],i=e[t],r=i[0],a=i[1],d=G(),p=r.length;d.p(r);var y=it(t),m=y.length,g=a.comment,k=g&&it(g),M=k&&k.length,b=ot(a.extra),z=0==a.level?0:8,x=function(i,r){if(i)v(),l(i,null);else{var e=r.length;h[n]=P(a,{size:p,crc:d.d(),c:r,f:y,m:k,u:m!=t.length||k&&g.length!=M,compression:z}),u+=30+m+b+e,o+=76+2*(m+b)+(M||0)+e,--s||w()}};if(m>65535&&x(F(11,0,1),null),z)if(p<16e4)try{x(null,xn(r,a))}catch(n){x(n,null)}else c.push(zn(r,a,x));else x(null,r)},p=0;p<a;++p)d(p);return v}function pt(n,i){i||(i={});var r={},e=[];Qn(n,"",r,i);var f=0,s=0;for(var u in r){var o=r[u],a=o[0],h=o[1],c=0==h.level?0:8,v=(x=it(u)).length,l=h.comment,w=l&&it(l),d=w&&w.length,p=ot(h.extra);v>65535&&F(11);var y=c?xn(a,h):a,m=y.length,g=G();g.p(a),e.push(P(h,{size:a.length,crc:g.d(),c:y,f:x,m:w,u:v!=u.length||w&&l.length!=d,o:f,compression:c})),f+=30+v+p+m,s+=76+2*(v+p)+(d||0)+m}for(var k=new t(s+22),M=f,b=s-f,z=0;z<e.length;++z){var x;at(k,(x=e[z]).o,x,x.f,x.u,x.c.length);var T=30+x.f.length+ot(x.extra);k.set(x.c,x.o+T),at(k,f,x,x.f,x.u,x.c.length,x.o,x.m),f+=16+T+(x.m?x.m.length:0)}return ht(k,f,e.length,b,M),k}var yt=function(){function n(){}return n.prototype.push=function(n,t){this.ondata(null,n,t)},n.compression=0,n}(),mt=function(){function n(){var n=this;this.i=new Tn(function(t,i){n.ondata(null,t,i)})}return n.prototype.push=function(n,t){try{this.i.push(n,t)}catch(n){this.ondata(n,null,t)}},n.compression=8,n}(),gt=function(){function n(n,t){var i=this;t<32e4?this.i=new Tn(function(n,t){i.ondata(null,n,t)}):(this.i=new Dn(function(n,t,r){i.ondata(n,t,r)}),this.terminate=this.i.terminate)}return n.prototype.push=function(n,t){this.i.terminate&&(n=S(n,0)),this.i.push(n,t)},n.compression=8,n}(),kt=function(){function n(n){this.onfile=n,this.k=[],this.o={0:yt},this.p=R}return n.prototype.push=function(n,i){var r=this;if(this.onfile||F(5),this.p||F(4),this.c>0){var e=Math.min(this.c,n.length),f=n.subarray(0,e);if(this.c-=e,this.d?this.d.push(f,!this.c):this.k[0].push(f),(n=n.subarray(e)).length)return this.push(n,i)}else{var s=0,u=0,o=void 0,a=void 0;this.p.length?n.length?((a=new t(this.p.length+n.length)).set(this.p),a.set(n,this.p.length)):a=this.p:a=n;for(var h=a.length,c=this.c,v=c&&this.d,l=function(){var n,t=cn(a,u);if(67324752==t){s=1,o=u,w.d=null,w.c=0;var i=hn(a,u+6),e=hn(a,u+8),f=2048&i,v=8&i,l=hn(a,u+26),d=hn(a,u+28);if(h>u+30+l+d){var p=[];w.k.unshift(p),s=2;var y,m=cn(a,u+18),g=cn(a,u+22),k=rt(a.subarray(u+30,u+=30+l),!f);4294967295==m?(n=v?[-2]:ut(a,u),m=n[0],g=n[1]):v&&(m=-1),u+=d,w.c=m;var M={name:k,compression:e,start:function(){if(M.ondata||F(5),m){var n=r.o[e];n||M.ondata(F(14,"unknown compression type "+e,1),null,0),(y=m<0?new n(k):new n(k,m,g)).ondata=function(n,t,i){M.ondata(n,t,i)};for(var t=0,i=p;t<i.length;t++)y.push(i[t],0);r.k[0]==p&&r.c?r.d=y:y.push(R,1)}else M.ondata(null,R,1)},terminate:function(){y&&y.terminate&&y.terminate()}};m>=0&&(M.size=m,M.originalSize=g),w.onfile(M)}return"break"}if(c){if(134695760==t)return o=u+=12+(-2==c&&8),s=3,w.c=0,"break";if(33639248==t)return o=u-=4,s=3,w.c=0,"break"}},w=this;u<h-4&&"break"!==l();++u);if(this.p=R,c<0){var d=a.subarray(0,s?o-12-(-2==c&&8)-(134695760==cn(a,o-16)&&4):u);v?v.push(d,!!s):this.k[+(2==s)].push(d)}if(2&s)return this.push(a.subarray(u),i);this.p=a.subarray(u)}i&&(this.c&&F(13),this.p=null)},n.prototype.register=function(n){this.o[n.compression]=n},n}(),Mt="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(n){n()};function bt(n,i,r){r||(r=i,i={}),"function"!=typeof r&&F(7);var e=[],f=function(){for(var n=0;n<e.length;++n)e[n]()},s={},u=function(n,t){Mt(function(){r(n,t)})};Mt(function(){u=r});for(var o=n.length-22;101010256!=cn(n,o);--o)if(!o||n.length-o>65558)return u(F(13,0,1),null),f;var a=hn(n,o+8);if(a){var h=a,c=cn(n,o+16),v=4294967295==c||65535==h;if(v){var l=cn(n,o-12);(v=101075792==cn(n,l))&&(h=a=cn(n,l+32),c=cn(n,l+48))}for(var w=i&&i.filter,d=function(i){var r=st(n,c,v),o=r[0],h=r[1],l=r[2],d=r[3],p=r[4],y=ft(n,r[5]);c=p;var m=function(n,t){n?(f(),u(n,null)):(t&&(s[d]=t),--a||u(null,s))};if(!w||w({name:d,size:h,originalSize:l,compression:o}))if(o)if(8==o){var g=n.subarray(y,y+h);if(l<524288||h>.8*l)try{m(null,Sn(g,{out:new t(l)}))}catch(n){m(n,null)}else e.push(En(g,{size:l},m))}else m(F(14,"unknown compression type "+o,1),null);else m(null,S(n,y,y+h));else m(null,null)},p=0;p<h;++p)d()}else u(null,{});return f}function zt(n,i){for(var r={},e=n.length-22;101010256!=cn(n,e);--e)(!e||n.length-e>65558)&&F(13);var f=hn(n,e+8);if(!f)return{};var s=cn(n,e+16),u=4294967295==s||65535==f;if(u){var o=cn(n,e-12);(u=101075792==cn(n,o))&&(f=cn(n,o+32),s=cn(n,o+48))}for(var a=i&&i.filter,h=0;h<f;++h){var c=st(n,s,u),v=c[0],l=c[1],w=c[2],d=c[3],p=c[4],y=ft(n,c[5]);s=p,a&&!a({name:d,size:l,originalSize:w,compression:v})||(v?8==v?r[d]=Sn(n.subarray(y,y+l),{out:new t(w)}):F(14,"unknown compression type "+v):r[d]=S(n,y,y+l))}return r}export{An as AsyncCompress,Jn as AsyncDecompress,bn as AsyncDeflate,Cn as AsyncGunzip,An as AsyncGzip,Dn as AsyncInflate,gt as AsyncUnzipInflate,Rn as AsyncUnzlib,lt as AsyncZipDeflate,Bn as AsyncZlib,In as Compress,nt as DecodeUTF8,Gn as Decompress,Mn as Deflate,tt as EncodeUTF8,I as FlateErrorCode,Ln as Gunzip,In as Gzip,Tn as Inflate,kt as Unzip,mt as UnzipInflate,yt as UnzipPassThrough,$n as Unzlib,wt as Zip,vt as ZipDeflate,ct as ZipPassThrough,qn as Zlib,Fn as compress,Un as compressSync,Kn as decompress,Pn as decompressSync,zn as deflate,xn as deflateSync,On as gunzip,jn as gunzipSync,Fn as gzip,Un as gzipSync,En as inflate,Sn as inflateSync,rt as strFromU8,it as strToU8,bt as unzip,zt as unzipSync,Wn as unzlib,Zn as unzlibSync,dt as zip,pt as zipSync,Hn as zlib,Nn as zlibSync};
|