single-file-cli 1.0.58 → 1.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,9 +79,6 @@ async function getPageData(win, options) {
79
79
  await new Promise(resolve => setTimeout(resolve, options.browserWaitDelay));
80
80
  }
81
81
  const pageData = await win.singlefile.getPageData(options, undefined, doc, win);
82
- if (options.includeInfobar) {
83
- await win.infobar.includeScript(pageData);
84
- }
85
82
  return pageData;
86
83
  }
87
84
 
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).singlefileBootstrap={})}(this,(function(e){"use strict";const t="single-file-load-deferred-images-start",s="single-file-load-deferred-images-end",o="single-file-load-deferred-images-keep-zoom-level-start",n="single-file-load-deferred-images-keep-zoom-level-end",i="single-file-block-cookies-start",a="single-file-block-cookies-end",r="single-file-dispatch-scroll-event-start",l="single-file-dispatch-scroll-event-end",d="single-file-block-storage-start",c="single-file-block-storage-end",m="single-file-load-image",u="single-file-image-loaded",g=(e,t,s)=>globalThis.addEventListener(e,t,s),p=e=>{try{globalThis.dispatchEvent(e)}catch(e){}},f=globalThis.CustomEvent,h=globalThis.document,T=globalThis.Document,E=globalThis.JSON;let b;b=window._singleFile_fontFaces?window._singleFile_fontFaces:window._singleFile_fontFaces=new Map,h instanceof T&&(g("single-file-new-font-face",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,b.set(E.stringify(s),t)})),g("single-file-delete-font",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,b.delete(E.stringify(s))})),g("single-file-clear-fonts",(()=>b=new Map)));const y="[\\x20\\t\\r\\n\\f]",I=new RegExp("\\\\([\\da-f]{1,6}"+y+"?|("+y+")|.)","ig");const w="single-file-on-before-capture",A="single-file-on-after-capture",v="single-file-request-get-adopted-stylesheets",S="single-file-response-get-adopted-stylesheets",N="data-single-file-removed-content",R="data-single-file-hidden-content",_="data-single-file-kept-content",C="data-single-file-hidden-frame",P="data-single-file-preserved-space-element",M="data-single-file-shadow-root-element",O="data-single-file-image",D="data-single-file-poster",F="data-single-file-video",L="data-single-file-canvas",x="data-single-file-movable-style",U="data-single-file-input-value",q="data-single-file-lazy-loaded-src",k="data-single-file-stylesheet",H="data-single-file-disabled-noscript",B="data-single-file-async-script",V="*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)",W=["NOSCRIPT","DISABLED-NOSCRIPT","META","LINK","STYLE","TITLE","TEMPLATE","SOURCE","OBJECT","SCRIPT","HEAD","BODY"],z=/^'(.*?)'$/,Y=/^"(.*?)"$/,j={regular:"400",normal:"400",bold:"700",bolder:"700",lighter:"100"},G="single-file-ui-element",K="data:,",X=(e,t,s)=>globalThis.addEventListener(e,t,s),Z=globalThis.JSON;function J(e,t,s){e.querySelectorAll("noscript:not(["+H+"])").forEach((e=>{e.setAttribute(H,e.textContent),e.textContent=""})),function(e){e.querySelectorAll("meta[http-equiv=refresh]").forEach((e=>{e.removeAttribute("http-equiv"),e.setAttribute("disabled-http-equiv","refresh")}))}(e),e.head&&e.head.querySelectorAll(V).forEach((e=>e.hidden=!0)),e.querySelectorAll("svg foreignObject").forEach((e=>{const t=e.querySelectorAll("html > head > "+V+", html > body > "+V);t.length&&(Array.from(e.childNodes).forEach((e=>e.remove())),t.forEach((t=>e.appendChild(t))))}));const o=new Map;let n;return t&&e.documentElement?(e.querySelectorAll("button button, a a").forEach((t=>{const s=e.createElement("template");s.setAttribute("data-single-file-invalid-element",""),s.content.appendChild(t.cloneNode(!0)),o.set(t,s),t.replaceWith(s)})),n=$(t,e,e.documentElement,s),s.moveStylesInHead&&e.querySelectorAll("body style, body ~ style").forEach((e=>{const s=ae(t,e);s&&se(e,s)&&(e.setAttribute(x,""),n.markedElements.push(e))}))):n={canvases:[],images:[],posters:[],videos:[],usedFonts:[],shadowRoots:[],markedElements:[]},{canvases:n.canvases,fonts:Array.from(b.values()),stylesheets:ne(e),images:n.images,posters:n.posters,videos:n.videos,usedFonts:Array.from(n.usedFonts.values()),shadowRoots:n.shadowRoots,referrer:e.referrer,markedElements:n.markedElements,invalidElements:o}}function $(e,t,s,o,n={usedFonts:new Map,canvases:[],images:[],posters:[],videos:[],shadowRoots:[],markedElements:[]},i){if(s.childNodes){Array.from(s.childNodes).filter((t=>t instanceof e.HTMLElement||t instanceof e.SVGElement)).forEach((s=>{let a,r,l;if(!o.autoSaveExternalSave&&(o.removeHiddenElements||o.removeUnusedFonts||o.compressHTML)&&(l=ae(e,s),s instanceof e.HTMLElement&&o.removeHiddenElements&&(r=(i||s.closest("html > head"))&&W.includes(s.tagName.toUpperCase())||s.closest("details"),r||(a=i||se(s,l),a&&(s.setAttribute(R,""),n.markedElements.push(s)))),!a)){if(o.compressHTML&&l){const e=l.getPropertyValue("white-space");e&&e.startsWith("pre")&&(s.setAttribute(P,""),n.markedElements.push(s))}o.removeUnusedFonts&&(Q(l,o,n.usedFonts),Q(ae(e,s,":first-letter"),o,n.usedFonts),Q(ae(e,s,":before"),o,n.usedFonts),Q(ae(e,s,":after"),o,n.usedFonts))}!function(e,t,s,o,n,i,a){const r=s.tagName&&s.tagName.toUpperCase();if("CANVAS"==r)try{n.canvases.push({dataURI:s.toDataURL("image/png","")}),s.setAttribute(L,n.canvases.length-1),n.markedElements.push(s)}catch(e){}if("IMG"==r){const t={currentSrc:i?K:o.loadDeferredImages&&s.getAttribute(q)||s.currentSrc};if(n.images.push(t),s.setAttribute(O,n.images.length-1),n.markedElements.push(s),s.removeAttribute(q),a=a||ae(e,s)){t.size=function(e,t,s){let o=t.naturalWidth,n=t.naturalHeight;if(!o&&!n){const i=null==t.getAttribute("style");if(s=s||ae(e,t)){let e,a,r,l,d,c,m,u,g=!1;if("content-box"==s.getPropertyValue("box-sizing")){const e=t.style.getPropertyValue("box-sizing"),s=t.style.getPropertyPriority("box-sizing"),o=t.clientWidth;t.style.setProperty("box-sizing","border-box","important"),g=t.clientWidth!=o,e?t.style.setProperty("box-sizing",e,s):t.style.removeProperty("box-sizing")}e=ie("padding-left",s),a=ie("padding-right",s),r=ie("padding-top",s),l=ie("padding-bottom",s),g?(d=ie("border-left-width",s),c=ie("border-right-width",s),m=ie("border-top-width",s),u=ie("border-bottom-width",s)):d=c=m=u=0,o=Math.max(0,t.clientWidth-e-a-d-c),n=Math.max(0,t.clientHeight-r-l-m-u),i&&t.removeAttribute("style")}}return{pxWidth:o,pxHeight:n}}(e,s,a);const o=a.getPropertyValue("box-shadow"),n=a.getPropertyValue("background-image");o&&"none"!=o||n&&"none"!=n||!(t.size.pxWidth>1||t.size.pxHeight>1)||(t.replaceable=!0,t.backgroundColor=a.getPropertyValue("background-color"),t.objectFit=a.getPropertyValue("object-fit"),t.boxSizing=a.getPropertyValue("box-sizing"),t.objectPosition=a.getPropertyValue("object-position"))}}if("VIDEO"==r){const o=s.currentSrc;if(o&&!o.startsWith("blob:")&&!o.startsWith("data:")){const t=ae(e,s.parentNode);n.videos.push({positionParent:t&&t.getPropertyValue("position"),src:o,size:{pxWidth:s.clientWidth,pxHeight:s.clientHeight},currentTime:s.currentTime}),s.setAttribute(F,n.videos.length-1)}if(!s.getAttribute("poster")){const e=t.createElement("canvas"),o=e.getContext("2d");e.width=s.clientWidth,e.height=s.clientHeight;try{o.drawImage(s,0,0,e.width,e.height),n.posters.push(e.toDataURL("image/png","")),s.setAttribute(D,n.posters.length-1),n.markedElements.push(s)}catch(e){}}}"IFRAME"==r&&i&&o.removeHiddenElements&&(s.setAttribute(C,""),n.markedElements.push(s));"INPUT"==r&&("password"!=s.type&&(s.setAttribute(U,s.value),n.markedElements.push(s)),"radio"!=s.type&&"checkbox"!=s.type||(s.setAttribute(U,s.checked),n.markedElements.push(s)));"TEXTAREA"==r&&(s.setAttribute(U,s.value),n.markedElements.push(s));"SELECT"==r&&s.querySelectorAll("option").forEach((e=>{e.selected&&(e.setAttribute(U,""),n.markedElements.push(e))}));"SCRIPT"==r&&(s.async&&""!=s.getAttribute("async")&&"async"!=s.getAttribute("async")&&(s.setAttribute(B,""),n.markedElements.push(s)),s.textContent=s.textContent.replace(/<\/script>/gi,"<\\/script>"))}(e,t,s,o,n,a,l);const d=!(s instanceof e.SVGElement)&&ee(s);if(d&&!s.classList.contains(G)){const i={};s.setAttribute(M,n.shadowRoots.length),n.markedElements.push(s),n.shadowRoots.push(i),$(e,t,d,o,n,a),i.content=d.innerHTML,i.mode=d.mode;try{if(d.adoptedStyleSheets)if(d.adoptedStyleSheets.length)i.adoptedStyleSheets=Array.from(d.adoptedStyleSheets).map((e=>Array.from(e.cssRules).map((e=>e.cssText)).join("\n")));else if(void 0===d.adoptedStyleSheets.length){const e=e=>i.adoptedStyleSheets=e.detail.adoptedStyleSheets;s.addEventListener(S,e),s.dispatchEvent(new CustomEvent(v,{options:{bubbles:!0,composed:!0}})),s.removeEventListener(S,e)}}catch(e){}}$(e,t,s,o,n,a),!o.autoSaveExternalSave&&o.removeHiddenElements&&i&&(r||""==s.getAttribute(_)?s.parentElement&&(s.parentElement.setAttribute(_,""),n.markedElements.push(s.parentElement)):a&&(s.setAttribute(N,""),n.markedElements.push(s)))}))}return n}function Q(e,t,s){if(e){const o=e.getPropertyValue("font-style")||"normal";e.getPropertyValue("font-family").split(",").forEach((n=>{if(n=te(n),!t.loadedFonts||t.loadedFonts.find((e=>te(e.family)==n&&e.style==o))){const t=(i=e.getPropertyValue("font-weight"),j[i.toLowerCase().trim()]||i),a=e.getPropertyValue("font-variant")||"normal",r=[n,t,o,a];s.set(Z.stringify(r),[n,t,o,a])}var i}))}}function ee(e){const t=globalThis.chrome;if(e.openOrClosedShadowRoot)return e.openOrClosedShadowRoot;if(!(t&&t.dom&&t.dom.openOrClosedShadowRoot))return e.shadowRoot;try{return t.dom.openOrClosedShadowRoot(e)}catch(t){return e.shadowRoot}}function te(e=""){return function(e){e=e.match(z)?e.replace(z,"$1"):e.replace(Y,"$1");return e.trim()}((t=e.trim(),t.replace(I,((e,t,s)=>{const o="0x"+t-65536;return o!=o||s?t:o<0?String.fromCharCode(o+65536):String.fromCharCode(o>>10|55296,1023&o|56320)})))).toLowerCase();var t}function se(e,t){let s=!1;if(t){const o=t.getPropertyValue("display"),n=t.getPropertyValue("opacity"),i=t.getPropertyValue("visibility");if(s="none"==o,!s&&("0"==n||"hidden"==i)&&e.getBoundingClientRect){const t=e.getBoundingClientRect();s=!t.width&&!t.height}}return Boolean(s)}function oe(e,t,s){if(e.querySelectorAll("["+H+"]").forEach((e=>{e.textContent=e.getAttribute(H),e.removeAttribute(H)})),e.querySelectorAll("meta[disabled-http-equiv]").forEach((e=>{e.setAttribute("http-equiv",e.getAttribute("disabled-http-equiv")),e.removeAttribute("disabled-http-equiv")})),e.head&&e.head.querySelectorAll("*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)").forEach((e=>e.removeAttribute("hidden"))),!t){const s=[N,C,R,P,O,D,F,L,U,M,k,B];t=e.querySelectorAll(s.map((e=>"["+e+"]")).join(","))}t.forEach((e=>{e.removeAttribute(N),e.removeAttribute(R),e.removeAttribute(_),e.removeAttribute(C),e.removeAttribute(P),e.removeAttribute(O),e.removeAttribute(D),e.removeAttribute(F),e.removeAttribute(L),e.removeAttribute(U),e.removeAttribute(M),e.removeAttribute(k),e.removeAttribute(B),e.removeAttribute(x)})),s&&s.forEach(((e,t)=>e.replaceWith(t)))}function ne(e){if(e){const t=[];return e.querySelectorAll("style").forEach(((s,o)=>{try{const n=e.createElement("style");n.textContent=s.textContent,e.body.appendChild(n);const i=n.sheet;n.remove(),i&&i.cssRules.length==s.sheet.cssRules.length||(s.setAttribute(k,o),t[o]=Array.from(s.sheet.cssRules).map((e=>e.cssText)).join("\n"))}catch(e){}})),t}}function ie(e,t){if(t.getPropertyValue(e).endsWith("px"))return parseFloat(t.getPropertyValue(e))}function ae(e,t,s){try{return e.getComputedStyle(t,s)}catch(e){}}const re={LAZY_SRC_ATTRIBUTE_NAME:q,SINGLE_FILE_UI_ELEMENT_CLASS:G},le=10,de="attributes",ce=globalThis.browser,me=globalThis.document,ue=globalThis.MutationObserver,ge=(e,t,s)=>globalThis.addEventListener(e,t,s),pe=(e,t,s)=>globalThis.removeEventListener(e,t,s),fe=new Map;let he;async function Te(e){if(me.documentElement){fe.clear();const s=me.body&&me.body.scrollHeight||me.documentElement.scrollHeight,n=me.body&&me.body.scrollWidth||me.documentElement.scrollWidth;if(s>globalThis.innerHeight||n>globalThis.innerWidth){const a=Math.max(s-1.5*globalThis.innerHeight,0),l=Math.max(n-1.5*globalThis.innerWidth,0);if(globalThis.scrollY<a||globalThis.scrollX<l)return function(e){return he=0,new Promise((async s=>{let n;const a=new Set,l=new ue((async t=>{if((t=t.filter((e=>e.type==de))).length){t.filter((e=>{if("src"==e.attributeName&&(e.target.setAttribute(re.LAZY_SRC_ATTRIBUTE_NAME,e.target.src),e.target.addEventListener("load",g)),"src"==e.attributeName||"srcset"==e.attributeName||e.target.tagName&&"SOURCE"==e.target.tagName.toUpperCase())return!e.target.classList||!e.target.classList.contains(re.SINGLE_FILE_UI_ELEMENT_CLASS)})).length&&(n=!0,await be(l,e,E),a.size||await Ee(l,e,E))}}));async function c(t){await Ie("idleTimeout",(async()=>{n?he<le&&(he++,Ae("idleTimeout"),await c(Math.max(500,t/2))):(Ae("loadTimeout"),Ae("maxTimeout"),ye(l,e,E))}),t,e.loadDeferredImagesNativeTimeout)}function g(e){const t=e.target;t.removeAttribute(re.LAZY_SRC_ATTRIBUTE_NAME),t.removeEventListener("load",g)}async function h(t){n=!0,await be(l,e,E),await Ee(l,e,E),t.detail&&a.add(t.detail)}async function T(t){await be(l,e,E),await Ee(l,e,E),a.delete(t.detail),a.size||await Ee(l,e,E)}function E(e){l.disconnect(),pe(m,h),pe(u,T),s(e)}await c(2*e.loadDeferredImagesMaxIdleTime),await be(l,e,E),l.observe(me,{subtree:!0,childList:!0,attributes:!0}),ge(m,h),ge(u,T),function(e){e.loadDeferredImagesBlockCookies&&p(new f(i)),e.loadDeferredImagesBlockStorage&&p(new f(d)),e.loadDeferredImagesDispatchScrollEvent&&p(new f(r)),e.loadDeferredImagesKeepZoomLevel?p(new f(o)):p(new f(t))}(e)}))}(e)}}}async function Ee(e,t,s){await Ie("loadTimeout",(()=>ye(e,t,s)),t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function be(e,t,s){await Ie("maxTimeout",(async()=>{await Ae("loadTimeout"),await ye(e,t,s)}),10*t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function ye(e,t,o){await Ae("idleTimeout"),function(e){e.loadDeferredImagesBlockCookies&&p(new f(a)),e.loadDeferredImagesBlockStorage&&p(new f(c)),e.loadDeferredImagesDispatchScrollEvent&&p(new f(l)),e.loadDeferredImagesKeepZoomLevel?p(new f(n)):p(new f(s))}(t),await Ie("endTimeout",(async()=>{await Ae("maxTimeout"),o()}),t.loadDeferredImagesMaxIdleTime/2,t.loadDeferredImagesNativeTimeout),e.disconnect()}async function Ie(e,t,s,o){if(ce&&ce.runtime&&ce.runtime.sendMessage&&!o){if(!fe.get(e)||!fe.get(e).pending){const o={callback:t,pending:!0};fe.set(e,o);try{await ce.runtime.sendMessage({method:"singlefile.lazyTimeout.setTimeout",type:e,delay:s})}catch(o){we(e,t,s)}o.pending=!1}}else we(e,t,s)}function we(e,t,s){const o=fe.get(e);o&&globalThis.clearTimeout(o),fe.set(e,t),globalThis.setTimeout(t,s)}async function Ae(e){if(ce&&ce.runtime&&ce.runtime.sendMessage)try{await ce.runtime.sendMessage({method:"singlefile.lazyTimeout.clearTimeout",type:e})}catch(t){ve(e)}else ve(e)}function ve(e){const t=fe.get(e);fe.delete(e),t&&globalThis.clearTimeout(t)}ce&&ce.runtime&&ce.runtime.onMessage&&ce.runtime.onMessage.addListener&&ce.runtime.onMessage.addListener((e=>{if("singlefile.lazyTimeout.onTimeout"==e.method){const t=fe.get(e.type);if(t){fe.delete(e.type);try{t.callback()}catch(t){ve(e.type)}}}}));const Se={ON_BEFORE_CAPTURE_EVENT_NAME:w,ON_AFTER_CAPTURE_EVENT_NAME:A,WIN_ID_ATTRIBUTE_NAME:"data-single-file-win-id",preProcessDoc:J,serialize:function(e){const t=e.doctype;let s="";return t&&(s="<!DOCTYPE "+t.nodeName,t.publicId?(s+=' PUBLIC "'+t.publicId+'"',t.systemId&&(s+=' "'+t.systemId+'"')):t.systemId&&(s+=' SYSTEM "'+t.systemId+'"'),t.internalSubset&&(s+=" ["+t.internalSubset+"]"),s+="> "),s+e.documentElement.outerHTML},postProcessDoc:oe,getShadowRoot:ee},Ne="__frameTree__::",Re='iframe, frame, object[type="text/html"][data]',_e="*",Ce="singlefile.frameTree.initRequest",Pe="singlefile.frameTree.ackInitRequest",Me="singlefile.frameTree.cleanupRequest",Oe="singlefile.frameTree.initResponse",De="*",Fe=5e3,Le=".",xe=globalThis.window==globalThis.top,Ue=globalThis.browser,qe=globalThis.top,ke=globalThis.MessageChannel,He=globalThis.document,Be=globalThis.JSON;let Ve,We=globalThis.sessions;var ze,Ye,je;function Ge(){return globalThis.crypto.getRandomValues(new Uint32Array(32)).join("")}async function Ke(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,xe||(Ve=globalThis.frameId=e.windowId),Je(He,e.options,Ve,t),xe||(e.options.userScriptEnabled&&s&&await s(Se.ON_BEFORE_CAPTURE_EVENT_NAME),tt({frames:[ot(He,globalThis,Ve,e.options)],sessionId:t,requestedFrameId:He.documentElement.dataset.requestedFrameId&&Ve}),e.options.userScriptEnabled&&s&&await s(Se.ON_AFTER_CAPTURE_EVENT_NAME),delete He.documentElement.dataset.requestedFrameId)}function Xe(e){if(!globalThis._singleFile_cleaningUp){globalThis._singleFile_cleaningUp=!0;const t=e.sessionId;et(nt(He),e.windowId,t)}}function Ze(e){e.frames.forEach((t=>$e("responseTimeouts",e.sessionId,t.windowId)));const t=We.get(e.sessionId);if(t){e.requestedFrameId&&(t.requestedFrameId=e.requestedFrameId),e.frames.forEach((e=>{let s=t.frames.find((t=>e.windowId==t.windowId));s||(s={windowId:e.windowId},t.frames.push(s)),s.processed||(s.content=e.content,s.baseURI=e.baseURI,s.title=e.title,s.url=e.url,s.canvases=e.canvases,s.fonts=e.fonts,s.stylesheets=e.stylesheets,s.images=e.images,s.posters=e.posters,s.videos=e.videos,s.usedFonts=e.usedFonts,s.shadowRoots=e.shadowRoots,s.processed=e.processed)}));t.frames.filter((e=>!e.processed)).length||(t.frames=t.frames.sort(((e,t)=>t.windowId.split(Le).length-e.windowId.split(Le).length)),t.resolve&&(t.requestedFrameId&&t.frames.forEach((e=>{e.windowId==t.requestedFrameId&&(e.requestedFrame=!0)})),t.resolve(t.frames)))}}function Je(e,t,s,o){const n=nt(e);!function(e,t,s,o,n){const i=[];let a;We.get(n)?a=We.get(n).requestTimeouts:(a={},We.set(n,{requestTimeouts:a}));t.forEach(((e,t)=>{const s=o+Le+t;e.setAttribute(Se.WIN_ID_ATTRIBUTE_NAME,s),i.push({windowId:s})})),tt({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),t.forEach(((e,t)=>{const i=o+Le+t;try{st(e.contentWindow,{method:Ce,windowId:i,sessionId:n,options:s})}catch(e){}a[i]=globalThis.setTimeout((()=>tt({frames:[{windowId:i,processed:!0}],sessionId:n})),Fe)})),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o),n.length&&function(e,t,s,o,n){const i=[];t.forEach(((e,t)=>{const a=o+Le+t;let r;try{r=e.contentDocument}catch(e){}if(r)try{const t=e.contentWindow;t.stop(),$e("requestTimeouts",n,a),Je(r,s,a,n),i.push(ot(r,t,a,s))}catch(e){i.push({windowId:a,processed:!0})}})),tt({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o)}function $e(e,t,s){const o=We.get(t);if(o&&o[e]){const t=o[e][s];t&&(globalThis.clearTimeout(t),delete o[e][s])}}function Qe(e,t){const s=We.get(e);s&&s.responseTimeouts&&(s.responseTimeouts[t]=globalThis.setTimeout((()=>tt({frames:[{windowId:t,processed:!0}],sessionId:e})),1e4))}function et(e,t,s){e.forEach(((e,o)=>{const n=t+Le+o;e.removeAttribute(Se.WIN_ID_ATTRIBUTE_NAME);try{st(e.contentWindow,{method:Me,windowId:n,sessionId:s})}catch(e){}})),e.forEach(((e,o)=>{const n=t+Le+o;let i;try{i=e.contentDocument}catch(e){}if(i)try{et(nt(i),n,s)}catch(e){}}))}function tt(e){e.method=Oe;try{qe.singlefile.processors.frameTree.initResponse(e)}catch(t){st(qe,e,!0)}}function st(e,t,s){if(e==qe&&Ue&&Ue.runtime&&Ue.runtime.sendMessage)Ue.runtime.sendMessage(t);else if(s){const s=new ke;e.postMessage(Ne+Be.stringify({method:t.method,sessionId:t.sessionId}),De,[s.port2]),s.port1.postMessage(t)}else e.postMessage(Ne+Be.stringify(t),De)}function ot(e,t,s,o){const n=Se.preProcessDoc(e,t,o),i=Se.serialize(e);Se.postProcessDoc(e,n.markedElements,n.invalidElements);return{windowId:s,content:i,baseURI:e.baseURI.split("#")[0],url:e.location.href,title:e.title,canvases:n.canvases,fonts:n.fonts,stylesheets:n.stylesheets,images:n.images,posters:n.posters,videos:n.videos,usedFonts:n.usedFonts,shadowRoots:n.shadowRoots,processed:!0}}function nt(e){let t=Array.from(e.querySelectorAll(Re));return e.querySelectorAll(_e).forEach((e=>{const s=Se.getShadowRoot(e);s&&(t=t.concat(...s.querySelectorAll(Re)))})),t}We||(We=globalThis.sessions=new Map),xe&&(Ve="0",Ue&&Ue.runtime&&Ue.runtime.onMessage&&Ue.runtime.onMessage.addListener&&Ue.runtime.onMessage.addListener((e=>e.method==Oe?(Ze(e),Promise.resolve({})):e.method==Pe?($e("requestTimeouts",e.sessionId,e.windowId),Qe(e.sessionId,e.windowId),Promise.resolve({})):void 0))),ze="message",Ye=async e=>{if("string"==typeof e.data&&e.data.startsWith(Ne)){e.preventDefault(),e.stopPropagation();const t=Be.parse(e.data.substring(Ne.length));t.method==Ce?(e.source&&st(e.source,{method:Pe,windowId:t.windowId,sessionId:t.sessionId}),xe||(globalThis.stop(),t.options.loadDeferredImages&&Te(t.options),await Ke(t))):t.method==Pe?($e("requestTimeouts",t.sessionId,t.windowId),Qe(t.sessionId,t.windowId)):t.method==Me?Xe(t):t.method==Oe&&We.get(t.sessionId)&&(e.ports[0].onmessage=e=>Ze(e.data))}},je=!0,globalThis.addEventListener(ze,Ye,je);var it=Object.freeze({__proto__:null,getAsync:function(e){const t=Ge();return e=Be.parse(Be.stringify(e)),new Promise((s=>{We.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{},resolve:e=>{e.sessionId=t,s(e)}}),Ke({windowId:Ve,sessionId:t,options:e})}))},getSync:function(e){const t=Ge();e=Be.parse(Be.stringify(e)),We.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{}}),function(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,xe||(Ve=globalThis.frameId=e.windowId);Je(He,e.options,Ve,t),xe||(e.options.userScriptEnabled&&s&&s(Se.ON_BEFORE_CAPTURE_EVENT_NAME),tt({frames:[ot(He,globalThis,Ve,e.options)],sessionId:t,requestedFrameId:He.documentElement.dataset.requestedFrameId&&Ve}),e.options.userScriptEnabled&&s&&s(Se.ON_AFTER_CAPTURE_EVENT_NAME),delete He.documentElement.dataset.requestedFrameId)}({windowId:Ve,sessionId:t,options:e});const s=We.get(t).frames;return s.sessionId=t,s},cleanup:function(e){We.delete(e),Xe({windowId:Ve,sessionId:e,options:{sessionId:e}})},initResponse:Ze,TIMEOUT_INIT_REQUEST_MESSAGE:Fe});const at=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"],rt=1,lt=3,dt=8,ct=[{tagName:"HEAD",accept:e=>!e.childNodes.length||e.childNodes[0].nodeType==rt},{tagName:"BODY",accept:e=>!e.childNodes.length}],mt=[{tagName:"HTML",accept:e=>!e||e.nodeType!=dt},{tagName:"HEAD",accept:e=>!e||e.nodeType!=dt&&(e.nodeType!=lt||!pt(e.textContent))},{tagName:"BODY",accept:e=>!e||e.nodeType!=dt},{tagName:"LI",accept:(e,t)=>!e&&t.parentElement&&("UL"==ft(t.parentElement)||"OL"==ft(t.parentElement))||e&&["LI"].includes(ft(e))},{tagName:"DT",accept:e=>!e||["DT","DD"].includes(ft(e))},{tagName:"P",accept:e=>e&&["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DETAILS","DIV","DL","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HR","MAIN","NAV","OL","P","PRE","SECTION","TABLE","UL"].includes(ft(e))},{tagName:"DD",accept:e=>!e||["DT","DD"].includes(ft(e))},{tagName:"RT",accept:e=>!e||["RT","RP"].includes(ft(e))},{tagName:"RP",accept:e=>!e||["RT","RP"].includes(ft(e))},{tagName:"OPTGROUP",accept:e=>!e||["OPTGROUP"].includes(ft(e))},{tagName:"OPTION",accept:e=>!e||["OPTION","OPTGROUP"].includes(ft(e))},{tagName:"COLGROUP",accept:e=>!e||e.nodeType!=dt&&(e.nodeType!=lt||!pt(e.textContent))},{tagName:"CAPTION",accept:e=>!e||e.nodeType!=dt&&(e.nodeType!=lt||!pt(e.textContent))},{tagName:"THEAD",accept:e=>!e||["TBODY","TFOOT"].includes(ft(e))},{tagName:"TBODY",accept:e=>!e||["TBODY","TFOOT"].includes(ft(e))},{tagName:"TFOOT",accept:e=>!e},{tagName:"TR",accept:e=>!e||["TR"].includes(ft(e))},{tagName:"TD",accept:e=>!e||["TD","TH"].includes(ft(e))},{tagName:"TH",accept:e=>!e||["TD","TH"].includes(ft(e))}],ut=["STYLE","SCRIPT","XMP","IFRAME","NOEMBED","NOFRAMES","PLAINTEXT","NOSCRIPT"];function gt(e,t,s){return e.nodeType==lt?function(e){const t=e.parentNode;let s;t&&t.nodeType==rt&&(s=ft(t));return!s||ut.includes(s)?"SCRIPT"==s||"STYLE"==s?e.textContent.replace(/<\//gi,"<\\/").replace(/\/>/gi,"\\/>"):e.textContent:e.textContent.replace(/&/g,"&amp;").replace(/\u00a0/g,"&nbsp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}(e):e.nodeType==dt?"\x3c!--"+e.textContent+"--\x3e":e.nodeType==rt?function(e,t,s){const o=ft(e),n=t&&ct.find((t=>o==ft(t)&&t.accept(e)));let i="";n&&!e.attributes.length||(i="<"+o.toLowerCase(),Array.from(e.attributes).forEach((s=>i+=function(e,t,s){const o=e.name;let n="";if(!o.match(/["'>/=]/)){let i,a=e.value;s&&"class"==o&&(a=Array.from(t.classList).map((e=>e.trim())).join(" ")),a=a.replace(/&/g,"&amp;").replace(/\u00a0/g,"&nbsp;"),a.includes('"')&&(a.includes("'")||!s?a=a.replace(/"/g,"&quot;"):i=!0);const r=!s||a.match(/[ \t\n\f\r'"`=<>]/);n+=" ",e.namespace?"http://www.w3.org/XML/1998/namespace"==e.namespaceURI?n+="xml:"+o:"http://www.w3.org/2000/xmlns/"==e.namespaceURI?("xmlns"!==o&&(n+="xmlns:"),n+=o):"http://www.w3.org/1999/xlink"==e.namespaceURI?n+="xlink:"+o:n+=o:n+=o,""!=a&&(n+="=",r&&(n+=i?"'":'"'),n+=a,r&&(n+=i?"'":'"'))}return n}(s,e,t))),i+=">");"TEMPLATE"!=o||e.childNodes.length?Array.from(e.childNodes).forEach((e=>i+=gt(e,t,s||"svg"==o))):i+=e.innerHTML;const a=t&&mt.find((t=>o==ft(t)&&t.accept(e.nextSibling,e)));(s||!a&&!at.includes(o))&&(i+="</"+o.toLowerCase()+">");return i}(e,t,s):void 0}function pt(e){return Boolean(e.match(/^[ \t\n\f\r]/))}function ft(e){return e.tagName&&e.tagName.toUpperCase()}const ht={frameTree:it},Tt={COMMENT_HEADER:"Page saved with SingleFile",COMMENT_HEADER_LEGACY:"Archive processed by SingleFile",ON_BEFORE_CAPTURE_EVENT_NAME:w,ON_AFTER_CAPTURE_EVENT_NAME:A,preProcessDoc:J,postProcessDoc:oe,serialize:(e,t)=>function(e,t){const s=e.doctype;let o="";return s&&(o="<!DOCTYPE "+s.nodeName,s.publicId?(o+=' PUBLIC "'+s.publicId+'"',s.systemId&&(o+=' "'+s.systemId+'"')):s.systemId&&(o+=' SYSTEM "'+s.systemId+'"'),s.internalSubset&&(o+=" ["+s.internalSubset+"]"),o+="> "),o+gt(e.documentElement,t)}(e,t),getShadowRoot:ee};X("single-file-user-script-init",(()=>globalThis._singleFile_waitForUserScript=async e=>{const t=new CustomEvent(e+"-request",{cancelable:!0}),s=new Promise((t=>X(e+"-response",t)));(e=>{try{globalThis.dispatchEvent(e)}catch(e){}})(t),t.defaultPrevented&&await s})),e.helper=Tt,e.processors=ht,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).singlefileBootstrap={})}(this,(function(e){"use strict";const t="single-file-load-deferred-images-start",s="single-file-load-deferred-images-end",o="single-file-load-deferred-images-keep-zoom-level-start",n="single-file-load-deferred-images-keep-zoom-level-end",i="single-file-block-cookies-start",a="single-file-block-cookies-end",r="single-file-dispatch-scroll-event-start",l="single-file-dispatch-scroll-event-end",d="single-file-block-storage-start",c="single-file-block-storage-end",m="single-file-load-image",u="single-file-image-loaded",g=(e,t,s)=>globalThis.addEventListener(e,t,s),p=e=>{try{globalThis.dispatchEvent(e)}catch(e){}},f=globalThis.CustomEvent,h=globalThis.document,T=globalThis.Document,E=globalThis.JSON;let b;b=window._singleFile_fontFaces?window._singleFile_fontFaces:window._singleFile_fontFaces=new Map,h instanceof T&&(g("single-file-new-font-face",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,b.set(E.stringify(s),t)})),g("single-file-delete-font",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,b.delete(E.stringify(s))})),g("single-file-clear-fonts",(()=>b=new Map)));const y="[\\x20\\t\\r\\n\\f]",I=new RegExp("\\\\([\\da-f]{1,6}"+y+"?|("+y+")|.)","ig");const w="single-file-on-before-capture",A="single-file-on-after-capture",v="single-file-request-get-adopted-stylesheets",S="single-file-response-get-adopted-stylesheets",N="data-single-file-removed-content",R="data-single-file-hidden-content",_="data-single-file-kept-content",P="data-single-file-hidden-frame",C="data-single-file-preserved-space-element",M="data-single-file-shadow-root-element",O="data-single-file-image",D="data-single-file-poster",F="data-single-file-video",L="data-single-file-canvas",x="data-single-file-movable-style",U="data-single-file-input-value",q="data-single-file-lazy-loaded-src",k="data-single-file-stylesheet",H="data-single-file-disabled-noscript",B="data-single-file-async-script",V="*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)",W=["NOSCRIPT","DISABLED-NOSCRIPT","META","LINK","STYLE","TITLE","TEMPLATE","SOURCE","OBJECT","SCRIPT","HEAD","BODY"],z=/^'(.*?)'$/,Y=/^"(.*?)"$/,j={regular:"400",normal:"400",bold:"700",bolder:"700",lighter:"100"},G="single-file-ui-element",K="data:,",X=(e,t,s)=>globalThis.addEventListener(e,t,s),Z=globalThis.JSON;function J(e,t,s){e.querySelectorAll("noscript:not(["+H+"])").forEach((e=>{e.setAttribute(H,e.textContent),e.textContent=""})),function(e){e.querySelectorAll("meta[http-equiv=refresh]").forEach((e=>{e.removeAttribute("http-equiv"),e.setAttribute("disabled-http-equiv","refresh")}))}(e),e.head&&e.head.querySelectorAll(V).forEach((e=>e.hidden=!0)),e.querySelectorAll("svg foreignObject").forEach((e=>{const t=e.querySelectorAll("html > head > "+V+", html > body > "+V);t.length&&(Array.from(e.childNodes).forEach((e=>e.remove())),t.forEach((t=>e.appendChild(t))))}));const o=new Map;let n;return t&&e.documentElement?(e.querySelectorAll("button button, a a").forEach((t=>{const s=e.createElement("template");s.setAttribute("data-single-file-invalid-element",""),s.content.appendChild(t.cloneNode(!0)),o.set(t,s),t.replaceWith(s)})),n=$(t,e,e.documentElement,s),s.moveStylesInHead&&e.querySelectorAll("body style, body ~ style").forEach((e=>{const s=ae(t,e);s&&se(e,s)&&(e.setAttribute(x,""),n.markedElements.push(e))}))):n={canvases:[],images:[],posters:[],videos:[],usedFonts:[],shadowRoots:[],markedElements:[]},{canvases:n.canvases,fonts:Array.from(b.values()),stylesheets:ne(e),images:n.images,posters:n.posters,videos:n.videos,usedFonts:Array.from(n.usedFonts.values()),shadowRoots:n.shadowRoots,referrer:e.referrer,markedElements:n.markedElements,invalidElements:o,scrollPosition:{x:t.scrollX,y:t.scrollY}}}function $(e,t,s,o,n={usedFonts:new Map,canvases:[],images:[],posters:[],videos:[],shadowRoots:[],markedElements:[]},i){if(s.childNodes){Array.from(s.childNodes).filter((t=>t instanceof e.HTMLElement||t instanceof e.SVGElement)).forEach((s=>{let a,r,l;if(!o.autoSaveExternalSave&&(o.removeHiddenElements||o.removeUnusedFonts||o.compressHTML)&&(l=ae(e,s),s instanceof e.HTMLElement&&o.removeHiddenElements&&(r=(i||s.closest("html > head"))&&W.includes(s.tagName.toUpperCase())||s.closest("details"),r||(a=i||se(s,l),a&&(s.setAttribute(R,""),n.markedElements.push(s)))),!a)){if(o.compressHTML&&l){const e=l.getPropertyValue("white-space");e&&e.startsWith("pre")&&(s.setAttribute(C,""),n.markedElements.push(s))}o.removeUnusedFonts&&(Q(l,o,n.usedFonts),Q(ae(e,s,":first-letter"),o,n.usedFonts),Q(ae(e,s,":before"),o,n.usedFonts),Q(ae(e,s,":after"),o,n.usedFonts))}!function(e,t,s,o,n,i,a){const r=s.tagName&&s.tagName.toUpperCase();if("CANVAS"==r)try{n.canvases.push({dataURI:s.toDataURL("image/png",""),backgroundColor:a.getPropertyValue("background-color")}),s.setAttribute(L,n.canvases.length-1),n.markedElements.push(s)}catch(e){}if("IMG"==r){const t={currentSrc:i?K:o.loadDeferredImages&&s.getAttribute(q)||s.currentSrc};if(n.images.push(t),s.setAttribute(O,n.images.length-1),n.markedElements.push(s),s.removeAttribute(q),a=a||ae(e,s)){t.size=function(e,t,s){let o=t.naturalWidth,n=t.naturalHeight;if(!o&&!n){const i=null==t.getAttribute("style");if(s=s||ae(e,t)){let e,a,r,l,d,c,m,u,g=!1;if("content-box"==s.getPropertyValue("box-sizing")){const e=t.style.getPropertyValue("box-sizing"),s=t.style.getPropertyPriority("box-sizing"),o=t.clientWidth;t.style.setProperty("box-sizing","border-box","important"),g=t.clientWidth!=o,e?t.style.setProperty("box-sizing",e,s):t.style.removeProperty("box-sizing")}e=ie("padding-left",s),a=ie("padding-right",s),r=ie("padding-top",s),l=ie("padding-bottom",s),g?(d=ie("border-left-width",s),c=ie("border-right-width",s),m=ie("border-top-width",s),u=ie("border-bottom-width",s)):d=c=m=u=0,o=Math.max(0,t.clientWidth-e-a-d-c),n=Math.max(0,t.clientHeight-r-l-m-u),i&&t.removeAttribute("style")}}return{pxWidth:o,pxHeight:n}}(e,s,a);const o=a.getPropertyValue("box-shadow"),n=a.getPropertyValue("background-image");o&&"none"!=o||n&&"none"!=n||!(t.size.pxWidth>1||t.size.pxHeight>1)||(t.replaceable=!0,t.backgroundColor=a.getPropertyValue("background-color"),t.objectFit=a.getPropertyValue("object-fit"),t.boxSizing=a.getPropertyValue("box-sizing"),t.objectPosition=a.getPropertyValue("object-position"))}}if("VIDEO"==r){const o=s.currentSrc;if(o&&!o.startsWith("blob:")&&!o.startsWith("data:")){const t=ae(e,s.parentNode);n.videos.push({positionParent:t&&t.getPropertyValue("position"),src:o,size:{pxWidth:s.clientWidth,pxHeight:s.clientHeight},currentTime:s.currentTime}),s.setAttribute(F,n.videos.length-1)}if(!s.getAttribute("poster")){const e=t.createElement("canvas"),o=e.getContext("2d");e.width=s.clientWidth,e.height=s.clientHeight;try{o.drawImage(s,0,0,e.width,e.height),n.posters.push(e.toDataURL("image/png","")),s.setAttribute(D,n.posters.length-1),n.markedElements.push(s)}catch(e){}}}"IFRAME"==r&&i&&o.removeHiddenElements&&(s.setAttribute(P,""),n.markedElements.push(s));"INPUT"==r&&("password"!=s.type&&(s.setAttribute(U,s.value),n.markedElements.push(s)),"radio"!=s.type&&"checkbox"!=s.type||(s.setAttribute(U,s.checked),n.markedElements.push(s)));"TEXTAREA"==r&&(s.setAttribute(U,s.value),n.markedElements.push(s));"SELECT"==r&&s.querySelectorAll("option").forEach((e=>{e.selected&&(e.setAttribute(U,""),n.markedElements.push(e))}));"SCRIPT"==r&&(s.async&&""!=s.getAttribute("async")&&"async"!=s.getAttribute("async")&&(s.setAttribute(B,""),n.markedElements.push(s)),s.textContent=s.textContent.replace(/<\/script>/gi,"<\\/script>"))}(e,t,s,o,n,a,l);const d=!(s instanceof e.SVGElement)&&ee(s);if(d&&!s.classList.contains(G)){const i={};s.setAttribute(M,n.shadowRoots.length),n.markedElements.push(s),n.shadowRoots.push(i),$(e,t,d,o,n,a),i.content=d.innerHTML,i.mode=d.mode;try{if(d.adoptedStyleSheets)if(d.adoptedStyleSheets.length)i.adoptedStyleSheets=Array.from(d.adoptedStyleSheets).map((e=>Array.from(e.cssRules).map((e=>e.cssText)).join("\n")));else if(void 0===d.adoptedStyleSheets.length){const e=e=>i.adoptedStyleSheets=e.detail.adoptedStyleSheets;s.addEventListener(S,e),s.dispatchEvent(new CustomEvent(v,{options:{bubbles:!0,composed:!0}})),s.removeEventListener(S,e)}}catch(e){}}$(e,t,s,o,n,a),!o.autoSaveExternalSave&&o.removeHiddenElements&&i&&(r||""==s.getAttribute(_)?s.parentElement&&(s.parentElement.setAttribute(_,""),n.markedElements.push(s.parentElement)):a&&(s.setAttribute(N,""),n.markedElements.push(s)))}))}return n}function Q(e,t,s){if(e){const o=e.getPropertyValue("font-style")||"normal";e.getPropertyValue("font-family").split(",").forEach((n=>{if(n=te(n),!t.loadedFonts||t.loadedFonts.find((e=>te(e.family)==n&&e.style==o))){const t=(i=e.getPropertyValue("font-weight"),j[i.toLowerCase().trim()]||i),a=e.getPropertyValue("font-variant")||"normal",r=[n,t,o,a];s.set(Z.stringify(r),[n,t,o,a])}var i}))}}function ee(e){const t=globalThis.chrome;if(e.openOrClosedShadowRoot)return e.openOrClosedShadowRoot;if(!(t&&t.dom&&t.dom.openOrClosedShadowRoot))return e.shadowRoot;try{return t.dom.openOrClosedShadowRoot(e)}catch(t){return e.shadowRoot}}function te(e=""){return function(e){e=e.match(z)?e.replace(z,"$1"):e.replace(Y,"$1");return e.trim()}((t=e.trim(),t.replace(I,((e,t,s)=>{const o="0x"+t-65536;return o!=o||s?t:o<0?String.fromCharCode(o+65536):String.fromCharCode(o>>10|55296,1023&o|56320)})))).toLowerCase();var t}function se(e,t){let s=!1;if(t){const o=t.getPropertyValue("display"),n=t.getPropertyValue("opacity"),i=t.getPropertyValue("visibility");if(s="none"==o,!s&&("0"==n||"hidden"==i)&&e.getBoundingClientRect){const t=e.getBoundingClientRect();s=!t.width&&!t.height}}return Boolean(s)}function oe(e,t,s){if(e.querySelectorAll("["+H+"]").forEach((e=>{e.textContent=e.getAttribute(H),e.removeAttribute(H)})),e.querySelectorAll("meta[disabled-http-equiv]").forEach((e=>{e.setAttribute("http-equiv",e.getAttribute("disabled-http-equiv")),e.removeAttribute("disabled-http-equiv")})),e.head&&e.head.querySelectorAll("*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)").forEach((e=>e.removeAttribute("hidden"))),!t){const s=[N,P,R,C,O,D,F,L,U,M,k,B];t=e.querySelectorAll(s.map((e=>"["+e+"]")).join(","))}t.forEach((e=>{e.removeAttribute(N),e.removeAttribute(R),e.removeAttribute(_),e.removeAttribute(P),e.removeAttribute(C),e.removeAttribute(O),e.removeAttribute(D),e.removeAttribute(F),e.removeAttribute(L),e.removeAttribute(U),e.removeAttribute(M),e.removeAttribute(k),e.removeAttribute(B),e.removeAttribute(x)})),s&&s.forEach(((e,t)=>e.replaceWith(t)))}function ne(e){if(e){const t=[];return e.querySelectorAll("style").forEach(((s,o)=>{try{const n=e.createElement("style");n.textContent=s.textContent,e.body.appendChild(n);const i=n.sheet;n.remove(),i&&i.cssRules.length==s.sheet.cssRules.length||(s.setAttribute(k,o),t[o]=Array.from(s.sheet.cssRules).map((e=>e.cssText)).join("\n"))}catch(e){}})),t}}function ie(e,t){if(t.getPropertyValue(e).endsWith("px"))return parseFloat(t.getPropertyValue(e))}function ae(e,t,s){try{return e.getComputedStyle(t,s)}catch(e){}}const re={LAZY_SRC_ATTRIBUTE_NAME:q,SINGLE_FILE_UI_ELEMENT_CLASS:G},le=10,de="attributes",ce=globalThis.browser,me=globalThis.document,ue=globalThis.MutationObserver,ge=(e,t,s)=>globalThis.addEventListener(e,t,s),pe=(e,t,s)=>globalThis.removeEventListener(e,t,s),fe=new Map;let he;async function Te(e){if(me.documentElement){fe.clear();const s=me.body&&me.body.scrollHeight||me.documentElement.scrollHeight,n=me.body&&me.body.scrollWidth||me.documentElement.scrollWidth;if(s>globalThis.innerHeight||n>globalThis.innerWidth){const a=Math.max(s-1.5*globalThis.innerHeight,0),l=Math.max(n-1.5*globalThis.innerWidth,0);if(globalThis.scrollY<a||globalThis.scrollX<l)return function(e){return he=0,new Promise((async s=>{let n;const a=new Set,l=new ue((async t=>{if((t=t.filter((e=>e.type==de))).length){t.filter((e=>{if("src"==e.attributeName&&(e.target.setAttribute(re.LAZY_SRC_ATTRIBUTE_NAME,e.target.src),e.target.addEventListener("load",g)),"src"==e.attributeName||"srcset"==e.attributeName||e.target.tagName&&"SOURCE"==e.target.tagName.toUpperCase())return!e.target.classList||!e.target.classList.contains(re.SINGLE_FILE_UI_ELEMENT_CLASS)})).length&&(n=!0,await be(l,e,E),a.size||await Ee(l,e,E))}}));async function c(t){await Ie("idleTimeout",(async()=>{n?he<le&&(he++,Ae("idleTimeout"),await c(Math.max(500,t/2))):(Ae("loadTimeout"),Ae("maxTimeout"),ye(l,e,E))}),t,e.loadDeferredImagesNativeTimeout)}function g(e){const t=e.target;t.removeAttribute(re.LAZY_SRC_ATTRIBUTE_NAME),t.removeEventListener("load",g)}async function h(t){n=!0,await be(l,e,E),await Ee(l,e,E),t.detail&&a.add(t.detail)}async function T(t){await be(l,e,E),await Ee(l,e,E),a.delete(t.detail),a.size||await Ee(l,e,E)}function E(e){l.disconnect(),pe(m,h),pe(u,T),s(e)}await c(2*e.loadDeferredImagesMaxIdleTime),await be(l,e,E),l.observe(me,{subtree:!0,childList:!0,attributes:!0}),ge(m,h),ge(u,T),function(e){e.loadDeferredImagesBlockCookies&&p(new f(i)),e.loadDeferredImagesBlockStorage&&p(new f(d)),e.loadDeferredImagesDispatchScrollEvent&&p(new f(r)),e.loadDeferredImagesKeepZoomLevel?p(new f(o)):p(new f(t))}(e)}))}(e)}}}async function Ee(e,t,s){await Ie("loadTimeout",(()=>ye(e,t,s)),t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function be(e,t,s){await Ie("maxTimeout",(async()=>{await Ae("loadTimeout"),await ye(e,t,s)}),10*t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function ye(e,t,o){await Ae("idleTimeout"),function(e){e.loadDeferredImagesBlockCookies&&p(new f(a)),e.loadDeferredImagesBlockStorage&&p(new f(c)),e.loadDeferredImagesDispatchScrollEvent&&p(new f(l)),e.loadDeferredImagesKeepZoomLevel?p(new f(n)):p(new f(s))}(t),await Ie("endTimeout",(async()=>{await Ae("maxTimeout"),o()}),t.loadDeferredImagesMaxIdleTime/2,t.loadDeferredImagesNativeTimeout),e.disconnect()}async function Ie(e,t,s,o){if(ce&&ce.runtime&&ce.runtime.sendMessage&&!o){if(!fe.get(e)||!fe.get(e).pending){const o={callback:t,pending:!0};fe.set(e,o);try{await ce.runtime.sendMessage({method:"singlefile.lazyTimeout.setTimeout",type:e,delay:s})}catch(o){we(e,t,s)}o.pending=!1}}else we(e,t,s)}function we(e,t,s){const o=fe.get(e);o&&globalThis.clearTimeout(o),fe.set(e,t),globalThis.setTimeout(t,s)}async function Ae(e){if(ce&&ce.runtime&&ce.runtime.sendMessage)try{await ce.runtime.sendMessage({method:"singlefile.lazyTimeout.clearTimeout",type:e})}catch(t){ve(e)}else ve(e)}function ve(e){const t=fe.get(e);fe.delete(e),t&&globalThis.clearTimeout(t)}ce&&ce.runtime&&ce.runtime.onMessage&&ce.runtime.onMessage.addListener&&ce.runtime.onMessage.addListener((e=>{if("singlefile.lazyTimeout.onTimeout"==e.method){const t=fe.get(e.type);if(t){fe.delete(e.type);try{t.callback()}catch(t){ve(e.type)}}}}));const Se={ON_BEFORE_CAPTURE_EVENT_NAME:w,ON_AFTER_CAPTURE_EVENT_NAME:A,WIN_ID_ATTRIBUTE_NAME:"data-single-file-win-id",preProcessDoc:J,serialize:function(e){const t=e.doctype;let s="";return t&&(s="<!DOCTYPE "+t.nodeName,t.publicId?(s+=' PUBLIC "'+t.publicId+'"',t.systemId&&(s+=' "'+t.systemId+'"')):t.systemId&&(s+=' SYSTEM "'+t.systemId+'"'),t.internalSubset&&(s+=" ["+t.internalSubset+"]"),s+="> "),s+e.documentElement.outerHTML},postProcessDoc:oe,getShadowRoot:ee},Ne="__frameTree__::",Re='iframe, frame, object[type="text/html"][data]',_e="*",Pe="singlefile.frameTree.initRequest",Ce="singlefile.frameTree.ackInitRequest",Me="singlefile.frameTree.cleanupRequest",Oe="singlefile.frameTree.initResponse",De="*",Fe=5e3,Le=".",xe=globalThis.window==globalThis.top,Ue=globalThis.browser,qe=globalThis.top,ke=globalThis.MessageChannel,He=globalThis.document,Be=globalThis.JSON;let Ve,We=globalThis.sessions;var ze,Ye,je;function Ge(){return globalThis.crypto.getRandomValues(new Uint32Array(32)).join("")}async function Ke(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,xe||(Ve=globalThis.frameId=e.windowId),Je(He,e.options,Ve,t),xe||(e.options.userScriptEnabled&&s&&await s(Se.ON_BEFORE_CAPTURE_EVENT_NAME),tt({frames:[ot(He,globalThis,Ve,e.options,e.scrolling)],sessionId:t,requestedFrameId:He.documentElement.dataset.requestedFrameId&&Ve}),e.options.userScriptEnabled&&s&&await s(Se.ON_AFTER_CAPTURE_EVENT_NAME),delete He.documentElement.dataset.requestedFrameId)}function Xe(e){if(!globalThis._singleFile_cleaningUp){globalThis._singleFile_cleaningUp=!0;const t=e.sessionId;et(nt(He),e.windowId,t)}}function Ze(e){e.frames.forEach((t=>$e("responseTimeouts",e.sessionId,t.windowId)));const t=We.get(e.sessionId);if(t){e.requestedFrameId&&(t.requestedFrameId=e.requestedFrameId),e.frames.forEach((e=>{let s=t.frames.find((t=>e.windowId==t.windowId));s||(s={windowId:e.windowId},t.frames.push(s)),s.processed||(s.content=e.content,s.baseURI=e.baseURI,s.title=e.title,s.url=e.url,s.canvases=e.canvases,s.fonts=e.fonts,s.stylesheets=e.stylesheets,s.images=e.images,s.posters=e.posters,s.videos=e.videos,s.usedFonts=e.usedFonts,s.shadowRoots=e.shadowRoots,s.processed=e.processed,s.scrollPosition=e.scrollPosition,s.scrolling=e.scrolling)}));t.frames.filter((e=>!e.processed)).length||(t.frames=t.frames.sort(((e,t)=>t.windowId.split(Le).length-e.windowId.split(Le).length)),t.resolve&&(t.requestedFrameId&&t.frames.forEach((e=>{e.windowId==t.requestedFrameId&&(e.requestedFrame=!0)})),t.resolve(t.frames)))}}function Je(e,t,s,o){const n=nt(e);!function(e,t,s,o,n){const i=[];let a;We.get(n)?a=We.get(n).requestTimeouts:(a={},We.set(n,{requestTimeouts:a}));t.forEach(((e,t)=>{const s=o+Le+t;e.setAttribute(Se.WIN_ID_ATTRIBUTE_NAME,s),i.push({windowId:s})})),tt({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),t.forEach(((e,t)=>{const i=o+Le+t;try{st(e.contentWindow,{method:Pe,windowId:i,sessionId:n,options:s,scrolling:e.scrolling})}catch(e){}a[i]=globalThis.setTimeout((()=>tt({frames:[{windowId:i,processed:!0}],sessionId:n})),Fe)})),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o),n.length&&function(e,t,s,o,n){const i=[];t.forEach(((e,t)=>{const a=o+Le+t;let r;try{r=e.contentDocument}catch(e){}if(r)try{const t=e.contentWindow;t.stop(),$e("requestTimeouts",n,a),Je(r,s,a,n),i.push(ot(r,t,a,s,e.scrolling))}catch(e){i.push({windowId:a,processed:!0})}})),tt({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o)}function $e(e,t,s){const o=We.get(t);if(o&&o[e]){const t=o[e][s];t&&(globalThis.clearTimeout(t),delete o[e][s])}}function Qe(e,t){const s=We.get(e);s&&s.responseTimeouts&&(s.responseTimeouts[t]=globalThis.setTimeout((()=>tt({frames:[{windowId:t,processed:!0}],sessionId:e})),1e4))}function et(e,t,s){e.forEach(((e,o)=>{const n=t+Le+o;e.removeAttribute(Se.WIN_ID_ATTRIBUTE_NAME);try{st(e.contentWindow,{method:Me,windowId:n,sessionId:s})}catch(e){}})),e.forEach(((e,o)=>{const n=t+Le+o;let i;try{i=e.contentDocument}catch(e){}if(i)try{et(nt(i),n,s)}catch(e){}}))}function tt(e){e.method=Oe;try{qe.singlefile.processors.frameTree.initResponse(e)}catch(t){st(qe,e,!0)}}function st(e,t,s){if(e==qe&&Ue&&Ue.runtime&&Ue.runtime.sendMessage)Ue.runtime.sendMessage(t);else if(s){const s=new ke;e.postMessage(Ne+Be.stringify({method:t.method,sessionId:t.sessionId}),De,[s.port2]),s.port1.postMessage(t)}else e.postMessage(Ne+Be.stringify(t),De)}function ot(e,t,s,o,n){const i=Se.preProcessDoc(e,t,o),a=Se.serialize(e);Se.postProcessDoc(e,i.markedElements,i.invalidElements);return{windowId:s,content:a,baseURI:e.baseURI.split("#")[0],url:e.location.href,title:e.title,canvases:i.canvases,fonts:i.fonts,stylesheets:i.stylesheets,images:i.images,posters:i.posters,videos:i.videos,usedFonts:i.usedFonts,shadowRoots:i.shadowRoots,scrollPosition:i.scrollPosition,scrolling:n,processed:!0}}function nt(e){let t=Array.from(e.querySelectorAll(Re));return e.querySelectorAll(_e).forEach((e=>{const s=Se.getShadowRoot(e);s&&(t=t.concat(...s.querySelectorAll(Re)))})),t}We||(We=globalThis.sessions=new Map),xe&&(Ve="0",Ue&&Ue.runtime&&Ue.runtime.onMessage&&Ue.runtime.onMessage.addListener&&Ue.runtime.onMessage.addListener((e=>e.method==Oe?(Ze(e),Promise.resolve({})):e.method==Ce?($e("requestTimeouts",e.sessionId,e.windowId),Qe(e.sessionId,e.windowId),Promise.resolve({})):void 0))),ze="message",Ye=async e=>{if("string"==typeof e.data&&e.data.startsWith(Ne)){e.preventDefault(),e.stopPropagation();const t=Be.parse(e.data.substring(Ne.length));t.method==Pe?(e.source&&st(e.source,{method:Ce,windowId:t.windowId,sessionId:t.sessionId}),xe||(globalThis.stop(),t.options.loadDeferredImages&&Te(t.options),await Ke(t))):t.method==Ce?($e("requestTimeouts",t.sessionId,t.windowId),Qe(t.sessionId,t.windowId)):t.method==Me?Xe(t):t.method==Oe&&We.get(t.sessionId)&&(e.ports[0].onmessage=e=>Ze(e.data))}},je=!0,globalThis.addEventListener(ze,Ye,je);var it=Object.freeze({__proto__:null,getAsync:function(e){const t=Ge();return e=Be.parse(Be.stringify(e)),new Promise((s=>{We.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{},resolve:e=>{e.sessionId=t,s(e)}}),Ke({windowId:Ve,sessionId:t,options:e})}))},getSync:function(e){const t=Ge();e=Be.parse(Be.stringify(e)),We.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{}}),function(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,xe||(Ve=globalThis.frameId=e.windowId);Je(He,e.options,Ve,t),xe||(e.options.userScriptEnabled&&s&&s(Se.ON_BEFORE_CAPTURE_EVENT_NAME),tt({frames:[ot(He,globalThis,Ve,e.options,e.scrolling)],sessionId:t,requestedFrameId:He.documentElement.dataset.requestedFrameId&&Ve}),e.options.userScriptEnabled&&s&&s(Se.ON_AFTER_CAPTURE_EVENT_NAME),delete He.documentElement.dataset.requestedFrameId)}({windowId:Ve,sessionId:t,options:e});const s=We.get(t).frames;return s.sessionId=t,s},cleanup:function(e){We.delete(e),Xe({windowId:Ve,sessionId:e,options:{sessionId:e}})},initResponse:Ze,TIMEOUT_INIT_REQUEST_MESSAGE:Fe});const at=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"],rt=1,lt=3,dt=8,ct=[{tagName:"HEAD",accept:e=>!e.childNodes.length||e.childNodes[0].nodeType==rt},{tagName:"BODY",accept:e=>!e.childNodes.length}],mt=[{tagName:"HTML",accept:e=>!e||e.nodeType!=dt},{tagName:"HEAD",accept:e=>!e||e.nodeType!=dt&&(e.nodeType!=lt||!pt(e.textContent))},{tagName:"BODY",accept:e=>!e||e.nodeType!=dt},{tagName:"LI",accept:(e,t)=>!e&&t.parentElement&&("UL"==ft(t.parentElement)||"OL"==ft(t.parentElement))||e&&["LI"].includes(ft(e))},{tagName:"DT",accept:e=>!e||["DT","DD"].includes(ft(e))},{tagName:"P",accept:e=>e&&["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DETAILS","DIV","DL","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HR","MAIN","NAV","OL","P","PRE","SECTION","TABLE","UL"].includes(ft(e))},{tagName:"DD",accept:e=>!e||["DT","DD"].includes(ft(e))},{tagName:"RT",accept:e=>!e||["RT","RP"].includes(ft(e))},{tagName:"RP",accept:e=>!e||["RT","RP"].includes(ft(e))},{tagName:"OPTGROUP",accept:e=>!e||["OPTGROUP"].includes(ft(e))},{tagName:"OPTION",accept:e=>!e||["OPTION","OPTGROUP"].includes(ft(e))},{tagName:"COLGROUP",accept:e=>!e||e.nodeType!=dt&&(e.nodeType!=lt||!pt(e.textContent))},{tagName:"CAPTION",accept:e=>!e||e.nodeType!=dt&&(e.nodeType!=lt||!pt(e.textContent))},{tagName:"THEAD",accept:e=>!e||["TBODY","TFOOT"].includes(ft(e))},{tagName:"TBODY",accept:e=>!e||["TBODY","TFOOT"].includes(ft(e))},{tagName:"TFOOT",accept:e=>!e},{tagName:"TR",accept:e=>!e||["TR"].includes(ft(e))},{tagName:"TD",accept:e=>!e||["TD","TH"].includes(ft(e))},{tagName:"TH",accept:e=>!e||["TD","TH"].includes(ft(e))}],ut=["STYLE","SCRIPT","XMP","IFRAME","NOEMBED","NOFRAMES","PLAINTEXT","NOSCRIPT"];function gt(e,t,s){return e.nodeType==lt?function(e){const t=e.parentNode;let s;t&&t.nodeType==rt&&(s=ft(t));return!s||ut.includes(s)?"SCRIPT"==s||"STYLE"==s?e.textContent.replace(/<\//gi,"<\\/").replace(/\/>/gi,"\\/>"):e.textContent:e.textContent.replace(/&/g,"&amp;").replace(/\u00a0/g,"&nbsp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}(e):e.nodeType==dt?"\x3c!--"+e.textContent+"--\x3e":e.nodeType==rt?function(e,t,s){const o=ft(e),n=t&&ct.find((t=>o==ft(t)&&t.accept(e)));let i="";n&&!e.attributes.length||(i="<"+o.toLowerCase(),Array.from(e.attributes).forEach((s=>i+=function(e,t,s){const o=e.name;let n="";if(!o.match(/["'>/=]/)){let i,a=e.value;s&&"class"==o&&(a=Array.from(t.classList).map((e=>e.trim())).join(" ")),a=a.replace(/&/g,"&amp;").replace(/\u00a0/g,"&nbsp;"),a.includes('"')&&(a.includes("'")||!s?a=a.replace(/"/g,"&quot;"):i=!0);const r=!s||a.match(/[ \t\n\f\r'"`=<>]/);n+=" ",e.namespace?"http://www.w3.org/XML/1998/namespace"==e.namespaceURI?n+="xml:"+o:"http://www.w3.org/2000/xmlns/"==e.namespaceURI?("xmlns"!==o&&(n+="xmlns:"),n+=o):"http://www.w3.org/1999/xlink"==e.namespaceURI?n+="xlink:"+o:n+=o:n+=o,""!=a&&(n+="=",r&&(n+=i?"'":'"'),n+=a,r&&(n+=i?"'":'"'))}return n}(s,e,t))),i+=">");"TEMPLATE"!=o||e.childNodes.length?Array.from(e.childNodes).forEach((e=>i+=gt(e,t,s||"svg"==o))):i+=e.innerHTML;const a=t&&mt.find((t=>o==ft(t)&&t.accept(e.nextSibling,e)));(s||!a&&!at.includes(o))&&(i+="</"+o.toLowerCase()+">");return i}(e,t,s):void 0}function pt(e){return Boolean(e.match(/^[ \t\n\f\r]/))}function ft(e){return e.tagName&&e.tagName.toUpperCase()}const ht={frameTree:it},Tt={COMMENT_HEADER:"Page saved with SingleFile",COMMENT_HEADER_LEGACY:"Archive processed by SingleFile",ON_BEFORE_CAPTURE_EVENT_NAME:w,ON_AFTER_CAPTURE_EVENT_NAME:A,preProcessDoc:J,postProcessDoc:oe,serialize:(e,t)=>function(e,t){const s=e.doctype;let o="";return s&&(o="<!DOCTYPE "+s.nodeName,s.publicId?(o+=' PUBLIC "'+s.publicId+'"',s.systemId&&(o+=' "'+s.systemId+'"')):s.systemId&&(o+=' SYSTEM "'+s.systemId+'"'),s.internalSubset&&(o+=" ["+s.internalSubset+"]"),o+="> "),o+gt(e.documentElement,t)}(e,t),getShadowRoot:ee};X("single-file-user-script-init",(()=>globalThis._singleFile_waitForUserScript=async e=>{const t=new CustomEvent(e+"-request",{cancelable:!0}),s=new Promise((t=>X(e+"-response",t)));(e=>{try{globalThis.dispatchEvent(e)}catch(e){}})(t),t.defaultPrevented&&await s})),e.helper=Tt,e.processors=ht,Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).singlefile={})}(this,(function(e){"use strict";const t="single-file-load-deferred-images-start",s="single-file-load-deferred-images-end",o="single-file-load-deferred-images-keep-zoom-level-start",n="single-file-load-deferred-images-keep-zoom-level-end",i="single-file-block-cookies-start",r="single-file-block-cookies-end",a="single-file-dispatch-scroll-event-start",l="single-file-dispatch-scroll-event-end",d="single-file-block-storage-start",c="single-file-block-storage-end",u="single-file-load-image",m="single-file-image-loaded",g=(e,t,s)=>globalThis.addEventListener(e,t,s),f=e=>{try{globalThis.dispatchEvent(e)}catch(e){}},h=globalThis.CustomEvent,p=globalThis.document,b=globalThis.Document,E=globalThis.JSON;let y;y=window._singleFile_fontFaces?window._singleFile_fontFaces:window._singleFile_fontFaces=new Map,p instanceof b&&(g("single-file-new-font-face",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,y.set(E.stringify(s),t)})),g("single-file-delete-font",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,y.delete(E.stringify(s))})),g("single-file-clear-fonts",(()=>y=new Map)));const T="[\\x20\\t\\r\\n\\f]",w=new RegExp("\\\\([\\da-f]{1,6}"+T+"?|("+T+")|.)","ig");const I="single-file-request-get-adopted-stylesheets",v="single-file-response-get-adopted-stylesheets",A="data-single-file-removed-content",S="data-single-file-hidden-content",_="data-single-file-kept-content",R="data-single-file-hidden-frame",M="data-single-file-preserved-space-element",F="data-single-file-shadow-root-element",N="data-single-file-image",C="data-single-file-poster",q="data-single-file-video",x="data-single-file-canvas",P="data-single-file-movable-style",L="data-single-file-input-value",k="data-single-file-lazy-loaded-src",D="data-single-file-stylesheet",U="data-single-file-disabled-noscript",O="data-single-file-async-script",V="*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)",W=["NOSCRIPT","DISABLED-NOSCRIPT","META","LINK","STYLE","TITLE","TEMPLATE","SOURCE","OBJECT","SCRIPT","HEAD","BODY"],H=/^'(.*?)'$/,z=/^"(.*?)"$/,B={regular:"400",normal:"400",bold:"700",bolder:"700",lighter:"100"},j="single-file-ui-element",Y="data:,",G=globalThis.JSON;function Z(e,t,s,o,n={usedFonts:new Map,canvases:[],images:[],posters:[],videos:[],shadowRoots:[],markedElements:[]},i){if(s.childNodes){Array.from(s.childNodes).filter((t=>t instanceof e.HTMLElement||t instanceof e.SVGElement)).forEach((s=>{let r,a,l;if(!o.autoSaveExternalSave&&(o.removeHiddenElements||o.removeUnusedFonts||o.compressHTML)&&(l=te(e,s),s instanceof e.HTMLElement&&o.removeHiddenElements&&(a=(i||s.closest("html > head"))&&W.includes(s.tagName.toUpperCase())||s.closest("details"),a||(r=i||X(s,l),r&&(s.setAttribute(S,""),n.markedElements.push(s)))),!r)){if(o.compressHTML&&l){const e=l.getPropertyValue("white-space");e&&e.startsWith("pre")&&(s.setAttribute(M,""),n.markedElements.push(s))}o.removeUnusedFonts&&(J(l,o,n.usedFonts),J(te(e,s,":first-letter"),o,n.usedFonts),J(te(e,s,":before"),o,n.usedFonts),J(te(e,s,":after"),o,n.usedFonts))}!function(e,t,s,o,n,i,r){const a=s.tagName&&s.tagName.toUpperCase();if("CANVAS"==a)try{n.canvases.push({dataURI:s.toDataURL("image/png","")}),s.setAttribute(x,n.canvases.length-1),n.markedElements.push(s)}catch(e){}if("IMG"==a){const t={currentSrc:i?Y:o.loadDeferredImages&&s.getAttribute(k)||s.currentSrc};if(n.images.push(t),s.setAttribute(N,n.images.length-1),n.markedElements.push(s),s.removeAttribute(k),r=r||te(e,s)){t.size=function(e,t,s){let o=t.naturalWidth,n=t.naturalHeight;if(!o&&!n){const i=null==t.getAttribute("style");if(s=s||te(e,t)){let e,r,a,l,d,c,u,m,g=!1;if("content-box"==s.getPropertyValue("box-sizing")){const e=t.style.getPropertyValue("box-sizing"),s=t.style.getPropertyPriority("box-sizing"),o=t.clientWidth;t.style.setProperty("box-sizing","border-box","important"),g=t.clientWidth!=o,e?t.style.setProperty("box-sizing",e,s):t.style.removeProperty("box-sizing")}e=ee("padding-left",s),r=ee("padding-right",s),a=ee("padding-top",s),l=ee("padding-bottom",s),g?(d=ee("border-left-width",s),c=ee("border-right-width",s),u=ee("border-top-width",s),m=ee("border-bottom-width",s)):d=c=u=m=0,o=Math.max(0,t.clientWidth-e-r-d-c),n=Math.max(0,t.clientHeight-a-l-u-m),i&&t.removeAttribute("style")}}return{pxWidth:o,pxHeight:n}}(e,s,r);const o=r.getPropertyValue("box-shadow"),n=r.getPropertyValue("background-image");o&&"none"!=o||n&&"none"!=n||!(t.size.pxWidth>1||t.size.pxHeight>1)||(t.replaceable=!0,t.backgroundColor=r.getPropertyValue("background-color"),t.objectFit=r.getPropertyValue("object-fit"),t.boxSizing=r.getPropertyValue("box-sizing"),t.objectPosition=r.getPropertyValue("object-position"))}}if("VIDEO"==a){const o=s.currentSrc;if(o&&!o.startsWith("blob:")&&!o.startsWith("data:")){const t=te(e,s.parentNode);n.videos.push({positionParent:t&&t.getPropertyValue("position"),src:o,size:{pxWidth:s.clientWidth,pxHeight:s.clientHeight},currentTime:s.currentTime}),s.setAttribute(q,n.videos.length-1)}if(!s.getAttribute("poster")){const e=t.createElement("canvas"),o=e.getContext("2d");e.width=s.clientWidth,e.height=s.clientHeight;try{o.drawImage(s,0,0,e.width,e.height),n.posters.push(e.toDataURL("image/png","")),s.setAttribute(C,n.posters.length-1),n.markedElements.push(s)}catch(e){}}}"IFRAME"==a&&i&&o.removeHiddenElements&&(s.setAttribute(R,""),n.markedElements.push(s));"INPUT"==a&&("password"!=s.type&&(s.setAttribute(L,s.value),n.markedElements.push(s)),"radio"!=s.type&&"checkbox"!=s.type||(s.setAttribute(L,s.checked),n.markedElements.push(s)));"TEXTAREA"==a&&(s.setAttribute(L,s.value),n.markedElements.push(s));"SELECT"==a&&s.querySelectorAll("option").forEach((e=>{e.selected&&(e.setAttribute(L,""),n.markedElements.push(e))}));"SCRIPT"==a&&(s.async&&""!=s.getAttribute("async")&&"async"!=s.getAttribute("async")&&(s.setAttribute(O,""),n.markedElements.push(s)),s.textContent=s.textContent.replace(/<\/script>/gi,"<\\/script>"))}(e,t,s,o,n,r,l);const d=!(s instanceof e.SVGElement)&&$(s);if(d&&!s.classList.contains(j)){const i={};s.setAttribute(F,n.shadowRoots.length),n.markedElements.push(s),n.shadowRoots.push(i),Z(e,t,d,o,n,r),i.content=d.innerHTML,i.mode=d.mode;try{if(d.adoptedStyleSheets)if(d.adoptedStyleSheets.length)i.adoptedStyleSheets=Array.from(d.adoptedStyleSheets).map((e=>Array.from(e.cssRules).map((e=>e.cssText)).join("\n")));else if(void 0===d.adoptedStyleSheets.length){const e=e=>i.adoptedStyleSheets=e.detail.adoptedStyleSheets;s.addEventListener(v,e),s.dispatchEvent(new CustomEvent(I,{options:{bubbles:!0,composed:!0}})),s.removeEventListener(v,e)}}catch(e){}}Z(e,t,s,o,n,r),!o.autoSaveExternalSave&&o.removeHiddenElements&&i&&(a||""==s.getAttribute(_)?s.parentElement&&(s.parentElement.setAttribute(_,""),n.markedElements.push(s.parentElement)):r&&(s.setAttribute(A,""),n.markedElements.push(s)))}))}return n}function J(e,t,s){if(e){const o=e.getPropertyValue("font-style")||"normal";e.getPropertyValue("font-family").split(",").forEach((n=>{if(n=K(n),!t.loadedFonts||t.loadedFonts.find((e=>K(e.family)==n&&e.style==o))){const t=(i=e.getPropertyValue("font-weight"),B[i.toLowerCase().trim()]||i),r=e.getPropertyValue("font-variant")||"normal",a=[n,t,o,r];s.set(G.stringify(a),[n,t,o,r])}var i}))}}function $(e){const t=globalThis.chrome;if(e.openOrClosedShadowRoot)return e.openOrClosedShadowRoot;if(!(t&&t.dom&&t.dom.openOrClosedShadowRoot))return e.shadowRoot;try{return t.dom.openOrClosedShadowRoot(e)}catch(t){return e.shadowRoot}}function K(e=""){return function(e){e=e.match(H)?e.replace(H,"$1"):e.replace(z,"$1");return e.trim()}((t=e.trim(),t.replace(w,((e,t,s)=>{const o="0x"+t-65536;return o!=o||s?t:o<0?String.fromCharCode(o+65536):String.fromCharCode(o>>10|55296,1023&o|56320)})))).toLowerCase();var t}function X(e,t){let s=!1;if(t){const o=t.getPropertyValue("display"),n=t.getPropertyValue("opacity"),i=t.getPropertyValue("visibility");if(s="none"==o,!s&&("0"==n||"hidden"==i)&&e.getBoundingClientRect){const t=e.getBoundingClientRect();s=!t.width&&!t.height}}return Boolean(s)}function Q(e){if(e){const t=[];return e.querySelectorAll("style").forEach(((s,o)=>{try{const n=e.createElement("style");n.textContent=s.textContent,e.body.appendChild(n);const i=n.sheet;n.remove(),i&&i.cssRules.length==s.sheet.cssRules.length||(s.setAttribute(D,o),t[o]=Array.from(s.sheet.cssRules).map((e=>e.cssText)).join("\n"))}catch(e){}})),t}}function ee(e,t){if(t.getPropertyValue(e).endsWith("px"))return parseFloat(t.getPropertyValue(e))}function te(e,t,s){try{return e.getComputedStyle(t,s)}catch(e){}}const se={LAZY_SRC_ATTRIBUTE_NAME:k,SINGLE_FILE_UI_ELEMENT_CLASS:j},oe=10,ne="attributes",ie=globalThis.browser,re=globalThis.document,ae=globalThis.MutationObserver,le=(e,t,s)=>globalThis.addEventListener(e,t,s),de=(e,t,s)=>globalThis.removeEventListener(e,t,s),ce=new Map;let ue;async function me(e){if(re.documentElement){ce.clear();const s=re.body&&re.body.scrollHeight||re.documentElement.scrollHeight,n=re.body&&re.body.scrollWidth||re.documentElement.scrollWidth;if(s>globalThis.innerHeight||n>globalThis.innerWidth){const r=Math.max(s-1.5*globalThis.innerHeight,0),l=Math.max(n-1.5*globalThis.innerWidth,0);if(globalThis.scrollY<r||globalThis.scrollX<l)return function(e){return ue=0,new Promise((async s=>{let n;const r=new Set,l=new ae((async t=>{if((t=t.filter((e=>e.type==ne))).length){t.filter((e=>{if("src"==e.attributeName&&(e.target.setAttribute(se.LAZY_SRC_ATTRIBUTE_NAME,e.target.src),e.target.addEventListener("load",g)),"src"==e.attributeName||"srcset"==e.attributeName||e.target.tagName&&"SOURCE"==e.target.tagName.toUpperCase())return!e.target.classList||!e.target.classList.contains(se.SINGLE_FILE_UI_ELEMENT_CLASS)})).length&&(n=!0,await fe(l,e,E),r.size||await ge(l,e,E))}}));async function c(t){await pe("idleTimeout",(async()=>{n?ue<oe&&(ue++,Ee("idleTimeout"),await c(Math.max(500,t/2))):(Ee("loadTimeout"),Ee("maxTimeout"),he(l,e,E))}),t,e.loadDeferredImagesNativeTimeout)}function g(e){const t=e.target;t.removeAttribute(se.LAZY_SRC_ATTRIBUTE_NAME),t.removeEventListener("load",g)}async function p(t){n=!0,await fe(l,e,E),await ge(l,e,E),t.detail&&r.add(t.detail)}async function b(t){await fe(l,e,E),await ge(l,e,E),r.delete(t.detail),r.size||await ge(l,e,E)}function E(e){l.disconnect(),de(u,p),de(m,b),s(e)}await c(2*e.loadDeferredImagesMaxIdleTime),await fe(l,e,E),l.observe(re,{subtree:!0,childList:!0,attributes:!0}),le(u,p),le(m,b),function(e){e.loadDeferredImagesBlockCookies&&f(new h(i)),e.loadDeferredImagesBlockStorage&&f(new h(d)),e.loadDeferredImagesDispatchScrollEvent&&f(new h(a)),e.loadDeferredImagesKeepZoomLevel?f(new h(o)):f(new h(t))}(e)}))}(e)}}}async function ge(e,t,s){await pe("loadTimeout",(()=>he(e,t,s)),t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function fe(e,t,s){await pe("maxTimeout",(async()=>{await Ee("loadTimeout"),await he(e,t,s)}),10*t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function he(e,t,o){await Ee("idleTimeout"),function(e){e.loadDeferredImagesBlockCookies&&f(new h(r)),e.loadDeferredImagesBlockStorage&&f(new h(c)),e.loadDeferredImagesDispatchScrollEvent&&f(new h(l)),e.loadDeferredImagesKeepZoomLevel?f(new h(n)):f(new h(s))}(t),await pe("endTimeout",(async()=>{await Ee("maxTimeout"),o()}),t.loadDeferredImagesMaxIdleTime/2,t.loadDeferredImagesNativeTimeout),e.disconnect()}async function pe(e,t,s,o){if(ie&&ie.runtime&&ie.runtime.sendMessage&&!o){if(!ce.get(e)||!ce.get(e).pending){const o={callback:t,pending:!0};ce.set(e,o);try{await ie.runtime.sendMessage({method:"singlefile.lazyTimeout.setTimeout",type:e,delay:s})}catch(o){be(e,t,s)}o.pending=!1}}else be(e,t,s)}function be(e,t,s){const o=ce.get(e);o&&globalThis.clearTimeout(o),ce.set(e,t),globalThis.setTimeout(t,s)}async function Ee(e){if(ie&&ie.runtime&&ie.runtime.sendMessage)try{await ie.runtime.sendMessage({method:"singlefile.lazyTimeout.clearTimeout",type:e})}catch(t){ye(e)}else ye(e)}function ye(e){const t=ce.get(e);ce.delete(e),t&&globalThis.clearTimeout(t)}ie&&ie.runtime&&ie.runtime.onMessage&&ie.runtime.onMessage.addListener&&ie.runtime.onMessage.addListener((e=>{if("singlefile.lazyTimeout.onTimeout"==e.method){const t=ce.get(e.type);if(t){ce.delete(e.type);try{t.callback()}catch(t){ye(e.type)}}}}));const Te={ON_BEFORE_CAPTURE_EVENT_NAME:"single-file-on-before-capture",ON_AFTER_CAPTURE_EVENT_NAME:"single-file-on-after-capture",WIN_ID_ATTRIBUTE_NAME:"data-single-file-win-id",preProcessDoc:function(e,t,s){e.querySelectorAll("noscript:not(["+U+"])").forEach((e=>{e.setAttribute(U,e.textContent),e.textContent=""})),function(e){e.querySelectorAll("meta[http-equiv=refresh]").forEach((e=>{e.removeAttribute("http-equiv"),e.setAttribute("disabled-http-equiv","refresh")}))}(e),e.head&&e.head.querySelectorAll(V).forEach((e=>e.hidden=!0)),e.querySelectorAll("svg foreignObject").forEach((e=>{const t=e.querySelectorAll("html > head > "+V+", html > body > "+V);t.length&&(Array.from(e.childNodes).forEach((e=>e.remove())),t.forEach((t=>e.appendChild(t))))}));const o=new Map;let n;return t&&e.documentElement?(e.querySelectorAll("button button, a a").forEach((t=>{const s=e.createElement("template");s.setAttribute("data-single-file-invalid-element",""),s.content.appendChild(t.cloneNode(!0)),o.set(t,s),t.replaceWith(s)})),n=Z(t,e,e.documentElement,s),s.moveStylesInHead&&e.querySelectorAll("body style, body ~ style").forEach((e=>{const s=te(t,e);s&&X(e,s)&&(e.setAttribute(P,""),n.markedElements.push(e))}))):n={canvases:[],images:[],posters:[],videos:[],usedFonts:[],shadowRoots:[],markedElements:[]},{canvases:n.canvases,fonts:Array.from(y.values()),stylesheets:Q(e),images:n.images,posters:n.posters,videos:n.videos,usedFonts:Array.from(n.usedFonts.values()),shadowRoots:n.shadowRoots,referrer:e.referrer,markedElements:n.markedElements,invalidElements:o}},serialize:function(e){const t=e.doctype;let s="";return t&&(s="<!DOCTYPE "+t.nodeName,t.publicId?(s+=' PUBLIC "'+t.publicId+'"',t.systemId&&(s+=' "'+t.systemId+'"')):t.systemId&&(s+=' SYSTEM "'+t.systemId+'"'),t.internalSubset&&(s+=" ["+t.internalSubset+"]"),s+="> "),s+e.documentElement.outerHTML},postProcessDoc:function(e,t,s){if(e.querySelectorAll("["+U+"]").forEach((e=>{e.textContent=e.getAttribute(U),e.removeAttribute(U)})),e.querySelectorAll("meta[disabled-http-equiv]").forEach((e=>{e.setAttribute("http-equiv",e.getAttribute("disabled-http-equiv")),e.removeAttribute("disabled-http-equiv")})),e.head&&e.head.querySelectorAll("*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)").forEach((e=>e.removeAttribute("hidden"))),!t){const s=[A,R,S,M,N,C,q,x,L,F,D,O];t=e.querySelectorAll(s.map((e=>"["+e+"]")).join(","))}t.forEach((e=>{e.removeAttribute(A),e.removeAttribute(S),e.removeAttribute(_),e.removeAttribute(R),e.removeAttribute(M),e.removeAttribute(N),e.removeAttribute(C),e.removeAttribute(q),e.removeAttribute(x),e.removeAttribute(L),e.removeAttribute(F),e.removeAttribute(D),e.removeAttribute(O),e.removeAttribute(P)})),s&&s.forEach(((e,t)=>e.replaceWith(t)))},getShadowRoot:$},we="__frameTree__::",Ie='iframe, frame, object[type="text/html"][data]',ve="*",Ae="singlefile.frameTree.initRequest",Se="singlefile.frameTree.ackInitRequest",_e="singlefile.frameTree.cleanupRequest",Re="singlefile.frameTree.initResponse",Me="*",Fe=5e3,Ne=".",Ce=globalThis.window==globalThis.top,qe=globalThis.browser,xe=globalThis.top,Pe=globalThis.MessageChannel,Le=globalThis.document,ke=globalThis.JSON;let De,Ue=globalThis.sessions;var Oe,Ve,We;function He(){return globalThis.crypto.getRandomValues(new Uint32Array(32)).join("")}async function ze(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,Ce||(De=globalThis.frameId=e.windowId),Ye(Le,e.options,De,t),Ce||(e.options.userScriptEnabled&&s&&await s(Te.ON_BEFORE_CAPTURE_EVENT_NAME),$e({frames:[Xe(Le,globalThis,De,e.options)],sessionId:t,requestedFrameId:Le.documentElement.dataset.requestedFrameId&&De}),e.options.userScriptEnabled&&s&&await s(Te.ON_AFTER_CAPTURE_EVENT_NAME),delete Le.documentElement.dataset.requestedFrameId)}function Be(e){if(!globalThis._singleFile_cleaningUp){globalThis._singleFile_cleaningUp=!0;const t=e.sessionId;Je(Qe(Le),e.windowId,t)}}function je(e){e.frames.forEach((t=>Ge("responseTimeouts",e.sessionId,t.windowId)));const t=Ue.get(e.sessionId);if(t){e.requestedFrameId&&(t.requestedFrameId=e.requestedFrameId),e.frames.forEach((e=>{let s=t.frames.find((t=>e.windowId==t.windowId));s||(s={windowId:e.windowId},t.frames.push(s)),s.processed||(s.content=e.content,s.baseURI=e.baseURI,s.title=e.title,s.url=e.url,s.canvases=e.canvases,s.fonts=e.fonts,s.stylesheets=e.stylesheets,s.images=e.images,s.posters=e.posters,s.videos=e.videos,s.usedFonts=e.usedFonts,s.shadowRoots=e.shadowRoots,s.processed=e.processed)}));t.frames.filter((e=>!e.processed)).length||(t.frames=t.frames.sort(((e,t)=>t.windowId.split(Ne).length-e.windowId.split(Ne).length)),t.resolve&&(t.requestedFrameId&&t.frames.forEach((e=>{e.windowId==t.requestedFrameId&&(e.requestedFrame=!0)})),t.resolve(t.frames)))}}function Ye(e,t,s,o){const n=Qe(e);!function(e,t,s,o,n){const i=[];let r;Ue.get(n)?r=Ue.get(n).requestTimeouts:(r={},Ue.set(n,{requestTimeouts:r}));t.forEach(((e,t)=>{const s=o+Ne+t;e.setAttribute(Te.WIN_ID_ATTRIBUTE_NAME,s),i.push({windowId:s})})),$e({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),t.forEach(((e,t)=>{const i=o+Ne+t;try{Ke(e.contentWindow,{method:Ae,windowId:i,sessionId:n,options:s})}catch(e){}r[i]=globalThis.setTimeout((()=>$e({frames:[{windowId:i,processed:!0}],sessionId:n})),Fe)})),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o),n.length&&function(e,t,s,o,n){const i=[];t.forEach(((e,t)=>{const r=o+Ne+t;let a;try{a=e.contentDocument}catch(e){}if(a)try{const t=e.contentWindow;t.stop(),Ge("requestTimeouts",n,r),Ye(a,s,r,n),i.push(Xe(a,t,r,s))}catch(e){i.push({windowId:r,processed:!0})}})),$e({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o)}function Ge(e,t,s){const o=Ue.get(t);if(o&&o[e]){const t=o[e][s];t&&(globalThis.clearTimeout(t),delete o[e][s])}}function Ze(e,t){const s=Ue.get(e);s&&s.responseTimeouts&&(s.responseTimeouts[t]=globalThis.setTimeout((()=>$e({frames:[{windowId:t,processed:!0}],sessionId:e})),1e4))}function Je(e,t,s){e.forEach(((e,o)=>{const n=t+Ne+o;e.removeAttribute(Te.WIN_ID_ATTRIBUTE_NAME);try{Ke(e.contentWindow,{method:_e,windowId:n,sessionId:s})}catch(e){}})),e.forEach(((e,o)=>{const n=t+Ne+o;let i;try{i=e.contentDocument}catch(e){}if(i)try{Je(Qe(i),n,s)}catch(e){}}))}function $e(e){e.method=Re;try{xe.singlefile.processors.frameTree.initResponse(e)}catch(t){Ke(xe,e,!0)}}function Ke(e,t,s){if(e==xe&&qe&&qe.runtime&&qe.runtime.sendMessage)qe.runtime.sendMessage(t);else if(s){const s=new Pe;e.postMessage(we+ke.stringify({method:t.method,sessionId:t.sessionId}),Me,[s.port2]),s.port1.postMessage(t)}else e.postMessage(we+ke.stringify(t),Me)}function Xe(e,t,s,o){const n=Te.preProcessDoc(e,t,o),i=Te.serialize(e);Te.postProcessDoc(e,n.markedElements,n.invalidElements);return{windowId:s,content:i,baseURI:e.baseURI.split("#")[0],url:e.location.href,title:e.title,canvases:n.canvases,fonts:n.fonts,stylesheets:n.stylesheets,images:n.images,posters:n.posters,videos:n.videos,usedFonts:n.usedFonts,shadowRoots:n.shadowRoots,processed:!0}}function Qe(e){let t=Array.from(e.querySelectorAll(Ie));return e.querySelectorAll(ve).forEach((e=>{const s=Te.getShadowRoot(e);s&&(t=t.concat(...s.querySelectorAll(Ie)))})),t}Ue||(Ue=globalThis.sessions=new Map),Ce&&(De="0",qe&&qe.runtime&&qe.runtime.onMessage&&qe.runtime.onMessage.addListener&&qe.runtime.onMessage.addListener((e=>e.method==Re?(je(e),Promise.resolve({})):e.method==Se?(Ge("requestTimeouts",e.sessionId,e.windowId),Ze(e.sessionId,e.windowId),Promise.resolve({})):void 0))),Oe="message",Ve=async e=>{if("string"==typeof e.data&&e.data.startsWith(we)){e.preventDefault(),e.stopPropagation();const t=ke.parse(e.data.substring(we.length));t.method==Ae?(e.source&&Ke(e.source,{method:Se,windowId:t.windowId,sessionId:t.sessionId}),Ce||(globalThis.stop(),t.options.loadDeferredImages&&me(t.options),await ze(t))):t.method==Se?(Ge("requestTimeouts",t.sessionId,t.windowId),Ze(t.sessionId,t.windowId)):t.method==_e?Be(t):t.method==Re&&Ue.get(t.sessionId)&&(e.ports[0].onmessage=e=>je(e.data))}},We=!0,globalThis.addEventListener(Oe,Ve,We),e.TIMEOUT_INIT_REQUEST_MESSAGE=Fe,e.cleanup=function(e){Ue.delete(e),Be({windowId:De,sessionId:e,options:{sessionId:e}})},e.getAsync=function(e){const t=He();return e=ke.parse(ke.stringify(e)),new Promise((s=>{Ue.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{},resolve:e=>{e.sessionId=t,s(e)}}),ze({windowId:De,sessionId:t,options:e})}))},e.getSync=function(e){const t=He();e=ke.parse(ke.stringify(e)),Ue.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{}}),function(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,Ce||(De=globalThis.frameId=e.windowId);Ye(Le,e.options,De,t),Ce||(e.options.userScriptEnabled&&s&&s(Te.ON_BEFORE_CAPTURE_EVENT_NAME),$e({frames:[Xe(Le,globalThis,De,e.options)],sessionId:t,requestedFrameId:Le.documentElement.dataset.requestedFrameId&&De}),e.options.userScriptEnabled&&s&&s(Te.ON_AFTER_CAPTURE_EVENT_NAME),delete Le.documentElement.dataset.requestedFrameId)}({windowId:De,sessionId:t,options:e});const s=Ue.get(t).frames;return s.sessionId=t,s},e.initResponse=je,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).singlefile={})}(this,(function(e){"use strict";const t="single-file-load-deferred-images-start",s="single-file-load-deferred-images-end",o="single-file-load-deferred-images-keep-zoom-level-start",n="single-file-load-deferred-images-keep-zoom-level-end",i="single-file-block-cookies-start",r="single-file-block-cookies-end",a="single-file-dispatch-scroll-event-start",l="single-file-dispatch-scroll-event-end",d="single-file-block-storage-start",c="single-file-block-storage-end",u="single-file-load-image",m="single-file-image-loaded",g=(e,t,s)=>globalThis.addEventListener(e,t,s),f=e=>{try{globalThis.dispatchEvent(e)}catch(e){}},h=globalThis.CustomEvent,p=globalThis.document,b=globalThis.Document,E=globalThis.JSON;let y;y=window._singleFile_fontFaces?window._singleFile_fontFaces:window._singleFile_fontFaces=new Map,p instanceof b&&(g("single-file-new-font-face",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,y.set(E.stringify(s),t)})),g("single-file-delete-font",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,y.delete(E.stringify(s))})),g("single-file-clear-fonts",(()=>y=new Map)));const T="[\\x20\\t\\r\\n\\f]",w=new RegExp("\\\\([\\da-f]{1,6}"+T+"?|("+T+")|.)","ig");const I="single-file-request-get-adopted-stylesheets",v="single-file-response-get-adopted-stylesheets",A="data-single-file-removed-content",S="data-single-file-hidden-content",_="data-single-file-kept-content",R="data-single-file-hidden-frame",M="data-single-file-preserved-space-element",F="data-single-file-shadow-root-element",N="data-single-file-image",C="data-single-file-poster",P="data-single-file-video",q="data-single-file-canvas",x="data-single-file-movable-style",k="data-single-file-input-value",L="data-single-file-lazy-loaded-src",D="data-single-file-stylesheet",U="data-single-file-disabled-noscript",V="data-single-file-async-script",O="*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)",W=["NOSCRIPT","DISABLED-NOSCRIPT","META","LINK","STYLE","TITLE","TEMPLATE","SOURCE","OBJECT","SCRIPT","HEAD","BODY"],H=/^'(.*?)'$/,z=/^"(.*?)"$/,B={regular:"400",normal:"400",bold:"700",bolder:"700",lighter:"100"},j="single-file-ui-element",Y="data:,",G=globalThis.JSON;function Z(e,t,s,o,n={usedFonts:new Map,canvases:[],images:[],posters:[],videos:[],shadowRoots:[],markedElements:[]},i){if(s.childNodes){Array.from(s.childNodes).filter((t=>t instanceof e.HTMLElement||t instanceof e.SVGElement)).forEach((s=>{let r,a,l;if(!o.autoSaveExternalSave&&(o.removeHiddenElements||o.removeUnusedFonts||o.compressHTML)&&(l=te(e,s),s instanceof e.HTMLElement&&o.removeHiddenElements&&(a=(i||s.closest("html > head"))&&W.includes(s.tagName.toUpperCase())||s.closest("details"),a||(r=i||X(s,l),r&&(s.setAttribute(S,""),n.markedElements.push(s)))),!r)){if(o.compressHTML&&l){const e=l.getPropertyValue("white-space");e&&e.startsWith("pre")&&(s.setAttribute(M,""),n.markedElements.push(s))}o.removeUnusedFonts&&(J(l,o,n.usedFonts),J(te(e,s,":first-letter"),o,n.usedFonts),J(te(e,s,":before"),o,n.usedFonts),J(te(e,s,":after"),o,n.usedFonts))}!function(e,t,s,o,n,i,r){const a=s.tagName&&s.tagName.toUpperCase();if("CANVAS"==a)try{n.canvases.push({dataURI:s.toDataURL("image/png",""),backgroundColor:r.getPropertyValue("background-color")}),s.setAttribute(q,n.canvases.length-1),n.markedElements.push(s)}catch(e){}if("IMG"==a){const t={currentSrc:i?Y:o.loadDeferredImages&&s.getAttribute(L)||s.currentSrc};if(n.images.push(t),s.setAttribute(N,n.images.length-1),n.markedElements.push(s),s.removeAttribute(L),r=r||te(e,s)){t.size=function(e,t,s){let o=t.naturalWidth,n=t.naturalHeight;if(!o&&!n){const i=null==t.getAttribute("style");if(s=s||te(e,t)){let e,r,a,l,d,c,u,m,g=!1;if("content-box"==s.getPropertyValue("box-sizing")){const e=t.style.getPropertyValue("box-sizing"),s=t.style.getPropertyPriority("box-sizing"),o=t.clientWidth;t.style.setProperty("box-sizing","border-box","important"),g=t.clientWidth!=o,e?t.style.setProperty("box-sizing",e,s):t.style.removeProperty("box-sizing")}e=ee("padding-left",s),r=ee("padding-right",s),a=ee("padding-top",s),l=ee("padding-bottom",s),g?(d=ee("border-left-width",s),c=ee("border-right-width",s),u=ee("border-top-width",s),m=ee("border-bottom-width",s)):d=c=u=m=0,o=Math.max(0,t.clientWidth-e-r-d-c),n=Math.max(0,t.clientHeight-a-l-u-m),i&&t.removeAttribute("style")}}return{pxWidth:o,pxHeight:n}}(e,s,r);const o=r.getPropertyValue("box-shadow"),n=r.getPropertyValue("background-image");o&&"none"!=o||n&&"none"!=n||!(t.size.pxWidth>1||t.size.pxHeight>1)||(t.replaceable=!0,t.backgroundColor=r.getPropertyValue("background-color"),t.objectFit=r.getPropertyValue("object-fit"),t.boxSizing=r.getPropertyValue("box-sizing"),t.objectPosition=r.getPropertyValue("object-position"))}}if("VIDEO"==a){const o=s.currentSrc;if(o&&!o.startsWith("blob:")&&!o.startsWith("data:")){const t=te(e,s.parentNode);n.videos.push({positionParent:t&&t.getPropertyValue("position"),src:o,size:{pxWidth:s.clientWidth,pxHeight:s.clientHeight},currentTime:s.currentTime}),s.setAttribute(P,n.videos.length-1)}if(!s.getAttribute("poster")){const e=t.createElement("canvas"),o=e.getContext("2d");e.width=s.clientWidth,e.height=s.clientHeight;try{o.drawImage(s,0,0,e.width,e.height),n.posters.push(e.toDataURL("image/png","")),s.setAttribute(C,n.posters.length-1),n.markedElements.push(s)}catch(e){}}}"IFRAME"==a&&i&&o.removeHiddenElements&&(s.setAttribute(R,""),n.markedElements.push(s));"INPUT"==a&&("password"!=s.type&&(s.setAttribute(k,s.value),n.markedElements.push(s)),"radio"!=s.type&&"checkbox"!=s.type||(s.setAttribute(k,s.checked),n.markedElements.push(s)));"TEXTAREA"==a&&(s.setAttribute(k,s.value),n.markedElements.push(s));"SELECT"==a&&s.querySelectorAll("option").forEach((e=>{e.selected&&(e.setAttribute(k,""),n.markedElements.push(e))}));"SCRIPT"==a&&(s.async&&""!=s.getAttribute("async")&&"async"!=s.getAttribute("async")&&(s.setAttribute(V,""),n.markedElements.push(s)),s.textContent=s.textContent.replace(/<\/script>/gi,"<\\/script>"))}(e,t,s,o,n,r,l);const d=!(s instanceof e.SVGElement)&&$(s);if(d&&!s.classList.contains(j)){const i={};s.setAttribute(F,n.shadowRoots.length),n.markedElements.push(s),n.shadowRoots.push(i),Z(e,t,d,o,n,r),i.content=d.innerHTML,i.mode=d.mode;try{if(d.adoptedStyleSheets)if(d.adoptedStyleSheets.length)i.adoptedStyleSheets=Array.from(d.adoptedStyleSheets).map((e=>Array.from(e.cssRules).map((e=>e.cssText)).join("\n")));else if(void 0===d.adoptedStyleSheets.length){const e=e=>i.adoptedStyleSheets=e.detail.adoptedStyleSheets;s.addEventListener(v,e),s.dispatchEvent(new CustomEvent(I,{options:{bubbles:!0,composed:!0}})),s.removeEventListener(v,e)}}catch(e){}}Z(e,t,s,o,n,r),!o.autoSaveExternalSave&&o.removeHiddenElements&&i&&(a||""==s.getAttribute(_)?s.parentElement&&(s.parentElement.setAttribute(_,""),n.markedElements.push(s.parentElement)):r&&(s.setAttribute(A,""),n.markedElements.push(s)))}))}return n}function J(e,t,s){if(e){const o=e.getPropertyValue("font-style")||"normal";e.getPropertyValue("font-family").split(",").forEach((n=>{if(n=K(n),!t.loadedFonts||t.loadedFonts.find((e=>K(e.family)==n&&e.style==o))){const t=(i=e.getPropertyValue("font-weight"),B[i.toLowerCase().trim()]||i),r=e.getPropertyValue("font-variant")||"normal",a=[n,t,o,r];s.set(G.stringify(a),[n,t,o,r])}var i}))}}function $(e){const t=globalThis.chrome;if(e.openOrClosedShadowRoot)return e.openOrClosedShadowRoot;if(!(t&&t.dom&&t.dom.openOrClosedShadowRoot))return e.shadowRoot;try{return t.dom.openOrClosedShadowRoot(e)}catch(t){return e.shadowRoot}}function K(e=""){return function(e){e=e.match(H)?e.replace(H,"$1"):e.replace(z,"$1");return e.trim()}((t=e.trim(),t.replace(w,((e,t,s)=>{const o="0x"+t-65536;return o!=o||s?t:o<0?String.fromCharCode(o+65536):String.fromCharCode(o>>10|55296,1023&o|56320)})))).toLowerCase();var t}function X(e,t){let s=!1;if(t){const o=t.getPropertyValue("display"),n=t.getPropertyValue("opacity"),i=t.getPropertyValue("visibility");if(s="none"==o,!s&&("0"==n||"hidden"==i)&&e.getBoundingClientRect){const t=e.getBoundingClientRect();s=!t.width&&!t.height}}return Boolean(s)}function Q(e){if(e){const t=[];return e.querySelectorAll("style").forEach(((s,o)=>{try{const n=e.createElement("style");n.textContent=s.textContent,e.body.appendChild(n);const i=n.sheet;n.remove(),i&&i.cssRules.length==s.sheet.cssRules.length||(s.setAttribute(D,o),t[o]=Array.from(s.sheet.cssRules).map((e=>e.cssText)).join("\n"))}catch(e){}})),t}}function ee(e,t){if(t.getPropertyValue(e).endsWith("px"))return parseFloat(t.getPropertyValue(e))}function te(e,t,s){try{return e.getComputedStyle(t,s)}catch(e){}}const se={LAZY_SRC_ATTRIBUTE_NAME:L,SINGLE_FILE_UI_ELEMENT_CLASS:j},oe=10,ne="attributes",ie=globalThis.browser,re=globalThis.document,ae=globalThis.MutationObserver,le=(e,t,s)=>globalThis.addEventListener(e,t,s),de=(e,t,s)=>globalThis.removeEventListener(e,t,s),ce=new Map;let ue;async function me(e){if(re.documentElement){ce.clear();const s=re.body&&re.body.scrollHeight||re.documentElement.scrollHeight,n=re.body&&re.body.scrollWidth||re.documentElement.scrollWidth;if(s>globalThis.innerHeight||n>globalThis.innerWidth){const r=Math.max(s-1.5*globalThis.innerHeight,0),l=Math.max(n-1.5*globalThis.innerWidth,0);if(globalThis.scrollY<r||globalThis.scrollX<l)return function(e){return ue=0,new Promise((async s=>{let n;const r=new Set,l=new ae((async t=>{if((t=t.filter((e=>e.type==ne))).length){t.filter((e=>{if("src"==e.attributeName&&(e.target.setAttribute(se.LAZY_SRC_ATTRIBUTE_NAME,e.target.src),e.target.addEventListener("load",g)),"src"==e.attributeName||"srcset"==e.attributeName||e.target.tagName&&"SOURCE"==e.target.tagName.toUpperCase())return!e.target.classList||!e.target.classList.contains(se.SINGLE_FILE_UI_ELEMENT_CLASS)})).length&&(n=!0,await fe(l,e,E),r.size||await ge(l,e,E))}}));async function c(t){await pe("idleTimeout",(async()=>{n?ue<oe&&(ue++,Ee("idleTimeout"),await c(Math.max(500,t/2))):(Ee("loadTimeout"),Ee("maxTimeout"),he(l,e,E))}),t,e.loadDeferredImagesNativeTimeout)}function g(e){const t=e.target;t.removeAttribute(se.LAZY_SRC_ATTRIBUTE_NAME),t.removeEventListener("load",g)}async function p(t){n=!0,await fe(l,e,E),await ge(l,e,E),t.detail&&r.add(t.detail)}async function b(t){await fe(l,e,E),await ge(l,e,E),r.delete(t.detail),r.size||await ge(l,e,E)}function E(e){l.disconnect(),de(u,p),de(m,b),s(e)}await c(2*e.loadDeferredImagesMaxIdleTime),await fe(l,e,E),l.observe(re,{subtree:!0,childList:!0,attributes:!0}),le(u,p),le(m,b),function(e){e.loadDeferredImagesBlockCookies&&f(new h(i)),e.loadDeferredImagesBlockStorage&&f(new h(d)),e.loadDeferredImagesDispatchScrollEvent&&f(new h(a)),e.loadDeferredImagesKeepZoomLevel?f(new h(o)):f(new h(t))}(e)}))}(e)}}}async function ge(e,t,s){await pe("loadTimeout",(()=>he(e,t,s)),t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function fe(e,t,s){await pe("maxTimeout",(async()=>{await Ee("loadTimeout"),await he(e,t,s)}),10*t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function he(e,t,o){await Ee("idleTimeout"),function(e){e.loadDeferredImagesBlockCookies&&f(new h(r)),e.loadDeferredImagesBlockStorage&&f(new h(c)),e.loadDeferredImagesDispatchScrollEvent&&f(new h(l)),e.loadDeferredImagesKeepZoomLevel?f(new h(n)):f(new h(s))}(t),await pe("endTimeout",(async()=>{await Ee("maxTimeout"),o()}),t.loadDeferredImagesMaxIdleTime/2,t.loadDeferredImagesNativeTimeout),e.disconnect()}async function pe(e,t,s,o){if(ie&&ie.runtime&&ie.runtime.sendMessage&&!o){if(!ce.get(e)||!ce.get(e).pending){const o={callback:t,pending:!0};ce.set(e,o);try{await ie.runtime.sendMessage({method:"singlefile.lazyTimeout.setTimeout",type:e,delay:s})}catch(o){be(e,t,s)}o.pending=!1}}else be(e,t,s)}function be(e,t,s){const o=ce.get(e);o&&globalThis.clearTimeout(o),ce.set(e,t),globalThis.setTimeout(t,s)}async function Ee(e){if(ie&&ie.runtime&&ie.runtime.sendMessage)try{await ie.runtime.sendMessage({method:"singlefile.lazyTimeout.clearTimeout",type:e})}catch(t){ye(e)}else ye(e)}function ye(e){const t=ce.get(e);ce.delete(e),t&&globalThis.clearTimeout(t)}ie&&ie.runtime&&ie.runtime.onMessage&&ie.runtime.onMessage.addListener&&ie.runtime.onMessage.addListener((e=>{if("singlefile.lazyTimeout.onTimeout"==e.method){const t=ce.get(e.type);if(t){ce.delete(e.type);try{t.callback()}catch(t){ye(e.type)}}}}));const Te={ON_BEFORE_CAPTURE_EVENT_NAME:"single-file-on-before-capture",ON_AFTER_CAPTURE_EVENT_NAME:"single-file-on-after-capture",WIN_ID_ATTRIBUTE_NAME:"data-single-file-win-id",preProcessDoc:function(e,t,s){e.querySelectorAll("noscript:not(["+U+"])").forEach((e=>{e.setAttribute(U,e.textContent),e.textContent=""})),function(e){e.querySelectorAll("meta[http-equiv=refresh]").forEach((e=>{e.removeAttribute("http-equiv"),e.setAttribute("disabled-http-equiv","refresh")}))}(e),e.head&&e.head.querySelectorAll(O).forEach((e=>e.hidden=!0)),e.querySelectorAll("svg foreignObject").forEach((e=>{const t=e.querySelectorAll("html > head > "+O+", html > body > "+O);t.length&&(Array.from(e.childNodes).forEach((e=>e.remove())),t.forEach((t=>e.appendChild(t))))}));const o=new Map;let n;return t&&e.documentElement?(e.querySelectorAll("button button, a a").forEach((t=>{const s=e.createElement("template");s.setAttribute("data-single-file-invalid-element",""),s.content.appendChild(t.cloneNode(!0)),o.set(t,s),t.replaceWith(s)})),n=Z(t,e,e.documentElement,s),s.moveStylesInHead&&e.querySelectorAll("body style, body ~ style").forEach((e=>{const s=te(t,e);s&&X(e,s)&&(e.setAttribute(x,""),n.markedElements.push(e))}))):n={canvases:[],images:[],posters:[],videos:[],usedFonts:[],shadowRoots:[],markedElements:[]},{canvases:n.canvases,fonts:Array.from(y.values()),stylesheets:Q(e),images:n.images,posters:n.posters,videos:n.videos,usedFonts:Array.from(n.usedFonts.values()),shadowRoots:n.shadowRoots,referrer:e.referrer,markedElements:n.markedElements,invalidElements:o,scrollPosition:{x:t.scrollX,y:t.scrollY}}},serialize:function(e){const t=e.doctype;let s="";return t&&(s="<!DOCTYPE "+t.nodeName,t.publicId?(s+=' PUBLIC "'+t.publicId+'"',t.systemId&&(s+=' "'+t.systemId+'"')):t.systemId&&(s+=' SYSTEM "'+t.systemId+'"'),t.internalSubset&&(s+=" ["+t.internalSubset+"]"),s+="> "),s+e.documentElement.outerHTML},postProcessDoc:function(e,t,s){if(e.querySelectorAll("["+U+"]").forEach((e=>{e.textContent=e.getAttribute(U),e.removeAttribute(U)})),e.querySelectorAll("meta[disabled-http-equiv]").forEach((e=>{e.setAttribute("http-equiv",e.getAttribute("disabled-http-equiv")),e.removeAttribute("disabled-http-equiv")})),e.head&&e.head.querySelectorAll("*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)").forEach((e=>e.removeAttribute("hidden"))),!t){const s=[A,R,S,M,N,C,P,q,k,F,D,V];t=e.querySelectorAll(s.map((e=>"["+e+"]")).join(","))}t.forEach((e=>{e.removeAttribute(A),e.removeAttribute(S),e.removeAttribute(_),e.removeAttribute(R),e.removeAttribute(M),e.removeAttribute(N),e.removeAttribute(C),e.removeAttribute(P),e.removeAttribute(q),e.removeAttribute(k),e.removeAttribute(F),e.removeAttribute(D),e.removeAttribute(V),e.removeAttribute(x)})),s&&s.forEach(((e,t)=>e.replaceWith(t)))},getShadowRoot:$},we="__frameTree__::",Ie='iframe, frame, object[type="text/html"][data]',ve="*",Ae="singlefile.frameTree.initRequest",Se="singlefile.frameTree.ackInitRequest",_e="singlefile.frameTree.cleanupRequest",Re="singlefile.frameTree.initResponse",Me="*",Fe=5e3,Ne=".",Ce=globalThis.window==globalThis.top,Pe=globalThis.browser,qe=globalThis.top,xe=globalThis.MessageChannel,ke=globalThis.document,Le=globalThis.JSON;let De,Ue=globalThis.sessions;var Ve,Oe,We;function He(){return globalThis.crypto.getRandomValues(new Uint32Array(32)).join("")}async function ze(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,Ce||(De=globalThis.frameId=e.windowId),Ye(ke,e.options,De,t),Ce||(e.options.userScriptEnabled&&s&&await s(Te.ON_BEFORE_CAPTURE_EVENT_NAME),$e({frames:[Xe(ke,globalThis,De,e.options,e.scrolling)],sessionId:t,requestedFrameId:ke.documentElement.dataset.requestedFrameId&&De}),e.options.userScriptEnabled&&s&&await s(Te.ON_AFTER_CAPTURE_EVENT_NAME),delete ke.documentElement.dataset.requestedFrameId)}function Be(e){if(!globalThis._singleFile_cleaningUp){globalThis._singleFile_cleaningUp=!0;const t=e.sessionId;Je(Qe(ke),e.windowId,t)}}function je(e){e.frames.forEach((t=>Ge("responseTimeouts",e.sessionId,t.windowId)));const t=Ue.get(e.sessionId);if(t){e.requestedFrameId&&(t.requestedFrameId=e.requestedFrameId),e.frames.forEach((e=>{let s=t.frames.find((t=>e.windowId==t.windowId));s||(s={windowId:e.windowId},t.frames.push(s)),s.processed||(s.content=e.content,s.baseURI=e.baseURI,s.title=e.title,s.url=e.url,s.canvases=e.canvases,s.fonts=e.fonts,s.stylesheets=e.stylesheets,s.images=e.images,s.posters=e.posters,s.videos=e.videos,s.usedFonts=e.usedFonts,s.shadowRoots=e.shadowRoots,s.processed=e.processed,s.scrollPosition=e.scrollPosition,s.scrolling=e.scrolling)}));t.frames.filter((e=>!e.processed)).length||(t.frames=t.frames.sort(((e,t)=>t.windowId.split(Ne).length-e.windowId.split(Ne).length)),t.resolve&&(t.requestedFrameId&&t.frames.forEach((e=>{e.windowId==t.requestedFrameId&&(e.requestedFrame=!0)})),t.resolve(t.frames)))}}function Ye(e,t,s,o){const n=Qe(e);!function(e,t,s,o,n){const i=[];let r;Ue.get(n)?r=Ue.get(n).requestTimeouts:(r={},Ue.set(n,{requestTimeouts:r}));t.forEach(((e,t)=>{const s=o+Ne+t;e.setAttribute(Te.WIN_ID_ATTRIBUTE_NAME,s),i.push({windowId:s})})),$e({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),t.forEach(((e,t)=>{const i=o+Ne+t;try{Ke(e.contentWindow,{method:Ae,windowId:i,sessionId:n,options:s,scrolling:e.scrolling})}catch(e){}r[i]=globalThis.setTimeout((()=>$e({frames:[{windowId:i,processed:!0}],sessionId:n})),Fe)})),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o),n.length&&function(e,t,s,o,n){const i=[];t.forEach(((e,t)=>{const r=o+Ne+t;let a;try{a=e.contentDocument}catch(e){}if(a)try{const t=e.contentWindow;t.stop(),Ge("requestTimeouts",n,r),Ye(a,s,r,n),i.push(Xe(a,t,r,s,e.scrolling))}catch(e){i.push({windowId:r,processed:!0})}})),$e({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o)}function Ge(e,t,s){const o=Ue.get(t);if(o&&o[e]){const t=o[e][s];t&&(globalThis.clearTimeout(t),delete o[e][s])}}function Ze(e,t){const s=Ue.get(e);s&&s.responseTimeouts&&(s.responseTimeouts[t]=globalThis.setTimeout((()=>$e({frames:[{windowId:t,processed:!0}],sessionId:e})),1e4))}function Je(e,t,s){e.forEach(((e,o)=>{const n=t+Ne+o;e.removeAttribute(Te.WIN_ID_ATTRIBUTE_NAME);try{Ke(e.contentWindow,{method:_e,windowId:n,sessionId:s})}catch(e){}})),e.forEach(((e,o)=>{const n=t+Ne+o;let i;try{i=e.contentDocument}catch(e){}if(i)try{Je(Qe(i),n,s)}catch(e){}}))}function $e(e){e.method=Re;try{qe.singlefile.processors.frameTree.initResponse(e)}catch(t){Ke(qe,e,!0)}}function Ke(e,t,s){if(e==qe&&Pe&&Pe.runtime&&Pe.runtime.sendMessage)Pe.runtime.sendMessage(t);else if(s){const s=new xe;e.postMessage(we+Le.stringify({method:t.method,sessionId:t.sessionId}),Me,[s.port2]),s.port1.postMessage(t)}else e.postMessage(we+Le.stringify(t),Me)}function Xe(e,t,s,o,n){const i=Te.preProcessDoc(e,t,o),r=Te.serialize(e);Te.postProcessDoc(e,i.markedElements,i.invalidElements);return{windowId:s,content:r,baseURI:e.baseURI.split("#")[0],url:e.location.href,title:e.title,canvases:i.canvases,fonts:i.fonts,stylesheets:i.stylesheets,images:i.images,posters:i.posters,videos:i.videos,usedFonts:i.usedFonts,shadowRoots:i.shadowRoots,scrollPosition:i.scrollPosition,scrolling:n,processed:!0}}function Qe(e){let t=Array.from(e.querySelectorAll(Ie));return e.querySelectorAll(ve).forEach((e=>{const s=Te.getShadowRoot(e);s&&(t=t.concat(...s.querySelectorAll(Ie)))})),t}Ue||(Ue=globalThis.sessions=new Map),Ce&&(De="0",Pe&&Pe.runtime&&Pe.runtime.onMessage&&Pe.runtime.onMessage.addListener&&Pe.runtime.onMessage.addListener((e=>e.method==Re?(je(e),Promise.resolve({})):e.method==Se?(Ge("requestTimeouts",e.sessionId,e.windowId),Ze(e.sessionId,e.windowId),Promise.resolve({})):void 0))),Ve="message",Oe=async e=>{if("string"==typeof e.data&&e.data.startsWith(we)){e.preventDefault(),e.stopPropagation();const t=Le.parse(e.data.substring(we.length));t.method==Ae?(e.source&&Ke(e.source,{method:Se,windowId:t.windowId,sessionId:t.sessionId}),Ce||(globalThis.stop(),t.options.loadDeferredImages&&me(t.options),await ze(t))):t.method==Se?(Ge("requestTimeouts",t.sessionId,t.windowId),Ze(t.sessionId,t.windowId)):t.method==_e?Be(t):t.method==Re&&Ue.get(t.sessionId)&&(e.ports[0].onmessage=e=>je(e.data))}},We=!0,globalThis.addEventListener(Ve,Oe,We),e.TIMEOUT_INIT_REQUEST_MESSAGE=Fe,e.cleanup=function(e){Ue.delete(e),Be({windowId:De,sessionId:e,options:{sessionId:e}})},e.getAsync=function(e){const t=He();return e=Le.parse(Le.stringify(e)),new Promise((s=>{Ue.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{},resolve:e=>{e.sessionId=t,s(e)}}),ze({windowId:De,sessionId:t,options:e})}))},e.getSync=function(e){const t=He();e=Le.parse(Le.stringify(e)),Ue.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{}}),function(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,Ce||(De=globalThis.frameId=e.windowId);Ye(ke,e.options,De,t),Ce||(e.options.userScriptEnabled&&s&&s(Te.ON_BEFORE_CAPTURE_EVENT_NAME),$e({frames:[Xe(ke,globalThis,De,e.options,e.scrolling)],sessionId:t,requestedFrameId:ke.documentElement.dataset.requestedFrameId&&De}),e.options.userScriptEnabled&&s&&s(Te.ON_AFTER_CAPTURE_EVENT_NAME),delete ke.documentElement.dataset.requestedFrameId)}({windowId:De,sessionId:t,options:e});const s=Ue.get(t).frames;return s.sessionId=t,s},e.initResponse=je,Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1 +1 @@
1
- !function(){"use strict";(t=>{const n="singlefile-infobar",e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAgMAAADXB5lNAAABhmlDQ1BJQ0MgcHJvZmlsZQAAKJF9kj1Iw0AYht+mSkUrDnYQcchQnSyIijqWKhbBQmkrtOpgcukfNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEydFJ0UVK/C4ptIjx4LiH9+59+e67A4RGhalm1wSgapaRisfEbG5VDLyiDwEAvZiVmKkn0osZeI6ve/j4ehfhWd7n/hz9St5kgE8kjjLdsIg3iGc2LZ3zPnGIlSSF+Jx43KACiR+5Lrv8xrnosMAzQ0YmNU8cIhaLHSx3MCsZKvE0cVhRNcoXsi4rnLc4q5Uaa9XJbxjMaytprtMcQRxLSCAJETJqKKMCCxFaNVJMpGg/5uEfdvxJcsnkKoORYwFVqJAcP/gb/O6tWZiadJOCMaD7xbY/RoHALtCs2/b3sW03TwD/M3Cltf3VBjD3SXq9rYWPgIFt4OK6rcl7wOUOMPSkS4bkSH6aQqEAvJ/RM+WAwVv6EGtu31r7OH0AMtSr5Rvg4BAYK1L2use9ezr79u+ZVv9+AFlNcp0UUpiqAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AsHAB8H+DhhoQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAJUExURQAAAICHi4qKioTuJAkAAAABdFJOUwBA5thmAAAAAWJLR0QCZgt8ZAAAAJJJREFUOI3t070NRCEMA2CnYAOyDyPwpHj/Va7hJ3FzV7zy3ET5JIwoAF6Jk4wzAJAkzxAYG9YRTgB+24wBgKmfrGAKTcEfAY4KRlRoIeBTgKOCERVaCPgU4Khge2GqKOBTgKOCERVaAEC/4PNcnyoSWHpjqkhwKxbcig0Q6AorXYF/+A6eIYD1lVbwG/jdA6/kA2THRAURVubcAAAAAElFTkSuQmCC",o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAgMAAADXB5lNAAABhmlDQ1BJQ0MgcHJvZmlsZQAAKJF9kj1Iw0AYht+mSkUrDnYQcchQnSyIijqWKhbBQmkrtOpgcukfNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEydFJ0UVK/C4ptIjx4LiH9+59+e67A4RGhalm1wSgapaRisfEbG5VDLyiDwEAvZiVmKkn0osZeI6ve/j4ehfhWd7n/hz9St5kgE8kjjLdsIg3iGc2LZ3zPnGIlSSF+Jx43KACiR+5Lrv8xrnosMAzQ0YmNU8cIhaLHSx3MCsZKvE0cVhRNcoXsi4rnLc4q5Uaa9XJbxjMaytprtMcQRxLSCAJETJqKKMCCxFaNVJMpGg/5uEfdvxJcsnkKoORYwFVqJAcP/gb/O6tWZiadJOCMaD7xbY/RoHALtCs2/b3sW03TwD/M3Cltf3VBjD3SXq9rYWPgIFt4OK6rcl7wOUOMPSkS4bkSH6aQqEAvJ/RM+WAwVv6EGtu31r7OH0AMtSr5Rvg4BAYK1L2use9ezr79u+ZVv9+AFlNcp0UUpiqAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AsHAB8VC4EQ6QAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAJUExURQAAAICHi4qKioTuJAkAAAABdFJOUwBA5thmAAAAAWJLR0QCZgt8ZAAAAJtJREFUOI3NkrsBgCAMRLFwBPdxBArcfxXFkO8rbKWAAJfHJ9faf9vuYX/749T5NmShm3bEwbe2SxeuM4+2oxDL1cDoKtVUjRy+tH78Cv2CS+wIiQNC1AEhk4AQeUTMWUJMfUJMSEJMSEY8kIx4IONroaYAimNxsXp1PA7PxwfVL8QnowwoVC0lig07wDDVUjAdbAnjwtow/z/bDW7eI4M2KruJAAAAAElFTkSuQmCC",i="SingleFile",A="single-file-ui-element",r="\n\t.infobar {\n\t\tbackground-color: #737373;\n\t\tcolor: white;\n\t\tdisplay: flex;\n\t\tposition: fixed;\n\t\ttop: 16px;\n\t\tright: 16px;\n\t\theight: auto;\n\t\twidth: auto;\n\t\tmin-height: 24px;\n\t\tmin-width: 24px;\n\t\tbackground-position: center;\n\t\tbackground-repeat: no-repeat;\n\t\tz-index: 2147483647;\n\t\tmargin: 0 0 0 16px;\n\t\tbackground-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAABhmlDQ1BJQ0MgcHJvZmlsZQAAKJF9kj1Iw0AYht+mSkUrDnYQcchQnSyIijqWKhbBQmkrtOpgcukfNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEydFJ0UVK/C4ptIjx4LiH9+59+e67A4RGhalm1wSgapaRisfEbG5VDLyiDwEAvZiVmKkn0osZeI6ve/j4ehfhWd7n/hz9St5kgE8kjjLdsIg3iGc2LZ3zPnGIlSSF+Jx43KACiR+5Lrv8xrnosMAzQ0YmNU8cIhaLHSx3MCsZKvE0cVhRNcoXsi4rnLc4q5Uaa9XJbxjMaytprtMcQRxLSCAJETJqKKMCCxFaNVJMpGg/5uEfdvxJcsnkKoORYwFVqJAcP/gb/O6tWZiadJOCMaD7xbY/RoHALtCs2/b3sW03TwD/M3Cltf3VBjD3SXq9rYWPgIFt4OK6rcl7wOUOMPSkS4bkSH6aQqEAvJ/RM+WAwVv6EGtu31r7OH0AMtSr5Rvg4BAYK1L2use9ezr79u+ZVv9+AFlNcp0UUpiqAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AsHADIRLMaOHwAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAPUExURQAAAIqKioyNjY2OjvDw8L2y1DEAAAABdFJOUwBA5thmAAAAAWJLR0QB/wIt3gAAAGNJREFUSMdjYCAJsLi4OBCQx6/CBQwIGIDPCBcXAkYQUsACU+AwlBVQHg6Eg5pgZBGOboIJZugDFwRwoJECJCUOhJI1wZwzqmBUwagCuipgIqTABG9h7YIKaKGAURAFEF/6AQAO4HqSoDP8bgAAAABJRU5ErkJggg==);\n\t\tborder-radius: 16px;\n\t\tuser-select: none;\n\t\t-moz-user-select: none;\n\t\topacity: .7;\n\t\tcursor: pointer;\n\t\tpadding-left: 0;\n\t\tpadding-right: 0;\n\t\tpadding-top: 0;\n\t\tpadding-bottom: 0;\n\t\tborder: 2px solid #eee;\n\t\tbackground-size: 70% 70%;\n\t\ttransition: all 250ms;\n\t\tfont-size: 13px;\n\t}\n\t.infobar:hover {\n\t\topacity: 1;\n\t}\n\t.infobar-open {\n\t\topacity: 1;\n\t\tbackground-color: #f9f9f9;\n\t\tcursor: auto;\n\t\tcolor: #2d2d2d;\n\t\tpadding-top: 2px;\n\t\tpadding-bottom: 2px;\n\t\tborder: 2px solid #878787;\n\t\tbackground-image: none;\n\t\tborder-radius: 8px;\n\t\tuser-select: initial;\n\t\t-moz-user-select: initial;\n\t}\n\t.infobar-close-button {\n\t\tdisplay: none;\n\t\topacity: .7;\n\t\tpadding-top: 4px;\n\t\tpadding-left: 8px;\n\t\tpadding-right: 8px;\n\t\tcursor: pointer;\n\t\ttransition: opacity 250ms;\n\t\theight: 16px;\n\t}\n\t.infobar-close-button:hover {\n\t\topacity: 1;\n\t}\n\t.infobar-content {\n\t\tdisplay: none;\n\t\tfont-family: Arial;\n\t\tfont-size: 14px;\n\t\tline-height: 22px;\n\t\tword-break: break-word;\n\t\twhite-space: pre-wrap;\n\t\tposition: relative;\n\t\ttop: 1px;\n\t\ttext-align: left;\n\t}\n\t.infobar-link {\n\t\tdisplay: none;\n\t\tpadding-left: 8px;\n\t\tpadding-right: 8px;\n\t\tline-height: 11px;\n\t\tcursor: pointer;\n\t\tuser-select: none;\n\t\toutline: 0;\n\t}\n\t.infobar-link-icon {\n\t\tpadding-top: 4px;\n\t\tpadding-left: 2px;\n\t\tcursor: pointer;\n\t\topacity: .7;\n\t\ttransition: opacity 250ms;\n\t\theight: 16px;\n\t}\n\t.infobar-link-icon:hover {\n\t\topacity: 1;\n\t}\n\t.infobar-open .infobar-close-button, .infobar-open .infobar-content, .infobar-open .infobar-link {\n\t\tdisplay: inline-block;\n\t}";let a=!0;const s=t.browser;async function c(){const t=document.evaluate("//comment()",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null);let c=t&&t.singleNodeValue;if(c&&((p=c).nodeType==Node.COMMENT_NODE&&p.textContent.includes(i))){const t=c.textContent.split("\n"),[,,i,...p]=t,g=i.match(/^ url: (.*) ?$/),h=g&&g[1];if(h){let t;if(s&&s.runtime&&s.runtime.sendMessage)try{t=await s.runtime.sendMessage({method:"tabs.getOptions",url:h})}catch(n){t={displayInfobar:!0}}else t={displayInfobar:!0};t.displayInfobar&&await async function(t,i){let s=document.querySelector(n);if(!s){let c="";if(i.length){const t=i[0].split("saved date: ")[1];if(t&&i.shift(),i.length>1){let t=i[0].split("info: ")[1].trim();for(let n=1;n<i.length-1;n++)t+="\n"+i[n].trim();c=t.trim()}else c=t}c=c||"No info",s=d(n,document.body),s.className=A;const p=await async function(t){if(t.attachShadow)return t.attachShadow({mode:"open"});{a=!1;const n=d("iframe",t);return n.style.setProperty("background-color","transparent","important"),n.style.setProperty("position","fixed","important"),n.style.setProperty("top",0,"important"),n.style.setProperty("right",0,"important"),n.style.setProperty("width","44px","important"),n.style.setProperty("height","48px","important"),n.style.setProperty("z-index",2147483647,"important"),new Promise((t=>{n.contentDocument.body.style.setProperty("margin",0),n.onload=()=>t(n.contentDocument.body)}))}}(s),g=document.createElement("style");g.textContent=r,p.appendChild(g);const h=document.createElement("div");h.classList.add("infobar"),p.appendChild(h);const u=document.createElement("img");u.classList.add("infobar-close-button"),h.appendChild(u),u.src=o,u.onclick=t=>{0===t.button&&s.remove()};const m=document.createElement("span");h.appendChild(m),m.classList.add("infobar-content"),m.textContent=c;const f=document.createElement("a");f.classList.add("infobar-link"),h.appendChild(f),f.target="_blank",f.rel="noopener noreferrer",f.title="Open source URL: "+t,f.href=t;const b=document.createElement("img");b.classList.add("infobar-link-icon"),f.appendChild(b),b.src=e,l(h),document.addEventListener("click",(t=>{if(0===t.button){let n=t.target;for(;n&&n!=s;)n=n.parentElement;n!=s&&l(h)}}))}}(h,p)}}var p}function l(t){if(t.classList.remove("infobar-open"),t.onclick=e=>{if(0===e.button)return function(t){a||document.querySelector(n).childNodes[0].contentWindow.getSelection().removeAllRanges();if(t.classList.add("infobar-open"),t.onclick=null,t.onmouseout=null,!a){const e=document.querySelector(n).childNodes[0];e.style.setProperty("width","100vw","important"),e.style.setProperty("height","100vh","important"),e.style.setProperty("width",t.getBoundingClientRect().width+33+"px","important"),e.style.setProperty("height",t.getBoundingClientRect().height+21+"px","important")}}(t),!1},!a){const t=document.querySelector(n).childNodes[0];t.style.setProperty("width","44px","important"),t.style.setProperty("height","48px","important")}}function d(t,n){const e=document.createElement(t);return n.appendChild(e),Array.from(getComputedStyle(e)).forEach((t=>e.style.setProperty(t,"initial","important"))),e}t.window==t.top&&("loading"==document.readyState?document.addEventListener("DOMContentLoaded",c,!1):c()),t.singlefile&&(t.singlefile.infobar={displayIcon:c})})("object"==typeof globalThis?globalThis:window)}();
1
+ !function(){"use strict";const n="single-file-infobar",e="\n.infobar,\n.infobar .infobar-icon,\n.infobar .infobar-link-icon {\n min-inline-size: 28px;\n min-block-size: 28px;\n box-sizing: border-box;\n}\n\n.infobar,\n.infobar .infobar-close-icon,\n.infobar .infobar-link-icon {\n opacity: 0.7;\n transition: opacity 250ms;\n}\n\n.infobar:hover,\n.infobar .infobar-close-icon:hover,\n.infobar .infobar-link-icon:hover {\n opacity: 1;\n}\n\n.infobar,\n.infobar-content {\n display: flex;\n}\n\n.infobar {\n position: fixed;\n top: 16px;\n right: 16px;\n margin-inline-start: 16px;\n margin-block-end: 16px;\n color: #2d2d2d;\n background-color: #737373;\n border: 2px solid;\n border-color: #eee;\n border-radius: 16px;\n z-index: 2147483647;\n}\n\n.infobar:valid, .infobar:not(:focus-within) .infobar-content {\n display: none;\n}\n\n.infobar:focus-within {\n background-color: #f9f9f9;\n border-color: #878787;\n border-radius: 8px;\n opacity: 1;\n transition-property: opacity, background-color, border-color, border-radius,\n color;\n}\n\n.infobar-content {\n align-items: center;\n}\n\n.infobar-content span {\n font-family: Arial, Helvetica, sans-serif;\n font-size: 14px;\n line-height: 18px;\n word-break: break-word;\n white-space: pre-wrap;\n margin-inline: 4px;\n margin-block: 4px;\n}\n\n.infobar .infobar-icon,\n.infobar .infobar-close-icon,\n.infobar .infobar-link-icon {\n cursor: pointer;\n background-position: center;\n background-repeat: no-repeat;\n}\n\n.infobar .infobar-close-icon,\n.infobar .infobar-link-icon {\n align-self: flex-start;\n}\n\n.infobar .infobar-icon {\n position: absolute;\n min-inline-size: 24px;\n min-block-size: 24px;\n}\n\n.infobar:focus-within .infobar-icon {\n z-index: -1;\n background-image: none;\n}\n\n.infobar .infobar-close-icon {\n min-inline-size: 22px;\n min-block-size: 22px;\n}\n\n.infobar .infobar-icon {\n background-color: transparent;\n background-size: 70%;\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAABhmlDQ1BJQ0MgcHJvZmlsZQAAKJF9kj1Iw0AYht+mSkUrDnYQcchQnSyIijqWKhbBQmkrtOpgcukfNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEydFJ0UVK/C4ptIjx4LiH9+59+e67A4RGhalm1wSgapaRisfEbG5VDLyiDwEAvZiVmKkn0osZeI6ve/j4ehfhWd7n/hz9St5kgE8kjjLdsIg3iGc2LZ3zPnGIlSSF+Jx43KACiR+5Lrv8xrnosMAzQ0YmNU8cIhaLHSx3MCsZKvE0cVhRNcoXsi4rnLc4q5Uaa9XJbxjMaytprtMcQRxLSCAJETJqKKMCCxFaNVJMpGg/5uEfdvxJcsnkKoORYwFVqJAcP/gb/O6tWZiadJOCMaD7xbY/RoHALtCs2/b3sW03TwD/M3Cltf3VBjD3SXq9rYWPgIFt4OK6rcl7wOUOMPSkS4bkSH6aQqEAvJ/RM+WAwVv6EGtu31r7OH0AMtSr5Rvg4BAYK1L2use9ezr79u+ZVv9+AFlNcp0UUpiqAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AsHADIRLMaOHwAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAPUExURQAAAIqKioyNjY2OjvDw8L2y1DEAAAABdFJOUwBA5thmAAAAAWJLR0QB/wIt3gAAAGNJREFUSMdjYCAJsLi4OBCQx6/CBQwIGIDPCBcXAkYQUsACU+AwlBVQHg6Eg5pgZBGOboIJZugDFwRwoJECJCUOhJI1wZwzqmBUwagCuipgIqTABG9h7YIKaKGAURAFEF/6AQAO4HqSoDP8bgAAAABJRU5ErkJggg==);\n}\n\n.infobar .infobar-link-icon {\n background-size: 60%;\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAgMAAADXB5lNAAABhmlDQ1BJQ0MgcHJvZmlsZQAAKJF9kj1Iw0AYht+mSkUrDnYQcchQnSyIijqWKhbBQmkrtOpgcukfNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEydFJ0UVK/C4ptIjx4LiH9+59+e67A4RGhalm1wSgapaRisfEbG5VDLyiDwEAvZiVmKkn0osZeI6ve/j4ehfhWd7n/hz9St5kgE8kjjLdsIg3iGc2LZ3zPnGIlSSF+Jx43KACiR+5Lrv8xrnosMAzQ0YmNU8cIhaLHSx3MCsZKvE0cVhRNcoXsi4rnLc4q5Uaa9XJbxjMaytprtMcQRxLSCAJETJqKKMCCxFaNVJMpGg/5uEfdvxJcsnkKoORYwFVqJAcP/gb/O6tWZiadJOCMaD7xbY/RoHALtCs2/b3sW03TwD/M3Cltf3VBjD3SXq9rYWPgIFt4OK6rcl7wOUOMPSkS4bkSH6aQqEAvJ/RM+WAwVv6EGtu31r7OH0AMtSr5Rvg4BAYK1L2use9ezr79u+ZVv9+AFlNcp0UUpiqAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AsHAB8H+DhhoQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAJUExURQAAAICHi4qKioTuJAkAAAABdFJOUwBA5thmAAAAAWJLR0QCZgt8ZAAAAJJJREFUOI3t070NRCEMA2CnYAOyDyPwpHj/Va7hJ3FzV7zy3ET5JIwoAF6Jk4wzAJAkzxAYG9YRTgB+24wBgKmfrGAKTcEfAY4KRlRoIeBTgKOCERVaCPgU4Khge2GqKOBTgKOCERVaAEC/4PNcnyoSWHpjqkhwKxbcig0Q6AorXYF/+A6eIYD1lVbwG/jdA6/kA2THRAURVubcAAAAAElFTkSuQmCC);\n}\n\n.infobar .infobar-close-icon {\n appearance: none;\n background-size: 80%;\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAgMAAADXB5lNAAABhmlDQ1BJQ0MgcHJvZmlsZQAAKJF9kj1Iw0AYht+mSkUrDnYQcchQnSyIijqWKhbBQmkrtOpgcukfNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEydFJ0UVK/C4ptIjx4LiH9+59+e67A4RGhalm1wSgapaRisfEbG5VDLyiDwEAvZiVmKkn0osZeI6ve/j4ehfhWd7n/hz9St5kgE8kjjLdsIg3iGc2LZ3zPnGIlSSF+Jx43KACiR+5Lrv8xrnosMAzQ0YmNU8cIhaLHSx3MCsZKvE0cVhRNcoXsi4rnLc4q5Uaa9XJbxjMaytprtMcQRxLSCAJETJqKKMCCxFaNVJMpGg/5uEfdvxJcsnkKoORYwFVqJAcP/gb/O6tWZiadJOCMaD7xbY/RoHALtCs2/b3sW03TwD/M3Cltf3VBjD3SXq9rYWPgIFt4OK6rcl7wOUOMPSkS4bkSH6aQqEAvJ/RM+WAwVv6EGtu31r7OH0AMtSr5Rvg4BAYK1L2use9ezr79u+ZVv9+AFlNcp0UUpiqAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AsHAB8VC4EQ6QAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAJUExURQAAAICHi4qKioTuJAkAAAABdFJOUwBA5thmAAAAAWJLR0QCZgt8ZAAAAJtJREFUOI3NkrsBgCAMRLFwBPdxBArcfxXFkO8rbKWAAJfHJ9faf9vuYX/749T5NmShm3bEwbe2SxeuM4+2oxDL1cDoKtVUjRy+tH78Cv2CS+wIiQNC1AEhk4AQeUTMWUJMfUJMSEJMSEY8kIx4IONroaYAimNxsXp1PA7PxwfVL8QnowwoVC0lig07wDDVUjAdbAnjwtow/z/bDW7eI4M2KruJAAAAAElFTkSuQmCC);\n}\n";function o(o,a,r){if(!o.querySelector(n)){let c=a.infobarContent?a.infobarContent:a.saveDate;c=c||"No info";const l=function(n,e,o){const i=n.createElement(e);return o.appendChild(i),Array.from(getComputedStyle(i)).forEach((n=>i.style.setProperty(n,"initial","important"))),i}(o,n,o.body);let s;if(r)s=l.attachShadow({mode:"open"});else{const n=o.createElement("template");n.setAttribute("shadowroot","open"),l.appendChild(n),s=n}const d=o.createElement("div"),b=o.createElement("style");b.textContent=e.replace(/ {2}/g,"").replace(/\n/g,"").replace(/: /g,":").replace(/, /g,","),d.appendChild(b);const f=o.createElement("form");f.classList.add("infobar"),d.appendChild(f);const p=o.createElement("span");p.tabIndex=-1,p.classList.add("infobar-icon"),f.appendChild(p);const g=o.createElement("span");g.tabIndex=-1,g.classList.add("infobar-content");const h=o.createElement("input");h.type="checkbox",h.required=!0,h.classList.add("infobar-close-icon"),g.appendChild(h);const u=o.createElement("span");u.textContent=c,g.appendChild(u);const C=o.createElement("a");if(C.classList.add("infobar-link-icon"),C.target="_blank",C.rel="noopener noreferrer",C.title="Open source URL: "+a.saveUrl,C.href=a.saveUrl,g.appendChild(C),f.appendChild(g),r)s.appendChild(d);else{const n=o.createElement("script");let e=t.toString();e+=i.toString(),e+="("+A.toString()+")(document)",n.textContent=e,d.appendChild(n),s.innerHTML=d.outerHTML}o.body.appendChild(l)}}function i(n){const e=n.evaluate("//comment()",n,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null);let o=e&&e.singleNodeValue;if(o&&o.nodeType==Node.COMMENT_NODE&&o.textContent.includes("SingleFile")){const n=o.textContent.split("\n"),[,,e,...i]=n,t=e.match(/^ url: (.*) ?$/),A=t&&t[1];if(A){let n,e;if(i.length&&(e=i[0].split("saved date: ")[1],e&&i.shift(),i.length>1)){let e=i[0].split("info: ")[1].trim();for(let n=1;n<i.length-1;n++)e+="\n"+i[n].trim();n=e.trim()}return{saveUrl:A,infobarContent:n,saveDate:e}}}}function t(n,{saveUrl:e,infobarContent:o,saveDate:i}){if(e){const t=n.querySelector("single-file-infobar").shadowRoot;t.querySelector(".infobar-content span").textContent=o||i;t.querySelector(".infobar-content .infobar-link-icon").href=e}}function A(n){const e=i(n);e&&e.saveUrl&&t(n,e)}(n=>{const e=n.browser;async function A(){let n={displayInfobar:!0};const A=i(document);if(A&&A.saveUrl){if(e&&e.runtime&&e.runtime.sendMessage)try{n=await e.runtime.sendMessage({method:"tabs.getOptions",url:A.saveUrl})}catch(n){}n.displayInfobar&&(o(document,n,!0),t(document,A))}}n.window==n.top&&("loading"==document.readyState?document.addEventListener("DOMContentLoaded",A,!1):A()),n.singlefile&&(n.singlefile.infobar={displayIcon:A})})("object"==typeof globalThis?globalThis:window)}();