playwright-core
Version:
A high-level API to automate web browsers
4 lines • 96.7 kB
JavaScript
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(e){let t;for(let n of Object.keys(e)){let r=e[n];r&&(t||={},t[n]=r,e[n]=0)}return t}function r(e){let t;for(let n of Object.keys(e)){let r=e[n];r.some(Boolean)&&(t||={},t[n]=r.slice(),r.fill(0))}return t}var i=class{constructor(e,t){this._snapshotIds=new Map,this._snapshotStorage=e,this._resourceLoader=t}serveSnapshot(e,t,n){let r=this._snapshot(e,t);if(!r)return new Response(null,{status:404});let i=r.render();return this._snapshotIds.set(n,r),new Response(i.html,{status:200,headers:{"Content-Type":`text/html; charset=utf-8`,"Content-Security-Policy":`script-src 'nonce-${i.scriptNonce}'; object-src 'none'`}})}async serveClosestScreenshot(e,t){let n=this._snapshot(e,t)?.closestScreenshot();return n?new Response(await this._resourceLoader(n)):new Response(null,{status:404})}serveSnapshotInfo(e,t){let n=this._snapshot(e,t);return this._respondWithJson(n?{viewport:n.viewport(),url:n.snapshot().frameUrl,timestamp:n.snapshot().timestamp,wallTime:n.snapshot().wallTime}:{error:`No snapshot found`})}_snapshot(e,t){return this._snapshotStorage.snapshotForCall(e,t.get(`phase`),t.get(`frameId`)||void 0)}_respondWithJson(e){return new Response(JSON.stringify(e),{status:200,headers:{"Cache-Control":`public, max-age=31536000`,"Content-Type":`application/json`}})}async serveResource(e,t,n){let r,i=this._snapshotIds.get(n);for(let n of e)if(r=i?.resourceByUrl(a(n),t),r)break;if(!r)return new Response(null,{status:404});let o=r.response.content._file,s=o&&await this._resourceLoader(o)||new Blob([]),c=r.response.content.mimeType;/^text\/|^application\/(javascript|json)/.test(c)&&!c.includes(`charset`)&&(c=`${c}; charset=utf-8`);let l=new Headers;c!==`x-unknown`&&l.set(`Content-Type`,c);for(let{name:e,value:t}of r.response.headers)l.set(e,t);l.delete(`Content-Encoding`),l.delete(`Access-Control-Allow-Origin`),l.set(`Access-Control-Allow-Origin`,`*`),l.delete(`Content-Length`),l.set(`Content-Length`,String(s.size)),this._snapshotStorage.hasResourceOverride(r.request.url)?l.set(`Cache-Control`,`no-store, no-cache, max-age=0`):l.set(`Cache-Control`,`public, max-age=31536000`);let{status:u}=r.response;return new Response(u===101||u===204||u===205||u===304?null:s,{headers:l,status:r.response.status,statusText:r.response.statusText})}};function a(e){try{let t=new URL(e);return t.hash=``,t.toString()}catch{return e}}var o={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function s(e){return e.replace(/[&<>"']/gu,e=>o[e])}function c(e){return e.replace(/[&<]/gu,e=>o[e])}function l(e,t,n){return e.find((r,i)=>{if(i===e.length-1)return!0;let a=e[i+1];return Math.abs(t(r)-n)<Math.abs(t(a)-n)})}function u(e){return Array.isArray(e)&&typeof e[0]==`string`}function d(e){return Array.isArray(e)&&Array.isArray(e[0])}var f=class{constructor(e,t,n,r,i){this._htmlCache=e,this._resources=t,this._snapshots=n,this._index=i,this._snapshot=n[i],this._callId=n[i].callId,this._screencastFrames=r,this.snapshotName=n[i].snapshotName}snapshot(){return this._snapshots[this._index]}viewport(){return this._snapshots[this._index].viewport}closestScreenshot(){let{wallTime:e,timestamp:t}=this.snapshot();return(e&&this._screencastFrames[0]?.frameSwapWallTime?l(this._screencastFrames,e=>e.frameSwapWallTime,e):l(this._screencastFrames,e=>e.timestamp,t))?.file}render(){let e=[],t=(n,r,i,a)=>{if(typeof n==`string`){e.push(c(n));return}if(d(n)){let e=r-n[0][0];if(e>=0&&e<=r){let r=h(this._snapshots[e]),o=n[0][1];if(o>=0&&o<r.length)return t(r[o],e,i,a)}}else if(u(n)){let[o,c,...l]=n;if(o.toUpperCase()===`SCRIPT`||/[\s=<>\/]/.test(o))return;let u=o.toUpperCase(),d=u===`NOSCRIPT`?`X-NOSCRIPT`:o,f=Object.entries(c||{});e.push(`<`,d);let h=`__playwright_current_src__`,g=u===`IFRAME`||u===`FRAME`,_=u===`A`,v=u===`IMG`,y=u===`META`,x=v&&f.some(e=>e[0]===h),C=u===`SOURCE`&&i===`PICTURE`&&a?.some(e=>e[0]===h),w=y&&f.some(e=>e[0].toLowerCase()===`http-equiv`&&!m.has(e[1].trim().toLowerCase()));for(let[t,n]of f){let r=t;if(t.toLowerCase().startsWith(`on`))continue;g&&t.toLowerCase()===`src`&&(r=`__playwright_src__`),g&&(t.toLowerCase()===`srcdoc`||t.toLowerCase()===`sandbox`)&&(r=`__playwright_`+t.toLowerCase()+`__`),u===`OBJECT`&&t.toLowerCase()===`data`&&(r=`__playwright_data__`),u===`EMBED`&&t.toLowerCase()===`src`&&(r=`__playwright_src__`),v&&t===h&&(r=`src`),[`src`,`srcset`].includes(t.toLowerCase())&&(x||C)&&(r=`_`+r),w&&(t.toLowerCase()===`http-equiv`||t.toLowerCase()===`content`)&&(r=`_`+t);let i=n;!_&&(t.toLowerCase()===`href`||t.toLowerCase()===`src`||t===h)&&(i=b(n)),e.push(` `,r,`="`,s(i),`"`)}if(u===`STYLE`){let t=typeof l[0]==`string`?l[0]:``;e.push(` `,`__playwright_style_content__`,`="`,s(S(t)),`"`),e.push(`></`,d,`>`);return}e.push(`>`);for(let e of l)t(e,r,d,f);p.has(d)||e.push(`</`,d,`>`);return}else return},n=this._snapshot,{html:r,scriptNonce:i}=this._htmlCache.getOrCompute(this,()=>{t(n.html,this._index,void 0,void 0);let r=n.doctype?.replace(/[^a-zA-Z0-9]/g,``),i=r?`<!DOCTYPE ${r}>`:``,a=g(),o=i+[`<style>*,*::before,*::after { visibility: hidden }</style>`,`<script nonce="${a}">${_(this.viewport(),this._callId,this.snapshotName)}<\/script>`].join(``)+e.join(``);return{value:{html:o,scriptNonce:a},size:o.length}});return{html:r,scriptNonce:i,pageId:n.pageId,frameId:n.frameId,index:this._index}}resourceByUrl(e,t){let n=this._snapshot,r,i;for(let a of this._resources){if(typeof a._monotonicTime==`number`&&a._monotonicTime>=n.timestamp)break;a.response.status!==304&&a.request.url===e&&a.request.method===t&&(a._frameref===n.frameId?r=a:i=a)}let a=r??i;if(a&&t.toUpperCase()===`GET`){let t=n.resourceOverrides.find(t=>t.url===e);if(t?.ref){let n=this._index-t.ref;n>=0&&n<this._snapshots.length&&(t=this._snapshots[n].resourceOverrides.find(t=>t.url===e))}t?.file&&(a={...a,response:{...a.response,content:{...a.response.content,_file:t.file}}})}return a}},p=new Set([`AREA`,`BASE`,`BR`,`COL`,`COMMAND`,`EMBED`,`HR`,`IMG`,`INPUT`,`KEYGEN`,`LINK`,`MENUITEM`,`META`,`PARAM`,`SOURCE`,`TRACK`,`WBR`]),m=new Set([`content-type`,`content-language`,`default-style`,`x-ua-compatible`]);function h(e){if(!e._nodes){let t=[],n=e=>{if(typeof e==`string`)t.push(e);else if(u(e)){let[,,...r]=e;for(let e of r)n(e);t.push(e)}};n(e.html),e._nodes=t}return e._nodes}function g(){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function _(e,...t){function n(e,t,...n){let r=window,i=new URLSearchParams(r.location.search),a=i.has(`shouldPopulateCanvasFromScreenshot`),o=i.has(`isUnderTest`),s={viewport:t,frames:new WeakMap};r.__playwright_frame_bounding_rects__=s;let c=[],l=[],u=[],d=[],f=r;for(;f!==f.parent&&new URLSearchParams(f.location.search).has(`frameId`);)f=f.parent;let p=t=>{for(let e of t.querySelectorAll(`[__playwright_scroll_top_]`))c.push(e);for(let e of t.querySelectorAll(`[__playwright_scroll_left_]`))l.push(e);for(let e of t.querySelectorAll(`style[__playwright_style_content__]`))e.textContent=e.getAttribute(`__playwright_style_content__`),e.removeAttribute(`__playwright_style_content__`);for(let e of t.querySelectorAll(`[__playwright_value_]`)){let t=e;t.type!==`file`&&(t.value=t.getAttribute(`__playwright_value_`)),e.removeAttribute(`__playwright_value_`)}for(let e of t.querySelectorAll(`[__playwright_checked_]`))e.checked=e.getAttribute(`__playwright_checked_`)===`true`,e.removeAttribute(`__playwright_checked_`);for(let e of t.querySelectorAll(`[__playwright_selected_]`))e.selected=e.getAttribute(`__playwright_selected_`)===`true`,e.removeAttribute(`__playwright_selected_`);for(let e of t.querySelectorAll(`[__playwright_popover_open_]`)){try{e.showPopover()}catch{}e.removeAttribute(`__playwright_popover_open_`)}for(let e of t.querySelectorAll(`[__playwright_dialog_open_]`)){try{e.getAttribute(`__playwright_dialog_open_`)===`modal`?e.showModal():e.show()}catch{}e.removeAttribute(`__playwright_dialog_open_`)}let i=e=>{let t=e.style;t.outline=`2px solid #006ab1`,t.backgroundColor=`#6fa8dc7f`,u.push(e)};for(let e of t.querySelectorAll(`[__playwright_target__=""]`))i(e);for(let e of n)if(e)for(let n of t.querySelectorAll(`[__playwright_target__="${e}"]`))i(n);for(let n of t.querySelectorAll(`iframe, frame`)){let t=n.getAttribute(`__playwright_bounding_rect__`);n.removeAttribute(`__playwright_bounding_rect__`);let i=t?JSON.parse(t):void 0;i&&s.frames.set(n,{boundingRect:i,scrollLeft:0,scrollTop:0});let a=n.getAttribute(`__playwright_src__`);if(!a)n.setAttribute(`src`,e);else{let e=a.substring(a.lastIndexOf(`/`)+1),t=new URL(r.location.href);t.searchParams.set(`frameId`,e),n.setAttribute(`src`,t.toString())}}{let e=t.querySelector(`body[__playwright_custom_elements__]`);if(e&&r.customElements){let t=(e.getAttribute(`__playwright_custom_elements__`)||``).split(`,`);for(let e of t)r.customElements.define(e,class extends HTMLElement{})}}for(let e of t.querySelectorAll(`template[__playwright_shadow_root_]`)){let t=e,n=t.parentElement.attachShadow({mode:`open`});n.appendChild(t.content),t.remove(),p(n)}for(let e of t.querySelectorAll(`a`))e.addEventListener(`click`,e=>{e.preventDefault()});if(`adoptedStyleSheets`in t){let e=[...t.adoptedStyleSheets];for(let n of t.querySelectorAll(`template[__playwright_style_sheet_]`)){let t=n,r=new CSSStyleSheet;r.replaceSync(t.getAttribute(`__playwright_style_sheet_`)),e.push(r)}t.adoptedStyleSheets=e}d.push(...t.querySelectorAll(`canvas`))},m=()=>{r.removeEventListener(`load`,m);for(let e of c)e.scrollTop=+e.getAttribute(`__playwright_scroll_top_`),e.removeAttribute(`__playwright_scroll_top_`),s.frames.has(e)&&(s.frames.get(e).scrollTop=e.scrollTop);for(let e of l)e.scrollLeft=+e.getAttribute(`__playwright_scroll_left_`),e.removeAttribute(`__playwright_scroll_left_`),s.frames.has(e)&&(s.frames.get(e).scrollLeft=e.scrollLeft);r.document.styleSheets[0].disabled=!0;let e=new URL(r.location.href).searchParams;if(r===f&&e.get(`pointX`)&&e.get(`pointY`)){let t=+e.get(`pointX`),n=+e.get(`pointY`),i=r.document.createElement(`x-pw-pointer`);i.style.position=`fixed`,i.style.backgroundColor=`#f44336`,i.style.width=`20px`,i.style.height=`20px`,i.style.borderRadius=`10px`,i.style.margin=`-10px 0 0 -10px`,i.style.zIndex=`2147483646`,i.style.display=`flex`,i.style.alignItems=`center`,i.style.justifyContent=`center`;let a=u[0],o=a?.getBoundingClientRect(),s=a?{x:o.left+o.width/2,y:o.top+o.height/2}:null;if(i.style.left=(s?.x??t)+`px`,i.style.top=(s?.y??n)+`px`,!(!s||Math.abs(s.x-t)<=10&&Math.abs(s.y-n)<=10)){let e=r.document.createElement(`x-pw-pointer-warning`);e.textContent=`⚠`,e.style.fontSize=`19px`,e.style.color=`white`,e.style.marginTop=`-3.5px`,e.style.userSelect=`none`,i.appendChild(e),i.setAttribute(`title`,`Recorded click position in absolute coordinates did not match the center of the clicked element. This is either due to the use of provided offset, or due to a difference between the test runner and the trace viewer operating systems.`)}r.document.documentElement.appendChild(i)}if(d.length>0){function e(e,t){function n(){let e=r.document.createElement(`canvas`);e.width/=Math.floor(e.width/24),e.height/=Math.floor(e.height/24);let t=e.getContext(`2d`);return t.fillStyle=`lightgray`,t.fillRect(0,0,e.width,e.height),t.fillStyle=`white`,t.fillRect(0,0,e.width/2,e.height/2),t.fillRect(e.width/2,e.height/2,e.width,e.height),t.createPattern(e,`repeat`)}e.fillStyle=n(),e.fillRect(0,0,t.width,t.height)}let t=new Image;t.onload=()=>{for(let n of d){let i=n.getContext(`2d`),s=n.getAttribute(`__playwright_bounding_rect__`);if(n.removeAttribute(`__playwright_bounding_rect__`),!s)continue;let c;try{c=JSON.parse(s)}catch{continue}let l=r;for(;l!==f;){let e=l.frameElement;l=l.parent;let t=l.__playwright_frame_bounding_rects__?.frames.get(e);if(!t?.boundingRect)break;let n=t.boundingRect.left-t.scrollLeft,r=t.boundingRect.top-t.scrollTop;c.left+=n,c.top+=r,c.right+=n,c.bottom+=r}let{width:u,height:d}=f.__playwright_frame_bounding_rects__.viewport;c.left/=u,c.top/=d,c.right/=u,c.bottom/=d;let p=c.right>1||c.bottom>1;if(c.left>1||c.top>1){n.title=`Playwright couldn't capture canvas contents because it's located outside the viewport.`;continue}e(i,n),a?(i.drawImage(t,c.left*t.width,c.top*t.height,(c.right-c.left)*t.width,(c.bottom-c.top)*t.height,0,0,n.width,n.height),p?n.title=`Playwright couldn't capture full canvas contents because it's located partially outside the viewport.`:n.title=`Canvas contents are displayed on a best-effort basis based on viewport screenshots taken during test execution.`):n.title=`Canvas content display is disabled.`,o&&console.log(`canvas drawn:`,JSON.stringify([c.left,c.top,c.right-c.left,c.bottom-c.top].map(e=>Math.floor(e*100))))}},t.onerror=()=>{for(let t of d)e(t.getContext(`2d`),t),t.title=`Playwright couldn't show canvas contents because the screenshot failed to load.`},t.src=location.href.replace(`/snapshot`,`/closest-screenshot`)}};r.addEventListener(`load`,m),r.addEventListener(`DOMContentLoaded`,()=>p(r.document))}let r=e=>JSON.stringify(e).replace(/</g,`\\u003c`);return`\n(${n.toString()})(${r(C)},${r(e)}${t.map(e=>`, ${r(String(e))}`).join(``)})`}var v=[`about:`,`blob:`,`data:`,`file:`,`ftp:`,`http:`,`https:`,`mailto:`,`sftp:`,`ws:`,`wss:`],y=`http://playwright.bloburl/#`;function b(e){e.startsWith(y)&&(e=e.substring(27));try{let t=new URL(e);if(t.protocol===`javascript:`||t.protocol===`vbscript:`)return`javascript:void(0)`;let n=t.protocol===`blob:`,r=t.protocol===`file:`;if(!n&&!r&&v.includes(t.protocol))return e;let i=`pw-`+t.protocol.slice(0,t.protocol.length-1);return r||(t.protocol=`https:`),t.hostname=t.hostname?`${i}--${t.hostname}`:i,r&&(t.protocol=`https:`),t.toString()}catch{return e}}var x=/url\(['"]?([\w-]+:)\/\//gi;function S(e){return e.replace(x,(e,t)=>t!==`blob:`&&t!==`file:`&&v.includes(t)?e:e.replace(t+`//`,`https://pw-${t.slice(0,-1)}--`))}var C=`data:text/html;base64,`+btoa(`<body></body><style>body { color-scheme: light dark; background: light-dark(white, #333) }</style>`),w=class{constructor(e){this._maxSize=e,this._map=new Map,this._size=0}getOrCompute(e,t){if(this._map.has(e)){let t=this._map.get(e);return this._map.delete(e),this._map.set(e,t),t.value}let n=t();for(;this._map.size&&this._size+n.size>this._maxSize;){let[e,t]=this._map.entries().next().value;this._size-=t.size,this._map.delete(e)}return this._map.set(e,n),this._size+=n.size,n.value}},T=class{constructor(){this._snapshotsByFrameId=new Map,this._renderersByCallIdAndPhase=new Map,this._cache=new w(1e8),this._resources=[],this._resourceUrlsWithOverrides=new Set}addResource(e){e.request.url=b(e.request.url),this._resources.push(e)}addFrameSnapshot(e,t){for(let t of e.resourceOverrides)t.url=b(t.url);let n=this._snapshotsByFrameId.get(e.frameId);n||(n=[],this._snapshotsByFrameId.set(e.frameId,n)),n.push(e);let r=new f(this._cache,this._resources,n,t,n.length-1);if(e.phase){let t=E(e.callId,e.phase),n=this._renderersByCallIdAndPhase.get(t);n||(n=[],this._renderersByCallIdAndPhase.set(t,n)),n.push(r)}return r}snapshotForCall(e,t,n){return(this._renderersByCallIdAndPhase.get(E(e,t))||[]).find(e=>n?e.snapshot().frameId===n:e.snapshot().isMainFrame)}snapshotsForTest(){return[...this._renderersByCallIdAndPhase.keys()]}finalize(){this._resources.sort((e,t)=>(e._monotonicTime||0)-(t._monotonicTime||0));for(let e of this._snapshotsByFrameId.values())for(let t of e)for(let e of t.resourceOverrides)this._resourceUrlsWithOverrides.add(e.url)}hasResourceOverride(e){return this._resourceUrlsWithOverrides.has(e)}};function E(e,t){return`${e}/${t}`}function D(e){return`call@${e}`}function O(e){let t=new Map,{files:n,stacks:r}=e;for(let e of r){let[r,i]=e;t.set(r,i.map(e=>({file:n[e[0]],line:e[1],column:e[2],function:e[3]})))}return t}var k=class extends Error{constructor(e){super(e),this.name=`TraceVersionError`}},ee=10,te=0,ne=class{constructor(e,t){this._actionMap=new Map,this._pageEntries=new Map,this._jsHandles=new Map,this._consoleObjects=new Map,this._snapshotPhases=new Map,this._legacyCallIdToStepId=new Map,this._contextEntry=e,this._snapshotStorage=t}appendTrace(e){for(let t of e.split(`
`))this._appendEvent(t)}appendStacks(e){let t=JSON.parse(e),n=t.stacks.map(([e,...t])=>{let n=typeof e==`number`?D(e):e;return[this._legacyCallIdToStepId.get(n)??n,...t]}),r=O({files:t.files,stacks:n});for(let e of this._actionMap.values())e.stack=e.stack||r.get(e.callId)}actions(){return[...this._actionMap.values()]}_collectSnapshotPhase(e,t){e&&this._snapshotPhases.set(e,t)}_pageEntry(e){let t=this._pageEntries.get(e);return t||(t={pageId:e,screencastFrames:[]},this._pageEntries.set(e,t),this._contextEntry.pages.push(t)),t}_appendEvent(e){if(!e)return;let t=this._modernize(JSON.parse(e));for(let e of t)this._innerAppendEvent(e)}_innerAppendEvent(e){let t=this._contextEntry;switch(e.type){case`context-options`:if(e.version>ee)throw new k(`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=e.version,t.origin=e.origin,t.browserName=e.browserName,t.channel=e.channel,t.title=e.title,t.platform=e.platform,t.playwrightVersion=e.playwrightVersion,t.wallTime=e.wallTime,t.monotonicTime=e.monotonicTime,t.startTime=e.monotonicTime,t.sdkLanguage=e.sdkLanguage,t.options=e.options,t.testIdAttributeName=e.testIdAttributeName,t.testTimeout=e.testTimeout,t.annotations=e.annotations;break;case`screencast-frame`:this._pageEntry(e.pageId).screencastFrames.push(e);break;case`screenshot`:t.screenshots.push(e);break;case`video`:t.videos.push(e);break;case`aria-snapshot`:t.ariaSnapshots.push(e);break;case`before`:this._actionMap.set(e.callId,{...e,type:`action`,endTime:0,log:[]});break;case`input`:{let t=this._actionMap.get(e.callId);t.point=e.point,t.box=e.box;break}case`log`:{let t=this._actionMap.get(e.callId);if(!t)return;t.log.push({time:e.time,message:e.message});break}case`after`:{let t=this._actionMap.get(e.callId);t.endTime=e.endTime,t.result=e.result,t.error=e.error,t.attachments=e.attachments,t.annotations=e.annotations,e.point&&(t.point=e.point);break}case`action`:this._actionMap.set(e.callId,{...e,log:[]});break;case`event`:(e.method===`page`||e.method===`pageClosed`)&&e.params?.pageId&&this._pageEntry(e.params.pageId),t.events.push(e);break;case`stdout`:t.stdio.push(e);break;case`stderr`:t.stdio.push(e);break;case`error`:t.errors.push(e);break;case`console`:t.events.push(e);break;case`resource-snapshot`:this._snapshotStorage.addResource(e.snapshot),t.resources.push(e.snapshot);break;case`frame-snapshot`:{let n=e.snapshot;this._snapshotStorage.addFrameSnapshot(n,this._pageEntry(n.pageId).screencastFrames),n.isMainFrame&&n.phase&&t.domSnapshots.push({callId:n.callId,phase:n.phase});break}}`pageId`in e&&e.pageId&&this._pageEntry(e.pageId),(e.type===`action`||e.type===`before`)&&(t.startTime=Math.min(t.startTime,e.startTime)),(e.type===`action`||e.type===`after`)&&(t.endTime=Math.max(t.endTime,e.endTime)),e.type===`event`&&(t.startTime=Math.min(t.startTime,e.time),t.endTime=Math.max(t.endTime,e.time)),e.type===`screencast-frame`&&(t.startTime=Math.min(t.startTime,e.timestamp),t.endTime=Math.max(t.endTime,e.timestamp))}_processedContextCreatedEvent(){return this._version!==void 0}_modernize(e){let t=this._version??e.version??6,n=[e];for(;t<ee;++t)n=this[`_modernize_${t}_to_${t+1}`].call(this,n);return n}_modernize_0_to_1(e){for(let t of e)t.type===`action`&&typeof t.metadata.error==`string`&&(t.metadata.error={error:{name:`Error`,message:t.metadata.error}});return e}_modernize_1_to_2(e){for(let t of e)t.type!==`frame-snapshot`||!t.snapshot.isMainFrame||(t.snapshot.viewport=this._contextEntry.options?.viewport||{width:1280,height:720});return e}_modernize_2_to_3(e){for(let t of e){if(t.type!==`resource-snapshot`||t.snapshot.request)continue;let e=t.snapshot;t.snapshot={_frameref:e.frameId,request:{url:e.url,method:e.method,headers:e.requestHeaders,postData:e.requestSha1?{_sha1:e.requestSha1}:void 0},response:{status:e.status,headers:e.responseHeaders,content:{mimeType:e.contentType,_sha1:e.responseSha1}},_monotonicTime:e.timestamp}}return e}_modernize_3_to_4(e){let t=[];for(let n of e){let e=this._modernize_event_3_to_4(n);e&&t.push(e)}return t}_modernize_event_3_to_4(e){if(e.type!==`action`&&e.type!==`event`)return e;let t=e.metadata;return t.internal||t.method.startsWith(`tracing`)?null:e.type===`event`?t.method===`__create__`&&t.type===`ConsoleMessage`?{type:`object`,class:t.type,guid:t.params.guid,initializer:t.params.initializer}:{type:`event`,time:t.startTime,class:t.type,method:t.method,params:t.params,pageId:t.pageId}:{type:`action`,callId:t.id,startTime:t.startTime,endTime:t.endTime,apiName:t.apiName||t.type+`.`+t.method,class:t.type,method:t.method,params:t.params,wallTime:t.wallTime||Date.now(),log:t.log,beforeSnapshot:t.snapshots.find(e=>e.title===`before`)?.snapshotName,inputSnapshot:t.snapshots.find(e=>e.title===`input`)?.snapshotName,afterSnapshot:t.snapshots.find(e=>e.title===`after`)?.snapshotName,error:t.error?.error,result:t.result,point:t.point,pageId:t.pageId}}_modernize_4_to_5(e){let t=[];for(let n of e){let e=this._modernize_event_4_to_5(n);e&&t.push(e)}return t}_modernize_event_4_to_5(e){if(e.type===`event`&&e.method===`__create__`&&e.class===`JSHandle`&&this._jsHandles.set(e.params.guid,e.params.initializer),e.type===`object`){if(e.class!==`ConsoleMessage`)return null;let t=e.initializer.args?.map(e=>e.guid?{preview:this._jsHandles.get(e.guid)?.preview||``,value:``}:{preview:e.preview||``,value:e.value||``});return this._consoleObjects.set(e.guid,{type:e.initializer.type,text:e.initializer.text,location:e.initializer.location,args:t}),null}if(e.type===`event`&&e.method===`console`){let t=this._consoleObjects.get(e.params.message?.guid||``);return t?{type:`console`,time:e.time,pageId:e.pageId,messageType:t.type,text:t.text,args:t.args,location:t.location}:null}return e}_modernize_5_to_6(e){let t=[];for(let n of e)if(t.push(n),!(n.type!==`after`||!n.log.length))for(let e of n.log)t.push({type:`log`,callId:n.callId,message:e,time:-1});return t}_modernize_6_to_7(e){let t=[];!this._processedContextCreatedEvent()&&e[0].type!==`context-options`&&t.push({type:`context-options`,origin:`testRunner`,version:6,browserName:``,options:{},platform:`unknown`,wallTime:0,monotonicTime:0,sdkLanguage:`javascript`,contextId:``});for(let n of e){if(n.type===`context-options`){t.push({...n,monotonicTime:0,origin:`library`,contextId:``});continue}if(n.type===`before`||n.type===`action`){this._contextEntry.monotonicTime||(this._contextEntry.monotonicTime=n.startTime,this._contextEntry.wallTime=n.wallTime);let e=n,r=n;r.stepId=`${e.apiName}@${e.wallTime}`,t.push(r)}else t.push(n)}return t}_modernize_7_to_8(e){let t=[];for(let n of e)if(n.type===`before`||n.type===`action`){let e=n,r=n;e.apiName&&(r.title=e.apiName,delete r.apiName),r.stepId=e.stepId??e.callId,t.push(r)}else t.push(n);return t}_modernize_8_to_9(e){for(let t of e){if(t.type===`before`||t.type===`input`||t.type===`after`||t.type===`action`){let e=t;this._collectSnapshotPhase(e.beforeSnapshot,`before`),this._collectSnapshotPhase(e.inputSnapshot,`action`),this._collectSnapshotPhase(e.afterSnapshot,`after`),delete e.beforeSnapshot,delete e.inputSnapshot,delete e.afterSnapshot}if(t.type===`after`||t.type===`action`)for(let e of t.attachments||[])e.sha1&&(e.file=`resources/`+e.sha1,delete e.sha1);if(t.type===`screencast-frame`&&t.sha1&&(t.file=`resources/`+t.sha1,delete t.sha1),t.type===`frame-snapshot`){t.snapshot.snapshotName&&(t.snapshot.phase=this._snapshotPhases.get(t.snapshot.snapshotName));for(let e of t.snapshot.resourceOverrides||[])e.sha1&&(e.file=`resources/`+e.sha1,delete e.sha1)}if(t.type===`resource-snapshot`){let e=t.snapshot.request?.postData;e?._sha1&&(e._file=`resources/`+e._sha1,delete e._sha1);let n=t.snapshot.response?.content;n?._sha1&&(n._file=`resources/`+n._sha1,delete n._sha1),t.snapshot._apiRequest&&(this._apiRequestRef||=`api-request-context@`+ ++te,t.snapshot._apiRequestRef=this._apiRequestRef,delete t.snapshot._apiRequest)}}return e}_modernize_9_to_10(e){for(let t of e)(t.type===`before`||t.type===`action`)&&(t.stepId&&t.stepId!==t.callId&&this._legacyCallIdToStepId.set(t.callId,t.stepId),delete t.stepId,t.parentId&&=this._legacyCallIdToStepId.get(t.parentId)??t.parentId),(t.type===`before`||t.type===`input`||t.type===`after`||t.type===`action`||t.type===`log`)&&(t.callId=this._legacyCallIdToStepId.get(t.callId)??t.callId),t.type===`frame-snapshot`&&(t.snapshot.callId=this._legacyCallIdToStepId.get(t.snapshot.callId)??t.snapshot.callId);return e}},re=class{constructor(){this.contextEntries=[],this._resourceToContentType=new Map}async load(e,t,n){this._backend=e;let r=t?.match(/(.+)\.trace$/)?.[1],i=[],a=!1;for(let e of await this._backend.entryNames()){let t=e.match(/(.+)\.trace$/);t&&(!r||r===t[1])&&i.push(t[1]||``),(e.startsWith(`src/`)||e.includes(`src@`))&&(a=!0)}if(!i.length)throw Error(`Cannot find .trace file`);this._snapshotStorage=new T;let o=i.length*3,s=0;for(let t of i){let r=ie();r.hasSource=a;let i=new ne(r,this._snapshotStorage),c=await this._backend.readText(t+`.trace`)||``;i.appendTrace(c),n?.(++s,o);let l=await this._backend.readText(t+`.network`)||``;i.appendTrace(l),n?.(++s,o);let u=await this._backend.readText(t+`.stacks`);if(u&&i.appendStacks(u),n?.(++s,o),r.actions=i.actions().sort((e,t)=>e.startTime-t.startTime),!e.isLive()){for(let e of r.actions.slice().reverse())if(!e.endTime&&!e.error)for(let t of r.actions)t.parentId===e.callId&&e.endTime<t.endTime&&(e.endTime=t.endTime)}for(let e of r.resources)e.request.postData?._file&&this._resourceToContentType.set(e.request.postData._file,A(e.request.postData.mimeType)),e.response.content?._file&&this._resourceToContentType.set(e.response.content._file,A(e.response.content.mimeType));this.contextEntries.push(r)}this._snapshotStorage.finalize()}async hasEntry(e){return this._backend.hasEntry(e)}async resourceEntry(e){let t=await this._backend.readBlob(e),n=this._resourceToContentType.get(e);return!t||n===void 0||n===`x-unknown`?t:new Blob([t],{type:n})}storage(){return this._snapshotStorage}};function A(e){let t=e.match(/^(.*);\s*charset=.*$/);return t?t[1]:e}function ie(){return{origin:`testRunner`,startTime:2**53-1,wallTime:2**53-1,monotonicTime:0,endTime:0,browserName:``,options:{deviceScaleFactor:1,isMobile:!1,viewport:{width:1280,height:800}},pages:[],resources:[],actions:[],screenshots:[],ariaSnapshots:[],domSnapshots:[],videos:[],events:[],errors:[],stdio:[],hasSource:!1}}function j(e,t){let n=Array(t.length).fill(0);return Array(t.length).fill(0).map((r,i)=>(r,a)=>{n[i]=r/a*t[i]*1e3,e(n.reduce((e,t)=>e+t,0),1e3)})}var ae=15,M=0,N=1,oe=2,P=-2,F=-3,se=-4,I=-5,L=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],ce=1440,le=0,ue=4,de=9,fe=5,pe=[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],me=[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],he=[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],ge=[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],_e=[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],ve=[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],ye=15;function be(){let e=this,t,n,r,i,a,o;function s(e,t,n,s,c,l,u,d,f,p,m){let h,g,_,v,y,b,x,S,C,w,T,E,D,O,k;w=0,y=n;do r[e[t+w]]++,w++,y--;while(y!==0);if(r[0]==n)return u[0]=-1,d[0]=0,M;for(S=d[0],b=1;b<=ye&&r[b]===0;b++);for(x=b,S<b&&(S=b),y=ye;y!==0&&r[y]===0;y--);for(_=y,S>y&&(S=y),d[0]=S,O=1<<b;b<y;b++,O<<=1)if((O-=r[b])<0)return F;if((O-=r[y])<0)return F;for(r[y]+=O,o[1]=b=0,w=1,D=2;--y!==0;)o[D]=b+=r[w],D++,w++;y=0,w=0;do(b=e[t+w])!==0&&(m[o[b]++]=y),w++;while(++y<n);for(n=o[_],o[0]=y=0,w=0,v=-1,E=-S,a[0]=0,T=0,k=0;x<=_;x++)for(h=r[x];h--!==0;){for(;x>E+S;){if(v++,E+=S,k=_-E,k=k>S?S:k,(g=1<<(b=x-E))>h+1&&(g-=h+1,D=x,b<k))for(;++b<k&&!((g<<=1)<=r[++D]);)g-=r[D];if(k=1<<b,p[0]+k>ce)return F;a[v]=T=p[0],p[0]+=k,v===0?u[0]=T:(o[v]=y,i[0]=b,i[1]=S,b=y>>>E-S,i[2]=T-a[v-1]-b,f.set(i,(a[v-1]+b)*3))}for(i[1]=x-E,w>=n?i[0]=192:m[w]<s?(i[0]=m[w]<256?0:96,i[2]=m[w++]):(i[0]=l[m[w]-s]+16+64,i[2]=c[m[w++]-s]),g=1<<x-E,b=y>>>E;b<k;b+=g)f.set(i,(T+b)*3);for(b=1<<x-1;(y&b)!==0;b>>>=1)y^=b;for(y^=b,C=(1<<E)-1;(y&C)!=o[v];)v--,E-=S,C=(1<<E)-1}return O!==0&&_!=1?I:M}function c(e){let s;for(t||(t=[],n=[],r=new Int32Array(16),i=[],a=new Int32Array(ye),o=new Int32Array(16)),n.length<e&&(n=[]),s=0;s<e;s++)n[s]=0;for(s=0;s<16;s++)r[s]=0;for(s=0;s<3;s++)i[s]=0;a.set(r.subarray(0,ye),0),o.set(r.subarray(0,16),0)}e.inflate_trees_bits=function(e,r,i,a,o){let l;return c(19),t[0]=0,l=s(e,0,19,19,null,null,i,r,a,t,n),l==F?o.msg=`oversubscribed dynamic bit lengths tree`:(l==I||r[0]===0)&&(o.msg=`incomplete dynamic bit lengths tree`,l=F),l},e.inflate_trees_dynamic=function(e,r,i,a,o,l,u,d,f){let p;return c(288),t[0]=0,p=s(i,0,e,257,he,ge,l,a,d,t,n),p!=M||a[0]===0?(p==F?f.msg=`oversubscribed literal/length tree`:p!=se&&(f.msg=`incomplete literal/length tree`,p=F),p):(c(288),p=s(i,e,r,0,_e,ve,u,o,d,t,n),p!=M||o[0]===0&&e>257?(p==F?f.msg=`oversubscribed distance tree`:p==I?(f.msg=`incomplete distance tree`,p=F):p!=se&&(f.msg=`empty distance tree with lengths`,p=F),p):M)}}be.inflate_trees_fixed=function(e,t,n,r){return e[0]=de,t[0]=fe,n[0]=pe,r[0]=me,M};var xe=0,Se=1,Ce=2,we=3,Te=4,Ee=5,De=6,Oe=7,ke=8,Ae=9;function je(){let e=this,t,n=0,r,i=0,a=0,o=0,s=0,c=0,l=0,u=0,d,f=0,p,m=0;function h(e,t,n,r,i,a,o,s){let c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C;m=s.next_in_index,h=s.avail_in,f=o.bitb,p=o.bitk,g=o.write,_=g<o.read?o.read-g-1:o.end-g,v=L[e],y=L[t];do{for(;p<20;)h--,f|=(s.read_byte(m++)&255)<<p,p+=8;if(c=f&v,l=n,u=r,C=(u+c)*3,(d=l[C])===0){f>>=l[C+1],p-=l[C+1],o.win[g++]=l[C+2],_--;continue}do{if(f>>=l[C+1],p-=l[C+1],d&16){for(d&=15,b=l[C+2]+(f&L[d]),f>>=d,p-=d;p<15;)h--,f|=(s.read_byte(m++)&255)<<p,p+=8;c=f&y,l=i,u=a,C=(u+c)*3,d=l[C];do if(f>>=l[C+1],p-=l[C+1],d&16){for(d&=15;p<d;)h--,f|=(s.read_byte(m++)&255)<<p,p+=8;if(x=l[C+2]+(f&L[d]),f>>=d,p-=d,_-=b,g>=x)S=g-x,g-S>0&&2>g-S?(o.win[g++]=o.win[S++],o.win[g++]=o.win[S++],b-=2):(o.win.set(o.win.subarray(S,S+2),g),g+=2,S+=2,b-=2);else{S=g-x;do S+=o.end;while(S<0);if(d=o.end-S,b>d){if(b-=d,g-S>0&&d>g-S)do o.win[g++]=o.win[S++];while(--d!==0);else o.win.set(o.win.subarray(S,S+d),g),g+=d,S+=d,d=0;S=0}}if(g-S>0&&b>g-S)do o.win[g++]=o.win[S++];while(--b!==0);else o.win.set(o.win.subarray(S,S+b),g),g+=b,S+=b,b=0;break}else if(!(d&64))c+=l[C+2],c+=f&L[d],C=(u+c)*3,d=l[C];else return s.msg=`invalid distance code`,b=s.avail_in-h,b=p>>3<b?p>>3:b,h+=b,m-=b,p-=b<<3,o.bitb=f,o.bitk=p,s.avail_in=h,s.total_in+=m-s.next_in_index,s.next_in_index=m,o.write=g,F;while(!0);break}if(!(d&64)){if(c+=l[C+2],c+=f&L[d],C=(u+c)*3,(d=l[C])===0){f>>=l[C+1],p-=l[C+1],o.win[g++]=l[C+2],_--;break}}else if(d&32)return b=s.avail_in-h,b=p>>3<b?p>>3:b,h+=b,m-=b,p-=b<<3,o.bitb=f,o.bitk=p,s.avail_in=h,s.total_in+=m-s.next_in_index,s.next_in_index=m,o.write=g,N;else return s.msg=`invalid literal/length code`,b=s.avail_in-h,b=p>>3<b?p>>3:b,h+=b,m-=b,p-=b<<3,o.bitb=f,o.bitk=p,s.avail_in=h,s.total_in+=m-s.next_in_index,s.next_in_index=m,o.write=g,F}while(!0)}while(_>=258&&h>=10);return b=s.avail_in-h,b=p>>3<b?p>>3:b,h+=b,m-=b,p-=b<<3,o.bitb=f,o.bitk=p,s.avail_in=h,s.total_in+=m-s.next_in_index,s.next_in_index=m,o.write=g,M}e.init=function(e,n,i,a,o,s){t=xe,l=e,u=n,d=i,f=a,p=o,m=s,r=null},e.proc=function(e,g,_){let v,y,b,x=0,S=0,C=0,w,T,E,D;for(C=g.next_in_index,w=g.avail_in,x=e.bitb,S=e.bitk,T=e.write,E=T<e.read?e.read-T-1:e.end-T;;)switch(t){case xe:if(E>=258&&w>=10&&(e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,_=h(l,u,d,f,p,m,e,g),C=g.next_in_index,w=g.avail_in,x=e.bitb,S=e.bitk,T=e.write,E=T<e.read?e.read-T-1:e.end-T,_!=M)){t=_==N?Oe:Ae;break}a=l,r=d,i=f,t=Se;case Se:for(v=a;S<v;){if(w!==0)_=M;else return e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_);w--,x|=(g.read_byte(C++)&255)<<S,S+=8}if(y=(i+(x&L[v]))*3,x>>>=r[y+1],S-=r[y+1],b=r[y],b===0){o=r[y+2],t=De;break}if(b&16){s=b&15,n=r[y+2],t=Ce;break}if(!(b&64)){a=b,i=y/3+r[y+2];break}if(b&32){t=Oe;break}return t=Ae,g.msg=`invalid literal/length code`,_=F,e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_);case Ce:for(v=s;S<v;){if(w!==0)_=M;else return e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_);w--,x|=(g.read_byte(C++)&255)<<S,S+=8}n+=x&L[v],x>>=v,S-=v,a=u,r=p,i=m,t=we;case we:for(v=a;S<v;){if(w!==0)_=M;else return e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_);w--,x|=(g.read_byte(C++)&255)<<S,S+=8}if(y=(i+(x&L[v]))*3,x>>=r[y+1],S-=r[y+1],b=r[y],b&16){s=b&15,c=r[y+2],t=Te;break}if(!(b&64)){a=b,i=y/3+r[y+2];break}return t=Ae,g.msg=`invalid distance code`,_=F,e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_);case Te:for(v=s;S<v;){if(w!==0)_=M;else return e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_);w--,x|=(g.read_byte(C++)&255)<<S,S+=8}c+=x&L[v],x>>=v,S-=v,t=Ee;case Ee:for(D=T-c;D<0;)D+=e.end;for(;n!==0;){if(E===0&&(T==e.end&&e.read!==0&&(T=0,E=T<e.read?e.read-T-1:e.end-T),E===0&&(e.write=T,_=e.inflate_flush(g,_),T=e.write,E=T<e.read?e.read-T-1:e.end-T,T==e.end&&e.read!==0&&(T=0,E=T<e.read?e.read-T-1:e.end-T),E===0)))return e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_);e.win[T++]=e.win[D++],E--,D==e.end&&(D=0),n--}t=xe;break;case De:if(E===0&&(T==e.end&&e.read!==0&&(T=0,E=T<e.read?e.read-T-1:e.end-T),E===0&&(e.write=T,_=e.inflate_flush(g,_),T=e.write,E=T<e.read?e.read-T-1:e.end-T,T==e.end&&e.read!==0&&(T=0,E=T<e.read?e.read-T-1:e.end-T),E===0)))return e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_);_=M,e.win[T++]=o,E--,t=xe;break;case Oe:if(S>7&&(S-=8,w++,C--),e.write=T,_=e.inflate_flush(g,_),T=e.write,E=T<e.read?e.read-T-1:e.end-T,e.read!=e.write)return e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_);t=ke;case ke:return _=N,e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_);case Ae:return _=F,e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_);default:return _=P,e.bitb=x,e.bitk=S,g.avail_in=w,g.total_in+=C-g.next_in_index,g.next_in_index=C,e.write=T,e.inflate_flush(g,_)}},e.free=function(){}}var Me=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Ne=0,Pe=1,Fe=2,Ie=3,Le=4,Re=5,ze=6,Be=7,Ve=8,R=9;function He(e,t){let n=this,r=Ne,i=0,a=0,o=0,s,c=[0],l=[0],u=new je,d=0,f=new Int32Array(ce*3),p=new be;n.bitk=0,n.bitb=0,n.win=new Uint8Array(t),n.end=t,n.read=0,n.write=0,n.reset=function(e,t){t&&(t[0]=0),r==ze&&u.free(e),r=Ne,n.bitk=0,n.bitb=0,n.read=n.write=0},n.reset(e,null),n.inflate_flush=function(e,t){let r,i,a;return i=e.next_out_index,a=n.read,r=(a<=n.write?n.write:n.end)-a,r>e.avail_out&&(r=e.avail_out),r!==0&&t==I&&(t=M),e.avail_out-=r,e.total_out+=r,e.next_out.set(n.win.subarray(a,a+r),i),i+=r,a+=r,a==n.end&&(a=0,n.write==n.end&&(n.write=0),r=n.write-a,r>e.avail_out&&(r=e.avail_out),r!==0&&t==I&&(t=M),e.avail_out-=r,e.total_out+=r,e.next_out.set(n.win.subarray(a,a+r),i),i+=r,a+=r),e.next_out_index=i,n.read=a,t},n.proc=function(e,t){let m,h,g,_,v,y,b,x;for(_=e.next_in_index,v=e.avail_in,h=n.bitb,g=n.bitk,y=n.write,b=y<n.read?n.read-y-1:n.end-y;;){let S,C,w,T,E,D,O,k;switch(r){case Ne:for(;g<3;){if(v!==0)t=M;else return n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);v--,h|=(e.read_byte(_++)&255)<<g,g+=8}switch(m=h&7,d=m&1,m>>>1){case 0:h>>>=3,g-=3,m=g&7,h>>>=m,g-=m,r=Pe;break;case 1:S=[],C=[],w=[[]],T=[[]],be.inflate_trees_fixed(S,C,w,T),u.init(S[0],C[0],w[0],0,T[0],0),h>>>=3,g-=3,r=ze;break;case 2:h>>>=3,g-=3,r=Ie;break;case 3:return h>>>=3,g-=3,r=R,e.msg=`invalid block type`,t=F,n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t)}break;case Pe:for(;g<32;){if(v!==0)t=M;else return n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);v--,h|=(e.read_byte(_++)&255)<<g,g+=8}if((~h>>>16&65535)!=(h&65535))return r=R,e.msg=`invalid stored block lengths`,t=F,n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);i=h&65535,h=g=0,r=i===0?d===0?Ne:Be:Fe;break;case Fe:if(v===0||b===0&&(y==n.end&&n.read!==0&&(y=0,b=y<n.read?n.read-y-1:n.end-y),b===0&&(n.write=y,t=n.inflate_flush(e,t),y=n.write,b=y<n.read?n.read-y-1:n.end-y,y==n.end&&n.read!==0&&(y=0,b=y<n.read?n.read-y-1:n.end-y),b===0)))return n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);if(t=M,m=i,m>v&&(m=v),m>b&&(m=b),n.win.set(e.read_buf(_,m),y),_+=m,v-=m,y+=m,b-=m,(i-=m)!==0)break;r=d===0?Ne:Be;break;case Ie:for(;g<14;){if(v!==0)t=M;else return n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);v--,h|=(e.read_byte(_++)&255)<<g,g+=8}if(a=m=h&16383,(m&31)>29||(m>>5&31)>29)return r=R,e.msg=`too many length or distance symbols`,t=F,n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);if(m=258+(m&31)+(m>>5&31),!s||s.length<m)s=[];else for(x=0;x<m;x++)s[x]=0;h>>>=14,g-=14,o=0,r=Le;case Le:for(;o<4+(a>>>10);){for(;g<3;){if(v!==0)t=M;else return n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);v--,h|=(e.read_byte(_++)&255)<<g,g+=8}s[Me[o++]]=h&7,h>>>=3,g-=3}for(;o<19;)s[Me[o++]]=0;if(c[0]=7,m=p.inflate_trees_bits(s,c,l,f,e),m!=M)return t=m,t==F&&(s=null,r=R),n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);o=0,r=Re;case Re:for(;m=a,!(o>=258+(m&31)+(m>>5&31));){let i,u;for(m=c[0];g<m;){if(v!==0)t=M;else return n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);v--,h|=(e.read_byte(_++)&255)<<g,g+=8}if(m=f[(l[0]+(h&L[m]))*3+1],u=f[(l[0]+(h&L[m]))*3+2],u<16)h>>>=m,g-=m,s[o++]=u;else{for(x=u==18?7:u-14,i=u==18?11:3;g<m+x;){if(v!==0)t=M;else return n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);v--,h|=(e.read_byte(_++)&255)<<g,g+=8}if(h>>>=m,g-=m,i+=h&L[x],h>>>=x,g-=x,x=o,m=a,x+i>258+(m&31)+(m>>5&31)||u==16&&x<1)return s=null,r=R,e.msg=`invalid bit length repeat`,t=F,n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);u=u==16?s[x-1]:0;do s[x++]=u;while(--i!==0);o=x}}if(l[0]=-1,E=[],D=[],O=[],k=[],E[0]=9,D[0]=6,m=a,m=p.inflate_trees_dynamic(257+(m&31),1+(m>>5&31),s,E,D,O,k,f,e),m!=M)return m==F&&(s=null,r=R),t=m,n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);u.init(E[0],D[0],f,O[0],f,k[0]),r=ze;case ze:if(n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,(t=u.proc(n,e,t))!=N)return n.inflate_flush(e,t);if(t=M,u.free(e),_=e.next_in_index,v=e.avail_in,h=n.bitb,g=n.bitk,y=n.write,b=y<n.read?n.read-y-1:n.end-y,d===0){r=Ne;break}r=Be;case Be:if(n.write=y,t=n.inflate_flush(e,t),y=n.write,b=y<n.read?n.read-y-1:n.end-y,n.read!=n.write)return n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);r=Ve;case Ve:return t=N,n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);case R:return t=F,n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t);default:return t=P,n.bitb=h,n.bitk=g,e.avail_in=v,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=y,n.inflate_flush(e,t)}}},n.free=function(e){n.reset(e,null),n.win=null,f=null},n.set_dictionary=function(e,t,r){n.win.set(e.subarray(t,t+r),0),n.read=n.write=r},n.sync_point=function(){return+(r==Pe)}}var Ue=32,We=8,Ge=0,Ke=1,qe=2,Je=3,Ye=4,Xe=5,Ze=6,Qe=7,$e=12,z=13,et=[0,0,255,255];function tt(){let e=this;e.mode=0,e.method=0,e.was=[0],e.need=0,e.marker=0,e.wbits=0;function t(e){return!e||!e.istate?P:(e.total_in=e.total_out=0,e.msg=null,e.istate.mode=Qe,e.istate.blocks.reset(e,null),M)}e.inflateEnd=function(t){return e.blocks&&e.blocks.free(t),e.blocks=null,M},e.inflateInit=function(n,r){return n.msg=null,e.blocks=null,r<8||r>15?(e.inflateEnd(n),P):(e.wbits=r,n.istate.blocks=new He(n,1<<r),t(n),M)},e.inflate=function(e,t){let n,r;if(!e||!e.istate||!e.next_in)return P;let i=e.istate;for(t=t==ue?I:M,n=I;;)switch(i.mode){case Ge:if(e.avail_in===0)return n;if(n=t,e.avail_in--,e.total_in++,((i.method=e.read_byte(e.next_in_index++))&15)!=We){i.mode=z,e.msg=`unknown compression method`,i.marker=5;break}if((i.method>>4)+8>i.wbits){i.mode=z,e.msg=`invalid win size`,i.marker=5;break}i.mode=Ke;case Ke:if(e.avail_in===0)return n;if(n=t,e.avail_in--,e.total_in++,r=e.read_byte(e.next_in_index++)&255,((i.method<<8)+r)%31!=0){i.mode=z,e.msg=`incorrect header check`,i.marker=5;break}if((r&Ue)===0){i.mode=Qe;break}i.mode=qe;case qe:if(e.avail_in===0)return n;n=t,e.avail_in--,e.total_in++,i.need=(e.read_byte(e.next_in_index++)&255)<<24&4278190080,i.mode=Je;case Je:if(e.avail_in===0)return n;n=t,e.avail_in--,e.total_in++,i.need+=(e.read_byte(e.next_in_index++)&255)<<16&16711680,i.mode=Ye;case Ye:if(e.avail_in===0)return n;n=t,e.avail_in--,e.total_in++,i.need+=(e.read_byte(e.next_in_index++)&255)<<8&65280,i.mode=Xe;case Xe:return e.avail_in===0?n:(n=t,e.avail_in--,e.total_in++,i.need+=e.read_byte(e.next_in_index++)&255,i.mode=Ze,oe);case Ze:return i.mode=z,e.msg=`need dictionary`,i.marker=0,P;case Qe:if(n=i.blocks.proc(e,n),n==F){i.mode=z,i.marker=0;break}if(n==M&&(n=t),n!=N)return n;n=t,i.blocks.reset(e,i.was),i.mode=$e;case $e:return e.avail_in=0,N;case z:return F;default:return P}},e.inflateSetDictionary=function(e,t,n){let r=0,i=n;if(!e||!e.istate||e.istate.mode!=Ze)return P;let a=e.istate;return i>=1<<a.wbits&&(i=(1<<a.wbits)-1,r=n-i),a.blocks.set_dictionary(t,r,i),a.mode=Qe,M},e.inflateSync=function(e){let n,r,i,a,o;if(!e||!e.istate)return P;let s=e.istate;if(s.mode!=z&&(s.mode=z,s.marker=0),(n=e.avail_in)===0)return I;for(r=e.next_in_index,i=s.marker;n!==0&&i<4;)e.read_byte(r)==et[i]?i++:i=e.read_byte(r)===0?4-i:0,r++,n--;return e.total_in+=r-e.next_in_index,e.next_in_index=r,e.avail_in=n,s.marker=i,i==4?(a=e.total_in,o=e.total_out,t(e),e.total_in=a,e.total_out=o,s.mode=Qe,M):F},e.inflateSyncPoint=function(e){return!e||!e.istate||!e.istate.blocks?P:e.istate.blocks.sync_point()}}function nt(){}nt.prototype={inflateInit(e){let t=this;return t.istate=new tt,e||=ae,t.istate.inflateInit(t,e)},inflate(e){let t=this;return t.istate?t.istate.inflate(t,e):P},inflateEnd(){let e=this;if(!e.istate)return P;let t=e.istate.inflateEnd(e);return e.istate=null,t},inflateSync(){let e=this;return e.istate?e.istate.inflateSync(e):P},inflateSetDictionary(e,t){let n=this;return n.istate?n.istate.inflateSetDictionary(n,e,t):P},read_byte(e){return this.next_in[e]},read_buf(e,t){return this.next_in.subarray(e,e+t)}};function rt(e){let t=this,n=new nt,r=e&&e.chunkSize?Math.floor(e.chunkSize*2):128*1024,i=le,a=new Uint8Array(r),o=!1;n.inflateInit(),n.next_out=a,t.append=function(e,t){let s=[],c,l,u=0,d=0,f=0;if(e.length!==0){n.next_in_index=0,n.next_in=e,n.avail_in=e.length;do{if(n.next_out_index=0,n.avail_out=r,n.avail_in===0&&!o&&(n.next_in_index=0,o=!0),c=n.inflate(i),o&&c===I){if(n.avail_in!==0)throw Error(`inflating: bad input`)}else if(c!==M&&c!==N)throw Error(`inflating: `+n.msg);if((o||c===N)&&n.avail_in===e.length)throw Error(`inflating: bad input`);n.next_out_index&&(n.next_out_index===r?s.push(new Uint8Array(a)):s.push(a.subarray(0,n.next_out_index))),f+=n.next_out_index,t&&n.next_in_index>0&&n.next_in_index!=u&&(t(n.next_in_index),u=n.next_in_index)}while(n.avail_in>0||n.avail_out===0);return s.length>1?(l=new Uint8Array(f),s.forEach(function(e){l.set(e,d),d+=e.length})):l=s[0]?new Uint8Array(s[0]):new Uint8Array,l}},t.flush=function(){n.inflateEnd()}}var it=4294967295,at=65535,ot=101010256,st=39169,ct=21589,lt=28789,ut=25461,dt=6534,ft=2048,pt=`undefined`,mt=class{constructor(e){return class extends TransformStream{constructor(t,n){let r=new e(n);super({transform(e,t){t.enqueue(r.append(e))},flush(e){let t=r.flush();t&&e.enqueue(t)}})}}}},ht=64,gt=2;try{typeof navigator<`u`&&navigator.hardwareConcurrency&&(gt=navigator.hardwareConcurrency)}catch{}var B=Object.assign({},{chunkSize:512*1024,maxWorkers:gt,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,workerScripts:void 0,CompressionStreamNative:typeof CompressionStream<`u`&&CompressionStream,DecompressionStreamNative:typeof DecompressionStream<`u`&&DecompressionStream});function _t(){return B}function vt(e){return Math.max(e.chunkSize,ht)}function yt(e){let{baseURL:t,chunkSize:n,maxWorkers:r,terminateWorkerTimeout:i,useCompressionStream:a,useWebWorkers:o,Deflate:s,Inflate:c,CompressionStream:l,DecompressionStream:u,workerScripts:d}=e;if(V(`baseURL`,t),V(`chunkSize`,n),V(`maxWorkers`,r),V(`terminateWorkerTimeout`,i),V(`useCompressionStream`,a),V(`useWebWorkers`,o),s&&(B.CompressionStream=new mt(s)),c&&(B.DecompressionStream=new mt(c)),V(`CompressionStream`,l),V(`DecompressionStream`,u),d!==void 0){let{deflate:e,inflate:t}=d;if((e||t)&&(B.workerScripts||={}),e){if(!Array.isArray(e))throw Error(`workerScripts.deflate must be an array`);B.workerScripts.deflate=e}if(t){if(!Array.isArray(t))throw Error(`workerScripts.inflate must be an array`);B.workerScripts.inflate=t}}}function V(e,t){t!==void 0&&(B[e]=t)}function bt(){return`application/octet-stream`}var xt=[];for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t&1?t=t>>>1^3988292384:t>>>=1;xt[e]=t}var St=class{constructor(e){this.crc=e||-1}append(e){let t=this.crc|0;for(let n=0,r=e.length|0;n<r;n++)t=t>>>8^xt[(t^e[n])&255];this.crc=t}get(){return~this.crc}},Ct=class extends TransformStream{constructor(){let e,t=new St;super({transform(e,n){t.append(e),n.enqueue(e)},flush(){let n=new Uint8Array(4);new DataView(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}};function wt(e){if(typeof TextEncoder>`u`){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let n=0;n<t.length;n++)t[n]=e.charCodeAt(n);return t}else return new TextEncoder().encode(e)}var H={concat(e,t){if(e.length===0||t.length===0)return e.concat(t);let n=e[e.length-1],r=H.getPartial(n);return r===32?e.concat(t):H._shiftRight(t,r,n|0,e.slice(0,e.length-1))},bitLength(e){let t=e.length;if(t===0)return 0;let n=e[t-1];return(t-1)*32+H.getPartial(n)},clamp(e,t){if(e.length*32<t)return e;e=e.slice(0,Math.ceil(t/32));let n=e.length;return t&=31,n>0&&t&&(e[n-1]=H.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial(e,t,n){return e===32?t:(n?t|0:t<<32-e)+e*1099511627776},getPartial(e){return Math.round(e/1099511627776)||32},_shiftRight(e,t,n,r){for(r===void 0&&(r=[]);t>=32;t-=32)r.push(n),n=0;if(t===0)return r.concat(e);for(let i=0;i<e.length;i++)r.push(n|e[i]>>>t),n=e[i]<<32-t;let i=e.length?e[e.length-1]:0,a=H.getPartial(i);return r.push(H.partial(t+a&31,t+a>32?n:r.pop(),1)),r}},Tt={bytes:{fromBits(e){let t=H.bitLength(e)/8,n=new Uint8Array(t),r;for(let i=0;i<t;i++)i&3||(r=e[i/4]),n[i]=r>>>24,r<<=8;return n},toBits(e){let t=[],n,r=0;for(n=0;n<e.length;n++)r=r<<8|e[n],(n&3)==3&&(t.push(r),r=0);return n&3&&t.push(H.partial(8*(n&3),r)),t}}},Et={};Et.sha1=class{constructor(e){let t=this;t.blockSize=512,t._init=[1732584193,4023233417,2562383102,271733878,3285377520],t._key=[1518500249,1859775393,2400959708,3395469782],e?(t._h=e._h.slice(0),t._buffer=e._buffer.slice(0),t._length=e._length):t.reset()}reset(){let e=this;return e._h=e._init.slice(0),e._buffer=[],e._length=0,e}update(e){let t=this;typeof e==`string`&&(e=Tt.utf8String.toBits(e));let n=t._buffer=H.concat(t._buffer,e),r=t._length,i=t._length=r+H.bitLength(e);if(i>9007199254740991)throw Error(`Cannot hash more than 2^53 - 1 bits`);let a=new Uint32Array(n),o=0;for(let e=t.blockSize+r-(t.blockSize+r&t.blockSize-1);e<=i;e+=t.blockSize)t._block(a.subarray(16*o,16*(o+1))),o+=1;return n.splice(0,16*o),t}finalize(){let e=this,t=e._buffer,n=e._h;t=H.concat(t,[H.partial(1,1)]);for(let e=t.length+2;e&15;e++)t.push(0);for(t.push(Math.floor(e._length/4294967296)),t.push(e._length|0);t.length;)e._block(t.splice(0,16));return e.reset(),n}_f(e,t,n,r){if(e<=19)return t&n|~t&r;if(e<=39)return t^n^r;if(e<=59)return t&n|t&r|n&r;if(e<=79)return t^n^r}_S(e,t){return t<<e|t>>>32-e}_block(e){let t=this,n=t._h,r=Array(80);for(let t=0;t<16;t++)r[t]=e[t];let i=n[0],a=n[1],o=n[2],s=n[3],c=n[4];for(let e=0;e<=79;e++){e>=16&&(r[e]=t._S(1,r[e-3]^r[e-8]^r[e-14]^r[e-16]));let n=t._S(5,i)+t._f(e,a,o,s)+c+r[e]+t._key[Math.floor(e/20)]|0;c=s,s=o,o=t._S(30,a),a=i,i=n}n[0]=n[0]+i|0,n[1]=n[1]+a|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+c|0}};var Dt={};Dt.aes=class{constructor(e){let t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();let n=t._tables[0][4],r=t._tables[1],i=e.length,a,o,s,c=1;if(i!==4&&i!==6&&i!==8)throw Error(`invalid aes key size`);for(t._key=[o=e.slice(0),s=[]],a=i;a<4*i+28;a++){let e=o[a-1];(a%i===0||i===8&&a%i===4)&&(e=n[e>>>24]<<24^n[e>>16&255]<<16^n[e>>8&255]<<8^n[e&255],a%i===0&&(e=e<<8^e>>>24^c<<24,c=c<<1^(c>>7)*283)),o[a]=o[a-i]^e}for(let e=0;a;e++,a--){let t=o[e&3?a:a-4];a<=4||e<4?s[e]=t:s[e]=r[0][n[t>>>24]]^r[1][n[t>>16&255]]^r[2][n[t>>8&255]]^r[3][n[t&255]]}}encrypt(e){return this._crypt(e,0)}decrypt(e){return this._crypt(e,1)}_precompute(){let e=this._tables[0],t=this._tables[1],n=e[4],r=t[4],i=[],a=[],o,s,c,l;for(let e=0;e<256;e++)a[(i[e]=e<<1^(e>>7)*283)^e]=e;for(let u=o=0;!n[u];u^=s||1,o=a[o]||1){let a=o^o<<1^o<<2^o<<3^o<<4;a=a>>8^a&255^99,n[u]=a,r[a]=u,l=i[c=i[s=i[u]]];let d=l*16843009^c*65537^s*257^u*16843008,f=i[a]*257^a*16843008;for(let n=0;n<4;n++)e[n][u]=f=f<<24^f>>>8,t[n][a]=d=d<<24^d>>>8}for(let n=0;n<5;n++)e[n]=e[n].slice(0),t[n]=t[n].slice(0)}_crypt(e,t){if(e.length!==4)throw Error(`invalid aes block size`);let n=this._key[t],r=n.length/4-2,i=[0,0,0,0],a=this._tables[t],o=a[0],s=a[1],c=a[2],l=a[3],u=a[4],d=e[0]^n[0],f=e[t?3:1]^n[1],p=e[2]^n[2],m=e[t?1:3]^n[3],h=4,g,_,v;for(let e=0;e<r;e++)g=o[d>>>24]^s[f>>16&255]^c[p>>8&255]^l[m&255]^n[h],_=o[f>>>24]^s[p>>16&255]^c[m>>8&255]^l[d&255]^n[h+1],v=o[p>>>24]^s[m>>16&255]^c[d>>8&255]^l[f&255]^n[h+2],m=o[m>>>24]^s[d>>16&255]^c[f>>8&255]^l[p&255]^n[h+3],h+=4,d=g,f=_,p=v;for(let e=0;e<4;e++)i[t?3&-e:e]=u[d>>>24]<<24^u[f>>16&255]<<16^u[p>>8&255]<<8^u[m&255]^n[h++],g=d,d=f,f=p,p=m,m=g;return i}};var Ot={getRandomValues(e){let t=new Uint32Array(e.buffer),n=e=>{let t=987654321,n=4294967295;return function(){return t=36969*(t&65535)+(t>>16)&n,e=18e3*(e&65535)+(e>>16)&n,(((t<<16)+e&n)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let r=0,i;r<e.length;r+=4){let e=n((i||Math.random())*4294967296);i=e()*987654071,t[r/4]=e()*4294967296|0}return e}},kt={};kt.ctrGladman=class{constructor(e,t){this._prf=e,this._initIv=t,this._iv=t}reset(){this._iv=this._initIv}update(e){return this.calculate(this._prf,e,this._iv)}incWord(e){if((e>>24&255)==255){let t=e>>16&255,n=e>>8&255,r=e&255;t===255?(t=0,n===255?(n=0,r===255?r=0:++r):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=r}else e+=1<<24;return e}incCounter(e){(e[0]=this.incWord(e[0]))===0&&(e[1]=this.incWord(e[1]))}calculate(e,t,n){let r;if(!(r=t.length))return[];let i=H.bitLength(t);for(let i=0;i<r;i+=4){this.incCounter(n);let r=e.encrypt(n);t[i]^=r[0],t[i+1]^=r[1],t[i+2]^=r[2],t[i+3]^=r[3]}return H.clamp(t,i)}};var At={importKey(e){return new At.hmacSha1(Tt.bytes.toBits(e))},pbkdf2(e,t,n,r){if(n||=1e4,r<0||n<0)throw Error(`invalid params to pbkdf2`);let i=(r>>5)+1<<2,a,o,s,c,l,u=new ArrayBuffer(i),d=new DataView(u),f=0,p=H;for(t=Tt.bytes.toBits(t),l=1;f<(i||1);l++){for(a=o=e.encrypt(p.concat(t,[l])),s=1;s<n;s++)for(o=e.encrypt(o),c=0;c<o.length;c++)a[c]^=o[c];for(s=0;f<(i||1)&&s<a.length;s++)d.setInt32(f,a[s]),f+=4}return u.slice(0,r/8)}};At.hmacSha1=class{constructor(e){let t=this,n=t._hash=Et.sha1,r=[[],[]];t._baseHash=[new n,new n];let i=t._baseHash[0].blockSize/32;e.length>i&&(e=new n().update(e).finalize());for(let t=0;t<i;t++)r[0][t]=e[t]^909522486,r[1][t]=e[t]^1549556828;t._baseHash[0].update(r[0]),t._baseHash[1].update(r[1]),t._resultHash=new n(t._baseHash[0])}reset(){let e=this;e._resultHash=new e._hash(e._baseHash[0]),e._updated=!1}update(e){let t=this;t._updated=!0,t._resultHash.update(e)}digest(){let e=this,t=e._resultHash.finalize(),n=new e._hash(e._baseHash[1]).update(t).finalize();return e.reset(),n}encrypt(e){if(this._updated)throw Error(`encrypt on already updated hmac called!`);return this.update(e),this.digest(e)}};var jt=typeof crypto<`u`&&typeof crypto.getRandomValues==`function`,Mt=`Invalid password`,Nt=`Invalid signature`,Pt=`zipjs-abort-check-password`;function Ft(e){return jt?crypto.getRandomValues(e):Ot.getRandomValues(e)}var It=16,Lt=`raw`,Rt={name:`PBKDF2`},zt={name:`HMAC`},Bt=`SHA-1`,Vt=Object.assign({hash:zt},Rt),Ht=Object.assign({iterations:1e3,hash:{name:Bt}},Rt),Ut=[`deriveBits`],Wt=[8,12,16],Gt=[16,24,32],U=10,Kt=[0,0,0,0],qt=typeof crypto!=pt,Jt=qt&&crypto.subtle,Yt=qt&&Jt!==void 0,W=Tt.bytes,Xt=Dt.aes,Zt=kt.ctrGladman,Qt=At.hmacSha1,$t=qt&&Yt&&typeof Jt.importKey==`function`,en=qt&&Yt&&typeof Jt.deriveBits==`function`,tn=class extends TransformStream{constructor({password:e,rawPassword:t,signed:n,encryptionStrength:r,checkPasswordOnly:i}){super({start(){Object.assign(this,{ready:new Promise(e=>this.resolveReady=e),password:un(e,t),signed:n,strength:r-1,pending:new Uint8Array})},async transform(e,t){let n=this,{password:r,strength:a,resolveReady:o,ready:s}=n;r?(await an(n,a,r,G(e,0,Wt[a]+2)),e=G(e,Wt[a]+2),i?t.error(Error(Pt)):o()):await s;let c=new Uint8Array(e.length-U-(e.length-U)%It);t.enqueue(rn(n,e,c,0,U,!0))},async flush(e){let{signed:t,ctr:n,hmac:r,pending:i,ready:a}=this;if(r&&n){await a;let o=G(i,0,i.length-U),s=G(i,i.length-U),c=new Uint8Array;if(o.length){let e=mn(W,o);r.update(e),c=pn(W,n.update(e))}if(t){let e=G(pn(W,r.digest()),0,U);for(let t=0;t<U;t++)if(e[t]!=s[t])throw Error(Nt)}e.enqueue(c)}}})}},nn=class extends TransformStream{constructor({password:e,rawPassword:t,encryptionStrength:n}){let r;super({start(){Object.assign(this,{ready:new Promise(e=>this.resolveReady=e),password:un(e,t),strength:n-1,pending:new Uint8Array})},async transform(e,t){let n=this,{password:r,strength:i,resolveReady:a,ready:o}=n,s=new Uint8Array;r?(s=await on(n,i,r),a()):await o;let c=new Uint8Array(s.length+e.length-e.length%It);c.set(s,0),t.enqueue(rn(n,e,c,s.length,0))},async flush(e){let{ctr:t,hmac:n,pending:i,ready:a}=this;if(n&&t){await a;let o=new Uint8Array;if(i.length){let e=t.update(mn(W,i));n.update(e),o=pn(W,e)}r.signature=pn(W,n.digest()).slice(0,U),e.enqueue(dn(o,r.signature))}}}),r=this}};function rn(e,t,n,r,i,a){let{ctr:o,hmac:s,pending:c}=e,l=t.length-i;c.length&&(t=dn(c,t),n=fn(n,l-l%It));let u;for(u=0;u<=l-It;u+=It){let e=mn(W,G(t,u,u+It));a&&s.update(e);let i=o.update(e);a||s.update(i),n.set(pn(W,i),u+r)}return e.pending=G(t,u),n}async function an(e,t,n,r){let i=await sn(e,t,n,G(r,0,Wt[t])),a=G(r,Wt[t]);if(i[0]!=a[0]||i[1]!=a[1])throw Error(Mt)}async function on(e,t,n){let r=Ft(new Uint8Array(Wt[t]));return dn(r,await sn(e,t,n,r))}async function sn(e,t,n,r){e.password=null;let i=await cn(Lt,n,Vt,!1,Ut),a=await ln(Object.assign({salt:r},Ht),i,8*(Gt[t]*2+2)),o=new Uint8Array(a),s=mn(W,G(o,0,Gt[t])),c=mn(W,G(o,Gt[t],Gt[t]*2)),l=G(o,Gt[t]*2);return Object.assign(e,{keys:{key:s,authentication:c,passwordVerification:l},ctr:new Zt(new Xt(s),Array.from(Kt)),hmac:new Qt(c)}),l}async function cn(e,t,n,r,i){if($t)try{return await Jt.importKey(e,t,n,r,i)}catch{return $t=!1,At.importKey(t)}else return At.importKey(t)}async function ln(e,t,n){if(en)try{return await Jt.deriveBits(e,t,n)}catch{return en=!1,At.pbkdf2(t,e.salt,Ht.iterations,n)}else return At.pbkdf2(t,e.salt,Ht.iterations,n)}function un(e,t){return t===void 0?wt(e):t}function dn(e,t){let n=e;return e.length+t.length&&(n=new Uint8Array(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function fn(e,t){if(t&&t>e.length){let n=e;e=new Uint8Array(t),e.set(n,0)}return e}function G(e,t,n){return e.subarray(t,n)}function pn(e,t){return e.fromBits(t)}function mn(e,t){return e.toBits(t)}var hn=12,gn=class extends TransformStream{constructor({password:e,passwordVerification:t,checkPasswordOnly:n}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),bn(this,e)},transform(e,t){let r=this;if(r.password){let t=vn(r,e.subarray(0,hn));if(r.password=null,t.at(-1)!=r.passwordVerification)throw Error(Mt);e=e.subarray(hn)}n?t.error(Error(Pt)):t.enqueue(vn(r,e))}})}},_n=class extends TransformStream{constructor({password:e,passwordVerification:t}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),bn(this,e)},transform(e,t){let n=this,r,i;if(n.password){n.password=null;let t=Ft(new Uint8Array(hn));t[hn-1]=n.passwordVerification,r=new Uint8Array(e.length+t.length),r.set(yn(n,t),0),i=hn}else r=new Uint8Array(e.length),i=0;r.set(yn(n,e),i),t.enqueue(r)}})}};function vn(e,t){let n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=Sn(e)^t[r],xn(e,n[r]);return n}function yn(e,t){let n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=Sn(e)^t[r],xn(e,t[r]);return n}function bn(e,t){let n=[305419896,591751049,878082192];Object.assign(e,{keys:n,crcKey0:new St(n[0]),crcKey2:new St(n[2])});for(let n=0;n<t.length;n++)xn(e,t.charCodeAt(n))}function xn(e,t){let[n,r,i]=e.keys;e.crcKey0.append([t]),n=~e.crcKey0.get(),r=wn(Math.imul(wn(r+Cn(n)),134775813)+1),e.crcKey2.append([r>>>24]),i=~e.crcKey2.get(),e.keys=[n,r,i]}function Sn(e){let t=e.keys[2]|2;return Cn(Math.imul(t,t^1)>>>8)}function Cn(e){return e&255}function wn(e){return e&4294967295}var Tn=`Invalid uncompressed size`,En=`deflate-raw`,Dn=class extends TransformStream{constructor(e,{chunkSize:t,CompressionStream:n,CompressionStreamNative:r}){super({});let{compressed:i,encrypted:a,useCompressionStream:o,zipCrypto:s,signed:c,level:l}=e,u=this,d,f,p=super.readable;(!a||s)&&c&&(d=new Ct,p=K(p,d)),i&&(p=An(p,o,{level:l,chunkSize:t},r,n)),a&&(s?p=K(p,new _n(e)):(f=new nn(e),p=K(p,f))),kn(u,p,()=>{let e;a&&!s&&(e=f.signature),(!a||s)&&c&&(e=new DataView(d.value.buffer).getUint32(0)),u.signature=e})}},On=class extends TransformStream{constructor(e,{chunkSize:t,DecompressionStream:n,DecompressionStreamNative:r}){super({});let{zipCrypto:i,encrypted:a,signed:o,signature:s,compressed:c,useCompressionStream:l}=e,u,d,f=super.readable;a&&(i?f=K(f,new gn(e)):(d=new tn(e),f=K(f,d))),c&&(f=An(f,l,{chunkSize:t},r,n)),(!a||i)&&o&&(u=new Ct,f=K(f,u)),kn(this,f,()=>{if((!a||i)&&o&&s!=new DataView(u.value.buffer).getUint32(0,!1))throw Error(Nt)})}};function kn(e,t,n){t=K(t,new TransformStream({flush:n})),Object.defineProperty(e,"readable",{get(){return t}})}function An(e,t,n,r,i){try{e=K(e,new(t&&r?r:i)(En,n))}catch(r){if(t)e=K(e,new i(En,n));else throw r}return e}function K(e,t){return e.pipeThrough(t)}var jn=`message`,Mn=`start`,Nn=`data`,Pn=`close`,Fn=`inflate`,In=class extends TransformStream{constructor(e,t){super({});let n=this,{codecType:r}=e,i;r.startsWith(`deflate`)?i=Dn:r.startsWith(`inflate`)&&(i=On),n.outputSize=0;let a=0,o=new i(e,t),s=super.readable,c=new TransformStream({transform(e,t){e&&e.length&&(a+=e.length,t.enqueue(e))},flush(){Object.assign(n,{inputSize:a})}}),l=new TransformStream({transform(t,r){if(t&&t.length&&(r.enqueue(t),n.outputSize+=t.length,e.outputSize&&n.outputSize>e.outputSize))throw Error(Tn)},flush(){let{signature:e}=o;Object.assign(n,{signature:e,inputSize:a})}});Object.defineProperty(n,"readable",{get(){return s.pipeThrough(c).pipeThrough(o).pipeThrough(l)}})}},Ln=class extends TransformStream{constructor(e){let t;super({transform:n,flush(e){t&&t.length&&e.enqueue(t)}});function n(r,i){if(t){let e=new Uint8Array(t.length+r.length);e.set(t),e.set(r,t.length),r=e,t=null}r.length>e?(i.enqueue(r.slice(0,e)),n(r.slice(e),i)):t=r}}},Rn=typeof Worker!=pt,zn=class{constructor(e,{readable:t,writable:n},{options:r,config:i,streamOptions:a,useWebWorkers:o,transferStreams:s,scripts:c},l){let{signal:u}=a;return Object.assign(e,{busy:!0,readable:t.pipeThrough(new Ln(i.chunkSize)).pipeThrough(new Bn(a),{signal:u}),writable:n,options:Object.assign({},r),scripts:c,transferStreams:s,terminate(){return new Promise(t=>{let{worker:n,busy:r}=e;n?(r?e.resolveTerminated=t:(n.terminate(),t()),e.interface=null):t()})},onTaskFinished(){let{resolveTerminated:t}=e;t&&(e.resolveTerminated=null,e.terminated=!0,e.worker.terminate(),t()),e.busy=!1,l(e)}}),(o&&Rn?Un:Hn)(e,i)}},Bn=class extends TransformStream{constructor({onstart:e,onprogress:t,size:n,onend:r}){let i=0;super({async start(){e&&await Vn(e,n)},async transform(e,r){i+=e.length,t&&await Vn(t,i,n),r.enqueue(e)},async flush(){r&&await Vn(r,i)}})}};async function Vn(e,...t){try{await e(...t)}catch{}}function Hn(e,t){return{run:()=>Wn(e,t)}}function Un(e,t){let{baseURL:n,chunkSize:r}=t;if(!e.interface){let i;try{i=Yn(e.scripts[0],n,e)}catch{return Rn=!1,Hn(e,t)}Object.assign(e,{worker:i,interface:{run:()=>Gn(e,{chunkSize:r})}})}return e.interface}async function Wn({options:e,readable:t,writable:n,onTaskFinished:r},i){let a;try{a=new In(e,i),await t.pipeThrough(a).pipeTo(n,{preventClose:!0,preventAbort:!0});let{signature:r,inputSize:o,outputSize:s}=a;return{signature:r,inputSize:o,outputSize:s}}catch(e){throw a&&(e.outputSize=a.outputSize),e}finally{r()}}async function Gn(e,t){let n,r,i=new Promise((e,t)=>{n=e,r=t});Object.assign(e,{reader:null,writer:null,resolveResult:n,rejectResult:r,result:i});let{readable:a,options:o,scripts:s}=e,{writable:c,closed:l}=Kn(e.writable),u=Xn({type:Mn,scripts:s.slice(1),options:o,config:t,readable:a,writable:c},e);u||Object.assign(e,{reader:a.getReader(),writer:c.getWriter()});let d=await i;return u||await c.getWriter().close(),await l,d}function Kn(e){let t,n=new Promise(e=>t=e);return{writable:new WritableStream({async write(t){let n=e.getWriter();await n.ready,await n.write(t),n.releaseLock()},close(){t()},abort(t){return e.getWriter().abort(t)}}),closed:n}}var qn=!0,Jn=!0;function Yn(e,t,n){let r={type:`module`},i,a;typeof e==`function`&&(e=e());try{i=new URL(e,t)}catch{i=e}if(qn)try{a=new Worker(i)}catch{qn=!1,a=new Worker(i,r)}else a=new Worker(i,r);return a.addEventListener(jn,e=>Zn(e,n)),a}function Xn(e,{worker:t,writer:n,onTaskFinished:r,transferStreams:i}){try{let{value:n,readable:r,writable:a}=e,o=[];if(n&&(n.byteLength<n.buffer.byteLength?e.value=n.buffer.slice(0,n.byteLength):e.value=n.buffer,o.push(e.value)),i&&Jn?(r&&o.push(r),a&&o.push(a)):e.readable=e.writable=null,o.length)try{return t.postMessage(e,o),!0}catch{Jn=!1,e.readable=e.writable=null,t.postMessage(e)}else t.postMessage(e)}catch(e){throw n&&n.releaseLock(),r(),e}}async function Zn({data:e},t){let{type:n,value:r,messageId:i,result:a,error:o}=e,{reader:s,writer:c,resolveResult:l,rejectResult:u,onTaskFinished:d}=t;try{if(o){let{message:e,stack:t,code:n,name:r,outputSize:i}=o,a=Error(e);Object.assign(a,{stack:t,code:n,name:r,outputSize:i}),f(a)}else{if(n==`pull`){let{value:e,done:n}=await s.read();Xn({type:Nn,value:e,done:n,messageId:i},t)}n==`data`&&(await c.ready,await c.write(new Uint8Array(r)),Xn({type:`ack`,messageId:i},t)),n==`close`&&f(null,a)}}catch(e){Xn({type:Pn,messageId:i},t),f(e)}function f(e,t){e?u(e):l(t),c&&c.releaseLock(),d()}}var q=[],Qn=[],$n=0;async function er(e,t){let{options:n,config:r}=t,{transferStreams:i,useWebWorkers:a,useCompressionStream:o,codecType:s,compressed:c,signed:l,encrypted:u}=n,{workerScripts:d,maxWorkers:f}=r;return t.transferStreams=i||i===void 0,t.useWebWorkers=!(!c&&!l&&!u&&!t.transferStreams)&&(a||a===void 0&&r.useWebWorkers),t.scripts=t.useWebWorkers&&d?d[s]:[],n.useCompressionStream=o||o===void 0&&r.useCompressionStream,(await p()).run();async function p(){let n=q.find(e=>!e.busy);if(n)return nr(n),new zn(n,e,t,m);if(q.length<f){let n={indexWorker:$n};return $n++,q.push(n),new zn(n,e,t,m)}else return new Promise(n=>Qn.push({resolve:n,stream:e,workerOptions:t}))}function m(e){if(Qn.length){let[{resolve:t,stream:n,workerOptions:r}]=Qn.splice(0,1);t(new zn(e,n,r,m))}else e.worker?(nr(e),tr(e,t)):q=q.filter(t=>t!=e)}}function tr(e,t){let{config:n}=t,{terminateWorkerTimeout:r}=n;Number.isFinite(r)&&r>=0&&(e.terminated?e.terminated=!1:e.terminateTimeout=setTimeout(async()=>{q=q.filter(t=>t!=e);try{await e.terminate()}catch{}},r))}function nr(e){let{terminateTimeout:t}=e;t&&(clearTimeout(t),e.terminateTimeout=null)}async function rr(){await Promise.allSettled(q.map(e=>(nr(e),e.terminate())))}var ir=`HTTP error `,ar=`HTTP Range not supported`,or=`Writer iterator completed too soon`,sr=`Writer not initialized`,cr=`text/plain`,lr=`Content-Length`,ur=`Content-Range`,dr=`Accept-Ranges`,fr=`Range`,pr=`Content-Type`,mr=`HEAD`,hr=`GET`,gr=`bytes`,_r=64*1024,vr=`writable`,yr=class{constructor(){this.size=0}init(){this.initialized=!0}},J=class extends yr{get readable(){let e=this,{chunkSize:t=_r}=e,n=new ReadableStream({start(){this.chunkOffset=0},async pull(r){let{offset:i=0,size:a,diskNumberStart:o}=n,{chunkOffset:s}=this,c=a===void 0?t:Math.min(t,a-s),l=await Y(e,i+s,c,o);r.enqueue(l),s+t>a||a===void 0&&!l.length&&c?r.close():this.chunkOffset+=t}});return n}},br=class extends yr{constructor(){super();let e=this,t=new WritableStream({write(t){if(!e.initialized)throw Error(sr);return e.writeUint8Array(t)}});Object.defineProperty(e,vr,{get(){return t}})}writeUint8Array(){}},xr=class extends J{constructor(e){super();let t=e.length;for(;e.charAt(t-1)==`=`;)t--;let n=e.indexOf(`,`)+1;Object.assign(this,{dataURI:e,dataStart:n,size:Math.floor((t-n)*.75)})}readUint8Array(e,t){let{dataStart:n,dataURI:r}=this,i=new Uint8Array(t),a=Math.floor(e/3)*4,o=atob(r.substring(a+n,Math.ceil((e+t)/3)*4+n)),s=e-Math.floor(a/4)*3,c=0;for(let e=s;e<s+t&&e<o.length;e++)i[e-s]=o.charCodeAt(e),c++;return c<i.length?i.subarray(0,c):i}},Sr=class extends br{constructor(e){super(),Object.assign(this,{data:`data:`+(e||``)+`;base64,`,pending:[]})}writeUint8Array(e){let t=this,n=0,r=t.pending,i=t.pending.length;for(t.pending=``,n=0;n<Math.floor((i+e.length)/3)*3-i;n++)r+=String.fromCharCode(e[n]);for(;n<e.length;n++)t.pending+=String.fromCharCode(e[n]);r.length&&(r.length>2?t.data+=btoa(r):t.pending+=r)}getData(){return this.data+btoa(this.pending)}},Cr=class extends J{constructor(e){super(),Object.assign(this,{blob:e,size:e.size})}async readUint8Array(e,t){let n=this,r=e+t,i=await(e||r<n.size?n.blob.slice(e,r):n.blob).arrayBuffer();return i.byteLength>t&&(i=i.slice(e,r)),new Uint8Array(i)}},wr=class extends yr{constructor(e){super();let t=this,n=new TransformStream,r=[];e&&r.push([pr,e]),Object.defineProperty(t,vr,{get(){return n.writable}}),t.blob=new Response(n.readable,{headers:r}).blob()}getData(){return this.blob}},Tr=class extends Cr{constructor(e){super(new Blob([e],{type:cr}))}},Er=class extends wr{constructor(e){super(e),Object.assign(this,{encoding:e,utf8:!e||e.toLowerCase()==`utf-8`})}async getData(){let{encoding:e,utf8:t}=this,n=await super.getData();if(n.text&&t)return n.text();{let t=new FileReader;return new Promise((r,i)=>{Object.assign(t,{onload:({target:e})=>r(e.result),onerror:()=>i(t.error)}),t.readAsText(n,e)})}}},Dr=class extends J{constructor(e,t){super(),kr(this,e,t)}async init(){await Ar(this,Rr,Pr),super.init()}readUint8Array(e,t){return jr(this,e,t,Rr,Pr)}},Or=class extends J{constructor(e,t){super(),kr(this,e,t)}async init(){await Ar(this,zr,Fr),super.init()}readUint8Array(e,t){return jr(this,e,t,zr,Fr)}};function kr(e,t,n){let{preventHeadRequest:r,useRangeHeader:i,forceRangeRequests:a,combineSizeEocd:o}=n;n=Object.assign({},n),delete n.preventHeadRequest,delete n.useRangeHeader,delete n.forceRangeRequests,delete n.combineSizeEocd,delete n.useXHR,Object.assign(e,{url:t,options:n,preventHeadRequest:r,useRangeHeader:i,forceRangeRequests:a,combineSizeEocd:o})}async function Ar(e,t,n){let{url:r,preventHeadRequest:i,useRangeHeader:a,forceRangeRequests:o,combineSizeEocd:s}=e;if(Jr(r)&&(a||o)&&(i===void 0||i)){let r=await t(hr,e,Mr(e,s?-22:void 0));if(!o&&r.headers.get(dr)!=gr)throw Error(ar);{s&&(e.eocdCache=new Uint8Array(await r.arrayBuffer()));let i,a=r.headers.get(ur);if(a){let e=a.trim().split(/\s*\/\s*/);if(e.length){let t=e[1];t&&t!=`*`&&(i=Number(t))}}i===void 0?await Lr(e,t,n):e.size=i}}else await Lr(e,t,n)}async function jr(e,t,n,r,i){let{useRangeHeader:a,forceRangeRequests:o,eocdCache:s,size:c,options:l}=e;if(a||o){if(s&&t==c-22&&n==22)return s;if(t>=c)return new Uint8Array;{t+n>c&&(n=c-t);let i=await r(hr,e,Mr(e,t,n));if(i.status!=206)throw Error(ar);return new Uint8Array(await i.arrayBuffer())}}else{let{data:r}=e;return r||await i(e,l),new Uint8Array(e.data.subarray(t,t+n))}}function Mr(e,t=0,n=1){return Object.assign({},Nr(e),{[fr]:`bytes=`+(t<0?t:t+`-`+(t+n-1))})}function Nr({options:e}){let{headers:t}=e;if(t)return Symbol.iterator in t?Object.fromEntries(t):t}async function Pr(e){await Ir(e,Rr)}async function Fr(e){await Ir(e,zr)}async function Ir(e,t){let n=await t(hr,e,Nr(e));e.data=new Uint8Array(await n.arrayBuffer()),e.size||=e.data.length}async function Lr(e,t,n){if(e.preventHeadRequest)await n(e,e.options);else{let r=(await t(mr,e,Nr(e))).headers.get(lr);r?e.size=Number(r):await n(e,e.options)}}async function Rr(e,{options:t,url:n},r){let i=await fetch(n,Object.assign({},t,{method:e,headers:r}));if(i.status<400)return i;throw i.status==416?Error(ar):Error(ir+(i.statusText||i.status))}function zr(e,{url:t},n){return new Promise((r,i)=>{let a=new XMLHttpRequest;if(a.addEventListener(`load`,()=>{if(a.status<400){let e=[];a.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{let n=t.trim().split(/\s*:\s*/);n[0]=n[0].trim().replace(/^[a-z]|-[a-z]/g,e=>e.toUpperCase()),e.push(n)}),r({status:a.status,arrayBuffer:()=>a.response,headers:new Map(e)})}else i(a.status==416?Error(ar):Error(ir+(a.statusText||a.status)))},!1),a.addEventListener(`error`,e=>i(e.detail?e.detail.error:Error(`Network error`)),!1),a.open(e,t),n)for(let e of Object.entries(n))a.setRequestHeader(e[0],e[1]);a.responseType=`arraybuffer`,a.send()})}var Br=class extends J{constructor(e,t={}){super(),Object.assign(this,{url:e,reader:t.useXHR?new Or(e,t):new Dr(e,t)})}set size(e){}get size(){return this.reader.size}async init(){await this.reader.init(),super.init()}readUint8Array(e,t){return this.reader.readUint8Array(e,t)}},Vr=class extends Br{constructor(e,t={}){t.useRangeHeader=!0,super(e,t)}},Hr=class extends J{constructor(e){super(),e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Object.assign(this,{array:e,size:e.length})}readUint8Array(e,t){return this.array.slice(e,e+t)}},Ur=class extends br{init(e=0){Object.assign(this,{offset:0,array:new Uint8Array(e)}),super.init()}writeUint8Array(e){let t=this;if(t.offset+e.length>t.array.length){let n=t.array;t.array=new Uint8Array(n.length+e.length),t.array.set(n)}t.array.set(e,t.offset),t.offset+=e.length}getData(){return this.array}},Wr=class extends J{constructor(e){super(),this.readers=e}async init(){let e=this,{readers:t}=e;e.lastDiskNumber=0,e.lastDiskOffset=0,await Promise.all(t.map(async(n,r)=>{await n.init(),r!=t.length-1&&(e.lastDiskOffset+=n.size),e.size+=n.size})),super.init()}async readUint8Array(e,t,n=0){let r=this,{readers:i}=this,a,o=n;o==-1&&(o=i.length-1);let s=e;for(;i[o]&&s>=i[o].size;)s-=i[o].size,o++;let c=i[o];if(c){let i=c.size;if(s+t<=i)a=await Y(c,s,t);else{let o=i-s;a=new Uint8Array(t);let l=await Y(c,s,o);a.set(l,0);let u=await r.readUint8Array(e+o,t-o,n);a.set(u,o),l.length+u.length<t&&(a=a.subarray(0,l.length+u.length))}}else a=new Uint8Array;return r.lastDiskNumber=Math.max(o,r.lastDiskNumber),a}},Gr=class extends yr{constructor(e,t=4294967295){super();let n=this;Object.assign(n,{diskNumber:0,diskOffset:0,size:0,maxSize:t,availableSize:t});let r,i,a,o=new WritableStream({async write(t){let{availableSize:o}=n;if(a)t.length>=o?(await s(t.subarray(0,o)),await c(),n.diskOffset+=r.size,n.diskNumber++,a=null,await this.write(t.subarray(o))):await s(t);else{let{value:o,done:s}=await e.next();if(s&&!o)throw Error(or);r=o,r.size=0,r.maxSize&&(n.maxSize=r.maxSize),n.availableSize=n.maxSize,await Yr(r),i=o.writable,a=i.getWriter(),await this.write(t)}},async close(){await a.ready,await c()}});Object.defineProperty(n,vr,{get(){return o}});async function s(e){let t=e.length;t&&(await a.ready,await a.write(e),r.size+=t,n.size+=t,n.availableSize-=t)}async function c(){await a.close()}}},Kr=class{constructor(e){return Array.isArray(e)&&(e=new Wr(e)),e instanceof ReadableStream&&(e={readable:e}),e}},qr=class{constructor(e){return e.writable===void 0&&typeof e.next==`function`&&(e=new Gr(e)),e instanceof WritableStream&&(e={writable:e}),e.size===void 0&&(e.size=0),e instanceof Gr||Object.assign(e,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),e}};function Jr(e){let{baseURL:t}=_t(),{protocol:n}=new URL(e,t);return n==`http:`||n==`https:`}async function Yr(e,t){if(e.init&&!e.initialized)await e.init(t);else return Promise.resolve()}function Y(e,t,n,r){return e.readUint8Array(t,n,r)}var Xr=Wr,Zr=Gr,Qr=`\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ `.split(``),$r=Qr.length==256;function ei(e){if($r){let t=``;for(let n=0;n<e.length;n++)t+=Qr[e[n]];return t}else return new TextDecoder().decode(e)}function ti(e,t){return t&&t.trim().toLowerCase()==`cp437`?ei(e):new TextDecoder(t).decode(e)}var ni=`filename`,ri=`rawFilename`,ii=`comment`,ai=`rawComment`,oi=`uncompressedSize`,si=`compressedSize`,ci=`offset`,li=`diskNumberStart`,ui=`lastModDate`,di=`rawLastModDate`,fi=`lastAccessDate`,pi=`rawLastAccessDate`,mi=`creationDate`,hi=`rawCreationDate`,gi=[ni,ri,si,oi,ui,di,ii,ai,fi,mi,ci,li,li,`internalFileAttribute`,`internalFileAttributes`,`externalFileAttribute`,`externalFileAttributes`,`msDosCompatible`,`zip64`,`encrypted`,`version`,`versionMadeBy`,`zipCrypto`,`directory`,`executable`,`compressionMethod`,`signature`,`extraField`,`bitFlag`,`filenameUTF8`,`commentUTF8`,`rawExtraField`,`extraFieldZip64`,`extraFieldUnicodePath`,`extraFieldUnicodeComment`,`extraFieldAES`,`extraFieldNTFS`,`extraFieldExtendedTimestamp`],_i=class{constructor(e){gi.forEach(t=>this[t]=e[t])}},vi=`filenameEncoding`,yi=`commentEncoding`,bi=`extractPrependedData`,xi=`extractAppendedData`,Si=`password`,Ci=`rawPassword`,wi=`passThrough`,Ti=`signal`,Ei=`checkPasswordOnly`,Di=`checkOverlappingEntryOnly`,Oi=`checkOverlappingEntry`,ki=`useWebWorkers`,Ai=`useCompressionStream`,ji=`transferStreams`,Mi=`File format is not recognized`,Ni=`End of central directory not found`,Pi=`End of Zip64 central directory locator not found`,Fi=`Central directory header not found`,Ii=`Local file header not found`,Li=`Zip64 extra field not found`,Ri=`File contains encrypted entry`,zi=`Encryption method not supported`,Bi=`Compression method not supported`,Vi=`Split zip file`,Hi=`Overlapping entry found`,Ui=`utf-8`,Wi=`cp437`,Gi=[[oi,it],[si,it],[ci,it],[li,at]],Ki={[at]:{getValue:Q,bytes:4},[it]:{getValue:ca,bytes:8}},qi=class{constructor(e,t={}){Object.assign(this,{reader:new Kr(e),options:t,config:_t(),readRanges:[]})}async*getEntriesGenerator(e={}){let t=this,{reader:n}=t,{config:r}=t;if(await Yr(n),(n.size===void 0||!n.readUint8Array)&&(n=new Cr(await new Response(n.readable).blob()),await Yr(n)),n.size<22)throw Error(Mi);n.chunkSize=vt(r);let i=await ia(n,ot,n.size,22,at*16);if(!i)throw Q($(await Y(n,0,4)))==134695760?Error(Vi):Error(Ni);let a=$(i),o=Q(a,12),s=Q(a,16),c=i.offset,l=Z(a,20),u=c+22+l,d=Z(a,4),f=n.lastDiskNumber||0,p=Z(a,6),m=Z(a,8),h=0,g=0;if(s==4294967295||o==4294967295||m==65535||p==65535){let e=$(await Y(n,i.offset-20,20));if(Q(e,0)==117853008){s=ca(e,8);let t=await Y(n,s,56,-1),r=$(t),a=i.offset-20-56;if(Q(r,0)!=101075792&&s!=a){let e=s;s=a,s>e&&(h=s-e),t=await Y(n,s,56,-1),r=$(t)}if(Q(r,0)!=101075792)throw Error(Pi);d==65535&&(d=Q(r,16)),p==65535&&(p=Q(r,20)),m==65535&&(m=ca(r,32)),o==4294967295&&(o=ca(r,40)),s-=o}}if(s>=n.size&&(h=n.size-s-o-22,s=n.size-o-22),f!=d)throw Error(Vi);if(s<0)throw Error(Mi);let _=0,v=await Y(n,s,o,p),y=$(v);if(o){let e=i.offset-o;if(Q(y,_)!=33639248&&s!=e){let t=s;s=e,s>t&&(h+=s-t),v=await Y(n,s,o,p),y=$(v)}}let b=i.offset-s-(n.lastDiskOffset||0);if(o!=b&&b>=0&&(o=b,v=await Y(n,s,o,p),y=$(v)),s<0||s>=n.size)throw Error(Mi);let x=X(t,e,vi),S=X(t,e,yi);for(let i=0;i<m;i++){let a=new Yi(n,r,t.options);if(Q(y,_)!=33639248)throw Error(Fi);Xi(a,y,_+6);let o=!!a.bitFlag.languageEncodingFlag,s=_+46,c=s+a.filenameLength,l=c+a.extraFieldLength,u=Z(y,_+4),d=u>>8==0,f=u>>8==3,p=v.subarray(s,c),b=Z(y,_+32),C=l+b,w=v.subarray(l,C),T=o,E=o,D=Q(y,_+38),O=d&&(sa(y,_+38)&16)==16||f&&(D>>16&61440)==16384||p.length&&p.at(-1)==47,k=f&&(D>>16&73)!=0,ee=Q(y,_+42)+h;Object.assign(a,{versionMadeBy:u,msDosCompatible:d,compressedSize:0,uncompressedSize:0,commentLength:b,directory:O,offset:ee,diskNumberStart:Z(y,_+34),internalFileAttributes:Z(y,_+36),externalFileAttributes:D,rawFilename:p,filenameUTF8:T,commentUTF8:E,rawExtraField:v.subarray(c,l),executable:k}),a.internalFileAttribute=a.internalFileAttributes,a.externalFileAttribute=a.externalFileAttributes;let te=X(t,e,`decodeText`)||ti,ne=T?Ui:x||Wi,re=E?Ui:S||Wi,A=te(p,ne);A===void 0&&(A=ti(p,ne));let ie=te(w,re);ie===void 0&&(ie=ti(w,re)),Object.assign(a,{rawComment:w,filename:A,comment:ie,directory:O||A.endsWith(`/`)}),g=Math.max(ee,g),Zi(a,a,y,_+6),a.zipCrypto=a.encrypted&&!a.extraFieldAES;let j=new _i(a);j.getData=(e,n)=>a.getData(e,j,t.readRanges,n),j.arrayBuffer=async e=>{let n=new TransformStream,[r]=await Promise.all([new Response(n.readable).arrayBuffer(),a.getData(n,j,t.readRanges,e)]);return r},_=C;let{onprogress:ae}=e;if(ae)try{await ae(i+1,m,new _i(a))}catch{}yield j}let C=X(t,e,bi),w=X(t,e,xi);return C&&(t.prependedData=g>0?await Y(n,0,g):new Uint8Array),t.comment=l?await Y(n,c+22,l):new Uint8Array,w&&(t.appendedData=u<n.size?await Y(n,u,n.size-u):new Uint8Array),!0}async getEntries(e={}){let t=[];for await(let n of this.getEntriesGenerator(e))t.push(n);return t}async close(){}},Ji=class{constructor(e={}){let{readable:t,writable:n}=new TransformStream,r=new qi(t,e).getEntriesGenerator();this.readable=new ReadableStream({async pull(e){let{done:t,value:n}=await r.next();if(t)return e.close();let i={...n,readable:(function(){let{readable:e,writable:t}=new TransformStream;if(n.getData)return n.getData(t),e})()};delete i.getData,e.enqueue(i)}}),this.writable=n}},Yi=class{constructor(e,t,n){Object.assign(this,{reader:e,config:t,options:n})}async getData(e,t,n,r={}){let i=this,{reader:a,offset:o,diskNumberStart:s,extraFieldAES:c,extraFieldZip64:l,compressionMethod:u,config:d,bitFlag:f,signature:p,rawLastModDate:m,uncompressedSize:h,compressedSize:g}=i,{dataDescriptor:_}=f,v=t.localDirectory={},y=$(await Y(a,o,30,s)),b=X(i,r,Si),x=X(i,r,Ci),S=X(i,r,wi);if(b=b&&b.length&&b,x=x&&x.length&&x,c&&c.originalCompressionMethod!=99||u!=0&&u!=8&&!S)throw Error(Bi);if(Q(y,0)!=67324752)throw Error(Ii);Xi(v,y,4);let{extraFieldLength:C,filenameLength:w,lastAccessDate:T,creationDate:E}=v;v.rawExtraField=C?await Y(a,o+30+w,C,s):new Uint8Array,Zi(i,v,y,4,!0),Object.assign(t,{lastAccessDate:T,creationDate:E});let D=i.encrypted&&v.encrypted&&!S,O=D&&!c;if(S||(t.zipCrypto=O),D){if(!O&&c.strength===void 0)throw Error(zi);if(!b&&!x)throw Error(Ri)}let k=o+30+w+C,ee=g,te=a.readable;Object.assign(te,{diskNumberStart:s,offset:k,size:ee});let ne=X(i,r,Ti),re=X(i,r,Ei),A=X(i,r,Oi),ie=X(i,r,Di);ie&&(A=!0);let{onstart:j,onprogress:ae,onend:M}=r,N={options:{codecType:Fn,password:b,rawPassword:x,zipCrypto:O,encryptionStrength:c&&c.strength,signed:X(i,r,`checkSignature`)&&!S,passwordVerification:O&&(_?m>>>8&255:p>>>24&255),outputSize:h,signature:p,compressed:u!=0&&!S,encrypted:i.encrypted&&!S,useWebWorkers:X(i,r,ki),useCompressionStream:X(i,r,Ai),transferStreams:X(i,r,ji),checkPasswordOnly:re},config:d,streamOptions:{signal:ne,size:ee,onstart:j,onprogress:ae,onend:M}};A&&await ra({reader:a,fileEntry:t,offset:o,diskNumberStart:s,signature:p,compressedSize:g,uncompressedSize:h,dataOffset:k,dataDescriptor:_||v.bitFlag.dataDescriptor,extraFieldZip64:l||v.extraFieldZip64,readRanges:n});let oe;try{if(!ie){re&&(e=new WritableStream),e=new qr(e),await Yr(e,S?g:h),{writable:oe}=e;let{outputSize:t}=await er({readable:te,writable:oe},N);if(e.size+=t,t!=(S?g:h))throw Error(Tn)}}catch(t){if(t.outputSize!==void 0&&(e.size+=t.outputSize),!re||t.message!=`zipjs-abort-check-password`)throw t}finally{!X(i,r,`preventClose`)&&oe&&!oe.locked&&await oe.getWriter().close()}return re||ie?void 0:e.getData?e.getData():oe}};function Xi(e,t,n){let r=e.rawBitFlag=Z(t,n+2),i=(r&1)==1,a=Q(t,n+6);Object.assign(e,{encrypted:i,version:Z(t,n),bitFlag:{level:(r&6)>>1,dataDescriptor:(r&8)==8,languageEncodingFlag:(r&ft)==ft},rawLastModDate:a,lastModDate:aa(a),filenameLength:Z(t,n+22),extraFieldLength:Z(t,n+24)})}function Zi(e,t,n,r,i){let{rawExtraField:a}=t,o=t.extraField=new Map,s=$(new Uint8Array(a)),c=0;try{for(;c<a.length;){let e=Z(s,c),t=Z(s,c+2);o.set(e,{type:e,data:a.slice(c+4,c+4+t)}),c+=4+t}}catch{}let l=Z(n,r+4);Object.assign(t,{signature:Q(n,r+10),compressedSize:Q(n,r+14),uncompressedSize:Q(n,r+18)});let u=o.get(1);u&&(Qi(u,t),t.extraFieldZip64=u);let d=o.get(lt);d&&($i(d,ni,ri,t,e),t.extraFieldUnicodePath=d);let f=o.get(ut);f&&($i(f,ii,ai,t,e),t.extraFieldUnicodeComment=f);let p=o.get(st);p?(ea(p,t,l),t.extraFieldAES=p):t.compressionMethod=l;let m=o.get(10);m&&(ta(m,t),t.extraFieldNTFS=m);let h=o.get(ct);h&&(na(h,t,i),t.extraFieldExtendedTimestamp=h);let g=o.get(dt);g&&(t.extraFieldUSDZ=g)}function Qi(e,t){t.zip64=!0;let n=$(e.data),r=Gi.filter(([e,n])=>t[e]==n);for(let i=0,a=0;i<r.length;i++){let[o,s]=r[i];if(t[o]==s){let r=Ki[s];t[o]=e[o]=r.getValue(n,a),a+=r.bytes}else if(e[o])throw Error(Li)}}function $i(e,t,n,r,i){let a=$(e.data),o=new St;o.append(i[n]);let s=$(new Uint8Array(4));s.setUint32(0,o.get(),!0);let c=Q(a,1);Object.assign(e,{version:sa(a,0),[t]:ti(e.data.subarray(5)),valid:!i.bitFlag.languageEncodingFlag&&c==Q(s,0)}),e.valid&&(r[t]=e[t],r[t+`UTF8`]=!0)}function ea(e,t,n){let r=$(e.data),i=sa(r,4);Object.assign(e,{vendorVersion:sa(r,0),vendorId:sa(r,2),strength:i,originalCompressionMethod:n,compressionMethod:Z(r,5)}),t.compressionMethod=e.compressionMethod}function ta(e,t){let n=$(e.data),r=4,i;try{for(;r<e.data.length&&!i;){let t=Z(n,r),a=Z(n,r+2);t==1&&(i=e.data.slice(r+4,r+4+a)),r+=4+a}}catch{}try{if(i&&i.length==24){let n=$(i),r=n.getBigUint64(0,!0),a=n.getBigUint64(8,!0),o=n.getBigUint64(16,!0);Object.assign(e,{rawLastModDate:r,rawLastAccessDate:a,rawCreationDate:o});let s={lastModDate:oa(r),lastAccessDate:oa(a),creationDate:oa(o)};Object.assign(e,s),Object.assign(t,s)}}catch{}}function na(e,t,n){let r=$(e.data),i=sa(r,0),a=[],o=[];n?((i&1)==1&&(a.push(ui),o.push(di)),(i&2)==2&&(a.push(fi),o.push(pi)),(i&4)==4&&(a.push(mi),o.push(hi))):e.data.length>=5&&(a.push(ui),o.push(di));let s=1;a.forEach((n,i)=>{if(e.data.length>=s+4){let a=Q(r,s);t[n]=e[n]=new Date(a*1e3);let c=o[i];e[c]=a}s+=4})}async function ra({reader:e,fileEntry:t,offset:n,diskNumberStart:r,signature:i,compressedSize:a,uncompressedSize:o,dataOffset:s,dataDescriptor:c,extraFieldZip64:l,readRanges:u}){let d=0;if(r)for(let t=0;t<r;t++){let n=e.readers[t];d+=n.size}let f=0;if(c&&(f=l?20:12),f){let n=await Y(e,s+a,f+4,r);if(Q($(n),0)==134695760){let e=Q($(n),4),r,s;l?(r=ca($(n),8),s=ca($(n),16)):(r=Q($(n),8),s=Q($(n),12)),(t.encrypted&&!t.zipCrypto||e==i)&&r==a&&s==o&&(f+=4)}}let p={start:d+n,end:d+s+a+f,fileEntry:t};for(let e of u)if(e.fileEntry!=t&&p.start>=e.start&&p.start<e.end){let t=Error(Hi);throw t.overlappingEntry=e.fileEntry,t}u.push(p)}async function ia(e,t,n,r,i){let a=new Uint8Array(4);la($(a),0,t);let o=r+i;return await s(r)||await s(Math.min(o,n));async function s(t){let i=n-t,o=await Y(e,i,t);for(let e=o.length-r;e>=0;e--)if(o[e]==a[0]&&o[e+1]==a[1]&&o[e+2]==a[2]&&o[e+3]==a[3])return{offset:i+e,buffer:o.slice(e,e+r).buffer}}}function X(e,t,n){return t[n]===void 0?e.options[n]:t[n]}function aa(e){let t=(e&4294901760)>>16,n=e&65535;try{return new Date(1980+((t&65024)>>9),((t&480)>>5)-1,t&31,(n&63488)>>11,(n&2016)>>5,(n&31)*2,0)}catch{}}function oa(e){return new Date(Number(e/BigInt(1e4)-BigInt(0xa9730b66800)))}function sa(e,t){return e.getUint8(t)}function Z(e,t){return e.getUint16(t,!0)}function Q(e,t){return e.getUint32(t,!0)}function ca(e,t){return Number(e.getBigUint64(t,!0))}function la(e,t,n){e.setUint32(t,n,!0)}function $(e){return new DataView(e.buffer)}var ua=t({BlobReader:()=>Cr,BlobWriter:()=>wr,Data64URIReader:()=>xr,Data64URIWriter:()=>Sr,ERR_BAD_FORMAT:()=>Mi,ERR_CENTRAL_DIRECTORY_NOT_FOUND:()=>Fi,ERR_ENCRYPTED:()=>Ri,ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND:()=>Pi,ERR_EOCDR_NOT_FOUND:()=>Ni,ERR_EXTRAFIELD_ZIP64_NOT_FOUND:()=>Li,ERR_HTTP_RANGE:()=>ar,ERR_INVALID_PASSWORD:()=>Mt,ERR_INVALID_SIGNATURE:()=>Nt,ERR_INVALID_UNCOMPRESSED_SIZE:()=>Tn,ERR_ITERATOR_COMPLETED_TOO_SOON:()=>or,ERR_LOCAL_FILE_HEADER_NOT_FOUND:()=>Ii,ERR_OVERLAPPING_ENTRY:()=>Hi,ERR_SPLIT_ZIP_FILE:()=>Vi,ERR_UNSUPPORTED_COMPRESSION:()=>Bi,ERR_UNSUPPORTED_ENCRYPTION:()=>zi,ERR_WRITER_NOT_INITIALIZED:()=>sr,GenericReader:()=>Kr,GenericWriter:()=>qr,HttpRangeReader:()=>Vr,HttpReader:()=>Br,Reader:()=>J,SplitDataReader:()=>Wr,SplitDataWriter:()=>Gr,SplitZipReader:()=>Xr,SplitZipWriter:()=>Zr,TextReader:()=>Tr,TextWriter:()=>Er,Uint8ArrayReader:()=>Hr,Uint8ArrayWriter:()=>Ur,Writer:()=>br,ZipReader:()=>qi,ZipReaderStream:()=>Ji,configure:()=>yt,getMimeType:()=>bt,initStream:()=>Yr,readUint8Array:()=>Y,terminateWorkers:()=>rr});yt({Inflate:rt});var da=ua,fa=class{constructor(e,t){da.configure({baseURL:self.location.href}),this._zipReader=new da.ZipReader(new da.HttpReader(this._resolveTraceURI(e),{mode:`cors`,preventHeadRequest:!0}),{useWebWorkers:!1}),this._entriesPromise=this._zipReader.getEntries({onprogress:t}).then(e=>{let t=new Map;for(let n of e)t.set(n.filename,n);return t})}_resolveTraceURI(e){return e.startsWith(`https://www.dropbox.com/`)?`https://dl.dropboxusercontent.com/`+e.substring(24):e}isLive(){return!1}async entryNames(){return[...(await this._entriesPromise).keys()]}async hasEntry(e){return(await this._entriesPromise).has(e)}async readText(e){let t=(await this._entriesPromise).get(e);if(!t)return;let n=new da.TextWriter;return await t.getData?.(n),n.getData()}async readBlob(e){let t=(await this._entriesPromise).get(e);if(!t)return;let n=new da.BlobWriter;return await t.getData(n),n.getData()}},pa=class{constructor(e){this._entriesPromise=this._readFile(e).then(async e=>{if(!e)throw Error(`File not found`);let t=await e.json(),n=new Map;for(let e of t.entries)n.set(e.name,e.path);return n})}isLive(){return!0}async entryNames(){return[...(await this._entriesPromise).keys()]}async hasEntry(e){return(await this._entriesPromise).has(e)}async readText(e){return(await this._readEntry(e))?.text()}async readBlob(e){let t=await this._readEntry(e);return t?.status===200?await t?.blob():void 0}async _readEntry(e){let t=(await this._entriesPromise).get(e);if(t)return this._readFile(t)}async _readFile(e){let t=await fetch(e);if(t.status!==404)return t}};self.addEventListener(`install`,function(e){self.skipWaiting()}),self.addEventListener(`activate`,function(e){e.waitUntil(self.clients.claim())});var ma=new URL(self.registration.scope).pathname,ha=new Map,ga=new Map,_a=self.registration.scope.startsWith(`https://`);function va(){ha.clear(),ga.clear()}async function ya(e,t,n){try{return{loadedTrace:await ba(e,t,n)}}catch(e){return{errorResponse:new Response(JSON.stringify({error:e?.message}),{status:500,headers:{"Content-Type":`application/json`}})}}}function ba(e,t,n){let r=t.searchParams.get(`trace`);if(!r)throw Error(`trace parameter is missing`);ga.set(e,r);let i=ha.get(r);if(i)return i;let a=xa(r,n);return ha.set(r,a),a.catch(()=>ha.delete(r)),a}async function xa(e,t){await Ta();let n=new re;try{let[r,i]=j(t,[.5,.4,.1]),a=Oa(e)||e.endsWith(`traces.dir`)?new pa(e):new fa(e,r);await n.load(a,void 0,i)}catch(t){if(console.error(t),t?.message?.includes(`Cannot find .trace file`)&&await n.hasEntry(`index.html`))throw Error(`Could not load trace. Did you upload a Playwright HTML report instead? Make sure to extract the archive first and then double-click the index.html file or put it on a web server.`);if(t instanceof k)throw Error(`Could not load trace from ${e}. ${t.message}`);let r=`Could not load trace from ${e}. Make sure a valid Playwright Trace is accessible over this url.`,i=await navigator.permissions.query({name:`local-network-access`}).catch(()=>{});throw i&&i.state!==`granted`&&(r+=`
If your trace is in a local or private network, please grant permission for Local Network Access.`),Error(r)}return{traceLoader:n,snapshotServer:new i(n.storage(),e=>n.resourceEntry(e))}}async function Sa(e){let t=e.request;if(t.url.startsWith(`chrome-extension://`))return fetch(t);let n=new URL(t.url),r;if(t.url.startsWith(self.registration.scope)&&(r=n.pathname.substring(ma.length-1)),r===`/restartServiceWorker`)return va(),new Response(null,{status:200});if(r===`/ping`)return new Response(null,{status:200});if(r===`/coverage`)return new Response(JSON.stringify(Ca()),{status:200,headers:{"Content-Type":`application/json`}});let i=!!e.resultingClientId,a=e.clientId?await self.clients.get(e.clientId):void 0;if(i&&!r?.startsWith(`/file/`)){if(r?.startsWith(`/snapshot/`)){let{errorResponse:t,loadedTrace:i}=await ya(e.resultingClientId,n,Da);if(t)return t;let a=decodeURIComponent(r.substring(10)),o=i.snapshotServer.serveSnapshot(a,n.searchParams,n.href);return _a&&o.headers.append(`Content-Security-Policy`,`upgrade-insecure-requests`),o}return fetch(e.request)}if(!r){if(!a)return new Response(`Sub-resource without a client`,{status:500});let{snapshotServer:e}=await ba(a.id,new URL(a.url),Ea(a));if(!e)return new Response(null,{status:404});let n=[t.url];return _a&&t.url.startsWith(`https://`)&&n.push(t.url.replace(/^https/,`http`)),e.serveResource(n,t.method,a.url)}if(r===`/contexts`||r.startsWith(`/snapshotInfo/`)||r.startsWith(`/closest-screenshot/`)||r.startsWith(`/file/`)){if(!a)return new Response(`Sub-resource without a client`,{status:500});let{errorResponse:e,loadedTrace:t}=await ya(a.id,n,Ea(a));if(e)return e;if(r===`/contexts`)return new Response(JSON.stringify(t.traceLoader.contextEntries),{status:200,headers:{"Content-Type":`application/json`}});if(r.startsWith(`/snapshotInfo/`)){let e=decodeURIComponent(r.substring(14));return t.snapshotServer.serveSnapshotInfo(e,n.searchParams)}if(r.startsWith(`/closest-screenshot/`)){let e=decodeURIComponent(r.substring(20));return t.snapshotServer.serveClosestScreenshot(e,n.searchParams)}if(r.startsWith(`/file/`)){let e=await t.traceLoader.resourceEntry(r.slice(6));return e?new Response(e,{status:200,headers:wa(n.searchParams)}):new Response(null,{status:404})}}return fetch(e.request)}function Ca(){let e=self.__coverage__||{},t=JSON.parse(JSON.stringify(e));for(let t of Object.values(e))n(t.s),n(t.f),r(t.b);return t}function wa(e){let t=e.get(`dn`),n=e.get(`dct`);if(!t)return;let r=new Headers;return r.set(`Content-Disposition`,`attachment; filename="attachment"; filename*=UTF-8''${encodeURIComponent(t)}`),n&&r.set(`Content-Type`,n),r}async function Ta(){let e=await self.clients.matchAll(),t=new Set;for(let[n,r]of ga){if(!e.find(e=>e.id===n)){ga.delete(n);continue}t.add(r)}for(let e of ha.keys())t.has(e)||ha.delete(e)}function Ea(e){return(t,n)=>{e.postMessage({method:`progress`,params:{done:t,total:n}})}}function Da(e,t){}function Oa(e){return!!new URL(e,`http://localhost`).searchParams.get(`path`)?.endsWith(`.json`)}self.addEventListener(`fetch`,function(e){if(e.request.headers.get(`x-pw-serviceworker`)===`skip`)return!1;e.respondWith(Sa(e))});