single-file-cli 1.0.21 → 1.0.23

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.
package/.eslintrc.js CHANGED
File without changes
package/Dockerfile CHANGED
File without changes
package/LICENSE CHANGED
File without changes
package/README.MD CHANGED
File without changes
package/args.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -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-image",s="single-file-image-loaded",o=(e,t,s)=>globalThis.addEventListener(e,t,s),n=e=>{try{globalThis.dispatchEvent(e)}catch(e){}},a=globalThis.CustomEvent,i=globalThis.document,r=globalThis.Document;let l;l=window._singleFile_fontFaces?window._singleFile_fontFaces:window._singleFile_fontFaces=new Map,i instanceof r&&(o("single-file-new-font-face",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,l.set(JSON.stringify(s),t)})),o("single-file-delete-font",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,l.delete(JSON.stringify(s))})),o("single-file-clear-fonts",(()=>l=new Map)));const d=new RegExp("\\\\([\\da-f]{1,6}[\\x20\\t\\r\\n\\f]?|([\\x20\\t\\r\\n\\f])|.)","ig");const c="single-file-on-before-capture",m="single-file-on-after-capture",u="data-single-file-removed-content",g="data-single-file-hidden-content",p="data-single-file-kept-content",f="data-single-file-hidden-frame",h="data-single-file-preserved-space-element",b="data-single-file-shadow-root-element",E="data-single-file-image",T="data-single-file-poster",y="data-single-file-video",w="data-single-file-canvas",I="data-single-file-movable-style",A="data-single-file-input-value",v="data-single-file-lazy-loaded-src",N="data-single-file-stylesheet",S="data-single-file-disabled-noscript",R="data-single-file-async-script",_="*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)",F=["NOSCRIPT","DISABLED-NOSCRIPT","META","LINK","STYLE","TITLE","TEMPLATE","SOURCE","OBJECT","SCRIPT","HEAD","BODY"],P=/^'(.*?)'$/,x=/^"(.*?)"$/,C={regular:"400",normal:"400",bold:"700",bolder:"700",lighter:"100"},M="single-file-ui-element",O="data:,",D=(e,t,s)=>globalThis.addEventListener(e,t,s);function q(e,t,s){e.querySelectorAll("noscript:not([data-single-file-disabled-noscript])").forEach((e=>{e.setAttribute(S,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(_).forEach((e=>e.hidden=!0)),e.querySelectorAll("svg foreignObject").forEach((e=>{const t=e.querySelectorAll("html > head > "+_+", html > body > "+_);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, p div").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=L(t,e,e.documentElement,s),s.moveStylesInHead&&e.querySelectorAll("body style, body ~ style").forEach((e=>{const s=j(t,e);s&&V(e,s)&&(e.setAttribute(I,""),n.markedElements.push(e))}))):n={canvases:[],images:[],posters:[],videos:[],usedFonts:[],shadowRoots:[],markedElements:[]},{canvases:n.canvases,fonts:Array.from(l.values()),stylesheets:z(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 L(e,t,s,o,n={usedFonts:new Map,canvases:[],images:[],posters:[],videos:[],shadowRoots:[],markedElements:[]},a){return Array.from(s.childNodes).filter((t=>t instanceof e.HTMLElement||t instanceof e.SVGElement)).forEach((s=>{let i,r,l;if(!o.autoSaveExternalSave&&(o.removeHiddenElements||o.removeUnusedFonts||o.compressHTML)&&(l=j(e,s),s instanceof e.HTMLElement&&o.removeHiddenElements&&(r=(a||s.closest("html > head"))&&F.includes(s.tagName)||s.closest("details"),r||(i=a||V(s,l),i&&(s.setAttribute(g,""),n.markedElements.push(s)))),!i)){if(o.compressHTML&&l){const e=l.getPropertyValue("white-space");e&&e.startsWith("pre")&&(s.setAttribute(h,""),n.markedElements.push(s))}o.removeUnusedFonts&&(k(l,o,n.usedFonts),k(j(e,s,":first-letter"),o,n.usedFonts),k(j(e,s,":before"),o,n.usedFonts),k(j(e,s,":after"),o,n.usedFonts))}!function(e,t,s,o,n,a,i){if("CANVAS"==s.tagName)try{n.canvases.push({dataURI:s.toDataURL("image/png","")}),s.setAttribute(w,n.canvases.length-1),n.markedElements.push(s)}catch(e){}if("IMG"==s.tagName){const t={currentSrc:a?O:o.loadDeferredImages&&s.getAttribute(v)||s.currentSrc};if(n.images.push(t),s.setAttribute(E,n.images.length-1),n.markedElements.push(s),s.removeAttribute(v),i=i||j(e,s)){t.size=function(e,t,s){let o=t.naturalWidth,n=t.naturalHeight;if(!o&&!n){const a=null==t.getAttribute("style");if(s=s||j(e,t)){let e,i,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=W("padding-left",s),i=W("padding-right",s),r=W("padding-top",s),l=W("padding-bottom",s),g?(d=W("border-left-width",s),c=W("border-right-width",s),m=W("border-top-width",s),u=W("border-bottom-width",s)):d=c=m=u=0,o=Math.max(0,t.clientWidth-e-i-d-c),n=Math.max(0,t.clientHeight-r-l-m-u),a&&t.removeAttribute("style")}}return{pxWidth:o,pxHeight:n}}(e,s,i);const o=i.getPropertyValue("box-shadow"),n=i.getPropertyValue("background-image");o&&"none"!=o||n&&"none"!=n||!(t.size.pxWidth>1||t.size.pxHeight>1)||(t.replaceable=!0,t.backgroundColor=i.getPropertyValue("background-color"),t.objectFit=i.getPropertyValue("object-fit"),t.boxSizing=i.getPropertyValue("box-sizing"),t.objectPosition=i.getPropertyValue("object-position"))}}if("VIDEO"==s.tagName){const o=s.currentSrc;if(o&&!o.startsWith("blob:")&&!o.startsWith("data:")){const t=j(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(y,n.videos.length-1)}if(!s.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(T,n.posters.length-1),n.markedElements.push(s)}catch(e){}}}"IFRAME"==s.tagName&&a&&o.removeHiddenElements&&(s.setAttribute(f,""),n.markedElements.push(s));"INPUT"==s.tagName&&("password"!=s.type&&(s.setAttribute(A,s.value),n.markedElements.push(s)),"radio"!=s.type&&"checkbox"!=s.type||(s.setAttribute(A,s.checked),n.markedElements.push(s)));"TEXTAREA"==s.tagName&&(s.setAttribute(A,s.value),n.markedElements.push(s));"SELECT"==s.tagName&&s.querySelectorAll("option").forEach((e=>{e.selected&&(e.setAttribute(A,""),n.markedElements.push(e))}));"SCRIPT"==s.tagName&&(s.async&&""!=s.getAttribute("async")&&"async"!=s.getAttribute("async")&&(s.setAttribute(R,""),n.markedElements.push(s)),s.textContent=s.textContent.replace(/<\/script>/gi,"<\\/script>"))}(e,t,s,o,n,i,l);const d=!(s instanceof e.SVGElement)&&U(s);if(d&&!s.classList.contains(M)){const a={};s.setAttribute(b,n.shadowRoots.length),n.markedElements.push(s),n.shadowRoots.push(a),L(e,t,d,o,n,i),a.content=d.innerHTML,a.mode=d.mode;try{d.adoptedStyleSheets&&d.adoptedStyleSheets.length&&(a.adoptedStyleSheets=Array.from(d.adoptedStyleSheets).map((e=>Array.from(e.cssRules).map((e=>e.cssText)).join("\n"))))}catch(e){}}L(e,t,s,o,n,i),!o.autoSaveExternalSave&&o.removeHiddenElements&&a&&(r||""==s.getAttribute(p)?s.parentElement&&(s.parentElement.setAttribute(p,""),n.markedElements.push(s.parentElement)):i&&(s.setAttribute(u,""),n.markedElements.push(s)))})),n}function k(e,t,s){if(e){const o=e.getPropertyValue("font-style")||"normal";e.getPropertyValue("font-family").split(",").forEach((n=>{if(n=H(n),!t.loadedFonts||t.loadedFonts.find((e=>H(e.family)==n&&e.style==o))){const t=(a=e.getPropertyValue("font-weight"),C[a.toLowerCase().trim()]||a),i=e.getPropertyValue("font-variant")||"normal",r=[n,t,o,i];s.set(JSON.stringify(r),[n,t,o,i])}var a}))}}function U(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 H(e=""){return function(e){e=e.match(P)?e.replace(P,"$1"):e.replace(x,"$1");return e.trim()}((t=e.trim(),t.replace(d,((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 V(e,t){let s=!1;if(t){const o=t.getPropertyValue("display"),n=t.getPropertyValue("opacity"),a=t.getPropertyValue("visibility");if(s="none"==o,!s&&("0"==n||"hidden"==a)&&e.getBoundingClientRect){const t=e.getBoundingClientRect();s=!t.width&&!t.height}}return Boolean(s)}function B(e,t,s){if(e.querySelectorAll("[data-single-file-disabled-noscript]").forEach((e=>{e.textContent=e.getAttribute(S),e.removeAttribute(S)})),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=[u,f,g,h,E,T,y,w,A,b,N,R];t=e.querySelectorAll(s.map((e=>"["+e+"]")).join(","))}t.forEach((e=>{e.removeAttribute(u),e.removeAttribute(g),e.removeAttribute(p),e.removeAttribute(f),e.removeAttribute(h),e.removeAttribute(E),e.removeAttribute(T),e.removeAttribute(y),e.removeAttribute(w),e.removeAttribute(A),e.removeAttribute(b),e.removeAttribute(N),e.removeAttribute(R),e.removeAttribute(I)})),s&&Array.from(s.entries()).forEach((([e,t])=>t.replaceWith(e)))}function z(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 a=n.sheet;n.remove(),a&&a.cssRules.length==s.sheet.cssRules.length||(s.setAttribute(N,o),t[o]=Array.from(s.sheet.cssRules).map((e=>e.cssText)).join("\n"))}catch(e){}})),t}}function W(e,t){if(t.getPropertyValue(e).endsWith("px"))return parseFloat(t.getPropertyValue(e))}function j(e,t,s){try{return e.getComputedStyle(t,s)}catch(e){}}const J=v,Y=M,G="attributes",K=globalThis.browser,$=globalThis.document,X=globalThis.MutationObserver,Q=(e,t,s)=>globalThis.addEventListener(e,t,s),Z=(e,t,s)=>globalThis.removeEventListener(e,t,s),ee=new Map;let te;async function se(e){if($.documentElement){ee.clear();const o=Math.max($.documentElement.scrollHeight-1.5*$.documentElement.clientHeight,0),i=Math.max($.documentElement.scrollWidth-1.5*$.documentElement.clientWidth,0);if(globalThis.scrollY<=o&&globalThis.scrollX<=i)return function(e){return te=0,new Promise((async o=>{let i;const r=new Set,l=new X((async t=>{if((t=t.filter((e=>e.type==G))).length){t.filter((e=>{if("src"==e.attributeName&&(e.target.setAttribute(J,e.target.src),e.target.addEventListener("load",c)),"src"==e.attributeName||"srcset"==e.attributeName||"SOURCE"==e.target.tagName)return!e.target.classList||!e.target.classList.contains(Y)})).length&&(i=!0,await ne(l,e,g),r.size||await oe(l,e,g))}}));async function d(t){await ie("idleTimeout",(async()=>{i?te<10&&(te++,le("idleTimeout"),await d(Math.max(500,t/2))):(le("loadTimeout"),le("maxTimeout"),ae(l,e,g))}),t,e.loadDeferredImagesNativeTimeout)}function c(e){const t=e.target;t.removeAttribute(J),t.removeEventListener("load",c)}async function m(t){i=!0,await ne(l,e,g),await oe(l,e,g),t.detail&&r.add(t.detail)}async function u(t){await ne(l,e,g),await oe(l,e,g),r.delete(t.detail),r.size||await oe(l,e,g)}function g(e){l.disconnect(),Z(t,m),Z(s,u),o(e)}await d(2*e.loadDeferredImagesMaxIdleTime),await ne(l,e,g),l.observe($,{subtree:!0,childList:!0,attributes:!0}),Q(t,m),Q(s,u),function(e){e.loadDeferredImagesBlockCookies&&n(new a("single-file-block-cookies-start")),e.loadDeferredImagesBlockStorage&&n(new a("single-file-block-storage-start")),e.loadDeferredImagesDispatchScrollEvent&&n(new a("single-file-dispatch-scroll-event-start")),e.loadDeferredImagesKeepZoomLevel?n(new a("single-file-load-deferred-images-keep-zoom-level-start")):n(new a("single-file-load-deferred-images-start"))}(e)}))}(e)}}async function oe(e,t,s){await ie("loadTimeout",(()=>ae(e,t,s)),t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function ne(e,t,s){await ie("maxTimeout",(async()=>{await le("loadTimeout"),await ae(e,t,s)}),10*t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function ae(e,t,s){await le("idleTimeout"),function(e){e.loadDeferredImagesBlockCookies&&n(new a("single-file-block-cookies-end")),e.loadDeferredImagesBlockStorage&&n(new a("single-file-block-storage-end")),e.loadDeferredImagesDispatchScrollEvent&&n(new a("single-file-dispatch-scroll-event-end")),e.loadDeferredImagesKeepZoomLevel?n(new a("single-file-load-deferred-images-keep-zoom-level-end")):n(new a("single-file-load-deferred-images-end"))}(t),await ie("endTimeout",(async()=>{await le("maxTimeout"),s()}),t.loadDeferredImagesMaxIdleTime/2,t.loadDeferredImagesNativeTimeout),e.disconnect()}async function ie(e,t,s,o){if(K&&K.runtime&&K.runtime.sendMessage&&!o){if(!ee.get(e)||!ee.get(e).pending){const o={callback:t,pending:!0};ee.set(e,o);try{await K.runtime.sendMessage({method:"singlefile.lazyTimeout.setTimeout",type:e,delay:s})}catch(o){re(e,t,s)}o.pending=!1}}else re(e,t,s)}function re(e,t,s){const o=ee.get(e);o&&globalThis.clearTimeout(o),ee.set(e,t),globalThis.setTimeout(t,s)}async function le(e){if(K&&K.runtime&&K.runtime.sendMessage)try{await K.runtime.sendMessage({method:"singlefile.lazyTimeout.clearTimeout",type:e})}catch(t){de(e)}else de(e)}function de(e){const t=ee.get(e);ee.delete(e),t&&globalThis.clearTimeout(t)}K&&K.runtime&&K.runtime.onMessage&&K.runtime.onMessage.addListener&&K.runtime.onMessage.addListener((e=>{if("singlefile.lazyTimeout.onTimeout"==e.method){const t=ee.get(e.type);if(t){ee.delete(e.type);try{t.callback()}catch(t){de(e.type)}}}}));const ce={ON_BEFORE_CAPTURE_EVENT_NAME:c,ON_AFTER_CAPTURE_EVENT_NAME:m,WIN_ID_ATTRIBUTE_NAME:"data-single-file-win-id",preProcessDoc:q,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:B,getShadowRoot:U},me="__frameTree__::",ue='iframe, frame, object[type="text/html"][data]',ge="singlefile.frameTree.initRequest",pe="singlefile.frameTree.ackInitRequest",fe="singlefile.frameTree.cleanupRequest",he="singlefile.frameTree.initResponse",be=5e3,Ee=".",Te=globalThis.window==globalThis.top,ye=globalThis.browser,we=globalThis.top,Ie=globalThis.MessageChannel,Ae=globalThis.document;let ve,Ne=globalThis.sessions;var Se,Re,_e;function Fe(){return globalThis.crypto.getRandomValues(new Uint32Array(32)).join("")}async function Pe(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,Te||(ve=globalThis.frameId=e.windowId),Me(Ae,e.options,ve,t),Te||(e.options.userScriptEnabled&&s&&await s(ce.ON_BEFORE_CAPTURE_EVENT_NAME),Le({frames:[Ue(Ae,globalThis,ve,e.options)],sessionId:t,requestedFrameId:Ae.documentElement.dataset.requestedFrameId&&ve}),e.options.userScriptEnabled&&s&&await s(ce.ON_AFTER_CAPTURE_EVENT_NAME),delete Ae.documentElement.dataset.requestedFrameId)}function xe(e){if(!globalThis._singleFile_cleaningUp){globalThis._singleFile_cleaningUp=!0;const t=e.sessionId;qe(He(Ae),e.windowId,t)}}function Ce(e){e.frames.forEach((t=>Oe("responseTimeouts",e.sessionId,t.windowId)));const t=Ne.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.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(Ee).length-e.windowId.split(Ee).length)),t.resolve&&(t.requestedFrameId&&t.frames.forEach((e=>{e.windowId==t.requestedFrameId&&(e.requestedFrame=!0)})),t.resolve(t.frames)))}}function Me(e,t,s,o){const n=He(e);!function(e,t,s,o,n){const a=[];let i;Ne.get(n)?i=Ne.get(n).requestTimeouts:(i={},Ne.set(n,{requestTimeouts:i}));t.forEach(((e,t)=>{const s=o+Ee+t;e.setAttribute(ce.WIN_ID_ATTRIBUTE_NAME,s),a.push({windowId:s})})),Le({frames:a,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),t.forEach(((e,t)=>{const a=o+Ee+t;try{ke(e.contentWindow,{method:ge,windowId:a,sessionId:n,options:s})}catch(e){}i[a]=globalThis.setTimeout((()=>Le({frames:[{windowId:a,processed:!0}],sessionId:n})),be)})),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o),n.length&&function(e,t,s,o,n){const a=[];t.forEach(((e,t)=>{const i=o+Ee+t;let r;try{r=e.contentDocument}catch(e){}if(r)try{const t=e.contentWindow;t.stop(),Oe("requestTimeouts",n,i),Me(r,s,i,n),a.push(Ue(r,t,i,s))}catch(e){a.push({windowId:i,processed:!0})}})),Le({frames:a,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o)}function Oe(e,t,s){const o=Ne.get(t);if(o&&o[e]){const t=o[e][s];t&&(globalThis.clearTimeout(t),delete o[e][s])}}function De(e,t){const s=Ne.get(e);s&&s.responseTimeouts&&(s.responseTimeouts[t]=globalThis.setTimeout((()=>Le({frames:[{windowId:t,processed:!0}],sessionId:e})),1e4))}function qe(e,t,s){e.forEach(((e,o)=>{const n=t+Ee+o;e.removeAttribute(ce.WIN_ID_ATTRIBUTE_NAME);try{ke(e.contentWindow,{method:fe,windowId:n,sessionId:s})}catch(e){}})),e.forEach(((e,o)=>{const n=t+Ee+o;let a;try{a=e.contentDocument}catch(e){}if(a)try{qe(He(a),n,s)}catch(e){}}))}function Le(e){e.method=he;try{we.singlefile.processors.frameTree.initResponse(e)}catch(t){ke(we,e,!0)}}function ke(e,t,s){if(e==we&&ye&&ye.runtime&&ye.runtime.sendMessage)ye.runtime.sendMessage(t);else if(s){const s=new Ie;e.postMessage(me+JSON.stringify({method:t.method,sessionId:t.sessionId}),"*",[s.port2]),s.port1.postMessage(t)}else e.postMessage(me+JSON.stringify(t),"*")}function Ue(e,t,s,o){const n=ce.preProcessDoc(e,t,o),a=ce.serialize(e);ce.postProcessDoc(e,n.markedElements,n.invalidElements);return{windowId:s,content:a,baseURI:e.baseURI.split("#")[0],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 He(e){let t=Array.from(e.querySelectorAll(ue));return e.querySelectorAll("*").forEach((e=>{const s=ce.getShadowRoot(e);s&&(t=t.concat(...s.querySelectorAll(ue)))})),t}Ne||(Ne=globalThis.sessions=new Map),Te&&(ve="0",ye&&ye.runtime&&ye.runtime.onMessage&&ye.runtime.onMessage.addListener&&ye.runtime.onMessage.addListener((e=>e.method==he?(Ce(e),Promise.resolve({})):e.method==pe?(Oe("requestTimeouts",e.sessionId,e.windowId),De(e.sessionId,e.windowId),Promise.resolve({})):void 0))),Se="message",Re=async e=>{if("string"==typeof e.data&&e.data.startsWith(me)){e.preventDefault(),e.stopPropagation();const t=JSON.parse(e.data.substring(me.length));t.method==ge?(e.source&&ke(e.source,{method:pe,windowId:t.windowId,sessionId:t.sessionId}),Te||(globalThis.stop(),t.options.loadDeferredImages&&se(t.options),await Pe(t))):t.method==pe?(Oe("requestTimeouts",t.sessionId,t.windowId),De(t.sessionId,t.windowId)):t.method==fe?xe(t):t.method==he&&Ne.get(t.sessionId)&&(e.ports[0].onmessage=e=>Ce(e.data))}},_e=!0,globalThis.addEventListener(Se,Re,_e);var Ve=Object.freeze({__proto__:null,getAsync:function(e){const t=Fe();return e=JSON.parse(JSON.stringify(e)),new Promise((s=>{Ne.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{},resolve:e=>{e.sessionId=t,s(e)}}),Pe({windowId:ve,sessionId:t,options:e})}))},getSync:function(e){const t=Fe();e=JSON.parse(JSON.stringify(e)),Ne.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{}}),function(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,Te||(ve=globalThis.frameId=e.windowId);Me(Ae,e.options,ve,t),Te||(e.options.userScriptEnabled&&s&&s(ce.ON_BEFORE_CAPTURE_EVENT_NAME),Le({frames:[Ue(Ae,globalThis,ve,e.options)],sessionId:t,requestedFrameId:Ae.documentElement.dataset.requestedFrameId&&ve}),e.options.userScriptEnabled&&s&&s(ce.ON_AFTER_CAPTURE_EVENT_NAME),delete Ae.documentElement.dataset.requestedFrameId)}({windowId:ve,sessionId:t,options:e});const s=Ne.get(t).frames;return s.sessionId=t,s},cleanup:function(e){Ne.delete(e),xe({windowId:ve,sessionId:e,options:{sessionId:e}})},initResponse:Ce,TIMEOUT_INIT_REQUEST_MESSAGE:be});const Be=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],ze=[{tagName:"head",accept:e=>!e.childNodes.length||1==e.childNodes[0].nodeType},{tagName:"body",accept:e=>!e.childNodes.length}],We=[{tagName:"html",accept:e=>!e||8!=e.nodeType},{tagName:"head",accept:e=>!e||8!=e.nodeType&&(3!=e.nodeType||!Ye(e.textContent))},{tagName:"body",accept:e=>!e||8!=e.nodeType},{tagName:"li",accept:(e,t)=>!e&&t.parentElement&&("UL"==t.parentElement.tagName||"OL"==t.parentElement.tagName)||e&&["LI"].includes(e.tagName)},{tagName:"dt",accept:e=>!e||["DT","DD"].includes(e.tagName)},{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(e.tagName)},{tagName:"dd",accept:e=>!e||["DT","DD"].includes(e.tagName)},{tagName:"rt",accept:e=>!e||["RT","RP"].includes(e.tagName)},{tagName:"rp",accept:e=>!e||["RT","RP"].includes(e.tagName)},{tagName:"optgroup",accept:e=>!e||["OPTGROUP"].includes(e.tagName)},{tagName:"option",accept:e=>!e||["OPTION","OPTGROUP"].includes(e.tagName)},{tagName:"colgroup",accept:e=>!e||8!=e.nodeType&&(3!=e.nodeType||!Ye(e.textContent))},{tagName:"caption",accept:e=>!e||8!=e.nodeType&&(3!=e.nodeType||!Ye(e.textContent))},{tagName:"thead",accept:e=>!e||["TBODY","TFOOT"].includes(e.tagName)},{tagName:"tbody",accept:e=>!e||["TBODY","TFOOT"].includes(e.tagName)},{tagName:"tfoot",accept:e=>!e},{tagName:"tr",accept:e=>!e||["TR"].includes(e.tagName)},{tagName:"td",accept:e=>!e||["TD","TH"].includes(e.tagName)},{tagName:"th",accept:e=>!e||["TD","TH"].includes(e.tagName)}],je=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"];function Je(e,t,s){return 3==e.nodeType?function(e){const t=e.parentNode;let s;t&&1==t.nodeType&&(s=t.tagName.toLowerCase());return!s||je.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):8==e.nodeType?"\x3c!--"+e.textContent+"--\x3e":1==e.nodeType?function(e,t,s){const o=e.tagName.toLowerCase(),n=t&&ze.find((t=>o==t.tagName&&t.accept(e)));let a="";n&&!e.attributes.length||(a="<"+o,Array.from(e.attributes).forEach((s=>a+=function(e,t,s){const o=e.name;let n="";if(!o.match(/["'>/=]/)){let a,i=e.value;s&&"class"==o&&(i=Array.from(t.classList).map((e=>e.trim())).join(" ")),i=i.replace(/&/g,"&amp;").replace(/\u00a0/g,"&nbsp;"),i.includes('"')&&(i.includes("'")||!s?i=i.replace(/"/g,"&quot;"):a=!0);const r=!s||i.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,""!=i&&(n+="=",r&&(n+=a?"'":'"'),n+=i,r&&(n+=a?"'":'"'))}return n}(s,e,t))),a+=">");"TEMPLATE"!=e.tagName||e.childNodes.length?Array.from(e.childNodes).forEach((e=>a+=Je(e,t,s||"svg"==o))):a+=e.innerHTML;const i=t&&We.find((t=>o==t.tagName&&t.accept(e.nextSibling,e)));(s||!i&&!Be.includes(o))&&(a+="</"+o+">");return a}(e,t,s):void 0}function Ye(e){return Boolean(e.match(/^[ \t\n\f\r]/))}const Ge={frameTree:Ve},Ke={COMMENT_HEADER:"Page saved with SingleFile",COMMENT_HEADER_LEGACY:"Archive processed by SingleFile",ON_BEFORE_CAPTURE_EVENT_NAME:c,ON_AFTER_CAPTURE_EVENT_NAME:m,preProcessDoc:q,postProcessDoc:B,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+Je(e.documentElement,t)}(e,t),getShadowRoot:U};D("single-file-user-script-init",(()=>globalThis._singleFile_waitForUserScript=async e=>{const t=new CustomEvent(e+"-request",{cancelable:!0}),s=new Promise((t=>D(e+"-response",t)));(e=>{try{globalThis.dispatchEvent(e)}catch(e){}})(t),t.defaultPrevented&&await s})),e.helper=Ke,e.processors=Ge,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-image",s="single-file-image-loaded",o=(e,t,s)=>globalThis.addEventListener(e,t,s),n=e=>{try{globalThis.dispatchEvent(e)}catch(e){}},a=globalThis.CustomEvent,i=globalThis.document,r=globalThis.Document;let l;l=window._singleFile_fontFaces?window._singleFile_fontFaces:window._singleFile_fontFaces=new Map,i instanceof r&&(o("single-file-new-font-face",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,l.set(JSON.stringify(s),t)})),o("single-file-delete-font",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,l.delete(JSON.stringify(s))})),o("single-file-clear-fonts",(()=>l=new Map)));const d=new RegExp("\\\\([\\da-f]{1,6}[\\x20\\t\\r\\n\\f]?|([\\x20\\t\\r\\n\\f])|.)","ig");const c="single-file-on-before-capture",m="single-file-on-after-capture",u="data-single-file-removed-content",g="data-single-file-hidden-content",p="data-single-file-kept-content",f="data-single-file-hidden-frame",h="data-single-file-preserved-space-element",b="data-single-file-shadow-root-element",E="data-single-file-image",T="data-single-file-poster",y="data-single-file-video",w="data-single-file-canvas",I="data-single-file-movable-style",A="data-single-file-input-value",v="data-single-file-lazy-loaded-src",N="data-single-file-stylesheet",S="data-single-file-disabled-noscript",R="data-single-file-async-script",_="*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)",F=["NOSCRIPT","DISABLED-NOSCRIPT","META","LINK","STYLE","TITLE","TEMPLATE","SOURCE","OBJECT","SCRIPT","HEAD","BODY"],P=/^'(.*?)'$/,x=/^"(.*?)"$/,C={regular:"400",normal:"400",bold:"700",bolder:"700",lighter:"100"},M="single-file-ui-element",O="data:,",D=(e,t,s)=>globalThis.addEventListener(e,t,s);function q(e,t,s){e.querySelectorAll("noscript:not([data-single-file-disabled-noscript])").forEach((e=>{e.setAttribute(S,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(_).forEach((e=>e.hidden=!0)),e.querySelectorAll("svg foreignObject").forEach((e=>{const t=e.querySelectorAll("html > head > "+_+", html > body > "+_);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=L(t,e,e.documentElement,s),s.moveStylesInHead&&e.querySelectorAll("body style, body ~ style").forEach((e=>{const s=j(t,e);s&&V(e,s)&&(e.setAttribute(I,""),n.markedElements.push(e))}))):n={canvases:[],images:[],posters:[],videos:[],usedFonts:[],shadowRoots:[],markedElements:[]},{canvases:n.canvases,fonts:Array.from(l.values()),stylesheets:z(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 L(e,t,s,o,n={usedFonts:new Map,canvases:[],images:[],posters:[],videos:[],shadowRoots:[],markedElements:[]},a){return Array.from(s.childNodes).filter((t=>t instanceof e.HTMLElement||t instanceof e.SVGElement)).forEach((s=>{let i,r,l;if(!o.autoSaveExternalSave&&(o.removeHiddenElements||o.removeUnusedFonts||o.compressHTML)&&(l=j(e,s),s instanceof e.HTMLElement&&o.removeHiddenElements&&(r=(a||s.closest("html > head"))&&F.includes(s.tagName)||s.closest("details"),r||(i=a||V(s,l),i&&(s.setAttribute(g,""),n.markedElements.push(s)))),!i)){if(o.compressHTML&&l){const e=l.getPropertyValue("white-space");e&&e.startsWith("pre")&&(s.setAttribute(h,""),n.markedElements.push(s))}o.removeUnusedFonts&&(k(l,o,n.usedFonts),k(j(e,s,":first-letter"),o,n.usedFonts),k(j(e,s,":before"),o,n.usedFonts),k(j(e,s,":after"),o,n.usedFonts))}!function(e,t,s,o,n,a,i){if("CANVAS"==s.tagName)try{n.canvases.push({dataURI:s.toDataURL("image/png","")}),s.setAttribute(w,n.canvases.length-1),n.markedElements.push(s)}catch(e){}if("IMG"==s.tagName){const t={currentSrc:a?O:o.loadDeferredImages&&s.getAttribute(v)||s.currentSrc};if(n.images.push(t),s.setAttribute(E,n.images.length-1),n.markedElements.push(s),s.removeAttribute(v),i=i||j(e,s)){t.size=function(e,t,s){let o=t.naturalWidth,n=t.naturalHeight;if(!o&&!n){const a=null==t.getAttribute("style");if(s=s||j(e,t)){let e,i,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=W("padding-left",s),i=W("padding-right",s),r=W("padding-top",s),l=W("padding-bottom",s),g?(d=W("border-left-width",s),c=W("border-right-width",s),m=W("border-top-width",s),u=W("border-bottom-width",s)):d=c=m=u=0,o=Math.max(0,t.clientWidth-e-i-d-c),n=Math.max(0,t.clientHeight-r-l-m-u),a&&t.removeAttribute("style")}}return{pxWidth:o,pxHeight:n}}(e,s,i);const o=i.getPropertyValue("box-shadow"),n=i.getPropertyValue("background-image");o&&"none"!=o||n&&"none"!=n||!(t.size.pxWidth>1||t.size.pxHeight>1)||(t.replaceable=!0,t.backgroundColor=i.getPropertyValue("background-color"),t.objectFit=i.getPropertyValue("object-fit"),t.boxSizing=i.getPropertyValue("box-sizing"),t.objectPosition=i.getPropertyValue("object-position"))}}if("VIDEO"==s.tagName){const o=s.currentSrc;if(o&&!o.startsWith("blob:")&&!o.startsWith("data:")){const t=j(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(y,n.videos.length-1)}if(!s.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(T,n.posters.length-1),n.markedElements.push(s)}catch(e){}}}"IFRAME"==s.tagName&&a&&o.removeHiddenElements&&(s.setAttribute(f,""),n.markedElements.push(s));"INPUT"==s.tagName&&("password"!=s.type&&(s.setAttribute(A,s.value),n.markedElements.push(s)),"radio"!=s.type&&"checkbox"!=s.type||(s.setAttribute(A,s.checked),n.markedElements.push(s)));"TEXTAREA"==s.tagName&&(s.setAttribute(A,s.value),n.markedElements.push(s));"SELECT"==s.tagName&&s.querySelectorAll("option").forEach((e=>{e.selected&&(e.setAttribute(A,""),n.markedElements.push(e))}));"SCRIPT"==s.tagName&&(s.async&&""!=s.getAttribute("async")&&"async"!=s.getAttribute("async")&&(s.setAttribute(R,""),n.markedElements.push(s)),s.textContent=s.textContent.replace(/<\/script>/gi,"<\\/script>"))}(e,t,s,o,n,i,l);const d=!(s instanceof e.SVGElement)&&U(s);if(d&&!s.classList.contains(M)){const a={};s.setAttribute(b,n.shadowRoots.length),n.markedElements.push(s),n.shadowRoots.push(a),L(e,t,d,o,n,i),a.content=d.innerHTML,a.mode=d.mode;try{d.adoptedStyleSheets&&d.adoptedStyleSheets.length&&(a.adoptedStyleSheets=Array.from(d.adoptedStyleSheets).map((e=>Array.from(e.cssRules).map((e=>e.cssText)).join("\n"))))}catch(e){}}L(e,t,s,o,n,i),!o.autoSaveExternalSave&&o.removeHiddenElements&&a&&(r||""==s.getAttribute(p)?s.parentElement&&(s.parentElement.setAttribute(p,""),n.markedElements.push(s.parentElement)):i&&(s.setAttribute(u,""),n.markedElements.push(s)))})),n}function k(e,t,s){if(e){const o=e.getPropertyValue("font-style")||"normal";e.getPropertyValue("font-family").split(",").forEach((n=>{if(n=H(n),!t.loadedFonts||t.loadedFonts.find((e=>H(e.family)==n&&e.style==o))){const t=(a=e.getPropertyValue("font-weight"),C[a.toLowerCase().trim()]||a),i=e.getPropertyValue("font-variant")||"normal",r=[n,t,o,i];s.set(JSON.stringify(r),[n,t,o,i])}var a}))}}function U(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 H(e=""){return function(e){e=e.match(P)?e.replace(P,"$1"):e.replace(x,"$1");return e.trim()}((t=e.trim(),t.replace(d,((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 V(e,t){let s=!1;if(t){const o=t.getPropertyValue("display"),n=t.getPropertyValue("opacity"),a=t.getPropertyValue("visibility");if(s="none"==o,!s&&("0"==n||"hidden"==a)&&e.getBoundingClientRect){const t=e.getBoundingClientRect();s=!t.width&&!t.height}}return Boolean(s)}function B(e,t,s){if(e.querySelectorAll("[data-single-file-disabled-noscript]").forEach((e=>{e.textContent=e.getAttribute(S),e.removeAttribute(S)})),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=[u,f,g,h,E,T,y,w,A,b,N,R];t=e.querySelectorAll(s.map((e=>"["+e+"]")).join(","))}t.forEach((e=>{e.removeAttribute(u),e.removeAttribute(g),e.removeAttribute(p),e.removeAttribute(f),e.removeAttribute(h),e.removeAttribute(E),e.removeAttribute(T),e.removeAttribute(y),e.removeAttribute(w),e.removeAttribute(A),e.removeAttribute(b),e.removeAttribute(N),e.removeAttribute(R),e.removeAttribute(I)})),s&&Array.from(s.entries()).forEach((([e,t])=>t.replaceWith(e)))}function z(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 a=n.sheet;n.remove(),a&&a.cssRules.length==s.sheet.cssRules.length||(s.setAttribute(N,o),t[o]=Array.from(s.sheet.cssRules).map((e=>e.cssText)).join("\n"))}catch(e){}})),t}}function W(e,t){if(t.getPropertyValue(e).endsWith("px"))return parseFloat(t.getPropertyValue(e))}function j(e,t,s){try{return e.getComputedStyle(t,s)}catch(e){}}const J=v,Y=M,G="attributes",K=globalThis.browser,$=globalThis.document,X=globalThis.MutationObserver,Q=(e,t,s)=>globalThis.addEventListener(e,t,s),Z=(e,t,s)=>globalThis.removeEventListener(e,t,s),ee=new Map;let te;async function se(e){if($.documentElement){ee.clear();const o=Math.max($.documentElement.scrollHeight-1.5*$.documentElement.clientHeight,0),i=Math.max($.documentElement.scrollWidth-1.5*$.documentElement.clientWidth,0);if(globalThis.scrollY<=o&&globalThis.scrollX<=i)return function(e){return te=0,new Promise((async o=>{let i;const r=new Set,l=new X((async t=>{if((t=t.filter((e=>e.type==G))).length){t.filter((e=>{if("src"==e.attributeName&&(e.target.setAttribute(J,e.target.src),e.target.addEventListener("load",c)),"src"==e.attributeName||"srcset"==e.attributeName||"SOURCE"==e.target.tagName)return!e.target.classList||!e.target.classList.contains(Y)})).length&&(i=!0,await ne(l,e,g),r.size||await oe(l,e,g))}}));async function d(t){await ie("idleTimeout",(async()=>{i?te<10&&(te++,le("idleTimeout"),await d(Math.max(500,t/2))):(le("loadTimeout"),le("maxTimeout"),ae(l,e,g))}),t,e.loadDeferredImagesNativeTimeout)}function c(e){const t=e.target;t.removeAttribute(J),t.removeEventListener("load",c)}async function m(t){i=!0,await ne(l,e,g),await oe(l,e,g),t.detail&&r.add(t.detail)}async function u(t){await ne(l,e,g),await oe(l,e,g),r.delete(t.detail),r.size||await oe(l,e,g)}function g(e){l.disconnect(),Z(t,m),Z(s,u),o(e)}await d(2*e.loadDeferredImagesMaxIdleTime),await ne(l,e,g),l.observe($,{subtree:!0,childList:!0,attributes:!0}),Q(t,m),Q(s,u),function(e){e.loadDeferredImagesBlockCookies&&n(new a("single-file-block-cookies-start")),e.loadDeferredImagesBlockStorage&&n(new a("single-file-block-storage-start")),e.loadDeferredImagesDispatchScrollEvent&&n(new a("single-file-dispatch-scroll-event-start")),e.loadDeferredImagesKeepZoomLevel?n(new a("single-file-load-deferred-images-keep-zoom-level-start")):n(new a("single-file-load-deferred-images-start"))}(e)}))}(e)}}async function oe(e,t,s){await ie("loadTimeout",(()=>ae(e,t,s)),t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function ne(e,t,s){await ie("maxTimeout",(async()=>{await le("loadTimeout"),await ae(e,t,s)}),10*t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function ae(e,t,s){await le("idleTimeout"),function(e){e.loadDeferredImagesBlockCookies&&n(new a("single-file-block-cookies-end")),e.loadDeferredImagesBlockStorage&&n(new a("single-file-block-storage-end")),e.loadDeferredImagesDispatchScrollEvent&&n(new a("single-file-dispatch-scroll-event-end")),e.loadDeferredImagesKeepZoomLevel?n(new a("single-file-load-deferred-images-keep-zoom-level-end")):n(new a("single-file-load-deferred-images-end"))}(t),await ie("endTimeout",(async()=>{await le("maxTimeout"),s()}),t.loadDeferredImagesMaxIdleTime/2,t.loadDeferredImagesNativeTimeout),e.disconnect()}async function ie(e,t,s,o){if(K&&K.runtime&&K.runtime.sendMessage&&!o){if(!ee.get(e)||!ee.get(e).pending){const o={callback:t,pending:!0};ee.set(e,o);try{await K.runtime.sendMessage({method:"singlefile.lazyTimeout.setTimeout",type:e,delay:s})}catch(o){re(e,t,s)}o.pending=!1}}else re(e,t,s)}function re(e,t,s){const o=ee.get(e);o&&globalThis.clearTimeout(o),ee.set(e,t),globalThis.setTimeout(t,s)}async function le(e){if(K&&K.runtime&&K.runtime.sendMessage)try{await K.runtime.sendMessage({method:"singlefile.lazyTimeout.clearTimeout",type:e})}catch(t){de(e)}else de(e)}function de(e){const t=ee.get(e);ee.delete(e),t&&globalThis.clearTimeout(t)}K&&K.runtime&&K.runtime.onMessage&&K.runtime.onMessage.addListener&&K.runtime.onMessage.addListener((e=>{if("singlefile.lazyTimeout.onTimeout"==e.method){const t=ee.get(e.type);if(t){ee.delete(e.type);try{t.callback()}catch(t){de(e.type)}}}}));const ce={ON_BEFORE_CAPTURE_EVENT_NAME:c,ON_AFTER_CAPTURE_EVENT_NAME:m,WIN_ID_ATTRIBUTE_NAME:"data-single-file-win-id",preProcessDoc:q,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:B,getShadowRoot:U},me="__frameTree__::",ue='iframe, frame, object[type="text/html"][data]',ge="singlefile.frameTree.initRequest",pe="singlefile.frameTree.ackInitRequest",fe="singlefile.frameTree.cleanupRequest",he="singlefile.frameTree.initResponse",be=5e3,Ee=".",Te=globalThis.window==globalThis.top,ye=globalThis.browser,we=globalThis.top,Ie=globalThis.MessageChannel,Ae=globalThis.document;let ve,Ne=globalThis.sessions;var Se,Re,_e;function Fe(){return globalThis.crypto.getRandomValues(new Uint32Array(32)).join("")}async function Pe(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,Te||(ve=globalThis.frameId=e.windowId),Me(Ae,e.options,ve,t),Te||(e.options.userScriptEnabled&&s&&await s(ce.ON_BEFORE_CAPTURE_EVENT_NAME),Le({frames:[Ue(Ae,globalThis,ve,e.options)],sessionId:t,requestedFrameId:Ae.documentElement.dataset.requestedFrameId&&ve}),e.options.userScriptEnabled&&s&&await s(ce.ON_AFTER_CAPTURE_EVENT_NAME),delete Ae.documentElement.dataset.requestedFrameId)}function xe(e){if(!globalThis._singleFile_cleaningUp){globalThis._singleFile_cleaningUp=!0;const t=e.sessionId;qe(He(Ae),e.windowId,t)}}function Ce(e){e.frames.forEach((t=>Oe("responseTimeouts",e.sessionId,t.windowId)));const t=Ne.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.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(Ee).length-e.windowId.split(Ee).length)),t.resolve&&(t.requestedFrameId&&t.frames.forEach((e=>{e.windowId==t.requestedFrameId&&(e.requestedFrame=!0)})),t.resolve(t.frames)))}}function Me(e,t,s,o){const n=He(e);!function(e,t,s,o,n){const a=[];let i;Ne.get(n)?i=Ne.get(n).requestTimeouts:(i={},Ne.set(n,{requestTimeouts:i}));t.forEach(((e,t)=>{const s=o+Ee+t;e.setAttribute(ce.WIN_ID_ATTRIBUTE_NAME,s),a.push({windowId:s})})),Le({frames:a,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),t.forEach(((e,t)=>{const a=o+Ee+t;try{ke(e.contentWindow,{method:ge,windowId:a,sessionId:n,options:s})}catch(e){}i[a]=globalThis.setTimeout((()=>Le({frames:[{windowId:a,processed:!0}],sessionId:n})),be)})),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o),n.length&&function(e,t,s,o,n){const a=[];t.forEach(((e,t)=>{const i=o+Ee+t;let r;try{r=e.contentDocument}catch(e){}if(r)try{const t=e.contentWindow;t.stop(),Oe("requestTimeouts",n,i),Me(r,s,i,n),a.push(Ue(r,t,i,s))}catch(e){a.push({windowId:i,processed:!0})}})),Le({frames:a,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o)}function Oe(e,t,s){const o=Ne.get(t);if(o&&o[e]){const t=o[e][s];t&&(globalThis.clearTimeout(t),delete o[e][s])}}function De(e,t){const s=Ne.get(e);s&&s.responseTimeouts&&(s.responseTimeouts[t]=globalThis.setTimeout((()=>Le({frames:[{windowId:t,processed:!0}],sessionId:e})),1e4))}function qe(e,t,s){e.forEach(((e,o)=>{const n=t+Ee+o;e.removeAttribute(ce.WIN_ID_ATTRIBUTE_NAME);try{ke(e.contentWindow,{method:fe,windowId:n,sessionId:s})}catch(e){}})),e.forEach(((e,o)=>{const n=t+Ee+o;let a;try{a=e.contentDocument}catch(e){}if(a)try{qe(He(a),n,s)}catch(e){}}))}function Le(e){e.method=he;try{we.singlefile.processors.frameTree.initResponse(e)}catch(t){ke(we,e,!0)}}function ke(e,t,s){if(e==we&&ye&&ye.runtime&&ye.runtime.sendMessage)ye.runtime.sendMessage(t);else if(s){const s=new Ie;e.postMessage(me+JSON.stringify({method:t.method,sessionId:t.sessionId}),"*",[s.port2]),s.port1.postMessage(t)}else e.postMessage(me+JSON.stringify(t),"*")}function Ue(e,t,s,o){const n=ce.preProcessDoc(e,t,o),a=ce.serialize(e);ce.postProcessDoc(e,n.markedElements,n.invalidElements);return{windowId:s,content:a,baseURI:e.baseURI.split("#")[0],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 He(e){let t=Array.from(e.querySelectorAll(ue));return e.querySelectorAll("*").forEach((e=>{const s=ce.getShadowRoot(e);s&&(t=t.concat(...s.querySelectorAll(ue)))})),t}Ne||(Ne=globalThis.sessions=new Map),Te&&(ve="0",ye&&ye.runtime&&ye.runtime.onMessage&&ye.runtime.onMessage.addListener&&ye.runtime.onMessage.addListener((e=>e.method==he?(Ce(e),Promise.resolve({})):e.method==pe?(Oe("requestTimeouts",e.sessionId,e.windowId),De(e.sessionId,e.windowId),Promise.resolve({})):void 0))),Se="message",Re=async e=>{if("string"==typeof e.data&&e.data.startsWith(me)){e.preventDefault(),e.stopPropagation();const t=JSON.parse(e.data.substring(me.length));t.method==ge?(e.source&&ke(e.source,{method:pe,windowId:t.windowId,sessionId:t.sessionId}),Te||(globalThis.stop(),t.options.loadDeferredImages&&se(t.options),await Pe(t))):t.method==pe?(Oe("requestTimeouts",t.sessionId,t.windowId),De(t.sessionId,t.windowId)):t.method==fe?xe(t):t.method==he&&Ne.get(t.sessionId)&&(e.ports[0].onmessage=e=>Ce(e.data))}},_e=!0,globalThis.addEventListener(Se,Re,_e);var Ve=Object.freeze({__proto__:null,getAsync:function(e){const t=Fe();return e=JSON.parse(JSON.stringify(e)),new Promise((s=>{Ne.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{},resolve:e=>{e.sessionId=t,s(e)}}),Pe({windowId:ve,sessionId:t,options:e})}))},getSync:function(e){const t=Fe();e=JSON.parse(JSON.stringify(e)),Ne.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{}}),function(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,Te||(ve=globalThis.frameId=e.windowId);Me(Ae,e.options,ve,t),Te||(e.options.userScriptEnabled&&s&&s(ce.ON_BEFORE_CAPTURE_EVENT_NAME),Le({frames:[Ue(Ae,globalThis,ve,e.options)],sessionId:t,requestedFrameId:Ae.documentElement.dataset.requestedFrameId&&ve}),e.options.userScriptEnabled&&s&&s(ce.ON_AFTER_CAPTURE_EVENT_NAME),delete Ae.documentElement.dataset.requestedFrameId)}({windowId:ve,sessionId:t,options:e});const s=Ne.get(t).frames;return s.sessionId=t,s},cleanup:function(e){Ne.delete(e),xe({windowId:ve,sessionId:e,options:{sessionId:e}})},initResponse:Ce,TIMEOUT_INIT_REQUEST_MESSAGE:be});const Be=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],ze=[{tagName:"head",accept:e=>!e.childNodes.length||1==e.childNodes[0].nodeType},{tagName:"body",accept:e=>!e.childNodes.length}],We=[{tagName:"html",accept:e=>!e||8!=e.nodeType},{tagName:"head",accept:e=>!e||8!=e.nodeType&&(3!=e.nodeType||!Ye(e.textContent))},{tagName:"body",accept:e=>!e||8!=e.nodeType},{tagName:"li",accept:(e,t)=>!e&&t.parentElement&&("UL"==t.parentElement.tagName||"OL"==t.parentElement.tagName)||e&&["LI"].includes(e.tagName)},{tagName:"dt",accept:e=>!e||["DT","DD"].includes(e.tagName)},{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(e.tagName)},{tagName:"dd",accept:e=>!e||["DT","DD"].includes(e.tagName)},{tagName:"rt",accept:e=>!e||["RT","RP"].includes(e.tagName)},{tagName:"rp",accept:e=>!e||["RT","RP"].includes(e.tagName)},{tagName:"optgroup",accept:e=>!e||["OPTGROUP"].includes(e.tagName)},{tagName:"option",accept:e=>!e||["OPTION","OPTGROUP"].includes(e.tagName)},{tagName:"colgroup",accept:e=>!e||8!=e.nodeType&&(3!=e.nodeType||!Ye(e.textContent))},{tagName:"caption",accept:e=>!e||8!=e.nodeType&&(3!=e.nodeType||!Ye(e.textContent))},{tagName:"thead",accept:e=>!e||["TBODY","TFOOT"].includes(e.tagName)},{tagName:"tbody",accept:e=>!e||["TBODY","TFOOT"].includes(e.tagName)},{tagName:"tfoot",accept:e=>!e},{tagName:"tr",accept:e=>!e||["TR"].includes(e.tagName)},{tagName:"td",accept:e=>!e||["TD","TH"].includes(e.tagName)},{tagName:"th",accept:e=>!e||["TD","TH"].includes(e.tagName)}],je=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"];function Je(e,t,s){return 3==e.nodeType?function(e){const t=e.parentNode;let s;t&&1==t.nodeType&&(s=t.tagName.toLowerCase());return!s||je.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):8==e.nodeType?"\x3c!--"+e.textContent+"--\x3e":1==e.nodeType?function(e,t,s){const o=e.tagName.toLowerCase(),n=t&&ze.find((t=>o==t.tagName&&t.accept(e)));let a="";n&&!e.attributes.length||(a="<"+o,Array.from(e.attributes).forEach((s=>a+=function(e,t,s){const o=e.name;let n="";if(!o.match(/["'>/=]/)){let a,i=e.value;s&&"class"==o&&(i=Array.from(t.classList).map((e=>e.trim())).join(" ")),i=i.replace(/&/g,"&amp;").replace(/\u00a0/g,"&nbsp;"),i.includes('"')&&(i.includes("'")||!s?i=i.replace(/"/g,"&quot;"):a=!0);const r=!s||i.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,""!=i&&(n+="=",r&&(n+=a?"'":'"'),n+=i,r&&(n+=a?"'":'"'))}return n}(s,e,t))),a+=">");"TEMPLATE"!=e.tagName||e.childNodes.length?Array.from(e.childNodes).forEach((e=>a+=Je(e,t,s||"svg"==o))):a+=e.innerHTML;const i=t&&We.find((t=>o==t.tagName&&t.accept(e.nextSibling,e)));(s||!i&&!Be.includes(o))&&(a+="</"+o+">");return a}(e,t,s):void 0}function Ye(e){return Boolean(e.match(/^[ \t\n\f\r]/))}const Ge={frameTree:Ve},Ke={COMMENT_HEADER:"Page saved with SingleFile",COMMENT_HEADER_LEGACY:"Archive processed by SingleFile",ON_BEFORE_CAPTURE_EVENT_NAME:c,ON_AFTER_CAPTURE_EVENT_NAME:m,preProcessDoc:q,postProcessDoc:B,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+Je(e.documentElement,t)}(e,t),getShadowRoot:U};D("single-file-user-script-init",(()=>globalThis._singleFile_waitForUserScript=async e=>{const t=new CustomEvent(e+"-request",{cancelable:!0}),s=new Promise((t=>D(e+"-response",t)));(e=>{try{globalThis.dispatchEvent(e)}catch(e){}})(t),t.defaultPrevented&&await s})),e.helper=Ke,e.processors=Ge,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-image",s="single-file-image-loaded",o=(e,t,s)=>globalThis.addEventListener(e,t,s),n=e=>{try{globalThis.dispatchEvent(e)}catch(e){}},i=globalThis.CustomEvent,a=globalThis.document,r=globalThis.Document;let l;l=window._singleFile_fontFaces?window._singleFile_fontFaces:window._singleFile_fontFaces=new Map,a instanceof r&&(o("single-file-new-font-face",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,l.set(JSON.stringify(s),t)})),o("single-file-delete-font",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,l.delete(JSON.stringify(s))})),o("single-file-clear-fonts",(()=>l=new Map)));const d=new RegExp("\\\\([\\da-f]{1,6}[\\x20\\t\\r\\n\\f]?|([\\x20\\t\\r\\n\\f])|.)","ig");const c="data-single-file-removed-content",m="data-single-file-hidden-content",u="data-single-file-kept-content",g="data-single-file-hidden-frame",f="data-single-file-preserved-space-element",h="data-single-file-shadow-root-element",p="data-single-file-image",b="data-single-file-poster",y="data-single-file-video",E="data-single-file-canvas",w="data-single-file-movable-style",T="data-single-file-input-value",I="data-single-file-lazy-loaded-src",v="data-single-file-stylesheet",A="data-single-file-disabled-noscript",S="data-single-file-async-script",R="*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)",N=["NOSCRIPT","DISABLED-NOSCRIPT","META","LINK","STYLE","TITLE","TEMPLATE","SOURCE","OBJECT","SCRIPT","HEAD","BODY"],_=/^'(.*?)'$/,F=/^"(.*?)"$/,M={regular:"400",normal:"400",bold:"700",bolder:"700",lighter:"100"},q="single-file-ui-element",x="data:,";function P(e,t,s,o,n={usedFonts:new Map,canvases:[],images:[],posters:[],videos:[],shadowRoots:[],markedElements:[]},i){return 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=V(e,s),s instanceof e.HTMLElement&&o.removeHiddenElements&&(r=(i||s.closest("html > head"))&&N.includes(s.tagName)||s.closest("details"),r||(a=i||O(s,l),a&&(s.setAttribute(m,""),n.markedElements.push(s)))),!a)){if(o.compressHTML&&l){const e=l.getPropertyValue("white-space");e&&e.startsWith("pre")&&(s.setAttribute(f,""),n.markedElements.push(s))}o.removeUnusedFonts&&(C(l,o,n.usedFonts),C(V(e,s,":first-letter"),o,n.usedFonts),C(V(e,s,":before"),o,n.usedFonts),C(V(e,s,":after"),o,n.usedFonts))}!function(e,t,s,o,n,i,a){if("CANVAS"==s.tagName)try{n.canvases.push({dataURI:s.toDataURL("image/png","")}),s.setAttribute(E,n.canvases.length-1),n.markedElements.push(s)}catch(e){}if("IMG"==s.tagName){const t={currentSrc:i?x:o.loadDeferredImages&&s.getAttribute(I)||s.currentSrc};if(n.images.push(t),s.setAttribute(p,n.images.length-1),n.markedElements.push(s),s.removeAttribute(I),a=a||V(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||V(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=U("padding-left",s),a=U("padding-right",s),r=U("padding-top",s),l=U("padding-bottom",s),g?(d=U("border-left-width",s),c=U("border-right-width",s),m=U("border-top-width",s),u=U("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"==s.tagName){const o=s.currentSrc;if(o&&!o.startsWith("blob:")&&!o.startsWith("data:")){const t=V(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(y,n.videos.length-1)}if(!s.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(b,n.posters.length-1),n.markedElements.push(s)}catch(e){}}}"IFRAME"==s.tagName&&i&&o.removeHiddenElements&&(s.setAttribute(g,""),n.markedElements.push(s));"INPUT"==s.tagName&&("password"!=s.type&&(s.setAttribute(T,s.value),n.markedElements.push(s)),"radio"!=s.type&&"checkbox"!=s.type||(s.setAttribute(T,s.checked),n.markedElements.push(s)));"TEXTAREA"==s.tagName&&(s.setAttribute(T,s.value),n.markedElements.push(s));"SELECT"==s.tagName&&s.querySelectorAll("option").forEach((e=>{e.selected&&(e.setAttribute(T,""),n.markedElements.push(e))}));"SCRIPT"==s.tagName&&(s.async&&""!=s.getAttribute("async")&&"async"!=s.getAttribute("async")&&(s.setAttribute(S,""),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)&&k(s);if(d&&!s.classList.contains(q)){const i={};s.setAttribute(h,n.shadowRoots.length),n.markedElements.push(s),n.shadowRoots.push(i),P(e,t,d,o,n,a),i.content=d.innerHTML,i.mode=d.mode;try{d.adoptedStyleSheets&&d.adoptedStyleSheets.length&&(i.adoptedStyleSheets=Array.from(d.adoptedStyleSheets).map((e=>Array.from(e.cssRules).map((e=>e.cssText)).join("\n"))))}catch(e){}}P(e,t,s,o,n,a),!o.autoSaveExternalSave&&o.removeHiddenElements&&i&&(r||""==s.getAttribute(u)?s.parentElement&&(s.parentElement.setAttribute(u,""),n.markedElements.push(s.parentElement)):a&&(s.setAttribute(c,""),n.markedElements.push(s)))})),n}function C(e,t,s){if(e){const o=e.getPropertyValue("font-style")||"normal";e.getPropertyValue("font-family").split(",").forEach((n=>{if(n=D(n),!t.loadedFonts||t.loadedFonts.find((e=>D(e.family)==n&&e.style==o))){const t=(i=e.getPropertyValue("font-weight"),M[i.toLowerCase().trim()]||i),a=e.getPropertyValue("font-variant")||"normal",r=[n,t,o,a];s.set(JSON.stringify(r),[n,t,o,a])}var i}))}}function k(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 D(e=""){return function(e){e=e.match(_)?e.replace(_,"$1"):e.replace(F,"$1");return e.trim()}((t=e.trim(),t.replace(d,((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 O(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 L(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(v,o),t[o]=Array.from(s.sheet.cssRules).map((e=>e.cssText)).join("\n"))}catch(e){}})),t}}function U(e,t){if(t.getPropertyValue(e).endsWith("px"))return parseFloat(t.getPropertyValue(e))}function V(e,t,s){try{return e.getComputedStyle(t,s)}catch(e){}}const W=I,z=q,H="attributes",B=globalThis.browser,j=globalThis.document,J=globalThis.MutationObserver,Y=(e,t,s)=>globalThis.addEventListener(e,t,s),G=(e,t,s)=>globalThis.removeEventListener(e,t,s),$=new Map;let K;async function X(e){if(j.documentElement){$.clear();const o=Math.max(j.documentElement.scrollHeight-1.5*j.documentElement.clientHeight,0),a=Math.max(j.documentElement.scrollWidth-1.5*j.documentElement.clientWidth,0);if(globalThis.scrollY<=o&&globalThis.scrollX<=a)return function(e){return K=0,new Promise((async o=>{let a;const r=new Set,l=new J((async t=>{if((t=t.filter((e=>e.type==H))).length){t.filter((e=>{if("src"==e.attributeName&&(e.target.setAttribute(W,e.target.src),e.target.addEventListener("load",c)),"src"==e.attributeName||"srcset"==e.attributeName||"SOURCE"==e.target.tagName)return!e.target.classList||!e.target.classList.contains(z)})).length&&(a=!0,await Q(l,e,g),r.size||await Z(l,e,g))}}));async function d(t){await te("idleTimeout",(async()=>{a?K<10&&(K++,oe("idleTimeout"),await d(Math.max(500,t/2))):(oe("loadTimeout"),oe("maxTimeout"),ee(l,e,g))}),t,e.loadDeferredImagesNativeTimeout)}function c(e){const t=e.target;t.removeAttribute(W),t.removeEventListener("load",c)}async function m(t){a=!0,await Q(l,e,g),await Z(l,e,g),t.detail&&r.add(t.detail)}async function u(t){await Q(l,e,g),await Z(l,e,g),r.delete(t.detail),r.size||await Z(l,e,g)}function g(e){l.disconnect(),G(t,m),G(s,u),o(e)}await d(2*e.loadDeferredImagesMaxIdleTime),await Q(l,e,g),l.observe(j,{subtree:!0,childList:!0,attributes:!0}),Y(t,m),Y(s,u),function(e){e.loadDeferredImagesBlockCookies&&n(new i("single-file-block-cookies-start")),e.loadDeferredImagesBlockStorage&&n(new i("single-file-block-storage-start")),e.loadDeferredImagesDispatchScrollEvent&&n(new i("single-file-dispatch-scroll-event-start")),e.loadDeferredImagesKeepZoomLevel?n(new i("single-file-load-deferred-images-keep-zoom-level-start")):n(new i("single-file-load-deferred-images-start"))}(e)}))}(e)}}async function Z(e,t,s){await te("loadTimeout",(()=>ee(e,t,s)),t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function Q(e,t,s){await te("maxTimeout",(async()=>{await oe("loadTimeout"),await ee(e,t,s)}),10*t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function ee(e,t,s){await oe("idleTimeout"),function(e){e.loadDeferredImagesBlockCookies&&n(new i("single-file-block-cookies-end")),e.loadDeferredImagesBlockStorage&&n(new i("single-file-block-storage-end")),e.loadDeferredImagesDispatchScrollEvent&&n(new i("single-file-dispatch-scroll-event-end")),e.loadDeferredImagesKeepZoomLevel?n(new i("single-file-load-deferred-images-keep-zoom-level-end")):n(new i("single-file-load-deferred-images-end"))}(t),await te("endTimeout",(async()=>{await oe("maxTimeout"),s()}),t.loadDeferredImagesMaxIdleTime/2,t.loadDeferredImagesNativeTimeout),e.disconnect()}async function te(e,t,s,o){if(B&&B.runtime&&B.runtime.sendMessage&&!o){if(!$.get(e)||!$.get(e).pending){const o={callback:t,pending:!0};$.set(e,o);try{await B.runtime.sendMessage({method:"singlefile.lazyTimeout.setTimeout",type:e,delay:s})}catch(o){se(e,t,s)}o.pending=!1}}else se(e,t,s)}function se(e,t,s){const o=$.get(e);o&&globalThis.clearTimeout(o),$.set(e,t),globalThis.setTimeout(t,s)}async function oe(e){if(B&&B.runtime&&B.runtime.sendMessage)try{await B.runtime.sendMessage({method:"singlefile.lazyTimeout.clearTimeout",type:e})}catch(t){ne(e)}else ne(e)}function ne(e){const t=$.get(e);$.delete(e),t&&globalThis.clearTimeout(t)}B&&B.runtime&&B.runtime.onMessage&&B.runtime.onMessage.addListener&&B.runtime.onMessage.addListener((e=>{if("singlefile.lazyTimeout.onTimeout"==e.method){const t=$.get(e.type);if(t){$.delete(e.type);try{t.callback()}catch(t){ne(e.type)}}}}));const ie={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([data-single-file-disabled-noscript])").forEach((e=>{e.setAttribute(A,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(R).forEach((e=>e.hidden=!0)),e.querySelectorAll("svg foreignObject").forEach((e=>{const t=e.querySelectorAll("html > head > "+R+", html > body > "+R);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, p div").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=P(t,e,e.documentElement,s),s.moveStylesInHead&&e.querySelectorAll("body style, body ~ style").forEach((e=>{const s=V(t,e);s&&O(e,s)&&(e.setAttribute(w,""),n.markedElements.push(e))}))):n={canvases:[],images:[],posters:[],videos:[],usedFonts:[],shadowRoots:[],markedElements:[]},{canvases:n.canvases,fonts:Array.from(l.values()),stylesheets:L(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("[data-single-file-disabled-noscript]").forEach((e=>{e.textContent=e.getAttribute(A),e.removeAttribute(A)})),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=[c,g,m,f,p,b,y,E,T,h,v,S];t=e.querySelectorAll(s.map((e=>"["+e+"]")).join(","))}t.forEach((e=>{e.removeAttribute(c),e.removeAttribute(m),e.removeAttribute(u),e.removeAttribute(g),e.removeAttribute(f),e.removeAttribute(p),e.removeAttribute(b),e.removeAttribute(y),e.removeAttribute(E),e.removeAttribute(T),e.removeAttribute(h),e.removeAttribute(v),e.removeAttribute(S),e.removeAttribute(w)})),s&&Array.from(s.entries()).forEach((([e,t])=>t.replaceWith(e)))},getShadowRoot:k},ae="__frameTree__::",re='iframe, frame, object[type="text/html"][data]',le="singlefile.frameTree.initRequest",de="singlefile.frameTree.ackInitRequest",ce="singlefile.frameTree.cleanupRequest",me="singlefile.frameTree.initResponse",ue=5e3,ge=".",fe=globalThis.window==globalThis.top,he=globalThis.browser,pe=globalThis.top,be=globalThis.MessageChannel,ye=globalThis.document;let Ee,we=globalThis.sessions;var Te,Ie,ve;function Ae(){return globalThis.crypto.getRandomValues(new Uint32Array(32)).join("")}async function Se(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,fe||(Ee=globalThis.frameId=e.windowId),_e(ye,e.options,Ee,t),fe||(e.options.userScriptEnabled&&s&&await s(ie.ON_BEFORE_CAPTURE_EVENT_NAME),xe({frames:[Ce(ye,globalThis,Ee,e.options)],sessionId:t,requestedFrameId:ye.documentElement.dataset.requestedFrameId&&Ee}),e.options.userScriptEnabled&&s&&await s(ie.ON_AFTER_CAPTURE_EVENT_NAME),delete ye.documentElement.dataset.requestedFrameId)}function Re(e){if(!globalThis._singleFile_cleaningUp){globalThis._singleFile_cleaningUp=!0;const t=e.sessionId;qe(ke(ye),e.windowId,t)}}function Ne(e){e.frames.forEach((t=>Fe("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.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(ge).length-e.windowId.split(ge).length)),t.resolve&&(t.requestedFrameId&&t.frames.forEach((e=>{e.windowId==t.requestedFrameId&&(e.requestedFrame=!0)})),t.resolve(t.frames)))}}function _e(e,t,s,o){const n=ke(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+ge+t;e.setAttribute(ie.WIN_ID_ATTRIBUTE_NAME,s),i.push({windowId:s})})),xe({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),t.forEach(((e,t)=>{const i=o+ge+t;try{Pe(e.contentWindow,{method:le,windowId:i,sessionId:n,options:s})}catch(e){}a[i]=globalThis.setTimeout((()=>xe({frames:[{windowId:i,processed:!0}],sessionId:n})),ue)})),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+ge+t;let r;try{r=e.contentDocument}catch(e){}if(r)try{const t=e.contentWindow;t.stop(),Fe("requestTimeouts",n,a),_e(r,s,a,n),i.push(Ce(r,t,a,s))}catch(e){i.push({windowId:a,processed:!0})}})),xe({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o)}function Fe(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 Me(e,t){const s=we.get(e);s&&s.responseTimeouts&&(s.responseTimeouts[t]=globalThis.setTimeout((()=>xe({frames:[{windowId:t,processed:!0}],sessionId:e})),1e4))}function qe(e,t,s){e.forEach(((e,o)=>{const n=t+ge+o;e.removeAttribute(ie.WIN_ID_ATTRIBUTE_NAME);try{Pe(e.contentWindow,{method:ce,windowId:n,sessionId:s})}catch(e){}})),e.forEach(((e,o)=>{const n=t+ge+o;let i;try{i=e.contentDocument}catch(e){}if(i)try{qe(ke(i),n,s)}catch(e){}}))}function xe(e){e.method=me;try{pe.singlefile.processors.frameTree.initResponse(e)}catch(t){Pe(pe,e,!0)}}function Pe(e,t,s){if(e==pe&&he&&he.runtime&&he.runtime.sendMessage)he.runtime.sendMessage(t);else if(s){const s=new be;e.postMessage(ae+JSON.stringify({method:t.method,sessionId:t.sessionId}),"*",[s.port2]),s.port1.postMessage(t)}else e.postMessage(ae+JSON.stringify(t),"*")}function Ce(e,t,s,o){const n=ie.preProcessDoc(e,t,o),i=ie.serialize(e);ie.postProcessDoc(e,n.markedElements,n.invalidElements);return{windowId:s,content:i,baseURI:e.baseURI.split("#")[0],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 ke(e){let t=Array.from(e.querySelectorAll(re));return e.querySelectorAll("*").forEach((e=>{const s=ie.getShadowRoot(e);s&&(t=t.concat(...s.querySelectorAll(re)))})),t}we||(we=globalThis.sessions=new Map),fe&&(Ee="0",he&&he.runtime&&he.runtime.onMessage&&he.runtime.onMessage.addListener&&he.runtime.onMessage.addListener((e=>e.method==me?(Ne(e),Promise.resolve({})):e.method==de?(Fe("requestTimeouts",e.sessionId,e.windowId),Me(e.sessionId,e.windowId),Promise.resolve({})):void 0))),Te="message",Ie=async e=>{if("string"==typeof e.data&&e.data.startsWith(ae)){e.preventDefault(),e.stopPropagation();const t=JSON.parse(e.data.substring(ae.length));t.method==le?(e.source&&Pe(e.source,{method:de,windowId:t.windowId,sessionId:t.sessionId}),fe||(globalThis.stop(),t.options.loadDeferredImages&&X(t.options),await Se(t))):t.method==de?(Fe("requestTimeouts",t.sessionId,t.windowId),Me(t.sessionId,t.windowId)):t.method==ce?Re(t):t.method==me&&we.get(t.sessionId)&&(e.ports[0].onmessage=e=>Ne(e.data))}},ve=!0,globalThis.addEventListener(Te,Ie,ve),e.TIMEOUT_INIT_REQUEST_MESSAGE=ue,e.cleanup=function(e){we.delete(e),Re({windowId:Ee,sessionId:e,options:{sessionId:e}})},e.getAsync=function(e){const t=Ae();return e=JSON.parse(JSON.stringify(e)),new Promise((s=>{we.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{},resolve:e=>{e.sessionId=t,s(e)}}),Se({windowId:Ee,sessionId:t,options:e})}))},e.getSync=function(e){const t=Ae();e=JSON.parse(JSON.stringify(e)),we.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{}}),function(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,fe||(Ee=globalThis.frameId=e.windowId);_e(ye,e.options,Ee,t),fe||(e.options.userScriptEnabled&&s&&s(ie.ON_BEFORE_CAPTURE_EVENT_NAME),xe({frames:[Ce(ye,globalThis,Ee,e.options)],sessionId:t,requestedFrameId:ye.documentElement.dataset.requestedFrameId&&Ee}),e.options.userScriptEnabled&&s&&s(ie.ON_AFTER_CAPTURE_EVENT_NAME),delete ye.documentElement.dataset.requestedFrameId)}({windowId:Ee,sessionId:t,options:e});const s=we.get(t).frames;return s.sessionId=t,s},e.initResponse=Ne,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-image",s="single-file-image-loaded",o=(e,t,s)=>globalThis.addEventListener(e,t,s),n=e=>{try{globalThis.dispatchEvent(e)}catch(e){}},i=globalThis.CustomEvent,a=globalThis.document,r=globalThis.Document;let l;l=window._singleFile_fontFaces?window._singleFile_fontFaces:window._singleFile_fontFaces=new Map,a instanceof r&&(o("single-file-new-font-face",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,l.set(JSON.stringify(s),t)})),o("single-file-delete-font",(e=>{const t=e.detail,s=Object.assign({},t);delete s.src,l.delete(JSON.stringify(s))})),o("single-file-clear-fonts",(()=>l=new Map)));const d=new RegExp("\\\\([\\da-f]{1,6}[\\x20\\t\\r\\n\\f]?|([\\x20\\t\\r\\n\\f])|.)","ig");const c="data-single-file-removed-content",m="data-single-file-hidden-content",u="data-single-file-kept-content",g="data-single-file-hidden-frame",f="data-single-file-preserved-space-element",h="data-single-file-shadow-root-element",p="data-single-file-image",b="data-single-file-poster",y="data-single-file-video",E="data-single-file-canvas",w="data-single-file-movable-style",T="data-single-file-input-value",I="data-single-file-lazy-loaded-src",v="data-single-file-stylesheet",A="data-single-file-disabled-noscript",S="data-single-file-async-script",R="*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)",N=["NOSCRIPT","DISABLED-NOSCRIPT","META","LINK","STYLE","TITLE","TEMPLATE","SOURCE","OBJECT","SCRIPT","HEAD","BODY"],_=/^'(.*?)'$/,F=/^"(.*?)"$/,M={regular:"400",normal:"400",bold:"700",bolder:"700",lighter:"100"},q="single-file-ui-element",x="data:,";function P(e,t,s,o,n={usedFonts:new Map,canvases:[],images:[],posters:[],videos:[],shadowRoots:[],markedElements:[]},i){return 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=V(e,s),s instanceof e.HTMLElement&&o.removeHiddenElements&&(r=(i||s.closest("html > head"))&&N.includes(s.tagName)||s.closest("details"),r||(a=i||O(s,l),a&&(s.setAttribute(m,""),n.markedElements.push(s)))),!a)){if(o.compressHTML&&l){const e=l.getPropertyValue("white-space");e&&e.startsWith("pre")&&(s.setAttribute(f,""),n.markedElements.push(s))}o.removeUnusedFonts&&(C(l,o,n.usedFonts),C(V(e,s,":first-letter"),o,n.usedFonts),C(V(e,s,":before"),o,n.usedFonts),C(V(e,s,":after"),o,n.usedFonts))}!function(e,t,s,o,n,i,a){if("CANVAS"==s.tagName)try{n.canvases.push({dataURI:s.toDataURL("image/png","")}),s.setAttribute(E,n.canvases.length-1),n.markedElements.push(s)}catch(e){}if("IMG"==s.tagName){const t={currentSrc:i?x:o.loadDeferredImages&&s.getAttribute(I)||s.currentSrc};if(n.images.push(t),s.setAttribute(p,n.images.length-1),n.markedElements.push(s),s.removeAttribute(I),a=a||V(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||V(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=U("padding-left",s),a=U("padding-right",s),r=U("padding-top",s),l=U("padding-bottom",s),g?(d=U("border-left-width",s),c=U("border-right-width",s),m=U("border-top-width",s),u=U("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"==s.tagName){const o=s.currentSrc;if(o&&!o.startsWith("blob:")&&!o.startsWith("data:")){const t=V(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(y,n.videos.length-1)}if(!s.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(b,n.posters.length-1),n.markedElements.push(s)}catch(e){}}}"IFRAME"==s.tagName&&i&&o.removeHiddenElements&&(s.setAttribute(g,""),n.markedElements.push(s));"INPUT"==s.tagName&&("password"!=s.type&&(s.setAttribute(T,s.value),n.markedElements.push(s)),"radio"!=s.type&&"checkbox"!=s.type||(s.setAttribute(T,s.checked),n.markedElements.push(s)));"TEXTAREA"==s.tagName&&(s.setAttribute(T,s.value),n.markedElements.push(s));"SELECT"==s.tagName&&s.querySelectorAll("option").forEach((e=>{e.selected&&(e.setAttribute(T,""),n.markedElements.push(e))}));"SCRIPT"==s.tagName&&(s.async&&""!=s.getAttribute("async")&&"async"!=s.getAttribute("async")&&(s.setAttribute(S,""),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)&&k(s);if(d&&!s.classList.contains(q)){const i={};s.setAttribute(h,n.shadowRoots.length),n.markedElements.push(s),n.shadowRoots.push(i),P(e,t,d,o,n,a),i.content=d.innerHTML,i.mode=d.mode;try{d.adoptedStyleSheets&&d.adoptedStyleSheets.length&&(i.adoptedStyleSheets=Array.from(d.adoptedStyleSheets).map((e=>Array.from(e.cssRules).map((e=>e.cssText)).join("\n"))))}catch(e){}}P(e,t,s,o,n,a),!o.autoSaveExternalSave&&o.removeHiddenElements&&i&&(r||""==s.getAttribute(u)?s.parentElement&&(s.parentElement.setAttribute(u,""),n.markedElements.push(s.parentElement)):a&&(s.setAttribute(c,""),n.markedElements.push(s)))})),n}function C(e,t,s){if(e){const o=e.getPropertyValue("font-style")||"normal";e.getPropertyValue("font-family").split(",").forEach((n=>{if(n=D(n),!t.loadedFonts||t.loadedFonts.find((e=>D(e.family)==n&&e.style==o))){const t=(i=e.getPropertyValue("font-weight"),M[i.toLowerCase().trim()]||i),a=e.getPropertyValue("font-variant")||"normal",r=[n,t,o,a];s.set(JSON.stringify(r),[n,t,o,a])}var i}))}}function k(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 D(e=""){return function(e){e=e.match(_)?e.replace(_,"$1"):e.replace(F,"$1");return e.trim()}((t=e.trim(),t.replace(d,((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 O(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 L(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(v,o),t[o]=Array.from(s.sheet.cssRules).map((e=>e.cssText)).join("\n"))}catch(e){}})),t}}function U(e,t){if(t.getPropertyValue(e).endsWith("px"))return parseFloat(t.getPropertyValue(e))}function V(e,t,s){try{return e.getComputedStyle(t,s)}catch(e){}}const W=I,z=q,H="attributes",B=globalThis.browser,j=globalThis.document,J=globalThis.MutationObserver,Y=(e,t,s)=>globalThis.addEventListener(e,t,s),G=(e,t,s)=>globalThis.removeEventListener(e,t,s),$=new Map;let K;async function X(e){if(j.documentElement){$.clear();const o=Math.max(j.documentElement.scrollHeight-1.5*j.documentElement.clientHeight,0),a=Math.max(j.documentElement.scrollWidth-1.5*j.documentElement.clientWidth,0);if(globalThis.scrollY<=o&&globalThis.scrollX<=a)return function(e){return K=0,new Promise((async o=>{let a;const r=new Set,l=new J((async t=>{if((t=t.filter((e=>e.type==H))).length){t.filter((e=>{if("src"==e.attributeName&&(e.target.setAttribute(W,e.target.src),e.target.addEventListener("load",c)),"src"==e.attributeName||"srcset"==e.attributeName||"SOURCE"==e.target.tagName)return!e.target.classList||!e.target.classList.contains(z)})).length&&(a=!0,await Q(l,e,g),r.size||await Z(l,e,g))}}));async function d(t){await te("idleTimeout",(async()=>{a?K<10&&(K++,oe("idleTimeout"),await d(Math.max(500,t/2))):(oe("loadTimeout"),oe("maxTimeout"),ee(l,e,g))}),t,e.loadDeferredImagesNativeTimeout)}function c(e){const t=e.target;t.removeAttribute(W),t.removeEventListener("load",c)}async function m(t){a=!0,await Q(l,e,g),await Z(l,e,g),t.detail&&r.add(t.detail)}async function u(t){await Q(l,e,g),await Z(l,e,g),r.delete(t.detail),r.size||await Z(l,e,g)}function g(e){l.disconnect(),G(t,m),G(s,u),o(e)}await d(2*e.loadDeferredImagesMaxIdleTime),await Q(l,e,g),l.observe(j,{subtree:!0,childList:!0,attributes:!0}),Y(t,m),Y(s,u),function(e){e.loadDeferredImagesBlockCookies&&n(new i("single-file-block-cookies-start")),e.loadDeferredImagesBlockStorage&&n(new i("single-file-block-storage-start")),e.loadDeferredImagesDispatchScrollEvent&&n(new i("single-file-dispatch-scroll-event-start")),e.loadDeferredImagesKeepZoomLevel?n(new i("single-file-load-deferred-images-keep-zoom-level-start")):n(new i("single-file-load-deferred-images-start"))}(e)}))}(e)}}async function Z(e,t,s){await te("loadTimeout",(()=>ee(e,t,s)),t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function Q(e,t,s){await te("maxTimeout",(async()=>{await oe("loadTimeout"),await ee(e,t,s)}),10*t.loadDeferredImagesMaxIdleTime,t.loadDeferredImagesNativeTimeout)}async function ee(e,t,s){await oe("idleTimeout"),function(e){e.loadDeferredImagesBlockCookies&&n(new i("single-file-block-cookies-end")),e.loadDeferredImagesBlockStorage&&n(new i("single-file-block-storage-end")),e.loadDeferredImagesDispatchScrollEvent&&n(new i("single-file-dispatch-scroll-event-end")),e.loadDeferredImagesKeepZoomLevel?n(new i("single-file-load-deferred-images-keep-zoom-level-end")):n(new i("single-file-load-deferred-images-end"))}(t),await te("endTimeout",(async()=>{await oe("maxTimeout"),s()}),t.loadDeferredImagesMaxIdleTime/2,t.loadDeferredImagesNativeTimeout),e.disconnect()}async function te(e,t,s,o){if(B&&B.runtime&&B.runtime.sendMessage&&!o){if(!$.get(e)||!$.get(e).pending){const o={callback:t,pending:!0};$.set(e,o);try{await B.runtime.sendMessage({method:"singlefile.lazyTimeout.setTimeout",type:e,delay:s})}catch(o){se(e,t,s)}o.pending=!1}}else se(e,t,s)}function se(e,t,s){const o=$.get(e);o&&globalThis.clearTimeout(o),$.set(e,t),globalThis.setTimeout(t,s)}async function oe(e){if(B&&B.runtime&&B.runtime.sendMessage)try{await B.runtime.sendMessage({method:"singlefile.lazyTimeout.clearTimeout",type:e})}catch(t){ne(e)}else ne(e)}function ne(e){const t=$.get(e);$.delete(e),t&&globalThis.clearTimeout(t)}B&&B.runtime&&B.runtime.onMessage&&B.runtime.onMessage.addListener&&B.runtime.onMessage.addListener((e=>{if("singlefile.lazyTimeout.onTimeout"==e.method){const t=$.get(e.type);if(t){$.delete(e.type);try{t.callback()}catch(t){ne(e.type)}}}}));const ie={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([data-single-file-disabled-noscript])").forEach((e=>{e.setAttribute(A,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(R).forEach((e=>e.hidden=!0)),e.querySelectorAll("svg foreignObject").forEach((e=>{const t=e.querySelectorAll("html > head > "+R+", html > body > "+R);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=P(t,e,e.documentElement,s),s.moveStylesInHead&&e.querySelectorAll("body style, body ~ style").forEach((e=>{const s=V(t,e);s&&O(e,s)&&(e.setAttribute(w,""),n.markedElements.push(e))}))):n={canvases:[],images:[],posters:[],videos:[],usedFonts:[],shadowRoots:[],markedElements:[]},{canvases:n.canvases,fonts:Array.from(l.values()),stylesheets:L(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("[data-single-file-disabled-noscript]").forEach((e=>{e.textContent=e.getAttribute(A),e.removeAttribute(A)})),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=[c,g,m,f,p,b,y,E,T,h,v,S];t=e.querySelectorAll(s.map((e=>"["+e+"]")).join(","))}t.forEach((e=>{e.removeAttribute(c),e.removeAttribute(m),e.removeAttribute(u),e.removeAttribute(g),e.removeAttribute(f),e.removeAttribute(p),e.removeAttribute(b),e.removeAttribute(y),e.removeAttribute(E),e.removeAttribute(T),e.removeAttribute(h),e.removeAttribute(v),e.removeAttribute(S),e.removeAttribute(w)})),s&&Array.from(s.entries()).forEach((([e,t])=>t.replaceWith(e)))},getShadowRoot:k},ae="__frameTree__::",re='iframe, frame, object[type="text/html"][data]',le="singlefile.frameTree.initRequest",de="singlefile.frameTree.ackInitRequest",ce="singlefile.frameTree.cleanupRequest",me="singlefile.frameTree.initResponse",ue=5e3,ge=".",fe=globalThis.window==globalThis.top,he=globalThis.browser,pe=globalThis.top,be=globalThis.MessageChannel,ye=globalThis.document;let Ee,we=globalThis.sessions;var Te,Ie,ve;function Ae(){return globalThis.crypto.getRandomValues(new Uint32Array(32)).join("")}async function Se(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,fe||(Ee=globalThis.frameId=e.windowId),_e(ye,e.options,Ee,t),fe||(e.options.userScriptEnabled&&s&&await s(ie.ON_BEFORE_CAPTURE_EVENT_NAME),xe({frames:[Ce(ye,globalThis,Ee,e.options)],sessionId:t,requestedFrameId:ye.documentElement.dataset.requestedFrameId&&Ee}),e.options.userScriptEnabled&&s&&await s(ie.ON_AFTER_CAPTURE_EVENT_NAME),delete ye.documentElement.dataset.requestedFrameId)}function Re(e){if(!globalThis._singleFile_cleaningUp){globalThis._singleFile_cleaningUp=!0;const t=e.sessionId;qe(ke(ye),e.windowId,t)}}function Ne(e){e.frames.forEach((t=>Fe("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.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(ge).length-e.windowId.split(ge).length)),t.resolve&&(t.requestedFrameId&&t.frames.forEach((e=>{e.windowId==t.requestedFrameId&&(e.requestedFrame=!0)})),t.resolve(t.frames)))}}function _e(e,t,s,o){const n=ke(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+ge+t;e.setAttribute(ie.WIN_ID_ATTRIBUTE_NAME,s),i.push({windowId:s})})),xe({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),t.forEach(((e,t)=>{const i=o+ge+t;try{Pe(e.contentWindow,{method:le,windowId:i,sessionId:n,options:s})}catch(e){}a[i]=globalThis.setTimeout((()=>xe({frames:[{windowId:i,processed:!0}],sessionId:n})),ue)})),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+ge+t;let r;try{r=e.contentDocument}catch(e){}if(r)try{const t=e.contentWindow;t.stop(),Fe("requestTimeouts",n,a),_e(r,s,a,n),i.push(Ce(r,t,a,s))}catch(e){i.push({windowId:a,processed:!0})}})),xe({frames:i,sessionId:n,requestedFrameId:e.documentElement.dataset.requestedFrameId&&o}),delete e.documentElement.dataset.requestedFrameId}(e,n,t,s,o)}function Fe(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 Me(e,t){const s=we.get(e);s&&s.responseTimeouts&&(s.responseTimeouts[t]=globalThis.setTimeout((()=>xe({frames:[{windowId:t,processed:!0}],sessionId:e})),1e4))}function qe(e,t,s){e.forEach(((e,o)=>{const n=t+ge+o;e.removeAttribute(ie.WIN_ID_ATTRIBUTE_NAME);try{Pe(e.contentWindow,{method:ce,windowId:n,sessionId:s})}catch(e){}})),e.forEach(((e,o)=>{const n=t+ge+o;let i;try{i=e.contentDocument}catch(e){}if(i)try{qe(ke(i),n,s)}catch(e){}}))}function xe(e){e.method=me;try{pe.singlefile.processors.frameTree.initResponse(e)}catch(t){Pe(pe,e,!0)}}function Pe(e,t,s){if(e==pe&&he&&he.runtime&&he.runtime.sendMessage)he.runtime.sendMessage(t);else if(s){const s=new be;e.postMessage(ae+JSON.stringify({method:t.method,sessionId:t.sessionId}),"*",[s.port2]),s.port1.postMessage(t)}else e.postMessage(ae+JSON.stringify(t),"*")}function Ce(e,t,s,o){const n=ie.preProcessDoc(e,t,o),i=ie.serialize(e);ie.postProcessDoc(e,n.markedElements,n.invalidElements);return{windowId:s,content:i,baseURI:e.baseURI.split("#")[0],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 ke(e){let t=Array.from(e.querySelectorAll(re));return e.querySelectorAll("*").forEach((e=>{const s=ie.getShadowRoot(e);s&&(t=t.concat(...s.querySelectorAll(re)))})),t}we||(we=globalThis.sessions=new Map),fe&&(Ee="0",he&&he.runtime&&he.runtime.onMessage&&he.runtime.onMessage.addListener&&he.runtime.onMessage.addListener((e=>e.method==me?(Ne(e),Promise.resolve({})):e.method==de?(Fe("requestTimeouts",e.sessionId,e.windowId),Me(e.sessionId,e.windowId),Promise.resolve({})):void 0))),Te="message",Ie=async e=>{if("string"==typeof e.data&&e.data.startsWith(ae)){e.preventDefault(),e.stopPropagation();const t=JSON.parse(e.data.substring(ae.length));t.method==le?(e.source&&Pe(e.source,{method:de,windowId:t.windowId,sessionId:t.sessionId}),fe||(globalThis.stop(),t.options.loadDeferredImages&&X(t.options),await Se(t))):t.method==de?(Fe("requestTimeouts",t.sessionId,t.windowId),Me(t.sessionId,t.windowId)):t.method==ce?Re(t):t.method==me&&we.get(t.sessionId)&&(e.ports[0].onmessage=e=>Ne(e.data))}},ve=!0,globalThis.addEventListener(Te,Ie,ve),e.TIMEOUT_INIT_REQUEST_MESSAGE=ue,e.cleanup=function(e){we.delete(e),Re({windowId:Ee,sessionId:e,options:{sessionId:e}})},e.getAsync=function(e){const t=Ae();return e=JSON.parse(JSON.stringify(e)),new Promise((s=>{we.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{},resolve:e=>{e.sessionId=t,s(e)}}),Se({windowId:Ee,sessionId:t,options:e})}))},e.getSync=function(e){const t=Ae();e=JSON.parse(JSON.stringify(e)),we.set(t,{frames:[],requestTimeouts:{},responseTimeouts:{}}),function(e){const t=e.sessionId,s=globalThis._singleFile_waitForUserScript;delete globalThis._singleFile_cleaningUp,fe||(Ee=globalThis.frameId=e.windowId);_e(ye,e.options,Ee,t),fe||(e.options.userScriptEnabled&&s&&s(ie.ON_BEFORE_CAPTURE_EVENT_NAME),xe({frames:[Ce(ye,globalThis,Ee,e.options)],sessionId:t,requestedFrameId:ye.documentElement.dataset.requestedFrameId&&Ee}),e.options.userScriptEnabled&&s&&s(ie.ON_AFTER_CAPTURE_EVENT_NAME),delete ye.documentElement.dataset.requestedFrameId)}({windowId:Ee,sessionId:t,options:e});const s=we.get(t).frames;return s.sessionId=t,s},e.initResponse=Ne,Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1 +1 @@
1
- !function(){"use strict";(e=>{const t="single-file-lazy-load",n="single-file-load-image",i="single-file-image-loaded",o="single-file-new-font-face",r={family:"font-family",style:"font-style",weight:"font-weight",stretch:"font-stretch",unicodeRange:"unicode-range",variant:"font-variant",featureSettings:"font-feature-settings"},l=(t,n,i)=>e.addEventListener(t,n,i),s=t=>{try{e.dispatchEvent(t)}catch(e){}},c=e.CustomEvent,d=e.document,g=e.screen,a=e.Element,f=e.UIEvent,m=e.FileReader,_=e.Blob,u=e.console,y=u&&u.warn&&((...e)=>u.warn(...e))||(()=>{}),h=new Map,p=new Map;let F;function E(o){const r=d.scrollingElement||d.documentElement,l=r.clientHeight,m=r.clientWidth,_=Math.max(r.scrollHeight-l,l),u=Math.max(r.scrollWidth-m,m);if(d.querySelectorAll("[loading=lazy]").forEach((e=>{e.loading="eager",e.setAttribute(t,"")})),r.__defineGetter__("clientHeight",(()=>_)),r.__defineGetter__("clientWidth",(()=>u)),g.__defineGetter__("height",(()=>_)),g.__defineGetter__("width",(()=>u)),e._singleFile_innerHeight=e.innerHeight,e._singleFile_innerWidth=e.innerWidth,e.__defineGetter__("innerHeight",(()=>_)),e.__defineGetter__("innerWidth",(()=>u)),o||e._singleFile_getBoundingClientRect||(e._singleFile_getBoundingClientRect=a.prototype.getBoundingClientRect,a.prototype.getBoundingClientRect=function(){const t=e._singleFile_getBoundingClientRect.call(this);return this==r&&(t.__defineGetter__("height",(()=>_)),t.__defineGetter__("bottom",(()=>_+t.top)),t.__defineGetter__("width",(()=>u)),t.__defineGetter__("right",(()=>u+t.left))),t}),!e._singleFileImage){const t=e.Image;e._singleFileImage=e.Image,e.__defineGetter__("Image",(function(){return function(){const e=new t(...arguments),o=new t(...arguments);return o.__defineSetter__("src",(function(t){e.src=t,s(new c(n,{detail:e.src}))})),o.__defineGetter__("src",(function(){return e.src})),o.__defineSetter__("srcset",(function(t){s(new c(n)),e.srcset=t})),o.__defineGetter__("srcset",(function(){return e.srcset})),e.onload=e.onloadend=e.onerror=t=>{s(new c(i,{detail:e.src})),o.dispatchEvent(new f(t.type,t))},e.decode&&(o.decode=()=>e.decode()),o}}))}let y,F;o?(y=l/_,F=m/u):(y=(l+e.scrollY)/_,F=(m+e.scrollX)/u);const E=Math.min(y,F);if(E<1){const e=d.documentElement.style.getPropertyValue("transform"),t=d.documentElement.style.getPropertyPriority("transform"),n=d.documentElement.style.getPropertyValue("transform-origin"),i=d.documentElement.style.getPropertyPriority("transform-origin"),r=d.documentElement.style.getPropertyValue("min-height"),l=d.documentElement.style.getPropertyPriority("min-height");d.documentElement.style.setProperty("transform-origin",(y<1?"50%":"0")+" "+(F<1?"50%":"0")+" 0","important"),d.documentElement.style.setProperty("transform","scale3d("+E+", "+E+", 1)","important"),d.documentElement.style.setProperty("min-height",100/E+"vh","important"),b(),o?(d.documentElement.style.setProperty("-sf-transform",e,t),d.documentElement.style.setProperty("-sf-transform-origin",n,i),d.documentElement.style.setProperty("-sf-min-height",r,l)):(d.documentElement.style.setProperty("transform",e,t),d.documentElement.style.setProperty("transform-origin",n,i),d.documentElement.style.setProperty("min-height",r,l))}if(!o){b();const e=r.getBoundingClientRect();window==window.top&&[...h].forEach((([t,n])=>{const i=n.options&&n.options.root&&n.options.root.getBoundingClientRect,o=i&&n.options.root.getBoundingClientRect(),r=p.get(t);if(r){const l=r.map((t=>{const n=t.getBoundingClientRect();return{target:t,intersectionRatio:1,boundingClientRect:n,intersectionRect:n,isIntersecting:!0,rootBounds:i?o:e,time:0}}));n.callback(l,t)}}))}}function w(n){d.querySelectorAll("[single-file-lazy-load]").forEach((e=>{e.loading="lazy",e.removeAttribute(t)})),n||e._singleFile_getBoundingClientRect&&(a.prototype.getBoundingClientRect=e._singleFile_getBoundingClientRect,delete e._singleFile_getBoundingClientRect),e._singleFileImage&&(delete e.Image,e.Image=e._singleFileImage,delete e._singleFileImage),n||b()}function v(){const t=d.scrollingElement||d.documentElement;null!=e._singleFile_innerHeight&&(delete e.innerHeight,e.innerHeight=e._singleFile_innerHeight,delete e._singleFile_innerHeight),null!=e._singleFile_innerWidth&&(delete e.innerWidth,e.innerWidth=e._singleFile_innerWidth,delete e._singleFile_innerWidth),delete t.clientHeight,delete t.clientWidth,delete g.height,delete g.width}if(l("single-file-load-deferred-images-start",(()=>E())),l("single-file-load-deferred-images-keep-zoom-level-start",(()=>E(!0))),l("single-file-load-deferred-images-end",(()=>w())),l("single-file-load-deferred-images-keep-zoom-level-end",(()=>w(!0))),l("single-file-load-deferred-images-reset",v),l("single-file-load-deferred-images-keep-zoom-level-reset",(()=>{const e=d.documentElement.style.getPropertyValue("-sf-transform"),t=d.documentElement.style.getPropertyPriority("-sf-transform"),n=d.documentElement.style.getPropertyValue("-sf-transform-origin"),i=d.documentElement.style.getPropertyPriority("-sf-transform-origin"),o=d.documentElement.style.getPropertyValue("-sf-min-height"),r=d.documentElement.style.getPropertyPriority("-sf-min-height");d.documentElement.style.setProperty("transform",e,t),d.documentElement.style.setProperty("transform-origin",n,i),d.documentElement.style.setProperty("min-height",o,r),d.documentElement.style.removeProperty("-sf-transform"),d.documentElement.style.removeProperty("-sf-transform-origin"),d.documentElement.style.removeProperty("-sf-min-height"),v()})),l("single-file-dispatch-scroll-event-start",(()=>{F=!0})),l("single-file-dispatch-scroll-event-end",(()=>{F=!1})),l("single-file-block-cookies-start",(()=>{try{d.__defineGetter__("cookie",(()=>{throw new Error("document.cookie temporary blocked by SingleFile")}))}catch(e){}})),l("single-file-block-cookies-end",(()=>{delete d.cookie})),l("single-file-block-storage-start",(()=>{e._singleFile_localStorage||(e._singleFile_localStorage=e.localStorage,e.__defineGetter__("localStorage",(()=>{throw new Error("localStorage temporary blocked by SingleFile")}))),e._singleFile_indexedDB||(e._singleFile_indexedDB=e.indexedDB,e.__defineGetter__("indexedDB",(()=>{throw new Error("indexedDB temporary blocked by SingleFile")})))})),l("single-file-block-storage-end",(()=>{e._singleFile_localStorage&&(delete e.localStorage,e.localStorage=e._singleFile_localStorage,delete e._singleFile_localStorage),e._singleFile_indexedDB||(delete e.indexedDB,e.indexedDB=e._singleFile_indexedDB,delete e._singleFile_indexedDB)})),e.FontFace){const t=e.FontFace;let n;e.FontFace=function(){return n||(y("SingleFile is hooking the FontFace constructor, document.fonts.delete and document.fonts.clear to handle dynamically loaded fonts."),n=!0),P(...arguments).then((e=>s(new c(o,{detail:e})))),new t(...arguments)},e.FontFace.toString=function(){return"function FontFace() { [native code] }"};const i=d.fonts.delete;d.fonts.delete=function(e){return P(e.family).then((e=>s(new c("single-file-delete-font",{detail:e})))),i.call(d.fonts,e)},d.fonts.delete.toString=function(){return"function delete() { [native code] }"};const r=d.fonts.clear;d.fonts.clear=function(){return s(new c("single-file-clear-fonts")),r.call(d.fonts)},d.fonts.clear.toString=function(){return"function clear() { [native code] }"}}if(e.IntersectionObserver){const t=e.IntersectionObserver;let n;e.IntersectionObserver=function(){n||(y("SingleFile is hooking the IntersectionObserver API to detect and load deferred images."),n=!0);const e=new t(...arguments),i=t.prototype.observe||e.observe,o=t.prototype.unobserve||e.unobserve,r=arguments[0],l=arguments[1];return i&&(e.observe=function(t){let n=p.get(e);return n||(n=[],p.set(e,n)),n.push(t),i.call(e,t)}),o&&(e.unobserve=function(t){let n=p.get(e);return n&&(n=n.filter((e=>e!=t)),n.length?p.set(e,n):(p.delete(e),h.delete(e))),o.call(e,t)}),h.set(e,{callback:r,options:l}),e},e.IntersectionObserver.prototype=t.prototype,e.IntersectionObserver.toString=function(){return"function IntersectionObserver() { [native code] }"}}async function P(e,t,n){const i={};return i["font-family"]=e,i.src=t,n&&Object.keys(n).forEach((e=>{r[e]&&(i[r[e]]=n[e])})),new Promise((e=>{if(i.src instanceof ArrayBuffer){const t=new m;t.readAsDataURL(new _([i.src])),t.addEventListener("load",(()=>{i.src="url("+t.result+")",e(i)}))}else e(i)}))}function b(){try{s(new f("resize")),F&&s(new f("scroll"))}catch(e){}}})("object"==typeof globalThis?globalThis:window)}();
1
+ !function(){"use strict";(e=>{const t="single-file-lazy-load",n="single-file-load-image",i="single-file-image-loaded",o="single-file-new-font-face",r={family:"font-family",style:"font-style",weight:"font-weight",stretch:"font-stretch",unicodeRange:"unicode-range",variant:"font-variant",featureSettings:"font-feature-settings"},l=(t,n,i)=>e.addEventListener(t,n,i),s=t=>{try{e.dispatchEvent(t)}catch(e){}},c=e.CustomEvent,d=e.document,a=e.screen,g=e.Element,f=e.UIEvent,m=e.FileReader,u=e.Blob,_=e.console,y=_&&_.warn&&((...e)=>_.warn(...e))||(()=>{}),h=new Map,p=new Map;let F;function E(o){const r=d.scrollingElement||d.documentElement,l=r.clientHeight,m=r.clientWidth,u=Math.max(r.scrollHeight-l,l),_=Math.max(r.scrollWidth-m,m);if(d.querySelectorAll("[loading=lazy]").forEach((e=>{e.loading="eager",e.setAttribute(t,"")})),r.__defineGetter__("clientHeight",(()=>u)),r.__defineGetter__("clientWidth",(()=>_)),a.__defineGetter__("height",(()=>u)),a.__defineGetter__("width",(()=>_)),e._singleFile_innerHeight=e.innerHeight,e._singleFile_innerWidth=e.innerWidth,e.__defineGetter__("innerHeight",(()=>u)),e.__defineGetter__("innerWidth",(()=>_)),o||e._singleFile_getBoundingClientRect||(e._singleFile_getBoundingClientRect=g.prototype.getBoundingClientRect,g.prototype.getBoundingClientRect=function(){const t=e._singleFile_getBoundingClientRect.call(this);return this==r&&(t.__defineGetter__("height",(()=>u)),t.__defineGetter__("bottom",(()=>u+t.top)),t.__defineGetter__("width",(()=>_)),t.__defineGetter__("right",(()=>_+t.left))),t}),!e._singleFileImage){const t=e.Image;e._singleFileImage=e.Image,e.__defineGetter__("Image",(function(){return function(){const e=new t(...arguments),o=new t(...arguments);return o.__defineSetter__("src",(function(t){e.src=t,s(new c(n,{detail:e.src}))})),o.__defineGetter__("src",(function(){return e.src})),o.__defineSetter__("srcset",(function(t){s(new c(n)),e.srcset=t})),o.__defineGetter__("srcset",(function(){return e.srcset})),e.onload=e.onloadend=e.onerror=t=>{s(new c(i,{detail:e.src})),o.dispatchEvent(new f(t.type,t))},e.decode&&(o.decode=()=>e.decode()),o}}))}let y,F;o?(y=l/u,F=m/_):(y=(l+e.scrollY)/u,F=(m+e.scrollX)/_);const E=Math.min(y,F);if(E<1){const e=d.documentElement.style.getPropertyValue("transform"),t=d.documentElement.style.getPropertyPriority("transform"),n=d.documentElement.style.getPropertyValue("transform-origin"),i=d.documentElement.style.getPropertyPriority("transform-origin"),r=d.documentElement.style.getPropertyValue("min-height"),l=d.documentElement.style.getPropertyPriority("min-height");d.documentElement.style.setProperty("transform-origin",(y<1?"50%":"0")+" "+(F<1?"50%":"0")+" 0","important"),d.documentElement.style.setProperty("transform","scale3d("+E+", "+E+", 1)","important"),d.documentElement.style.setProperty("min-height",100/E+"vh","important"),b(),o?(d.documentElement.style.setProperty("-sf-transform",e,t),d.documentElement.style.setProperty("-sf-transform-origin",n,i),d.documentElement.style.setProperty("-sf-min-height",r,l)):(d.documentElement.style.setProperty("transform",e,t),d.documentElement.style.setProperty("transform-origin",n,i),d.documentElement.style.setProperty("min-height",r,l))}if(!o){b();const e=r.getBoundingClientRect();window==window.top&&[...h].forEach((([t,n])=>{const i=n.options&&n.options.root&&n.options.root.getBoundingClientRect,o=i&&n.options.root.getBoundingClientRect(),r=p.get(t);if(r){const l=r.map((t=>{const n=t.getBoundingClientRect();return{target:t,intersectionRatio:1,boundingClientRect:n,intersectionRect:n,isIntersecting:!0,rootBounds:i?o:e,time:0}}));n.callback(l,t)}}))}}function w(n){d.querySelectorAll("[single-file-lazy-load]").forEach((e=>{e.loading="lazy",e.removeAttribute(t)})),n||e._singleFile_getBoundingClientRect&&(g.prototype.getBoundingClientRect=e._singleFile_getBoundingClientRect,delete e._singleFile_getBoundingClientRect),e._singleFileImage&&(delete e.Image,e.Image=e._singleFileImage,delete e._singleFileImage),n||b()}function v(){const t=d.scrollingElement||d.documentElement;null!=e._singleFile_innerHeight&&(delete e.innerHeight,e.innerHeight=e._singleFile_innerHeight,delete e._singleFile_innerHeight),null!=e._singleFile_innerWidth&&(delete e.innerWidth,e.innerWidth=e._singleFile_innerWidth,delete e._singleFile_innerWidth),delete t.clientHeight,delete t.clientWidth,delete a.height,delete a.width}if(l("single-file-load-deferred-images-start",(()=>E())),l("single-file-load-deferred-images-keep-zoom-level-start",(()=>E(!0))),l("single-file-load-deferred-images-end",(()=>w())),l("single-file-load-deferred-images-keep-zoom-level-end",(()=>w(!0))),l("single-file-load-deferred-images-reset",v),l("single-file-load-deferred-images-keep-zoom-level-reset",(()=>{const e=d.documentElement.style.getPropertyValue("-sf-transform"),t=d.documentElement.style.getPropertyPriority("-sf-transform"),n=d.documentElement.style.getPropertyValue("-sf-transform-origin"),i=d.documentElement.style.getPropertyPriority("-sf-transform-origin"),o=d.documentElement.style.getPropertyValue("-sf-min-height"),r=d.documentElement.style.getPropertyPriority("-sf-min-height");d.documentElement.style.setProperty("transform",e,t),d.documentElement.style.setProperty("transform-origin",n,i),d.documentElement.style.setProperty("min-height",o,r),d.documentElement.style.removeProperty("-sf-transform"),d.documentElement.style.removeProperty("-sf-transform-origin"),d.documentElement.style.removeProperty("-sf-min-height"),v()})),l("single-file-dispatch-scroll-event-start",(()=>{F=!0})),l("single-file-dispatch-scroll-event-end",(()=>{F=!1})),l("single-file-block-cookies-start",(()=>{try{d.__defineGetter__("cookie",(()=>{throw new Error("document.cookie temporary blocked by SingleFile")}))}catch(e){}})),l("single-file-block-cookies-end",(()=>{delete d.cookie})),l("single-file-block-storage-start",(()=>{e._singleFile_localStorage||(e._singleFile_localStorage=e.localStorage,e.__defineGetter__("localStorage",(()=>{throw new Error("localStorage temporary blocked by SingleFile")}))),e._singleFile_indexedDB||(e._singleFile_indexedDB=e.indexedDB,e.__defineGetter__("indexedDB",(()=>{throw new Error("indexedDB temporary blocked by SingleFile")})))})),l("single-file-block-storage-end",(()=>{e._singleFile_localStorage&&(delete e.localStorage,e.localStorage=e._singleFile_localStorage,delete e._singleFile_localStorage),e._singleFile_indexedDB||(delete e.indexedDB,e.indexedDB=e._singleFile_indexedDB,delete e._singleFile_indexedDB)})),l("single-file-request-fetch",(async t=>{s(new c("single-file-ack-fetch"));const{url:n,options:i}=JSON.parse(t.detail);let o;try{const t=await((t,n)=>e.fetch(t,n))(n,i);o={url:n,response:await t.arrayBuffer(),headers:[...t.headers],status:t.status}}catch(e){o={url:n,error:e&&e.toString()}}s(new c("single-file-response-fetch",{detail:o}))})),e.FontFace){const t=e.FontFace;let n;e.FontFace=function(){return n||(y("SingleFile is hooking the FontFace constructor, document.fonts.delete and document.fonts.clear to handle dynamically loaded fonts."),n=!0),P(...arguments).then((e=>s(new c(o,{detail:e})))),new t(...arguments)},e.FontFace.toString=function(){return"function FontFace() { [native code] }"};const i=d.fonts.delete;d.fonts.delete=function(e){return P(e.family).then((e=>s(new c("single-file-delete-font",{detail:e})))),i.call(d.fonts,e)},d.fonts.delete.toString=function(){return"function delete() { [native code] }"};const r=d.fonts.clear;d.fonts.clear=function(){return s(new c("single-file-clear-fonts")),r.call(d.fonts)},d.fonts.clear.toString=function(){return"function clear() { [native code] }"}}if(e.IntersectionObserver){const t=e.IntersectionObserver;let n;e.IntersectionObserver=function(){n||(y("SingleFile is hooking the IntersectionObserver API to detect and load deferred images."),n=!0);const e=new t(...arguments),i=t.prototype.observe||e.observe,o=t.prototype.unobserve||e.unobserve,r=arguments[0],l=arguments[1];return i&&(e.observe=function(t){let n=p.get(e);return n||(n=[],p.set(e,n)),n.push(t),i.call(e,t)}),o&&(e.unobserve=function(t){let n=p.get(e);return n&&(n=n.filter((e=>e!=t)),n.length?p.set(e,n):(p.delete(e),h.delete(e))),o.call(e,t)}),h.set(e,{callback:r,options:l}),e},e.IntersectionObserver.prototype=t.prototype,e.IntersectionObserver.toString=function(){return"function IntersectionObserver() { [native code] }"}}async function P(e,t,n){const i={};return i["font-family"]=e,i.src=t,n&&Object.keys(n).forEach((e=>{r[e]&&(i[r[e]]=n[e])})),new Promise((e=>{if(i.src instanceof ArrayBuffer){const t=new m;t.readAsDataURL(new u([i.src])),t.addEventListener("load",(()=>{i.src="url("+t.result+")",e(i)}))}else e(i)}))}function b(){try{s(new f("resize")),F&&s(new f("scroll"))}catch(e){}}})("object"==typeof globalThis?globalThis:window)}();
@@ -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 c=t.browser;async function s(){const t=document.evaluate("//comment()",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null);let s=t&&t.singleNodeValue;if(s&&((p=s).nodeType==Node.COMMENT_NODE&&p.textContent.includes(i))){const t=s.textContent.split("\n"),[,,i,p,...g]=t;if(i&&p){let t;t=c&&c.runtime&&c.runtime.sendMessage?await c.runtime.sendMessage({method:"tabs.getOptions",url:i}):{displayInfobar:!0},t.displayInfobar&&await async function(t,i,c){let s=document.querySelector(n);if(!s){if(t=t.split("url: ")[1],i=i.split("saved date: ")[1],c&&c.length>1){let t=c[0].split("info: ")[1].trim();for(let n=1;n<c.length-1;n++)t+="\n"+c[n].trim();c=t.trim()}else c=i;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 u=document.createElement("div");u.classList.add("infobar"),p.appendChild(u);const h=document.createElement("img");h.classList.add("infobar-close-button"),u.appendChild(h),h.src=o,h.onclick=t=>{0===t.button&&s.remove()};const m=document.createElement("span");u.appendChild(m),m.classList.add("infobar-content"),m.textContent=c;const b=document.createElement("a");b.classList.add("infobar-link"),u.appendChild(b),b.target="_blank",b.rel="noopener noreferrer",b.title="Open source URL: "+t,b.href=t;const f=document.createElement("img");f.classList.add("infobar-link-icon"),b.appendChild(f),f.src=e,l(u),document.addEventListener("click",(t=>{if(0===t.button){let n=t.target;for(;n&&n!=s;)n=n.parentElement;n!=s&&l(u)}}))}}(i,p,g)}}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",s,!1):s())})("object"==typeof globalThis?globalThis:window)}();
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 c=t.browser;async function s(){const t=document.evaluate("//comment()",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null);let s=t&&t.singleNodeValue;if(s&&((p=s).nodeType==Node.COMMENT_NODE&&p.textContent.includes(i))){const t=s.textContent.split("\n"),[,,i,p,...g]=t,h=i.match(/^ url: (.*) $/),u=h&&h[1];if(u&&p){let t;if(c&&c.runtime&&c.runtime.sendMessage)try{t=await c.runtime.sendMessage({method:"tabs.getOptions",url:u})}catch(n){t={displayInfobar:!0}}else t={displayInfobar:!0};t.displayInfobar&&await async function(t,i,c){let s=document.querySelector(n);if(!s){if(i=i.split("saved date: ")[1],c&&c.length>1){let t=c[0].split("info: ")[1].trim();for(let n=1;n<c.length-1;n++)t+="\n"+c[n].trim();c=t.trim()}else c=i;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 b=document.createElement("a");b.classList.add("infobar-link"),h.appendChild(b),b.target="_blank",b.rel="noopener noreferrer",b.title="Open source URL: "+t,b.href=t;const f=document.createElement("img");f.classList.add("infobar-link-icon"),b.appendChild(f),f.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)}}))}}(u,p,g)}}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",s,!1):s())})("object"==typeof globalThis?globalThis:window)}();