varX=Object.defineProperty;varit=Object.getOwnPropertyDescriptor;varrt=Object.getOwnPropertyNames;varot=Object.prototype.hasOwnProperty;varat=(h,e)=>{for(vartine)X(h,t,{get:e[t],enumerable:!0})},ct=(h,e,t,n)=>{if(e&&typeofe=="object"||typeofe=="function")for(letsofrt(e))!ot.call(h,s)&&s!==t&&X(h,s,{get:()=>e[s],enumerable:!(n=it(e,s))||n.enumerable});returnh};varlt=h=>ct(X({},"__esModule",{value:!0}),h);varft={};at(ft,{default:()=>G});module.exports=lt(ft);varst=require("obsidian");varS=require("obsidian");varO=class{constructor(){this.values=newMap}put(e,t){this.values.set(e,t)}get(e,t){varn;return(n=this.values.get(e))!=null?n:t}getFirst(e,t){for(letn=0;n<e.length;n++){lets=e[n];if(this.containsKey(s))returnthis.get(s,t)}returnt}containsKey(e){returnthis.values.has(e)}getKeys(){returnArray.from(this.values.keys())}clear(){this.values.clear()}};varg=class{staticsetActive(e){g.isActive=e,g.isActive||this.clear()}staticsetAutoExpire(e){g.baseMinutesToExpire=e!=null?e:0,g.updateExpiryTime()}staticupdateExpiryTime(){g.baseMinutesToExpire==0||g.baseMinutesToExpire==null?g.expiryTime=null:g.expiryTime=Date.now()+g.baseMinutesToExpire*1e3*60}staticput(e,t){!g.isActive||(this.cache.put(t.path,e),this.cache.put(t.parent.path,e),this.cache.put(t.basename,e),g.updateExpiryTime())}staticgetExact(e){returng.isActive?(this.clearIfExpired(),g.updateExpiryTime(),this.cache.get(e.path,g.blankPasswordAndHint)):g.blankPasswordAndHint}staticgetBestGuess(e){returng.isActive?(this.clearIfExpired(),g.updateExpiryTime(),this.cache.getFirst([e.path,e.parent.path,e.basename],g.blankPasswordAndHint)):g.blankPasswordAndHint}staticclearIfExpired(){g.expiryTime!=null&&(Date.now()<g.expiryTime||this.clear())}staticclear(){this.cache.clear()}},f=g;f.isActive=!0,f.blankPasswordAndHint={password:"",hint:""},f.cache=newO,f.baseMinutesToExpire=0,f.expiryTime=null;varN=classextendsS.PluginSettingTab{constructor(t,n,s,i){super(t,n);this.plugin=n,this.settings=s,this.features=i}display(){let{containerEl:t}=this;t.empty(),t.createEl("h1",{text:"Settings for Meld Encrypt"}),newS.Setting(t).setHeading().setName("Common Settings"),newS.Setting(t).setName("Confirm password?").setDesc("Confirm password when encrypting.").addToggle(i=>{i.setValue(this.settings.confirmPassword).onChange(asyncr=>{this.settings.confirmPassword=r,awaitthis.plugin.saveSettings()})});letn=()=>{if(!this.settings.rememberPassword){s.settingEl.hide();return}s.settingEl.show();leti=this.settings.rememberPasswordTimeout,r=`${i} minutes`;i==0&&(r="Never forget"),s.setName(`Remember Password Timeout (${r})`)};newS.Setting(t).setName("Remember password?").setDesc("Remember the last used passwords when encrypting or decrypting.").addToggle(i=>{i.setValue(this.settings.rememberPassword).onChange(asyncr=>{this.settings.rememberPassword=r,awaitthis.plugin.saveSettings(),f.setActive(this.settings.rememberPassword),n()})});lets=newS.Setting(t).setDesc("The number of minutes to remember passwords.").addSlider(i=>{i.setLimits(0,120,5).setValue(this.settings.rememberPasswordTimeout).onChange(asyncr=>{this.settings.rememberPasswordTimeout=r,awaitthis.plugin.saveSettings(),f.setAutoExpire(this.settings.rememberPasswordTimeout),n()})});n(),this.features.forEach(i=>{i.buildSettingsUi(t,async()=>awaitthis.plugin.saveSettings())})}};varv=require("obsidian");varq=newTextEncoder,pt=newTextDecoder,dt=1e3,ut=q.encode("XHWnDAT6ehMVY2zD"),C=class{asyncderiveKey(e){lett=q.encode(e),n=awaitcrypto.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);returncrypto.subtle.deriveKey({name:"PBKDF2",hash:{name:"SHA-256"},iterations:dt,salt:ut},n,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}asyncencryptToBytes(e,t){letn=awaitthis.deriveKey(t),s=q.encode(e),i=crypto.getRandomValues(newUint8Array(16)),r=newUint8Array(awaitcrypto.subtle.encrypt({name:"AES-GCM",iv:i},n,s)),o=newUint8Array(i.byteLength+r.byteLength);returno.set(i,0),o.set(r,i.byteLength),o}convertToString(e){lett="";for(letn=0;n<e.length;n++)t+=String.fromCharCode(e[n]);retur