1(()=>{"use strict";({"./src/js/webWorker.ts"(){var e=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,s){function i(e){try{a(n.next(e))}catch(e){s(e)}}function c(e){try{a(n.throw(e))}catch(e){s(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,c)}a((n=n.apply(e,t||[])).next())})};const t="template";function r(){return new Promise((e,r)=>{const n=indexedDB.open("dom-template",1);n.onerror=()=>{var e,t;return r(new Error(null!==(t=null===(e=n.error)||void 0===e?void 0:e.message)&&void 0!==t?t:"IndexedDB open error"))},n.onsuccess=()=>e(n.result),n.onupgradeneeded=()=>{const e=n.result;e.objectStoreNames.contains(t)||e.createObjectStore(t,{keyPath:"key"})}})}function n(n,o){return e(this,void 0,void 0,function*(){try{const e=yield r();return yield new Promise((r,i)=>{const c=e.transaction(t,"readonly").objectStore(t).get(n);c.onsuccess=()=>{const e=c.result;return e?o&&e.responseHash!==o?r(null):"number"==typeof(t=e.expiryTimestamp)&&Date.now()>t?(s(n).catch(()=>{}),r(null)):void r(e):r(null);var t},c.onerror=()=>{var e,t;return i(new Error(null!==(t=null===(e=c.error)||void 0===e?void 0:e.message)&&void 0!==t?t:"IndexedDB request error"))}})}catch(e){return null}})}function o(n,o){return e(this,void 0,void 0,function*(){const e=yield r();return new Promise((r,s)=>{const i=e.transaction(t,"readwrite");i.objectStore(t).put(Object.assign({key:n},o)),i.oncomplete=()=>r(),i.onerror=()=>{var e,t;return s(new Error(null!==(t=null===(e=i.error)||void 0===e?void 0:e.message)&&void 0!==t?t:"IndexedDB transaction error"))}})})}function s(n){return e(this,void 0,void 0,function*(){const e=yield r();return new Promise((r,o)=>{const s=e.transaction(t,"readwrite");s.objectStore(t).delete(n),s.oncomplete=()=>r(),s.onerror=()=>{var e,t;return o(new Error(null!==(t=null===(e=s.error)||void 0===e?void 0:e.message)&&void 0!==t?t:"IndexedDB transaction error"))}})})}self.onmessage=function(t){return e(this,void 0,void 0,function*(){try{const{type:r,payload:i}=t.data;switch(r){case"LOOKUP":{const{key:e,hashedValue:t}=i,r=yield n(e,t);self.postMessage(Object.assign({type:"LOOKUP_RESULT"},r));break}case"INSERT":{const{key:e,value:t}=i;try{yield o(e,t),self.postMessage({type:"INSERT_RESULT",success:!0})}catch(e){self.postMessage({type:"INSERT_RESULT",success:!1,error:String(e)})}break}case"DELETE":{const{key:e}=i;try{yield s(e),self.postMessage({type:"DELETE_RESULT",success:!0})}catch(e){self.postMessage({type:"DELETE_RESULT",success:!1,error:String(e)})}break}case"CHECK_INCOGNITO":{const t=yield function(){return e(this,void 0,void 0,function*(){try{const e=indexedDB.open("incognito-test");return yield new Promise(t=>{e.onerror=()=>t(!0),e.onsuccess=()=>{e.result.close(),indexedDB.deleteDatabase("incognito-test"),t(!1)}})}catch(e){return!0}})}();self.postMessage({type:"CHECK_INCOGNITO_RESULT",incognito:t});break}case"BACKGROUND_API_CALL":{const{endpoint:t,querySelector:r}=i;try{const s=function(e,t){let r=e.replace(/[^\w]/g,"_");return t&&(r+="__"+t.replace(/[^\w]/g,"_")),r}(t,r),i=yield fetch(t).then(e=>{if(!e.ok)throw new Error("Network error: "+e.status);return e.json()}),c=yield function(t){return e(this,void 0,void 0,function*(){try{const e=JSON.stringify(t),r=(new TextEncoder).encode(e),n=new Uint8Array(r.length);n.set(r);const o=yield crypto.subtle.digest("SHA-256",n.buffer);return Array.from(new Uint8Array(o)).map(e=>e.toString(16).padStart(2,"0")).join("")}catch(e){return""}})}(i),a=yield n(s,c);if(a&&a.responseHash===c)return void self.postMessage({type:"BACKGROUND_API_CALL_RESULT",updated:!1});const u=yield function(t){return e(this,void 0,void 0,function*(){try{let e=`<div>${JSON.stringify(t)}</div>`;if(t.images&&Array.isArray(t.images))for(const r of t.images)try{const t=yield fetch(r).then(e=>{if(!e.ok)throw new Error("Image fetch failed");return e.blob()});e+=`<img src="${URL.createObjectURL(t)}" alt="Image" />`}catch(t){e+='<img alt="Image unavailable" />'}return e}catch(e){return"<div>Error generating template</div>"}})}(i),d=Date.now()+864e5;yield o(s,{responseHash:c,generatedTemplate:u,expiryTimestamp:d}),self.postMessage({type:"BACKGROUND_API_CALL_RESULT",updated:!0})}catch(e){self.postMessage({type:"BACKGROUND_API_CALL_RESULT",updated:!1,error:String(e)})}break}
1default:self.postMessage({type:"ERROR",error:"Unknown message type"})}}catch(e){self.postMessage({type:"ERROR",error:String(e)})}})}}})["./src/js/webWorker.ts"].call({})})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.