brave-real-playwright-core
Version:
Brave-optimized Playwright Core (v1.55.0) with comprehensive stealth patches and error stack sanitization
3 lines • 93.6 kB
JavaScript
var Ys=Object.defineProperty;var Vs=(n,t,e)=>t in n?Ys(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var L=(n,t,e)=>Vs(n,typeof t!="symbol"?t+"":t,e);function Gs(n,t){const e=new Array(t.length).fill(0);return new Array(t.length).fill(0).map((s,r)=>(i,a)=>{e[r]=i/a*t[r]*1e3,n(e.reduce((c,l)=>c+l,0),1e3)})}const vn={"&":"&","<":"<",">":">",'"':""","'":"'"};function Zs(n){return n.replace(/[&<>"']/ug,t=>vn[t])}function Ks(n){return n.replace(/[&<]/ug,t=>vn[t])}function Lt(n,t,e){return n.find((s,r)=>{if(r===n.length-1)return!0;const i=n[r+1];return Math.abs(t(s)-e)<Math.abs(t(i)-e)})}function Ln(n){return Array.isArray(n)&&typeof n[0]=="string"}function Xs(n){return Array.isArray(n)&&Array.isArray(n[0])}class $s{constructor(t,e,s,r,i){L(this,"_htmlCache");L(this,"_snapshots");L(this,"_index");L(this,"snapshotName");L(this,"_resources");L(this,"_snapshot");L(this,"_callId");L(this,"_screencastFrames");this._htmlCache=t,this._resources=e,this._snapshots=s,this._index=i,this._snapshot=s[i],this._callId=s[i].callId,this._screencastFrames=r,this.snapshotName=s[i].snapshotName}snapshot(){return this._snapshots[this._index]}viewport(){return this._snapshots[this._index].viewport}closestScreenshot(){var r;const{wallTime:t,timestamp:e}=this.snapshot(),s=t&&((r=this._screencastFrames[0])!=null&&r.frameSwapWallTime)?Lt(this._screencastFrames,i=>i.frameSwapWallTime,t):Lt(this._screencastFrames,i=>i.timestamp,e);return s==null?void 0:s.sha1}render(){const t=[],e=(i,a,c,l)=>{if(typeof i=="string"){c==="STYLE"||c==="style"?t.push(rr(tr(i))):t.push(Ks(i));return}if(Xs(i)){const _=a-i[0][0];if(_>=0&&_<=a){const f=Qs(this._snapshots[_]),b=i[0][1];if(b>=0&&b<f.length)return e(f[b],_,c,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",o=h==="A",d=h==="IMG",y=d&&S.some(m=>m[0]===C),g=h==="SOURCE"&&c==="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;o&&m.toLowerCase()==="href"?R="link://"+E:(m.toLowerCase()==="href"||m.toLowerCase()==="src"||m===C)&&(R=rt(E)),t.push(" ",p,'="',Zs(R),'"')}t.push(">");for(const m of b)e(m,a,h,S);Js.has(h)||t.push("</",h,">");return}else return},s=this._snapshot;return{html:this._htmlCache.getOrCompute(this,()=>{e(s.html,this._index,void 0,void 0);const a=(s.doctype?`<!DOCTYPE ${s.doctype}>`:"")+["<style>*,*::before,*::after { visibility: hidden }</style>",`<script>${zs(this.viewport(),this._callId,this.snapshotName)}<\/script>`].join("")+t.join("");return{value:a,size:a.length}}),pageId:s.pageId,frameId:s.frameId,index:this._index}}resourceByUrl(t,e){const s=this._snapshot;let r,i;for(const c of this._resources){if(typeof c._monotonicTime=="number"&&c._monotonicTime>=s.timestamp)break;c.response.status!==304&&c.request.url===t&&c.request.method===e&&(c._frameref===s.frameId?r=c:i=c)}let a=r??i;if(a&&e.toUpperCase()==="GET"){for(const c of s.resourceOverrides)if(t===c.url&&c.sha1){a={...a,response:{...a.response,content:{...a.response.content,_sha1:c.sha1}}};break}}return a}}const Js=new Set(["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","MENUITEM","META","PARAM","SOURCE","TRACK","WBR"]);function Qs(n){if(!n._nodes){const t=[],e=s=>{if(typeof s=="string")t.push(s);else if(Ln(s)){const[,,...r]=s;for(const i of r)e(i);t.push(s)}};e(n.html),n._nodes=t}return n._nodes}function zs(n,...t){function e(s,r,...i){const a=new URLSearchParams(location.search),c=a.has("shouldPopulateCanvasFromScreenshot"),l=a.has("isUnderTest"),_={viewport:r,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 o=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(s(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(),o(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,N=O.top+O.height/2;if(w.style.left=I+"px",w.style.top=N+"px",m&&(Math.abs(I-E)>=10||Math.abs(N-p)>=10)){const P=document.createElement("x-pw-pointer-warning");P.textContent="⚠",P.style.fontSize="19px",P.style.color="white",P.style.marginTop="-3.5px",P.style.userSelect="none",w.appendChild(P),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 M=O.frameElement;O=O.parent;const v=(R=O.__playwright_frame_bounding_rects__)==null?void 0:R.frames.get(M);if(!(v!=null&&v.boundingRect))break;const Y=v.boundingRect.left-v.scrollLeft,D=v.boundingRect.top-v.scrollTop;w.left+=Y,w.top+=D,w.right+=Y,w.bottom+=D}const{width:I,height:N}=u.__playwright_frame_bounding_rects__.viewport;w.left=w.left/I,w.top=w.top/N,w.right=w.right/I,w.bottom=w.bottom/N;const P=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),c?(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),P?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(M=>Math.floor(M*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=()=>o(document);window.addEventListener("load",d),window.addEventListener("DOMContentLoaded",y)}return`
(${e.toString()})(${it.toString()}, ${JSON.stringify(n)}${t.map(s=>`, "${s}"`).join("")})`}const Fn=["about:","blob:","data:","file:","ftp:","http:","https:","mailto:","sftp:","ws:","wss:"],Ft="http://playwright.bloburl/#";function rt(n){n.startsWith(Ft)&&(n=n.substring(Ft.length));try{const t=new URL(n);if(t.protocol==="javascript:"||t.protocol==="vbscript:")return"javascript:void(0)";const e=t.protocol==="blob:",s=t.protocol==="file:";if(!e&&!s&&Fn.includes(t.protocol))return n;const r="pw-"+t.protocol.slice(0,t.protocol.length-1);return s||(t.protocol="https:"),t.hostname=t.hostname?`${r}--${t.hostname}`:r,s&&(t.protocol="https:"),t.toString()}catch{return n}}const er=/url\(['"]?([\w-]+:)\/\//ig;function tr(n){return n.replace(er,(t,e)=>!(e==="blob:")&&!(e==="file:")&&Fn.includes(e)?t:t.replace(e+"//",`https://pw-${e.slice(0,-1)}--`))}const nr=/url\(\s*'([^']*)'\s*\)/ig,sr=/url\(\s*"([^"]*)"\s*\)/ig;function rr(n){const t=(e,s)=>s.includes("</")?e.replace(s,encodeURI(s)):e;return n.replace(nr,t).replace(sr,t)}function it(n){const t=new URL(n);return t.pathname.endsWith("/snapshot.html")?t.searchParams.get("r"):n}class ir{constructor(t,e){L(this,"_snapshotStorage");L(this,"_resourceLoader");L(this,"_snapshotIds",new Map);this._snapshotStorage=t,this._resourceLoader=e}serveSnapshot(t,e,s){const r=this._snapshot(t,e);if(!r)return new Response(null,{status:404});const i=r.render();return this._snapshotIds.set(s,r),new Response(i.html,{status:200,headers:{"Content-Type":"text/html; charset=utf-8"}})}async serveClosestScreenshot(t,e){const s=this._snapshot(t,e),r=s==null?void 0:s.closestScreenshot();return r?new Response(await this._resourceLoader(r)):new Response(null,{status:404})}serveSnapshotInfo(t,e){const s=this._snapshot(t,e);return this._respondWithJson(s?{viewport:s.viewport(),url:s.snapshot().frameUrl,timestamp:s.snapshot().timestamp,wallTime:s.snapshot().wallTime}:{error:"No snapshot found"})}_snapshot(t,e){const s=e.get("name");return this._snapshotStorage.snapshotByName(t,s)}_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,s){let r;const i=this._snapshotIds.get(s);for(const S of t)if(r=i==null?void 0:i.resourceByUrl(ar(S),e),r)break;if(!r)return new Response(null,{status:404});const a=r.response.content._sha1,c=a?await this._resourceLoader(a)||new Blob([]):new Blob([]);let l=r.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 r.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(c.size)),f.set("Cache-Control","public, max-age=31536000");const{status:b}=r.response,h=b===101||b===204||b===205||b===304;return new Response(h?null:c,{headers:f,status:r.response.status,statusText:r.response.statusText})}}function ar(n){try{const t=new URL(n);return t.hash="",t.toString()}catch{return n}}function or(n){const t=new Map,{files:e,stacks:s}=n;for(const r of s){const[i,a]=r;t.set(`call@${i}`,a.map(c=>({file:e[c[0]],line:c[1],column:c[2],function:c[3]})))}return t}class cr{constructor(t){L(this,"_maxSize");L(this,"_map");L(this,"_size");this._maxSize=t,this._map=new Map,this._size=0}getOrCompute(t,e){if(this._map.has(t)){const r=this._map.get(t);return this._map.delete(t),this._map.set(t,r),r.value}const s=e();for(;this._map.size&&this._size+s.size>this._maxSize;){const[r,i]=this._map.entries().next().value;this._size-=i.size,this._map.delete(r)}return this._map.set(t,s),this._size+=s.size,s.value}}class lr{constructor(){L(this,"_frameSnapshots",new Map);L(this,"_cache",new cr(1e8));L(this,"_contextToResources",new Map)}addResource(t,e){e.request.url=rt(e.request.url),this._ensureResourcesForContext(t).push(e)}addFrameSnapshot(t,e,s){for(const c of e.resourceOverrides)c.url=rt(c.url);let r=this._frameSnapshots.get(e.frameId);r||(r={raw:[],renderers:[]},this._frameSnapshots.set(e.frameId,r),e.isMainFrame&&this._frameSnapshots.set(e.pageId,r)),r.raw.push(e);const i=this._ensureResourcesForContext(t),a=new $s(this._cache,i,r.raw,s,r.raw.length-1);return r.renderers.push(a),a}snapshotByName(t,e){const s=this._frameSnapshots.get(t);return s==null?void 0:s.renderers.find(r=>r.snapshotName===e)}snapshotsForTest(){return[...this._frameSnapshots.keys()]}finalize(){for(const t of this._contextToResources.values())t.sort((e,s)=>(e._monotonicTime||0)-(s._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=8;class fr{constructor(t,e){L(this,"_contextEntry");L(this,"_snapshotStorage");L(this,"_actionMap",new Map);L(this,"_version");L(this,"_pageEntries",new Map);L(this,"_jsHandles",new Map);L(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 s of e)this._innerAppendEvent(s)}_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 s=this._actionMap.get(t.callId);s.inputSnapshot=t.inputSnapshot,s.point=t.point;break}case"log":{const s=this._actionMap.get(t.callId);if(!s)return;s.log.push({time:t.time,message:t.message});break}case"after":{const s=this._actionMap.get(t.callId);s.afterSnapshot=t.afterSnapshot,s.endTime=t.endTime,s.result=t.result,s.error=t.error,s.attachments=t.attachments,s.annotations=t.annotations,t.point&&(s.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??6,s=[t];for(;e<Ut;++e)s=this[`_modernize_${e}_to_${e+1}`].call(this,s);return s}_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 s of t)s.type!=="frame-snapshot"||!s.snapshot.isMainFrame||(s.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 s=e.snapshot;e.snapshot={_frameref:s.frameId,request:{url:s.url,method:s.method,headers:s.requestHeaders,postData:s.requestSha1?{_sha1:s.requestSha1}:void 0},response:{status:s.status,headers:s.responseHeaders,content:{mimeType:s.contentType,_sha1:s.responseSha1}},_monotonicTime:s.timestamp}}return t}_modernize_3_to_4(t){const e=[];for(const s of t){const r=this._modernize_event_3_to_4(s);r&&e.push(r)}return e}_modernize_event_3_to_4(t){var s,r,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:(s=e.snapshots.find(c=>c.title==="before"))==null?void 0:s.snapshotName,inputSnapshot:(r=e.snapshots.find(c=>c.title==="input"))==null?void 0:r.snapshotName,afterSnapshot:(i=e.snapshots.find(c=>c.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 s of t){const r=this._modernize_event_4_to_5(s);r&&e.push(r)}return e}_modernize_event_4_to_5(t){var e,s;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 r=(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:r}),null}if(t.type==="event"&&t.method==="console"){const r=this._consoleObjects.get(((s=t.params.message)==null?void 0:s.guid)||"");return r?{type:"console",time:t.time,pageId:t.pageId,messageType:r.type,text:r.text,args:r.args,location:r.location}:null}return t}_modernize_5_to_6(t){const e=[];for(const s of t)if(e.push(s),!(s.type!=="after"||!s.log.length))for(const r of s.log)e.push({type:"log",callId:s.callId,message:r,time:-1});return e}_modernize_6_to_7(t){const e=[];if(!this._processedContextCreatedEvent()&&t[0].type!=="context-options"){const s={type:"context-options",origin:"testRunner",version:6,browserName:"",options:{},platform:"unknown",wallTime:0,monotonicTime:0,sdkLanguage:"javascript",contextId:""};e.push(s)}for(const s of t){if(s.type==="context-options"){e.push({...s,monotonicTime:0,origin:"library",contextId:""});continue}if(s.type==="before"||s.type==="action"){this._contextEntry.wallTime||(this._contextEntry.wallTime=s.wallTime);const r=s,i=s;i.stepId=`${r.apiName}@${r.wallTime}`,e.push(i)}else e.push(s)}return e}_modernize_7_to_8(t){const e=[];for(const s of t)if(s.type==="before"||s.type==="action"){const r=s,i=s;r.apiName&&(i.title=r.apiName,delete i.apiName),i.stepId=r.stepId??r.callId,e.push(i)}else e.push(s);return e}}class ur{constructor(){L(this,"contextEntries",[]);L(this,"_snapshotStorage");L(this,"_backend");L(this,"_resourceToContentType",new Map)}async load(t,e){var c,l;this._backend=t;const s=[];let r=!1;for(const _ of await this._backend.entryNames()){const f=_.match(/(.+)\.trace$/);f&&s.push(f[1]||""),_.includes("src@")&&(r=!0)}if(!s.length)throw new Error("Cannot find .trace file");this._snapshotStorage=new lr;const i=s.length*3;let a=0;for(const _ of s){const f=dr();f.traceUrl=t.traceURL(),f.hasSource=r;const b=new fr(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,o)=>u.startTime-o.startTime),!t.isLive()){for(const u of f.actions.slice().reverse())if(!u.endTime&&!u.error)for(const o of f.actions)o.parentId===u.callId&&u.endTime<o.endTime&&(u.endTime=o.endTime)}const C=await this._backend.readText(_+".stacks");if(C){const u=or(JSON.parse(C));for(const o of f.actions)o.stack=o.stack||u.get(o.callId)}e(++a,i);for(const u of f.resources)(c=u.request.postData)!=null&&c._sha1&&this._resourceToContentType.set(u.request.postData._sha1,Mt(u.request.postData.mimeType)),(l=u.response.content)!=null&&l._sha1&&this._resourceToContentType.set(u.response.content._sha1,Mt(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),s=this._resourceToContentType.get(t);return!e||s===void 0||s==="x-unknown"?e:new Blob([e],{type:s})}storage(){return this._snapshotStorage}}function Mt(n){const t=n.match(/^(.*);\s*charset=.*$/);return t?t[1]:n}function dr(){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 _r=15,F=0,ee=1,hr=2,X=-2,H=-3,Wt=-4,te=-5,$=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],Mn=1440,pr=0,mr=4,wr=9,gr=5,br=[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],yr=[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],xr=[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],Er=[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],Tr=[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],Sr=[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],ne=15;function at(){const n=this;let t,e,s,r,i,a;function c(_,f,b,h,S,C,u,o,d,y,g){let m,E,p,R,T,A,x,w,O,I,N,P,k,M,v;I=0,T=b;do s[_[f+I]]++,I++,T--;while(T!==0);if(s[0]==b)return u[0]=-1,o[0]=0,F;for(w=o[0],A=1;A<=ne&&s[A]===0;A++);for(x=A,w<A&&(w=A),T=ne;T!==0&&s[T]===0;T--);for(p=T,w>T&&(w=T),o[0]=w,M=1<<A;A<T;A++,M<<=1)if((M-=s[A])<0)return H;if((M-=s[T])<0)return H;for(s[T]+=M,a[1]=A=0,I=1,k=2;--T!==0;)a[k]=A+=s[I],k++,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,P=-w,i[0]=0,N=0,v=0;x<=p;x++)for(m=s[x];m--!==0;){for(;x>P+w;){if(R++,P+=w,v=p-P,v=v>w?w:v,(E=1<<(A=x-P))>m+1&&(E-=m+1,k=x,A<v))for(;++A<v&&!((E<<=1)<=s[++k]);)E-=s[k];if(v=1<<A,y[0]+v>Mn)return H;i[R]=N=y[0],y[0]+=v,R!==0?(a[R]=T,r[0]=A,r[1]=w,A=T>>>P-w,r[2]=N-i[R-1]-A,d.set(r,(i[R-1]+A)*3)):u[0]=N}for(r[1]=x-P,I>=b?r[0]=192:g[I]<h?(r[0]=g[I]<256?0:96,r[2]=g[I++]):(r[0]=C[g[I]-h]+16+64,r[2]=S[g[I++]-h]),E=1<<x-P,A=T>>>P;A<v;A+=E)d.set(r,(N+A)*3);for(A=1<<x-1;(T&A)!==0;A>>>=1)T^=A;for(T^=A,O=(1<<P)-1;(T&O)!=a[R];)R--,P-=w,O=(1<<P)-1}return M!==0&&p!=1?te:F}function l(_){let f;for(t||(t=[],e=[],s=new Int32Array(ne+1),r=[],i=new Int32Array(ne),a=new Int32Array(ne+1)),e.length<_&&(e=[]),f=0;f<_;f++)e[f]=0;for(f=0;f<ne+1;f++)s[f]=0;for(f=0;f<3;f++)r[f]=0;i.set(s.subarray(0,ne),0),a.set(s.subarray(0,ne+1),0)}n.inflate_trees_bits=function(_,f,b,h,S){let C;return l(19),t[0]=0,C=c(_,0,19,19,null,null,b,f,h,t,e),C==H?S.msg="oversubscribed dynamic bit lengths tree":(C==te||f[0]===0)&&(S.msg="incomplete dynamic bit lengths tree",C=H),C},n.inflate_trees_dynamic=function(_,f,b,h,S,C,u,o,d){let y;return l(288),t[0]=0,y=c(b,0,_,257,xr,Er,C,h,o,t,e),y!=F||h[0]===0?(y==H?d.msg="oversubscribed literal/length tree":y!=Wt&&(d.msg="incomplete literal/length tree",y=H),y):(l(288),y=c(b,_,f,0,Tr,Sr,u,S,o,t,e),y!=F||S[0]===0&&_>257?(y==H?d.msg="oversubscribed distance tree":y==te?(d.msg="incomplete distance tree",y=H):y!=Wt&&(d.msg="empty distance tree with lengths",y=H),y):F)}}at.inflate_trees_fixed=function(n,t,e,s){return n[0]=wr,t[0]=gr,e[0]=br,s[0]=yr,F};const Ne=0,Ht=1,Bt=2,jt=3,qt=4,Yt=5,Vt=6,Xe=7,Gt=8,ve=9;function Rr(){const n=this;let t,e=0,s,r=0,i=0,a=0,c=0,l=0,_=0,f=0,b,h=0,S,C=0;function u(o,d,y,g,m,E,p,R){let T,A,x,w,O,I,N,P,k,M,v,Y,D,_e,U,W;N=R.next_in_index,P=R.avail_in,O=p.bitb,I=p.bitk,k=p.write,M=k<p.read?p.read-k-1:p.end-k,v=$[o],Y=$[d];do{for(;I<20;)P--,O|=(R.read_byte(N++)&255)<<I,I+=8;if(T=O&v,A=y,x=g,W=(x+T)*3,(w=A[W])===0){O>>=A[W+1],I-=A[W+1],p.win[k++]=A[W+2],M--;continue}do{if(O>>=A[W+1],I-=A[W+1],(w&16)!==0){for(w&=15,D=A[W+2]+(O&$[w]),O>>=w,I-=w;I<15;)P--,O|=(R.read_byte(N++)&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;)P--,O|=(R.read_byte(N++)&255)<<I,I+=8;if(_e=A[W+2]+(O&$[w]),O>>=w,I-=w,M-=D,k>=_e)U=k-_e,k-U>0&&2>k-U?(p.win[k++]=p.win[U++],p.win[k++]=p.win[U++],D-=2):(p.win.set(p.win.subarray(U,U+2),k),k+=2,U+=2,D-=2);else{U=k-_e;do U+=p.end;while(U<0);if(w=p.end-U,D>w){if(D-=w,k-U>0&&w>k-U)do p.win[k++]=p.win[U++];while(--w!==0);else p.win.set(p.win.subarray(U,U+w),k),k+=w,U+=w,w=0;U=0}}if(k-U>0&&D>k-U)do p.win[k++]=p.win[U++];while(--D!==0);else p.win.set(p.win.subarray(U,U+D),k),k+=D,U+=D,D=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",D=R.avail_in-P,D=I>>3<D?I>>3:D,P+=D,N-=D,I-=D<<3,p.bitb=O,p.bitk=I,R.avail_in=P,R.total_in+=N-R.next_in_index,R.next_in_index=N,p.write=k,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[k++]=A[W+2],M--;break}}else return(w&32)!==0?(D=R.avail_in-P,D=I>>3<D?I>>3:D,P+=D,N-=D,I-=D<<3,p.bitb=O,p.bitk=I,R.avail_in=P,R.total_in+=N-R.next_in_index,R.next_in_index=N,p.write=k,ee):(R.msg="invalid literal/length code",D=R.avail_in-P,D=I>>3<D?I>>3:D,P+=D,N-=D,I-=D<<3,p.bitb=O,p.bitk=I,R.avail_in=P,R.total_in+=N-R.next_in_index,R.next_in_index=N,p.write=k,H)}while(!0)}while(M>=258&&P>=10);return D=R.avail_in-P,D=I>>3<D?I>>3:D,P+=D,N-=D,I-=D<<3,p.bitb=O,p.bitk=I,R.avail_in=P,R.total_in+=N-R.next_in_index,R.next_in_index=N,p.write=k,F}n.init=function(o,d,y,g,m,E){t=Ne,_=o,f=d,b=y,h=g,S=m,C=E,s=null},n.proc=function(o,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=o.bitb,R=o.bitk,x=o.write,w=x<o.read?o.read-x-1:o.end-x;;)switch(t){case Ne:if(w>=258&&A>=10&&(o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,y=u(_,f,b,h,S,C,o,d),T=d.next_in_index,A=d.avail_in,p=o.bitb,R=o.bitk,x=o.write,w=x<o.read?o.read-x-1:o.end-x,y!=F)){t=y==ee?Xe:ve;break}i=_,s=b,r=h,t=Ht;case Ht:for(g=i;R<g;){if(A!==0)y=F;else return o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y);A--,p|=(d.read_byte(T++)&255)<<R,R+=8}if(m=(r+(p&$[g]))*3,p>>>=s[m+1],R-=s[m+1],E=s[m],E===0){a=s[m+2],t=Vt;break}if((E&16)!==0){c=E&15,e=s[m+2],t=Bt;break}if((E&64)===0){i=E,r=m/3+s[m+2];break}if((E&32)!==0){t=Xe;break}return t=ve,d.msg="invalid literal/length code",y=H,o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y);case Bt:for(g=c;R<g;){if(A!==0)y=F;else return o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y);A--,p|=(d.read_byte(T++)&255)<<R,R+=8}e+=p&$[g],p>>=g,R-=g,i=f,s=S,r=C,t=jt;case jt:for(g=i;R<g;){if(A!==0)y=F;else return o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y);A--,p|=(d.read_byte(T++)&255)<<R,R+=8}if(m=(r+(p&$[g]))*3,p>>=s[m+1],R-=s[m+1],E=s[m],(E&16)!==0){c=E&15,l=s[m+2],t=qt;break}if((E&64)===0){i=E,r=m/3+s[m+2];break}return t=ve,d.msg="invalid distance code",y=H,o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y);case qt:for(g=c;R<g;){if(A!==0)y=F;else return o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y);A--,p|=(d.read_byte(T++)&255)<<R,R+=8}l+=p&$[g],p>>=g,R-=g,t=Yt;case Yt:for(O=x-l;O<0;)O+=o.end;for(;e!==0;){if(w===0&&(x==o.end&&o.read!==0&&(x=0,w=x<o.read?o.read-x-1:o.end-x),w===0&&(o.write=x,y=o.inflate_flush(d,y),x=o.write,w=x<o.read?o.read-x-1:o.end-x,x==o.end&&o.read!==0&&(x=0,w=x<o.read?o.read-x-1:o.end-x),w===0)))return o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y);o.win[x++]=o.win[O++],w--,O==o.end&&(O=0),e--}t=Ne;break;case Vt:if(w===0&&(x==o.end&&o.read!==0&&(x=0,w=x<o.read?o.read-x-1:o.end-x),w===0&&(o.write=x,y=o.inflate_flush(d,y),x=o.write,w=x<o.read?o.read-x-1:o.end-x,x==o.end&&o.read!==0&&(x=0,w=x<o.read?o.read-x-1:o.end-x),w===0)))return o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y);y=F,o.win[x++]=a,w--,t=Ne;break;case Xe:if(R>7&&(R-=8,A++,T--),o.write=x,y=o.inflate_flush(d,y),x=o.write,w=x<o.read?o.read-x-1:o.end-x,o.read!=o.write)return o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y);t=Gt;case Gt:return y=ee,o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y);case ve:return y=H,o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y);default:return y=X,o.bitb=p,o.bitk=R,d.avail_in=A,d.total_in+=T-d.next_in_index,d.next_in_index=T,o.write=x,o.inflate_flush(d,y)}},n.free=function(){}}const Zt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],we=0,$e=1,Kt=2,Xt=3,$t=4,Jt=5,Le=6,Fe=7,Qt=8,he=9;function Ar(n,t){const e=this;let s=we,r=0,i=0,a=0,c;const l=[0],_=[0],f=new Rr;let b=0,h=new Int32Array(Mn*3);const S=0,C=new at;e.bitk=0,e.bitb=0,e.win=new Uint8Array(t),e.end=t,e.read=0,e.write=0,e.reset=function(u,o){o&&(o[0]=S),s==Le&&f.free(u),s=we,e.bitk=0,e.bitb=0,e.read=e.write=0},e.reset(n,null),e.inflate_flush=function(u,o){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&&o==te&&(o=F),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&&o==te&&(o=F),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,o},e.proc=function(u,o){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,N,P,k;switch(s){case we:for(;g<3;){if(E!==0)o=F;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,o);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,s=$e;break;case 1:A=[],x=[],w=[[]],O=[[]],at.inflate_trees_fixed(A,x,w,O),f.init(A[0],x[0],w[0],0,O[0],0),y>>>=3,g-=3,s=Le;break;case 2:y>>>=3,g-=3,s=Xt;break;case 3:return y>>>=3,g-=3,s=he,u.msg="invalid block type",o=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,o)}break;case $e:for(;g<32;){if(E!==0)o=F;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,o);E--,y|=(u.read_byte(m++)&255)<<g,g+=8}if((~y>>>16&65535)!=(y&65535))return s=he,u.msg="invalid stored block lengths",o=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,o);r=y&65535,y=g=0,s=r!==0?Kt:b!==0?Fe:we;break;case Kt: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,o=e.inflate_flush(u,o),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,o);if(o=F,d=r,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,(r-=d)!==0)break;s=b!==0?Fe:we;break;case Xt:for(;g<14;){if(E!==0)o=F;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,o);E--,y|=(u.read_byte(m++)&255)<<g,g+=8}if(i=d=y&16383,(d&31)>29||(d>>5&31)>29)return s=he,u.msg="too many length or distance symbols",o=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,o);if(d=258+(d&31)+(d>>5&31),!c||c.length<d)c=[];else for(T=0;T<d;T++)c[T]=0;y>>>=14,g-=14,a=0,s=$t;case $t:for(;a<4+(i>>>10);){for(;g<3;){if(E!==0)o=F;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,o);E--,y|=(u.read_byte(m++)&255)<<g,g+=8}c[Zt[a++]]=y&7,y>>>=3,g-=3}for(;a<19;)c[Zt[a++]]=0;if(l[0]=7,d=C.inflate_trees_bits(c,l,_,h,u),d!=F)return o=d,o==H&&(c=null,s=he),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,o);a=0,s=Jt;case Jt:for(;d=i,!(a>=258+(d&31)+(d>>5&31));){let M,v;for(d=l[0];g<d;){if(E!==0)o=F;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,o);E--,y|=(u.read_byte(m++)&255)<<g,g+=8}if(d=h[(_[0]+(y&$[d]))*3+1],v=h[(_[0]+(y&$[d]))*3+2],v<16)y>>>=d,g-=d,c[a++]=v;else{for(T=v==18?7:v-14,M=v==18?11:3;g<d+T;){if(E!==0)o=F;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,o);E--,y|=(u.read_byte(m++)&255)<<g,g+=8}if(y>>>=d,g-=d,M+=y&$[T],y>>>=T,g-=T,T=a,d=i,T+M>258+(d&31)+(d>>5&31)||v==16&&T<1)return c=null,s=he,u.msg="invalid bit length repeat",o=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,o);v=v==16?c[T-1]:0;do c[T++]=v;while(--M!==0);a=T}}if(_[0]=-1,I=[],N=[],P=[],k=[],I[0]=9,N[0]=6,d=i,d=C.inflate_trees_dynamic(257+(d&31),1+(d>>5&31),c,I,N,P,k,h,u),d!=F)return d==H&&(c=null,s=he),o=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,o);f.init(I[0],N[0],h,P[0],h,k[0]),s=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,(o=f.proc(e,u,o))!=ee)return e.inflate_flush(u,o);if(o=F,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){s=we;break}s=Fe;case Fe:if(e.write=p,o=e.inflate_flush(u,o),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,o);s=Qt;case Qt:return o=ee,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,o);case he:return o=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,o);default:return o=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,o)}}},e.free=function(u){e.reset(u,null),e.win=null,h=null},e.set_dictionary=function(u,o,d){e.win.set(u.subarray(o,o+d),0),e.read=e.write=d},e.sync_point=function(){return s==$e?1:0}}const Cr=32,Ir=8,Or=0,zt=1,en=2,tn=3,nn=4,sn=5,Je=6,xe=7,rn=12,se=13,Pr=[0,0,255,255];function kr(){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=xe,e.istate.blocks.reset(e,null),F)}n.inflateEnd=function(e){return n.blocks&&n.blocks.free(e),n.blocks=null,F},n.inflateInit=function(e,s){return e.msg=null,n.blocks=null,s<8||s>15?(n.inflateEnd(e),X):(n.wbits=s,e.istate.blocks=new Ar(e,1<<s),t(e),F)},n.inflate=function(e,s){let r,i;if(!e||!e.istate||!e.next_in)return X;const a=e.istate;for(s=s==mr?te:F,r=te;;)switch(a.mode){case Or:if(e.avail_in===0)return r;if(r=s,e.avail_in--,e.total_in++,((a.method=e.read_byte(e.next_in_index++))&15)!=Ir){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=zt;case zt:if(e.avail_in===0)return r;if(r=s,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&Cr)===0){a.mode=xe;break}a.mode=en;case en:if(e.avail_in===0)return r;r=s,e.avail_in--,e.total_in++,a.need=(e.read_byte(e.next_in_index++)&255)<<24&4278190080,a.mode=tn;case tn:if(e.avail_in===0)return r;r=s,e.avail_in--,e.total_in++,a.need+=(e.read_byte(e.next_in_index++)&255)<<16&16711680,a.mode=nn;case nn:if(e.avail_in===0)return r;r=s,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?r:(r=s,e.avail_in--,e.total_in++,a.need+=e.read_byte(e.next_in_index++)&255,a.mode=Je,hr);case Je:return a.mode=se,e.msg="need dictionary",a.marker=0,X;case xe:if(r=a.blocks.proc(e,r),r==H){a.mode=se,a.marker=0;break}if(r==F&&(r=s),r!=ee)return r;r=s,a.blocks.reset(e,a.was),a.mode=rn;case rn:return e.avail_in=0,ee;case se:return H;default:return X}},n.inflateSetDictionary=function(e,s,r){let i=0,a=r;if(!e||!e.istate||e.istate.mode!=Je)return X;const c=e.istate;return a>=1<<c.wbits&&(a=(1<<c.wbits)-1,i=r-a),c.blocks.set_dictionary(s,i,a),c.mode=xe,F},n.inflateSync=function(e){let s,r,i,a,c;if(!e||!e.istate)return X;const l=e.istate;if(l.mode!=se&&(l.mode=se,l.marker=0),(s=e.avail_in)===0)return te;for(r=e.next_in_index,i=l.marker;s!==0&&i<4;)e.read_byte(r)==Pr[i]?i++:e.read_byte(r)!==0?i=0:i=4-i,r++,s--;return e.total_in+=r-e.next_in_index,e.next_in_index=r,e.avail_in=s,l.marker=i,i!=4?H:(a=e.total_in,c=e.total_out,t(e),e.total_in=a,e.total_out=c,l.mode=xe,F)},n.inflateSyncPoint=function(e){return!e||!e.istate||!e.istate.blocks?X:e.istate.blocks.sync_point()}}function Wn(){}Wn.prototype={inflateInit(n){const t=this;return t.istate=new kr,n||(n=_r),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 Dr(n){const t=this,e=new Wn,s=n&&n.chunkSize?Math.floor(n.chunkSize*2):128*1024,r=pr,i=new Uint8Array(s);let a=!1;e.inflateInit(),e.next_out=i,t.append=function(c,l){const _=[];let f,b,h=0,S=0,C=0;if(c.length!==0){e.next_in_index=0,e.next_in=c,e.avail_in=c.length;do{if(e.next_out_index=0,e.avail_out=s,e.avail_in===0&&!a&&(e.next_in_index=0,a=!0),f=e.inflate(r),a&&f===te){if(e.avail_in!==0)throw new Error("inflating: bad input")}else if(f!==F&&f!==ee)throw new Error("inflating: "+e.msg);if((a||f===ee)&&e.avail_in===c.length)throw new Error("inflating: bad input");e.next_out_index&&(e.next_out_index===s?_.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 pe=4294967295,ae=65535,Nr=8,vr=0,Lr=99,Fr=67324752,Ur=134695760,an=33639248,Mr=101010256,on=101075792,Wr=117853008,oe=22,Qe=20,ze=56,Hr=1,Br=39169,jr=10,qr=1,Yr=21589,Vr=28789,Gr=25461,Zr=6534,cn=1,Kr=6,ln=8,fn=2048,un=16,dn=16384,_n=73,hn="/",G=void 0,ue="undefined",Oe="function";class pn{constructor(t){return class extends TransformStream{constructor(e,s){const r=new t(s);super({transform(i,a){a.enqueue(r.append(i))},flush(i){const a=r.flush();a&&i.enqueue(a)}})}}}}const Xr=64;let Hn=2;try{typeof navigator!=ue&&navigator.hardwareConcurrency&&(Hn=navigator.hardwareConcurrency)}catch{}const $r={chunkSize:512*1024,maxWorkers:Hn,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,workerScripts:G,CompressionStreamNative:typeof CompressionStream!=ue&&CompressionStream,DecompressionStreamNative:typeof DecompressionStream!=ue&&DecompressionStream},ce=Object.assign({},$r);function Bn(){return ce}function Jr(n){return Math.max(n.chunkSize,Xr)}function jn(n){const{baseURL:t,chunkSize:e,maxWorkers:s,terminateWorkerTimeout:r,useCompressionStream:i,useWebWorkers:a,Deflate:c,Inflate:l,CompressionStream:_,DecompressionStream:f,workerScripts:b}=n;if(re("baseURL",t),re("chunkSize",e),re("maxWorkers",s),re("terminateWorkerTimeout",r),re("useCompressionStream",i),re("useWebWorkers",a),c&&(ce.CompressionStream=new pn(c)),l&&(ce.DecompressionStream=new pn(l)),re("CompressionStream",_),re("DecompressionStream",f),b!==G){const{deflate:h,inflate:S}=b;if((h||S)&&(ce.workerScripts||(ce.workerScripts={})),h){if(!Array.isArray(h))throw new Error("workerScripts.deflate must be an array");ce.workerScripts.deflate=h}if(S){if(!Array.isArray(S))throw new Error("workerScripts.inflate must be an array");ce.workerScripts.inflate=S}}}function re(n,t){t!==G&&(ce[n]=t)}function Qr(){return"application/octet-stream"}const qn=[];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;qn[n]=t}class Be{constructor(t){this.crc=t||-1}append(t){let e=this.crc|0;for(let s=0,r=t.length|0;s<r;s++)e=e>>>8^qn[(e^t[s])&255];this.crc=e}get(){return~this.crc}}class Yn extends TransformStream{constructor(){let t;const e=new Be;super({transform(s,r){e.append(s),r.enqueue(s)},flush(){const s=new Uint8Array(4);new DataView(s.buffer).setUint32(0,e.get()),t.value=s}}),t=this}}function zr(n){if(typeof TextEncoder==ue){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],s=K.getPartial(e);return s===32?n.concat(t):K._shiftRight(t,s,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,s){for(s===void 0&&(s=[]);t>=32;t-=32)s.push(e),e=0;if(t===0)return s.concat(n);for(let a=0;a<n.length;a++)s.push(e|n[a]>>>t),e=n[a]<<32-t;const r=n.length?n[n.length-1]:0,i=K.getPartial(r);return s.push(K.partial(t+i&31,t+i>32?e:s.pop(),1)),s}},je={bytes:{fromBits(n){const e=K.bitLength(n)/8,s=new Uint8Array(e);let r;for(let i=0;i<e;i++)(i&3)===0&&(r=n[i/4]),s[i]=r>>>24,r<<=8;return s},toBits(n){const t=[];let e,s=0;for(e=0;e<n.length;e++)s=s<<8|n[e],(e&3)===3&&(t.push(s),s=0);return e&3&&t.push(K.partial(8*(e&3),s)),t}}},Vn={};Vn.sha1=class{constructor(n){const t=this;t.blockSize=512,t._init=[1732584193,4023233417,2562383102,271733878,3285377520],t._key=[1518500249,1859775393,2400959708,3395469782],n?(t._h=n._h.slice(0),t._buffer=n._buffer.slice(0),t._length=n._length):t.reset()}reset(){const n=this;return n._h=n._init.slice(0),n._buf