diff --git a/build/_locales/ca/messages.json b/build/_locales/ca/messages.json index cb41858..a1f3771 100644 --- a/build/_locales/ca/messages.json +++ b/build/_locales/ca/messages.json @@ -900,5 +900,10 @@ "recoveryModeTitle": { "message": "Mode de recuperació", "description": "Títol del mode de recuperació" + }, + + "downloadForTroubleshootingOption": { + "message": "Descarregar dades per solucionar problemes", + "description": "Opció de descàrrega per solucionar problemes" } } diff --git a/build/_locales/de/messages.json b/build/_locales/de/messages.json index 4134acf..bf3e57f 100644 --- a/build/_locales/de/messages.json +++ b/build/_locales/de/messages.json @@ -899,5 +899,10 @@ "recoveryModeTitle": { "message": "Wiederherstellungsmodus", "description": "Titel des Wiederherstellungsmodus" + }, + + "downloadForTroubleshootingOption": { + "message": "Daten zum Beheben von Problemen herunterladen", + "description": "Option zum Herunterladen zur Fehlerbehebung" } } diff --git a/build/_locales/en/messages.json b/build/_locales/en/messages.json index 3cf9132..72b9a86 100644 --- a/build/_locales/en/messages.json +++ b/build/_locales/en/messages.json @@ -898,5 +898,9 @@ "recoveryModeTitle": { "message": "Recovery mode", "description": "Recovery mode title" + }, + "downloadForTroubleshootingOption": { + "message": "Download data for troubleshooting", + "description": "Download for troubleshooting option" } } diff --git a/build/_locales/es/messages.json b/build/_locales/es/messages.json index 67b3f96..4102f15 100644 --- a/build/_locales/es/messages.json +++ b/build/_locales/es/messages.json @@ -900,5 +900,9 @@ "recoveryModeTitle": { "message": "Modo de recuperación", "description": "Título del modo de recuperación" + }, + "downloadForTroubleshootingOption": { + "message": "Descargar datos para solucionar problemas", + "description": "Opción de descarga para solución de problemas" } } diff --git a/build/_locales/fr/messages.json b/build/_locales/fr/messages.json index 9d11a3d..02b9db7 100644 --- a/build/_locales/fr/messages.json +++ b/build/_locales/fr/messages.json @@ -900,5 +900,10 @@ "recoveryModeTitle": { "message": "Mode de récupération", "description": "Titre du mode de récupération" + }, + + "downloadForTroubleshootingOption": { + "message": "Télécharger des données pour résoudre les problèmes", + "description": "Option de téléchargement pour résoudre les problèmes" } } diff --git a/build/_locales/hi/messages.json b/build/_locales/hi/messages.json index 0c899ce..11fac77 100644 --- a/build/_locales/hi/messages.json +++ b/build/_locales/hi/messages.json @@ -900,5 +900,10 @@ "recoveryModeTitle": { "message": "पुनर्प्राप्ति मोड", "description": "पुनर्प्राप्ति मोड का शीर्षक" + }, + + "downloadForTroubleshootingOption": { + "message": "समस्या समाधान के लिए डेटा डाउनलोड करें", + "description": "समस्या समाधान के लिए डाउनलोड करने का विकल्प" } } diff --git a/build/_locales/id/messages.json b/build/_locales/id/messages.json index 17db3f8..d565ea3 100644 --- a/build/_locales/id/messages.json +++ b/build/_locales/id/messages.json @@ -900,5 +900,10 @@ "recoveryModeTitle": { "message": "Mode Pemulihan", "description": "Judul Mode Pemulihan" + }, + + "downloadForTroubleshootingOption": { + "message": "Unduh data untuk perbaikan masalah", + "description": "Pilihan unduhan untuk perbaikan masalah" } } diff --git a/build/_locales/it/messages.json b/build/_locales/it/messages.json index 6354fd0..1169056 100644 --- a/build/_locales/it/messages.json +++ b/build/_locales/it/messages.json @@ -885,5 +885,10 @@ "recoveryModeTitle": { "message": "Modalità di recupero", "description": "Titolo della modalità di recupero" + }, + + "downloadForTroubleshootingOption": { + "message": "Scarica dati per risolvere problemi", + "description": "Opzione di scaricamento per risolvere problemi" } } diff --git a/build/_locales/ko/messages.json b/build/_locales/ko/messages.json index f0bf69f..34aeac6 100644 --- a/build/_locales/ko/messages.json +++ b/build/_locales/ko/messages.json @@ -899,5 +899,10 @@ "recoveryModeTitle": { "message": "복구 모드", "description": "복구 모드 제목" + }, + + "downloadForTroubleshootingOption": { + "message": "문제 해결을 위한 데이터 다운로드", + "description": "문제 해결을 위한 다운로드 옵션" } } diff --git a/build/_locales/pl/messages.json b/build/_locales/pl/messages.json index 19c7157..9f04e42 100644 --- a/build/_locales/pl/messages.json +++ b/build/_locales/pl/messages.json @@ -899,5 +899,10 @@ "recoveryModeTitle": { "message": "Tryb odzyskiwania", "description": "Tytuł trybu odzyskiwania" + }, + + "downloadForTroubleshootingOption": { + "message": "Pobierz dane do rozwiązywania problemów", + "description": "Opcja pobierania do rozwiązywania problemów" } } diff --git a/build/_locales/pt_BR/messages.json b/build/_locales/pt_BR/messages.json index 2fe17e2..4d7ffb9 100644 --- a/build/_locales/pt_BR/messages.json +++ b/build/_locales/pt_BR/messages.json @@ -899,5 +899,10 @@ "recoveryModeTitle": { "message": "Modo de recuperação", "description": "Título do modo de recuperação" + }, + + "downloadForTroubleshootingOption": { + "message": "Baixar dados para solucionar problemas", + "description": "Opção de download para solucionar problemas" } } diff --git a/build/_locales/pt_PT/messages.json b/build/_locales/pt_PT/messages.json index 127d483..a934992 100644 --- a/build/_locales/pt_PT/messages.json +++ b/build/_locales/pt_PT/messages.json @@ -900,5 +900,10 @@ "recoveryModeTitle": { "message": "Modo de recuperação", "description": "Título do modo de recuperação" + }, + + "downloadForTroubleshootingOption": { + "message": "Descarregar dados para solucionar problemas", + "description": "Opção de descarregamento para solucionar problemas" } } diff --git a/build/_locales/ru/messages.json b/build/_locales/ru/messages.json index 458bd00..8f67c00 100644 --- a/build/_locales/ru/messages.json +++ b/build/_locales/ru/messages.json @@ -900,5 +900,10 @@ "recoveryModeTitle": { "message": "Режим восстановления", "description": "Заголовок режима восстановления" + }, + + "downloadForTroubleshootingOption": { + "message": "Скачать данные для устранения проблем", + "description": "Опция скачивания для устранения проблем" } } diff --git a/build/_locales/ta/messages.json b/build/_locales/ta/messages.json index eb753ec..76dde03 100644 --- a/build/_locales/ta/messages.json +++ b/build/_locales/ta/messages.json @@ -899,5 +899,10 @@ "recoveryModeTitle": { "message": "மீட்டமைப்பு முறை", "description": "மீட்டமைப்பு முறை தலைப்பு" + }, + + "downloadForTroubleshootingOption": { + "message": "பிரச்சனைகளை தீர்க்க தரவை பதிவிறக்கவும்", + "description": "பிரச்சனைகளை தீர்க்க விருப்ப பதிவிறக்க விருப்பம்" } } diff --git a/build/_locales/tr/messages.json b/build/_locales/tr/messages.json index b18d2aa..c65417e 100644 --- a/build/_locales/tr/messages.json +++ b/build/_locales/tr/messages.json @@ -899,5 +899,10 @@ "recoveryModeTitle": { "message": "Kurtarma Modu", "description": "Kurtarma Modu Başlığı" + }, + + "downloadForTroubleshootingOption": { + "message": "Sorunları Gidermek için Verileri İndir", + "description": "Sorunları Giderme Seçeneği" } } diff --git a/build/_locales/uk/messages.json b/build/_locales/uk/messages.json index 1130d00..9ca95a3 100644 --- a/build/_locales/uk/messages.json +++ b/build/_locales/uk/messages.json @@ -899,5 +899,10 @@ "recoveryModeTitle": { "message": "Режим відновлення", "description": "Заголовок режиму відновлення" + }, + + "downloadForTroubleshootingOption": { + "message": "Завантажити дані для усунення проблем", + "description": "Опція завантаження для усунення проблем" } } diff --git a/build/_locales/zh_CN/messages.json b/build/_locales/zh_CN/messages.json index ed471d8..61848b6 100644 --- a/build/_locales/zh_CN/messages.json +++ b/build/_locales/zh_CN/messages.json @@ -895,5 +895,10 @@ "recoveryModeTitle": { "message": "恢复模式", "description": "恢复模式标题" + }, + + "downloadForTroubleshootingOption": { + "message": "下载故障排除数据", + "description": "故障排除选项" } } diff --git a/build/_locales/zh_TW/messages.json b/build/_locales/zh_TW/messages.json index 71fb1c1..a5a61b6 100644 --- a/build/_locales/zh_TW/messages.json +++ b/build/_locales/zh_TW/messages.json @@ -900,5 +900,10 @@ "recoveryModeTitle": { "message": "復原模式", "description": "復原模式標題" + }, + + "downloadForTroubleshootingOption": { + "message": "下載故障排除資料", + "description": "故障排除選項" } } diff --git a/build/background.bundle.js b/build/background.bundle.js index c432488..2898a2c 100644 --- a/build/background.bundle.js +++ b/build/background.bundle.js @@ -5,4 +5,4 @@ https://localforage.github.io/localForage (c) 2013-2017 Mozilla, Apache License 2.0 */ -e.exports=function e(t,r,n){function o(i,c){if(!r[i]){if(!t[i]){if(a)return a(i,!0);var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var u=r[i]={exports:{}};t[i][0].call(u.exports,(function(e){var r=t[i][1][e];return o(r||e)}),u,u.exports,e,t,r,n)}return r[i].exports}for(var a=void 0,i=0;i=43)}})).catch((function(){return!1}))}function k(e){return"boolean"==typeof m?u.resolve(m):x(e).then((function(e){return m=e}))}function E(e){var t=g[e.name],r={};r.promise=new u((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function _(e){var t=g[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function S(e,t){var r=g[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function I(e,t){return new u((function(r,n){if(g[e.name]=g[e.name]||R(),e.db){if(!t)return r(e.db);E(e),e.db.close()}var o=[e.name];t&&o.push(e.version);var a=i.open.apply(i,o);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(p)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){var t=a.result;t.onversionchange=function(e){e.target.close()},r(t),_(e)}}))}function T(e){return I(e,!1)}function N(e){return I(e,!0)}function D(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.versione.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||r){if(r){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function j(e){return new u((function(t,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},n.readAsBinaryString(e)}))}function L(e){return s([w(atob(e.data))],{type:e.type})}function C(e){return e&&e.__local_forage_encoded_blob}function O(e){var t=this,r=t._initReady().then((function(){var e=g[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return f(r,e,e),r}function A(e){E(e);for(var t=g[e.name],r=t.forages,n=0;n0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return u.resolve().then((function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),N(e)})).then((function(){return A(e).then((function(){M(e,t,r,n-1)}))})).catch(r);r(o)}}function R(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function B(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var o=g[r.name];o||(o=R(),g[r.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=O);var a=[];function i(){return u.resolve()}for(var c=0;c>4,l[s++]=(15&n)<<4|o>>2,l[s++]=(3&o)<<6|63&a;return u}function pe(e){var t,r=new Uint8Array(e),n="";for(t=0;t>2],n+=V[(3&r[t])<<4|r[t+1]>>4],n+=V[(15&r[t+1])<<2|r[t+2]>>6],n+=V[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}function me(e,t){var r="";if(e&&(r=he.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===he.call(e.buffer))){var n,o=X;e instanceof ArrayBuffer?(n=e,o+=ee):(n=e.buffer,"[object Int8Array]"===r?o+=re:"[object Uint8Array]"===r?o+=ne:"[object Uint8ClampedArray]"===r?o+=oe:"[object Int16Array]"===r?o+=ae:"[object Uint16Array]"===r?o+=ce:"[object Int32Array]"===r?o+=ie:"[object Uint32Array]"===r?o+=se:"[object Float32Array]"===r?o+=ue:"[object Float64Array]"===r?o+=le:t(new Error("Failed to get type for BinaryArray"))),t(o+pe(n))}else if("[object Blob]"===r){var a=new FileReader;a.onload=function(){var r=Y+e.type+"~"+pe(this.result);t(X+te+r)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}}function ge(e){if(e.substring(0,Z)!==X)return JSON.parse(e);var t,r=e.substring(fe),n=e.substring(Z,fe);if(n===te&&H.test(r)){var o=r.match(H);t=o[1],r=r.substring(o[0].length)}var a=de(r);switch(n){case ee:return a;case te:return s([a],{type:t});case re:return new Int8Array(a);case ne:return new Uint8Array(a);case oe:return new Uint8ClampedArray(a);case ae:return new Int16Array(a);case ce:return new Uint16Array(a);case ie:return new Int32Array(a);case se:return new Uint32Array(a);case ue:return new Float32Array(a);case le:return new Float64Array(a);default:throw new Error("Unkown type: "+n)}}var ve={serialize:me,deserialize:ge,stringToBuffer:de,bufferToString:pe};function ye(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function be(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var o=new u((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(o){ye(o,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=ve,o}function we(e,t,r,n,o,a){e.executeSql(r,n,o,(function(e,i){i.code===i.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,c){c.rows.length?a(e,i):ye(e,t,(function(){e.executeSql(r,n,o,a)}),a)}),a):a(e,i)}),a)}function xe(e,t){var r=this;e=h(e);var n=new u((function(t,n){r.ready().then((function(){var o=r._dbInfo;o.db.transaction((function(r){we(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function ke(e,t){var r=this,n=new u((function(t,n){r.ready().then((function(){var o=r._dbInfo;o.db.transaction((function(r){we(r,o,"SELECT * FROM "+o.storeName,[],(function(r,n){for(var a=n.rows,i=a.length,c=0;c0)return void a(Ee.apply(o,[e,c,r,n-1]));i(t)}}))}))})).catch(i)}));return l(a,r),a}function _e(e,t,r){return Ee.apply(this,[e,t,r,1])}function Se(e,t){var r=this;e=h(e);var n=new u((function(t,n){r.ready().then((function(){var o=r._dbInfo;o.db.transaction((function(r){we(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function Ie(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"DELETE FROM "+n.storeName,[],(function(){e()}),(function(e,t){r(t)}))}))})).catch(r)}));return l(r,e),r}function Te(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(t,r){var n=r.rows.item(0).c;e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return l(r,e),r}function Ne(e,t){var r=this,n=new u((function(t,n){r.ready().then((function(){var o=r._dbInfo;o.db.transaction((function(r){we(r,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function De(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"SELECT key FROM "+n.storeName,[],(function(t,r){for(var n=[],o=0;o '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var o=[],a=0;a0}function Be(e){var t=this,r={};if(e)for(var n in e)r[n]=e[n];return r.keyPrefix=Ae(e,t._defaultConfig),Re()?(t._dbInfo=r,r.serializer=ve,u.resolve()):u.reject()}function Pe(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return l(r,e),r}function Fe(e,t){var r=this;e=h(e);var n=r.ready().then((function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n}));return l(n,t),n}function Ue(e,t){var r=this,n=r.ready().then((function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,a=localStorage.length,i=1,c=0;c=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}})):u.reject("Invalid arguments"),l(n,t),n}var We={_driver:"localStorageWrapper",_initStorage:Be,_support:Oe(),iterate:Ue,getItem:Fe,setItem:ze,removeItem:Je,clear:Pe,length:Ge,key:$e,keys:qe,dropInstance:Ke},Qe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ve=function(e,t){for(var r=e.length,n=0;n{"use strict";var n=r(5877);e.exports={generate:function(){var e=n.v1();return e.substr(14,4)+e.substr(9,4)+e.substr(0,8)+e.substr(19,4)+e.substr(24,e.length)},toBinary16:function(e){return new Buffer(e,"hex")},fromBinary16:function(e){return e.toString("hex")}}},5877:(e,t,r)=>{var n=r(3570),o=r(1171),a=o;a.v1=n,a.v4=o,e.exports=a},5327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},5217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},3570:(e,t,r)=>{var n,o,a=r(5217),i=r(5327),c=0,s=0;e.exports=function(e,t,r){var u=t&&r||0,l=t||[],f=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:o;if(null==f||null==h){var d=a();null==f&&(f=n=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==h&&(h=o=16383&(d[6]<<8|d[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),m=void 0!==e.nsecs?e.nsecs:s+1,g=p-c+(m-s)/1e4;if(g<0&&void 0===e.clockseq&&(h=h+1&16383),(g<0||p>c)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=p,s=m,o=h;var v=(1e4*(268435455&(p+=122192928e5))+m)%4294967296;l[u++]=v>>>24&255,l[u++]=v>>>16&255,l[u++]=v>>>8&255,l[u++]=255&v;var y=p/4294967296*1e4&268435455;l[u++]=y>>>8&255,l[u++]=255&y,l[u++]=y>>>24&15|16,l[u++]=y>>>16&255,l[u++]=h>>>8|128,l[u++]=255&h;for(var b=0;b<6;++b)l[u+b]=f[b];return t||i(l)}},1171:(e,t,r)=>{var n=r(5217),o=r(5327);e.exports=function(e,t,r){var a=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||n)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var c=0;c<16;++c)t[a+c]=i[c];return t||o(i)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return n};var r,n={},o=Object.prototype,a=o.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(r){f=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new C(n||[]);return i(a,"_invoke",{value:N(e,r,c)}),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}n.wrap=h;var p="suspendedStart",m="suspendedYield",g="executing",v="completed",y={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var E=Object.getPrototypeOf,_=E&&E(E(O([])));_&&_!==o&&a.call(_,s)&&(k=_);var S=x.prototype=b.prototype=Object.create(k);function I(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function T(t,r){function n(o,i,c,s){var u=d(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==e(f)&&a.call(f,"__await")?r.resolve(f.__await).then((function(e){n("next",e,c,s)}),(function(e){n("throw",e,c,s)})):r.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return n("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,t){function a(){return new r((function(r,o){n(e,t,r,o)}))}return o=o?o.then(a,a):a()}})}function N(e,t,n){var o=p;return function(a,i){if(o===g)throw new Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:r,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=D(c,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=g;var u=d(e,t,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function D(e,t){var n=t.method,o=e.iterator[n];if(o===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=r,D(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=d(o,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,y;var i=a.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,y):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function O(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function e(){for(;++o=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),y}},n}function n(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}const o=function(){var e,r=(e=t().mark((function e(){var r;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,chrome.identity.getAuthToken({interactive:!0});case 3:if(r=e.sent){e.next=6;break}throw new Error("User cancelled sign-in or failed to get token");case 6:return e.next=8,new Promise((function(e){return chrome.storage.local.set({token:r.token},(function(){return e()}))}));case 8:return e.next=10,chrome.identity.getProfileUserInfo();case 10:return e.sent,e.abrupt("return",r.token);case 14:return e.prev=14,e.t0=e.catch(0),console.error("Error signing in:",e.t0.message),e.abrupt("return",null);case 19:case"end":return e.stop()}}),e,null,[[0,14]])})),function(){var t=this,r=arguments;return new Promise((function(o,a){var i=e.apply(t,r);function c(e){n(i,o,a,c,s,"next",e)}function s(e){n(i,o,a,c,s,"throw",e)}c(void 0)}))});return function(){return r.apply(this,arguments)}}();function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */i=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var a=t&&t.prototype instanceof b?t:b,i=Object.create(a.prototype),c=new C(n||[]);return o(i,"_invoke",{value:N(e,r,c)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var p="suspendedStart",m="suspendedYield",g="executing",v="completed",y={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var E=Object.getPrototypeOf,_=E&&E(E(O([])));_&&_!==r&&n.call(_,s)&&(k=_);var S=x.prototype=b.prototype=Object.create(k);function I(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(o,i,c,s){var u=d(e[o],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==a(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function N(t,r,n){var o=p;return function(a,i){if(o===g)throw new Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=D(c,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=g;var u=d(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function D(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,D(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=d(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function O(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:O(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}function c(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){c(a,n,o,i,s,"next",e)}function s(e){c(a,n,o,i,s,"throw",e)}i(void 0)}))}}const u=function(){var e=s(i().mark((function e(t,r,n){var a,c;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=function(){return c=s(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,t){chrome.storage.local.get(["token"],function(){var r=s(i().mark((function r(n){var a,c,s,u;return i().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!chrome.runtime.lastError){r.next=4;break}t(new Error(chrome.runtime.lastError)),r.next=24;break;case 4:if((a=n.token)&&null!==a){r.next=13;break}return r.next=8,o();case 8:(c=r.sent)&&null!==c||t(new Error("Sign-in failed")),e(c),r.next=24;break;case 13:r.prev=13,s=JSON.parse(atob(a.split(".")[1])),r.next=21;break;case 17:return r.prev=17,r.t0=r.catch(13),chrome.identity.getAuthToken({interactive:!0},(function(r){chrome.runtime.lastError?t(new Error(chrome.runtime.lastError)):e(r)})),r.abrupt("return");case 21:u=1e3*s.exp,Date.now()>=u?chrome.identity.getAuthToken({interactive:!0},(function(r){chrome.runtime.lastError?t(new Error(chrome.runtime.lastError)):e(r)})):e(a);case 24:case"end":return r.stop()}}),r,null,[[13,17]])})));return function(e){return r.apply(this,arguments)}}())})));case 1:case"end":return e.stop()}}),e)}))),c.apply(this,arguments)},a=function(){return c.apply(this,arguments)},e.abrupt("return",new Promise(function(){var e=s(i().mark((function e(o,c){var s,u,l,f,h,d,p,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,a();case 3:if((s=e.sent)&&null!==s){e.next=6;break}throw new Error("Sign-in failed");case 6:return u=new Headers({Authorization:"Bearer ".concat(s),"Content-Type":t.type}),e.next=9,fetch("https://www.googleapis.com/upload/drive/v3/files?uploadType=media",{method:"POST",headers:u,body:t});case 9:if((l=e.sent).ok){e.next=12;break}throw new Error("Error uploading to Google Drive: ".concat(l.status));case 12:return e.next=14,l.json();case 14:if(f=e.sent,h=f.id){e.next=18;break}throw new Error("File ID is undefined");case 18:return d={name:r},e.next=21,fetch("https://www.googleapis.com/drive/v3/files/".concat(h),{method:"PATCH",headers:new Headers({Authorization:"Bearer ".concat(s),"Content-Type":"application/json; charset=UTF-8"}),body:JSON.stringify(d)});case 21:if((p=e.sent).ok){e.next=28;break}return e.next=25,p.json();case 25:throw m=e.sent,console.error("Error updating file metadata:",p.status,m.error.message),new Error("Error updating file metadata: ".concat(p.status));case 28:n({status:"ok",url:h}),chrome.tabs.create({url:"https://drive.google.com/file/d/".concat(h,"/view")}),o("https://drive.google.com/file/d/".concat(h,"/view")),e.next=38;break;case 33:e.prev=33,e.t0=e.catch(0),console.error("Error uploading to Google Drive:",e.t0.message),n({status:"ew",url:null}),c(e.t0);case 38:case"end":return e.stop()}}),e,null,[[0,33]])})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}();var l=r(9483),f=r.n(l);function h(e){if(e){if("string"!=typeof e)return this.userErrors.push("Collection name in collection() method must be a string and not an object, number or boolean."),this;{this.collectionName=e;let t=this.dbName;return e in this.lf||(this.lf[e]=f().createInstance({driver:f().INDEXEDDB,name:t,storeName:e})),this}}return this.userErrors.push("No collection name specified in collection() method."),this}function d(e){return e?"string"!=typeof e&&"object"!=typeof e?this.userErrors.push("Document criteria specified in doc() method must not be a number or boolean. Use a string (with a key) or an object (with criteria) e.g. { id: 1 }"):this.docSelectionCriteria=e:this.userErrors.push("No document criteria specified in doc() method. Use a string (with a key) or an object (with criteria) e.g. { id: 1 }"),this}function p(e,t){return e?"string"!=typeof e?this.userErrors.push("First parameter in orderBy() method must be a string (a field name) e.g. 'name'"):this.orderByProperty=e:this.userErrors.push("No field name specified in orderBy() method. Use a string e.g. 'name'"),t&&("asc"!==t&&"desc"!==t?this.userErrors.push("Second parameter in orderBy() method must be a string set to 'asc' or 'desc'."):this.orderByDirection=t),this}function m(e){return e?Number.isInteger(e)?this.limitBy=e:this.userErrors.push("Limit parameter in limit() method must be an integer (e.g. 3) and not a float, boolean, string or object."):this.userErrors.push("No integer specified in limit() method."),this}function g(e,t){return Object.keys(t).every((r=>"object"==typeof t[r]?g(e[r],t[r]):t[r]===e[r]))}const v={baseStyle:"\n padding: 2px 5px;\n background-color: #124F5C;\n border-radius: 4px;\n color: white; \n ",colors:{log:"#124F5C",error:"#ed2939",warn:"#f39c12"},log(e,t){0},error(e,t){0},warn(e,t){0}};function y(){this.collectionName=null,this.orderByProperty=null,this.orderByDirection=null,this.limitBy=null,this.docSelectionCriteria=null,this.userErrors=[]}function b(){let e;return this.collectionName||this.docSelectionCriteria?this.collectionName&&!this.docSelectionCriteria?e="collection":this.collectionName&&this.docSelectionCriteria&&(e="doc"):e="db",e}function w(){for(let e=0;e{let t=this.collectionName,r=this.orderByProperty,n=this.orderByDirection,o=this.limitBy,a=[];return this.lf[t].iterate(((t,r)=>{let n={};n=e.keys?{key:r,data:t}:t,a.push(n)})).then((()=>{let i=`Got "${t}" collection`;return r&&(i+=`, ordered by "${r}"`,e.keys?a.sort(((e,t)=>e.data[r].toString().localeCompare(t.data[r].toString()))):a.sort(((e,t)=>e[r].toString().localeCompare(t[r].toString())))),"desc"==n&&(i+=" (descending)",a.reverse()),o&&(i+=`, limited to ${o}`,a=a.splice(0,o)),i+=":",v.log.call(this,i,a),y.call(this),a}))},this.getDocument=()=>{let e=this.collectionName,t=this.docSelectionCriteria,r=[],n={};return this.getDocumentByCriteria=()=>this.lf[e].iterate(((e,n)=>{g(e,t)&&r.push(e)})).then((()=>{if(r.length)return n=r[0],v.log.call(this,`Got Document with ${JSON.stringify(t)}:`,n),y.call(this),n;v.error.call(this,`Could not find Document in "${e}" collection with criteria: ${JSON.stringify(t)}`)})),this.getDocumentByKey=()=>this.lf[e].getItem(t).then((r=>(n=r,n?v.log.call(this,`Got Document with key ${JSON.stringify(t)}:`,n):v.error.call(this,`Could not find Document in "${e}" collection with Key: ${JSON.stringify(t)}`),y.call(this),n))).catch((r=>{v.error.call(this,`Could not find Document in "${e}" collection with Key: ${JSON.stringify(t)}`),y.call(this)})),"object"==typeof t?this.getDocumentByCriteria():this.getDocumentByKey()},"object"!=typeof e||e instanceof Array!=0?this.userErrors.push('Data passed to .get() must be an object. Not an array, string, number or boolean. The object must contain a "keys" property set to true or false, e.g. { keys: true }'):e.hasOwnProperty("keys")?"boolean"!=typeof e.keys&&this.userErrors.push('Property "keys" passed into get() method must be assigned a boolean value (true or false). Not a string or integer.'):this.userErrors.push('Object passed to get() method must contain a "keys" property set to boolean true or false, e.g. { keys: true }'),this.userErrors.length)return w.call(this),null;{let e=b.call(this);if("collection"==e)return this.getCollection();if("doc"==e)return this.getDocument()}}function k(e,t){return y.call(this),v.log.call(this,e,t),{success:!0,message:e,data:t}}function E(e){return y.call(this),v.error.call(this,e),`Error: ${e}`}let _=r(2024);function S(e,t){if(e?"object"==typeof e&&e instanceof Array==0||this.userErrors.push("Data passed to .add() must be an object. Not an array, string, number or boolean."):this.userErrors.push('No data specified in add() method. You must use an object, e.g { id: 1, name: "Bill", age: 47 }'),!this.userErrors.length){let r=this.collectionName;return new Promise(((n,o)=>{let a=null;return a=t||_.generate(),this.lf[r].setItem(a,e).then((()=>{n(k.call(this,`Document added to "${r}" collection.`,{key:a,data:e}))})).catch((e=>{o(E.call(this,`Could not add Document to ${r} collection.`))}))}))}w.call(this)}function I(e){for(var t=1;t{this.updateDocumentByCriteria=()=>{let a=[];this.lf[t].iterate(((t,n)=>{if(g(t,r)){let r=I(t,e);a.push({key:n,newDocument:r})}})).then((()=>{a.length||o(E.call(this,`No Documents found in ${t} Collection with criteria ${JSON.stringify(r)}.`)),a.length>1&&v.warn.call(this,`Multiple documents (${a.length}) with ${JSON.stringify(r)} found for updating.`)})).then((()=>{a.forEach(((i,c)=>{this.lf[t].setItem(i.key,i.newDocument).then((o=>{c===a.length-1&&n(k.call(this,`${a.length} Document${a.length>1?"s":""} in "${t}" collection with ${JSON.stringify(r)} updated.`,e))})).catch((e=>{o(E.call(this,`Could not update ${a.length} Documents in ${t} Collection.`))}))}))}))},this.updateDocumentByKey=()=>{let a={};this.lf[t].getItem(r).then((o=>{a=I(o,e),this.lf[t].setItem(r,a),n(k.call(this,`Document in "${t}" collection with key ${JSON.stringify(r)} updated.`,a))})).catch((e=>{o(E.call(this,`No Document found in "${t}" collection with key ${JSON.stringify(r)}`))}))},e?"object"==typeof e&&e instanceof Array==0||this.userErrors.push("Data passed to .update() must be an object. Not an array, string, number or boolean."):this.userErrors.push('No update object provided to update() method. Use an object e.g. { name: "William" }'),this.userErrors.length?w.call(this):"object"==typeof r?this.updateDocumentByCriteria():this.updateDocumentByKey()}))}function N(e,t={keys:!1}){let r=this.collectionName,n=this.docSelectionCriteria,o=b.call(this);return new Promise(((a,i)=>{if(this.setCollection=()=>{this.lf[r].clear().then((()=>{if(t.keys){console.log("keys provided");let t=0;e.forEach((e=>{e.hasOwnProperty("_key")||t++})),t?i(E.call(this,"Documents provided to .set() in an array must each have a _key property set to a string.")):(e.forEach((e=>{let t=e._key;delete e._key,this.add(e,t)})),a(k.call(this,`Collection "${r}" set with ${e.length} Documents.`,e)))}else e.forEach((e=>{this.add(e)})),a(k.call(this,`Collection "${r}" set with ${e.length} Documents.`,e))})).catch((t=>{i(E.call(this,`Could not set ${r} Collection with data ${JSON.stringify(e)}.`))}))},this.setDocument=()=>(this.setDocumentByCriteria=()=>{let t=[];this.lf[r].iterate(((r,o)=>{g(r,n)&&t.push({key:o,newDocument:e})})).then((()=>{t.length||i(E.call(this,`No Documents found in ${r} Collection with criteria ${JSON.stringify(n)}.`)),t.length>1&&v.warn.call(this,`Multiple documents (${t.length}) with ${JSON.stringify(n)} found for setting.`)})).then((()=>{t.forEach(((o,c)=>{this.lf[r].setItem(o.key,o.newDocument).then((o=>{c===t.length-1&&a(k.call(this,`${t.length} Document${t.length>1?"s":""} in "${r}" collection with ${JSON.stringify(n)} was set.`,e))})).catch((e=>{i(E.call(this,`Could not set ${t.length} Documents in ${r} Collection.`))}))}))}))},this.setDocumentByKey=()=>{this.lf[r].setItem(n,e).then((t=>{a(k.call(this,`Document in "${r}" collection with key ${JSON.stringify(n)} was set.`,e))})).catch((e=>{i(E.call(this,`Document in "${r}" collection with key ${JSON.stringify(n)} could not be set.`))}))},"object"==typeof n?this.setDocumentByCriteria():this.setDocumentByKey()),e?"doc"===o?"object"==typeof e&&e instanceof Array==0||this.userErrors.push("Data passed to .set() must be an object. Not an array, string, number or boolean."):"collection"===o&&("object"==typeof e&&e instanceof Array==1||this.userErrors.push("Data passed to .set() must be an array of objects. Not an object, string, number or boolean.")):this.userErrors.push('No new Document object provided to set() method. Use an object e.g. { id: 1, name: "Bill", age: 47 }'),this.userErrors.length)w.call(this);else{if("collection"==o)return this.setCollection();if("doc"==o)return this.setDocument()}}))}function D(){return new Promise(((e,t)=>{if(this.deleteDatabase=()=>{let t=this.dbName;indexedDB.deleteDatabase(t),e(k.call(this,`Database "${t}" deleted.`,{database:t}))},this.deleteCollection=()=>{let r=this.dbName,n=this.collectionName;this.addToDeleteCollectionQueue=e=>{this.deleteCollectionQueue.queue.push(e),this.runDeleteCollectionQueue()},this.runDeleteCollectionQueue=()=>{0==this.deleteCollectionQueue.running&&(this.deleteCollectionQueue.running=!0,this.deleteNextCollectionFromQueue())},this.deleteNextCollectionFromQueue=()=>{if(this.deleteCollectionQueue.queue.length){let n=this.deleteCollectionQueue.queue[0];this.deleteCollectionQueue.queue.shift(),this.lf[n].dropInstance({name:r,storeName:n}).then((()=>{this.deleteNextCollectionFromQueue(),e(k.call(this,`Collection "${n}" deleted.`,{collection:n}))})).catch((e=>{t(e.call(this,`Collection "${n}" could not be deleted.`))}))}else this.deleteCollectionQueue.running=!1},this.addToDeleteCollectionQueue(n)},this.deleteDocument=()=>{let r=this.collectionName,n=this.docSelectionCriteria;return this.deleteDocumentByCriteria=()=>{let o=[];this.lf[r].iterate(((e,t)=>{g(e,n)&&o.push(t)})).then((()=>{o.length||t(E.call(this,`No Documents found in "${r}" Collection with criteria ${JSON.stringify(n)}. No documents deleted.`)),o.length>1&&v.warn.call(this,`Multiple documents (${o.length}) with ${JSON.stringify(n)} found.`)})).then((()=>{o.forEach(((a,i)=>{this.lf[r].removeItem(a).then((()=>{i===o.length-1&&e(k.call(this,`${o.length} Document${o.length>1?"s":""} with ${JSON.stringify(n)} deleted.`,{keys:o}))})).catch((e=>{t(E.call(this,`Could not delete ${o.length} Documents in ${r} Collection.`))}))}))}))},this.deleteDocumentByKey=()=>{this.lf[r].getItem(n).then((o=>{o?this.lf[r].removeItem(n).then((()=>{e(k.call(this,`Document with key ${JSON.stringify(n)} deleted.`,{key:n}))})).catch((function(e){t(E.call(this,`No Document found in "${r}" Collection with key ${JSON.stringify(n)}. No document was deleted.`))})):t(E.call(this,`No Document found in "${r}" Collection with key ${JSON.stringify(n)}. No document was deleted.`))}))},"object"==typeof n?this.deleteDocumentByCriteria():this.deleteDocumentByKey()},this.userErrors.length)w.call(this);else{let e=b.call(this);if("db"==e)return this.deleteDatabase();if("collection"==e)return this.deleteCollection();if("doc"==e)return this.deleteDocument()}}))}function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function L(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=A(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw a}}}}function C(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */C=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new L(n||[]);return o(i,"_invoke",{value:I(e,r,c)}),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var h="suspendedStart",d="suspendedYield",p="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};u(w,i,(function(){return this}));var x=Object.getPrototypeOf,k=x&&x(x(O([])));k&&k!==r&&n.call(k,i)&&(w=k);var E=b.prototype=v.prototype=Object.create(w);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(o,a,i,c){var s=f(e[o],e,a);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==j(l)&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,i,c)}),(function(e){r("throw",e,i,c)})):t.resolve(l).then((function(e){u.value=e,i(u)}),(function(e){return r("throw",e,i,c)}))}c(s.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function I(t,r,n){var o=h;return function(a,i){if(o===p)throw new Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=T(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var u=f(t,r,n);if("normal"===u.type){if(o=n.done?m:d,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=m,n.method="throw",n.arg=u.arg)}}}function T(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,T(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=f(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function O(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),D(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;D(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:O(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||A(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){if(e){if("string"==typeof e)return M(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(e,t):void 0}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r3e5&&(t="editorfallback.html"),navigator.userAgent.includes("Chrome/")&&parseInt(navigator.userAgent.match(/Chrome\/([0-9]+)/)[1])<=109&&(t="editorfallback.html"),e.next=10,chrome.storage.local.get(["activeTab"]);case 10:o=e.sent,a=o.activeTab,chrome.tabs.get(a,(function(e){e&&chrome.windows.update(e.windowId,{focused:!0},(function(){chrome.tabs.update(a,{active:!0,selected:!0,highlighted:!0}),chrome.tabs.create({url:t,index:1,pinned:!0,active:!1},function(){var e=B(C().mark((function e(t){return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:chrome.windows.update(t.windowId,{focused:!0}),chrome.storage.local.set({sandboxTab:t.id}),chrome.tabs.sendMessage(a,{type:"ready-to-record"}),chrome.tabs.highlight({tabs:a});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}))}));case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),$=function(){var e=B(C().mark((function e(){var t,r;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,chrome.storage.local.get(["activeTab"]);case 2:t=e.sent,r=t.activeTab,chrome.tabs.get(r,(function(e){chrome.windows.update(e.windowId,{focused:!0},(function(){chrome.tabs.update(r,{active:!0}),chrome.tabs.sendMessage(r,{type:"ready-to-record"})}))}));case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),q=function(){var e=B(C().mark((function e(){var t,r,n,o,a,i,c;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return chrome.storage.local.set({recordingStartTime:Date.now(),restarting:!1}),e.next=3,chrome.storage.local.get(["customRegion"]);case 3:return t=e.sent,r=t.customRegion,re(r?{type:"start-recording-tab",region:!0}:{type:"start-recording-tab"}),chrome.action.setIcon({path:"assets/recording-logo.png"}),e.next=9,chrome.storage.local.get(["alarm"]);case 9:return n=e.sent,o=n.alarm,e.next=13,chrome.storage.local.get(["alarmTime"]);case 13:a=e.sent,i=a.alarmTime,o&&(c=parseFloat(i),chrome.alarms.create("recording-alarm",{delayInMinutes:c/60}));case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();chrome.commands.onCommand.addListener(function(){var e=B(C().mark((function e(t){var r,n,o;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("start-recording"!==t){e.next=7;break}return e.next=3,F();case 3:r=e.sent,!1===navigator.onLine&&!r.url.includes("/playground.html")&&!r.url.includes("/setup.html")||r.url.startsWith("chrome://")||r.url.startsWith("chrome-extension://")&&!r.url.includes("/playground.html")&&!r.url.includes("/setup.html")||r.url.includes("stackoverflow.com/")||r.url.includes("chrome.google.com/webstore")||r.url.includes("chromewebstore.google.com")?chrome.tabs.create({url:"playground.html",active:!0}).then((function(e){chrome.storage.local.set({activeTab:e.id}),chrome.tabs.onUpdated.addListener((function e(t,r,n){t===n.id&&"complete"===r.status&&(setTimeout((function(){chrome.tabs.sendMessage(n.id,{type:"start-stream"})}),500),chrome.tabs.onUpdated.removeListener(e))}))})):chrome.tabs.sendMessage(r.id,{type:"start-stream"}),e.next=19;break;case 7:if("cancel-recording"!==t){e.next=14;break}return e.next=10,F();case 10:n=e.sent,chrome.tabs.sendMessage(n.id,{type:"cancel-recording"}),e.next=19;break;case 14:if("pause-recording"!=t){e.next=19;break}return e.next=17,F();case 17:o=e.sent,chrome.tabs.sendMessage(o.id,{type:"pause-recording"});case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());var G=function(){var e=B(C().mark((function e(t){var r,n,o,a,i,c;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("recording-alarm"!==t.name){e.next=22;break}return e.next=3,chrome.storage.local.get(["recording"]);case 3:if(r=e.sent,!r.recording){e.next=21;break}return V(),e.next=9,chrome.storage.local.get(["recordingTab"]);case 9:return n=e.sent,o=n.recordingTab,chrome.tabs.sendMessage(o,{type:"stop-recording-tab"}),e.next=14,chrome.storage.local.get(["activeTab"]);case 14:return a=e.sent,i=a.activeTab,chrome.tabs.sendMessage(i,{type:"stop-recording-tab"}),e.next=19,F();case 19:c=e.sent,chrome.tabs.sendMessage(c.id,{type:"stop-recording-tab"});case 21:chrome.alarms.clear("recording-alarm");case 22:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),J=function(e){G(e)},z=function(){chrome.alarms.onAlarm.hasListener(J)||chrome.alarms.onAlarm.addListener(J)};chrome.permissions&&chrome.permissions.contains({permissions:["alarms"]},(function(e){e&&z()}));var K=function(){var e=B(C().mark((function e(t){var r,n,o,a,i,c,s,u,l,f,h,d,p,m,g,v;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,chrome.storage.local.get(["recordingStartTime"]);case 2:return r=e.sent,n=r.recordingStartTime,e.next=6,chrome.tabs.get(t.tabId);case 6:return e.sent,e.next=9,chrome.storage.local.get(["recording"]);case 9:if(o=e.sent,!o.recording){e.next=28;break}return e.next=14,chrome.storage.local.get(["tabRecordedID"]);case 14:return a=e.sent,(i=a.tabRecordedID)&&i!=t.tabId?chrome.tabs.sendMessage(t.tabId,{type:"hide-popup-recording"}):chrome.storage.local.set({activeTab:t.tabId}),e.next=19,chrome.storage.local.get(["region"]);case 19:return c=e.sent,s=c.region,e.next=23,chrome.storage.local.get(["customRegion"]);case 23:u=e.sent,l=u.customRegion,s||l||chrome.tabs.sendMessage(t.tabId,{type:"recording-check"}),e.next=29;break;case 28:chrome.tabs.sendMessage(t.tabId,{type:"recording-ended"});case 29:if(!n){e.next=47;break}return e.next=32,chrome.storage.local.get(["alarm"]);case 32:if(f=e.sent,!f.alarm){e.next=45;break}return e.next=37,chrome.storage.local.get(["alarmTime"]);case 37:h=e.sent,d=h.alarmTime,p=parseFloat(d),m=Math.floor((Date.now()-n)/1e3),g=p-m,chrome.tabs.sendMessage(t.tabId,{type:"time",time:g}),e.next=47;break;case 45:v=Math.floor((Date.now()-n)/1e3),chrome.tabs.sendMessage(t.tabId,{type:"time",time:v});case 47:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function W(e){return new Promise((function(t,r){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(e){r(e)},n.readAsDataURL(e)}))}chrome.windows.onFocusChanged.addListener(function(){var e=B(C().mark((function e(t){var r,n,o;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==chrome.windows.WINDOW_ID_NONE){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,chrome.tabs.query({active:!0,windowId:t});case 4:r=e.sent,n=O(r,1),(o=n[0])&&K({tabId:o.id});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),chrome.tabs.onActivated.addListener(function(){var e=B(C().mark((function e(t){return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:K(t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),chrome.tabs.onUpdated.addListener(function(){var e=B(C().mark((function e(t,r,n){var o,a,i,c,s,u,l,f,h,d,p,m;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("complete"!==r.status){e.next=36;break}return e.next=3,chrome.storage.local.get(["recordingStartTime"]);case 3:return o=e.sent,a=o.recordingStartTime,e.next=7,chrome.tabs.get(t);case 7:if(i=e.sent,!a){e.next=26;break}return e.next=11,chrome.storage.local.get(["alarm"]);case 11:if(c=e.sent,!c.alarm){e.next=24;break}return e.next=16,chrome.storage.local.get(["alarmTime"]);case 16:s=e.sent,u=s.alarmTime,l=parseFloat(u),f=Math.floor((Date.now()-a)/1e3),h=l-f,chrome.tabs.sendMessage(t,{type:"time",time:h}),e.next=26;break;case 24:d=Math.floor((Date.now()-a)/1e3),chrome.tabs.sendMessage(t,{type:"time",time:d});case 26:return e.next=28,chrome.storage.local.get(["recording"]);case 28:return p=e.sent,p.recording||chrome.tabs.sendMessage(i.id,{type:"recording-ended"}),e.next=33,chrome.commands.getAll();case 33:m=e.sent,chrome.tabs.sendMessage(i.id,{type:"commands",commands:m}),i.url.includes(chrome.runtime.getURL("playground.html"))&&"complete"===r.status&&chrome.tabs.sendMessage(i.id,{type:"toggle-popup"});case 36:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}());var Q=function(){var e=B(C().mark((function e(){var t,r,n,o=arguments;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]&&o[0],e.next=3,chrome.storage.local.get(["sandboxTab"]);case 3:r=e.sent,n=r.sandboxTab,P.collection("chunks").get().then(function(){var e=B(C().mark((function e(r){var o,a,i,c;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==r.length){e.next=3;break}return chrome.tabs.sendMessage(n,{type:"make-video-tab",override:t}),e.abrupt("return");case 3:10,o=r.length,a=[],i=0,3,chrome.tabs.sendMessage(n,{type:"chunk-count",count:o}),c=function(){var e=B(C().mark((function e(){var s,u,l,f,h,d,p,m,g=arguments;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=g.length>0&&void 0!==g[0]?g[0]:0,u=i,l=Math.min(i+10,o),a=[],f=u;case 5:if(!(f0&&chrome.tabs.sendMessage(n,{type:"new-chunk-tab",chunks:a},(function(e){e?(i+=10)3e5?chrome.tabs.create({url:"editorfallback.html",active:!0},(function(e){chrome.tabs.onUpdated.addListener((function t(r,n,o){r===e.id&&"complete"===n.status&&(chrome.tabs.onUpdated.removeListener(t),chrome.tabs.remove(a),chrome.storage.local.set({sandboxTab:e.id}),Q())}))})):(chrome.tabs.get(a,(function(e){chrome.windows.update(e.windowId,{focused:!0}).then((function(){chrome.tabs.update(a,{active:!0,pinned:!1}),chrome.tabs.move(a,{index:-1})}))})),Q()),chrome.action.setIcon({path:"assets/icon-34.png"}),e.next=16,chrome.storage.local.get(["wasRegion"]);case 16:i=e.sent,i.wasRegion&&chrome.storage.local.set({wasRegion:!1,region:!0}),chrome.alarms.clear("recording-alarm"),ae();case 21:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Y=function(){var e=B(C().mark((function e(){var t,r,n;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t="editor.html",e.next=3,chrome.storage.local.get(["sandboxTab"]);case 3:r=e.sent,n=r.sandboxTab,chrome.tabs.create({url:t,active:!0},(function(e){chrome.tabs.onUpdated.addListener((function t(r,o,a){r===e.id&&"complete"===o.status&&(chrome.tabs.onUpdated.removeListener(t),chrome.tabs.remove(n),chrome.storage.local.set({sandboxTab:e.id}),Q(!0))}))}));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();chrome.runtime.onStartup.addListener((function(){console.log("Starting...")})),chrome.action.onClicked.addListener(function(){var e=B(C().mark((function e(t){var r,n,o,a,i;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,chrome.storage.local.get(["recording"]);case 2:if(r=e.sent,!r.recording){e.next=14;break}return V(),re({type:"stop-recording-tab"}),e.next=9,chrome.storage.local.get(["activeTab"]);case 9:n=e.sent,o=n.activeTab,chrome.tabs.get(o,(function(e){e?chrome.tabs.sendMessage(o,{type:"stop-recording-tab"}):(chrome.tabs.sendMessage(t.id,{type:"stop-recording-tab"}),chrome.storage.local.set({activeTab:t.id}))})),e.next=15;break;case 14:!1===navigator.onLine&&!t.url.includes("/playground.html")&&!t.url.includes("/setup.html")||t.url.startsWith("chrome://")||t.url.startsWith("chrome-extension://")&&!t.url.includes("/playground.html")&&!t.url.includes("/setup.html")||t.url.includes("stackoverflow.com/")||t.url.includes("chrome.google.com/webstore")||t.url.includes("chromewebstore.google.com")?chrome.tabs.create({url:"playground.html",active:!0}).then((function(e){chrome.storage.local.set({activeTab:e.id})})):(chrome.tabs.sendMessage(t.id,{type:"toggle-popup"}),chrome.storage.local.set({activeTab:t.id}));case 15:return e.next=17,chrome.storage.local.get(["firstTime"]);case 17:if(a=e.sent,!a.firstTime||!t.url.includes(chrome.runtime.getURL("setup.html"))){e.next=25;break}return chrome.storage.local.set({firstTime:!1}),e.next=23,F();case 23:i=e.sent,chrome.tabs.sendMessage(i.id,{type:"setup-complete"});case 25:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());var H=function(){var e=B(C().mark((function e(t){return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:re({type:"next-chunk-tab"});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),X=function(){var e=B(C().mark((function e(){var t;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F();case 2:t=e.sent,chrome.tabs.sendMessage(t.id,{type:"ready-to-record"});case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Z=function(){var e=B(C().mark((function e(){var t,r,n,o,a,i,c;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,chrome.storage.local.get(["micActive","defaultAudioInput","defaultAudioOutput","defaultVideoInput","systemAudio","recordingType"]);case 2:return t=e.sent,r=t.micActive,n=t.defaultAudioInput,o=t.defaultAudioOutput,a=t.defaultVideoInput,i=t.systemAudio,c=t.recordingType,e.abrupt("return",{micActive:r,defaultAudioInput:n,defaultAudioOutput:o,defaultVideoInput:a,systemAudio:i,recordingType:c});case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ee=function(){var e=B(C().mark((function e(){var t,r,n,o;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,chrome.storage.local.get(["region"]);case 2:if(t=e.sent,t.region){e.next=10;break}return e.next=7,chrome.storage.local.get(["sandboxTab"]);case 7:r=e.sent,n=r.sandboxTab,chrome.tabs.get(n,(function(e){e&&chrome.tabs.remove(e.id)}));case 10:return e.next=12,chrome.storage.local.get(["wasRegion"]);case 12:o=e.sent,o.wasRegion&&chrome.storage.local.set({wasRegion:!1,region:!0}),chrome.action.setIcon({path:"assets/icon-34.png"});case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),te=function(){var e=B(C().mark((function e(){var t,r,n;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t="editor.html",navigator.userAgent.includes("Chrome/")&&parseInt(navigator.userAgent.match(/Chrome\/([0-9]+)/)[1])<=109&&(t="editorfallback.html"),e.next=4,chrome.storage.local.get(["sandboxTab"]);case 4:r=e.sent,n=r.sandboxTab,chrome.tabs.get(n,(function(e){e&&chrome.tabs.remove(e.id)})),chrome.tabs.create({url:t,index:1,pinned:!0,active:!1},(function(e){chrome.storage.local.set({sandboxTab:e.id}),chrome.tabs.onUpdated.addListener((function e(t,r,n){t===n.id&&"complete"===r.status&&(chrome.tabs.onUpdated.removeListener(e),$())}))}));case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),re=function(){var e=B(C().mark((function e(t){return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:chrome.storage.local.get(["recordingTab","offscreen"],(function(e){e.offscreen?chrome.runtime.sendMessage(t):chrome.tabs.get(e.recordingTab,(function(e){chrome.tabs.sendMessage(e.id,t)}))}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ne=function(){var e=B(C().mark((function e(t){var r,n,o,a,i,c,s,u;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F();case 2:return r=e.sent,chrome.storage.local.set({activeTab:r.id,tabRecordedID:null}),r.url.includes(chrome.runtime.getURL("playground.html"))?chrome.storage.local.set({tabPreferred:!0}):chrome.storage.local.set({tabPreferred:!1}),e.prev=5,e.next=8,chrome.runtime.getContexts({});case 8:if(n=e.sent,!n.find((function(e){return"OFFSCREEN_DOCUMENT"===e.contextType}))){e.next=13;break}return e.next=13,chrome.offscreen.closeDocument();case 13:e.next=17;break;case 15:e.prev=15,e.t0=e.catch(5);case 17:if(!t.region){e.next=46;break}if(chrome.storage.local.set({recordingTab:r.id,offscreen:!1,region:!0}),!t.customRegion){e.next=23;break}re({type:"loaded",request:t,region:!0}),e.next=44;break;case 23:throw e.prev=23,new Error("Exit offscreen recording");case 27:if(o=e.sent,!o.find((function(e){return"OFFSCREEN_DOCUMENT"===e.contextType}))){e.next=32;break}return e.next=32,chrome.offscreen.closeDocument();case 32:return e.next=34,chrome.offscreen.createDocument({url:"recorderoffscreen.html",reasons:["USER_MEDIA","AUDIO_PLAYBACK","DISPLAY_MEDIA"],justification:"Recording from getDisplayMedia API and tabCapture API"});case 34:return e.next=36,chrome.tabCapture.getMediaStreamId({targetTabId:r.id});case 36:a=e.sent,chrome.storage.local.set({recordingTab:null,offscreen:!0,region:!1,wasRegion:!0}),re({type:"loaded",request:t,isTab:!0,tabID:a}),e.next=44;break;case 41:e.prev=41,e.t1=e.catch(23),chrome.tabs.create({url:"recorder.html",pinned:!0,index:0,active:!!r.url.includes(chrome.runtime.getURL("playground.html"))}).then((function(e){chrome.storage.local.set({recordingTab:e.id,offscreen:!1,region:!1,wasRegion:!0,tabRecordedID:r.id}),chrome.tabs.onUpdated.addListener((function n(o,a,i){o===e.id&&"complete"===a.status&&(chrome.tabs.onUpdated.removeListener(n),re({type:"loaded",request:t,tabID:r.id,isTab:!0}))}))}));case 44:e.next=71;break;case 46:if(e.prev=46,t.offscreenRecording&&!t.camera){e.next=49;break}throw new Error("Exit offscreen recording");case 49:return e.next=51,chrome.storage.local.get(["quality"]);case 51:return i=e.sent,c=i.quality,e.next=55,chrome.runtime.getContexts({});case 55:if(s=e.sent,!s.find((function(e){return"OFFSCREEN_DOCUMENT"===e.contextType}))){e.next=60;break}return e.next=60,chrome.offscreen.closeDocument();case 60:return e.next=62,chrome.offscreen.createDocument({url:"recorderoffscreen.html",reasons:["USER_MEDIA","AUDIO_PLAYBACK","DISPLAY_MEDIA"],justification:"Recording from getDisplayMedia API"});case 62:chrome.storage.local.set({recordingTab:null,offscreen:!0,region:!1,wasRegion:!1}),re({type:"loaded",request:t,isTab:!1,quality:c}),e.next=71;break;case 66:e.prev=66,e.t2=e.catch(46),u=!0,t.camera&&(u=!1),chrome.tabs.create({url:"recorder.html",pinned:!0,index:0,active:u}).then((function(e){chrome.storage.local.set({recordingTab:e.id,offscreen:!1,region:!1,wasRegion:!1}),chrome.tabs.onUpdated.addListener((function r(n,o,a){n===e.id&&"complete"===o.status&&(chrome.tabs.onUpdated.removeListener(r),re({type:"loaded",request:t}))}))}));case 71:case"end":return e.stop()}}),e,null,[[5,15],[23,41],[46,66]])})));return function(t){return e.apply(this,arguments)}}(),oe=function(){var e=B(C().mark((function e(){var t,r;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,chrome.storage.local.get(["sandboxTab"]);case 2:t=e.sent,r=t.sandboxTab,chrome.tabs.sendMessage(r,{type:"saved-to-drive"});case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ae=function(){var e=B(C().mark((function e(){var t;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,chrome.runtime.getContexts({});case 3:if(t=e.sent,!t.find((function(e){return"OFFSCREEN_DOCUMENT"===e.contextType}))){e.next=8;break}return e.next=8,chrome.offscreen.closeDocument();case 8:e.next=12;break;case 10:e.prev=10,e.t0=e.catch(0);case 12:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}(),ie=function(){var e=B(C().mark((function e(){var t,r,n,o,a,i,c,s,u,l,f;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=chrome.runtime.getManifest().content_scripts,r=t.map((function(e){return chrome.tabs.query({url:e.matches})})),e.next=4,Promise.all(r);case 4:for(n=e.sent,o=[],a=0;a=43)}})).catch((function(){return!1}))}function k(e){return"boolean"==typeof m?u.resolve(m):x(e).then((function(e){return m=e}))}function E(e){var t=g[e.name],r={};r.promise=new u((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function _(e){var t=g[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function S(e,t){var r=g[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function I(e,t){return new u((function(r,n){if(g[e.name]=g[e.name]||R(),e.db){if(!t)return r(e.db);E(e),e.db.close()}var o=[e.name];t&&o.push(e.version);var a=i.open.apply(i,o);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(p)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){var t=a.result;t.onversionchange=function(e){e.target.close()},r(t),_(e)}}))}function T(e){return I(e,!1)}function N(e){return I(e,!0)}function D(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.versione.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||r){if(r){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function j(e){return new u((function(t,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},n.readAsBinaryString(e)}))}function L(e){return s([w(atob(e.data))],{type:e.type})}function C(e){return e&&e.__local_forage_encoded_blob}function O(e){var t=this,r=t._initReady().then((function(){var e=g[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return f(r,e,e),r}function A(e){E(e);for(var t=g[e.name],r=t.forages,n=0;n0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return u.resolve().then((function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),N(e)})).then((function(){return A(e).then((function(){M(e,t,r,n-1)}))})).catch(r);r(o)}}function R(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function B(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var o=g[r.name];o||(o=R(),g[r.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=O);var a=[];function i(){return u.resolve()}for(var c=0;c>4,l[s++]=(15&n)<<4|o>>2,l[s++]=(3&o)<<6|63&a;return u}function pe(e){var t,r=new Uint8Array(e),n="";for(t=0;t>2],n+=V[(3&r[t])<<4|r[t+1]>>4],n+=V[(15&r[t+1])<<2|r[t+2]>>6],n+=V[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}function me(e,t){var r="";if(e&&(r=he.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===he.call(e.buffer))){var n,o=X;e instanceof ArrayBuffer?(n=e,o+=ee):(n=e.buffer,"[object Int8Array]"===r?o+=re:"[object Uint8Array]"===r?o+=ne:"[object Uint8ClampedArray]"===r?o+=oe:"[object Int16Array]"===r?o+=ae:"[object Uint16Array]"===r?o+=ce:"[object Int32Array]"===r?o+=ie:"[object Uint32Array]"===r?o+=se:"[object Float32Array]"===r?o+=ue:"[object Float64Array]"===r?o+=le:t(new Error("Failed to get type for BinaryArray"))),t(o+pe(n))}else if("[object Blob]"===r){var a=new FileReader;a.onload=function(){var r=Y+e.type+"~"+pe(this.result);t(X+te+r)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}}function ge(e){if(e.substring(0,Z)!==X)return JSON.parse(e);var t,r=e.substring(fe),n=e.substring(Z,fe);if(n===te&&H.test(r)){var o=r.match(H);t=o[1],r=r.substring(o[0].length)}var a=de(r);switch(n){case ee:return a;case te:return s([a],{type:t});case re:return new Int8Array(a);case ne:return new Uint8Array(a);case oe:return new Uint8ClampedArray(a);case ae:return new Int16Array(a);case ce:return new Uint16Array(a);case ie:return new Int32Array(a);case se:return new Uint32Array(a);case ue:return new Float32Array(a);case le:return new Float64Array(a);default:throw new Error("Unkown type: "+n)}}var ve={serialize:me,deserialize:ge,stringToBuffer:de,bufferToString:pe};function ye(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function be(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var o=new u((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(o){ye(o,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=ve,o}function we(e,t,r,n,o,a){e.executeSql(r,n,o,(function(e,i){i.code===i.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,c){c.rows.length?a(e,i):ye(e,t,(function(){e.executeSql(r,n,o,a)}),a)}),a):a(e,i)}),a)}function xe(e,t){var r=this;e=h(e);var n=new u((function(t,n){r.ready().then((function(){var o=r._dbInfo;o.db.transaction((function(r){we(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function ke(e,t){var r=this,n=new u((function(t,n){r.ready().then((function(){var o=r._dbInfo;o.db.transaction((function(r){we(r,o,"SELECT * FROM "+o.storeName,[],(function(r,n){for(var a=n.rows,i=a.length,c=0;c0)return void a(Ee.apply(o,[e,c,r,n-1]));i(t)}}))}))})).catch(i)}));return l(a,r),a}function _e(e,t,r){return Ee.apply(this,[e,t,r,1])}function Se(e,t){var r=this;e=h(e);var n=new u((function(t,n){r.ready().then((function(){var o=r._dbInfo;o.db.transaction((function(r){we(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function Ie(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"DELETE FROM "+n.storeName,[],(function(){e()}),(function(e,t){r(t)}))}))})).catch(r)}));return l(r,e),r}function Te(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(t,r){var n=r.rows.item(0).c;e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return l(r,e),r}function Ne(e,t){var r=this,n=new u((function(t,n){r.ready().then((function(){var o=r._dbInfo;o.db.transaction((function(r){we(r,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function De(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"SELECT key FROM "+n.storeName,[],(function(t,r){for(var n=[],o=0;o '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var o=[],a=0;a0}function Be(e){var t=this,r={};if(e)for(var n in e)r[n]=e[n];return r.keyPrefix=Ae(e,t._defaultConfig),Re()?(t._dbInfo=r,r.serializer=ve,u.resolve()):u.reject()}function Pe(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return l(r,e),r}function Fe(e,t){var r=this;e=h(e);var n=r.ready().then((function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n}));return l(n,t),n}function Ue(e,t){var r=this,n=r.ready().then((function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,a=localStorage.length,i=1,c=0;c=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}})):u.reject("Invalid arguments"),l(n,t),n}var We={_driver:"localStorageWrapper",_initStorage:Be,_support:Oe(),iterate:Ue,getItem:Fe,setItem:ze,removeItem:Je,clear:Pe,length:Ge,key:$e,keys:qe,dropInstance:Ke},Qe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ve=function(e,t){for(var r=e.length,n=0;n{"use strict";var n=r(5877);e.exports={generate:function(){var e=n.v1();return e.substr(14,4)+e.substr(9,4)+e.substr(0,8)+e.substr(19,4)+e.substr(24,e.length)},toBinary16:function(e){return new Buffer(e,"hex")},fromBinary16:function(e){return e.toString("hex")}}},5877:(e,t,r)=>{var n=r(3570),o=r(1171),a=o;a.v1=n,a.v4=o,e.exports=a},5327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},5217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},3570:(e,t,r)=>{var n,o,a=r(5217),i=r(5327),c=0,s=0;e.exports=function(e,t,r){var u=t&&r||0,l=t||[],f=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:o;if(null==f||null==h){var d=a();null==f&&(f=n=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==h&&(h=o=16383&(d[6]<<8|d[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),m=void 0!==e.nsecs?e.nsecs:s+1,g=p-c+(m-s)/1e4;if(g<0&&void 0===e.clockseq&&(h=h+1&16383),(g<0||p>c)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=p,s=m,o=h;var v=(1e4*(268435455&(p+=122192928e5))+m)%4294967296;l[u++]=v>>>24&255,l[u++]=v>>>16&255,l[u++]=v>>>8&255,l[u++]=255&v;var y=p/4294967296*1e4&268435455;l[u++]=y>>>8&255,l[u++]=255&y,l[u++]=y>>>24&15|16,l[u++]=y>>>16&255,l[u++]=h>>>8|128,l[u++]=255&h;for(var b=0;b<6;++b)l[u+b]=f[b];return t||i(l)}},1171:(e,t,r)=>{var n=r(5217),o=r(5327);e.exports=function(e,t,r){var a=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||n)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var c=0;c<16;++c)t[a+c]=i[c];return t||o(i)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return n};var r,n={},o=Object.prototype,a=o.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(r){f=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new C(n||[]);return i(a,"_invoke",{value:N(e,r,c)}),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}n.wrap=h;var p="suspendedStart",m="suspendedYield",g="executing",v="completed",y={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var E=Object.getPrototypeOf,_=E&&E(E(O([])));_&&_!==o&&a.call(_,s)&&(k=_);var S=x.prototype=b.prototype=Object.create(k);function I(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function T(t,r){function n(o,i,c,s){var u=d(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==e(f)&&a.call(f,"__await")?r.resolve(f.__await).then((function(e){n("next",e,c,s)}),(function(e){n("throw",e,c,s)})):r.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return n("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,t){function a(){return new r((function(r,o){n(e,t,r,o)}))}return o=o?o.then(a,a):a()}})}function N(e,t,n){var o=p;return function(a,i){if(o===g)throw new Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:r,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=D(c,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=g;var u=d(e,t,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function D(e,t){var n=t.method,o=e.iterator[n];if(o===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=r,D(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=d(o,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,y;var i=a.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,y):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function O(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function e(){for(;++o=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),y}},n}function n(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}const o=function(){var e,r=(e=t().mark((function e(){var r;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,chrome.identity.getAuthToken({interactive:!0});case 3:if(r=e.sent){e.next=6;break}throw new Error("User cancelled sign-in or failed to get token");case 6:return e.next=8,new Promise((function(e){return chrome.storage.local.set({token:r.token},(function(){return e()}))}));case 8:return e.next=10,chrome.identity.getProfileUserInfo();case 10:return e.sent,e.abrupt("return",r.token);case 14:return e.prev=14,e.t0=e.catch(0),console.error("Error signing in:",e.t0.message),e.abrupt("return",null);case 19:case"end":return e.stop()}}),e,null,[[0,14]])})),function(){var t=this,r=arguments;return new Promise((function(o,a){var i=e.apply(t,r);function c(e){n(i,o,a,c,s,"next",e)}function s(e){n(i,o,a,c,s,"throw",e)}c(void 0)}))});return function(){return r.apply(this,arguments)}}();function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */i=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var a=t&&t.prototype instanceof b?t:b,i=Object.create(a.prototype),c=new C(n||[]);return o(i,"_invoke",{value:N(e,r,c)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var p="suspendedStart",m="suspendedYield",g="executing",v="completed",y={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var E=Object.getPrototypeOf,_=E&&E(E(O([])));_&&_!==r&&n.call(_,s)&&(k=_);var S=x.prototype=b.prototype=Object.create(k);function I(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(o,i,c,s){var u=d(e[o],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==a(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function N(t,r,n){var o=p;return function(a,i){if(o===g)throw new Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=D(c,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=g;var u=d(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function D(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,D(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=d(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function O(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:O(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}function c(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){c(a,n,o,i,s,"next",e)}function s(e){c(a,n,o,i,s,"throw",e)}i(void 0)}))}}const u=function(){var e=s(i().mark((function e(t,r,n){var a,c;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=function(){return c=s(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,t){chrome.storage.local.get(["token"],function(){var r=s(i().mark((function r(n){var a,c,s,u;return i().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!chrome.runtime.lastError){r.next=4;break}t(new Error(chrome.runtime.lastError)),r.next=24;break;case 4:if((a=n.token)&&null!==a){r.next=13;break}return r.next=8,o();case 8:(c=r.sent)&&null!==c||t(new Error("Sign-in failed")),e(c),r.next=24;break;case 13:r.prev=13,s=JSON.parse(atob(a.split(".")[1])),r.next=21;break;case 17:return r.prev=17,r.t0=r.catch(13),chrome.identity.getAuthToken({interactive:!0},(function(r){chrome.runtime.lastError?t(new Error(chrome.runtime.lastError)):e(r)})),r.abrupt("return");case 21:u=1e3*s.exp,Date.now()>=u?chrome.identity.getAuthToken({interactive:!0},(function(r){chrome.runtime.lastError?t(new Error(chrome.runtime.lastError)):e(r)})):e(a);case 24:case"end":return r.stop()}}),r,null,[[13,17]])})));return function(e){return r.apply(this,arguments)}}())})));case 1:case"end":return e.stop()}}),e)}))),c.apply(this,arguments)},a=function(){return c.apply(this,arguments)},e.abrupt("return",new Promise(function(){var e=s(i().mark((function e(o,c){var s,u,l,f,h,d,p,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,a();case 3:if((s=e.sent)&&null!==s){e.next=6;break}throw new Error("Sign-in failed");case 6:return u=new Headers({Authorization:"Bearer ".concat(s),"Content-Type":t.type}),e.next=9,fetch("https://www.googleapis.com/upload/drive/v3/files?uploadType=media",{method:"POST",headers:u,body:t});case 9:if((l=e.sent).ok){e.next=12;break}throw new Error("Error uploading to Google Drive: ".concat(l.status));case 12:return e.next=14,l.json();case 14:if(f=e.sent,h=f.id){e.next=18;break}throw new Error("File ID is undefined");case 18:return d={name:r},e.next=21,fetch("https://www.googleapis.com/drive/v3/files/".concat(h),{method:"PATCH",headers:new Headers({Authorization:"Bearer ".concat(s),"Content-Type":"application/json; charset=UTF-8"}),body:JSON.stringify(d)});case 21:if((p=e.sent).ok){e.next=28;break}return e.next=25,p.json();case 25:throw m=e.sent,console.error("Error updating file metadata:",p.status,m.error.message),new Error("Error updating file metadata: ".concat(p.status));case 28:n({status:"ok",url:h}),chrome.tabs.create({url:"https://drive.google.com/file/d/".concat(h,"/view")}),o("https://drive.google.com/file/d/".concat(h,"/view")),e.next=38;break;case 33:e.prev=33,e.t0=e.catch(0),console.error("Error uploading to Google Drive:",e.t0.message),n({status:"ew",url:null}),c(e.t0);case 38:case"end":return e.stop()}}),e,null,[[0,33]])})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}();var l=r(9483),f=r.n(l);function h(e){if(e){if("string"!=typeof e)return this.userErrors.push("Collection name in collection() method must be a string and not an object, number or boolean."),this;{this.collectionName=e;let t=this.dbName;return e in this.lf||(this.lf[e]=f().createInstance({driver:f().INDEXEDDB,name:t,storeName:e})),this}}return this.userErrors.push("No collection name specified in collection() method."),this}function d(e){return e?"string"!=typeof e&&"object"!=typeof e?this.userErrors.push("Document criteria specified in doc() method must not be a number or boolean. Use a string (with a key) or an object (with criteria) e.g. { id: 1 }"):this.docSelectionCriteria=e:this.userErrors.push("No document criteria specified in doc() method. Use a string (with a key) or an object (with criteria) e.g. { id: 1 }"),this}function p(e,t){return e?"string"!=typeof e?this.userErrors.push("First parameter in orderBy() method must be a string (a field name) e.g. 'name'"):this.orderByProperty=e:this.userErrors.push("No field name specified in orderBy() method. Use a string e.g. 'name'"),t&&("asc"!==t&&"desc"!==t?this.userErrors.push("Second parameter in orderBy() method must be a string set to 'asc' or 'desc'."):this.orderByDirection=t),this}function m(e){return e?Number.isInteger(e)?this.limitBy=e:this.userErrors.push("Limit parameter in limit() method must be an integer (e.g. 3) and not a float, boolean, string or object."):this.userErrors.push("No integer specified in limit() method."),this}function g(e,t){return Object.keys(t).every((r=>"object"==typeof t[r]?g(e[r],t[r]):t[r]===e[r]))}const v={baseStyle:"\n padding: 2px 5px;\n background-color: #124F5C;\n border-radius: 4px;\n color: white; \n ",colors:{log:"#124F5C",error:"#ed2939",warn:"#f39c12"},log(e,t){0},error(e,t){0},warn(e,t){0}};function y(){this.collectionName=null,this.orderByProperty=null,this.orderByDirection=null,this.limitBy=null,this.docSelectionCriteria=null,this.userErrors=[]}function b(){let e;return this.collectionName||this.docSelectionCriteria?this.collectionName&&!this.docSelectionCriteria?e="collection":this.collectionName&&this.docSelectionCriteria&&(e="doc"):e="db",e}function w(){for(let e=0;e{let t=this.collectionName,r=this.orderByProperty,n=this.orderByDirection,o=this.limitBy,a=[];return this.lf[t].iterate(((t,r)=>{let n={};n=e.keys?{key:r,data:t}:t,a.push(n)})).then((()=>{let i=`Got "${t}" collection`;return r&&(i+=`, ordered by "${r}"`,e.keys?a.sort(((e,t)=>e.data[r].toString().localeCompare(t.data[r].toString()))):a.sort(((e,t)=>e[r].toString().localeCompare(t[r].toString())))),"desc"==n&&(i+=" (descending)",a.reverse()),o&&(i+=`, limited to ${o}`,a=a.splice(0,o)),i+=":",v.log.call(this,i,a),y.call(this),a}))},this.getDocument=()=>{let e=this.collectionName,t=this.docSelectionCriteria,r=[],n={};return this.getDocumentByCriteria=()=>this.lf[e].iterate(((e,n)=>{g(e,t)&&r.push(e)})).then((()=>{if(r.length)return n=r[0],v.log.call(this,`Got Document with ${JSON.stringify(t)}:`,n),y.call(this),n;v.error.call(this,`Could not find Document in "${e}" collection with criteria: ${JSON.stringify(t)}`)})),this.getDocumentByKey=()=>this.lf[e].getItem(t).then((r=>(n=r,n?v.log.call(this,`Got Document with key ${JSON.stringify(t)}:`,n):v.error.call(this,`Could not find Document in "${e}" collection with Key: ${JSON.stringify(t)}`),y.call(this),n))).catch((r=>{v.error.call(this,`Could not find Document in "${e}" collection with Key: ${JSON.stringify(t)}`),y.call(this)})),"object"==typeof t?this.getDocumentByCriteria():this.getDocumentByKey()},"object"!=typeof e||e instanceof Array!=0?this.userErrors.push('Data passed to .get() must be an object. Not an array, string, number or boolean. The object must contain a "keys" property set to true or false, e.g. { keys: true }'):e.hasOwnProperty("keys")?"boolean"!=typeof e.keys&&this.userErrors.push('Property "keys" passed into get() method must be assigned a boolean value (true or false). Not a string or integer.'):this.userErrors.push('Object passed to get() method must contain a "keys" property set to boolean true or false, e.g. { keys: true }'),this.userErrors.length)return w.call(this),null;{let e=b.call(this);if("collection"==e)return this.getCollection();if("doc"==e)return this.getDocument()}}function k(e,t){return y.call(this),v.log.call(this,e,t),{success:!0,message:e,data:t}}function E(e){return y.call(this),v.error.call(this,e),`Error: ${e}`}let _=r(2024);function S(e,t){if(e?"object"==typeof e&&e instanceof Array==0||this.userErrors.push("Data passed to .add() must be an object. Not an array, string, number or boolean."):this.userErrors.push('No data specified in add() method. You must use an object, e.g { id: 1, name: "Bill", age: 47 }'),!this.userErrors.length){let r=this.collectionName;return new Promise(((n,o)=>{let a=null;return a=t||_.generate(),this.lf[r].setItem(a,e).then((()=>{n(k.call(this,`Document added to "${r}" collection.`,{key:a,data:e}))})).catch((e=>{o(E.call(this,`Could not add Document to ${r} collection.`))}))}))}w.call(this)}function I(e){for(var t=1;t{this.updateDocumentByCriteria=()=>{let a=[];this.lf[t].iterate(((t,n)=>{if(g(t,r)){let r=I(t,e);a.push({key:n,newDocument:r})}})).then((()=>{a.length||o(E.call(this,`No Documents found in ${t} Collection with criteria ${JSON.stringify(r)}.`)),a.length>1&&v.warn.call(this,`Multiple documents (${a.length}) with ${JSON.stringify(r)} found for updating.`)})).then((()=>{a.forEach(((i,c)=>{this.lf[t].setItem(i.key,i.newDocument).then((o=>{c===a.length-1&&n(k.call(this,`${a.length} Document${a.length>1?"s":""} in "${t}" collection with ${JSON.stringify(r)} updated.`,e))})).catch((e=>{o(E.call(this,`Could not update ${a.length} Documents in ${t} Collection.`))}))}))}))},this.updateDocumentByKey=()=>{let a={};this.lf[t].getItem(r).then((o=>{a=I(o,e),this.lf[t].setItem(r,a),n(k.call(this,`Document in "${t}" collection with key ${JSON.stringify(r)} updated.`,a))})).catch((e=>{o(E.call(this,`No Document found in "${t}" collection with key ${JSON.stringify(r)}`))}))},e?"object"==typeof e&&e instanceof Array==0||this.userErrors.push("Data passed to .update() must be an object. Not an array, string, number or boolean."):this.userErrors.push('No update object provided to update() method. Use an object e.g. { name: "William" }'),this.userErrors.length?w.call(this):"object"==typeof r?this.updateDocumentByCriteria():this.updateDocumentByKey()}))}function N(e,t={keys:!1}){let r=this.collectionName,n=this.docSelectionCriteria,o=b.call(this);return new Promise(((a,i)=>{if(this.setCollection=()=>{this.lf[r].clear().then((()=>{if(t.keys){console.log("keys provided");let t=0;e.forEach((e=>{e.hasOwnProperty("_key")||t++})),t?i(E.call(this,"Documents provided to .set() in an array must each have a _key property set to a string.")):(e.forEach((e=>{let t=e._key;delete e._key,this.add(e,t)})),a(k.call(this,`Collection "${r}" set with ${e.length} Documents.`,e)))}else e.forEach((e=>{this.add(e)})),a(k.call(this,`Collection "${r}" set with ${e.length} Documents.`,e))})).catch((t=>{i(E.call(this,`Could not set ${r} Collection with data ${JSON.stringify(e)}.`))}))},this.setDocument=()=>(this.setDocumentByCriteria=()=>{let t=[];this.lf[r].iterate(((r,o)=>{g(r,n)&&t.push({key:o,newDocument:e})})).then((()=>{t.length||i(E.call(this,`No Documents found in ${r} Collection with criteria ${JSON.stringify(n)}.`)),t.length>1&&v.warn.call(this,`Multiple documents (${t.length}) with ${JSON.stringify(n)} found for setting.`)})).then((()=>{t.forEach(((o,c)=>{this.lf[r].setItem(o.key,o.newDocument).then((o=>{c===t.length-1&&a(k.call(this,`${t.length} Document${t.length>1?"s":""} in "${r}" collection with ${JSON.stringify(n)} was set.`,e))})).catch((e=>{i(E.call(this,`Could not set ${t.length} Documents in ${r} Collection.`))}))}))}))},this.setDocumentByKey=()=>{this.lf[r].setItem(n,e).then((t=>{a(k.call(this,`Document in "${r}" collection with key ${JSON.stringify(n)} was set.`,e))})).catch((e=>{i(E.call(this,`Document in "${r}" collection with key ${JSON.stringify(n)} could not be set.`))}))},"object"==typeof n?this.setDocumentByCriteria():this.setDocumentByKey()),e?"doc"===o?"object"==typeof e&&e instanceof Array==0||this.userErrors.push("Data passed to .set() must be an object. Not an array, string, number or boolean."):"collection"===o&&("object"==typeof e&&e instanceof Array==1||this.userErrors.push("Data passed to .set() must be an array of objects. Not an object, string, number or boolean.")):this.userErrors.push('No new Document object provided to set() method. Use an object e.g. { id: 1, name: "Bill", age: 47 }'),this.userErrors.length)w.call(this);else{if("collection"==o)return this.setCollection();if("doc"==o)return this.setDocument()}}))}function D(){return new Promise(((e,t)=>{if(this.deleteDatabase=()=>{let t=this.dbName;indexedDB.deleteDatabase(t),e(k.call(this,`Database "${t}" deleted.`,{database:t}))},this.deleteCollection=()=>{let r=this.dbName,n=this.collectionName;this.addToDeleteCollectionQueue=e=>{this.deleteCollectionQueue.queue.push(e),this.runDeleteCollectionQueue()},this.runDeleteCollectionQueue=()=>{0==this.deleteCollectionQueue.running&&(this.deleteCollectionQueue.running=!0,this.deleteNextCollectionFromQueue())},this.deleteNextCollectionFromQueue=()=>{if(this.deleteCollectionQueue.queue.length){let n=this.deleteCollectionQueue.queue[0];this.deleteCollectionQueue.queue.shift(),this.lf[n].dropInstance({name:r,storeName:n}).then((()=>{this.deleteNextCollectionFromQueue(),e(k.call(this,`Collection "${n}" deleted.`,{collection:n}))})).catch((e=>{t(e.call(this,`Collection "${n}" could not be deleted.`))}))}else this.deleteCollectionQueue.running=!1},this.addToDeleteCollectionQueue(n)},this.deleteDocument=()=>{let r=this.collectionName,n=this.docSelectionCriteria;return this.deleteDocumentByCriteria=()=>{let o=[];this.lf[r].iterate(((e,t)=>{g(e,n)&&o.push(t)})).then((()=>{o.length||t(E.call(this,`No Documents found in "${r}" Collection with criteria ${JSON.stringify(n)}. No documents deleted.`)),o.length>1&&v.warn.call(this,`Multiple documents (${o.length}) with ${JSON.stringify(n)} found.`)})).then((()=>{o.forEach(((a,i)=>{this.lf[r].removeItem(a).then((()=>{i===o.length-1&&e(k.call(this,`${o.length} Document${o.length>1?"s":""} with ${JSON.stringify(n)} deleted.`,{keys:o}))})).catch((e=>{t(E.call(this,`Could not delete ${o.length} Documents in ${r} Collection.`))}))}))}))},this.deleteDocumentByKey=()=>{this.lf[r].getItem(n).then((o=>{o?this.lf[r].removeItem(n).then((()=>{e(k.call(this,`Document with key ${JSON.stringify(n)} deleted.`,{key:n}))})).catch((function(e){t(E.call(this,`No Document found in "${r}" Collection with key ${JSON.stringify(n)}. No document was deleted.`))})):t(E.call(this,`No Document found in "${r}" Collection with key ${JSON.stringify(n)}. No document was deleted.`))}))},"object"==typeof n?this.deleteDocumentByCriteria():this.deleteDocumentByKey()},this.userErrors.length)w.call(this);else{let e=b.call(this);if("db"==e)return this.deleteDatabase();if("collection"==e)return this.deleteCollection();if("doc"==e)return this.deleteDocument()}}))}function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function L(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=A(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw a}}}}function C(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */C=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new L(n||[]);return o(i,"_invoke",{value:I(e,r,c)}),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var h="suspendedStart",d="suspendedYield",p="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};u(w,i,(function(){return this}));var x=Object.getPrototypeOf,k=x&&x(x(O([])));k&&k!==r&&n.call(k,i)&&(w=k);var E=b.prototype=v.prototype=Object.create(w);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(o,a,i,c){var s=f(e[o],e,a);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==j(l)&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,i,c)}),(function(e){r("throw",e,i,c)})):t.resolve(l).then((function(e){u.value=e,i(u)}),(function(e){return r("throw",e,i,c)}))}c(s.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function I(t,r,n){var o=h;return function(a,i){if(o===p)throw new Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=T(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var u=f(t,r,n);if("normal"===u.type){if(o=n.done?m:d,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=m,n.method="throw",n.arg=u.arg)}}}function T(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,T(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=f(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function O(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),D(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;D(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:O(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||A(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){if(e){if("string"==typeof e)return M(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(e,t):void 0}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&void 0!==o[0]&&o[0],e.next=3,chrome.storage.local.get(["sandboxTab"]);case 3:r=e.sent,n=r.sandboxTab,P.collection("chunks").get().then(function(){var e=B(C().mark((function e(r){var o,a,i,c;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==r.length){e.next=3;break}return chrome.tabs.sendMessage(n,{type:"make-video-tab",override:t}),e.abrupt("return");case 3:10,o=r.length,a=[],i=0,3,chrome.tabs.sendMessage(n,{type:"chunk-count",count:o}),c=function(){var e=B(C().mark((function e(){var s,u,l,f,h,d,p,m,g=arguments;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=g.length>0&&void 0!==g[0]?g[0]:0,u=i,l=Math.min(i+10,o),a=[],f=u;case 5:if(!(f0&&chrome.tabs.sendMessage(n,{type:"new-chunk-tab",chunks:a},(function(e){e?(i+=10)3e5?chrome.tabs.create({url:"editorfallback.html",active:!0},(function(e){chrome.tabs.onUpdated.addListener((function t(r,n,o){r===e.id&&"complete"===n.status&&(chrome.tabs.onUpdated.removeListener(t),chrome.tabs.remove(a),chrome.storage.local.set({sandboxTab:e.id}),Q())}))})):(chrome.tabs.get(a,(function(e){chrome.windows.update(e.windowId,{focused:!0}).then((function(){chrome.tabs.update(a,{active:!0,pinned:!1}),chrome.tabs.move(a,{index:-1})}))})),Q()),chrome.action.setIcon({path:"assets/icon-34.png"}),e.next=16,chrome.storage.local.get(["wasRegion"]);case 16:i=e.sent,i.wasRegion&&chrome.storage.local.set({wasRegion:!1,region:!0}),chrome.alarms.clear("recording-alarm"),ae();case 21:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Y=function(){var e=B(C().mark((function e(){var t,r,n;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t="editor.html",e.next=3,chrome.storage.local.get(["sandboxTab"]);case 3:r=e.sent,n=r.sandboxTab,chrome.tabs.create({url:t,active:!0},(function(e){chrome.tabs.onUpdated.addListener((function t(r,o,a){r===e.id&&"complete"===o.status&&(chrome.tabs.onUpdated.removeListener(t),chrome.tabs.remove(n),chrome.storage.local.set({sandboxTab:e.id}),Q(!0))}))}));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();chrome.runtime.onStartup.addListener((function(){console.log("Starting...")})),chrome.action.onClicked.addListener(function(){var e=B(C().mark((function e(t){var r,n,o,a,i;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,chrome.storage.local.get(["recording"]);case 2:if(r=e.sent,!r.recording){e.next=14;break}return V(),re({type:"stop-recording-tab"}),e.next=9,chrome.storage.local.get(["activeTab"]);case 9:n=e.sent,o=n.activeTab,chrome.tabs.get(o,(function(e){e?chrome.tabs.sendMessage(o,{type:"stop-recording-tab"}):(chrome.tabs.sendMessage(t.id,{type:"stop-recording-tab"}),chrome.storage.local.set({activeTab:t.id}))})),e.next=15;break;case 14:!1===navigator.onLine&&!t.url.includes("/playground.html")&&!t.url.includes("/setup.html")||t.url.startsWith("chrome://")||t.url.startsWith("chrome-extension://")&&!t.url.includes("/playground.html")&&!t.url.includes("/setup.html")||t.url.includes("stackoverflow.com/")||t.url.includes("chrome.google.com/webstore")||t.url.includes("chromewebstore.google.com")?chrome.tabs.create({url:"playground.html",active:!0}).then((function(e){chrome.storage.local.set({activeTab:e.id})})):(chrome.tabs.sendMessage(t.id,{type:"toggle-popup"}),chrome.storage.local.set({activeTab:t.id}));case 15:return e.next=17,chrome.storage.local.get(["firstTime"]);case 17:if(a=e.sent,!a.firstTime||!t.url.includes(chrome.runtime.getURL("setup.html"))){e.next=25;break}return chrome.storage.local.set({firstTime:!1}),e.next=23,F();case 23:i=e.sent,chrome.tabs.sendMessage(i.id,{type:"setup-complete"});case 25:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());var H=function(){var e=B(C().mark((function e(t){return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:re({type:"next-chunk-tab"});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),X=function(){var e=B(C().mark((function e(){var t;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F();case 2:t=e.sent,chrome.tabs.sendMessage(t.id,{type:"ready-to-record"});case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Z=function(){var e=B(C().mark((function e(){var t,r,n,o,a,i,c;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,chrome.storage.local.get(["micActive","defaultAudioInput","defaultAudioOutput","defaultVideoInput","systemAudio","recordingType"]);case 2:return t=e.sent,r=t.micActive,n=t.defaultAudioInput,o=t.defaultAudioOutput,a=t.defaultVideoInput,i=t.systemAudio,c=t.recordingType,e.abrupt("return",{micActive:r,defaultAudioInput:n,defaultAudioOutput:o,defaultVideoInput:a,systemAudio:i,recordingType:c});case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ee=function(){var e=B(C().mark((function e(){var t,r,n,o;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,chrome.storage.local.get(["region"]);case 2:if(t=e.sent,t.region){e.next=10;break}return e.next=7,chrome.storage.local.get(["sandboxTab"]);case 7:r=e.sent,n=r.sandboxTab,chrome.tabs.get(n,(function(e){e&&chrome.tabs.remove(e.id)}));case 10:return e.next=12,chrome.storage.local.get(["wasRegion"]);case 12:o=e.sent,o.wasRegion&&chrome.storage.local.set({wasRegion:!1,region:!0}),chrome.action.setIcon({path:"assets/icon-34.png"});case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),te=function(){var e=B(C().mark((function e(){var t,r,n;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t="editor.html",navigator.userAgent.includes("Chrome/")&&parseInt(navigator.userAgent.match(/Chrome\/([0-9]+)/)[1])<=109&&(t="editorfallback.html"),e.next=4,chrome.storage.local.get(["sandboxTab"]);case 4:r=e.sent,n=r.sandboxTab,chrome.tabs.get(n,(function(e){e&&chrome.tabs.remove(e.id)})),chrome.tabs.create({url:t,index:1,pinned:!0,active:!1},(function(e){chrome.storage.local.set({sandboxTab:e.id}),chrome.tabs.onUpdated.addListener((function e(t,r,n){t===n.id&&"complete"===r.status&&(chrome.tabs.onUpdated.removeListener(e),$())}))}));case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),re=function(){var e=B(C().mark((function e(t){return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:chrome.storage.local.get(["recordingTab","offscreen"],(function(e){e.offscreen?chrome.runtime.sendMessage(t):chrome.tabs.get(e.recordingTab,(function(e){chrome.tabs.sendMessage(e.id,t)}))}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ne=function(){var e=B(C().mark((function e(t){var r,n,o,a,i,c,s,u;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F();case 2:return r=e.sent,chrome.storage.local.set({activeTab:r.id,tabRecordedID:null}),r.url.includes(chrome.runtime.getURL("playground.html"))?chrome.storage.local.set({tabPreferred:!0}):chrome.storage.local.set({tabPreferred:!1}),e.prev=5,e.next=8,chrome.runtime.getContexts({});case 8:if(n=e.sent,!n.find((function(e){return"OFFSCREEN_DOCUMENT"===e.contextType}))){e.next=13;break}return e.next=13,chrome.offscreen.closeDocument();case 13:e.next=17;break;case 15:e.prev=15,e.t0=e.catch(5);case 17:if(!t.region){e.next=46;break}if(chrome.storage.local.set({recordingTab:r.id,offscreen:!1,region:!0}),!t.customRegion){e.next=23;break}re({type:"loaded",request:t,region:!0}),e.next=44;break;case 23:throw e.prev=23,new Error("Exit offscreen recording");case 27:if(o=e.sent,!o.find((function(e){return"OFFSCREEN_DOCUMENT"===e.contextType}))){e.next=32;break}return e.next=32,chrome.offscreen.closeDocument();case 32:return e.next=34,chrome.offscreen.createDocument({url:"recorderoffscreen.html",reasons:["USER_MEDIA","AUDIO_PLAYBACK","DISPLAY_MEDIA"],justification:"Recording from getDisplayMedia API and tabCapture API"});case 34:return e.next=36,chrome.tabCapture.getMediaStreamId({targetTabId:r.id});case 36:a=e.sent,chrome.storage.local.set({recordingTab:null,offscreen:!0,region:!1,wasRegion:!0}),re({type:"loaded",request:t,isTab:!0,tabID:a}),e.next=44;break;case 41:e.prev=41,e.t1=e.catch(23),chrome.tabs.create({url:"recorder.html",pinned:!0,index:0,active:!!r.url.includes(chrome.runtime.getURL("playground.html"))}).then((function(e){chrome.storage.local.set({recordingTab:e.id,offscreen:!1,region:!1,wasRegion:!0,tabRecordedID:r.id}),chrome.tabs.onUpdated.addListener((function n(o,a,i){o===e.id&&"complete"===a.status&&(chrome.tabs.onUpdated.removeListener(n),re({type:"loaded",request:t,tabID:r.id,isTab:!0}))}))}));case 44:e.next=71;break;case 46:if(e.prev=46,t.offscreenRecording&&!t.camera){e.next=49;break}throw new Error("Exit offscreen recording");case 49:return e.next=51,chrome.storage.local.get(["quality"]);case 51:return i=e.sent,c=i.quality,e.next=55,chrome.runtime.getContexts({});case 55:if(s=e.sent,!s.find((function(e){return"OFFSCREEN_DOCUMENT"===e.contextType}))){e.next=60;break}return e.next=60,chrome.offscreen.closeDocument();case 60:return e.next=62,chrome.offscreen.createDocument({url:"recorderoffscreen.html",reasons:["USER_MEDIA","AUDIO_PLAYBACK","DISPLAY_MEDIA"],justification:"Recording from getDisplayMedia API"});case 62:chrome.storage.local.set({recordingTab:null,offscreen:!0,region:!1,wasRegion:!1}),re({type:"loaded",request:t,isTab:!1,quality:c}),e.next=71;break;case 66:e.prev=66,e.t2=e.catch(46),u=!0,t.camera&&(u=!1),chrome.tabs.create({url:"recorder.html",pinned:!0,index:0,active:u}).then((function(e){chrome.storage.local.set({recordingTab:e.id,offscreen:!1,region:!1,wasRegion:!1}),chrome.tabs.onUpdated.addListener((function r(n,o,a){n===e.id&&"complete"===o.status&&(chrome.tabs.onUpdated.removeListener(r),re({type:"loaded",request:t}))}))}));case 71:case"end":return e.stop()}}),e,null,[[5,15],[23,41],[46,66]])})));return function(t){return e.apply(this,arguments)}}(),oe=function(){var e=B(C().mark((function e(){var t,r;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,chrome.storage.local.get(["sandboxTab"]);case 2:t=e.sent,r=t.sandboxTab,chrome.tabs.sendMessage(r,{type:"saved-to-drive"});case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ae=function(){var e=B(C().mark((function e(){var t;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,chrome.runtime.getContexts({});case 3:if(t=e.sent,!t.find((function(e){return"OFFSCREEN_DOCUMENT"===e.contextType}))){e.next=8;break}return e.next=8,chrome.offscreen.closeDocument();case 8:e.next=12;break;case 10:e.prev=10,e.t0=e.catch(0);case 12:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}(),ie=function(){var e=B(C().mark((function e(){var t,r,n,o,a,i,c,s,u,l,f;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=chrome.runtime.getManifest().content_scripts,r=t.map((function(e){return chrome.tabs.query({url:e.matches})})),e.next=4,Promise.all(r);case 4:for(n=e.sent,o=[],a=0;a0&&a[a.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]=256)throw new Error("Mask value must be in range [0, 255] but got "+e);if(!Number.isInteger(e))throw new Error("Mask value must be an integer but got "+e)}function by(e){var t=e.shape[2],n=Il(e,2),r=Xl(n,[-1]);return Su(r,t)}function vy(e,t){return oi((function(){return Ks(pp(e,Di(t)),"int32")}))}function wy(e,t){var n=t.shape,r=n[0],a=n[1],o=n[2];return oi((function(){var n=by(t),s=op(bd(0,o,1,"int32"),1),i=Ks(ku(n,s),"int32"),u=Xl(i,[r,a]),l=bi(u,Di(1,"int32"));return Wi(function(e,t){return xi(e,t)}(l,e),Di(1,"int32"))}))}var xy=function(){function e(e,t){this.model=e,this.outputStride=t;var n=this.model.inputs[0].shape;X(-1===n[1]&&-1===n[2],(function(){return"Input shape ["+n[1]+", "+n[2]+"] must both be equal to or -1"}))}return e.prototype.predict=function(e){var t=this;return oi((function(){var n=t.preprocessInput(Ks(e,"float32")),r=op(n,0),a=t.model.predict(r).map((function(e){return qd(e,[0])})),o=t.nameOutputResults(a);return{heatmapScores:tc(o.heatmap),offsets:o.offsets,displacementFwd:o.displacementFwd,displacementBwd:o.displacementBwd,segmentation:o.segmentation,partHeatmaps:o.partHeatmaps,longOffsets:o.longOffsets,partOffsets:o.partOffsets}}))},e.prototype.dispose=function(){this.model.dispose()},e}(),ky=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ly(t,e),t.prototype.preprocessInput=function(e){return oi((function(){return Wi(wi(e,127.5),1)}))},t.prototype.nameOutputResults=function(e){return{offsets:e[0],segmentation:e[1],partHeatmaps:e[2],longOffsets:e[3],heatmap:e[4],displacementFwd:e[5],displacementBwd:e[6],partOffsets:e[7]}},t}(xy),Sy=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],Ey=Sy.length,Ny=Sy.reduce((function(e,t,n){return e[t]=n,e}),{});function Ty(e,t,n){var r=e[0],a=e[1],o=t[0],s=t[1],i=n.top,u=n.bottom;return[s/(n.left+n.right+a),o/(i+u+r)]}function _y(e,t,n,r){return{y:r.get(e,t,n),x:r.get(e,t,n+Ey)}}function Ay(e,t,n){var r=_y(e.heatmapY,e.heatmapX,e.id,n),a=r.y,o=r.x;return{x:e.heatmapX*t+o,y:e.heatmapY*t+a}}function Iy(e,t,n){return en?n:e}function My(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Oy(e,t,n){void 0===n&&(n=.3);for(var r=0,a=0,o=0;on&&(a+=1,r+=Math.pow(e[o].x-t.keypoints[o].position.x,2)+Math.pow(e[o].y-t.keypoints[o].position.y,2));return 0===a?r=1/0:r/=a,r}function Dy(e,t,n,r,a,o,s){for(var i=s[0],u=s[1],l=n(e),c=l.y*r+l.x,p=a[Ey*(2*c)+t],d=a[Ey*(2*c+1)+t],f=e.y+p,h=e.x+d,m=0;m "+l+") {\n numKpt = numKpt + 1;\n curDistSum = curDistSum + dist(x, y, poseX, poseY);\n }\n }\n if (numKpt > 0 && curDistSum / float(numKpt) < minDist) {\n minDist = curDistSum / float(numKpt);\n iMin = i;\n }\n }\n return iMin;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int nearestPose = findNearestPose(coords[0], coords[1]);\n setOutput(float(nearestPose));\n }\n "};return gi().compileAndRun(C,[e,v,M])}function Fy(){return"webgl"===pi()}function Py(e,t,n,r,a,o,s,i,u,l,c,p){var d=s[0],f=s[1];return void 0===u&&(u=.2),void 0===l&&(l=8),void 0===c&&(c=.3),void 0===p&&(p=10),py(this,void 0,void 0,(function(){var s,h,m,g,y;return dy(this,(function(b){switch(b.label){case 0:return s=n.filter((function(e){return e.score>=u})),Fy()?(m=oi((function(){var n=Ry(e,t,s,r,a,o,[d,f],i,l,c,p),u=ni().makeTensorFromDataId(n.dataId,n.shape,n.dtype);return s.map((function(e,t){return function(e,t){return oi((function(){return Ks(Fc(e,Di(t)),"int32")}))}(u,t)}))})),[4,Promise.all(m.map((function(e){return e.data()})))]):[3,2];case 1:return h=b.sent(),m.forEach((function(e){return e.dispose()})),[3,5];case 2:return[4,e.data()];case 3:return g=b.sent(),[4,t.data()];case 4:y=b.sent(),h=function(e,t,n,r,a,o,s,i,u,l){var c=s[0],p=s[1];void 0===l&&(l=5);for(var d=n.map((function(e){return new Uint8Array(r*a).fill(0)})),f=i.top,h=i.left,m=Ty([r,a],[c,p],i),g=m[0],y=m[1],b=$y([c,p],o)[0],v=0;v=0&&(d[k][x]=1)}}return d}(g,y,s,r,a,o,[d,f],i,l),b.label=5;case 5:return[2,h.map((function(e,t){return{data:e,pose:s[t],width:a,height:r}}))]}}))}))}function Ly(e,t,n,r,a,o,s,i,u,l,c,p,d){var f=i[0],h=i[1];return void 0===l&&(l=.2),void 0===c&&(c=8),void 0===p&&(p=.3),void 0===d&&(d=10),py(this,void 0,void 0,(function(){var i,m,g,y,b,v;return dy(this,(function(w){switch(w.label){case 0:return i=r.filter((function(e){return e.score>=l})),Fy()?(g=oi((function(){var r=Ry(e,t,i,a,o,s,[f,h],u,c,p,d),l=ni().makeTensorFromDataId(r.dataId,r.shape,r.dtype);return i.map((function(e,t){return function(e,t,n){return oi((function(){return Wi(xi(Ks(Fc(e,Di(n)),"int32"),bi(t,1)),1)}))}(l,n,t)}))})),[4,Promise.all(g.map((function(e){return e.data()})))]):[3,2];case 1:return m=w.sent(),g.forEach((function(e){return e.dispose()})),[3,6];case 2:return[4,e.data()];case 3:return y=w.sent(),[4,t.data()];case 4:return b=w.sent(),[4,n.data()];case 5:v=w.sent(),m=function(e,t,n,r,a,o,s,i,u,l,c){var p=i[0],d=i[1];void 0===c&&(c=5);for(var f=r.map((function(e){return new Int32Array(a*o).fill(-1)})),h=u.top,m=u.left,g=Ty([a,o],[p,d],u),y=g[0],b=g[1],v=$y([p,d],s)[0],w=0;w=0&&(f[S][k]=n[k])}}return f}(y,b,v,i,a,o,s,[f,h],u,c),w.label=6;case 6:return[2,m.map((function(e,t){return{pose:i[t],data:e,height:a,width:o}}))]}}))}))}function zy(e){return Math.floor(e/2)}[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]].map((function(e){var t=e[0],n=e[1];return[Ny[t],Ny[n]]}));var By=function(){function e(e,t){this.priorityQueue=new Array(e),this.numberOfElements=-1,this.getElementValue=t}return e.prototype.enqueue=function(e){this.priorityQueue[++this.numberOfElements]=e,this.swim(this.numberOfElements)},e.prototype.dequeue=function(){var e=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,e},e.prototype.empty=function(){return-1===this.numberOfElements},e.prototype.size=function(){return this.numberOfElements+1},e.prototype.all=function(){return this.priorityQueue.slice(0,this.numberOfElements+1)},e.prototype.max=function(){return this.priorityQueue[0]},e.prototype.swim=function(e){for(;e>0&&this.less(zy(e),e);)this.exchange(e,zy(e)),e=zy(e)},e.prototype.sink=function(e){for(;2*e<=this.numberOfElements;){var t=2*e;if(tt){l=!1;break}if(!l)break}return l}var Uy=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]].map((function(e){var t=e[0],n=e[1];return[Ny[t],Ny[n]]})),jy=Uy.map((function(e){return e[1]})),Wy=Uy.map((function(e){return e[0]}));function Hy(e,t,n,r){return{y:Iy(Math.round(e.y/t),0,n-1),x:Iy(Math.round(e.x/t),0,r-1)}}function qy(e,t,n,r,a,o,s,i){void 0===i&&(i=2);for(var u=r.shape,l=u[0],c=u[1],p=function(e,t,n){var r=n.shape[2]/2;return{y:n.get(t.y,t.x,e),x:n.get(t.y,t.x,r+e)}}(e,Hy(t.position,o,l,c),s),d=My(t.position,p),f=0;f=0;--d){var f=jy[d],h=Wy[d];u[f]&&!u[h]&&(u[h]=qy(d,u[f],h,t,n,r,o))}for(d=0;d=.1,(function(){return"inputResolution must be a string or number between 0.1 and 2, but was "+e})),e}(e);return[rb(r*o,t),rb(a*o,t)]}function ib(e,t,n,r,a){var o=t[0],s=t[1],i=n[0],u=n[1],l=r[0],c=l[0],p=l[1],d=r[1],f=d[0],h=d[1];return void 0===a&&(a=!1),oi((function(){var t=Ah.resizeBilinear(e,[i,u],!0);return a&&(t=tc(t)),function(e,t,n){var r=t[0],a=t[1],o=n[0],s=o[0],i=o[1],u=n[1],l=u[0],c=u[1];return oi((function(){var t=op(e);return qd(Ah.cropAndResize(t,[[s/(r+s+i-1),l/(a+l+c-1),(s+r-1)/(r+s+i-1),(l+a-1)/(a+l+c-1)]],[0],[r,a]),[0])}))}(t,[o,s],[[c,p],[f,h]])}))}function ub(e,t){var n=t[0],r=t[1],a=nb(e),o=a[0],s=a[1],i=r/n,u=[0,0,0,0],l=u[0],c=u[1],p=u[2],d=u[3];s/o1)throw new Error("segmentationThreshold "+t+". Should be in range [0.0, 1.0]");if(n<=0)throw new Error("Invalid maxDetections "+n+". Should be > 0");if(r<0||r>1)throw new Error("Invalid scoreThreshold "+r+". Should be in range [0.0, 1.0]");if(a<=0)throw new Error("Invalid nmsRadius "+a+".")}function vb(e){var t=e.segmentationThreshold,n=e.maxDetections,r=e.scoreThreshold,a=e.nmsRadius,o=e.minKeypointScore,s=e.refineSteps;if(t<0||t>1)throw new Error("segmentationThreshold "+t+". Should be in range [0.0, 1.0]");if(n<=0)throw new Error("Invalid maxDetections "+n+". Should be > 0");if(r<0||r>1)throw new Error("Invalid scoreThreshold "+r+". Should be in range [0.0, 1.0]");if(a<=0)throw new Error("Invalid nmsRadius "+a+".");if(o<0||o>1)throw new Error("Invalid minKeypointScore "+o+".Should be in range [0.0, 1.0]");if(s<=0||s>20)throw new Error("Invalid refineSteps "+s+".Should be in range [1, 20]")}var wb=function(){function e(e){this.baseModel=e}return e.prototype.predictForPersonSegmentation=function(e){var t=this.baseModel.predict(e);return{segmentLogits:t.segmentation,heatmapScores:t.heatmapScores,offsets:t.offsets,displacementFwd:t.displacementFwd,displacementBwd:t.displacementBwd}},e.prototype.predictForPersonSegmentationAndPart=function(e){var t=this.baseModel.predict(e);return{segmentLogits:t.segmentation,partHeatmapLogits:t.partHeatmaps,heatmapScores:t.heatmapScores,offsets:t.offsets,displacementFwd:t.displacementFwd,displacementBwd:t.displacementBwd}},e.prototype.predictForMultiPersonInstanceSegmentationAndPart=function(e){var t=this.baseModel.predict(e);return{segmentLogits:t.segmentation,longOffsets:t.longOffsets,heatmapScores:t.heatmapScores,offsets:t.offsets,displacementFwd:t.displacementFwd,displacementBwd:t.displacementBwd,partHeatmaps:t.partHeatmaps}},e.prototype.segmentPersonActivation=function(e,t,n){var r=this;void 0===n&&(n=.5);var a=nb(e),o=a[0],s=a[1],i=sb(t,this.baseModel.outputStride,[o,s]),u=ub(e,i),l=u.resized,c=u.padding,p=oi((function(){var e=r.predictForPersonSegmentation(l),t=e.segmentLogits,a=e.heatmapScores,i=e.offsets,u=e.displacementFwd,p=e.displacementBwd,d=l.shape,f=d[0],h=d[1],m=ib(t,[o,s],[f,h],[[c.top,c.bottom],[c.left,c.right]],!0);return{segmentation:vy(qd(m),n),heatmapScores:a,offsets:i,displacementFwd:u,displacementBwd:p}})),d=p.segmentation,f=p.heatmapScores,h=p.offsets,m=p.displacementFwd,g=p.displacementBwd;return l.dispose(),{segmentation:d,heatmapScores:f,offsets:h,displacementFwd:m,displacementBwd:g,padding:c,internalResolutionHeightAndWidth:i}},e.prototype.segmentPerson=function(e,t){return void 0===t&&(t=gb),py(this,void 0,void 0,(function(){var n,r,a,o,s,i,u,l,c,p,d,f,h,m,g,y,b,v;return dy(this,(function(w){switch(w.label){case 0:return bb(t=cy(cy({},gb),t)),n=this.segmentPersonActivation(e,t.internalResolution,t.segmentationThreshold),r=n.segmentation,a=n.heatmapScores,o=n.offsets,s=n.displacementFwd,i=n.displacementBwd,u=n.padding,l=n.internalResolutionHeightAndWidth,c=r.shape,p=c[0],d=c[1],[4,r.data()];case 1:return f=w.sent(),r.dispose(),[4,lb([a,o,s,i])];case 2:return h=w.sent(),m=h[0],g=h[1],y=h[2],b=h[3],v=cb(v=Yy(m,g,y,b,this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[p,d],l,u,!1),a.dispose(),o.dispose(),s.dispose(),i.dispose(),[2,{height:p,width:d,data:f,allPoses:v}]}}))}))},e.prototype.segmentMultiPerson=function(e,t){return void 0===t&&(t=yb),py(this,void 0,void 0,(function(){var n,r,a,o,s,i,u,l,c,p,d,f,h,m,g,y,b,v,w,x,k,S=this;return dy(this,(function(E){switch(E.label){case 0:return vb(t=cy(cy({},yb),t)),n=nb(e),r=n[0],a=n[1],o=sb(t.internalResolution,this.baseModel.outputStride,[r,a]),s=ub(e,o),i=s.resized,u=s.padding,l=oi((function(){var e,n=S.predictForMultiPersonInstanceSegmentationAndPart(i),s=n.segmentLogits,l=n.longOffsets,c=n.heatmapScores,p=n.offsets,d=n.displacementFwd,f=n.displacementBwd,h=ib(s,[r,a],o,[[u.top,u.bottom],[u.left,u.right]],!0);return e=l,{segmentation:vy(qd(h),t.segmentationThreshold),longOffsets:e,heatmapScoresRaw:c,offsetsRaw:p,displacementFwdRaw:d,displacementBwdRaw:f}})),c=l.segmentation,p=l.longOffsets,d=l.heatmapScoresRaw,f=l.offsetsRaw,h=l.displacementFwdRaw,m=l.displacementBwdRaw,[4,lb([d,f,h,m])];case 1:return g=E.sent(),y=g[0],b=g[1],v=g[2],w=g[3],x=cb(x=Yy(y,b,v,w,this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[r,a],o,u,!1),[4,Py(c,p,x,r,a,this.baseModel.outputStride,o,u,t.scoreThreshold,t.refineSteps,t.minKeypointScore,t.maxDetections)];case 2:return k=E.sent(),i.dispose(),c.dispose(),p.dispose(),d.dispose(),f.dispose(),h.dispose(),m.dispose(),[2,k]}}))}))},e.prototype.segmentPersonPartsActivation=function(e,t,n){var r=this;void 0===n&&(n=.5);var a=nb(e),o=a[0],s=a[1],i=sb(t,this.baseModel.outputStride,[o,s]),u=ub(e,i),l=u.resized,c=u.padding,p=oi((function(){var e=r.predictForPersonSegmentationAndPart(l),t=e.segmentLogits,a=e.partHeatmapLogits,i=e.heatmapScores,u=e.offsets,p=e.displacementFwd,d=e.displacementBwd,f=l.shape,h=f[0],m=f[1],g=ib(t,[o,s],[h,m],[[c.top,c.bottom],[c.left,c.right]],!0),y=ib(a,[o,s],[h,m],[[c.top,c.bottom],[c.left,c.right]],!0);return{partSegmentation:wy(vy(qd(g),n),y),heatmapScores:i,offsets:u,displacementFwd:p,displacementBwd:d}})),d=p.partSegmentation,f=p.heatmapScores,h=p.offsets,m=p.displacementFwd,g=p.displacementBwd;return l.dispose(),{partSegmentation:d,heatmapScores:f,offsets:h,displacementFwd:m,displacementBwd:g,padding:c,internalResolutionHeightAndWidth:i}},e.prototype.segmentPersonParts=function(e,t){return void 0===t&&(t=gb),py(this,void 0,void 0,(function(){var n,r,a,o,s,i,u,l,c,p,d,f,h,m,g,y,b,v;return dy(this,(function(w){switch(w.label){case 0:return bb(t=cy(cy({},gb),t)),n=this.segmentPersonPartsActivation(e,t.internalResolution,t.segmentationThreshold),r=n.partSegmentation,a=n.heatmapScores,o=n.offsets,s=n.displacementFwd,i=n.displacementBwd,u=n.padding,l=n.internalResolutionHeightAndWidth,c=r.shape,p=c[0],d=c[1],[4,r.data()];case 1:return f=w.sent(),r.dispose(),[4,lb([a,o,s,i])];case 2:return h=w.sent(),m=h[0],g=h[1],y=h[2],b=h[3],v=cb(v=Yy(m,g,y,b,this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[p,d],l,u,!1),a.dispose(),o.dispose(),s.dispose(),i.dispose(),[2,{height:p,width:d,data:f,allPoses:v}]}}))}))},e.prototype.segmentMultiPersonParts=function(e,t){return void 0===t&&(t=yb),py(this,void 0,void 0,(function(){var n,r,a,o,s,i,u,l,c,p,d,f,h,m,g,y,b,v,w,x,k,S,E=this;return dy(this,(function(N){switch(N.label){case 0:return vb(t=cy(cy({},yb),t)),n=nb(e),r=n[0],a=n[1],o=sb(t.internalResolution,this.baseModel.outputStride,[r,a]),s=ub(e,o),i=s.resized,u=s.padding,l=oi((function(){var e=E.predictForMultiPersonInstanceSegmentationAndPart(i),n=e.segmentLogits,s=e.longOffsets,l=e.heatmapScores,c=e.offsets,p=e.displacementFwd,d=e.displacementBwd,f=e.partHeatmaps,h=ib(n,[r,a],o,[[u.top,u.bottom],[u.left,u.right]],!0),m=ib(f,[r,a],o,[[u.top,u.bottom],[u.left,u.right]],!0),g=s,y=vy(qd(h),t.segmentationThreshold),b=function(e){var t=e.shape,n=t[0],r=t[1],a=t[2];return oi((function(){var t=by(e),o=op(bd(0,a,1,"int32"),1),s=Ks(ku(t,o),"int32");return Xl(s,[n,r])}))}(m);return{segmentation:y,longOffsets:g,heatmapScoresRaw:l,offsetsRaw:c,displacementFwdRaw:p,displacementBwdRaw:d,partSegmentation:b}})),c=l.segmentation,p=l.longOffsets,d=l.heatmapScoresRaw,f=l.offsetsRaw,h=l.displacementFwdRaw,m=l.displacementBwdRaw,g=l.partSegmentation,[4,lb([d,f,h,m])];case 1:return y=N.sent(),b=y[0],v=y[1],w=y[2],x=y[3],k=cb(k=Yy(b,v,w,x,this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[r,a],o,u,!1),[4,Ly(c,p,g,k,r,a,this.baseModel.outputStride,o,u,t.scoreThreshold,t.refineSteps,t.minKeypointScore,t.maxDetections)];case 2:return S=N.sent(),i.dispose(),c.dispose(),p.dispose(),d.dispose(),f.dispose(),h.dispose(),m.dispose(),g.dispose(),[2,S]}}))}))},e.prototype.dispose=function(){this.baseModel.dispose()},e}();function xb(e){return py(this,void 0,void 0,(function(){var t,n,r,a,o,s;return dy(this,(function(i){switch(i.label){case 0:if(t=e.outputStride,n=e.quantBytes,r=e.multiplier,null==y)throw new Error("Cannot find TensorFlow.js. If you are using a