UNPKG

playwright-core

Version:

A high-level API to automate web browsers

3 lines 95.2 kB
var $s=Object.defineProperty;var Js=(s,t,e)=>t in s?$s(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var We=(s,t,e)=>Js(s,typeof t!="symbol"?t+"":t,e);class Qs{constructor(t,e){this._snapshotIds=new Map,this._snapshotStorage=t,this._resourceLoader=e}serveSnapshot(t,e,n){const i=this._snapshot(t,e);if(!i)return new Response(null,{status:404});const r=i.render();return this._snapshotIds.set(n,i),new Response(r.html,{status:200,headers:{"Content-Type":"text/html; charset=utf-8"}})}async serveClosestScreenshot(t,e){const n=this._snapshot(t,e),i=n==null?void 0:n.closestScreenshot();return i?new Response(await this._resourceLoader(i)):new Response(null,{status:404})}serveSnapshotInfo(t,e){const n=this._snapshot(t,e);return this._respondWithJson(n?{viewport:n.viewport(),url:n.snapshot().frameUrl,timestamp:n.snapshot().timestamp,wallTime:n.snapshot().wallTime}:{error:"No snapshot found"})}_snapshot(t,e){const n=e.get("name");return this._snapshotStorage.snapshotByName(t,n)}_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,n){let i;const r=this._snapshotIds.get(n);for(const R of t)if(i=r==null?void 0:r.resourceByUrl(zs(R),e),i)break;if(!i)return new Response(null,{status:404});const a=i.response.content._sha1,o=a?await this._resourceLoader(a)||new Blob([]):new Blob([]);let l=i.response.content.mimeType;/^text\/|^application\/(javascript|json)/.test(l)&&!l.includes("charset")&&(l=`${l}; charset=utf-8`);const d=new Headers;l!=="x-unknown"&&d.set("Content-Type",l);for(const{name:R,value:A}of i.response.headers)d.set(R,A);d.delete("Content-Encoding"),d.delete("Access-Control-Allow-Origin"),d.set("Access-Control-Allow-Origin","*"),d.delete("Content-Length"),d.set("Content-Length",String(o.size)),this._snapshotStorage.hasResourceOverride(i.request.url)?d.set("Cache-Control","no-store, no-cache, max-age=0"):d.set("Cache-Control","public, max-age=31536000");const{status:m}=i.response,y=m===101||m===204||m===205||m===304;return new Response(y?null:o,{headers:d,status:i.response.status,statusText:i.response.statusText})}}function zs(s){try{const t=new URL(s);return t.hash="",t.toString()}catch{return s}}function er(s){const t=new Map,{files:e,stacks:n}=s;for(const i of n){const[r,a]=i;t.set(`call@${r}`,a.map(o=>({file:e[o[0]],line:o[1],column:o[2],function:o[3]})))}return t}const Wn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function tr(s){return s.replace(/[&<>"']/ug,t=>Wn[t])}function nr(s){return s.replace(/[&<]/ug,t=>Wn[t])}function Ut(s,t,e){return s.find((n,i)=>{if(i===s.length-1)return!0;const r=s[i+1];return Math.abs(t(n)-e)<Math.abs(t(r)-e)})}function Hn(s){return Array.isArray(s)&&typeof s[0]=="string"}function sr(s){return Array.isArray(s)&&Array.isArray(s[0])}class rr{constructor(t,e,n,i,r){this._htmlCache=t,this._resources=e,this._snapshots=n,this._index=r,this._snapshot=n[r],this._callId=n[r].callId,this._screencastFrames=i,this.snapshotName=n[r].snapshotName}snapshot(){return this._snapshots[this._index]}viewport(){return this._snapshots[this._index].viewport}closestScreenshot(){var i;const{wallTime:t,timestamp:e}=this.snapshot(),n=t&&((i=this._screencastFrames[0])!=null&&i.frameSwapWallTime)?Ut(this._screencastFrames,r=>r.frameSwapWallTime,t):Ut(this._screencastFrames,r=>r.timestamp,e);return n==null?void 0:n.sha1}render(){const t=[],e=(r,a,o,l)=>{if(typeof r=="string"){o==="STYLE"||o==="style"?t.push(dr(lr(r))):t.push(nr(r));return}if(sr(r)){const _=a-r[0][0];if(_>=0&&_<=a){const d=ar(this._snapshots[_]),m=r[0][1];if(m>=0&&m<d.length)return e(d[m],_,o,l)}}else if(Hn(r)){const[_,d,...m]=r,y=_==="NOSCRIPT"?"X-NOSCRIPT":_,R=Object.entries(d||{});t.push("<",y);const A="__playwright_current_src__",f=y==="IFRAME"||y==="FRAME",c=y==="A",u=y==="IMG",b=u&&R.some(w=>w[0]===A),g=y==="SOURCE"&&o==="PICTURE"&&(l==null?void 0:l.some(w=>w[0]===A));for(const[w,S]of R){let h=w;f&&w.toLowerCase()==="src"&&(h="__playwright_src__"),u&&w===A&&(h="src"),["src","srcset"].includes(w.toLowerCase())&&(b||g)&&(h="_"+h);let T=S;!c&&(w.toLowerCase()==="href"||w.toLowerCase()==="src"||w===A)&&(T=ft(S)),t.push(" ",h,'="',tr(T),'"')}t.push(">");for(const w of m)e(w,a,y,R);ir.has(y)||t.push("</",y,">");return}else return},n=this._snapshot;return{html:this._htmlCache.getOrCompute(this,()=>{e(n.html,this._index,void 0,void 0);const a=(n.doctype?`<!DOCTYPE ${n.doctype}>`:"")+["<style>*,*::before,*::after { visibility: hidden }</style>",`<script>${or(this.viewport(),this._callId,this.snapshotName)}<\/script>`].join("")+t.join("");return{value:a,size:a.length}}),pageId:n.pageId,frameId:n.frameId,index:this._index}}resourceByUrl(t,e){const n=this._snapshot;let i,r;for(const o of this._resources){if(typeof o._monotonicTime=="number"&&o._monotonicTime>=n.timestamp)break;o.response.status!==304&&o.request.url===t&&o.request.method===e&&(o._frameref===n.frameId?i=o:r=o)}let a=i??r;if(a&&e.toUpperCase()==="GET"){let o=n.resourceOverrides.find(l=>l.url===t);if(o!=null&&o.ref){const l=this._index-o.ref;l>=0&&l<this._snapshots.length&&(o=this._snapshots[l].resourceOverrides.find(_=>_.url===t))}o!=null&&o.sha1&&(a={...a,response:{...a.response,content:{...a.response.content,_sha1:o.sha1}}})}return a}}const ir=new Set(["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","MENUITEM","META","PARAM","SOURCE","TRACK","WBR"]);function ar(s){if(!s._nodes){const t=[],e=n=>{if(typeof n=="string")t.push(n);else if(Hn(n)){const[,,...i]=n;for(const r of i)e(r);t.push(n)}};e(s.html),s._nodes=t}return s._nodes}function or(s,...t){function e(n,...i){const r=window,a=new URLSearchParams(r.location.search),o=a.has("shouldPopulateCanvasFromScreenshot"),l=a.has("isUnderTest"),_={viewport:n,frames:new WeakMap};r.__playwright_frame_bounding_rects__=_;const d="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.",m=[],y=[],R=[],A=[];let f=r;for(;f!==f.parent&&!f.location.pathname.match(/\/page@[a-z0-9]+$/);)f=f.parent;const c=g=>{for(const w of g.querySelectorAll("[__playwright_scroll_top_]"))m.push(w);for(const w of g.querySelectorAll("[__playwright_scroll_left_]"))y.push(w);for(const w of g.querySelectorAll("[__playwright_value_]")){const S=w;S.type!=="file"&&(S.value=S.getAttribute("__playwright_value_")),w.removeAttribute("__playwright_value_")}for(const w of g.querySelectorAll("[__playwright_checked_]"))w.checked=w.getAttribute("__playwright_checked_")==="true",w.removeAttribute("__playwright_checked_");for(const w of g.querySelectorAll("[__playwright_selected_]"))w.selected=w.getAttribute("__playwright_selected_")==="true",w.removeAttribute("__playwright_selected_");for(const w of g.querySelectorAll("[__playwright_popover_open_]")){try{w.showPopover()}catch{}w.removeAttribute("__playwright_popover_open_")}for(const w of g.querySelectorAll("[__playwright_dialog_open_]")){try{w.getAttribute("__playwright_dialog_open_")==="modal"?w.showModal():w.show()}catch{}w.removeAttribute("__playwright_dialog_open_")}for(const w of i)for(const S of g.querySelectorAll(`[__playwright_target__="${w}"]`)){const h=S.style;h.outline="2px solid #006ab1",h.backgroundColor="#6fa8dc7f",R.push(S)}for(const w of g.querySelectorAll("iframe, frame")){const S=w.getAttribute("__playwright_bounding_rect__");w.removeAttribute("__playwright_bounding_rect__");const h=S?JSON.parse(S):void 0;h&&_.frames.set(w,{boundingRect:h,scrollLeft:0,scrollTop:0});const T=w.getAttribute("__playwright_src__");if(!T)w.setAttribute("src",'data:text/html,<body style="background: #ddd"></body>');else{const E=new URL(r.location.href),O=E.pathname.lastIndexOf("/snapshot/");O!==-1&&(E.pathname=E.pathname.substring(0,O+1)),E.pathname+=T.substring(1),w.setAttribute("src",E.toString())}}{const w=g.querySelector("body[__playwright_custom_elements__]");if(w&&r.customElements){const S=(w.getAttribute("__playwright_custom_elements__")||"").split(",");for(const h of S)r.customElements.define(h,class extends HTMLElement{})}}for(const w of g.querySelectorAll("template[__playwright_shadow_root_]")){const S=w,h=S.parentElement.attachShadow({mode:"open"});h.appendChild(S.content),S.remove(),c(h)}for(const w of g.querySelectorAll("a"))w.addEventListener("click",S=>{S.preventDefault()});if("adoptedStyleSheets"in g){const w=[...g.adoptedStyleSheets];for(const S of g.querySelectorAll("template[__playwright_style_sheet_]")){const h=S,T=new CSSStyleSheet;T.replaceSync(h.getAttribute("__playwright_style_sheet_")),w.push(T)}g.adoptedStyleSheets=w}A.push(...g.querySelectorAll("canvas"))},u=()=>{r.removeEventListener("load",u);for(const S of m)S.scrollTop=+S.getAttribute("__playwright_scroll_top_"),S.removeAttribute("__playwright_scroll_top_"),_.frames.has(S)&&(_.frames.get(S).scrollTop=S.scrollTop);for(const S of y)S.scrollLeft=+S.getAttribute("__playwright_scroll_left_"),S.removeAttribute("__playwright_scroll_left_"),_.frames.has(S)&&(_.frames.get(S).scrollLeft=S.scrollLeft);r.document.styleSheets[0].disabled=!0;const g=new URL(r.location.href).searchParams,w=r===f;if(g.get("pointX")&&g.get("pointY")){const S=+g.get("pointX"),h=+g.get("pointY"),T=g.has("hasInputTarget"),E=R.length>0,O=r.document.documentElement?[r.document.documentElement]:[];for(const x of E?R:O){const p=r.document.createElement("x-pw-pointer");if(p.style.position="fixed",p.style.backgroundColor="#f44336",p.style.width="20px",p.style.height="20px",p.style.borderRadius="10px",p.style.margin="-10px 0 0 -10px",p.style.zIndex="2147483646",p.style.display="flex",p.style.alignItems="center",p.style.justifyContent="center",E){const C=x.getBoundingClientRect(),I=C.left+C.width/2,k=C.top+C.height/2;if(p.style.left=I+"px",p.style.top=k+"px",w&&(Math.abs(I-S)>=10||Math.abs(k-h)>=10)){const N=r.document.createElement("x-pw-pointer-warning");N.textContent="⚠",N.style.fontSize="19px",N.style.color="white",N.style.marginTop="-3.5px",N.style.userSelect="none",p.appendChild(N),p.setAttribute("title",d)}r.document.documentElement.appendChild(p)}else w&&!T&&(p.style.left=S+"px",p.style.top=h+"px",r.document.documentElement.appendChild(p))}}if(A.length>0){let S=function(T,E){function O(){const x=r.document.createElement("canvas");x.width=x.width/Math.floor(x.width/24),x.height=x.height/Math.floor(x.height/24);const p=x.getContext("2d");return p.fillStyle="lightgray",p.fillRect(0,0,x.width,x.height),p.fillStyle="white",p.fillRect(0,0,x.width/2,x.height/2),p.fillRect(x.width/2,x.height/2,x.width,x.height),p.createPattern(x,"repeat")}T.fillStyle=O(),T.fillRect(0,0,E.width,E.height)};const h=new Image;h.onload=()=>{var T;for(const E of A){const O=E.getContext("2d"),x=E.getAttribute("__playwright_bounding_rect__");if(E.removeAttribute("__playwright_bounding_rect__"),!x)continue;let p;try{p=JSON.parse(x)}catch{continue}let C=r;for(;C!==f;){const M=C.frameElement;C=C.parent;const L=(T=C.__playwright_frame_bounding_rects__)==null?void 0:T.frames.get(M);if(!(L!=null&&L.boundingRect))break;const V=L.boundingRect.left-L.scrollLeft,P=L.boundingRect.top-L.scrollTop;p.left+=V,p.top+=P,p.right+=V,p.bottom+=P}const{width:I,height:k}=f.__playwright_frame_bounding_rects__.viewport;p.left=p.left/I,p.top=p.top/k,p.right=p.right/I,p.bottom=p.bottom/k;const N=p.right>1||p.bottom>1;if(p.left>1||p.top>1){E.title="Playwright couldn't capture canvas contents because it's located outside the viewport.";continue}S(O,E),o?(O.drawImage(h,p.left*h.width,p.top*h.height,(p.right-p.left)*h.width,(p.bottom-p.top)*h.height,0,0,E.width,E.height),N?E.title="Playwright couldn't capture full canvas contents because it's located partially outside the viewport.":E.title="Canvas contents are displayed on a best-effort basis based on viewport screenshots taken during test execution."):E.title="Canvas content display is disabled.",l&&console.log("canvas drawn:",JSON.stringify([p.left,p.top,p.right-p.left,p.bottom-p.top].map(M=>Math.floor(M*100))))}},h.onerror=()=>{for(const T of A){const E=T.getContext("2d");S(E,T),T.title="Playwright couldn't show canvas contents because the screenshot failed to load."}},h.src=location.href.replace("/snapshot","/closest-screenshot")}},b=()=>c(r.document);r.addEventListener("load",u),r.addEventListener("DOMContentLoaded",b)}return` (${e.toString()})(${JSON.stringify(s)}${t.map(n=>`, "${n}"`).join("")})`}const Bn=["about:","blob:","data:","file:","ftp:","http:","https:","mailto:","sftp:","ws:","wss:"],Wt="http://playwright.bloburl/#";function ft(s){s.startsWith(Wt)&&(s=s.substring(Wt.length));try{const t=new URL(s);if(t.protocol==="javascript:"||t.protocol==="vbscript:")return"javascript:void(0)";const e=t.protocol==="blob:",n=t.protocol==="file:";if(!e&&!n&&Bn.includes(t.protocol))return s;const i="pw-"+t.protocol.slice(0,t.protocol.length-1);return n||(t.protocol="https:"),t.hostname=t.hostname?`${i}--${t.hostname}`:i,n&&(t.protocol="https:"),t.toString()}catch{return s}}const cr=/url\(['"]?([\w-]+:)\/\//ig;function lr(s){return s.replace(cr,(t,e)=>!(e==="blob:")&&!(e==="file:")&&Bn.includes(e)?t:t.replace(e+"//",`https://pw-${e.slice(0,-1)}--`))}const fr=/url\(\s*'([^']*)'\s*\)/ig,ur=/url\(\s*"([^"]*)"\s*\)/ig;function dr(s){const t=(e,n)=>n.includes("</")?e.replace(n,encodeURI(n)):e;return s.replace(fr,t).replace(ur,t)}class _r{constructor(t){this._maxSize=t,this._map=new Map,this._size=0}getOrCompute(t,e){if(this._map.has(t)){const i=this._map.get(t);return this._map.delete(t),this._map.set(t,i),i.value}const n=e();for(;this._map.size&&this._size+n.size>this._maxSize;){const[i,r]=this._map.entries().next().value;this._size-=r.size,this._map.delete(i)}return this._map.set(t,n),this._size+=n.size,n.value}}class hr{constructor(){this._frameSnapshots=new Map,this._cache=new _r(1e8),this._contextToResources=new Map,this._resourceUrlsWithOverrides=new Set}addResource(t,e){e.request.url=ft(e.request.url),this._ensureResourcesForContext(t).push(e)}addFrameSnapshot(t,e,n){for(const o of e.resourceOverrides)o.url=ft(o.url);let i=this._frameSnapshots.get(e.frameId);i||(i={raw:[],renderers:[]},this._frameSnapshots.set(e.frameId,i),e.isMainFrame&&this._frameSnapshots.set(e.pageId,i)),i.raw.push(e);const r=this._ensureResourcesForContext(t),a=new rr(this._cache,r,i.raw,n,i.raw.length-1);return i.renderers.push(a),a}snapshotByName(t,e){const n=this._frameSnapshots.get(t);return n==null?void 0:n.renderers.find(i=>i.snapshotName===e)}snapshotsForTest(){return[...this._frameSnapshots.keys()]}finalize(){for(const t of this._contextToResources.values())t.sort((e,n)=>(e._monotonicTime||0)-(n._monotonicTime||0));for(const t of this._frameSnapshots.values())for(const e of t.raw)for(const n of e.resourceOverrides)this._resourceUrlsWithOverrides.add(n.url)}hasResourceOverride(t){return this._resourceUrlsWithOverrides.has(t)}_ensureResourcesForContext(t){let e=this._contextToResources.get(t);return e||(e=[],this._contextToResources.set(t,e)),e}}class jn extends Error{constructor(t){super(t),this.name="TraceVersionError"}}const Ht=8;class pr{constructor(t,e){this._actionMap=new Map,this._pageEntries=new Map,this._jsHandles=new Map,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 n of e)this._innerAppendEvent(n)}_innerAppendEvent(t){const e=this._contextEntry;switch(t.type){case"context-options":{if(t.version>Ht)throw new jn("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.playwrightVersion=t.playwrightVersion,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 n=this._actionMap.get(t.callId);n.inputSnapshot=t.inputSnapshot,n.point=t.point;break}case"log":{const n=this._actionMap.get(t.callId);if(!n)return;n.log.push({time:t.time,message:t.message});break}case"after":{const n=this._actionMap.get(t.callId);n.afterSnapshot=t.afterSnapshot,n.endTime=t.endTime,n.result=t.result,n.error=t.error,n.attachments=t.attachments,n.annotations=t.annotations,t.point&&(n.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,n=[t];for(;e<Ht;++e)n=this[`_modernize_${e}_to_${e+1}`].call(this,n);return n}_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 n of t)n.type!=="frame-snapshot"||!n.snapshot.isMainFrame||(n.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 n=e.snapshot;e.snapshot={_frameref:n.frameId,request:{url:n.url,method:n.method,headers:n.requestHeaders,postData:n.requestSha1?{_sha1:n.requestSha1}:void 0},response:{status:n.status,headers:n.responseHeaders,content:{mimeType:n.contentType,_sha1:n.responseSha1}},_monotonicTime:n.timestamp}}return t}_modernize_3_to_4(t){const e=[];for(const n of t){const i=this._modernize_event_3_to_4(n);i&&e.push(i)}return e}_modernize_event_3_to_4(t){var n,i,r,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:(n=e.snapshots.find(o=>o.title==="before"))==null?void 0:n.snapshotName,inputSnapshot:(i=e.snapshots.find(o=>o.title==="input"))==null?void 0:i.snapshotName,afterSnapshot:(r=e.snapshots.find(o=>o.title==="after"))==null?void 0:r.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 n of t){const i=this._modernize_event_4_to_5(n);i&&e.push(i)}return e}_modernize_event_4_to_5(t){var e,n;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 i=(e=t.initializer.args)==null?void 0:e.map(r=>{if(r.guid){const a=this._jsHandles.get(r.guid);return{preview:(a==null?void 0:a.preview)||"",value:""}}return{preview:r.preview||"",value:r.value||""}});return this._consoleObjects.set(t.guid,{type:t.initializer.type,text:t.initializer.text,location:t.initializer.location,args:i}),null}if(t.type==="event"&&t.method==="console"){const i=this._consoleObjects.get(((n=t.params.message)==null?void 0:n.guid)||"");return i?{type:"console",time:t.time,pageId:t.pageId,messageType:i.type,text:i.text,args:i.args,location:i.location}:null}return t}_modernize_5_to_6(t){const e=[];for(const n of t)if(e.push(n),!(n.type!=="after"||!n.log.length))for(const i of n.log)e.push({type:"log",callId:n.callId,message:i,time:-1});return e}_modernize_6_to_7(t){const e=[];if(!this._processedContextCreatedEvent()&&t[0].type!=="context-options"){const n={type:"context-options",origin:"testRunner",version:6,browserName:"",options:{},platform:"unknown",wallTime:0,monotonicTime:0,sdkLanguage:"javascript",contextId:""};e.push(n)}for(const n of t){if(n.type==="context-options"){e.push({...n,monotonicTime:0,origin:"library",contextId:""});continue}if(n.type==="before"||n.type==="action"){this._contextEntry.wallTime||(this._contextEntry.wallTime=n.wallTime);const i=n,r=n;r.stepId=`${i.apiName}@${i.wallTime}`,e.push(r)}else e.push(n)}return e}_modernize_7_to_8(t){const e=[];for(const n of t)if(n.type==="before"||n.type==="action"){const i=n,r=n;i.apiName&&(r.title=i.apiName,delete r.apiName),r.stepId=i.stepId??i.callId,e.push(r)}else e.push(n);return e}}class mr{constructor(){this.contextEntries=[],this._resourceToContentType=new Map}async load(t,e){var o,l;this._backend=t;const n=[];let i=!1;for(const _ of await this._backend.entryNames()){const d=_.match(/(.+)\.trace$/);d&&n.push(d[1]||""),_.includes("src@")&&(i=!0)}if(!n.length)throw new Error("Cannot find .trace file");this._snapshotStorage=new hr;const r=n.length*3;let a=0;for(const _ of n){const d=wr();d.hasSource=i;const m=new pr(d,this._snapshotStorage),y=await this._backend.readText(_+".trace")||"";m.appendTrace(y),e(++a,r);const R=await this._backend.readText(_+".network")||"";if(m.appendTrace(R),e(++a,r),d.actions=m.actions().sort((f,c)=>f.startTime-c.startTime),!t.isLive()){for(const f of d.actions.slice().reverse())if(!f.endTime&&!f.error)for(const c of d.actions)c.parentId===f.callId&&f.endTime<c.endTime&&(f.endTime=c.endTime)}const A=await this._backend.readText(_+".stacks");if(A){const f=er(JSON.parse(A));for(const c of d.actions)c.stack=c.stack||f.get(c.callId)}e(++a,r);for(const f of d.resources)(o=f.request.postData)!=null&&o._sha1&&this._resourceToContentType.set(f.request.postData._sha1,Bt(f.request.postData.mimeType)),(l=f.response.content)!=null&&l._sha1&&this._resourceToContentType.set(f.response.content._sha1,Bt(f.response.content.mimeType));this.contextEntries.push(d)}this._snapshotStorage.finalize()}async hasEntry(t){return this._backend.hasEntry(t)}async resourceForSha1(t){const e=await this._backend.readBlob("resources/"+t),n=this._resourceToContentType.get(t);return!e||n===void 0||n==="x-unknown"?e:new Blob([e],{type:n})}storage(){return this._snapshotStorage}}function Bt(s){const t=s.match(/^(.*);\s*charset=.*$/);return t?t[1]:s}function wr(){return{origin:"testRunner",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:""}}function gr(s,t){const e=new Array(t.length).fill(0);return new Array(t.length).fill(0).map((n,i)=>(r,a)=>{e[i]=r/a*t[i]*1e3,s(e.reduce((o,l)=>o+l,0),1e3)})}const br=15,v=0,ne=1,yr=2,K=-2,H=-3,jt=-4,se=-5,X=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],Gn=1440,Er=0,xr=4,Tr=9,Sr=5,Rr=[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],Ar=[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],Or=[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],Ir=[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],Cr=[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],Nr=[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],ie=15;function ut(){const s=this;let t,e,n,i,r,a;function o(_,d,m,y,R,A,f,c,u,b,g){let w,S,h,T,E,O,x,p,C,I,k,N,D,M,L;I=0,E=m;do n[_[d+I]]++,I++,E--;while(E!==0);if(n[0]==m)return f[0]=-1,c[0]=0,v;for(p=c[0],O=1;O<=ie&&n[O]===0;O++);for(x=O,p<O&&(p=O),E=ie;E!==0&&n[E]===0;E--);for(h=E,p>E&&(p=E),c[0]=p,M=1<<O;O<E;O++,M<<=1)if((M-=n[O])<0)return H;if((M-=n[E])<0)return H;for(n[E]+=M,a[1]=O=0,I=1,D=2;--E!==0;)a[D]=O+=n[I],D++,I++;E=0,I=0;do(O=_[d+I])!==0&&(g[a[O]++]=E),I++;while(++E<m);for(m=a[h],a[0]=E=0,I=0,T=-1,N=-p,r[0]=0,k=0,L=0;x<=h;x++)for(w=n[x];w--!==0;){for(;x>N+p;){if(T++,N+=p,L=h-N,L=L>p?p:L,(S=1<<(O=x-N))>w+1&&(S-=w+1,D=x,O<L))for(;++O<L&&!((S<<=1)<=n[++D]);)S-=n[D];if(L=1<<O,b[0]+L>Gn)return H;r[T]=k=b[0],b[0]+=L,T!==0?(a[T]=E,i[0]=O,i[1]=p,O=E>>>N-p,i[2]=k-r[T-1]-O,u.set(i,(r[T-1]+O)*3)):f[0]=k}for(i[1]=x-N,I>=m?i[0]=192:g[I]<y?(i[0]=g[I]<256?0:96,i[2]=g[I++]):(i[0]=A[g[I]-y]+16+64,i[2]=R[g[I++]-y]),S=1<<x-N,O=E>>>N;O<L;O+=S)u.set(i,(k+O)*3);for(O=1<<x-1;(E&O)!==0;O>>>=1)E^=O;for(E^=O,C=(1<<N)-1;(E&C)!=a[T];)T--,N-=p,C=(1<<N)-1}return M!==0&&h!=1?se:v}function l(_){let d;for(t||(t=[],e=[],n=new Int32Array(ie+1),i=[],r=new Int32Array(ie),a=new Int32Array(ie+1)),e.length<_&&(e=[]),d=0;d<_;d++)e[d]=0;for(d=0;d<ie+1;d++)n[d]=0;for(d=0;d<3;d++)i[d]=0;r.set(n.subarray(0,ie),0),a.set(n.subarray(0,ie+1),0)}s.inflate_trees_bits=function(_,d,m,y,R){let A;return l(19),t[0]=0,A=o(_,0,19,19,null,null,m,d,y,t,e),A==H?R.msg="oversubscribed dynamic bit lengths tree":(A==se||d[0]===0)&&(R.msg="incomplete dynamic bit lengths tree",A=H),A},s.inflate_trees_dynamic=function(_,d,m,y,R,A,f,c,u){let b;return l(288),t[0]=0,b=o(m,0,_,257,Or,Ir,A,y,c,t,e),b!=v||y[0]===0?(b==H?u.msg="oversubscribed literal/length tree":b!=jt&&(u.msg="incomplete literal/length tree",b=H),b):(l(288),b=o(m,_,d,0,Cr,Nr,f,R,c,t,e),b!=v||R[0]===0&&_>257?(b==H?u.msg="oversubscribed distance tree":b==se?(u.msg="incomplete distance tree",b=H):b!=jt&&(u.msg="empty distance tree with lengths",b=H),b):v)}}ut.inflate_trees_fixed=function(s,t,e,n){return s[0]=Tr,t[0]=Sr,e[0]=Rr,n[0]=Ar,v};const He=0,Gt=1,Yt=2,qt=3,Vt=4,Zt=5,Kt=6,et=7,Xt=8,Be=9;function Pr(){const s=this;let t,e=0,n,i=0,r=0,a=0,o=0,l=0,_=0,d=0,m,y=0,R,A=0;function f(c,u,b,g,w,S,h,T){let E,O,x,p,C,I,k,N,D,M,L,V,P,J,F,U;k=T.next_in_index,N=T.avail_in,C=h.bitb,I=h.bitk,D=h.write,M=D<h.read?h.read-D-1:h.end-D,L=X[c],V=X[u];do{for(;I<20;)N--,C|=(T.read_byte(k++)&255)<<I,I+=8;if(E=C&L,O=b,x=g,U=(x+E)*3,(p=O[U])===0){C>>=O[U+1],I-=O[U+1],h.win[D++]=O[U+2],M--;continue}do{if(C>>=O[U+1],I-=O[U+1],(p&16)!==0){for(p&=15,P=O[U+2]+(C&X[p]),C>>=p,I-=p;I<15;)N--,C|=(T.read_byte(k++)&255)<<I,I+=8;E=C&V,O=w,x=S,U=(x+E)*3,p=O[U];do if(C>>=O[U+1],I-=O[U+1],(p&16)!==0){for(p&=15;I<p;)N--,C|=(T.read_byte(k++)&255)<<I,I+=8;if(J=O[U+2]+(C&X[p]),C>>=p,I-=p,M-=P,D>=J)F=D-J,D-F>0&&2>D-F?(h.win[D++]=h.win[F++],h.win[D++]=h.win[F++],P-=2):(h.win.set(h.win.subarray(F,F+2),D),D+=2,F+=2,P-=2);else{F=D-J;do F+=h.end;while(F<0);if(p=h.end-F,P>p){if(P-=p,D-F>0&&p>D-F)do h.win[D++]=h.win[F++];while(--p!==0);else h.win.set(h.win.subarray(F,F+p),D),D+=p,F+=p,p=0;F=0}}if(D-F>0&&P>D-F)do h.win[D++]=h.win[F++];while(--P!==0);else h.win.set(h.win.subarray(F,F+P),D),D+=P,F+=P,P=0;break}else if((p&64)===0)E+=O[U+2],E+=C&X[p],U=(x+E)*3,p=O[U];else return T.msg="invalid distance code",P=T.avail_in-N,P=I>>3<P?I>>3:P,N+=P,k-=P,I-=P<<3,h.bitb=C,h.bitk=I,T.avail_in=N,T.total_in+=k-T.next_in_index,T.next_in_index=k,h.write=D,H;while(!0);break}if((p&64)===0){if(E+=O[U+2],E+=C&X[p],U=(x+E)*3,(p=O[U])===0){C>>=O[U+1],I-=O[U+1],h.win[D++]=O[U+2],M--;break}}else return(p&32)!==0?(P=T.avail_in-N,P=I>>3<P?I>>3:P,N+=P,k-=P,I-=P<<3,h.bitb=C,h.bitk=I,T.avail_in=N,T.total_in+=k-T.next_in_index,T.next_in_index=k,h.write=D,ne):(T.msg="invalid literal/length code",P=T.avail_in-N,P=I>>3<P?I>>3:P,N+=P,k-=P,I-=P<<3,h.bitb=C,h.bitk=I,T.avail_in=N,T.total_in+=k-T.next_in_index,T.next_in_index=k,h.write=D,H)}while(!0)}while(M>=258&&N>=10);return P=T.avail_in-N,P=I>>3<P?I>>3:P,N+=P,k-=P,I-=P<<3,h.bitb=C,h.bitk=I,T.avail_in=N,T.total_in+=k-T.next_in_index,T.next_in_index=k,h.write=D,v}s.init=function(c,u,b,g,w,S){t=He,_=c,d=u,m=b,y=g,R=w,A=S,n=null},s.proc=function(c,u,b){let g,w,S,h=0,T=0,E=0,O,x,p,C;for(E=u.next_in_index,O=u.avail_in,h=c.bitb,T=c.bitk,x=c.write,p=x<c.read?c.read-x-1:c.end-x;;)switch(t){case He:if(p>=258&&O>=10&&(c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,b=f(_,d,m,y,R,A,c,u),E=u.next_in_index,O=u.avail_in,h=c.bitb,T=c.bitk,x=c.write,p=x<c.read?c.read-x-1:c.end-x,b!=v)){t=b==ne?et:Be;break}r=_,n=m,i=y,t=Gt;case Gt:for(g=r;T<g;){if(O!==0)b=v;else return c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b);O--,h|=(u.read_byte(E++)&255)<<T,T+=8}if(w=(i+(h&X[g]))*3,h>>>=n[w+1],T-=n[w+1],S=n[w],S===0){a=n[w+2],t=Kt;break}if((S&16)!==0){o=S&15,e=n[w+2],t=Yt;break}if((S&64)===0){r=S,i=w/3+n[w+2];break}if((S&32)!==0){t=et;break}return t=Be,u.msg="invalid literal/length code",b=H,c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b);case Yt:for(g=o;T<g;){if(O!==0)b=v;else return c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b);O--,h|=(u.read_byte(E++)&255)<<T,T+=8}e+=h&X[g],h>>=g,T-=g,r=d,n=R,i=A,t=qt;case qt:for(g=r;T<g;){if(O!==0)b=v;else return c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b);O--,h|=(u.read_byte(E++)&255)<<T,T+=8}if(w=(i+(h&X[g]))*3,h>>=n[w+1],T-=n[w+1],S=n[w],(S&16)!==0){o=S&15,l=n[w+2],t=Vt;break}if((S&64)===0){r=S,i=w/3+n[w+2];break}return t=Be,u.msg="invalid distance code",b=H,c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b);case Vt:for(g=o;T<g;){if(O!==0)b=v;else return c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b);O--,h|=(u.read_byte(E++)&255)<<T,T+=8}l+=h&X[g],h>>=g,T-=g,t=Zt;case Zt:for(C=x-l;C<0;)C+=c.end;for(;e!==0;){if(p===0&&(x==c.end&&c.read!==0&&(x=0,p=x<c.read?c.read-x-1:c.end-x),p===0&&(c.write=x,b=c.inflate_flush(u,b),x=c.write,p=x<c.read?c.read-x-1:c.end-x,x==c.end&&c.read!==0&&(x=0,p=x<c.read?c.read-x-1:c.end-x),p===0)))return c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b);c.win[x++]=c.win[C++],p--,C==c.end&&(C=0),e--}t=He;break;case Kt:if(p===0&&(x==c.end&&c.read!==0&&(x=0,p=x<c.read?c.read-x-1:c.end-x),p===0&&(c.write=x,b=c.inflate_flush(u,b),x=c.write,p=x<c.read?c.read-x-1:c.end-x,x==c.end&&c.read!==0&&(x=0,p=x<c.read?c.read-x-1:c.end-x),p===0)))return c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b);b=v,c.win[x++]=a,p--,t=He;break;case et:if(T>7&&(T-=8,O++,E--),c.write=x,b=c.inflate_flush(u,b),x=c.write,p=x<c.read?c.read-x-1:c.end-x,c.read!=c.write)return c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b);t=Xt;case Xt:return b=ne,c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b);case Be:return b=H,c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b);default:return b=K,c.bitb=h,c.bitk=T,u.avail_in=O,u.total_in+=E-u.next_in_index,u.next_in_index=E,c.write=x,c.inflate_flush(u,b)}},s.free=function(){}}const $t=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],we=0,tt=1,Jt=2,Qt=3,zt=4,en=5,je=6,Ge=7,tn=8,he=9;function Dr(s,t){const e=this;let n=we,i=0,r=0,a=0,o;const l=[0],_=[0],d=new Pr;let m=0,y=new Int32Array(Gn*3);const R=0,A=new ut;e.bitk=0,e.bitb=0,e.win=new Uint8Array(t),e.end=t,e.read=0,e.write=0,e.reset=function(f,c){c&&(c[0]=R),n==je&&d.free(f),n=we,e.bitk=0,e.bitb=0,e.read=e.write=0},e.reset(s,null),e.inflate_flush=function(f,c){let u,b,g;return b=f.next_out_index,g=e.read,u=(g<=e.write?e.write:e.end)-g,u>f.avail_out&&(u=f.avail_out),u!==0&&c==se&&(c=v),f.avail_out-=u,f.total_out+=u,f.next_out.set(e.win.subarray(g,g+u),b),b+=u,g+=u,g==e.end&&(g=0,e.write==e.end&&(e.write=0),u=e.write-g,u>f.avail_out&&(u=f.avail_out),u!==0&&c==se&&(c=v),f.avail_out-=u,f.total_out+=u,f.next_out.set(e.win.subarray(g,g+u),b),b+=u,g+=u),f.next_out_index=b,e.read=g,c},e.proc=function(f,c){let u,b,g,w,S,h,T,E;for(w=f.next_in_index,S=f.avail_in,b=e.bitb,g=e.bitk,h=e.write,T=h<e.read?e.read-h-1:e.end-h;;){let O,x,p,C,I,k,N,D;switch(n){case we:for(;g<3;){if(S!==0)c=v;else return e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);S--,b|=(f.read_byte(w++)&255)<<g,g+=8}switch(u=b&7,m=u&1,u>>>1){case 0:b>>>=3,g-=3,u=g&7,b>>>=u,g-=u,n=tt;break;case 1:O=[],x=[],p=[[]],C=[[]],ut.inflate_trees_fixed(O,x,p,C),d.init(O[0],x[0],p[0],0,C[0],0),b>>>=3,g-=3,n=je;break;case 2:b>>>=3,g-=3,n=Qt;break;case 3:return b>>>=3,g-=3,n=he,f.msg="invalid block type",c=H,e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c)}break;case tt:for(;g<32;){if(S!==0)c=v;else return e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);S--,b|=(f.read_byte(w++)&255)<<g,g+=8}if((~b>>>16&65535)!=(b&65535))return n=he,f.msg="invalid stored block lengths",c=H,e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);i=b&65535,b=g=0,n=i!==0?Jt:m!==0?Ge:we;break;case Jt:if(S===0||T===0&&(h==e.end&&e.read!==0&&(h=0,T=h<e.read?e.read-h-1:e.end-h),T===0&&(e.write=h,c=e.inflate_flush(f,c),h=e.write,T=h<e.read?e.read-h-1:e.end-h,h==e.end&&e.read!==0&&(h=0,T=h<e.read?e.read-h-1:e.end-h),T===0)))return e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);if(c=v,u=i,u>S&&(u=S),u>T&&(u=T),e.win.set(f.read_buf(w,u),h),w+=u,S-=u,h+=u,T-=u,(i-=u)!==0)break;n=m!==0?Ge:we;break;case Qt:for(;g<14;){if(S!==0)c=v;else return e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);S--,b|=(f.read_byte(w++)&255)<<g,g+=8}if(r=u=b&16383,(u&31)>29||(u>>5&31)>29)return n=he,f.msg="too many length or distance symbols",c=H,e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);if(u=258+(u&31)+(u>>5&31),!o||o.length<u)o=[];else for(E=0;E<u;E++)o[E]=0;b>>>=14,g-=14,a=0,n=zt;case zt:for(;a<4+(r>>>10);){for(;g<3;){if(S!==0)c=v;else return e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);S--,b|=(f.read_byte(w++)&255)<<g,g+=8}o[$t[a++]]=b&7,b>>>=3,g-=3}for(;a<19;)o[$t[a++]]=0;if(l[0]=7,u=A.inflate_trees_bits(o,l,_,y,f),u!=v)return c=u,c==H&&(o=null,n=he),e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);a=0,n=en;case en:for(;u=r,!(a>=258+(u&31)+(u>>5&31));){let M,L;for(u=l[0];g<u;){if(S!==0)c=v;else return e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);S--,b|=(f.read_byte(w++)&255)<<g,g+=8}if(u=y[(_[0]+(b&X[u]))*3+1],L=y[(_[0]+(b&X[u]))*3+2],L<16)b>>>=u,g-=u,o[a++]=L;else{for(E=L==18?7:L-14,M=L==18?11:3;g<u+E;){if(S!==0)c=v;else return e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);S--,b|=(f.read_byte(w++)&255)<<g,g+=8}if(b>>>=u,g-=u,M+=b&X[E],b>>>=E,g-=E,E=a,u=r,E+M>258+(u&31)+(u>>5&31)||L==16&&E<1)return o=null,n=he,f.msg="invalid bit length repeat",c=H,e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);L=L==16?o[E-1]:0;do o[E++]=L;while(--M!==0);a=E}}if(_[0]=-1,I=[],k=[],N=[],D=[],I[0]=9,k[0]=6,u=r,u=A.inflate_trees_dynamic(257+(u&31),1+(u>>5&31),o,I,k,N,D,y,f),u!=v)return u==H&&(o=null,n=he),c=u,e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);d.init(I[0],k[0],y,N[0],y,D[0]),n=je;case je:if(e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,(c=d.proc(e,f,c))!=ne)return e.inflate_flush(f,c);if(c=v,d.free(f),w=f.next_in_index,S=f.avail_in,b=e.bitb,g=e.bitk,h=e.write,T=h<e.read?e.read-h-1:e.end-h,m===0){n=we;break}n=Ge;case Ge:if(e.write=h,c=e.inflate_flush(f,c),h=e.write,T=h<e.read?e.read-h-1:e.end-h,e.read!=e.write)return e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);n=tn;case tn:return c=ne,e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);case he:return c=H,e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c);default:return c=K,e.bitb=b,e.bitk=g,f.avail_in=S,f.total_in+=w-f.next_in_index,f.next_in_index=w,e.write=h,e.inflate_flush(f,c)}}},e.free=function(f){e.reset(f,null),e.win=null,y=null},e.set_dictionary=function(f,c,u){e.win.set(f.subarray(c,c+u),0),e.read=e.write=u},e.sync_point=function(){return n==tt?1:0}}const kr=32,Lr=8,vr=0,nn=1,sn=2,rn=3,an=4,on=5,nt=6,Se=7,cn=12,ae=13,Fr=[0,0,255,255];function Mr(){const s=this;s.mode=0,s.method=0,s.was=[0],s.need=0,s.marker=0,s.wbits=0;function t(e){return!e||!e.istate?K:(e.total_in=e.total_out=0,e.msg=null,e.istate.mode=Se,e.istate.blocks.reset(e,null),v)}s.inflateEnd=function(e){return s.blocks&&s.blocks.free(e),s.blocks=null,v},s.inflateInit=function(e,n){return e.msg=null,s.blocks=null,n<8||n>15?(s.inflateEnd(e),K):(s.wbits=n,e.istate.blocks=new Dr(e,1<<n),t(e),v)},s.inflate=function(e,n){let i,r;if(!e||!e.istate||!e.next_in)return K;const a=e.istate;for(n=n==xr?se:v,i=se;;)switch(a.mode){case vr:if(e.avail_in===0)return i;if(i=n,e.avail_in--,e.total_in++,((a.method=e.read_byte(e.next_in_index++))&15)!=Lr){a.mode=ae,e.msg="unknown compression method",a.marker=5;break}if((a.method>>4)+8>a.wbits){a.mode=ae,e.msg="invalid win size",a.marker=5;break}a.mode=nn;case nn:if(e.avail_in===0)return i;if(i=n,e.avail_in--,e.total_in++,r=e.read_byte(e.next_in_index++)&255,((a.method<<8)+r)%31!==0){a.mode=ae,e.msg="incorrect header check",a.marker=5;break}if((r&kr)===0){a.mode=Se;break}a.mode=sn;case sn:if(e.avail_in===0)return i;i=n,e.avail_in--,e.total_in++,a.need=(e.read_byte(e.next_in_index++)&255)<<24&4278190080,a.mode=rn;case rn:if(e.avail_in===0)return i;i=n,e.avail_in--,e.total_in++,a.need+=(e.read_byte(e.next_in_index++)&255)<<16&16711680,a.mode=an;case an:if(e.avail_in===0)return i;i=n,e.avail_in--,e.total_in++,a.need+=(e.read_byte(e.next_in_index++)&255)<<8&65280,a.mode=on;case on:return e.avail_in===0?i:(i=n,e.avail_in--,e.total_in++,a.need+=e.read_byte(e.next_in_index++)&255,a.mode=nt,yr);case nt:return a.mode=ae,e.msg="need dictionary",a.marker=0,K;case Se:if(i=a.blocks.proc(e,i),i==H){a.mode=ae,a.marker=0;break}if(i==v&&(i=n),i!=ne)return i;i=n,a.blocks.reset(e,a.was),a.mode=cn;case cn:return e.avail_in=0,ne;case ae:return H;default:return K}},s.inflateSetDictionary=function(e,n,i){let r=0,a=i;if(!e||!e.istate||e.istate.mode!=nt)return K;const o=e.istate;return a>=1<<o.wbits&&(a=(1<<o.wbits)-1,r=i-a),o.blocks.set_dictionary(n,r,a),o.mode=Se,v},s.inflateSync=function(e){let n,i,r,a,o;if(!e||!e.istate)return K;const l=e.istate;if(l.mode!=ae&&(l.mode=ae,l.marker=0),(n=e.avail_in)===0)return se;for(i=e.next_in_index,r=l.marker;n!==0&&r<4;)e.read_byte(i)==Fr[r]?r++:e.read_byte(i)!==0?r=0:r=4-r,i++,n--;return e.total_in+=i-e.next_in_index,e.next_in_index=i,e.avail_in=n,l.marker=r,r!=4?H:(a=e.total_in,o=e.total_out,t(e),e.total_in=a,e.total_out=o,l.mode=Se,v)},s.inflateSyncPoint=function(e){return!e||!e.istate||!e.istate.blocks?K:e.istate.blocks.sync_point()}}function Yn(){}Yn.prototype={inflateInit(s){const t=this;return t.istate=new Mr,s||(s=br),t.istate.inflateInit(t,s)},inflate(s){const t=this;return t.istate?t.istate.inflate(t,s):K},inflateEnd(){const s=this;if(!s.istate)return K;const t=s.istate.inflateEnd(s);return s.istate=null,t},inflateSync(){const s=this;return s.istate?s.istate.inflateSync(s):K},inflateSetDictionary(s,t){const e=this;return e.istate?e.istate.inflateSetDictionary(e,s,t):K},read_byte(s){return this.next_in[s]},read_buf(s,t){return this.next_in.subarray(s,s+t)}};function Ur(s){const t=this,e=new Yn,n=s&&s.chunkSize?Math.floor(s.chunkSize*2):128*1024,i=Er,r=new Uint8Array(n);let a=!1;e.inflateInit(),e.next_out=r,t.append=function(o,l){const _=[];let d,m,y=0,R=0,A=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=n,e.avail_in===0&&!a&&(e.next_in_index=0,a=!0),d=e.inflate(i),a&&d===se){if(e.avail_in!==0)throw new Error("inflating: bad input")}else if(d!==v&&d!==ne)throw new Error("inflating: "+e.msg);if((a||d===ne)&&e.avail_in===o.length)throw new Error("inflating: bad input");e.next_out_index&&(e.next_out_index===n?_.push(new Uint8Array(r)):_.push(r.subarray(0,e.next_out_index))),A+=e.next_out_index,l&&e.next_in_index>0&&e.next_in_index!=y&&(l(e.next_in_index),y=e.next_in_index)}while(e.avail_in>0||e.avail_out===0);return _.length>1?(m=new Uint8Array(A),_.forEach(function(f){m.set(f,R),R+=f.length})):m=_[0]?new Uint8Array(_[0]):new Uint8Array,m}},t.flush=function(){e.inflateEnd()}}const pe=4294967295,le=65535,Wr=8,Hr=0,Br=99,jr=67324752,qn=134695760,Gr=qn,ln=33639248,Yr=101010256,fn=101075792,qr=117853008,te=22,st=20,rt=56,Vr=12,Zr=20,un=4,Kr=1,Xr=39169,$r=10,Jr=1,Qr=21589,zr=28789,ei=25461,ti=6534,dn=1,ni=6,_n=8,hn=2048,pn=16,si=61440,ri=16384,ii=73,mn="/",it=30,ai=10,oi=14,ci=18,j=void 0,de="undefined",De="function";class wn{constructor(t){return class extends TransformStream{constructor(e,n){const i=new t(n);super({transform(r,a){a.enqueue(i.append(r))},flush(r){const a=i.flush();a&&r.enqueue(a)}})}}}}const li=64;let Vn=2;try{typeof navigator!=de&&navigator.hardwareConcurrency&&(Vn=navigator.hardwareConcurrency)}catch{}const fi={chunkSize:512*1024,maxWorkers:Vn,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,workerScripts:j,CompressionStreamNative:typeof CompressionStream!=de&&CompressionStream,DecompressionStreamNative:typeof DecompressionStream!=de&&DecompressionStream},fe=Object.assign({},fi);function Zn(){return fe}function ui(s){return Math.max(s.chunkSize,li)}function Kn(s){const{baseURL:t,chunkSize:e,maxWorkers:n,terminateWorkerTimeout:i,useCompressionStream:r,useWebWorkers:a,Deflate:o,Inflate:l,CompressionStream:_,DecompressionStream:d,workerScripts:m}=s;if(oe("baseURL",t),oe("chunkSize",e),oe("maxWorkers",n),oe("terminateWorkerTimeout",i),oe("useCompressionStream",r),oe("useWebWorkers",a),o&&(fe.CompressionStream=new wn(o)),l&&(fe.DecompressionStream=new wn(l)),oe("CompressionStream",_),oe("DecompressionStream",d),m!==j){const{deflate:y,inflate:R}=m;if((y||R)&&(fe.workerScripts||(fe.workerScripts={})),y){if(!Array.isArray(y))throw new Error("workerScripts.deflate must be an array");fe.workerScripts.deflate=y}if(R){if(!Array.isArray(R))throw new Error("workerScripts.inflate must be an array");fe.workerScripts.inflate=R}}}function oe(s,t){t!==j&&(fe[s]=t)}function di(){return"application/octet-stream"}const Xn=[];for(let s=0;s<256;s++){let t=s;for(let e=0;e<8;e++)t&1?t=t>>>1^3988292384:t=t>>>1;Xn[s]=t}class Ze{constructor(t){this.crc=t||-1}append(t){let e=this.crc|0;for(let n=0,i=t.length|0;n<i;n++)e=e>>>8^Xn[(e^t[n])&255];this.crc=e}get(){return~this.crc}}class $n extends TransformStream{constructor(){let t;const e=new Ze;super({transform(n,i){e.append(n),i.enqueue(n)},flush(){const n=new Uint8Array(4);new DataView(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}function _i(s){if(typeof TextEncoder==de){s=unescape(encodeURIComponent(s));const t=new Uint8Array(s.length);for(let e=0;e<t.length;e++)t[e]=s.charCodeAt(e);return t}else return new TextEncoder().encode(s)}const Z={concat(s,t){if(s.length===0||t.length===0)return s.concat(t);const e=s[s.length-1],n=Z.getPartial(e);return n===32?s.concat(t):Z._shiftRight(t,n,e|0,s.slice(0,s.length-1))},bitLength(s){const t=s.length;if(t===0)return 0;const e=s[t-1];return(t-1)*32+Z.getPartial(e)},clamp(s,t){if(s.length*32<t)return s;s=s.slice(0,Math.ceil(t/32));const e=s.length;return t=t&31,e>0&&t&&(s[e-1]=Z.partial(t,s[e-1]&2147483648>>t-1,1)),s},partial(s,t,e){return s===32?t:(e?t|0:t<<32-s)+s*1099511627776},getPartial(s){return Math.round(s/1099511627776)||32},_shiftRight(s,t,e,n){for(n===void 0&&(n=[]);t>=32;t-=32)n.push(e),e=0;if(t===0)return n.concat(s);for(let a=0;a<s.length;a++)n.push(e|s[a]>>>t),e=s[a]<<32-t;const i=s.length?s[s.length-1]:0,r=Z.getPartial(i);return n.push(Z.partial(t+r&31,t+r>32?e:n.pop(),1)),n}},Ke={bytes:{fromBits(s){const e=Z.bitLength(s)/8,n=new Uint8Array(e);let i;for(let r=0;r<e;r++)(r&3)===0&&(i=s[r/4]),n[r]=i>>>24,i<<=8;return n},toBits(s){const t=[];let e,n=0;for(e=0;e<s.length;e++)n=n<<8|s[e],(e&3)===3&&(t.push(n),n=0);return e&3&&t.push(Z.partial(8*(e&3),n)),t}}},Jn={};Jn.sha1=class{constructor(s){const t=this;t.blockSize=512,t._init=[1732584193,4023233417,2562383102,271733878,3285377520],t._key=[1518500249,1859775393,2400959708,3395469782],s?(t._h=s._h.slice(0),t._buffer=s._buffer.slice(0),t._length=s._length):t.reset()}reset(){const s=this;return s._h=s._