!function(){"use strict";const t=8388608,e=0,n=[e],r=Symbol(),o=new TextEncoder,a=new TextDecoder,s=new Array(256);let i=0;function c(t,e,r,o){if(void 0===o){if(i++,!(s.length-i>=n.length))throw new Error("Reached maximum number of custom types");s[s.length-i]={serialize:t,parse:e,test:r}}else s[o]={serialize:t,parse:e,test:r}}async function l(t,e){const n=f(t,e);let r=new Uint8Array([]);for await(const t of n){const e=r;r=new Uint8Array(e.length+t.length),r.set(e,0),r.set(t,e.length)}return r}c((async function(t,e){const n=t.objects.indexOf(e);await m(t,n)}),(async function(t){const e=await S(t);return new b(e,t)}),P,e),c(null,(function(){return{}}),L),c(p,T,U),c(h,I,(function(t){return"string"==typeof t})),c(y,(async function(t){const e=await S(t),n=await t.consume(8*e);return new Float64Array(n.buffer)}),(function(t){return"Float64Array"==t.constructor.name})),c(y,(async function(t){const e=await S(t),n=await t.consume(4*e);return new Float32Array(n.buffer)}),(function(t){return"Float32Array"==t.constructor.name})),c(y,(async function(t){const e=await S(t),n=await t.consume(4*e);return new Uint32Array(n.buffer)}),(function(t){return"Uint32Array"==t.constructor.name})),c(y,(async function(t){const e=await S(t),n=await t.consume(4*e);return new Int32Array(n.buffer)}),(function(t){return"Int32Array"==t.constructor.name})),c(y,(async function(t){const e=await S(t),n=await t.consume(2*e);return new Uint16Array(n.buffer)}),(function(t){return"Uint16Array"==t.constructor.name})),c(y,(async function(t){const e=await S(t),n=await t.consume(2*e);return new Int16Array(n.buffer)}),(function(t){return"Int16Array"==t.constructor.name})),c(y,(async function(t){const e=await S(t),n=await t.consume(e);return new Uint8ClampedArray(n.buffer)}),(function(t){return"Uint8ClampedArray"==t.constructor.name})),c(y,(async function(t){const e=await S(t);return await t.consume(e)}),(function(t){return"Uint8Array"==t.constructor.name})),c(y,(async function(t){const e=await S(t),n=await t.consume(e);return new Int8Array(n.buffer)}),(function(t){return"Int8Array"==t.constructor.name})),c((async function(t,e){await m(t,e.byteLength),await t.append(new Uint8Array(e))}),(async function(t){const e=await S(t);return(await t.consume(e)).buffer}),(function(t){return"ArrayBuffer"==t.constructor.name})),c(g,C,k),c((async function(t,e){const n=new Uint8Array(new Uint32Array([e]).buffer);await t.append(n)}),(async function(t){const e=await t.consume(4);return new Uint32Array(e.buffer)[0]}),(function(t){return O(t)&&t>=0&&t<=4294967295})),c((async function(t,e){const n=new Uint8Array(new Int32Array([e]).buffer);await t.append(n)}),(async function(t){const e=await t.consume(4);return new Int32Array(e.buffer)[0]}),(function(t){return O(t)&&t>=-2147483648&&t<=2147483647})),c((async function(t,e){const n=new Uint8Array(new Uint16Array([e]).buffer);await t.append(n)}),(async function(t){const e=await t.consume(2);return new Uint16Array(e.buffer)[0]}),(function(t){return O(t)&&t>=0&&t<=65535})),c((async function(t,e){const n=new Uint8Array(new Int16Array([e]).buffer);await t.append(n)}),(async function(t){const e=await t.consume(2);return new Int16Array(e.buffer)[0]}),(function(t){return O(t)&&t>=-32768&&t<=32767})),c((async function(t,e){const n=new Uint8Array([e]);await t.append(n)}),(async function(t){const e=await t.consume(1);return new Uint8Array(e.buffer)[0]}),(function(t){return O(t)&&t>=0&&t<=255})),c((async function(t,e){const n=new Uint8Array(new Int8Array([e]).buffer);await t.append(n)}),(async function(t){const e=await t.consume(1);return new Int8Array(e.buffer)[0]}),(function(t){return O(t)&&t>=-128&&t<=127})),c(null,(function(){return}),(function(t){return void 0===t})),c(null,(function(){return null}),(function(t){return null===t})),c(null,(function(){return NaN}),(function(t){return Number.isNaN(t)})),c(w,x,(function(t){return"boolean"==typeof t})),c((async function(t,e){await h(t,e.description)}),(async function(t){const e=await I(t);return Symbol(e)}),N),c(null,(function(){return r}),D),c((async function(t,e){const n=e.entries();await m(t,e.size);for(const[e,r]of n)await m(t,e),await m(t,r)}),(async function(t){const e=await S(t),n=new Map;e&&await async function r(o=0){const a=await S(t),s=await S(t);t.setObject([a,s],((t,e)=>n.set(t,e))),on.add(t))),othis.value.length){const e=this.value.length-this.offset;await this.append(new Uint8Array(t).subarray(0,e)),await this.appendData({value:this.value}),this.offset=0,await this.append(new Uint8Array(t).subarray(e))}else this.value.set(t,this.offset),this.offset+=t.length}async flush(){this.offset&&await this.appendData({value:new Uint8Array(this.value).subarray(0,this.offset),done:!0})}}function f(e,{chunkSize:n=t}={}){let r,o,a,s,i,c;return{[Symbol.asyncIterator]:()=>({next:()=>s?{done:s}:async function(){c?c():l().catch((()=>{}));i=new Promise((t=>c=t));const t=await async function(){const{value:t,done:e}=await o;s=e,e||u();return t}();return{value:t}}(),return:()=>({done:!0})})};async function l(){u(),r=new d(f,n),await m(r,e),await r.flush()}function u(){o=new Promise((t=>a=t))}async function f(t){a(t),await i}}async function m(t,n){const r=s.findIndex((({test:e}={})=>e&&e(n,t)));t.addObject(n),await t.append(new Uint8Array([r]));const o=s[r].serialize;o&&await o(t,n),r!=e&&L(n)&&(await async function(t,e){const n=Object.getOwnPropertySymbols(e),r=n.map((t=>[t,e[t]]));await p(t,r)}(t,n),await async function(t,e){if(ArrayBuffer.isView(e))await m(t,0);else{let n=Object.entries(e);U(e)&&(n=n.filter((([t])=>!O(Number(t))))),await m(t,n.length);for(const[e,r]of n)await h(t,e),await m(t,r)}}(t,n))}async function p(t,e){await m(t,e.length);const n=Object.keys(e).filter((t=>O(Number(t)))).map((t=>Number(t)));let o=0,a=n[o];for(const[s,i]of e.entries())a==s?(a=n[++o],await m(t,i)):await m(t,r)}async function h(t,e){const n=o.encode(e);await m(t,n.length),await t.append(n)}async function y(t,e){await m(t,e.length),await t.append("Uint8Array"==e.constructor.name?e:new Uint8Array(e.buffer))}async function g(t,e){const n=new Uint8Array(new Float64Array([e]).buffer);await t.append(n)}async function w(t,e){const n=new Uint8Array([Number(e)]);await t.append(n)}class b{constructor(t,e){this.index=t,this.data=e}getObject(){return this.data.objects[this.index]}}class A{constructor(t){this.stream=new E(t),this.objects=[],this.setters=[]}consume(t){return this.stream.consume(t)}getObjectId(){const t=this.objects.length;return this.objects.push(void 0),t}resolveObject(t,e){B(e)&&!R(e)&&(this.objects[t]=e)}setObject(t,e){this.setters.push({functionArguments:t,setterFunction:e})}executeSetters(){this.setters.forEach((({functionArguments:t,setterFunction:e})=>{e(...t.map((t=>R(t)?t.getObject():t)))}))}}class E{constructor(t){this.offset=0,this.value=new Uint8Array(0),this.consumeData=t}async consume(t){if(this.offset+t>this.value.length){const e=new Uint8Array(this.value).subarray(this.offset,this.value.length),n=await this.consumeData();return e.length+n.length!=this.value.length&&(this.value=new Uint8Array(e.length+n.length)),this.value.set(e),this.value.set(n,e.length),this.offset=0,this.consume(t)}{const e=this.value.slice(this.offset,this.offset+t);return this.offset+=e.length,e}}}function v(){let t,e,n,r,o,a;return{next:async e=>e?async function(e){o?await o:async function(){let e;r=new Promise((t=>e=t)),t=new A(i),s();const n=await S(t);t.executeSetters(),e(n)}().catch((()=>{}));return function(){o=new Promise((t=>a=t))}(),n(e),{done:!1}}(e):{value:await r,done:!0},return:()=>({done:!0})};function s(){e=new Promise((t=>n=t))}async function i(){const t=await e;return s(),a&&a(),t}}async function S(t){const n=(await t.consume(1))[0],r=s[n].parse,o=t.getObjectId(),a=await r(t);return n!=e&&L(a)&&(await async function(t,e){const n=await T(t);t.setObject([n],(t=>t.forEach((([t,n])=>e[t]=n))))}(t,a),await async function(t,e){const n=await S(t);n&&await r();async function r(o=0){const a=await I(t),s=await S(t);t.setObject([s],(t=>e[a]=t)),on[o]=t));on.style.setProperty(t,"initial","important"))),n}(t),s=a.attachShadow({mode:"open"}),i=document.createElement("style");i.textContent="\n\t\t\t\t.container {\n\t\t\t\t\tbackground-color: #ff6c00;\n\t\t\t\t\tcolor: white;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tposition: fixed;\n\t\t\t\t\ttop: 0px;\n\t\t\t\t\tleft: 0px;\n\t\t\t\t\tright: 0px;\n\t\t\t\t\theight: auto;\n\t\t\t\t\twidth: auto;\n\t\t\t\t\tmin-height: 24px;\n\t\t\t\t\tmin-width: 24px;\t\t\t\t\t\n\t\t\t\t\tz-index: 2147483647;\n\t\t\t\t\tmargin: 0;\n\t\t\t\t\tpadding: 2px;\n\t\t\t\t\tfont-family: Arial;\n\t\t\t\t}\n\t\t\t\t.singlefile-open-file-bar.container, .singlefile-share-page-bar.container {\n\t\t\t\t\tbackground-color: gainsboro;\n\t\t\t\t\tborder-block-end: gray 1px solid;\n\t\t\t\t}\n\t\t\t\t.text {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\tpadding-top: 4px;\n\t\t\t\t\tpadding-bottom: 4px;\n\t\t\t\t\tpadding-left: 8px;\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tbutton {\n\t\t\t\t\tbackground-color: grey;\n\t\t\t\t\tcolor: white;\n\t\t\t\t\tborder: 1px solid darkgrey;\n\t\t\t\t\tpadding: 3px;\n\t\t\t\t\tpadding-left: 8px;\n\t\t\t\t\tpadding-right: 8px;\n\t\t\t\t\tborder-radius: 4px;\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t}\n\t\t\t\t.close-button {\n\t\t\t\t\topacity: .7;\n\t\t\t\t\tpadding-left: 8px;\n\t\t\t\t\tpadding-right: 8px;\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t\ttransition: opacity 250ms;\n\t\t\t\t\theight: 16px;\n\t\t\t\t\tfont-size: .8rem;\n\t\t\t\t\talign-self: center;\n\t\t\t\t}\n\t\t\t\t.singlefile-open-file-bar button, .singlefile-share-page-bar button{\n\t\t\t\t\tbackground-color: dimgrey;\n\t\t\t\t}\n\t\t\t\t.singlefile-open-file-bar .close-button, .singlefile-share-page-bar .close-button{\n\t\t\t\t\tfilter: invert(1);\n\t\t\t\t}\n\t\t\t\ta {\n\t\t\t\t\tcolor: #303036;\n\t\t\t\t}\n\t\t\t\t.close-button:hover {\n\t\t\t\t\topacity: 1;\n\t\t\t\t}\n\t\t\t",s.appendChild(i);const c=document.createElement("div");c.classList.add(t),c.classList.add("container");const l=document.createElement("span");l.classList.add("text");const d=e.split("__DOC_LINK__");if(l.textContent=d[0],n&&2==d.length){const t=document.createElement("a");t.textContent=n,t.href=n,t.target="_blank",l.appendChild(t),l.appendChild(document.createTextNode(d[1]))}if(r&&o){const t=document.createElement("button");t.textContent=r,t.onclick=()=>o(),l.appendChild(t)}c.appendChild(l);const u=document.createElement("img");u.classList.add("close-button"),c.appendChild(u),s.appendChild(c),u.src=F,u.onclick=t=>{0===t.button&&(o&&o(!0),a.remove())},document.documentElement.appendChild(a)}}catch(t){}}const Y=16777216;let K,$,tt,et,nt;try{K=browser.i18n.getMessage("topPanelEmbeddedImageButton"),$=browser.i18n.getMessage("topPanelSharePageButton"),tt=browser.i18n.getMessage("topPanelShareSelectionButton"),et=browser.i18n.getMessage("topPanelError")}catch(t){}async function rt(t,e){e.includeBOM&&(t.content="\ufeff"+t.content);const n=e.embeddedImage,r={method:"downloads.download",taskId:e.taskId,insertTextBody:e.insertTextBody,confirmFilename:e.confirmFilename,filenameConflictAction:e.filenameConflictAction,filename:t.filename,mimeType:t.mimeType,saveToClipboard:e.saveToClipboard,saveToGDrive:e.saveToGDrive,saveToDropbox:e.saveToDropbox,saveWithWebDAV:e.saveWithWebDAV,webDAVURL:e.webDAVURL,webDAVUser:e.webDAVUser,webDAVPassword:e.webDAVPassword,saveToGitHub:e.saveToGitHub,githubToken:e.githubToken,githubUser:e.githubUser,githubRepository:e.githubRepository,githubBranch:e.githubBranch,saveWithCompanion:e.saveWithCompanion,forceWebAuthFlow:e.forceWebAuthFlow,filenameReplacementCharacter:e.filenameReplacementCharacter,openEditor:e.openEditor,openSavedPage:e.openSavedPage,compressHTML:e.compressHTML,backgroundSave:e.backgroundSave,bookmarkId:e.bookmarkId,replaceBookmarkURL:e.replaceBookmarkURL,applySystemTheme:e.applySystemTheme,defaultEditorMode:e.defaultEditorMode,includeInfobar:e.includeInfobar,warnUnsavedPage:e.warnUnsavedPage,createRootDirectory:e.createRootDirectory,selfExtractingArchive:e.selfExtractingArchive,embeddedImage:n?Array.from(n):null,preventAppendedData:e.preventAppendedData,extractDataFromPage:e.extractDataFromPage,insertCanonicalLink:e.insertCanonicalLink,insertMetaNoIndex:e.insertMetaNoIndex,insertMetaCSP:e.insertMetaCSP,password:e.password,compressContent:e.compressContent,foregroundSave:e.foregroundSave,sharePage:e.sharePage,saveToRestFormApi:e.saveToRestFormApi,saveToRestFormApiUrl:e.saveToRestFormApiUrl,saveToRestFormApiFileFieldName:e.saveToRestFormApiFileFieldName,saveToRestFormApiUrlFieldName:e.saveToRestFormApiUrlFieldName,saveToRestFormApiToken:e.saveToRestFormApiToken},o=setInterval((()=>{browser.runtime.sendMessage({method:"ping"}).then((()=>{}))}),15e3);if(e.compressContent){const o=new Blob([await l(t)],{type:t.mimeType}),a=URL.createObjectURL(o);r.blobURL=a;const s=await browser.runtime.sendMessage(r);if(URL.revokeObjectURL(a),s.error){r.embeddedImage=n,r.blobURL=null,r.pageData=t;const e=f(r);for await(const t of e)await browser.runtime.sendMessage({method:"downloads.download",compressContent:!0,data:Array.from(t)});await browser.runtime.sendMessage({method:"downloads.download",compressContent:!0,mimeType:t.mimeType})}e.backgroundSave&&await browser.runtime.sendMessage({method:"downloads.end",taskId:e.taskId})}else{if(e.backgroundSave&&!e.sharePage||e.openEditor||e.saveToGDrive||e.saveToGitHub||e.saveWithCompanion||e.saveWithWebDAV||e.saveToDropbox||e.saveToRestFormApi){const e=URL.createObjectURL(new Blob([t.content],{type:t.mimeType}));r.blobURL=e;const n=await browser.runtime.sendMessage(r);if(URL.revokeObjectURL(e),n.error){r.blobURL=null;for(let e=0;e*YY,r.truncated?(r.finished=(e+1)*Y>t.content.length,r.content=t.content.substring(e*Y,(e+1)*Y)):r.content=t.content,await browser.runtime.sendMessage(r)}}else e.saveToClipboard?function(t){const e="copy";function n(e){e.clipboardData.setData(t.mimeType,t.content),e.clipboardData.setData("text/plain",t.content),e.preventDefault()}document.addEventListener(e,n),document.execCommand(e),document.removeEventListener(e,n)}(t):await ot(t,e),e.openSavedPage&&open(URL.createObjectURL(new Blob([t.content],{type:t.mimeType}))),browser.runtime.sendMessage({method:"ui.processEnd"});await browser.runtime.sendMessage({method:"downloads.end",taskId:e.taskId,hash:t.hash,woleetKey:e.woleetKey})}clearInterval(o)}async function ot(t,e){if(Array.isArray(t.content)&&(t.content=new Uint8Array(t.content)),e.sharePage&&navigator.share)await at(t,e);else if(t.filename&&t.filename.length){const e=document.createElement("a");return e.download=t.filename,e.href=URL.createObjectURL(new Blob([t.content],{type:t.mimeType})),e.dispatchEvent(new MouseEvent("click")),new Promise((t=>setTimeout((()=>{URL.revokeObjectURL(e.href),t()}),1e3)))}}async function at(t,e){nt=function(){let t;return{display:async function(e){return new Promise((n=>{t=n,J(H,"",{buttonLabel:e?z:q,buttonOnclick:n})}))},hide:function(){const t=document.querySelector(H);t&&t.remove()},cancel:function(){this.hide(),t&&t(!0)}}}();if(!await nt.display(e.selected)){const n={files:[new File([t.content],t.filename,{type:t.mimeType})]};try{await navigator.share(n),nt.hide()}catch(n){if(nt.hide(),"AbortError"!==n.name)throw n;await at(t,e)}}}Z({EMBEDDED_IMAGE_BUTTON_MESSAGE:K,SHARE_PAGE_BUTTON_MESSAGE:$,SHARE_SELECTION_BUTTON_MESSAGE:tt,ERROR_TITLE_MESSAGE:et});const st="single-file-request-fetch-supported",it="single-file-response-fetch-supported",ct="single-file-request-fetch",lt="single-file-response-fetch",dt="Host fetch error (SingleFile)",ut=Boolean(window.wrappedJSObject),ft=(t,e)=>(e.cache="force-cache",e.referrerPolicy="strict-origin-when-cross-origin",window.fetch(t,e));let mt,pt=0,ht=new Map;async function yt(t,e={}){try{const n={cache:"force-cache",headers:e.headers,referrerPolicy:"strict-origin-when-cross-origin"};let r;try{r=e.referrer&&!ut?await ft(t,n):await async function(t,e){if(void 0===mt&&(mt=!1,document.addEventListener(it,(()=>mt=!0),!1),document.dispatchEvent(new CustomEvent(st))),!mt)return ft(t,e);{const n=new Promise(((n,r)=>{document.dispatchEvent(new CustomEvent(ct,{detail:JSON.stringify({url:t,options:e})})),document.addEventListener(lt,(function e(o){o.detail?o.detail.url==t&&(document.removeEventListener(lt,e,!1),o.detail.response?n({status:o.detail.status,headers:new Map(o.detail.headers),arrayBuffer:async()=>o.detail.response}):r(o.detail.error)):r()}),!1)}));try{return await n}catch(n){if(n&&n.message==dt)return ft(t,e);throw n}}}(t,n)}catch(e){if(!e||e.message!=dt)throw e;r=await ft(t,n)}return r}catch(n){pt++;const r=new Promise(((t,e)=>ht.set(pt,{resolve:t,reject:e})));return await gt({method:"singlefile.fetch",url:t,requestId:pt,referrer:e.referrer,headers:e.headers}),r}}async function gt(t){const e=await browser.runtime.sendMessage(t);if(!e||e.error)throw new Error(e&&e.error&&e.error.toString());return e}browser.runtime.onMessage.addListener((t=>"singlefile.fetchFrame"==t.method&&window.frameId&&window.frameId==t.frameId?async function(t){try{const e=await ft(t.url,{cache:"force-cache",headers:t.headers,referrerPolicy:"strict-origin-when-cross-origin"});return{status:e.status,headers:[...e.headers],array:Array.from(new Uint8Array(await e.arrayBuffer()))}}catch(t){return{error:t&&t.toString()}}}(t):"singlefile.fetchResponse"==t.method?async function(t){const e=ht.get(t.requestId);e&&(t.error?(e.reject(new Error(t.error)),ht.delete(t.requestId)):(t.truncated&&(e.array?e.array=e.array.concat(t.array):(e.array=t.array,ht.set(t.requestId,e)),t.finished&&(t.array=e.array)),t.truncated&&!t.finished||(e.resolve({status:t.status,headers:{get:e=>t.headers&&t.headers[e]},arrayBuffer:async()=>new Uint8Array(t.array).buffer}),ht.delete(t.requestId))));return{}}(t):void 0));const wt=globalThis.singlefile,bt=wt.helper.SELECTED_CONTENT_ATTRIBUTE_NAME,At="singlefile-mask",Et="singlefile-mask-content",vt="singlefile-progress-bar",St="singlefile-progress-bar-content",Tt="single-file-selection-zone",It="singlefile-logs-window",Ct="singlefile-logs",xt="singlefile-logs-line",Pt="singlefile-logs-line-text",Rt="singlefile-logs-line-icon",Lt=wt.helper.SINGLE_FILE_UI_ELEMENT_CLASS,Ut=8,Dt=browser.i18n.getMessage("logPanelDeferredImages"),kt=browser.i18n.getMessage("logPanelFrameContents"),Ot=browser.i18n.getMessage("logPanelEmbeddedImage"),Nt=browser.i18n.getMessage("logPanelStep"),Bt=browser.i18n.getMessage("logPanelWidth"),Mt=new Set(Array.from(getComputedStyle(document.documentElement)));let Ft,_t;function jt(t,e){return prompt(t,e)}function Gt(t){const e=document.querySelector(At);e&&e.style.setProperty("display",t?"block":"none"),_t&&_t.style.setProperty("display",t?"block":"none")}function Ht(t){if(!document.querySelector(At)&&(t.logsEnabled&&document.documentElement.appendChild(_t),t.shadowEnabled)){const e=function(){try{let t=document.querySelector(At);if(!t){t=re(At,document.documentElement);const e=t.attachShadow({mode:"open"}),n=document.createElement("style");n.textContent=`\n\t\t\t\t@keyframes single-file-progress { \n\t\t\t\t\t0% { \n\t\t\t\t\t\tleft: -50px;\n\t\t\t\t\t} \n\t\t\t\t\t100% { \n\t\t\t\t\t\tleft: 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t.${vt} {\n\t\t\t\t\tposition: fixed;\n\t\t\t\t\ttop: 0;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\twidth: 0;\n\t\t\t\t\theight: 8px;\n\t\t\t\t\tz-index: 2147483646;\n\t\t\t\t\topacity: .5;\n\t\t\t\t\toverflow: hidden;\t\t\t\t\t\n\t\t\t\t\ttransition: width 200ms ease-in-out;\n\t\t\t\t}\n\t\t\t\t.${St} {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\tanimation: single-file-progress 3s linear infinite reverse;\n\t\t\t\t\tbackground: \n\t\t\t\t\t\twhite \n\t\t\t\t\t\tlinear-gradient(-45deg, rgba(0, 0, 0, 0.075) 25%, \n\t\t\t\t\t\t\ttransparent 25%, \n\t\t\t\t\t\t\ttransparent 50%, \n\t\t\t\t\t\t\trgba(0, 0, 0, 0.075) 50%, \n\t\t\t\t\t\t\trgba(0, 0, 0, 0.075) 75%, \n\t\t\t\t\t\t\ttransparent 75%, transparent)\n\t\t\t\t\t\trepeat scroll 0% 0% / 50px 50px padding-box border-box;\n\t\t\t\t\twidth: calc(100% + 50px);\n\t\t\t\t\theight: 100%;\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t.${Et} {\n\t\t\t\t\tposition: fixed;\n\t\t\t\t\ttop: 0;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tz-index: 2147483646;\n\t\t\t\t\topacity: 0;\n\t\t\t\t\tbackground-color: black;\n\t\t\t\t\ttransition: opacity 250ms;\n\t\t\t\t}\n\t\t\t`,e.appendChild(n);let r=document.createElement("div");r.classList.add(Et),e.appendChild(r),t.offsetWidth,r.style.setProperty("opacity",.3),t.offsetWidth}return t}catch(t){}}();t.progressBarEnabled&&function(t){try{if(!t.shadowRoot.querySelector("."+vt)){let e=document.createElement("div");e.classList.add(vt),t.shadowRoot.appendChild(e);const n=document.createElement("div");n.classList.add(St),e.appendChild(n)}}catch(t){}}(e)}}function Wt(){const t=document.querySelector(At);t&&t.remove(),_t.remove(),$t()}function qt(t,e,n){n.shadowEnabled&&n.progressBarEnabled&&function(t,e){try{const n=document.querySelector(At);if(n){const r=n.shadowRoot.querySelector("."+vt);if(r&&e){const n=Math.floor(t/e*100)+"%";r.style.getPropertyValue("width")!=n&&(r.style.setProperty("width",n),r.offsetWidth)}}}catch(t){}}(t,e)}function zt(t){te("insert-embedded-image",Ot,"…",t)}function Vt(t){te("insert-embedded-image",Ot,"✓",t)}function Xt(){let t;const e=[],n=getSelection();for(let r=0;r{"A"==t.tagName&&t.href&&e.push(n.currentNode.href)}))}}return Array.from(new Set(e))}async function Zt(t){let e=Qt();return e||t?e:(e=await new Promise((t=>{let e=[];function n(t){e=[],i(),t.preventDefault()}function r(t){const e=function(t){let e,n=t.target,r=n.getBoundingClientRect();for(e=ne("floor",n,t.clientX-r.left,ee(n,"left")),e==n&&(e=ne("ceil",n,r.left+r.width-t.clientX,ee(n,"right"))),e==n&&(e=ne("floor",n,t.clientY-r.top,ee(n,"top"))),e==n&&(e=ne("ceil",n,r.top+r.height-t.clientY,ee(n,"bottom"))),n=e;n&&n.clientWidth<=Ut&&n.clientHeight<=Ut;)n=n.parentElement;return n}(t);var n;e&&(Ft=e,n=e,requestAnimationFrame((()=>{const t=Kt(),e=n.getBoundingClientRect(),r=document.scrollingElement||document.documentElement;t.style.setProperty("top",r.scrollTop+e.top-10+"px"),t.style.setProperty("left",r.scrollLeft+e.left-10+"px"),t.style.setProperty("width",e.width+20+"px"),t.style.setProperty("height",e.height+20+"px")})))}function o(t){t.preventDefault(),t.stopPropagation(),0==t.button?i(Ft,t.ctrlKey):s()}function a(t){"Escape"==t.key&&s()}function s(){e.length&&getSelection().removeAllRanges(),e=[],l()}function i(t,e){if(t){e||d();const n=document.createRange();n.selectNodeContents(t),c(),getSelection().addRange(n),u(),e||l()}else l()}function c(){const t=getSelection();for(let e=t.rangeCount-1;e>=0;e--){const n=t.getRangeAt(e);n.startOffset==n.endOffset&&(t.removeRange(n),e--)}}function l(){Kt().remove(),removeEventListener("mousemove",r,!0),removeEventListener("click",o,!0),removeEventListener("keyup",a,!0),Ft=null,t(Boolean(e.length)),setTimeout((()=>document.removeEventListener("contextmenu",n,!0)),0)}function d(){getSelection().removeAllRanges(),e.forEach((t=>getSelection().addRange(t)))}function u(){e=[];for(let t=0;tUt&&r.parentElement.clientHeight>Ut&&(r.parentElement.clientWidth-r.clientWidth>Ut||r.parentElement.clientHeight-r.clientHeight>Ut)&&o.push(r.parentElement),r=r.parentElement)}else n=!1}while(n&&r);return o}function ne(t,e,n,r){return Math[t](n/Ut)<=r.length&&(e=r[r.length-Math[t](n/Ut)-1]),e}function re(t,e){const n=document.createElement(t);return n.className=Lt,e&&e.appendChild(n),Mt.forEach((t=>n.style.setProperty(t,"initial","important"))),n}$t();const oe=globalThis.singlefile,ae=globalThis.singlefileBootstrap,se="moz-extension:";let ie,ce,le,de,ue,fe,me;Z({EMBEDDED_IMAGE_BUTTON_MESSAGE:browser.i18n.getMessage("topPanelEmbeddedImageButton"),SHARE_PAGE_BUTTON_MESSAGE:browser.i18n.getMessage("topPanelSharePageButton"),SHARE_SELECTION_BUTTON_MESSAGE:browser.i18n.getMessage("topPanelShareSelectionButton"),ERROR_TITLE_MESSAGE:browser.i18n.getMessage("topPanelError")}),ae&&ae.initializedSingleFile||(oe.init({fetch:yt,frameFetch:async function(t,e){const n=await gt({method:"singlefile.fetchFrame",url:t,frameId:e.frameId,referrer:e.referrer,headers:e.headers});return{status:n.status,headers:new Map(n.headers),arrayBuffer:async()=>new Uint8Array(n.array).buffer}}}),browser.runtime.onMessage.addListener((t=>{if("content.save"==t.method||"content.cancelSave"==t.method||"content.download"==t.method||"content.getSelectedLinks"==t.method||"content.error"==t.method||"content.prompt"==t.method||"content.beginScrollTo"==t.method||"content.scrollTo"==t.method||"content.endScrollTo"==t.method)return async function(t){if(!location.href.startsWith(se)){if("content.save"==t.method)return await async function(t){const e=setInterval((()=>{browser.runtime.sendMessage({method:"ping"}).then((()=>{}))}),15e3),n=t.options;let r;(n.selected||n.optionallySelected)&&(r=await Zt(n.optionallySelected));if(!(ce||ae&&ae.pageInfo.processing)){if(n.updatedResources=ae?ae.pageInfo.updatedResources:{},n.visitDate=ae?ae.pageInfo.visitDate:new Date,Object.keys(n.updatedResources).forEach((t=>n.updatedResources[t].retrieved=!1)),n.optionallySelected&&r&&(n.selected=!0),!n.selected||r){ae&&(ae.pageInfo.processing=!0),ce=!0;try{const t=await async function(t){const e=oe.processors.frameTree;let n;t.keepFilename=t.saveToGDrive||t.saveToGitHub||t.saveWithWebDAV||t.saveToDropbox||t.saveToRestFormApi,oe.helper.initDoc(document),Ht(t),ie=new oe.SingleFile(t);const r=[];t.insertCanonicalLink=!0;let o,a=0,s=0;t.onprogress=async t=>{const{options:e}=t.detail;if(!ie.cancelled){if(t.type==t.RESOURCES_INITIALIZING&&!o&&e.insertEmbeddedScreenshotImage&&e.compressContent){o=!0,Gt(!1);const t=await browser.runtime.sendMessage({method:"tabs.getScreenshot",width:document.documentElement.scrollWidth,height:document.documentElement.scrollHeight,innerHeight:globalThis.innerHeight});Gt(!0),zt(e),e.embeddedImage=new Uint8Array(await(await yt(t)).arrayBuffer()),URL.revokeObjectURL(t),Vt(e)}t.type==t.RESOURCES_INITIALIZED&&(s=t.detail.max,e.loadDeferredImages&&oe.processors.lazy.resetZoomLevel(e)),t.type==t.RESOURCES_INITIALIZED||t.type==t.RESOURCE_LOADED?(t.type==t.RESOURCE_LOADED&&a++,await browser.runtime.sendMessage({method:"ui.processProgress",index:a,maxIndex:s}),qt(a,s,e)):t.detail.frame||t.type==t.PAGE_LOADING||t.type==t.PAGE_LOADED||(t.type==t.STAGE_STARTED?t.detail.step<3&&function(t,e){te("step-"+t,`${Nt} ${t+1} / 3`,"…",e)}(t.detail.step,e):t.type==t.STAGE_ENDED&&t.detail.step<3&&function(t,e){te("step-"+t,`${Nt} ${t+1} / 3`,"✓",e)}(t.detail.step,e))}};const i=ie.cancel.bind(ie);if(t.insertEmbeddedImage&&t.compressContent){zt(t),de=function(){let t;return{display:async function(){return new Promise((e=>{t=e,J(G,"",{buttonLabel:W,buttonOnclick:e})}))},hide:function(){const t=document.querySelector(G);t&&t.remove()},cancel:function(){this.hide(),t&&t(!0)}}}();await de.display()||(t.embeddedImage=await function({accept:t}={accept:"image/*"}){const e=document.createElement("input");return e.type="file",e.accept=t,e.click(),new Promise((t=>{e.addEventListener("change",(async e=>{if(e.target.files.length){const n=e.target.files[0];if("image/png"==n.type){const e=new FileReader;e.addEventListener("load",(async()=>t(new Uint8Array(e.result)))),e.addEventListener("error",(()=>t())),e.readAsArrayBuffer(n)}else{const e=await new Promise((t=>{const e=new FileReader;e.addEventListener("load",(()=>t(e.result))),e.addEventListener("error",(()=>t())),e.readAsDataURL(n)}));if(e){const r=await createImageBitmap(n),o=new Image;o.src=e,o.addEventListener("error",(()=>t())),await new Promise((t=>o.addEventListener("load",t)));const a=new OffscreenCanvas(o.width,o.height);a.getContext("2d").drawImage(r,0,0);const s=await a.convertToBlob({type:"image/png"}),i=new FileReader;i.addEventListener("load",(()=>t(new Uint8Array(i.result)))),i.addEventListener("error",(()=>t())),i.readAsArrayBuffer(s)}else t()}}else t()})),e.addEventListener("cancel",(()=>t()))}))}({accept:"image/*"}),de.hide()),Vt(t)}if(!t.saveRawPage&&!ie.cancelled){let n;if(t.loadDeferredImages&&(n=oe.processors.lazy.process(t),function(t){te("load-deferred-images",Dt,"…",t)}(t),n.then((()=>{ie.cancelled||function(t){te("load-deferred-images",Dt,"✓",t)}(t)})),t.loadDeferredImagesBeforeFrames&&await n),!t.removeFrames&&e&&globalThis.frames){let n;n=t.loadDeferredImages?new Promise((n=>globalThis.setTimeout((()=>n(e.getAsync(t))),t.loadDeferredImagesBeforeFrames||!t.loadDeferredImages?0:t.loadDeferredImagesMaxIdleTime))):e.getAsync(t),function(t){te("load-frames",kt,"…",t)}(t),n.then((()=>{ie.cancelled||function(t){te("load-frames",kt,"✓",t)}(t)})),t.loadDeferredImagesBeforeFrames?t.frames=await new Promise((t=>{ie.cancel=function(){i(),t([])},n.then(t)})):r.push(n)}t.loadDeferredImages&&!t.loadDeferredImagesBeforeFrames&&r.push(n)}t.loadDeferredImagesBeforeFrames||ie.cancelled||([t.frames]=await new Promise((t=>{const e=Promise.all(r);ie.cancel=function(){i(),t([[]])},e.then((()=>t(e)))})));t.delayBeforeProcessing&&await new Promise((e=>setTimeout(e,1e3*t.delayBeforeProcessing)));n=t.frames&&t.frames.sessionId;const c=t.frames&&t.frames.find((t=>t.requestedFrame));t.win=globalThis,c?(t.content=c.content,t.url=c.baseURI,t.canvases=c.canvases,t.fonts=c.fonts,t.stylesheets=c.stylesheets,t.images=c.images,t.posters=c.posters,t.videos=c.videos,t.usedFonts=c.usedFonts,t.shadowRoots=c.shadowRoots,t.adoptedStyleSheets=c.adoptedStyleSheets):t.doc=document;ie.cancelled||await ie.run();n&&e.cleanup(n);let l;ie.cancelled||(t.confirmInfobarContent&&(t.infobarContent=jt("Infobar content",t.infobarContent)||""),l=await ie.getPageData(),(t.selected||t.optionallySelected)&&document.querySelectorAll("["+bt+"]").forEach((t=>t.removeAttribute(bt))),Wt(),t.displayStats&&(console.log("SingleFile stats"),console.table(l.stats)));return l}(n);if(t)if((!n.backgroundSave&&!n.saveToClipboard||n.saveToGDrive||n.saveToGitHub||n.saveWithCompanion||n.saveWithWebDAV||n.saveToDropbox||n.saveToRestFormApi)&&n.confirmFilename){const e=jt("Save as",t.filename);e?(t.filename=e,await rt(t,n)):(browser.runtime.sendMessage({method:"downloads.cancel"}),browser.runtime.sendMessage({method:"ui.processCancelled"}))}else await rt(t,n)}catch(t){if(!ie.cancelled){console.error(t);const e=t.toString();browser.runtime.sendMessage({method:"ui.processError",error:e}),Q(e)}}}else browser.runtime.sendMessage({method:"ui.processCancelled"});ce=!1,ae&&(ae.pageInfo.processing=!1)}clearInterval(e)}(t),{};if("content.cancelSave"==t.method)return ie&&(ie.cancel(),Wt(),de&&(de.cancel(),de=null),browser.runtime.sendMessage({method:"ui.processCancelled"})),t.options.loadDeferredImages&&oe.processors.lazy.resetZoomLevel(t.options),{};if("content.getSelectedLinks"==t.method)return{urls:Xt()};if("content.download"==t.method){le||(le=v());const e=await le.next(t.data);if(e.done){le=null;try{await ot(e.value,{foregroundSave:e.value.foregroundSave,sharePage:e.value.sharePage})}catch(t){return{error:t.toString()}}finally{await browser.runtime.sendMessage({method:"downloads.end",taskId:e.value.taskId})}}return{}}if("content.error"==t.method)return Q(t.error,t.link),{};if("content.prompt"==t.method)return jt(t.message,t.value);if("content.beginScrollTo"==t.method)return ue=globalThis.scrollY,fe=document.documentElement.style.getPropertyValue("transform"),me=document.documentElement.style.getPropertyValue("overflow"),globalThis.scrollTo(0,0),document.documentElement.style.setProperty("transform","translateY(0px)"),document.documentElement.style.setProperty("overflow","hidden"),{};if("content.scrollTo"==t.method)return document.documentElement.style.setProperty("transform","translateY(-"+t.y+"px)"),await new Promise((t=>setTimeout(t,500))),{};if("content.endScrollTo"==t.method)return globalThis.scrollTo(0,ue),document.documentElement.style.setProperty("transform",fe),document.documentElement.style.setProperty("overflow",me),{}}}(t)})),ae?ae.initializedSingleFile=!0:globalThis.singlefileBootstrap={initializedSingleFile:!0})}();