rebrowser-playwright-core
Version:
A drop-in replacement for playwright-core patched with rebrowser-patches. It allows to pass modern automation detection tests.
3 lines • 94.2 kB
JavaScript
var Gr=Object.defineProperty;var Vr=(n,t,e)=>t in n?Gr(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var N=(n,t,e)=>Vr(n,typeof t!="symbol"?t+"":t,e);function Zr(n,t){const e=new Array(t.length).fill(0);return new Array(t.length).fill(0).map((r,s)=>(i,a)=>{e[s]=i/a*t[s]*1e3,n(e.reduce((o,l)=>o+l,0),1e3)})}function Kr(n){var t,e,r,s,i,a,o,l,_;if(n=n??globalThis,!n.__playwright_builtins__){const f={setTimeout:(t=n.setTimeout)==null?void 0:t.bind(n),clearTimeout:(e=n.clearTimeout)==null?void 0:e.bind(n),setInterval:(r=n.setInterval)==null?void 0:r.bind(n),clearInterval:(s=n.clearInterval)==null?void 0:s.bind(n),requestAnimationFrame:(i=n.requestAnimationFrame)==null?void 0:i.bind(n),cancelAnimationFrame:(a=n.cancelAnimationFrame)==null?void 0:a.bind(n),requestIdleCallback:(o=n.requestIdleCallback)==null?void 0:o.bind(n),cancelIdleCallback:(l=n.cancelIdleCallback)==null?void 0:l.bind(n),performance:n.performance,eval:(_=n.eval)==null?void 0:_.bind(n),Intl:n.Intl,Date:n.Date,Map:n.Map,Set:n.Set};Object.defineProperty(n,"__playwright_builtins__",{value:f,configurable:!1,enumerable:!1,writable:!1})}return n.__playwright_builtins__}const J=Kr();J.setTimeout;J.clearTimeout;J.setInterval;J.clearInterval;J.requestAnimationFrame;J.cancelAnimationFrame;J.requestIdleCallback;J.cancelIdleCallback;J.performance;J.Intl;J.Date;const Xr=J.Map;J.Set;const Nn={"&":"&","<":"<",">":">",'"':""","'":"'"};function $r(n){return n.replace(/[&<>"']/ug,t=>Nn[t])}function Jr(n){return n.replace(/[&<]/ug,t=>Nn[t])}function Lt(n,t,e){return n.find((r,s)=>{if(s===n.length-1)return!0;const i=n[s+1];return Math.abs(t(r)-e)<Math.abs(t(i)-e)})}function Ln(n){return Array.isArray(n)&&typeof n[0]=="string"}function Qr(n){return Array.isArray(n)&&Array.isArray(n[0])}class zr{constructor(t,e,r,s,i){N(this,"_htmlCache");N(this,"_snapshots");N(this,"_index");N(this,"snapshotName");N(this,"_resources");N(this,"_snapshot");N(this,"_callId");N(this,"_screencastFrames");this._htmlCache=t,this._resources=e,this._snapshots=r,this._index=i,this._snapshot=r[i],this._callId=r[i].callId,this._screencastFrames=s,this.snapshotName=r[i].snapshotName}snapshot(){return this._snapshots[this._index]}viewport(){return this._snapshots[this._index].viewport}closestScreenshot(){var s;const{wallTime:t,timestamp:e}=this.snapshot(),r=t&&((s=this._screencastFrames[0])!=null&&s.frameSwapWallTime)?Lt(this._screencastFrames,i=>i.frameSwapWallTime,t):Lt(this._screencastFrames,i=>i.timestamp,e);return r==null?void 0:r.sha1}render(){const t=[],e=(i,a,o,l)=>{if(typeof i=="string"){o==="STYLE"||o==="style"?t.push(ss(i)):t.push(Jr(i));return}if(Qr(i)){const _=a-i[0][0];if(_>=0&&_<=a){const f=ts(this._snapshots[_]),b=i[0][1];if(b>=0&&b<f.length)return e(f[b],_,o,l)}}else if(Ln(i)){const[_,f,...b]=i,h=_==="NOSCRIPT"?"X-NOSCRIPT":_,S=Object.entries(f||{});t.push("<",h);const C="__playwright_current_src__",u=h==="IFRAME"||h==="FRAME",c=h==="A",d=h==="IMG",y=d&&S.some(m=>m[0]===C),g=h==="SOURCE"&&o==="PICTURE"&&(l==null?void 0:l.some(m=>m[0]===C));for(const[m,E]of S){let p=m;u&&m.toLowerCase()==="src"&&(p="__playwright_src__"),d&&m===C&&(p="src"),["src","srcset"].includes(m.toLowerCase())&&(y||g)&&(p="_"+p);let R=E;c&&m.toLowerCase()==="href"?R="link://"+E:(m.toLowerCase()==="href"||m.toLowerCase()==="src"||m===C)&&(R=it(E)),t.push(" ",p,'="',$r(R),'"')}t.push(">");for(const m of b)e(m,a,h,S);es.has(h)||t.push("</",h,">");return}else return},r=this._snapshot;return{html:this._htmlCache.getOrCompute(this,()=>{e(r.html,this._index,void 0,void 0);const a=(r.doctype?`<!DOCTYPE ${r.doctype}>`:"")+["<style>*,*::before,*::after { visibility: hidden }</style>",`<script>${ns(this.viewport(),this._callId,this.snapshotName)}<\/script>`].join("")+t.join("");return{value:a,size:a.length}}),pageId:r.pageId,frameId:r.frameId,index:this._index}}resourceByUrl(t,e){const r=this._snapshot;let s,i;for(const o of this._resources){if(typeof o._monotonicTime=="number"&&o._monotonicTime>=r.timestamp)break;o.response.status!==304&&o.request.url===t&&o.request.method===e&&(o._frameref===r.frameId?s=o:i=o)}let a=s??i;if(a&&e.toUpperCase()==="GET"){for(const o of r.resourceOverrides)if(t===o.url&&o.sha1){a={...a,response:{...a.response,content:{...a.response.content,_sha1:o.sha1}}};break}}return a}}const es=new Set(["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","MENUITEM","META","PARAM","SOURCE","TRACK","WBR"]);function ts(n){if(!n._nodes){const t=[],e=r=>{if(typeof r=="string")t.push(r);else if(Ln(r)){const[,,...s]=r;for(const i of s)e(i);t.push(r)}};e(n.html),n._nodes=t}return n._nodes}function ns(n,...t){function e(r,s,...i){const a=new URLSearchParams(location.search),o=a.has("shouldPopulateCanvasFromScreenshot"),l=a.has("isUnderTest"),_={viewport:s,frames:new WeakMap};window.__playwright_frame_bounding_rects__=_;const f="Recorded click position in absolute coordinates did not match the center of the clicked element. This is likely due to a difference between the test runner and the trace viewer operating systems.",b=[],h=[],S=[],C=[];let u=window;for(;u!==u.parent&&!u.location.pathname.match(/\/page@[a-z0-9]+$/);)u=u.parent;const c=g=>{for(const m of g.querySelectorAll("[__playwright_scroll_top_]"))b.push(m);for(const m of g.querySelectorAll("[__playwright_scroll_left_]"))h.push(m);for(const m of g.querySelectorAll("[__playwright_value_]")){const E=m;E.type!=="file"&&(E.value=E.getAttribute("__playwright_value_")),m.removeAttribute("__playwright_value_")}for(const m of g.querySelectorAll("[__playwright_checked_]"))m.checked=m.getAttribute("__playwright_checked_")==="true",m.removeAttribute("__playwright_checked_");for(const m of g.querySelectorAll("[__playwright_selected_]"))m.selected=m.getAttribute("__playwright_selected_")==="true",m.removeAttribute("__playwright_selected_");for(const m of g.querySelectorAll("[__playwright_popover_open_]")){try{m.showPopover()}catch{}m.removeAttribute("__playwright_popover_open_")}for(const m of g.querySelectorAll("[__playwright_dialog_open_]")){try{m.getAttribute("__playwright_dialog_open_")==="modal"?m.showModal():m.show()}catch{}m.removeAttribute("__playwright_dialog_open_")}for(const m of i)for(const E of g.querySelectorAll(`[__playwright_target__="${m}"]`)){const p=E.style;p.outline="2px solid #006ab1",p.backgroundColor="#6fa8dc7f",S.push(E)}for(const m of g.querySelectorAll("iframe, frame")){const E=m.getAttribute("__playwright_bounding_rect__");m.removeAttribute("__playwright_bounding_rect__");const p=E?JSON.parse(E):void 0;p&&_.frames.set(m,{boundingRect:p,scrollLeft:0,scrollTop:0});const R=m.getAttribute("__playwright_src__");if(!R)m.setAttribute("src",'data:text/html,<body style="background: #ddd"></body>');else{const T=new URL(r(window.location.href)),A=T.pathname.lastIndexOf("/snapshot/");A!==-1&&(T.pathname=T.pathname.substring(0,A+1)),T.pathname+=R.substring(1),m.setAttribute("src",T.toString())}}{const m=g.querySelector("body[__playwright_custom_elements__]");if(m&&window.customElements){const E=(m.getAttribute("__playwright_custom_elements__")||"").split(",");for(const p of E)window.customElements.define(p,class extends HTMLElement{})}}for(const m of g.querySelectorAll("template[__playwright_shadow_root_]")){const E=m,p=E.parentElement.attachShadow({mode:"open"});p.appendChild(E.content),E.remove(),c(p)}if("adoptedStyleSheets"in g){const m=[...g.adoptedStyleSheets];for(const E of g.querySelectorAll("template[__playwright_style_sheet_]")){const p=E,R=new CSSStyleSheet;R.replaceSync(p.getAttribute("__playwright_style_sheet_")),m.push(R)}g.adoptedStyleSheets=m}C.push(...g.querySelectorAll("canvas"))},d=()=>{window.removeEventListener("load",d);for(const E of b)E.scrollTop=+E.getAttribute("__playwright_scroll_top_"),E.removeAttribute("__playwright_scroll_top_"),_.frames.has(E)&&(_.frames.get(E).scrollTop=E.scrollTop);for(const E of h)E.scrollLeft=+E.getAttribute("__playwright_scroll_left_"),E.removeAttribute("__playwright_scroll_left_"),_.frames.has(E)&&(_.frames.get(E).scrollLeft=E.scrollTop);document.styleSheets[0].disabled=!0;const g=new URL(window.location.href).searchParams,m=window===u;if(g.get("pointX")&&g.get("pointY")){const E=+g.get("pointX"),p=+g.get("pointY"),R=g.has("hasInputTarget"),T=S.length>0,A=document.documentElement?[document.documentElement]:[];for(const x of T?S:A){const w=document.createElement("x-pw-pointer");if(w.style.position="fixed",w.style.backgroundColor="#f44336",w.style.width="20px",w.style.height="20px",w.style.borderRadius="10px",w.style.margin="-10px 0 0 -10px",w.style.zIndex="2147483646",w.style.display="flex",w.style.alignItems="center",w.style.justifyContent="center",T){const O=x.getBoundingClientRect(),I=O.left+O.width/2,v=O.top+O.height/2;if(w.style.left=I+"px",w.style.top=v+"px",m&&(Math.abs(I-E)>=10||Math.abs(v-p)>=10)){const k=document.createElement("x-pw-pointer-warning");k.textContent="⚠",k.style.fontSize="19px",k.style.color="white",k.style.marginTop="-3.5px",k.style.userSelect="none",w.appendChild(k),w.setAttribute("title",f)}document.documentElement.appendChild(w)}else m&&!R&&(w.style.left=E+"px",w.style.top=p+"px",document.documentElement.appendChild(w))}}if(C.length>0){let E=function(R,T){function A(){const x=document.createElement("canvas");x.width=x.width/Math.floor(x.width/24),x.height=x.height/Math.floor(x.height/24);const w=x.getContext("2d");return w.fillStyle="lightgray",w.fillRect(0,0,x.width,x.height),w.fillStyle="white",w.fillRect(0,0,x.width/2,x.height/2),w.fillRect(x.width/2,x.height/2,x.width,x.height),w.createPattern(x,"repeat")}R.fillStyle=A(),R.fillRect(0,0,T.width,T.height)};const p=new Image;p.onload=()=>{var R;for(const T of C){const A=T.getContext("2d"),x=T.getAttribute("__playwright_bounding_rect__");if(T.removeAttribute("__playwright_bounding_rect__"),!x)continue;let w;try{w=JSON.parse(x)}catch{continue}let O=window;for(;O!==u;){const U=O.frameElement;O=O.parent;const F=(R=O.__playwright_frame_bounding_rects__)==null?void 0:R.frames.get(U);if(!(F!=null&&F.boundingRect))break;const Y=F.boundingRect.left-F.scrollLeft,P=F.boundingRect.top-F.scrollTop;w.left+=Y,w.top+=P,w.right+=Y,w.bottom+=P}const{width:I,height:v}=u.__playwright_frame_bounding_rects__.viewport;w.left=w.left/I,w.top=w.top/v,w.right=w.right/I,w.bottom=w.bottom/v;const k=w.right>1||w.bottom>1;if(w.left>1||w.top>1){T.title="Playwright couldn't capture canvas contents because it's located outside the viewport.";continue}E(A,T),o?(A.drawImage(p,w.left*p.width,w.top*p.height,(w.right-w.left)*p.width,(w.bottom-w.top)*p.height,0,0,T.width,T.height),k?T.title="Playwright couldn't capture full canvas contents because it's located partially outside the viewport.":T.title="Canvas contents are displayed on a best-effort basis based on viewport screenshots taken during test execution."):T.title="Canvas content display is disabled.",l&&console.log("canvas drawn:",JSON.stringify([w.left,w.top,w.right-w.left,w.bottom-w.top].map(U=>Math.floor(U*100))))}},p.onerror=()=>{for(const R of C){const T=R.getContext("2d");E(T,R),R.title="Playwright couldn't show canvas contents because the screenshot failed to load."}},p.src=location.href.replace("/snapshot","/closest-screenshot")}},y=()=>c(document);window.addEventListener("load",d),window.addEventListener("DOMContentLoaded",y)}return`
(${e.toString()})(${at.toString()}, ${JSON.stringify(n)}${t.map(r=>`, "${r}"`).join("")})`}const Mn=["about:","blob:","data:","file:","ftp:","http:","https:","mailto:","sftp:","ws:","wss:"],Mt="http://playwright.bloburl/#";function it(n){n.startsWith(Mt)&&(n=n.substring(Mt.length));try{const t=new URL(n);if(t.protocol==="javascript:"||t.protocol==="vbscript:")return"javascript:void(0)";const e=t.protocol==="blob:",r=t.protocol==="file:";if(!e&&!r&&Mn.includes(t.protocol))return n;const s="pw-"+t.protocol.slice(0,t.protocol.length-1);return r||(t.protocol="https:"),t.hostname=t.hostname?`${s}--${t.hostname}`:s,r&&(t.protocol="https:"),t.toString()}catch{return n}}const rs=/url\(['"]?([\w-]+:)\/\//ig;function ss(n){return n.replace(rs,(t,e)=>!(e==="blob:")&&!(e==="file:")&&Mn.includes(e)?t:t.replace(e+"//",`https://pw-${e.slice(0,-1)}--`))}function at(n){const t=new URL(n);return t.pathname.endsWith("/snapshot.html")?t.searchParams.get("r"):n}class is{constructor(t,e){N(this,"_snapshotStorage");N(this,"_resourceLoader");N(this,"_snapshotIds",new Map);this._snapshotStorage=t,this._resourceLoader=e}serveSnapshot(t,e,r){const s=this._snapshot(t,e);if(!s)return new Response(null,{status:404});const i=s.render();return this._snapshotIds.set(r,s),new Response(i.html,{status:200,headers:{"Content-Type":"text/html; charset=utf-8"}})}async serveClosestScreenshot(t,e){const r=this._snapshot(t,e),s=r==null?void 0:r.closestScreenshot();return s?new Response(await this._resourceLoader(s)):new Response(null,{status:404})}serveSnapshotInfo(t,e){const r=this._snapshot(t,e);return this._respondWithJson(r?{viewport:r.viewport(),url:r.snapshot().frameUrl,timestamp:r.snapshot().timestamp,wallTime:r.snapshot().wallTime}:{error:"No snapshot found"})}_snapshot(t,e){const r=e.get("name");return this._snapshotStorage.snapshotByName(t,r)}_respondWithJson(t){return new Response(JSON.stringify(t),{status:200,headers:{"Cache-Control":"public, max-age=31536000","Content-Type":"application/json"}})}async serveResource(t,e,r){let s;const i=this._snapshotIds.get(r);for(const S of t)if(s=i==null?void 0:i.resourceByUrl(as(S),e),s)break;if(!s)return new Response(null,{status:404});const a=s.response.content._sha1,o=a?await this._resourceLoader(a)||new Blob([]):new Blob([]);let l=s.response.content.mimeType;/^text\/|^application\/(javascript|json)/.test(l)&&!l.includes("charset")&&(l=`${l}; charset=utf-8`);const f=new Headers;l!=="x-unknown"&&f.set("Content-Type",l);for(const{name:S,value:C}of s.response.headers)f.set(S,C);f.delete("Content-Encoding"),f.delete("Access-Control-Allow-Origin"),f.set("Access-Control-Allow-Origin","*"),f.delete("Content-Length"),f.set("Content-Length",String(o.size)),f.set("Cache-Control","public, max-age=31536000");const{status:b}=s.response,h=b===101||b===204||b===205||b===304;return new Response(h?null:o,{headers:f,status:s.response.status,statusText:s.response.statusText})}}function as(n){try{const t=new URL(n);return t.hash="",t.toString()}catch{return n}}function os(n){const t=new Xr,{files:e,stacks:r}=n;for(const s of r){const[i,a]=s;t.set(`call@${i}`,a.map(o=>({file:e[o[0]],line:o[1],column:o[2],function:o[3]})))}return t}class cs{constructor(t){N(this,"_maxSize");N(this,"_map");N(this,"_size");this._maxSize=t,this._map=new Map,this._size=0}getOrCompute(t,e){if(this._map.has(t)){const s=this._map.get(t);return this._map.delete(t),this._map.set(t,s),s.value}const r=e();for(;this._map.size&&this._size+r.size>this._maxSize;){const[s,i]=this._map.entries().next().value;this._size-=i.size,this._map.delete(s)}return this._map.set(t,r),this._size+=r.size,r.value}}class ls{constructor(){N(this,"_frameSnapshots",new Map);N(this,"_cache",new cs(1e8));N(this,"_contextToResources",new Map)}addResource(t,e){e.request.url=it(e.request.url),this._ensureResourcesForContext(t).push(e)}addFrameSnapshot(t,e,r){for(const o of e.resourceOverrides)o.url=it(o.url);let s=this._frameSnapshots.get(e.frameId);s||(s={raw:[],renderers:[]},this._frameSnapshots.set(e.frameId,s),e.isMainFrame&&this._frameSnapshots.set(e.pageId,s)),s.raw.push(e);const i=this._ensureResourcesForContext(t),a=new zr(this._cache,i,s.raw,r,s.raw.length-1);return s.renderers.push(a),a}snapshotByName(t,e){const r=this._frameSnapshots.get(t);return r==null?void 0:r.renderers.find(s=>s.snapshotName===e)}snapshotsForTest(){return[...this._frameSnapshots.keys()]}finalize(){for(const t of this._contextToResources.values())t.sort((e,r)=>(e._monotonicTime||0)-(r._monotonicTime||0))}_ensureResourcesForContext(t){let e=this._contextToResources.get(t);return e||(e=[],this._contextToResources.set(t,e)),e}}class Un extends Error{constructor(t){super(t),this.name="TraceVersionError"}}const Ut=7;class fs{constructor(t,e){N(this,"_contextEntry");N(this,"_snapshotStorage");N(this,"_actionMap",new Map);N(this,"_version");N(this,"_pageEntries",new Map);N(this,"_jsHandles",new Map);N(this,"_consoleObjects",new Map);this._contextEntry=t,this._snapshotStorage=e}appendTrace(t){for(const e of t.split(`
`))this._appendEvent(e)}actions(){return[...this._actionMap.values()]}_pageEntry(t){let e=this._pageEntries.get(t);return e||(e={pageId:t,screencastFrames:[]},this._pageEntries.set(t,e),this._contextEntry.pages.push(e)),e}_appendEvent(t){if(!t)return;const e=this._modernize(JSON.parse(t));for(const r of e)this._innerAppendEvent(r)}_innerAppendEvent(t){const e=this._contextEntry;switch(t.type){case"context-options":{if(t.version>Ut)throw new Un("The trace was created by a newer version of Playwright and is not supported by this version of the viewer. Please use latest Playwright to open the trace.");this._version=t.version,e.origin=t.origin,e.browserName=t.browserName,e.channel=t.channel,e.title=t.title,e.platform=t.platform,e.wallTime=t.wallTime,e.startTime=t.monotonicTime,e.sdkLanguage=t.sdkLanguage,e.options=t.options,e.testIdAttributeName=t.testIdAttributeName,e.contextId=t.contextId??"";break}case"screencast-frame":{this._pageEntry(t.pageId).screencastFrames.push(t);break}case"before":{this._actionMap.set(t.callId,{...t,type:"action",endTime:0,log:[]});break}case"input":{const r=this._actionMap.get(t.callId);r.inputSnapshot=t.inputSnapshot,r.point=t.point;break}case"log":{const r=this._actionMap.get(t.callId);if(!r)return;r.log.push({time:t.time,message:t.message});break}case"after":{const r=this._actionMap.get(t.callId);r.afterSnapshot=t.afterSnapshot,r.endTime=t.endTime,r.result=t.result,r.error=t.error,r.attachments=t.attachments,r.annotations=t.annotations,t.point&&(r.point=t.point);break}case"action":{this._actionMap.set(t.callId,{...t,log:[]});break}case"event":{e.events.push(t);break}case"stdout":{e.stdio.push(t);break}case"stderr":{e.stdio.push(t);break}case"error":{e.errors.push(t);break}case"console":{e.events.push(t);break}case"resource-snapshot":this._snapshotStorage.addResource(this._contextEntry.contextId,t.snapshot),e.resources.push(t.snapshot);break;case"frame-snapshot":this._snapshotStorage.addFrameSnapshot(this._contextEntry.contextId,t.snapshot,this._pageEntry(t.snapshot.pageId).screencastFrames);break}"pageId"in t&&t.pageId&&this._pageEntry(t.pageId),(t.type==="action"||t.type==="before")&&(e.startTime=Math.min(e.startTime,t.startTime)),(t.type==="action"||t.type==="after")&&(e.endTime=Math.max(e.endTime,t.endTime)),t.type==="event"&&(e.startTime=Math.min(e.startTime,t.time),e.endTime=Math.max(e.endTime,t.time)),t.type==="screencast-frame"&&(e.startTime=Math.min(e.startTime,t.timestamp),e.endTime=Math.max(e.endTime,t.timestamp))}_processedContextCreatedEvent(){return this._version!==void 0}_modernize(t){let e=this._version||t.version;if(e===void 0)return[t];let r=[t];for(;e<Ut;++e)r=this[`_modernize_${e}_to_${e+1}`].call(this,r);return r}_modernize_0_to_1(t){for(const e of t)e.type==="action"&&typeof e.metadata.error=="string"&&(e.metadata.error={error:{name:"Error",message:e.metadata.error}});return t}_modernize_1_to_2(t){var e;for(const r of t)r.type!=="frame-snapshot"||!r.snapshot.isMainFrame||(r.snapshot.viewport=((e=this._contextEntry.options)==null?void 0:e.viewport)||{width:1280,height:720});return t}_modernize_2_to_3(t){for(const e of t){if(e.type!=="resource-snapshot"||e.snapshot.request)continue;const r=e.snapshot;e.snapshot={_frameref:r.frameId,request:{url:r.url,method:r.method,headers:r.requestHeaders,postData:r.requestSha1?{_sha1:r.requestSha1}:void 0},response:{status:r.status,headers:r.responseHeaders,content:{mimeType:r.contentType,_sha1:r.responseSha1}},_monotonicTime:r.timestamp}}return t}_modernize_3_to_4(t){const e=[];for(const r of t){const s=this._modernize_event_3_to_4(r);s&&e.push(s)}return e}_modernize_event_3_to_4(t){var r,s,i,a;if(t.type!=="action"&&t.type!=="event")return t;const e=t.metadata;return e.internal||e.method.startsWith("tracing")?null:t.type==="event"?e.method==="__create__"&&e.type==="ConsoleMessage"?{type:"object",class:e.type,guid:e.params.guid,initializer:e.params.initializer}:{type:"event",time:e.startTime,class:e.type,method:e.method,params:e.params,pageId:e.pageId}:{type:"action",callId:e.id,startTime:e.startTime,endTime:e.endTime,apiName:e.apiName||e.type+"."+e.method,class:e.type,method:e.method,params:e.params,wallTime:e.wallTime||Date.now(),log:e.log,beforeSnapshot:(r=e.snapshots.find(o=>o.title==="before"))==null?void 0:r.snapshotName,inputSnapshot:(s=e.snapshots.find(o=>o.title==="input"))==null?void 0:s.snapshotName,afterSnapshot:(i=e.snapshots.find(o=>o.title==="after"))==null?void 0:i.snapshotName,error:(a=e.error)==null?void 0:a.error,result:e.result,point:e.point,pageId:e.pageId}}_modernize_4_to_5(t){const e=[];for(const r of t){const s=this._modernize_event_4_to_5(r);s&&e.push(s)}return e}_modernize_event_4_to_5(t){var e,r;if(t.type==="event"&&t.method==="__create__"&&t.class==="JSHandle"&&this._jsHandles.set(t.params.guid,t.params.initializer),t.type==="object"){if(t.class!=="ConsoleMessage")return null;const s=(e=t.initializer.args)==null?void 0:e.map(i=>{if(i.guid){const a=this._jsHandles.get(i.guid);return{preview:(a==null?void 0:a.preview)||"",value:""}}return{preview:i.preview||"",value:i.value||""}});return this._consoleObjects.set(t.guid,{type:t.initializer.type,text:t.initializer.text,location:t.initializer.location,args:s}),null}if(t.type==="event"&&t.method==="console"){const s=this._consoleObjects.get(((r=t.params.message)==null?void 0:r.guid)||"");return s?{type:"console",time:t.time,pageId:t.pageId,messageType:s.type,text:s.text,args:s.args,location:s.location}:null}return t}_modernize_5_to_6(t){const e=[];for(const r of t)if(e.push(r),!(r.type!=="after"||!r.log.length))for(const s of r.log)e.push({type:"log",callId:r.callId,message:s,time:-1});return e}_modernize_6_to_7(t){const e=[];if(!this._processedContextCreatedEvent()&&t[0].type!=="context-options"){const r={type:"context-options",origin:"testRunner",version:7,browserName:"",options:{},platform:process.platform,wallTime:0,monotonicTime:0,sdkLanguage:"javascript",contextId:""};e.push(r)}for(const r of t){if(r.type==="context-options"){e.push({...r,monotonicTime:0,origin:"library",contextId:""});continue}!this._contextEntry.wallTime&&r.type==="before"&&(this._contextEntry.wallTime=r.wallTime),!this._contextEntry.startTime&&r.type==="before"&&(this._contextEntry.startTime=r.startTime),e.push(r)}return e}}class us{constructor(){N(this,"contextEntries",[]);N(this,"_snapshotStorage");N(this,"_backend");N(this,"_resourceToContentType",new Map)}async load(t,e){var o,l;this._backend=t;const r=[];let s=!1;for(const _ of await this._backend.entryNames()){const f=_.match(/(.+)\.trace$/);f&&r.push(f[1]||""),_.includes("src@")&&(s=!0)}if(!r.length)throw new Error("Cannot find .trace file");this._snapshotStorage=new ls;const i=r.length*3;let a=0;for(const _ of r){const f=ds();f.traceUrl=t.traceURL(),f.hasSource=s;const b=new fs(f,this._snapshotStorage),h=await this._backend.readText(_+".trace")||"";b.appendTrace(h),e(++a,i);const S=await this._backend.readText(_+".network")||"";if(b.appendTrace(S),e(++a,i),f.actions=b.actions().sort((u,c)=>u.startTime-c.startTime),!t.isLive()){for(const u of f.actions.slice().reverse())if(!u.endTime&&!u.error)for(const c of f.actions)c.parentId===u.callId&&u.endTime<c.endTime&&(u.endTime=c.endTime)}const C=await this._backend.readText(_+".stacks");if(C){const u=os(JSON.parse(C));for(const c of f.actions)c.stack=c.stack||u.get(c.callId)}e(++a,i);for(const u of f.resources)(o=u.request.postData)!=null&&o._sha1&&this._resourceToContentType.set(u.request.postData._sha1,Wt(u.request.postData.mimeType)),(l=u.response.content)!=null&&l._sha1&&this._resourceToContentType.set(u.response.content._sha1,Wt(u.response.content.mimeType));this.contextEntries.push(f)}this._snapshotStorage.finalize()}async hasEntry(t){return this._backend.hasEntry(t)}async resourceForSha1(t){const e=await this._backend.readBlob("resources/"+t),r=this._resourceToContentType.get(t);return!e||r===void 0||r==="x-unknown"?e:new Blob([e],{type:r})}storage(){return this._snapshotStorage}}function Wt(n){const t=n.match(/^(.*);\s*charset=.*$/);return t?t[1]:n}function ds(){return{origin:"testRunner",traceUrl:"",startTime:Number.MAX_SAFE_INTEGER,wallTime:Number.MAX_SAFE_INTEGER,endTime:0,browserName:"",options:{deviceScaleFactor:1,isMobile:!1,viewport:{width:1280,height:800}},pages:[],resources:[],actions:[],events:[],errors:[],stdio:[],hasSource:!1,contextId:""}}const _s=15,L=0,te=1,hs=2,X=-2,H=-3,Ht=-4,ne=-5,$=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],Wn=1440,ps=0,ms=4,ws=9,gs=5,bs=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],ys=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],xs=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Es=[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,112,112],Ts=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],Ss=[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],re=15;function ot(){const n=this;let t,e,r,s,i,a;function o(_,f,b,h,S,C,u,c,d,y,g){let m,E,p,R,T,A,x,w,O,I,v,k,D,U,F;I=0,T=b;do r[_[f+I]]++,I++,T--;while(T!==0);if(r[0]==b)return u[0]=-1,c[0]=0,L;for(w=c[0],A=1;A<=re&&r[A]===0;A++);for(x=A,w<A&&(w=A),T=re;T!==0&&r[T]===0;T--);for(p=T,w>T&&(w=T),c[0]=w,U=1<<A;A<T;A++,U<<=1)if((U-=r[A])<0)return H;if((U-=r[T])<0)return H;for(r[T]+=U,a[1]=A=0,I=1,D=2;--T!==0;)a[D]=A+=r[I],D++,I++;T=0,I=0;do(A=_[f+I])!==0&&(g[a[A]++]=T),I++;while(++T<b);for(b=a[p],a[0]=T=0,I=0,R=-1,k=-w,i[0]=0,v=0,F=0;x<=p;x++)for(m=r[x];m--!==0;){for(;x>k+w;){if(R++,k+=w,F=p-k,F=F>w?w:F,(E=1<<(A=x-k))>m+1&&(E-=m+1,D=x,A<F))for(;++A<F&&!((E<<=1)<=r[++D]);)E-=r[D];if(F=1<<A,y[0]+F>Wn)return H;i[R]=v=y[0],y[0]+=F,R!==0?(a[R]=T,s[0]=A,s[1]=w,A=T>>>k-w,s[2]=v-i[R-1]-A,d.set(s,(i[R-1]+A)*3)):u[0]=v}for(s[1]=x-k,I>=b?s[0]=192:g[I]<h?(s[0]=g[I]<256?0:96,s[2]=g[I++]):(s[0]=C[g[I]-h]+16+64,s[2]=S[g[I++]-h]),E=1<<x-k,A=T>>>k;A<F;A+=E)d.set(s,(v+A)*3);for(A=1<<x-1;(T&A)!==0;A>>>=1)T^=A;for(T^=A,O=(1<<k)-1;(T&O)!=a[R];)R--,k-=w,O=(1<<k)-1}return U!==0&&p!=1?ne:L}function l(_){let f;for(t||(t=[],e=[],r=new Int32Array(re+1),s=[],i=new Int32Array(re),a=new Int32Array(re+1)),e.length<_&&(e=[]),f=0;f<_;f++)e[f]=0;for(f=0;f<re+1;f++)r[f]=0;for(f=0;f<3;f++)s[f]=0;i.set(r.subarray(0,re),0),a.set(r.subarray(0,re+1),0)}n.inflate_trees_bits=function(_,f,b,h,S){let C;return l(19),t[0]=0,C=o(_,0,19,19,null,null,b,f,h,t,e),C==H?S.msg="oversubscribed dynamic bit lengths tree":(C==ne||f[0]===0)&&(S.msg="incomplete dynamic bit lengths tree",C=H),C},n.inflate_trees_dynamic=function(_,f,b,h,S,C,u,c,d){let y;return l(288),t[0]=0,y=o(b,0,_,257,xs,Es,C,h,c,t,e),y!=L||h[0]===0?(y==H?d.msg="oversubscribed literal/length tree":y!=Ht&&(d.msg="incomplete literal/length tree",y=H),y):(l(288),y=o(b,_,f,0,Ts,Ss,u,S,c,t,e),y!=L||S[0]===0&&_>257?(y==H?d.msg="oversubscribed distance tree":y==ne?(d.msg="incomplete distance tree",y=H):y!=Ht&&(d.msg="empty distance tree with lengths",y=H),y):L)}}ot.inflate_trees_fixed=function(n,t,e,r){return n[0]=ws,t[0]=gs,e[0]=bs,r[0]=ys,L};const Fe=0,Bt=1,jt=2,qt=3,Yt=4,Gt=5,Vt=6,$e=7,Zt=8,Ne=9;function Rs(){const n=this;let t,e=0,r,s=0,i=0,a=0,o=0,l=0,_=0,f=0,b,h=0,S,C=0;function u(c,d,y,g,m,E,p,R){let T,A,x,w,O,I,v,k,D,U,F,Y,P,he,M,W;v=R.next_in_index,k=R.avail_in,O=p.bitb,I=p.bitk,D=p.write,U=D<p.read?p.read-D-1:p.end-D,F=$[c],Y=$[d];do{for(;I<20;)k--,O|=(R.read_byte(v++)&255)<<I,I+=8;if(T=O&F,A=y,x=g,W=(x+T)*3,(w=A[W])===0){O>>=A[W+1],I-=A[W+1],p.win[D++]=A[W+2],U--;continue}do{if(O>>=A[W+1],I-=A[W+1],(w&16)!==0){for(w&=15,P=A[W+2]+(O&$[w]),O>>=w,I-=w;I<15;)k--,O|=(R.read_byte(v++)&255)<<I,I+=8;T=O&Y,A=m,x=E,W=(x+T)*3,w=A[W];do if(O>>=A[W+1],I-=A[W+1],(w&16)!==0){for(w&=15;I<w;)k--,O|=(R.read_byte(v++)&255)<<I,I+=8;if(he=A[W+2]+(O&$[w]),O>>=w,I-=w,U-=P,D>=he)M=D-he,D-M>0&&2>D-M?(p.win[D++]=p.win[M++],p.win[D++]=p.win[M++],P-=2):(p.win.set(p.win.subarray(M,M+2),D),D+=2,M+=2,P-=2);else{M=D-he;do M+=p.end;while(M<0);if(w=p.end-M,P>w){if(P-=w,D-M>0&&w>D-M)do p.win[D++]=p.win[M++];while(--w!==0);else p.win.set(p.win.subarray(M,M+w),D),D+=w,M+=w,w=0;M=0}}if(D-M>0&&P>D-M)do p.win[D++]=p.win[M++];while(--P!==0);else p.win.set(p.win.subarray(M,M+P),D),D+=P,M+=P,P=0;break}else if((w&64)===0)T+=A[W+2],T+=O&$[w],W=(x+T)*3,w=A[W];else return R.msg="invalid distance code",P=R.avail_in-k,P=I>>3<P?I>>3:P,k+=P,v-=P,I-=P<<3,p.bitb=O,p.bitk=I,R.avail_in=k,R.total_in+=v-R.next_in_index,R.next_in_index=v,p.write=D,H;while(!0);break}if((w&64)===0){if(T+=A[W+2],T+=O&$[w],W=(x+T)*3,(w=A[W])===0){O>>=A[W+1],I-=A[W+1],p.win[D++]=A[W+2],U--;break}}else return(w&32)!==0?(P=R.avail_in-k,P=I>>3<P?I>>3:P,k+=P,v-=P,I-=P<<3,p.bitb=O,p.bitk=I,R.avail_in=k,R.total_in+=v-R.next_in_index,R.next_in_index=v,p.write=D,te):(R.msg="invalid literal/length code",P=R.avail_in-k,P=I>>3<P?I>>3:P,k+=P,v-=P,I-=P<<3,p.bitb=O,p.bitk=I,R.avail_in=k,R.total_in+=v-R.next_in_index,R.next_in_index=v,p.write=D,H)}while(!0)}while(U>=258&&k>=10);return P=R.avail_in-k,P=I>>3<P?I>>3:P,k+=P,v-=P,I-=P<<3,p.bitb=O,p.bitk=I,R.avail_in=k,R.total_in+=v-R.next_in_index,R.next_in_index=v,p.write=D,L}n.init=function(c,d,y,g,m,E){t=Fe,_=c,f=d,b=y,h=g,S=m,C=E,r=null},n.proc=function(c,d,y){let g,m,E,p=0,R=0,T=0,A,x,w,O;for(T=d.next_in_index,A=d.avail_in,p=c.bitb,R=c.bitk,x=c.write,w=x<c.read?c.read-x-1:c.end-x;;)switch(t){case Fe:if(w>=258&&A>=10&&(c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,y=u(_,f,b,h,S,C,c,d),T=d.next_in_index,A=d.avail_in,p=c.bitb,R=c.bitk,x=c.write,w=x<c.read?c.read-x-1:c.end-x,y!=L)){t=y==te?$e:Ne;break}i=_,r=b,s=h,t=Bt;case Bt:for(g=i;R<g;){if(A!==0)y=L;else return c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y);A--,p|=(d.read_byte(T++)&255)<<R,R+=8}if(m=(s+(p&$[g]))*3,p>>>=r[m+1],R-=r[m+1],E=r[m],E===0){a=r[m+2],t=Vt;break}if((E&16)!==0){o=E&15,e=r[m+2],t=jt;break}if((E&64)===0){i=E,s=m/3+r[m+2];break}if((E&32)!==0){t=$e;break}return t=Ne,d.msg="invalid literal/length code",y=H,c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y);case jt:for(g=o;R<g;){if(A!==0)y=L;else return c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y);A--,p|=(d.read_byte(T++)&255)<<R,R+=8}e+=p&$[g],p>>=g,R-=g,i=f,r=S,s=C,t=qt;case qt:for(g=i;R<g;){if(A!==0)y=L;else return c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y);A--,p|=(d.read_byte(T++)&255)<<R,R+=8}if(m=(s+(p&$[g]))*3,p>>=r[m+1],R-=r[m+1],E=r[m],(E&16)!==0){o=E&15,l=r[m+2],t=Yt;break}if((E&64)===0){i=E,s=m/3+r[m+2];break}return t=Ne,d.msg="invalid distance code",y=H,c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y);case Yt:for(g=o;R<g;){if(A!==0)y=L;else return c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y);A--,p|=(d.read_byte(T++)&255)<<R,R+=8}l+=p&$[g],p>>=g,R-=g,t=Gt;case Gt:for(O=x-l;O<0;)O+=c.end;for(;e!==0;){if(w===0&&(x==c.end&&c.read!==0&&(x=0,w=x<c.read?c.read-x-1:c.end-x),w===0&&(c.write=x,y=c.inflate_flush(d,y),x=c.write,w=x<c.read?c.read-x-1:c.end-x,x==c.end&&c.read!==0&&(x=0,w=x<c.read?c.read-x-1:c.end-x),w===0)))return c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y);c.win[x++]=c.win[O++],w--,O==c.end&&(O=0),e--}t=Fe;break;case Vt:if(w===0&&(x==c.end&&c.read!==0&&(x=0,w=x<c.read?c.read-x-1:c.end-x),w===0&&(c.write=x,y=c.inflate_flush(d,y),x=c.write,w=x<c.read?c.read-x-1:c.end-x,x==c.end&&c.read!==0&&(x=0,w=x<c.read?c.read-x-1:c.end-x),w===0)))return c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y);y=L,c.win[x++]=a,w--,t=Fe;break;case $e:if(R>7&&(R-=8,A++,T--),c.write=x,y=c.inflate_flush(d,y),x=c.write,w=x<c.read?c.read-x-1:c.end-x,c.read!=c.write)return c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y);t=Zt;case Zt:return y=te,c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y);case Ne:return y=H,c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y);default:return y=X,c.bitb=p,c.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,c.write=x,c.inflate_flush(d,y)}},n.free=function(){}}const Kt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ge=0,Je=1,Xt=2,$t=3,Jt=4,Qt=5,Le=6,Me=7,zt=8,pe=9;function As(n,t){const e=this;let r=ge,s=0,i=0,a=0,o;const l=[0],_=[0],f=new Rs;let b=0,h=new Int32Array(Wn*3);const S=0,C=new ot;e.bitk=0,e.bitb=0,e.win=new Uint8Array(t),e.end=t,e.read=0,e.write=0,e.reset=function(u,c){c&&(c[0]=S),r==Le&&f.free(u),r=ge,e.bitk=0,e.bitb=0,e.read=e.write=0},e.reset(n,null),e.inflate_flush=function(u,c){let d,y,g;return y=u.next_out_index,g=e.read,d=(g<=e.write?e.write:e.end)-g,d>u.avail_out&&(d=u.avail_out),d!==0&&c==ne&&(c=L),u.avail_out-=d,u.total_out+=d,u.next_out.set(e.win.subarray(g,g+d),y),y+=d,g+=d,g==e.end&&(g=0,e.write==e.end&&(e.write=0),d=e.write-g,d>u.avail_out&&(d=u.avail_out),d!==0&&c==ne&&(c=L),u.avail_out-=d,u.total_out+=d,u.next_out.set(e.win.subarray(g,g+d),y),y+=d,g+=d),u.next_out_index=y,e.read=g,c},e.proc=function(u,c){let d,y,g,m,E,p,R,T;for(m=u.next_in_index,E=u.avail_in,y=e.bitb,g=e.bitk,p=e.write,R=p<e.read?e.read-p-1:e.end-p;;){let A,x,w,O,I,v,k,D;switch(r){case ge:for(;g<3;){if(E!==0)c=L;else return e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);E--,y|=(u.read_byte(m++)&255)<<g,g+=8}switch(d=y&7,b=d&1,d>>>1){case 0:y>>>=3,g-=3,d=g&7,y>>>=d,g-=d,r=Je;break;case 1:A=[],x=[],w=[[]],O=[[]],ot.inflate_trees_fixed(A,x,w,O),f.init(A[0],x[0],w[0],0,O[0],0),y>>>=3,g-=3,r=Le;break;case 2:y>>>=3,g-=3,r=$t;break;case 3:return y>>>=3,g-=3,r=pe,u.msg="invalid block type",c=H,e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c)}break;case Je:for(;g<32;){if(E!==0)c=L;else return e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);E--,y|=(u.read_byte(m++)&255)<<g,g+=8}if((~y>>>16&65535)!=(y&65535))return r=pe,u.msg="invalid stored block lengths",c=H,e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);s=y&65535,y=g=0,r=s!==0?Xt:b!==0?Me:ge;break;case Xt:if(E===0||R===0&&(p==e.end&&e.read!==0&&(p=0,R=p<e.read?e.read-p-1:e.end-p),R===0&&(e.write=p,c=e.inflate_flush(u,c),p=e.write,R=p<e.read?e.read-p-1:e.end-p,p==e.end&&e.read!==0&&(p=0,R=p<e.read?e.read-p-1:e.end-p),R===0)))return e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);if(c=L,d=s,d>E&&(d=E),d>R&&(d=R),e.win.set(u.read_buf(m,d),p),m+=d,E-=d,p+=d,R-=d,(s-=d)!==0)break;r=b!==0?Me:ge;break;case $t:for(;g<14;){if(E!==0)c=L;else return e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);E--,y|=(u.read_byte(m++)&255)<<g,g+=8}if(i=d=y&16383,(d&31)>29||(d>>5&31)>29)return r=pe,u.msg="too many length or distance symbols",c=H,e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);if(d=258+(d&31)+(d>>5&31),!o||o.length<d)o=[];else for(T=0;T<d;T++)o[T]=0;y>>>=14,g-=14,a=0,r=Jt;case Jt:for(;a<4+(i>>>10);){for(;g<3;){if(E!==0)c=L;else return e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);E--,y|=(u.read_byte(m++)&255)<<g,g+=8}o[Kt[a++]]=y&7,y>>>=3,g-=3}for(;a<19;)o[Kt[a++]]=0;if(l[0]=7,d=C.inflate_trees_bits(o,l,_,h,u),d!=L)return c=d,c==H&&(o=null,r=pe),e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);a=0,r=Qt;case Qt:for(;d=i,!(a>=258+(d&31)+(d>>5&31));){let U,F;for(d=l[0];g<d;){if(E!==0)c=L;else return e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);E--,y|=(u.read_byte(m++)&255)<<g,g+=8}if(d=h[(_[0]+(y&$[d]))*3+1],F=h[(_[0]+(y&$[d]))*3+2],F<16)y>>>=d,g-=d,o[a++]=F;else{for(T=F==18?7:F-14,U=F==18?11:3;g<d+T;){if(E!==0)c=L;else return e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);E--,y|=(u.read_byte(m++)&255)<<g,g+=8}if(y>>>=d,g-=d,U+=y&$[T],y>>>=T,g-=T,T=a,d=i,T+U>258+(d&31)+(d>>5&31)||F==16&&T<1)return o=null,r=pe,u.msg="invalid bit length repeat",c=H,e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);F=F==16?o[T-1]:0;do o[T++]=F;while(--U!==0);a=T}}if(_[0]=-1,I=[],v=[],k=[],D=[],I[0]=9,v[0]=6,d=i,d=C.inflate_trees_dynamic(257+(d&31),1+(d>>5&31),o,I,v,k,D,h,u),d!=L)return d==H&&(o=null,r=pe),c=d,e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);f.init(I[0],v[0],h,k[0],h,D[0]),r=Le;case Le:if(e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,(c=f.proc(e,u,c))!=te)return e.inflate_flush(u,c);if(c=L,f.free(u),m=u.next_in_index,E=u.avail_in,y=e.bitb,g=e.bitk,p=e.write,R=p<e.read?e.read-p-1:e.end-p,b===0){r=ge;break}r=Me;case Me:if(e.write=p,c=e.inflate_flush(u,c),p=e.write,R=p<e.read?e.read-p-1:e.end-p,e.read!=e.write)return e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);r=zt;case zt:return c=te,e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);case pe:return c=H,e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c);default:return c=X,e.bitb=y,e.bitk=g,u.avail_in=E,u.total_in+=m-u.next_in_index,u.next_in_index=m,e.write=p,e.inflate_flush(u,c)}}},e.free=function(u){e.reset(u,null),e.win=null,h=null},e.set_dictionary=function(u,c,d){e.win.set(u.subarray(c,c+d),0),e.read=e.write=d},e.sync_point=function(){return r==Je?1:0}}const Cs=32,Is=8,Os=0,en=1,tn=2,nn=3,rn=4,sn=5,Qe=6,Ee=7,an=12,se=13,ks=[0,0,255,255];function Ds(){const n=this;n.mode=0,n.method=0,n.was=[0],n.need=0,n.marker=0,n.wbits=0;function t(e){return!e||!e.istate?X:(e.total_in=e.total_out=0,e.msg=null,e.istate.mode=Ee,e.istate.blocks.reset(e,null),L)}n.inflateEnd=function(e){return n.blocks&&n.blocks.free(e),n.blocks=null,L},n.inflateInit=function(e,r){return e.msg=null,n.blocks=null,r<8||r>15?(n.inflateEnd(e),X):(n.wbits=r,e.istate.blocks=new As(e,1<<r),t(e),L)},n.inflate=function(e,r){let s,i;if(!e||!e.istate||!e.next_in)return X;const a=e.istate;for(r=r==ms?ne:L,s=ne;;)switch(a.mode){case Os:if(e.avail_in===0)return s;if(s=r,e.avail_in--,e.total_in++,((a.method=e.read_byte(e.next_in_index++))&15)!=Is){a.mode=se,e.msg="unknown compression method",a.marker=5;break}if((a.method>>4)+8>a.wbits){a.mode=se,e.msg="invalid win size",a.marker=5;break}a.mode=en;case en:if(e.avail_in===0)return s;if(s=r,e.avail_in--,e.total_in++,i=e.read_byte(e.next_in_index++)&255,((a.method<<8)+i)%31!==0){a.mode=se,e.msg="incorrect header check",a.marker=5;break}if((i&Cs)===0){a.mode=Ee;break}a.mode=tn;case tn:if(e.avail_in===0)return s;s=r,e.avail_in--,e.total_in++,a.need=(e.read_byte(e.next_in_index++)&255)<<24&4278190080,a.mode=nn;case nn:if(e.avail_in===0)return s;s=r,e.avail_in--,e.total_in++,a.need+=(e.read_byte(e.next_in_index++)&255)<<16&16711680,a.mode=rn;case rn:if(e.avail_in===0)return s;s=r,e.avail_in--,e.total_in++,a.need+=(e.read_byte(e.next_in_index++)&255)<<8&65280,a.mode=sn;case sn:return e.avail_in===0?s:(s=r,e.avail_in--,e.total_in++,a.need+=e.read_byte(e.next_in_index++)&255,a.mode=Qe,hs);case Qe:return a.mode=se,e.msg="need dictionary",a.marker=0,X;case Ee:if(s=a.blocks.proc(e,s),s==H){a.mode=se,a.marker=0;break}if(s==L&&(s=r),s!=te)return s;s=r,a.blocks.reset(e,a.was),a.mode=an;case an:return e.avail_in=0,te;case se:return H;default:return X}},n.inflateSetDictionary=function(e,r,s){let i=0,a=s;if(!e||!e.istate||e.istate.mode!=Qe)return X;const o=e.istate;return a>=1<<o.wbits&&(a=(1<<o.wbits)-1,i=s-a),o.blocks.set_dictionary(r,i,a),o.mode=Ee,L},n.inflateSync=function(e){let r,s,i,a,o;if(!e||!e.istate)return X;const l=e.istate;if(l.mode!=se&&(l.mode=se,l.marker=0),(r=e.avail_in)===0)return ne;for(s=e.next_in_index,i=l.marker;r!==0&&i<4;)e.read_byte(s)==ks[i]?i++:e.read_byte(s)!==0?i=0:i=4-i,s++,r--;return e.total_in+=s-e.next_in_index,e.next_in_index=s,e.avail_in=r,l.marker=i,i!=4?H:(a=e.total_in,o=e.total_out,t(e),e.total_in=a,e.total_out=o,l.mode=Ee,L)},n.inflateSyncPoint=function(e){return!e||!e.istate||!e.istate.blocks?X:e.istate.blocks.sync_point()}}function Hn(){}Hn.prototype={inflateInit(n){const t=this;return t.istate=new Ds,n||(n=_s),t.istate.inflateInit(t,n)},inflate(n){const t=this;return t.istate?t.istate.inflate(t,n):X},inflateEnd(){const n=this;if(!n.istate)return X;const t=n.istate.inflateEnd(n);return n.istate=null,t},inflateSync(){const n=this;return n.istate?n.istate.inflateSync(n):X},inflateSetDictionary(n,t){const e=this;return e.istate?e.istate.inflateSetDictionary(e,n,t):X},read_byte(n){return this.next_in[n]},read_buf(n,t){return this.next_in.subarray(n,n+t)}};function Ps(n){const t=this,e=new Hn,r=n&&n.chunkSize?Math.floor(n.chunkSize*2):128*1024,s=ps,i=new Uint8Array(r);let a=!1;e.inflateInit(),e.next_out=i,t.append=function(o,l){const _=[];let f,b,h=0,S=0,C=0;if(o.length!==0){e.next_in_index=0,e.next_in=o,e.avail_in=o.length;do{if(e.next_out_index=0,e.avail_out=r,e.avail_in===0&&!a&&(e.next_in_index=0,a=!0),f=e.inflate(s),a&&f===ne){if(e.avail_in!==0)throw new Error("inflating: bad input")}else if(f!==L&&f!==te)throw new Error("inflating: "+e.msg);if((a||f===te)&&e.avail_in===o.length)throw new Error("inflating: bad input");e.next_out_index&&(e.next_out_index===r?_.push(new Uint8Array(i)):_.push(i.subarray(0,e.next_out_index))),C+=e.next_out_index,l&&e.next_in_index>0&&e.next_in_index!=h&&(l(e.next_in_index),h=e.next_in_index)}while(e.avail_in>0||e.avail_out===0);return _.length>1?(b=new Uint8Array(C),_.forEach(function(u){b.set(u,S),S+=u.length})):b=_[0]?new Uint8Array(_[0]):new Uint8Array,b}},t.flush=function(){e.inflateEnd()}}const me=4294967295,oe=65535,vs=8,Fs=0,Ns=99,Ls=67324752,Ms=134695760,on=33639248,Us=101010256,cn=101075792,Ws=117853008,ce=22,ze=20,et=56,Hs=1,Bs=39169,js=10,qs=1,Ys=21589,Gs=28789,Vs=25461,Zs=6534,ln=1,Ks=6,fn=8,un=2048,dn=16,_n=16384,hn=73,pn="/",V=void 0,de="undefined",ke="function";class mn{constructor(t){return class extends TransformStream{constructor(e,r){const s=new t(r);super({transform(i,a){a.enqueue(s.append(i))},flush(i){const a=s.flush();a&&i.enqueue(a)}})}}}}const Xs=64;let Bn=2;try{typeof navigator!=de&&navigator.hardwareConcurrency&&(Bn=navigator.hardwareConcurrency)}catch{}const $s={chunkSize:512*1024,maxWorkers:Bn,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,workerScripts:V,CompressionStreamNative:typeof CompressionStream!=de&&CompressionStream,DecompressionStreamNative:typeof DecompressionStream!=de&&DecompressionStream},le=Object.assign({},$s);function jn(){return le}function Js(n){return Math.max(n.chunkSize,Xs)}function qn(n){const{baseURL:t,chunkSize:e,maxWorkers:r,terminateWorkerTimeout:s,useCompressionStream:i,useWebWorkers:a,Deflate:o,Inflate:l,CompressionStream:_,DecompressionStream:f,workerScripts:b}=n;if(ie("baseURL",t),ie("chunkSize",e),ie("maxWorkers",r),ie("terminateWorkerTimeout",s),ie("useCompressionStream",i),ie("useWebWorkers",a),o&&(le.CompressionStream=new mn(o)),l&&(le.DecompressionStream=new mn(l)),ie("CompressionStream",_),ie("DecompressionStream",f),b!==V){const{deflate:h,inflate:S}=b;if((h||S)&&(le.workerScripts||(le.workerScripts={})),h){if(!Array.isArray(h))throw new Error("workerScripts.deflate must be an array");le.workerScripts.deflate=h}if(S){if(!Array.isArray(S))throw new Error("workerScripts.inflate must be an array");le.workerScripts.inflate=S}}}function ie(n,t){t!==V&&(le[n]=t)}function Qs(){return"application/octet-stream"}const Yn=[];for(let n=0;n<256;n++){let t=n;for(let e=0;e<8;e++)t&1?t=t>>>1^3988292384:t=t>>>1;Yn[n]=t}class je{constructor(t){this.crc=t||-1}append(t){let e=this.crc|0;for(let r=0,s=t.length|0;r<s;r++)e=e>>>8^Yn[(e^t[r])&255];this.crc=e}get(){return~this.crc}}class Gn extends TransformStream{constructor(){let t;const e=new je;super({transform(r,s){e.append(r),s.enqueue(r)},flush(){const r=new Uint8Array(4);new DataView(r.buffer).setUint32(0,e.get()),t.value=r}}),t=this}}function zs(n){if(typeof TextEncoder==de){n=unescape(encodeURIComponent(n));const t=new Uint8Array(n.length);for(let e=0;e<t.length;e++)t[e]=n.charCodeAt(e);return t}else return new TextEncoder().encode(n)}const K={concat(n,t){if(n.length===0||t.length===0)return n.concat(t);const e=n[n.length-1],r=K.getPartial(e);return r===32?n.concat(t):K._shiftRight(t,r,e|0,n.slice(0,n.length-1))},bitLength(n){const t=n.length;if(t===0)return 0;const e=n[t-1];return(t-1)*32+K.getPartial(e)},clamp(n,t){if(n.length*32<t)return n;n=n.slice(0,Math.ceil(t/32));const e=n.length;return t=t&31,e>0&&t&&(n[e-1]=K.partial(t,n[e-1]&2147483648>>t-1,1)),n},partial(n,t,e){return n===32?t:(e?t|0:t<<32-n)+n*1099511627776},getPartial(n){return Math.round(n/1099511627776)||32},_shiftRight(n,t,e,r){for(r===void 0&&(r=[]);t>=32;t-=32)r.push(e),e=0;if(t===0)return r.concat(n);for(let a=0;a<n.length;a++)r.push(e|n[a]>>>t),e=n[a]<<32-t;const s=n.length?n[n.len