").val(e).attr({type:"text",class:"hide-by-pos"}).appendTo(document.body);t[0].selectionStart=0,t[0].selectionEnd=e.length,t.focus(),t.on({"copy cut paste"(){setTimeout((()=>t.blur()),0)},blur(){t.remove()}})},copyHtml(e){const t=document.createElement("div");t.style.userSelect="auto",t.style.webkitUserSelect="auto",t.style.mozUserSelect="auto",t.innerHTML=e,document.body.appendChild(t);const n=document.createRange();n.selectNodeContents(t);const i=window.getSelection();i.removeAllRanges(),i.addRange(n);const s=document.execCommand("copy");return t.remove(),s}}},8132:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FeatureTester:()=>s});var i=n(667);const s={test(){return Promise.resolve().then((()=>this.checkWebAssembly())).then((()=>this.checkLocalStorage())).then((()=>this.checkWebCrypto()))},checkWebAssembly(){try{const e=new n.g.WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));return new n.g.WebAssembly.Instance(e)instanceof n.g.WebAssembly.Instance}catch(e){throw"WebAssembly is not supported"}},checkLocalStorage(){if(!i.Features.isDesktop)try{localStorage.setItem("_test","1"),localStorage.removeItem("_test")}catch(e){throw"LocalStorage is not supported"}},checkWebCrypto(){if(!n.g.crypto.subtle)throw"WebCrypto is not supported"}}},9053:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FocusDetector:()=>o});var i=n(7201),s=n(9491),r=n(667);const o={init(){this.isFocused=!0,this.detectsFocusWithEvents=!r.Features.isDesktop&&!r.Features.isMobile,this.detectsFocusWithEvents&&(window.addEventListener("focus",(()=>{o.isFocused||(o.isFocused=!0,i.Events.emit("main-window-focus"))})),window.addEventListener("blur",(()=>{o.isFocused&&(o.isFocused=!1,i.Events.emit("main-window-blur"))})))},hasFocus(){return this.detectsFocusWithEvents?this.isFocused:!s.Launcher||s.Launcher.isAppFocused()}}},5665:(e,t,n)=>{"use strict";n.r(t),n.d(t,{IdleTracker:()=>r});var i=n(7201),s=n(7614);const r={actionTime:Date.now(),init(){setInterval(this.checkIdle.bind(this),6e4)},checkIdle(){const e=(Date.now()-this.actionTime)/1e3/60,t=s.AppSettingsModel.idleMinutes;t&&e>t&&(i.Events.emit("before-user-idle"),i.Events.emit("user-idle"))},regUserAction(){this.actionTime=Date.now()}};i.Events.on("power-monitor-resume",(()=>r.checkIdle))},1164:(e,t,n)=>{"use strict";n.r(t),n.d(t,{KeyHandler:()=>c});var i=n(7201),s=n(5665),r=n(2977),o=n(4953),a=n(6718);const l=navigator.platform.indexOf("Mac")>=0?"metaKey":"ctrlKey";const c=new class{constructor(){this.SHORTCUT_ACTION=1,this.SHORTCUT_OPT=2,this.SHORTCUT_SHIFT=4,this.shortcuts={}}init(){a(document).bind("keypress",this.keypress.bind(this)),a(document).bind("keydown",this.keydown.bind(this)),this.shortcuts[r.Keys.DOM_VK_A]=[{handler:this.handleAKey,thisArg:this,shortcut:this.SHORTCUT_ACTION,modal:!0,noPrevent:!0}]}onKey(e,t,n,i,s,r){let o=this.shortcuts[e];o||(this.shortcuts[e]=o=[]),o.push({handler:t,thisArg:n,shortcut:i,modal:s,noPrevent:r})}offKey(e,t,n){this.shortcuts[e]&&(this.shortcuts[e]=this.shortcuts[e].filter((e=>e.handler!==t||e.thisArg!==n)))}isActionKey(e){return e[l]}keydown(e){s.IdleTracker.regUserAction();const t=e.keyCode||e.which,n=this.shortcuts[t];if(n&&n.length)for(const i of n){if(o.FocusManager.modal&&i.modal!==o.FocusManager.modal&&"*"!==i.modal){e.stopPropagation();continue}const n=this.isActionKey(e);switch(i.shortcut){case this.SHORTCUT_ACTION:if(!n)continue;break;case this.SHORTCUT_OPT:if(!e.altKey)continue;break;case this.SHORTCUT_SHIFT:if(!e.shiftKey)continue;break;case this.SHORTCUT_ACTION+this.SHORTCUT_OPT:if(!e.altKey||!n)continue;break;default:if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)continue}if(i.handler.call(i.thisArg,e,t),n&&!i.noPrevent&&e.preventDefault(),e.isImmediatePropagationStopped())break}}keypress(e){o.FocusManager.modal||e.which===r.Keys.DOM_VK_RETURN||e.which===r.Keys.DOM_VK_ESCAPE||e.which===r.Keys.DOM_VK_TAB||e.altKey||e.ctrlKey||e.metaKey?o.FocusManager.modal&&i.Events.emit("keypress:"+o.FocusManager.modal,e):i.Events.emit("keypress",e)}reg(){s.IdleTracker.regUserAction()}handleAKey(e){"input"===e.target.tagName.toLowerCase()&&["password","text"].indexOf(e.target.type)>=0?e.stopImmediatePropagation():e.preventDefault()}}},5358:(e,t,n)=>{"use strict";n.r(t),n.d(t,{PopupNotifier:()=>u});var i=n(7201),s=n(9491),r=n(4530),o=n(403),a=n(3297),l=n(2363),c=n(6838);const u={logger:null,init(){if(this.logger=new l.Logger("popup-notifier"),s.Launcher)window.open=c.noop;else{const e=window.open;window.open=function(...t){const n=e.apply(window,t);return n?(u.deferCheckClosed(n),i.Events.emit("popup-opened",n)):r.Alerts.alertDisplayed||r.Alerts.error({header:a.Locale.authPopupRequired,body:a.Locale.authPopupRequiredBody}),n}}},deferCheckClosed(e){setTimeout(u.checkClosed.bind(u,e),o.Timeouts.CheckWindowClosed)},checkClosed(e){if(e.closed)setTimeout(u.triggerClosed.bind(u,e),o.Timeouts.CheckWindowClosed);else{const t=u.tryGetLocationSearch(e);if(t){try{e.close()}catch(e){}return void u.triggerClosed(e,t)}u.deferCheckClosed(e)}},tryGetLocationSearch(e){try{if(e.location.host===location.host)return e.location.search}catch(e){}},triggerClosed(e,t){i.Events.emit("popup-closed",{window:e,locationSearch:t})}}},6892:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SecureInput:()=>r});var i=n(3617),s=n.n(i);const r=function(){this.el=null,this.minChar=5120+Math.round(100*Math.random()),this.maxLen=1024,this.length=0,this.pseudoValue="",this.salt=new Uint32Array(0)};r.prototype.setElement=function(e){this.el=e,this.el.val(this.pseudoValue),this.el.on("input",this._input.bind(this))},r.prototype.reset=function(){if(this.el=null,this.length=0,this.pseudoValue="",this.salt)for(let e=0;e=this.minChar&&e<=this.minChar+this.maxLen},Object.defineProperty(r.prototype,"value",{enumerable:!0,get(){const e=this.pseudoValue,t=this.salt,n=e.length;let i=0;const r=new Uint8Array(4*n),o=s().Random.getBytes(4*n);let a,l;for(let c=0;c{"use strict";n.r(t),n.d(t,{Transport:()=>a});var i=n(9491),s=n(2363),r=n(6838);const o=new s.Logger("transport"),a={httpGet(e){let t;const n=i.Launcher.req("fs");if(e.file&&(t=i.Launcher.getTempPath(e.file),n.existsSync(t)))try{if(e.cache&&n.statSync(t).size>0)return o.info("File already downloaded "+e.url),e.success(t);n.unlinkSync(t)}catch(e){n.unlink(t,r.noop)}const s=e.url.split(":")[0];o.info("GET "+e.url);const l=i.Launcher.req("url").parse(e.url);l.headers={"User-Agent":navigator.userAgent},i.Launcher.resolveProxy(e.url,(c=>{o.info("Request to "+e.url+" "+(c?"using proxy "+c.host+":"+c.port:"without proxy")),c&&(l.headers.Host=l.host,l.host=c.host,l.port=c.port,l.path=e.url),i.Launcher.req(s).get(l,(i=>{if(o.info("Response from "+e.url+": "+i.statusCode),200===i.statusCode)if(e.file){const s=n.createWriteStream(t);i.pipe(s),s.on("finish",(()=>{s.close((()=>{e.success(t)}))})),s.on("error",(t=>{e.error(t)}))}else{let t=[];i.on("data",(e=>{t.push(e)})),i.on("end",(()=>{t=window.Buffer.concat(t),e.utf8&&(t=t.toString("utf8")),e.success(t)}))}else if(i.headers.location&&[301,302].indexOf(i.statusCode)>=0){if(e.noRedirect)return e.error("Too many redirects");e.url=i.headers.location,e.noRedirect=!0,a.httpGet(e)}else e.error("HTTP status "+i.statusCode)})).on("error",(i=>{o.error("Cannot GET "+e.url,i),t&&n.unlink(t,r.noop),e.error(i)}))}))}}},1673:(e,t,n)=>{"use strict";n.r(t),n.d(t,{KdbxToHtml:()=>g});var i=n(3617),s=n.n(i),r=n(7119),o=n(9673),a=n(6098),l=n(2378),c=n(3297);const u={db:n(8737),entry:n(1421)},d=[{name:"UserName",locStr:"user"},{name:"Password",locStr:"password",protect:!0},{name:"URL",locStr:"website"},{name:"Notes",locStr:"notes"}],h={Title:!0};for(const{name:e}of d)h[e]=!0;function p(e,t,n){if(n=[...n,t],t.uuid.equals(e.meta.recycleBinUuid)||t.uuid.equals(e.meta.entryTemplatesGroup))return"";return t.entries.map((t=>m(e,t,n))).join("\n")+t.groups.map((t=>p(e,t,n))).join("\n")}function m(e,t,n){const i=n.map((e=>e.name)).join(" / "),r=[];for(const e of d){const n=f(t,e.name);n&&r.push({title:l.StringFormat.capFirst(c.Locale[e.locStr]),value:n,protect:e.protect})}for(const e of Object.keys(t.fields))if(!h[e]){const n=f(t,e);n&&r.push({title:e,value:n,protect:t.fields[e].isProtected})}const o=f(t,"Title");let p;t.times.expires&&t.times.expiryTime&&(p=a.DateFormat.dtStr(t.times.expiryTime));const m=Object.entries(t.binaries).map((([e,t])=>{if(t&&t.ref&&(t=t.value),t){t="data:application/octet-stream;base64,"+s().ByteUtils.bytesToBase64(t)}return{name:e,data:t}})).filter((e=>e.name&&e.data));return u.entry({path:i,title:o,fields:r,tags:t.tags.join(", "),created:a.DateFormat.dtStr(t.times.creationTime),modified:a.DateFormat.dtStr(t.times.lastModTime),expires:p,attachments:m})}function f(e,t){const n=e.fields[t];return n&&n.isProtected&&n.getText()||n||""}const g={convert(e,t){const n=e.groups.map((t=>p(e,t,[]))).join("\n");return u.db({name:t.name,date:a.DateFormat.dtStr(Date.now()),appLink:o.Links.Homepage,appVersion:r.RuntimeInfo.version,contentHtml:n})},entryToHtml:(e,t)=>m(0,t,[])}},6655:(e,t,n)=>{"use strict";n.r(t),n.d(t,{OtpQrReader:()=>h});var i=n(8767),s=n.n(i),r=n(7201),o=n(7027),a=n(4530),l=n(9081),c=n(667),u=n(3297);const d=new(n(2363).Logger)("otp-qr-reader");const h=new class{constructor(){this.alert=null,this.fileInput=null,this.pasteEvent=this.pasteEvent.bind(this)}read(){let e=o.Shortcuts.screenshotToClipboardShortcut();e&&(e=u.Locale.detSetupOtpAlertBodyWith.replace("{}",e));const t=c.Features.isMobile?"":u.Locale.detSetupOtpAlertBodyWith.replace("{}",o.Shortcuts.actionShortcutSymbol()+"V");this.startListenClipoard();const n=[{result:"manually",title:u.Locale.detSetupOtpManualButton,silent:!0},a.Alerts.buttons.cancel];c.Features.isMobile&&n.unshift({result:"select",title:u.Locale.detSetupOtpScanButton});const i=c.Features.isMobile?u.Locale.detSetupOtpAlertBody3Mobile:u.Locale.detSetupOtpAlertBody3.replace("{}",t||"");this.alert=a.Alerts.alert({icon:"qrcode",header:u.Locale.detSetupOtpAlert,body:[u.Locale.detSetupOtpAlertBody,u.Locale.detSetupOtpAlertBody1,u.Locale.detSetupOtpAlertBody2.replace("{}",e||""),i,u.Locale.detSetupOtpAlertBody4].join("\n"),esc:"",click:"",enter:"",buttons:n,complete:e=>{this.alert=null,this.stopListenClipboard(),"select"===e?this.selectFile():"manually"===e&&this.enterManually()}})}selectFile(){if(!this.fileInput){const e=document.createElement("input");e.setAttribute("type","file"),e.setAttribute("capture","camera"),e.setAttribute("accept","image/*"),e.setAttribute("class","hide-by-pos"),this.fileInput=e,this.fileInput.onchange=this.fileSelected}this.fileInput.click()}fileSelected(){const e=this.fileInput.files[0];!e||e.type.indexOf("image")<0||this.readFile(e)}startListenClipoard(){document.addEventListener("paste",this.pasteEvent)}stopListenClipboard(){document.removeEventListener("paste",this.pasteEvent)}pasteEvent(e){const t=[...e.clipboardData.items].find((e=>"file"===e.kind&&-1!==e.type.indexOf("image")));t?(d.info("Reading pasted image",t.type),this.alert&&this.alert.change({header:u.Locale.detOtpImageReading}),this.readFile(t.getAsFile())):d.debug("Paste without file")}readFile(e){const t=new FileReader;t.onload=()=>{d.debug("Image data loaded"),this.readQr(t.result)},t.readAsDataURL(e)}readQr(e){const t=new Image;t.onload=()=>{d.debug("Image format loaded");try{const e=d.ts(),n=new(s())(t).decode();d.info("QR code read",d.ts(e)),this.removeAlert();try{const e=l.Otp.parseUrl(n);r.Events.emit("qr-read",e)}catch(e){d.error("Error parsing QR code",e),a.Alerts.error({header:u.Locale.detOtpQrWrong,body:u.Locale.detOtpQrWrongBody,pre:e.toString()})}}catch(e){d.error("Error reading QR code",e),this.removeAlert(),a.Alerts.error({header:u.Locale.detOtpQrError,body:u.Locale.detOtpQrErrorBody})}},t.onerror=()=>{d.debug("Image load error"),this.removeAlert(),a.Alerts.error({header:u.Locale.detOtpImageError,body:u.Locale.detOtpImageErrorBody})},t.src=e}enterManually(){r.Events.emit("qr-enter-manually")}removeAlert(){this.alert&&this.alert.closeImmediate()}}},6098:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DateFormat:()=>r});var i=n(111),s=n(2378);const r={months(){const e=new Intl.DateTimeFormat(i.SettingsManager.activeLocale,{month:"long"}),t=[];for(let n=0;n<12;n++)t.push(e.format(new Date(2008,n)));return t},weekDays(){const e=new Intl.DateTimeFormat(i.SettingsManager.activeLocale,{weekday:"long"}),t=[];for(let n=1;n<8;n++)t.push(e.format(new Date(2007,9,6+n)));return t},shortWeekDays(){const e=new Intl.DateTimeFormat(i.SettingsManager.activeLocale,{weekday:"short"}),t=[];for(let n=1;n<8;n++)t.push(e.format(new Date(Date.UTC(2007,9,6+n))));return t},dtStr:e=>("number"==typeof e&&(e=new Date(e)),e?new Intl.DateTimeFormat(i.SettingsManager.activeLocale,{dateStyle:"medium",timeStyle:"medium"}).format(e):""),dStr:e=>("number"==typeof e&&(e=new Date(e)),e?new Intl.DateTimeFormat(i.SettingsManager.activeLocale,{year:"numeric",month:"short",day:"numeric"}).format(e):""),dtStrFs:e=>("number"==typeof e&&(e=new Date(e)),e?e.getFullYear()+"-"+s.StringFormat.pad(e.getMonth()+1,2)+"-"+s.StringFormat.pad(e.getDate(),2)+"T"+s.StringFormat.pad(e.getHours(),2)+"-"+s.StringFormat.pad(e.getMinutes(),2)+"-"+s.StringFormat.pad(e.getSeconds(),2):"")}},9491:(e,t,n)=>{"use strict";let i;n.r(t),n.d(t,{Launcher:()=>i}),window.process&&window.process.versions&&window.process.versions.electron&&(i=n(547).Launcher)},547:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Launcher:()=>u});var i=n(7201),s=n(8578),r=n(7119),o=n(3297),a=n(2363),l=n(6838);const c=new a.Logger("launcher"),u={name:"electron",version:window.process.versions.electron,autoTypeSupported:!0,thirdPartyStoragesSupported:!0,clipboardSupported:!0,req:window.require,platform:()=>process.platform,electron(){return this.req("electron")},remoteApp(){return this.electron().remote.app},remReq(e){return this.electron().remote.require(e)},openLink(e){/^(http|https|ftp|sftp|mailto):/i.test(e)&&this.electron().shell.openExternal(e)},devTools:!0,openDevTools(){this.electron().remote.getCurrentWindow().webContents.openDevTools({mode:"bottom"})},getSaveFileName(e,t){if(e){const t=this.remReq("electron").app.getPath("userDesktop");e=this.joinPath(t,e)}this.remReq("electron").dialog.showSaveDialog({title:o.Locale.launcherSave,defaultPath:e,filters:[{name:o.Locale.launcherFileFilter,extensions:["kdbx"]}]}).then((e=>t(e.filePath)))},getUserDataPath(e){return this.userDataPath||(this.userDataPath=this.remoteApp().getPath("userData")),this.joinPath(this.userDataPath,e||"")},getTempPath(e){return this.joinPath(this.remoteApp().getPath("temp"),e||"")},getDocumentsPath(e){return this.joinPath(this.remoteApp().getPath("documents"),e||"")},getAppPath(e){const t=this.req("path").dirname,n=__dirname.endsWith("app.asar")?__dirname:this.remoteApp().getAppPath();return this.joinPath(t(n),e||"")},getWorkDirPath(e){return this.joinPath(process.cwd(),e||"")},joinPath(...e){return this.req("path").join(...e)},writeFile(e,t,n){this.req("fs").writeFile(e,window.Buffer.from(t),n)},readFile(e,t,n){this.req("fs").readFile(e,t,((e,t)=>{const i="string"==typeof t?t:new Uint8Array(t);n(i,e)}))},fileExists(e,t){const n=this.req("fs");n.access(e,n.constants.F_OK,(e=>t(!e)))},fileExistsSync(e){const t=this.req("fs");return!t.accessSync(e,t.constants.F_OK)},deleteFile(e,t){this.req("fs").unlink(e,t||l.noop)},statFile(e,t){this.req("fs").stat(e,((e,n)=>t(n,e)))},mkdir(e,t){const n=this.req("fs"),i=this.req("path"),s=[],r=function(e,t,s){n.exists(e,(n=>{if(n)return s();t.unshift(e);const o=i.dirname(e);if(o===e||!o||"."===o||"/"===o)return s();r(o,t,s)}))},o=function(e,t){if(!e.length)return t();n.mkdir(e.shift(),(n=>n?t(n):o(e,t)))};r(e,s,(()=>o(s,t)))},parsePath(e){const t=this.req("path");return{path:e,dir:t.dirname(e),file:t.basename(e)}},createFsWatcher(e){return this.req("fs").watch(e,{persistent:!1})},loadConfig(e){return this.remoteApp().loadConfig(e)},saveConfig(e,t){return this.remoteApp().saveConfig(e,t)},ensureRunnable(e){if("win32"!==process.platform){const t=this.req("fs"),n=t.statSync(e);if(0==(73&n.mode)){const i=64|n.mode;c.info(`chmod 0${i.toString(8)} ${e}`),t.chmodSync(e,i)}}},preventExit:e=>(e.returnValue=!1,!1),exit(){this.exitRequested=!0,this.requestExit()},requestExit(){const e=this.remoteApp();e.setHookBeforeQuitEvent(!1),this.restartPending?e.restartApp():e.quit()},requestRestart(){this.restartPending=!0,this.requestExit()},cancelRestart(){this.restartPending=!1},setClipboardText(e){return this.electron().clipboard.writeText(e)},getClipboardText(){return this.electron().clipboard.readText()},clearClipboardText(){const{clipboard:e}=this.electron();e.clear(),"linux"===process.platform&&e.clear("selection")},quitOnRealQuitEventIfMinimizeOnQuitIsEnabled(){return"darwin"===this.platform()},minimizeApp(){this.remoteApp().minimizeApp({restore:o.Locale.menuRestoreApp.replace("{}","KeeWeb"),quit:o.Locale.menuQuitApp.replace("{}","KeeWeb")})},canDetectOsSleep:()=>"linux"!==process.platform,updaterEnabled(){return-1===this.electron().remote.process.argv.indexOf("--disable-updater")},getMainWindow(){return this.remoteApp().getMainWindow()},resolveProxy(e,t){this.getMainWindow().webContents.session.resolveProxy(e).then((e=>{const n=/^proxy\s+([\w\.]+):(\d+)+\s*/i.exec(e);e=n&&n[1]?{host:n[1],port:+n[2]}:null,t(e)}))},hideApp(){const e=this.remoteApp();"darwin"===this.platform()?e.hide():e.minimizeThenHideIfInTray()},isAppFocused(){return!!this.electron().remote.BrowserWindow.getFocusedWindow()},showMainWindow(){this.remoteApp().showAndFocusMainWindow()},spawn(e){const t=c.ts();let n=e.complete;const i=this.req("child_process").spawn(e.cmd,e.args);[i.stdin,i.stdout,i.stderr].forEach((e=>e.setEncoding("utf-8")));let s="",r="";if(i.stderr.on("data",(t=>{if(s+=t.toString("utf-8"),e.throwOnStdErr)try{i.kill()}catch(e){}})),i.stdout.on("data",(e=>{r+=e.toString("utf-8")})),i.on("close",(i=>{r=r.trim(),s=s.trim();const o="spawn "+e.cmd+": "+i+", "+c.ts(t);0!==i?c.error(o+"\n"+r+"\n"+s):c.info(o+(r&&!e.noStdOutLogging?"\n"+r:"")),n&&(n(0!==i?"Exit code "+i:null,r,i),n=null)})),i.on("error",(i=>{c.error("spawn error: "+e.cmd+", "+c.ts(t),i),n&&(n(i),n=null)})),e.data)try{i.stdin.end(e.data)}catch(e){c.error("spawn write error",e)}return process.nextTick((()=>{i.stdin.destroy()})),i},checkOpenFiles(){this.readyToOpenFiles=!0,this.pendingFileToOpen&&(this.openFile(this.pendingFileToOpen),delete this.pendingFileToOpen)},openFile(e){this.readyToOpenFiles?i.Events.emit("launcher-open-file",e):this.pendingFileToOpen=e},setGlobalShortcuts(e){this.remoteApp().setGlobalShortcuts(e)}};i.Events.on("launcher-exit-request",(()=>{setTimeout((()=>u.exit()),0)})),i.Events.on("launcher-minimize",(()=>setTimeout((()=>i.Events.emit("app-minimized")),0))),i.Events.on("launcher-started-minimized",(()=>setTimeout((()=>u.minimizeApp()),0))),i.Events.on("start-profile",(e=>s.StartProfiler.reportAppProfile(e))),i.Events.on("log",(e=>new a.Logger(e.category||"remote-app")[e.method||"info"](e.message))),window.launcherOpen=e=>u.openFile(e),window.launcherOpenedFile&&(c.info("Open file request",window.launcherOpenedFile),u.openFile(window.launcherOpenedFile),delete window.launcherOpenedFile),i.Events.on("app-ready",(()=>setTimeout((()=>{u.checkOpenFiles(),u.remoteApp().setAboutPanelOptions({applicationVersion:r.RuntimeInfo.version,version:r.RuntimeInfo.commit})}),0))),"darwin"===process.platform&&u.remoteApp().setHookBeforeQuitEvent(!0),u.remoteApp().on("remote-app-event",(e=>{window.debugRemoteAppEvents&&c.debug("remote-app-event",e.name),i.Events.emit(e.name,e.data)}))},3006:(e,t,n)=>{"use strict";n.r(t),n.d(t,{NativeModules:()=>a});var i=n(7201),s=n(2363),r=n(9491),o=n(403);let a;if(r.Launcher){const e=new s.Logger("native-module-connector");let t,n=0,l={},c={};const u={yubikeys(e){i.Events.emit("native-modules-yubikeys",{numYubiKeys:e})},log(...t){e.info("Message from host",...t)},result({callId:t,result:n,error:i}){const s=l[t];s&&(delete l[t],i?(e.error("Received an error",s.cmd,i),s.reject(i)):s.resolve(n))},"yk-chal-resp-result"({callbackId:e,error:t,result:n}){const i=c[e];if(i){t&&t.touchRequested||delete c[e],i(t,n)}}};a={startHost(){if(t)return;e.debug("Starting native module host");const n=r.Launcher.req("path"),i=r.Launcher.remoteApp().getAppContentRoot(),s=n.join(i,"native-module-host.js"),{fork:o}=r.Launcher.req("child_process");t=o(s),t.on("message",(e=>this.hostCallback(e))),t.on("error",(e=>this.hostError(e))),t.on("exit",((e,t)=>this.hostExit(e,t))),this.call("init",r.Launcher.remoteApp().getAppMainRoot()),this.usbListenerRunning&&this.call("start-usb")},hostError(t){e.error("Host error",t)},hostExit(n,i){e.error(`Host exited with code ${n} and signal ${i}`),t=null;const s=new Error("Native module host crashed");for(const e of Object.values(l))e.reject(s);l={};for(const e of Object.values(c))e(s);c={},0!==n&&this.autoRestartHost()},hostCallback(t){const{cmd:n,args:i}=t;u[n]?u[n](...i):e.error("No callback",n)},autoRestartHost(){setTimeout((()=>{try{this.startHost()}catch(t){e.error("Native module host failed to auto-restart",t)}}),o.Timeouts.NativeModuleHostRestartTime)},call(e,...i){return new Promise(((s,r)=>{if(!t)try{this.startHost()}catch(e){return r(e)}n++,n===Number.MAX_SAFE_INTEGER&&(n=1),l[n]={cmd:e,resolve:s,reject:r},t.send({cmd:e,args:i,callId:n})}))},startUsbListener(){this.call("start-usb"),this.usbListenerRunning=!0},stopUsbListener(){this.usbListenerRunning=!1,t&&this.call("stop-usb")},getYubiKeys(e){return this.call("get-yubikeys",e)},yubiKeyChallengeResponse(e,t,i,s){return c[n]=s,this.call("yk-chal-resp",e,t,i,n)},yubiKeyCancelChallengeResponse(){t&&this.call("yk-cancel-chal-resp")},argon2(e,t,n){return this.call("argon2",e,t,n)}}}},111:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsManager:()=>o});var i=n(7201),s=n(667),r=n(3297);const o={neutralLocale:null,activeLocale:"en-US",activeTheme:null,allLocales:{"en-US":"English","de-DE":"Deutsch","fr-FR":"Français"},allThemes:{dark:"setGenThemeDark",light:"setGenThemeLight",fb:"setGenThemeFb",db:"setGenThemeDb",sd:"setGenThemeSd",sl:"setGenThemeSl",te:"setGenThemeTe",hc:"setGenThemeHc"},customLocales:{},setBySettings(e){this.setTheme(e.theme),this.setFontSize(e.fontSize);const t=e.locale;try{t?this.setLocale(e.locale):this.setLocale(this.getBrowserLocale())}catch(e){}},getDefaultTheme:()=>"dark",setTheme(e){if(!e){if(this.activeTheme)return;e=this.getDefaultTheme()}for(const e of document.body.classList)/^th-/.test(e)&&document.body.classList.remove(e);document.body.classList.add(this.getThemeClass(e));const t=document.head.querySelector("meta[name=theme-color]");t&&(t.content=window.getComputedStyle(document.body).backgroundColor),this.activeTheme=e},getThemeClass:e=>"th-"+e,setFontSize(e){const t=s.Features.isMobile?14:12;document.documentElement.style.fontSize=t+2*(e||0)+"px"},setLocale(e){if(!e||e===this.activeLocale)return;let t;"en-US"!==e&&(t=this.customLocales[e]?this.customLocales[e]:n(3267)("./"+e+".json")),this.neutralLocale||(this.neutralLocale=Object.assign({},r.Locale)),Object.assign(r.Locale,this.neutralLocale,t),this.activeLocale=e,i.Events.emit("set-locale",e)},getBrowserLocale(){const e=navigator.languages&&navigator.languages[0]||navigator.language;return e&&e.startsWith("en")?"en-US":e}}},6524:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsStore:()=>o});var i=n(9491),s=n(2378);const r=new(n(2363).Logger)("settings"),o={load(e){let t;return t=i.Launcher?i.Launcher.loadConfig(e):Promise.resolve().then((()=>localStorage[s.StringFormat.camelCase(e)])),t.then((e=>e?JSON.parse(e):null)).catch((t=>{r.error(`Error loading ${e}`,t)}))},save:(e,t)=>i.Launcher?i.Launcher.saveConfig(e,JSON.stringify(t)).catch((t=>{r.error(`Error saving ${e}`,t)})):Promise.resolve().then((()=>{"undefined"!=typeof localStorage&&(localStorage[s.StringFormat.camelCase(e)]=JSON.stringify(t))}))}},4530:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Alerts:()=>r});var i=n(3297),s=n(5266);const r={alertDisplayed:!1,buttons:{ok:{result:"yes",get title(){return i.Locale.alertOk}},yes:{result:"yes",get title(){return i.Locale.alertYes}},no:{result:"",get title(){return i.Locale.alertNo}},cancel:{result:"",get title(){return i.Locale.alertCancel}}},alert(e){if(e.skipIfAlertDisplayed&&r.alertDisplayed)return null;r.alertDisplayed=!0;const t=new s.ModalView(e);return t.render(),t.once("result",((t,n)=>{t&&e.success&&e.success(t,n),!t&&e.cancel&&e.cancel(),e.complete&&e.complete(t,n)})),t.on("will-close",(()=>{r.alertDisplayed=!1})),t},notImplemented(){this.alert({header:i.Locale.notImplemented,body:"",icon:"exclamation-triangle",buttons:[this.buttons.ok],esc:"",click:"",enter:""})},info(e){this.alert(Object.assign({header:"",body:"",icon:"info",buttons:[this.buttons.ok],esc:"",click:"",enter:""},e))},error(e){this.alert(Object.assign({header:"",body:"",icon:"exclamation-circle",buttons:[this.buttons.ok],esc:"",click:"",enter:""},e))},yesno(e){this.alert(Object.assign({header:"",body:"",icon:"question",buttons:[this.buttons.yes,this.buttons.no],esc:"",click:"",enter:"yes"},e))}}},5754:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DropboxApps:()=>i,GDriveApps:()=>s,OneDriveApps:()=>r});const i={AppFolder:{id:"qp7ctun6qt5n9d6",secret:"07s5r4ck1uvlj6a"},FullDropbox:{id:"eor7hvv6u6oslq9",secret:"ez04o1iwf6yprq3"}},s={Local:{id:"783608538594-36tkdh8iscrq8t8dq87gghubnhivhjp5.apps.googleusercontent.com",secret:"yAtyfc9TIQ9GyQgQmo3i0HAP"},Production:{id:"847548101761-koqkji474gp3i2gn3k5omipbfju7pbt1.apps.googleusercontent.com",secret:"42HeSBybXDZjvweotq4o4CkJ"},Desktop:{id:"847548101761-h2pcl2p6m1tssnlqm0vrm33crlveccbr.apps.googleusercontent.com",secret:"nTSCiqXtUNmURIIdASaC1TJK"}},r={Local:{id:"b97c53d5-db5b-4124-aab9-d39195293815"},Production:{id:"bbc74d1b-3a9c-46e6-9da4-4c645e830923"},Desktop:{id:"bbc74d1b-3a9c-46e6-9da4-4c645e830923",secret:"aOMJaktJEAs_Tmh]fx4iQ[Zd3mp3KK7-"}}},7017:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Colors:()=>i});const i={AllColors:["yellow","green","red","orange","blue","violet"],ColorsValues:{yellow:"ffff00",green:"00ff00",red:"ff0000",orange:"ff8800",blue:"0000ff",violet:"ff00ff"},BgColors:{yellow:"ffff88",green:"88ff88",red:"ff8888",orange:"ffcc88",blue:"8888ff",violet:"ff88ff"}}},4491:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DefaultAppSettings:()=>i});const i={theme:null,locale:null,expandGroups:!0,listViewWidth:null,menuViewWidth:null,tagsViewHeight:null,autoUpdate:"install",clipboardSeconds:0,autoSave:!0,autoSaveInterval:0,rememberKeyFiles:"path",idleMinutes:15,minimizeOnClose:!1,tableView:!1,colorfulIcons:!1,useMarkdown:!0,directAutotype:!0,titlebarStyle:"default",lockOnMinimize:!0,lockOnCopy:!1,lockOnAutoType:!1,lockOnOsLock:!1,helpTipCopyShown:!1,templateHelpShown:!1,skipOpenLocalWarn:!1,hideEmptyFields:!1,skipHttpsWarning:!1,demoOpened:!1,fontSize:0,tableViewColumns:null,generatorPresets:null,generatorHidePassword:!1,cacheConfigSettings:!1,allowIframes:!1,useGroupIconForEntries:!1,enableUsb:!0,fieldLabelDblClickAutoType:!1,yubiKeyShowIcon:!0,yubiKeyAutoOpen:!1,yubiKeyMatchEntries:!0,yubiKeyShowChalResp:!0,yubiKeyRememberChalResp:!1,yubiKeyStuckWorkaround:!1,canOpen:!0,canOpenDemo:!0,canOpenSettings:!0,canCreate:!0,canImportXml:!0,canImportCsv:!0,canRemoveLatest:!0,canExportXml:!0,canExportHtml:!0,canSaveTo:!0,canOpenStorage:!0,canOpenGenerator:!0,canOpenOtpDevice:!0,dropbox:!0,dropboxFolder:null,dropboxAppKey:null,dropboxSecret:null,webdav:!0,webdavSaveMethod:"move",webdavStatReload:!1,gdrive:!0,gdriveClientId:null,gdriveClientSecret:null,onedrive:!0,onedriveClientId:null,onedriveClientSecret:null}},9166:(e,t,n)=>{"use strict";n.r(t),n.d(t,{BuiltInFields:()=>i});const i=["Title","Password","UserName","URL","Notes","TOTP Seed","TOTP Settings","_etm_template_uuid"]},4596:(e,t,n)=>{"use strict";n.r(t),n.d(t,{YubiKeyVendorId:()=>i,YubiKeyProductIds:()=>s,YubiKeyChallengeSize:()=>r});const i=4176,s={Gen1:[16],NEO:[272,274,275,276,277,278],YK4:[1025,1026,1027,1028,1029,1030,1031]},r=64},353:(e,t,n)=>{"use strict";n.r(t),n.d(t,{IconMap:()=>i});const i=["key","globe","exclamation-triangle","server","thumbtack","comments","puzzle-piece","edit","plug","address-card","paperclip","camera","wifi","link","battery-three-quarters","barcode","certificate","bullseye","desktop","envelope","cog","clipboard","paper-plane","newspaper","bolt","inbox","save","hdd","dot-circle","user-lock","terminal","print","project-diagram","flag-checkered","wrench","laptop","archive","credit-card","windows","clock","search","flask","gamepad","trash","sticky-note","ban","question-circle","cube","folder-o","folder-open-o","database","unlock-alt","lock","check","pencil-alt","image","book","list-alt","user-secret","utensils","home","star","linux","map-pin","apple","wikipedia-w","dollar-sign","signature","mobile"]},2977:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Keys:()=>i});const i={DOM_VK_CANCEL:3,DOM_VK_HELP:6,DOM_VK_BACK_SPACE:8,DOM_VK_TAB:9,DOM_VK_CLEAR:12,DOM_VK_RETURN:13,DOM_VK_ENTER:14,DOM_VK_SHIFT:16,DOM_VK_CONTROL:17,DOM_VK_ALT:18,DOM_VK_PAUSE:19,DOM_VK_CAPS_LOCK:20,DOM_VK_ESCAPE:27,DOM_VK_SPACE:32,DOM_VK_PAGE_UP:33,DOM_VK_PAGE_DOWN:34,DOM_VK_END:35,DOM_VK_HOME:36,DOM_VK_LEFT:37,DOM_VK_UP:38,DOM_VK_RIGHT:39,DOM_VK_DOWN:40,DOM_VK_PRINTSCREEN:44,DOM_VK_INSERT:45,DOM_VK_DELETE:46,DOM_VK_0:48,DOM_VK_1:49,DOM_VK_2:50,DOM_VK_3:51,DOM_VK_4:52,DOM_VK_5:53,DOM_VK_6:54,DOM_VK_7:55,DOM_VK_8:56,DOM_VK_9:57,DOM_VK_SEMICOLON:59,DOM_VK_EQUALS:61,DOM_VK_A:65,DOM_VK_B:66,DOM_VK_C:67,DOM_VK_D:68,DOM_VK_E:69,DOM_VK_F:70,DOM_VK_G:71,DOM_VK_H:72,DOM_VK_I:73,DOM_VK_J:74,DOM_VK_K:75,DOM_VK_L:76,DOM_VK_M:77,DOM_VK_N:78,DOM_VK_O:79,DOM_VK_P:80,DOM_VK_Q:81,DOM_VK_R:82,DOM_VK_S:83,DOM_VK_T:84,DOM_VK_U:85,DOM_VK_V:86,DOM_VK_W:87,DOM_VK_X:88,DOM_VK_Y:89,DOM_VK_Z:90,DOM_VK_CONTEXT_MENU:93,DOM_VK_NUMPAD0:96,DOM_VK_NUMPAD1:97,DOM_VK_NUMPAD2:98,DOM_VK_NUMPAD3:99,DOM_VK_NUMPAD4:100,DOM_VK_NUMPAD5:101,DOM_VK_NUMPAD6:102,DOM_VK_NUMPAD7:103,DOM_VK_NUMPAD8:104,DOM_VK_NUMPAD9:105,DOM_VK_MULTIPLY:106,DOM_VK_ADD:107,DOM_VK_SEPARATOR:108,DOM_VK_SUBTRACT:109,DOM_VK_DECIMAL:110,DOM_VK_DIVIDE:111,DOM_VK_F1:112,DOM_VK_F2:113,DOM_VK_F3:114,DOM_VK_F4:115,DOM_VK_F5:116,DOM_VK_F6:117,DOM_VK_F7:118,DOM_VK_F8:119,DOM_VK_F9:120,DOM_VK_F10:121,DOM_VK_F11:122,DOM_VK_F12:123,DOM_VK_F13:124,DOM_VK_F14:125,DOM_VK_F15:126,DOM_VK_F16:127,DOM_VK_F17:128,DOM_VK_F18:129,DOM_VK_F19:130,DOM_VK_F20:131,DOM_VK_F21:132,DOM_VK_F22:133,DOM_VK_F23:134,DOM_VK_F24:135,DOM_VK_NUM_LOCK:144,DOM_VK_SCROLL_LOCK:145,DOM_VK_COMMA:188,DOM_VK_PERIOD:190,DOM_VK_SLASH:191,DOM_VK_BACK_QUOTE:192,DOM_VK_OPEN_BRACKET:219,DOM_VK_BACK_SLASH:220,DOM_VK_CLOSE_BRACKET:221,DOM_VK_QUOTE:222,DOM_VK_META:224}},9673:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Links:()=>i});const i={Homepage:"https://keeweb.info",Repo:"https://github.com/keeweb/keeweb",Desktop:"https://github.com/keeweb/keeweb/releases/latest",WebApp:"https://app.keeweb.info",BetaWebApp:"https://beta.keeweb.info",License:"https://github.com/keeweb/keeweb/blob/master/LICENSE",LicenseApache:"https://opensource.org/licenses/Apache-2.0",LicenseLinkCCBY40:"https://creativecommons.org/licenses/by/4.0/",UpdateDesktop:"https://github.com/keeweb/keeweb/releases/download/v{ver}/UpdateDesktop.zip",ReleaseNotes:"https://github.com/keeweb/keeweb/blob/master/release-notes.md#release-notes",SelfHostedDropbox:"https://github.com/keeweb/keeweb#self-hosting",Manifest:"https://app.keeweb.info/manifest.appcache",AutoType:"https://github.com/keeweb/keeweb/wiki/Auto-Type",Translation:"https://keeweb.oneskyapp.com/",Donation:"https://opencollective.com/keeweb#support",Plugins:"https://plugins.keeweb.info",PluginDevelopStart:"https://github.com/keeweb/keeweb/wiki/Plugins",YubiKeyManual:"https://github.com/keeweb/keeweb/wiki/YubiKey",YubiKeyManagerInstall:"https://github.com/Yubico/yubikey-manager#installation"}},403:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Timeouts:()=>i});const i={CopyTip:1500,AutoHideHint:3e3,FileChangeSync:3e3,BeforeAutoLock:300,CheckWindowClosed:300,OtpFadeDuration:1e4,AutoTypeAfterHide:100,AutoTypeWindowFocusAfterBlur:500,DropDownClickWait:500,RedrawInactiveWindow:50,PopupWaitTime:1e3,AutoUpdatePluginsAfterStart:500,LinkDownloadRevoke:6e5,DefaultHttpRequest:6e4,ExternalDeviceReconnect:3e3,ExternalDeviceAfterReconnect:1e3,FieldLabelDoubleClick:300,NativeModuleHostRestartTime:3e3}},9071:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Collection:()=>c});var i=n(7187),s=n.n(i);const r=Symbol("events"),o=Symbol("array");function a(e,t){const n=e.constructor.model;if(!n)throw new Error(`Model type not defined for ${e.constructor.name}`);if(!(t instanceof n)){const n=t&&t.constructor?t.constructor.name:typeof t;throw new Error(`Attempt to write ${n} into ${e.constructor.name}`)}}const l={set(e,t,n){const i=parseInt(t);if(isNaN(i))return e[t]=n,!0;a(e,n);const s=e[o],l=s[t];return l!==n&&(s[t]=n,function(e,t,n){const i=e[r];if(!i.paused){const s={added:[],removed:[]};n&&(i.emit("remove",n,e),s.removed.push(n)),t&&(i.emit("add",t,e),s.added.push(t)),i.emit("change",s,e)}}(e,n,l)),!0},get(e,t){if("string"!=typeof t)return e[t];const n=parseInt(t);return isNaN(n)?e[t]:e[o][t]}};class c{constructor(e){const t=new(s());t.setMaxListeners(100);const n={[r]:{value:t},[o]:{value:[]}};return Object.defineProperties(this,n),e&&this.push(...e),new Proxy(this,l)}get length(){return this[o].length}set length(e){const t=this[o];let n;et.id===e))}remove(e){for(let t=0;t{"use strict";n.r(t),n.d(t,{Events:()=>o});var i=n(7187),s=n.n(i);class r extends(s()){constructor(){super(),this.setMaxListeners(1e3)}}const o=new r},9186:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Model:()=>d});var i=n(7187),s=n.n(i),r=n(2363);const o=Symbol("events"),a=Symbol("defaults"),l=Symbol("extensions");function c(e,t,n,i){const s=e[o];s.paused||(s.emit("change:"+t,e,n,i),s.noChange||s.emit("change",e,{[t]:n}))}const u={deleteProperty(e,t){if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[a],i=n[t],s=e[t];return s!==i&&(Object.prototype.hasOwnProperty.call(n,t)?e[t]=i:delete e[t],c(e,t,i,s)),!0}return!0},set(e,t,n,i){if(Object.prototype.hasOwnProperty.call(e,t)||e[l]){if(e[t]!==n){const i=e[t];e[t]=n,c(e,t,n,i)}return!0}return new r.Logger(i.constructor.name).warn(`Unknown property: ${t}`,(new Error).stack),!1}};class d{constructor(e){const t=new(s());t.setMaxListeners(100);const n={[o]:{value:t}};for(const[e,t]of Object.entries(this[a]))n[e]={configurable:!0,enumerable:!0,writable:!0,value:t};Object.defineProperties(this,n);const i=new Proxy(this,u);return e&&i.set(e,{silent:!0}),i}set(e,{silent:t}={}){const n=this[o];t&&(n.paused=!0),n.noChange=!0;for(const[t,n]of Object.entries(e))this[t]=n;n.noChange=!1,t?n.paused=!1:n.emit("change",this,e)}on(e,t){this[o].on(e,t)}once(e,t){this[o].once(e,t)}off(e,t){this[o].off(e,t)}emit(e,...t){this[o].emit(e,...t)}static defineModelProperties(e,t){this.prototype[a]=Object.assign({},this.prototype[a],e),t&&t.extensions&&(this.prototype[l]=!0)}static set(e){this.prototype[a]=e}}},4796:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Copyable:()=>l});var i=n(7201),s=n(7614),r=n(3297),o=n(3710),a=n(403);const l={hideFieldCopyTip(){this.fieldCopyTip&&(this.fieldCopyTip.hide(),this.fieldCopyTip=null)},fieldCopied(e){this.hideFieldCopyTip();const t=e.source.labelEl,n=e.copyRes.seconds,l=n?r.Locale.detFieldCopiedTime.replace("{}",n):r.Locale.detFieldCopied;let c;this.isHidden()||(c=o.Tip.createTip(t[0],{title:l,placement:"right",fast:!0,force:!0,noInit:!0}),this.fieldCopyTip=c,c.show()),setTimeout((()=>{c&&c.hide(),this.fieldCopyTip=null,"$Password"===e.source.model.name&&s.AppSettingsModel.lockOnCopy&&setTimeout((()=>{i.Events.emit("lock-workspace")}),a.Timeouts.BeforeAutoLock)}),a.Timeouts.CopyTip)}}},8892:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Resizable:()=>s});var i=n(7201);const s={listenDrag(e){this.listenTo(e,"dragstart",this.dragStart),this.listenTo(e,"drag",this.drag),this.listenTo(e,"autosize",this.autoSize)},dragStart(e){this._dragInfo=this.getDragInfo(e.coord)},drag(e){const t=this._dragInfo;let n=t.startSize+e.offset;n=Math.max(t.min,Math.min(t.max,n)),this.$el[t.prop](n),this.emit("view-resize",n),i.Events.emit("page-geometry",{source:"resizable"})},autoSize(e){const t=this.getDragInfo(e.coord);void 0!==t.auto?this.$el.css(t.prop,t.auto):this.$el.css(t.prop,""),this.fixSize(t),this.emit("view-resize",null),i.Events.emit("page-geometry",{source:"resizable"})},fixSize(e){const t=this.$el[e.prop]();Math.max(e.min,Math.min(e.max,t))!==t&&this.$el[e.prop](t)},getDragInfo(e){const t="x"===e?"Width":"Height",n=t.toLowerCase(),i=this.getSizeProp("min"+t),s=this.getSizeProp("max"+t),r=this.getSizeProp("auto"+t);return{startSize:this.$el[n](),prop:n,min:i,max:s,auto:r}},getSizeProp(e){const t=this[e];return"function"==typeof t?t.call(this):t}}},7015:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Scrollable:()=>a}),function(e){function t(i){if(n[i])return n[i].exports;var s=n[i]={i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,n){function i(e,t){for(var n in e)e.hasOwnProperty(n)&&t(n,e[n])}var s=!1;try{var r=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("test",null,r)}catch(e){}e.exports.event=function(e,t,n,i){var r="on"==i?"add":"remove";t.split(" ").forEach((function(t){var i=!1;-1!=["scroll","touchstart","touchmove"].indexOf(t)&&s&&(i={passive:!0}),e[r+"EventListener"](t,n,i)}))},e.exports.css=function(e,t,n){var s;if(void 0===n){if("string"==typeof t)return e.style[t];s=t}else(s={})[t]=n;i(s,(function(t,n){e.style[t]=n}))},e.exports.add=function(e,t){t&&e.classList.add(t)},e.exports.rm=function(e,t){t&&e.classList.remove(t)},e.exports.has=function(e,t){return!!t&&e.classList.contains(t)},e.exports.clone=function(e){var t={};return i(e||{},(function(e,n){t[e]=n})),t},e.exports.qs=function(e,t){return e instanceof HTMLElement?e:(t||document).querySelector(e)},e.exports.each=i},function(e,t,n){function i(e){var t,n,i=e&&e[0]||e,s="string"==typeof e||i instanceof HTMLElement?{root:e}:g(e),r={direction:"v",barOnCls:"_scrollbar",resizeDebounce:0,event:d,cssGuru:!1,impact:"scroller",position:"static"};for(var l in s=s||{},r)null==s[l]&&(s[l]=r[l]);t=this&&this instanceof u.jQuery,s._chain?n=s.root:t?s.root=n=this[0]:n=A(s.root||s.scroller);var c=o(n,s.direction),h=+c;if(s.index=h,h==h&&null!==c&&b[h])return b[h];s.root&&s.scroller?s.scroller=A(s.scroller,n):s.scroller=n,s.root=n;var p=a(s);return p.autoUpdate&&p.autoUpdate(),p}function s(){return(new Date).getTime()}function r(e,t,n){e._eventHandlers=e._eventHandlers||[{element:e.scroller,handler:function(t){e.scroll(t)},type:"scroll"},{element:e.root,handler:function(){e.update()},type:"transitionend animationend"},{element:e.scroller,handler:function(){e.update()},type:"keyup"},{element:e.bar,handler:function(t){t.preventDefault(),e.selection(),e.drag.now=1,e.draggingCls&&p(e.root,e.draggingCls)},type:"touchstart mousedown"},{element:document,handler:function(){e.selection(1),e.drag.now=0,e.draggingCls&&f(e.root,e.draggingCls)},type:"mouseup blur touchend"},{element:document,handler:function(t){2!=t.button&&e._pos0(t)},type:"touchstart mousedown"},{element:document,handler:function(t){e.drag.now&&e.drag(t)},type:"mousemove touchmove"},{element:u,handler:function(){e.update()},type:"resize"},{element:e.root,handler:function(){e.update()},type:"sizeChange"},{element:e.clipper,handler:function(){e.clipperOnScroll()},type:"scroll"}],function(e,t){var n=0,i=e;for(void 0!==i.length&&i!==u||(i=[i]);i[n];)t.call(this,i[n],n),n++}(e._eventHandlers,(function(e){if(e.element)if(e.element.length&&e.element!==u)for(var i=0;i=0?n=setTimeout(o,t-a):(n=null,e())};return function(){i=s(),n||(n=setTimeout(o,t))}},constructor:function(e){function t(e){var t=this.barMinSize||20,n=e;n>0&&n=this.scroller[this.origin.scrollSize];e||t?m(this.root,this.barOnCls)&&f(this.root,this.barOnCls):m(this.root,this.barOnCls)||p(this.root,this.barOnCls)}},this._pos0=function(e){d=this.cursor(e)-c},this.drag=function(e){var t=o.call(this,this.cursor(e)-d),n=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client];this.scroller[this.origin.scroll]=t*n},this.selection=function(e){this.event(document,"selectpos selectstart",a,e?"off":"on")},this.resize=function(){function e(){var e,n=t.scroller[t.origin.crossOffset],i=t.scroller[t.origin.crossClient],r=0;if(k?r=15:i>0&&0===n&&(n=i+17),n)if(t.barOn(),"scroller"==t.impact){var o=n-i+r;if("static"==t.position)h(t.scroller,t.origin.crossSize)!=(e=t.clipper[t.origin.crossClient]+o+"px")&&t._setCrossSizes(t.scroller,e);else{var a={},c=t.rtl?"Left":"Right";"h"==t.direction&&(c="Bottom"),a["padding"+c]=o+"px",h(t.scroller,a)}}else h(t.clipper,t.origin.crossSize)!=(e=i+"px")&&t._setCrossSizes(t.clipper,e);Array.prototype.unshift.call(arguments,"resize"),l.apply(t,arguments),b=s()}var t=this,n=void 0===t.resizeDebounce?300:t.resizeDebounce,i=0;s()-bs+r.bar[r.origin.offset]&&(o=1);var a=r.pos()+o*n*r.scroller[r.origin.client];r.pos(a)}},type:"mousedown"},this._eventHandlers.push(s),this.event(s.element,s.type,s.handler,"on"))}},function(e,t,n){var i=(n(6),n(0).css),s=n(0).add,r=n(0).rm;e.exports=function(e){function t(e,t,n){var o=t,u=1==n?"pos":"oppos";l<(c.minView||0)&&(o=void 0),i(a[e],this.origin.pos,""),i(a[e],this.origin.oppos,""),r(a[e],c.outside),void 0!==o&&(o+="px",i(a[e],this.origin[u],o),s(a[e],c.outside))}function n(e){try{var t=document.createEvent("WheelEvent");t.initWebKitWheelEvent(e.originalEvent.wheelDeltaX,e.originalEvent.wheelDeltaY),p.dispatchEvent(t),e.preventDefault()}catch(e){}}function o(e){var t;for(var s in e)c[s]=e[s];if(c.elements instanceof HTMLElement?a=[c.elements]:"string"==typeof c.elements?a=this.scroller.querySelectorAll(c.elements):c.elements&&c.elements[0]instanceof HTMLElement&&(a=c.elements),a){l=this.scroller[this.origin.client];for(var r=0;rd[o]+l-c.radius?(e=2,n=this.scroller[this.origin.client]-a[o][this.origin.offset]-u[o]-l):(e=3,n=void 0),i=!1,(h[o]-this.pos()d[o]+l)&&(i=!0),e==g[o]&&i==A[o]||(t.call(this,o,n,e),g[o]=e,A[o]=i,p=!0);if(p)for(o=0;othis.removeScroll)),this[o]=!0)),this.scroller=this.$el.find(".scroller"),this.scrollerBar=this.$el.find(".scroller__bar"),this.scrollerBarWrapper=this.$el.find(".scroller__bar-wrapper")},removeScroll(){if(this.scroll){try{this.scroll.dispose()}catch(e){}this.scroll=null}},pageResized(){this.scroll&&(this.scroll.update(),requestAnimationFrame((()=>{if(this.scroll){this.scroll.update();const e=Math.round(this.scrollerBar.height()),t=Math.round(this.scrollerBarWrapper.height());this.scrollerBarWrapper.toggleClass("invisible",e>=t)}})))},initScroll(){r&&this.listenTo(s.Events,"page-geometry",this.pageResized)}}},7779:(e,t,n)=>{"use strict";n.r(t),n.d(t,{View:()=>m,DefaultTemplateOptions:()=>p});var i=n(6238),s=n.n(i),r=n(7187),o=n.n(r),a=n(3710),l=n(1164),c=n(4953),u=n(2363),d=n(6718);const h={mouseenter:!0,mouseleave:!0,blur:!0,focus:!0},p={allowProtoPropertiesByDefault:!0,allowedProtoProperties:{length:!0,active:!0}};class m extends(o()){constructor(e,t={}){super(),this.parent=void 0,this.template=void 0,this.events={},this.model=void 0,this.options={},this.views={},this.hidden=void 0,this.removed=!1,this.modal=void 0,this.eventListeners={},this.elementEventListeners=[],this.debugLogger=localStorage.debugView?new u.Logger("view",this.constructor.name):void 0,this.model=e,this.options=t,this.setMaxListeners(100)}render(e){var t;if(this.removed)return;let n;return this.debugLogger&&(this.debugLogger.debug("Render start"),n=this.debugLogger.ts()),this.el&&a.Tip.destroyTips(this.el),this.renderElement(e),a.Tip.createTips(this.el),null===(t=this.debugLogger)||void 0===t||t.debug("Render finished",this.debugLogger.ts(n)),this}renderElement(e){const t=this.template(e,p);if(this.el){const e=this.options.ownParent?this.el.firstChild:this.el;s()(e,t),this.bindElementEvents()}else{let e=this.options.parent||this.parent;if(!e)throw new Error(`Error rendering ${this.constructor.name}: I don't know how to insert the view`);{if("string"==typeof e&&(e=document.querySelector(e)),!e)throw new Error(`Error rendering ${this.constructor.name}: parent not found`);this.options.replace&&(a.Tip.destroyTips(e),e.innerHTML="");const n=document.createElement("div");n.innerHTML=t;const i=n.firstChild;this.options.ownParent?(i&&e.appendChild(i),this.el=e):(this.el=i,e.appendChild(this.el)),this.modal&&c.FocusManager.setModal(this.modal),this.bindEvents()}this.$el=d(this.el)}}bindEvents(){const e={};for(const[t,n]of Object.entries(this.events)){const i=t.indexOf(" ");let s,r;if(i>0){if(s=t.substr(0,i),r=t.substr(i+1),h[s]){this.elementEventListeners.push({event:s,selector:r,method:n,els:[]});continue}}else s=t;e[s]||(e[s]=[]),e[s].push({selector:r,method:n})}for(const[n,i]of Object.entries(e)){var t;null===(t=this.debugLogger)||void 0===t||t.debug("Bind","view",n,i);const e=e=>this.eventListener(e,i);this.eventListeners[n]=e,this.el.addEventListener(n,e)}this.bindElementEvents()}unbindEvents(){for(const[e,t]of Object.entries(this.eventListeners))this.el.removeEventListener(e,t);this.unbindElementEvents()}bindElementEvents(){if(this.elementEventListeners.length){this.unbindElementEvents();for(const t of this.elementEventListeners){var e;const n=this.el.querySelectorAll(t.selector);null===(e=this.debugLogger)||void 0===e||e.debug("Bind","element",t.event,t.selector,n.length),t.listener=e=>this.eventListener(e,[t]);for(const e of n)e.addEventListener(t.event,t.listener),t.els.push(e)}}}unbindElementEvents(){if(this.elementEventListeners.length)for(const e of this.elementEventListeners){for(const t of e.els)t.removeEventListener(e.event,e.listener);e.els=[]}}eventListener(e,t){var n;null===(n=this.debugLogger)||void 0===n||n.debug("Listener fired",e.type);for(const{selector:n,method:r}of t){var i,s;if(n){const t=e.target.closest(n);if(!t||!this.el.contains(t))continue}if(this[r])null===(i=this.debugLogger)||void 0===i||i.debug("Handling event",e.type,r),this[r](e);else null===(s=this.debugLogger)||void 0===s||s.debug("Method not defined",r)}}remove(){var e;this.modal&&c.FocusManager.modal===this.modal&&c.FocusManager.setModal(null),this.emit("remove"),this.removeInnerViews(),a.Tip.hideTips(this.el),this.el.remove(),this.removed=!0,null===(e=this.debugLogger)||void 0===e||e.debug("Remove")}removeInnerViews(){if(this.views){for(const e of Object.values(this.views))e&&(e instanceof Array?e.forEach((e=>e.remove())):e.remove());this.views={}}}listenTo(e,t,n){const i=n.bind(this);e.on(t,i),this.once("remove",(()=>e.off(t,i)))}hide(){return a.Tip.hideTips(this.el),this.toggle(!1)}show(){return this.toggle(!0)}toggle(e){var t,n;(null===(t=this.debugLogger)||void 0===t||t.debug(e?"Show":"Hide"),void 0===e&&(e=this.hidden),this.hidden!==!e)?(this.hidden=!e,this.modal&&(e?c.FocusManager.setModal(this.modal):c.FocusManager.modal===this.modal&&c.FocusManager.setModal(null)),this.emit(e?"show":"hide"),this.el&&(this.el.classList.toggle("show",!!e),this.el.classList.toggle("hide",!e),e||a.Tip.hideTips(this.el))):null===(n=this.debugLogger)||void 0===n||n.debug("Toggle: noop",e)}isHidden(){return!!this.hidden}isVisible(){return!this.hidden}afterPaint(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}onKey(e,t,n,i,s){l.KeyHandler.onKey(e,t,this,n,i,s),this.once("remove",(()=>l.KeyHandler.offKey(e,t,this)))}off(e,t){return void 0===t?super.removeAllListeners(e):super.off(e,t)}}},9861:(e,t,n)=>{"use strict";n.r(t);var i=n(7109);n.n(i)().registerHelper("add",((e,t)=>parseInt(e)+parseInt(t)))},4540:(e,t,n)=>{"use strict";n.r(t);var i=n(7109);n.n(i)().registerHelper("cmp",(function(e,t,n,i){let s;switch(n){case"<":s=e":s=e>t;break;case">=":s=e>=t;break;case"<=":s=e<=t;break;case"===":case"==":s=e===t;break;case"!==":case"!=":s=e!==t}return s?i.fn(this):i.inverse(this)}))},2156:(e,t,n)=>{"use strict";n.r(t);var i=n(7109);n.n(i)().registerHelper("ifemptyoreq",(function(e,t,n){return e&&e!==t?n.inverse(this):n.fn(this)}))},7672:(e,t,n)=>{"use strict";n.r(t);var i=n(7109);n.n(i)().registerHelper("ifeq",(function(e,t,n){return e===t?n.fn(this):n.inverse(this)}))},580:(e,t,n)=>{"use strict";n.r(t);var i=n(7109);n.n(i)().registerHelper("ifneq",(function(e,t,n){return e!==t?n.fn(this):n.inverse(this)}))},3676:(e,t,n)=>{"use strict";n.r(t);n(9861),n(4540),n(7672),n(580),n(2156),n(8386)},8386:(e,t,n)=>{"use strict";n.r(t);var i=n(7109),s=n.n(i),r=n(3297);s().registerHelper("res",(function(e,t){let n=r.Locale[e];if(n){n.indexOf("{}")>=0&&(n=n.replace("{}",t.fn(this)))}return n})),s().registerHelper("Res",(e=>{let t=r.Locale[e];return t&&(t=t[0].toUpperCase()+t.substr(1)),t}))},2985:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AppModel:()=>B});var i=n(7201),s=n(949),r=n(6491),o=n(6253),a=n(6469),l=n(7119),c=n(9491),u=n(8647),d=n(403),h=n(7614),p=n(7725),m=n(3850),f=n(7449),g=n(5572),A=n(7833),y=n(4563),v=n(739),b=n(667),w=n(6098),k=n(4798),C=n(1240),_=n(3297),E=n(2363),I=n(6838),S=n(3279),x=n.n(S);n(9689);class B{constructor(){this.tags=[],this.files=new o.FileCollection,this.fileInfos=a.FileInfoCollection,this.menu=new y.MenuModel,this.filter={},this.sort="title",this.settings=h.AppSettingsModel,this.activeEntryId=null,this.isBeta=l.RuntimeInfo.beta,this.advancedSearch=null,this.attachedYubiKeysCount=0,i.Events.on("refresh",this.refresh.bind(this)),i.Events.on("set-filter",this.setFilter.bind(this)),i.Events.on("add-filter",this.addFilter.bind(this)),i.Events.on("set-sort",this.setSort.bind(this)),i.Events.on("empty-trash",this.emptyTrash.bind(this)),i.Events.on("select-entry",this.selectEntry.bind(this)),i.Events.on("unset-keyfile",this.unsetKeyFile.bind(this)),i.Events.on("usb-devices-changed",this.usbDevicesChanged.bind(this)),this.appLogger=new E.Logger("app"),B.instance=this}loadConfig(e){return new Promise(((t,n)=>{this.ensureCanLoadConfig(e),this.appLogger.debug("Loading config from",e);const i=this.appLogger.ts(),s=new XMLHttpRequest;s.open("GET",e),s.responseType="json",s.send(),s.addEventListener("load",(()=>{let r=s.response;if(!r){const e="OK"===s.statusText?"Malformed JSON":s.statusText;return this.appLogger.error("Error loading app config",e),n("Error loading app config")}if("string"==typeof r)try{r=JSON.parse(r)}catch(e){return this.appLogger.error("Error parsing response",e,r),n("Error parsing response")}if(!r.settings)return this.appLogger.error("Invalid app config, no settings section",r),n("Invalid app config, no settings section");this.appLogger.info("Loaded app config from",e,this.appLogger.ts(i)),t(r)})),s.addEventListener("error",(()=>{this.appLogger.error("Error loading app config",s.statusText,s.status),n("Error loading app config")}))})).then((e=>this.applyUserConfig(e)))}ensureCanLoadConfig(e){if(!b.Features.isSelfHosted)throw"Configs are supported only in self-hosted installations";const t=document.createElement("a");t.href=e;if(t.host&&t.host!==location.host)throw"Loading config from this location is not allowed"}applyUserConfig(e){if(this.settings.set(e.settings),e.files&&(e.showOnlyFilesFromConfig&&(this.fileInfos.length=0),e.files.filter((e=>e&&e.storage&&e.name&&e.path&&!this.fileInfos.getMatch(e.storage,e.name,e.path))).map((e=>new m.FileInfoModel({id:C.IdGenerator.uuid(),name:e.name,storage:e.storage,path:e.path,opts:e.options}))).reverse().forEach((e=>this.fileInfos.unshift(e)))),e.plugins){const t=e.plugins.map((e=>v.PluginManager.installIfNew(e.url,e.manifest,!0)));return Promise.all(t).then((()=>{this.settings.set(e.settings)}))}e.advancedSearch&&(this.advancedSearch=e.advancedSearch,this.addFilter({advanced:this.advancedSearch}))}addFile(e){if(this.files.get(e.id))return!1;this.files.push(e);for(const t of e.groups)this.menu.groupsSection.addItem(t);return this._addTags(e),this._tagsChanged(),this.menu.filesSection.addItem({icon:"lock",title:e.name,page:"file",file:e}),this.refresh(),e.on("reload",this.reloadFile.bind(this)),e.on("change",(()=>i.Events.emit("file-changed",e))),e.on("ejected",(()=>this.closeFile(e))),!0}reloadFile(e){this.menu.groupsSection.replaceByFile(e,e.groups[0]),this.updateTags()}_addTags(e){const t={};this.tags.forEach((e=>{t[e.toLowerCase()]=!0})),e.forEachEntry({},(e=>{for(const n of e.tags)t[n.toLowerCase()]||(t[n.toLowerCase()]=!0,this.tags.push(n))})),this.tags.sort()}_tagsChanged(){this.tags.length?(this.menu.tagsSection.scrollable=!0,this.menu.tagsSection.setItems(this.tags.map((e=>({title:e,icon:"tag",filterKey:"tag",filterValue:e,editable:!0}))))):(this.menu.tagsSection.scrollable=!1,this.menu.tagsSection.removeAllItems())}updateTags(){const e=this.tags.slice();this.tags.splice(0,this.tags.length);for(const e of this.files)this._addTags(e);e.join(",")!==this.tags.join(",")&&this._tagsChanged()}renameTag(e,t){this.files.forEach((n=>n.renameTag&&n.renameTag(e,t))),this.updateTags()}closeAllFiles(){for(const e of this.files)e.close(),this.fileClosed(e);this.files.length=0,this.menu.groupsSection.removeAllItems(),this.menu.tagsSection.scrollable=!1,this.menu.tagsSection.removeAllItems(),this.menu.filesSection.removeAllItems(),this.tags.splice(0,this.tags.length),this.filter={},this.menu.select({item:this.menu.allItemsItem})}closeFile(e){e.close(),this.fileClosed(e),this.files.remove(e),this.updateTags(),this.menu.groupsSection.removeByFile(e),this.menu.filesSection.removeByFile(e),this.menu.select({item:this.menu.allItemsSection.items[0]})}emptyTrash(){this.files.forEach((e=>e.emptyTrash&&e.emptyTrash())),this.refresh()}setFilter(e){this.filter=this.prepareFilter(e),this.filter.subGroups=this.settings.expandGroups,!this.filter.advanced&&this.advancedSearch&&(this.filter.advanced=this.advancedSearch);const t=this.getEntries();if(!this.activeEntryId||!t.get(this.activeEntryId)){const e=t[0];this.activeEntryId=e?e.id:null}i.Events.emit("filter",{filter:this.filter,sort:this.sort,entries:t}),i.Events.emit("entry-selected",t.get(this.activeEntryId))}refresh(){this.setFilter(this.filter)}selectEntry(e){this.activeEntryId=e.id,this.refresh()}addFilter(e){this.setFilter(Object.assign(this.filter,e))}setSort(e){this.sort=e,this.setFilter(this.filter)}getEntries(){const e=this.getEntriesByFilter(this.filter);return e.sortEntries(this.sort,this.filter),this.filter.trash&&this.addTrashGroups(e),e}getEntriesByFilter(e){const t=this.prepareFilter(e),n=new r.SearchResultCollection,i=this.files.filter((e=>e.external)),s=this.settings.yubiKeyMatchEntries?new Set:void 0;if(this.files.filter((e=>!e.external)).forEach((e=>{e.forEachEntry(t,(e=>{if(s)for(const t of i){const n=t.getMatchingEntry(e);n&&s.add(n)}n.push(e)}))})),i.length)for(const e of i)e.forEachEntry(t,(e=>{s&&s.has(e)||n.push(e)}));return n}addTrashGroups(e){this.files.forEach((t=>{const n=t.getTrashGroup&&t.getTrashGroup();n&&n.getOwnSubGroups().forEach((i=>{e.unshift(g.GroupModel.fromGroup(i,t,n))}))}))}prepareFilter(e){(e=Object.assign({},e)).textLower=e.text?e.text.toLowerCase():"",e.textParts=null,e.textLowerParts=null;if(!(e.advanced&&e.advanced.exact)&&e.text){const t=e.text.split(/\s+/).filter((e=>e));t.length&&(e.textParts=t,e.textLowerParts=e.textLower.split(/\s+/).filter((e=>e)))}return e.tagLower=e.tag?e.tag.toLowerCase():"",e}getFirstSelectedGroupForCreation(){const e=this.filter.group;let t,n;return e&&this.files.some((i=>(t=i,n=i.getGroup(e),n))),n||(t=this.files.find((e=>e.active&&!e.readOnly)),n=t.groups[0]),{group:n,file:t}}completeUserNames(e){const t={};this.files.forEach((n=>{n.forEachEntry({text:e,textLower:e.toLowerCase(),advanced:{user:!0}},(e=>{const n=e.user;n&&(t[n]=(t[n]||0)+1)}))}));const n=Object.entries(t);n.sort(((e,t)=>t[1]-e[1]));return n.length>5&&(n.length=5),n.map((e=>e[0]))}getEntryTemplates(){const e=[];return this.files.forEach((t=>{var n;null===(n=t.forEachEntryTemplate)||void 0===n||n.call(t,(n=>{e.push({file:t,entry:n})}))})),e}canCreateEntries(){return this.files.some((e=>e.active&&!e.readOnly))}createNewEntry(e){const t=this.getFirstSelectedGroupForCreation();if(e&&e.template){t.file!==e.template.file&&(t.file=e.template.file,t.group=e.template.file.groups[0]);const n=e.template.entry,i=p.EntryModel.newEntry(t.group,t.file);return i.copyFromTemplate(n),i}return p.EntryModel.newEntry(t.group,t.file,{tag:this.filter.tag})}createNewGroup(){const e=this.getFirstSelectedGroupForCreation();return g.GroupModel.newGroup(e.group,e.file)}createNewTemplateEntry(){const e=this.getFirstSelectedGroupForCreation().file,t=e.getEntryTemplatesGroup()||e.createEntryTemplatesGroup();return p.EntryModel.newEntry(t,e)}createDemoFile(){if(this.files.getByName("Demo"))return!1;{const e=new f.FileModel({id:C.IdGenerator.uuid()});return e.openDemo((()=>{this.addFile(e)})),!0}}createNewFile(e){if(!e)for(let t=0;e=_.Locale.openNewFile+(t||""),this.files.getByName(e)||this.fileInfos.getByName(e);t++);const t=new f.FileModel({id:C.IdGenerator.uuid()});return t.create(e),this.addFile(t),t}openFile(e,t){const n=new E.Logger("open",e.name);n.info("File open request");const i=e.id?this.fileInfos.get(e.id):this.fileInfos.getMatch(e.storage,e.name,e.path);!e.opts&&i&&i.opts&&(e.opts=i.opts),i&&i.modified?(n.info("Open file from cache because it is modified"),this.openFileFromCache(e,((e,i)=>{!e&&i&&(n.info("Sync just opened modified file"),setTimeout((()=>this.syncFile(i)),0)),t(e)}),i)):e.fileData?(n.info("Open file from supplied content"),"file"===e.storage?s.Storage.file.stat(e.path,null,((n,s)=>{if(n)return t(n);e.rev=s.rev,this.openFileWithData(e,t,i,e.fileData)})):this.openFileWithData(e,t,i,e.fileData,!0)):e.storage?i&&i.openDate&&i.rev===e.rev&&"file"!==i.storage?(n.info("Open file from cache because it is latest"),this.openFileFromCache(e,((s,r)=>{if(s){if("KdbxError"===s.name||s.ykError)return t(s);n.info("Error loading file from cache, trying to open from storage",s),this.openFileFromStorage(e,t,i,n,!0)}else t(s,r)}),i)):i&&i.openDate&&"file"!==e.storage?(n.info("Open file from cache, will sync after load",e.storage),this.openFileFromCache(e,((s,r)=>{if(!s&&r)n.info("Sync just opened file"),setTimeout((()=>this.syncFile(r)),0),t(s);else{if("KdbxError"===s.name||s.ykError)return t(s);n.info("Error loading file from cache, trying to open from storage",s),this.openFileFromStorage(e,t,i,n,!0)}}),i)):this.openFileFromStorage(e,t,i,n):(n.info("Open file from cache as main storage"),this.openFileFromCache(e,t,i))}openFileFromCache(e,t,n){s.Storage.cache.load(n.id,null,((i,s)=>{s||(i=_.Locale.openFileNoCacheError),new E.Logger("open",e.name).info("Loaded file from cache",i),i?t(i):this.openFileWithData(e,t,n,s)}))}openFileFromStorage(e,t,n,i,r){i.info("Open file from storage",e.storage);const o=s.Storage[e.storage],a=()=>{i.info("Load from storage"),o.load(e.path,e.opts,((s,r,a)=>{if(s)n&&n.openDate?(i.info("Open file from cache because of storage load error",s),this.openFileFromCache(e,t,n)):(i.info("Storage load error",s),t(s));else{i.info("Open file from content loaded from storage"),e.fileData=r,e.rev=a&&a.rev||null;const s="file"!==o.name;this.openFileWithData(e,t,n,r,s)}}))},l=n&&n.rev||null;l&&o.stat?(i.info("Stat file"),o.stat(e.path,e.opts,((s,c)=>{!r&&n&&"file"!==o.name&&(s||c&&c.rev===l)?(i.info("Open file from cache because "+(s?"stat error":"it is latest"),s),this.openFileFromCache(e,t,n)):c?(i.info("Open file from storage ("+c.rev+", local "+l+")"),a()):(i.info("Stat error",s),t(s))}))):a()}openFileWithData(e,t,n,i,r){const o=new E.Logger("open",e.name);let a=!1;!e.keyFileData&&n&&n.keyFileName?(e.keyFileName=n.keyFileName,"data"===this.settings.rememberKeyFiles?e.keyFileData=f.FileModel.createKeyFileWithHash(n.keyFileHash):"path"===this.settings.rememberKeyFiles&&n.keyFilePath&&(e.keyFilePath=n.keyFilePath,s.Storage.file.enabled&&(a=!0))):!e.keyFilePath||e.keyFileData||n||(a=!0);const l=new f.FileModel({id:n?n.id:C.IdGenerator.uuid(),name:e.name,storage:e.storage,path:e.path,keyFileName:e.keyFileName,keyFilePath:e.keyFilePath,backup:n&&n.backup||null,fingerprint:n&&n.fingerprint||null,chalResp:e.chalResp}),c=a=>{if(a)return t(a);if(this.files.get(l.id))return t("Duplicate file id");n&&n.modified&&(n.editState&&(o.info("Loaded local edit state"),l.setLocalEditState(n.editState)),o.info("Mark file as modified"),l.modified=!0),n&&(l.syncDate=n.syncDate),r&&(o.info("Save loaded file to cache"),s.Storage.cache.save(l.id,null,e.fileData));const c=e.rev||n&&n.rev;this.setFileOpts(l,e.opts),this.addToLastOpenFiles(l,c),this.addFile(l),t(null,l),this.fileOpened(l,i,e)},u=()=>{l.open(e.password,i,e.keyFileData,c)};a?s.Storage.file.load(e.keyFilePath,{},((n,i)=>{n?(o.info("Storage load error",n),t(n)):(e.keyFileData=i,u())})):u()}importFileWithXml(e,t){const n=new E.Logger("import",e.name);n.info("File import request with supplied xml");const i=new f.FileModel({id:C.IdGenerator.uuid(),name:e.name,storage:e.storage,path:e.path});i.importWithXml(e.fileXml,(e=>{if(n.info("Import xml complete "+(e?"with error":""),e),e)return t(e);this.addFile(i),this.fileOpened(i)}))}addToLastOpenFiles(e,t){this.appLogger.debug("Add last open file",e.id,e.name,e.storage,e.path,t);const n=new Date,i=new m.FileInfoModel({id:e.id,name:e.name,storage:e.storage,path:e.path,opts:this.getStoreOpts(e),modified:e.modified,editState:e.getLocalEditState(),rev:t,syncDate:e.syncDate||n,openDate:n,backup:e.backup,fingerprint:e.fingerprint,chalResp:e.chalResp});switch(this.settings.rememberKeyFiles){case"data":i.set({keyFileName:e.keyFileName||null,keyFileHash:e.getKeyFileHash()});break;case"path":i.set({keyFileName:e.keyFileName||null,keyFilePath:e.keyFilePath||null})}this.fileInfos.remove(e.id),this.fileInfos.unshift(i),this.fileInfos.save()}getStoreOpts(e){const t=e.opts,n=e.storage;return s.Storage[n]&&s.Storage[n].fileOptsToStoreOpts&&t?s.Storage[n].fileOptsToStoreOpts(t,e):null}setFileOpts(e,t){const n=e.storage;s.Storage[n]&&s.Storage[n].storeOptsToFileOpts&&t&&(e.opts=s.Storage[n].storeOptsToFileOpts(t,e))}fileOpened(e,t,n){"file"===e.storage&&s.Storage.file.watch(e.path,x()((()=>{this.syncFile(e)}),d.Timeouts.FileChangeSync)),e.isKeyChangePending(!0)&&i.Events.emit("key-change-pending",{file:e});const r=e.backup;t&&r&&r.enabled&&r.pending&&this.scheduleBackupFile(e,t),n&&this.saveFileFingerprint(e,n.password),this.settings.yubiKeyAutoOpen&&this.attachedYubiKeysCount>0&&!this.files.some((e=>e.external))&&this.tryOpenOtpDeviceInBackground()}fileClosed(e){"file"===e.storage&&s.Storage.file.unwatch(e.path)}removeFileInfo(e){s.Storage.cache.remove(e),this.fileInfos.remove(e),this.fileInfos.save()}getFileInfo(e){return this.fileInfos.get(e.id)||this.fileInfos.getMatch(e.storage,e.name,e.path)}syncFile(e,t,n){if(e.demo)return n&&n();if(e.syncing)return n&&n("Sync in progress");if(!e.active)return n&&n("File is closed");t||(t={});const r=new E.Logger("sync",e.name),o=t.storage||e.storage;let a=t.path||e.path;const l=t.opts||e.opts;!o||!s.Storage[o].getPathForName||a&&o===e.storage||(a=s.Storage[o].getPathForName(e.name));const c=Object.assign({},t);c&&c.opts&&c.opts.password&&(c.opts=Object.assign({},c.opts),c.opts.password="***"),r.info("Sync started",o,a,c);let u=this.getFileInfo(e);if(!u){r.info("Create new file info");const t=new Date;u=new m.FileInfoModel({id:C.IdGenerator.uuid(),name:e.name,storage:e.storage,path:e.path,opts:this.getStoreOpts(e),modified:e.modified,editState:null,rev:null,syncDate:t,openDate:t,backup:e.backup})}e.setSyncProgress();const d=t=>{if(!e.active)return n&&n("File is closed");r.info("Sync finished",t||"no error"),e.setSyncComplete(a,o,t?t.toString():null),u.set({name:e.name,storage:o,path:a,opts:this.getStoreOpts(e),modified:e.dirty?u.modified:e.modified,editState:e.dirty?u.editState:e.getLocalEditState(),syncDate:e.syncDate,chalResp:e.chalResp}),"data"===this.settings.rememberKeyFiles&&u.set({keyFileName:e.keyFileName||null,keyFileHash:e.getKeyFileHash()}),this.fileInfos.get(u.id)||this.fileInfos.unshift(u),this.fileInfos.save(),n&&n(t)};if(o){const n=3;let c=0;const h=()=>{if(++c===n)return d("Too many load attempts");r.info("Load from storage, attempt "+c),s.Storage[o].load(a,l,((n,o,a)=>(r.info("Load from storage",a,n||"no error"),e.active?n?d(n):void e.mergeOrUpdate(o,t.remoteKey,(t=>{if(r.info("Merge complete",t||"no error"),this.refresh(),t)return"InvalidKey"===t.code&&(r.info("Remote key changed, request to enter new key"),i.Events.emit("remote-key-changed",{file:e})),d(t);a&&a.rev&&(r.info("Update rev in file info"),u.rev=a.rev),e.syncDate=new Date,e.modified?(r.info("Updated sync date, saving modified file"),m()):e.dirty?(r.info("Saving not modified dirty file to cache"),s.Storage.cache.save(u.id,null,o,(t=>{if(t)return d(t);e.dirty=!1,r.info("Complete, remove dirty flag"),d()}))):(r.info("Complete, no changes"),d())})):d("File is closed"))))},p=t=>{r.info("Save data to storage");const n=u.storage===o?u.rev:void 0;s.Storage[o].save(a,l,t,((n,i)=>{n&&n.revConflict?(r.info("Save rev conflict, reloading from storage"),h()):n?(r.info("Error saving data to storage"),d(n)):(i&&i.rev&&(r.info("Update rev in file info"),u.rev=i.rev),i&&i.path&&(r.info("Update path in file info",i.path),e.path=i.path,u.path=i.path,a=i.path),e.syncDate=new Date,r.info("Save to storage complete, update sync date"),this.scheduleBackupFile(e,t),d())}),n)},m=()=>{r.info("Getting file data for saving"),e.getData(((t,n)=>{if(n)return d(n);"file"===o?(r.info("Saving to file storage"),p(t)):e.dirty?(r.info("Saving to cache"),s.Storage.cache.save(u.id,null,t,(n=>{if(n)return d(n);e.dirty=!1,r.info("Saved to cache, saving to storage"),p(t)}))):(r.info("Saving to storage, skip cache because not dirty"),p(t))}))};r.info("Stat file"),s.Storage[o].stat(a,l,((t,n)=>{if(!e.active)return d("File is closed");t?t.notFound?(r.info("File does not exist in storage, creating"),m()):e.dirty?(r.info("Stat error, dirty, save to cache",t||"no error"),e.getData(((n,i)=>{if(i)return r.error("Error getting file data",i),d(t);s.Storage.cache.save(u.id,null,n,(n=>{n&&r.error("Error saving to cache",n),n||(e.dirty=!1),r.info("Saved to cache, exit with error",t||"no error"),d(t)}))}))):(r.info("Stat error, not dirty",t||"no error"),d(t)):n.rev===u.rev?e.modified?(r.info("Stat found same version, modified, saving"),m()):(r.info("Stat found same version, not modified"),d()):(r.info("Found new version, loading from storage"),h())}))}else{if(!e.modified&&u.id===e.id)return r.info("Local, not modified"),d();r.info("Local, save to cache"),e.getData(((t,n)=>{if(n)return d(n);s.Storage.cache.save(u.id,null,t,(n=>{r.info("Saved to cache",n||"no error"),d(n),n||this.scheduleBackupFile(e,t)}))}))}}clearStoredKeyFiles(){for(const e of this.fileInfos)e.set({keyFileName:null,keyFilePath:null,keyFileHash:null});this.fileInfos.save()}unsetKeyFile(e){this.fileInfos.get(e).set({keyFileName:null,keyFilePath:null,keyFileHash:null}),this.fileInfos.save()}setFileBackup(e,t){const n=this.fileInfos.get(e);n&&(n.backup=t),this.fileInfos.save()}backupFile(e,t,n){const i=e.opts;let r=e.backup;const o=new E.Logger("backup",e.name);if(!r||!r.storage||!r.path)return n("Invalid backup settings");let a=r.path.replace("{date}",w.DateFormat.dtStrFs(new Date));o.info("Backup file to",r.storage,a);const l=()=>{s.Storage[r.storage].getPathForName&&(a=s.Storage[r.storage].getPathForName(a)),s.Storage[r.storage].save(a,i,t,(t=>{t?o.error("Backup error",t):(o.info("Backup complete"),r=e.backup,r.lastTime=Date.now(),delete r.pending,e.backup=r,this.setFileBackup(e.id,r)),n(t)}))};let c=k.UrlFormat.fileToDir(a);s.Storage[r.storage].getPathForName&&(c=s.Storage[r.storage].getPathForName(c).replace(".kdbx","")),s.Storage[r.storage].stat(c,i,(e=>{if(e)if(e.notFound){if(o.info("Backup folder does not exist"),!s.Storage[r.storage].mkdir)return n("Mkdir not supported by "+r.storage);s.Storage[r.storage].mkdir(c,(e=>{e?(o.error("Error creating backup folder",e),n("Error creating backup folder")):(o.info("Backup folder created"),l())}))}else o.error("Stat folder error",e),n("Cannot stat backup folder");else o.info("Backup folder exists, saving"),l()}))}scheduleBackupFile(e,t){const n=e.backup;if(!n||!n.enabled)return;const i=new E.Logger("backup",e.name);let s=!1;if(n.lastTime){const e=new Date(n.lastTime);switch(n.schedule){case"0":break;case"1d":e.setDate(e.getDate()+1);break;case"1w":e.setDate(e.getDate()+7);break;case"1m":e.setMonth(e.getMonth()+1);break;default:return}e.getTime()<=Date.now()&&(s=!0),i.debug("Last backup time: "+new Date(n.lastTime)+", schedule: "+n.schedule+", next time: "+e+", "+(s?"backup now":"skip backup"))}else s=!0,i.debug("No last backup time, backup now");n.pending||(n.pending=!0,this.setFileBackup(e.id,n)),s&&this.backupFile(e,t,I.noop)}saveFileFingerprint(e,t){if(c.Launcher&&c.Launcher.fingerprints&&!e.fingerprint){const n=this.fileInfos.get(e.id);c.Launcher.fingerprints.register(e.id,t,(e=>{e&&(n.fingerprint=e,this.fileInfos.save())}))}}usbDevicesChanged(){const e=this.attachedYubiKeysCount;if(this.attachedYubiKeysCount=u.UsbListener.attachedYubiKeys,!this.settings.yubiKeyAutoOpen)return;const t=u.UsbListener.attachedYubiKeys>e,n=this.files.some((e=>e.active&&!e.external));t&&n&&!this.openingOtpDevice&&this.tryOpenOtpDeviceInBackground()}tryOpenOtpDeviceInBackground(){this.appLogger.debug("Auto-opening a YubiKey"),this.openOtpDevice((e=>{this.appLogger.debug("YubiKey auto-open complete",e)}))}openOtpDevice(e){this.openingOtpDevice=!0;const t=new A.YubiKeyOtpModel;return t.open((n=>{this.openingOtpDevice=!1,n||this.addFile(t),e(n)})),t}getMatchingOtpEntry(e){if(!this.settings.yubiKeyMatchEntries)return null;for(const t of this.files)if(t.external){const n=t.getMatchingEntry(e);if(n)return n}}}},7614:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AppSettingsModel:()=>a});var i=n(9186),s=n(6524),r=n(4491);class o extends i.Model{constructor(){super(),this.on("change",(()=>this.save()))}load(){return s.SettingsStore.load("app-settings").then((e=>{e&&(this.upgrade(e),this.set(e,{silent:!0}))}))}upgrade(e){!0===e.rememberKeyFiles&&(e.rememberKeyFiles="data"),"en"===e.locale&&(e.locale="en-US"),"macdark"===e.theme&&(e.theme="dark"),"wh"===e.theme&&(e.theme="light")}save(){const e={};for(const[t,n]of Object.entries(this))r.DefaultAppSettings[t]!==n&&(e[t]=n);s.SettingsStore.save("app-settings",e)}}o.defineModelProperties(r.DefaultAppSettings,{extensions:!0});const a=new o},5667:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AttachmentModel:()=>s});var i=n(9186);class s extends i.Model{getBinary(){let e=this.data;if(e&&e.ref&&(e=e.value),e&&e.getBinary&&(e=e.getBinary()),e instanceof ArrayBuffer&&e.byteLength&&(e=new Uint8Array(e)),e instanceof Uint8Array)return e}static fromAttachment(e){const t=function(e){const t=e?e.split(".").pop():void 0;return t?t.toLowerCase():void 0}(e.title);return new s({title:e.title,data:e.data,ext:t,icon:r(t),mimeType:o(t)})}}function r(e){switch(e){case"txt":case"log":case"rtf":case"pem":return"file-alt";case"html":case"htm":case"js":case"css":case"xml":case"config":case"json":case"yaml":case"cpp":case"c":case"h":case"cc":case"hpp":case"mm":case"cs":case"php":case"sh":case"py":case"java":case"rb":case"cfg":case"properties":case"yml":case"asm":case"bat":return"file-code";case"pdf":return"file-pdf";case"zip":case"rar":case"bz":case"bz2":case"7z":case"gzip":case"gz":case"tar":case"cab":case"ace":case"dmg":case"jar":return"file-archive";case"doc":case"docx":return"file-word";case"xls":case"xlsx":return"file-excel";case"ppt":case"pptx":return"file-powerpoint";case"jpeg":case"jpg":case"png":case"gif":case"bmp":case"tiff":case"svg":case"ico":case"psd":return"file-image";case"avi":case"mp4":case"3gp":case"m4v":case"mov":case"mpeg":case"mpg":case"mpe":return"file-video";case"mp3":case"wav":case"flac":return"file-audio"}return"file"}function o(e){switch(e){case"txt":case"log":case"html":case"htm":case"js":case"css":case"xml":case"config":case"json":case"yaml":case"cpp":case"c":case"h":case"cc":case"hpp":case"mm":case"cs":case"php":case"sh":case"py":case"java":case"rb":case"cfg":case"properties":case"yml":case"asm":case"pem":return"text/plain";case"pdf":return"application/pdf";case"jpeg":case"jpg":case"png":case"gif":case"bmp":case"tiff":case"svg":return"image/"+e}}s.defineModelProperties({title:void 0,data:void 0,ext:void 0,icon:void 0,mimeType:void 0})},7725:(e,t,n)=>{"use strict";n.r(t),n.d(t,{EntryModel:()=>w});var i=n(3617),s=n.n(i),r=n(9186),o=n(7614),a=n(1673),l=n(353),c=n(9166),u=n(5667),d=n(4546),h=n(9081),p=n(5563),m=n(8495),f=n(6838),g=n(9907);const A=/^https?:\/\//i,y=/^\{REF:([TNPAU])@I:(\w{32})}$/,v=["title","password","user","url","notes"],b={T:"Title",U:"UserName",P:"Password",A:"URL",N:"Notes"};class w extends r.Model{constructor(e){super(e),this._search=new g.EntrySearch(this)}setEntry(e,t,n){this.entry=e,this.group=t,this.file=n,this.uuid===e.uuid.id&&this._checkUpdatedEntry(),this.hasFieldRefs=!1,this._fillByEntry(),this.hasFieldRefs=!0}_fillByEntry(){const e=this.entry;this.set({id:this.file.subId(e.uuid.id),uuid:e.uuid.id},{silent:!0}),this.fileName=this.file.name,this.groupName=this.group.title,this.title=this._getFieldString("Title"),this.password=this._getPassword(),this.notes=this._getFieldString("Notes"),this.url=this._getFieldString("URL"),this.displayUrl=this._getDisplayUrl(this._getFieldString("URL")),this.user=this._getFieldString("UserName"),this.iconId=e.icon,this.icon=this._iconFromId(e.icon),this.tags=e.tags,this.color=this._colorToModel(e.bgColor)||this._colorToModel(e.fgColor),this.fields=this._fieldsToModel(e.fields),this.attachments=this._attachmentsToModel(e.binaries),this.created=e.times.creationTime,this.updated=e.times.lastModTime,this.expires=e.times.expires?e.times.expiryTime:void 0,this.expired=e.times.expires&&e.times.expiryTime<=new Date,this.historyLength=e.history.length,this.titleUserLower=`${this.title}:${this.user}`.toLowerCase(),this._buildCustomIcon(),this._buildSearchText(),this._buildSearchTags(),this._buildSearchColor(),this._buildAutoType(),this.hasFieldRefs&&this.resolveFieldReferences()}_getPassword(){const e=this.entry.fields.Password||s().ProtectedValue.fromString("");return e.isProtected?e:s().ProtectedValue.fromString(e)}_getFieldString(e){const t=this.entry.fields[e];return t?t.isProtected?t.getText():t.toString():""}_checkUpdatedEntry(){this.isJustCreated&&(this.isJustCreated=!1),this.canBeDeleted&&(this.canBeDeleted=!1),this.unsaved&&+this.updated!=+this.entry.times.lastModTime&&(this.unsaved=!1)}_buildSearchText(){let e="";for(const t of Object.values(this.entry.fields))"string"==typeof t&&(e+=t.toLowerCase()+"\n");this.entry.tags.forEach((t=>{e+=t.toLowerCase()+"\n"})),this.attachments.forEach((t=>{e+=t.title.toLowerCase()+"\n"})),this.searchText=e}_buildCustomIcon(){this.customIcon=null,this.customIconId=null,this.entry.customIcon&&(this.customIcon=m.IconUrlFormat.toDataUrl(this.file.db.meta.customIcons[this.entry.customIcon]),this.customIconId=this.entry.customIcon.toString())}_buildSearchTags(){this.searchTags=this.entry.tags.map((e=>e.toLowerCase()))}_buildSearchColor(){this.searchColor=this.color}_buildAutoType(){this.autoTypeEnabled=this.entry.autoType.enabled,this.autoTypeObfuscation=this.entry.autoType.obfuscation===s().Consts.AutoTypeObfuscationOptions.UseClipboard,this.autoTypeSequence=this.entry.autoType.defaultSequence,this.autoTypeWindows=this.entry.autoType.items.map(this._convertAutoTypeItem)}_convertAutoTypeItem(e){return{window:e.window,sequence:e.keystrokeSequence}}_iconFromId(e){return l.IconMap[e]}_getDisplayUrl(e){return e?e.replace(A,""):""}_colorToModel(e){return e?d.Color.getNearest(e):null}_fieldsToModel(e){return(0,f.omit)(e,c.BuiltInFields)}_attachmentsToModel(e){const t=[];for(let[n,i]of Object.entries(e))i&&i.ref&&(i=i.value),i&&t.push(u.AttachmentModel.fromAttachment({data:i,title:n}));return t}_entryModified(){this.unsaved||(this.unsaved=!0,0!==this.file.historyMaxItems&&this.entry.pushHistory(),this.file.setModified()),this.isJustCreated&&(this.isJustCreated=!1),this.entry.times.update()}setSaved(){this.unsaved&&(this.unsaved=!1),this.canBeDeleted&&(this.canBeDeleted=!1)}matches(e){return this._search.matches(e)}getAllFields(){return this.entry.fields}getHistoryEntriesForSearch(){return this.entry.history}resolveFieldReferences(){this.hasFieldRefs=!1,v.forEach((e=>{const t=this[e],n=this._resolveFieldReference(t);void 0!==n&&(this[e]=n,this.hasFieldRefs=!0)}))}getFieldValue(e){let t;if(e=e.toLowerCase(),Object.keys(this.entry.fields).some((n=>n.toLowerCase()===e&&(t=n,!0))),t){let e=this.entry.fields[t];const n=this._resolveFieldReference(e);return void 0!==n&&(e=n),e}}_resolveFieldReference(e){if(!e)return;if(e.isProtected&&e.isFieldReference()&&(e=e.getText()),"string"!=typeof e)return;const t=e.match(y);return t?this._getReferenceValue(t[1],t[2]):void 0}_getReferenceValue(e,t){const n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=parseInt(t.substr(2*e,2),16);const i=new(s().KdbxUuid)(n),r=this.file.getEntry(this.file.subId(i.id));if(r)return r.entry.fields[b[e]]}setColor(e){this._entryModified(),this.entry.bgColor=d.Color.getKnownBgColor(e),this._fillByEntry()}setIcon(e){this._entryModified(),this.entry.icon=e,this.entry.customIcon=void 0,this._fillByEntry()}setCustomIcon(e){this._entryModified(),this.entry.customIcon=new(s().KdbxUuid)(e),this._fillByEntry()}setExpires(e){this._entryModified(),this.entry.times.expiryTime=e instanceof Date?e:void 0,this.entry.times.expires=!!e,this._fillByEntry()}setTags(e){this._entryModified(),this.entry.tags=e,this._fillByEntry()}renameTag(e,t){const n=this.entry.tags.findIndex((t=>t.toLowerCase()===e.toLowerCase()));n<0||(this._entryModified(),this.entry.tags.splice(n,1),t&&this.entry.tags.push(t),this._fillByEntry())}setField(e,t,n){t&&("string"==typeof t||t.isProtected&&t.byteLength)||n||c.BuiltInFields.indexOf(e)>=0?(this._entryModified(),t=this.sanitizeFieldValue(t),this.entry.fields[e]=t):Object.prototype.hasOwnProperty.call(this.entry.fields,e)&&(this._entryModified(),delete this.entry.fields[e]),this._fillByEntry()}sanitizeFieldValue(e){return e&&!e.isProtected&&(e=e.replace(/[\x00-\x09\x0B-\x0C\x0E-\x1F\uFFF0-\uFFFF]/g,"")),e}hasField(e){return Object.prototype.hasOwnProperty.call(this.entry.fields,e)}addAttachment(e,t){return this._entryModified(),this.file.db.createBinary(t).then((t=>{this.entry.binaries[e]=t,this._fillByEntry()}))}removeAttachment(e){this._entryModified(),delete this.entry.binaries[e],this._fillByEntry()}getHistory(){const e=this.entry.history.map((function(e){return w.fromEntry(e,this.group,this.file)}),this);return e.push(this),e.sort(((e,t)=>e.updated-t.updated)),e}deleteHistory(e){const t=this.entry.history.indexOf(e);t>=0&&(this.entry.removeHistory(t),this.file.setModified()),this._fillByEntry()}revertToHistoryState(e){this.entry.history.indexOf(e)<0||(this.entry.pushHistory(),this.unsaved=!0,this.file.setModified(),this.entry.fields={},this.entry.binaries={},this.entry.copyFrom(e),this._entryModified(),this._fillByEntry())}discardUnsaved(){if(this.unsaved&&this.entry.history.length){this.unsaved=!1;const e=this.entry.history[this.entry.history.length-1];this.entry.removeHistory(this.entry.history.length-1),this.entry.fields={},this.entry.binaries={},this.entry.copyFrom(e),this._fillByEntry()}}moveToTrash(){this.file.setModified(),this.isJustCreated&&(this.isJustCreated=!1),this.file.db.remove(this.entry),this.file.reload()}deleteFromTrash(){this.file.setModified(),this.file.db.move(this.entry,null),this.file.reload()}removeWithoutHistory(){if(this.canBeDeleted){const e=this.group.group.entries.indexOf(this.entry);e>=0&&this.group.group.entries.splice(e,1),this.file.reload()}}detach(){return this.file.setModified(),this.file.db.move(this.entry,null),this.file.reload(),this.entry}moveToFile(e){this.canBeDeleted&&(this.removeWithoutHistory(),this.group=e.groups[0],this.file=e,this._fillByEntry(),this.entry.times.update(),this.group.group.entries.push(this.entry),this.group.addEntry(this),this.isJustCreated=!0,this.unsaved=!0,this.file.setModified())}initOtpGenerator(){let e;if(this.fields.otp){if(e=this.fields.otp,e.isProtected&&(e=e.getText()),h.Otp.isSecret(e.replace(/\s/g,"")))e=h.Otp.makeUrl(e.replace(/\s/g,"").toUpperCase());else if(0!==e.toLowerCase().lastIndexOf("otpauth:",0)){const t={};e.split("&").forEach((e=>{const n=e.split("=",2);t[n[0]]=decodeURIComponent(n[1]).replace(/=/g,"")})),t.key&&(e=h.Otp.makeUrl(t.key,t.step,t.size))}}else if(this.entry.fields["TOTP Seed"]){let t=this.entry.fields["TOTP Seed"];if(t.isProtected&&(t=t.getText()),t){let n,i,r=this.entry.fields["TOTP Settings"];r&&r.isProtected&&(r=r.getText()),r&&(r=r.split(";"),r.length>0&&r[0]>0&&(n=r[0]),r.length>1&&r[1]>0&&(i=r[1])),e=h.Otp.makeUrl(t,n,i),this.fields.otp=s().ProtectedValue.fromString(e)}}if(e){if(this.otpGenerator&&this.otpGenerator.url===e)return;try{this.otpGenerator=h.Otp.parseUrl(e)}catch(e){this.otpGenerator=null}}else this.otpGenerator=null}setOtp(e){this.otpGenerator=e,this.setOtpUrl(e.url)}setOtpUrl(e){this.setField("otp",e?s().ProtectedValue.fromString(e):void 0),delete this.entry.fields["TOTP Seed"],delete this.entry.fields["TOTP Settings"]}getEffectiveEnableAutoType(){return"boolean"==typeof this.entry.autoType.enabled?this.entry.autoType.enabled:this.group.getEffectiveEnableAutoType()}getEffectiveAutoTypeSeq(){return this.entry.autoType.defaultSequence||this.group.getEffectiveAutoTypeSeq()}setEnableAutoType(e){this._entryModified(),this.entry.autoType.enabled=e,this._buildAutoType()}setAutoTypeObfuscation(e){this._entryModified(),this.entry.autoType.obfuscation=e?s().Consts.AutoTypeObfuscationOptions.UseClipboard:s().Consts.AutoTypeObfuscationOptions.None,this._buildAutoType()}setAutoTypeSeq(e){this._entryModified(),this.entry.autoType.defaultSequence=e||void 0,this._buildAutoType()}getGroupPath(){let e=this.group;const t=[];for(;e;)t.unshift(e.title),e=e.parentGroup;return t}cloneEntry(e){const t=w.newEntry(this.group,this.file),n=t.entry.uuid;return t.entry.copyFrom(this.entry),t.entry.uuid=n,t.entry.times.update(),t.entry.times.creationTime=t.entry.times.lastModTime,t.entry.fields.Title=this.title+e,t._fillByEntry(),this.file.reload(),t}copyFromTemplate(e){const t=this.entry.uuid;this.entry.copyFrom(e.entry),this.entry.uuid=t,this.entry.times.update(),this.entry.times.creationTime=this.entry.times.lastModTime,this.entry.fields.Title="",this._fillByEntry()}getRank(e){const t=e.textLower;if(!t)return 0;const n=e.advanced&&e.advanced.protect,i={Title:10,URL:8,UserName:5,Notes:2};return Object.keys(i).concat(Object.keys(this.fields)).reduce(((e,s)=>{const r=this.entry.fields[s];if(!r)return e;if(r.isProtected&&(!n||!r.length))return e;return e+p.Ranking.getStringRank(t,r)*(i[s]||2)}),0)}getHtml(){return a.KdbxToHtml.entryToHtml(this.file.db,this.entry)}static fromEntry(e,t,n){const i=new w;return i.setEntry(e,t,n),i}static newEntry(e,t,n){const i=new w,s=t.db.createEntry(e.group);return o.AppSettingsModel.useGroupIconForEntries&&e.icon&&e.iconId&&(s.icon=e.iconId),n&&n.tag&&(s.tags=[n.tag]),i.setEntry(s,e,t),i.entry.times.update(),i.unsaved=!0,i.isJustCreated=!0,i.canBeDeleted=!0,e.addEntry(i),t.setModified(),i}}w.defineModelProperties({},{extensions:!0})},5757:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ExternalDeviceModel:()=>r});var i=n(9186),s=n(1797);class r extends i.Model{constructor(...e){super(...e),this.entries=new s.ExternalEntryCollection,this.groups=[],this.entryMap={}}close(){}forEachEntry(e,t){if(!(e.trash||e.group||e.tag))for(const n of this.entries)n.matches(e)&&t(n)}entryId(e,t){return`${e}:${t}`.toLowerCase()}getMatchingEntry(e){return this.entryMap[this.entryId(e.title,e.user)]}_buildEntryMap(){for(const e of this.entries)this.entryMap[e.id.toLowerCase()]=e}}r.defineModelProperties({id:"",external:!0,readOnly:!0,active:!1,entries:void 0,groups:void 0,name:void 0,shortName:void 0,deviceClassName:void 0,entryMap:void 0})},5940:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ExternalEntryModel:()=>r});var i=n(9186),s=n(9907);class r extends i.Model{constructor(e){super(e),this.tags=[],this.fields={},this._buildSearchText(),this._buildFields(),this._search=new s.EntrySearch(this)}matches(e){return this._search.matches(e)}_buildSearchText(){let e="";this.title&&(e+=this.title.toLowerCase()),this.user&&(e+="\n"+this.user.toLowerCase()),this.searchText=e}_buildFields(){this.fields.Title=this.title}getAllFields(){return this.fields}getFieldValue(e){return this.fields[e]}getEffectiveAutoTypeSeq(){return"{TOTP}{ENTER}"}}r.defineModelProperties({id:"",external:!0,readOnly:!0,device:void 0,deviceSubId:null,title:void 0,description:void 0,fields:void 0,icon:void 0,tags:void 0,searchText:void 0,_search:void 0})},2140:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ExternalOtpDeviceModel:()=>s});var i=n(5757);class s extends i.ExternalDeviceModel{open(e){throw"Not implemented"}cancelOpen(){throw"Not implemented"}close(e){throw"Not implemented"}getOtp(e){throw"Not implemented"}}},9224:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ExternalOtpEntryModel:()=>s});var i=n(5940);class s extends i.ExternalEntryModel{constructor(e){super(Object.assign({},e,{description:e.user}))}initOtpGenerator(){if(this.otpGenerator)return;const e={next:t=>{if(e.otp&&e.expires){const n=e.expires-Date.now();if(n>0)return t(null,e.otp,n)}e.promise?e.promise.then((({err:e,otp:n,timeLeft:i})=>{t(e,n,i)})):e.promise=new Promise((n=>{e.otpState=this.device.getOtp(this,((i,s,r)=>{e.otpState=null,e.promise=null,s&&r>0?(e.otp=s,e.expires=Date.now()+r):(e.otp=null,e.expires=null),t(i,s,r),n({err:i,otp:s,timeLeft:r})}))}))},cancel:()=>{this.otpState&&this.device.cancelGetOtp(this,this.otpState)}};this.otpGenerator=e}_buildFields(){super._buildFields(),this.fields.UserName=this.user}}s.defineModelProperties({user:void 0,otpGenerator:void 0,needsTouch:!1})},7833:(e,t,n)=>{"use strict";n.r(t),n.d(t,{YubiKeyOtpModel:()=>u});var i=n(7201),s=n(2140),r=n(9224),o=n(2363),a=n(8647),l=n(9777);const c=new o.Logger("yubikey");class u extends s.ExternalOtpDeviceModel{constructor(e){super(Object.assign({id:"yubikey",name:"YubiKey",shortName:"YubiKey",deviceClassName:"YubiKey"},e)),this.onUsbDevicesChanged=()=>{0===a.UsbListener.attachedYubiKeys&&this.emit("ejected")}}open(e){l.YubiKey.listWithYkman(((t,n)=>{if(t)return e(t);let i=0;const s=[],r=()=>{const t=n.shift();this._addYubiKey(t.serial,(t=>{if(l.YubiKey.aborted)return e("Aborted");t?s.push(t):i++,n&&n.length?r():(i&&this._openComplete(),e(i?null:s[0]))}))};r()}))}_addYubiKey(e,t){c.info("Adding YubiKey",e),l.YubiKey.getOtpCodes(e,((n,i)=>{if(n)return t(n);for(const t of i)this.entries.push(new r.ExternalOtpEntryModel({id:this.entryId(t.title,t.user),device:this,deviceSubId:e,icon:"clock",title:t.title,user:t.user,needsTouch:t.needsTouch}));t()}))}_openComplete(){this.active=!0,this._buildEntryMap(),i.Events.on("usb-devices-changed",this.onUsbDevicesChanged)}cancelOpen(){l.YubiKey.abort(),i.Events.off("usb-devices-changed",this.onUsbDevicesChanged)}getOtp(e,t){const n=3e4-Date.now()%3e4+500;l.YubiKey.getOtp(e.deviceSubId,`${e.title}:${e.user}`,((e,i)=>{t(e,i,n)}))}cancelGetOtp(e,t){t&&t.kill()}close(e){i.Events.off("usb-devices-changed",this.onUsbDevicesChanged),this.set({active:!1})}}u.defineModelProperties({onUsbDevicesChanged:null})},3850:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FileInfoModel:()=>o});var i=n(9186),s=n(6838);const r={id:"",name:"",storage:null,path:null,modified:!1,editState:null,rev:null,syncDate:null,openDate:null,keyFileName:null,keyFileHash:null,keyFilePath:null,opts:null,backup:null,fingerprint:null,chalResp:null};class o extends i.Model{constructor(e){e=(0,s.pick)(Object.assign({},e),Object.keys(r));for(const[t,n]of Object.entries(e))/Date$/.test(t)&&(e[t]=n?new Date(n):null);super(e)}}o.defineModelProperties(r)},7449:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FileModel:()=>y});var i=n(3617),s=n.n(i),r=n(4181),o=n.n(r),a=n(9186),l=n(7201),c=n(6195),u=n(1673),d=n(5572),h=n(7614),p=n(8495),m=n(2363),f=n(6838),g=n(9621);const A=new m.Logger("file");class y extends a.Model{constructor(e){super(Object.assign({entryMap:{},groupMap:{}},e))}open(e,t,n,i){try{const r=g.ChalRespCalculator.build(this.chalResp),o=new(s().Credentials)(e,n,r),a=A.ts();s().Kdbx.load(t,o).then((r=>{this.db=r,this.readModel(),this.setOpenFile({passwordLength:e?e.textLength:0}),n&&s().ByteUtils.zeroBuffer(n),this.fixVersion(),A.info("Opened file "+this.name+": "+A.ts(a)+", "+this.kdfArgsToString(r.header)+", "+Math.round(t.byteLength/1024)+" kB"),i()})).catch((r=>{if(r.code===s().Consts.ErrorCodes.InvalidKey&&e&&!e.byteLength)return A.info("Error opening file with empty password, try to open with null password"),this.open(null,t,n,i);A.error("Error opening file",r.code,r.message,r),i(r)}))}catch(e){A.error("Error opening file",e,e.code,e.message,e),i(e)}}kdfArgsToString(e){return e.kdfParameters?e.kdfParameters.keys().map((t=>{const n=e.kdfParameters.get(t);if(!(n instanceof ArrayBuffer))return t+"="+n})).filter((e=>e)).join("&"):e.keyEncryptionRounds?e.keyEncryptionRounds+" rounds":"?"}create(e){const t=s().ProtectedValue.fromString(""),n=new(s().Credentials)(t);this.db=s().Kdbx.create(n,e),this.name=e,this.readModel(),this.set({active:!0,created:!0,name:e})}importWithXml(e,t){try{const n=A.ts(),i=s().ProtectedValue.fromString(""),r=new(s().Credentials)(i);s().Kdbx.loadXml(e,r).then((e=>{this.db=e,this.readModel(),this.set({active:!0,created:!0}),A.info("Imported file "+this.name+": "+A.ts(n)),t()})).catch((e=>{A.error("Error importing file",e.code,e.message,e),t(e)}))}catch(e){A.error("Error importing file",e,e.code,e.message,e),t(e)}}openDemo(e){const t=s().ProtectedValue.fromString("demo"),n=new(s().Credentials)(t),i=s().ByteUtils.arrayToBuffer(s().ByteUtils.base64ToBytes(o()));s().Kdbx.load(i,n).then((t=>{this.db=t,this.name="Demo",this.readModel(),this.setOpenFile({passwordLength:4,demo:!0}),e()}))}setOpenFile(e){this.set(Object.assign({},e,{active:!0,oldKeyFileName:this.keyFileName,oldPasswordLength:e.passwordLength,passwordChanged:!1,keyFileChanged:!1})),this.oldPasswordHash=this.db.credentials.passwordHash,this.oldKeyFileHash=this.db.credentials.keyFileHash,this.oldKeyChangeDate=this.db.meta.keyChanged}readModel(){const e=new c.GroupCollection;this.set({uuid:this.db.getDefaultGroup().uuid.toString(),groups:e,formatVersion:this.db.header.versionMajor,defaultUser:this.db.meta.defaultUser,recycleBinEnabled:this.db.meta.recycleBinEnabled,historyMaxItems:this.db.meta.historyMaxItems,historyMaxSize:this.db.meta.historyMaxSize,keyEncryptionRounds:this.db.header.keyEncryptionRounds,keyChangeForce:this.db.meta.keyChangeForce,kdfName:this.readKdfName(),kdfParameters:this.readKdfParams()},{silent:!0}),this.db.groups.forEach((function(t){let n=this.getGroup(this.subId(t.uuid.id));n?n.setGroup(t,this):n=d.GroupModel.fromGroup(t,this),e.push(n)}),this),this.buildObjectMap(),this.resolveFieldReferences()}readKdfName(){if(4===this.db.header.versionMajor&&this.db.header.kdfParameters){let e=this.db.header.kdfParameters.get("$UUID");if(e)switch(e=s().ByteUtils.bytesToBase64(e),e){case s().Consts.KdfId.Argon2d:return"Argon2d";case s().Consts.KdfId.Argon2id:return"Argon2id";case s().Consts.KdfId.Aes:return"Aes"}return"Unknown"}return"Aes"}readKdfParams(){const e=this.db.header.kdfParameters;if(!e)return;let t=e.get("$UUID");if(t)switch(t=s().ByteUtils.bytesToBase64(t),t){case s().Consts.KdfId.Argon2d:case s().Consts.KdfId.Argon2id:return{parallelism:e.get("P").valueOf(),iterations:e.get("I").valueOf(),memory:e.get("M").valueOf()};case s().Consts.KdfId.Aes:return{rounds:e.get("R").valueOf()};default:return}}subId(e){return this.id+":"+e}buildObjectMap(){const e={},t={};this.forEachGroup((n=>{t[n.id]=n,n.forEachOwnEntry(null,(t=>{e[t.id]=t}))}),{includeDisabled:!0}),this.entryMap=e,this.groupMap=t}resolveFieldReferences(){const e=this.entryMap;Object.keys(e).forEach((t=>{e[t].resolveFieldReferences()}))}fixVersion(){"KdbxWeb"===this.db.meta.generator&&4===this.db.header.versionMajor&&1===this.db.header.versionMinor&&(this.db.header.versionMinor=0,A.info("Fixed file version: 4.1 => 4.0"))}reload(){this.buildObjectMap(),this.readModel(),this.emit("reload",this)}mergeOrUpdate(e,t,n){let i,r=Promise.resolve();t?(i=new(s().Credentials)(s().ProtectedValue.fromString("")),r=i.ready.then((()=>{const e=[];return t.password?e.push(i.setPassword(t.password)):i.passwordHash=this.db.credentials.passwordHash,t.keyFileName&&(t.keyFileData?e.push(i.setKeyFile(t.keyFileData)):i.keyFileHash=this.db.credentials.keyFileHash),Promise.all(e)}))):i=this.db.credentials,r.then((()=>{s().Kdbx.load(e,i).then((e=>{if(this.modified)try{t&&e.meta.keyChanged>this.db.meta.keyChanged&&(this.db.credentials=e.credentials,this.keyFileName=t.keyFileName||"",t.password&&(this.passwordLength=t.password.textLength)),this.db.merge(e)}catch(e){return A.error("File merge error",e),n(e)}else this.db=e;this.dirty=!0,this.reload(),n()})).catch((e=>{A.error("Error opening file to merge",e.code,e.message,e),n(e)}))}))}getLocalEditState(){return this.db.getLocalEditState()}setLocalEditState(e){this.db.setLocalEditState(e)}close(){this.set({keyFileName:"",passwordLength:0,modified:!1,dirty:!1,active:!1,created:!1,groups:null,passwordChanged:!1,keyFileChanged:!1,syncing:!1}),this.chalResp&&!h.AppSettingsModel.yubiKeyRememberChalResp&&g.ChalRespCalculator.clearCache(this.chalResp)}getEntry(e){return this.entryMap[e]}getGroup(e){return this.groupMap[e]}forEachEntry(e,t){let n=this;e.trash?n=this.getGroup(this.db.meta.recycleBinUuid?this.subId(this.db.meta.recycleBinUuid.id):null):e.group&&(n=this.getGroup(e.group)),n&&(n.forEachOwnEntry&&n.forEachOwnEntry(e,t),e.group&&!e.subGroups||n.forEachGroup((n=>{n.forEachOwnEntry(e,t)}),e))}forEachGroup(e,t){this.groups.forEach((n=>{!1!==e(n)&&n.forEachGroup(e,t)}))}getTrashGroup(){return this.db.meta.recycleBinEnabled?this.getGroup(this.subId(this.db.meta.recycleBinUuid.id)):null}getEntryTemplatesGroup(){return this.db.meta.entryTemplatesGroup?this.getGroup(this.subId(this.db.meta.entryTemplatesGroup.id)):null}createEntryTemplatesGroup(){const e=this.groups[0],t=d.GroupModel.newGroup(e,this);return t.setName("Templates"),this.db.meta.entryTemplatesGroup=t.group.uuid,this.reload(),t}setModified(){this.demo||(this.set({modified:!0,dirty:!0}),l.Events.emit("file-modified"))}getData(e){this.db.cleanup({historyRules:!0,customIcons:!0,binaries:!0}),this.db.cleanup({binaries:!0}),this.db.save().then((t=>{e(t)})).catch((t=>{A.error("Error saving file",this.name,t),e(void 0,t)}))}getXml(e){this.db.saveXml(!0).then((t=>{e(t)}))}getHtml(e){e(u.KdbxToHtml.convert(this.db,{name:this.name}))}getKeyFileHash(){const e=this.db.credentials.keyFileHash;return e?s().ByteUtils.bytesToBase64(e.getBinary()):null}forEachEntryTemplate(e){if(!this.db.meta.entryTemplatesGroup)return;const t=this.getGroup(this.subId(this.db.meta.entryTemplatesGroup.id));t&&t.forEachOwnEntry({},e)}setSyncProgress(){this.set({syncing:!0})}setSyncComplete(e,t,n){n||this.db.removeLocalEditState();const i=this.modified&&!!n;this.set({created:!1,path:e||this.path,storage:t||this.storage,modified:i,dirty:!!n&&this.dirty,syncing:!1,syncError:n});this.passwordChanged&&this.fingerprint&&!n&&(this.fingerprint=null),this.open&&(this.setOpenFile({passwordLength:this.passwordLength}),this.forEachEntry({includeDisabled:!0},(e=>e.setSaved())))}setPassword(e){this.db.credentials.setPassword(e),this.db.meta.keyChanged=new Date,this.set({passwordLength:e.textLength,passwordChanged:!0}),this.setModified()}resetPassword(){this.db.credentials.passwordHash=this.oldPasswordHash,this.db.credentials.keyFileHash===this.oldKeyFileHash&&(this.db.meta.keyChanged=this.oldKeyChangeDate),this.set({passwordLength:this.oldPasswordLength,passwordChanged:!1})}setKeyFile(e,t){this.db.credentials.setKeyFile(e),this.db.meta.keyChanged=new Date,this.set({keyFileName:t,keyFileChanged:!0}),this.setModified()}generateAndSetKeyFile(){return s().Credentials.createRandomKeyFile().then((e=>(this.setKeyFile(e,"Generated"),e)))}resetKeyFile(){this.db.credentials.keyFileHash=this.oldKeyFileHash,this.db.credentials.passwordHash===this.oldPasswordHash&&(this.db.meta.keyChanged=this.oldKeyChangeDate),this.set({keyFileName:this.oldKeyFileName,keyFileChanged:!1})}removeKeyFile(){this.db.credentials.keyFileHash=null;const e=!!this.oldKeyFileHash;e||this.db.credentials.passwordHash!==this.oldPasswordHash||(this.db.meta.keyChanged=this.oldKeyChangeDate),this.set({keyFileName:"",keyFilePath:"",keyFileChanged:e}),l.Events.emit("unset-keyfile",this.id),this.setModified()}isKeyChangePending(e){if(!this.db.meta.keyChanged)return!1;const t=e?this.db.meta.keyChangeForce:this.db.meta.keyChangeRec;if(!t||t<0||isNaN(t))return!1;return(Date.now()-this.db.meta.keyChanged)/1e3/3600/24>t}setChallengeResponse(e){this.chalResp&&!h.AppSettingsModel.yubiKeyRememberChalResp&&g.ChalRespCalculator.clearCache(this.chalResp),this.db.credentials.setChallengeResponse(g.ChalRespCalculator.build(e)),this.db.meta.keyChanged=new Date,this.chalResp=e,this.setModified()}setKeyChange(e,t){(isNaN(t)||!t||t<0)&&(t=-1);const n=e?"keyChangeForce":"keyChangeRec";this.db.meta[n]=t,this[n]=t,this.setModified()}setName(e){this.db.meta.name=e,this.db.meta.nameChanged=new Date,this.name=e,this.groups[0].setName(e),this.setModified(),this.reload()}setDefaultUser(e){this.db.meta.defaultUser=e,this.db.meta.defaultUserChanged=new Date,this.defaultUser=e,this.setModified()}setRecycleBinEnabled(e){e=!!e,this.db.meta.recycleBinEnabled=e,e&&this.db.createRecycleBin(),this.recycleBinEnabled=e,this.setModified()}setHistoryMaxItems(e){this.db.meta.historyMaxItems=e,this.historyMaxItems=e,this.setModified()}setHistoryMaxSize(e){this.db.meta.historyMaxSize=e,this.historyMaxSize=e,this.setModified()}setKeyEncryptionRounds(e){this.db.header.keyEncryptionRounds=e,this.keyEncryptionRounds=e,this.setModified()}setKdfParameter(e,t){const n=s().VarDictionary.ValueType;switch(e){case"memory":this.db.header.kdfParameters.set("M",n.UInt64,s().Int64.from(t));break;case"iterations":this.db.header.kdfParameters.set("I",n.UInt64,s().Int64.from(t));break;case"parallelism":this.db.header.kdfParameters.set("P",n.UInt32,t);break;case"rounds":this.db.header.kdfParameters.set("R",n.UInt32,t);break;default:return}this.kdfParameters=this.readKdfParams(),this.setModified()}emptyTrash(){const e=this.getTrashGroup();if(e){let t=!1;e.getOwnSubGroups().slice().forEach((function(e){this.db.move(e,null),t=!0}),this),e.group.entries.slice().forEach((function(e){this.db.move(e,null),t=!0}),this),e.items.length=0,e.entries.length=0,t&&this.setModified()}}getCustomIcons(){return(0,f.mapObject)(this.db.meta.customIcons,(e=>p.IconUrlFormat.toDataUrl(e)))}addCustomIcon(e){const t=s().KdbxUuid.random();return this.db.meta.customIcons[t]=s().ByteUtils.arrayToBuffer(s().ByteUtils.base64ToBytes(e)),t.toString()}renameTag(e,t){this.forEachEntry({},(n=>n.renameTag(e,t)))}setFormatVersion(e){this.db.setVersion(e),this.setModified(),this.readModel()}setKdf(e){if(!this.db.header.kdfParameters)throw new Error("Cannot set KDF on this version");switch(e){case"Aes":this.db.setKdf(s().Consts.KdfId.Aes);break;case"Argon2d":this.db.setKdf(s().Consts.KdfId.Argon2d);break;case"Argon2id":this.db.setKdf(s().Consts.KdfId.Argon2id);break;default:throw new Error("Bad KDF name")}this.setModified(),this.readModel()}static createKeyFileWithHash(e){const t=s().ByteUtils.base64ToBytes(e),n=s().ByteUtils.bytesToHex(t);return s().ByteUtils.stringToBytes(n)}}y.defineModelProperties({id:"",uuid:"",name:"",db:null,entryMap:null,groupMap:null,keyFileName:"",keyFilePath:null,chalResp:null,passwordLength:0,path:"",opts:null,storage:null,modified:!1,dirty:!1,active:!1,created:!1,demo:!1,groups:null,oldPasswordLength:0,oldKeyFileName:"",passwordChanged:!1,keyFileChanged:!1,keyChangeForce:-1,syncing:!1,syncError:null,syncDate:null,backup:null,formatVersion:null,defaultUser:null,recycleBinEnabled:null,historyMaxItems:null,historyMaxSize:null,keyEncryptionRounds:null,kdfName:null,kdfParameters:null,fingerprint:null,oldPasswordHash:null,oldKeyFileHash:null,oldKeyChangeDate:null})},5572:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GroupModel:()=>p});var i=n(3617),s=n.n(i),r=n(353),o=n(7725),a=n(9233),l=n(8495),c=n(6195),u=n(8533);const d=s().Consts.Icons,h="{USERNAME}{TAB}{PASSWORD}{ENTER}";class p extends a.MenuItemModel{setGroup(e,t,n){const i=e.uuid.equals(t.db.meta.recycleBinUuid),s=t.subId(e.uuid.id);this.set({id:s,uuid:e.uuid.id,expanded:e.expanded,visible:!i,items:new c.GroupCollection,entries:new u.EntryCollection,filterValue:s,enableSearching:e.enableSearching,enableAutoType:e.enableAutoType,autoTypeSeq:e.defaultAutoTypeSeq,top:!n,drag:!!n,collapsible:!!n},{silent:!0}),this.group=e,this.file=t,this.parentGroup=n,this._fillByGroup(!0);const r=this.items,a=this.entries,l=e.groups.map((e=>{let n=t.getGroup(t.subId(e.uuid.id));return n?n.setGroup(e,t,this):n=p.fromGroup(e,t,this),n}),this);r.push(...l);const d=e.entries.map((e=>{let n=t.getEntry(t.subId(e.uuid.id));return n?n.setEntry(e,this,t):n=o.EntryModel.fromEntry(e,this,t),n}),this);a.push(...d)}_fillByGroup(e){this.set({title:this.parentGroup?this.group.name:this.file.name,iconId:this.group.icon,icon:this._iconFromId(this.group.icon),customIcon:this._buildCustomIcon(),customIconId:this.group.customIcon?this.group.customIcon.toString():null,expanded:!1!==this.group.expanded},{silent:e})}_iconFromId(e){if(e!==d.Folder&&e!==d.FolderOpen)return r.IconMap[e]}_buildCustomIcon(){return this.customIcon=null,this.group.customIcon?l.IconUrlFormat.toDataUrl(this.file.db.meta.customIcons[this.group.customIcon]):null}_groupModified(){this.isJustCreated&&(this.isJustCreated=!1),this.file.setModified(),this.group.times.update()}forEachGroup(e,t){let n=!0;return this.items.forEach((i=>{i.matches(t)&&(n=!1!==e(i)&&!1!==i.forEachGroup(e,t))})),n}forEachOwnEntry(e,t){this.entries.forEach((function(n){n.matches(e)&&t(n,this)}))}matches(e){return(e&&e.includeDisabled||!1!==this.group.enableSearching&&!this.group.uuid.equals(this.file.db.meta.entryTemplatesGroup))&&(!e||!e.autoType||!1!==this.group.enableAutoType)}getOwnSubGroups(){return this.group.groups}addEntry(e){this.entries.push(e)}addGroup(e){this.items.push(e)}setName(e){this._groupModified(),this.group.name=e,this._fillByGroup()}setIcon(e){this._groupModified(),this.group.icon=e,this.group.customIcon=void 0,this._fillByGroup()}setCustomIcon(e){this._groupModified(),this.group.customIcon=new(s().KdbxUuid)(e),this._fillByGroup()}setExpanded(e){this.group.expanded=e,this.expanded=e}setEnableSearching(e){this._groupModified();let t=!0,n=this.parentGroup;for(;n;){if("boolean"==typeof n.enableSearching){t=n.enableSearching;break}n=n.parentGroup}e===t&&(e=null),this.group.enableSearching=e,this.enableSearching=this.group.enableSearching}getEffectiveEnableSearching(){let e=this;for(;e;){if("boolean"==typeof e.enableSearching)return e.enableSearching;e=e.parentGroup}return!0}setEnableAutoType(e){this._groupModified();let t=!0,n=this.parentGroup;for(;n;){if("boolean"==typeof n.enableAutoType){t=n.enableAutoType;break}n=n.parentGroup}e===t&&(e=null),this.group.enableAutoType=e,this.enableAutoType=this.group.enableAutoType}getEffectiveEnableAutoType(){let e=this;for(;e;){if("boolean"==typeof e.enableAutoType)return e.enableAutoType;e=e.parentGroup}return!0}setAutoTypeSeq(e){this._groupModified(),this.group.defaultAutoTypeSeq=e||void 0,this.autoTypeSeq=this.group.defaultAutoTypeSeq}getEffectiveAutoTypeSeq(){let e=this;for(;e;){if(e.autoTypeSeq)return e.autoTypeSeq;e=e.parentGroup}return h}getParentEffectiveAutoTypeSeq(){return this.parentGroup?this.parentGroup.getEffectiveAutoTypeSeq():h}isEntryTemplatesGroup(){return this.group.uuid.equals(this.file.db.meta.entryTemplatesGroup)}moveToTrash(){this.file.setModified(),this.file.db.remove(this.group),this.group.uuid.equals(this.file.db.meta.entryTemplatesGroup)&&(this.file.db.meta.entryTemplatesGroup=void 0),this.file.reload()}deleteFromTrash(){this.file.db.move(this.group,null),this.file.reload()}removeWithoutHistory(){const e=this.parentGroup.group.groups.indexOf(this.group);e>=0&&this.parentGroup.group.groups.splice(e,1),this.file.reload()}moveHere(e){if(e&&e.id!==this.id)if(e.file===this.file){if(this.file.setModified(),e instanceof p){for(let t=this;t;t=t.parentGroup)if(e===t)return;if(this.group.groups.indexOf(e.group)>=0)return;this.file.db.move(e.group,this.group),this.file.reload()}else if(e instanceof o.EntryModel){if(this.group.entries.indexOf(e.entry)>=0)return;this.file.db.move(e.entry,this.group),this.file.reload()}}else if(e instanceof o.EntryModel){this.file.setModified();const t=e.detach();this.file.db.importEntry(t,this.group,e.file.db),this.file.reload()}}moveToTop(e){if(!(e&&e.id!==this.id&&e.file===this.file&&e instanceof p))return;this.file.setModified();for(let t=this;t;t=t.parentGroup)if(e===t)return;let t=this.parentGroup.group.groups.indexOf(this.group);const n=this.parentGroup.group.groups.indexOf(e.group);n>=0&&n=0&&this.file.db.move(e.group,this.parentGroup.group,t),this.file.reload()}static fromGroup(e,t,n){const i=new p;return i.setGroup(e,t,n),i}static newGroup(e,t){const n=new p,i=t.db.createGroup(e.group);return n.setGroup(i,t,e),n.group.times.update(),n.isJustCreated=!0,e.addGroup(n),t.setModified(),t.reload(),n}}p.defineModelProperties({id:"",uuid:"",iconId:0,entries:null,filterKey:"group",editable:!0,top:!1,drag:!0,drop:!0,enableSearching:!0,enableAutoType:null,autoTypeSeq:null,group:null,file:null,parentGroup:null,customIconId:null,isJustCreated:!1})},5782:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GroupsMenuModel:()=>r});var i=n(6195),s=n(4954);class r extends s.MenuSectionModel{constructor(){super(new i.GroupCollection)}}r.defineModelProperties({scrollable:!0,grow:!0})},9233:(e,t,n)=>{"use strict";n.r(t),n.d(t,{MenuItemModel:()=>o});var i=n(9186),s=n(8604),r=n(4655);class o extends i.Model{constructor(e){super(e),e&&e.file&&e.file.on("change:name",this.changeTitle.bind(this))}addItem(e){this.items.push(e)}addOption(e){this.options||(this.options=new s.MenuOptionCollection),this.options.push(new r.MenuOptionModel(e))}toggleExpanded(){const e=this.items;let t=!this.expanded;e&&e.length||(t=!0),this.expanded=t}changeTitle(e,t){this.title=t}}o.defineModelProperties({id:"",title:"",locTitle:"",icon:"",customIcon:null,active:!1,expanded:!0,items:null,shortcut:null,options:null,cls:null,iconCls:null,disabled:!1,visible:!0,drag:!1,drop:!1,filterKey:null,filterValue:null,collapsible:!1,defaultItem:!1,page:null,editable:!1,file:null,section:null})},4563:(e,t,n)=>{"use strict";n.r(t),n.d(t,{MenuModel:()=>p});var i=n(9186),s=n(7201),r=n(8567),o=n(7017),a=n(2977),l=n(5782),c=n(4954),u=n(2378),d=n(3297),h=n(9491);class p extends i.Model{constructor(){super(),this.menus={},this.allItemsSection=new c.MenuSectionModel([{locTitle:"menuAllItems",icon:"th-large",active:!0,shortcut:a.Keys.DOM_VK_A,filterKey:"*"}]),this.allItemsItem=this.allItemsSection.items[0],this.groupsSection=new l.GroupsMenuModel,this.colorsSection=new c.MenuSectionModel([{locTitle:"menuColors",icon:"bookmark",shortcut:a.Keys.DOM_VK_C,cls:"menu__item-colors",filterKey:"color",filterValue:!0}]),this.colorsItem=this.colorsSection.items[0];const e=[this._getDefaultTagItem()];this.tagsSection=new c.MenuSectionModel(e),this.tagsSection.set({scrollable:!0,drag:!0}),this.tagsSection.defaultItems=e,this.trashSection=new c.MenuSectionModel([{locTitle:"menuTrash",icon:"trash-alt",shortcut:a.Keys.DOM_VK_D,filterKey:"trash",filterValue:!0,drop:!0}]),o.Colors.AllColors.forEach((e=>{const t={cls:`fa ${e}-color`,value:e,filterValue:e};this.colorsSection.items[0].addOption(t)})),this.menus.app=new r.MenuSectionCollection([this.allItemsSection,this.colorsSection,this.tagsSection,this.groupsSection,this.trashSection]),this.generalSection=new c.MenuSectionModel([{locTitle:"menuSetGeneral",icon:"cog",page:"general",section:"top",active:!0},{locTitle:"setGenAppearance",icon:"0",page:"general",section:"appearance",active:!0},{locTitle:"setGenFunction",icon:"0",page:"general",section:"function",active:!0},{locTitle:"setGenLock",icon:"0",page:"general",section:"lock",active:!0},{locTitle:"setGenStorage",icon:"0",page:"general",section:"storage",active:!0},{locTitle:"advanced",icon:"0",page:"general",section:"advanced",active:!0}]),this.shortcutsSection=new c.MenuSectionModel([{locTitle:"shortcuts",icon:"keyboard",page:"shortcuts"}]),this.pluginsSection=new c.MenuSectionModel([{locTitle:"plugins",icon:"puzzle-piece",page:"plugins"}]),h.Launcher&&(this.devicesSection=new c.MenuSectionModel([{locTitle:"menuSetDevices",icon:"usb",page:"devices"}])),this.aboutSection=new c.MenuSectionModel([{locTitle:"menuSetAbout",icon:"info",page:"about"}]),this.helpSection=new c.MenuSectionModel([{locTitle:"help",icon:"question",page:"help"}]),this.filesSection=new c.MenuSectionModel,this.filesSection.set({scrollable:!0,grow:!0}),this.menus.settings=new r.MenuSectionCollection([this.generalSection,this.shortcutsSection,this.pluginsSection,this.devicesSection,this.aboutSection,this.helpSection,this.filesSection].filter((e=>e))),this.sections=this.menus.app,s.Events.on("set-locale",this._setLocale.bind(this)),s.Events.on("select-next-menu-item",this._selectNext.bind(this)),s.Events.on("select-previous-menu-item",this._selectPrevious.bind(this)),this._setLocale()}select(e){const t=this.sections;for(const n of t)this._select(n,e.item);if(t===this.menus.app){this.colorsItem.options.forEach((t=>{t.active=t===e.option})),this.colorsItem.iconCls=e.item===this.colorsItem&&e.option?e.option.value+"-color":null;const t=e.item.filterKey,n=(e.option||e.item).filterValue,i={};i[t]=n,s.Events.emit("set-filter",i)}else t===this.menus.settings&&e.item.page&&s.Events.emit("set-page",{page:e.item.page,section:e.item.section,file:e.item.file})}_selectPrevious(){let e=null;const t=n=>{if(!1===n.visible)return!0;n.active&&(e=n);const i=n.items;i&&i.forEach((n=>n.active&&e?(this.select({item:e}),!1):t(n)))};this.sections.forEach((e=>t(e)))}_selectNext(){let e=null;const t=n=>{if(!1===n.visible)return!0;if(n.active&&e&&n!==e)return this.select({item:n}),e=null,!1;const i=n.items;i&&i.forEach((n=>(n.active&&(e=n),t(n))))};this.sections.forEach((e=>t(e)))}_select(e,t){const n=e.items;if(n)for(const e of n)e.active=e===t,this._select(e,t)}_setLocale(){for(const e of[this.menus.app,this.menus.settings])for(const t of e)for(const e of t.items)e.locTitle&&(e.title=u.StringFormat.capFirst(d.Locale[e.locTitle]));this.tagsSection.defaultItems[0]=this._getDefaultTagItem()}_getDefaultTagItem(){return{title:u.StringFormat.capFirst(d.Locale.tags),icon:"tags",defaultItem:!0,disabled:{header:d.Locale.menuAlertNoTags,body:d.Locale.menuAlertNoTagsBody,icon:"tags"}}}setMenu(e){this.sections=this.menus[e]}}p.defineModelProperties({sections:null,menu:null},{extensions:!0})},4655:(e,t,n)=>{"use strict";n.r(t),n.d(t,{MenuOptionModel:()=>s});var i=n(9186);class s extends i.Model{}s.defineModelProperties({title:"",cls:"",value:"",active:!1,filterValue:null})},4954:(e,t,n)=>{"use strict";n.r(t),n.d(t,{MenuSectionModel:()=>a});var i=n(9186),s=n(900),r=n(9233);function o(e){return e instanceof r.MenuItemModel?e:new r.MenuItemModel(e)}class a extends i.Model{constructor(e=[]){super({items:new s.MenuItemCollection(e.map(o))})}addItem(e){this.items.push(o(e)),this.emit("change-items")}removeAllItems(){this.items.length=0,this.defaultItems&&this.items.push(...this.defaultItems.map((e=>new r.MenuItemModel(e)))),this.emit("change-items")}removeByFile(e){const t=this.items;t.find((n=>(n.file===e||n.file===e)&&(t.remove(n),!0))),this.emit("change-items")}replaceByFile(e,t){const n=this.items;n.find(((i,s)=>(i.file===e||i.file===e)&&(n[s]=t,!0))),this.emit("change-items")}setItems(e){this.items.length=0,this.items.push(...e.map(o)),this.emit("change-items")}}a.defineModelProperties({defaultItems:null,items:null,scrollable:!1,grow:!1,drag:!1,visible:void 0,active:!1})},8925:(e,t,n)=>{"use strict";n.r(t),n.d(t,{RuntimeDataModel:()=>o});var i=n(9186),s=n(6524);class r extends i.Model{constructor(){super(),this.on("change",(()=>this.save()))}load(){return s.SettingsStore.load("runtime-data").then((e=>{e&&this.set(e,{silent:!0})}))}save(){s.SettingsStore.save("runtime-data",this)}}r.defineModelProperties({},{extensions:!0});const o=new r;window.RuntimeDataModel=o},2706:(e,t,n)=>{"use strict";n.r(t),n.d(t,{UpdateModel:()=>o});var i=n(9186),s=n(6524);class r extends i.Model{load(){return s.SettingsStore.load("update-info").then((e=>{if(e)try{for(const[t,n]of Object.entries(e))/Date$/.test(t)&&(e[t]=n?new Date(n):null);this.set(e,{silent:!0})}catch(e){}}))}save(){const e=Object.assign({},this);for(const t of Object.keys(e))0===t.lastIndexOf("update",0)&&delete e[t];s.SettingsStore.save("update-info",e)}}r.defineModelProperties({lastSuccessCheckDate:null,lastCheckDate:null,lastVersion:null,lastVersionReleaseDate:null,lastCheckError:null,lastCheckUpdMin:null,status:null,updateStatus:null,updateError:null,updateManual:!1});const o=new r},484:(e,t,n)=>{"use strict";n.r(t),n.d(t,{PluginApi:()=>s});const i={kdbxweb:n(3617),hbs:n(7109),pikaday:n(4319),qrcode:n(8767)},s={require:e=>i[e]||n(7814)("./"+e)}},1525:(e,t,n)=>{"use strict";n.r(t),n.d(t,{PluginCollection:()=>r});var i=n(9071),s=n(1203);class r extends i.Collection{}r.model=s.Plugin},3172:(e,t,n)=>{"use strict";n.r(t),n.d(t,{PluginGallery:()=>c});var i=n(3617),s=n.n(i),r=n(7201),o=n(6524),a=n(9673),l=n(7536);const c={logger:new(n(2363).Logger)("plugin-gallery"),gallery:null,loading:!1,loadError:null,loadPlugins(){if(this.gallery)return Promise.resolve(this.gallery);this.loading=!0,this.loadError=!1;const e=this.logger.ts();return new Promise((e=>{this.logger.debug("Loading plugins...");const t=new XMLHttpRequest;t.open("GET",a.Links.Plugins+"/plugins.json"),t.responseType="json",t.send(),t.addEventListener("load",(()=>{const n=t.response;e(n)})),t.addEventListener("error",(()=>{this.logger.error("Network error loading plugins"),e()}))})).then((t=>(this.loading=!1,t?this.verifySignature(t).then((t=>(this.loadError=!t,t&&(this.logger.debug(`Loaded ${t.plugins.length} plugins`,this.logger.ts(e)),this.gallery=t,this.saveGallery(t)),r.Events.emit("plugin-gallery-load-complete"),t))):(this.loadError=!0,void r.Events.emit("plugin-gallery-load-complete"))))).catch((e=>{this.loadError=!0,this.logger.error("Error loading plugin gallery",e),r.Events.emit("plugin-gallery-load-complete")}))},verifySignature(e){const t=JSON.stringify(e,null,2).replace(e.signature,"");return l.SignatureVerifier.verify(s().ByteUtils.stringToBytes(t),e.signature).then((t=>{if(t)return e;this.logger.error("JSON signature invalid")})).catch((e=>{this.logger.error("Error verifying plugins signature",e)}))},getCachedGallery(){const e=this.logger.ts();return o.SettingsStore.load("plugin-gallery").then((t=>{if(t)return this.verifySignature(t).then((t=>(this.logger.debug("Loaded cached plugin gallery",this.logger.ts(e)),t)))}))},saveGallery(e){o.SettingsStore.save("plugin-gallery",e)}}},739:(e,t,n)=>{"use strict";n.r(t),n.d(t,{PluginManager:()=>m});var i=n(9186),s=n(7119),r=n(6524),o=n(1203),a=n(1525),l=n(3172),c=n(7536),u=n(2363),d=n(6838);const h=new u.Logger("plugin-mgr");class p extends i.Model{constructor(){super({plugins:new a.PluginCollection})}init(){const e=h.ts();return r.SettingsStore.load("plugins").then((t=>{if(t&&(this.set({autoUpdateAppVersion:t.autoUpdateAppVersion,autoUpdateDate:t.autoUpdateDate}),t&&t.plugins&&t.plugins.length))return l.PluginGallery.getCachedGallery().then((n=>{const i=t.plugins.map((e=>this.loadPlugin(e,n)));return Promise.all(i).then((t=>{this.plugins.push(...t.filter((e=>e))),h.info(`Loaded ${this.plugins.length} plugins`,h.ts(e))}))}))}))}install(e,t,n){return this.emit("change"),o.Plugin.loadFromUrl(e,t).then((e=>this.uninstall(e.id).then((()=>(n&&(e.skipSignatureValidation=!0),e.install(!0,!1).then((()=>{this.plugins.push(e),this.emit("change"),this.saveState()}))))))).catch((e=>{throw this.emit("change"),e}))}installIfNew(e,t,n){const i=this.plugins.find((t=>t.url===e));return i&&"invalid"!==i.status?Promise.resolve():this.install(e,t,n)}uninstall(e){const t=this.plugins.get(e);return t?(this.emit("change"),t.uninstall().then((()=>{this.plugins.remove(e),this.emit("change"),this.saveState()}))):Promise.resolve()}disable(e){const t=this.plugins.get(e);return t&&t.status===o.PluginStatus.STATUS_ACTIVE?(this.emit("change"),t.disable().then((()=>{this.emit("change"),this.saveState()}))):Promise.resolve()}activate(e){const t=this.plugins.get(e);return t&&t.status!==o.PluginStatus.STATUS_ACTIVE?(this.emit("change"),t.install(!0,!0).then((()=>{this.emit("change"),this.saveState()}))):Promise.resolve()}update(e){const t=this.plugins.get(e),n=[o.PluginStatus.STATUS_ACTIVE,o.PluginStatus.STATUS_INACTIVE,o.PluginStatus.STATUS_NONE,o.PluginStatus.STATUS_ERROR,o.PluginStatus.STATUS_INVALID];if(!t||n.indexOf(t.status)<0)return Promise.reject();const i=t.url;return this.emit("change"),o.Plugin.loadFromUrl(i).then((e=>t.update(e).then((()=>{this.emit("change"),this.saveState()})).catch((e=>{throw this.emit("change"),e})))).catch((e=>{throw this.emit("change"),e}))}setAutoUpdate(e,t){const n=this.plugins.get(e);n&&n.autoUpdate!==t&&(n.setAutoUpdate(t),this.emit("change"),this.saveState())}runAutoUpdate(){const e=this.plugins.filter((e=>e.autoUpdate)).map((e=>e.id));if(!e.length)return Promise.resolve();const t=this.autoUpdateAppVersion!==s.RuntimeInfo.version,n=!this.autoUpdateDate||Date.now()-this.autoUpdateDate>p.UpdateInterval;if(!(t||n))return;h.info("Auto-updating plugins",e.join(", ")),this.set({autoUpdateAppVersion:s.RuntimeInfo.version,autoUpdateDate:Date.now()}),this.saveState();const i=()=>{const t=e.shift();if(t)return this.update(t).catch(d.noop).then(i)};return i()}loadPlugin(e,t){const n=new o.Plugin({manifest:e.manifest,url:e.url,autoUpdate:e.autoUpdate});let i=e.enabled;if(i){const n=t?t.plugins.find((t=>t.manifest.name===e.manifest.name)):null;i=(n?[n.manifest.publicKey]:c.SignatureVerifier.getPublicKeys()).includes(e.manifest.publicKey)}return n.install(i,!0).then((()=>n)).catch((()=>n))}saveState(){r.SettingsStore.save("plugins",{autoUpdateAppVersion:this.autoUpdateAppVersion,autoUpdateDate:this.autoUpdateDate,plugins:this.plugins.map((e=>({manifest:e.manifest,url:e.url,enabled:"active"===e.status,autoUpdate:e.autoUpdate})))})}getStatus(e){const t=this.plugins.get(e);return t?t.status:""}getPlugin(e){return this.plugins.get(e)}}p.UpdateInterval=6048e5,p.defineModelProperties({plugins:null,autoUpdateAppVersion:null,autoUpdateDate:null});const m=new p},1203:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Plugin:()=>b,PluginStatus:()=>v});var i=n(3617),s=n.n(i),r=n(6846),o=n(9186),a=n(7119),l=n(9491),c=n(111),u=n(7614),d=n(484),h=n(7378),p=n(3366),m=n(8146),f=n(7536),g=n(2363);const A=new g.Logger("plugin"),y=new p.IoCache({cacheName:"PluginFiles",logger:new g.Logger("storage-plugin-files")}),v={STATUS_NONE:"",STATUS_ACTIVE:"active",STATUS_INACTIVE:"inactive",STATUS_INSTALLING:"installing",STATUS_ACTIVATING:"activating",STATUS_UNINSTALLING:"uninstalling",STATUS_UPDATING:"updating",STATUS_INVALID:"invalid",STATUS_ERROR:"error"};class b extends o.Model{constructor(e){const t=e.manifest.name;if(!t)throw new Error("Cannot create a plugin without name");super(Object.assign({id:t,name:t,resources:{},logger:new g.Logger(`plugin:${t}`)},e))}install(e,t){const n=this.logger.ts();return this.status=v.STATUS_INSTALLING,Promise.resolve().then((()=>{const i=this.validateManifest();if(i)throw this.logger.error("Manifest validation error",i),this.status=v.STATUS_INVALID,"Plugin validation error: "+i;if(this.status=v.STATUS_INACTIVE,e)return this.installWithManifest(t).then((()=>{this.installTime=this.logger.ts()-n})).catch((e=>{throw this.logger.error("Error installing plugin",e),this.set({status:v.STATUS_ERROR,installError:e,installTime:this.logger.ts()-n,updateError:null}),e}));this.logger.info("Loaded inactive plugin")}))}validateManifest(){const e=this.manifest;if(!e.name)return"No plugin name";if(!e.description)return"No plugin description";if(!/^\d+\.\d+\.\d+$/.test(e.version||""))return"Invalid plugin version";if("0.1.0"!==e.manifestVersion)return"Invalid manifest version "+e.manifestVersion;if(!(e.author&&e.author.email&&e.author.name&&e.author.url))return"Invalid plugin author";if(!e.url)return"No plugin url";if(!e.publicKey)return"No plugin public key";if(!this.skipSignatureValidation&&!f.SignatureVerifier.getPublicKeys().includes(e.publicKey))return"Public key mismatch";if(!e.resources||!Object.keys(e.resources).length)return"No plugin resources";if(e.resources.loc&&(!e.locale||!e.locale.title||!/^[a-z]{2}(-[A-Z]{2})?$/.test(e.locale.name)))return"Bad plugin locale";if(e.desktop&&!l.Launcher)return"Desktop plugin";if(e.versionMin){if(!/^\d+\.\d+\.\d+$/.test(e.versionMin))return"Invalid versionMin";if(m.SemVer.compareVersions(e.versionMin,a.RuntimeInfo.version)>0)return`Required min app version is ${e.versionMin}, actual ${a.RuntimeInfo.version}`}if(e.versionMax){if(!/^\d+\.\d+\.\d+$/.test(e.versionMax))return"Invalid versionMin";if(m.SemVer.compareVersions(e.versionMax,a.RuntimeInfo.version)<0)return`Required max app version is ${e.versionMax}, actual ${a.RuntimeInfo.version}`}}validateUpdatedManifest(e){const t=this.manifest;if(t.name!==e.name)return"Plugin name mismatch";if(t.publicKey!==e.publicKey){const n=f.SignatureVerifier.getPublicKeys().includes(t.publicKey),i=f.SignatureVerifier.getPublicKeys().includes(e.publicKey);if(!n||!i)return"Public key mismatch"}}installWithManifest(e){const t=this.manifest;this.logger.info("Loading plugin with resources",Object.keys(t.resources).join(", "),e?"(local)":"(url)"),this.resources={};const n=this.logger.ts(),i=Object.keys(t.resources).map((n=>this.loadResource(n,e,t)));return Promise.all(i).catch((()=>{throw"Error loading plugin resources"})).then((()=>this.installWithResources())).then((()=>e?void 0:this.saveResources())).then((()=>{this.logger.info("Install complete",this.logger.ts(n))}))}getResourcePath(e){switch(e){case"css":return"plugin.css";case"js":return"plugin.js";case"loc":return this.manifest.locale.name+".json";default:throw`Unknown resource ${e}`}}getStorageResourcePath(e){return this.id+"_"+this.getResourcePath(e)}loadResource(e,t,n){const i=this.logger.ts();let s;if(t)s=new Promise(((t,n)=>{const i=this.getStorageResourcePath(e);y.load(i,((e,i)=>e?n(e):t(i)))}));else{s=w(this.url+this.getResourcePath(e)+"?v="+n.version,!0)}return s.then((t=>(this.logger.debug("Resource data loaded",e,this.logger.ts(i)),this.verifyResource(t,e).then((t=>{this.resources[e]=t})))))}verifyResource(e,t){const n=this.logger.ts(),i=this.manifest,s=i.resources[t];return f.SignatureVerifier.verify(e,s,i.publicKey).then((i=>{if(i)return this.logger.debug("Resource signature validated",t,this.logger.ts(n)),e;throw this.logger.error("Resource signature invalid",t),`Signature invalid: ${t}`})).catch((()=>{throw this.logger.error("Error validating resource signature",t),`Error validating resource signature for ${t}`}))}installWithResources(){this.logger.info("Installing plugin resources");const e=this.manifest,t=[];return this.resources.css&&t.push(this.applyCss(e.name,this.resources.css,e.theme)),this.resources.js&&t.push(this.applyJs(e.name,this.resources.js)),this.resources.loc&&t.push(this.applyLoc(e.locale,this.resources.loc)),Promise.all(t).then((()=>{this.status=v.STATUS_ACTIVE})).catch((e=>(this.logger.info("Install error",e),this.status=v.STATUS_ERROR,this.disable().then((()=>{throw e})))))}saveResources(){const e=[];for(const t of Object.keys(this.resources))e.push(this.saveResource(t,this.resources[t]));return Promise.all(e).catch((e=>(this.logger.debug("Error saving plugin resources",e),this.uninstall().then((()=>{throw"Error saving plugin resources"})))))}saveResource(e,t){return new Promise(((n,i)=>{const s=this.getStorageResourcePath(e);y.save(s,t,(e=>{e?i(e):n()}))}))}deleteResources(){const e=[];for(const t of Object.keys(this.resources))e.push(this.deleteResource(t));return Promise.all(e)}deleteResource(e){return new Promise((t=>{const n=this.getStorageResourcePath(e);y.remove(n,(()=>t()))}))}applyCss(e,t,n){return new Promise(((i,s)=>{try{const s=new Blob([t],{type:"text/css"}),o=URL.createObjectURL(s),a="plugin-css-"+e;this.createElementInHead("link",a,{rel:"stylesheet",href:o}).addEventListener("load",(()=>{if(URL.revokeObjectURL(o),n){const e=this.getThemeLocaleKey(n.name);c.SettingsManager.allThemes[n.name]=e,r[e]=n.title;for(const e of Array.from(document.styleSheets))if(e.ownerNode.id===a){this.processThemeStyleSheet(e,n);break}}this.logger.debug("Plugin style installed"),i()}))}catch(e){this.logger.error("Error installing plugin style",e),s(e)}}))}processThemeStyleSheet(e,t){const n=".th-"+t.name,i=[];for(const t of Array.from(e.cssRules))t.selectorText&&0!==t.selectorText.lastIndexOf(n,0)&&i.push(t.selectorText),t.selectorText===n&&this.addThemeVariables(t);if(i.length)throw this.logger.error("Themes must not add rules outside theme namespace. Bad selectors:",i),"Invalid theme"}addThemeVariables(e){h.ThemeVars.apply(e.style)}applyJs(e,t){return new Promise(((i,r)=>{try{let o=s().ByteUtils.bytesToString(t);this.module={exports:{}};const a="plugin-"+Date.now().toString()+Math.random().toString();n.g[a]={require:d.PluginApi.require,module:this.module},o=`(function(require, module){${o}})(window["${a}"].require,window["${a}"].module);`;const l=this.logger.ts(),c=new Blob([o],{type:"text/javascript"}),u=URL.createObjectURL(c),h="plugin-js-"+e;this.createElementInHead("script",h,{src:u}).addEventListener("load",(()=>{URL.revokeObjectURL(u),setTimeout((()=>{delete n.g[a],this.module.exports.uninstall?(this.logger.debug("Plugin script installed",this.logger.ts(l)),this.loadPluginSettings(),i()):r("Plugin script installation failed")}),0)}))}catch(e){this.logger.error("Error installing plugin script",e),r(e)}}))}createElementInHead(e,t,n){let i=document.getElementById(t);i&&i.parentNode.removeChild(i),i=document.createElement(e),i.setAttribute("id",t);for(const[e,t]of Object.entries(n))i.setAttribute(e,t);return document.head.appendChild(i),i}removeElement(e){const t=document.getElementById(e);t&&t.parentNode.removeChild(t)}applyLoc(e,t){return Promise.resolve().then((()=>{const n=s().ByteUtils.bytesToString(t),i=JSON.parse(n);c.SettingsManager.allLocales[e.name]=e.title,c.SettingsManager.customLocales[e.name]=i,this.logger.debug("Plugin locale installed")}))}removeLoc(e){delete c.SettingsManager.allLocales[e.name],delete c.SettingsManager.customLocales[e.name],c.SettingsManager.activeLocale===e.name&&(u.AppSettingsModel.locale="en-US")}getThemeLocaleKey(e){return`setGenThemeCustom_${e}`}removeTheme(e){delete c.SettingsManager.allThemes[e.name],u.AppSettingsModel.theme===e.name&&(u.AppSettingsModel.theme=c.SettingsManager.getDefaultTheme()),delete r[this.getThemeLocaleKey(e.name)]}loadPluginSettings(){if(!this.module||!this.module.exports||!this.module.exports.setSettings)return;const e=this.logger.ts(),t=this.getSettingPrefix();let n=null;for(const e of Object.keys(u.AppSettingsModel))0===e.lastIndexOf(t,0)&&(n||(n={}),n[e.replace(t,"")]=u.AppSettingsModel[e]);n&&this.setSettings(n),this.logger.debug("Plugin settings loaded",this.logger.ts(e))}uninstallPluginCode(){if(this.manifest.resources.js&&this.module&&this.module.exports&&this.module.exports.uninstall)try{this.module.exports.uninstall()}catch(e){this.logger.error("Plugin uninstall method returned an error",e)}}uninstall(){const e=this.logger.ts();return this.disable().then((()=>this.deleteResources().then((()=>{this.status="",this.logger.info("Uninstall complete",this.logger.ts(e))}))))}disable(){const e=this.manifest;this.logger.info("Disabling plugin with resources",Object.keys(e.resources).join(", ")),this.status=v.STATUS_UNINSTALLING;const t=this.logger.ts();return Promise.resolve().then((()=>{e.resources.css&&this.removeElement("plugin-css-"+this.name),e.resources.js&&this.uninstallPluginCode(),e.resources.loc&&this.removeLoc(this.manifest.locale),e.theme&&this.removeTheme(e.theme),this.status=v.STATUS_INACTIVE,this.logger.info("Disable complete",this.logger.ts(t))}))}update(e){const t=this.logger.ts(),n=this.status;return this.status=v.STATUS_UPDATING,Promise.resolve().then((()=>{const i=this.manifest,s=e.manifest;if(i.version===s.version)return this.set({status:n,updateCheckDate:Date.now(),updateError:null}),void this.logger.info(`v${i.version} is the latest plugin version`);this.logger.info(`Updating plugin from v${i.version} to v${s.version}`);const r=e.validateManifest()||this.validateUpdatedManifest(s);if(r)throw this.logger.error("Manifest validation error",r),this.set({status:n,updateCheckDate:Date.now(),updateError:r}),"Plugin validation error: "+r;return this.uninstallPluginCode(),e.installWithManifest(!1).then((()=>{this.module=e.module,this.resources=e.resources,this.set({status:v.STATUS_ACTIVE,manifest:s,installTime:this.logger.ts()-t,installError:null,updateCheckDate:Date.now(),updateError:null}),this.logger.info("Update complete",this.logger.ts(t))})).catch((e=>{if(this.logger.error("Error updating plugin",e),n===v.STATUS_ACTIVE)return this.logger.info("Activating previous version"),this.installWithResources().then((()=>{throw this.set({updateCheckDate:Date.now(),updateError:e}),e}));throw this.set({status:n,updateCheckDate:Date.now(),updateError:e}),e}))}))}setAutoUpdate(e){this.autoUpdate=!!e}getSettingPrefix(){return`plugin:${this.id}:`}getSettings(){if(this.status===v.STATUS_ACTIVE&&this.module&&this.module.exports&&this.module.exports.getSettings)try{const e=this.module.exports.getSettings(),t=this.getSettingPrefix();if(e instanceof Array)return e.map((e=>{e=Object.assign({},e);const n=u.AppSettingsModel[t+e.name];return void 0!==n&&(e.value=n),e}));this.logger.error("getSettings: expected Array, got ",typeof e)}catch(e){this.logger.error("getSettings error",e)}}setSettings(e){for(const t of Object.keys(e))u.AppSettingsModel[this.getSettingPrefix()+t]=e[t];if(this.module.exports.setSettings)try{this.module.exports.setSettings(e)}catch(e){this.logger.error("setSettings error",e)}}static loadFromUrl(e,t){"/"!==e[e.length-1]&&(e+="/"),A.info("Installing plugin from url",e);return w(e+"manifest.json").catch((e=>{throw A.error("Error loading plugin manifest",e),"Error loading plugin manifest"})).then((n=>{try{n=JSON.parse(n)}catch(e){throw A.error("Failed to parse manifest",n),"Failed to parse manifest"}if(A.debug("Loaded manifest",n),t){if(t.name!==n.name)throw"Bad plugin name";if(t.privateKey!==n.privateKey)throw"Bad plugin private key"}return new b({manifest:n,url:e})}))}}function w(e,t){A.debug("GET",e);const n=A.ts();return new Promise(((i,s)=>{const r=new XMLHttpRequest;r.addEventListener("load",(()=>{200===r.status?(A.debug("GET OK",e,A.ts(n)),i(r.response)):(A.debug("GET error",e,r.status),s(r.status?`HTTP status ${r.status}`:"network error"))})),r.addEventListener("error",(()=>{A.debug("GET error",e,r.status),s(r.status?`HTTP status ${r.status}`:"network error")})),r.addEventListener("abort",(()=>{A.debug("GET aborted",e),s("Network request timeout")})),r.addEventListener("timeout",(()=>{A.debug("GET timeout",e),s("Network request timeout")})),t&&(r.responseType=t?"arraybuffer":"text"),r.open("GET",e),r.send()}))}b.defineModelProperties({id:"",name:"",logger:null,manifest:"",url:"",status:"",autoUpdate:!1,installTime:null,installError:null,updateCheckDate:null,updateError:null,skipSignatureValidation:!1,resources:null,module:null}),Object.assign(b,v)},7378:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ThemeVars:()=>s});var i=n(4546);const s={themeDefaults:null,newLineRegEx:/[\n\s]+/g,themeVarsRegEx:/([\w\-]+):([^:]+),(\$)?/g,init(){if(this.themeDefaults)return;this.themeDefaults={};const e=/\s([\w\-]+):\s*([^,\s]+)/g;let t;do{if(t=e.exec("$theme-defaults: (\n mute-percent: 30%,\n light-border-percent: 20%,\n modal-opacity: 0.9,\n color-lightness-shift: 0\n);\n"),t){const[,e,n]=t;this.themeDefaults["--"+e]=n}}while(t)},apply(e){this.init();const t="/* This file is also parsed in JS to build theme styles, see theme-vars.js */\n@function set-theme-vars($t) {\n @return map-merge(\n (\n muted-color:\n mix(\n map-get($t, medium-color),\n map-get($t, background-color),\n map-get($t, mute-percent)\n ),\n muted-color-border:\n mix(\n map-get($t, medium-color),\n map-get($t, background-color),\n semi-mute-percent(map-get($t, mute-percent))\n ),\n text-selection-bg-color: rgba(map-get($t, action-color), 0.3),\n text-selection-bg-color-error: rgba(map-get($t, error-color), 0.8),\n text-semi-muted-color: mix(map-get($t, action-color), map-get($t, text-color), 0.5),\n text-contrast-action-color:\n text-contrast-color(\n map-get($t, action-color),\n map-get($t, color-lightness-shift),\n map-get($t, background-color),\n map-get($t, text-color)\n ),\n text-contrast-error-color:\n text-contrast-color(\n map-get($t, error-color),\n map-get($t, color-lightness-shift),\n map-get($t, background-color),\n map-get($t, text-color)\n ),\n base-border-color: mix(map-get($t, medium-color), map-get($t, background-color), 50%),\n accent-border-color: mix(map-get($t, medium-color), map-get($t, background-color), 65%),\n light-border-color:\n mix(\n map-get($t, medium-color),\n map-get($t, background-color),\n map-get($t, light-border-percent)\n ),\n form-box-border-color-focus:\n mix(map-get($t, action-color), map-get($t, text-color), 70%),\n form-box-shadow-color-focus:\n rgba(mix(map-get($t, action-color), map-get($t, text-color), 70%), 0.7),\n form-box-shadow-color-hover:\n rgba(mix(map-get($t, action-color), map-get($t, text-color), 70%), 0.5),\n form-box-shadow-color-focus-error: lightness-alpha(map-get($t, error-color), -5%, -0.3),\n secondary-background-color:\n mix(map-get($t, medium-color), map-get($t, background-color), 10%),\n intermediate-background-color:\n mix(map-get($t, medium-color), map-get($t, background-color), 3%),\n intermediate-pressed-background-color:\n mix(map-get($t, medium-color), map-get($t, background-color), 2.6%),\n disabled-background-color: shade(map-get($t, background-color), 5%),\n action-background-color-focus: shade(map-get($t, action-color), 20%),\n action-background-color-focus-tr: rgba(shade(map-get($t, action-color), 20%), 0.1),\n error-background-color-focus: shade(map-get($t, error-color), 20%),\n error-background-color-focus-tr: rgba(shade(map-get($t, error-color), 20%), 0.1),\n action-background-color-active: shade(map-get($t, action-color), 25%),\n action-background-color-active-tr: rgba(shade(map-get($t, action-color), 25%), 0.15),\n error-background-color-active: shade(map-get($t, error-color), 25%),\n error-background-color-active-tr: rgba(shade(map-get($t, error-color), 25%), 0.15),\n modal-background-color: rgba(map-get($t, background-color), map-get($t, modal-opacity)),\n modal-background-color-tr: rgba(map-get($t, background-color), 0),\n selected-item-color: mix(map-get($t, action-color), map-get($t, background-color), 85%),\n selected-on-secondary-item-color:\n mix(map-get($t, medium-color), map-get($t, background-color), 30%),\n selectable-on-secondary-item-color:\n mix(map-get($t, medium-color), map-get($t, background-color), 14%),\n clickable-on-secondary-color:\n mix(map-get($t, medium-color), map-get($t, background-color), 75%)\n ),\n $t\n );\n}\n".replace(this.newLineRegEx,"").matchAll(this.themeVarsRegEx);for(let[,n,i,s]of t){s&&i.endsWith(")")&&(i=i.substr(0,i.length-1));const t="--"+n;if(e.getPropertyValue(t))continue;let r=i.replace(/map-get\(\$t,\s*([\w\-]+)\)/g,"--$1"),o=!0;const a=[];for(;o;)o=!1,r=r.replace(/([\w\-]+)\([^()]+\)/,(t=>{o=!0;const[,n,i]=t.match(/([\w\-]+)\((.*)\)/),s=i.trim().split(/\s*,\s*/).filter((e=>e)).map((t=>this.resolveArg(t,e,a)));return a.push(this.fn[n](...s)),"L"+(a.length-1)}));r=a[a.length-1],e.setProperty(t,r)}},resolveArg(e,t,n){if(/^--/.test(e)){let n=t.getPropertyValue(e);if(n&&(n=n.trim()),n)e=n;else{if(!this.themeDefaults[e])throw new Error("Css property missing: "+e);e=this.themeDefaults[e]}}if(/^L/.test(e))return n[e.substr(1)];if(/%$/.test(e))return e.replace(/%$/,"")/100;if(/^-?[\d.]+?$/.test(e))return+e;if(/^(#|rgb)/.test(e))return new i.Color(e);throw new Error("Bad css arg: "+e)},fn:{mix:(e,t,n)=>e.mix(t,n).toRgba(),"semi-mute-percent":e=>e/2,rgba(e,t){const n=new i.Color(e);return n.a=t,n.toRgba()},"text-contrast-color":(e,t,n,i)=>e.l-t>=n.l?i.toRgba():n.toRgba(),"lightness-alpha"(e,t,n){const s=new i.Color(e);return s.l+=Math.min(0,Math.max(1,t)),s.a+=Math.min(0,Math.max(1,n)),s.toHsla()},shade:(e,t)=>i.Color.black.mix(e,t).toRgba()}}},9938:(e,t,n)=>{"use strict";n.r(t),n.d(t,{EntryPresenter:()=>r});var i=n(6098),s=n(3297);const r=function(e,t,n){this.entry=null,this.descField=e,this.noColor=t||"",this.activeEntryId=n};r.prototype={present(e){return e.entry?this.entry=e:e.group?this.group=e:e.external&&(this.entry=e,this.external=!0),this},get id(){return this.entry?this.entry.id:this.group.id},get icon(){return this.entry?this.entry.icon:this.group.icon||"folder"},get customIcon(){return this.entry?this.entry.customIcon:void 0},get color(){return this.entry?this.entry.color||(this.entry.customIcon?this.noColor:void 0):void 0},get title(){return this.entry?this.entry.title:this.group.title},get notes(){return this.entry?this.entry.notes:void 0},get url(){return this.entry?this.entry.displayUrl:void 0},get user(){return this.entry?this.entry.user:void 0},get active(){return this.entry?this.entry.id===this.activeEntryId:this.group.active},get created(){return this.entry?i.DateFormat.dtStr(this.entry.created):void 0},get updated(){return this.entry?i.DateFormat.dtStr(this.entry.updated):void 0},get expired(){return!!this.entry&&this.entry.expired},get tags(){return this.entry?this.entry.tags:void 0},get groupName(){return this.entry?this.entry.groupName:void 0},get fileName(){return this.entry?this.entry.fileName:void 0},get description(){if(!this.entry)return"["+s.Locale.listGroup+"]";if(this.external)return this.entry.description;switch(this.descField){case"website":return this.url||"("+s.Locale.listNoWebsite+")";case"user":return this.user||"("+s.Locale.listNoUser+")";case"created":return this.created;case"updated":return this.updated;case"attachments":return this.entry.attachments.map((e=>e.title)).join(", ")||"("+s.Locale.listNoAttachments+")";default:return this.user||this.notes||this.url}}}},7980:(e,t,n)=>{"use strict";n.r(t),n.d(t,{StorageCache:()=>r});var i=n(6902),s=n(8402);class r extends s.StorageBase{constructor(...e){super(...e),this.name="cache",this.enabled=i.IoBrowserCache.enabled,this.system=!0,this.io=null}init(){super.init(),this.io=new i.IoBrowserCache({cacheName:"FilesCache",logger:this.logger})}save(e,t,n,i){this.io.save(e,n,i)}load(e,t,n){this.io.load(e,n)}remove(e,t,n){this.io.remove(e,n)}}},526:(e,t,n)=>{"use strict";n.r(t),n.d(t,{StorageDropbox:()=>c});var i=n(8402),s=n(667),r=n(4798),o=n(5754),a=n(3297);const l="bad-key";class c extends i.StorageBase{constructor(...e){super(...e),this.name="dropbox",this.icon="dropbox",this.enabled=!0,this.uipos=20,this.backup=!0}_toFullPath(e){const t=this.appSettings.dropboxFolder;return t&&(e=r.UrlFormat.fixSlashes("/"+t+"/"+e)),e}_toRelPath(e){const t=this.appSettings.dropboxFolder;if(t){const n=e.toLowerCase().indexOf(t.toLowerCase());0===n?e=e.substr(t.length):1===n&&(e=e.substr(t.length+1)),e=r.UrlFormat.fixSlashes("/"+e)}return e}_fixConfigFolder(e){return"/"===(e=e.replace(/\\/g,"/").trim())[0]&&(e=e.substr(1)),e}_getKey(){return this.appSettings.dropboxAppKey||o.DropboxApps.AppFolder.id}_getSecret(){const e=this._getKey();return e===o.DropboxApps.AppFolder.id?o.DropboxApps.AppFolder.secret:e===o.DropboxApps.FullDropbox.id?o.DropboxApps.FullDropbox.secret:this.appSettings.dropboxSecret}_isValidKey(){const e=this._getKey(),t=e===o.DropboxApps.AppFolder.id||e===o.DropboxApps.FullDropbox.id;return e&&e.indexOf(" ")<0&&(!t||this._canUseBuiltInKeys())}_canUseBuiltInKeys(){return!s.Features.isSelfHosted}_getOAuthConfig(){return{scope:"files.content.read files.content.write files.metadata.read files.metadata.write",url:"https://www.dropbox.com/oauth2/authorize",tokenUrl:"https://api.dropboxapi.com/oauth2/token",clientId:this._getKey(),clientSecret:this._getSecret(),pkce:!0,width:600,height:400,urlParams:{token_access_type:"offline"}}}needShowOpenConfig(){return!this._isValidKey()||!this._getSecret()}getOpenConfig(){return{desc:"dropboxSetupDesc",fields:[{id:"key",title:"dropboxAppKey",desc:"dropboxAppKeyDesc",type:"text",required:!0,pattern:"\\w+"},{id:"secret",title:"dropboxAppSecret",desc:"dropboxAppSecretDesc",type:"password",required:!0,pattern:"\\w+"},{id:"folder",title:"dropboxFolder",desc:"dropboxFolderDesc",type:"text",placeholder:"dropboxFolderPlaceholder"}]}}getSettingsConfig(){const e=[],t=this._getKey(),n={id:"link",title:"dropboxLink",type:"select",value:"custom",options:{app:"dropboxLinkApp",full:"dropboxLinkFull",custom:"dropboxLinkCustom"}},i={id:"key",title:"dropboxAppKey",desc:"dropboxAppKeyDesc",type:"text",required:!0,pattern:"\\w+",value:t},s={id:"secret",title:"dropboxAppSecret",desc:"dropboxAppSecretDesc",type:"password",required:!0,pattern:"\\w+",value:this.appSettings.dropboxSecret||""},r={id:"folder",title:"dropboxFolder",desc:"dropboxFolderSettingsDesc",type:"text",value:this.appSettings.dropboxFolder||""};return this._canUseBuiltInKeys()?(e.push(n),t===o.DropboxApps.AppFolder.id?n.value="app":t===o.DropboxApps.FullDropbox.id?(n.value="full",e.push(r)):(e.push(i),e.push(s),e.push(r))):(e.push(i),e.push(s),e.push(r)),{fields:e}}applyConfig(e,t){if(e.key===o.DropboxApps.AppFolder.id||e.key===o.DropboxApps.FullDropbox.id)return t(l);e.folder&&(e.folder=this._fixConfigFolder(e.folder)),this.appSettings.set({dropboxAppKey:e.key,dropboxSecret:e.secret,dropboxFolder:e.folder}),t()}applySetting(e,t){switch(e){case"link":switch(e="dropboxAppKey",t){case"app":t=o.DropboxApps.AppFolder.id;break;case"full":t=o.DropboxApps.FullDropbox.id;break;case"custom":t=`(${a.Locale.dropboxAppKeyHint})`;break;default:return}this.logout();break;case"key":e="dropboxAppKey",this.logout();break;case"secret":e="dropboxSecret",this.logout();break;case"folder":e="dropboxFolder",t=this._fixConfigFolder(t);break;default:return}this.appSettings[e]=t}getPathForName(e){return"/"+e+".kdbx"}_encodeJsonHttpHeader(e){return e.replace(/[\u007f-\uffff]/g,(e=>"\\u"+("000"+e.charCodeAt(0).toString(16)).slice(-4)))}_apiCall(e){this._oauthAuthorize((t=>{if(t)return e.error(t);const n=e.host||"api";let i,s,r=e.data;e.apiArg?i={"Dropbox-API-Arg":this._encodeJsonHttpHeader(JSON.stringify(e.apiArg))}:e.data&&(r=JSON.stringify(r),s="application/json"),this._xhr({url:`https://${n}.dropboxapi.com/2/${e.method}`,method:"POST",responseType:e.responseType||"json",headers:i,data:r,dataType:s,statuses:e.statuses||void 0,success:e.success,error:(t,n)=>{let i=n.response&&n.response.error||new Error("Network error");i&&i.path&&"not_found"===i.path[".tag"]?(i=new Error("File removed"),i.notFound=!0,this.logger.debug("File not found",e.method)):this.logger.error("API error",e.method,n.status,i),i.status=n.status,e.error(i)}})}))}load(e,t,n){this.logger.debug("Load",e);const i=this.logger.ts();e=this._toFullPath(e),this._apiCall({method:"files/download",host:"content",apiArg:{path:e},responseType:"arraybuffer",success:(t,s)=>{const r=JSON.parse(s.getResponseHeader("dropbox-api-result"));this.logger.debug("Loaded",e,r.rev,this.logger.ts(i)),n(null,t,{rev:r.rev})},error:n})}stat(e,t,n){this.logger.debug("Stat",e);const i=this.logger.ts();e=this._toFullPath(e),this._apiCall({method:"files/get_metadata",data:{path:e},success:t=>{"file"===t[".tag"]?t={rev:t.rev}:"folder"===t[".tag"]&&(t={folder:!0}),this.logger.debug("Stated",e,t.folder?"folder":t.rev,this.logger.ts(i)),n&&n(null,t)},error:n})}save(e,t,n,i,s){this.logger.debug("Save",e,s);const r=this.logger.ts(),o={path:e=this._toFullPath(e),mode:s?{".tag":"update",update:s}:{".tag":"overwrite"}};this._apiCall({method:"files/upload",host:"content",apiArg:o,data:n,responseType:"json",success:t=>{this.logger.debug("Saved",e,t.rev,this.logger.ts(r)),i(null,{rev:t.rev})},error:i})}list(e,t){this.logger.debug("List");const n=this.logger.ts();this._apiCall({method:"files/list_folder",data:{path:this._toFullPath(e||""),recursive:!1},success:e=>{this.logger.debug("Listed",this.logger.ts(n));const i=e.entries.map((e=>({name:e.name,path:this._toRelPath(e.path_display),rev:e.rev,dir:"file"!==e[".tag"]})));t(null,i)},error:t})}remove(e,t){this.logger.debug("Remove",e);const n=this.logger.ts();e=this._toFullPath(e),this._apiCall({method:"files/delete",data:{path:e},success:()=>{this.logger.debug("Removed",e,this.logger.ts(n)),t()},error:t})}mkdir(e,t){this.logger.debug("Make dir",e);const n=this.logger.ts();e=this._toFullPath(e),this._apiCall({method:"files/create_folder",data:{path:e},success:()=>{this.logger.debug("Made dir",e,this.logger.ts(n)),t()},error:t})}logout(){this._oauthRevokeToken("https://api.dropboxapi.com/2/auth/token/revoke",{method:"POST"})}}},3758:(e,t,n)=>{"use strict";n.r(t),n.d(t,{StorageFileCache:()=>r});var i=n(9491),s=n(8402);class r extends s.StorageBase{constructor(...e){super(...e),this.name="cache",this.enabled=!!i.Launcher,this.system=!0,this.path=null}getPath(e){return i.Launcher.joinPath(this.path,e)}initFs(e){if(this.path)return e&&e();const t=i.Launcher.getUserDataPath("OfflineFiles"),n=n=>(this.path=n?null:t,n&&this.logger.error("Error opening local offline storage",n),e&&e(n));i.Launcher.fileExists(t,(e=>{e?n():i.Launcher.mkdir(t,n)}))}save(e,t,n,s){this.logger.debug("Save",e),this.initFs((t=>{if(t)return s&&s(t);const r=this.logger.ts();i.Launcher.writeFile(this.getPath(e),n,(t=>{if(t)return this.logger.error("Error saving to cache",e,t),s&&s(t);this.logger.debug("Saved",e,this.logger.ts(r)),s&&s()}))}))}load(e,t,n){this.logger.debug("Load",e),this.initFs((t=>{if(t)return n&&n(null,t);const s=this.logger.ts();i.Launcher.readFile(this.getPath(e),void 0,((t,i)=>i?(this.logger.error("Error loading from cache",e,i),n&&n(i,null)):(this.logger.debug("Loaded",e,this.logger.ts(s)),n&&n(null,t.buffer))))}))}remove(e,t,n){this.logger.debug("Remove",e),this.initFs((t=>{if(t)return n&&n(t);const s=this.logger.ts(),r=this.getPath(e);i.Launcher.fileExists(r,(t=>{t?i.Launcher.deleteFile(r,(t=>(t?this.logger.error("Error removing from cache",e,t):this.logger.debug("Removed",e,this.logger.ts(s)),n&&n(t)))):n&&n()}))}))}}},7899:(e,t,n)=>{"use strict";n.r(t),n.d(t,{StorageFile:()=>o});var i=n(9491),s=n(8402);const r={};class o extends s.StorageBase{constructor(...e){super(...e),this.name="file",this.icon="hdd-o",this.enabled=!!i.Launcher,this.system=!0,this.backup=!0}load(e,t,n){this.logger.debug("Load",e);const s=this.logger.ts(),r=t=>{this.logger.error("Error reading local file",e,t),n&&n(t,null)};i.Launcher.readFile(e,void 0,((t,o)=>{if(o)return r(o);i.Launcher.statFile(e,((i,o)=>{if(o)return r(o);const a=i.mtime.getTime().toString();this.logger.debug("Loaded",e,a,this.logger.ts(s)),n&&n(null,t.buffer,{rev:a})}))}))}stat(e,t,n){this.logger.debug("Stat",e);const s=this.logger.ts();i.Launcher.statFile(e,((t,i)=>{if(i)return this.logger.error("Error stat local file",e,i),"ENOENT"===i.code&&(i.notFound=!0),n&&n(i,null);if(this.logger.debug("Stat done",e,this.logger.ts(s)),n){const e=t.mtime.getTime().toString();n(null,{rev:e})}}))}save(e,t,n,s,r){this.logger.debug("Save",e,r);const o=this.logger.ts(),a=t=>{Object.prototype.hasOwnProperty.call(t,"code")&&"EISDIR"===t.code&&(t.isDir=!0),this.logger.error("Error writing local file",e,t),s&&s(t)},l=()=>{i.Launcher.writeFile(e,n,(t=>{if(t)return a(t);i.Launcher.statFile(e,((t,n)=>{if(n)return a(n);const i=t.mtime.getTime().toString();this.logger.debug("Saved",e,this.logger.ts(o)),s&&s(void 0,{rev:i})}))}))};r?i.Launcher.statFile(e,((e,t)=>{if(t)return l();const n=e.mtime.getTime().toString();if(n!==r)return this.logger.debug("Save mtime differs",r,n),s&&s({revConflict:!0},{rev:n});l()})):l()}mkdir(e,t){this.logger.debug("Make dir",e);const n=this.logger.ts();i.Launcher.mkdir(e,(i=>{i?(this.logger.error("Error making local dir",e,i),t&&t("Error making local dir")):(this.logger.debug("Made dir",e,this.logger.ts(n)),t&&t())}))}watch(e,t){const n=i.Launcher.parsePath(e);if(!r[n.dir]&&!n.dir.startsWith("\\")){let e;this.logger.debug("Watch dir",n.dir);try{e=i.Launcher.createFsWatcher(n.dir)}catch(e){this.logger.warn("Error watching dir",e)}e&&(e.on("change",this.fsWatcherChange.bind(this,n.dir)),r[n.dir]={fsWatcher:e,callbacks:[]})}const s=r[n.dir];s&&s.callbacks.push({file:n.file,callback:t})}unwatch(e){const t=i.Launcher.parsePath(e),n=r[t.dir];if(n){const e=n.callbacks.findIndex((e=>e.file===t.file));e>=0&&n.callbacks.splice(e,1),n.callbacks.length||(this.logger.debug("Stop watch dir",t.dir),n.fsWatcher.close(),delete r[t.dir])}}fsWatcherChange(e,t,n){const i=r[e];i&&i.callbacks.forEach((i=>{i.file===n&&"function"==typeof i.callback&&(this.logger.debug("File changed",e,t,n),i.callback())}))}}},5661:(e,t,n)=>{"use strict";n.r(t),n.d(t,{StorageGDrive:()=>l});var i=n(8402),s=n(3297),r=n(667),o=n(5754);const a="NewFile:";class l extends i.StorageBase{constructor(...e){super(...e),this.name="gdrive",this.enabled=!0,this.uipos=30,this.icon="google-drive",this._baseUrl="https://www.googleapis.com/drive/v3",this._baseUrlUpload="https://www.googleapis.com/upload/drive/v3"}getPathForName(e){return a+e}load(e,t,n){this.stat(e,t,((t,i)=>{if(t)return n&&n(t);this.logger.debug("Load",e);const s=this.logger.ts(),r=this._baseUrl+"/files/{id}/revisions/{rev}?alt=media".replace("{id}",e).replace("{rev}",i.rev);this._xhr({url:r,responseType:"arraybuffer",success:t=>(this.logger.debug("Loaded",e,i.rev,this.logger.ts(s)),n&&n(null,t,{rev:i.rev})),error:t=>(this.logger.error("Load error",e,t,this.logger.ts(s)),n&&n(t))})}))}stat(e,t,n){if(0===e.lastIndexOf(a,0))return n&&n({notFound:!0});this._oauthAuthorize((t=>{if(t)return n&&n(t);this.logger.debug("Stat",e);const i=this.logger.ts(),s=this._baseUrl+"/files/{id}?fields=headRevisionId".replace("{id}",e);this._xhr({url:s,responseType:"json",success:t=>{const s=t.headRevisionId;return this.logger.debug("Stated",e,s,this.logger.ts(i)),n&&n(null,{rev:s})},error:e=>(this.logger.error("Stat error",this.logger.ts(i),e),n&&n(e))})}))}save(e,t,n,i,s){this._oauthAuthorize((r=>{if(r)return i&&i(r);this.stat(e,t,((t,r)=>{if(s){if(t)return i&&i(t);if(r.rev!==s)return i&&i({revConflict:!0},r)}this.logger.debug("Save",e);const o=this.logger.ts(),l=0===e.lastIndexOf(a,0);let c,u,d=!1;if(l){c=this._baseUrlUpload+"/files?uploadType=multipart&fields=id,headRevisionId";const t=e.replace(a,"")+".kdbx",i="b"+Date.now()+"x"+Math.round(1e6*Math.random());n=["--",i,"\r\n","Content-Type: application/json; charset=UTF-8","\r\n\r\n",JSON.stringify({name:t}),"\r\n","--",i,"\r\n","Content-Type: application/octet-stream","\r\n\r\n",n,"\r\n","--",i,"--","\r\n"],u='multipart/related; boundary="'+i+'"',d=!0}else c=this._baseUrlUpload+"/files/{id}?uploadType=media&fields=headRevisionId".replace("{id}",e);this._xhr({url:c,method:l?"POST":"PATCH",responseType:"json",data:n,dataType:u,dataIsMultipart:d,success:t=>{this.logger.debug("Saved",e,this.logger.ts(o));const n=t.headRevisionId;return n?i&&i(null,{rev:n,path:l?t.id:null}):i&&i("save error: no rev")},error:t=>(this.logger.error("Save error",e,t,this.logger.ts(o)),i&&i(t))})}))}))}list(e,t){this._oauthAuthorize((n=>{if(n)return t&&t(n);this.logger.debug("List");let i="shared"===e?"sharedWithMe=true":e?`"${e}" in parents`:'"root" in parents';i+=" and trashed=false";const r=this._baseUrl+"/files?fields={fields}&q={q}&pageSize=1000".replace("{fields}",encodeURIComponent("files(id,name,mimeType,headRevisionId)")).replace("{q}",encodeURIComponent(i)),o=this.logger.ts();this._xhr({url:r,responseType:"json",success:n=>{if(!n)return this.logger.error("List error",this.logger.ts(o)),t&&t("list error");this.logger.debug("Listed",this.logger.ts(o));const i=n.files.map((e=>({name:e.name,path:e.id,rev:e.headRevisionId,dir:"application/vnd.google-apps.folder"===e.mimeType})));return e||i.unshift({name:s.Locale.gdriveSharedWithMe,path:"shared",rev:void 0,dir:!0}),t&&t(null,i)},error:e=>(this.logger.error("List error",this.logger.ts(o),e),t&&t(e))})}))}remove(e,t){this.logger.debug("Remove",e);const n=this.logger.ts(),i=this._baseUrl+"/files/{id}".replace("{id}",e);this._xhr({url:i,method:"DELETE",responseType:"json",statuses:[200,204],success:()=>(this.logger.debug("Removed",e,this.logger.ts(n)),t&&t()),error:i=>(this.logger.error("Remove error",e,i,this.logger.ts(n)),t&&t(i))})}logout(){this._oauthRevokeToken("https://accounts.google.com/o/oauth2/revoke?token={token}")}_getOAuthConfig(){let e=this.appSettings.gdriveClientId,t=this.appSettings.gdriveClientSecret;return e&&t||(r.Features.isDesktop?({id:e,secret:t}=o.GDriveApps.Desktop):r.Features.isLocal?({id:e,secret:t}=o.GDriveApps.Local):({id:e,secret:t}=o.GDriveApps.Production)),{scope:"https://www.googleapis.com/auth/drive",url:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",clientId:e,clientSecret:t,width:600,height:400,pkce:!0,redirectUrlParams:{access_type:"offline"}}}}},1854:(e,t,n)=>{"use strict";n.r(t),n.d(t,{StorageOneDrive:()=>o});var i=n(8402),s=n(5754),r=n(667);class o extends i.StorageBase{constructor(...e){super(...e),this.name="onedrive",this.enabled=!0,this.uipos=40,this.icon="onedrive",this._baseUrl="https://graph.microsoft.com/v1.0/me"}getPathForName(e){return"/drive/root:/"+e+".kdbx"}load(e,t,n){this._oauthAuthorize((t=>{if(t)return n&&n(t);this.logger.debug("Load",e);const i=this.logger.ts(),s=this._baseUrl+e;this._xhr({url:s,responseType:"json",success:t=>{const s=t["@microsoft.graph.downloadUrl"];let r=t.eTag;if(!s||!t.eTag)return this.logger.debug("Load error",e,"no download url",t,this.logger.ts(i)),n&&n("no download url");this._xhr({url:s,responseType:"arraybuffer",skipAuth:!0,success:(t,s)=>(r=s.getResponseHeader("ETag")||r,this.logger.debug("Loaded",e,r,this.logger.ts(i)),n&&n(null,t,{rev:r})),error:t=>(this.logger.error("Load error",e,t,this.logger.ts(i)),n&&n(t))})},error:t=>(this.logger.error("Load error",e,t,this.logger.ts(i)),n&&n(t))})}))}stat(e,t,n){this._oauthAuthorize((t=>{if(t)return n&&n(t);this.logger.debug("Stat",e);const i=this.logger.ts(),s=this._baseUrl+e;this._xhr({url:s,responseType:"json",success:t=>{const s=t.eTag;return s?(this.logger.debug("Stated",e,s,this.logger.ts(i)),n&&n(null,{rev:s})):(this.logger.error("Stat error",e,"no eTag",this.logger.ts(i)),n&&n("no eTag"))},error:(t,s)=>404===s.status?(this.logger.debug("Stated not found",e,this.logger.ts(i)),n&&n({notFound:!0})):(this.logger.error("Stat error",e,t,this.logger.ts(i)),n&&n(t))})}))}save(e,t,n,i,s){this._oauthAuthorize((t=>{if(t)return i&&i(t);this.logger.debug("Save",e,s);const r=this.logger.ts(),o=this._baseUrl+e+":/content";this._xhr({url:o,method:"PUT",responseType:"json",headers:s?{"If-Match":s}:null,data:n,statuses:[200,201,412],success:(t,n)=>(s=t.eTag)?412===n.status?(this.logger.debug("Save conflict",e,s,this.logger.ts(r)),i&&i({revConflict:!0},{rev:s})):(this.logger.debug("Saved",e,s,this.logger.ts(r)),i&&i(null,{rev:s})):(this.logger.error("Save error",e,"no eTag",this.logger.ts(r)),i&&i("no eTag")),error:t=>(this.logger.error("Save error",e,t,this.logger.ts(r)),i&&i(t))})}))}list(e,t){this._oauthAuthorize((n=>{if(n)return t&&t(n);this.logger.debug("List");const i=this.logger.ts(),s=this._baseUrl+(e?`${e}:/children`:"/drive/root/children");this._xhr({url:s,responseType:"json",success:e=>{if(!e||!e.value)return this.logger.error("List error",this.logger.ts(i),e),t&&t("list error");this.logger.debug("Listed",this.logger.ts(i));const n=e.value.filter((e=>e.name)).map((e=>({name:e.name,path:e.parentReference.path+"/"+e.name,rev:e.eTag,dir:!!e.folder})));return t&&t(null,n)},error:e=>(this.logger.error("List error",this.logger.ts(i),e),t&&t(e))})}))}remove(e,t){this.logger.debug("Remove",e);const n=this.logger.ts(),i=this._baseUrl+e;this._xhr({url:i,method:"DELETE",responseType:"json",statuses:[200,204],success:()=>(this.logger.debug("Removed",e,this.logger.ts(n)),t&&t()),error:i=>(this.logger.error("Remove error",e,i,this.logger.ts(n)),t&&t(i))})}mkdir(e,t){this._oauthAuthorize((n=>{if(n)return t&&t(n);this.logger.debug("Make dir",e);const i=this.logger.ts(),s=this._baseUrl+"/drive/root/children",r=JSON.stringify({name:e.replace("/drive/root:/",""),folder:{}});this._xhr({url:s,method:"POST",responseType:"json",statuses:[200,204],data:r,dataType:"application/json",success:()=>(this.logger.debug("Made dir",e,this.logger.ts(i)),t&&t()),error:n=>(this.logger.error("Make dir error",e,n,this.logger.ts(i)),t&&t(n))})}))}logout(e){this._oauthRevokeToken()}_getOAuthConfig(){let e=this.appSettings.onedriveClientId,t=this.appSettings.onedriveClientSecret;return e||(r.Features.isDesktop?({id:e,secret:t}=s.OneDriveApps.Desktop):r.Features.isLocal?({id:e,secret:t}=s.OneDriveApps.Local):({id:e,secret:t}=s.OneDriveApps.Production)),{url:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/token",scope:"files.readwrite offline_access",clientId:e,clientSecret:t,pkce:!0,width:600,height:500}}}},1337:(e,t,n)=>{"use strict";n.r(t),n.d(t,{StorageWebDav:()=>a});var i=n(3617),s=n.n(i),r=n(8402),o=n(3297);class a extends r.StorageBase{constructor(...e){super(...e),this.name="webdav",this.icon="server",this.enabled=!0,this.uipos=10}needShowOpenConfig(){return!0}getOpenConfig(){return{fields:[{id:"path",title:"openUrl",desc:"openUrlDesc",type:"text",required:!0,pattern:"^https://.+"},{id:"user",title:"openUser",desc:"openUserDesc",placeholder:"openUserPlaceholder",type:"text"},{id:"password",title:"openPass",desc:"openPassDesc",placeholder:"openPassPlaceholder",type:"password"}]}}getSettingsConfig(){return{fields:[{id:"webdavSaveMethod",title:"webdavSaveMethod",type:"select",value:this.appSettings.webdavSaveMethod||"default",options:{default:"webdavSaveMove",put:"webdavSavePut"}},{id:"webdavStatReload",title:"webdavStatReload",type:"checkbox",value:!!this.appSettings.webdavStatReload}]}}applySetting(e,t){this.appSettings[e]=t}load(e,t,n){this._request({op:"Load",method:"GET",path:e,user:t?t.user:null,password:t?t.password:null,nostat:this.appSettings.webdavStatReload},n?(e,t,i)=>{this.appSettings.webdavStatReload?this._calcStatByContent(t).then((i=>n(e,t.response,i))):n(e,t.response,i)}:null)}stat(e,t,n){this._statRequest(e,t,"Stat",n?(e,t,i)=>n(e,i):null)}_statRequest(e,t,n,i){this.appSettings.webdavStatReload?this._request({op:n,method:"GET",path:e,user:t?t.user:null,password:t?t.password:null,nostat:!0},i?(e,t)=>{this._calcStatByContent(t).then((n=>i(e,t,n)))}:null):this._request({op:n,method:"HEAD",path:e,user:t?t.user:null,password:t?t.password:null},i?(e,t,n)=>{i(e,t,n)}:null)}save(e,t,n,i,s){const r=function(e,t,n){i&&(i(e,n),i=null)},o=e.replace(/[^\/]+$/,(e=>"."+e))+"."+Date.now(),a={path:e,user:t?t.user:null,password:t?t.password:null};this._statRequest(e,t,"Save:stat",((i,l,c)=>{let u="put"!==this.appSettings.webdavSaveMethod;if(i){if(!i.notFound)return r(i);this.logger.debug("Save: not found, creating"),u=!1}else if(c.rev!==s)return this.logger.debug("Save error",e,"rev conflict",c.rev,s),r({revConflict:!0},0,c);u?this._request(Object.assign({},a,{op:"Save:put",method:"PUT",path:o,data:n,nostat:!0}),(n=>{if(n)return r(n);this._statRequest(e,t,"Save:stat",((n,i,l)=>{if(n)return this._request(Object.assign({},a,{op:"Save:delete",method:"DELETE",path:o})),r(n,0,l);if(l.rev!==s)return this.logger.debug("Save error",e,"rev conflict",l.rev,s),this._request(Object.assign({},a,{op:"Save:delete",method:"DELETE",path:o})),r({revConflict:!0},0,l);let c=e;c.indexOf("://")<0&&(c=0===c.indexOf("/")?location.protocol+"//"+location.host+c:location.href.replace(/\?(.*)/,"").replace(/[^/]*$/,c)),this._request(Object.assign({},a,{op:"Save:move",method:"MOVE",path:o,nostat:!0,headers:{Destination:encodeURI(c),Overwrite:"T"}}),(n=>{if(n)return r(n);this._statRequest(e,t,"Save:stat",((e,t,n)=>{r(e,0,n)}))}))}))})):this._request(Object.assign({},a,{op:"Save:put",method:"PUT",data:n,nostat:!0}),(n=>{if(n)return r(n);this._statRequest(e,t,"Save:stat",((e,t,n)=>{r(e,0,n)}))}))}))}fileOptsToStoreOpts(e,t){const n={user:e.user,encpass:e.encpass};if(e.password){const i=t.uuid,s=e.password,r=this._xorString(s,i);n.encpass=btoa(r)}return n}storeOptsToFileOpts(e,t){const n={user:e.user,password:e.password};if(e.encpass){const i=t.uuid,s=atob(e.encpass);n.password=this._xorString(s,i)}return n}_xorString(e,t){let n="";for(let i=0;i{if([200,201,204].indexOf(i.status)<0){let s;switch(this.logger.debug(e.op+" error",e.path,i.status,this.logger.ts(n)),i.status){case 404:s={notFound:!0};break;case 412:s={revConflict:!0};break;default:s="HTTP status "+i.status}return void(t&&(t(s,i),t=null))}const s=i.getResponseHeader("Last-Modified");if(!s&&!e.nostat)return this.logger.debug(e.op+" error",e.path,"no headers",this.logger.ts(n)),void(t&&(t(o.Locale.webdavNoLastModified,i),t=null));const r=e.op+("e"===e.op.charAt(e.op.length-1)?"d":"ed");this.logger.debug(r,e.path,s,this.logger.ts(n)),t&&(t(null,i,s?{rev:s}:null),t=null)})),i.addEventListener("error",(()=>{this.logger.debug(e.op+" error",e.path,this.logger.ts(n)),t&&(t("network error",i),t=null)})),i.addEventListener("abort",(()=>{this.logger.debug(e.op+" error",e.path,"aborted",this.logger.ts(n)),t&&(t("aborted",i),t=null)})),i.open(e.method,e.path),i.responseType="arraybuffer",e.user&&i.setRequestHeader("Authorization","Basic "+btoa(e.user+":"+e.password)),e.headers)for(const[t,n]of Object.entries(e.headers))i.setRequestHeader(t,n);if(["GET","HEAD"].indexOf(e.method)>=0&&i.setRequestHeader("Cache-Control","no-cache"),e.data){const t=new Blob([e.data],{type:"application/octet-stream"});i.send(t)}else i.send()}_calcStatByContent(e){return 200===e.status&&"arraybuffer"===e.responseType&&e.response&&e.response.byteLength?s().CryptoEngine.sha256(e.response).then((t=>{const n=s().ByteUtils.bytesToHex(t).substr(0,10);return this.logger.debug("Calculated rev by content",`${e.response.byteLength} bytes`,n),{rev:n}})):(this.logger.debug("Cannot calculate rev by content"),null)}}},949:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Storage:()=>m});var i=n(9491),s=n(7980),r=n(526),o=n(7899),a=n(3758),l=n(5661),c=n(1854),u=n(1337),d=n(5434);const h={file:new o.StorageFile,cache:i.Launcher?new a.StorageFileCache:new s.StorageCache},p={dropbox:new r.StorageDropbox,gdrive:new l.StorageGDrive,onedrive:new c.StorageOneDrive,webdav:new u.StorageWebDav},m=h;i.Launcher&&!i.Launcher.thirdPartyStoragesSupported||Object.assign(m,p),requestAnimationFrame(d.createOAuthSession)},6902:(e,t,n)=>{"use strict";n.r(t),n.d(t,{IoBrowserCache:()=>s});const i=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,s=function(e){this.db=null,this.cacheName=e.cacheName,this.logger=e.logger};Object.assign(s.prototype,{initDb(e){if(this.db)return e&&e();try{const t=i.open(this.cacheName);t.onerror=t=>{this.logger.error("Error opening indexed db",t),e&&e(t)},t.onsuccess=t=>{this.db=t.target.result,e&&e()},t.onupgradeneeded=e=>{e.target.result.createObjectStore("files")}}catch(t){this.logger.error("Error opening indexed db",t),e&&e(t)}},save(e,t,n){this.logger.debug("Save",e),this.initDb((i=>{if(i)return n&&n(i);try{const i=this.logger.ts(),s=this.db.transaction(["files"],"readwrite").objectStore("files").put(t,e);s.onsuccess=()=>{this.logger.debug("Saved",e,this.logger.ts(i)),n&&n()},s.onerror=()=>{this.logger.error("Error saving to cache",e,s.error),n&&n(s.error)}}catch(t){this.logger.error("Error saving to cache",e,t),n&&n(t)}}))},load(e,t){this.logger.debug("Load",e),this.initDb((n=>{if(n)return t&&t(n,null);try{const n=this.logger.ts(),i=this.db.transaction(["files"],"readonly").objectStore("files").get(e);i.onsuccess=()=>{this.logger.debug("Loaded",e,this.logger.ts(n)),t&&t(null,i.result)},i.onerror=()=>{this.logger.error("Error loading from cache",e,i.error),t&&t(i.error)}}catch(n){this.logger.error("Error loading from cache",e,n),t&&t(n,null)}}))},remove(e,t){this.logger.debug("Remove",e),this.initDb((n=>{if(n)return t&&t(n);try{const n=this.logger.ts(),i=this.db.transaction(["files"],"readwrite").objectStore("files").delete(e);i.onsuccess=()=>{this.logger.debug("Removed",e,this.logger.ts(n)),t&&t()},i.onerror=()=>{this.logger.error("Error removing from cache",e,i.error),t&&t(i.error)}}catch(n){this.logger.error("Error removing from cache",e,n),t&&t(n)}}))}})},3366:(e,t,n)=>{"use strict";n.r(t),n.d(t,{IoCache:()=>o});var i=n(9491),s=n(7811),r=n(6902);const o=i.Launcher?s.IoFileCache:r.IoBrowserCache},7811:(e,t,n)=>{"use strict";n.r(t),n.d(t,{IoFileCache:()=>s});var i=n(9491);const s=function(e){this.basePath=null,this.cacheName=e.cacheName,this.logger=e.logger};Object.assign(s.prototype,{initFs(e){if(this.basePath)return e();const t=i.Launcher.getUserDataPath(this.cacheName);i.Launcher.mkdir(t,(n=>{n?this.logger.error("Error creating plugin folder"):this.basePath=t,e(n)}))},resolvePath(e){return i.Launcher.joinPath(this.basePath,e)},save(e,t,n){this.initFs((s=>{if(s)return n&&n(s,null);this.logger.debug("Save",e);const r=this.logger.ts(),o=this.resolvePath(e);i.Launcher.writeFile(o,t,(t=>{t?(this.logger.error("Error saving file",e,t),n&&n(t)):(this.logger.debug("Saved",e,this.logger.ts(r)),n&&n())}))}))},load(e,t){this.initFs((n=>{if(n)return t&&t(n,null);this.logger.debug("Load",e);const s=this.logger.ts(),r=this.resolvePath(e);i.Launcher.readFile(r,void 0,((n,i)=>{i?(this.logger.error("Error loading file",e,i),t&&t(i)):(this.logger.debug("Loaded",e,this.logger.ts(s)),t&&t(null,n))}))}))},remove(e,t){this.initFs((n=>{if(n)return t&&t(n,null);this.logger.debug("Remove",e);const s=this.logger.ts(),r=this.resolvePath(e);i.Launcher.deleteFile(r,(n=>{n?(this.logger.error("Error removing file",e,n),t&&t(n)):(this.logger.debug("Removed",e,this.logger.ts(s)),t&&t())}))}))}})},5434:(e,t,n)=>{"use strict";n.r(t),n.d(t,{createOAuthSession:()=>o});var i=n(3617),s=n.n(i);let r;function o(){const e=r,t=s().ByteUtils.bytesToHex(s().Random.getBytes(64)),n=s().ByteUtils.bytesToHex(s().Random.getBytes(50)),i=s().ByteUtils.arrayToBuffer(s().ByteUtils.stringToBytes(n));return s().CryptoEngine.sha256(i).then((e=>{const i=s().ByteUtils.bytesToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");r={state:t,codeChallenge:i,codeVerifier:n}})),r=null,e}},8402:(e,t,n)=>{"use strict";n.r(t),n.d(t,{StorageBase:()=>m});var i=n(7201),s=n(9673),r=n(7614),o=n(8925),a=n(2363),l=n(4715),c=n(4798),u=n(9491),d=n(6838),h=n(667),p=n(5434);class m{constructor(){this.name=null,this.icon=null,this.enabled=!1,this.system=!1,this.uipos=null,this.logger=null,this.appSettings=r.AppSettingsModel,this.runtimeData=o.RuntimeDataModel}init(){if(!this.name)throw"Failed to init provider: no name";if(!this.system){const e=this.appSettings[this.name];"boolean"==typeof e&&(this.enabled=e)}return this.logger=new a.Logger("storage-"+this.name),this}setEnabled(e){e||this.logout(),this.enabled=e}get loggedIn(){return!!this.runtimeData[this.name+"OAuthToken"]}logout(){}_xhr(e){this.logger.info("HTTP request",e.method||"GET",e.url),e.data&&(e.dataType||(e.dataType="application/octet-stream"),e.headers=Object.assign({},e.headers,{"Content-Type":e.dataType})),this._oauthToken&&!e.skipAuth&&(e.headers=Object.assign({},e.headers,{Authorization:"Bearer "+this._oauthToken.accessToken})),this._httpRequest(e,(t=>{this.logger.info("HTTP response",t.status);return(e.statuses||[200]).indexOf(t.status)>=0?e.success&&e.success(t.response,t):401===t.status&&this._oauthToken?void this._oauthGetNewToken((n=>n?e.error&&e.error("unauthorized",t):(e.tryNum=(e.tryNum||0)+1,e.tryNum>=3?(this.logger.info("Too many authorize attempts, fail request",e.url),e.error&&e.error("unauthorized",t)):(this.logger.info("Repeat request, try #"+e.tryNum,e.url),void this._xhr(e))))):e.error&&e.error("http status "+t.status,t)}))}_httpRequest(e,t){(h.Features.isDesktop?this._httpRequestLauncher:this._httpRequestWeb).call(this,e,t)}_httpRequestWeb(e,t){const n=new XMLHttpRequest;if(e.responseType&&(n.responseType=e.responseType),n.addEventListener("load",(()=>{t({status:n.status,response:n.response,getResponseHeader:e=>n.getResponseHeader(e)})})),n.addEventListener("error",(()=>e.error&&e.error("network error",n))),n.addEventListener("timeout",(()=>e.error&&e.error("timeout",n))),n.open(e.method||"GET",e.url),e.headers)for(const[t,i]of Object.entries(e.headers))n.setRequestHeader(t,i);let i=e.data;i&&(e.dataIsMultipart||(i=[i]),i=new Blob(i,{type:e.dataType})),n.send(i)}_httpRequestLauncher(e,t){u.Launcher.remoteApp().httpRequest(e,((e,...t)=>this.logger[e](...t)),(({status:n,response:i,headers:s})=>{if(i=Buffer.from(i,"hex"),"json"===e.responseType)try{i=JSON.parse(i.toString("utf8"))}catch(t){return e.error&&e.error("json parse error")}else i=i.buffer.slice(i.byteOffset,i.byteOffset+i.length);t({status:n,response:i,getResponseHeader:e=>s[e.toLowerCase()]})}))}_openPopup(e,t,n,i,s){const r=void 0!==window.screenLeft?window.screenLeft:screen.left,o=void 0!==window.screenTop?window.screenTop:screen.top;let a={width:n,height:i,left:(window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width)/2-n/2+r,top:(window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height)/2-i/2+o,dialog:"yes",dependent:"yes",scrollbars:"yes",location:"yes"};return a=Object.keys(a).map((e=>e+"="+a[e])).join(","),window.open(e,t,a,s)}_getOauthRedirectUrl(){let e=window.location.href;return 0===e.lastIndexOf("file:",0)&&(e=s.Links.WebApp),new URL(`oauth-result/${this.name}.html`,e).href}_oauthAuthorize(e){if(this._tokenIsValid(this._oauthToken))return e();const t=this._getOAuthConfig(),n=this.runtimeData[this.name+"OAuthToken"];if(this._tokenIsValid(n))return this._oauthToken=n,e();if(n&&n.refreshToken)return this._oauthExchangeRefreshToken(e);const s=(0,p.createOAuthSession)();let r;h.Features.isDesktop?(r=l.StorageOAuthListener.listen(this.name),s.redirectUri=r.redirectUri):s.redirectUri=this._getOauthRedirectUrl();const o=t.pkce?{code_challenge:s.codeChallenge,code_challenge_method:"S256"}:void 0,a=c.UrlFormat.makeUrl(t.url,Object.assign({client_id:t.clientId,scope:t.scope,state:s.state,redirect_uri:s.redirectUri,response_type:"code"},o,t.urlParams));if(r)return r.on("ready",(()=>{u.Launcher.openLink(a),e("browser-auth-started")})),r.on("error",(t=>e(t))),void r.on("result",(e=>this._oauthCodeReceived(e,s)));if(!this._openPopup(a,"OAuth",t.width,t.height))return e("OAuth: cannot open popup");this.logger.debug("OAuth: popup opened");const d=t=>{const n={};for(const[e,i]of new URLSearchParams(t).entries())n[e]=i;n.error?(this.logger.error("OAuth error",n.error,n.error_description),e("OAuth: "+n.error)):n.code?(i.Events.off("popup-closed",m),window.removeEventListener("message",f),this._oauthCodeReceived(n,s,e)):this.logger.debug("Skipped OAuth message",n)},m=t=>{i.Events.off("popup-closed",m),window.removeEventListener("message",f),t.locationSearch?d(t.locationSearch):(this.logger.error("OAuth error","popup closed"),e("OAuth: popup closed"))},f=e=>{e.origin===location.origin&&(e.data&&e.data.storage&&e.data.search?e.data.storage===this.name?d(e.data.search):this.logger.debug("Skipped OAuth message for another storage",e.data.storage):this.logger.debug("Skipped empty OAuth message",e.data))};i.Events.on("popup-closed",m),window.addEventListener("message",f)}_oauthProcessReturn(e){const t=this._oauthMsgToToken(e);return t&&!t.error&&(this._oauthToken=t,this.runtimeData[this.name+"OAuthToken"]=t,this.logger.debug("OAuth token received")),t}_oauthMsgToToken(e){return e.token_type?(0,d.omitEmpty)({dt:Date.now()-6e4,tokenType:e.token_type,accessToken:e.access_token,refreshToken:e.refresh_token,authenticationToken:e.authentication_token,expiresIn:+e.expires_in,scope:e.scope,userId:e.user_id}):e.error?{error:e.error,errorDescription:e.error_description}:void 0}_oauthGetNewToken(e){this._oauthToken.expired=!0,this.runtimeData[this.name+"OAuthToken"]=this._oauthToken,this._oauthToken.refreshToken?this._oauthExchangeRefreshToken(e):this._oauthAuthorize(e)}_oauthRevokeToken(e,t){const n=this.runtimeData[this.name+"OAuthToken"];n&&(e&&this._xhr(Object.assign({url:e.replace("{token}",n.accessToken),statuses:[200,401]},t)),delete this.runtimeData[this.name+"OAuthToken"],this._oauthToken=null)}_tokenIsValid(e){return!(!e||e.expired)&&!(e.dt&&e.expiresIn&&e.dt+1e3*e.expiresIn{this.logger.debug("OAuth code exchanged",e);const t=this._oauthProcessReturn(e);if(t&&t.error)return n&&n("OAuth code exchange error: "+t.error);null==n||n()},error:e=>{this.logger.error("Error exchanging OAuth code",e),null==n||n("OAuth code exchange error: "+e)}})}_oauthExchangeRefreshToken(e){this.logger.debug("Exchanging refresh token");const{refreshToken:t}=this.runtimeData[this.name+"OAuthToken"],n=this._getOAuthConfig();this._xhr({url:n.tokenUrl,method:"POST",responseType:"json",skipAuth:!0,data:c.UrlFormat.buildFormData(Object.assign({client_id:n.clientId},n.clientSecret?{client_secret:n.clientSecret}:null,{grant_type:"refresh_token",refresh_token:t})),dataType:"application/x-www-form-urlencoded",success:n=>{this.logger.debug("Refresh token exchanged"),this._oauthProcessReturn(Object.assign({refresh_token:t},n)),e()},error:(t,n)=>{400===n.status?(delete this.runtimeData[this.name+"OAuthToken"],this._oauthToken=null,this.logger.error("Error exchanging refresh token, trying to authorize again"),this._oauthAuthorize(e)):(this.logger.error("Error exchanging refresh token",t),null==e||e("Error exchanging refresh token"))}})}}},4715:(e,t,n)=>{"use strict";n.r(t),n.d(t,{StorageOAuthListener:()=>c});var i=n(7187),s=n.n(i),r=n(2363),o=n(9491),a=n(3297);const l=new r.Logger("storage-oauth-listener"),c={server:null,listen(e){this.server&&this.stop();const t={};Object.keys(s().prototype).forEach((e=>{t[e]=s().prototype[e]}));const n=o.Launcher.req("http");let i=!1;const r=n.createServer(((e,n)=>{n.writeHead(200,"OK",{"Content-Type":"text/plain; charset=UTF-8"}),n.end(a.Locale.appBrowserAuthComplete),i||(this.stop(),this.handleResult(e.url,t),i=!0)})),c=48149;return l.info("Starting OAuth listener on port 48149..."),r.listen(c),r.on("error",(e=>{l.error("Failed to start OAuth listener",e),t.emit("error","Failed to start OAuth listener: "+e),r.close()})),r.on("listening",(()=>{this.server=r,t.emit("ready")})),t.redirectUri=`http://localhost:48149/oauth-result/${e}.html`,t},stop(){this.server&&(this.server.close(),l.info("OAuth listener stopped"))},handleResult(e,t){if((e=new URL(e,t.redirectUri)).origin+e.pathname!==t.redirectUri)return void l.info("Skipped result",e,t.redirectUri);l.info("OAuth result with code received");const n=e.searchParams.get("state"),i=e.searchParams.get("code");t.emit("result",{state:n,code:i})}}},4546:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Color:()=>r});var i=n(7017);const s={},r=function(e){const t=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(,\s*([\d.]+))?\)$/.exec(e);if(t)this.r=+t[1],this.g=+t[2],this.b=+t[2],this.a=t[4]?t[4]:1,this.setHsl();else{const t=/^#?([0-9a-f]{3,6})$/i.exec(e);if(t){const e=t[1],n=3===e.length?1:2;this.r=parseInt(e.substr(0,n),16),this.g=parseInt(e.substr(n,n),16),this.b=parseInt(e.substr(2*n,n),16),this.a=1,this.setHsl()}else e instanceof r?(this.r=e.r,this.g=e.g,this.b=e.b,this.h=e.h,this.s=e.s,this.l=e.l,this.a=e.a):(this.r=this.g=this.b=this.h=this.s=this.l=0,this.a=1)}};r.prototype.setHsl=function(){const e=this.r/255,t=this.g/255,n=this.b/255,i=Math.max(e,t,n),s=Math.min(e,t,n);let r,o;const a=(i+s)/2;if(i===s)r=o=0;else{const l=i-s;switch(o=a>.5?l/(2-i-s):l/(i+s),i){case e:r=(t-n)/l+(t{"use strict";n.r(t),n.d(t,{Comparators:()=>r});const i=String.fromCharCode(65533),s=window.Intl&&window.Intl.Collator&&!/Edge/.test(navigator.userAgent)?new Intl.Collator(void 0,{sensitivity:"base"}).compare:(e,t)=>e.toLocaleLowerCase().localeCompare(t.toLocaleLowerCase()),r={stringComparator:(e,t)=>t?function(t,n){return s(t[e]||i,n[e]||i)}:function(t,n){return s(n[e],t[e])},rankComparator:()=>function(e,t){return t.getRank(this.filter)-e.getRank(this.filter)},dateComparator:(e,t)=>t?function(t,n){return t[e]-n[e]}:function(t,n){return n[e]-t[e]}}},8009:(e,t,n)=>{"use strict";n.r(t),n.d(t,{CsvParser:()=>i});class i{constructor(){this.next=void 0,this.csv=void 0,this.index=void 0,this.line=[],this.lines=[],this.value="",this.error=void 0}parse(e){for(this.csv=e.trim().replace(/\r\n/g,"\n"),this.result=[],this.next=this.handleBeforeValue,this.index=0;this.next&&this.index=0&&(t<0||e=0?t:this.csv.length;const i=this.csv.substr(this.index,n-this.index);return this.line.push(i),this.index=n,this.handleAfterValue}handleQuotedValue(){const e=this.csv.indexOf('"',this.index),t=this.csv.indexOf("\\",this.index);if(e<0)return this.index=this.csv.length,this.error="Quoted value not closed",this.handleError;if(t>0&&t{"use strict";n.r(t),n.d(t,{Otp:()=>s});const i=new(n(2363).Logger)("otp"),s=function(e,t){if(["hotp","totp"].indexOf(t.type)<0)throw"Bad type: "+t.type;if(!t.secret)throw"Empty secret";if(t.algorithm&&["SHA1","SHA256","SHA512"].indexOf(t.algorithm)<0)throw"Bad algorithm: "+t.algorithm;if(t.digits&&["6","7","8"].indexOf(t.digits)<0)throw"Bad digits: "+t.digits;if("hotp"===t.type&&!t.counter)throw"Bad counter: "+t.counter;if(t.period&&isNaN(t.period)||t.period<1)throw"Bad period: "+t.period;if(this.url=e,this.type=t.type,this.account=t.account,this.secret=t.secret,this.issuer=t.issuer,this.algorithm=t.algorithm?t.algorithm.toUpperCase():"SHA1",this.digits=t.digits?+t.digits:6,this.counter=t.counter,this.period=t.period?+t.period:30,this.key=s.fromBase32(this.secret),!this.key)throw"Bad key: "+this.key};s.prototype.next=function(e){let t,n;if("totp"===this.type){const e=Date.now(),i=Math.round(e/1e3);t=Math.floor(i/this.period);const s=1e3*this.period;n=s-e%s}else t=this.counter;const r=new Uint8Array(8).buffer;new DataView(r).setUint32(4,t),this.hmac(r,((t,r)=>{if(!t)return i.error("OTP calculation error",r),e(r);const o=15&(t=new DataView(t)).getInt8(t.byteLength-1),a=2147483647&t.getUint32(o);let l;l="Steam"===this.issuer?s.hmacToSteamCode(a):s.hmacToDigits(a,this.digits),e(null,l,n)}))},s.prototype.hmac=function(e,t){const n=window.crypto.subtle||window.crypto.webkitSubtle,i={name:"HMAC",hash:{name:this.algorithm.replace("SHA","SHA-")}};n.importKey("raw",this.key,i,!1,["sign"]).then((s=>{n.sign(i,s,e).then((e=>{t(e)})).catch((e=>{t(null,e)}))})).catch((e=>{t(null,e)}))},s.hmacToDigits=function(e,t){let n=e.toString();return n=s.leftPad(n.substr(n.length-t),t),n},s.hmacToSteamCode=function(e){const t="23456789BCDFGHJKMNPQRTVWXY";let n="";for(let i=0;i<5;++i)n+=t.charAt(e%t.length),e/=t.length;return n},s.fromBase32=function(e){e=e.replace(/\s/g,"");let t,n="";for(t=0;t1&&(n.account=e[1].trim())}return n.type=t[1].toLowerCase(),t[3].split("&").forEach((e=>{const t=e.split("=",2);n[t[0].toLowerCase()]=decodeURIComponent(t[1])})),new s(e,n)},s.isSecret=function(e){return!!s.fromBase32(e)},s.makeUrl=function(e,t,n){return"otpauth://totp/default?secret="+e+(t?"&period="+t:"")+(n?"&digits="+n:"")}},5563:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Ranking:()=>i});const i={getStringRank(e,t){if(!e||!t)return 0;let n=s(e,t);return 0===n&&e.length===t.length?10:0===n?5:n>0?3:(n=s(t,e),0===n?5:n>0?3:0)}};function s(e,t){return e.isProtected?e.indexOfLower(t):t.isProtected?t.indexOfSelfInLower(e):e.indexOf(t)}window.Ranking=i},8146:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SemVer:()=>i});const i={compareVersions(e,t){e=e.replace(/-.*$/,"").split("."),t=t.replace(/-.*$/,"").split(".");for(let n=0;ns)return 1}return 0}}},7536:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SignatureVerifier:()=>l});var i=n(3617),s=n.n(i),r=n(2363);const o="-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnRq2k3TTx0ewTe6wDr6Q\nVeB5diwiIWzsJD+ApfZu1KNPedcAgslAfjpNsYF1if6cYsPMJH70xJ2np6RQBl1V\nPdwShOuxkD7m0BD5Hw/Aar8Hdp5cvAdOOMdBO+0DbGeUMy+z66s+oUCJmqVp19T6\nPkkxbhN08rgtT7v+aFvrbqbO/vlsskbJpH2K2io+e1XmRGPnSr9q4KSqfGbTfe5g\nLwDIOFd66Z4mb5Utb5wWpsy6Gjh06Yf257AccGD3A1bkTNOyeeX0tqciYBePWMk0\nicP/aZ6hnErfhnUKf3tOgPLppSHiGcaSKekhChZ2xLUs3U64JwrXSmwHj+TzdO3S\n0QIDAQAB\n-----END PUBLIC KEY-----\n",a="-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyZAmWXMpKsh9WCyUO5TR\n2/QIJsgyaViWRAgY5nHZhTR/sjhfG97OeurW7NYC4XPsnyJDepEjDsj9LNzquMES\nxsLRSmxo+m1lVWn8Q59LwqOvUK+BKH4eZYF89Nwv2HZjZnr/w7xYcxJbhOuAzpbq\nFD/gAvlozrsHG9uI95h1FHPd6mfolEHLK30LXPQ5FdJ/AWb29ILKYbVEdM8qsjoN\nfSICw7XTbd7wB0TMcgRpjWllzKaftxCO38svhBjAz4cUvtZ05yi4dzK0VsJHfW33\nuno3YBn0/bwLkqMzD1/Hv05p6CVzuDTOCBsXkEobra8OBviatoSukot6cS4Famki\n9QIDAQAB\n-----END PUBLIC KEY-----\n",l={logger:new r.Logger("signature-verifier"),publicKeys:null,verify(e,t,n){if(!n){const n=this.getPublicKeys();return this.verify(e,t,n[0]).then((i=>i||!n[1]?i:this.verify(e,t,n[1])))}return new Promise(((i,r)=>{const o={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};try{"string"==typeof t&&(t=s().ByteUtils.base64ToBytes(t));const a=window.crypto.subtle,l="spki";n=s().ByteUtils.base64ToBytes(n),a.importKey(l,n,o,!1,["verify"]).then((n=>{try{a.verify(o,n,s().ByteUtils.arrayToBuffer(t),s().ByteUtils.arrayToBuffer(e)).then((e=>{i(e)})).catch((e=>{this.logger.error("Verify error",e),r(e)}))}catch(e){this.logger.error("Signature verification error",e),r(e)}})).catch((e=>{this.logger.error("ImportKey error",e),r(e)}))}catch(e){this.logger.error("Signature key verification error",e),r(e)}}))},getPublicKeys(){return this.publicKeys||(this.publicKeys=[o,a].map((e=>e.match(/-+BEGIN PUBLIC KEY-+([\s\S]+?)-+END PUBLIC KEY-+/)[1].replace(/\s+/g,"")))),this.publicKeys}}},9907:(e,t,n)=>{"use strict";n.r(t),n.d(t,{EntrySearch:()=>s});var i=n(9166);class s{constructor(e){this.model=e}matches(e){if(!e)return!0;if(e.tagLower&&this.model.searchTags&&this.model.searchTags.indexOf(e.tagLower)<0)return!1;if(e.textLower)if(e.advanced){if(!this.matchesAdv(e))return!1}else if(e.textLowerParts){const t=e.textLowerParts;for(let e=0;e=0}static matchStringLower(e,t){return e.isProtected?e.includesLower(t):e.toLowerCase().indexOf(t)>=0}static matchStringMulti(e,t,n,i){for(let s=0;s!(i.BuiltInFields.indexOf(s)>=0)&&("string"==typeof e[s]?t.other&&a(e[s],n,r,o):t.protect&&a(e[s],n,r,o))))}return l}static matchField(e,t,n,i){return!!e&&t(e,n,i)}}},667:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Features:()=>s});const i=!!(window.process&&window.process.versions&&window.process.versions.electron),s={isDesktop:i,isMac:navigator.platform.indexOf("Mac")>=0,isWindows:navigator.platform.indexOf("Win")>=0,isiOS:/iPad|iPhone|iPod/i.test(navigator.userAgent),isMobile:/iPhone|iPad|iPod|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop|Windows Phone|webOS/i.test(navigator.userAgent)||screen.width<800,isPopup:!(window.parent===window.top&&!window.opener),isStandalone:!!navigator.standalone,isFrame:window.top!==window,isSelfHosted:!i&&!/^http(s?):\/\/((localhost:8085)|((app|beta)\.keeweb\.info))/.test(location.href),isLocal:location.origin.indexOf("localhost")>=0,supportsTitleBarStyles(){return this.isMac},hasUnicodeFlags(){return this.isMac},getBrowserCssClass:()=>window.chrome&&window.navigator.userAgent.indexOf("Chrome/")>-1?"chrome":window.navigator.userAgent.indexOf("Edge/")>-1?"edge":navigator.standalone?"standalone":""}},6838:(e,t,n)=>{"use strict";n.r(t),n.d(t,{escape:()=>s,noop:()=>r,shuffle:()=>o,pick:()=>a,omit:()=>l,omitEmpty:()=>c,mapObject:()=>u,isEqual:()=>d});var i=n(7109);const s=n.n(i)().escapeExpression;function r(){}function o(e){for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e}function a(e,t){if(!e)return e;const n={};for(const i of t)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function l(e,t){if(!e)return e;const n=Object.assign({},e);for(const e of t)delete n[e];return n}function c(e){return e?Object.entries(e).reduce(((e,[t,n])=>(n&&(e[t]=n),e)),{}):e}function u(e,t){return Object.entries(e).reduce(((e,[n,i])=>(e[n]=t(i),e)),{})}function d(e,t){return e===t||(e instanceof Date?+e==+t:e instanceof Array&&t instanceof Array&&e.join(",")===t.join(","))}},8495:(e,t,n)=>{"use strict";n.r(t),n.d(t,{IconUrlFormat:()=>r});var i=n(3617),s=n.n(i);const r={toDataUrl:e=>e?"data:image/png;base64,"+s().ByteUtils.bytesToBase64(e):null}},8134:(e,t,n)=>{"use strict";n.r(t),n.d(t,{MdToHtml:()=>c});var i=n(1638),s=n.n(i),r=n(4782),o=n.n(r);const a=/<\/?p>|
|\r|\n/g;class l extends o().Renderer{link(e,t,n){return super.link(e,t,n).replace("${s().sanitize(n,{ADD_ATTR:["target"]})}`}}}},1705:(e,t,n)=>{"use strict";n.r(t),n.d(t,{PasswordPresenter:()=>o});n(9689);var i=n(6838);class s{randomCharCode(){return 97+Math.floor(26*Math.random())}}function r(e){return Math.random()<.2?String.fromCharCode(e):`${e.toString(16)};`}const o={present:e=>new Array(e+1).join("•"),presentValueWithLineBreaks(e){if(!e)return"";let t="";return e.forEachChar((e=>{t+=10===e?"\n":"•"})),t},asDOM(e){const t=[],n=new s;let o=0;e.forEachChar((e=>{const i=r(e);if(t.push({html:i,order:o}),Math.random()>.5){const e=r(n.randomCharCode());t.push({html:e,order:-1})}o++})),(0,i.shuffle)(t);const a=document.createElement("div");a.style.display="flex";for(const e of t){const t=document.createElement("div");t.innerHTML=e.html,e.order>=0?t.style.order=e.order:t.style.display="none",a.appendChild(t)}return a}}},2378:(e,t,n)=>{"use strict";n.r(t),n.d(t,{StringFormat:()=>i});const i={camelCaseRegex:/-./g,capFirst:e=>e?e[0].toUpperCase()+e.substr(1):"",pad(e,t){let n=e.toString();for(;n.lengthe[1].toUpperCase()))},pascalCase(e){return this.capFirst(e.replace(this.camelCaseRegex,(e=>e[1].toUpperCase())))}}},4798:(e,t,n)=>{"use strict";n.r(t),n.d(t,{UrlFormat:()=>i});const i={multiSlashRegex:/\/{2,}/g,lastPartRegex:/[\/\\]?[^\/\\]+$/,kdbxEndRegex:/\.kdbx$/i,getDataFileName(e){const t=e.lastIndexOf("/");return t>=0&&(e=e.substr(t+1)),e=e.replace(/\?.*/,"").replace(/\.kdbx/i,"")},isKdbx(e){return e&&this.kdbxEndRegex.test(e)},fixSlashes(e){return e.replace(this.multiSlashRegex,"/")},fileToDir(e){return e.replace(this.lastPartRegex,"")||"/"},makeUrl:(e,t)=>e+"?"+Object.entries(t).map((([e,t])=>e+"="+encodeURIComponent(t))).join("&"),buildFormData:e=>Object.entries(e).map((([e,t])=>`${e}=${encodeURIComponent(t)}`)).join("&")}},1240:(e,t,n)=>{"use strict";n.r(t),n.d(t,{IdGenerator:()=>i});const i={uuid(){const e=i.s4;return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},s4:()=>Math.floor(65536*(1+Math.random())).toString(16).substring(1)}},4486:(e,t,n)=>{"use strict";n.r(t),n.d(t,{PasswordGenerator:()=>l,CharRanges:()=>o});var i=n(3617),s=n.n(i),r=n(8709);const o={upper:"ABCDEFGHJKLMNPQRSTUVWXYZ",lower:"abcdefghijkmnpqrstuvwxyz",digits:"123456789",special:"!@#$%^&*_+-=,./?;:`\"~'\\",brackets:"(){}[]<>",high:"¡¢£¤¥¦§©ª«¬®¯°±²³´µ¶¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ",ambiguous:"O0oIl"},a={A:o.upper,a:o.lower,1:o.digits,"*":o.special,"[":o.brackets,Ä:o.high,0:o.ambiguous},l={generate(e){if(!e||"number"!=typeof e.length||e.length<0)return"";if("Pronounceable"===e.name)return this.generatePronounceable(e);const t=Object.keys(o).filter((t=>e[t])).map((e=>o[e]));if(e.include&&e.include.length&&t.push(e.include),!t.length)return"";const n=Object.assign({},a,{X:t.join(""),I:e.include||""}),i=e.pattern||"X",r=s().Random.getBytes(e.length),l=[];for(let t=0;t=0&&(e=e.toUpperCase()),n+=e}return n.substr(0,e.length)},deriveOpts(e){const t={};let n=0;if(e){const i=o;e.forEachChar((e=>{n++,e=String.fromCharCode(e);for(const[n,s]of Object.entries(i))s.indexOf(e)>=0&&(t[n]=!0)}))}return t.length=n,t}}},8709:(e,t,n)=>{"use strict";n.r(t),n.d(t,{phonetic:()=>d});const i=["b","c","d","f","g","h","j","k","l","m","n","p","qu","r","s","t","bl","ch","cl","cr","dr","fl","fr","gl","gr","kl","kr","ph","pr","pl","sc","sh","sl","sn","sr","st","str","sw","th","tr","br","v","w","y","z"],s=["a","e","i","o","u","ee","ie","oo","ou","ue"],r=["b","d","f","g","k","l","m","n","p","r","s","t","y","ch","ck","ln","nk","ng","rn","sh","sk","st","th","x","z"],o={quu:"que","qu([aeiou]){2}":"qu$1","[iu]y":"ey",eye:"ye","(.)ye$":"$1y","(^|e)cie(?!$)":"$1cei","([vz])$":"$1e","[iu]w":"ow"};function a(e){const t=l(e.numeric),n=t%e.opts.compoundSimplicity==0,o=""===e.word;o&&t%6>0||e.lastSkippedPost||n?(e.word+=c(i,16,e),e.lastSkippedPre=!1):e.lastSkippedPre=!0,e.word+=c(s,5,e,o&&e.lastSkippedPre),e.lastSkippedPre||n?(e.word+=c(r,13,e),e.lastSkippedPost=!1):e.lastSkippedPost=!0}function l(e){let t=1;for(;e;)t+=e%7,e=Math.floor(e/7);return t}function c(e,t,n,i){const s=l(n.numeric),r=(n.numeric+s)%n.opts.phoneticSimplicity>0||i?t:e.length,o=e[n.numeric%r];return n.numeric=u(n.numeric+n.word),o}function u(e){let t=0;for(let n=0,i=(e+="-Phonetic").length;n>>=0}return t}const d={generate:function(e){const t=(e=function(e){const t={};return e=e||{},t.length=e.length||16,t.seed=e.seed||Math.random(),t.phoneticSimplicity=e.phoneticSimplicity?Math.max(e.phoneticSimplicity,1):5,t.compoundSimplicity=e.compoundSimplicity?Math.max(e.compoundSimplicity,1):5,t}(e)).length,n={numeric:u(e.seed),lastSkippedPost:!1,word:"",opts:e};for(;n.word.length{"use strict";n.r(t),n.d(t,{KdbxwebInit:()=>c});var i=n(3617),s=n.n(i),r=n(2363),o=n(667),a=n(3006);const l=new r.Logger("argon2"),c={init(){s().CryptoEngine.argon2=(...e)=>this.argon2(...e)},argon2(e,t,n,i,s,r,o,a){const c={password:e,salt:t,memory:n,iterations:i,length:s,parallelism:r,type:o,version:a};return this.loadRuntime(n).then((e=>{const t=l.ts();return e.hash(c).then((e=>(l.debug("Hash computed",l.ts(t)),e)))}))},loadRuntime(e){return this.runtimeModule?Promise.resolve(this.runtimeModule):n.g.WebAssembly?o.Features.isDesktop?(l.debug("Using native argon2"),this.runtimeModule={hash(e){const t=l.ts(),n=r(e.password),i=r(e.salt);return a.NativeModules.argon2(n,i,{type:e.type,version:e.version,hashLength:e.length,saltLength:e.salt.length,timeCost:e.iterations,parallelism:e.parallelism,memoryCost:e.memory}).then((e=>(n.data.fill(0),i.data.fill(0),l.debug("Argon2 hash calculated",l.ts(t)),function(e){const t=Buffer.from(e.data),n=Buffer.from(e.random);for(let e=0;e{throw n.data.fill(0),i.data.fill(0),l.error("Argon2 error",e),e}));function r(e){const t=Buffer.from(e),n=Buffer.from(s().Random.getBytes(t.length));for(let e=0;e{const s=setTimeout((()=>i("timeout")),5e3);try{const r=l.ts(),o=n(3401).Z,a=n(3e3),u=1048576,d=65536,h=(2*(1024*(1024*u))-64*u)/1024/d,p=Math.min(Math.max(Math.ceil(1024*e/d),256)+256,h),m=`var wasmMemory=new WebAssembly.Memory({initial:${p},maximum:${h}});`,f='var Module={wasmJSMethod: "native-wasm",wasmBinary: Uint8Array.from(atob("'+a+'"), c => c.charCodeAt(0)),print(...args) { postMessage({op:"log",args}) },printErr(...args) { postMessage({op:"log",args}) },postRun:'+this.workerPostRun.toString()+",calcHash:"+this.calcHash.toString()+",wasmMemory:wasmMemory,buffer:wasmMemory.buffer,TOTAL_MEMORY:"+p*d+"}",g=o.replace(/^var Module.*?}/,m+f),A=new Blob([g],{type:"application/javascript"}),y=URL.createObjectURL(A),v=new Worker(y),b=e=>{switch(e.data.op){case"log":l.debug(...e.data.args);break;case"postRun":l.debug("WebAssembly runtime loaded (web worker)",l.ts(r)),URL.revokeObjectURL(y),clearTimeout(s),v.removeEventListener("message",b),this.runtimeModule={hash:e=>new Promise(((t,n)=>{v.postMessage(e);const i=e=>{if(v.removeEventListener("message",i),v.terminate(),c.runtimeModule=null,e.data&&!e.data.error&&e.data.hash)t(e.data.hash);else{const t=e.data&&e.data.error||"unexpected error";l.error("Worker error",t),n(t)}};v.addEventListener("message",i)}))},t(this.runtimeModule);break;default:l.error("Unknown message",e.data),URL.revokeObjectURL(y),i("Load error")}};v.addEventListener("message",b)}catch(e){i(e)}})).catch((e=>{throw l.warn("WebAssembly error",e),new Error("WebAssembly error")})):Promise.reject("WebAssembly is not supported")},workerPostRun:function(){self.postMessage({op:"postRun"}),self.onmessage=e=>{try{const t=Module.calcHash(Module,e.data);self.postMessage({hash:t})}catch(e){self.postMessage({error:e.toString()})}}},calcHash:function(e,t){let{password:n,salt:i}=t;const{memory:s,iterations:r,length:o,parallelism:a,type:l,version:c}=t,u=n.byteLength;n=e.allocate(new Uint8Array(n),"i8",e.ALLOC_NORMAL);const d=i.byteLength;i=e.allocate(new Uint8Array(i),"i8",e.ALLOC_NORMAL);const h=e.allocate(new Array(o),"i8",e.ALLOC_NORMAL),p=e.allocate(new Array(512),"i8",e.ALLOC_NORMAL),m=e._argon2_hash(r,s,a,n,u,i,d,h,o,p,512,l,c);if(m)throw new Error("Argon2 error "+m);const f=new Uint8Array(o);for(let t=0;t{"use strict";n.r(t);var i=n(3617),s=n.n(i);const r="{REF:0@I:00000000000000000000000000000000}".split(""),o=r.length;s().ProtectedValue.prototype.isProtected=!0,s().ProtectedValue.prototype.forEachChar=function(e){const t=this._value,n=this._salt;let i,s,r,o;for(let a=0,l=t.length;a=192&&i<224){if(!1===e((31&i)<<6|63&s))return}else{if(a++,r=t[a]^n[a],a===l)break;if(i>=224&&i<240&&!1===e((15&i)<<12|(63&s)<<6|63&r))return;if(a++,o=t[a]^n[a],a===l)break;if(i>=240&&i<248){let t=(7&i)<<18|(63&s)<<12|(63&r)<<6|63&o;if(t<=65535){if(!1===e(t))return}else{if(t^=65536,!1===e(55296|t>>10))return;if(!1===e(56320|1023&t))return}}}}},Object.defineProperty(s().ProtectedValue.prototype,"length",{get(){return this.textLength}}),Object.defineProperty(s().ProtectedValue.prototype,"textLength",{get(){let e=0;return this.forEachChar((()=>{e++})),e}}),s().ProtectedValue.prototype.includesLower=function(e){return-1!==this.indexOfLower(e)},s().ProtectedValue.prototype.indexOfLower=function(e){let t=-1;const n=[],i=e.length;let s=-1;return this.forEachChar((r=>{if(s++,r=String.fromCharCode(r).toLowerCase(),-1===t){for(let o=0;o{if(i++,s=String.fromCharCode(s).toLowerCase(),0===i)return t=e.indexOf(s,t+1),void(n=-1!==t);n&&(n=e[t+i]===s)}))}while(!n&&t>=0);return t},window.PV=s().ProtectedValue,s().ProtectedValue.prototype.equals=function(e){if(!e)return!1;if(!e.isProtected)return this.textLength===e.length&&this.includes(e);if(e===this)return!0;const t=this.byteLength;if(t!==e.byteLength)return!1;for(let n=0;n{const n=r[e++];if("0"!==n&&t!==n)return!1})),!0}},3297:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Locale:()=>i});var i=n(6846)},2363:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Logger:()=>r});const i={Off:0,Error:1,Warn:2,Info:3,Debug:4,All:5},s=[],r=function(e,t,n=i.All){this.prefix=e?e+(t?":"+t:""):"default",this.level=n};r.prototype.ts=function(e){return e?Math.round(performance.now()-e)+"ms":performance.now()},r.prototype.getPrefix=function(){return(new Date).toISOString()+" ["+this.prefix+"] "},r.prototype.debug=function(...e){e[0]=this.getPrefix()+e[0],this.level>=i.Debug&&(r.saveLast("debug",e),console.log(...e))},r.prototype.info=function(...e){e[0]=this.getPrefix()+e[0],this.level>=i.Info&&(r.saveLast("info",e),console.info(...e))},r.prototype.warn=function(...e){e[0]=this.getPrefix()+e[0],this.level>=i.Warn&&(r.saveLast("warn",e),console.warn(...e))},r.prototype.error=function(...e){e[0]=this.getPrefix()+e[0],this.level>=i.Error&&(r.saveLast("error",e),console.error(...e))},r.prototype.setLevel=function(e){this.level=e},r.prototype.getLevel=function(){return this.level},r.saveLast=function(e,t){s.push({level:e,args:Array.prototype.slice.call(t)}),s.length>100&&s.shift()},r.getLast=function(){return s},r.Level=i},2547:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FileSaver:()=>s});var i=n(403);const s={saveAs(e,t){const n=document.createElement("a");n.download=t,n.rel="noopener",n.href=URL.createObjectURL(e),document.body.appendChild(n),n.click(),document.body.removeChild(n),setTimeout((()=>{URL.revokeObjectURL(n.href)}),i.Timeouts.LinkDownloadRevoke)}}},7609:(e,t,n)=>{"use strict";n.r(t),n.d(t,{InputFx:()=>i});const i={shake(e){e.addClass("input-shake"),setTimeout((()=>e.removeClass("input-shake")),1e3)}}},3710:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Tip:()=>a});var i=n(7201),s=n(667),r=n(6838),o=n(6718);const a=function(e,t){this.el=e,this.title=t&&t.title||e.attr("title"),this.placement=t&&t.placement||e.attr("tip-placement"),this.fast=t&&t.fast||!1,this.tipEl=null,this.showTimeout=null,this.hideTimeout=null,this.force=t&&t.force||!1,this.hide=this.hide.bind(this),this.destroy=this.destroy.bind(this),this.mouseenter=this.mouseenter.bind(this),this.mouseleave=this.mouseleave.bind(this)};a.enabled=!s.Features.isMobile,a.prototype.init=function(){a.enabled&&(this.el.removeAttr("title"),this.el.attr("data-title",this.title),this.el.mouseenter(this.mouseenter).mouseleave(this.mouseleave),this.el.click(this.mouseleave))},a.prototype.show=function(){if(!a.enabled&&!this.force||!this.title)return;i.Events.on("page-geometry",this.hide),this.tipEl&&(this.tipEl.remove(),this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null));const e=this.tipEl=o("").addClass("tip").appendTo("body").text(this.title),t=this.el[0].getBoundingClientRect(),n=this.tipEl[0].getBoundingClientRect(),s=this.placement||this.getAutoPlacement(t,n);let r,l;e.addClass("tip--"+s),this.fast&&e.addClass("tip--fast");switch(s){case"top":r=t.top-n.height-10,l=t.left+t.width/2-n.width/2;break;case"top-left":r=t.top-n.height-10,l=t.left+t.width/2-n.width+10;break;case"bottom":r=t.bottom+10,l=t.left+t.width/2-n.width/2;break;case"left":r=t.top+t.height/2-n.height/2,l=t.left-n.width-10;break;case"right":r=t.top+t.height/2-n.height/2,l=t.right+10}e.css({top:r,left:l})},a.prototype.hide=function(){this.tipEl&&(this.tipEl.remove(),this.tipEl=null,i.Events.off("page-geometry",this.hide))},a.prototype.destroy=function(){this.hide(),this.el.off("mouseenter",this.mouseenter),this.el.off("mouseleave",this.mouseleave),this.el.off("click",this.mouseleave),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)},a.prototype.mouseenter=function(){this.showTimeout||(this.showTimeout=setTimeout((()=>{this.showTimeout=null,this.show()}),200))},a.prototype.mouseleave=function(){this.tipEl&&(this.tipEl.addClass("tip--hide"),this.hideTimeout=setTimeout((()=>{this.hideTimeout=null,this.hide()}),500)),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null)},a.prototype.getAutoPlacement=function(e,t){const n=document.body.getBoundingClientRect(),i=n.bottom-e.bottom>20+t.height,s=n.right-e.right>20+t.width/2,r=n.right-e.right>20+t.width,o=e.left>20+t.width/2,a=e.left>20+t.width;return i?a&&!s?"left":r&&!o?"right":"bottom":a&&!s?"left":r&&!o?"right":"top"},a.createTips=function(e){a.enabled&&o("[title]",e).each(((e,t)=>{a.createTip(t)}))},a.createTip=function(e,t){if(!(a.enabled||t&&t.force))return;const n=new a(o(e),t);return t&&t.noInit||n.init(),e._tip=n,n},a.hideTips=function(e){a.enabled&&e&&o("[data-title]",e).each(((e,t)=>{a.hideTip(t)}))},a.hideTip=function(e){e._tip&&e._tip.hide()},a.updateTip=function(e,t){e._tip&&(e._tip.hide(),Object.assign(e._tip,(0,r.pick)(t,["title","placement","fast","showTimeout","hideTimeout"])))},a.destroyTips=function(e){o("[data-title]",e).each(((e,t)=>{t._tip&&(t._tip.destroy(),t._tip=void 0)}))}},2014:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AppView:()=>D});var i=n(7779),s=n(7201),r=n(5665),o=n(1164),a=n(9491),l=n(111),c=n(4530),u=n(2977),d=n(2706),h=n(667),p=n(3297),m=n(2363),f=n(8009),g=n(2766),A=n(1864),y=n(1434),v=n(5249),b=n(7953),w=n(5984),k=n(7622),C=n(7780),_=n(9676),E=n(6498),I=n(2791),S=n(4199),x=n(9993),B=n(97),T=n(4520),P=n.n(T);class D extends i.View{constructor(e){super(e),this.parent="body",this.template=P(),this.events={contextmenu:"contextMenu",drop:"drop",dragenter:"dragover",dragover:"dragover","click a[target=_blank]":"extLinkClick",mousedown:"bodyClick"},this.titlebarStyle="default",this.views.menu=new E.MenuView(this.model.menu,{ownParent:!0}),this.views.menuDrag=new A.DragView("x",{parent:".app__menu-drag"}),this.views.footer=new v.FooterView(this.model,{ownParent:!0}),this.views.listWrap=new _.ListWrapView(this.model,{ownParent:!0}),this.views.list=new C.ListView(this.model,{ownParent:!0}),this.views.listDrag=new A.DragView("x",{parent:".app__list-drag"}),this.views.list.dragView=this.views.listDrag,this.views.details=new g.DetailsView(void 0,{ownParent:!0}),this.views.details.appModel=this.model,this.views.menu.listenDrag(this.views.menuDrag),this.views.list.listenDrag(this.views.listDrag),this.titlebarStyle=this.model.settings.titlebarStyle,this.listenTo(this.model.settings,"change:theme",this.setTheme),this.listenTo(this.model.settings,"change:locale",this.setLocale),this.listenTo(this.model.settings,"change:fontSize",this.setFontSize),this.listenTo(this.model.settings,"change:autoSaveInterval",this.setupAutoSave),this.listenTo(this.model.files,"change",this.fileListUpdated),this.listenTo(s.Events,"select-all",this.selectAll),this.listenTo(s.Events,"menu-select",this.menuSelect),this.listenTo(s.Events,"lock-workspace",this.lockWorkspace),this.listenTo(s.Events,"show-file",this.showFileSettings),this.listenTo(s.Events,"open-file",this.toggleOpenFile),this.listenTo(s.Events,"save-all",this.saveAll),this.listenTo(s.Events,"remote-key-changed",this.remoteKeyChanged),this.listenTo(s.Events,"key-change-pending",this.keyChangePending),this.listenTo(s.Events,"toggle-settings",this.toggleSettings),this.listenTo(s.Events,"toggle-menu",this.toggleMenu),this.listenTo(s.Events,"toggle-details",this.toggleDetails),this.listenTo(s.Events,"edit-group",this.editGroup),this.listenTo(s.Events,"edit-tag",this.editTag),this.listenTo(s.Events,"edit-generator-presets",this.editGeneratorPresets),this.listenTo(s.Events,"launcher-open-file",this.launcherOpenFile),this.listenTo(s.Events,"user-idle",this.userIdle),this.listenTo(s.Events,"os-lock",this.osLocked),this.listenTo(s.Events,"power-monitor-suspend",this.osLocked),this.listenTo(s.Events,"app-minimized",this.appMinimized),this.listenTo(s.Events,"show-context-menu",this.showContextMenu),this.listenTo(s.Events,"second-instance",this.showSingleInstanceAlert),this.listenTo(s.Events,"enter-full-screen",this.enterFullScreen),this.listenTo(s.Events,"leave-full-screen",this.leaveFullScreen),this.listenTo(s.Events,"import-csv-requested",this.showImportCsv),this.listenTo(s.Events,"launcher-before-quit",this.launcherBeforeQuit),this.listenTo(d.UpdateModel,"change:updateReady",this.updateApp),window.onbeforeunload=this.beforeUnload.bind(this),window.onresize=this.windowResize.bind(this),window.onblur=this.windowBlur.bind(this),this.onKey(u.Keys.DOM_VK_ESCAPE,this.escPressed),this.onKey(u.Keys.DOM_VK_BACK_SPACE,this.backspacePressed),a.Launcher&&a.Launcher.devTools&&this.onKey(u.Keys.DOM_VK_I,this.openDevTools,o.KeyHandler.SHORTCUT_ACTION+o.KeyHandler.SHORTCUT_OPT,"*"),this.setWindowClass(),this.setupAutoSave()}setWindowClass(){const e=h.Features.getBrowserCssClass();e&&document.body.classList.add(e),"default"!==this.titlebarStyle&&document.body.classList.add("titlebar-"+this.titlebarStyle),h.Features.isMobile&&document.body.classList.add("mobile")}render(){super.render({beta:this.model.isBeta,titlebarStyle:this.titlebarStyle}),this.panelEl=this.$el.find(".app__panel:first"),this.views.listWrap.render(),this.views.menu.render(),this.views.menuDrag.render(),this.views.footer.render(),this.views.list.render(),this.views.listDrag.render(),this.views.details.render(),this.showLastOpenFile()}showOpenFile(){this.hideContextMenu(),this.views.menu.hide(),this.views.menuDrag.hide(),this.views.listWrap.hide(),this.views.list.hide(),this.views.listDrag.hide(),this.views.details.hide(),this.views.footer.toggle(this.model.files.hasOpenFiles()),this.hidePanelView(),this.hideSettings(),this.hideOpenFile(),this.hideKeyChange(),this.hideImportCsv(),this.views.open=new I.OpenView(this.model),this.views.open.render(),this.views.open.on("close",(()=>{this.showEntries()})),this.views.open.on("remove",(()=>{s.Events.emit("closed-open-view")}))}showLastOpenFile(){this.showOpenFile();const e=this.model.fileInfos[0];e&&(this.views.open.currentSelectedIndex=0,this.views.open.showOpenFileInfo(e))}launcherOpenFile(e){e&&e.data&&/\.kdbx$/i.test(e.data)&&(this.showOpenFile(),this.views.open.showOpenLocalFile(e.data,e.key))}updateApp(){"ready"!==d.UpdateModel.updateStatus||a.Launcher||this.model.files.hasOpenFiles()||window.location.reload()}showEntries(){this.views.menu.show(),this.views.menuDrag.show(),this.views.listWrap.show(),this.views.list.show(),this.views.listDrag.show(),this.views.details.show(),this.views.footer.show(),this.hidePanelView(),this.hideOpenFile(),this.hideSettings(),this.hideKeyChange(),this.hideImportCsv()}hideOpenFile(){this.views.open&&(this.views.open.remove(),this.views.open=null)}hidePanelView(){this.views.panel&&(this.views.panel.remove(),this.views.panel=null,this.panelEl.addClass("hide"))}showPanelView(e){this.views.listWrap.hide(),this.views.list.hide(),this.views.listDrag.hide(),this.views.details.hide(),this.hidePanelView(),e.render(),this.views.panel=e,this.panelEl.removeClass("hide")}hideSettings(){this.views.settings&&(this.model.menu.setMenu("app"),this.views.settings.remove(),this.views.settings=null)}hideKeyChange(){this.views.keyChange&&(this.views.keyChange.hide(),this.views.keyChange=null)}hideImportCsv(){this.views.importCsv&&(this.views.importCsv.remove(),this.views.importCsv=null)}showSettings(e){this.model.menu.setMenu("settings"),this.views.menu.show(),this.views.menuDrag.show(),this.views.listWrap.hide(),this.views.list.hide(),this.views.listDrag.hide(),this.views.details.hide(),this.hidePanelView(),this.hideOpenFile(),this.hideKeyChange(),this.hideImportCsv(),this.views.settings=new S.SettingsView(this.model),this.views.settings.render(),e||(e=this.model.menu.generalSection.items[0]),this.model.menu.select({item:e}),this.views.menu.switchVisibility(!1)}showEditGroup(e){this.showPanelView(new w.GrpView(e))}showEditTag(){this.showPanelView(new x.TagView(this.model))}showKeyChange(e,t){c.Alerts.alertDisplayed||this.views.keyChange&&this.views.keyChange.model.remote||(this.hideSettings(),this.hidePanelView(),this.views.menu.hide(),this.views.listWrap.hide(),this.views.list.hide(),this.views.listDrag.hide(),this.views.details.hide(),this.views.keyChange=new k.KeyChangeView({file:e,expired:t.expired,remote:t.remote}),this.views.keyChange.render(),this.views.keyChange.on("accept",this.keyChangeAccept.bind(this)),this.views.keyChange.on("cancel",this.showEntries.bind(this)))}fileListUpdated(){this.model.files.hasOpenFiles()?this.showEntries():(this.showOpenFile(),this.selectLastOpenFile())}showFileSettings(e){const t=this.model.menu.filesSection.items.find((t=>t.file.id===e.fileId));this.views.settings?this.views.settings.file===t.file?this.showEntries():this.model.menu.select({item:t}):this.showSettings(t)}toggleOpenFile(){this.views.open?this.model.files.hasOpenFiles()&&this.showEntries():this.showOpenFile()}launcherBeforeQuit(){const e={fromBeforeQuit:!0,preventDefault(){}};!1!==this.beforeUnload(e)&&a.Launcher.exit()}beforeUnload(e){const t={preventDefault(){this.prevented=!0}};if(s.Events.emit("main-window-will-close",t),t.prevented)return!!a.Launcher&&a.Launcher.preventExit(e);let n=this.model.settings.minimizeOnClose;if(e.fromBeforeQuit&&a.Launcher.quitOnRealQuitEventIfMinimizeOnQuitIsEnabled()&&(n=!1),this.model.files.hasDirtyFiles()){const t=()=>{n?a.Launcher.minimizeApp():a.Launcher.exit()};if(a.Launcher&&a.Launcher.exitRequested)return;if(a.Launcher){if(!this.exitAlertShown){if(this.model.settings.autoSave)return this.saveAndLock((e=>{e&&t()}),{appClosing:!0}),a.Launcher.preventExit(e);this.exitAlertShown=!0,c.Alerts.yesno({header:p.Locale.appUnsavedWarn,body:p.Locale.appUnsavedWarnBody,buttons:[{result:"save",title:p.Locale.saveChanges},{result:"exit",title:p.Locale.discardChanges,error:!0},{result:"",title:p.Locale.appDontExitBtn}],success:e=>{"save"===e?this.saveAndLock((e=>{e&&t()}),{appClosing:!0}):t()},cancel:()=>{a.Launcher.cancelRestart(!1)},complete:()=>{this.exitAlertShown=!1}})}return a.Launcher.preventExit(e)}return p.Locale.appUnsavedWarnBody}return a.Launcher&&!a.Launcher.exitRequested&&!a.Launcher.restartPending&&n?(a.Launcher.minimizeApp(),this.appMinimized(),a.Launcher.preventExit(e)):void 0}windowResize(){s.Events.emit("page-geometry",{source:"window"})}windowBlur(e){e.target===window&&s.Events.emit("page-blur")}enterFullScreen(){this.$el.addClass("fullscreen")}leaveFullScreen(){this.$el.removeClass("fullscreen")}escPressed(){this.views.open&&this.model.files.hasOpenFiles()&&this.showEntries()}backspacePressed(e){e.target===document.body&&e.preventDefault()}openDevTools(){a.Launcher&&a.Launcher.devTools&&a.Launcher.openDevTools()}selectAll(){this.menuSelect({item:this.model.menu.allItemsSection.items[0]})}menuSelect(e){this.model.menu.select(e),this.views.panel&&!this.views.panel.isHidden()&&this.showEntries()}userIdle(){this.lockWorkspace(!0)}osLocked(){this.model.settings.lockOnOsLock&&this.lockWorkspace(!0)}appMinimized(){this.model.settings.lockOnMinimize&&this.lockWorkspace(!0)}lockWorkspace(e){if(!c.Alerts.alertDisplayed)if(this.model.files.hasUnsavedFiles())if(this.model.settings.autoSave)this.saveAndLock();else{const t=e?p.Locale.appCannotLockAutoInit:p.Locale.appCannotLock;c.Alerts.alert({icon:"lock",header:"Lock",body:t,buttons:[{result:"save",title:p.Locale.saveChanges},{result:"discard",title:p.Locale.discardChanges,error:!0},{result:"",title:p.Locale.alertCancel}],checkbox:p.Locale.appAutoSave,success:(e,t)=>{"save"===e?(t&&(this.model.settings.autoSave=t),this.saveAndLock()):"discard"===e&&this.model.closeAllFiles()}})}else this.closeAllFilesAndShowFirst()}saveAndLock(e,t){let n=0;const i=[];function s(s,r){if(r&&i.push(s.name),0==--n)if(i.length&&this.model.files.hasDirtyFiles())if(c.Alerts.alertDisplayed)e&&e(!1);else{const n=[c.Alerts.buttons.ok];let s=(i.length>1?p.Locale.appSaveErrorBodyMul:p.Locale.appSaveErrorBody)+" "+i.join(", ")+".";null!=t&&t.appClosing&&(n.unshift({result:"ignore",title:p.Locale.appSaveErrorExitLoseChanges,error:!0}),s+="\n"+p.Locale.appSaveErrorExitLoseChangesBody),c.Alerts.error({header:p.Locale.appSaveError,body:s,buttons:n,complete:t=>{"ignore"===t?(this.model.closeAllFiles(),e(!0)):e(!1)}})}else this.closeAllFilesAndShowFirst(),e&&e(!0)}this.model.files.forEach((function(e){e.dirty&&(this.model.syncFile(e,null,s.bind(this,e)),n++)}),this),n||this.closeAllFilesAndShowFirst()}closeAllFilesAndShowFirst(){let e=this.model.files.find((e=>!e.demo&&!e.created&&!e.external));if(this.model.closeAllFiles(),e||(e=this.model.fileInfos[0]),e){const t=this.model.fileInfos.getMatch(e.storage,e.name,e.path);t&&this.views.open.showOpenFileInfo(t)}}selectLastOpenFile(){const e=this.model.fileInfos[0];e&&this.views.open.showOpenFileInfo(e)}saveAll(){this.model.files.forEach((function(e){this.model.syncFile(e)}),this)}setupAutoSave(){this.autoSaveTimer&&clearInterval(this.autoSaveTimer),this.model.settings.autoSaveInterval&&(this.autoSaveTimer=setInterval(this.saveAll.bind(this),1e3*this.model.settings.autoSaveInterval*60))}remoteKeyChanged(e){this.showKeyChange(e.file,{remote:!0})}keyChangePending(e){this.showKeyChange(e.file,{expired:!0})}keyChangeAccept(e){this.showEntries(),e.expired?(e.file.setPassword(e.password),e.keyFileData&&e.keyFileName?e.file.setKeyFile(e.keyFileData,e.keyFileName):e.file.removeKeyFile()):this.model.syncFile(e.file,{remoteKey:{password:e.password,keyFileName:e.keyFileName,keyFileData:e.keyFileData}})}toggleSettings(e){let t=e?this.model.menu[e+"Section"]:null;t&&(t=t.items[0]),this.views.settings?this.views.settings.page!==e&&t?t&&this.model.menu.select({item:t}):this.model.files.hasOpenFiles()?this.showEntries():(this.showLastOpenFile(),this.views.open.toggleMore()):(this.showSettings(),t&&this.model.menu.select({item:t}))}toggleMenu(){this.views.menu.switchVisibility()}toggleDetails(e){this.$el.toggleClass("app--details-visible",e),this.views.menu.switchVisibility(!1)}editGroup(e){!e||this.views.panel instanceof w.GrpView?this.showEntries():this.showEditGroup(e)}editTag(e){!e||this.views.panel instanceof x.TagView?this.showEntries():(this.showEditTag(),this.views.panel.showTag(e))}editGeneratorPresets(){this.views.panel instanceof b.GeneratorPresetsView?this.showEntries():(this.views.settings&&this.showEntries(),this.showPanelView(new b.GeneratorPresetsView(this.model)))}isContextMenuAllowed(e){return["input","textarea"].indexOf(e.target.tagName.toLowerCase())<0}contextMenu(e){this.isContextMenuAllowed(e)&&e.preventDefault()}showContextMenu(e){if(e.options&&this.isContextMenuAllowed(e)){e.stopImmediatePropagation(),e.preventDefault(),this.views.contextMenu&&this.views.contextMenu.remove();const t=new y.DropdownView(e);t.render({position:{left:e.pageX,top:e.pageY},options:e.options}),t.on("cancel",(e=>this.hideContextMenu())),t.on("select",(e=>this.contextMenuSelect(e))),this.views.contextMenu=t}}hideContextMenu(){this.views.contextMenu&&(this.views.contextMenu.remove(),delete this.views.contextMenu)}contextMenuSelect(e){this.hideContextMenu(),s.Events.emit("context-menu-select",e)}showSingleInstanceAlert(){this.hideOpenFile(),c.Alerts.error({header:p.Locale.appTabWarn,body:p.Locale.appTabWarnBody,esc:!1,enter:!1,click:!1,buttons:[]})}dragover(e){e.preventDefault(),e.dataTransfer.dropEffect="none"}drop(e){e.preventDefault()}setTheme(){l.SettingsManager.setTheme(this.model.settings.theme)}setFontSize(){l.SettingsManager.setFontSize(this.model.settings.fontSize)}setLocale(){l.SettingsManager.setLocale(this.model.settings.locale),this.views.settings.isVisible()&&(this.hideSettings(),this.showSettings()),this.$el.find(".app__beta:first").text(p.Locale.appBeta)}extLinkClick(e){a.Launcher&&(e.preventDefault(),a.Launcher.openLink(e.target.href))}bodyClick(e){r.IdleTracker.regUserAction(),s.Events.emit("click",e)}showImportCsv(e){const t=new FileReader,n=new m.Logger("import-csv");n.info("Reading CSV..."),t.onload=t=>{n.info("Parsing CSV...");const i=n.ts(),s=new f.CsvParser;let r;try{r=s.parse(t.target.result)}catch(t){return n.error("Error parsing CSV",t),void c.Alerts.error({header:p.Locale.openFailedRead,body:t.toString()})}n.info(`Parsed CSV: ${r.rows.length} records, ${n.ts(i)}`),this.hideSettings(),this.hidePanelView(),this.hideOpenFile(),this.hideKeyChange(),this.views.menu.hide(),this.views.listWrap.hide(),this.views.list.hide(),this.views.listDrag.hide(),this.views.details.hide(),this.views.importCsv=new B.ImportCsvView(r,{appModel:this.model,fileName:e.name}),this.views.importCsv.render(),this.views.importCsv.on("cancel",(()=>{this.model.files.hasOpenFiles()?this.showEntries():this.showOpenFile()})),this.views.importCsv.on("done",(()=>{this.model.refresh(),this.showEntries()}))},t.onerror=()=>{c.Alerts.error({header:p.Locale.openFailedRead})},t.readAsText(e)}}},2385:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AutoTypeHintView:()=>u});var i=n(7779),s=n(9673),r=n(403),o=n(667),a=n(9337),l=n.n(a),c=n(6718);class u extends i.View{constructor(e){super(e),this.parent="body",this.template=l(),this.events={},this.input=e.input,this.bodyClick=this.bodyClick.bind(this),this.inputBlur=this.inputBlur.bind(this),c("body").on("click",this.bodyClick),this.input.addEventListener("blur",this.inputBlur),this.once("remove",(()=>{c("body").off("click",this.bodyClick),this.input.removeEventListener("blur",this.inputBlur)}))}render(){super.render({cmd:o.Features.isMac?"command":"ctrl",hasCtrl:o.Features.isMac,link:s.Links.AutoType});const e=this.input.getBoundingClientRect();this.$el.appendTo(document.body).css({left:e.left,top:e.bottom+1,width:e.width});const t=this.$el[0].getBoundingClientRect(),n=document.body.getBoundingClientRect();t.bottom>n.bottom&&this.$el.css("height",t.height+n.bottom-t.bottom-1)}bodyClick(e){if(this.removeTimer&&(clearTimeout(this.removeTimer),this.removeTimer=null),e.target!==this.input)if(c.contains(this.$el[0],e.target)||e.target===this.$el[0]){if(e.stopPropagation(),"a"===e.target.tagName.toLowerCase()&&!e.target.href){let t=c(e.target).text();"{"!==t[0]&&(t=t.split(" ")[0]),this.insertText(t)}this.input.focus()}else this.remove();else e.stopPropagation()}inputBlur(){this.removeTimer||(this.removeTimer=setTimeout(this.remove.bind(this),r.Timeouts.DropDownClickWait))}insertText(e){const t=this.input.selectionEnd||this.input.value.length;this.input.value=this.input.value.substr(0,t)+e+this.input.value.substr(t),this.input.selectionStart=this.input.selectionEnd=t+e.length,this.input.dispatchEvent(new Event("input",{bubbles:!0}))}}},3752:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AutoTypeSelectView:()=>v});var i=n(7779),s=n(7201),r=n(7027),o=n(1164),a=n(2977),l=n(7614),c=n(9938),u=n(2378),d=n(3297),h=n(7015),p=n(1434),m=n(7433),f=n.n(m),g=n(9873),A=n.n(g),y=n(6718);class v extends i.View{constructor(e){super(e),this.parent="body",this.modal="auto-type",this.template=f(),this.itemTemplate=A(),this.events={"click .at-select__header-filter-clear":"clearFilterText","click .at-select__item":"itemClicked","contextmenu .at-select__item":"itemRightClicked"},this.result=null,this.entries=null,this.initScroll(),this.listenTo(s.Events,"main-window-will-close",this.mainWindowWillClose),this.listenTo(s.Events,"keypress:auto-type",this.keyPressed),this.setupKeys()}setupKeys(){this.onKey(a.Keys.DOM_VK_ESCAPE,this.escPressed,!1,"auto-type"),this.onKey(a.Keys.DOM_VK_RETURN,this.enterPressed,!1,"auto-type"),this.onKey(a.Keys.DOM_VK_RETURN,this.actionEnterPressed,o.KeyHandler.SHORTCUT_ACTION,"auto-type"),this.onKey(a.Keys.DOM_VK_RETURN,this.optEnterPressed,o.KeyHandler.SHORTCUT_OPT,"auto-type"),this.onKey(a.Keys.DOM_VK_RETURN,this.shiftEnterPressed,o.KeyHandler.SHORTCUT_SHIFT,"auto-type"),this.onKey(a.Keys.DOM_VK_UP,this.upPressed,!1,"auto-type"),this.onKey(a.Keys.DOM_VK_DOWN,this.downPressed,!1,"auto-type"),this.onKey(a.Keys.DOM_VK_BACK_SPACE,this.backSpacePressed,!1,"auto-type"),this.onKey(a.Keys.DOM_VK_O,this.openKeyPressed,o.KeyHandler.SHORTCUT_ACTION,"auto-type")}render(){let e;e=this.model.filter.title||this.model.filter.url?d.Locale.autoTypeMsgMatchedByWindow.replace("{}",this.model.filter.title||this.model.filter.url):d.Locale.autoTypeMsgNoWindow;const t=l.AppSettingsModel.colorfulIcons?"":"grayscale";this.entries=this.model.filter.getEntries(),this.result=this.entries[0];const n=new c.EntryPresenter(null,t,this.result&&this.result.id);let s="";const o=this.itemTemplate;this.entries.forEach((e=>{n.present(e),s+=o(n,i.DefaultTemplateOptions)})),super.render({filterText:this.model.filter.text,topMessage:e,itemsHtml:s,actionSymbol:r.Shortcuts.actionShortcutSymbol(!0),altSymbol:r.Shortcuts.altShortcutSymbol(!0),shiftSymbol:r.Shortcuts.shiftShortcutSymbol(!0),keyEnter:d.Locale.keyEnter}),document.activeElement.blur(),this.createScroll({root:this.$el.find(".at-select__items")[0],scroller:this.$el.find(".scroller")[0],bar:this.$el.find(".scroller__bar")[0]})}cancelAndClose(){this.result=null,this.emit("result",this.result)}closeWithResult(e){this.emit("result",{entry:this.result,sequence:e})}escPressed(){this.model.filter.text?this.clearFilterText():this.cancelAndClose()}enterPressed(){this.closeWithResult()}actionEnterPressed(){this.closeWithResult("{PASSWORD}")}optEnterPressed(){this.closeWithResult("{USERNAME}")}openKeyPressed(){this.emit("show-open-files")}shiftEnterPressed(e){const t=this.$el.find('.at-select__item[data-id="'+this.result.id+'"]');this.showItemOptions(t,e)}upPressed(e){e.preventDefault();const t=this.entries.indexOf(this.result)-1;t>=0&&(this.result=this.entries[t],this.highlightActive())}downPressed(e){e.preventDefault();const t=this.entries.indexOf(this.result)+1;tn.bottom&&(this.scroller[0].scrollTop+=t.bottom-n.bottom)}keyPressed(e){e.which&&e.which!==a.Keys.DOM_VK_RETURN&&(this.model.filter.text+=String.fromCharCode(e.which),this.render())}backSpacePressed(){this.model.filter.text&&(this.model.filter.text=this.model.filter.text.substr(0,this.model.filter.text.length-1),this.render())}clearFilterText(){this.model.filter.text="",this.render()}itemClicked(e){const t=y(e.target).closest(".at-select__item");if(y(e.target).closest(".at-select__item-options").length)this.showItemOptions(t,e);else{const e=t.data("id");this.result=this.entries.get(e),this.closeWithResult()}}itemRightClicked(e){const t=y(e.target).closest(".at-select__item");this.showItemOptions(t,e)}mainWindowWillClose(e){e.preventDefault()}showItemOptions(e,t){t&&t.stopImmediatePropagation();const n=e.data("id"),i=this.entries.get(n);if(this.views.optionsDropdown&&(this.hideItemOptionsDropdown(),this.result&&this.result.id===i.id))return;this.result=i,e.hasClass("at-select__item--active")||this.highlightActive();const s=new p.DropdownView;this.listenTo(s,"cancel",this.hideItemOptionsDropdown),this.listenTo(s,"select",this.itemOptionsDropdownSelect);const r=[];i.fields.otp&&r.push({value:"{TOTP}",icon:"clock",text:d.Locale.autoTypeSelectionOtp}),i.user&&r.push({value:"{USERNAME}",icon:"user",text:u.StringFormat.capFirst(d.Locale.user)}),i.password&&r.push({value:"{PASSWORD}",icon:"key",text:u.StringFormat.capFirst(d.Locale.password)});for(const e of Object.keys(i.fields))"otp"!==e&&r.push({value:`{S:${e}}`,icon:"th-list",text:e});let o;if(t&&2===t.button)o={top:t.pageY,left:t.pageX};else{const t=e[0].getBoundingClientRect();o={top:t.bottom,right:t.right}}s.render({position:o,options:r}),this.views.optionsDropdown=s}hideItemOptionsDropdown(){this.views.optionsDropdown&&(this.views.optionsDropdown.remove(),delete this.views.optionsDropdown)}itemOptionsDropdownSelect(e){this.hideItemOptionsDropdown();const t=e.item;this.closeWithResult(t)}}Object.assign(v.prototype,h.Scrollable)},3122:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DetailsAddFieldView:()=>o});var i=n(7779),s=n(486),r=n.n(s);class o extends i.View{constructor(...e){super(...e),this.parent=".details__body-fields",this.template=r(),this.events={"click .details__field-label":"fieldLabelClick","click .details__field-value":"fieldValueClick"}}render(){super.render(),this.labelEl=this.$el.find(".details__field-label")}fieldLabelClick(){this.emit("more-click")}fieldValueClick(){this.emit("add-field")}}},2550:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DetailsAttachmentView:()=>c});var i=n(7779),s=n(7027),r=n(667),o=n(2069),a=n.n(o),l=n(6718);class c extends i.View{constructor(...e){super(...e),this.template=a(),this.events={"click .details__subview-close":"closeAttachment","click .details__attachment-preview-download-btn":"downloadAttachment"}}render(e){super.render({isMobile:r.Features.isMobile});this.$el.find(".details__attachment-preview-download-text-shortcut").text(s.Shortcuts.actionShortcutSymbol());const t=new Blob([this.model.getBinary()],{type:this.model.mimeType}),n=this.$el.find(".details__attachment-preview-data");switch((this.model.mimeType||"").split("/")[0]){case"text":{const i=new FileReader;return i.addEventListener("loadend",(()=>{l("").text(i.result).appendTo(n),e()})),void i.readAsText(t)}case"image":return l("
").attr("src",URL.createObjectURL(t)).appendTo(n),void e()}this.$el.addClass("details__attachment-preview--empty"),this.$el.find(".details__attachment-preview-icon").addClass("fa-"+this.model.icon),e()}downloadAttachment(){this.emit("download")}closeAttachment(){this.emit("close")}}},4184:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DetailsAutoTypeView:()=>d});var i=n(7779),s=n(3898),r=n(7027),o=n(3297),a=n(2385),l=n(2219),c=n.n(l),u=n(6718);class d extends i.View{constructor(...e){super(...e),this.parent=".details__body-after",this.template=c(),this.events={"focus #details__auto-type-sequence":"seqFocus","input #details__auto-type-sequence":"seqInput","keypress #details__auto-type-sequence":"seqKeyPress","keydown #details__auto-type-sequence":"seqKeyDown","change #details__auto-type-enabled":"enabledChange","change #details__auto-type-obfuscation":"obfuscationChange"}}render(){const e=o.Locale.detAutoTypeShortcutsDesc.replace("{}",r.Shortcuts.actionShortcutSymbol()+"T").replace("{}",r.Shortcuts.globalShortcutText("autoType"));super.render({enabled:this.model.getEffectiveEnableAutoType(),obfuscation:this.model.autoTypeObfuscation,sequence:this.model.autoTypeSequence,windows:this.model.autoTypeWindows,defaultSequence:this.model.group.getEffectiveAutoTypeSeq(),detAutoTypeShortcutsDesc:e})}seqInput(e){const t=e.target,n=t.value.trim();s.AutoType.validate(this.model,n,(e=>{u(t).toggleClass("input--error",!!e),e||this.model.setAutoTypeSeq(n)}))}seqKeyPress(e){e.stopPropagation()}seqKeyDown(e){e.stopPropagation()}seqFocus(e){this.views.hint||(this.views.hint=new a.AutoTypeHintView({input:e.target}),this.views.hint.render(),this.views.hint.on("remove",(()=>{delete this.views.hint})))}enabledChange(e){this.model.setEnableAutoType(e.target.checked)}obfuscationChange(e){this.model.setAutoTypeObfuscation(e.target.checked)}}},9042:(e,t,n)=>{"use strict";n.r(t),n.d(t,{createDetailsFields:()=>y});var i=n(3297),s=n(2378),r=n(6098),o=n(2985),a=n(9260),l=n(8877),c=n(2836),u=n(2969),d=n(1297),h=n(1960),p=n(3033),m=n(2574),f=n(8108),g=n(4169),A=n(4984);function y(e){const t=e.model,n=e.matchingOtpEntry,y=[],v=[];if(t.external)v.push(new a.FieldViewReadOnly({name:"Device",title:s.StringFormat.capFirst(i.Locale.device),value:()=>t.device.name})),y.push(new A.FieldViewReadOnlyWithOptions({name:"$UserName",title:s.StringFormat.capFirst(i.Locale.user),aside:!1,value:()=>t.user,sequence:"{USERNAME}"})),y.push(new l.FieldViewOtp({name:"$otp",title:i.Locale.detOtpField,value:()=>t.otpGenerator,sequence:"{TOTP}",readonly:!0,needsTouch:t.needsTouch,deviceShortName:t.device.shortName}));else{const A=o.AppModel.instance.files.filter((e=>e.active&&!e.readOnly));if(t.isJustCreated&&A.length>1){const e=A.map((e=>({id:e.id,value:e.name,selected:e===t.file})));y.push(new c.FieldViewSelect({name:"$File",title:s.StringFormat.capFirst(i.Locale.file),value:()=>e}))}else v.push(new a.FieldViewReadOnly({name:"File",title:s.StringFormat.capFirst(i.Locale.file),value:()=>t.fileName}));y.push(new u.FieldViewAutocomplete({name:"$UserName",title:s.StringFormat.capFirst(i.Locale.user),value:()=>t.user,getCompletions:e.getUserNameCompletions.bind(e),sequence:"{USERNAME}"})),y.push(new d.FieldViewText({name:"$Password",title:s.StringFormat.capFirst(i.Locale.password),canGen:!0,value:()=>t.password,sequence:"{PASSWORD}"})),y.push(new h.FieldViewUrl({name:"$URL",title:s.StringFormat.capFirst(i.Locale.website),value:()=>t.url,sequence:"{URL}"})),y.push(new d.FieldViewText({name:"$Notes",title:s.StringFormat.capFirst(i.Locale.notes),multiline:"true",markdown:!0,value:()=>t.notes,sequence:"{NOTES}"})),y.push(new p.FieldViewTags({name:"Tags",title:s.StringFormat.capFirst(i.Locale.tags),tags:o.AppModel.instance.tags,value:()=>t.tags})),y.push(new m.FieldViewDate({name:"Expires",title:i.Locale.detExpires,lessThanNow:"("+i.Locale.detExpired+")",value:()=>t.expires})),v.push(new a.FieldViewReadOnly({name:"Group",title:i.Locale.detGroup,value:()=>t.groupName,tip:()=>t.getGroupPath().join(" / ")})),v.push(new a.FieldViewReadOnly({name:"Created",title:i.Locale.detCreated,value:()=>r.DateFormat.dtStr(t.created)})),v.push(new a.FieldViewReadOnly({name:"Updated",title:i.Locale.detUpdated,value:()=>r.DateFormat.dtStr(t.updated)})),v.push(new f.FieldViewHistory({name:"History",title:s.StringFormat.capFirst(i.Locale.history),value:()=>({length:t.historyLength,unsaved:t.unsaved})})),n&&y.push(new l.FieldViewOtp({name:"$otp",title:i.Locale.detOtpField,value:()=>n.otpGenerator,sequence:"{TOTP}",readonly:!0,needsTouch:n.needsTouch,deviceShortName:n.device.shortName}));for(const e of Object.keys(t.fields))"otp"===e&&t.otpGenerator?n||y.push(new l.FieldViewOtp({name:"$"+e,title:e,value:()=>t.otpGenerator,sequence:"{TOTP}"})):y.push(new g.FieldViewCustom({name:"$"+e,title:e,multiline:!0,value:()=>t.fields[e],sequence:`{S:${e}}`}))}return{fieldViews:y,fieldViewsAside:v}}},264:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DetailsHistoryView:()=>g});var i=n(7779),s=n(4530),r=n(2977),o=n(6098),a=n(2378),l=n(3297),c=n(4796),u=n(9260),d=n(2402),h=n(6838),p=n(4226),m=n.n(p),f=n(6718);class g extends i.View{constructor(e,t){super(e,t),this.template=m(),this.events={"click .details__subview-close":"closeHistory","click .details__history-timeline-item":"timelineItemClick","click .details__history-arrow-prev":"timelinePrevClick","click .details__history-arrow-next":"timelineNextClick","click .details__history-button-revert":"revertClick","click .details__history-button-delete":"deleteClick","click .details__history-button-discard":"discardClick"},this.formats=[{name:"ms",round:1,format:e=>o.DateFormat.dtStr(e)},{name:"sec",round:1e3,format:e=>o.DateFormat.dtStr(e)},{name:"min",round:6e4,format:e=>o.DateFormat.dtStr(e).replace(":00 "," ")},{name:"hour",round:36e5,format:e=>o.DateFormat.dtStr(e).replace(":00","")},{name:"day",round:864e5,format:e=>o.DateFormat.dStr(e)},{name:"month",round:26784e5,format:e=>o.DateFormat.dStr(e)},{name:"year",round:31536e6,format:e=>e.getFullYear()}],this.fieldViews=[],this.visibleRecord=void 0,this.onKey(r.Keys.DOM_VK_ESCAPE,this.closeHistory),this.once("remove",(()=>{this.removeFieldViews()}))}render(){super.render(),this.history=this.model.getHistory(),this.buildTimeline(),this.timelineEl=this.$el.find(".details__history-timeline"),this.bodyEl=this.$el.find(".details__history-body"),this.timeline.forEach((function(e,t){f("").addClass("fa fa-circle details__history-timeline-item").css("left",100*e.pos+"%").attr("data-id",t).appendTo(this.timelineEl)}),this),this.labels.forEach((function(e){f("").addClass("details__history-timeline-label").css("left",100*e.pos+"%").text(e.text).appendTo(this.timelineEl)}),this);let e=this.visibleRecord;void 0===e&&(e=this.history.length-1),this.showRecord(e)}removeFieldViews(){this.fieldViews.forEach((e=>e.remove())),this.fieldViews=[]}showRecord(e){this.activeIx=e,this.record=this.timeline[e].rec,this.timelineEl.find(".details__history-timeline-item").removeClass("details__history-timeline-item--active"),this.timelineEl.find('.details__history-timeline-item[data-id="'+e+'"]').addClass("details__history-timeline-item--active"),this.removeFieldViews(),this.bodyEl.empty();const t=this.record.color?this.record.color+"-color":"";this.fieldViews.push(new u.FieldViewReadOnly({name:"Rev",title:l.Locale.detHistoryVersion,value:e+1})),this.fieldViews.push(new u.FieldViewReadOnly({name:"Updated",title:l.Locale.detHistorySaved,value:o.DateFormat.dtStr(this.record.updated)+(this.record.unsaved?" ("+l.Locale.detHistoryCurUnsavedState+")":"")+(e!==this.history.length-1||this.record.unsaved?"":" ("+l.Locale.detHistoryCurState+")")})),this.fieldViews.push(new d.FieldViewReadOnlyRaw({name:"$Title",title:a.StringFormat.capFirst(l.Locale.title),value:' '+(0,h.escape)(this.record.title)||0})),this.fieldViews.push(new u.FieldViewReadOnly({name:"$UserName",title:a.StringFormat.capFirst(l.Locale.user),value:this.record.user})),this.fieldViews.push(new u.FieldViewReadOnly({name:"$Password",title:a.StringFormat.capFirst(l.Locale.password),value:this.record.password})),this.fieldViews.push(new u.FieldViewReadOnly({name:"$URL",title:a.StringFormat.capFirst(l.Locale.website),value:this.record.url})),this.fieldViews.push(new u.FieldViewReadOnly({name:"$Notes",title:a.StringFormat.capFirst(l.Locale.notes),value:this.record.notes})),this.fieldViews.push(new u.FieldViewReadOnly({name:"Tags",title:a.StringFormat.capFirst(l.Locale.tags),value:this.record.tags.join(", ")})),this.fieldViews.push(new u.FieldViewReadOnly({name:"Expires",title:l.Locale.detExpires,value:this.record.expires?o.DateFormat.dtStr(this.record.expires):""}));for(const[e,t]of Object.entries(this.record.fields))this.fieldViews.push(new u.FieldViewReadOnly({name:"$"+e,title:e,value:t}));this.record.attachments.length&&this.fieldViews.push(new u.FieldViewReadOnly({name:"Attachments",title:l.Locale.detAttachments,value:this.record.attachments.map((e=>e.title)).join(", ")})),this.fieldViews.forEach((e=>{e.parent=this.bodyEl[0],e.render(),e.on("copy",this.fieldCopied.bind(this))}));const n=this.$el.find(".details__history-buttons");n.find(".details__history-button-revert").toggle(e1||!1)}timelineItemClick(e){const t=f(e.target).closest(".details__history-timeline-item").data("id");this.showRecord(t)}timelinePrevClick(){this.activeIx>0&&this.showRecord(this.activeIx-1)}timelineNextClick(){this.activeIx({pos:(n.updated-e.updated)/(t.updated-e.updated),rec:n})));const n=t.updated-e.updated,i=this.getDateFormat(n);this.labels=this.getLabels(e.updated.getTime(),t.updated.getTime(),i.round).map((n=>({pos:(n-e.updated)/(t.updated-e.updated),val:n,text:i.format(new Date(n))})))}getDateFormat(e){for(let t=0;t0?t-1:0];return this.formats[this.formats.length-1]}getLabels(e,t,n){const i=Math.floor((t-e)/n);i>2&&(n*=Math.ceil(i/2));const s=[];let r=Math.ceil(e/n)*n;for(;r1&&(s[0]-e)/(t-e)<.1&&s.shift(),s}closeHistory(e){this.emit("close",{updated:e})}revertClick(){s.Alerts.yesno({header:l.Locale.detHistoryRevertAlert,body:l.Locale.detHistoryRevertAlertBody,success:()=>{this.model.revertToHistoryState(this.record.entry),this.closeHistory(!0)}})}deleteClick(){s.Alerts.yesno({header:l.Locale.detHistoryDeleteAlert,body:l.Locale.detHistoryDeleteAlertBody,success:()=>{this.model.deleteHistory(this.record.entry),this.visibleRecord=this.activeIx,this.render()}})}discardClick(){s.Alerts.yesno({header:l.Locale.detHistoryDiscardChangesAlert,body:l.Locale.detHistoryDiscardChangesAlertBody,success:()=>{this.model.discardUnsaved(),this.closeHistory(!0)}})}}Object.assign(g.prototype,c.Copyable)},2766:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DetailsView:()=>R});var i=n(3617),s=n.n(i),r=n(7779),o=n(7201),a=n(3898),l=n(5933),c=n(1164),u=n(6655),d=n(4530),h=n(2977),p=n(403),m=n(7614),f=n(5572),g=n(667),A=n(3297),y=n(2547),v=n(3710),b=n(4796),w=n(7015),k=n(3122),C=n(2550),_=n(4184),E=n(264),I=n(1434),S=n(9042),x=n(4169),B=n(3872),T=n(6838),P=n(7014),D=n.n(P),F=n(5041),O=n.n(F),M=n(2322),L=n.n(M),Q=n(6718);class R extends r.View{constructor(e,t){super(e,t),this.parent=".app__details",this.fieldViews=[],this.fieldCopyTip=null,this.events={"click .details__colors-popup-item":"selectColor","click .details__header-icon":"toggleIcons","click .details__attachment":"toggleAttachment","click .details__header-title":"editTitle","click .details__history-link":"showHistory","click .details__buttons-trash":"moveToTrash","click .details__buttons-trash-del":"deleteFromTrash","click .details__back-button":"backClick","click .details__attachment-add":"attachmentBtnClick","change .details__attachment-input-file":"attachmentFileChange","dragover .details":"dragover","dragleave .details":"dragleave","drop .details":"drop","contextmenu .details":"contextMenu"},this.initScroll(),this.listenTo(o.Events,"entry-selected",this.showEntry),this.listenTo(o.Events,"copy-password",this.copyPassword),this.listenTo(o.Events,"copy-user",this.copyUserName),this.listenTo(o.Events,"copy-url",this.copyUrl),this.listenTo(o.Events,"copy-otp",this.copyOtp),this.listenTo(o.Events,"toggle-settings",this.settingsToggled),this.listenTo(o.Events,"context-menu-select",this.contextMenuSelect),this.listenTo(o.Events,"set-locale",this.render),this.listenTo(o.Events,"qr-read",this.otpCodeRead),this.listenTo(o.Events,"qr-enter-manually",this.otpEnterManually),this.onKey(h.Keys.DOM_VK_C,this.copyPasswordFromShortcut,c.KeyHandler.SHORTCUT_ACTION,!1,!0),this.onKey(h.Keys.DOM_VK_B,this.copyUserName,c.KeyHandler.SHORTCUT_ACTION),this.onKey(h.Keys.DOM_VK_U,this.copyUrl,c.KeyHandler.SHORTCUT_ACTION),this.onKey(h.Keys.DOM_VK_2,this.copyOtp,c.KeyHandler.SHORTCUT_OPT),a.AutoType.enabled&&this.onKey(h.Keys.DOM_VK_T,(()=>this.autoType()),c.KeyHandler.SHORTCUT_ACTION),this.onKey(h.Keys.DOM_VK_DELETE,this.deleteKeyPress,c.KeyHandler.SHORTCUT_ACTION,!1,!0),this.onKey(h.Keys.DOM_VK_BACK_SPACE,this.deleteKeyPress,c.KeyHandler.SHORTCUT_ACTION,!1,!0),this.once("remove",(()=>{this.removeFieldViews()}))}removeFieldViews(){this.fieldViews.forEach((e=>e.remove())),this.fieldViews=[],this.hideFieldCopyTip()}render(){if(v.Tip.destroyTips(this.$el),this.removeScroll(),this.removeFieldViews(),this.removeInnerViews(),!this.model)return this.template=O(),void super.render();if(this.model instanceof f.GroupModel)return this.template=L(),void super.render();const e=Object.assign({deleted:this.appModel.filter.trash},this.model);this.template=D(),super.render(e),this.setSelectedColor(this.model.color),this.addFieldViews(),this.createScroll({root:this.$el.find(".details__body")[0],scroller:this.$el.find(".scroller")[0],bar:this.$el.find(".scroller__bar")[0]}),this.$el.find(".details").removeClass("details--drag"),this.dragging=!1,this.dragTimeout&&clearTimeout(this.dragTimeout),this.pageResized(),this.showCopyTip()}getFieldView(e){return this.fieldViews.find((t=>t.model.name===e))}addFieldViews(){const{fieldViews:e,fieldViewsAside:t}=(0,S.createDetailsFields)(this),n=m.AppSettingsModel.hideEmptyFields,i=this.$el.find(".details__body-fields"),s=this.$el.find(".details__body-aside");for(const r of[e,t])for(const t of r)if(t.parent=r===e?i[0]:s[0],t.render(),t.on("change",this.fieldChanged.bind(this)),t.on("copy",this.fieldCopied.bind(this)),t.on("autotype",(e=>this.autoType(e.source.model.sequence))),n){const e=t.model.value();if(!e||0===e.length||0===e.byteLength){if(this.model.isJustCreated){if(!["$URL","$Notes","Tags","Expires","History"].includes(t.model.name))continue}t.hide()}}this.fieldViews=e.concat(t),this.model.external||(this.moreView=new k.DetailsAddFieldView,this.moreView.render(),this.moreView.on("add-field",this.addNewField.bind(this)),this.moreView.on("more-click",this.toggleMoreOptions.bind(this)))}addNewField(){this.moreView.remove(),this.moreView=null;let e=A.Locale.detNetField;if(this.model.fields[e])for(let t=1;;t++){const n=e+t;if(!this.model.fields[n]){e=n;break}}const t=new x.FieldViewCustom({name:"$"+e,title:e,newField:e,multiline:!0,value:()=>""},{parent:this.$el.find(".details__body-fields")[0]});t.on("change",this.fieldChanged.bind(this)),t.render(),t.edit(),this.fieldViews.push(t)}toggleMoreOptions(){this.views.dropdownView?(this.views.dropdownView.remove(),this.views.dropdownView=null):setTimeout((()=>{const e=new I.DropdownView;this.listenTo(e,"cancel",this.toggleMoreOptions),this.listenTo(e,"select",this.moreOptionsSelect);const t=m.AppSettingsModel.hideEmptyFields,n=[];t?(this.fieldViews.forEach((e=>{e.isHidden()&&n.push({value:"add:"+e.model.name,icon:"pencil-alt",text:A.Locale.detMenuAddField.replace("{}",e.model.title)})}),this),n.push({value:"add-new",icon:"plus",text:A.Locale.detMenuAddNewField}),n.push({value:"toggle-empty",icon:"eye",text:A.Locale.detMenuShowEmpty})):(n.push({value:"add-new",icon:"plus",text:A.Locale.detMenuAddNewField}),n.push({value:"toggle-empty",icon:"eye-slash",text:A.Locale.detMenuHideEmpty})),n.push({value:"otp",icon:"clock",text:A.Locale.detSetupOtp}),a.AutoType.enabled&&n.push({value:"auto-type",icon:"keyboard",text:A.Locale.detAutoTypeSettings}),n.push({value:"clone",icon:"clone",text:A.Locale.detClone}),n.push({value:"copy-to-clipboard",icon:"copy",text:A.Locale.detCopyEntryToClipboard});const i=this.moreView.labelEl[0].getBoundingClientRect();e.render({position:{top:i.bottom,left:i.left},options:n}),this.views.dropdownView=e}))}moreOptionsSelect(e){switch(this.views.dropdownView.remove(),this.views.dropdownView=null,e.item){case"add-new":this.addNewField();break;case"toggle-empty":{const e=m.AppSettingsModel.hideEmptyFields;m.AppSettingsModel.hideEmptyFields=!e,this.render();break}case"otp":this.setupOtp();break;case"auto-type":this.toggleAutoType();break;case"clone":this.clone();break;case"copy-to-clipboard":this.copyToClipboard();break;default:if(0===e.item.lastIndexOf("add:",0)){const t=e.item.substr(4),n=this.fieldViews.find((e=>e.model.name===t));n.show(),n.edit()}}}getUserNameCompletions(e){return this.appModel.completeUserNames(e)}setSelectedColor(e){this.$el.find(".details__colors-popup > .details__colors-popup-item").removeClass("details__colors-popup-item--active");const t=this.$el.find(".details__header-color")[0];for(const e of t.classList)e.indexOf("color")>0&&0!==e.lastIndexOf("details",0)&&t.classList.remove(e);e&&(this.$el.find(".details__colors-popup > ."+e+"-color").addClass("details__colors-popup-item--active"),t.classList.add(e+"-color"))}selectColor(e){let t=Q(e.target).closest(".details__colors-popup-item").data("color");t&&(t===this.model.color&&(t=null),this.model.setColor(t),this.entryUpdated())}toggleIcons(){if(this.model.external)return;if(this.views.sub&&this.views.sub instanceof B.IconSelectView)return void this.render();this.removeSubView();const e=new B.IconSelectView({iconId:this.model.customIconId||this.model.iconId,url:this.model.url,file:this.model.file},{parent:this.scroller[0],replace:!0});this.listenTo(e,"select",this.iconSelected),e.render(),this.pageResized(),this.views.sub=e}toggleAttachment(e){const t=Q(e.target).closest(".details__attachment"),n=t.data("id"),i=this.model.attachments[n];if(e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)return void this.downloadAttachment(i);if(this.views.sub&&this.views.sub.attId===n)return void this.render();this.removeSubView();const s=new C.DetailsAttachmentView(i,{parent:this.scroller[0],replace:!0});s.attId=n,s.render(this.pageResized.bind(this)),s.on("download",(()=>this.downloadAttachment(i))),this.listenTo(s,"close",this.render.bind(this)),this.views.sub=s,t.addClass("details__attachment--active")}removeSubView(){this.$el.find(".details__attachment").removeClass("details__attachment--active"),this.views.sub&&(this.views.sub.remove(),delete this.views.sub)}downloadAttachment(e){const t=e.getBinary();if(!t)return;const n=e.mimeType||"application/octet-stream",i=new Blob([t],{type:n});y.FileSaver.saveAs(i,e.title)}iconSelected(e){e.custom?e.id!==this.model.customIconId?(this.model.setCustomIcon(e.id),this.entryUpdated()):this.render():e.id!==this.model.iconId?(this.model.setIcon(+e.id),this.entryUpdated()):this.render()}showEntry(e){this.model=e,this.initOtp(),this.render(),e&&!e.title&&e.isJustCreated&&this.editTitle()}initOtp(){var e,t,n;this.matchingOtpEntry=null,this.model&&(null===(e=(t=this.model).initOtpGenerator)||void 0===e||e.call(t),this.model.external||(this.matchingOtpEntry=this.appModel.getMatchingOtpEntry(this.model),null===(n=this.matchingOtpEntry)||void 0===n||n.initOtpGenerator()))}copyKeyPress(e){if(!e||this.isHidden())return!1;if(!window.getSelection().toString()){const t=e.getTextValue();if(!t)return;l.CopyPaste.simpleCopy||l.CopyPaste.createHiddenInput(t);const n=l.CopyPaste.copy(t);return this.fieldCopied({source:e,copyRes:n}),!0}return!1}copyPasswordFromShortcut(e){this.model.external&&(this.copyOtp(),e.preventDefault());this.copyKeyPress(this.getFieldView("$Password"))&&e.preventDefault()}copyPassword(){this.copyKeyPress(this.getFieldView("$Password"))}copyUserName(){this.copyKeyPress(this.getFieldView("$UserName"))}copyUrl(){this.copyKeyPress(this.getFieldView("$URL"))}copyOtp(){const e=this.getFieldView("$otp");if(this.model.external)return!!e&&(e.copyValue(),!0);this.copyKeyPress(e)}showCopyTip(){if(this.helpTipCopyShown)return;if(this.helpTipCopyShown=m.AppSettingsModel.helpTipCopyShown,this.helpTipCopyShown)return;m.AppSettingsModel.helpTipCopyShown=!0,this.helpTipCopyShown=!0;const e=this.moreView.labelEl,t=new v.Tip(e,{title:A.Locale.detCopyHint,placement:"right"});t.show(),this.fieldCopyTip=t,setTimeout((()=>{t.hide()}),p.Timeouts.AutoHideHint)}settingsToggled(){this.hideFieldCopyTip()}fieldChanged(e){if(e.field){if("$"===e.field[0]){let t=e.field.substr(1);if("otp"===t){if(this.otpFieldChanged(e.val))return void this.entryUpdated()}else{if(e.newField){t&&this.model.setField(t,void 0),t=e.newField;let n=0;for(;this.model.hasField(t);)n++,t=e.newField+n;const i=this.model.group.isEntryTemplatesGroup();return this.model.setField(t,e.val,i),void this.entryUpdated()}if("File"===t){const t=this.appModel.files.get(e.val);return this.model.moveToFile(t),this.appModel.activeEntryId=this.model.id,this.entryUpdated(),void o.Events.emit("entry-selected",this.model)}t&&this.model.setField(t,e.val)}}else if("Tags"===e.field)this.model.setTags(e.val),this.appModel.updateTags();else if("Expires"===e.field){const t=e.val||void 0;(0,T.isEqual)(t,this.model.expires)||this.model.setExpires(t)}this.entryUpdated(!0),this.fieldViews.forEach((function(e,t){e instanceof x.FieldViewCustom&&!e.model.newField&&!this.model.hasField(e.model.title)?(e.remove(),this.fieldViews.splice(t,1)):e.update()}),this)}else if(e.newField)return void this.render();e.tab&&this.focusNextField(e.tab)}otpFieldChanged(e){let t=this.model.fields.otp;return t&&t.isProtected&&(t=t.getText()),e&&e.isProtected&&(e=e.getText()),t===e?(this.render(),!1):(this.model.setOtpUrl(e),!0)}dragover(e){e.preventDefault(),e.stopPropagation();const t=e.dataTransfer;t.types&&(t.types.indexOf?-1!==t.types.indexOf("Files"):t.types.contains("Files"))?(t.dropEffect="copy",this.dragTimeout&&clearTimeout(this.dragTimeout),this.model&&!this.dragging&&(this.dragging=!0,this.$el.find(".details").addClass("details--drag"))):t.dropEffect="none"}dragleave(){this.dragTimeout&&clearTimeout(this.dragTimeout),this.dragTimeout=setTimeout((()=>{this.$el.find(".details").removeClass("details--drag"),this.dragging=!1}),100)}drop(e){if(e.preventDefault(),!this.model)return;this.dragTimeout&&clearTimeout(this.dragTimeout),this.$el.find(".details").removeClass("details--drag"),this.dragging=!1;const t=e.target.files||e.dataTransfer.files;this.addAttachedFiles(t)}attachmentBtnClick(){this.$el.find(".details__attachment-input-file")[0].click()}attachmentFileChange(e){this.addAttachedFiles(e.target.files)}addAttachedFiles(e){for(const t of e){const e=new FileReader;e.onload=()=>{this.addAttachment(t.name,e.result)},e.readAsArrayBuffer(t)}}addAttachment(e,t){this.model.addAttachment(e,t).then((()=>{this.entryUpdated()}))}deleteKeyPress(e){if(this.views.sub&&void 0!==this.views.sub.attId){e.preventDefault();const t=this.model.attachments[this.views.sub.attId];this.model.removeAttachment(t.title),this.render()}}editTitle(){if(this.model.external)return;const e=Q("").addClass("details__header-title-input").attr({autocomplete:"off",spellcheck:"false",placeholder:"Title"}).val(this.model.title);e.bind({blur:this.titleInputBlur.bind(this),input:this.titleInputInput.bind(this),keydown:this.titleInputKeydown.bind(this),keypress:this.titleInputInput.bind(this)}),Q(".details__header-title").replaceWith(e),e.focus()[0].setSelectionRange(this.model.title.length,this.model.title.length)}titleInputBlur(e){this.setTitle(e.target.value)}titleInputInput(e){e.stopPropagation()}titleInputKeydown(e){c.KeyHandler.reg(),e.stopPropagation();const t=e.keyCode||e.which;if(t===h.Keys.DOM_VK_RETURN)Q(e.target).unbind("blur"),this.setTitle(e.target.value);else if(t===h.Keys.DOM_VK_ESCAPE){if(Q(e.target).unbind("blur"),this.model.isJustCreated)return this.model.removeWithoutHistory(),void o.Events.emit("refresh");this.render()}else t===h.Keys.DOM_VK_TAB&&(e.preventDefault(),Q(e.target).unbind("blur"),this.setTitle(e.target.value),e.shiftKey||this.focusNextField({field:"$Title"}))}setTitle(e){this.model.title instanceof s().ProtectedValue&&(e=s().ProtectedValue.fromString(e)),e!==this.model.title&&(this.model.setField("Title",e),this.entryUpdated(!0));const t=Q('').text(e||"(no title)");this.$el.find(".details__header-title-input").replaceWith(t)}entryUpdated(e){o.Events.emit("entry-updated",{entry:this.model}),this.initOtp(),e||this.render()}focusNextField(e){let t,n=!1;"$Title"!==e.field||e.prev||(n=!0);const i=e.prev?this.fieldViews.length-1:0,s=e.prev?-1:this.fieldViews.length,r=e.prev?-1:1;for(let o=i;o!==s;o+=r){const i=this.fieldViews[o];if(i.model.name===e.field)n=!0;else if(n&&!i.readonly&&!i.isHidden()){t=i;break}}t&&t.edit()}showHistory(){this.removeSubView();const e=new E.DetailsHistoryView(this.model,{parent:this.scroller[0],replace:!0});this.listenTo(e,"close",this.historyClosed.bind(this)),e.render(),this.pageResized(),this.views.sub=e}historyClosed(e){e.updated?this.entryUpdated():this.render()}moveToTrash(){const e=()=>{this.model.moveToTrash(),o.Events.emit("refresh")};g.Features.isMobile?d.Alerts.yesno({header:A.Locale.detDelToTrash,body:A.Locale.detDelToTrashBody,icon:"trash-alt",success:e}):e()}clone(){const e=this.model.cloneEntry(" "+A.Locale.detClonedName);o.Events.emit("select-entry",e)}copyToClipboard(){l.CopyPaste.copyHtml(this.model.getHtml())}deleteFromTrash(){d.Alerts.yesno({header:A.Locale.detDelFromTrash,body:A.Locale.detDelFromTrashBody,hint:A.Locale.detDelFromTrashBodyHint,icon:"minus-circle",success:()=>{this.model.deleteFromTrash(),o.Events.emit("refresh")}})}backClick(){o.Events.emit("toggle-details",!1)}contextMenu(e){const t=document.queryCommandSupported("copy"),n=[];t&&(this.model.external?n.push({value:"det-copy-otp",icon:"copy",text:A.Locale.detMenuCopyOtp}):n.push({value:"det-copy-password",icon:"copy",text:A.Locale.detMenuCopyPassword}),n.push({value:"det-copy-user",icon:"copy",text:A.Locale.detMenuCopyUser})),this.model.external||(n.push({value:"det-add-new",icon:"plus",text:A.Locale.detMenuAddNewField}),n.push({value:"det-clone",icon:"clone",text:A.Locale.detClone}),t&&n.push({value:"copy-to-clipboard",icon:"clipboard",text:A.Locale.detCopyEntryToClipboard})),a.AutoType.enabled&&n.push({value:"det-auto-type",icon:"keyboard",text:A.Locale.detAutoType}),o.Events.emit("show-context-menu",Object.assign(e,{options:n}))}contextMenuSelect(e){switch(e.item){case"det-copy-password":this.copyPassword();break;case"det-copy-user":this.copyUserName();break;case"det-copy-otp":this.copyOtp();break;case"det-add-new":this.addNewField();break;case"det-clone":this.clone();break;case"det-auto-type":this.autoType();break;case"copy-to-clipboard":this.copyToClipboard()}}setupOtp(){u.OtpQrReader.read()}otpCodeRead(e){this.model.setOtp(e),this.entryUpdated()}otpEnterManually(){if(this.model.fields.otp){const e=this.fieldViews.find((e=>"$otp"===e.model.name));e&&e.edit()}else{this.moreView.remove(),this.moreView=null;const e=new x.FieldViewCustom({name:"$otp",title:"otp",newField:"otp",value:s().ProtectedValue.fromString("")},{parent:this.$el.find(".details__body-fields")[0]});e.on("change",this.fieldChanged.bind(this)),e.render(),e.edit(),this.fieldViews.push(e)}}toggleAutoType(){if(this.views.autoType)return this.views.autoType.remove(),void delete this.views.autoType;this.views.autoType=new _.DetailsAutoTypeView(this.model),this.views.autoType.render()}autoType(e){const t=this.model;if((null==e?void 0:e.includes("{TOTP}"))||t.external&&!e){const n=this.getFieldView("$otp");n.refreshOtp((i=>{i||o.Events.emit("auto-type",{entry:t,sequence:e,context:{resolved:{totp:n.otpValue}}})}))}else o.Events.emit("auto-type",{entry:t,sequence:e})}}Object.assign(R.prototype,w.Scrollable),Object.assign(R.prototype,b.Copyable)},1864:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DragView:()=>a});var i=n(7779),s=n(3814),r=n.n(s),o=n(6718);class a extends i.View{constructor(e,t){super(e,t),this.template=r(),this.events={mousedown:"mousedown"},this.setCoord(e),this.mouseDownTime=-1,this.mouseDownCount=0}render(){super.render({coord:this.model})}setCoord(e){this.coord=e,this.offsetProp="page"+e.toUpperCase()}mousedown(e){if(1===e.which){const t=Date.now();if(t-this.mouseDownTime<500){if(this.mouseDownCount++,2===this.mouseDownCount)return void this.emit("autosize",{coord:this.coord})}else this.mouseDownTime=t,this.mouseDownCount=1;this.initialOffset=e[this.offsetProp];const n=this.$el.css("cursor");this.dragMask=o("",{class:"drag-mask"}).css("cursor",n).appendTo("body"),this.dragMask.on("mousemove",this.mousemove.bind(this)),this.dragMask.on("mouseup",this.mouseup.bind(this)),this.emit("dragstart",{offset:this.initialOffset,coord:this.coord}),this.$el.addClass("dragging"),e.preventDefault()}}mousemove(e){0===e.which?this.mouseup():this.emit("drag",{offset:e[this.offsetProp]-this.initialOffset})}mouseup(){this.dragMask.remove(),this.$el.removeClass("dragging")}}},1434:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DropdownView:()=>c});var i=n(7201),s=n(7779),r=n(2977),o=n(8087),a=n.n(o),l=n(6718);class c extends s.View{constructor(e){super(e),this.parent="body",this.modal="dropdown",this.template=a(),this.events={"click .dropdown__item":"itemClick"},i.Events.emit("dropdown-shown"),this.bodyClick=this.bodyClick.bind(this),this.listenTo(i.Events,"show-context-menu",this.bodyClick),this.listenTo(i.Events,"dropdown-shown",this.bodyClick),l("body").on("click contextmenu keydown",this.bodyClick),this.onKey(r.Keys.DOM_VK_UP,this.upPressed,!1,"dropdown"),this.onKey(r.Keys.DOM_VK_DOWN,this.downPressed,!1,"dropdown"),this.onKey(r.Keys.DOM_VK_RETURN,this.enterPressed,!1,"dropdown"),this.onKey(r.Keys.DOM_VK_ESCAPE,this.escPressed,!1,"dropdown"),this.once("remove",(()=>{l("body").off("click contextmenu keydown",this.bodyClick)}))}render(e){this.options=e.options,super.render(e);const t=this.$el[0].getBoundingClientRect(),n=document.body.getBoundingClientRect();let i=e.position.left||e.position.right-t.right+t.left,s=e.position.top;i+t.width>n.right&&(i=Math.max(0,n.right-t.width)),s+t.height>n.bottom&&(s=Math.max(0,n.bottom-t.height)),this.$el.css({top:s,left:i})}bodyClick(e){e&&[r.Keys.DOM_VK_UP,r.Keys.DOM_VK_DOWN,r.Keys.DOM_VK_RETURN,r.Keys.DOM_VK_ESCAPE].includes(e.which)||this.removed||this.emit("cancel")}itemClick(e){e.stopPropagation();const t=l(e.target).closest(".dropdown__item"),n=t.data("value");this.emit("select",{item:n,el:t})}upPressed(e){e.preventDefault(),this.selectedOption?this.selectedOption--:this.selectedOption=this.options.length-1,this.renderSelectedOption()}downPressed(e){e.preventDefault(),void 0===this.selectedOption||this.selectedOption===this.options.length-1?this.selectedOption=0:this.selectedOption++,this.renderSelectedOption()}renderSelectedOption(){this.$el.find(".dropdown__item").removeClass("dropdown__item--active"),this.$el.find(`.dropdown__item:nth(${this.selectedOption})`).addClass("dropdown__item--active")}enterPressed(){if(!this.removed&&void 0!==this.selectedOption){const e=this.$el.find(`.dropdown__item:nth(${this.selectedOption})`),t=e.data("value");this.emit("select",{item:t,el:e})}}escPressed(e){e.stopImmediatePropagation(),this.removed||this.emit("cancel")}}},2969:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewAutocomplete:()=>l});var i=n(2977),s=n(1297),r=n(4197),o=n.n(r),a=n(6718);class l extends s.FieldViewText{constructor(...e){super(...e),this.hasOptions=!0}endEdit(e,t){this.autocomplete&&(this.autocomplete.remove(),this.autocomplete=null),delete this.selectedCompletionIx,super.endEdit(e,t)}startEdit(){super.startEdit();const e=this.input[0].getBoundingClientRect(),t=parseInt(this.input.css("--focus-shadow-spread"))||0;this.autocomplete=a('').appendTo("body"),this.autocomplete.css({top:e.bottom+t,left:e.left,width:e.width-2}),delete this.selectedCompletionIx,this.autocomplete.mousedown(this.autocompleteClick.bind(this)),this.input.val()?this.autocomplete.hide():this.updateAutocomplete()}fieldValueInput(e){e.stopPropagation(),this.updateAutocomplete(),super.fieldValueInput.call(this,e)}fieldValueKeydown(e){switch(e.which){case i.Keys.DOM_VK_UP:this.moveAutocomplete(!1),e.preventDefault();break;case i.Keys.DOM_VK_DOWN:this.moveAutocomplete(!0),e.preventDefault();break;case i.Keys.DOM_VK_RETURN:{const e=this.autocomplete.find(".details__field-autocomplete-item--selected").text();e&&(this.input.val(e),this.endEdit(e));break}default:delete this.selectedCompletionIx}super.fieldValueKeydown(e)}moveAutocomplete(e){const t=this.model.getCompletions(this.input.val());"number"==typeof this.selectedCompletionIx?this.selectedCompletionIx=(t.length+this.selectedCompletionIx+(e?1:-1))%t.length:this.selectedCompletionIx=e?0:t.length-1,this.updateAutocomplete()}updateAutocomplete(){const e=this.model.getCompletions(this.input.val()),t=o()({completions:e,selectedIx:this.selectedCompletionIx});this.autocomplete.html(t),this.autocomplete.toggle(!!t)}autocompleteClick(e){if(e.stopPropagation(),e.target.classList.contains("details__field-autocomplete-item")){const t=a(e.target).text();this.input.val(t),this.endEdit(t)}else this.afterPaint((()=>{this.input.focus()}))}}},4169:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewCustom:()=>d});var i=n(3617),s=n.n(i),r=n(2977),o=n(3297),a=n(3710),l=n(4707),c=n(1297),u=n(6718);class d extends c.FieldViewText{constructor(e,t){super(e,t),this.events=Object.assign({},this.events,{"mousedown .details__field-label":"fieldLabelMousedown"})}startEdit(){super.startEdit(),this.$el.addClass("details__field--can-edit-title"),void 0===this.isProtected&&(this.isProtected=this.value instanceof s().ProtectedValue),this.$el.toggleClass("details__field--protected",this.isProtected),u("").addClass("details__field-value-btn details__field-value-btn-protect").appendTo(this.valueEl).mousedown(this.protectBtnClick.bind(this));let e=o.Locale.detLockField;this.isProtected&&(e=o.Locale.detUnlockField);new a.Tip(u(this.valueEl).find(".details__field-value-btn"),{title:e}).init()}endEdit(e,t){this.$el.removeClass("details__field--can-edit-title"),t=Object.assign({},t),(this.model.titleChanged||this.model.newField)&&(t.newField=this.model.title),this.editing&&(delete this.input,"string"==typeof e&&(e=this.isProtected?s().ProtectedValue.fromString(e):u.trim(e)),l.FieldView.prototype.endEdit.call(this,e,t),this.model.titleChanged&&delete this.model.titleChanged)}startEditTitle(e){const t=e?"":this.model.title||"";this.labelInput=u(""),this.labelEl.empty().append(this.labelInput),this.labelInput.attr({autocomplete:"off",spellcheck:"false"}).val(t).focus()[0].setSelectionRange(t.length,t.length),this.labelInput.bind({input:this.fieldLabelInput.bind(this),keydown:this.fieldLabelKeydown.bind(this),keyup:this.fieldLabelKeyup.bind(this),keypress:this.fieldLabelInput.bind(this),mousedown:this.fieldLabelInputClick.bind(this),click:this.fieldLabelInputClick.bind(this)})}endEditTitle(e){e&&e!==this.model.title?(this.model.title=e,this.model.titleChanged=!0):""===e&&this.emit("change",{field:"$"+this.model.title,val:""}),this.$el.find(".details__field-label").text(this.model.title),delete this.labelInput,this.editing&&this.input&&this.input.focus()}fieldLabelClick(e){e.stopImmediatePropagation(),this.model.newField?this.startEditTitle(!0):this.editing?this.startEditTitle():super.fieldLabelClick.call(this,e)}fieldLabelMousedown(e){this.editing&&e.stopPropagation()}fieldValueBlur(){this.labelInput&&this.endEditTitle(this.labelInput.val()),this.input&&this.endEdit(this.input.val())}fieldLabelInput(e){e.stopPropagation()}fieldLabelInputClick(e){e.stopPropagation()}fieldLabelKeydown(e){e.stopPropagation();const t=e.keyCode||e.which;t===r.Keys.DOM_VK_ESCAPE?this.endEditTitle():t===r.Keys.DOM_VK_TAB&&(e.preventDefault(),this.endEditTitle(e.target.value))}fieldLabelKeyup(e){(e.keyCode||e.which)===r.Keys.DOM_VK_RETURN&&this.endEditTitle(e.target.value)}fieldValueInputClick(){this.labelInput&&this.endEditTitle(this.labelInput.val()),super.fieldValueInputClick.call(this)}protectBtnClick(e){e.stopPropagation(),this.isProtected=!this.isProtected,this.$el.toggleClass("details__field--protected",this.isProtected),this.labelInput&&this.endEditTitle(this.labelInput.val()),setTimeout((()=>this.input.focus()))}}},2574:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewDate:()=>a});var i=n(4319),s=n.n(i),r=n(6098),o=n(1297);class a extends o.FieldViewText{constructor(...e){super(...e),this.hasOptions=!1}renderValue(e){let t=e?r.DateFormat.dStr(e):"";return e&&this.model.lessThanNow&ðis.picker.show()),0)}adjustPickerPosition(...e){window.Pikaday=s(),s().prototype.adjustPosition.apply(this.picker,e);const t=parseInt(this.input.css("--focus-shadow-spread"))||0;if(t){const e=this.picker.el.classList.contains("top-aligned")?-t:t,n=parseInt(this.picker.el.style.top)+e;this.picker.el.style.top=`${n}px`}}fieldValueBlur(e){this.picker||super.fieldValueBlur(e)}endEdit(e,t){if(this.picker){try{this.picker.destroy()}catch(e){}this.picker=null}(e=new Date(e))&&!isNaN(e.getTime())||(e=null),super.endEdit(e,t)}pickerClose(){this.endEdit(this.input.val())}pickerSelect(e){this.endEdit(e)}}},8108:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewHistory:()=>r});var i=n(3297),s=n(4707);class r extends s.FieldView{constructor(...e){super(...e),this.readonly=!0}renderValue(e){if(!e.length)return i.Locale.detHistoryEmpty;let t=e.length+" "+(1===e.length?i.Locale.detHistoryRec:i.Locale.detHistoryRecs);return e.unsaved&&(t+=" ("+i.Locale.detHistoryModified+")"),''+t+""}}},8877:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewOtp:()=>a});var i=n(403),s=n(1297),r=n(3297),o=n(2378);class a extends s.FieldViewText{constructor(e,t){super(e,t),this.otpTimeout=null,this.otpTickInterval=null,this.otpValue=null,this.otpGenerator=null,this.otpTimeLeft=0,this.otpValidUntil=0,this.fieldOpacity=null,this.otpState=null,this.once("remove",(()=>this.stopOtpUpdater())),e.readonly&&(this.readonly=!0)}renderValue(e){if(!e)return this.resetOtp(),"";if(e!==this.otpGenerator&&(this.resetOtp(),this.otpGenerator=e,this.requestOtpUpdate()),this.otpValue)return this.otpValue;switch(this.otpState){case"awaiting-command":return r.Locale.detOtpClickToTouch;case"awaiting-touch":return r.Locale.detOtpTouch.replace("{}",this.model.deviceShortName);case"error":return o.StringFormat.capFirst(r.Locale.error);case"generating":return r.Locale.detOtpGenerating;default:return""}}getEditValue(e){return e&&e.url}getTextValue(){return this.otpValue}render(){super.render(),this.fieldOpacity=null,this.otpTick()}resetOtp(){this.otpGenerator=null,this.otpValue=null,this.otpTimeLeft=0,this.otpValidUntil=0,this.otpState=null,this.otpTimeout&&(clearTimeout(this.otpTimeout),this.otpTimeout=null),this.otpTickInterval&&(clearInterval(this.otpTickInterval),this.otpTickInterval=null)}requestOtpUpdate(){this.value&&(this.model.needsTouch?this.otpState="awaiting-command":(this.otpState="generating",this.value.next(this.otpUpdated.bind(this))))}otpUpdated(e,t,n){if(!this.removed)return e?(this.otpState="error",void this.render()):void(this.value&&t?(this.otpValue=t||"",this.otpTimeLeft=n||0,this.otpValidUntil=Date.now()+n,this.editing||this.render(),this.otpValue&&n&&(this.otpTimeout=setTimeout((()=>{this.requestOtpUpdate(),this.otpTickInterval&&(clearInterval(this.otpTickInterval),this.otpTickInterval=null),this.model.needsTouch&&(this.fieldOpacity=null,this.otpValue=null,this.otpValidUntil=0,this.otpTimeLeft=0,this.valueEl.css("opacity",1)),this.render()}),n),this.otpTickInterval||(this.otpTickInterval=setInterval(this.otpTick.bind(this),300)))):this.resetOtp())}otpTick(){if(!this.value||!this.otpValidUntil)return;let e;const t=this.otpValidUntil-Date.now();e=t>=i.Timeouts.OtpFadeDuration||this.editing?1:t<=0?.1:Math.max(.1,Math.pow(t/i.Timeouts.OtpFadeDuration,2)),this.fieldOpacity!==e&&(this.fieldOpacity=e,this.valueEl.css("opacity",e))}copyValue(){this.refreshOtp((e=>{e||super.copyValue()}))}refreshOtp(e){this.model.needsTouch?this.otpValue?e():this.requestTouch(e):e()}requestTouch(e){this.otpState="awaiting-touch",this.value.next(((t,n,i)=>{this.otpUpdated(t,n,i),e(t)})),this.render()}stopOtpUpdater(){"awaiting-touch"===this.otpState&&this.value&&this.value.cancel&&this.value.cancel(),this.resetOtp()}}},2402:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewReadOnlyRaw:()=>s});var i=n(4707);class s extends i.FieldView{constructor(...e){super(...e),this.readonly=!0}renderValue(e){return e}}},4984:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewReadOnlyWithOptions:()=>s});var i=n(1297);class s extends i.FieldViewText{constructor(...e){super(...e),this.readonly=!0,this.hasOptions=!0}}},9260:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewReadOnly:()=>r});var i=n(4707),s=n(6838);class r extends i.FieldView{constructor(...e){super(...e),this.readonly=!0}renderValue(e){return e=(e=e.isProtected?new Array(e.textLength+1).join("•"):(0,s.escape)(e)).replace(/\n/g,"
")}}},2836:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewSelect:()=>r});var i=n(4707),s=n(6838);class r extends i.FieldView{constructor(...e){super(...e),this.readonly=!0}renderValue(e){return""}render(){super.render(),this.valueEl.addClass("details__field-value--select"),this.valueEl.find("select:first").change((e=>{this.triggerChange({val:e.target.value,field:this.model.name})}))}fieldLabelClick(){}fieldValueClick(){}edit(){}startEdit(){}endEdit(e,t){this.editing&&(delete this.input,super.endEdit(e,t))}}},3033:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewTags:()=>l});var i=n(1297),s=n(6838),r=n(6914),o=n.n(r),a=n(6718);class l extends i.FieldViewText{constructor(...e){super(...e),this.hasOptions=!1}renderValue(e){return e?(0,s.escape)(e.join(", ")):""}getEditValue(e){return e?e.join(", "):""}getTextValue(){return this.value?this.value.join(", "):""}valueToTags(e){const t={};this.model.tags.forEach((e=>{t[e.toLowerCase()]=e}));const n={};return e.split(/\s*[;,:]\s*/).filter((e=>e)).map((e=>t[e.toLowerCase()]||e)).forEach((e=>{n[e]=e})),Object.keys(n)}endEdit(e,t){void 0!==e&&(e=this.valueToTags(e)),this.tagsAutocomplete&&(this.tagsAutocomplete.remove(),this.tagsAutocomplete=null),super.endEdit(e,t)}startEdit(){super.startEdit();const e=this.input[0].getBoundingClientRect(),t=parseInt(this.input.css("--focus-shadow-spread"))||0;this.tagsAutocomplete=a('').appendTo("body"),this.tagsAutocomplete.css({top:e.bottom+t,left:e.left,width:e.width-2}),this.tagsAutocomplete.mousedown(this.tagsAutocompleteClick.bind(this)),this.setTags()}fieldValueInput(e){e.stopPropagation(),this.setTags(),super.fieldValueInput(e)}getAvailableTags(){const e=this.valueToTags(this.input.val()),t=e[e.length-1],n=t&&this.model.tags.indexOf(t)<0;return this.model.tags.filter((i=>e.indexOf(i)<0&&(!n||i.toLowerCase().indexOf(t.toLowerCase())>=0)))}setTags(){const e=this.getAvailableTags(),t=o()({tags:e});this.tagsAutocomplete.html(t),this.tagsAutocomplete.toggle(!!t)}tagsAutocompleteClick(e){if(e.stopPropagation(),e.target.classList.contains("details__field-autocomplete-item")){const t=a(e.target).text();let n=this.input.val();if(n){const e=this.valueToTags(n),i=e[e.length-1];i&&this.model.tags.indexOf(i)<0?n=n.substr(0,n.lastIndexOf(i))+t:n+=", "+t}else n=t;this.input.val(n),this.input.focus(),this.setTags()}this.afterPaint((()=>{this.input.focus()}))}}},1297:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewText:()=>A});var i=n(3617),s=n.n(i),r=n(7201),o=n(1164),a=n(2977),l=n(667),c=n(8134),u=n(1705),d=n(3710),h=n(4707),p=n(1473),m=n(6838),f=n(7614),g=n(6718);class A extends h.FieldView{constructor(e,t){super(e,t),this.hasOptions=!0,this.once("remove",(()=>this.stopBlurListener()))}renderValue(e){if(this.model.markdown&&f.AppSettingsModel.useMarkdown){e&&e.isProtected&&(e=e.getText());const t=c.MdToHtml.convert(e);if(t.html)return t.html;e=t.text}return e&&e.isProtected?u.PasswordPresenter.presentValueWithLineBreaks(e):(0,m.escape)(e||"").replace(/\n/g,"
")}getEditValue(e){return e&&e.isProtected?e.getText():e||""}startEdit(){const e=this.getEditValue(this.value),t=!(!this.value||!this.value.isProtected);this.$el.toggleClass("details__field--protected",t),this.input=g(document.createElement(this.model.multiline?"textarea":"input")),this.valueEl.empty().append(this.input),this.input.attr({autocomplete:"off",spellcheck:"false"}).val(e).focus()[0].setSelectionRange(e.length,e.length),this.input.bind({input:this.fieldValueInput.bind(this),keydown:this.fieldValueKeydown.bind(this),keypress:this.fieldValueInput.bind(this),click:this.fieldValueInputClick.bind(this),mousedown:this.fieldValueInputMouseDown.bind(this)});const n=e=>this.fieldValueBlur(e);r.Events.on("click",n),this.stopBlurListener=()=>r.Events.off("click",n),this.listenTo(r.Events,"main-window-will-close",this.externalEndEdit),this.listenTo(r.Events,"before-user-idle",this.externalEndEdit),this.model.multiline&&this.setInputHeight(),l.Features.isMobile?this.createMobileControls():this.model.canGen&&g("").addClass("details__field-value-btn details__field-value-btn-gen").appendTo(this.valueEl).click(this.showGeneratorClick.bind(this)).mousedown(this.showGenerator.bind(this)),d.Tip.hideTip(this.valueEl[0]),d.Tip.hideTip(this.labelEl[0])}createMobileControls(){this.mobileControls={},["cancel","apply"].forEach((e=>{this.mobileControls[e]=g("").addClass("details__field-value-btn details__field-value-btn-"+e).appendTo(this.labelEl).data("action",e).on({mousedown:this.mobileFieldControlMouseDown.bind(this),touchstart:this.mobileFieldControlTouchStart.bind(this),touchend:this.mobileFieldControlTouchEnd.bind(this),touchmove:this.mobileFieldControlTouchMove.bind(this)})}))}showGeneratorClick(e){e.stopPropagation(),this.gen||this.input.focus()}showGenerator(){if(this.gen)this.hideGenerator();else{const e=this.input[0].getBoundingClientRect(),t=parseInt(this.input.css("--focus-shadow-spread"))||0,n={left:e.left},i=e.bottom+t,s=document.documentElement.clientHeight;i>s/2&&i>200?n.bottom=s-e.top+t:n.top=i,this.gen=new p.GeneratorView({pos:n,password:this.value}),this.gen.render(),this.gen.once("remove",this.generatorClosed.bind(this)),this.gen.once("result",this.generatorResult.bind(this))}}hideGenerator(){if(this.gen){const e=this.gen;delete this.gen,e.remove()}}generatorClosed(){this.gen&&(delete this.gen,this.endEdit())}generatorResult(e){this.gen&&(delete this.gen,this.endEdit(e))}setInputHeight(){this.input.height(18);let e=this.input[0].scrollHeight;e<=18&&(e=18),this.input.height(e)}fieldValueBlur(){!this.gen&&this.input&&this.endEdit(this.input.val())}fieldValueInput(e){e.stopPropagation(),this.model.multiline&&this.setInputHeight()}fieldValueInputClick(){this.gen&&this.hideGenerator()}fieldValueInputMouseDown(e){e.stopPropagation()}fieldValueKeydown(e){o.KeyHandler.reg();const t=e.keyCode||e.which;if(t===a.Keys.DOM_VK_RETURN){if(!this.model.multiline||!e.altKey&&!e.shiftKey&&!e.ctrlKey){if(this.gen)return e.target.value=this.gen.password,void this.hideGenerator();this.stopBlurListener(),this.endEdit(e.target.value)}}else if(t===a.Keys.DOM_VK_ESCAPE)this.stopBlurListener(),this.endEdit();else if(t===a.Keys.DOM_VK_TAB)e.preventDefault(),this.stopBlurListener(),this.endEdit(e.target.value,{tab:{field:this.model.name,prev:e.shiftKey}});else if(t===a.Keys.DOM_VK_G&&e.metaKey)e.preventDefault(),this.showGenerator();else if(t===a.Keys.DOM_VK_S&&(e.metaKey||e.ctrlKey))return this.stopBlurListener(),void this.endEdit(e.target.value);e.stopPropagation()}externalEndEdit(){this.input&&this.endEdit(this.input.val())}endEdit(e,t){this.gen&&this.hideGenerator(),this.editing&&(delete this.input,this.mobileControls&&(this.mobileControls.cancel.remove(),this.mobileControls.apply.remove(),delete this.mobileControls),this.stopBlurListener(),"string"==typeof e&&this.value instanceof s().ProtectedValue&&(e=s().ProtectedValue.fromString(e)),"string"==typeof e&&(e=g.trim(e)),super.endEdit(e,t))}stopBlurListener(){}mobileFieldControlMouseDown(e){e.stopPropagation(),this.stopBlurListener();"apply"===g(e.target).data("action")?this.endEdit(this.input.val()):this.endEdit()}mobileFieldControlTouchStart(e){this.$el.attr("active-mobile-action",g(e.target).data("action"))}mobileFieldControlTouchEnd(e){const t=this.$el.attr("active-mobile-action")===g(e.target).data("action");this.$el.removeAttr("active-mobile-action"),t&&this.mobileFieldControlMouseDown(e)}mobileFieldControlTouchMove(e){const t=e.originalEvent.targetTouches[0],n=t.target.getBoundingClientRect();t.clientX>=n.left&&t.clientX<=n.right&&t.clientY>=n.top&&t.clientY<=n.bottom?this.$el.attr("active-mobile-action",g(e.target).data("action")):this.$el.removeAttr("active-mobile-action")}}},1960:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldViewUrl:()=>o});var i=n(1297),s=n(6838);const r=["http:","https:","ftp:","ftps:","mailto:"];class o extends i.FieldViewText{constructor(...e){super(...e),this.displayUrlRegex=/^https:\/\//i,this.cssClass="url"}renderValue(e){try{return e?''+(0,s.escape)(this.displayUrl(e))+"":""}catch(t){return(0,s.escape)(e)}}fixUrl(e){const t=new URL(e,"ws://x").protocol;if("ws:"===t)return"https://"+e;if(!r.includes(t))throw new Error("Bad url");return e}displayUrl(e){return e.replace(this.displayUrlRegex,"")}getTextValue(){return this.value}}},4707:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FieldView:()=>b});var i=n(3617),s=n.n(i),r=n(7779),o=n(7201),a=n(5933),l=n(3710),c=n(6838),u=n(667),d=n(3297),h=n(3898),p=n(1705),m=n(1434),f=n(7614),g=n(403),A=n(2545),y=n.n(A),v=n(6718);class b extends r.View{constructor(e,t){super(e,t),this.template=y(),this.events={"click .details__field-label":"fieldLabelClick","dblclick .details__field-label":"fieldLabelDblClick","click .details__field-value":"fieldValueClick","dragstart .details__field-label":"fieldLabelDrag","click .details__field-options":"fieldOptionsClick"},this.once("remove",(()=>{this.tip&&l.Tip.hideTip(this.valueEl[0])})),u.Features.isMobile&&this.listenTo(o.Events,"click",this.bodyClick)}render(){this.value="function"==typeof this.model.value?this.model.value():this.model.value;const e=this.renderValue(this.value);super.render({cls:this.cssClass,editable:!this.readonly,multiline:this.model.multiline,title:this.model.title,canEditTitle:this.model.newField,protect:this.value&&this.value.isProtected,hasOptions:!u.Features.isMobile&&e&&this.hasOptions}),this.valueEl=this.$el.find(".details__field-value"),this.valueEl.html(e),this.labelEl=this.$el.find(".details__field-label"),this.model.tip&&(this.tip="function"==typeof this.model.tip?this.model.tip():this.model.tip,this.tip&&(this.valueEl.attr("title",this.tip),l.Tip.createTip(this.valueEl[0])))}update(){if("function"==typeof this.model.value){const e=this.model.value();(!(0,c.isEqual)(e,this.value)||this.value&&e&&this.value.toString()!==e.toString())&&this.render()}}fieldLabelClick(e){if(e.stopImmediatePropagation(),this.hideOptionsDropdown(),!this.preventCopy)if(h.AutoType.enabled&&f.AppSettingsModel.fieldLabelDblClickAutoType){if(this.fieldLabelClickTimer)return clearTimeout(this.fieldLabelClickTimer),this.fieldLabelClickTimer=null,void this.emit("autotype",{source:this});this.fieldLabelClickTimer=setTimeout((()=>{this.copyValue(),this.fieldLabelClickTimer=null}),g.Timeouts.FieldLabelDoubleClick)}else this.copyValue()}copyValue(){let e;if(this.model.name){const t=this.getTextValue();if(!t)return;return a.CopyPaste.simpleCopy||a.CopyPaste.createHiddenInput(t),e=a.CopyPaste.copy(t),void this.emit("copy",{source:this,copyRes:e})}if(!this.value)return;const t=window.getSelection(),n=document.createRange();n.selectNodeContents(this.valueEl[0]),t.removeAllRanges(),t.addRange(n),e=a.CopyPaste.copy(this.valueEl[0].innerText||this.valueEl.text()),e&&(t.removeAllRanges(),this.emit("copy",{source:this,copyRes:e}))}fieldValueClick(e){if(this.hideOptionsDropdown(),["a","input","textarea"].indexOf(e.target.tagName.toLowerCase())>=0)return;window.getSelection().toString()||(u.Features.isMobile?(e.stopPropagation(),this.showMobileActions()):this.edit())}fieldLabelDrag(e){if(e.stopPropagation(),this.hideOptionsDropdown(),!this.value)return;const t=e.dataTransfer,n=this.getTextValue();"a"===this.valueEl[0].tagName.toLowerCase()&&t.setData("text/uri-list",n),t.setData("text/plain",n),t.effectAllowed="copy"}edit(){this.readonly||this.editing||(this.valueEl.removeClass("details__field-value--revealed"),this.$el.addClass("details__field--edit"),this.startEdit(),this.editing=!0,this.preventCopy=!0,this.labelEl[0].setAttribute("draggable","false"))}endEdit(e,t){if(!this.editing)return;let n;this.editing=!1,setTimeout((()=>{this.preventCopy=!1}),300),n=this.value&&this.value.isProtected?this.value.equals(e):e&&e.isProtected?e.equals(this.value):e instanceof Date&&this.value instanceof Date?e.toDateString()===this.value.toDateString():(0,c.isEqual)(this.value,e);const i=(e&&e.isProtected)===(this.value&&this.value.isProtected),s=t&&t.newField;let r;void 0===e||n&&i&&!s?t&&(r=t):(r={val:e,field:this.model.name},t&&Object.assign(r,t)),r&&this.triggerChange(r),this.valueEl.removeClass("details__field-value--revealed").html(this.renderValue(this.value)),this.$el.removeClass("details__field--edit"),this.labelEl[0].setAttribute("draggable","true")}triggerChange(e){e.sender=this,this.emit("change",e)}fieldOptionsClick(e){if(this.views.optionsDropdown)return void this.hideOptionsDropdown();e.stopPropagation();const t=new m.DropdownView;this.listenTo(t,"cancel",this.hideOptionsDropdown),this.listenTo(t,"select",this.optionsDropdownSelect);const n=[];n.push({value:"copy",icon:"copy",text:d.Locale.alertCopy}),this.value instanceof s().ProtectedValue&&(this.valueEl.hasClass("details__field-value--revealed")?n.push({value:"hide",icon:"eye-slash",text:d.Locale.detHideField}):n.push({value:"reveal",icon:"eye",text:d.Locale.detRevealField})),h.AutoType.enabled&&this.model.sequence&&n.push({value:"autotype",icon:"keyboard",text:d.Locale.detAutoTypeField});const i=this.$el[0].getBoundingClientRect(),r={top:i.bottom,right:i.right};t.render({position:r,options:n}),this.views.optionsDropdown=t}hideOptionsDropdown(){this.views.optionsDropdown&&(this.views.optionsDropdown.remove(),delete this.views.optionsDropdown)}optionsDropdownSelect(e){switch(this.hideOptionsDropdown(),e.item){case"copy":this.copyValue();break;case"reveal":this.revealValue();break;case"hide":this.hideValue();break;case"autotype":this.emit("autotype",{source:this})}}revealValue(){const e=p.PasswordPresenter.asDOM(this.value);this.valueEl.addClass("details__field-value--revealed").empty(),this.valueEl.append(e)}hideValue(){this.valueEl.removeClass("details__field-value--revealed").html(this.renderValue(this.value))}bodyClick(e){this.mobileActionsEl&&(this.valueEl[0].contains(e.target)||this.mobileActionsEl[0].contains(e.target)||(this.mobileActionsEl.remove(),delete this.mobileActionsEl))}showMobileActions(){if(this.readonly)return;if(this.mobileActionsEl)return this.mobileActionsEl.remove(),void delete this.mobileActionsEl;const e=this.valueEl.position().left,t=this.$el.width()-e,n=this.valueEl.height(),i=v("").addClass("details__field-mobile-actions").appendTo(this.$el).css({left:e,top:n,width:t}),r=[];this.value&&r.push({name:"copy",icon:"copy"}),r.push({name:"edit",icon:"pencil-alt"}),this.value instanceof s().ProtectedValue&&r.push({name:"reveal",icon:"eye"}),this.model.canGen&&r.push({name:"generate",icon:"bolt"});for(const e of r)v("").addClass(`details__field-mobile-action fa fa-${e.icon}`).appendTo(i).click((()=>this.doMobileAction(e.name)));this.mobileActionsEl=i}doMobileAction(e){switch(this.mobileActionsEl.remove(),delete this.mobileActionsEl,e){case"copy":this.copyValue();break;case"edit":this.edit();break;case"reveal":this.revealValue();break;case"generate":this.edit(),setTimeout((()=>this.showGenerator()),0)}}getTextValue(){return this.value?this.value.isProtected?this.value.getText():this.value:""}}},5249:(e,t,n)=>{"use strict";n.r(t),n.d(t,{FooterView:()=>h});var i=n(7779),s=n(7201),r=n(1164),o=n(2977),a=n(2706),l=n(1473),c=n(2015),u=n.n(c),d=n(6718);class h extends i.View{constructor(e,t){super(e,t),this.parent=".app__footer",this.template=u(),this.events={"click .footer__db-item":"showFile","click .footer__db-open":"openFile","click .footer__btn-help":"toggleHelp","click .footer__btn-settings":"toggleSettings","click .footer__btn-generate":"genPass","click .footer__btn-lock":"lockWorkspace"},this.onKey(o.Keys.DOM_VK_L,this.lockWorkspace,r.KeyHandler.SHORTCUT_ACTION,!1,!0),this.onKey(o.Keys.DOM_VK_G,this.genPass,r.KeyHandler.SHORTCUT_ACTION),this.onKey(o.Keys.DOM_VK_O,this.openFile,r.KeyHandler.SHORTCUT_ACTION),this.onKey(o.Keys.DOM_VK_S,this.saveAll,r.KeyHandler.SHORTCUT_ACTION),this.onKey(o.Keys.DOM_VK_COMMA,this.toggleSettings,r.KeyHandler.SHORTCUT_ACTION),this.listenTo(this,"hide",this.viewHidden),this.listenTo(this.model.files,"change",this.render),this.listenTo(s.Events,"file-changed",this.render),this.listenTo(s.Events,"set-locale",this.render),this.listenTo(a.UpdateModel,"change:updateStatus",this.render)}render(){super.render({files:this.model.files,updateAvailable:["ready","found"].indexOf(a.UpdateModel.updateStatus)>=0})}viewHidden(){this.views.gen&&(this.views.gen.remove(),delete this.views.gen)}lockWorkspace(e){this.model.files.hasOpenFiles()&&(e.preventDefault(),s.Events.emit("lock-workspace"))}genPass(e){if(e.stopPropagation(),this.views.gen)return void this.views.gen.remove();const t=this.$el.find(".footer__btn-generate")[0].getBoundingClientRect(),n=document.body.getBoundingClientRect(),i=n.right-t.right,s=n.bottom-t.top,r=new l.GeneratorView({copy:!0,pos:{right:i,bottom:s}});r.render(),r.once("remove",(()=>{delete this.views.gen})),this.views.gen=r}showFile(e){const t=d(e.target).closest(".footer__db-item").data("file-id");t&&s.Events.emit("show-file",{fileId:t})}openFile(){s.Events.emit("open-file")}saveAll(){s.Events.emit("save-all")}toggleHelp(){s.Events.emit("toggle-settings","help")}toggleSettings(){s.Events.emit("toggle-settings","general")}}},7953:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GeneratorPresetsView:()=>h});var i=n(7201),s=n(7779),r=n(1622),o=n(4486),a=n(3297),l=n(7015),c=n(1764),u=n.n(c),d=n(6718);class h extends s.View{constructor(...e){super(...e),this.parent=".app__panel",this.template=u(),this.events={"click .back-button":"returnToApp","change .gen-ps__list":"changePreset","click .gen-ps__btn-create":"createPreset","click .gen-ps__btn-delete":"deletePreset","click .info-btn--pattern":"togglePatternHelp","input #gen-ps__field-title":"changeTitle","change #gen-ps__check-enabled":"changeEnabled","change #gen-ps__check-default":"changeDefault","input #gen-ps__field-length":"changeLength","change .gen-ps__check-range":"changeRange","input #gen-ps__field-include":"changeInclude","input #gen-ps__field-pattern":"changePattern"},this.selected=null,this.reservedTitles=[a.Locale.genPresetDerived]}render(){this.presets=r.GeneratorPresets.all,this.selected&&this.presets.some((e=>e.name===this.selected))||(this.selected=(this.presets.filter((e=>e.default))[0]||this.presets[0]).name),super.render({presets:this.presets,selected:this.getPreset(this.selected),ranges:this.getSelectedRanges()}),this.createScroll({root:this.$el.find(".gen-ps")[0],scroller:this.$el.find(".scroller")[0],bar:this.$el.find(".scroller__bar")[0]}),this.renderExample()}renderExample(){const e=this.getPreset(this.selected),t=o.PasswordGenerator.generate(e);this.$el.find(".gen-ps__example").text(t),this.pageResized()}getSelectedRanges(){const e=this.getPreset(this.selected),t={high:"¡¢£¤¥¦§©ª«¬®¯°±¹²´µ¶»¼÷¿ÀÖîü..."};return["Upper","Lower","Digits","Special","Brackets","High","Ambiguous"].map((n=>{const i=n.toLowerCase();return{name:i,title:a.Locale["genPs"+n],enabled:e[i],sample:t[i]||o.CharRanges[i]}}))}getPreset(e){return this.presets.filter((t=>t.name===e))[0]}returnToApp(){i.Events.emit("edit-generator-presets")}changePreset(e){this.selected=e.target.value,this.render()}createPreset(){let e,t;for(let n=1;;n++){const i="Custom"+n,s=a.Locale.genPsNew+" "+n;if(!this.presets.filter((e=>e.name===i||e.title===s)).length){e=i,t=s;break}}const n=this.getPreset(this.selected),i={name:e,title:t,length:n.length,upper:n.upper,lower:n.lower,digits:n.digits,special:n.special,brackets:n.brackets,ambiguous:n.ambiguous,include:n.include};r.GeneratorPresets.add(i),this.selected=e,this.render()}deletePreset(){r.GeneratorPresets.remove(this.selected),this.render()}togglePatternHelp(){this.$el.find(".gen-ps__pattern-help").toggleClass("hide")}changeTitle(e){const t=d.trim(e.target.value);if(t&&t!==this.getPreset(this.selected).title){let n=this.presets.some((e=>e.title.toLowerCase()===t.toLowerCase()));if(n||(n=this.reservedTitles.some((e=>e.toLowerCase()===t.toLowerCase()))),n)return void d(e.target).addClass("input--error");d(e.target).removeClass("input--error"),r.GeneratorPresets.setPreset(this.selected,{title:t}),this.$el.find(".gen-ps__list option[selected]").text(t)}}changeEnabled(e){const t=e.target.checked;r.GeneratorPresets.setDisabled(this.selected,!t)}changeDefault(e){const t=e.target.checked;r.GeneratorPresets.setDefault(t?this.selected:null)}changeLength(e){const t=+e.target.value;t>0?(r.GeneratorPresets.setPreset(this.selected,{length:t}),d(e.target).removeClass("input--error")):d(e.target).addClass("input--error"),this.presets=r.GeneratorPresets.all,this.renderExample()}changeRange(e){const t=e.target.checked,n=e.target.dataset.range;r.GeneratorPresets.setPreset(this.selected,{[n]:t}),this.presets=r.GeneratorPresets.all,this.renderExample()}changeInclude(e){const t=e.target.value;t!==this.getPreset(this.selected).include&&r.GeneratorPresets.setPreset(this.selected,{include:t}),this.presets=r.GeneratorPresets.all,this.renderExample()}changePattern(e){const t=e.target.value;t!==this.getPreset(this.selected).pattern&&r.GeneratorPresets.setPreset(this.selected,{pattern:t}),this.presets=r.GeneratorPresets.all,this.renderExample()}}Object.assign(h.prototype,l.Scrollable)},1473:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GeneratorView:()=>f});var i=n(7779),s=n(7201),r=n(1622),o=n(5933),a=n(7614),l=n(4486),c=n(1705),u=n(3297),d=n(3710),h=n(4691),p=n.n(h),m=n(6718);class f extends i.View{constructor(e){super(e),this.parent="body",this.template=p(),this.events={click:"click","mousedown .gen__length-range":"generate","input .gen__length-range":"lengthChange","change .gen__length-range":"lengthChange","change .gen__check input[type=checkbox]":"checkChange","change .gen__check-hide":"hideChange","click .gen__btn-ok":"btnOkClick","change .gen__sel-tpl":"presetChange","click .gen__btn-refresh":"newPass"},this.valuesMap=[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,24,26,28,30,32,48,64],this.presets=null,this.preset=null,this.createPresets();const t=this.preset;this.gen=Object.assign({},this.presets.find((e=>e.name===t))),this.hide=a.AppSettingsModel.generatorHidePassword,m("body").one("click",this.remove.bind(this)),this.listenTo(s.Events,"lock-workspace",this.remove.bind(this))}render(){const e=document.queryCommandSupported("copy"),t=this.model.copy?e?u.Locale.alertCopy:u.Locale.alertClose:u.Locale.alertOk;super.render({btnTitle:t,showToggleButton:this.model.copy,opt:this.gen,hide:this.hide,presets:this.presets,preset:this.preset,showTemplateEditor:!this.model.noTemplateEditor}),this.resultEl=this.$el.find(".gen__result"),this.$el.css(this.model.pos),this.generate()}createPresets(){if(this.presets=r.GeneratorPresets.enabled,!this.model.password||this.model.password.isProtected&&!this.model.password.byteLength){const e=this.presets.filter((e=>e.default))[0]||this.presets[0];this.preset=e.name}else{const e={name:"Derived",title:u.Locale.genPresetDerived};Object.assign(e,l.PasswordGenerator.deriveOpts(this.model.password)),this.presets.splice(0,0,e),this.preset="Derived"}this.presets.forEach((e=>{e.pseudoLength=this.lengthToPseudoValue(e.length)}))}lengthToPseudoValue(e){for(let t=0;t=e)return t;return this.valuesMap.length-1}showPassword(){this.hide&&!this.model.copy?this.resultEl.text(c.PasswordPresenter.present(this.password.length)):this.resultEl.text(this.password)}click(e){e.stopPropagation()}lengthChange(e){const t=this.valuesMap[e.target.value];t!==this.gen.length&&(this.gen.length=t,this.$el.find(".gen__length-range-val").text(t),this.optionChanged("length"),this.generate())}checkChange(e){const t=m(e.target).data("id");t&&(this.gen[t]=e.target.checked),this.optionChanged(t),this.generate()}optionChanged(e){"Custom"===this.preset||"Pronounceable"===this.preset&&["length","lower","upper"].indexOf(e)>=0||(this.preset=this.gen.name="Custom",this.$el.find(".gen__sel-tpl").val(""))}generate(){this.password=l.PasswordGenerator.generate(this.gen),this.showPassword();const e=this.password.length>32;this.resultEl.toggleClass("gen__result--long-pass",e)}hideChange(e){this.hide=e.target.checked,a.AppSettingsModel.generatorHidePassword=this.hide;const t=this.$el.find(".gen__check-hide-label");d.Tip.updateTip(t[0],{title:this.hide?u.Locale.genShowPass:u.Locale.genHidePass}),this.showPassword()}btnOkClick(){o.CopyPaste.simpleCopy||o.CopyPaste.createHiddenInput(this.password),o.CopyPaste.copy(this.password),this.emit("result",this.password),this.remove()}presetChange(e){const t=e.target.value;if("..."===t)return s.Events.emit("edit-generator-presets"),void this.remove();this.preset=t;const n=this.presets.find((e=>e.name===t));this.gen=Object.assign({},n),this.render()}newPass(){this.generate()}}},5984:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GrpView:()=>h});var i=n(7779),s=n(7201),r=n(3898),o=n(7015),a=n(2385),l=n(3872),c=n(3399),u=n.n(c),d=n(6718);class h extends i.View{constructor(...e){super(...e),this.parent=".app__panel",this.template=u(),this.events={"click .grp__icon":"showIconsSelect","click .grp__buttons-trash":"moveToTrash","click .back-button":"returnToApp","input #grp__field-title":"changeTitle","focus #grp__field-auto-type-seq":"focusAutoTypeSeq","input #grp__field-auto-type-seq":"changeAutoTypeSeq","change #grp__check-search":"setEnableSearching","change #grp__check-auto-type":"setEnableAutoType"}}render(){this.removeSubView(),super.render({title:this.model.title,icon:this.model.icon||"folder",customIcon:this.model.customIcon,enableSearching:this.model.getEffectiveEnableSearching(),readonly:this.model.top,canAutoType:r.AutoType.enabled,autoTypeSeq:this.model.autoTypeSeq,autoTypeEnabled:this.model.getEffectiveEnableAutoType(),defaultAutoTypeSeq:this.model.getParentEffectiveAutoTypeSeq()}),this.model.title||this.$el.find("#grp__field-title").focus(),this.createScroll({root:this.$el.find(".grp")[0],scroller:this.$el.find(".scroller")[0],bar:this.$el.find(".scroller__bar")[0]}),this.pageResized()}removeSubView(){this.views.sub&&(this.views.sub.remove(),delete this.views.sub)}changeTitle(e){const t=d.trim(e.target.value);t?this.model.top||t===this.model.title||this.model.setName(t):this.model.isJustCreated&&(this.model.removeWithoutHistory(),s.Events.emit("edit-group"))}changeAutoTypeSeq(e){const t=e.target,n=d.trim(t.value);r.AutoType.validate(null,n,(t=>{d(e.target).toggleClass("input--error",!!t),t||this.model.setAutoTypeSeq(n)}))}focusAutoTypeSeq(e){this.views.hint||(this.views.hint=new a.AutoTypeHintView({input:e.target}),this.views.hint.render(),this.views.hint.on("remove",(()=>{delete this.views.hint})))}showIconsSelect(){if(this.views.sub)this.removeSubView();else{const e=new l.IconSelectView({iconId:this.model.customIconId||this.model.iconId,file:this.model.file},{parent:this.$el.find(".grp__icons")[0]});this.listenTo(e,"select",this.iconSelected),e.render(),this.views.sub=e}this.pageResized()}iconSelected(e){e.custom?e.id!==this.model.customIconId&&this.model.setCustomIcon(e.id):e.id!==this.model.iconId&&this.model.setIcon(+e.id),this.render()}moveToTrash(){this.model.moveToTrash(),s.Events.emit("select-all")}setEnableSearching(e){const t=e.target.checked;this.model.setEnableSearching(t)}setEnableAutoType(e){const t=e.target.checked;this.model.setEnableAutoType(t)}returnToApp(){s.Events.emit("edit-group")}}Object.assign(h.prototype,o.Scrollable)},3872:(e,t,n)=>{"use strict";n.r(t),n.d(t,{IconSelectView:()=>u});var i=n(7779),s=n(353),r=n(2363),o=n(5203),a=n.n(o),l=n(6718);const c=new r.Logger("icon-select-view");class u extends i.View{constructor(...e){super(...e),this.template=a(),this.events={"click .icon-select__icon":"iconClick","click .icon-select__icon-download":"downloadIcon","click .icon-select__icon-select":"selectIcon","change .icon-select__file-input":"iconSelected"},this.special={select:null,download:null}}render(){super.render({sel:this.model.iconId,icons:s.IconMap,canDownloadFavicon:!!this.model.url,customIcons:this.model.file.getCustomIcons()})}iconClick(e){const t=l(e.target).closest(".icon-select__icon"),n=t[0].getAttribute("data-val");if("special"===n){const n=this.special[t.data("special")];if(n){const t=this.model.file.addCustomIcon(n.data);this.emit("select",{id:t,custom:!0}),e.preventDefault(),e.stopImmediatePropagation()}}else if(n){const e=t.hasClass("icon-select__icon-custom");this.emit("select",{id:n,custom:e})}}downloadIcon(){if(this.downloadingFavicon)return;this.downloadingFavicon=!0,this.$el.find(".icon-select__icon-download>i").addClass("spin"),this.$el.find(".icon-select__icon-download").addClass("icon-select__icon--progress").removeClass("icon-select__icon--download-error");const e=this.getIconUrl(!0),t=document.createElement("img");t.crossOrigin="Anonymous",t.src=e,t.onload=()=>{this.setSpecialImage(t,"download"),this.$el.find(".icon-select__icon-download img").remove(),this.$el.find(".icon-select__icon-download>i").removeClass("spin"),this.$el.find(".icon-select__icon-download").removeClass("icon-select__icon--progress").addClass("icon-select__icon--custom-selected").append(t),this.downloadingFavicon=!1},t.onerror=t=>{c.error("Favicon download error: "+e,t),this.$el.find(".icon-select__icon-download>i").removeClass("spin"),this.$el.find(".icon-select__icon-download").removeClass("icon-select__icon--custom-selected icon-select__icon--progress").addClass("icon-select__icon--download-error"),this.downloadingFavicon=!1}}getIconUrl(e){if(!this.model.url)return null;let t=this.model.url.replace(/([^\/:]\/.*)?$/,(e=>(e&&e[0])+"/favicon.ico"));return t.indexOf("://")<0&&(t="http://"+t),e?"https://services.keeweb.info/favicon/"+t.replace(/^.*:\/+/,"").replace(/\/.*/,""):t}selectIcon(){this.$el.find(".icon-select__file-input").click()}iconSelected(e){const t=e.target.files[0];if(t){const e=new FileReader;e.onload=e=>{const t=document.createElement("img");t.onload=()=>{this.setSpecialImage(t,"select"),this.$el.find(".icon-select__icon-select img").remove(),this.$el.find(".icon-select__icon-select").addClass("icon-select__icon--custom-selected").append(t)},t.src=e.target.result},e.readAsDataURL(t)}else this.$el.find(".icon-select__icon-select img").remove(),this.$el.find(".icon-select__icon-select").removeClass("icon-select__icon--custom-selected")}setSpecialImage(e,t){const n=Math.min(e.width,32),i=document.createElement("canvas"),s=i.getContext("2d");i.width=n,i.height=n,s.drawImage(e,0,0,n,n);const r=i.toDataURL().replace(/^.*,/,"");this.special[t]={width:e.width,height:e.height,data:r}}}},97:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ImportCsvView:()=>u});var i=n(3617),s=n.n(i),r=n(7779),o=n(7015),a=n(789),l=n.n(a),c=n(7725);class u extends r.View{constructor(e,t){super(e,t),this.parent=".app__body",this.template=l(),this.events={"click .back-button":"returnToApp","click .import-csv__button-cancel":"returnToApp","click .import-csv__button-run":"runImport","change .import-csv__field-select":"changeMapping","change .import-csv__target-select":"changeGroup"},this.knownFields=[{field:"Title",re:/title|\bname|account/i},{field:"UserName",re:/user|login/i},{field:"Password",re:/pass/i},{field:"URL",re:/url|site/i},{field:"Notes",re:/notes|comment|extra/i}],this.fieldMapping=[],this.targetGroup=void 0,this.appModel=t.appModel,this.fileName=t.fileName,this.guessFieldMapping(),this.fillGroups(),this.initScroll()}render(){super.render({headers:this.model.headers,rows:this.model.rows,fieldMapping:this.fieldMapping,groups:this.groups}),this.createScroll({root:this.$el.find(".import-csv__body")[0],scroller:this.$el.find(".import-csv__body > .scroller")[0],bar:this.$el.find(".import-csv__body > .scroller__bar-wrapper > .scroller__bar")[0]}),this.pageResized(),this.scroll._update||(this.scroll._update=this.scroll.update,this.scroll.update=this.scrollUpdate.bind(this))}scrollUpdate(){this.scroller.css({width:"auto",minWidth:"auto",maxWidth:"auto"}),this.scroll._update()}returnToApp(){this.emit("cancel")}changeMapping(e){const t=+e.target.dataset.col,n=e.target.value,i=this.knownFields.some((e=>e.field===n)),s=n?i?"builtin":"custom":"ignore";if(this.fieldMapping[t]={mapping:s,field:n},n){let e=0;for(const i of this.fieldMapping){if(i.field===n&&t!==e){i.type="ignore",i.field="";this.el.querySelector(`.import-csv__field-select[data-col="${e}"]`).value=""}e++}}}guessFieldMapping(){const e={};for(const t of this.model.headers.map((e=>e.trim()))){if(!t||/^(group|grouping)$/i.test(t)){this.fieldMapping.push({type:"ignore"});continue}let n=!1;for(const{field:i,re:s}of this.knownFields)if(!e[i]&&s.test(t)){this.fieldMapping.push({type:"builtin",field:i}),e[i]=!0,n=!0;break}n||this.fieldMapping.push({type:"custom",field:t})}}fillGroups(){this.groups=[];for(const e of this.appModel.files)e.forEachGroup((t=>{const n=t.title,i=[];for(let e=t;e.parentGroup;e=e.parentGroup)i.push(" "," ");this.groups.push({id:t.id,fileId:e.id,spaces:i,title:n})}))}changeGroup(e){const t=e.target.value;if(!t)return void(this.targetGroup=void 0);const n=e.target.querySelector(`option[value="${t}"]`).dataset.file,i=this.appModel.files.get(n);this.targetGroup=i.getGroup(t)}runImport(){let e=this.targetGroup,t=e?e.file:void 0;if(!e){const n=this.fileName.replace(/\.csv$/i,"");t=this.appModel.createNewFile(n),e=t.groups[0]}for(const n of this.model.rows){const i=c.EntryModel.newEntry(e,t);for(let e=0;e{"use strict";n.r(t),n.d(t,{KeyChangeView:()=>d});var i=n(7779),s=n(6892),r=n(4530),o=n(2977),a=n(3297),l=n(7609),c=n(9215),u=n.n(c);class d extends i.View{constructor(e){super(e),this.parent=".app__body",this.template=u(),this.events={"keydown .key-change__pass":"inputKeydown","keydown .key-change__pass-repeat":"inputKeydown","click .key-change__keyfile":"keyFileClicked","change .key-change__file":"keyFileSelected","click .key-change__btn-ok":"accept","click .key-change__btn-cancel":"cancel"},this.passwordInput=null,this.passwordRepeatInput=null,this.inputEl=null,this.passwordInput=new s.SecureInput}render(){this.keyFileName=this.model.file.keyFileName||null,this.keyFileData=null;const e=this.model.expired;super.render({fileName:this.model.file.name,keyFileName:this.model.file.keyFileName,title:this.model.expired?a.Locale.keyChangeTitleExpired:a.Locale.keyChangeTitleRemote,message:this.model.expired?a.Locale.keyChangeMessageExpired:a.Locale.keyChangeMessageRemote,repeat:e}),this.$el.find(".key-change__keyfile-name").text(this.keyFileName?": "+this.keyFileName:""),this.inputEl=this.$el.find(".key-change__pass"),this.passwordInput.reset(),this.passwordInput.setElement(this.inputEl),this.inputEl.focus(),e&&(this.passwordRepeatInput=new s.SecureInput,this.passwordRepeatInput.reset(),this.passwordRepeatInput.setElement(this.$el.find(".key-change__pass-repeat")))}inputKeydown(e){e.which===o.Keys.DOM_VK_RETURN&&this.accept()}keyFileClicked(){this.keyFileName&&(this.keyFileName=null,this.keyFile=null,this.$el.find(".key-change__keyfile-name").empty()),this.$el.find(".key-change__file").val(null).click(),this.inputEl.focus()}keyFileSelected(e){const t=e.target.files[0];if(t){const e=new FileReader;e.onload=e=>{this.keyFileName=t.name,this.keyFileData=e.target.result,this.$el.find(".key-change__keyfile-name").text(": "+this.keyFileName)},e.onerror=()=>{r.Alerts.error({header:a.Locale.openFailedRead})},e.readAsArrayBuffer(t)}else this.$el.find(".key-change__keyfile-name").empty();this.inputEl.focus()}accept(){return this.passwordInput.value.byteLength?(this.passwordInput.el.removeClass("input--error"),this.passwordRepeatInput&&!this.passwordRepeatInput.value.equals(this.passwordInput.value)?(this.passwordRepeatInput.el.addClass("input--error"),this.passwordRepeatInput.el.focus(),void l.InputFx.shake(this.passwordRepeatInput.el)):void this.emit("accept",{file:this.model.file,expired:this.model.expired,password:this.passwordInput.value,keyFileName:this.keyFileName,keyFileData:this.keyFileData})):(this.passwordInput.el.focus(),this.passwordRepeatInput.el.addClass("input--error"),void l.InputFx.shake(this.passwordInput.el))}cancel(){this.emit("cancel")}}},248:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ListSearchView:()=>g});var i=n(7779),s=n(7201),r=n(7027),o=n(1164),a=n(2977),l=n(8612),c=n(667),u=n(2378),d=n(3297),h=n(1434),p=n(3917),m=n.n(p),f=n(6718);class g extends i.View{constructor(e){super(e),this.parent=".list__header",this.template=m(),this.events={"keydown .list__search-field":"inputKeyDown","keypress .list__search-field":"inputKeyPress","input .list__search-field":"inputChange","focus .list__search-field":"inputFocus","click .list__search-btn-new":"createOptionsClick","click .list__search-btn-sort":"sortOptionsClick","click .list__search-icon-search":"advancedSearchClick","click .list__search-btn-menu":"toggleMenu","change .list__search-adv input[type=checkbox]":"toggleAdvCheck"},this.inputEl=null,this.sortOptions=null,this.sortIcons=null,this.createOptions=null,this.advancedSearchEnabled=!1,this.advancedSearch=null,this.sortOptions=[{value:"title",icon:"sort-alpha-down",loc:()=>u.StringFormat.capFirst(d.Locale.title)+" "+this.addArrow(d.Locale.searchAZ)},{value:"-title",icon:"sort-alpha-down-alt",loc:()=>u.StringFormat.capFirst(d.Locale.title)+" "+this.addArrow(d.Locale.searchZA)},{value:"website",icon:"sort-alpha-down",loc:()=>u.StringFormat.capFirst(d.Locale.website)+" "+this.addArrow(d.Locale.searchAZ)},{value:"-website",icon:"sort-alpha-down-alt",loc:()=>u.StringFormat.capFirst(d.Locale.website)+" "+this.addArrow(d.Locale.searchZA)},{value:"user",icon:"sort-alpha-down",loc:()=>u.StringFormat.capFirst(d.Locale.user)+" "+this.addArrow(d.Locale.searchAZ)},{value:"-user",icon:"sort-alpha-down-alt",loc:()=>u.StringFormat.capFirst(d.Locale.user)+" "+this.addArrow(d.Locale.searchZA)},{value:"created",icon:"sort-numeric-down",loc:()=>d.Locale.searchCreated+" "+this.addArrow(d.Locale.searchON)},{value:"-created",icon:"sort-numeric-down-alt",loc:()=>d.Locale.searchCreated+" "+this.addArrow(d.Locale.searchNO)},{value:"updated",icon:"sort-numeric-down",loc:()=>d.Locale.searchUpdated+" "+this.addArrow(d.Locale.searchON)},{value:"-updated",icon:"sort-numeric-down-alt",loc:()=>d.Locale.searchUpdated+" "+this.addArrow(d.Locale.searchNO)},{value:"-attachments",icon:"sort-amount-down",loc:()=>d.Locale.searchAttachments},{value:"-rank",icon:"sort-amount-down",loc:()=>d.Locale.searchRank}],this.sortIcons={},this.sortOptions.forEach((e=>{this.sortIcons[e.value]=e.icon})),this.advancedSearch={user:!0,other:!0,url:!0,protect:!1,notes:!0,pass:!1,cs:!1,regex:!1,history:!1,title:!0},this.model.advancedSearch&&(this.advancedSearch=Object.assign({},this.model.advancedSearch)),this.setLocale(),this.onKey(a.Keys.DOM_VK_F,this.findKeyPress,o.KeyHandler.SHORTCUT_ACTION),this.onKey(a.Keys.DOM_VK_N,this.newKeyPress,o.KeyHandler.SHORTCUT_OPT),this.onKey(a.Keys.DOM_VK_DOWN,this.downKeyPress),this.onKey(a.Keys.DOM_VK_UP,this.upKeyPress),this.listenTo(this,"show",this.viewShown),this.listenTo(this,"hide",this.viewHidden),this.listenTo(s.Events,"filter",this.filterChanged),this.listenTo(s.Events,"set-locale",this.setLocale),this.listenTo(s.Events,"page-blur",this.pageBlur),this.listenTo(this.model.files,"change",this.fileListUpdated),this.once("remove",(()=>{this.removeKeypressHandler()}))}setLocale(){this.sortOptions.forEach((e=>{e.text=e.loc()})),this.createOptions=[{value:"entry",icon:"key",text:u.StringFormat.capFirst(d.Locale.entry),hint:c.Features.isMobile?null:`(${d.Locale.searchShiftClickOr} ${r.Shortcuts.altShortcutSymbol(!0)})`},{value:"group",icon:"folder",text:u.StringFormat.capFirst(d.Locale.group)}],this.el&&this.render()}pageBlur(){this.inputEl.blur()}removeKeypressHandler(){}viewShown(){const e=e=>this.documentKeyPress(e);s.Events.on("keypress",e),this.removeKeypressHandler=()=>s.Events.off("keypress",e)}viewHidden(){this.removeKeypressHandler()}render(){let e;this.inputEl&&(e=this.inputEl.val()),super.render({adv:this.advancedSearch,advEnabled:this.advancedSearchEnabled,canCreate:this.model.canCreateEntries()}),this.inputEl=this.$el.find(".list__search-field"),e&&this.inputEl.val(e)}inputKeyDown(e){switch(e.which){case a.Keys.DOM_VK_UP:case a.Keys.DOM_VK_DOWN:break;case a.Keys.DOM_VK_RETURN:e.target.blur();break;case a.Keys.DOM_VK_ESCAPE:this.inputEl.val()&&(this.inputEl.val(""),this.inputChange()),e.target.blur();break;default:return}e.preventDefault()}inputKeyPress(e){e.stopPropagation()}inputChange(){s.Events.emit("add-filter",{text:this.inputEl.val()})}inputFocus(e){f(e.target).select()}documentKeyPress(e){if(this.hidden)return;const t=e.charCode;t&&(this.hideSearchOptions(),this.inputEl.val(String.fromCharCode(t)).focus(),this.inputEl[0].setSelectionRange(1,1),this.inputChange(),e.preventDefault())}findKeyPress(e){this.hidden||(e.preventDefault(),this.hideSearchOptions(),this.inputEl.select().focus())}newKeyPress(e){this.hidden||(e.preventDefault(),this.hideSearchOptions(),this.emit("create-entry"))}downKeyPress(e){e.preventDefault(),this.hideSearchOptions(),this.emit("select-next")}upKeyPress(e){e.preventDefault(),this.hideSearchOptions(),this.emit("select-prev")}filterChanged(e){this.hideSearchOptions(),e.filter.text!==this.inputEl.val()&&this.inputEl.val(e.text||"");const t=this.sortIcons[e.sort]||"sort";this.$el.find(".list__search-btn-sort>i").attr("class","fa fa-"+t);let n=!!e.filter.advanced;this.model.advancedSearch&&(n=e.filter.advanced!==this.model.advancedSearch),this.advancedSearchEnabled!==n&&(this.advancedSearchEnabled=n,this.$el.find(".list__search-adv").toggleClass("hide",!this.advancedSearchEnabled))}createOptionsClick(e){if(e.stopImmediatePropagation(),e.shiftKey)return this.hideSearchOptions(),void this.emit("create-entry");this.toggleCreateOptions()}sortOptionsClick(e){this.toggleSortOptions(),e.stopImmediatePropagation()}advancedSearchClick(){this.advancedSearchEnabled=!this.advancedSearchEnabled,this.$el.find(".list__search-adv").toggleClass("hide",!this.advancedSearchEnabled);let e=!1;this.advancedSearchEnabled?e=this.advancedSearch:this.model.advancedSearch&&(e=this.model.advancedSearch),s.Events.emit("add-filter",{advanced:e})}toggleMenu(){s.Events.emit("toggle-menu")}toggleAdvCheck(e){const t=f(e.target).data("id");this.advancedSearch[t]=e.target.checked,s.Events.emit("add-filter",{advanced:this.advancedSearch})}hideSearchOptions(){this.views.searchDropdown&&(this.views.searchDropdown.remove(),this.views.searchDropdown=null,this.$el.find(".list__search-btn-sort,.list__search-btn-new").removeClass("sel--active"))}toggleSortOptions(){if(this.views.searchDropdown&&this.views.searchDropdown.isSort)return void this.hideSearchOptions();this.hideSearchOptions(),this.$el.find(".list__search-btn-sort").addClass("sel--active");const e=new h.DropdownView;e.isSort=!0,this.listenTo(e,"cancel",this.hideSearchOptions),this.listenTo(e,"select",this.sortDropdownSelect),this.sortOptions.forEach((function(e){e.active=this.model.sort===e.value}),this),e.render({position:{top:this.$el.find(".list__search-btn-sort")[0].getBoundingClientRect().bottom,right:this.$el[0].getBoundingClientRect().right+1},options:this.sortOptions}),this.views.searchDropdown=e}toggleCreateOptions(){if(this.views.searchDropdown&&this.views.searchDropdown.isCreate)return void this.hideSearchOptions();this.hideSearchOptions(),this.$el.find(".list__search-btn-new").addClass("sel--active");const e=new h.DropdownView;e.isCreate=!0,this.listenTo(e,"cancel",this.hideSearchOptions),this.listenTo(e,"select",this.createDropdownSelect),e.render({position:{top:this.$el.find(".list__search-btn-new")[0].getBoundingClientRect().bottom,right:this.$el[0].getBoundingClientRect().right+1},options:this.createOptions.concat(this.getCreateEntryTemplateOptions())}),this.views.searchDropdown=e}getCreateEntryTemplateOptions(){const e=this.model.getEntryTemplates(),t=this.model.files.length>1;this.entryTemplates={};const n=[];return e.forEach((e=>{const i="tmpl:"+e.entry.id;n.push({value:i,icon:e.entry.icon,text:t?e.file.name+" / "+e.entry.title:e.entry.title}),this.entryTemplates[i]=e})),n.sort(l.Comparators.stringComparator("text",!0)),n.push({value:"tmpl",icon:"sticky-note-o",text:u.StringFormat.capFirst(d.Locale.template)}),n}sortDropdownSelect(e){this.hideSearchOptions(),s.Events.emit("set-sort",e.item)}createDropdownSelect(e){switch(this.hideSearchOptions(),e.item){case"entry":this.emit("create-entry");break;case"group":this.emit("create-group");break;case"tmpl":this.emit("create-template");break;default:this.entryTemplates[e.item]&&this.emit("create-entry",{template:this.entryTemplates[e.item]})}}addArrow(e){return e.replace("{}","→")}fileListUpdated(){this.render()}}},7780:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ListView:()=>C});var i=n(7779),s=n(7201),r=n(6491),o=n(9207),a=n(4530),l=n(7614),c=n(9938),u=n(2378),d=n(3297),h=n(8892),p=n(7015),m=n(1434),f=n(248),g=n(3493),A=n.n(g),y=n(902),v=n.n(y),b=n(1530),w=n.n(b),k=n(6718);class C extends i.View{constructor(e,t){super(e,t),this.parent=".app__list",this.template=v(),this.emptyTemplate=w(),this.events={click:"click","click .list__table-options":"tableOptionsClick","dragstart .list__item":"itemDragStart"},this.minWidth=200,this.minHeight=200,this.maxWidth=500,this.maxHeight=500,this.itemsEl=null,this.tableColumns=[{val:"title",name:"title",enabled:!0},{val:"user",name:"user",enabled:!0},{val:"url",name:"website",enabled:!0},{val:"tags",name:"tags",enabled:!0},{val:"notes",name:"notes",enabled:!0},{val:"groupName",name:"group",enabled:!1},{val:"fileName",name:"file",enabled:!1}],this.throttleSetViewSizeSetting=A()((e=>{l.AppSettingsModel.listViewWidth=e}),1e3),this.initScroll(),this.views.search=new f.ListSearchView(this.model),this.listenTo(this.views.search,"select-prev",this.selectPrev),this.listenTo(this.views.search,"select-next",this.selectNext),this.listenTo(this.views.search,"create-entry",this.createEntry),this.listenTo(this.views.search,"create-group",this.createGroup),this.listenTo(this.views.search,"create-template",this.createTemplate),this.listenTo(this,"show",this.viewShown),this.listenTo(this,"hide",this.viewHidden),this.listenTo(this,"view-resize",this.viewResized),this.listenTo(s.Events,"filter",this.filterChanged),this.listenTo(s.Events,"entry-updated",this.entryUpdated),this.listenTo(s.Events,"set-locale",this.render),this.listenTo(this.model.settings,"change:tableView",this.setTableView),this.readTableColumnsEnabled(),this.items=new r.SearchResultCollection}render(){if(this.itemsEl||(super.render(),this.itemsEl=this.$el.find(".list__items>.scroller"),this.views.search.render(),this.setTableView(),this.createScroll({root:this.$el.find(".list__items")[0],scroller:this.$el.find(".scroller")[0],bar:this.$el.find(".scroller__bar")[0]})),this.items.length){const e=this.getItemTemplate(),t=this.getItemsTemplate(),n=l.AppSettingsModel.colorfulIcons?"":"grayscale",s=new c.EntryPresenter(this.getDescField(),n,this.model.activeEntryId),r={};this.tableColumns.forEach((e=>{e.enabled&&(r[e.val]=!0)})),s.columns=r;let o="";this.items.forEach((t=>{s.present(t),o+=e(s,i.DefaultTemplateOptions)}),this);const a=t({itemsHtml:o,columns:this.tableColumns},i.DefaultTemplateOptions);this.itemsEl.html(a)}else this.itemsEl.html(this.emptyTemplate({},i.DefaultTemplateOptions));this.pageResized()}getItemsTemplate(){return this.model.settings.tableView?n(616):this.renderPlainItems}renderPlainItems(e){return e.itemsHtml}getItemTemplate(){return this.model.settings.tableView?n(1448):n(8140)}getDescField(){return this.model.sort.replace("-","")}click(e){const t=e.target.closest(".list__item");if(!t)return;const n=t.id,i=this.items.get(n);i.active||this.selectItem(i),s.Events.emit("toggle-details",!0)}selectPrev(){const e=this.items.indexOf(this.items.get(this.model.activeEntryId));e>0&&this.selectItem(this.items[e-1])}selectNext(){const e=this.items.indexOf(this.items.get(this.model.activeEntryId));e{this.model.settings.templateHelpShown=!0,this.createTemplate()}});const e=this.model.createNewTemplateEntry();this.items.unshift(e),this.render(),this.selectItem(e)}selectItem(e){this.model.activeEntryId=e.id,s.Events.emit("entry-selected",e),this.itemsEl.find(".list__item--active").removeClass("list__item--active");const t=document.getElementById(e.id);t.classList.add("list__item--active");const n=this.itemsEl[0],i=t.getBoundingClientRect(),r=n.getBoundingClientRect();i.topr.bottom&&(n.scrollTop+=i.bottom-r.bottom)}viewShown(){this.views.search.show()}viewHidden(){this.views.search.hide()}setTableView(){const e=this.model.settings.tableView;this.dragView.setCoord(e?"y":"x"),this.setDefaultSize()}setDefaultSize(){this.setSize(this.model.settings.listViewWidth)}setSize(e){this.$el.css({width:"auto",height:"auto"}),e?this.$el.css("flex","0 0 "+e+"px"):this.$el.css("flex","")}viewResized(e){this.setSize(e),this.throttleSetViewSizeSetting(e)}filterChanged(e){this.items=e.entries,this.render()}entryUpdated(){const e=this.itemsEl[0].scrollTop;this.render(),this.itemsEl[0].scrollTop=e}itemDragStart(e){e.stopPropagation();const t=k(e.target).closest(".list__item").attr("id");e.dataTransfer.setData("text/entry",t),e.dataTransfer.effectAllowed="move",o.DragDropInfo.dragObject=this.items.get(t)}tableOptionsClick(e){if(e.stopImmediatePropagation(),this.views.optionsDropdown)return void this.hideOptionsDropdown();const t=new m.DropdownView;this.listenTo(t,"cancel",this.hideOptionsDropdown),this.listenTo(t,"select",this.optionsDropdownSelect);const n=this.$el.find(".list__table-options")[0].getBoundingClientRect(),i=this.tableColumns.map((e=>({value:e.val,icon:e.enabled?"check-square-o":"square-o",text:u.StringFormat.capFirst(d.Locale[e.name])})));t.render({position:{top:n.bottom,left:n.left},options:i}),this.views.optionsDropdown=t}hideOptionsDropdown(){this.views.optionsDropdown&&(this.views.optionsDropdown.remove(),delete this.views.optionsDropdown)}optionsDropdownSelect(e){const t=this.tableColumns.find((t=>t.val===e.item));t.enabled=!t.enabled,e.el.find("i:first").toggleClass("fa-check-square-o fa-square-o"),this.render(),this.saveTableColumnsEnabled()}readTableColumnsEnabled(){const e=l.AppSettingsModel.tableViewColumns;e&&e.length&&this.tableColumns.forEach((t=>{t.enabled=e.indexOf(t.name)>=0}))}saveTableColumnsEnabled(){const e=this.tableColumns.filter((e=>e.enabled)).map((e=>e.name));l.AppSettingsModel.tableViewColumns=e}}Object.assign(C.prototype,h.Resizable),Object.assign(C.prototype,p.Scrollable)},9676:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ListWrapView:()=>s});var i=n(7779);class s extends i.View{constructor(e,t){super(e,t),this.parent=".app__list-wrap",this.template=()=>"",this.events={},this.listenTo(this.model.settings,"change:tableView",this.setListLayout)}render(){super.render(),this.setListLayout()}setListLayout(){const e=!!this.model.settings.tableView;this.el.classList.toggle("app__list-wrap--table",e)}}},1956:(e,t,n)=>{"use strict";n.r(t),n.d(t,{MenuItemView:()=>p});var i=n(7201),s=n(7779),r=n(9207),o=n(1164),a=n(4530),l=n(2977),c=n(3297),u=n(9325),d=n.n(u),h=n(6718);class p extends s.View{constructor(e,t){super(e,t),this.template=d(),this.events={mouseover:"mouseover",mouseout:"mouseout","click .menu__item-option":"selectOption",click:"selectItem",dblclick:"expandItem","click .menu__item-edit":"editItem","click .menu__item-empty-trash":"emptyTrash",dragstart:"dragstart",dragover:"dragover",dragleave:"dragleave",drop:"drop","dragover .menu__item-drag-top":"dragoverTop","dragleave .menu__item-drag-top":"dragleaveTop"},this.iconEl=null,this.itemViews=[],this.listenTo(this.model,"change:title",this.changeTitle),this.listenTo(this.model,"change:icon",this.changeIcon),this.listenTo(this.model,"change:customIconId",this.render),this.listenTo(this.model,"change:active",this.changeActive),this.listenTo(this.model,"change:expanded",this.changeExpanded),this.listenTo(this.model,"change:cls",this.changeCls),this.listenTo(this.model,"change:iconCls",this.changeIconCls),this.listenTo(this.model,"delete",this.remove),this.listenTo(this.model,"insert",this.insertItem);const n=this.model.shortcut;n&&(this.onKey(n,this.selectItem,o.KeyHandler.SHORTCUT_OPT),n!==l.Keys.DOM_VK_C&&this.onKey(n,this.selectItem,o.KeyHandler.SHORTCUT_ACTION)),this.once("remove",(()=>{this.removeInnerViews()}))}render(){this.removeInnerViews(),super.render(this.model),this.model.options&&(window.model=this.model),this.iconEl=this.$el.find(".menu__item-icon");const e=this.model.items;e&&e.forEach((e=>{e.visible&&this.insertItem(e)})),this.$el.toggleClass("menu__item--collapsed",!this.model.expanded)}insertItem(e){const t=new p(e,{parent:this.el});t.render(),this.itemViews.push(t)}removeInnerViews(){this.itemViews.forEach((e=>e.remove())),this.itemViews=[]}changeTitle(e,t){this.$el.find(".menu__item-title").first().text(t||"(no title)")}changeIcon(e,t){this.iconEl[0].className="menu__item-icon fa "+(t?"fa-"+t:"menu__item-icon--no-icon")}changeActive(e,t){this.$el.toggleClass("menu__item--active",t)}changeExpanded(e,t){this.$el.toggleClass("menu__item--collapsed",!t),this.model.setExpanded(t)}changeCls(e,t,n){n&&this.$el.removeClass(n),this.$el.addClass(t)}changeIconCls(e,t,n){const i=this.el.querySelector(".menu__item-icon");n&&i.classList.remove(n),t&&i.classList.add(t)}mouseover(e){e.button||(this.$el.addClass("menu__item--hover"),e.stopPropagation())}mouseout(e){this.$el.removeClass("menu__item--hover"),e.stopPropagation()}selectItem(e){e.stopPropagation(),e.preventDefault(),this.model.active||(this.model.disabled?a.Alerts.info(this.model.disabled):i.Events.emit("menu-select",{item:this.model}))}selectOption(e){const t=this.model.options,n=h(e.target).data("value");if(t&&t.length){const e=t.find((e=>e.value===n));e&&i.Events.emit("menu-select",{item:this.model,option:e})}e.stopImmediatePropagation(),e.preventDefault()}expandItem(e){this.model.toggleExpanded&&this.model.toggleExpanded(),e.stopPropagation()}editItem(e){if(this.model.active&&this.model.editable)switch(e.stopPropagation(),this.model.filterKey){case"tag":i.Events.emit("edit-tag",this.model);break;case"group":i.Events.emit("edit-group",this.model)}}emptyTrash(e){e.stopPropagation(),a.Alerts.yesno({header:c.Locale.menuEmptyTrashAlert,body:c.Locale.menuEmptyTrashAlertBody,icon:"minus-circle",success(){i.Events.emit("empty-trash")}})}dropAllowed(e){const t=e.dataTransfer.types;for(let e=0;e{"use strict";n.r(t),n.d(t,{MenuSectionView:()=>h});var i=n(7779),s=n(7614),r=n(8892),o=n(7015),a=n(1956),l=n(3493),c=n.n(l),u=n(1833),d=n.n(u);class h extends i.View{constructor(e,t){super(e,t),this.template=d(),this.events={},this.itemViews=[],this.minHeight=55,this.autoHeight="auto",this.saveViewHeight=c()((e=>{s.AppSettingsModel.tagsViewHeight=e}),1e3),this.listenTo(this.model,"change-items",this.itemsChanged),this.listenTo(this,"view-resize",this.viewResized),this.once("remove",(()=>{this.scroll&&this.scroll.dispose(),this.removeInnerViews()}))}render(){if(this.itemsEl?this.removeInnerViews():(super.render(this.model),this.itemsEl=this.model.scrollable?this.$el.find(".scroller"):this.$el,this.model.scrollable&&(this.initScroll(),this.createScroll({root:this.$el[0],scroller:this.$el.find(".scroller")[0],bar:this.$el.find(".scroller__bar")[0]}))),this.model.items.forEach((e=>{const t=new a.MenuItemView(e,{parent:this.itemsEl[0]});t.render(),this.itemViews.push(t)})),this.model.drag){const e=s.AppSettingsModel.tagsViewHeight;"number"==typeof e&&(this.$el.height(),this.$el.css("flex","0 0 "+e+"px"))}this.pageResized()}maxHeight(){return this.$el.parent().height()-116}removeInnerViews(){this.itemViews.forEach((e=>e.remove())),this.itemViews=[]}itemsChanged(){this.render()}viewResized(e){this.$el.css("flex","0 0 "+(e?e+"px":"auto")),this.saveViewHeight(e)}}Object.assign(h.prototype,r.Resizable),Object.assign(h.prototype,o.Scrollable)},6498:(e,t,n)=>{"use strict";n.r(t),n.d(t,{MenuView:()=>g});var i=n(7201),s=n(7779),r=n(1164),o=n(2977),a=n(7614),l=n(8892),c=n(1864),u=n(913),d=n(3493),h=n.n(d),p=n(8565),m=n.n(p),f=n(6718);class g extends s.View{constructor(e,t){super(e,t),this.parent=".app__menu",this.template=m(),this.events={},this.sectionViews=[],this.minWidth=130,this.maxWidth=300,this.viewResized=h()((e=>{a.AppSettingsModel.menuViewWidth=e}),1e3),this.listenTo(this.model,"change:sections",this.menuChanged),this.listenTo(this,"view-resize",this.viewResized),this.onKey(o.Keys.DOM_VK_UP,this.selectPreviousSection,r.KeyHandler.SHORTCUT_ACTION+r.KeyHandler.SHORTCUT_OPT),this.onKey(o.Keys.DOM_VK_DOWN,this.selectNextSection,r.KeyHandler.SHORTCUT_ACTION+r.KeyHandler.SHORTCUT_OPT),this.once("remove",(()=>{this.sectionViews.forEach((e=>e.remove())),this.sectionViews=[]}))}render(){super.render();const e=this.$el.find(".menu");this.model.sections.forEach((function(t){const n=new u.MenuSectionView(t,{parent:e[0]});if(n.render(),t.drag){const t=f("").addClass("menu__drag-section").appendTo(e),i=new c.DragView("y",{parent:t[0]});n.listenDrag(i),i.render(),this.sectionViews.push(i)}this.sectionViews.push(n)}),this),"number"==typeof a.AppSettingsModel.menuViewWidth&&this.$el.width(a.AppSettingsModel.menuViewWidth)}menuChanged(){this.render()}switchVisibility(e){this.$el.toggleClass("menu-visible",e)}selectPreviousSection(){i.Events.emit("select-previous-menu-item")}selectNextSection(){i.Events.emit("select-next-menu-item")}}Object.assign(g.prototype,l.Resizable)},5266:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ModalView:()=>l});var i=n(7779),s=n(2977),r=n(1877),o=n.n(r),a=n(6718);class l extends i.View{constructor(e){super(e),this.parent="body",this.modal="alert",this.template=o(),this.events={"click .modal__buttons button":"buttonClick",click:"bodyClick"},"string"==typeof this.model.esc&&this.onKey(s.Keys.DOM_VK_ESCAPE,this.escPressed,!1,"alert"),"string"==typeof this.model.enter&&this.onKey(s.Keys.DOM_VK_RETURN,this.enterPressed,!1,"alert"),this.once("remove",(()=>{this.model.view&&this.model.view.remove()}))}render(){super.render(Object.assign({},this.model,{body:this.model.body?this.model.body.toString().split("\n"):""})),this.$el.addClass("modal--hidden"),setTimeout((()=>{this.$el.removeClass("modal--hidden"),document.activeElement.blur()}),20),this.model.view&&(this.model.view.parent=".modal__body",this.model.view.render())}change(e){e.header&&this.$el.find(".modal__header").text(e.header)}buttonClick(e){const t=a(e.target).data("result");this.closeWithResult(t)}bodyClick(e){"string"!=typeof this.model.click||e.target.matches("button")||this.closeWithResult(this.model.click)}escPressed(){this.closeWithResult(this.model.esc)}enterPressed(e){e.stopImmediatePropagation(),e.preventDefault(),this.closeWithResult(this.model.enter)}closeWithResult(e){const t=this.model.checkbox?this.$el.find("#modal__check").is(":checked"):void 0;this.emit("will-close"),this.emit("result",e,t),this.removeView()}closeWithoutResult(){this.emit("will-close"),this.removeView()}removeView(){this.$el.addClass("modal--hidden"),this.unbindEvents(),setTimeout((()=>this.remove()),100)}closeImmediate(){this.emit("will-close"),this.emit("result",void 0),this.unbindEvents(),this.remove()}}},5634:(e,t,n)=>{"use strict";n.r(t),n.d(t,{OpenChalRespView:()=>d});var i=n(7201),s=n(7779),r=n(9777),o=n(667),a=n(3297),l=n(403),c=n(7913),u=n.n(c);class d extends s.View{constructor(){super(),this.template=u(),this.events={"click .open-chal-resp__item":"itemClick"},this.listenTo(i.Events,"usb-devices-changed",this.usbDevicesChanged),this.checkDevices()}render(){let e=this.error;const t=this.yubiKeys&&!this.yubiKeys.length;t&&(e=a.Locale.openChalRespErrorEmpty),super.render({error:e,showEmptyMacWarning:t&&o.Features.isMac,yubiKeys:this.yubiKeys,loading:!this.yubiKeys&&!this.error})}usbDevicesChanged(){setTimeout((()=>{this.removed||this.checkDevices()}),l.Timeouts.ExternalDeviceAfterReconnect)}checkDevices(){r.YubiKey.list(((e,t)=>{if(!this.removed){if(this.error=e,this.yubiKeys=[],t)for(const{fullName:e,vid:n,pid:i,serial:s,slots:r}of t)for(const t of r.filter((e=>e.valid)))this.yubiKeys.push({fullName:e,vid:n,pid:i,serial:s,slot:t.number});this.render()}}))}itemClick(e){const t=e.target.closest("[data-serial]"),n=+t.dataset.vid,i=+t.dataset.pid,s=+t.dataset.serial,r=+t.dataset.slot;this.emit("select",{vid:n,pid:i,serial:s,slot:r})}}},9408:(e,t,n)=>{"use strict";n.r(t),n.d(t,{OpenConfigView:()=>l});var i=n(7779),s=n(2977),r=n(3297),o=n(5010),a=n.n(o);class l extends i.View{constructor(...e){super(...e),this.template=a(),this.events={"click .open__config-btn-cancel":"cancel","click .open__config-btn-ok":"apply","input input":"changeInput","keyup input":"keyup"}}render(){super.render(this.model),this.$el.find(":input:first").focus(),this.checkValidity()}cancel(){this.emit("cancel")}apply(){const e=this.getData();e&&this.emit("apply",e)}changeInput(){this.checkValidity()}keyup(e){e.which===s.Keys.DOM_VK_RETURN&&this.apply()}checkValidity(){const e=this.getData();this.$el.find(".open__config-btn-ok").prop("disabled",!e)}getData(){let e={storage:this.model.id};return this.model.fields.every((function(t){const n=this.$el.find("#open__config-field-"+t.id)[0];return e&&n.checkValidity()?(e[t.id]=n.value,!0):(e=null,!1)}),this),e}setDisabled(e){e=!!e,this.$el.find(":input:not(.open__config-btn-cancel)").prop("disabled",e),this.$el.toggleClass("open__config--disabled",e),e&&this.$el.find(".open__config-error").text("")}setError(e){const t=e&&e.notFound?r.Locale.openConfigErrorNotFound:r.Locale.openConfigError.replace("{}",e);this.$el.find(".open__config-error").text(t)}}},2791:(e,t,n)=>{"use strict";n.r(t),n.d(t,{OpenView:()=>D});var i=n(3617),s=n.n(i),r=n(7779),o=n(7201),a=n(949),l=n(2596),c=n(9053),u=n(1164),d=n(6892),h=n(9491),p=n(4530),m=n(8647),f=n(9777),g=n(2977),A=n(8612),y=n(667),v=n(4798),b=n(3297),w=n(2363),k=n(7609),C=n(9408),_=n(4902),E=n(5634),I=n(6838),S=n(1473),x=n(3467),B=n.n(x),T=n(6718);const P=new w.Logger("open-view");class D extends r.View{constructor(e){super(e),this.parent=".app__body",this.modal="open",this.template=B(),this.events={"change .open__file-ctrl":"fileSelected","click .open__icon-open":"openFile","click .open__icon-new":"createNew","click .open__icon-demo":"createDemo","click .open__icon-yubikey":"openYubiKey","click .open__icon-more":"toggleMore","click .open__icon-storage":"openStorage","click .open__icon-settings":"openSettings","click .open__pass-input[readonly]":"openFile","input .open__pass-input":"inputInput","keydown .open__pass-input":"inputKeydown","keyup .open__pass-input":"inputKeyup","keypress .open__pass-input":"inputKeypress","click .open__pass-enter-btn":"openDb","click .open__settings-key-file":"openKeyFile","click .open__settings-yubikey":"selectYubiKeyChalResp","click .open__last-item":"openLast","click .open__icon-generate":"toggleGenerator",dragover:"dragover",dragleave:"dragleave",drop:"drop"},this.params=null,this.passwordInput=null,this.busy=!1,this.currentSelectedIndex=-1,window.$=T,this.resetParams(),this.passwordInput=new d.SecureInput,this.onKey(g.Keys.DOM_VK_Z,this.undoKeyPress,u.KeyHandler.SHORTCUT_ACTION,"open"),this.onKey(g.Keys.DOM_VK_TAB,this.tabKeyPress,null,"open"),this.onKey(g.Keys.DOM_VK_ENTER,this.enterKeyPress,null,"open"),this.onKey(g.Keys.DOM_VK_RETURN,this.enterKeyPress,null,"open"),this.onKey(g.Keys.DOM_VK_DOWN,this.moveOpenFileSelectionDown,null,"open"),this.onKey(g.Keys.DOM_VK_UP,this.moveOpenFileSelectionUp,null,"open"),this.listenTo(o.Events,"main-window-focus",this.windowFocused.bind(this)),this.listenTo(o.Events,"usb-devices-changed",this.usbDevicesChanged.bind(this)),this.once("remove",(()=>{this.passwordInput.reset()})),this.listenTo(o.Events,"user-idle",this.userIdle)}render(){this.dragTimeout&&clearTimeout(this.dragTimeout);const e=[];this.model.settings.canOpenStorage&&Object.keys(a.Storage).forEach((t=>{const n=a.Storage[t];!n.system&&n.enabled&&e.push(n)})),e.sort(((e,t)=>(e.uipos||1/0)-(t.uipos||1/0)));const t=e.length||this.model.settings.canOpenSettings||this.model.settings.canOpenGenerator,n=!(t||this.model.settings.canOpen||this.model.settings.canCreate||this.model.settings.canOpenDemo&&!this.model.settings.demoOpened),i=!!m.UsbListener.attachedYubiKeys,s=i&&this.model.settings.canOpenOtpDevice&&this.model.settings.yubiKeyShowIcon&&!this.model.files.get("yubikey"),r=i&&this.model.settings.yubiKeyShowChalResp;super.render({lastOpenFiles:this.getLastOpenFiles(),canOpenKeyFromDropbox:!h.Launcher&&a.Storage.dropbox.enabled,demoOpened:this.model.settings.demoOpened,storageProviders:e,canOpen:this.model.settings.canOpen,canOpenDemo:this.model.settings.canOpenDemo,canOpenSettings:this.model.settings.canOpenSettings,canOpenGenerator:this.model.settings.canOpenGenerator,canCreate:this.model.settings.canCreate,canRemoveLatest:this.model.settings.canRemoveLatest,canOpenYubiKey:s,canUseChalRespYubiKey:r,showMore:t,showLogo:n}),this.inputEl=this.$el.find(".open__pass-input"),this.passwordInput.setElement(this.inputEl)}resetParams(){this.params={id:null,name:"",storage:null,path:null,keyFileName:null,keyFileData:null,keyFilePath:null,fileData:null,rev:null,opts:null,chalResp:null}}windowFocused(){this.inputEl.focus()}focusInput(e){!c.FocusDetector.hasFocus()||!e&&y.Features.isMobile||this.inputEl.focus()}getLastOpenFiles(){return this.model.fileInfos.map((e=>{let t="file-alt";const n=a.Storage[e.storage];return n&&n.icon&&(t=n.icon),{id:e.id,name:e.name,path:this.getDisplayedPath(e),icon:t}}))}getDisplayedPath(e){const t=e.storage;return"file"===t||"webdav"===t?e.path:null}showLocalFileAlert(){this.model.settings.skipOpenLocalWarn||p.Alerts.alert({header:b.Locale.openLocalFile,body:b.Locale.openLocalFileBody,icon:"file-alt",buttons:[{result:"skip",title:b.Locale.openLocalFileDontShow,error:!0},{result:"ok",title:b.Locale.alertOk}],click:"",esc:"",enter:"",success:e=>{this.focusInput(),"skip"===e&&(this.model.settings.skipOpenLocalWarn=!0)}})}fileSelected(e){const t=e.target.files[0];t&&this.processFile(t,(e=>{e&&!t.path&&"fileData"===this.reading&&this.showLocalFileAlert()}))}processFile(e,t){const n=new FileReader;n.onload=n=>{let i=!1;switch(this.reading){case"fileData":switch(this.getOpenFileFormat(n.target.result)){case"kdbx":this.params.id=null,this.params.fileData=n.target.result,this.params.name=e.name.replace(/(.+)\.\w+$/i,"$1"),this.params.path=e.path||null,this.params.storage=e.path?"file":null,this.params.rev=null,this.params.keyFileData||(this.params.keyFileName=null),this.displayOpenFile(),this.displayOpenKeyFile(),i=!0;break;case"xml":this.params.id=null,this.params.fileXml=s().ByteUtils.bytesToString(n.target.result),this.params.name=e.name.replace(/\.\w+$/i,""),this.params.path=null,this.params.storage=null,this.params.rev=null,this.importDbWithXml(),i=!0;break;case"kdb":p.Alerts.error({header:b.Locale.openWrongFile,body:b.Locale.openKdbFileBody});break;default:p.Alerts.error({header:b.Locale.openWrongFile,body:b.Locale.openWrongFileBody})}break;case"keyFileData":this.params.keyFileData=n.target.result,this.params.keyFileName=e.name,"path"===this.model.settings.rememberKeyFiles&&(this.params.keyFilePath=e.path),this.displayOpenKeyFile(),i=!0}t&&t(i)},n.onerror=()=>{p.Alerts.error({header:b.Locale.openFailedRead}),t&&t(!1)},"fileXml"===this.reading?n.readAsText(e):n.readAsArrayBuffer(e)}getOpenFileFormat(e){if(e.byteLength<8)return;const t=new Uint32Array(e,0,2);if(t[0]===s().Consts.Signatures.FileMagic)return t[1]===s().Consts.Signatures.Sig2Kdb?"kdb":t[1]===s().Consts.Signatures.Sig2Kdbx?"kdbx":void 0;if(this.model.settings.canImportXml)try{if(s().ByteUtils.bytesToString(t).trim().startsWith("{e&&t&&(this.reading="keyFileData",this.processFile(t)),e&&"function"==typeof n&&n()}))}openFile(){!1!==this.model.settings.canOpen&&(this.busy||(this.closeConfig(),this.openAny("fileData")))}openKeyFile(e){T(e.target).hasClass("open__settings-key-file-dropbox")?this.openKeyFileFromDropbox():!this.busy&&this.params.name&&(this.params.keyFileName?(this.params.keyFileData=null,this.params.keyFilePath=null,this.params.keyFileName="",this.$el.removeClass("open--key-file"),this.$el.find(".open__settings-key-file-name").text(b.Locale.openKeyFile)):this.openAny("keyFileData"))}openKeyFileFromDropbox(){this.busy||new l.DropboxChooser(((e,t)=>{e||(this.params.keyFileData=t.data,this.params.keyFileName=t.name,this.displayOpenKeyFile())})).choose()}openAny(e,t){this.reading=e,this.params[e]=null;const n=this.$el.find(".open__file-ctrl").attr("accept",t||"").val(null);h.Launcher&&h.Launcher.openFileChooser?h.Launcher.openFileChooser(((e,t)=>{e?P.error("Error opening file chooser",e):this.processFile(t)})):n.click()}openLast(e){if(this.busy)return;const t=T(e.target).closest(".open__last-item").data("id").toString();if(T(e.target).is(".open__last-item-icon-del")){const e=this.model.fileInfos.get(t);return!e.storage||e.modified?void p.Alerts.yesno({header:b.Locale.openRemoveLastQuestion,body:e.modified?b.Locale.openRemoveLastQuestionModBody:b.Locale.openRemoveLastQuestionBody,buttons:[{result:"yes",title:b.Locale.alertYes},{result:"",title:b.Locale.alertNo}],success:()=>{this.removeFile(t)}}):void this.removeFile(t)}const n=this.model.fileInfos.get(t);this.showOpenFileInfo(n,!0)}removeFile(e){this.model.removeFileInfo(e),this.$el.find('.open__last-item[data-id="'+e+'"]').remove(),this.resetParams(),this.render()}inputKeydown(e){const t=e.keyCode||e.which;t===g.Keys.DOM_VK_RETURN?this.openDb():t===g.Keys.DOM_VK_CAPS_LOCK&&this.toggleCapsLockWarning(!1)}inputKeyup(e){(e.keyCode||e.which)===g.Keys.DOM_VK_CAPS_LOCK&&this.toggleCapsLockWarning(!1)}inputKeypress(e){const t=e.keyCode||e.which,n=String.fromCharCode(t),i=n.toLowerCase();i===n.toUpperCase()||e.shiftKey||this.toggleCapsLockWarning(n!==i)}toggleCapsLockWarning(e){this.$el.find(".open__pass-warning").toggleClass("invisible",!e)}dragover(e){if(!1===this.model.settings.canOpen)return;e.preventDefault(),e.stopPropagation();const t=e.dataTransfer;t.types&&(t.types.indexOf?-1!==t.types.indexOf("Files"):t.types.contains("Files"))?(t.dropEffect="copy",this.dragTimeout&&clearTimeout(this.dragTimeout),this.$el.hasClass("open--drag")||this.$el.addClass("open--drag")):t.dropEffect="none"}dragleave(){!1!==this.model.settings.canOpen&&(this.dragTimeout&&clearTimeout(this.dragTimeout),this.dragTimeout=setTimeout((()=>{this.$el.removeClass("open--drag")}),100))}drop(e){if(!1===this.model.settings.canOpen)return;if(e.preventDefault(),this.busy)return;this.dragTimeout&&clearTimeout(this.dragTimeout),this.closeConfig(),this.$el.removeClass("open--drag");const t=[...e.target.files||e.dataTransfer.files],n=t.find((e=>/\.kdbx$/i.test(e.name))),i=t.find((e=>/\.keyx?$/i.test(e.name)));if(n)this.setFile(n,i,n.path?null:this.showLocalFileAlert.bind(this));else{if(this.model.settings.canImportXml){const e=t.find((e=>/\.xml$/i.test(e.name)));if(e)return void this.setFile(e,null,this.showLocalFileAlert.bind(this))}if(this.model.settings.canImportCsv){const e=t.find((e=>/\.csv$/i.test(e.name)));e&&o.Events.emit("import-csv-requested",e)}}}undoKeyPress(e){e.preventDefault()}tabKeyPress(){this.$el.addClass("open--show-focus")}enterKeyPress(e){const t=this.$el.find("[tabindex]:focus");t.length&&t.trigger("click",e)}showOpenFileInfo(e,t){!this.busy&&e&&(this.params.id=e.id,this.params.storage=e.storage,this.params.path=e.path,this.params.name=e.name,this.params.fileData=null,this.params.rev=null,this.params.keyFileName=e.keyFileName,this.params.keyFilePath=e.keyFilePath,this.params.keyFileData=null,this.params.opts=e.opts,this.params.chalResp=e.chalResp,this.displayOpenFile(),this.displayOpenKeyFile(),this.displayOpenChalResp(),this.openFileWithFingerprint(e),t&&this.focusInput(!0))}showOpenLocalFile(e,t){if(!this.busy&&(this.params.id=null,this.params.storage="file",this.params.path=e,this.params.name=e.match(/[^/\\]*$/)[0],this.params.rev=null,this.params.fileData=null,this.displayOpenFile(),t)){const e=h.Launcher.parsePath(t);this.params.keyFileName=e.file,this.params.keyFilePath=t,this.params.keyFileData=null,this.displayOpenKeyFile()}}openFileWithFingerprint(e){e.fingerprint&&h.Launcher&&h.Launcher.fingerprints&&h.Launcher.fingerprints.auth(e.id,e.fingerprint,(e=>{this.inputEl.val(e),this.inputEl.trigger("input"),this.openDb()}))}createDemo(){this.busy||(this.closeConfig(),this.model.createDemoFile()||this.emit("close"),this.model.settings.demoOpened||(this.model.settings.demoOpened=!0))}createNew(){this.busy||this.model.createNewFile()}openDb(){this.params.id&&this.model.files.get(this.params.id)?this.emit("close"):!this.busy&&this.params.name&&(this.$el.toggleClass("open--opening",!0),this.inputEl.attr("disabled","disabled"),this.busy=!0,this.params.password=this.passwordInput.value,this.afterPaint((()=>{this.model.openFile(this.params,(e=>this.openDbComplete(e)))})))}openDbComplete(e){this.busy=!1,this.$el.toggleClass("open--opening",!1),this.inputEl.removeAttr("disabled").toggleClass("input--error",!!e),e?(P.error("Error opening file",e),this.focusInput(!0),this.inputEl[0].selectionStart=0,this.inputEl[0].selectionEnd=this.inputEl.val().length,"InvalidKey"===e.code?k.InputFx.shake(this.inputEl):e.userCanceled||(e.notFound&&(e=b.Locale.openErrorFileNotFound),p.Alerts.error({header:b.Locale.openError,body:b.Locale.openErrorDescription,pre:this.errorToString(e)}))):this.emit("close")}importDbWithXml(){!this.busy&&this.params.name&&(this.$el.toggleClass("open--opening",!0),this.inputEl.attr("disabled","disabled"),this.busy=!0,this.afterPaint((()=>this.model.importFileWithXml(this.params,(e=>{e&&(this.params.name="",this.params.fileXml=null),this.openDbComplete(e)})))))}toggleMore(){this.busy||(this.closeConfig(),this.$el.find(".open__icons--lower").toggleClass("hide"))}openSettings(){o.Events.emit("toggle-settings")}openStorage(e){if(this.busy)return;const t=a.Storage[T(e.target).closest(".open__icon").data("storage")];t&&(t.needShowOpenConfig&&t.needShowOpenConfig()?this.showConfig(t):t.list?this.listStorage(t):p.Alerts.notImplemented())}listStorage(e,t){if(this.busy)return;this.closeConfig();const n=this.$el.find(".open__icon-storage[data-storage="+e.name+"]");this.busy=!0,n.toggleClass("flip3d",!0),e.list(t&&t.dir,((i,s)=>{if(n.toggleClass("flip3d",!1),this.busy=!1,i||!s){if("browser-auth-started"===(i=i?i.toString():""))return;return void(0===i.lastIndexOf("OAuth",0)||p.Alerts.alertDisplayed||p.Alerts.error({header:b.Locale.openError,body:b.Locale.openListErrorBody,pre:i.toString()}))}if(!s.length)return void p.Alerts.error({header:b.Locale.openNothingFound,body:b.Locale.openNothingFoundBody});const r=A.Comparators.stringComparator("path",!0);s.sort(((e,t)=>e.dir!==t.dir?!!t.dir-!!e.dir:r(e,t))),t&&t.dir&&s.unshift({path:t.prevDir,name:"..",dir:!0});const o=new _.StorageFileListView({files:s});o.on("selected",(n=>{n.dir?this.listStorage(e,{dir:n.path,prevDir:t&&t.dir||""}):this.openStorageFile(e,n)})),p.Alerts.alert({header:b.Locale.openSelectFile,body:b.Locale.openSelectFileBody,icon:e.icon||"file-alt",buttons:[{result:"",title:b.Locale.alertCancel}],esc:"",click:"",view:o})}))}openStorageFile(e,t){this.busy||(this.params.id=null,this.params.storage=e.name,this.params.path=t.path,this.params.name=v.UrlFormat.getDataFileName(t.name),this.params.rev=t.rev,this.params.fileData=null,this.displayOpenFile())}showConfig(e){if(this.busy)return;this.views.openConfig&&this.views.openConfig.remove();const t=Object.assign({id:e.name,name:b.Locale[e.name]||e.name,icon:e.icon,buttons:!0},e.getOpenConfig());this.views.openConfig=new C.OpenConfigView(t,{parent:".open__config-wrap"}),this.views.openConfig.on("cancel",this.closeConfig.bind(this)),this.views.openConfig.on("apply",this.applyConfig.bind(this)),this.views.openConfig.render(),this.$el.find(".open__pass-area").addClass("hide"),this.$el.find(".open__icons--lower").addClass("hide")}closeConfig(){this.busy&&(this.storageWaitId=null,this.busy=!1),this.views.openConfig&&(this.views.openConfig.remove(),delete this.views.openConfig),this.$el.find(".open__pass-area").removeClass("hide"),this.$el.find(".open__config").addClass("hide"),this.focusInput()}applyConfig(e){if(this.busy||!e)return;this.busy=!0,this.views.openConfig.setDisabled(!0);const t=a.Storage[e.storage];this.storageWaitId=Math.random();const n=e.path,i=(0,I.omit)(e,["path","storage"]),s={waitId:this.storageWaitId,storage:e.storage,path:n,opts:i};t.applyConfig?t.applyConfig(i,this.storageApplyConfigComplete.bind(this,s)):t.stat(n,i,this.storageStatComplete.bind(this,s))}storageApplyConfigComplete(e,t){this.storageWaitId===e.waitId&&(this.storageWaitId=null,this.busy=!1,t?(this.views.openConfig.setDisabled(!1),this.views.openConfig.setError(t)):this.closeConfig())}storageStatComplete(e,t,n){this.storageWaitId===e.waitId&&(this.storageWaitId=null,this.busy=!1,t?(this.views.openConfig.setDisabled(!1),this.views.openConfig.setError(t)):(this.closeConfig(),this.params.id=null,this.params.storage=e.storage,this.params.path=e.path,this.params.opts=e.opts,this.params.name=v.UrlFormat.getDataFileName(e.path),this.params.rev=n.rev,this.params.fileData=null,this.displayOpenFile()))}moveOpenFileSelection(e){const t=this.getLastOpenFiles();this.currentSelectedIndex+e>=0&&this.currentSelectedIndex+e<=t.length-1&&(this.currentSelectedIndex=this.currentSelectedIndex+e);if(!t[this.currentSelectedIndex])return;const n=this.model.fileInfos.get(t[this.currentSelectedIndex].id);this.showOpenFileInfo(n)}moveOpenFileSelectionDown(){this.moveOpenFileSelection(1)}moveOpenFileSelectionUp(){this.moveOpenFileSelection(-1)}toggleGenerator(e){if(e.stopPropagation(),this.views.gen)return void this.views.gen.remove();const t=this.$el.find(".open__icon-generate")[0].getBoundingClientRect(),n={left:t.left,top:t.top};y.Features.isMobile&&(n.left="50vw",n.top="50vh",n.transform="translate(-50%, -50%)");const i=new S.GeneratorView({copy:!0,noTemplateEditor:!0,pos:n});i.render(),i.once("remove",(()=>{delete this.views.gen})),this.views.gen=i}userIdle(){this.inputEl.val(""),this.passwordInput.reset(),this.passwordInput.setElement(this.inputEl)}usbDevicesChanged(){if(this.model.settings.canOpenOtpDevice){const e=!!m.UsbListener.attachedYubiKeys,t=e&&this.model.settings.yubiKeyShowIcon;this.$el.find(".open__icon-yubikey").toggleClass("hide",!t);const n=e&&this.model.settings.yubiKeyShowChalResp;this.$el.find(".open__settings-yubikey").toggleClass("open__settings-yubikey--present",!!n),!e&&this.busy&&this.otpDevice&&this.otpDevice.cancelOpen()}}openYubiKey(){if(this.busy&&this.otpDevice&&this.otpDevice.cancelOpen(),!this.busy){this.busy=!0,this.inputEl.attr("disabled","disabled");const e=this.$el.find(".open__icon-yubikey");e.toggleClass("flip3d",!0),f.YubiKey.checkToolStatus().then((t=>{if("ok"!==t)return e.toggleClass("flip3d",!1),this.inputEl.removeAttr("disabled"),this.busy=!1,o.Events.emit("toggle-settings","devices");this.otpDevice=this.model.openOtpDevice((t=>{t&&!f.YubiKey.aborted&&p.Alerts.error({header:b.Locale.openError,body:b.Locale.openErrorDescription,pre:this.errorToString(t)}),this.otpDevice=null,e.toggleClass("flip3d",!1),this.inputEl.removeAttr("disabled"),this.busy=!1}))}))}}selectYubiKeyChalResp(){if(this.busy)return;if(this.params.chalResp)return this.params.chalResp=null,this.el.querySelector(".open__settings-yubikey").classList.remove("open__settings-yubikey--active"),void this.focusInput();const e=new E.OpenChalRespView;e.on("select",(({vid:e,pid:t,serial:n,slot:i})=>{this.params.chalResp={vid:e,pid:t,serial:n,slot:i},this.el.querySelector(".open__settings-yubikey").classList.add("open__settings-yubikey--active"),this.focusInput()})),p.Alerts.alert({header:b.Locale.openChalRespHeader,icon:"usb-token",buttons:[{result:"",title:b.Locale.alertCancel}],esc:"",click:"",view:e})}errorToString(e){const t=e.toString();return t!=={}.toString()?t:e.ykError&&e.code?b.Locale.yubiKeyErrorWithCode.replace("{}",e.code):void 0}}},1127:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsAboutView:()=>c});var i=n(7779),s=n(7119),r=n(9673),o=n(667),a=n(5225),l=n.n(a);class c extends i.View{constructor(...e){super(...e),this.template=l()}render(){super.render({version:s.RuntimeInfo.version,licenseLink:r.Links.License,licenseLinkApache:r.Links.LicenseApache,licenseLinkCCBY40:r.Links.LicenseLinkCCBY40,repoLink:r.Links.Repo,donationLink:r.Links.Donation,isDesktop:o.Features.isDesktop})}}},9646:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsDevicesView:()=>d});var i=n(7201),s=n(7779),r=n(7614),o=n(9777),a=n(9673),l=n(8647),c=n(6013),u=n.n(c);class d extends s.View{constructor(...e){super(...e),this.template=u(),this.events={"change .settings__devices-enable-usb":"changeEnableUsb","change .settings__yubikey-show-icon":"changeYubiKeyShowIcon","change .settings__yubikey-auto-open":"changeYubiKeyAutoOpen","change .settings__yubikey-match-entries":"changeYubiKeyMatchEntries","change .settings__yubikey-chalresp-show":"changeYubiKeyShowChalResp","change .settings__yubikey-remember-chalresp":"changeYubiKeyRememberChalResp","change .settings__yubikey-stuck-workaround":"changeYubiKeyStuckWorkaround"},["ok","checking"].includes(o.YubiKey.ykmanStatus)||(this.toolCheckPromise=o.YubiKey.checkToolStatus())}render(){this.toolCheckPromise&&(this.toolCheckPromise.then((()=>this.render())),this.toolCheckPromise=void 0),super.render({supported:l.UsbListener.supported,enableUsb:l.UsbListener.supported&&r.AppSettingsModel.enableUsb,ykmanStatus:o.YubiKey.ykmanStatus,yubiKeyShowIcon:r.AppSettingsModel.yubiKeyShowIcon,yubiKeyAutoOpen:r.AppSettingsModel.yubiKeyAutoOpen,yubiKeyMatchEntries:r.AppSettingsModel.yubiKeyMatchEntries,yubiKeyShowChalResp:r.AppSettingsModel.yubiKeyShowChalResp,yubiKeyRememberChalResp:r.AppSettingsModel.yubiKeyRememberChalResp,yubiKeyStuckWorkaround:r.AppSettingsModel.yubiKeyStuckWorkaround,yubiKeyManualLink:a.Links.YubiKeyManual,ykmanInstallLink:a.Links.YubiKeyManagerInstall})}changeEnableUsb(e){r.AppSettingsModel.enableUsb=e.target.checked,this.render()}changeYubiKeyShowIcon(e){r.AppSettingsModel.yubiKeyShowIcon=e.target.checked,this.render()}changeYubiKeyAutoOpen(e){r.AppSettingsModel.yubiKeyAutoOpen=e.target.checked,this.render()}changeYubiKeyMatchEntries(e){r.AppSettingsModel.yubiKeyMatchEntries=e.target.checked,this.render(),i.Events.emit("refresh")}changeYubiKeyShowChalResp(e){r.AppSettingsModel.yubiKeyShowChalResp=e.target.checked,this.render()}changeYubiKeyRememberChalResp(e){r.AppSettingsModel.yubiKeyRememberChalResp=e.target.checked,this.render()}changeYubiKeyStuckWorkaround(e){r.AppSettingsModel.yubiKeyStuckWorkaround=e.target.checked,this.render()}}},1219:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsFileExternalView:()=>a});var i=n(7779),s=n(7201),r=n(1299),o=n.n(r);class a extends i.View{constructor(...e){super(...e),this.template=o(),this.events={"click .settings__file-button-settings":"openDevicesSettings","click .settings__file-button-close":"closeFile"}}render(){super.render({name:this.model.name,deviceClassName:this.model.deviceClassName})}openDevicesSettings(){s.Events.emit("toggle-settings","devices")}closeFile(){this.appModel.closeFile(this.model)}}},1500:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsFileView:()=>I});var i=n(3617),s=n.n(i),r=n(7779),o=n(949),a=n(7027),l=n(9491),c=n(4530),u=n(9777),d=n(8647),h=n(9673),p=n(7614),m=n(6098),f=n(4798),g=n(1705),A=n(3297),y=n(667),v=n(2547),b=n(9408),w=n(6838),k=n(2507),C=n.n(k),_=n(6718);const E="Backups/{name}.{date}.bak";class I extends r.View{constructor(e,t){super(e,t),this.template=C(),this.yubiKeys=[],this.events={"click .settings__file-button-save-default":"saveDefault","click .settings__file-button-save-choose":"toggleChooser","click .settings__file-button-close":"closeFile","click .settings__file-save-to-file":"saveToFile","click .settings__file-save-to-xml":"saveToXml","click .settings__file-save-to-html":"saveToHtml","click .settings__file-save-to-storage":"saveToStorage","change #settings__file-key-file":"keyFileChange","click #settings__file-file-select-link":"triggerSelectFile","change #settings__file-file-select":"fileSelected","focus #settings__file-master-pass":"focusMasterPass","input #settings__file-master-pass":"changeMasterPass","blur #settings__file-master-pass":"blurMasterPass","focus #settings__file-confirm-master-pass":"focusConfirmMasterPass","blur #settings__file-confirm-master-pass":"blurConfirmMasterPass","input #settings__file-name":"changeName","input #settings__file-def-user":"changeDefUser","change #settings__file-backup-enabled":"changeBackupEnabled","input #settings__file-backup-path":"changeBackupPath","change #settings__file-backup-storage":"changeBackupStorage","change #settings__file-backup-schedule":"changeBackupSchedule","click .settings__file-button-backup":"backupFile","change #settings__file-trash":"changeTrash","change #settings__file-hist-type":"changeHistoryMode","input #settings__file-hist-len":"changeHistoryLength","input #settings__file-hist-size":"changeHistorySize","change #settings__file-format-version":"changeFormatVersion","change #settings__file-kdf":"changeKdf","input #settings__file-key-rounds":"changeKeyRounds","input #settings__file-key-change-force":"changeKeyChangeForce","input .settings__input-kdf":"changeKdfParameter","change #settings__file-yubikey":"changeYubiKey"};const n=["syncing","syncError","syncDate"];for(const e of n)this.listenTo(this.model,"change:"+e,(()=>{setTimeout((()=>this.render()),0)}));this.refreshYubiKeys(!1)}render(){const e=[],t=this.model.storage;let n=!1;Object.keys(o.Storage).forEach((i=>{const s=o.Storage[i];!n&&s.backup&&s.enabled&&(n=!0),!s.system&&s.enabled&&e.push({name:s.name,icon:s.icon,own:i===t,backup:s.backup})})),e.sort(((e,t)=>(e.uipos||1/0)-(t.uipos||1/0)));const i=this.model.backup,s=this.model.chalResp?`${this.model.chalResp.serial}:${this.model.chalResp.slot}`:"",r=!!this.model.chalResp||l.Launcher&&p.AppSettingsModel.enableUsb&&p.AppSettingsModel.yubiKeyShowChalResp,c=[];if(r){for(const e of this.yubiKeys)for(const t of e.slots.filter((e=>e.valid)))c.push({value:`${e.serial}:${t.number}`,fullName:e.fullName,vid:e.vid,pid:e.pid,serial:e.serial,slot:t.number});s&&!c.some((e=>e.value===s))&&c.push({value:s,fullName:`YubiKey ${this.model.chalResp.serial}`,vid:this.model.chalResp.vid,pid:this.model.chalResp.pid,serial:this.model.chalResp.serial,slot:this.model.chalResp.slot})}super.render({cmd:a.Shortcuts.actionShortcutSymbol(!0),supportFiles:!!l.Launcher,desktopLink:h.Links.Desktop,name:this.model.name,path:this.model.path,storage:this.model.storage,syncing:this.model.syncing,syncError:this.model.syncError,syncDate:m.DateFormat.dtStr(this.model.syncDate),password:g.PasswordPresenter.present(this.model.passwordLength),defaultUser:this.model.defaultUser,recycleBinEnabled:this.model.recycleBinEnabled,backupEnabled:i&&i.enabled,backupStorage:i&&i.storage,backupPath:i&&i.path||E.replace("{name}",this.model.name),backupSchedule:i?i.schedule:"1w",historyMaxItems:this.model.historyMaxItems,historyMaxSize:Math.round(this.model.historyMaxSize/1024/1024),formatVersion:this.model.formatVersion,kdfName:this.model.kdfName,isArgon2Kdf:this.model.kdfName.startsWith("Argon2"),keyEncryptionRounds:this.model.keyEncryptionRounds,keyChangeForce:this.model.keyChangeForce>0?this.model.keyChangeForce:null,kdfParameters:this.kdfParametersToUi(this.model.kdfParameters),storageProviders:e,canBackup:n,canSaveTo:p.AppSettingsModel.canSaveTo,canExportXml:p.AppSettingsModel.canExportXml,canExportHtml:p.AppSettingsModel.canExportHtml,showYubiKeyBlock:r,selectedYubiKey:s,yubiKeys:c}),this.model.created||(this.$el.find(".settings__file-master-pass-warning").toggle(this.model.passwordChanged),this.$el.find("#settings__file-master-pass-warning-text").text(A.Locale.setFilePassChanged)),this.renderKeyFileSelect()}kdfParametersToUi(e){return e?Object.assign({},e,{memory:Math.round(e.memory/1024)}):null}renderKeyFileSelect(){const e=this.model.keyFileName,t=this.model.oldKeyFileName,n=this.model.keyFileChanged,i=this.$el.find("#settings__file-key-file");if(i.empty(),e&&n){const t="Generated"!==e?A.Locale.setFileUseKeyFile+" "+e:A.Locale.setFileUseGenKeyFile;_("").val("ex").text(t).appendTo(i)}if(t){const e=n?A.Locale.setFileUseOldKeyFile:A.Locale.setFileUseKeyFile+" "+t;_("").val("old").text(e).appendTo(i)}_("").val("gen").text(A.Locale.setFileGenKeyFile).appendTo(i),_("").val("none").text(A.Locale.setFileDontUseKeyFile).appendTo(i),e&&n?i.val("ex"):e?t&&e===t&&!n&&i.val("old"):i.val("none")}validatePassword(e){return!!this.model.passwordLength||(c.Alerts.yesno({header:A.Locale.setFileEmptyPass,body:A.Locale.setFileEmptyPassBody,success:()=>{e()},cancel:()=>{this.$el.find("#settings__file-master-pass").focus()}}),!1)}save(e){if(e||(e={}),e.startedByUser=!0,!e.skipValidation){if(!this.validatePassword((()=>{e.skipValidation=!0,this.save(e)})))return}this.appModel.syncFile(this.model,e)}saveDefault(){this.save()}toggleChooser(){this.$el.find(".settings__file-save-choose").toggleClass("hide")}saveToFile(e){if(!0!==e&&!this.validatePassword(this.saveToFile.bind(this,!0)))return;const t=this.model.name+".kdbx";l.Launcher&&!this.model.storage?l.Launcher.getSaveFileName(t,(e=>{e&&this.save({storage:"file",path:e})})):this.model.getData((e=>{if(e)if(l.Launcher)l.Launcher.getSaveFileName(t,(t=>{t&&o.Storage.file.save(t,null,e,(e=>{e&&c.Alerts.error({header:A.Locale.setFileSaveError,body:A.Locale.setFileSaveErrorBody+" "+t+":",pre:e})}))}));else{const n=new Blob([e],{type:"application/octet-stream"});v.FileSaver.saveAs(n,t)}}))}saveToXml(){c.Alerts.yesno({header:A.Locale.setFileExportRaw,body:A.Locale.setFileExportRawBody,success:()=>{this.model.getXml((e=>{const t=new Blob([e],{type:"text/xml"});v.FileSaver.saveAs(t,this.model.name+".xml")}))}})}saveToHtml(){c.Alerts.yesno({header:A.Locale.setFileExportRaw,body:A.Locale.setFileExportRawBody,success:()=>{this.model.getHtml((e=>{const t=new Blob([e],{type:"text/html"});v.FileSaver.saveAs(t,this.model.name+".html")}))}})}saveToStorage(e){if(this.model.syncing||this.model.demo)return;const t=_(e.target).closest(".settings__file-save-to-storage").data("storage"),n=o.Storage[t];if(n)if(this.model.storage===t)this.save();else{if(!n.list){if(n.getOpenConfig){const e=Object.assign({id:n.name,name:A.Locale[n.name]||n.name,icon:n.icon,buttons:!1},n.getOpenConfig()),i=new b.OpenConfigView(e);c.Alerts.alert({header:"",body:"",icon:n.icon||"file-alt",buttons:[c.Alerts.buttons.ok,c.Alerts.buttons.cancel],esc:"",opaque:!0,view:i,success:()=>{const e=i.getData();if(!e)return;const n=(0,w.omit)(e,["path","storage"]);n&&Object.keys(n).length&&(this.model.opts=n),this.save({storage:t,path:e.path,opts:n})}})}else c.Alerts.notImplemented();return}this.model.syncing=!0,n.list("",((e,i)=>{if(this.model.syncing=!1,e)return;const s=this.model.name.toLowerCase(),r=[...i].find((e=>!e.dir&&f.UrlFormat.getDataFileName(e.name).toLowerCase()===s));r?c.Alerts.yesno({header:A.Locale.setFileAlreadyExists,body:A.Locale.setFileAlreadyExistsBody.replace("{}",this.model.name),success:()=>{this.model.syncing=!0,n.remove(r.path,(e=>{this.model.syncing=!1,e||this.save({storage:t})}))}}):this.save({storage:t})}))}}closeFile(){this.model.modified?c.Alerts.yesno({header:A.Locale.setFileUnsaved,body:A.Locale.setFileUnsavedBody,buttons:[{result:"close",title:A.Locale.setFileCloseNoSave,error:!0},{result:"",title:A.Locale.setFileDontClose}],success:e=>{"close"===e&&this.closeFileNoCheck()}}):this.closeFileNoCheck()}closeFileNoCheck(){this.appModel.closeFile(this.model)}keyFileChange(e){switch(e.target.value){case"old":this.selectOldKeyFile();break;case"gen":this.generateKeyFile();break;case"none":this.clearKeyFile()}}selectOldKeyFile(){this.model.resetKeyFile(),this.renderKeyFileSelect()}generateKeyFile(){this.model.generateAndSetKeyFile().then((e=>{const t=new Blob([e],{type:"application/octet-stream"});v.FileSaver.saveAs(t,this.model.name+".key"),this.renderKeyFileSelect()}))}clearKeyFile(){this.model.removeKeyFile(),this.renderKeyFileSelect()}triggerSelectFile(){this.$el.find("#settings__file-file-select").click()}fileSelected(e){const t=e.target.files[0],n=new FileReader;n.onload=e=>{const n=e.target.result;this.model.setKeyFile(n,t.name),this.renderKeyFileSelect()},n.readAsArrayBuffer(t)}focusMasterPass(e){e.target.value="",e.target.setAttribute("type","text"),this.model.passwordChanged=!1}changeMasterPass(e){e.target.value?(this.$el.find("#settings__file-confirm-master-pass-group").show(),this.$el.find("#settings__file-master-pass-warning-text").text(A.Locale.setFilePassChange),this.model.created||this.$el.find(".settings__file-master-pass-warning").show()):(this.model.resetPassword(),this.$el.find(".settings__file-master-pass-warning").hide())}blurMasterPass(e){e.target.value||(this.model.resetPassword(),this.resetConfirmMasterPass(),e.target.value=g.PasswordPresenter.present(this.model.passwordLength),this.$el.find(".settings__file-master-pass-warning").hide()),e.target.setAttribute("type","password")}resetConfirmMasterPass(){this.$el.find("#settings__file-confirm-master-pass").val(""),this.$el.find("#settings__file-confirm-master-pass-group").hide(),this.$el.find("#settings__file-master-pass-warning-text").text(A.Locale.setFilePassChange)}focusConfirmMasterPass(e){e.target.value="",e.target.setAttribute("type","text")}blurConfirmMasterPass(e){e.target.setAttribute("type","password");const t=this.$el.find("#settings__file-master-pass").val(),n=e.target.value;t===n?(this.$el.find("#settings__file-master-pass-warning-text").text(A.Locale.setFilePassChanged),this.$el.find(".settings__file-confirm-master-pass-warning").hide(),this.model.setPassword(s().ProtectedValue.fromString(n))):(this.$el.find("#settings__file-master-pass-warning-text").text(A.Locale.setFilePassChange),this.$el.find(".settings__file-confirm-master-pass-warning").show(),this.model.resetPassword())}changeName(e){const t=_.trim(e.target.value);t&&this.model.setName(t)}changeDefUser(e){const t=_.trim(e.target.value);this.model.setDefaultUser(t)}changeBackupEnabled(e){const t=e.target.checked;let n=this.model.backup;if(!n){n={enabled:t,schedule:"1w"};const e=E.replace("{name}",this.model.name);l.Launcher?(n.storage="file",n.path=l.Launcher.getDocumentsPath(e)):(n.storage="dropbox",n.path=e),this.$el.find("#settings__file-backup-storage").val(n.storage),this.$el.find("#settings__file-backup-path").val(n.path)}this.$el.find(".settings__file-backups").toggleClass("hide",!t),n.enabled=t,this.setBackup(n)}changeBackupPath(e){const t=this.model.backup;t.path=e.target.value.trim(),this.setBackup(t)}changeBackupStorage(e){const t=this.model.backup;t.storage=e.target.value,this.setBackup(t)}changeBackupSchedule(e){const t=this.model.backup;t.schedule=e.target.value,this.setBackup(t)}setBackup(e){this.model.backup=e,this.appModel.setFileBackup(this.model.id,e)}backupFile(){if(this.backupInProgress)return;const e=this.$el.find(".settings__file-button-backup");e.text(A.Locale.setFileBackupNowWorking),this.model.getData((t=>{if(!t)return this.backupInProgress=!1,void e.text(A.Locale.setFileBackupNow);this.appModel.backupFile(this.model,t,(t=>{if(this.backupInProgress=!1,e.text(A.Locale.setFileBackupNow),t){let e="",n="";t.isDir?(e=A.Locale.setFileBackupErrorIsDir,n=A.Locale.setFileBackupErrorIsDirDescription):(e=A.Locale.setFileBackupError,n=A.Locale.setFileBackupErrorDescription),c.Alerts.error({title:e,body:n,pre:t.toString()})}}))}))}changeTrash(e){this.model.setRecycleBinEnabled(e.target.checked)}changeHistoryLength(e){if(!e.target.validity.valid)return;const t=+e.target.value;isNaN(t)?e.target.value=this.model.historyMaxItems:this.model.setHistoryMaxItems(t)}changeHistoryMode(e){let t=+e.target.value;t>0&&(t=10),this.model.setHistoryMaxItems(t),this.render()}changeHistorySize(e){if(!e.target.validity.valid)return;const t=+e.target.value;isNaN(t)?e.target.value=this.model.historyMaxSize/1024/1024:this.model.setHistoryMaxSize(1024*t*1024)}changeFormatVersion(e){const t=+e.target.value;this.model.setFormatVersion(t),this.render()}changeKdf(e){this.model.setKdf(e.target.value),this.render()}changeKeyRounds(e){if(!e.target.validity.valid)return;const t=+e.target.value;isNaN(t)?e.target.value=this.model.keyEncryptionRounds:this.model.setKeyEncryptionRounds(t)}changeKeyChangeForce(e){if(!e.target.validity.valid)return;let t=Math.round(e.target.value);(isNaN(t)||t<=0)&&(t=-1),this.model.setKeyChange(!0,t)}changeKdfParameter(e){if(!e.target.validity.valid)return;const t=_(e.target).data("field"),n=_(e.target).data("mul")||1,i=e.target.value*n;isNaN(i)?e.target.value=Math.round(this.model.kdfParameters[t]/n):i>0&&this.model.setKdfParameter(t,i)}refreshYubiKeys(e){l.Launcher&&p.AppSettingsModel.enableUsb&&p.AppSettingsModel.yubiKeyShowChalResp&&(d.UsbListener.attachedYubiKeys||this.yubiKeys.length&&(this.yubiKeys=[],this.render()),u.YubiKey.list(((t,n)=>{t||this.removed||(this.yubiKeys=n,this.render(),e&&d.UsbListener.attachedYubiKeys&&!n.length&&y.Features.isMac&&c.Alerts.error({body:A.Locale.setFileYubiKeyErrorEmptyMac}))})))}changeYubiKey(e){let t=null;const n=e.target.value;if("refresh"===n)return this.render(),void this.refreshYubiKeys(!0);if(n){const n=e.target.selectedOptions[0],i=+n.dataset.vid,s=+n.dataset.pid,r=+n.dataset.serial,o=+n.dataset.slot;t={vid:i,pid:s,serial:r,slot:o}}c.Alerts.yesno({header:A.Locale.setFileYubiKeyHeader,body:A.Locale.setFileYubiKeyBody,success:()=>{this.model.setChallengeResponse(t)},cancel:()=>{this.render()}})}}},9383:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsGeneralView:()=>E});var i=n(7201),s=n(7779),r=n(3898),o=n(949),a=n(7119),l=n(5621),c=n(9491),u=n(111),d=n(4530),h=n(9673),p=n(7614),m=n(2706),f=n(8146),g=n(667),A=n(6098),y=n(3297),v=n(3346),b=n(2416),w=n(6838),k=n(9160),C=n.n(k),_=n(6718);class E extends s.View{constructor(e,t){super(e,t),this.template=C(),this.events={"click .settings__general-theme":"changeTheme","change .settings__general-locale":"changeLocale","change .settings__general-font-size":"changeFontSize","change .settings__general-expand":"changeExpandGroups","change .settings__general-auto-update":"changeAutoUpdate","change .settings__general-idle-minutes":"changeIdleMinutes","change .settings__general-clipboard":"changeClipboard","change .settings__general-auto-save":"changeAutoSave","change .settings__general-auto-save-interval":"changeAutoSaveInterval","change .settings__general-remember-key-files":"changeRememberKeyFiles","change .settings__general-minimize":"changeMinimize","change .settings__general-lock-on-minimize":"changeLockOnMinimize","change .settings__general-lock-on-copy":"changeLockOnCopy","change .settings__general-lock-on-auto-type":"changeLockOnAutoType","change .settings__general-lock-on-os-lock":"changeLockOnOsLock","change .settings__general-table-view":"changeTableView","change .settings__general-colorful-icons":"changeColorfulIcons","change .settings__general-use-markdown":"changeUseMarkdown","change .settings__general-use-group-icon-for-entries":"changeUseGroupIconForEntries","change .settings__general-direct-autotype":"changeDirectAutotype","change .settings__general-field-label-dblclick-autotype":"changeFieldLabelDblClickAutoType","change .settings__general-titlebar-style":"changeTitlebarStyle","click .settings__general-update-btn":"checkUpdate","click .settings__general-restart-btn":"restartApp","click .settings__general-download-update-btn":"downloadUpdate","click .settings__general-update-found-btn":"installFoundUpdate","change .settings__general-prv-check":"changeStorageEnabled","click .settings__general-prv-logout":"logoutFromStorage","click .settings__general-show-advanced":"showAdvancedSettings","click .settings__general-dev-tools-link":"openDevTools","click .settings__general-try-beta-link":"tryBeta","click .settings__general-show-logs-link":"showLogs","click .settings__general-reload-app-link":"reloadApp"},this.listenTo(m.UpdateModel,"change:status",this.render),this.listenTo(m.UpdateModel,"change:updateStatus",this.render)}render(){const e="ready"===m.UpdateModel.updateStatus,t="found"===m.UpdateModel.updateStatus,n=m.UpdateModel.updateManual,i=this.getStorageProviders();super.render({themes:(0,w.mapObject)(u.SettingsManager.allThemes,(e=>y.Locale[e])),activeTheme:u.SettingsManager.activeTheme,locales:u.SettingsManager.allLocales,activeLocale:u.SettingsManager.activeLocale,fontSize:p.AppSettingsModel.fontSize,expandGroups:p.AppSettingsModel.expandGroups,canClearClipboard:!!c.Launcher,clipboardSeconds:p.AppSettingsModel.clipboardSeconds,rememberKeyFiles:p.AppSettingsModel.rememberKeyFiles,supportFiles:!!c.Launcher,autoSave:p.AppSettingsModel.autoSave,autoSaveInterval:p.AppSettingsModel.autoSaveInterval,idleMinutes:p.AppSettingsModel.idleMinutes,minimizeOnClose:p.AppSettingsModel.minimizeOnClose,devTools:c.Launcher&&c.Launcher.devTools,canAutoUpdate:l.Updater.enabled,canAutoSaveOnClose:!!c.Launcher,canMinimize:!!c.Launcher,canDetectMinimize:!!c.Launcher,canDetectOsSleep:c.Launcher&&c.Launcher.canDetectOsSleep(),canAutoType:r.AutoType.enabled,lockOnMinimize:c.Launcher&&p.AppSettingsModel.lockOnMinimize,lockOnCopy:p.AppSettingsModel.lockOnCopy,lockOnAutoType:p.AppSettingsModel.lockOnAutoType,lockOnOsLock:p.AppSettingsModel.lockOnOsLock,tableView:p.AppSettingsModel.tableView,canSetTableView:!g.Features.isMobile,autoUpdate:l.Updater.getAutoUpdateType(),updateInProgress:l.Updater.updateInProgress(),updateInfo:this.getUpdateInfo(),updateWaitingReload:e&&!c.Launcher,showUpdateBlock:l.Updater.enabled&&!n,updateReady:e,updateFound:t,updateManual:n,releaseNotesLink:h.Links.ReleaseNotes,colorfulIcons:p.AppSettingsModel.colorfulIcons,useMarkdown:p.AppSettingsModel.useMarkdown,useGroupIconForEntries:p.AppSettingsModel.useGroupIconForEntries,directAutotype:p.AppSettingsModel.directAutotype,fieldLabelDblClickAutoType:p.AppSettingsModel.fieldLabelDblClickAutoType,supportsTitleBarStyles:c.Launcher&&g.Features.supportsTitleBarStyles(),titlebarStyle:p.AppSettingsModel.titlebarStyle,storageProviders:i,showReloadApp:g.Features.isStandalone}),this.renderProviderViews(i)}renderProviderViews(e){e.forEach((function(e){if(this.views[e.name]&&this.views[e.name].remove(),e.hasConfig){const t=new b.SettingsPrvView(e,{parent:this.$el.find(".settings__general-"+e.name)[0]});this.views[e.name]=t,t.render()}}),this)}getUpdateInfo(){switch(m.UpdateModel.status){case"checking":return y.Locale.setGenUpdateChecking+"...";case"error":{let e=y.Locale.setGenErrorChecking;return m.UpdateModel.lastError&&(e+=": "+m.UpdateModel.lastError),m.UpdateModel.lastSuccessCheckDate&&(e+=". "+y.Locale.setGenLastCheckSuccess.replace("{}",A.DateFormat.dtStr(m.UpdateModel.lastSuccessCheckDate))+": "+y.Locale.setGenLastCheckVer.replace("{}",m.UpdateModel.lastVersion)),e}case"ok":{let e=y.Locale.setGenCheckedAt+" "+A.DateFormat.dtStr(m.UpdateModel.lastCheckDate)+": ";switch(e+=f.SemVer.compareVersions(a.RuntimeInfo.version,m.UpdateModel.lastVersion)>=0?y.Locale.setGenLatestVer:y.Locale.setGenNewVer.replace("{}",m.UpdateModel.lastVersion)+" "+A.DateFormat.dStr(m.UpdateModel.lastVersionReleaseDate),m.UpdateModel.updateStatus){case"downloading":return e+". "+y.Locale.setGenDownloadingUpdate;case"extracting":return e+". "+y.Locale.setGenExtractingUpdate;case"error":return e+". "+y.Locale.setGenCheckErr}return e}default:return y.Locale.setGenNeverChecked}}getStorageProviders(){const e=[];return Object.keys(o.Storage).forEach((t=>{const n=o.Storage[t];n.system||e.push(n)})),e.sort(((e,t)=>(e.uipos||1/0)-(t.uipos||1/0))),e.map((e=>({name:e.name,enabled:e.enabled,hasConfig:!!e.getSettingsConfig,loggedIn:e.loggedIn})))}changeTheme(e){const t=e.target.closest(".settings__general-theme").dataset.theme;"..."===t?this.goToPlugins():(p.AppSettingsModel.theme=t,this.render())}changeLocale(e){const t=e.target.value;"..."===t?(e.target.value=p.AppSettingsModel.locale||"en-US",this.goToPlugins()):p.AppSettingsModel.locale=t}goToPlugins(){this.appModel.menu.select({item:this.appModel.menu.pluginsSection.items[0]})}changeFontSize(e){const t=+e.target.value;p.AppSettingsModel.fontSize=t}changeTitlebarStyle(e){const t=e.target.value;p.AppSettingsModel.titlebarStyle=t}changeClipboard(e){const t=+e.target.value;p.AppSettingsModel.clipboardSeconds=t}changeIdleMinutes(e){const t=+e.target.value;p.AppSettingsModel.idleMinutes=t}changeAutoUpdate(e){const t=e.target.value||!1;p.AppSettingsModel.autoUpdate=t,t&&l.Updater.scheduleNextCheck()}checkUpdate(){l.Updater.check(!0)}changeAutoSave(e){const t=e.target.checked||!1;p.AppSettingsModel.autoSave=t}changeAutoSaveInterval(e){const t=Number(e.target.value)||0;p.AppSettingsModel.autoSaveInterval=t}changeRememberKeyFiles(e){const t=e.target.value||!1;p.AppSettingsModel.rememberKeyFiles=t,this.appModel.clearStoredKeyFiles()}changeMinimize(e){const t=e.target.checked||!1;p.AppSettingsModel.minimizeOnClose=t}changeLockOnMinimize(e){const t=e.target.checked||!1;p.AppSettingsModel.lockOnMinimize=t}changeLockOnCopy(e){const t=e.target.checked||!1;p.AppSettingsModel.lockOnCopy=t}changeLockOnAutoType(e){const t=e.target.checked||!1;p.AppSettingsModel.lockOnAutoType=t}changeLockOnOsLock(e){const t=e.target.checked||!1;p.AppSettingsModel.lockOnOsLock=t}changeTableView(e){const t=e.target.checked||!1;p.AppSettingsModel.tableView=t,i.Events.emit("refresh")}changeColorfulIcons(e){const t=e.target.checked||!1;p.AppSettingsModel.colorfulIcons=t,i.Events.emit("refresh")}changeUseMarkdown(e){const t=e.target.checked||!1;p.AppSettingsModel.useMarkdown=t,i.Events.emit("refresh")}changeUseGroupIconForEntries(e){const t=e.target.checked||!1;p.AppSettingsModel.useGroupIconForEntries=t,i.Events.emit("refresh")}changeDirectAutotype(e){const t=e.target.checked||!1;p.AppSettingsModel.directAutotype=t,i.Events.emit("refresh")}changeFieldLabelDblClickAutoType(e){const t=e.target.checked||!1;p.AppSettingsModel.fieldLabelDblClickAutoType=t,i.Events.emit("refresh")}restartApp(){c.Launcher?c.Launcher.requestRestart():window.location.reload()}downloadUpdate(){c.Launcher.openLink(h.Links.Desktop)}installFoundUpdate(){l.Updater.update(!0,(()=>{c.Launcher.requestRestart()}))}changeExpandGroups(e){const t=e.target.checked;p.AppSettingsModel.expandGroups=t,i.Events.emit("refresh")}changeStorageEnabled(e){const t=o.Storage[_(e.target).data("storage")];t&&(t.setEnabled(e.target.checked),p.AppSettingsModel[t.name]=t.enabled,this.$el.find(".settings__general-"+t.name).toggleClass("hide",!e.target.checked))}logoutFromStorage(e){const t=o.Storage[_(e.target).data("storage")];t&&(t.logout(),_(e.target).remove())}showAdvancedSettings(){this.$el.find(".settings__general-show-advanced, .settings__general-advanced").toggleClass("hide"),this.scrollToBottom()}openDevTools(){c.Launcher&&c.Launcher.openDevTools()}tryBeta(){this.appModel.files.hasUnsavedFiles()?d.Alerts.info({header:y.Locale.setGenTryBetaWarning,body:y.Locale.setGenTryBetaWarningBody}):location.href=h.Links.BetaWebApp}showLogs(){this.views.logView&&this.views.logView.remove(),this.views.logView=new v.SettingsLogsView,this.views.logView.render(),this.scrollToBottom()}reloadApp(){location.reload()}scrollToBottom(){this.$el.closest(".scroller").scrollTop(this.$el.height())}}},1426:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsHelpView:()=>c});var i=n(7779),s=n(7119),r=n(9673),o=n(9491),a=n(3935),l=n.n(a);class c extends i.View{constructor(...e){super(...e),this.template=l()}render(){const e="KeeWeb v"+s.RuntimeInfo.version+" ("+s.RuntimeInfo.commit+", "+s.RuntimeInfo.buildDate+")\nEnvironment: "+(o.Launcher?o.Launcher.name+" v"+o.Launcher.version:"web")+"\nUser-Agent: "+navigator.userAgent;super.render({issueLink:r.Links.Repo+"/issues/new?body="+encodeURIComponent("# please describe your issue here\n\n"+e),desktopLink:r.Links.Desktop,webAppLink:r.Links.WebApp,appInfo:e})}}},3346:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsLogsView:()=>l});var i=n(7779),s=n(2378),r=n(2363),o=n(364),a=n.n(o);class l extends i.View{constructor(...e){super(...e),this.parent=".settings__general-advanced",this.template=a(),this.levelToColor={debug:"muted",warn:"yellow",error:"red"}}render(){const e=r.Logger.getLast().map((e=>({level:e.level,color:this.levelToColor[e.level],msg:"["+s.StringFormat.padStr(e.level.toUpperCase(),5)+"] "+e.args.map((e=>this.mapArg(e))).join(" ")})));super.render({logs:e})}mapArg(e){if(null===e)return"null";if(void 0===e)return"undefined";if(""===e)return'""';if(!e||!e.toString()||"object"!=typeof e)return e?e.toString():e;if(e instanceof Array)return"["+e.map((e=>this.mapArg(e))).join(", ")+"]";let t=e.toString();if("[object Object]"===t){const n=[];t=JSON.stringify(e,((e,t)=>{if("object"==typeof t&&null!==t){if(-1!==n.indexOf(t))return;n.push(t)}return t}))}return t}}},868:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsPluginsView:()=>b});var i=n(7779),s=n(7201),r=n(7119),o=n(9491),a=n(111),l=n(9673),c=n(7614),u=n(3172),d=n(739),h=n(8612),p=n(8146),m=n(667),f=n(6098),g=n(3297),A=n(9014),y=n.n(A),v=n(6718);class b extends i.View{constructor(e,t){super(e,t),this.template=y(),this.events={"click .settings_plugins-install-btn":"installClick","click .settings_plugins-uninstall-btn":"uninstallClick","click .settings_plugins-disable-btn":"disableClick","click .settings_plugins-enable-btn":"enableClick","click .settings_plugins-update-btn":"updateClick","click .settings_plugins-use-locale-btn":"useLocaleClick","click .settings_plugins-use-theme-btn":"useThemeClick","click .settings__plugins-gallery-plugin-install-btn":"galleryInstallClick","input .settings__plugins-gallery-search":"gallerySearchInput","change select.settings__plugins-plugin-input":"pluginSettingChange","change input[type=checkbox].settings__plugins-plugin-input":"pluginSettingChange","input input[type=text].settings__plugins-plugin-input":"pluginSettingChange","change .settings__plugins-plugin-updates":"autoUpdateChange","click .settings__plugins-gallery-load-btn":"loadPluginGalleryClick"},this.searchStr=null,this.installFromUrl=null,this.installing={},this.installErrors={},this.listenTo(d.PluginManager,"change",this.render.bind(this)),this.listenTo(s.Events,"plugin-gallery-load-complete",this.pluginGalleryLoadComplete.bind(this))}render(){super.render({plugins:d.PluginManager.plugins.map((e=>({id:e.id,manifest:e.manifest,status:e.status,installTime:Math.round(e.installTime),updateError:e.updateError,updateCheckDate:f.DateFormat.dtStr(e.updateCheckDate),installError:e.installError,official:e.official,autoUpdate:e.autoUpdate,settings:e.getSettings()}))).sort(h.Comparators.stringComparator("id",!0)),installingFromUrl:this.installFromUrl&&!this.installFromUrl.error,installUrl:this.installFromUrl?this.installFromUrl.url:null,installUrlError:this.installFromUrl?this.installFromUrl.error:null,galleryLoading:u.PluginGallery.loading,galleryLoadError:u.PluginGallery.loadError,galleryPlugins:this.getGalleryPlugins(),searchStr:this.searchStr,hasUnicodeFlags:m.Features.hasUnicodeFlags(),pluginDevLink:l.Links.PluginDevelopStart,translateLink:l.Links.Translation}),this.searchStr&&this.showFilterResults()}pluginGalleryLoadComplete(){this.render(),s.Events.emit("page-geometry",{source:"view"})}getGalleryPlugins(){if(!u.PluginGallery.gallery)return null;const e=d.PluginManager.plugins;return u.PluginGallery.gallery.plugins.map((e=>({url:e.url,manifest:e.manifest,installing:this.installing[e.url],installError:this.installErrors[e.url],official:e.official}))).filter((t=>!e.get(t.manifest.name)&&this.canInstallPlugin(t))).sort(((e,t)=>e.manifest.name.localeCompare(t.manifest.name)))}canInstallPlugin(e){return(!e.manifest.locale||!a.SettingsManager.allLocales[e.manifest.locale.name])&&(!(e.manifest.desktop&&!o.Launcher)&&(!(e.manifest.versionMin&&p.SemVer.compareVersions(e.manifest.versionMin,r.RuntimeInfo.version)>0)&&!(e.manifest.versionMax&&p.SemVer.compareVersions(e.manifest.versionMax,r.RuntimeInfo.version)>0)))}loadPluginGalleryClick(){u.PluginGallery.loading||(u.PluginGallery.loadPlugins(),this.render())}installClick(){const e=this.$el.find(".settings_plugins-install-btn"),t=this.$el.find("#settings__plugins-install-url");this.$el.find(".settings__plugins-install-error").empty();const n=t.val().trim();n&&(t.prop("disabled",!0),e.text(g.Locale.setPlInstallBtnProgress+"...").prop("disabled",!0),this.installFromUrl={url:n},d.PluginManager.install(n,void 0,!0).then((()=>{this.installFinished(),this.installFromUrl=null,this.render(),this.$el.closest(".scroller").scrollTop(0)})).catch((e=>{this.installFinished(),this.installFromUrl.error=e,this.$el.find(".settings__plugins-install-error").text(e.toString()),this.$el.closest(".scroller").scrollTop(this.$el.height())})))}installFinished(){const e=this.$el.find(".settings_plugins-install-btn");this.$el.find("#settings__plugins-install-url").prop("disabled",!1),e.text(g.Locale.setPlInstallBtn).prop("disabled",!1)}uninstallClick(e){const t=v(e.target).data("plugin");d.PluginManager.uninstall(t)}disableClick(e){const t=v(e.target).data("plugin");d.PluginManager.disable(t)}enableClick(e){const t=v(e.target).data("plugin");d.PluginManager.activate(t)}updateClick(e){const t=v(e.target).data("plugin");d.PluginManager.update(t)}useLocaleClick(e){const t=v(e.target).data("locale");c.AppSettingsModel.locale=t}useThemeClick(e){const t=v(e.target).data("theme");c.AppSettingsModel.theme=t}galleryInstallClick(e){const t=v(e.target),n=t.data("plugin"),i=u.PluginGallery.gallery.plugins.find((e=>e.manifest.name===n));t.text(g.Locale.setPlInstallBtnProgress+"...").prop("disabled",!0),this.installing[i.url]=!0,delete this.installErrors[i.url],d.PluginManager.install(i.url,i.manifest).catch((e=>{this.installErrors[i.url]=e,delete this.installing[i.url],this.render()})).then((()=>{t.prop("disabled",!0),delete this.installing[i.url]}))}gallerySearchInput(e){this.searchStr=e.target.value.toLowerCase(),this.showFilterResults()}showFilterResults(){const e={};for(const t of u.PluginGallery.gallery.plugins)e[t.manifest.name]=t;for(const t of v(".settings__plugins-gallery-plugin",this.$el)){const n=t.dataset.plugin,i=this.pluginMatchesFilter(e[n]);v(t).toggle(i)}}pluginMatchesFilter(e){const t=this.searchStr,n=e.manifest;return!!(!t||n.name.toLowerCase().indexOf(t)>=0||n.description&&n.description.toLowerCase().indexOf(t)>=0||n.locale&&(n.locale.name.toLowerCase().indexOf(t)>=0||n.locale.title.toLowerCase().indexOf(t)>=0))}pluginSettingChange(e){const t=e.target,n=v(t).closest(".settings__plugins-plugin-setting"),i=n.data("setting"),s=n.data("plugin"),r="checkbox"===t.type?t.checked:t.value;d.PluginManager.getPlugin(s).setSettings({[i]:r})}autoUpdateChange(e){const t=v(e.target).data("plugin"),n=e.target.checked;d.PluginManager.setAutoUpdate(t,n)}}},2416:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsPrvView:()=>l});var i=n(7779),s=n(949),r=n(1858),o=n.n(r),a=n(6718);class l extends i.View{constructor(...e){super(...e),this.template=o(),this.events={"change .settings__general-prv-field-sel":"changeField","input .settings__general-prv-field-txt":"changeField","change .settings__general-prv-field-check":"changeCheckbox"}}render(){const e=s.Storage[this.model.name];e&&e.getSettingsConfig&&super.render(e.getSettingsConfig())}changeField(e){const t=e.target.dataset.id,n=e.target.value;if(n&&!e.target.checkValidity())return;s.Storage[this.model.name].applySetting(t,n),a(e.target).is("select")&&this.render()}changeCheckbox(e){const t=e.target.dataset.id,n=!!e.target.checked;s.Storage[this.model.name].applySetting(t,n)}}},1499:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsShortcutsView:()=>h});var i=n(7779),s=n(7027),r=n(9491),o=n(2977),a=n(667),l=n(3297),c=n(2075),u=n.n(c),d=n(6718);class h extends i.View{constructor(...e){super(...e),this.template=u(),this.systemShortcuts=["Meta+A","Alt+A","Alt+C","Alt+D","Meta+F","Meta+C","Meta+B","Meta+U","Meta+T","Alt+N","Meta+O","Meta+S","Meta+G","Meta+,","Meta+L"],this.events={"click button.shortcut":"shortcutClick"}}render(){super.render({cmd:s.Shortcuts.actionShortcutSymbol(!0),alt:s.Shortcuts.altShortcutSymbol(!0),globalIsLarge:!a.Features.isMac,autoTypeSupported:!!r.Launcher,globalShortcuts:r.Launcher?{autoType:s.Shortcuts.globalShortcutText("autoType",!0),copyPassword:s.Shortcuts.globalShortcutText("copyPassword",!0),copyUser:s.Shortcuts.globalShortcutText("copyUser",!0),copyUrl:s.Shortcuts.globalShortcutText("copyUrl",!0),copyOtp:s.Shortcuts.globalShortcutText("copyOtp",!0),restoreApp:s.Shortcuts.globalShortcutText("restoreApp",!0)}:void 0})}shortcutClick(e){const t=e.target.dataset.shortcut,n=d(`.shortcut__editor[data-shortcut=${t}]`);if(n.length)return void n.remove();const i=d("").addClass("shortcut__editor").attr("data-shortcut",t);d("").text(l.Locale.setShEdit).appendTo(i);const r=d("").addClass("shortcut__editor-input").val(s.Shortcuts.globalShortcutText(t)).appendTo(i);a.Features.isMac||r.addClass("shortcut__editor-input--large"),i.insertAfter(d(e.target).parent()),r.focus(),r.on("keypress",(e=>e.preventDefault())),r.on("keydown",(e=>{if(e.preventDefault(),e.stopImmediatePropagation(),e.which===o.Keys.DOM_VK_DELETE||e.which===o.Keys.DOM_VK_BACK_SPACE)return s.Shortcuts.setGlobalShortcut(t,void 0),void this.render();if(e.which===o.Keys.DOM_VK_ESCAPE)return void r.blur();const n=s.Shortcuts.keyEventToShortcut(e),i=s.Shortcuts.presentShortcut(n.value);r.val(i);const a=this.systemShortcuts.includes(n.text);r.toggleClass("input--error",a);n.valid&&!a&&(s.Shortcuts.setGlobalShortcut(t,n.value),this.render())}))}}},4199:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SettingsView:()=>u});var i=n(7779),s=n(7201),r=n(2977),o=n(7015),a=n(2378),l=n(3595),c=n.n(l);class u extends i.View{constructor(e,t){super(e,t),this.parent=".app__body",this.template=c(),this.events={"click .settings__back-button":"returnToApp"},this.initScroll(),this.listenTo(s.Events,"set-page",this.setPage),this.onKey(r.Keys.DOM_VK_ESCAPE,this.returnToApp)}render(){super.render(),this.createScroll({root:this.$el.find(".settings")[0],scroller:this.$el.find(".scroller")[0],bar:this.$el.find(".scroller__bar")[0]}),this.pageEl=this.$el.find(".scroller")}setPage(e){let{page:t,section:i,file:s}=e;"file"===t&&s&&s.external&&(t="file-external");const r=n(4367)("./settings-"+t+"-view")[`Settings${a.StringFormat.pascalCase(t)}View`];this.views.page&&this.views.page.remove(),this.views.page=new r(s,{parent:this.pageEl[0]}),this.views.page.appModel=this.model,this.views.page.render(),this.file=s,this.page=t,this.pageResized(),this.scrollToSection(i)}scrollToSection(e){let t;e&&(t=this.views.page.el.querySelector(`#${e}`)),t||(t=this.views.page.el.querySelector("h1")),t&&t.scrollIntoView(!0)}returnToApp(){s.Events.emit("toggle-settings",!1)}}Object.assign(u.prototype,o.Scrollable)},4902:(e,t,n)=>{"use strict";n.r(t),n.d(t,{StorageFileListView:()=>l});var i=n(7779),s=n(4798),r=n(8517),o=n.n(r),a=n(6718);class l extends i.View{constructor(e){super(e),this.template=o(),this.events={"click .open-list__file":"fileClick","click .open-list__check-wrap":"showAllCheckClick","change #open-list__check":"showAllCheckChange"},this.allStorageFiles={},this.showHiddenFiles=!1}render(){let e=this.model.files.map((e=>(this.allStorageFiles[e.path]=e,{path:e.path,name:e.name.replace(/\.kdbx$/i,""),kdbx:s.UrlFormat.isKdbx(e.name),dir:e.dir})));const t=e.filter((e=>e.dir||e.kdbx)),n=t.length&&e.length>t.length;this.showHiddenFiles||t.length>0&&(e=t);const i=e.length>14?3:e.length>7?2:1;super.render({files:e,density:i,showHiddenFiles:this.showHiddenFiles,canShowHiddenFiles:n})}fileClick(e){const t=a(e.target).closest(".open-list__file").data("path"),n=this.allStorageFiles[t];this.emit("selected",n)}showAllCheckClick(e){e.stopPropagation()}showAllCheckChange(e){this.showHiddenFiles=e.target.checked,this.render()}}},9993:(e,t,n)=>{"use strict";n.r(t),n.d(t,{TagView:()=>u});var i=n(7201),s=n(7779),r=n(4530),o=n(3297),a=n(2354),l=n.n(a),c=n(6718);class u extends s.View{constructor(...e){super(...e),this.parent=".app__panel",this.template=l(),this.events={"click .tag__buttons-trash":"moveToTrash","click .back-button":"returnToApp","click .tag__btn-rename":"renameTag"}}render(){this.tag&&super.render({title:this.tag.title})}showTag(e){this.tag=e,this.render()}renameTag(){const e=c.trim(this.$el.find("#tag__field-title").val());e&&e!==this.tag.title&&(/[;,:]/.test(e)?r.Alerts.error({header:o.Locale.tagBadName,body:o.Locale.tagBadNameBody.replace("{}","`,`, `;`, `:`")}):this.model.tags.some((t=>t.toLowerCase()===e.toLowerCase()))?r.Alerts.error({header:o.Locale.tagExists,body:o.Locale.tagExistsBody}):(this.model.renameTag(this.tag.title,e),i.Events.emit("select-all")))}moveToTrash(){this.title=null,r.Alerts.yesno({header:o.Locale.tagTrashQuestion,body:o.Locale.tagTrashQuestionBody,success:()=>{this.model.renameTag(this.tag.title,void 0),i.Events.emit("select-all")}})}returnToApp(){i.Events.emit("edit-tag")}}},4181:e=>{e.exports="A9mimmf7S7UBAAMAAhAAMcHy5r9xQ1C+WAUhavxa/wMEAAEAAAAEIABxfxHCnkXg33kgTHHC6ypJD/1WaAxFf/UFnsjwgy44owUgANa13e5Af7s/e3BwxJs+Mb3XuRoXV4k0IcscL/9moswVBggACgAAAAAAAAAHEAAnycUp1VWOk2aUhSXwteDSCCAAGDqvOxl3dcYVAwpzbbi5YkY9DljzaRK0fIGFw77Rp1oJIADTfQrMe/PsZn/KiDX+wuZYVi2eDNMb1pvbQwQULs8WhAoEAAIAAAAABAAA0K0KaMB6ReFmqp35nHRMkvUQHBGfH4AOfmHQGxKRHvKJBkJwia6LSTf0nWwM3bmB9wk3kf4JrIdpM8hS7Jc/8MFd4NqjPUwMIZaqbY/7vCQ3kg8N4dCi3zzL/xfBrn9nVvJp2tQdyw4ok+rRlGMZL4c3iyuIA6pyBFkUzPZUj1gKljzXNIppDWyEys2+zfBHUvneuZF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igCACIBQQRqNgIAIAAgATQCADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATUCADcDAA8LIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASkDADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATIBADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATMBADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATAAADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATEAADcDAA8LIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASsDADkDAA8LIAAgAkEAEQIACwtCAQN/IAAoAgAsAAAQEARAA0AgACgCACICLAAAIQMgACACQQFqNgIAIAMgAUEKbGpBUGohASACLAABEBANAAsLIAELEQAgAEUEQEEADwsgACABEDwLIwAgASABKQMwQgF8NwMwIAIgASAAQQAQEiACIAAgAEEAEBIL0AQCCH8CfiMAQYAYayICJAACQCAARQ0AAkACfwJAAkACQCAAKAIgQX9qDgICAQALIAEoAgAhBEEADAILIAEoAgANAiABLQAIQQJJDQAgAS0ACEVBAXQhBQwCCyACEDAgAkGACGoQMCACIAEoAgAiBK03A4AIIAIgATUCBDcDiAggAiABMQAINwOQCCACIAA1Agw3A5gIIAIgADUCCDcDoAggAiAANQIgNwOoCEEBCyEJIAQNACABLQAIIgRFQQF0IQUgBCAJQQFzcg0AIAJBgBBqIAJBgAhqIAIQJUECIQULIAUgACgCECIETw0AQX8gACgCFCIGQX9qIAYgASgCBGwgBWogBCABLQAIbGoiBCAGcBsgBGohAwNAIARBf2ogAyAEIAZwQQFGGyEGAn8gCQRAIAVB/wBxIgNFBEAgAkGAEGogAkGACGogAhAlCyACQYAQaiADQQN0agwBCyAAKAIAIAZBCnRqCyIDKAIEIQcgAygCACEDIAAoAhghCCABIAU2AgwgACABIAMgByAIcK0iCiAKIAE1AgQiCiABLQAIGyABKAIAGyILIApREEghByAAKAIAIgMgACgCFCALp2xBCnRqIAdBCnRqIQcgAyAEQQp0aiEIAkAgACgCBEEQRgRAIAMgBkEKdGogByAIQQ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iwgAEEANgIcIABBADYCECAAKAIUGiAAQQA2AhRBAAsaIAAgACgCACAEcjYCACABRQ0ACyACQdABaiQAC4kCAAJAIAAEfyABQf8ATQ0BAkBBtB4oAgAoAgBFBEAgAUGAf3FBgL8DRg0DDAELIAFB/w9NBEAgACABQT9xQYABcjoAASAAIAFBBnZBwAFyOgAAQQIPCyABQYCwA09BACABQYBAcUGAwANHG0UEQCAAIAFBP3FBgAFyOgACIAAgAUEMdkHgAXI6AAAgACABQQZ2QT9xQYABcjoAAUEDDwsgAUGAgHxqQf//P00EQCAAIAFBP3FBgAFyOgADIAAgAUESdkHwAXI6AAAgACABQQZ2QT9xQYABcjoAAiAAIAFBDHZBP3FBgAFyOgABQQQPCwtB8B5BGTYCAEF/BUEBCw8LIAAgAToAAEEBC7gBAQF/IAFBAEchAgJAAkACQCABRSAAQQNxRXINAANAIAAtAABFDQIgAEEBaiEAIAFBf2oiAUEARyECIAFFDQEgAEEDcQ0ACwsgAkUNAQsCQCAALQAARSABQQRJcg0AA0AgACgCACICQX9zIAJB//37d2pxQYCBgoR4cQ0BIABBBGohACABQXxqIgFBA0sNAAsLIAFFDQADQCAALQAARQRAIAAPCyAAQQFqIQAgAUF/aiIBDQALC0EAC4YBAQJ/IwBBoAFrIgIkACACQQhqQfAXQZABEAYaIAIgADYCNCACIAA2AhwgAkF+IABrIgNB/////wdB/////wcgA0sbIgM2AjggAiAAIANqIgA2AiQgAiAANgIYIAJBCGogARA7IAMEQCACKAIcIgAgACACKAIYRmtBADoAAAsgAkGgAWokAAszAQF/IAAoAhQiAyABIAIgACgCECADayIBIAEgAksbIgEQBhogACAAKAIUIAFqNgIUIAILlQIBA38jAEHQAGsiESQAQX4hEwJAIAhBBEkNACAIEAwiEkUEQEFqIRMMAQsgEUEANgJMIBFCADcCRCARIAI2AjwgESACNgI4IBEgATYCNCARIAA2AjAgESAPNgIsIBEgDjYCKCARIA02AiQgESAMNgIgIBEgBjYCHCARIAU2AhggESAENgIUIBEgAzYCECARIAg2AgwgESASNgIIIBEgEDYCQCARQQhqIAsQHyITBEAgEiAIEAUgEhAJDAELIAcEQCAHIBIgCBAGGgsCQCAJRSAKRXINACAJIAogEUEIaiALECtFDQAgEiAIEAUgCSAKEAUgEhAJQWEhEwwBCyASIAgQBSASEAlBACETCyARQdAAaiQAIBMLtgMBBX8jAEEQayIDJAAgACgCBCEGIAAoAhQhBwJAIAIQICIERQRAQWYhAgwBC0FgIQIgAS0AACIFQSRHDQAgAUEBaiABIAVBJEYbIgEgBCAEEAsiBBARIgUNACAAQRA2AjggASABIARqIgEgBRsiBEHcF0EDEBFFBEAgBEEDaiADQQxqEBYiAUUNASAAIAMoAgw2AjgLIAFB4BdBAxARDQAgAUEDaiADQQxqEBYiAUUNACAAIAMoAgw2AiwgAUHkF0EDEBENACABQQNqIANBDGoQFiIBRQ0AIAAgAygCDDYCKCABQegXQQMQEQ0AIAFBA2ogA0EMahAWIgFFDQAgACADKAIMIgQ2AjAgACAENgI0IAEtAABBJEcNACADIAc2AgwgACgCECADQQxqIAFBAWoQLSIBRQ0AIAAgAygCDDYCFCABLQAAQSRHDQAgAyAGNgIMIAAoAgAgA0EMaiABQQFqEC0iAUUNACAAIAMoAgw2AgQgAEEANgJEIABCADcCPCAAQgA3AhggAEIANwIgIAAQHSICDQAgAS0AACEAIANBEGokAEFgQQAgABsPCyADQRBqJAAgAgtjAQJ/IwBB0ABrIgIkAEFnIQMCQCAARSABRXINACAAIAE2AiggASAAIAAoAgwQTSIDDQAgAiABIAAoAiAQQyACQUBrQQgQBSACIAAQRCACQcgAEAVBACEDCyACQdAAaiQAIAML6gMBAX8jAEGAAmsiAyQAIABFIAFFckUEQCADQRBqQcAAEBkaIANBDGogASgCMBAIIANBEGogA0EMakEEEAcaIANBDGogASgCBBAIIANBEGogA0EMakEEEAcaIANBDGogASgCLBAIIANBEGogA0EMakEEEAcaIANBDGogASgCKBAIIANBEGogA0EMakEEEAcaIANBDGogASgCOBAIIANBEGogA0EMakEEEAcaIANBDGogAhAIIANBEGogA0EMakEEEAcaIANBDGogASgCDBAIIANBEGogA0EMakEEEAcaAkAgASgCCCICRQ0AIANBEGogAiABKAIMEAcaIAEtAERBAXFFDQAgASgCCCABKAIMEB4gAUEANgIMCyADQQxqIAEoAhQQCCADQRBqIANBDGpBBBAHGiABKAIQIgIEQCADQRBqIAIgASgCFBAHGgsgA0EMaiABKAIcEAggA0EQaiADQQxqQQQQBxoCQCABKAIYIgJFDQAgA0EQaiACIAEoAhwQBxogAS0AREECcUUNACABKAIYIAEoAhwQHiABQQA2AhwLIANBDGogASgCJBAIIANBEGogA0EMakEEEAcaIAEoAiAiAgRAIANBEGogAiABKAIkEAcaCyADQRBqIABBwAAQExoLIANBgAJqJAALngEBBH8jAEGACGsiAiQAIAEoAhgEQCAAQcQAaiEFIABBQGshBANAIARBABAIIAUgAxAIIAJBgAggAEHIABAhIAEoAgAgASgCFCADbEEKdGogAhAvIARBARAIIAJBgAggAEHIABAhIAEoAgAgASgCFCADbEEKdGpBgAhqIAIQLyADQQFqIgMgASgCGEkNAAsLIAJBgAgQBSACQYAIaiQAC6ECAQZ/IwBBIGsiAiQAAkAgACgCGCIDEDciBEUEQEFqIQEMAQsCQCAAKAIIRQRADAELA0BBACEGAkADQAJAIANFBEBBACEDDAELQQAhAQNAIAEgACgCHCIDTwRAIAQgASADa0ECdGooAgAQJw0ECyACIAY6ABggAkEANgIcIAIgAikDGDcDCCACIAU2AhAgAiABNgIUIAIgAikDEDcDACAAIAIQJiABQQFqIgEgACgCGCIDSQ0ACwsgAyAAKAIcayIBIANJBEADQCAEIAFBAnRqKAIAECcNAyABQQFqIgEgACgCGCIDSQ0ACwsgBkEBaiIGQQRHDQALQQAhASAFQQFqIgUgACgCCEkNAQwCCwtBXyEBCyAEEAkLIAJBIGokACABC60BAQZ/IwBBIGsiASQAIAAoAggEQCAAKAIYIQIDQCACIQRBACEFA0ACQCAERQRAQQAhBAwBC0EAIQYDQCABIAU6ABggAUEANgIcIAEgASkDGD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cyBub3QgbWF0Y2ggdGhlIHN1cHBsaWVkIGhhc2gAVW5rbm93biBlcnJvciBjb2RlAAAAAAQLAADPCgAAvQoAAK0KAACdCgAAiwoAAHoKAABnCgAATwoAACwKAAANCgAA6AkAAMcJAACvCQAAdwkAAEQJAAAVCQAA3ggAAM8IAADBCAAAqAgAAI8IAAB4CAAAYQgAAE4IAAA6CAAAHggAAAEIAADwBwAA3gcAAMkHAACzBwAAoAcAAIwHAAB1BwAAcgcAAAEAAAAkdj0AJG09ACx0PQAscD0AJWx1AEGUGAsBAgBBuxgLBf//////AEGAGQsQLSsgICAwWDB4AChudWxsKQBBoBkLQREACgAREREAAAAABQAAAAAAAAkAAAAACwAAAAAAAAAAEQAPChEREQMKBwABAAkLCwAACQYLAAALAAYRAAAAERERAEHxGQshCwAAAAAAAAAAEQAKChEREQAKAAACAAkLAAAACQALAAALAEGrGgsBDABBtxoLFQwAAAAADAAAAAAJDAAAAAAADAAADABB5RoLAQ4AQfEaCxUNAAAABA0AAAAACQ4AAAAAAA4AAA4AQZ8bCwEQAEGrGwseDwAAAAAPAAAAAAkQAAAAAAAQAAAQAAASAAAAEhISAEHiGwsOEgAAABISEgAAAAAAAAkAQZMcCwELAEGfHAsVCgAAAAAKAAAAAAkLAAAAAAALAAALAEHNHAsBDABB2RwLJwwAAAAADAAAAAAJDAAAAAAADAAADAAAMDEyMzQ1Njc4OUFCQ0RFRgBBgB0LAQEAQbQeCwKcDwBB7B4LA7ARUA=="},1638:function(e){e.exports=function(){"use strict";var e=Object.hasOwnProperty,t=Object.setPrototypeOf,n=Object.isFrozen,i=Object.getPrototypeOf,s=Object.getOwnPropertyDescriptor,r=Object.freeze,o=Object.seal,a=Object.create,l="undefined"!=typeof Reflect&&Reflect,c=l.apply,u=l.construct;c||(c=function(e,t,n){return e.apply(t,n)}),r||(r=function(e){return e}),o||(o=function(e){return e}),u||(u=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1?n-1:0),s=1;s/gm),N=o(/^data-[\-\w.\u00B7-\uFFFF]/),U=o(/^aria-[\-\w]+$/),K=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),H=o(/^(?:\w+script|data):/i),G=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),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};function V(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:q(),n=function(t){return e(t)};if(n.version="2.2.6",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var i=t.document,s=t.document,o=t.DocumentFragment,a=t.HTMLTemplateElement,l=t.Node,c=t.Element,u=t.NodeFilter,d=t.NamedNodeMap,k=void 0===d?t.NamedNodeMap||t.MozNamedAttrMap:d,W=t.Text,Y=t.Comment,J=t.DOMParser,$=t.trustedTypes,X=c.prototype,Z=E(X,"cloneNode"),ee=E(X,"nextSibling"),te=E(X,"childNodes"),ne=E(X,"parentNode");if("function"==typeof a){var ie=s.createElement("template");ie.content&&ie.content.ownerDocument&&(s=ie.content.ownerDocument)}var se=z($,i),re=se&&Qe?se.createHTML(""):"",oe=s,ae=oe.implementation,le=oe.createNodeIterator,ce=oe.getElementsByTagName,ue=oe.createDocumentFragment,de=i.importNode,he={};try{he=_(s).documentMode?s.documentMode:{}}catch(e){}var pe={};n.isSupported=ae&&void 0!==ae.createHTMLDocument&&9!==he;var me=Q,fe=R,ge=N,Ae=U,ye=H,ve=G,be=K,we=null,ke=C({},[].concat(V(I),V(S),V(x),V(T),V(D))),Ce=null,_e=C({},[].concat(V(F),V(O),V(M),V(L))),Ee=null,Ie=null,Se=!0,xe=!0,Be=!1,Te=!1,Pe=!1,De=!1,Fe=!1,Oe=!1,Me=!1,Le=!0,Qe=!1,Re=!0,Ne=!0,Ue=!1,Ke={},He=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ge=null,je=C({},["audio","video","img","source","image","track"]),Ve=null,qe=C({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),ze=null,We=s.createElement("form"),Ye=function(e){ze&&ze===e||(e&&"object"===(void 0===e?"undefined":j(e))||(e={}),e=_(e),we="ALLOWED_TAGS"in e?C({},e.ALLOWED_TAGS):ke,Ce="ALLOWED_ATTR"in e?C({},e.ALLOWED_ATTR):_e,Ve="ADD_URI_SAFE_ATTR"in e?C(_(qe),e.ADD_URI_SAFE_ATTR):qe,Ge="ADD_DATA_URI_TAGS"in e?C(_(je),e.ADD_DATA_URI_TAGS):je,Ee="FORBID_TAGS"in e?C({},e.FORBID_TAGS):{},Ie="FORBID_ATTR"in e?C({},e.FORBID_ATTR):{},Ke="USE_PROFILES"in e&&e.USE_PROFILES,Se=!1!==e.ALLOW_ARIA_ATTR,xe=!1!==e.ALLOW_DATA_ATTR,Be=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Te=e.SAFE_FOR_TEMPLATES||!1,Pe=e.WHOLE_DOCUMENT||!1,Oe=e.RETURN_DOM||!1,Me=e.RETURN_DOM_FRAGMENT||!1,Le=!1!==e.RETURN_DOM_IMPORT,Qe=e.RETURN_TRUSTED_TYPE||!1,Fe=e.FORCE_BODY||!1,Re=!1!==e.SANITIZE_DOM,Ne=!1!==e.KEEP_CONTENT,Ue=e.IN_PLACE||!1,be=e.ALLOWED_URI_REGEXP||be,Te&&(xe=!1),Me&&(Oe=!0),Ke&&(we=C({},[].concat(V(D))),Ce=[],!0===Ke.html&&(C(we,I),C(Ce,F)),!0===Ke.svg&&(C(we,S),C(Ce,O),C(Ce,L)),!0===Ke.svgFilters&&(C(we,x),C(Ce,O),C(Ce,L)),!0===Ke.mathMl&&(C(we,T),C(Ce,M),C(Ce,L))),e.ADD_TAGS&&(we===ke&&(we=_(we)),C(we,e.ADD_TAGS)),e.ADD_ATTR&&(Ce===_e&&(Ce=_(Ce)),C(Ce,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&C(Ve,e.ADD_URI_SAFE_ATTR),Ne&&(we["#text"]=!0),Pe&&C(we,["html","head","body"]),we.table&&(C(we,["tbody"]),delete Ee.tbody),r&&r(e),ze=e)},Je=C({},["mi","mo","mn","ms","mtext"]),$e=C({},["foreignobject","desc","title","annotation-xml"]),Xe=C({},S);C(Xe,x),C(Xe,B);var Ze=C({},T);C(Ze,P);var et="http://www.w3.org/1998/Math/MathML",tt="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml",it=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:nt,tagName:"template"});var n=f(e.tagName),i=f(t.tagName);if(e.namespaceURI===tt)return t.namespaceURI===nt?"svg"===n:t.namespaceURI===et?"svg"===n&&("annotation-xml"===i||Je[i]):Boolean(Xe[n]);if(e.namespaceURI===et)return t.namespaceURI===nt?"math"===n:t.namespaceURI===tt?"math"===n&&$e[i]:Boolean(Ze[n]);if(e.namespaceURI===nt){if(t.namespaceURI===tt&&!$e[i])return!1;if(t.namespaceURI===et&&!Je[i])return!1;var s=C({},["title","style","font","a","script"]);return!Ze[n]&&(s[n]||!Xe[n])}return!1},st=function(e){m(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=re}catch(t){e.remove()}}},rt=function(e,t){try{m(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){m(n.removed,{attribute:null,from:t})}t.removeAttribute(e)},ot=function(e){var t=void 0,n=void 0;if(Fe)e=""+e;else{var i=g(e,/^[\r\n\t ]+/);n=i&&i[0]}var r=se?se.createHTML(e):e;try{t=(new J).parseFromString(r,"text/html")}catch(e){}if(!t||!t.documentElement){var o=(t=ae.createHTMLDocument("")).body;o.parentNode.removeChild(o.parentNode.firstElementChild),o.outerHTML=r}return e&&n&&t.body.insertBefore(s.createTextNode(n),t.body.childNodes[0]||null),ce.call(t,Pe?"html":"body")[0]},at=function(e){return le.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT,(function(){return u.FILTER_ACCEPT}),!1)},lt=function(e){return!(e instanceof W||e instanceof Y||"string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof k&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI&&"function"==typeof e.insertBefore)},ct=function(e){return"object"===(void 0===l?"undefined":j(l))?e instanceof l:e&&"object"===(void 0===e?"undefined":j(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},ut=function(e,t,i){pe[e]&&h(pe[e],(function(e){e.call(n,t,i,ze)}))},dt=function(e){var t=void 0;if(ut("beforeSanitizeElements",e,null),lt(e))return st(e),!0;if(g(e.nodeName,/[\u0080-\uFFFF]/))return st(e),!0;var i=f(e.nodeName);if(ut("uponSanitizeElement",e,{tagName:i,allowedTags:we}),!ct(e.firstElementChild)&&(!ct(e.content)||!ct(e.content.firstElementChild))&&b(/<[/\w]/g,e.innerHTML)&&b(/<[/\w]/g,e.textContent))return st(e),!0;if(!we[i]||Ee[i]){if(Ne&&!He[i])for(var s=ne(e),r=te(e),o=r.length-1;o>=0;--o)s.insertBefore(Z(r[o],!0),ee(e));return st(e),!0}return e instanceof c&&!it(e)?(st(e),!0):"noscript"!==i&&"noembed"!==i||!b(/<\/no(script|embed)/i,e.innerHTML)?(Te&&3===e.nodeType&&(t=e.textContent,t=A(t,me," "),t=A(t,fe," "),e.textContent!==t&&(m(n.removed,{element:e.cloneNode()}),e.textContent=t)),ut("afterSanitizeElements",e,null),!1):(st(e),!0)},ht=function(e,t,n){if(Re&&("id"===t||"name"===t)&&(n in s||n in We))return!1;if(xe&&b(ge,t));else if(Se&&b(Ae,t));else{if(!Ce[t]||Ie[t])return!1;if(Ve[t]);else if(b(be,A(n,ve,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==y(n,"data:")||!Ge[e])if(Be&&!b(ye,A(n,ve,"")));else if(n)return!1}return!0},pt=function(e){var t=void 0,i=void 0,s=void 0,r=void 0;ut("beforeSanitizeAttributes",e,null);var o=e.attributes;if(o){var a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ce};for(r=o.length;r--;){var l=t=o[r],c=l.name,u=l.namespaceURI;if(i=v(t.value),s=f(c),a.attrName=s,a.attrValue=i,a.keepAttr=!0,a.forceKeepAttr=void 0,ut("uponSanitizeAttribute",e,a),i=a.attrValue,!a.forceKeepAttr&&(rt(c,e),a.keepAttr))if(b(/\/>/i,i))rt(c,e);else{Te&&(i=A(i,me," "),i=A(i,fe," "));var d=e.nodeName.toLowerCase();if(ht(d,s,i))try{u?e.setAttributeNS(u,c,i):e.setAttribute(c,i),p(n.removed)}catch(e){}}}ut("afterSanitizeAttributes",e,null)}},mt=function e(t){var n=void 0,i=at(t);for(ut("beforeSanitizeShadowDOM",t,null);n=i.nextNode();)ut("uponSanitizeShadowNode",n,null),dt(n)||(n.content instanceof o&&e(n.content),pt(n));ut("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e,s){var r=void 0,a=void 0,c=void 0,u=void 0,d=void 0;if(e||(e="\x3c!--\x3e"),"string"!=typeof e&&!ct(e)){if("function"!=typeof e.toString)throw w("toString is not a function");if("string"!=typeof(e=e.toString()))throw w("dirty is not a string, aborting")}if(!n.isSupported){if("object"===j(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(ct(e))return t.toStaticHTML(e.outerHTML)}return e}if(De||Ye(s),n.removed=[],"string"==typeof e&&(Ue=!1),Ue);else if(e instanceof l)1===(a=(r=ot("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?r=a:r.appendChild(a);else{if(!Oe&&!Te&&!Pe&&-1===e.indexOf("<"))return se&&Qe?se.createHTML(e):e;if(!(r=ot(e)))return Oe?null:re}r&&Fe&&st(r.firstChild);for(var h=at(Ue?e:r);c=h.nextNode();)3===c.nodeType&&c===u||dt(c)||(c.content instanceof o&&mt(c.content),pt(c),u=c);if(u=null,Ue)return e;if(Oe){if(Me)for(d=ue.call(r.ownerDocument);r.firstChild;)d.appendChild(r.firstChild);else d=r;return Le&&(d=de.call(i,d,!0)),d}var p=Pe?r.outerHTML:r.innerHTML;return Te&&(p=A(p,me," "),p=A(p,fe," ")),se&&Qe?se.createHTML(p):p},n.setConfig=function(e){Ye(e),De=!0},n.clearConfig=function(){ze=null,De=!1},n.isValidAttribute=function(e,t,n){ze||Ye({});var i=f(e),s=f(t);return ht(i,s,n)},n.addHook=function(e,t){"function"==typeof t&&(pe[e]=pe[e]||[],m(pe[e],t))},n.removeHook=function(e){pe[e]&&p(pe[e])},n.removeHooks=function(e){pe[e]&&(pe[e]=[])},n.removeAllHooks=function(){pe={}},n}()}()},7187:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function r(){r.init.call(this)}e.exports=r,e.exports.once=function(e,t){return new Promise((function(n,i){function s(){void 0!==r&&e.removeListener("error",r),n([].slice.call(arguments))}var r;"error"!==t&&(r=function(n){e.removeListener(t,s),i(n)},e.once("error",r)),e.once(t,s)}))},r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function c(e,t,n,i){var s,r,o,c;if(a(n),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),r=e._events),o=r[t]),void 0===o)o=r[t]=n,++e._eventsCount;else if("function"==typeof o?o=r[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(s=l(e))>0&&o.length>s&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,c=u,console&&console.warn&&console.warn(c)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},s=u.bind(i);return s.listener=n,i.wrapFn=s,s}function h(e,t,n){var i=e._events;if(void 0===i)return[];var s=i[t];return void 0===s?[]:"function"==typeof s?n?[s.listener||s]:[s]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=r[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var c=l.length,u=m(l,c);for(n=0;n=0;r--)if(n[r]===t||n[r].listener===t){o=n[r].listener,s=r;break}if(s<0)return this;0===s?n.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},r.prototype.listeners=function(e){return h(this,e,!0)},r.prototype.rawListeners=function(e){return h(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},r.prototype.listenerCount=p,r.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},9839:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>s});var i=n(9839);!function(e){var t=e.babelHelpers={};t.typeof="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},t.defineProperty=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},t.slicedToArray=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,s=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){s=!0,r=e}finally{try{!i&&a.return&&a.return()}finally{if(s)throw r}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},t.toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t+~]|"+Q+")"+Q+"*"),V=new RegExp(Q+"|>"),q=new RegExp(U),z=new RegExp("^"+R+"$"),W={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+U),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+Q+"*(even|odd|(([+-]|)(\\d*)n|)"+Q+"*(?:([+-]|)"+Q+"*(\\d+)|))"+Q+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+Q+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+Q+"*((?:-\\d)?\\d*)"+Q+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,J=/^(?:input|select|textarea|button)$/i,$=/^h\d$/i,X=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+Q+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},ie=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,se=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){h()},oe=be((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{F.apply(T=O.call(w.childNodes),w.childNodes),T[w.childNodes.length].nodeType}catch(t){F={apply:T.length?function(e,t){D.apply(e,O.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}function ae(e,t,i,s){var r,a,c,u,d,m,A,y=t&&t.ownerDocument,w=t?t.nodeType:9;if(i=i||[],"string"!=typeof e||!e||1!==w&&9!==w&&11!==w)return i;if(!s&&(h(t),t=t||p,f)){if(11!==w&&(d=Z.exec(e)))if(r=d[1]){if(9===w){if(!(c=t.getElementById(r)))return i;if(c.id===r)return i.push(c),i}else if(y&&(c=y.getElementById(r))&&v(t,c)&&c.id===r)return i.push(c),i}else{if(d[2])return F.apply(i,t.getElementsByTagName(e)),i;if((r=d[3])&&n.getElementsByClassName&&t.getElementsByClassName)return F.apply(i,t.getElementsByClassName(r)),i}if(n.qsa&&!S[e+" "]&&(!g||!g.test(e))&&(1!==w||"object"!==t.nodeName.toLowerCase())){if(A=e,y=t,1===w&&(V.test(e)||j.test(e))){for((y=ee.test(e)&&Ae(t.parentNode)||t)===t&&n.scope||((u=t.getAttribute("id"))?u=u.replace(ie,se):t.setAttribute("id",u=b)),a=(m=o(e)).length;a--;)m[a]=(u?"#"+u:":scope")+" "+ve(m[a]);A=m.join(",")}try{return F.apply(i,y.querySelectorAll(A)),i}catch(t){S(e,!0)}finally{u===b&&t.removeAttribute("id")}}}return l(e.replace(H,"$1"),t,i,s)}function le(){var e=[];return function t(n,s){return e.push(n+" ")>i.cacheLength&&delete t[e.shift()],t[n+" "]=s}}function ce(e){return e[b]=!0,e}function ue(e){var t=p.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function de(e,t){for(var n=e.split("|"),s=n.length;s--;)i.attrHandle[n[s]]=t}function he(e,t){var n=t&&e,i=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function pe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function me(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function fe(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&oe(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function ge(e){return ce((function(t){return t=+t,ce((function(n,i){for(var s,r=e([],n.length,t),o=r.length;o--;)n[s=r[o]]&&(n[s]=!(i[s]=n[s]))}))}))}function Ae(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in n=ae.support={},r=ae.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},h=ae.setDocument=function(e){var t,s,o=e?e.ownerDocument||e:w;return o!=p&&9===o.nodeType&&o.documentElement&&(m=(p=o).documentElement,f=!r(p),w!=p&&(s=p.defaultView)&&s.top!==s&&(s.addEventListener?s.addEventListener("unload",re,!1):s.attachEvent&&s.attachEvent("onunload",re)),n.scope=ue((function(e){return m.appendChild(e).appendChild(p.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),n.attributes=ue((function(e){return e.className="i",!e.getAttribute("className")})),n.getElementsByTagName=ue((function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length})),n.getElementsByClassName=X.test(p.getElementsByClassName),n.getById=ue((function(e){return m.appendChild(e).id=b,!p.getElementsByName||!p.getElementsByName(b).length})),n.getById?(i.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},i.find.ID=function(e,t){if(void 0!==t.getElementById&&f){var n=t.getElementById(e);return n?[n]:[]}}):(i.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},i.find.ID=function(e,t){if(void 0!==t.getElementById&&f){var n,i,s,r=t.getElementById(e);if(r){if((n=r.getAttributeNode("id"))&&n.value===e)return[r];for(s=t.getElementsByName(e),i=0;r=s[i++];)if((n=r.getAttributeNode("id"))&&n.value===e)return[r]}return[]}}),i.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,i=[],s=0,r=t.getElementsByTagName(e);if("*"===e){for(;n=r[s++];)1===n.nodeType&&i.push(n);return i}return r},i.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&f)return t.getElementsByClassName(e)},A=[],g=[],(n.qsa=X.test(p.querySelectorAll))&&(ue((function(e){var t;m.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]="+Q+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||g.push("\\["+Q+"*(?:value|"+L+")"),e.querySelectorAll("[id~="+b+"-]").length||g.push("~="),(t=p.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||g.push("\\["+Q+"*name"+Q+"*="+Q+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||g.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||g.push(".#.+[+~]"),e.querySelectorAll("\\\f"),g.push("[\\r\\n\\f]")})),ue((function(e){e.innerHTML="";var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&g.push("name"+Q+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&g.push(":enabled",":disabled"),m.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")}))),(n.matchesSelector=X.test(y=m.matches||m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&ue((function(e){n.disconnectedMatch=y.call(e,"*"),y.call(e,"[s!='']:x"),A.push("!=",U)})),g=g.length&&new RegExp(g.join("|")),A=A.length&&new RegExp(A.join("|")),t=X.test(m.compareDocumentPosition),v=t||X.test(m.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},x=t?function(e,t){if(e===t)return d=!0,0;var i=!e.compareDocumentPosition-!t.compareDocumentPosition;return i||(1&(i=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===i?e==p||e.ownerDocument==w&&v(w,e)?-1:t==p||t.ownerDocument==w&&v(w,t)?1:u?M(u,e)-M(u,t):0:4&i?-1:1)}:function(e,t){if(e===t)return d=!0,0;var n,i=0,s=e.parentNode,r=t.parentNode,o=[e],a=[t];if(!s||!r)return e==p?-1:t==p?1:s?-1:r?1:u?M(u,e)-M(u,t):0;if(s===r)return he(e,t);for(n=e;n=n.parentNode;)o.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;o[i]===a[i];)i++;return i?he(o[i],a[i]):o[i]==w?-1:a[i]==w?1:0}),p},ae.matches=function(e,t){return ae(e,null,null,t)},ae.matchesSelector=function(e,t){if(h(e),n.matchesSelector&&f&&!S[t+" "]&&(!A||!A.test(t))&&(!g||!g.test(t)))try{var i=y.call(e,t);if(i||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(e){S(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ae.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ae.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return W.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&q.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=_[e+" "];return t||(t=new RegExp("(^|"+Q+")"+e+"("+Q+"|$)"))&&_(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(i){var s=ae.attr(i,e);return null==s?"!="===t:!t||(s+="","="===t?s===n:"!="===t?s!==n:"^="===t?n&&0===s.indexOf(n):"*="===t?n&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,t,n){return A(t)?_.grep(e,(function(e,i){return!!t.call(e,i,e)!==n})):t.nodeType?_.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?_.grep(e,(function(e){return-1)[^>]*|#([\w-]+))$/;(_.fn.init=function(e,t,n){var i,s;if(!e)return this;if(n=n||F,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:O.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof _?t[0]:t,_.merge(this,_.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:v,!0)),P.test(i[1])&&_.isPlainObject(t))for(i in t)A(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(s=v.getElementById(i[2]))&&(this[0]=s,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):A(e)?void 0!==n.ready?n.ready(e):e(_):_.makeArray(e,this)}).prototype=_.fn,F=_(v);var M=/^(?:parents|prev(?:Until|All))/,L={children:!0,contents:!0,next:!0,prev:!0};function Q(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}_.fn.extend({has:function(e){var t=_(e,this),n=t.length;return this.filter((function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ae=/^$|^module$|\/(?:java|ecma)script/i;pe=v.createDocumentFragment().appendChild(v.createElement("div")),(me=v.createElement("input")).setAttribute("type","radio"),me.setAttribute("checked","checked"),me.setAttribute("name","t"),pe.appendChild(me),g.checkClone=pe.cloneNode(!0).cloneNode(!0).lastChild.checked,pe.innerHTML="",g.noCloneChecked=!!pe.cloneNode(!0).lastChild.defaultValue,pe.innerHTML="",g.option=!!pe.lastChild;var ye={thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};function ve(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&T(e,t)?_.merge([e],n):n}function be(e,t){for(var n=0,i=e.length;n",""]);var we=/<|?\w+;/;function ke(e,t,n,i,s){for(var r,o,a,l,c,u,d=t.createDocumentFragment(),h=[],p=0,m=e.length;p\s*$/g;function Oe(e,t){return T(e,"table")&&T(11!==t.nodeType?t:t.firstChild,"tr")&&_(e).children("tbody")[0]||e}function Me(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Le(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Qe(e,t){var n,i,s,r,o,a;if(1===t.nodeType){if(X.hasData(e)&&(a=X.get(e).events))for(s in X.remove(t,"handle events"),a)for(n=0,i=a[s].length;n").attr(e.scriptAttrs||{}).prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&s("error"===e.type?404:200,e.type)}),v.head.appendChild(t[0])},abort:function(){n&&n()}}}));var Wt,Yt=[],Jt=/(=)\?(?=&|$)|\?\?/;_.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||_.expando+"_"+It.guid++;return this[e]=!0,e}}),_.ajaxPrefilter("json jsonp",(function(e,t,n){var s,r,o,a=!1!==e.jsonp&&(Jt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Jt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return s=e.jsonpCallback=A(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Jt,"$1"+s):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+s),e.converters["script json"]=function(){return o||_.error(s+" was not called"),o[0]},e.dataTypes[0]="json",r=i[s],i[s]=function(){o=arguments},n.always((function(){void 0===r?_(i).removeProp(s):i[s]=r,e[s]&&(e.jsonpCallback=t.jsonpCallback,Yt.push(s)),o&&A(r)&&r(o[0]),o=r=void 0})),"script"})),g.createHTMLDocument=((Wt=v.implementation.createHTMLDocument("").body).innerHTML="",2===Wt.childNodes.length),_.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(g.createHTMLDocument?((i=(t=v.implementation.createHTMLDocument("")).createElement("base")).href=v.location.href,t.head.appendChild(i)):t=v),r=!n&&[],(s=P.exec(e))?[t.createElement(s[1])]:(s=ke([e],t,r),r&&r.length&&_(r).remove(),_.merge([],s.childNodes)));var i,s,r},_.fn.load=function(e,t,n){var i,s,r,o=this,a=e.indexOf(" ");return-1").append(_.parseHTML(e)).find(i):e)})).always(n&&function(e,t){o.each((function(){n.apply(this,r||[e.responseText,t,e])}))}),this},_.expr.pseudos.animated=function(e){return _.grep(_.timers,(function(t){return e===t.elem})).length},_.offset={setOffset:function(e,t,n){var i,s,r,o,a,l,c=_.css(e,"position"),u=_(e),d={};"static"===c&&(e.style.position="relative"),a=u.offset(),r=_.css(e,"top"),l=_.css(e,"left"),("absolute"===c||"fixed"===c)&&-1<(r+l).indexOf("auto")?(o=(i=u.position()).top,s=i.left):(o=parseFloat(r)||0,s=parseFloat(l)||0),A(t)&&(t=t.call(e,n,_.extend({},a))),null!=t.top&&(d.top=t.top-a.top+o),null!=t.left&&(d.left=t.left-a.left+s),"using"in t?t.using.call(e,d):("number"==typeof d.top&&(d.top+="px"),"number"==typeof d.left&&(d.left+="px"),u.css(d))}},_.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each((function(t){_.offset.setOffset(this,e,t)}));var t,n,i=this[0];return i?i.getClientRects().length?(t=i.getBoundingClientRect(),n=i.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,i=this[0],s={top:0,left:0};if("fixed"===_.css(i,"position"))t=i.getBoundingClientRect();else{for(t=this.offset(),n=i.ownerDocument,e=i.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===_.css(e,"position");)e=e.parentNode;e&&e!==i&&1===e.nodeType&&((s=_(e).offset()).top+=_.css(e,"borderTopWidth",!0),s.left+=_.css(e,"borderLeftWidth",!0))}return{top:t.top-s.top-_.css(i,"marginTop",!0),left:t.left-s.left-_.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent;e&&"static"===_.css(e,"position");)e=e.offsetParent;return e||oe}))}}),_.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(e,t){var n="pageYOffset"===t;_.fn[e]=function(i){return V(this,(function(e,i,s){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===s)return r?r[t]:e[i];r?r.scrollTo(n?r.pageXOffset:s,n?s:r.pageYOffset):e[i]=s}),e,i,arguments.length)}})),_.each(["top","left"],(function(e,t){_.cssHooks[t]=Ve(g.pixelPosition,(function(e,n){if(n)return n=je(e,t),Ue.test(n)?_(e).position()[t]+"px":n}))})),_.each({Height:"height",Width:"width"},(function(e,t){_.each({padding:"inner"+e,content:t,"":"outer"+e},(function(n,i){_.fn[i]=function(s,r){var o=arguments.length&&(n||"boolean"!=typeof s),a=n||(!0===s||!0===r?"margin":"border");return V(this,(function(t,n,s){var r;return y(t)?0===i.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(r=t.documentElement,Math.max(t.body["scroll"+e],r["scroll"+e],t.body["offset"+e],r["offset"+e],r["client"+e])):void 0===s?_.css(t,n,a):_.style(t,n,s,a)}),t,o?s:void 0,o)}}))})),_.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(e,t){_.fn[t]=function(e){return this.on(t,e)}})),_.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,i){return this.on(t,e,n,i)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),_.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),(function(e,t){_.fn[t]=function(e,n){return 0r;r++){s[r]=new Array(t);for(var o=0;t>o;o++)s[r][o]=[0,0]}var a,l;for(l=0;t>l;l++)for(a=0;t>a;a++){for(var c=0,h=255,p=0;i>p;p++)for(var m=n*a+(i*l+p)*u,f=0;n>f;f++){var g=e[m+f];c>g&&(c=g),g>h&&(h=g)}s[a][l][0]=c,s[a][l][1]=h}for(var A=new Array(t),y=0;t>y;y++)A[y]=new Array(t);for(l=0;t>l;l++)for(a=0;t>a;a++)A[a][l]=Math.floor((s[a][l][0]+s[a][l][1])/2);return A}function i(e){for(var t=n(e),i=t.length,s=Math.floor(u/i),r=Math.floor(d/i),o=new Uint8Array(d*u),a=0;i>a;a++)for(var l=0;i>l;l++)for(var c=0;r>c;c++)for(var h=0;s>h;h++)o[s*l+h+(r*a+c)*u]=e[s*l+h+(r*a+c)*u]n;n++)for(var i=0;u>i;i++){var s=4*i+n*u*4;t[i+n*u]=(33*e[s]+34*e[s+1]+33*e[s+2])/100}return t}var l,c,u,d,h,p=1048576;this.decode=function(){l=document.createElement("canvas"),c=l.getContext("2d");var n=e.height,i=e.width;if(e.width*e.height>p){var s=e.width/e.height;i=s*(n=Math.sqrt(p/s))}return l.width=i,l.height=n,c.drawImage(e,0,0,l.width,l.height),u=l.width,d=l.height,h=c.getImageData(0,0,l.width,l.height),t()}}var s=n(13),r=n(12),o=n(17);e.exports=i},function(e,t,n){"use strict";function i(e,t){if(t||(t=e),1>e||1>t)throw"Both dimensions must be greater than 0";this.width=e,this.height=t;var n=e>>5;0!=(31&e)&&n++,this.rowSize=n,this.bits=new Uint32Array(n*t),this.getDimension=function(){if(this.width!==this.height)throw"Can get dimension on a non-square matrix";return this.width},this.getValue=function(e,t){var n=t*this.rowSize+(e>>5);return 0!=(1&s(this.bits[n],31&e))},this.setValue=function(e,t){var n=t*this.rowSize+(e>>5);this.bits[n]|=1<<(31&e)},this.flip=function(e,t){var n=t*this.rowSize+(e>>5);this.bits[n]^=1<<(31&e)},this.setRegion=function(e,t,n,i){if(0>t||0>e)throw"Left and top must be nonnegative";if(1>i||1>n)throw"Height and width must be at least 1";var s=e+n,r=t+i;if(r>this.height||s>this.width)throw"The region must fit inside the matrix";for(var o=t;r>o;o++)for(var a=o*this.rowSize,l=e;s>l;l++)this.bits[a+(l>>5)]|=1<<(31&l)}}var s=n(3).URShift;e.exports=i},function(e,t){"use strict";function n(e){this.expTable=new Array(256),this.logTable=new Array(256);var t,n=1;for(t=0;256>t;t++)this.expTable[t]=n,(n<<=1)>=256&&(n^=e);for(t=0;255>t;t++)this.logTable[this.expTable[t]]=t;var s=new Array(1);s[0]=0,this.zero=new i(this,new Array(s));var r=new Array(1);r[0]=1,this.one=new i(this,new Array(r)),this.buildMonomial=function(e,n){if(0>e)throw"System.ArgumentException";if(0===n)return this.zero;var s=new Array(e+1);for(t=0;t1&&0===t[0]){for(var o=1;r>o&&0===t[o];)o++;if(o===r)this.coefficients=e.zero.coefficients;else{for(this.coefficients=new Array(r-o),s=0;ss;s++)i=n.addOrSubtract(i,this.coefficients[s]);return i}var r=this.coefficients[0];for(s=1;t>s;s++)r=n.addOrSubtract(this.field.multiply(e,r),this.coefficients[s]);return r},this.addOrSubtract=function(t){if(this.field!==t.field)throw"GF256Polys do not have same GF256 field";if(this.zero)return t;if(t.zero)return this;var r=this.coefficients,o=t.coefficients;if(r.length>o.length){var a=r;r=o,o=a}for(var l=new Array(o.length),c=o.length-r.length,u=0;c>u;u++)l[u]=o[u];for(s=c;ss;s++)for(var c=t[s],u=0;a>u;u++)l[s+u]=n.addOrSubtract(l[s+u],this.field.multiply(c,o[u]));return new i(this.field,l)},this.multiply2=function(e){if(0===e)return this.field.zero;if(1===e)return this;var t=this.coefficients.length,n=new Array(t);for(s=0;t>s;s++)n[s]=this.field.multiply(this.coefficients[s],e);return new i(this.field,n)},this.multiplyByMonomial=function(e,t){if(0>e)throw"System.ArgumentException";if(0===t)return this.field.zero;var n=this.coefficients.length,r=new Array(n+e);for(s=0;ss;s++)r[s]=this.field.multiply(this.coefficients[s],t);return new i(this.field,r)}}n.QR_CODE_FIELD=new n(285),n.DATA_MATRIX_FIELD=new n(301),n.addOrSubtract=function(e,t){return e^t},e.exports.GF256=n,e.exports.GF256Poly=i},function(e,t){"use strict";function n(e,t){return e>=0?e>>t:(e>>t)+(2<<~t)}e.exports={URShift:n}},function(e,t,n){"use strict";function i(e){this.errorCorrectionLevel=s.forBits(e>>3&3),this.dataMask=7&e}var s=n(14),r=n(3).URShift,o=21522,a=[[21522,0],[20773,1],[24188,2],[23371,3],[17913,4],[16590,5],[20375,6],[19104,7],[30660,8],[29427,9],[32170,10],[30877,11],[26159,12],[25368,13],[27713,14],[26998,15],[5769,16],[5054,17],[7399,18],[6608,19],[1890,20],[597,21],[3340,22],[2107,23],[13663,24],[12392,25],[16177,26],[14854,27],[9396,28],[8579,29],[11994,30],[11245,31]],l=[0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4];i.numBitsDiffering=function(e,t){return l[15&(e^=t)]+l[15&r(e,4)]+l[15&r(e,8)]+l[15&r(e,12)]+l[15&r(e,16)]+l[15&r(e,20)]+l[15&r(e,24)]+l[15&r(e,28)]},i.decodeFormatInformation=function(e){var t=i.doDecodeFormatInformation(e);return t||i.doDecodeFormatInformation(e^o)},i.doDecodeFormatInformation=function(e){for(var t=4294967295,n=0,s=0;sl&&(n=r[1],t=l)}return 3>=t?new i(n):null},e.exports=i},function(e,t){"use strict";function n(e,t,i,s,r,o,a,l,c){this.a11=e,this.a12=s,this.a13=a,this.a21=t,this.a22=r,this.a23=l,this.a31=i,this.a32=o,this.a33=c,this.transformPoints1=function(n){for(var u=n.length,d=0;u>d;d+=2){var h=n[d],p=n[d+1],m=a*h+l*p+c;n[d]=(e*h+t*p+i)/m,n[d+1]=(s*h+r*p+o)/m}},this.buildAdjoint=function(){return new n(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)},this.times=function(e){return new n(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}n.quadrilateralToQuadrilateral=function(e,t,n,i,s,r,o,a,l,c,u,d,h,p,m,f){var g=this.quadrilateralToSquare(e,t,n,i,s,r,o,a);return this.squareToQuadrilateral(l,c,u,d,h,p,m,f).times(g)},n.squareToQuadrilateral=function(e,t,i,s,r,o,a,l){var c=l-o,u=t-s+o-l;if(0===c&&0===u)return new n(i-e,r-i,e,s-t,o-s,t,0,0,1);var d=i-r,h=a-r,p=e-i+r-a,m=s-o,f=d*c-h*m,g=(p*c-h*u)/f,A=(d*u-p*m)/f;return new n(i-e+g*i,a-e+A*a,e,s-t+g*s,l-t+A*l,t,g,A,1)},n.quadrilateralToSquare=function(e,t,n,i,s,r,o,a){return this.squareToQuadrilateral(e,t,n,i,s,r,o,a).buildAdjoint()},e.exports=n},function(e,t,n){"use strict";function i(e,t){this.count=e,this.dataCodewords=t}function s(e,t,n){this.ecCodewordsPerBlock=e,this.ecBlocks=n?[t,n]:[t],this.getECBlocks=function(){return this.ecBlocks}}function r(e,t,n,i,s,r){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=[n,i,s,r];for(var o=0,l=n.ecCodewordsPerBlock,c=n.getECBlocks(),u=0;ui;i++)for(var s=this.alignmentPatternCenters[i]-2,r=0;n>r;r++)0===i&&(0===r||r===n-1)||i===n-1&&0===r||t.setRegion(this.alignmentPatternCenters[r]-2,s,5,5);return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t},this.getECBlocksForLevel=function(e){return this.ecBlocks[e.ordinal]}}function o(){return[new r(1,[],new s(7,new i(1,19)),new s(10,new i(1,16)),new s(13,new i(1,13)),new s(17,new i(1,9))),new r(2,[6,18],new s(10,new i(1,34)),new s(16,new i(1,28)),new s(22,new i(1,22)),new s(28,new i(1,16))),new r(3,[6,22],new s(15,new i(1,55)),new s(26,new i(1,44)),new s(18,new i(2,17)),new s(22,new i(2,13))),new r(4,[6,26],new s(20,new i(1,80)),new s(18,new i(2,32)),new s(26,new i(2,24)),new s(16,new i(4,9))),new r(5,[6,30],new s(26,new i(1,108)),new s(24,new i(2,43)),new s(18,new i(2,15),new i(2,16)),new s(22,new i(2,11),new i(2,12))),new r(6,[6,34],new s(18,new i(2,68)),new s(16,new i(4,27)),new s(24,new i(4,19)),new s(28,new i(4,15))),new r(7,[6,22,38],new s(20,new i(2,78)),new s(18,new i(4,31)),new s(18,new i(2,14),new i(4,15)),new s(26,new i(4,13),new i(1,14))),new r(8,[6,24,42],new s(24,new i(2,97)),new s(22,new i(2,38),new i(2,39)),new s(22,new i(4,18),new i(2,19)),new s(26,new i(4,14),new i(2,15))),new r(9,[6,26,46],new s(30,new i(2,116)),new s(22,new i(3,36),new i(2,37)),new s(20,new i(4,16),new i(4,17)),new s(24,new i(4,12),new i(4,13))),new r(10,[6,28,50],new s(18,new i(2,68),new i(2,69)),new s(26,new i(4,43),new i(1,44)),new s(24,new i(6,19),new i(2,20)),new s(28,new i(6,15),new i(2,16))),new r(11,[6,30,54],new s(20,new i(4,81)),new s(30,new i(1,50),new i(4,51)),new s(28,new i(4,22),new i(4,23)),new s(24,new i(3,12),new i(8,13))),new r(12,[6,32,58],new s(24,new i(2,92),new i(2,93)),new s(22,new i(6,36),new i(2,37)),new s(26,new i(4,20),new i(6,21)),new s(28,new i(7,14),new i(4,15))),new r(13,[6,34,62],new s(26,new i(4,107)),new s(22,new i(8,37),new i(1,38)),new s(24,new i(8,20),new i(4,21)),new s(22,new i(12,11),new i(4,12))),new r(14,[6,26,46,66],new s(30,new i(3,115),new i(1,116)),new s(24,new i(4,40),new i(5,41)),new s(20,new i(11,16),new i(5,17)),new s(24,new i(11,12),new i(5,13))),new r(15,[6,26,48,70],new s(22,new i(5,87),new i(1,88)),new s(24,new i(5,41),new i(5,42)),new s(30,new i(5,24),new i(7,25)),new s(24,new i(11,12),new i(7,13))),new r(16,[6,26,50,74],new s(24,new i(5,98),new i(1,99)),new s(28,new i(7,45),new i(3,46)),new s(24,new i(15,19),new i(2,20)),new s(30,new i(3,15),new i(13,16))),new r(17,[6,30,54,78],new s(28,new i(1,107),new i(5,108)),new s(28,new i(10,46),new i(1,47)),new s(28,new i(1,22),new i(15,23)),new s(28,new i(2,14),new i(17,15))),new r(18,[6,30,56,82],new s(30,new i(5,120),new i(1,121)),new s(26,new i(9,43),new i(4,44)),new s(28,new i(17,22),new i(1,23)),new s(28,new i(2,14),new i(19,15))),new r(19,[6,30,58,86],new s(28,new i(3,113),new i(4,114)),new s(26,new i(3,44),new i(11,45)),new s(26,new i(17,21),new i(4,22)),new s(26,new i(9,13),new i(16,14))),new r(20,[6,34,62,90],new s(28,new i(3,107),new i(5,108)),new s(26,new i(3,41),new i(13,42)),new s(30,new i(15,24),new i(5,25)),new s(28,new i(15,15),new i(10,16))),new r(21,[6,28,50,72,94],new s(28,new i(4,116),new i(4,117)),new s(26,new i(17,42)),new s(28,new i(17,22),new i(6,23)),new s(30,new i(19,16),new i(6,17))),new r(22,[6,26,50,74,98],new s(28,new i(2,111),new i(7,112)),new s(28,new i(17,46)),new s(30,new i(7,24),new i(16,25)),new s(24,new i(34,13))),new r(23,[6,30,54,74,102],new s(30,new i(4,121),new i(5,122)),new s(28,new i(4,47),new i(14,48)),new s(30,new i(11,24),new i(14,25)),new s(30,new i(16,15),new i(14,16))),new r(24,[6,28,54,80,106],new s(30,new i(6,117),new i(4,118)),new s(28,new i(6,45),new i(14,46)),new s(30,new i(11,24),new i(16,25)),new s(30,new i(30,16),new i(2,17))),new r(25,[6,32,58,84,110],new s(26,new i(8,106),new i(4,107)),new s(28,new i(8,47),new i(13,48)),new s(30,new i(7,24),new i(22,25)),new s(30,new i(22,15),new i(13,16))),new r(26,[6,30,58,86,114],new s(28,new i(10,114),new i(2,115)),new s(28,new i(19,46),new i(4,47)),new s(28,new i(28,22),new i(6,23)),new s(30,new i(33,16),new i(4,17))),new r(27,[6,34,62,90,118],new s(30,new i(8,122),new i(4,123)),new s(28,new i(22,45),new i(3,46)),new s(30,new i(8,23),new i(26,24)),new s(30,new i(12,15),new i(28,16))),new r(28,[6,26,50,74,98,122],new s(30,new i(3,117),new i(10,118)),new s(28,new i(3,45),new i(23,46)),new s(30,new i(4,24),new i(31,25)),new s(30,new i(11,15),new i(31,16))),new r(29,[6,30,54,78,102,126],new s(30,new i(7,116),new i(7,117)),new s(28,new i(21,45),new i(7,46)),new s(30,new i(1,23),new i(37,24)),new s(30,new i(19,15),new i(26,16))),new r(30,[6,26,52,78,104,130],new s(30,new i(5,115),new i(10,116)),new s(28,new i(19,47),new i(10,48)),new s(30,new i(15,24),new i(25,25)),new s(30,new i(23,15),new i(25,16))),new r(31,[6,30,56,82,108,134],new s(30,new i(13,115),new i(3,116)),new s(28,new i(2,46),new i(29,47)),new s(30,new i(42,24),new i(1,25)),new s(30,new i(23,15),new i(28,16))),new r(32,[6,34,60,86,112,138],new s(30,new i(17,115)),new s(28,new i(10,46),new i(23,47)),new s(30,new i(10,24),new i(35,25)),new s(30,new i(19,15),new i(35,16))),new r(33,[6,30,58,86,114,142],new s(30,new i(17,115),new i(1,116)),new s(28,new i(14,46),new i(21,47)),new s(30,new i(29,24),new i(19,25)),new s(30,new i(11,15),new i(46,16))),new r(34,[6,34,62,90,118,146],new s(30,new i(13,115),new i(6,116)),new s(28,new i(14,46),new i(23,47)),new s(30,new i(44,24),new i(7,25)),new s(30,new i(59,16),new i(1,17))),new r(35,[6,30,54,78,102,126,150],new s(30,new i(12,121),new i(7,122)),new s(28,new i(12,47),new i(26,48)),new s(30,new i(39,24),new i(14,25)),new s(30,new i(22,15),new i(41,16))),new r(36,[6,24,50,76,102,128,154],new s(30,new i(6,121),new i(14,122)),new s(28,new i(6,47),new i(34,48)),new s(30,new i(46,24),new i(10,25)),new s(30,new i(2,15),new i(64,16))),new r(37,[6,28,54,80,106,132,158],new s(30,new i(17,122),new i(4,123)),new s(28,new i(29,46),new i(14,47)),new s(30,new i(49,24),new i(10,25)),new s(30,new i(24,15),new i(46,16))),new r(38,[6,32,58,84,110,136,162],new s(30,new i(4,122),new i(18,123)),new s(28,new i(13,46),new i(32,47)),new s(30,new i(48,24),new i(14,25)),new s(30,new i(42,15),new i(32,16))),new r(39,[6,26,54,82,110,138,166],new s(30,new i(20,117),new i(4,118)),new s(28,new i(40,47),new i(7,48)),new s(30,new i(43,24),new i(22,25)),new s(30,new i(10,15),new i(67,16))),new r(40,[6,30,58,86,114,142,170],new s(30,new i(19,118),new i(6,119)),new s(28,new i(18,47),new i(31,48)),new s(30,new i(34,24),new i(34,25)),new s(30,new i(20,15),new i(61,16)))]}var a=n(1),l=n(4);r.VERSION_DECODE_INFO=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017],r.VERSIONS=o(),r.getVersionForNumber=function(e){if(1>e||e>40)throw"ArgumentException";return r.VERSIONS[e-1]},r.getProvisionalVersionForDimension=function(e){if(e%4!=1)throw"Error getProvisionalVersionForDimension";try{return r.getVersionForNumber(e-17>>2)}catch(e){throw"Error getVersionForNumber"}},r.decodeVersionInformation=function(e){for(var t=4294967295,n=0,i=0;io&&(n=i+7,t=o)}return 3>=t?this.getVersionForNumber(n):null},e.exports=r},function(e,t,n){"use strict";function i(e,t,n,i,r,o){this.image=e,this.possibleCenters=[],this.width=i,this.height=r,this.moduleSize=o,this.crossCheckStateCount=[0,0,0],this.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},this.foundPatternCross=function(e){for(var t=this.moduleSize/2,n=0;3>n;n++)if(Math.abs(o-e[n])>=t)return!1;return!0},this.crossCheckVertical=function(t,n,i,s){var r=e.height,o=this.crossCheckStateCount;o[0]=0,o[1]=0,o[2]=0;for(var a=t;a>=0&&e[n+a*e.width]&&o[1]<=i;)o[1]++,a--;if(0>a||o[1]>i)return NaN;for(;a>=0&&!e[n+a*e.width]&&o[0]<=i;)o[0]++,a--;if(o[0]>i)return NaN;for(a=t+1;r>a&&e[n+a*e.width]&&o[1]<=i;)o[1]++,a++;if(a===r||o[1]>i)return NaN;for(;r>a&&!e[n+a*e.width]&&o[2]<=i;)o[2]++,a++;if(o[2]>i)return NaN;var l=o[0]+o[1]+o[2];return 5*Math.abs(l-s)>=2*s?NaN:this.foundPatternCross(o)?this.centerFromEnd(o,a):NaN},this.handlePossibleCenter=function(e,t,n){var i=e[0]+e[1]+e[2],r=this.centerFromEnd(e,n),o=this.crossCheckVertical(t,Math.floor(r),2*e[1],i);if(!isNaN(o)){for(var a=(e[0]+e[1]+e[2])/3,l=this.possibleCenters.length,c=0;l>c;c++)if(this.possibleCenters[c].aboutEquals(a,o,r))return new s(r,o,a);var u=new s(r,o,a);this.possibleCenters.push(u)}return null},this.find=function(){for(var s,o=t+i,a=n+(r>>1),l=[0,0,0],c=0;r>c;c++){var u=a+(0==(1&c)?c+1>>1:-(c+1>>1));l[0]=0,l[1]=0,l[2]=0;for(var d=t;o>d&&!e[d+e.width*u];)d++;for(var h=0;o>d;){if(e[d+u*e.width])if(1===h)l[h]++;else if(2===h){if(this.foundPatternCross(l)&&(s=this.handlePossibleCenter(l,u,d)))return s;l[0]=l[2],l[1]=1,l[2]=0,h=1}else l[++h]++;else 1===h&&h++,l[h]++;d++}if(this.foundPatternCross(l)&&null!==(s=this.handlePossibleCenter(l,u,o)))return s}if(0!==this.possibleCenters.length)return this.possibleCenters[0];throw"Couldn't find enough alignment patterns"}}var s=n(8);e.exports=i},function(e,t){"use strict";function n(e,t,n){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=n,this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,n){if(Math.abs(t-this.y)<=e&&Math.abs(n-this.x)<=e){var i=Math.abs(e-this.estimatedModuleSize);return 1>=i||i/this.estimatedModuleSize<=1}return!1}}e.exports=n},function(e,t,n){"use strict";function i(e){var t=e.getDimension();if(21>t||1!=(3&t))throw"Error BitMatrixParser";this.bitMatrix=e,this.parsedVersion=null,this.parsedFormatInfo=null,this.copyBit=function(e,t,n){return this.bitMatrix.getValue(e,t)?n<<1|1:n<<1},this.readFormatInformation=function(){if(this.parsedFormatInfo)return this.parsedFormatInfo;var e,t=0;for(e=0;6>e;e++)t=this.copyBit(e,8,t);t=this.copyBit(7,8,t),t=this.copyBit(8,8,t),t=this.copyBit(8,7,t);for(var n=5;n>=0;n--)t=this.copyBit(8,n,t);if(this.parsedFormatInfo=s.decodeFormatInformation(t),this.parsedFormatInfo)return this.parsedFormatInfo;var i=this.bitMatrix.getDimension();t=0;var r=i-8;for(e=i-1;e>=r;e--)t=this.copyBit(e,8,t);for(n=i-7;i>n;n++)t=this.copyBit(8,n,t);if(this.parsedFormatInfo=s.decodeFormatInformation(t),this.parsedFormatInfo)return this.parsedFormatInfo;throw"Error readFormatInformation"},this.readVersion=function(){if(this.parsedVersion)return this.parsedVersion;var e=this.bitMatrix.getDimension(),t=e-17>>2;if(6>=t)return r.getVersionForNumber(t);var n,i,s=0,o=e-11;for(i=5;i>=0;i--)for(n=e-9;n>=o;n--)s=this.copyBit(n,i,s);if(this.parsedVersion=r.decodeVersionInformation(s),this.parsedVersion&&this.parsedVersion.getDimensionForVersion()===e)return this.parsedVersion;for(s=0,n=5;n>=0;n--)for(i=e-9;i>=o;i--)s=this.copyBit(n,i,s);if(this.parsedVersion=r.decodeVersionInformation(s),this.parsedVersion&&this.parsedVersion.getDimensionForVersion()===e)return this.parsedVersion;throw"Error readVersion"},this.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),n=o.forReference(e.dataMask),i=this.bitMatrix.getDimension();n.unmaskBitMatrix(this.bitMatrix,i);for(var s=t.buildFunctionPattern(),r=!0,a=new Array(t.totalCodewords),l=0,c=0,u=0,d=i-1;d>0;d-=2){6===d&&d--;for(var h=0;i>h;h++)for(var p=r?i-1-h:h,m=0;2>m;m++)s.getValue(d-m,p)||(u++,c<<=1,this.bitMatrix.getValue(d-m,p)&&(c|=1),8===u&&(a[l++]=c,u=0,c=0));r^=!0}if(l!==t.totalCodewords)throw"Error readCodewords";return a}}var s=n(4),r=n(6),o=n(11);e.exports=i},function(e,t){"use strict";function n(e,t){this.numDataCodewords=e,this.codewords=t}n.getDataBlocks=function(e,t,i){if(e.length!==t.totalCodewords)throw"ArgumentException";var s,r,o=t.getECBlocksForLevel(i),a=0,l=o.getECBlocks();for(s=0;s=0&&c[f].codewords.length!==m;)f--;f++;var g=m-o.ecCodewordsPerBlock,A=0;for(s=0;g>s;s++)for(r=0;u>r;r++)c[r].codewords[s]=e[A++];for(r=f;u>r;r++)c[r].codewords[g]=e[A++];var y=c[0].codewords.length;for(s=g;y>s;s++)for(r=0;u>r;r++){var v=f>r?s:s+1;c[r].codewords[v]=e[A++]}return c},e.exports=n},function(e,t,n){"use strict";function i(){this.unmaskBitMatrix=function(e,t){for(var n=0;t>n;n++)for(var i=0;t>i;i++)this.isMasked(n,i)&&e.flip(i,n)},this.isMasked=function(e,t){return 0==(e+t&1)}}function s(){this.unmaskBitMatrix=function(e,t){for(var n=0;t>n;n++)for(var i=0;t>i;i++)this.isMasked(n,i)&&e.flip(i,n)},this.isMasked=function(e){return 0==(1&e)}}function r(){this.unmaskBitMatrix=function(e,t){for(var n=0;t>n;n++)for(var i=0;t>i;i++)this.isMasked(n,i)&&e.flip(i,n)},this.isMasked=function(e,t){return t%3==0}}function o(){this.unmaskBitMatrix=function(e,t){for(var n=0;t>n;n++)for(var i=0;t>i;i++)this.isMasked(n,i)&&e.flip(i,n)},this.isMasked=function(e,t){return(e+t)%3==0}}function a(){this.unmaskBitMatrix=function(e,t){for(var n=0;t>n;n++)for(var i=0;t>i;i++)this.isMasked(n,i)&&e.flip(i,n)},this.isMasked=function(e,t){return 0==(d(e,1)+t/3&1)}}function l(){this.unmaskBitMatrix=function(e,t){for(var n=0;t>n;n++)for(var i=0;t>i;i++)this.isMasked(n,i)&&e.flip(i,n)},this.isMasked=function(e,t){var n=e*t;return(1&n)+n%3==0}}function c(){this.unmaskBitMatrix=function(e,t){for(var n=0;t>n;n++)for(var i=0;t>i;i++)this.isMasked(n,i)&&e.flip(i,n)},this.isMasked=function(e,t){var n=e*t;return 0==((1&n)+n%3&1)}}function u(){this.unmaskBitMatrix=function(e,t){for(var n=0;t>n;n++)for(var i=0;t>i;i++)this.isMasked(n,i)&&e.flip(i,n)},this.isMasked=function(e,t){return 0==((e+t&1)+e*t%3&1)}}var d=n(3).URShift,h={forReference:function(e){if(0>e||e>7)throw"System.ArgumentException";return h.DATA_MASKS[e]}};h.DATA_MASKS=[new i,new s,new r,new o,new a,new l,new c,new u],e.exports=h},function(e,t,n){"use strict";var i=n(19),s=n(2).GF256,r=n(9),o=n(10),a=n(18),l={};l.rsDecoder=new i(s.QR_CODE_FIELD),l.correctErrors=function(e,t){var n,i=e.length,s=new Array(i);for(n=0;i>n;n++)s[n]=255&e[n];var r=e.length-t;try{l.rsDecoder.decode(s,r)}catch(e){throw e}for(n=0;t>n;n++)e[n]=s[n]},l.decode=function(e){var t,n=new r(e),i=n.readVersion(),s=n.readFormatInformation().errorCorrectionLevel,c=n.readCodewords(),u=o.getDataBlocks(c,i,s),d=0;for(t=0;tt;t++)h[p++]=g[t]}return new a(h,i.versionNumber,s.bits)},e.exports=l},function(e,t,n){"use strict";function i(e,t){this.bits=e,this.points=t}function s(e){this.image=e,this.sizeOfBlackWhiteBlackRun=function(t,n,i,s){var r=Math.abs(s-n)>Math.abs(i-t);if(r){var o=t;t=n,n=o,o=i,i=s,s=o}for(var a=Math.abs(i-t),l=Math.abs(s-n),c=-a>>1,u=s>n?1:-1,d=i>t?1:-1,h=0,p=t,m=n;p!==i;p+=d){var f=r?m:p,g=r?p:m;if(1===h?this.image[f+g*e.width]&&h++:this.image[f+g*e.width]||h++,3===h){var A=p-t,y=m-n;return Math.sqrt(A*A+y*y)}if((c+=l)>0){if(m===s)break;m+=u,c-=a}}var v=i-t,b=s-n;return Math.sqrt(v*v+b*b)},this.sizeOfBlackWhiteBlackRunBothWays=function(t,n,i,s){var r=this.sizeOfBlackWhiteBlackRun(t,n,i,s),o=1,a=t-(i-t);0>a?(o=t/(t-a),a=0):a>=e.width&&(o=(e.width-1-t)/(a-t),a=e.width-1);var l=Math.floor(n-(s-n)*o);return o=1,0>l?(o=n/(n-l),l=0):l>=e.height&&(o=(e.height-1-n)/(l-n),l=e.height-1),a=Math.floor(t+(a-t)*o),(r+=this.sizeOfBlackWhiteBlackRun(t,n,a,l))-1},this.calculateModuleSizeOneWay=function(e,t){var n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.x),Math.floor(e.y),Math.floor(t.x),Math.floor(t.y)),i=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.x),Math.floor(t.y),Math.floor(e.x),Math.floor(e.y));return isNaN(n)?i/7:isNaN(i)?n/7:(n+i)/14},this.calculateModuleSize=function(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2},this.distance=function(e,t){var n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)},this.computeDimension=function(e,t,n,i){var s=7+(Math.round(this.distance(e,t)/i)+Math.round(this.distance(e,n)/i)>>1);switch(3&s){case 0:s++;break;case 2:s--;break;case 3:throw"Error dimension"}return s},this.findAlignmentInRegion=function(t,n,i,s){var o=Math.floor(s*t),a=Math.max(0,n-o),l=Math.min(e.width-1,n+o);if(3*t>l-a)throw"Error align";var c=Math.max(0,i-o),u=Math.min(e.height-1,i+o);return new r(this.image,a,c,l-a,u-c,t).find()},this.createTransform=function(e,t,n,i,s){var r,o,a,l,u=s-3.5;return i?(r=i.x,o=i.y,a=l=u-3):(r=t.x-e.x+n.x,o=t.y-e.y+n.y,a=l=u),c.quadrilateralToQuadrilateral(3.5,3.5,u,3.5,a,l,3.5,u,e.x,e.y,t.x,t.y,r,o,n.x,n.y)},this.sampleGrid=function(t,n){return o.sampleGrid3(e,n,t)},this.processFinderPatternInfo=function(e){var t=e.topLeft,n=e.topRight,s=e.bottomLeft,r=this.calculateModuleSize(t,n,s);if(1>r)throw"Error modSize";var o=this.computeDimension(t,n,s,r),l=a.getProvisionalVersionForDimension(o),c=l.getDimensionForVersion()-7,u=null;if(l.alignmentPatternCenters.length>0)for(var d=n.x-t.x+s.x,h=n.y-t.y+s.y,p=1-3/c,m=Math.floor(t.x+p*(d-t.x)),f=Math.floor(t.y+p*(h-t.y)),g=4;16>=g;g<<=1){u=this.findAlignmentInRegion(r,m,f,g);break}var A=this.createTransform(t,n,s,u,o);return new i(this.sampleGrid(A,o),u?[s,t,n,u]:[s,t,n])},this.detect=function(){var e=(new l).findFinderPattern(this.image);return this.processFinderPatternInfo(e)}}var r=n(7),o=n(16),a=n(6),l=n(15),c=n(5);e.exports=s},function(e,t){"use strict";function n(e,t,n){this.ordinal=e,this.bits=t,this.name=n}n.forBits=function(e){if(0>e||e>=o.length)throw"ArgumentException";return o[e]};var i=new n(0,1,"L"),s=new n(1,0,"M"),r=new n(2,3,"Q"),o=[s,i,new n(3,2,"H"),r];e.exports=n},function(e,t){"use strict";function n(e){function t(e,t){var n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)}function n(e,t,n){var i=t.x,s=t.y;return(n.x-i)*(e.y-s)-(n.y-s)*(e.x-i)}var i,s,r,o=t(e[0],e[1]),a=t(e[1],e[2]),l=t(e[0],e[2]);if(a>=o&&a>=l?(s=e[0],i=e[1],r=e[2]):l>=a&&l>=o?(s=e[1],i=e[0],r=e[2]):(s=e[2],i=e[0],r=e[1]),n(i,s,r)<0){var c=i;i=r,r=c}e[0]=i,e[1]=s,e[2]=r}function i(e,t,n){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=n,this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,n){if(Math.abs(t-this.y)<=e&&Math.abs(n-this.x)<=e){var i=Math.abs(e-this.estimatedModuleSize);return 1>=i||i/this.estimatedModuleSize<=1}return!1}}function s(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}function r(){this.image=null,this.possibleCenters=[],this.hasSkipped=!1,this.crossCheckStateCount=[0,0,0,0,0],this.getCrossCheckStateCount=function(){return this.crossCheckStateCount[0]=0,this.crossCheckStateCount[1]=0,this.crossCheckStateCount[2]=0,this.crossCheckStateCount[3]=0,this.crossCheckStateCount[4]=0,this.crossCheckStateCount},this.foundPatternCross=function(e){for(var t=0,n=0;5>n;n++){var i=e[n];if(0===i)return!1;t+=i}if(7>t)return!1;var s=Math.floor((t<=0&&s[t+a*s.width];)o[2]++,a--;if(0>a)return NaN;for(;a>=0&&!s[t+a*s.width]&&o[1]<=n;)o[1]++,a--;if(0>a||o[1]>n)return NaN;for(;a>=0&&s[t+a*s.width]&&o[0]<=n;)o[0]++,a--;if(o[0]>n)return NaN;for(a=e+1;r>a&&s[t+a*s.width];)o[2]++,a++;if(a===r)return NaN;for(;r>a&&!s[t+a*s.width]&&o[3]=n)return NaN;for(;r>a&&s[t+a*s.width]&&o[4]=n)return NaN;var l=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(l-i)>=2*i?NaN:this.foundPatternCross(o)?this.centerFromEnd(o,a):NaN},this.crossCheckHorizontal=function(e,t,n,i){for(var s=this.image,r=s.width,o=this.getCrossCheckStateCount(),a=e;a>=0&&s[a+t*s.width];)o[2]++,a--;if(0>a)return NaN;for(;a>=0&&!s[a+t*s.width]&&o[1]<=n;)o[1]++,a--;if(0>a||o[1]>n)return NaN;for(;a>=0&&s[a+t*s.width]&&o[0]<=n;)o[0]++,a--;if(o[0]>n)return NaN;for(a=e+1;r>a&&s[a+t*s.width];)o[2]++,a++;if(a===r)return NaN;for(;r>a&&!s[a+t*s.width]&&o[3]=n)return NaN;for(;r>a&&s[a+t*s.width]&&o[4]=n)return NaN;var l=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(l-i)>=i?NaN:this.foundPatternCross(o)?this.centerFromEnd(o,a):NaN},this.handlePossibleCenter=function(e,t,n){var s=e[0]+e[1]+e[2]+e[3]+e[4],r=this.centerFromEnd(e,n),o=this.crossCheckVertical(t,Math.floor(r),e[2],s);if(!isNaN(o)&&(r=this.crossCheckHorizontal(Math.floor(r),Math.floor(o),e[2],s),!isNaN(r))){for(var a=s/7,l=!1,c=this.possibleCenters.length,u=0;c>u;u++){var d=this.possibleCenters[u];if(d.aboutEquals(a,o,r)){d.incrementCount(),l=!0;break}}if(!l){var h=new i(r,o,a);this.possibleCenters.push(h)}return!0}return!1},this.selectBestPatterns=function(){var e=this.possibleCenters.length;if(3>e)throw"Couldn't find enough finder patterns";if(e>3){var t,n=0,i=0;for(t=0;e>t;t++){var s=this.possibleCenters[t].estimatedModuleSize;n+=s,i+=s*s}var r=n/e;this.possibleCenters.sort((function(e,t){var n=Math.abs(t.estimatedModuleSize-r),i=Math.abs(e.estimatedModuleSize-r);return i>n?-1:n===i?0:1}));var o=Math.sqrt(i/e-r*r),a=Math.max(.2*r,o);for(t=0;t3;t++){var l=this.possibleCenters[t];Math.abs(l.estimatedModuleSize-r)>a&&(this.possibleCenters.splice(t,1),t--)}}return this.possibleCenters.length>3&&this.possibleCenters.sort((function(e,t){return e.count>t.count?-1:e.count=e)return 0;for(var t=null,n=0;e>n;n++){var i=this.possibleCenters[n];if(i.count>=c){if(t)return this.hasSkipped=!0,Math.floor((Math.abs(t.x-i.x)-Math.abs(t.y-i.y))/2);t=i}}return 0},this.haveMultiplyConfirmedCenters=function(){var e,t,n=0,i=0,s=this.possibleCenters.length;for(e=0;s>e;e++)(t=this.possibleCenters[e]).count>=c&&(n++,i+=t.estimatedModuleSize);if(3>n)return!1;var r=i/s,o=0;for(e=0;s>e;e++)t=this.possibleCenters[e],o+=Math.abs(t.estimatedModuleSize-r);return.05*i>=o},this.findFinderPattern=function(e){var t=!1;this.image=e;var i=e.height,r=e.width,l=Math.floor(3*i/(4*a));(o>l||t)&&(l=o);for(var c=!1,u=new Array(5),d=l-1;i>d&&!c;d+=l){u[0]=0,u[1]=0,u[2]=0,u[3]=0,u[4]=0;for(var h=0,p=0;r>p;p++)if(e[p+d*e.width])1==(1&h)&&h++,u[h]++;else if(0==(1&h))if(4===h)if(this.foundPatternCross(u)){if(this.handlePossibleCenter(u,d,p))if(l=2,this.hasSkipped)c=this.haveMultiplyConfirmedCenters();else{var m=this.findRowSkip();m>u[2]&&(d+=m-u[2]-l,p=r-1)}else{do{p++}while(r>p&&!e[p+d*e.width]);p--}h=0,u[0]=0,u[1]=0,u[2]=0,u[3]=0,u[4]=0}else u[0]=u[2],u[1]=u[3],u[2]=u[4],u[3]=1,u[4]=0,h=3;else u[++h]++;else u[h]++;this.foundPatternCross(u)&&this.handlePossibleCenter(u,d,r)&&(l=u[0],this.hasSkipped&&(c=this.haveMultiplyConfirmedCenters()))}var f=this.selectBestPatterns();return n(f),new s(f)}}var o=3,a=57,l=8,c=2;e.exports=r},function(e,t,n){"use strict";var i=n(1),s=n(5),r={checkAndNudgePoints:function(e,t){var n,i,s,r=e.width,o=e.height,a=!0;for(s=0;sn||n>r||-1>i||i>o)throw"Error.checkAndNudgePoints ";a=!1,-1===n?(t[s]=0,a=!0):n===r&&(t[s]=r-1,a=!0),-1===i?(t[s+1]=0,a=!0):i===o&&(t[s+1]=o-1,a=!0)}for(a=!0,s=t.length-2;s>=0&&a;s-=2){if(n=Math.floor(t[s]),i=Math.floor(t[s+1]),-1>n||n>r||-1>i||i>o)throw"Error.checkAndNudgePoints ";a=!1,-1===n?(t[s]=0,a=!0):n===r&&(t[s]=r-1,a=!0),-1===i?(t[s+1]=0,a=!0):i===o&&(t[s+1]=o-1,a=!0)}},sampleGrid3:function(e,t,n){for(var s=new i(t),o=new Array(t<<1),a=0;t>a;a++){var l,c=o.length,u=a+.5;for(l=0;c>l;l+=2)o[l]=.5+(l>>1),o[l+1]=u;n.transformPoints1(o),r.checkAndNudgePoints(e,o);try{for(l=0;c>l;l+=2){var d=4*Math.floor(o[l])+Math.floor(o[l+1])*e.width*4,h=e[Math.floor(o[l])+e.width*Math.floor(o[l+1])];e.imagedata.data[d]=h?255:0,e.imagedata.data[d+1]=h?255:0,e.imagedata.data[d+2]=0,e.imagedata.data[d+3]=255,h&&s.setValue(l>>1,a)}}catch(e){throw"Error.checkAndNudgePoints"}}return s},sampleGridx:function(e,t,n,i,o,a,l,c,u,d,h,p,m,f,g,A,y,v){var b=s.quadrilateralToQuadrilateral(n,i,o,a,l,c,u,d,h,p,m,f,g,A,y,v);return r.sampleGrid3(e,t,b)}};e.exports=r},function(e,t,n){"use strict";var i=n(1),s={extractPureBits:function(e){var t=this.getTopLeftOnBit(e),n=this.getBottomRightOnBit(e);if(!t||!n)throw"not found";var s=this.getModuleSize(t,e);if(!s)throw"not found";var r=t[1],o=n[1],a=t[0],l=n[0];if(a>=l||r>=o)throw"not found";o-r!=l-a&&(l=a+(o-r));var c=Math.round((l-a+1)/s),u=Math.round((o-r+1)/s);if(0>=c||0>=u)throw"not found";if(u!==c)throw"not found";var d=Math.floor(s/2),h=(a+=d)+(c-1)*s-l;if(h>0){if(h>d)throw"not found";a-=h}var p=(r+=d)+(u-1)*s-o;if(p>0){if(p>d)throw"not found";r-=p}for(var m=e.width,f=new i(c,u),g=0;u>g;g++)for(var A=r+g*s,y=0;c>y;y++)e[a+y*s+A*m]&&f.setValue(y,g);return f},getModuleSize:function(e,t){for(var n=t.height,i=t.width,s=e[0],r=e[1],o=1,a=0;i>s&&n>r;){if(o!==t[s+r*i]){if(5==++a)break;o=o?0:1}s++,r++}return s===i||r===n?null:(s-e[0])/7},getTopLeftOnBit:function(e){for(var t=0;t=0&&0===e[t];)t--;if(0>t)throw"not found";return[t%e.width,Math.floor(t/e.width)]}};e.exports=s},function(e,t){"use strict";function n(e,t,n){this.blockPointer=0,this.bitPointer=7,this.dataLength=0,this.blocks=e,this.numErrorCorrectionCode=n,9>=t?this.dataLengthMode=0:t>=10&&26>=t?this.dataLengthMode=1:t>=27&&40>=t&&(this.dataLengthMode=2),this.getNextBits=function(e){var t,n,i=0;if(et;t++)s+=1<>this.bitPointer-e+1,this.bitPointer-=e,i}if(e>8-(e-(this.bitPointer+1)),this.bitPointer=this.bitPointer-e%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),i}if(e>8-(e-(this.bitPointer+1+8))),this.bitPointer=this.bitPointer-(e-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),i}return 0},this.nextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},this.getDataLength=function(e){for(var t=0;e>>t!=1;)t++;return this.getNextBits(i[this.dataLengthMode][t])},this.getRomanAndFigureString=function(e){var t=e,n=0,i="",s=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];do{if(t>1){var r=(n=this.getNextBits(11))%45;i+=s[Math.floor(n/45)],i+=s[r],t-=2}else 1===t&&(i+=s[n=this.getNextBits(6)],t-=1)}while(t>0);return i},this.getFigureString=function(e){var t=e,n=0,i="";do{t>=3?(100>(n=this.getNextBits(10))&&(i+="0"),10>n&&(i+="0"),t-=3):2===t?(10>(n=this.getNextBits(7))&&(i+="0"),t-=2):1===t&&(n=this.getNextBits(4),t-=1),i+=n}while(t>0);return i},this.get8bitByteArray=function(e){var t=e,n=0,i=[];do{n=this.getNextBits(8),i.push(n),t--}while(t>0);return i},this.getKanjiString=function(e){var t=e,n=0,i="";do{var s=((n=this.getNextBits(13))/192<<8)+n%192,r=0;r=40956>=s+33088?s+33088:s+49472,i+=String.fromCharCode(r),t--}while(t>0);return i},this.getDataByte=function(){for(var e=[],t=1,n=2,i=4,s=8;;){var r=this.nextMode();if(0===r){if(e.length>0)break;throw"Empty data block"}if(r!==t&&r!==n&&r!==i&&r!==s)throw"Invalid mode: "+r+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";var o,a,l=this.getDataLength(r);if(1>l)throw"Invalid data length: "+l;switch(r){case t:o=this.getFigureString(l),a=new Array(o.length);for(var c=0;cn;n++){var c=i.evaluateAt(this.field.exp(a?n+1:n));o[o.length-1-n]=c,c&&(l=!1)}if(!l){var u=new r(this.field,o),d=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),u,t),h=d[0],p=d[1],m=this.findErrorLocations(h),f=this.findErrorMagnitudes(p,m,a);for(n=0;ng)throw"ReedSolomonException Bad error location";e[g]=s.addOrSubtract(e[g],f[n])}}},this.runEuclideanAlgorithm=function(e,t,n){if(e.degree=Math.floor(n/2);){var u=s,d=o,h=l;if(o=a,l=c,(s=r).zero)throw"r_{i-1} was zero";r=u;for(var p=this.field.zero,m=s.getCoefficient(s.degree),f=this.field.inverse(m);r.degree>=s.degree&&!r.zero;){var g=r.degree-s.degree,A=this.field.multiply(r.getCoefficient(r.degree),f);p=p.addOrSubtract(this.field.buildMonomial(g,A)),r=r.addOrSubtract(s.multiplyByMonomial(g,A))}a=p.multiply1(o).addOrSubtract(d),c=p.multiply1(l).addOrSubtract(h)}var y=c.getCoefficient(0);if(0===y)throw"ReedSolomonException sigmaTilde(0) was zero";var v=this.field.inverse(y);return[c.multiply2(v),r.multiply2(v)]},this.findErrorLocations=function(e){var t=e.degree;if(1===t)return new Array(e.getCoefficient(1));for(var n=new Array(t),i=0,s=1;256>s&&t>i;s++)0===e.evaluateAt(s)&&(n[i]=this.field.inverse(s),i++);if(i!==t)throw"Error locator degree does not match number of roots";return n},this.findErrorMagnitudes=function(e,t,n){for(var i=t.length,r=new Array(i),o=0;i>o;o++){for(var a=this.field.inverse(t[o]),l=1,c=0;i>c;c++)o!==c&&(l=this.field.multiply(l,s.addOrSubtract(1,this.field.multiply(t[c],a))));r[o]=this.field.multiply(e.evaluateAt(a),this.field.inverse(l)),n&&(r[o]=this.field.multiply(r[o],a))}return r}}var s=n(2).GF256,r=n(2).GF256Poly;e.exports=i}])},3617:function(e,t,n){var i,s;e.exports=(i=n(7707),s=n(7707),(()=>{var e={6378:e=>{"use strict";function t(e,t){this.sigmaWords=[1634760805,857760878,2036477234,1797285236],this.block=new Uint8Array(64),this.blockUsed=64,this.x=new Uint32Array(16);var n=new Uint32Array(16);n[0]=this.sigmaWords[0],n[1]=this.sigmaWords[1],n[2]=this.sigmaWords[2],n[3]=this.sigmaWords[3],n[4]=i(e,0),n[5]=i(e,4),n[6]=i(e,8),n[7]=i(e,12),n[8]=i(e,16),n[9]=i(e,20),n[10]=i(e,24),n[11]=i(e,28),n[12]=0,12===t.length?(n[13]=i(t,0),n[14]=i(t,4),n[15]=i(t,8)):(n[13]=0,n[14]=i(t,0),n[15]=i(t,4)),this.input=n}function n(e,t,n,i,s){e[t]+=e[n],e[s]=r(e[s]^e[t],16),e[i]+=e[s],e[n]=r(e[n]^e[i],12),e[t]+=e[n],e[s]=r(e[s]^e[t],8),e[i]+=e[s],e[n]=r(e[n]^e[i],7)}function i(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function s(e,t,n){e[t]=n,n>>>=8,e[t+1]=n,n>>>=8,e[t+2]=n,n>>>=8,e[t+3]=n}function r(e,t){return e<>>32-t}t.prototype.getBytes=function(e){for(var t=new Uint8Array(e),n=0;n0;e-=2)n(i,0,4,8,12),n(i,1,5,9,13),n(i,2,6,10,14),n(i,3,7,11,15),n(i,0,5,10,15),n(i,1,6,11,12),n(i,2,7,8,13),n(i,3,4,9,14);for(e=16;e--;)i[e]+=t[e];for(e=16;e--;)s(r,4*e,i[e]);t[12]+=1,t[12]||(t[13]+=1)},t.prototype.encrypt=function(e){for(var t=e.length,n=new Uint8Array(t),i=0,s=this.block;i{"use strict";var i=n(2327),s=n(1025),r=n(6736),o=n(6378),a=n.g.crypto,l=a?a.subtle||a.webkitSubtle:null,c=n.g.process&&n.g.process.versions&&n.g.process.versions.node?n(6417):null;function u(){}function d(){}u.prototype.importKey=function(e){var t=this;return l.importKey("raw",e,{name:"AES-CBC"},!1,["encrypt","decrypt"]).then((function(e){t.key=e}))},u.prototype.encrypt=function(e,t){return l.encrypt({name:"AES-CBC",iv:t},this.key,e)},u.prototype.decrypt=function(e,t){return l.decrypt({name:"AES-CBC",iv:t},this.key,e).catch((function(){throw new s(r.ErrorCodes.InvalidKey,"invalid key")}))},d.prototype.importKey=function(e){return this.key=e,Promise.resolve()},d.prototype.encrypt=function(e,t){var n=this;return Promise.resolve().then((function(){var s=c.createCipheriv("aes-256-cbc",Buffer.from(n.key),Buffer.from(t)),r=s.update(Buffer.from(e));return i.arrayToBuffer(Buffer.concat([r,s.final()]))}))},d.prototype.decrypt=function(e,t){var n=this;return Promise.resolve().then((function(){var s=c.createDecipheriv("aes-256-cbc",Buffer.from(n.key),Buffer.from(t)),r=s.update(Buffer.from(e));return i.arrayToBuffer(Buffer.concat([r,s.final()]))})).catch((function(){throw new s(r.ErrorCodes.InvalidKey,"invalid key")}))},e.exports.subtle=l,e.exports.webCrypto=a,e.exports.nodeCrypto=c,e.exports.sha256=function(e){return e.byteLength?l?l.digest({name:"SHA-256"},e):c?new Promise((function(t){t(c.createHash("sha256").update(Buffer.from(e)).digest().buffer)})):Promise.reject(new s(r.ErrorCodes.NotImplemented,"SHA256 not implemented")):Promise.resolve(i.arrayToBuffer(i.hexToBytes("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")))},e.exports.sha512=function(e){return e.byteLength?l?l.digest({name:"SHA-512"},e):c?new Promise((function(t){t(c.createHash("sha512").update(Buffer.from(e)).digest().buffer)})):Promise.reject(new s(r.ErrorCodes.NotImplemented,"SHA512 not implemented")):Promise.resolve(i.arrayToBuffer(i.hexToBytes("cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e")))},e.exports.hmacSha256=function(e,t){if(l){var n={name:"HMAC",hash:{name:"SHA-256"}};return l.importKey("raw",e,n,!1,["sign"]).then((function(e){return l.sign(n,e,t)}))}return c?new Promise((function(n){n(c.createHmac("sha256",Buffer.from(e)).update(Buffer.from(t)).digest().buffer)})):Promise.reject(new s(r.ErrorCodes.NotImplemented,"HMAC-SHA256 not implemented"))},e.exports.random=function(e){if(l)return function(e){for(var t=new Uint8Array(e);e>0;){var n=e%65536;n=n>0?n:65536;var i=new Uint8Array(n);a.getRandomValues(i),e-=n,t.set(i,e)}return t}(e);if(c)return new Uint8Array(c.randomBytes(e));throw new s(r.ErrorCodes.NotImplemented,"Random not implemented")},e.exports.createAesCbc=function(){if(l)return new u;if(c)return new d;throw new s(r.ErrorCodes.NotImplemented,"AES-CBC not implemented")},e.exports.chacha20=function(e,t,n){return Promise.resolve().then((function(){var s=new o(new Uint8Array(t),new Uint8Array(n));return i.arrayToBuffer(s.encrypt(new Uint8Array(e)))}))},e.exports.argon2=function(e,t,n,i,o,a,l,c){return Promise.reject(new s(r.ErrorCodes.NotImplemented,"Argon2 not implemented"))},e.exports.Argon2TypeArgon2d=0,e.exports.Argon2TypeArgon2id=2,e.exports.configure=function(e,t,n){l=e,a=t,c=n}},4768:(e,t,n)=>{"use strict";var i=n(3677),s=n(1025),r=n(6736),o=n(2327),a=n(9692);e.exports.decrypt=function(e){return Promise.resolve().then((function(){var t,n=new i(e),l=[],c=0,u=0,d=function(){if(n.getUint32(!0),t=n.readBytes(32),(c=n.getUint32(!0))>0){u+=c;var e=n.readBytes(c);return a.sha256(e).then((function(n){if(o.arrayBufferEquals(n,t))return l.push(e),d();throw new s(r.ErrorCodes.FileCorrupt,"invalid hash block")}))}for(var i=new Uint8Array(u),h=0,p=0;p0){var c=Math.min(1048576,t);t-=c;var u=e.slice(n,n+c);return a.sha256(u).then((function(e){var t=new ArrayBuffer(40),a=new i(t);return a.setUint32(s,!0),a.writeBytes(e),a.setUint32(c,!0),o.push(t),r+=t.byteLength,o.push(u),r+=u.byteLength,s++,n+=c,l()}))}var d=new ArrayBuffer(40);new DataView(d).setUint32(0,s,!0),o.push(d),r+=d.byteLength;for(var h=new Uint8Array(r),p=0,m=0;m{"use strict";var i=n(1923),s=n(1025),r=n(6736),o=n(2327),a=n(3677),l=n(9692);function c(e,t){var n=new Uint8Array(8+e.byteLength);n.set(new Uint8Array(e),8);var i=new DataView(n.buffer);return i.setUint32(0,t.lo,!0),i.setUint32(4,t.hi,!0),l.sha512(o.arrayToBuffer(n)).then((function(e){return o.zeroBuffer(n),e}))}function u(e,t,n,s){return c(e,new i(t)).then((function(e){var i=new Uint8Array(s.byteLength+4+8),r=new DataView(i.buffer);return i.set(new Uint8Array(s),12),r.setInt32(0,t,!0),r.setInt32(8,n,!0),l.hmacSha256(e,i.buffer)}))}e.exports.getHmacKey=c,e.exports.decrypt=function(e,t){var n=new a(e);return Promise.resolve().then((function(){var e,i=[],a=0,l=0,c=0,d=function(){if(e=n.readBytes(32),(l=n.getUint32(!0))>0){c+=l;var h=n.readBytes(l);return u(t,a,l,h).then((function(t){if(o.arrayBufferEquals(t,e))return i.push(h),a++,d();throw new s(r.ErrorCodes.FileCorrupt,"invalid hash block")}))}for(var p=new Uint8Array(c),m=0,f=0;f0)return o.push(d),r+=d.byteLength,s++,i+=c,l();for(var u=new Uint8Array(r),h=0,p=0;p{"use strict";var i=n(2327),s=n(9692),r=16;function o(e,t,n){for(var s=Promise.resolve(i.arrayToBuffer(t)),o=new Uint8Array(r*Math.min(n,1e4));n>0;){var l=Math.min(n,1e4);n-=l;var c=r*l;s=a(e,s,o.length===c?o.buffer:i.arrayToBuffer(o.subarray(0,c)))}return s.then((function(e){return new Uint8Array(e)}))}function a(e,t,n){return t.then((function(t){return e.encrypt(n,t)})).then((function(e){var t=i.arrayToBuffer(new Uint8Array(e).subarray(-32,-16));return i.zeroBuffer(e),t}))}e.exports.encrypt=function(e,t,n){var a=s.createAesCbc();return a.importKey(i.arrayToBuffer(t)).then((function(){for(var t=[],i=0;i<32;i+=r)t.push(o(a,e.subarray(i,i+r),n));return Promise.all(t)})).then((function(e){var t=new Uint8Array(32);return e.forEach((function(e,n){for(var s=n*r,o=0;o{"use strict";var i=n(6736),s=n(2327),r=n(1076),o=n(1923),a=n(9692),l=n(1025),c=n(390),u=[{name:"salt",field:"S",type:r.ValueType.Bytes},{name:"parallelism",field:"P",type:r.ValueType.UInt32},{name:"memory",field:"M",type:r.ValueType.UInt64},{name:"iterations",field:"I",type:r.ValueType.UInt64},{name:"version",field:"V",type:r.ValueType.UInt32},{name:"secretKey",field:"K",type:r.ValueType.Bytes},{name:"assocData",field:"A",type:r.ValueType.Bytes},{name:"rounds",field:"R",type:r.ValueType.UInt64}];function d(e){var t={};return u.forEach((function(n){var i=e.get(n.field);i&&(i instanceof o&&(i=i.value),t[n.name]=i)})),t}function h(e,t,n){var s=d(t);return s.salt instanceof ArrayBuffer&&32===s.salt.byteLength?"number"!=typeof s.parallelism||s.parallelism<1?Promise.reject(new l(i.ErrorCodes.FileCorrupt,"bad argon2 parallelism")):"number"!=typeof s.iterations||s.iterations<1?Promise.reject(new l(i.ErrorCodes.FileCorrupt,"bad argon2 iterations")):"number"!=typeof s.memory||s.memory<1||s.memory%1024!=0?Promise.reject(new l(i.ErrorCodes.FileCorrupt,"bad argon2 memory")):19!==s.version&&16!==s.version?Promise.reject(new l(i.ErrorCodes.FileCorrupt,"bad argon2 version")):s.secretKey?Promise.reject(new l(i.ErrorCodes.Unsupported,"argon2 secret key")):s.assocData?Promise.reject(new l(i.ErrorCodes.Unsupported,"argon2 assoc data")):a.argon2(e,s.salt,s.memory/1024,s.iterations,32,s.parallelism,n,s.version):Promise.reject(new l(i.ErrorCodes.FileCorrupt,"bad argon2 salt"))}e.exports.encrypt=function(e,t){var n=t.get("$UUID");if(!(n&&n instanceof ArrayBuffer))return Promise.reject(new l(i.ErrorCodes.FileCorrupt,"no kdf uuid"));switch(s.bytesToBase64(n)){case i.KdfId.Argon2d:return h(e,t,a.Argon2TypeArgon2d);case i.KdfId.Argon2id:return h(e,t,a.Argon2TypeArgon2id);case i.KdfId.Aes:return function(e,t){var n=d(t);return n.salt instanceof ArrayBuffer&&32===n.salt.byteLength?"number"!=typeof n.rounds||n.rounds<1?Promise.reject(new l(i.ErrorCodes.FileCorrupt,"bad aes rounds")):c.encrypt(new Uint8Array(e),new Uint8Array(n.salt),n.rounds).then((function(e){return a.sha256(e).then((function(t){return s.zeroBuffer(e),t}))})):Promise.reject(new l(i.ErrorCodes.FileCorrupt,"bad aes salt"))}(e,t);default:return Promise.reject(new l(i.ErrorCodes.Unsupported,"bad kdf"))}}},5073:(e,t,n)=>{"use strict";var i=n(9928),s=n(6378),r=n(6736),o=n(1025),a=n(9692),l=n(2327),c=[232,48,9,75,151,32,93,42],u=function(e){this.algo=e};u.prototype.getSalt=function(e){return l.arrayToBuffer(this.algo.getBytes(e))},u.create=function(e,t){switch(t){case r.CrsAlgorithm.Salsa20:return a.sha256(l.arrayToBuffer(e)).then((function(e){var t=new Uint8Array(e),n=new i(t,c);return new u(n)}));case r.CrsAlgorithm.ChaCha20:return a.sha512(l.arrayToBuffer(e)).then((function(e){var t=new Uint8Array(e,0,32),n=new Uint8Array(e,32,12),i=new s(t,n);return new u(i)}));default:return Promise.reject(new o(r.ErrorCodes.Unsupported,"crsAlgorithm"))}},e.exports=u},8423:(e,t,n)=>{"use strict";var i=n(2327),s=n(9692),r=n(3586),o=function(e,t){Object.defineProperty(this,"_value",{value:new Uint8Array(e)}),Object.defineProperty(this,"_salt",{value:new Uint8Array(t)})};o.prototype.toString=function(){return i.bytesToBase64(this._value)},o.fromString=function(e){for(var t=i.stringToBytes(e),n=r.getBytes(t.length),s=0,a=t.length;s=0;i--)n[i]=e[i]^t[i];return n},o.prototype.setSalt=function(e){for(var t=new Uint8Array(e),n=this._value,i=this._salt,s=0,r=n.length;s{"use strict";for(var i=n(9928),s=n(9692),r=new Uint8Array(32),o=new Uint8Array(8),a=0;a=0;--i)t[i]^=n[i];return t}},9928:e=>{"use strict";function t(e,t){this.rounds=20,this.sigmaWords=[1634760805,857760878,2036477234,1797285236],this.keyWords=[],this.nonceWords=[0,0],this.counterWords=[0,0],this.block=[],this.blockUsed=64,this.setKey(e),this.setNonce(t)}t.prototype.setKey=function(e){for(var t=0,n=0;t<8;t++,n+=4)this.keyWords[t]=255&e[n]|(255&e[n+1])<<8|(255&e[n+2])<<16|(255&e[n+3])<<24;this._reset()},t.prototype.setNonce=function(e){this.nonceWords[0]=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,this.nonceWords[1]=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,this._reset()},t.prototype.getBytes=function(e){for(var t=new Uint8Array(e),n=0;n>4&15]),n.push(t[15&i[s]]);return n.join("")},t.prototype._reset=function(){this.counterWords[0]=0,this.counterWords[1]=0,this.blockUsed=64},t.prototype._incrementCounter=function(){this.counterWords[0]=this.counterWords[0]+1&4294967295,0===this.counterWords[0]&&(this.counterWords[1]=this.counterWords[1]+1&4294967295)},t.prototype._generateBlock=function(){for(var e,t=this.sigmaWords[0],n=this.keyWords[0],i=this.keyWords[1],s=this.keyWords[2],r=this.keyWords[3],o=this.sigmaWords[1],a=this.nonceWords[0],l=this.nonceWords[1],c=this.counterWords[0],u=this.counterWords[1],d=this.sigmaWords[2],h=this.keyWords[4],p=this.keyWords[5],m=this.keyWords[6],f=this.keyWords[7],g=this.sigmaWords[3],A=t,y=n,v=i,b=s,w=r,k=o,C=a,_=l,E=c,I=u,S=d,x=h,B=p,T=m,P=f,D=g,F=0;F>>25)+A)<<9|e>>>23)+w)<<13|e>>>19)+E)<<18|e>>>14,k^=(e=(y^=(e=(T^=(e=(I^=(e=k+y)<<7|e>>>25)+k)<<9|e>>>23)+I)<<13|e>>>19)+T)<<18|e>>>14,S^=(e=(C^=(e=(v^=(e=(P^=(e=S+C)<<7|e>>>25)+S)<<9|e>>>23)+P)<<13|e>>>19)+v)<<18|e>>>14,D^=(e=(x^=(e=(_^=(e=(b^=(e=D+x)<<7|e>>>25)+D)<<9|e>>>23)+b)<<13|e>>>19)+_)<<18|e>>>14,A^=(e=(b^=(e=(v^=(e=(y^=(e=A+b)<<7|e>>>25)+A)<<9|e>>>23)+y)<<13|e>>>19)+v)<<18|e>>>14,k^=(e=(w^=(e=(_^=(e=(C^=(e=k+w)<<7|e>>>25)+k)<<9|e>>>23)+C)<<13|e>>>19)+_)<<18|e>>>14,S^=(e=(I^=(e=(E^=(e=(x^=(e=S+I)<<7|e>>>25)+S)<<9|e>>>23)+x)<<13|e>>>19)+E)<<18|e>>>14,D^=(e=(P^=(e=(T^=(e=(B^=(e=D+P)<<7|e>>>25)+D)<<9|e>>>23)+B)<<13|e>>>19)+T)<<18|e>>>14;A+=t,y+=n,v+=i,b+=s,w+=r,k+=o,C+=a,_+=l,E+=c,I+=u,S+=d,x+=h,B+=p,T+=m,P+=f,D+=g,this.block[0]=A>>>0&255,this.block[1]=A>>>8&255,this.block[2]=A>>>16&255,this.block[3]=A>>>24&255,this.block[4]=y>>>0&255,this.block[5]=y>>>8&255,this.block[6]=y>>>16&255,this.block[7]=y>>>24&255,this.block[8]=v>>>0&255,this.block[9]=v>>>8&255,this.block[10]=v>>>16&255,this.block[11]=v>>>24&255,this.block[12]=b>>>0&255,this.block[13]=b>>>8&255,this.block[14]=b>>>16&255,this.block[15]=b>>>24&255,this.block[16]=w>>>0&255,this.block[17]=w>>>8&255,this.block[18]=w>>>16&255,this.block[19]=w>>>24&255,this.block[20]=k>>>0&255,this.block[21]=k>>>8&255,this.block[22]=k>>>16&255,this.block[23]=k>>>24&255,this.block[24]=C>>>0&255,this.block[25]=C>>>8&255,this.block[26]=C>>>16&255,this.block[27]=C>>>24&255,this.block[28]=_>>>0&255,this.block[29]=_>>>8&255,this.block[30]=_>>>16&255,this.block[31]=_>>>24&255,this.block[32]=E>>>0&255,this.block[33]=E>>>8&255,this.block[34]=E>>>16&255,this.block[35]=E>>>24&255,this.block[36]=I>>>0&255,this.block[37]=I>>>8&255,this.block[38]=I>>>16&255,this.block[39]=I>>>24&255,this.block[40]=S>>>0&255,this.block[41]=S>>>8&255,this.block[42]=S>>>16&255,this.block[43]=S>>>24&255,this.block[44]=x>>>0&255,this.block[45]=x>>>8&255,this.block[46]=x>>>16&255,this.block[47]=x>>>24&255,this.block[48]=B>>>0&255,this.block[49]=B>>>8&255,this.block[50]=B>>>16&255,this.block[51]=B>>>24&255,this.block[52]=T>>>0&255,this.block[53]=T>>>8&255,this.block[54]=T>>>16&255,this.block[55]=T>>>24&255,this.block[56]=P>>>0&255,this.block[57]=P>>>8&255,this.block[58]=P>>>16&255,this.block[59]=P>>>24&255,this.block[60]=D>>>0&255,this.block[61]=D>>>8&255,this.block[62]=D>>>16&255,this.block[63]=D>>>24&255},e.exports=t},6736:e=>{"use strict";e.exports.Signatures={FileMagic:2594363651,Sig2Kdbx:3041655655,Sig2Kdb:3041655653},e.exports.ErrorCodes={NotImplemented:"NotImplemented",InvalidArg:"InvalidArg",BadSignature:"BadSignature",InvalidVersion:"InvalidVersion",Unsupported:"Unsupported",FileCorrupt:"FileCorrupt",InvalidKey:"InvalidKey",MergeError:"MergeError"},e.exports.CompressionAlgorithm={None:0,GZip:1},e.exports.CrsAlgorithm={Null:0,ArcFourVariant:1,Salsa20:2,ChaCha20:3},e.exports.KdfId={Argon2:"72Nt34wpREuR96mkA+MKDA==",Argon2d:"72Nt34wpREuR96mkA+MKDA==",Argon2id:"nimLGVbbR3OyPfw+xvCh5g==",Aes:"ydnzmmKKRGC/dA0IwYpP6g=="},e.exports.CipherId={Aes:"McHy5r9xQ1C+WAUhavxa/w==",ChaCha20:"1gOKK4tvTLWlJDOaMdu1mg=="},e.exports.AutoTypeObfuscationOptions={None:0,UseClipboard:1},e.exports.Defaults={KeyEncryptionRounds:3e5,MntncHistoryDays:365,HistoryMaxItems:10,HistoryMaxSize:6291456,RecycleBinName:"Recycle Bin"},e.exports.Icons={Key:0,World:1,Warning:2,NetworkServer:3,MarkedDirectory:4,UserCommunication:5,Parts:6,Notepad:7,WorldSocket:8,Identity:9,PaperReady:10,Digicam:11,IRCommunication:12,MultiKeys:13,Energy:14,Scanner:15,WorldStar:16,CDRom:17,Monitor:18,EMail:19,Configuration:20,ClipboardReady:21,PaperNew:22,Screen:23,EnergyCareful:24,EMailBox:25,Disk:26,Drive:27,PaperQ:28,TerminalEncrypted:29,Console:30,Printer:31,ProgramIcons:32,Run:33,Settings:34,WorldComputer:35,Archive:36,Homebanking:37,DriveWindows:39,Clock:39,EMailSearch:40,PaperFlag:41,Memory:42,TrashBin:43,Note:44,Expired:45,Info:46,Package:47,Folder:48,FolderOpen:49,FolderPackage:50,LockOpen:51,PaperLocked:52,Checked:53,Pen:54,Thumbnail:55,Book:56,List:57,UserKey:58,Tool:59,Home:60,Star:61,Tux:62,Feather:63,Apple:64,Wiki:65,Money:66,Certificate:67,BlackBerry:68}},7953:e=>{"use strict";e.exports={Elem:{DocNode:"KeePassFile",Meta:"Meta",Root:"Root",Group:"Group",Entry:"Entry",Generator:"Generator",HeaderHash:"HeaderHash",SettingsChanged:"SettingsChanged",DbName:"DatabaseName",DbNameChanged:"DatabaseNameChanged",DbDesc:"DatabaseDescription",DbDescChanged:"DatabaseDescriptionChanged",DbDefaultUser:"DefaultUserName",DbDefaultUserChanged:"DefaultUserNameChanged",DbMntncHistoryDays:"MaintenanceHistoryDays",DbColor:"Color",DbKeyChanged:"MasterKeyChanged",DbKeyChangeRec:"MasterKeyChangeRec",DbKeyChangeForce:"MasterKeyChangeForce",RecycleBinEnabled:"RecycleBinEnabled",RecycleBinUuid:"RecycleBinUUID",RecycleBinChanged:"RecycleBinChanged",EntryTemplatesGroup:"EntryTemplatesGroup",EntryTemplatesGroupChanged:"EntryTemplatesGroupChanged",HistoryMaxItems:"HistoryMaxItems",HistoryMaxSize:"HistoryMaxSize",LastSelectedGroup:"LastSelectedGroup",LastTopVisibleGroup:"LastTopVisibleGroup",MemoryProt:"MemoryProtection",ProtTitle:"ProtectTitle",ProtUserName:"ProtectUserName",ProtPassword:"ProtectPassword",ProtUrl:"ProtectURL",ProtNotes:"ProtectNotes",CustomIcons:"CustomIcons",CustomIconItem:"Icon",CustomIconItemID:"UUID",CustomIconItemData:"Data",AutoType:"AutoType",History:"History",Name:"Name",Notes:"Notes",Uuid:"UUID",Icon:"IconID",CustomIconID:"CustomIconUUID",FgColor:"ForegroundColor",BgColor:"BackgroundColor",OverrideUrl:"OverrideURL",Times:"Times",Tags:"Tags",CreationTime:"CreationTime",LastModTime:"LastModificationTime",LastAccessTime:"LastAccessTime",ExpiryTime:"ExpiryTime",Expires:"Expires",UsageCount:"UsageCount",LocationChanged:"LocationChanged",GroupDefaultAutoTypeSeq:"DefaultAutoTypeSequence",EnableAutoType:"EnableAutoType",EnableSearching:"EnableSearching",String:"String",Binary:"Binary",Key:"Key",Value:"Value",AutoTypeEnabled:"Enabled",AutoTypeObfuscation:"DataTransferObfuscation",AutoTypeDefaultSeq:"DefaultSequence",AutoTypeItem:"Association",Window:"Window",KeystrokeSequence:"KeystrokeSequence",Binaries:"Binaries",IsExpanded:"IsExpanded",LastTopVisibleEntry:"LastTopVisibleEntry",DeletedObjects:"DeletedObjects",DeletedObject:"DeletedObject",DeletionTime:"DeletionTime",CustomData:"CustomData",StringDictExItem:"Item"},Attr:{Id:"ID",Ref:"Ref",Protected:"Protected",ProtectedInMemPlainXml:"ProtectInMemory",Compressed:"Compressed"},Val:{False:"False",True:"True"}}},1025:e=>{"use strict";function t(e,t){this.name="KdbxError",this.code=e,this.message="Error "+e+(t?": "+t:"")}t.prototype=Error.prototype,e.exports=t},7949:(e,t,n)=>{"use strict";var i=n(8423),s=n(9692),r=n(2327),o=function(){Object.defineProperties(this,{idToHash:{value:{}},hashOrder:{value:null,configurable:!0}})};o.prototype.hash=function(){var e=[],t=this;return Object.keys(t).forEach((function(n){var i=t[n];e.push(t.getBinaryHash(i).then((function(e){t.idToHash[n]=e,t[e]=t[n],delete t[n]})))})),Promise.all(e)},o.prototype.getBinaryHash=function(e){var t;return e instanceof i?t=e.getHash():(e instanceof ArrayBuffer||e instanceof Uint8Array)&&(e=r.arrayToBuffer(e),t=s.sha256(e)),t.then((function(e){return r.bytesToHex(e)}))},o.prototype.assignIds=function(){Object.defineProperty(this,"hashOrder",{value:Object.keys(this),configurable:!0})},o.prototype.add=function(e){var t=this;return this.getBinaryHash(e).then((function(n){return t[n]=e,{ref:n,value:e}}))},e.exports=o},5293:(e,t,n)=>{"use strict";var i=n(4422),s=function(e){this.kdbx=e.kdbx,this.exportXml=e.exportXml||!1};s.prototype.setXmlDate=function(e,t){var n=this.kdbx.header.versionMajor>=4&&!this.exportXml;i.setDate(e,t,n)},e.exports=s},3449:(e,t,n)=>{"use strict";var i=n(8423),s=n(1025),r=n(6736),o=n(2327),a=n(4422),l=n(3586),c=n(9692),u=function(e,t,n){var i=this;this.ready=Promise.all([this.setPassword(e),this.setKeyFile(t),this.setChallengeResponse(n)]).then((function(){return i}))};u.prototype.setPassword=function(e){if(null!==e){if(e instanceof i){var t=this;return e.getHash().then((function(e){t.passwordHash=i.fromBinary(e)}))}return Promise.reject(new s(r.ErrorCodes.InvalidArg,"password"))}return this.passwordHash=null,Promise.resolve()},u.prototype.setKeyFile=function(e){if(e&&!(e instanceof ArrayBuffer)&&!(e instanceof Uint8Array))return Promise.reject(new s(r.ErrorCodes.InvalidArg,"keyFile"));if(e){if(32===e.byteLength)return this.keyFileHash=i.fromBinary(o.arrayToBuffer(e)),Promise.resolve();var t,n,l=this;try{var u=o.bytesToString(o.arrayToBuffer(e));if(u.match(/^[a-f\d]{64}$/i)){var d=o.hexToBytes(u);return void(this.keyFileHash=i.fromBinary(d))}var h=a.parse(u.trim()),p=a.getChildNode(h.documentElement,"Meta");t=+a.getChildNode(p,"Version").textContent.split(".")[0];var m=a.getChildNode(h.documentElement,"Key");n=a.getChildNode(m,"Data")}catch(t){return c.sha256(e).then((function(e){l.keyFileHash=i.fromBinary(e)}))}switch(t){case 1:this.keyFileHash=i.fromBinary(o.base64ToBytes(n.textContent));break;case 2:var f=o.hexToBytes(n.textContent.replace(/\s+/g,"")),g=n.getAttribute("Hash");return c.sha256(f).then((function(e){if(o.bytesToHex(new Uint8Array(e).subarray(0,4)).toUpperCase()!==g)throw new s(r.ErrorCodes.FileCorrupt,"Key file data hash mismatch");l.keyFileHash=i.fromBinary(f)}));default:return Promise.reject(new s(r.ErrorCodes.FileCorrupt,"Bad keyfile version"))}}else this.keyFileHash=null;return Promise.resolve()},u.prototype.setChallengeResponse=function(e){return this.challengeResponse=e,Promise.resolve()},u.prototype.getHash=function(e){var t=this;return this.ready.then((function(){return t.getChallengeResponse(e).then((function(e){var n=[];t.passwordHash&&n.push(t.passwordHash.getBinary()),t.keyFileHash&&n.push(t.keyFileHash.getBinary()),e&&n.push(new Uint8Array(e));var i=n.reduce((function(e,t){return e+t.byteLength}),0),s=new Uint8Array(i),r=0;return n.forEach((function(e){s.set(e,r),o.zeroBuffer(e),r+=e.length})),c.sha256(o.arrayToBuffer(s)).then((function(e){return o.zeroBuffer(s),e}))}))}))},u.prototype.getChallengeResponse=function(e){var t=this.challengeResponse;return Promise.resolve().then((function(){return t&&e?t(e).then((function(e){return c.sha256(o.arrayToBuffer(e)).then((function(t){return o.zeroBuffer(e),t}))})):null}))},u.createRandomKeyFile=function(e){for(var t=l.getBytes(32),n=l.getBytes(32),i=0;i<32;i++)t[i]^=n[i],t[i]^=1e3*Math.random()%255;return u.createKeyFileWithHash(t,e)},u.createKeyFileWithHash=function(e,t){var n="1.00";let i;if(2===t&&(n="2.0"),2===t)i=c.sha256(e).then((function(t){for(var n=o.bytesToHex(new Uint8Array(t).subarray(0,4)).toUpperCase(),i=o.bytesToHex(e).toUpperCase(),s=' \n',r=0;r<2;r++)s+=" ",s+=[0,1,2,3].map((function(e){return i.substr(32*r+8*e,8)})).join(" "),s+="\n";return s+" \n"}));else{var s=" "+o.bytesToBase64(e)+"\n";i=Promise.resolve(s)}return i.then((e=>{var t='\n\n \n '+n+"\n \n \n"+e+" \n";return o.stringToBytes(t)}))},e.exports=u},6130:(e,t,n)=>{"use strict";var i=n(7953),s=n(4422),r={read:function(e){for(var t={},n=0,s=e.childNodes,o=s.length;n{"use strict";var i=n(7953),s=n(4422),r=function(){this.uuid=void 0,this.deletionTime=void 0,Object.preventExtensions(this)};r.prototype._readNode=function(e){switch(e.tagName){case i.Elem.Uuid:this.uuid=s.getUuid(e);break;case i.Elem.DeletionTime:this.deletionTime=s.getDate(e)}},r.prototype.write=function(e,t){var n=s.addChildNode(e,i.Elem.DeletedObject);s.setUuid(s.addChildNode(n,i.Elem.Uuid),this.uuid),t.setXmlDate(s.addChildNode(n,i.Elem.DeletionTime),this.deletionTime)},r.read=function(e){for(var t=new r,n=0,i=e.childNodes,s=i.length;n{"use strict";var i=n(8423),s=n(7953),r=n(4422),o=n(6736),a=n(6130),l=n(6542),c=n(8928),u=/\s*[;,:]\s*/,d=function(){this.uuid=void 0,this.icon=void 0,this.customIcon=void 0,this.fgColor=void 0,this.bgColor=void 0,this.overrideUrl=void 0,this.tags=[],this.times=new c,this.fields={},this.binaries={},this.autoType={enabled:!0,obfuscation:o.AutoTypeObfuscationOptions.None,defaultSequence:void 0,items:[]},this.history=[],this.parentGroup=void 0,this.customData=void 0,this._editState=void 0,Object.preventExtensions(this)};d.prototype._readNode=function(e,t){switch(e.tagName){case s.Elem.Uuid:this.uuid=r.getUuid(e);break;case s.Elem.Icon:this.icon=r.getNumber(e)||o.Icons.Key;break;case s.Elem.CustomIconID:this.customIcon=r.getUuid(e);break;case s.Elem.FgColor:this.fgColor=r.getText(e);break;case s.Elem.BgColor:this.bgColor=r.getText(e);break;case s.Elem.OverrideUrl:this.overrideUrl=r.getText(e);break;case s.Elem.Tags:this.tags=this._stringToTags(r.getText(e));break;case s.Elem.Times:this.times=c.read(e);break;case s.Elem.String:this._readField(e);break;case s.Elem.Binary:this._readBinary(e,t);break;case s.Elem.AutoType:this._readAutoType(e);break;case s.Elem.History:this._readHistory(e,t);break;case s.Elem.CustomData:this._readCustomData(e)}},d.prototype._readField=function(e){var t=r.getChildNode(e,s.Elem.Key),n=r.getChildNode(e,s.Elem.Value),i=r.getText(t),o=r.getProtectedText(n);i&&(this.fields[i]=o)},d.prototype._writeFields=function(e){var t=this.fields;Object.keys(t).forEach((function(n){var i=t[n];if(null!=i){var o=r.addChildNode(e,s.Elem.String);r.setText(r.addChildNode(o,s.Elem.Key),n),r.setProtectedText(r.addChildNode(o,s.Elem.Value),i)}}))},d.prototype._readBinary=function(e,t){var n=r.getChildNode(e,s.Elem.Key),i=r.getChildNode(e,s.Elem.Value),o=r.getText(n),a=r.getProtectedBinary(i);o&&a&&(a.ref&&(a.ref=t.kdbx.binaries.idToHash[a.ref],a.ref?a.value=t.kdbx.binaries[a.ref]:a=null),a&&(this.binaries[o]=a))},d.prototype._writeBinaries=function(e,t){var n=this.binaries;Object.keys(n).forEach((function(i){var o=n[i];if(o){if(o.ref){var a=t.kdbx.binaries.hashOrder.indexOf(o.ref);if(a<0)return;o={ref:a.toString()}}var l=r.addChildNode(e,s.Elem.Binary);r.setText(r.addChildNode(l,s.Elem.Key),i),r.setProtectedBinary(r.addChildNode(l,s.Elem.Value),o)}}))},d.prototype._stringToTags=function(e){return e?e.split(u).filter((function(e){return e})):[]},d.prototype._readAutoType=function(e){for(var t=0,n=e.childNodes,i=n.length;tt.times.lastModTime&&!this.history.some((function(e){return+e.times.lastModTime==+t.times.lastModTime}))){var i=new d;i.copyFrom(t),n.push(i)}this.history=this._mergeHistory(n,t.times.lastModTime)}},d.prototype._mergeHistory=function(e,t){this.history.sort((function(e,t){return e.times.lastModTime-t.times.lastModTime})),e.sort((function(e,t){return e.times.lastModTime-t.times.lastModTime}));var n={},i={};this.history.forEach((function(e){n[e.times.lastModTime.getTime()]=e})),e.forEach((function(e){i[e.times.lastModTime.getTime()]=e}));for(var s=0,r=0,o=[];su){if(!this._editState||this._editState.deleted.indexOf(u)<0){var h=new d;h.copyFrom(l),o.push(h)}r++}else(this._editState&&this._editState.added.indexOf(c)>=0||c>t)&&o.push(a),s++;else o.push(a),s++,r++}return o},d.create=function(e,t){var n=new d(t);return n.uuid=l.random(),n.icon=o.Icons.Key,n.times=c.create(),n.parentGroup=t,n._setField("Title","",e.memoryProtection.title),n._setField("UserName",e.defaultUser||"",e.memoryProtection.userName),n._setField("Password","",e.memoryProtection.password),n._setField("URL","",e.memoryProtection.url),n._setField("Notes","",e.memoryProtection.notes),n.autoType.enabled="boolean"!=typeof t.enableAutoType||t.enableAutoType,n.autoType.obfuscation=o.AutoTypeObfuscationOptions.None,n},d.read=function(e,t,n){for(var i=new d,s=0,r=e.childNodes,o=r.length;s{"use strict";var i=n(991),s=n(1025),r=n(6482),o=n(5293),a=n(9692),l=n(3677),c=n(2327),u=n(4422),d=n(1923),h=n(6736),p=n(4768),m=n(9470),f=n(5073),g=n(390),A=n(9693),y=function(e){this.kdbx=e};y.prototype.load=function(e){var t=new l(e),n=this.kdbx,i=this;return i.ctx=new o({kdbx:n}),n.credentials.ready.then((function(){if(n.header=r.read(t,i.ctx),3===n.header.versionMajor)return i._loadV3(t);if(4===n.header.versionMajor)return i._loadV4(t);throw new s(h.ErrorCodes.InvalidVersion,"bad version: "+n.header.versionMajor)}))},y.prototype._loadV3=function(e){var t=this.kdbx,n=this;return n._decryptXmlV3(t,e).then((function(i){return t.xml=u.parse(i),n._setProtectedValues().then((function(){return t._loadFromXml(n.ctx).then((function(){return n._checkHeaderHashV3(e).then((function(){return t}))}))}))}))},y.prototype._loadV4=function(e){var t=this;return t._getHeaderHash(e).then((function(n){var r=e.readBytes(n.byteLength);if(!c.arrayBufferEquals(r,n))throw new s(h.ErrorCodes.FileCorrupt,"header hash mismatch");return t._computeKeysV4().then((function(n){return t._getHeaderHmac(e,n.hmacKey).then((function(r){var o=e.readBytes(r.byteLength);if(!c.arrayBufferEquals(o,r))throw new s(h.ErrorCodes.InvalidKey);return m.decrypt(e.readBytesToEnd(),n.hmacKey).then((function(s){return c.zeroBuffer(n.hmacKey),t._decryptData(s,n.cipherKey).then((function(s){c.zeroBuffer(n.cipherKey),t.kdbx.header.compression===h.CompressionAlgorithm.GZip&&(s=i.ungzip(s)),e=new l(c.arrayToBuffer(s)),t.kdbx.header.readInnerHeader(e,t.ctx),s=e.readBytesToEnd();var r=c.bytesToString(s);return t.kdbx.xml=u.parse(r),t._setProtectedValues().then((function(){return t.kdbx._loadFromXml(t.ctx)}))}))}))}))}))}))},y.prototype.loadXml=function(e){var t=this.kdbx,n=new o({kdbx:t});return t.credentials.ready.then((function(){return t.header=r.create(),t.xml=u.parse(e),u.protectPlainValues(t.xml.documentElement),t._loadFromXml(n)}))},y.prototype.save=function(){var e=this.kdbx,t=this;return t.ctx=new o({kdbx:e}),e.binaries.assignIds(),e.credentials.ready.then((function(){var n=new l;if(e.header.generateSalts(),e.header.write(n),3===e.header.versionMajor)return t._saveV3(n);if(4===e.header.versionMajor)return t._saveV4(n);throw new s(h.ErrorCodes.InvalidVersion,"bad version: "+e.header.versionMajor)}))},y.prototype._saveV3=function(e){var t=this;return t._getHeaderHash(e).then((function(n){return t.kdbx.meta.headerHash=n,t.kdbx._buildXml(t.ctx),t._getProtectSaltGenerator().then((function(n){return u.updateProtectedValuesSalt(t.kdbx.xml.documentElement,n),t._encryptXmlV3().then((function(t){return e.writeBytes(t),e.getWrittenBytes()}))}))}))},y.prototype._saveV4=function(e){var t=this;return t.kdbx._buildXml(t.ctx),t._getHeaderHash(e).then((function(n){return e.writeBytes(n),t._computeKeysV4().then((function(n){return t._getHeaderHmac(e,n.hmacKey).then((function(s){return e.writeBytes(s),t._getProtectSaltGenerator().then((function(s){u.updateProtectedValuesSalt(t.kdbx.xml.documentElement,s);var r=u.serialize(t.kdbx.xml),o=new l;t.kdbx.header.writeInnerHeader(o,t.ctx);var a=o.getWrittenBytes(),d=c.arrayToBuffer(c.stringToBytes(r)),p=new ArrayBuffer(a.byteLength+d.byteLength),f=new Uint8Array(p);return f.set(new Uint8Array(a)),f.set(new Uint8Array(d),a.byteLength),c.zeroBuffer(d),c.zeroBuffer(a),t.kdbx.header.compression===h.CompressionAlgorithm.GZip&&(p=i.gzip(p)),t._encryptData(c.arrayToBuffer(p),n.cipherKey).then((function(t){return c.zeroBuffer(n.cipherKey),m.encrypt(t,n.hmacKey).then((function(t){return c.zeroBuffer(n.hmacKey),e.writeBytes(t),e.getWrittenBytes()}))}))}))}))}))}))},y.prototype.saveXml=function(e){var t=this.kdbx;return t.credentials.ready.then((function(){t.header.generateSalts();var n=new o({kdbx:t,exportXml:!0});t.binaries.assignIds(),t._buildXml(n),u.unprotectValues(t.xml.documentElement);var i=u.serialize(t.xml,e);return u.protectUnprotectedValues(t.xml.documentElement),i}))},y.prototype._decryptXmlV3=function(e,t){var n=t.readBytesToEnd(),s=this;return s._getMasterKeyV3().then((function(e){return s._decryptData(n,e).then((function(t){return c.zeroBuffer(e),t=s._trimStartBytesV3(t),p.decrypt(t).then((function(e){return s.kdbx.header.compression===h.CompressionAlgorithm.GZip&&(e=i.ungzip(e)),c.bytesToString(e)}))}))}))},y.prototype._encryptXmlV3=function(){var e=this.kdbx,t=this,n=u.serialize(e.xml),s=c.arrayToBuffer(c.stringToBytes(n));return e.header.compression===h.CompressionAlgorithm.GZip&&(s=i.gzip(s)),p.encrypt(c.arrayToBuffer(s)).then((function(n){var i=new Uint8Array(e.header.streamStartBytes),s=new Uint8Array(n.byteLength+i.length);return s.set(i),s.set(new Uint8Array(n),i.length),n=s,t._getMasterKeyV3().then((function(e){return t._encryptData(c.arrayToBuffer(n),e).then((function(t){return c.zeroBuffer(e),t}))}))}))},y.prototype._getMasterKeyV3=function(){var e=this.kdbx;return e.credentials.getHash().then((function(t){var n=e.header.transformSeed,i=e.header.keyEncryptionRounds,s=e.header.masterSeed;return e.credentials.getChallengeResponse(s).then((function(e){return g.encrypt(new Uint8Array(t),n,i).then((function(n){return c.zeroBuffer(t),a.sha256(n).then((function(t){c.zeroBuffer(n);var i=e?e.byteLength:0,r=new Uint8Array(s.byteLength+t.byteLength+i);return r.set(new Uint8Array(s),0),e&&r.set(new Uint8Array(e),s.byteLength),r.set(new Uint8Array(t),s.byteLength+i),c.zeroBuffer(t),c.zeroBuffer(s),e&&c.zeroBuffer(e),a.sha256(r.buffer).then((function(e){return c.zeroBuffer(r.buffer),e}))}))}))}))}))},y.prototype._trimStartBytesV3=function(e){var t=this.kdbx.header.streamStartBytes;if(e.byteLength{"use strict";var i=n(7953),s=n(4422),r=n(6736),o=n(6130),a=n(8928),l=n(6542),c=n(741),u=function(){this.uuid=void 0,this.name=void 0,this.notes=void 0,this.icon=void 0,this.customIcon=void 0,this.times=new a,this.expanded=void 0,this.defaultAutoTypeSeq=void 0,this.enableAutoType=void 0,this.enableSearching=void 0,this.lastTopVisibleEntry=void 0,this.groups=[],this.entries=[],this.parentGroup=void 0,this.customData=void 0,Object.preventExtensions(this)};u.prototype._readNode=function(e,t){switch(e.tagName){case i.Elem.Uuid:this.uuid=s.getUuid(e);break;case i.Elem.Name:this.name=s.getText(e);break;case i.Elem.Notes:this.notes=s.getText(e);break;case i.Elem.Icon:this.icon=s.getNumber(e);break;case i.Elem.CustomIconID:this.customIcon=s.getUuid(e);break;case i.Elem.Times:this.times=a.read(e);break;case i.Elem.IsExpanded:this.expanded=s.getBoolean(e);break;case i.Elem.GroupDefaultAutoTypeSeq:this.defaultAutoTypeSeq=s.getText(e);break;case i.Elem.EnableAutoType:this.enableAutoType=s.getBoolean(e);break;case i.Elem.EnableSearching:this.enableSearching=s.getBoolean(e);break;case i.Elem.LastTopVisibleEntry:this.lastTopVisibleEntry=s.getUuid(e);break;case i.Elem.Group:this.groups.push(u.read(e,t,this));break;case i.Elem.Entry:this.entries.push(c.read(e,t,this));break;case i.Elem.CustomData:this.customData=o.read(e)}},u.prototype.write=function(e,t){var n=s.addChildNode(e,i.Elem.Group);s.setUuid(s.addChildNode(n,i.Elem.Uuid),this.uuid),s.setText(s.addChildNode(n,i.Elem.Name),this.name),s.setText(s.addChildNode(n,i.Elem.Notes),this.notes),s.setNumber(s.addChildNode(n,i.Elem.Icon),this.icon),this.customIcon&&s.setUuid(s.addChildNode(n,i.Elem.CustomIconID),this.customIcon),o.write(n,this.customData),this.times.write(n,t),s.setBoolean(s.addChildNode(n,i.Elem.IsExpanded),this.expanded),s.setText(s.addChildNode(n,i.Elem.GroupDefaultAutoTypeSeq),this.defaultAutoTypeSeq),s.setBoolean(s.addChildNode(n,i.Elem.EnableAutoType),this.enableAutoType),s.setBoolean(s.addChildNode(n,i.Elem.EnableSearching),this.enableSearching),s.setUuid(s.addChildNode(n,i.Elem.LastTopVisibleEntry),this.lastTopVisibleEntry),this.groups.forEach((function(e){e.write(n,t)})),this.entries.forEach((function(e){e.write(n,t)}))},u.prototype.forEach=function(e,t){e.call(t,void 0,this),this.entries.forEach((function(n){e.call(t,n)})),this.groups.forEach((function(n){n.forEach(e,t)}))},u.prototype.merge=function(e){var t=e.remote[this.uuid];t&&(t.times.lastModTime>this.times.lastModTime&&this.copyFrom(t),this.groups=this._mergeCollection(this.groups,t.groups,e),this.entries=this._mergeCollection(this.entries,t.entries,e),this.groups.forEach((function(t){t.merge(e)})),this.entries.forEach((function(t){t.merge(e)})))},u.prototype._mergeCollection=function(e,t,n){var i=[];return e.forEach((function(e){if(!n.deleted[e.uuid]){var t=n.remote[e.uuid];t?t.times.locationChanged<=e.times.locationChanged&&i.push(e):i.push(e)}}),this),t.forEach((function(e,s){if(!n.deleted[e.uuid]){var r=n.objects[e.uuid];if(r&&e.times.locationChanged>r.times.locationChanged)r.parentGroup=this,i.splice(this._findInsertIx(i,t,s),0,r);else if(!r){var o=new e.constructor;o.copyFrom(e),o.parentGroup=this,i.splice(this._findInsertIx(i,t,s),0,o)}}}),this),i},u.prototype._findInsertIx=function(e,t,n){for(var i=e.length,s=-1,r=0;r<=e.length;r++){var o=0,a=n>0?t[n-1].uuid.id:void 0,l=n+10?e[r-1].uuid.id:void 0,u=rs&&(i=r,s=o)}return i},u.prototype.copyFrom=function(e){this.uuid=e.uuid,this.name=e.name,this.notes=e.notes,this.icon=e.icon,this.customIcon=e.customIcon,this.times=e.times.clone(),this.expanded=e.expanded,this.defaultAutoTypeSeq=e.defaultAutoTypeSeq,this.enableAutoType=e.enableAutoType,this.enableSearching=e.enableSearching,this.lastTopVisibleEntry=e.lastTopVisibleEntry},u.create=function(e,t){var n=new u;return n.uuid=l.random(),n.icon=r.Icons.Folder,n.times=a.create(),n.name=e,n.parentGroup=t,n.expanded=!0,n.enableAutoType=null,n.enableSearching=null,n.lastTopVisibleEntry=new l,n},u.read=function(e,t,n){for(var i=new u,s=0,r=e.childNodes,o=r.length;s{"use strict";var i=n(6542),s=n(6736),r=n(8423),o=n(1025),a=n(3677),l=n(2327),c=n(1076),u=n(1923),d=n(3586),h=[{name:"EndOfHeader"},{name:"Comment"},{name:"CipherID"},{name:"CompressionFlags"},{name:"MasterSeed"},{name:"TransformSeed",ver:[3]},{name:"TransformRounds",ver:[3]},{name:"EncryptionIV"},{name:"ProtectedStreamKey",ver:[3]},{name:"StreamStartBytes",ver:[3]},{name:"InnerRandomStreamID",ver:[3]},{name:"KdfParameters",ver:[4]},{name:"PublicCustomData",ver:[4]}],p=[{name:"EndOfHeader"},{name:"InnerRandomStreamID"},{name:"InnerRandomStreamKey"},{name:"Binary",skipHeader:!0}],m={DefaultFileVersionMajor:4,DefaultFileVersionMinor:0,MaxFileVersionMajor:4,MaxFileVersionMinor:1,MaxSupportedVersion:4,FlagBinaryProtected:1,InnerHeaderBinaryFieldId:3,DefaultKdfAlgo:s.KdfId.Argon2d,DefaultKdfSaltLength:32,DefaultKdfParallelism:1,DefaultKdfIterations:2,DefaultKdfMemory:1048576,DefaultKdfVersion:19},f={3:1,4:0},g=function(){this.versionMajor=void 0,this.versionMinor=void 0,this.dataCipherUuid=void 0,this.compression=void 0,this.masterSeed=void 0,this.transformSeed=void 0,this.keyEncryptionRounds=void 0,this.encryptionIV=void 0,this.protectedStreamKey=void 0,this.streamStartBytes=void 0,this.crsAlgorithm=void 0,this.endPos=void 0,this.kdfParameters=void 0,this.publicCustomData=void 0,Object.preventExtensions(this)};g.prototype._readSignature=function(e){if(e.byteLength<8)throw new o(s.ErrorCodes.FileCorrupt,"not enough data");var t=e.getUint32(!0),n=e.getUint32(!0);if(t!==s.Signatures.FileMagic||n!==s.Signatures.Sig2Kdbx)throw new o(s.ErrorCodes.BadSignature)},g.prototype._writeSignature=function(e){e.setUint32(s.Signatures.FileMagic,!0),e.setUint32(s.Signatures.Sig2Kdbx,!0)},g.prototype._readVersion=function(e){var t=e.getUint16(!0),n=e.getUint16(!0);if(n>m.MaxSupportedVersion)throw new o(s.ErrorCodes.InvalidVersion);this.versionMinor=t,this.versionMajor=n},g.prototype._writeVersion=function(e){e.setUint16(this.versionMinor,!0),e.setUint16(this.versionMajor,!0)},g.prototype._readCipherID=function(e){if(16!==e.byteLength)throw new o(s.ErrorCodes.Unsupported,"cipher");this.dataCipherUuid=new i(e)},g.prototype._writeCipherID=function(e){this._writeFieldSize(e,16),e.writeBytes(this.dataCipherUuid.bytes)},g.prototype._readCompressionFlags=function(e){var t=new DataView(e).getUint32(e,!0);if(t<0||t>=Object.keys(s.CompressionAlgorithm).length)throw new o(s.ErrorCodes.Unsupported,"compression");this.compression=t},g.prototype._writeCompressionFlags=function(e){this._writeFieldSize(e,4),e.setUint32(this.compression,!0)},g.prototype._readMasterSeed=function(e){this.masterSeed=e},g.prototype._writeMasterSeed=function(e){this._writeFieldBytes(e,this.masterSeed)},g.prototype._readTransformSeed=function(e){this.transformSeed=e},g.prototype._writeTransformSeed=function(e){this._writeFieldBytes(e,this.transformSeed)},g.prototype._readTransformRounds=function(e){this.keyEncryptionRounds=new a(e).getUint64(!0)},g.prototype._writeTransformRounds=function(e){this._writeFieldSize(e,8),e.setUint64(this.keyEncryptionRounds,!0)},g.prototype._readEncryptionIV=function(e){this.encryptionIV=e},g.prototype._writeEncryptionIV=function(e){this._writeFieldBytes(e,this.encryptionIV)},g.prototype._readProtectedStreamKey=function(e){this.protectedStreamKey=e},g.prototype._writeProtectedStreamKey=function(e){this._writeFieldBytes(e,this.protectedStreamKey)},g.prototype._readStreamStartBytes=function(e){this.streamStartBytes=e},g.prototype._writeStreamStartBytes=function(e){this._writeFieldBytes(e,this.streamStartBytes)},g.prototype._readInnerRandomStreamID=function(e){this.crsAlgorithm=new DataView(e).getUint32(e,!0)},g.prototype._writeInnerRandomStreamID=function(e){this._writeFieldSize(e,4),e.setUint32(this.crsAlgorithm,!0)},g.prototype._readInnerRandomStreamKey=function(e){this.protectedStreamKey=e},g.prototype._writeInnerRandomStreamKey=function(e){this._writeFieldBytes(e,this.protectedStreamKey)},g.prototype._readKdfParameters=function(e){this.kdfParameters=c.read(new a(e))},g.prototype._writeKdfParameters=function(e){var t=new a;this.kdfParameters.write(t),this._writeFieldBytes(e,t.getWrittenBytes())},g.prototype._readPublicCustomData=function(e){this.publicCustomData=c.read(new a(e))},g.prototype._hasPublicCustomData=function(){return this.publicCustomData},g.prototype._writePublicCustomData=function(e){if(this.publicCustomData){var t=new a;this.publicCustomData.write(t),this._writeFieldBytes(e,t.getWrittenBytes())}},g.prototype._readBinary=function(e,t){var n=new DataView(e).getUint8(0)&m.FlagBinaryProtected,i=e.slice(1),s=n?r.fromBinary(i):i,o=Object.keys(t.kdbx.binaries).length;t.kdbx.binaries[o]=s},g.prototype._writeBinary=function(e,t){if(!(this.versionMajor<4))for(var n=t.kdbx.binaries.hashOrder,i=0;i0&&(i=e.readBytes(r));var o=t[s];if(o){var a=this["_read"+o.name];a&&a.call(this,i,n)}return 0!==s},g.prototype._writeField=function(e,t,n,i){var s=n[t];if(s){if(s.ver&&s.ver.indexOf(this.versionMajor)<0)return;var r=this["_write"+s.name];if(r){var o=this["_has"+s.name];if(o&&!o.call(this))return;s.skipHeader||e.setUint8(t),r.call(this,e,i)}}},g.prototype._readFieldSize=function(e){return this.versionMajor>=4?e.getUint32(!0):e.getUint16(!0)},g.prototype._writeFieldSize=function(e,t){this.versionMajor>=4?e.setUint32(t,!0):e.setUint16(t,!0)},g.prototype._writeFieldBytes=function(e,t){this._writeFieldSize(e,t.byteLength),e.writeBytes(t)},g.prototype._validate=function(){if(void 0===this.dataCipherUuid)throw new o(s.ErrorCodes.FileCorrupt,"no cipher in header");if(void 0===this.compression)throw new o(s.ErrorCodes.FileCorrupt,"no compression in header");if(!this.masterSeed)throw new o(s.ErrorCodes.FileCorrupt,"no master seed in header");if(this.versionMajor<4&&!this.transformSeed)throw new o(s.ErrorCodes.FileCorrupt,"no transform seed in header");if(this.versionMajor<4&&!this.keyEncryptionRounds)throw new o(s.ErrorCodes.FileCorrupt,"no key encryption rounds in header");if(!this.encryptionIV)throw new o(s.ErrorCodes.FileCorrupt,"no encryption iv in header");if(this.versionMajor<4&&!this.protectedStreamKey)throw new o(s.ErrorCodes.FileCorrupt,"no protected stream key in header");if(this.versionMajor<4&&!this.streamStartBytes)throw new o(s.ErrorCodes.FileCorrupt,"no stream start bytes in header");if(this.versionMajor<4&&!this.crsAlgorithm)throw new o(s.ErrorCodes.FileCorrupt,"no crs algorithm in header");if(this.versionMajor>=4&&!this.kdfParameters)throw new o(s.ErrorCodes.FileCorrupt,"no kdf parameters in header")},g.prototype._validateInner=function(){if(!this.protectedStreamKey)throw new o(s.ErrorCodes.FileCorrupt,"no protected stream key in header");if(!this.crsAlgorithm)throw new o(s.ErrorCodes.FileCorrupt,"no crs algorithm in header")},g.prototype._createKdfParameters=function(e){switch(e||(e=m.DefaultKdfAlgo),e){case s.KdfId.Argon2d:this.kdfParameters=new c,this.kdfParameters.set("$UUID",c.ValueType.Bytes,l.base64ToBytes(s.KdfId.Argon2d)),this.kdfParameters.set("S",c.ValueType.Bytes,d.getBytes(m.DefaultKdfSaltLength)),this.kdfParameters.set("P",c.ValueType.UInt32,m.DefaultKdfParallelism),this.kdfParameters.set("I",c.ValueType.UInt64,new u(m.DefaultKdfIterations)),this.kdfParameters.set("M",c.ValueType.UInt64,new u(m.DefaultKdfMemory)),this.kdfParameters.set("V",c.ValueType.UInt32,m.DefaultKdfVersion);break;case s.KdfId.Aes:this.kdfParameters=new c,this.kdfParameters.set("$UUID",c.ValueType.Bytes,l.base64ToBytes(s.KdfId.Aes)),this.kdfParameters.set("S",c.ValueType.Bytes,d.getBytes(m.DefaultKdfSaltLength)),this.kdfParameters.set("R",c.ValueType.UInt64,new u(s.Defaults.KeyEncryptionRounds));break;default:throw new o(s.ErrorCodes.InvalidArg,"bad KDF algo")}},g.prototype.write=function(e){this._validate(),this._writeSignature(e),this._writeVersion(e);for(var t=1;t{"use strict";var i=n(7953),s=n(6542),r=n(6130),o=n(4422),a=n(6736),l={Generator:"KdbxWeb"},c=function(){this.generator=void 0,this.headerHash=void 0,this.settingsChanged=void 0,this._name=void 0,this.nameChanged=void 0,this._desc=void 0,this.descChanged=void 0,this._defaultUser=void 0,this.defaultUserChanged=void 0,this._mntncHistoryDays=void 0,this._color=void 0,this.keyChanged=void 0,this._keyChangeRec=void 0,this._keyChangeForce=void 0,this._recycleBinEnabled=void 0,this._recycleBinUuid=void 0,this.recycleBinChanged=void 0,this._entryTemplatesGroup=void 0,this.entryTemplatesGroupChanged=void 0,this._historyMaxItems=void 0,this._historyMaxSize=void 0,this._lastSelectedGroup=void 0,this._lastTopVisibleGroup=void 0,this._memoryProtection={title:void 0,userName:void 0,password:void 0,url:void 0,notes:void 0},this.customData={},this.customIcons={},this._editState=void 0,Object.preventExtensions(this)},u={name:"nameChanged",desc:"descChanged",defaultUser:"defaultUserChanged",mntncHistoryDays:null,color:null,keyChangeRec:null,keyChangeForce:null,recycleBinEnabled:"recycleBinChanged",recycleBinUuid:"recycleBinChanged",entryTemplatesGroup:"entryTemplatesGroupChanged",historyMaxItems:null,historyMaxSize:null,lastSelectedGroup:null,lastTopVisibleGroup:null,memoryProtection:null};Object.keys(u).forEach((function(e){!function(e,t){var n="_"+e;Object.defineProperty(c.prototype,e,{enumerable:!0,get:function(){return this[n]},set:function(i){i!==this[n]&&(this[n]=i,t?this[t]=new Date:this._setPropModDate(e))}})}(e,u[e])})),c.prototype._setPropModDate=function(e){this._editState||(this._editState={}),this._editState[e]=(new Date).getTime()},c.prototype._readNode=function(e,t){switch(e.tagName){case i.Elem.Generator:this.generator=o.getText(e);break;case i.Elem.HeaderHash:this.headerHash=o.getBytes(e);break;case i.Elem.SettingsChanged:this.settingsChanged=o.getDate(e);break;case i.Elem.DbName:this._name=o.getText(e);break;case i.Elem.DbNameChanged:this.nameChanged=o.getDate(e);break;case i.Elem.DbDesc:this._desc=o.getText(e);break;case i.Elem.DbDescChanged:this.descChanged=o.getDate(e);break;case i.Elem.DbDefaultUser:this._defaultUser=o.getText(e);break;case i.Elem.DbDefaultUserChanged:this.defaultUserChanged=o.getDate(e);break;case i.Elem.DbMntncHistoryDays:this._mntncHistoryDays=o.getNumber(e);break;case i.Elem.DbColor:this._color=o.getText(e);break;case i.Elem.DbKeyChanged:this.keyChanged=o.getDate(e);break;case i.Elem.DbKeyChangeRec:this._keyChangeRec=o.getNumber(e);break;case i.Elem.DbKeyChangeForce:this._keyChangeForce=o.getNumber(e);break;case i.Elem.RecycleBinEnabled:this._recycleBinEnabled=o.getBoolean(e);break;case i.Elem.RecycleBinUuid:this._recycleBinUuid=o.getUuid(e);break;case i.Elem.RecycleBinChanged:this.recycleBinChanged=o.getDate(e);break;case i.Elem.EntryTemplatesGroup:this._entryTemplatesGroup=o.getUuid(e);break;case i.Elem.EntryTemplatesGroupChanged:this.entryTemplatesGroupChanged=o.getDate(e);break;case i.Elem.HistoryMaxItems:this._historyMaxItems=o.getNumber(e);break;case i.Elem.HistoryMaxSize:this._historyMaxSize=o.getNumber(e);break;case i.Elem.LastSelectedGroup:this._lastSelectedGroup=o.getUuid(e);break;case i.Elem.LastTopVisibleGroup:this._lastTopVisibleGroup=o.getUuid(e);break;case i.Elem.MemoryProt:this._readMemoryProtection(e);break;case i.Elem.CustomIcons:this._readCustomIcons(e);break;case i.Elem.Binaries:this._readBinaries(e,t);break;case i.Elem.CustomData:this._readCustomData(e)}},c.prototype._readMemoryProtection=function(e){for(var t=0,n=e.childNodes,s=n.length;tthis.nameChanged&&(this._name=e.name,this.nameChanged=e.nameChanged),e.descChanged>this.descChanged&&(this._desc=e.desc,this.descChanged=e.descChanged),e.defaultUserChanged>this.defaultUserChanged&&(this._defaultUser=e.defaultUser,this.defaultUserChanged=e.defaultUserChanged),e.keyChanged>this.keyChanged&&(this.keyChanged=e.keyChanged),e.settingsChanged>this.settingsChanged&&(this.settingsChanged=e.settingsChanged),e.recycleBinChanged>this.recycleBinChanged&&(this._recycleBinEnabled=e.recycleBinEnabled,this._recycleBinUuid=e.recycleBinUuid,this.recycleBinChanged=e.recycleBinChanged),e.entryTemplatesGroupChanged>this.entryTemplatesGroupChanged&&(this._entryTemplatesGroup=e.entryTemplatesGroup,this.entryTemplatesGroupChanged=e.entryTemplatesGroupChanged),Object.keys(e.customData).forEach((function(n){this.customData[n]||t.deleted[n]||(this.customData[n]=e.customData[n])}),this),Object.keys(e.customIcons).forEach((function(n){this.customIcons[n]||t.deleted[n]||(this.customIcons[n]=e.customIcons[n])}),this),this._editState&&this._editState.historyMaxItems||(this.historyMaxItems=e.historyMaxItems),this._editState&&this._editState.historyMaxSize||(this.historyMaxSize=e.historyMaxSize),this._editState&&this._editState.keyChangeRec||(this.keyChangeRec=e.keyChangeRec),this._editState&&this._editState.keyChangeForce||(this.keyChangeForce=e.keyChangeForce),this._editState&&this._editState.mntncHistoryDays||(this.mntncHistoryDays=e.mntncHistoryDays),this._editState&&this._editState.color||(this.color=e.color)},c.create=function(){var e=new Date,t=new c;return t.generator=l.Generator,t.settingsChanged=e,t.mntncHistoryDays=a.Defaults.MntncHistoryDays,t.recycleBinEnabled=!0,t.historyMaxItems=a.Defaults.HistoryMaxItems,t.historyMaxSize=a.Defaults.HistoryMaxSize,t.nameChanged=e,t.descChanged=e,t.defaultUserChanged=e,t.recycleBinChanged=e,t.keyChangeRec=-1,t.keyChangeForce=-1,t.entryTemplatesGroup=new s,t.entryTemplatesGroupChanged=e,t.memoryProtection={title:!1,userName:!1,password:!0,url:!1,notes:!1},t},c.read=function(e,t){for(var n=new c,i=0,s=e.childNodes,r=s.length;i{"use strict";var i=n(7953),s=n(4422),r=function(){this.creationTime=void 0,this.lastModTime=void 0,this.lastAccessTime=void 0,this.expiryTime=void 0,this.expires=void 0,this.usageCount=void 0,this.locationChanged=new Date,Object.preventExtensions(this)};r.prototype._readNode=function(e){switch(e.tagName){case i.Elem.CreationTime:this.creationTime=s.getDate(e);break;case i.Elem.LastModTime:this.lastModTime=s.getDate(e);break;case i.Elem.LastAccessTime:this.lastAccessTime=s.getDate(e);break;case i.Elem.ExpiryTime:this.expiryTime=s.getDate(e);break;case i.Elem.Expires:this.expires=s.getBoolean(e);break;case i.Elem.UsageCount:this.usageCount=s.getNumber(e);break;case i.Elem.LocationChanged:this.locationChanged=s.getDate(e)}},r.prototype.clone=function(){var e=new r;return e.creationTime=this.creationTime,e.lastModTime=this.lastModTime,e.lastAccessTime=this.lastAccessTime,e.expiryTime=this.expiryTime,e.expires=this.expires,e.usageCount=this.usageCount,e.locationChanged=this.locationChanged,e},r.prototype.update=function(){var e=new Date;this.lastModTime=e,this.lastAccessTime=e},r.prototype.write=function(e,t){var n=s.addChildNode(e,i.Elem.Times);t.setXmlDate(s.addChildNode(n,i.Elem.CreationTime),this.creationTime),t.setXmlDate(s.addChildNode(n,i.Elem.LastModTime),this.lastModTime),t.setXmlDate(s.addChildNode(n,i.Elem.LastAccessTime),this.lastAccessTime),t.setXmlDate(s.addChildNode(n,i.Elem.ExpiryTime),this.expiryTime),s.setBoolean(s.addChildNode(n,i.Elem.Expires),this.expires),s.setNumber(s.addChildNode(n,i.Elem.UsageCount),this.usageCount),t.setXmlDate(s.addChildNode(n,i.Elem.LocationChanged),this.locationChanged)},r.create=function(){var e=new r,t=new Date;return e.creationTime=t,e.lastModTime=t,e.lastAccessTime=t,e.expiryTime=t,e.expires=!1,e.usageCount=0,e.locationChanged=t,e},r.read=function(e){for(var t=new r,n=0,i=e.childNodes,s=i.length;n{"use strict";var i=n(2327),s=n(3586);function r(e){if(void 0===e&&(e=new ArrayBuffer(16)),"string"==typeof e&&(e=i.base64ToBytes(e)),this.id=16===e.byteLength?i.bytesToBase64(e):void 0,this.empty=!0,e)for(var t=new Uint8Array(e),n=0,s=t.length;n{"use strict";var i=n(3722),s=n(1025),r=n(3449),o=n(6482),a=n(35),l=n(7949),c=n(7522),u=n(741),d=n(5982),h=n(6542),p=n(6736),m=n(7953),f=n(4422),g=function(){this.header=void 0,this.credentials=void 0,this.meta=void 0,this.xml=void 0,this.binaries=new l,this.groups=[],this.deletedObjects=[],Object.preventExtensions(this)};g.create=function(e,t){if(!(e instanceof r))throw new s(p.ErrorCodes.InvalidArg,"credentials");var n=new g;return n.credentials=e,n.header=o.create(),n.meta=a.create(),n.meta._name=t,n.createDefaultGroup(),n.createRecycleBin(),n.meta._lastSelectedGroup=n.getDefaultGroup().id,n.meta._lastTopVisibleGroup=n.getDefaultGroup().id,n},g.load=function(e,t){if(!(e instanceof ArrayBuffer))return Promise.reject(new s(p.ErrorCodes.InvalidArg,"data"));if(!(t instanceof r))return Promise.reject(new s(p.ErrorCodes.InvalidArg,"credentials"));var n=new g;return n.credentials=t,new i(n).load(e)},g.loadXml=function(e,t){if("string"!=typeof e)return Promise.reject(new s(p.ErrorCodes.InvalidArg,"data"));if(!(t instanceof r))return Promise.reject(new s(p.ErrorCodes.InvalidArg,"credentials"));var n=new g;return n.credentials=t,new i(n).loadXml(e)},g.prototype.save=function(){return new i(this).save()},g.prototype.saveXml=function(e){return new i(this).saveXml(e)},g.prototype.createDefaultGroup=function(){if(!this.groups.length){var e=c.create(this.meta.name);e.icon=p.Icons.FolderOpen,e.expanded=!0,this.groups.push(e)}},g.prototype.createRecycleBin=function(){if(this.meta.recycleBinEnabled=!0,!this.meta.recycleBinUuid||!this.getGroup(this.meta.recycleBinUuid)){var e=this.getDefaultGroup(),t=c.create(p.Defaults.RecycleBinName,e);t.icon=p.Icons.TrashBin,t.enableAutoType=!1,t.enableSearching=!1,this.meta.recycleBinUuid=t.uuid,e.groups.push(t)}},g.prototype.createGroup=function(e,t){var n=c.create(t,e);return e.groups.push(n),n},g.prototype.createEntry=function(e){var t=u.create(this.meta,e);return e.entries.push(t),t},g.prototype.getDefaultGroup=function(){return this.groups[0]},g.prototype.getGroup=function(e,t){for(var n=t?t.groups:this.groups,i=0;i=0?t[i].splice(n,0,e):t[i].push(e);else{var o=new Date;e instanceof c?e.forEach((function(e,t){this.addDeletedObject((e||t).uuid,o)}),this):this.addDeletedObject(e.uuid,o)}e.parentGroup=t,e.times.locationChanged=new Date}},g.prototype.addDeletedObject=function(e,t){var n=new d;n.uuid=e,n.deletionTime=t,this.deletedObjects.push(n)},g.prototype.remove=function(e){var t=null;this.meta.recycleBinEnabled&&(this.createRecycleBin(),t=this.getGroup(this.meta.recycleBinUuid)),this.move(e,t)},g.prototype.createBinary=function(e){return this.binaries.add(e)},g.prototype.importEntry=function(e,t,n){var i=new u,s=h.random();i.copyFrom(e),i.uuid=s,e.history.forEach((function(e){var t=new u;t.copyFrom(e),t.uuid=s,i.history.push(t)}));var r={},o={};return i.history.concat(i).forEach((function(e){e.customIcon&&(o[e.customIcon]=e.customIcon),Object.values(e.binaries).forEach((function(e){e.ref&&(r[e.ref]=e)}))})),Object.values(r).forEach((function(e){var t=n.binaries[e.ref];t&&!this.binaries[e.ref]&&(this.binaries[e.ref]=t)}),this),Object.values(o).forEach((function(e){var t=n.meta.customIcons[e];t&&(this.meta.customIcons[e]=t)}),this),t.entries.push(i),i.parentGroup=t,i.times.update(),i},g.prototype.cleanup=function(e){var t=new Date,n=e&&e.historyRules&&"number"==typeof this.meta.historyMaxItems&&this.meta.historyMaxItems>=0?this.meta.historyMaxItems:1/0,i={},s={},r=function(e){e&&e.customIcon&&(i[e.customIcon]=!0),e&&e.binaries&&Object.keys(e.binaries).forEach((function(t){e.binaries[t]&&e.binaries[t].ref&&(s[e.binaries[t].ref]=!0)}))};this.getDefaultGroup().forEach((function(e,t){e&&e.history.length>n&&e.removeHistory(0,e.history.length-n),e&&r(e),e&&e.history&&e.history.forEach((function(e){r(e)})),t&&t.customIcon&&(i[t.customIcon]=!0)})),e&&e.customIcons&&Object.keys(this.meta.customIcons).forEach((function(e){if(!i[e]){var n=new h(e);this.addDeletedObject(n,t),delete this.meta.customIcons[e]}}),this),e&&e.binaries&&Object.keys(this.binaries).forEach((function(e){s[e]||delete this.binaries[e]}),this)},g.prototype.merge=function(e){var t=this.getDefaultGroup(),n=e.getDefaultGroup();if(!t||!n)throw new s(p.ErrorCodes.MergeError,"no default group");if(!t.uuid.equals(n.uuid))throw new s(p.ErrorCodes.MergeError,"default group is different");var i=this._getObjectMap();e.deletedObjects.forEach((function(e){i.deleted[e.uuid]||(this.deletedObjects.push(e),i.deleted[e.uuid]=e.deletionTime)}),this),Object.keys(e.binaries).forEach((function(t){this.binaries[t]||i.deleted[t]||(this.binaries[t]=e.binaries[t])}),this),i.remote=e._getObjectMap().objects,this.meta.merge(e.meta,i),t.merge(i),this.cleanup({historyRules:!0,customIcons:!0,binaries:!0})},g.prototype.getLocalEditState=function(){var e={};return this.getDefaultGroup().forEach((function(t){t&&t._editState&&(e[t.uuid]=t._editState)})),this.meta._editState&&(e.meta=this.meta._editState),e},g.prototype.setLocalEditState=function(e){this.getDefaultGroup().forEach((function(t){t&&e[t.uuid]&&(t._editState=e[t.uuid])})),e.meta&&(this.meta._editState=e.meta)},g.prototype.removeLocalEditState=function(){this.getDefaultGroup().forEach((function(e){e&&(e._editState=void 0)})),this.meta._editState=void 0},g.prototype.upgrade=function(){this.setVersion(o.MaxFileVersion)},g.prototype.setVersion=function(e){this.meta.headerHash=null,this.meta.settingsChanged=new Date,this.header.setVersion(e)},g.prototype.setKdf=function(e){this.meta.headerHash=null,this.meta.settingsChanged=new Date,this.header.setKdf(e)},g.prototype._getObjectMap=function(){var e={},t={};return this.getDefaultGroup().forEach((function(t,n){var i=t||n;if(e[i.uuid])throw new s(p.ErrorCodes.MergeError,"Duplicate: "+i.uuid);e[i.uuid]=i})),this.deletedObjects.forEach((function(e){t[e.uuid]=e.deletionTime})),{objects:e,deleted:t}},g.prototype._loadFromXml=function(e){if(this.xml.documentElement.tagName!==m.Elem.DocNode)throw new s(p.ErrorCodes.FileCorrupt,"bad xml root");this._parseMeta(e);var t=this;return this.binaries.hash().then((function(){return t._parseRoot(e),t}))},g.prototype._parseMeta=function(e){var t=f.getChildNode(this.xml.documentElement,m.Elem.Meta,"no meta node");this.meta=a.read(t,e)},g.prototype._parseRoot=function(e){this.groups=[],this.deletedObjects=[];for(var t=0,n=f.getChildNode(this.xml.documentElement,m.Elem.Root,"no root node").childNodes,i=n.length;t{e.exports.Kdbx=n(2795),e.exports.KdbxUuid=n(6542),e.exports.KdbxError=n(1025),e.exports.Credentials=n(3449),e.exports.Consts=n(6736),e.exports.ProtectedValue=n(8423),e.exports.ByteUtils=n(2327),e.exports.VarDictionary=n(1076),e.exports.Int64=n(1923),e.exports.Random=n(3586),e.exports.CryptoEngine=n(9692)},3677:e=>{"use strict";function t(e){this._arrayBuffer=e||new ArrayBuffer(1024),this._dataView=new DataView(this._arrayBuffer),this._pos=0,this._canExpand=!e}["Int","Uint","Float"].forEach((function(e){("Float"===e?[4,8]:[1,2,4]).forEach((function(n){var i="get"+e+8*n;t.prototype[i]=function(e){var t=this._dataView[i].call(this._dataView,this._pos,e);return this._pos+=n,t};var s="set"+e+8*n;t.prototype[s]=function(e,t){this._checkCapacity(n),this._dataView[s].call(this._dataView,this._pos,e,t),this._pos+=n}}))})),t.prototype.getUint64=function(e){var t=this.getUint32(e),n=this.getUint32(e);return e?n*=4294967296:t*=4294967296,t+n},t.prototype.setUint64=function(e,t){t?(this.setUint32(4294967295&e,!0),this.setUint32(Math.floor(e/4294967296),!0)):(this._checkCapacity(8),this.setUint32(Math.floor(e/4294967296),!1),this.setUint32(4294967295&e,!1))},t.prototype.readBytes=function(e){var t=this._arrayBuffer.slice(this._pos,this._pos+e);return this._pos+=e,t},t.prototype.readBytesToEnd=function(){var e=this._arrayBuffer.byteLength-this._pos;return this.readBytes(e)},t.prototype.readBytesNoAdvance=function(e,t){return this._arrayBuffer.slice(e,t)},t.prototype.writeBytes=function(e){e instanceof ArrayBuffer&&(e=new Uint8Array(e)),this._checkCapacity(e.length),new Uint8Array(this._arrayBuffer).set(e,this._pos),this._pos+=e.length},t.prototype.getWrittenBytes=function(){return this._arrayBuffer.slice(0,this._pos)},t.prototype._checkCapacity=function(e){var t=this._arrayBuffer.byteLength-this._pos;if(this._canExpand&&t{"use strict";var i=n.g.TextEncoder,s=n.g.TextDecoder;if(!i||!s){var r=n(8176);i=r.TextEncoder,s=r.TextDecoder}var o=new i,a=new s;e.exports.arrayBufferEquals=function(e,t){if(e.byteLength!==t.byteLength)return!1;for(var n=new Uint8Array(e),i=new Uint8Array(t),s=0,r=n.length;s{"use strict";function t(e,t){this.lo=e||0,this.hi=t||0}Object.defineProperty(t.prototype,"value",{enumerable:!0,get:function(){if(this.hi){if(this.hi>=2097152)throw new Error("too large number");return 4294967296*this.hi+this.lo}return this.lo}}),t.prototype.valueOf=function(){return this.value},t.from=function(e){if(e>9007199254740991)throw new Error("too large number");var n=e>>>0;return new t(n,(e-n)/4294967296>>>0)},e.exports=t},1076:(e,t,n)=>{"use strict";var i=n(1025),s=n(6736),r=n(2327),o=n(1923),a={UInt32:4,UInt64:5,Bool:8,Int32:12,Int64:13,String:24,Bytes:66};function l(){this._items=[],this._dict={},Object.preventExtensions(this)}l.ValueType=a,l.prototype.get=function(e){var t=this._dict[e];return t?t.value:void 0},l.prototype.keys=function(){return this._items.map((function(e){return e.key}))},Object.defineProperty(l.prototype,"length",{enumberable:!0,get:function(){return this._items.length}}),l.prototype.set=function(e,t,n){switch(t){case a.UInt32:if("number"!=typeof n||n<0)throw new i(s.ErrorCodes.InvalidArg);break;case a.UInt64:if(!(n instanceof o))throw new i(s.ErrorCodes.InvalidArg);break;case a.Bool:if("boolean"!=typeof n)throw new i(s.ErrorCodes.InvalidArg);break;case a.Int32:if("number"!=typeof n)throw new i(s.ErrorCodes.InvalidArg);break;case a.Int64:if(!(n instanceof o))throw new i(s.ErrorCodes.InvalidArg);break;case a.String:if("string"!=typeof n)throw new i(s.ErrorCodes.InvalidArg);break;case a.Bytes:if(n instanceof Uint8Array&&(n=r.arrayToBuffer(n)),!(n instanceof ArrayBuffer))throw new i(s.ErrorCodes.InvalidArg);break;default:throw new i(s.ErrorCodes.InvalidArg)}var l={key:e,type:t,value:n};if(this._dict[e]){var c=this._items.indexOf(this._dict[e]);this._items.splice(c,1,l)}else this._items.push(l);this._dict[e]=l},l.prototype.remove=function(e){this._items=this._items.filter((function(t){return t.key!==e})),delete this._dict[e]},l.read=function(e){var t=new l;for(t._readVersion(e);;){var n=t._readItem(e);if(!n)break;t._items.push(n),t._dict[n.key]=n}return t},l.prototype._readVersion=function(e){e.getUint8();var t=e.getUint8();if(0===t||t>1)throw new i(s.ErrorCodes.InvalidVersion)},l.prototype._readItem=function(e){var t=e.getUint8();if(!t)return!1;var n=e.getInt32(!0);if(n<=0)throw new i(s.ErrorCodes.FileCorrupt,"bad key length");var l,c=r.bytesToString(e.readBytes(n)),u=e.getInt32(!0);if(u<0)throw new i(s.ErrorCodes.FileCorrupt,"bad value length");switch(t){case a.UInt32:if(4!==u)throw new i(s.ErrorCodes.FileCorrupt,"bad uint32");l=e.getUint32(!0);break;case a.UInt64:if(8!==u)throw new i(s.ErrorCodes.FileCorrupt,"bad uint64");var d=e.getUint32(!0),h=e.getUint32(!0);l=new o(d,h);break;case a.Bool:if(1!==u)throw new i(s.ErrorCodes.FileCorrupt,"bad bool");l=0!==e.getUint8();break;case a.Int32:if(4!==u)throw new i(s.ErrorCodes.FileCorrupt,"bad int32");l=e.getInt32(!0);break;case a.Int64:if(8!==u)throw new i(s.ErrorCodes.FileCorrupt,"bad int64");var p=e.getUint32(!0),m=e.getUint32(!0);l=new o(p,m);break;case a.String:l=r.bytesToString(e.readBytes(u));break;case a.Bytes:l=e.readBytes(u);break;default:throw new i(s.ErrorCodes.FileCorrupt,"bad value type: "+t)}return{key:c,type:t,value:l}},l.prototype.write=function(e){this._writeVersion(e),Object.keys(this._items).forEach((function(t){this._writeItem(e,this._items[t])}),this),e.setUint8(0)},l.prototype._writeVersion=function(e){e.setUint16(256,!0)},l.prototype._writeItem=function(e,t){e.setUint8(t.type);var n=r.stringToBytes(t.key);switch(e.setInt32(n.length,!0),e.writeBytes(n),t.type){case a.UInt32:e.setInt32(4,!0),e.setUint32(t.value,!0);break;case a.UInt64:e.setInt32(8,!0),e.setUint32(t.value.lo,!0),e.setUint32(t.value.hi,!0);break;case a.Bool:e.setInt32(1,!0),e.setUint8(t.value?1:0);break;case a.Int32:e.setInt32(4,!0),e.setInt32(t.value,!0);break;case a.Int64:e.setInt32(8,!0),e.setUint32(t.value.lo,!0),e.setUint32(t.value.hi,!0);break;case a.String:var o=r.stringToBytes(t.value);e.setInt32(o.length,!0),e.writeBytes(o);break;case a.Bytes:var l=r.arrayToBuffer(t.value);e.setInt32(l.byteLength,!0),e.writeBytes(l);break;default:throw new i(s.ErrorCodes.Unsupported)}},e.exports=l},4422:(e,t,n)=>{"use strict";var i=n(1025),s=n(6736),r=n(7953),o=n(6542),a=n(8423),l=n(2327),c=n(1923),u=n(991),d=/\.\d\d\d/,h=n.g.DOMParser?n.g:n(5348),p=n.g.DOMParser?void 0:{errorHandler:{error:function(e){throw e},fatalError:function(e){throw e}}},m=62135596800;function f(e){var t,n=p?new h.DOMParser(p):new h.DOMParser;e=e.replace(/[\x00-\x09\x0B-\x0C\x0E-\x1F]/g,"");try{t=n.parseFromString(e,"application/xml")}catch(e){throw new i(s.ErrorCodes.FileCorrupt,"bad xml: "+e.message)}if(!t.documentElement)throw new i(s.ErrorCodes.FileCorrupt,"bad xml");var r=t.getElementsByTagName("parsererror")[0];if(r)throw new i(s.ErrorCodes.FileCorrupt,"bad xml: "+r.textContent);return t}function g(e,t){var n=e.childNodes.length;if(0!==n){for(var i,s="\n"+" ".repeat(t),r=t>0?"\n"+" ".repeat(t-1):"",o=e.ownerDocument||e,a=[],l=0;l0){var d=o.createTextNode(r);e.appendChild(d)}g(i,t+1)}}}function A(e){if(e&&e.childNodes)return e.protectedValue?e.protectedValue.text:e.textContent}function y(e,t){e.textContent=t||""}function v(e){var t=A(e);return t?l.arrayToBuffer(l.base64ToBytes(t)):void 0}function b(e,t){"string"==typeof t&&(t=l.base64ToBytes(t)),y(e,t?l.bytesToBase64(l.arrayToBuffer(t)):void 0)}function w(e){switch(e&&e.toLowerCase&&e.toLowerCase()){case"true":return!0;case"false":return!1;case"null":return null}}function k(e,t){t(e);for(var n=0,i=e.childNodes,s=i.length;n),"$1\n<")),n},e.exports.create=function(e){return f('<'+e+"/>")},e.exports.getChildNode=function(e,t,n){if(e&&e.childNodes)for(var r=0,o=e.childNodes,a=o.length;r0)return new Date(t);var n=new DataView(l.arrayToBuffer(l.base64ToBytes(t))),i=new c(n.getUint32(0,!0),n.getUint32(4,!0)).value;return new Date(1e3*(i-m))}},e.exports.setDate=function(e,t,n){if(t)if(n){var i=Math.floor(t.getTime()/1e3)+m,s=new DataView(new ArrayBuffer(8)),r=c.from(i);s.setUint32(0,r.lo,!0),s.setUint32(4,r.hi,!0),y(e,l.bytesToBase64(s.buffer))}else y(e,t.toISOString().replace(d,""));else y(e,"")},e.exports.getNumber=function(e){var t=A(e);return t?+t:void 0},e.exports.setNumber=function(e,t){y(e,"number"!=typeof t||isNaN(t)?void 0:t.toString())},e.exports.getBoolean=function(e){var t=A(e);return t?w(t):void 0},e.exports.setBoolean=function(e,t){y(e,void 0===t?"":null===t?"null":t?"True":"False")},e.exports.strToBoolean=w,e.exports.getUuid=function(e){var t=v(e);return t?new o(t):void 0},e.exports.setUuid=function(e,t){b(e,t instanceof o?t.toBytes():t)},e.exports.getProtectedText=function(e){return e.protectedValue||e.textContent},e.exports.setProtectedText=function(e,t){t instanceof a?(e.protectedValue=t,e.setAttribute(r.Attr.Protected,"True")):y(e,t)},e.exports.getProtectedBinary=function(e){if(e.protectedValue)return e.protectedValue;var t=e.textContent,n=e.getAttribute(r.Attr.Ref);if(n)return{ref:n};if(t){var i=w(e.getAttribute(r.Attr.Compressed)),s=l.base64ToBytes(t);return i&&(s=u.ungzip(s)),l.arrayToBuffer(s)}},e.exports.setProtectedBinary=function(e,t){t instanceof a?(e.protectedValue=t,e.setAttribute(r.Attr.Protected,"True")):t&&t.ref?e.setAttribute(r.Attr.Ref,t.ref):b(e,t)},e.exports.setProtectedValues=function(e,t){k(e,(function(e){if(w(e.getAttribute(r.Attr.Protected)))try{var n=l.arrayToBuffer(l.base64ToBytes(e.textContent));if(n.byteLength){var o=t.getSalt(n.byteLength);e.protectedValue=new a(n,o)}}catch(t){throw new i(s.ErrorCodes.FileCorrupt,"bad protected value at line "+e.lineNumber+": "+t)}}))},e.exports.updateProtectedValuesSalt=function(e,t){k(e,(function(e){if(w(e.getAttribute(r.Attr.Protected))&&e.protectedValue){var n=t.getSalt(e.protectedValue.byteLength);e.protectedValue.setSalt(n),e.textContent=e.protectedValue.toString()}}))},e.exports.unprotectValues=function(e){k(e,(function(e){w(e.getAttribute(r.Attr.Protected))&&e.protectedValue&&(e.removeAttribute(r.Attr.Protected),e.setAttribute(r.Attr.ProtectedInMemPlainXml,"True"),e.textContent=e.protectedValue.getText())}))},e.exports.protectUnprotectedValues=function(e){k(e,(function(e){w(e.getAttribute(r.Attr.ProtectedInMemPlainXml))&&e.protectedValue&&(e.removeAttribute(r.Attr.ProtectedInMemPlainXml),e.setAttribute(r.Attr.Protected,"True"),e.textContent=e.protectedValue.toString())}))},e.exports.protectPlainValues=function(e){k(e,(function(e){w(e.getAttribute(r.Attr.ProtectedInMemPlainXml))&&(e.protectedValue=a.fromString(e.textContent),e.textContent=e.protectedValue.toString(),e.removeAttribute(r.Attr.ProtectedInMemPlainXml),e.setAttribute(r.Attr.Protected,"True"))}))}},991:(e,t,n)=>{"use strict";var i={};(0,n(7609).assign)(i,n(8143),n(5613),n(2436)),e.exports=i},8143:(e,t,n)=>{"use strict";var i=n(3152),s=n(7609),r=n(9141),o=n(5710),a=n(8894),l=Object.prototype.toString;function c(e){if(!(this instanceof c))return new c(e);this.options=s.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var n=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw new Error(o[n]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var u;if(u="string"==typeof t.dictionary?r.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=i.deflateSetDictionary(this.strm,u)))throw new Error(o[n]);this._dict_set=!0}}function u(e,t){var n=new c(t);if(n.push(e,!0),n.err)throw n.msg;return n.result}c.prototype.push=function(e,t){var n,o,a=this.strm,c=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=r.string2buf(e):"[object ArrayBuffer]"===l.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new s.Buf8(c),a.next_out=0,a.avail_out=c),1!==(n=i.deflate(a,o))&&0!==n)return this.onEnd(n),this.ended=!0,!1;0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(r.buf2binstring(s.shrinkBuf(a.output,a.next_out))):this.onData(s.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&1!==n);return 4===o?(n=i.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==o||(this.onEnd(0),a.avail_out=0,!0)},c.prototype.onData=function(e){this.chunks.push(e)},c.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=c,t.deflate=u,t.deflateRaw=function(e,t){return(t=t||{}).raw=!0,u(e,t)},t.gzip=function(e,t){return(t=t||{}).gzip=!0,u(e,t)}},5613:(e,t,n)=>{"use strict";var i=n(1863),s=n(7609),r=n(9141),o=n(2436),a=n(5710),l=n(8894),c=n(8235),u=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=i.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(a[n]);this.header=new c,i.inflateGetHeader(this.strm,this.header)}function h(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg;return n.result}d.prototype.push=function(e,t){var n,a,l,c,d,h,p=this.strm,m=this.options.chunkSize,f=this.options.dictionary,g=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?p.input=r.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?p.input=new Uint8Array(e):p.input=e,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new s.Buf8(m),p.next_out=0,p.avail_out=m),(n=i.inflate(p,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(h="string"==typeof f?r.string2buf(f):"[object ArrayBuffer]"===u.call(f)?new Uint8Array(f):f,n=i.inflateSetDictionary(this.strm,h)),n===o.Z_BUF_ERROR&&!0===g&&(n=o.Z_OK,g=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),this.ended=!0,!1;p.next_out&&(0!==p.avail_out&&n!==o.Z_STREAM_END&&(0!==p.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=r.utf8border(p.output,p.next_out),c=p.next_out-l,d=r.buf2string(p.output,l),p.next_out=c,p.avail_out=m-c,c&&s.arraySet(p.output,p.output,l,c,0),this.onData(d)):this.onData(s.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((p.avail_in>0||0===p.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(n=i.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),p.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=d,t.inflate=h,t.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},t.ungzip=h},7609:(e,t)=>{"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,n,i,s){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+i),s);else for(var r=0;r{"use strict";var i=n(7609),s=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(e){s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){r=!1}for(var o=new i.Buf8(256),a=0;a<256;a++)o[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function l(e,t){if(t<65537&&(e.subarray&&r||!e.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var n="",o=0;o>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},t.buf2binstring=function(e){return l(e,e.length)},t.binstring2buf=function(e){for(var t=new i.Buf8(e.length),n=0,s=t.length;n4)c[i++]=65533,n+=r-1;else{for(s&=2===r?31:3===r?15:7;r>1&&n1?c[i++]=65533:s<65536?c[i++]=s:(s-=65536,c[i++]=55296|s>>10&1023,c[i++]=56320|1023&s)}return l(c,i)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},5530:e=>{"use strict";e.exports=function(e,t,n,i){for(var s=65535&e|0,r=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{r=r+(s=s+t[i++]|0)|0}while(--o);s%=65521,r%=65521}return s|r<<16|0}},2436:e=>{"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},1383:e=>{"use strict";var t=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,n,i,s){var r=t,o=s+i;e^=-1;for(var a=s;a>>8^r[255&(e^n[a])];return-1^e}},3152:(e,t,n)=>{"use strict";var i,s=n(7609),r=n(7322),o=n(5530),a=n(1383),l=n(5710),c=-2,u=258,d=262,h=103,p=113,m=666;function f(e,t){return e.msg=l[t],t}function g(e){return(e<<1)-(e>4?9:0)}function A(e){for(var t=e.length;--t>=0;)e[t]=0}function y(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(s.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function v(e,t){r._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,y(e.strm)}function b(e,t){e.pending_buf[e.pending++]=t}function w(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function k(e,t){var n,i,s=e.max_chain_length,r=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-d?e.strstart-(e.w_size-d):0,c=e.window,h=e.w_mask,p=e.prev,m=e.strstart+u,f=c[r+o-1],g=c[r+o];e.prev_length>=e.good_match&&(s>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(n=t)+o]===g&&c[n+o-1]===f&&c[n]===c[r]&&c[++n]===c[r+1]){r+=2,n++;do{}while(c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&ro){if(e.match_start=t,o=i,i>=a)break;f=c[r+o-1],g=c[r+o]}}}while((t=p[t&h])>l&&0!=--s);return o<=e.lookahead?o:e.lookahead}function C(e){var t,n,i,r,l,c,u,h,p,m,f=e.w_size;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-d)){s.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=n=e.hash_size;do{i=e.head[--t],e.head[t]=i>=f?i-f:0}while(--n);t=n=f;do{i=e.prev[--t],e.prev[t]=i>=f?i-f:0}while(--n);r+=f}if(0===e.strm.avail_in)break;if(c=e.strm,u=e.window,h=e.strstart+e.lookahead,p=r,m=void 0,(m=c.avail_in)>p&&(m=p),n=0===m?0:(c.avail_in-=m,s.arraySet(u,c.input,c.next_in,m,h),1===c.state.wrap?c.adler=o(c.adler,u,m,h):2===c.state.wrap&&(c.adler=a(c.adler,u,m,h)),c.next_in+=m,c.total_in+=m,m),e.lookahead+=n,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3)if(i=r._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-3,i=r._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=s&&(e.ins_h=(e.ins_h<15&&(a=2,i-=16),r<1||r>9||8!==n||i<8||i>15||t<0||t>9||o<0||o>4)return f(e,c);8===i&&(i=9);var l=new S;return e.state=l,l.strm=e,l.wrap=a,l.gzhead=null,l.w_bits=i,l.w_size=1<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(C(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+n;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,v(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-d&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(v(e,!1),e.strm.avail_out),1)})),new I(4,4,8,4,_),new I(4,5,16,8,_),new I(4,6,32,32,_),new I(4,4,16,16,E),new I(8,16,32,32,E),new I(8,16,128,128,E),new I(8,32,128,256,E),new I(32,128,258,1024,E),new I(32,258,258,4096,E)],t.deflateInit=function(e,t){return T(e,t,8,15,8,0)},t.deflateInit2=T,t.deflateReset=B,t.deflateResetKeep=x,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?c:(e.state.gzhead=t,0):c},t.deflate=function(e,t){var n,s,o,l;if(!e||!e.state||t>5||t<0)return e?f(e,c):c;if(s=e.state,!e.output||!e.input&&0!==e.avail_in||s.status===m&&4!==t)return f(e,0===e.avail_out?-5:c);if(s.strm=e,n=s.last_flush,s.last_flush=t,42===s.status)if(2===s.wrap)e.adler=0,b(s,31),b(s,139),b(s,8),s.gzhead?(b(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),b(s,255&s.gzhead.time),b(s,s.gzhead.time>>8&255),b(s,s.gzhead.time>>16&255),b(s,s.gzhead.time>>24&255),b(s,9===s.level?2:s.strategy>=2||s.level<2?4:0),b(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(b(s,255&s.gzhead.extra.length),b(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(e.adler=a(e.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=69):(b(s,0),b(s,0),b(s,0),b(s,0),b(s,0),b(s,9===s.level?2:s.strategy>=2||s.level<2?4:0),b(s,3),s.status=p);else{var d=8+(s.w_bits-8<<4)<<8;d|=(s.strategy>=2||s.level<2?0:s.level<6?1:6===s.level?2:3)<<6,0!==s.strstart&&(d|=32),d+=31-d%31,s.status=p,w(s,d),0!==s.strstart&&(w(s,e.adler>>>16),w(s,65535&e.adler)),e.adler=1}if(69===s.status)if(s.gzhead.extra){for(o=s.pending;s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>o&&(e.adler=a(e.adler,s.pending_buf,s.pending-o,o)),y(e),o=s.pending,s.pending!==s.pending_buf_size));)b(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>o&&(e.adler=a(e.adler,s.pending_buf,s.pending-o,o)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=73)}else s.status=73;if(73===s.status)if(s.gzhead.name){o=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>o&&(e.adler=a(e.adler,s.pending_buf,s.pending-o,o)),y(e),o=s.pending,s.pending===s.pending_buf_size)){l=1;break}l=s.gzindexo&&(e.adler=a(e.adler,s.pending_buf,s.pending-o,o)),0===l&&(s.gzindex=0,s.status=91)}else s.status=91;if(91===s.status)if(s.gzhead.comment){o=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>o&&(e.adler=a(e.adler,s.pending_buf,s.pending-o,o)),y(e),o=s.pending,s.pending===s.pending_buf_size)){l=1;break}l=s.gzindexo&&(e.adler=a(e.adler,s.pending_buf,s.pending-o,o)),0===l&&(s.status=h)}else s.status=h;if(s.status===h&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&y(e),s.pending+2<=s.pending_buf_size&&(b(s,255&e.adler),b(s,e.adler>>8&255),e.adler=0,s.status=p)):s.status=p),0!==s.pending){if(y(e),0===e.avail_out)return s.last_flush=-1,0}else if(0===e.avail_in&&g(t)<=g(n)&&4!==t)return f(e,-5);if(s.status===m&&0!==e.avail_in)return f(e,-5);if(0!==e.avail_in||0!==s.lookahead||0!==t&&s.status!==m){var k=2===s.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(C(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(s,t):3===s.strategy?function(e,t){for(var n,i,s,o,a=e.window;;){if(e.lookahead<=u){if(C(e),e.lookahead<=u&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=a[s=e.strstart-1])===a[++s]&&i===a[++s]&&i===a[++s]){o=e.strstart+u;do{}while(i===a[++s]&&i===a[++s]&&i===a[++s]&&i===a[++s]&&i===a[++s]&&i===a[++s]&&i===a[++s]&&i===a[++s]&&se.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=r._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(s,t):i[s.level].func(s,t);if(3!==k&&4!==k||(s.status=m),1===k||3===k)return 0===e.avail_out&&(s.last_flush=-1),0;if(2===k&&(1===t?r._tr_align(s):5!==t&&(r._tr_stored_block(s,0,0,!1),3===t&&(A(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),y(e),0===e.avail_out))return s.last_flush=-1,0}return 4!==t?0:s.wrap<=0?1:(2===s.wrap?(b(s,255&e.adler),b(s,e.adler>>8&255),b(s,e.adler>>16&255),b(s,e.adler>>24&255),b(s,255&e.total_in),b(s,e.total_in>>8&255),b(s,e.total_in>>16&255),b(s,e.total_in>>24&255)):(w(s,e.adler>>>16),w(s,65535&e.adler)),y(e),s.wrap>0&&(s.wrap=-s.wrap),0!==s.pending?0:1)},t.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==h&&t!==p&&t!==m?f(e,c):(e.state=null,t===p?f(e,-3):0):c},t.deflateSetDictionary=function(e,t){var n,i,r,a,l,u,d,h,p=t.length;if(!e||!e.state)return c;if(2===(a=(n=e.state).wrap)||1===a&&42!==n.status||n.lookahead)return c;for(1===a&&(e.adler=o(e.adler,t,p,0)),n.wrap=0,p>=n.w_size&&(0===a&&(A(n.head),n.strstart=0,n.block_start=0,n.insert=0),h=new s.Buf8(n.w_size),s.arraySet(h,t,p-n.w_size,n.w_size,0),t=h,p=n.w_size),l=e.avail_in,u=e.next_in,d=e.input,e.avail_in=p,e.next_in=0,e.input=t,C(n);n.lookahead>=3;){i=n.strstart,r=n.lookahead-2;do{n.ins_h=(n.ins_h<{"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},8121:e=>{"use strict";e.exports=function(e,t){var n,i,s,r,o,a,l,c,u,d,h,p,m,f,g,A,y,v,b,w,k,C,_,E,I;n=e.state,i=e.next_in,E=e.input,s=i+(e.avail_in-5),r=e.next_out,I=e.output,o=r-(t-e.avail_out),a=r+(e.avail_out-257),l=n.dmax,c=n.wsize,u=n.whave,d=n.wnext,h=n.window,p=n.hold,m=n.bits,f=n.lencode,g=n.distcode,A=(1<>>=b=v>>>24,m-=b,0==(b=v>>>16&255))I[r++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=f[(65535&v)+(p&(1<>>=b,m-=b),m<15&&(p+=E[i++]<>>=b=v>>>24,m-=b,!(16&(b=v>>>16&255))){if(0==(64&b)){v=g[(65535&v)+(p&(1<l){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=b,m-=b,k>(b=r-o)){if((b=k-b)>u&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(C=0,_=h,0===d){if(C+=c-b,b2;)I[r++]=_[C++],I[r++]=_[C++],I[r++]=_[C++],w-=3;w&&(I[r++]=_[C++],w>1&&(I[r++]=_[C++]))}else{C=r-k;do{I[r++]=I[C++],I[r++]=I[C++],I[r++]=I[C++],w-=3}while(w>2);w&&(I[r++]=I[C++],w>1&&(I[r++]=I[C++]))}break}}break}}while(i>3,p&=(1<<(m-=w<<3))-1,e.next_in=i,e.next_out=r,e.avail_in=i{"use strict";var i=n(7609),s=n(5530),r=n(1383),o=n(8121),a=n(7371),l=-2,c=12,u=30;function d(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function p(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(852),t.distcode=t.distdyn=new i.Buf32(592),t.sane=1,t.back=-1,0):l}function m(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,p(e)):l}function f(e,t){var n,i;return e&&e.state?(i=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?l:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,m(e))):l}function g(e,t){var n,i;return e?(i=new h,e.state=i,i.window=null,0!==(n=f(e,t))&&(e.state=null),n):l}var A,y,v=!0;function b(e){if(v){var t;for(A=new i.Buf32(512),y=new i.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,A,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,y,0,e.work,{bits:5}),v=!1}e.lencode=A,e.lenbits=9,e.distcode=y,e.distbits=5}function w(e,t,n,s){var r,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(i.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((r=o.wsize-o.wnext)>s&&(r=s),i.arraySet(o.window,t,n-s,r,o.wnext),(s-=r)?(i.arraySet(o.window,t,n-s,s,0),o.wnext=s,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=r(n.check,R,2,0),y=0,v=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&y)<<8)+(y>>8))%31){e.msg="incorrect header check",n.mode=u;break}if(8!=(15&y)){e.msg="unknown compression method",n.mode=u;break}if(v-=4,F=8+(15&(y>>>=4)),0===n.wbits)n.wbits=F;else if(F>n.wbits){e.msg="invalid window size",n.mode=u;break}n.dmax=1<>8&1),512&n.flags&&(R[0]=255&y,R[1]=y>>>8&255,n.check=r(n.check,R,2,0)),y=0,v=0,n.mode=3;case 3:for(;v<32;){if(0===g)break e;g--,y+=h[m++]<>>8&255,R[2]=y>>>16&255,R[3]=y>>>24&255,n.check=r(n.check,R,4,0)),y=0,v=0,n.mode=4;case 4:for(;v<16;){if(0===g)break e;g--,y+=h[m++]<>8),512&n.flags&&(R[0]=255&y,R[1]=y>>>8&255,n.check=r(n.check,R,2,0)),y=0,v=0,n.mode=5;case 5:if(1024&n.flags){for(;v<16;){if(0===g)break e;g--,y+=h[m++]<>>8&255,n.check=r(n.check,R,2,0)),y=0,v=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((_=n.length)>g&&(_=g),_&&(n.head&&(F=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),i.arraySet(n.head.extra,h,m,_,F)),512&n.flags&&(n.check=r(n.check,h,_,m)),g-=_,m+=_,n.length-=_),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===g)break e;_=0;do{F=h[m+_++],n.head&&F&&n.length<65536&&(n.head.name+=String.fromCharCode(F))}while(F&&_>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=c;break;case 10:for(;v<32;){if(0===g)break e;g--,y+=h[m++]<>>=7&v,v-=7&v,n.mode=27;break}for(;v<3;){if(0===g)break e;g--,y+=h[m++]<>>=1)){case 0:n.mode=14;break;case 1:if(b(n),n.mode=20,6===t){y>>>=2,v-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=u}y>>>=2,v-=2;break;case 14:for(y>>>=7&v,v-=7&v;v<32;){if(0===g)break e;g--,y+=h[m++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=u;break}if(n.length=65535&y,y=0,v=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(_=n.length){if(_>g&&(_=g),_>A&&(_=A),0===_)break e;i.arraySet(p,h,m,_,f),g-=_,m+=_,A-=_,f+=_,n.length-=_;break}n.mode=c;break;case 17:for(;v<14;){if(0===g)break e;g--,y+=h[m++]<>>=5,v-=5,n.ndist=1+(31&y),y>>>=5,v-=5,n.ncode=4+(15&y),y>>>=4,v-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=u;break}n.have=0,n.mode=18;case 18:for(;n.have>>=3,v-=3}for(;n.have<19;)n.lens[N[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,M={bits:n.lenbits},O=a(0,n.lens,0,19,n.lencode,0,n.work,M),n.lenbits=M.bits,O){e.msg="invalid code lengths set",n.mode=u;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,B=65535&Q,!((S=Q>>>24)<=v);){if(0===g)break e;g--,y+=h[m++]<>>=S,v-=S,n.lens[n.have++]=B;else{if(16===B){for(L=S+2;v>>=S,v-=S,0===n.have){e.msg="invalid bit length repeat",n.mode=u;break}F=n.lens[n.have-1],_=3+(3&y),y>>>=2,v-=2}else if(17===B){for(L=S+3;v>>=S)),y>>>=3,v-=3}else{for(L=S+7;v>>=S)),y>>>=7,v-=7}if(n.have+_>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=u;break}for(;_--;)n.lens[n.have++]=F}}if(n.mode===u)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=u;break}if(n.lenbits=9,M={bits:n.lenbits},O=a(1,n.lens,0,n.nlen,n.lencode,0,n.work,M),n.lenbits=M.bits,O){e.msg="invalid literal/lengths set",n.mode=u;break}if(n.distbits=6,n.distcode=n.distdyn,M={bits:n.distbits},O=a(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,M),n.distbits=M.bits,O){e.msg="invalid distances set",n.mode=u;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(g>=6&&A>=258){e.next_out=f,e.avail_out=A,e.next_in=m,e.avail_in=g,n.hold=y,n.bits=v,o(e,C),f=e.next_out,p=e.output,A=e.avail_out,m=e.next_in,h=e.input,g=e.avail_in,y=n.hold,v=n.bits,n.mode===c&&(n.back=-1);break}for(n.back=0;x=(Q=n.lencode[y&(1<>>16&255,B=65535&Q,!((S=Q>>>24)<=v);){if(0===g)break e;g--,y+=h[m++]<>T)])>>>16&255,B=65535&Q,!(T+(S=Q>>>24)<=v);){if(0===g)break e;g--,y+=h[m++]<>>=T,v-=T,n.back+=T}if(y>>>=S,v-=S,n.back+=S,n.length=B,0===x){n.mode=26;break}if(32&x){n.back=-1,n.mode=c;break}if(64&x){e.msg="invalid literal/length code",n.mode=u;break}n.extra=15&x,n.mode=22;case 22:if(n.extra){for(L=n.extra;v>>=n.extra,v-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;x=(Q=n.distcode[y&(1<>>16&255,B=65535&Q,!((S=Q>>>24)<=v);){if(0===g)break e;g--,y+=h[m++]<>T)])>>>16&255,B=65535&Q,!(T+(S=Q>>>24)<=v);){if(0===g)break e;g--,y+=h[m++]<>>=T,v-=T,n.back+=T}if(y>>>=S,v-=S,n.back+=S,64&x){e.msg="invalid distance code",n.mode=u;break}n.offset=B,n.extra=15&x,n.mode=24;case 24:if(n.extra){for(L=n.extra;v>>=n.extra,v-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=u;break}n.mode=25;case 25:if(0===A)break e;if(_=C-A,n.offset>_){if((_=n.offset-_)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=u;break}_>n.wnext?(_-=n.wnext,E=n.wsize-_):E=n.wnext-_,_>n.length&&(_=n.length),I=n.window}else I=p,E=f-n.offset,_=n.length;_>A&&(_=A),A-=_,n.length-=_;do{p[f++]=I[E++]}while(--_);0===n.length&&(n.mode=21);break;case 26:if(0===A)break e;p[f++]=n.length,A--,n.mode=21;break;case 27:if(n.wrap){for(;v<32;){if(0===g)break e;g--,y|=h[m++]<{"use strict";var i=n(7609),s=15,r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(e,t,n,c,u,d,h,p){var m,f,g,A,y,v,b,w,k,C=p.bits,_=0,E=0,I=0,S=0,x=0,B=0,T=0,P=0,D=0,F=0,O=null,M=0,L=new i.Buf16(16),Q=new i.Buf16(16),R=null,N=0;for(_=0;_<=s;_++)L[_]=0;for(E=0;E=1&&0===L[S];S--);if(x>S&&(x=S),0===S)return u[d++]=20971520,u[d++]=20971520,p.bits=1,0;for(I=1;I0&&(0===e||1!==S))return-1;for(Q[1]=0,_=1;_852||2===e&&D>592)return 1;for(;;){b=_-T,h[E]v?(w=R[N+h[E]],k=O[M+h[E]]):(w=96,k=0),m=1<<_-T,I=f=1<>T)+(f-=m)]=b<<24|w<<16|k|0}while(0!==f);for(m=1<<_-1;F&m;)m>>=1;if(0!==m?(F&=m-1,F+=m):F=0,E++,0==--L[_]){if(_===S)break;_=t[n+h[E]]}if(_>x&&(F&A)!==g){for(0===T&&(T=x),y+=I,P=1<<(B=_-T);B+T852||2===e&&D>592)return 1;u[g=F&A]=x<<24|B<<16|y-d|0}}return 0!==F&&(u[y+F]=_-T<<24|64<<16|0),p.bits=x,0}},5710:e=>{"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},7322:(e,t,n)=>{"use strict";var i=n(7609);function s(e){for(var t=e.length;--t>=0;)e[t]=0}var r=256,o=286,a=30,l=15,c=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],u=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],h=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],p=new Array(576);s(p);var m=new Array(60);s(m);var f=new Array(512);s(f);var g=new Array(256);s(g);var A=new Array(29);s(A);var y,v,b,w=new Array(a);function k(e,t,n,i,s){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=s,this.has_stree=e&&e.length}function C(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function _(e){return e<256?f[e]:f[256+(e>>>7)]}function E(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<>>=1,n<<=1}while(--t>0);return n>>>1}function B(e,t,n){var i,s,r=new Array(16),o=0;for(i=1;i<=l;i++)r[i]=o=o+n[i-1]<<1;for(s=0;s<=t;s++){var a=e[2*s+1];0!==a&&(e[2*s]=x(r[a]++,a))}}function T(e){var t;for(t=0;t8?E(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function D(e,t,n,i){var s=2*t,r=2*n;return e[s]>1;n>=1;n--)F(e,r,n);s=c;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,r,1),i=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=i,r[2*s]=r[2*n]+r[2*i],e.depth[s]=(e.depth[n]>=e.depth[i]?e.depth[n]:e.depth[i])+1,r[2*n+1]=r[2*i+1]=s,e.heap[1]=s++,F(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,i,s,r,o,a,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,h=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,m=t.stat_desc.extra_base,f=t.stat_desc.max_length,g=0;for(r=0;r<=l;r++)e.bl_count[r]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)(r=c[2*c[2*(i=e.heap[n])+1]+1]+1)>f&&(r=f,g++),c[2*i+1]=r,i>u||(e.bl_count[r]++,o=0,i>=m&&(o=p[i-m]),a=c[2*i],e.opt_len+=a*(r+o),h&&(e.static_len+=a*(d[2*i+1]+o)));if(0!==g){do{for(r=f-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[f]--,g-=2}while(g>0);for(r=f;0!==r;r--)for(i=e.bl_count[r];0!==i;)(s=e.heap[--n])>u||(c[2*s+1]!==r&&(e.opt_len+=(r-c[2*s+1])*c[2*s],c[2*s+1]=r),i--)}}(e,t),B(r,u,e.bl_count)}function L(e,t,n){var i,s,r=-1,o=t[1],a=0,l=7,c=4;for(0===o&&(l=138,c=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)s=o,o=t[2*(i+1)+1],++a>=7;i0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t=3&&0===e.bl_tree[2*h[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),s=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=s&&(s=o)):s=o=n+5,n+4<=s&&-1!==t?N(e,t,n,i):4===e.strategy||o===s?(I(e,2+(i?1:0),3),O(e,p,m)):(I(e,4+(i?1:0),3),function(e,t,n,i){var s;for(I(e,t-257,5),I(e,n-1,5),I(e,i-4,4),s=0;s