/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var Lm=Object.create;var jn=Object.defineProperty,Nm=Object.defineProperties,Bm=Object.getOwnPropertyDescriptor,Km=Object.getOwnPropertyDescriptors,zm=Object.getOwnPropertyNames,dl=Object.getOwnPropertySymbols,Hm=Object.getPrototypeOf,pl=Object.prototype.hasOwnProperty,Vm=Object.prototype.propertyIsEnumerable;var hl=(t,e,r)=>e in t?jn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ye=(t,e)=>{for(var r in e||(e={}))pl.call(e,r)&&hl(t,r,e[r]);if(dl)for(var r of dl(e))Vm.call(e,r)&&hl(t,r,e[r]);return t},ze=(t,e)=>Nm(t,Km(e)),ml=t=>jn(t,"__esModule",{value:!0});var A=(t,e)=>()=>(t&&(e=t(t=0)),e);var gi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gl=(t,e)=>{ml(t);for(var r in e)jn(t,r,{get:e[r],enumerable:!0})},Wm=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of zm(e))!pl.call(t,n)&&n!=="default"&&jn(t,n,{get:()=>e[n],enumerable:!(r=Bm(e,n))||r.enumerable});return t},ve=t=>Wm(ml(jn(t!=null?Lm(Hm(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);function fe(){}function $m(t,e){for(let r in e)t[r]=e[r];return t}function os(t){return t()}function yl(){return Object.create(null)}function it(t){t.forEach(os)}function Er(t){return typeof t=="function"}function Te(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function ss(t,e){return yi||(yi=document.createElement("a")),yi.href=e,t===yi.href}function _l(t){return Object.keys(t).length===0}function vl(t,...e){if(t==null)return fe;let r=t.subscribe(...e);return r.unsubscribe?()=>r.unsubscribe():r}function _i(t,e,r){t.$$.on_destroy.push(vl(e,r))}function Fr(t,e,r,n){if(t){let i=bl(t,e,r,n);return t[0](i)}}function bl(t,e,r,n){return t[1]&&n?$m(r.ctx.slice(),t[1](n(e))):r.ctx}function Tr(t,e,r,n){if(t[2]&&n){let i=t[2](n(r));if(e.dirty===void 0)return i;if(typeof i=="object"){let o=[],s=Math.max(e.dirty.length,i.length);for(let a=0;a32){let e=[],r=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,r,n)}function N(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function Qm(t){return Array.from(t.childNodes)}function ct(t,e){e=""+e,t.data!==e&&(t.data=e)}function as(t,e){t.value=e??""}function qe(t,e,r,n){r==null?t.style.removeProperty(e):t.style.setProperty(e,r,n?"important":"")}function ls(t,e,r){t.classList[r?"add":"remove"](e)}function qm(t,e,{bubbles:r=!1,cancelable:n=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(t,r,n,e),i}function Cn(t){Sn=t}function us(){if(!Sn)throw new Error("Function called outside component initialization");return Sn}function En(t){us().$$.on_mount.push(t)}function Fn(t){us().$$.on_destroy.push(t)}function cs(){let t=us();return(e,r,{cancelable:n=!1}={})=>{let i=t.$$.callbacks[e];if(i){let o=qm(e,r,{cancelable:n});return i.slice().forEach(s=>{s.call(t,o)}),!o.defaultPrevented}return!0}}function Ye(t,e){let r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}function Cl(){fs||(fs=!0,Sl.then(El))}function kt(){return Cl(),Sl}function ds(t){Pr.push(t)}function El(){if(kr!==0)return;let t=Sn;do{try{for(;krt.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),Pr=e}function or(){ir={r:0,c:[],p:ir}}function sr(){ir.r||it(ir.c),ir=ir.p}function te(t,e){t&&t.i&&(xi.delete(t),t.i(e))}function ne(t,e,r,n){if(t&&t.o){if(xi.has(t))return;xi.add(t),ir.c.push(()=>{xi.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function Ue(t){t&&t.c()}function He(t,e,r,n){let{fragment:i,after_update:o}=t.$$;i&&i.m(e,r),n||ds(()=>{let s=t.$$.on_mount.map(os).filter(Er);t.$$.on_destroy?t.$$.on_destroy.push(...s):it(s),t.$$.on_mount=[]}),o.forEach(ds)}function Le(t,e){let r=t.$$;r.fragment!==null&&(Jm(r.after_update),it(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function Zm(t,e){t.$$.dirty[0]===-1&&(Ir.push(t),Cl(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{let y=h.length?h[0]:f;return l.ctx&&i(l.ctx[p],l.ctx[p]=y)&&(!l.skip_bound&&l.bound[p]&&l.bound[p](y),c&&Zm(t,p)),f}):[],l.update(),c=!0,it(l.before_update),l.fragment=n?n(l.ctx):!1,e.target){if(e.hydrate){Um();let p=Qm(e.target);l.fragment&&l.fragment.l(p),p.forEach(W)}else l.fragment&&l.fragment.c();e.intro&&te(t.$$.fragment),He(t,e.target,e.anchor,e.customElement),Gm(),El()}Cn(u)}var yi,wl,vi,jl,Sn,Ir,_t,Pr,Al,Sl,fs,ps,kr,xi,ir,Xm,U1,eg,ke,Ze=A(()=>{wl=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,vi=class{constructor(e){this.options=e,this._listeners="WeakMap"in wl?new WeakMap:void 0}observe(e,r){return this._listeners.set(e,r),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!==null&&e!==void 0?e:this._observer=new ResizeObserver(r=>{var n;for(let i of r)vi.entries.set(i.target,i),(n=this._listeners.get(i.target))===null||n===void 0||n(i)})}};vi.entries="WeakMap"in wl?new WeakMap:void 0;jl=!1;Ir=[],_t=[],Pr=[],Al=[],Sl=Promise.resolve(),fs=!1;ps=new Set,kr=0;xi=new Set;Xm=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],U1=new Set([...Xm]);typeof HTMLElement=="function"&&(eg=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(os).filter(Er);for(let e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(t,e,r){this[t]=r}disconnectedCallback(){it(this.$$.on_disconnect)}$destroy(){Le(this,1),this.$destroy=fe}$on(t,e){if(!Er(e))return fe;let r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(e),()=>{let n=r.indexOf(e);n!==-1&&r.splice(n,1)}}$set(t){this.$$set&&!_l(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});ke=class{$destroy(){Le(this,1),this.$destroy=fe}$on(e,r){if(!Er(r))return fe;let n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{let i=n.indexOf(r);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!_l(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}});var hs,Fl=A(()=>{hs=class{constructor(){this.handlers=new Map;this.disabled=[]}on(e,r,n){if(e.includes("@")||r.includes("@"))throw new Error("Invalid context/event name - Cannot contain @");this.handlers.set(`${e}@${r}`,n)}off(e,r){if(r)this.handlers.delete(`${e}@${r}`);else for(let[n]of this.handlers.entries())n.startsWith(`${e}@`)&&this.handlers.delete(n)}disable(e){this.enable(e),this.disabled.push(e)}enable(e){this.disabled=this.disabled.filter(r=>r!==e)}emit(e,...r){let n=[...this.handlers.entries()].filter(([i,o])=>!this.disabled.includes(i.split("@")[0]));for(let[i,o]of n)i.endsWith(`@${e}`)&&o(...r)}}});function wi(t,e=fe){let r,n=new Set;function i(a){if(Te(t,a)&&(t=a,r)){let u=!Mr.length;for(let l of n)l[1](),Mr.push(l,t);if(u){for(let l=0;l{n.delete(l),n.size===0&&r&&(r(),r=null)}}return{set:i,update:o,subscribe:s}}var Mr,ms=A(()=>{Ze();Ze();Mr=[]});function Ve(t,e){return typeof e!="object"||be(e).forEach(function(r){t[r]=e[r]}),t}function Je(t,e){return tg.call(t,e)}function Rr(t,e){typeof e=="function"&&(e=e(Tn(t))),(typeof Reflect=="undefined"?be:Reflect.ownKeys)(e).forEach(r=>{vt(t,r,e[r])})}function vt(t,e,r,n){Tl(t,e,Ve(r&&Je(r,"get")&&typeof r.get=="function"?{get:r.get,set:r.set,configurable:!0}:{value:r,configurable:!0,writable:!0},n))}function Lr(t){return{from:function(e){return t.prototype=Object.create(e.prototype),vt(t.prototype,"constructor",t),{extend:Rr.bind(null,t.prototype)}}}}function gs(t,e){let r=rg(t,e),n;return r||(n=Tn(t))&&gs(n,e)}function ji(t,e,r){return ng.call(t,e,r)}function Dl(t,e){return e(t)}function Dn(t){if(!t)throw new Error("Assertion Failed")}function Ol(t){ue.setImmediate?setImmediate(t):setTimeout(t,0)}function Il(t,e){return t.reduce((r,n,i)=>{var o=e(n,i);return o&&(r[o[0]]=o[1]),r},{})}function ig(t,e,r){try{t.apply(null,r)}catch(n){e&&e(n)}}function bt(t,e){if(Je(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var r=[],n=0,i=e.length;n=0)e=t;else{let o=Tn(t);e=o===Object.prototype?{}:Object.create(o),Mt&&Mt.set(t,e);for(var i in t)Je(t,i)&&(e[i]=ys(t[i]))}return e}function _s(t){return lg.call(t).slice(8,-1)}function xt(t){var e,r,n,i;if(arguments.length===1){if(Be(t))return t.slice();if(this===Nr&&typeof t=="string")return[t];if(i=ug(t)){for(r=[];n=i.next(),!n.done;)r.push(n.value);return r}if(t==null)return[t];if(e=t.length,typeof e=="number"){for(r=new Array(e);e--;)r[e]=t[e];return r}return[t]}for(e=arguments.length,r=new Array(e);e--;)r[e]=arguments[e];return r}function Rl(t,e){ft=t,Ll=e}function ar(){if(cg)try{throw ar.arguments,new Error}catch(t){return t}return new Error}function xs(t,e){var r=t.stack;return r?(e=e||0,r.indexOf(t.name)===0&&(e+=(t.name+t.message).split(` `).length),r.split(` `).slice(e).filter(Ll).map(n=>` `+n).join("")):""}function Br(t,e){this._e=ar(),this.name=t,this.message=e}function Bl(t,e){return t+". Errors: "+Object.keys(e).map(r=>e[r].toString()).filter((r,n,i)=>i.indexOf(r)===n).join(` `)}function Ai(t,e,r,n){this._e=ar(),this.failures=e,this.failedKeys=n,this.successCount=r,this.message=Bl(t,e)}function In(t,e){this._e=ar(),this.name="BulkError",this.failures=Object.keys(e).map(r=>e[r]),this.failuresByPos=e,this.message=Bl(t,e)}function hg(t,e){if(!t||t instanceof Br||t instanceof TypeError||t instanceof SyntaxError||!t.name||!Kl[t.name])return t;var r=new Kl[t.name](e||t.message,t);return"stack"in t&&vt(r,"stack",{get:function(){return this.inner.stack}}),r}function ie(){}function Pn(t){return t}function mg(t,e){return t==null||t===Pn?e:function(r){return e(t(r))}}function lr(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function gg(t,e){return t===ie?e:function(){var r=t.apply(this,arguments);r!==void 0&&(arguments[0]=r);var n=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=e.apply(this,arguments);return n&&(this.onsuccess=this.onsuccess?lr(n,this.onsuccess):n),i&&(this.onerror=this.onerror?lr(i,this.onerror):i),o!==void 0?o:r}}function yg(t,e){return t===ie?e:function(){t.apply(this,arguments);var r=this.onsuccess,n=this.onerror;this.onsuccess=this.onerror=null,e.apply(this,arguments),r&&(this.onsuccess=this.onsuccess?lr(r,this.onsuccess):r),n&&(this.onerror=this.onerror?lr(n,this.onerror):n)}}function _g(t,e){return t===ie?e:function(r){var n=t.apply(this,arguments);Ve(r,n);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var s=e.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?lr(i,this.onsuccess):i),o&&(this.onerror=this.onerror?lr(o,this.onerror):o),n===void 0?s===void 0?void 0:s:Ve(n,s)}}function vg(t,e){return t===ie?e:function(){return e.apply(this,arguments)===!1?!1:t.apply(this,arguments)}}function As(t,e){return t===ie?e:function(){var r=t.apply(this,arguments);if(r&&typeof r.then=="function"){for(var n=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return r.then(function(){return e.apply(n,o)})}return e.apply(this,arguments)}}function R(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ie,this._lib=!1;var e=this._PSD=z;if(ft&&(this._stackHolder=ar(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==kn)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Ps(this,this._value);return}this._state=null,this._value=null,++e.ref,Wl(this,t)}function Vl(t,e,r,n,i){this.onFulfilled=typeof t=="function"?t:null,this.onRejected=typeof e=="function"?e:null,this.resolve=r,this.reject=n,this.psd=i}function Wl(t,e){try{e(r=>{if(t._state===null){if(r===t)throw new TypeError("A promise cannot be resolved with itself.");var n=t._lib&&Ln();r&&typeof r.then=="function"?Wl(t,(i,o)=>{r instanceof R?r._then(i,o):r.then(i,o)}):(t._state=!0,t._value=r,$l(t)),n&&Nn()}},Ps.bind(null,t))}catch(r){Ps(t,r)}}function Ps(t,e){if(Ti.push(e),t._state===null){var r=t._lib&&Ln();e=Os(e),t._state=!1,t._value=e,ft&&e!==null&&typeof e=="object"&&!e._promise&&ig(()=>{var n=gs(e,"stack");e._promise=t,vt(e,"stack",{get:()=>Fs?n&&(n.get?n.get.apply(e):n.value):t.stack})}),Sg(t),$l(t),r&&Nn()}}function $l(t){var e=t._listeners;t._listeners=[];for(var r=0,n=e.length;r{--cr==0&&Ms()},[]))}function ks(t,e){if(t._state===null){t._listeners.push(e);return}var r=t._state?e.onFulfilled:e.onRejected;if(r===null)return(t._state?e.resolve:e.reject)(t._value);++e.psd.ref,++cr,Mn(jg,[r,t,e])}function jg(t,e,r){try{Ds=e;var n,i=e._value;e._state?n=t(i):(Ti.length&&(Ti=[]),n=t(i),Ti.indexOf(i)===-1&&Cg(e)),r.resolve(n)}catch(o){r.reject(o)}finally{Ds=null,--cr==0&&Ms(),--r.psd.ref||r.psd.finalize()}}function Ul(t,e,r){if(e.length===r)return e;var n="";if(t._state===!1){var i=t._value,o,s;i!=null?(o=i.name||"Error",s=i.message||i,n=xs(i,0)):(o=i,s=""),e.push(o+(s?": "+s:"")+n)}return ft&&(n=xs(t._stackHolder,2),n&&e.indexOf(n)===-1&&e.push(n),t._prev&&Ul(t._prev,e,r)),e}function Gl(t,e){var r=e?e._numPrev+1:0;r0;)for(t=Rn,Rn=[],r=t.length,e=0;e0);Ts=!0,Fi=!0}function Ms(){var t=ur;ur=[],t.forEach(n=>{n._PSD.onunhandled.call(null,n._value,n)});for(var e=Di.slice(0),r=e.length;r;)e[--r]()}function Ag(t){function e(){t(),Di.splice(Di.indexOf(e),1)}Di.push(e),++cr,Mn(()=>{--cr==0&&Ms()},[])}function Sg(t){ur.some(e=>e._value===t._value)||ur.push(t)}function Cg(t){for(var e=ur.length;e;)if(ur[--e]._value===t._value){ur.splice(e,1);return}}function Ii(t){return new R(kn,!1,t)}function de(t,e){var r=z;return function(){var n=Ln(),i=z;try{return Lt(r,!0),t.apply(this,arguments)}catch(o){e&&e(o)}finally{Lt(i,!1),n&&Nn()}}}function Rt(t,e,r,n){var i=z,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Fg;var s=Kr.env;o.env=Es?{Promise:R,PromiseProp:{value:R,configurable:!0,writable:!0},all:R.all,race:R.race,allSettled:R.allSettled,any:R.any,resolve:R.resolve,reject:R.reject,nthen:Yl(s.nthen,o),gthen:Yl(s.gthen,o)}:{},e&&Ve(o,e),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=Hr(o,t,r,n);return o.ref===0&&o.finalize(),a}function zr(){return Ke.id||(Ke.id=++Eg),++Ke.awaits,Ke.echoes+=zl,Ke.id}function wt(){return Ke.awaits?(--Ke.awaits==0&&(Ke.id=0),Ke.echoes=Ke.awaits*zl,!0):!1}function Mi(t){return Ke.echoes&&t&&t.constructor===Ei?(zr(),t.then(e=>(wt(),e),e=>(wt(),je(e)))):t}function Tg(t){++ki,(!Ke.echoes||--Ke.echoes==0)&&(Ke.echoes=Ke.id=0),Pi.push(z),Lt(t,!0)}function Dg(){var t=Pi[Pi.length-1];Pi.pop(),Lt(t,!1)}function Lt(t,e){var r=z;if((e?Ke.echoes&&(!Rs++||t!==z):Rs&&(!--Rs||t!==z))&&ql(e?Tg.bind(null,t):Dg),t!==z&&(z=t,r===Kr&&(Kr.env=Ql()),Es)){var n=Kr.env.Promise,i=t.env;Ci.then=i.nthen,n.prototype.then=i.gthen,(r.global||t.global)&&(Object.defineProperty(ue,"Promise",i.PromiseProp),n.all=i.all,n.race=i.race,n.resolve=i.resolve,n.reject=i.reject,i.allSettled&&(n.allSettled=i.allSettled),i.any&&(n.any=i.any))}}function Ql(){var t=ue.Promise;return Es?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(ue,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:Ci.then,gthen:t.prototype.then}:{}}function Hr(t,e,r,n,i){var o=z;try{return Lt(t,!0),e(r,n,i)}finally{Lt(o,!1)}}function ql(t){Hl.call(Ss,t)}function Ri(t,e,r,n){return typeof t!="function"?t:function(){var i=z;r&&zr(),Lt(e,!0);try{return t.apply(this,arguments)}finally{Lt(i,!1),n&&ql(wt)}}}function Yl(t,e){return function(r,n){return t.call(this,Ri(r,e),Ri(n,e))}}function Xl(t,e){var r;try{r=e.onuncatched(t)}catch{}if(r!==!1)try{var n,i={promise:e,reason:t};if(ue.document&&document.createEvent?(n=document.createEvent("Event"),n.initEvent(Jl,!0,!0),Ve(n,i)):ue.CustomEvent&&(n=new CustomEvent(Jl,{detail:i}),Ve(n,i)),n&&ue.dispatchEvent&&(dispatchEvent(n),!ue.PromiseRejectionEvent&&ue.onunhandledrejection))try{ue.onunhandledrejection(n)}catch{}ft&&n&&!n.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}function Ls(t,e,r,n){if(!t.idbdb||!t._state.openComplete&&!z.letThrough&&!t._vip){if(t._state.openComplete)return je(new V.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return je(new V.DatabaseClosed);t.open().catch(ie)}return t._state.dbReadyPromise.then(()=>Ls(t,e,r,n))}else{var i=t._createTransaction(e,r,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(o){return o.name===js.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>Ls(t,e,r,n))):je(o)}return i._promise(e,(o,s)=>Rt(()=>(z.trans=i,n(o,s,i)))).then(o=>i._completion.then(()=>o))}}function dr(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}function Bi(t){return typeof t=="string"&&!/\./.test(t)?e=>(e[t]===void 0&&t in e&&(e=On(e),delete e[t]),e):e=>e}function Kn(t){var e={},r=function(a,u){if(u){for(var l=arguments.length,c=new Array(l-1);--l;)c[l-1]=arguments[l];return e[a].subscribe.apply(null,c),t}else if(typeof a=="string")return e[a]};r.addEventType=o;for(var n=1,i=arguments.length;ndr(n(),e()):e,t.justLimit=r&&!n}function kg(t,e){t.isMatch=dr(t.isMatch,e)}function Ki(t,e){if(t.isPrimKey)return e.primaryKey;let r=e.getIndexByKeyPath(t.index);if(!r)throw new V.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return r}function iu(t,e,r){let n=Ki(t,e.schema);return e.openCursor({trans:r,values:!t.keysOnly,reverse:t.dir==="prev",unique:!!t.unique,query:{index:n,range:t.range}})}function zi(t,e,r,n){let i=t.replayFilter?dr(t.filter,t.replayFilter()):t.filter;if(t.or){let o={},s=(a,u,l)=>{if(!i||i(u,l,f=>u.stop(f),f=>u.fail(f))){var c=u.primaryKey,p=""+c;p==="[object ArrayBuffer]"&&(p=""+new Uint8Array(c)),Je(o,p)||(o[p]=!0,e(a,u,l))}};return Promise.all([t.or._iterate(s,r),ou(iu(t,n,r),t.algorithm,s,!t.keysOnly&&t.valueMapper)])}else return ou(iu(t,n,r),dr(t.algorithm,i),e,!t.keysOnly&&t.valueMapper)}function ou(t,e,r,n){var i=n?(s,a,u)=>r(n(s),a,u):r,o=de(i);return t.then(s=>{if(s)return s.start(()=>{var a=()=>s.continue();(!e||e(s,u=>a=u,u=>{s.stop(u),a=ie},u=>{s.fail(u),a=ie}))&&o(s.value,s,u=>a=u),a()})})}function We(t,e){try{let r=su(t),n=su(e);if(r!==n)return r==="Array"?1:n==="Array"?-1:r==="binary"?1:n==="binary"?-1:r==="string"?1:n==="string"?-1:r==="Date"?1:n!=="Date"?NaN:-1;switch(r){case"number":case"Date":case"string":return t>e?1:te?-1:t===e?0:1}function Xe(t,e,r){var n=t instanceof Ws?new t.Collection(t):t;return n._ctx.error=r?new r(e):new TypeError(e),n}function Wr(t){return new t.Collection(t,()=>uu("")).limit(0)}function Kg(t){return t==="next"?e=>e.toUpperCase():e=>e.toLowerCase()}function zg(t){return t==="next"?e=>e.toLowerCase():e=>e.toUpperCase()}function Hg(t,e,r,n,i,o){for(var s=Math.min(t.length,n.length),a=-1,u=0;u=0?t.substr(0,a)+e[a]+r.substr(a+1):null;i(t[u],l)<0&&(a=u)}return stypeof j=="string"))return Xe(t,eu);function f(j){i=Kg(j),o=zg(j),s=j==="next"?Ng:Bg;var v=r.map(function(d){return{lower:o(d),upper:i(d)}}).sort(function(d,b){return s(d.lower,b.lower)});a=v.map(function(d){return d.upper}),u=v.map(function(d){return d.lower}),l=j,c=j==="next"?"":n}f("next");var h=new t.Collection(t,()=>Nt(a[0],u[p-1]+n));h._ondirectionchange=function(j){f(j)};var y=0;return h._addAlgorithm(function(j,v,d){var b=j.key;if(typeof b!="string")return!1;var m=o(b);if(e(m,u,y))return!0;for(var g=null,x=y;x0)&&(g=_)}return v(g!==null?function(){j.continue(g+c)}:d),!1}),h}function Nt(t,e,r,n){return{type:2,lower:t,upper:e,lowerOpen:r,upperOpen:n}}function uu(t){return{type:1,lower:t,upper:t}}function Vg(t){return zn(Ws.prototype,function(r,n,i){this.db=t,this._ctx={table:r,index:n===":id"?null:n,or:i};let o=t._deps.indexedDB;if(!o)throw new V.MissingAPI;this._cmp=this._ascending=o.cmp.bind(o),this._descending=(s,a)=>o.cmp(a,s),this._max=(s,a)=>o.cmp(s,a)>0?s:a,this._min=(s,a)=>o.cmp(s,a)<0?s:a,this._IDBKeyRange=t._deps.IDBKeyRange})}function dt(t){return de(function(e){return Hn(e),t(e.target.error),!1})}function Hn(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}function Wg(t){return zn(cu.prototype,function(r,n,i,o,s){this.db=t,this.mode=r,this.storeNames=n,this.schema=i,this.chromeTransactionDurability=o,this.idbtrans=null,this.on=Kn(this,"complete","error","abort"),this.parent=s||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new R((a,u)=>{this._resolve=a,this._reject=u}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},a=>{var u=this.active;return this.active=!1,this.on.error.fire(a),this.parent?this.parent._reject(a):u&&this.idbtrans&&this.idbtrans.abort(),je(a)})})}function $s(t,e,r,n,i,o,s){return{name:t,keyPath:e,unique:r,multi:n,auto:i,compound:o,src:(r&&!s?"&":"")+(n?"*":"")+(i?"++":"")+fu(e)}}function fu(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function du(t,e,r){return{name:t,primKey:e,indexes:r,mappedClass:null,idxByName:Il(r,n=>[n.name,n])}}function $g(t){return t.length===1?t[0]:t}function Us(t){return t==null?()=>{}:typeof t=="string"?Ug(t):e=>bt(e,t)}function Ug(t){return t.split(".").length===1?r=>r[t]:r=>bt(r,t)}function pu(t){return[].slice.call(t)}function $n(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Qg(t,e,r){function n(c,p){let f=pu(c.objectStoreNames);return{schema:{name:c.name,tables:f.map(h=>p.objectStore(h)).map(h=>{let{keyPath:y,autoIncrement:j}=h,v=Be(y),d=y==null,b={},m={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:d,compound:v,keyPath:y,autoIncrement:j,unique:!0,extractKey:Us(y)},indexes:pu(h.indexNames).map(g=>h.index(g)).map(g=>{let{name:x,unique:_,multiEntry:w,keyPath:S}=g,E=Be(S),D={name:x,compound:E,keyPath:S,unique:_,multiEntry:w,extractKey:Us(S)};return b[$n(S)]=D,D}),getIndexByKeyPath:g=>b[$n(g)]};return b[":id"]=m.primaryKey,y!=null&&(b[$n(y)]=m.primaryKey),m})},hasGetAll:f.length>0&&"getAll"in p.objectStore(f[0])&&!(typeof navigator!="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function i(c){if(c.type===3)return null;if(c.type===4)throw new Error("Cannot convert never type to IDBKeyRange");let{lower:p,upper:f,lowerOpen:h,upperOpen:y}=c;return p===void 0?f===void 0?null:e.upperBound(f,!!y):f===void 0?e.lowerBound(p,!!h):e.bound(p,f,!!h,!!y)}function o(c){let p=c.name;function f({trans:j,type:v,keys:d,values:b,range:m}){return new Promise((g,x)=>{g=de(g);let _=j.objectStore(p),w=_.keyPath==null,S=v==="put"||v==="add";if(!S&&v!=="delete"&&v!=="deleteRange")throw new Error("Invalid operation type: "+v);let{length:E}=d||b||{length:1};if(d&&b&&d.length!==b.length)throw new Error("Given keys array must have same length as given values array.");if(E===0)return g({numFailures:0,failures:{},results:[],lastResult:void 0});let D,O=[],L=[],k=0,H=Y=>{++k,Hn(Y)};if(v==="deleteRange"){if(m.type===4)return g({numFailures:k,failures:L,results:[],lastResult:void 0});m.type===3?O.push(D=_.clear()):O.push(D=_.delete(i(m)))}else{let[Y,J]=S?w?[b,d]:[b,null]:[d,null];if(S)for(let C=0;C{let J=Y.target.result;O.forEach((C,F)=>C.error!=null&&(L[F]=C.error)),g({numFailures:k,failures:L,results:v==="delete"?d:O.map(C=>C.result),lastResult:J})};D.onerror=Y=>{H(Y),X(Y)},D.onsuccess=X})}function h({trans:j,values:v,query:d,reverse:b,unique:m}){return new Promise((g,x)=>{g=de(g);let{index:_,range:w}=d,S=j.objectStore(p),E=_.isPrimaryKey?S:S.index(_.name),D=b?m?"prevunique":"prev":m?"nextunique":"next",O=v||!("openKeyCursor"in E)?E.openCursor(i(w),D):E.openKeyCursor(i(w),D);O.onerror=dt(x),O.onsuccess=de(L=>{let k=O.result;if(!k){g(null);return}k.___id=++Gg,k.done=!1;let H=k.continue.bind(k),X=k.continuePrimaryKey;X&&(X=X.bind(k));let Y=k.advance.bind(k),J=()=>{throw new Error("Cursor not started")},C=()=>{throw new Error("Cursor not stopped")};k.trans=j,k.stop=k.continue=k.continuePrimaryKey=k.advance=J,k.fail=de(x),k.next=function(){let F=1;return this.start(()=>F--?this.continue():this.stop()).then(()=>this)},k.start=F=>{let P=new Promise((Z,se)=>{Z=de(Z),O.onerror=dt(se),k.fail=se,k.stop=Fe=>{k.stop=k.continue=k.continuePrimaryKey=k.advance=C,Z(Fe)}}),K=()=>{if(O.result)try{F()}catch(Z){k.fail(Z)}else k.done=!0,k.start=()=>{throw new Error("Cursor behind last entry")},k.stop()};return O.onsuccess=de(Z=>{O.onsuccess=K,K()}),k.continue=H,k.continuePrimaryKey=X,k.advance=Y,K(),P},g(k)},x)})}function y(j){return v=>new Promise((d,b)=>{d=de(d);let{trans:m,values:g,limit:x,query:_}=v,w=x===1/0?void 0:x,{index:S,range:E}=_,D=m.objectStore(p),O=S.isPrimaryKey?D:D.index(S.name),L=i(E);if(x===0)return d({result:[]});if(j){let k=g?O.getAll(L,w):O.getAllKeys(L,w);k.onsuccess=H=>d({result:H.target.result}),k.onerror=dt(b)}else{let k=0,H=g||!("openKeyCursor"in O)?O.openCursor(L):O.openKeyCursor(L),X=[];H.onsuccess=Y=>{let J=H.result;if(!J)return d({result:X});if(X.push(g?J.value:J.primaryKey),++k===x)return d({result:X});J.continue()},H.onerror=dt(b)}})}return{name:p,schema:c,mutate:f,getMany({trans:j,keys:v}){return new Promise((d,b)=>{d=de(d);let m=j.objectStore(p),g=v.length,x=new Array(g),_=0,w=0,S,E=O=>{let L=O.target;(x[L._pos]=L.result)!=null,++w===_&&d(x)},D=dt(b);for(let O=0;O{d=de(d);let g=j.objectStore(p).get(v);g.onsuccess=x=>d(x.target.result),g.onerror=dt(b)})},query:y(a),openCursor:h,count({query:j,trans:v}){let{index:d,range:b}=j;return new Promise((m,g)=>{let x=v.objectStore(p),_=d.isPrimaryKey?x:x.index(d.name),w=i(b),S=w?_.count(w):_.count();S.onsuccess=de(E=>m(E.target.result)),S.onerror=dt(g)})}}}let{schema:s,hasGetAll:a}=n(t,r),u=s.tables.map(c=>o(c)),l={};return u.forEach(c=>l[c.name]=c),{stack:"dbcore",transaction:t.transaction.bind(t),table(c){if(!l[c])throw new Error(`Table '${c}' not found`);return l[c]},MIN_KEY:-1/0,MAX_KEY:Wn(e),schema:s}}function qg(t,e){return e.reduce((r,{create:n})=>ye(ye({},r),n(r)),t)}function Yg(t,e,{IDBKeyRange:r,indexedDB:n},i){return{dbcore:qg(Qg(e,r,i),t.dbcore)}}function Gs({_novip:t},e){let r=e.db,n=Yg(t._middlewares,r,t._deps,e);t.core=n.dbcore,t.tables.forEach(i=>{let o=i.name;t.core.schema.tables.some(s=>s.name===o)&&(i.core=t.core.table(o),t[o]instanceof t.Table&&(t[o].core=i.core))})}function Vi({_novip:t},e,r,n){r.forEach(i=>{let o=n[i];e.forEach(s=>{let a=gs(s,i);(!a||"value"in a&&a.value===void 0)&&(s===t.Transaction.prototype||s instanceof t.Transaction?vt(s,i,{get(){return this.table(i)},set(u){Tl(this,i,{value:u,writable:!0,configurable:!0,enumerable:!0})}}):s[i]=new t.Table(i,o))})})}function Qs({_novip:t},e){e.forEach(r=>{for(let n in r)r[n]instanceof t.Table&&delete r[n]})}function Jg(t,e){return t._cfg.version-e._cfg.version}function Xg(t,e,r,n){let i=t._dbSchema,o=t._createTransaction("readwrite",t._storeNames,i);o.create(r),o._completion.catch(n);let s=o._reject.bind(o),a=z.transless||z;Rt(()=>{z.trans=o,z.transless=a,e===0?(be(i).forEach(u=>{qs(r,u,i[u].primKey,i[u].indexes)}),Gs(t,r),R.follow(()=>t.on.populate.fire(o)).catch(s)):Zg(t,e,o,r).catch(s)})}function Zg({_novip:t},e,r,n){let i=[],o=t._versions,s=t._dbSchema=Js(t,t.idbdb,n),a=!1;o.filter(c=>c._cfg.version>=e).forEach(c=>{i.push(()=>{let p=s,f=c._cfg.dbschema;Xs(t,p,n),Xs(t,f,n),s=t._dbSchema=f;let h=hu(p,f);h.add.forEach(j=>{qs(n,j[0],j[1].primKey,j[1].indexes)}),h.change.forEach(j=>{if(j.recreate)throw new V.Upgrade("Not yet support for changing primary key");{let v=n.objectStore(j.name);j.add.forEach(d=>Ys(v,d)),j.change.forEach(d=>{v.deleteIndex(d.name),Ys(v,d)}),j.del.forEach(d=>v.deleteIndex(d))}});let y=c._cfg.contentUpgrade;if(y&&c._cfg.version>e){Gs(t,n),r._memoizedTables={},a=!0;let j=Pl(f);h.del.forEach(m=>{j[m]=p[m]}),Qs(t,[t.Transaction.prototype]),Vi(t,[t.Transaction.prototype],be(j),j),r.schema=j;let v=bs(y);v&&zr();let d,b=R.follow(()=>{if(d=y(r),d&&v){var m=wt.bind(null,null);d.then(m,m)}});return d&&typeof d.then=="function"?R.resolve(d):b.then(()=>d)}}),i.push(p=>{if(!a||!Og){let f=c._cfg.dbschema;ty(f,p)}Qs(t,[t.Transaction.prototype]),Vi(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),r.schema=t._dbSchema})});function l(){return i.length?R.resolve(i.shift()(r.idbtrans)).then(l):R.resolve()}return l().then(()=>{ey(s,n)})}function hu(t,e){let r={del:[],add:[],change:[]},n;for(n in t)e[n]||r.del.push(n);for(n in e){let i=t[n],o=e[n];if(!i)r.add.push([n,o]);else{let s={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!Li)s.recreate=!0,r.change.push(s);else{let a=i.idxByName,u=o.idxByName,l;for(l in a)u[l]||s.del.push(l);for(l in u){let c=a[l],p=u[l];c?c.src!==p.src&&s.change.push(p):s.add.push(p)}(s.del.length>0||s.add.length>0||s.change.length>0)&&r.change.push(s)}}}return r}function qs(t,e,r,n){let i=t.db.createObjectStore(e,r.keyPath?{keyPath:r.keyPath,autoIncrement:r.auto}:{autoIncrement:r.auto});return n.forEach(o=>Ys(i,o)),i}function ey(t,e){be(t).forEach(r=>{e.db.objectStoreNames.contains(r)||qs(e,r,t[r].primKey,t[r].indexes)})}function ty(t,e){[].slice.call(e.db.objectStoreNames).forEach(r=>t[r]==null&&e.db.deleteObjectStore(r))}function Ys(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function Js(t,e,r){let n={};return ji(e.objectStoreNames,0).forEach(o=>{let s=r.objectStore(o),a=s.keyPath,u=$s(fu(a),a||"",!1,!1,!!s.autoIncrement,a&&typeof a!="string",!0),l=[];for(let p=0;pi.add.length||i.change.length))}function Xs({_novip:t},e,r){let n=r.db.objectStoreNames;for(let i=0;i{e=e.trim();let n=e.replace(/([&*]|\+\+)/g,""),i=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return $s(n,i||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),Be(i),r===0)})}function oy(t){return zn(mu.prototype,function(r){this.db=t,this._cfg={version:r,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function Zs(t,e){let r=t._dbNamesDB;return r||(r=t._dbNamesDB=new St(Ni,{addons:[],indexedDB:t,IDBKeyRange:e}),r.version(1).stores({dbnames:"name"})),r.table("dbnames")}function ea(t){return t&&typeof t.databases=="function"}function sy({indexedDB:t,IDBKeyRange:e}){return ea(t)?Promise.resolve(t.databases()).then(r=>r.map(n=>n.name).filter(n=>n!==Ni)):Zs(t,e).toCollection().primaryKeys()}function ay({indexedDB:t,IDBKeyRange:e},r){!ea(t)&&r!==Ni&&Zs(t,e).put({name:r}).catch(ie)}function ly({indexedDB:t,IDBKeyRange:e},r){!ea(t)&&r!==Ni&&Zs(t,e).delete(r).catch(ie)}function ta(t){return Rt(function(){return z.letThrough=!0,t()})}function uy(){var t=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!t||!indexedDB.databases)return Promise.resolve();var e;return new Promise(function(r){var n=function(){return indexedDB.databases().finally(r)};e=setInterval(n,100),n()}).finally(function(){return clearInterval(e)})}function cy(t){let e=t._state,{indexedDB:r}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then(()=>e.dbOpenError?je(e.dbOpenError):t);ft&&(e.openCanceller._stackHolder=ar()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;let n=e.openCanceller;function i(){if(e.openCanceller!==n)throw new V.DatabaseClosed("db.open() was cancelled")}let o=e.dbReadyResolve,s=null,a=!1;return R.race([n,(typeof navigator=="undefined"?R.resolve():uy()).then(()=>new R((u,l)=>{if(i(),!r)throw new V.MissingAPI;let c=t.name,p=e.autoSchema?r.open(c):r.open(c,Math.round(t.verno*10));if(!p)throw new V.MissingAPI;p.onerror=dt(l),p.onblocked=de(t._fireOnBlocked),p.onupgradeneeded=de(f=>{if(s=p.transaction,e.autoSchema&&!t._options.allowEmptyDB){p.onerror=Hn,s.abort(),p.result.close();let y=r.deleteDatabase(c);y.onsuccess=y.onerror=de(()=>{l(new V.NoSuchDatabase(`Database ${c} doesnt exist`))})}else{s.onerror=dt(l);var h=f.oldVersion>Math.pow(2,62)?0:f.oldVersion;a=h<1,t._novip.idbdb=p.result,Xg(t,h/10,s,l)}},l),p.onsuccess=de(()=>{s=null;let f=t._novip.idbdb=p.result,h=ji(f.objectStoreNames);if(h.length>0)try{let y=f.transaction($g(h),"readonly");e.autoSchema?ry(t,f,y):(Xs(t,t._dbSchema,y),ny(t,y)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),Gs(t,y)}catch{}Bn.push(t),f.onversionchange=de(y=>{e.vcFired=!0,t.on("versionchange").fire(y)}),f.onclose=de(y=>{t.on("close").fire(y)}),a&&ay(t._deps,c),u()},l)}))]).then(()=>(i(),e.onReadyBeingFired=[],R.resolve(ta(()=>t.on.ready.fire(t.vip))).then(function u(){if(e.onReadyBeingFired.length>0){let l=e.onReadyBeingFired.reduce(As,ie);return e.onReadyBeingFired=[],R.resolve(ta(()=>l(t.vip))).then(u)}}))).finally(()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1}).then(()=>t).catch(u=>{e.dbOpenError=u;try{s&&s.abort()}catch{}return n===e.openCanceller&&t._close(),je(u)}).finally(()=>{e.openComplete=!0,o()})}function ra(t){var e=s=>t.next(s),r=s=>t.throw(s),n=o(e),i=o(r);function o(s){return a=>{var u=s(a),l=u.value;return u.done?l:!l||typeof l.then!="function"?Be(l)?Promise.all(l).then(n,i):n(l):l.then(n,i)}}return o(e)()}function fy(t,e,r){var n=arguments.length;if(n<2)throw new V.InvalidArgument("Too few arguments");for(var i=new Array(n-1);--n;)i[n-1]=arguments[n];r=i.pop();var o=kl(i);return[t,o,r]}function gu(t,e,r,n,i){return R.resolve().then(()=>{let o=z.transless||z,s=t._createTransaction(e,r,t._dbSchema,n),a={trans:s,transless:o};if(n)s.idbtrans=n.idbtrans;else try{s.create(),t._state.PR1398_maxLoop=3}catch(p){return p.name===js.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>gu(t,e,r,null,i))):je(p)}let u=bs(i);u&&zr();let l,c=R.follow(()=>{if(l=i.call(s,s),l)if(u){var p=wt.bind(null,null);l.then(p,p)}else typeof l.next=="function"&&typeof l.throw=="function"&&(l=ra(l))},a);return(l&&typeof l.then=="function"?R.resolve(l).then(p=>s.active?p:je(new V.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):c.then(()=>l)).then(p=>(n&&s._resolve(),s._completion.then(()=>p))).catch(p=>(s._reject(p),je(p)))})}function Wi(t,e,r){let n=Be(t)?t.slice():[t];for(let i=0;i0,m=ze(ye({},y),{isVirtual:b,keyTail:h,keyLength:d,extractKey:Us(f),unique:!b&&y.unique});if(v.push(m),m.isPrimaryKey||o.push(m),d>1){let g=d===2?f[0]:f.slice(0,d-1);s(g,h+1,y)}return v.sort((g,x)=>g.keyTail-x.keyTail),m}let a=s(n.primaryKey.keyPath,0,n.primaryKey);i[":id"]=[a];for(let f of n.indexes)s(f.keyPath,0,f);function u(f){let h=i[$n(f)];return h&&h[0]}function l(f,h){return{type:f.type===1?2:f.type,lower:Wi(f.lower,f.lowerOpen?t.MAX_KEY:t.MIN_KEY,h),lowerOpen:!0,upper:Wi(f.upper,f.upperOpen?t.MIN_KEY:t.MAX_KEY,h),upperOpen:!0}}function c(f){let h=f.query.index;return h.isVirtual?ze(ye({},f),{query:{index:h,range:l(f.query.range,h.keyTail)}}):f}return ze(ye({},r),{schema:ze(ye({},n),{primaryKey:a,indexes:o,getIndexByKeyPath:u}),count(f){return r.count(c(f))},query(f){return r.query(c(f))},openCursor(f){let{keyTail:h,isVirtual:y,keyLength:j}=f.query.index;if(!y)return r.openCursor(f);function v(d){function b(g){g!=null?d.continue(Wi(g,f.reverse?t.MAX_KEY:t.MIN_KEY,h)):f.unique?d.continue(d.key.slice(0,j).concat(f.reverse?t.MIN_KEY:t.MAX_KEY,h)):d.continue()}return Object.create(d,{continue:{value:b},continuePrimaryKey:{value(g,x){d.continuePrimaryKey(Wi(g,t.MAX_KEY,h),x)}},primaryKey:{get(){return d.primaryKey}},key:{get(){let g=d.key;return j===1?g[0]:g.slice(0,j)}},value:{get(){return d.value}}})}return r.openCursor(c(f)).then(d=>d&&v(d))}})}})}function na(t,e,r,n){return r=r||{},n=n||"",be(t).forEach(i=>{if(!Je(e,i))r[n+i]=void 0;else{var o=t[i],s=e[i];if(typeof o=="object"&&typeof s=="object"&&o&&s){let a=_s(o),u=_s(s);a!==u?r[n+i]=e[i]:a==="Object"?na(o,s,r,n+i+"."):o!==s&&(r[n+i]=e[i])}else o!==s&&(r[n+i]=e[i])}}),be(e).forEach(i=>{Je(t,i)||(r[n+i]=e[i])}),r}function hy(t,e){return e.type==="delete"?e.keys:e.keys||e.values.map(t.extractKey)}function gy(t,e,r){return e.type==="add"?Promise.resolve([]):t.getMany({trans:e.trans,keys:r,cache:"immutable"})}function yu(t,e,r){try{if(!e||e.keys.length0)throw RangeError();if(ia(t))return Ve(t,{from:e,to:r,d:1});let i=t.l,o=t.r;if(We(r,t.from)<0)return i?Un(i,e,r):t.l={from:e,to:r,d:1,l:null,r:null},_u(t);if(We(e,t.to)>0)return o?Un(o,e,r):t.r={from:e,to:r,d:1,l:null,r:null},_u(t);We(e,t.from)<0&&(t.from=e,t.l=null,t.d=o?o.d+1:1),We(r,t.to)>0&&(t.to=r,t.r=null,t.d=t.l?t.l.d+1:1);let s=!t.r;i&&!t.l&&$i(t,i),o&&s&&$i(t,o)}function $i(t,e){function r(n,{from:i,to:o,l:s,r:a}){Un(n,i,o),s&&r(n,s),a&&r(n,a)}ia(e)||r(t,e)}function _y(t,e){let r=oa(e),n=r.next();if(n.done)return!1;let i=n.value,o=oa(t),s=o.next(i.from),a=s.value;for(;!n.done&&!s.done;){if(We(a.from,i.to)<=0&&We(a.to,i.from)>=0)return!0;We(i.from,a.from)<0?i=(n=r.next(a.from)).value:a=(s=o.next(i.from)).value}return!1}function oa(t){let e=ia(t)?null:{s:0,n:t};return{next(r){let n=arguments.length>0;for(;e;)switch(e.s){case 0:if(e.s=1,n)for(;e.n.l&&We(r,e.n.from)<0;)e={up:e,n:e.n.l,s:1};else for(;e.n.l;)e={up:e,n:e.n.l,s:1};case 1:if(e.s=2,!n||We(r,e.n.to)<=0)return{value:e.n,done:!1};case 2:if(e.n.r){e.s=3,e={up:e,n:e.n.r,s:0};continue}case 3:e=e.up}return{done:!0}}}}function _u(t){var e,r;let n=(((e=t.r)===null||e===void 0?void 0:e.d)||0)-(((r=t.l)===null||r===void 0?void 0:r.d)||0),i=n>1?"r":n<-1?"l":"";if(i){let o=i==="r"?"l":"r",s=ye({},t),a=t[i];t.from=a.from,t.to=a.to,t[i]=a[i],s[i]=a[o],t[o]=s,s.d=vu(s)}t.d=vu(t)}function vu({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}function by(t,e,r,n){function i(o){let s=t(o.name||"");function a(l){return l!=null?o.extractKey(l):null}let u=l=>o.multiEntry&&Be(l)?l.forEach(c=>s.addKey(c)):s.addKey(l);(r||n).forEach((l,c)=>{let p=r&&a(r[c]),f=n&&a(n[c]);We(p,f)!==0&&(p!=null&&u(p),f!=null&&u(f))})}e.indexes.forEach(i)}function xu(t,e){return be(e).forEach(r=>{let n=t[r]||(t[r]=new At);$i(n,e[r])}),t}function wy(t){let e=!1,r,n=new bu(i=>{let o=bs(t);function s(v){o&&zr();let d=()=>Rt(t,{subscr:v,trans:null}),b=z.trans?Hr(z.transless,d):d();return o&&b.then(wt,wt),b}let a=!1,u={},l={},c={get closed(){return a},unsubscribe:()=>{a=!0,Kt.storagemutated.unsubscribe(y)}};i.start&&i.start(c);let p=!1,f=!1;function h(){return be(l).some(v=>u[v]&&_y(u[v],l[v]))}let y=v=>{xu(u,v),h()&&j()},j=()=>{if(p||a)return;u={};let v={},d=s(v);f||(Kt(Vn,y),f=!0),p=!0,Promise.resolve(d).then(b=>{e=!0,r=b,p=!1,!a&&(h()?j():(u={},l=v,i.next&&i.next(b)))},b=>{p=!1,e=!1,i.error&&i.error(b),c.unsubscribe()})};return j(),c});return n.hasValue=()=>e,n.getValue=()=>r,n}function Ui(t){let e=Ct;try{Ct=!0,Kt.storagemutated.fire(t)}finally{Ct=e}}function jy({data:t}){t&&t.type===Bt&&Ui(t.changedParts)}var ue,be,Be,Tn,tg,Tl,rg,ng,sg,Ml,ag,Mt,lg,vs,ug,Nr,bs,ft,Ll,cg,fg,Nl,ws,dg,js,pg,V,Kl,Si,kn,bg,xg,zl,Ss,Ci,Cs,Hl,Ei,Es,Fs,wg,Mn,Ts,Fi,ur,Ti,Ds,Os,Kr,z,Rn,cr,Di,Is,Ke,Eg,Pi,Rs,ki,Fg,Jl,je,Zl,fr,Ns,jt,eu,Bn,Li,Og,Ig,tu,Ni,Bs,Ks,ru,nu,lu,Vs,Ws,Vn,Bt,Kt,cu,Wn,Gg,mu,py,my,yy,At,vy,St,xy,bu,sa,pr,Ct,wu=A(()=>{ue=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,be=Object.keys,Be=Array.isArray;typeof Promise!="undefined"&&!ue.Promise&&(ue.Promise=Promise);Tn=Object.getPrototypeOf,tg={}.hasOwnProperty;Tl=Object.defineProperty;rg=Object.getOwnPropertyDescriptor;ng=[].slice;sg=[].concat;Ml="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(kl([8,16,32,64].map(t=>["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>ue[t]),ag=Ml.map(t=>ue[t]);Il(Ml,t=>[t,!0]);Mt=null;({toString:lg}={});vs=typeof Symbol!="undefined"?Symbol.iterator:"@@iterator",ug=typeof vs=="symbol"?function(t){var e;return t!=null&&(e=t[vs])&&e.apply(t)}:function(){return null},Nr={};bs=typeof Symbol!="undefined"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1,ft=typeof location!="undefined"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);Ll=()=>!0,cg=!new Error("").stack;fg=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Nl=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],ws=fg.concat(Nl),dg={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};Lr(Br).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+xs(this._e,2))}},toString:function(){return this.name+": "+this.message}});Lr(Ai).from(Br);Lr(In).from(Br);js=ws.reduce((t,e)=>(t[e]=e+"Error",t),{}),pg=Br,V=ws.reduce((t,e)=>{var r=e+"Error";function n(i,o){this._e=ar(),this.name=r,i?typeof i=="string"?(this.message=`${i}${o?` `+o:""}`,this.inner=o||null):typeof i=="object"&&(this.message=`${i.name} ${i.message}`,this.inner=i):(this.message=dg[e]||r,this.inner=null)}return Lr(n).from(pg),t[e]=n,t},{});V.Syntax=SyntaxError;V.Type=TypeError;V.Range=RangeError;Kl=Nl.reduce((t,e)=>(t[e+"Error"]=V[e],t),{});Si=ws.reduce((t,e)=>(["Syntax","Type","Range"].indexOf(e)===-1&&(t[e+"Error"]=V[e]),t),{});Si.ModifyError=Ai;Si.DexieError=Br;Si.BulkError=In;kn={},bg=100,xg=20,zl=100,[Ss,Ci,Cs]=typeof Promise=="undefined"?[]:(()=>{let t=Promise.resolve();if(typeof crypto=="undefined"||!crypto.subtle)return[t,Tn(t),t];let e=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[e,Tn(e),t]})(),Hl=Ci&&Ci.then,Ei=Ss&&Ss.constructor,Es=!!Cs,Fs=!1,wg=Cs?()=>{Cs.then(Oi)}:ue.setImmediate?setImmediate.bind(null,Oi):ue.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver(()=>{Oi(),t=null}).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(Oi,0)},Mn=function(t,e){Rn.push([t,e]),Fi&&(wg(),Fi=!1)},Ts=!0,Fi=!0,ur=[],Ti=[],Ds=null,Os=Pn,Kr={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Xl,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(t=>{try{Xl(t[0],t[1])}catch{}})}},z=Kr,Rn=[],cr=0,Di=[];Is={get:function(){var t=z,e=ki;function r(n,i){var o=!t.global&&(t!==z||e!==ki);let s=o&&!wt();var a=new R((u,l)=>{ks(this,new Vl(Ri(n,t,o,s),Ri(i,t,o,s),u,l,t))});return ft&&Gl(a,this),a}return r.prototype=kn,r},set:function(t){vt(this,"then",t&&t.prototype===kn?Is:{get:function(){return t},set:Is.set})}};Rr(R.prototype,{then:Is,_then:function(t,e){ks(this,new Vl(null,null,t,e,z))},catch:function(t){if(arguments.length===1)return this.then(null,t);var e=arguments[0],r=arguments[1];return typeof e=="function"?this.then(null,n=>n instanceof e?r(n):Ii(n)):this.then(null,n=>n&&n.name===e?r(n):Ii(n))},finally:function(t){return this.then(e=>(t(),e),e=>(t(),Ii(e)))},stack:{get:function(){if(this._stack)return this._stack;try{Fs=!0;var t=Ul(this,[],xg),e=t.join(` From previous: `);return this._state!==null&&(this._stack=e),e}finally{Fs=!1}}},timeout:function(t,e){return t<1/0?new R((r,n)=>{var i=setTimeout(()=>n(new V.Timeout(e)),t);this.then(r,n).finally(clearTimeout.bind(null,i))}):this}});typeof Symbol!="undefined"&&Symbol.toStringTag&&vt(R.prototype,Symbol.toStringTag,"Dexie.Promise");Kr.env=Ql();Rr(R,{all:function(){var t=xt.apply(null,arguments).map(Mi);return new R(function(e,r){t.length===0&&e([]);var n=t.length;t.forEach((i,o)=>R.resolve(i).then(s=>{t[o]=s,--n||e(t)},r))})},resolve:t=>{if(t instanceof R)return t;if(t&&typeof t.then=="function")return new R((r,n)=>{t.then(r,n)});var e=new R(kn,!0,t);return Gl(e,Ds),e},reject:Ii,race:function(){var t=xt.apply(null,arguments).map(Mi);return new R((e,r)=>{t.map(n=>R.resolve(n).then(e,r))})},PSD:{get:()=>z,set:t=>z=t},totalEchoes:{get:()=>ki},newPSD:Rt,usePSD:Hr,scheduler:{get:()=>Mn,set:t=>{Mn=t}},rejectionMapper:{get:()=>Os,set:t=>{Os=t}},follow:(t,e)=>new R((r,n)=>Rt((i,o)=>{var s=z;s.unhandleds=[],s.onunhandled=o,s.finalize=lr(function(){Ag(()=>{this.unhandleds.length===0?i():o(this.unhandleds[0])})},s.finalize),t()},e,r,n))});Ei&&(Ei.allSettled&&vt(R,"allSettled",function(){let t=xt.apply(null,arguments).map(Mi);return new R(e=>{t.length===0&&e([]);let r=t.length,n=new Array(r);t.forEach((i,o)=>R.resolve(i).then(s=>n[o]={status:"fulfilled",value:s},s=>n[o]={status:"rejected",reason:s}).then(()=>--r||e(n)))})}),Ei.any&&typeof AggregateError!="undefined"&&vt(R,"any",function(){let t=xt.apply(null,arguments).map(Mi);return new R((e,r)=>{t.length===0&&r(new AggregateError([]));let n=t.length,i=new Array(n);t.forEach((o,s)=>R.resolve(o).then(a=>e(a),a=>{i[s]=a,--n||r(new AggregateError(i))}))})}));Ke={awaits:0,echoes:0,id:0},Eg=0,Pi=[],Rs=0,ki=0,Fg=0;(""+Hl).indexOf("[native code]")===-1&&(zr=wt=ie);Jl="unhandledrejection";je=R.reject;Zl="3.2.4",fr=String.fromCharCode(65535),Ns=-1/0,jt="Invalid key provided. Keys must be of type string, number, Date or Array.",eu="String expected.",Bn=[],Li=typeof navigator!="undefined"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Og=Li,Ig=Li,tu=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),Ni="__dbnames",Bs="readonly",Ks="readwrite";ru={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};nu=class{_trans(e,r,n){let i=this._tx||z.trans,o=this.name;function s(u,l,c){if(!c.schema[o])throw new V.NotFound("Table "+o+" not part of transaction");return r(c.idbtrans,c)}let a=Ln();try{return i&&i.db===this.db?i===z.trans?i._promise(e,s,n):Rt(()=>i._promise(e,s,n),{trans:i,transless:z.transless||z}):Ls(this.db,e,[this.name],s)}finally{a&&Nn()}}get(e,r){return e&&e.constructor===Object?this.where(e).first(r):this._trans("readonly",n=>this.core.get({trans:n,key:e}).then(i=>this.hook.reading.fire(i))).then(r)}where(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(Be(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let r=be(e);if(r.length===1)return this.where(r[0]).equals(e[r[0]]);let n=this.schema.indexes.concat(this.schema.primKey).filter(l=>l.compound&&r.every(c=>l.keyPath.indexOf(c)>=0)&&l.keyPath.every(c=>r.indexOf(c)>=0))[0];if(n&&this.db._maxKey!==fr)return this.where(n.name).equals(n.keyPath.map(l=>e[l]));!n&&ft&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${r.join("+")}]`);let{idxByName:i}=this.schema,o=this.db._deps.indexedDB;function s(l,c){try{return o.cmp(l,c)===0}catch{return!1}}let[a,u]=r.reduce(([l,c],p)=>{let f=i[p],h=e[p];return[l||f,l||!f?dr(c,f&&f.multi?y=>{let j=bt(y,p);return Be(j)&&j.some(v=>s(h,v))}:y=>s(h,bt(y,p))):c]},[null,null]);return a?this.where(a.name).equals(e[a.keyPath]).filter(u):n?this.filter(u):this.where(r).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,Be(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;let r=n=>{if(!n)return n;let i=Object.create(e.prototype);for(var o in n)if(Je(n,o))try{i[o]=n[o]}catch{}return i};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=r,this.hook("reading",r),e}defineClass(){function e(r){Ve(this,r)}return this.mapToClass(e)}add(e,r){let{auto:n,keyPath:i}=this.schema.primKey,o=e;return i&&n&&(o=Bi(i)(e)),this._trans("readwrite",s=>this.core.mutate({trans:s,type:"add",keys:r!=null?[r]:null,values:[o]})).then(s=>s.numFailures?R.reject(s.failures[0]):s.lastResult).then(s=>{if(i)try{ot(e,i,s)}catch{}return s})}update(e,r){if(typeof e=="object"&&!Be(e)){let n=bt(e,this.schema.primKey.keyPath);if(n===void 0)return je(new V.InvalidArgument("Given object does not contain its primary key"));try{typeof r!="function"?be(r).forEach(i=>{ot(e,i,r[i])}):r(e,{value:e,primKey:n})}catch{}return this.where(":id").equals(n).modify(r)}else return this.where(":id").equals(e).modify(r)}put(e,r){let{auto:n,keyPath:i}=this.schema.primKey,o=e;return i&&n&&(o=Bi(i)(e)),this._trans("readwrite",s=>this.core.mutate({trans:s,type:"put",values:[o],keys:r!=null?[r]:null})).then(s=>s.numFailures?R.reject(s.failures[0]):s.lastResult).then(s=>{if(i)try{ot(e,i,s)}catch{}return s})}delete(e){return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:[e]})).then(r=>r.numFailures?R.reject(r.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:ru})).then(e=>e.numFailures?R.reject(e.failures[0]):void 0)}bulkGet(e){return this._trans("readonly",r=>this.core.getMany({keys:e,trans:r}).then(n=>n.map(i=>this.hook.reading.fire(i))))}bulkAdd(e,r,n){let i=Array.isArray(r)?r:void 0;n=n||(i?void 0:r);let o=n?n.allKeys:void 0;return this._trans("readwrite",s=>{let{auto:a,keyPath:u}=this.schema.primKey;if(u&&i)throw new V.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");let l=e.length,c=u&&a?e.map(Bi(u)):e;return this.core.mutate({trans:s,type:"add",keys:i,values:c,wantResults:o}).then(({numFailures:p,results:f,lastResult:h,failures:y})=>{let j=o?f:h;if(p===0)return j;throw new In(`${this.name}.bulkAdd(): ${p} of ${l} operations failed`,y)})})}bulkPut(e,r,n){let i=Array.isArray(r)?r:void 0;n=n||(i?void 0:r);let o=n?n.allKeys:void 0;return this._trans("readwrite",s=>{let{auto:a,keyPath:u}=this.schema.primKey;if(u&&i)throw new V.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");let l=e.length,c=u&&a?e.map(Bi(u)):e;return this.core.mutate({trans:s,type:"put",keys:i,values:c,wantResults:o}).then(({numFailures:p,results:f,lastResult:h,failures:y})=>{let j=o?f:h;if(p===0)return j;throw new In(`${this.name}.bulkPut(): ${p} of ${l} operations failed`,y)})})}bulkDelete(e){let r=e.length;return this._trans("readwrite",n=>this.core.mutate({trans:n,type:"delete",keys:e})).then(({numFailures:n,lastResult:i,failures:o})=>{if(n===0)return i;throw new In(`${this.name}.bulkDelete(): ${n} of ${r} operations failed`,o)})}};lu=class{_read(e,r){var n=this._ctx;return n.error?n.table._trans(null,je.bind(null,n.error)):n.table._trans("readonly",e).then(r)}_write(e){var r=this._ctx;return r.error?r.table._trans(null,je.bind(null,r.error)):r.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var r=this._ctx;r.algorithm=dr(r.algorithm,e)}_iterate(e,r){return zi(this._ctx,e,r,this._ctx.table.core)}clone(e){var r=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&Ve(n,e),r._ctx=n,r}raw(){return this._ctx.valueMapper=null,this}each(e){var r=this._ctx;return this._read(n=>zi(r,e,n,r.table.core))}count(e){return this._read(r=>{let n=this._ctx,i=n.table.core;if(Vr(n,!0))return i.count({trans:r,query:{index:Ki(n,i.schema),range:n.range}}).then(s=>Math.min(s,n.limit));var o=0;return zi(n,()=>(++o,!1),r,i).then(()=>o)}).then(e)}sortBy(e,r){let n=e.split(".").reverse(),i=n[0],o=n.length-1;function s(l,c){return c?s(l[n[c]],c-1):l[i]}var a=this._ctx.dir==="next"?1:-1;function u(l,c){var p=s(l,o),f=s(c,o);return pf?a:0}return this.toArray(function(l){return l.sort(u)}).then(r)}toArray(e){return this._read(r=>{var n=this._ctx;if(n.dir==="next"&&Vr(n,!0)&&n.limit>0){let{valueMapper:i}=n,o=Ki(n,n.table.core.schema);return n.table.core.query({trans:r,limit:n.limit,values:!0,query:{index:o,range:n.range}}).then(({result:s})=>i?s.map(i):s)}else{let i=[];return zi(n,o=>i.push(o),r,n.table.core).then(()=>i)}},e)}offset(e){var r=this._ctx;return e<=0?this:(r.offset+=e,Vr(r)?Hs(r,()=>{var n=e;return(i,o)=>n===0?!0:n===1?(--n,!1):(o(()=>{i.advance(n),n=0}),!1)}):Hs(r,()=>{var n=e;return()=>--n<0}),this)}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Hs(this._ctx,()=>{var r=e;return function(n,i,o){return--r<=0&&i(o),r>=0}},!0),this}until(e,r){return zs(this._ctx,function(n,i,o){return e(n.value)?(i(o),r):!0}),this}first(e){return this.limit(1).toArray(function(r){return r[0]}).then(e)}last(e){return this.reverse().first(e)}filter(e){return zs(this._ctx,function(r){return e(r.value)}),kg(this._ctx,e),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(n,i){e(i.key,i)})}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(n,i){e(i.primaryKey,i)})}keys(e){var r=this._ctx;r.keysOnly=!r.isMatch;var n=[];return this.each(function(i,o){n.push(o.key)}).then(function(){return n}).then(e)}primaryKeys(e){var r=this._ctx;if(r.dir==="next"&&Vr(r,!0)&&r.limit>0)return this._read(i=>{var o=Ki(r,r.table.core.schema);return r.table.core.query({trans:i,values:!1,limit:r.limit,query:{index:o,range:r.range}})}).then(({result:i})=>i).then(e);r.keysOnly=!r.isMatch;var n=[];return this.each(function(i,o){n.push(o.primaryKey)}).then(function(){return n}).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys(function(r){return r[0]}).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,r=e.index&&e.table.schema.idxByName[e.index];if(!r||!r.multi)return this;var n={};return zs(this._ctx,function(i){var o=i.primaryKey.toString(),s=Je(n,o);return n[o]=!0,!s}),this}modify(e){var r=this._ctx;return this._write(n=>{var i;if(typeof e=="function")i=e;else{var o=be(e),s=o.length;i=function(j){for(var v=!1,d=0;d{let{failures:d,numFailures:b}=v;f+=j-b;for(let m of be(d))p.push(d[m])};return this.clone().primaryKeys().then(j=>{let v=d=>{let b=Math.min(c,j.length-d);return a.getMany({trans:n,keys:j.slice(d,d+b),cache:"immutable"}).then(m=>{let g=[],x=[],_=u?[]:null,w=[];for(let E=0;E0&&a.mutate({trans:n,type:"add",values:g}).then(E=>{for(let D in E.failures)w.splice(parseInt(D),1);y(g.length,E)})).then(()=>(x.length>0||S&&typeof e=="object")&&a.mutate({trans:n,type:"put",keys:_,values:x,criteria:S,changeSpec:typeof e!="function"&&e}).then(E=>y(x.length,E))).then(()=>(w.length>0||S&&e===Vs)&&a.mutate({trans:n,type:"delete",keys:w,criteria:S}).then(E=>y(w.length,E))).then(()=>j.length>d+b&&v(d+c))})};return v(0).then(()=>{if(p.length>0)throw new Ai("Error modifying one or more objects",p,f,h);return j.length})})})}delete(){var e=this._ctx,r=e.range;return Vr(e)&&(e.isPrimKey&&!Ig||r.type===3)?this._write(n=>{let{primaryKey:i}=e.table.core.schema,o=r;return e.table.core.count({trans:n,query:{index:i,range:o}}).then(s=>e.table.core.mutate({trans:n,type:"deleteRange",range:o}).then(({failures:a,lastResult:u,results:l,numFailures:c})=>{if(c)throw new Ai("Could not delete some values",Object.keys(a).map(p=>a[p]),s-c);return s-c}))}):this.modify(Vs)}},Vs=(t,e)=>e.value=null;Ws=class{get Collection(){return this._ctx.table.db.Collection}between(e,r,n,i){n=n!==!1,i=i===!0;try{return this._cmp(e,r)>0||this._cmp(e,r)===0&&(n||i)&&!(n&&i)?Wr(this):new this.Collection(this,()=>Nt(e,r,!n,!i))}catch{return Xe(this,jt)}}equals(e){return e==null?Xe(this,jt):new this.Collection(this,()=>uu(e))}above(e){return e==null?Xe(this,jt):new this.Collection(this,()=>Nt(e,void 0,!0))}aboveOrEqual(e){return e==null?Xe(this,jt):new this.Collection(this,()=>Nt(e,void 0,!1))}below(e){return e==null?Xe(this,jt):new this.Collection(this,()=>Nt(void 0,e,!1,!0))}belowOrEqual(e){return e==null?Xe(this,jt):new this.Collection(this,()=>Nt(void 0,e))}startsWith(e){return typeof e!="string"?Xe(this,eu):this.between(e,e+fr,!0,!0)}startsWithIgnoreCase(e){return e===""?this.startsWith(e):Hi(this,(r,n)=>r.indexOf(n[0])===0,[e],fr)}equalsIgnoreCase(e){return Hi(this,(r,n)=>r===n[0],[e],"")}anyOfIgnoreCase(){var e=xt.apply(Nr,arguments);return e.length===0?Wr(this):Hi(this,(r,n)=>n.indexOf(r)!==-1,e,"")}startsWithAnyOfIgnoreCase(){var e=xt.apply(Nr,arguments);return e.length===0?Wr(this):Hi(this,(r,n)=>n.some(i=>r.indexOf(i)===0),e,fr)}anyOf(){let e=xt.apply(Nr,arguments),r=this._cmp;try{e.sort(r)}catch{return Xe(this,jt)}if(e.length===0)return Wr(this);let n=new this.Collection(this,()=>Nt(e[0],e[e.length-1]));n._ondirectionchange=o=>{r=o==="next"?this._ascending:this._descending,e.sort(r)};let i=0;return n._addAlgorithm((o,s,a)=>{let u=o.key;for(;r(u,e[i])>0;)if(++i,i===e.length)return s(a),!1;return r(u,e[i])===0?!0:(s(()=>{o.continue(e[i])}),!1)}),n}notEqual(e){return this.inAnyRange([[Ns,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=xt.apply(Nr,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return Xe(this,jt)}let r=e.reduce((n,i)=>n?n.concat([[n[n.length-1][1],i]]):[[Ns,i]],null);return r.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(r,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,r){let n=this._cmp,i=this._ascending,o=this._descending,s=this._min,a=this._max;if(e.length===0)return Wr(this);if(!e.every(g=>g[0]!==void 0&&g[1]!==void 0&&i(g[0],g[1])<=0))return Xe(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",V.InvalidArgument);let u=!r||r.includeLowers!==!1,l=r&&r.includeUppers===!0;function c(g,x){let _=0,w=g.length;for(;_0){S[0]=s(S[0],x[0]),S[1]=a(S[1],x[1]);break}}return _===w&&g.push(x),g}let p=i;function f(g,x){return p(g[0],x[0])}let h;try{h=e.reduce(c,[]),h.sort(f)}catch{return Xe(this,jt)}let y=0,j=l?g=>i(g,h[y][1])>0:g=>i(g,h[y][1])>=0,v=u?g=>o(g,h[y][0])>0:g=>o(g,h[y][0])>=0;function d(g){return!j(g)&&!v(g)}let b=j,m=new this.Collection(this,()=>Nt(h[0][0],h[h.length-1][1],!u,!l));return m._ondirectionchange=g=>{g==="next"?(b=j,p=i):(b=v,p=o),h.sort(f)},m._addAlgorithm((g,x,_)=>{for(var w=g.key;b(w);)if(++y,y===h.length)return x(_),!1;return d(w)?!0:(this._cmp(w,h[y][1])===0||this._cmp(w,h[y][0])===0||x(()=>{p===i?g.continue(h[y][0]):g.continue(h[y][1])}),!1)}),m}startsWithAnyOf(){let e=xt.apply(Nr,arguments);return e.every(r=>typeof r=="string")?e.length===0?Wr(this):this.inAnyRange(e.map(r=>[r,r+fr])):Xe(this,"startsWithAnyOf() only works with strings")}};Vn="storagemutated",Bt="x-storagemutated-1",Kt=Kn(null,Vn),cu=class{_lock(){return Dn(!z.global),++this._reculock,this._reculock===1&&!z.global&&(z.lockOwnerFor=this),this}_unlock(){if(Dn(!z.global),--this._reculock==0)for(z.global||(z.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{Hr(e[1],e[0])}catch{}}return this}_locked(){return this._reculock&&z.lockOwnerFor!==this}create(e){if(!this.mode)return this;let r=this.db.idbdb,n=this.db._state.dbOpenError;if(Dn(!this.idbtrans),!e&&!r)switch(n&&n.name){case"DatabaseClosedError":throw new V.DatabaseClosed(n);case"MissingAPIError":throw new V.MissingAPI(n.message,n);default:throw new V.OpenFailed(n)}if(!this.active)throw new V.TransactionInactive;return Dn(this._completion._state===null),e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):r.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})),e.onerror=de(i=>{Hn(i),this._reject(e.error)}),e.onabort=de(i=>{Hn(i),this.active&&this._reject(new V.Abort(e.error)),this.active=!1,this.on("abort").fire(i)}),e.oncomplete=de(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&Kt.storagemutated.fire(e.mutatedParts)}),this}_promise(e,r,n){if(e==="readwrite"&&this.mode!=="readwrite")return je(new V.ReadOnly("Transaction is readonly"));if(!this.active)return je(new V.TransactionInactive);if(this._locked())return new R((o,s)=>{this._blockedFuncs.push([()=>{this._promise(e,r,n).then(o,s)},z])});if(n)return Rt(()=>{var o=new R((s,a)=>{this._lock();let u=r(s,a,this);u&&u.then&&u.then(s,a)});return o.finally(()=>this._unlock()),o._lib=!0,o});var i=new R((o,s)=>{var a=r(o,s,this);a&&a.then&&a.then(o,s)});return i._lib=!0,i}_root(){return this.parent?this.parent._root():this}waitFor(e){var r=this._root();let n=R.resolve(e);if(r._waitingFor)r._waitingFor=r._waitingFor.then(()=>n);else{r._waitingFor=n,r._waitingQueue=[];var i=r.idbtrans.objectStore(r.storeNames[0]);(function s(){for(++r._spinCount;r._waitingQueue.length;)r._waitingQueue.shift()();r._waitingFor&&(i.get(-1/0).onsuccess=s)})()}var o=r._waitingFor;return new R((s,a)=>{n.then(u=>r._waitingQueue.push(de(s.bind(null,u))),u=>r._waitingQueue.push(de(a.bind(null,u)))).finally(()=>{r._waitingFor===o&&(r._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new V.Abort))}table(e){let r=this._memoizedTables||(this._memoizedTables={});if(Je(r,e))return r[e];let n=this.schema[e];if(!n)throw new V.NotFound("Table "+e+" not part of transaction");let i=new this.db.Table(e,n,this);return i.core=this.db.core.table(e),r[e]=i,i}};Wn=t=>{try{return t.only([[]]),Wn=()=>[[]],[[]]}catch{return Wn=()=>fr,fr}};Gg=0;mu=class{_parseStoresSpec(e,r){be(e).forEach(n=>{if(e[n]!==null){var i=iy(e[n]),o=i.shift();if(o.multi)throw new V.Schema("Primary key cannot be multi-valued");i.forEach(s=>{if(s.auto)throw new V.Schema("Only primary key can be marked as autoIncrement (++)");if(!s.keyPath)throw new V.Schema("Index must have a name and cannot be an empty string")}),r[n]=du(n,o,i)}})}stores(e){let r=this.db;this._cfg.storesSource=this._cfg.storesSource?Ve(this._cfg.storesSource,e):e;let n=r._versions,i={},o={};return n.forEach(s=>{Ve(i,s._cfg.storesSource),o=s._cfg.dbschema={},s._parseStoresSpec(i,o)}),r._dbSchema=o,Qs(r,[r._allTables,r,r.Transaction.prototype]),Vi(r,[r._allTables,r,r.Transaction.prototype,this._cfg.tables],be(o),o),r._storeNames=be(o),this}upgrade(e){return this._cfg.contentUpgrade=As(this._cfg.contentUpgrade||ie,e),this}};py={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:dy};my={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>ze(ye({},t),{table(e){let r=t.table(e),{primaryKey:n}=r.schema;return ze(ye({},r),{mutate(o){let s=z.trans,{deleting:a,creating:u,updating:l}=s.table(e).hook;switch(o.type){case"add":if(u.fire===ie)break;return s._promise("readwrite",()=>c(o),!0);case"put":if(u.fire===ie&&l.fire===ie)break;return s._promise("readwrite",()=>c(o),!0);case"delete":if(a.fire===ie)break;return s._promise("readwrite",()=>c(o),!0);case"deleteRange":if(a.fire===ie)break;return s._promise("readwrite",()=>p(o),!0)}return r.mutate(o);function c(h){let y=z.trans,j=h.keys||hy(n,h);if(!j)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?ze(ye({},h),{keys:j}):ye({},h),h.type!=="delete"&&(h.values=[...h.values]),h.keys&&(h.keys=[...h.keys]),gy(r,h,j).then(v=>{let d=j.map((b,m)=>{let g=v[m],x={onerror:null,onsuccess:null};if(h.type==="delete")a.fire.call(x,b,g,y);else if(h.type==="add"||g===void 0){let _=u.fire.call(x,b,h.values[m],y);b==null&&_!=null&&(b=_,h.keys[m]=b,n.outbound||ot(h.values[m],n.keyPath,b))}else{let _=na(g,h.values[m]),w=l.fire.call(x,_,b,g,y);if(w){let S=h.values[m];Object.keys(w).forEach(E=>{Je(S,E)?S[E]=w[E]:ot(S,E,w[E])})}}return x});return r.mutate(h).then(({failures:b,results:m,numFailures:g,lastResult:x})=>{for(let _=0;_(d.forEach(m=>m.onerror&&m.onerror(b)),Promise.reject(b)))})}function p(h){return f(h.trans,h.range,1e4)}function f(h,y,j){return r.query({trans:h,values:!1,query:{index:n,range:y},limit:j}).then(({result:v})=>c({type:"delete",keys:v,trans:h}).then(d=>d.numFailures>0?Promise.reject(d.failures[0]):v.length({table:e=>{let r=t.table(e);return ze(ye({},r),{getMany:n=>{if(!n.cache)return r.getMany(n);let i=yu(n.keys,n.trans._cache,n.cache==="clone");return i?R.resolve(i):r.getMany(n).then(o=>(n.trans._cache={keys:n.keys,values:n.cache==="clone"?On(o):o},o))},mutate:n=>(n.type!=="add"&&(n.trans._cache=null),r.mutate(n))})}})};At=function(t,e){if(this)Ve(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0});else{let r=new At;return t&&"d"in t&&Ve(r,t),r}};Rr(At.prototype,{add(t){return $i(this,t),this},addKey(t){return Un(this,t,t),this},addKeys(t){return t.forEach(e=>Un(this,e,e)),this},[vs](){return oa(this)}});vy={stack:"dbcore",level:0,create:t=>{let e=t.schema.name,r=new At(t.MIN_KEY,t.MAX_KEY);return ze(ye({},t),{table:n=>{let i=t.table(n),{schema:o}=i,{primaryKey:s}=o,{extractKey:a,outbound:u}=s,l=ze(ye({},i),{mutate:f=>{let h=f.trans,y=h.mutatedParts||(h.mutatedParts={}),j=_=>{let w=`idb://${e}/${n}/${_}`;return y[w]||(y[w]=new At)},v=j(""),d=j(":dels"),{type:b}=f,[m,g]=f.type==="deleteRange"?[f.range]:f.type==="delete"?[f.keys]:f.values.length<50?[[],f.values]:[],x=f.trans._cache;return i.mutate(f).then(_=>{if(Be(m)){b!=="delete"&&(m=_.results),v.addKeys(m);let w=yu(m,x);!w&&b!=="add"&&d.addKeys(m),(w||g)&&by(j,o,w,g)}else if(m){let w={from:m.lower,to:m.upper};d.add(w),v.add(w)}else v.add(r),d.add(r),o.indexes.forEach(w=>j(w.name).add(r));return _})}}),c=({query:{index:f,range:h}})=>{var y,j;return[f,new At((y=h.lower)!==null&&y!==void 0?y:t.MIN_KEY,(j=h.upper)!==null&&j!==void 0?j:t.MAX_KEY)]},p={get:f=>[s,new At(f.key)],getMany:f=>[s,new At().addKeys(f.keys)],count:c,query:c,openCursor:c};return be(p).forEach(f=>{l[f]=function(h){let{subscr:y}=z;if(y){let j=g=>{let x=`idb://${e}/${n}/${g}`;return y[x]||(y[x]=new At)},v=j(""),d=j(":dels"),[b,m]=p[f](h);if(j(b.name||"").add(m),!b.isPrimaryKey)if(f==="count")d.add(r);else{let g=f==="query"&&u&&h.values&&i.query(ze(ye({},h),{values:!1}));return i[f].apply(this,arguments).then(x=>{if(f==="query"){if(u&&h.values)return g.then(({result:w})=>(v.addKeys(w),x));let _=h.values?x.result.map(a):x.result;h.values?v.addKeys(_):d.addKeys(_)}else if(f==="openCursor"){let _=x,w=h.values;return _&&Object.create(_,{key:{get(){return d.addKey(_.primaryKey),_.key}},primaryKey:{get(){let S=_.primaryKey;return d.addKey(S),S}},value:{get(){return w&&v.addKey(_.primaryKey),_.value}}})}return x})}}return i[f].apply(this,arguments)}}),l}})}};St=class{constructor(e,r){this._middlewares={},this.verno=0;let n=St.dependencies;this._options=r=ye({addons:St.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange},r),this._deps={indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange};let{addons:i}=r;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;let o={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ie,dbReadyPromise:null,cancelOpen:ie,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};o.dbReadyPromise=new R(s=>{o.dbReadyResolve=s}),o.openCanceller=new R((s,a)=>{o.cancelOpen=a}),this._state=o,this.name=e,this.on=Kn(this,"populate","blocked","versionchange","close",{ready:[As,ie]}),this.on.ready.subscribe=Dl(this.on.ready.subscribe,s=>(a,u)=>{St.vip(()=>{let l=this._state;if(l.openComplete)l.dbOpenError||R.resolve().then(a),u&&s(a);else if(l.onReadyBeingFired)l.onReadyBeingFired.push(a),u&&s(a);else{s(a);let c=this;u||s(function p(){c.on.ready.unsubscribe(a),c.on.ready.unsubscribe(p)})}})}),this.Collection=Lg(this),this.Table=Pg(this),this.Transaction=Wg(this),this.Version=oy(this),this.WhereClause=Vg(this),this.on("versionchange",s=>{s.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()}),this.on("blocked",s=>{!s.newVersion||s.newVersionnew this.Transaction(s,a,u,this._options.chromeTransactionDurability,l),this._fireOnBlocked=s=>{this.on("blocked").fire(s),Bn.filter(a=>a.name===this.name&&a!==this&&!a._state.vcFired).map(a=>a.on("versionchange").fire(s))},this.use(py),this.use(my),this.use(vy),this.use(yy),this.vip=Object.create(this,{_vip:{value:!0}}),i.forEach(s=>s(this))}version(e){if(isNaN(e)||e<.1)throw new V.Type("Given version is not a positive number");if(e=Math.round(e*10)/10,this.idbdb||this._state.isBeingOpened)throw new V.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);let r=this._versions;var n=r.filter(i=>i._cfg.version===e)[0];return n||(n=new this.Version(e),r.push(n),r.sort(Jg),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||z.letThrough||this._vip)?e():new R((r,n)=>{if(this._state.openComplete)return n(new V.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen){n(new V.DatabaseClosed);return}this.open().catch(ie)}this._state.dbReadyPromise.then(r,n)}).then(e)}use({stack:e,create:r,level:n,name:i}){i&&this.unuse({stack:e,name:i});let o=this._middlewares[e]||(this._middlewares[e]=[]);return o.push({stack:e,create:r,level:n??10,name:i}),o.sort((s,a)=>s.level-a.level),this}unuse({stack:e,name:r,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter(i=>n?i.create!==n:r?i.name!==r:!1)),this}open(){return cy(this)}_close(){let e=this._state,r=Bn.indexOf(this);if(r>=0&&Bn.splice(r,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}e.dbReadyPromise=new R(n=>{e.dbReadyResolve=n}),e.openCanceller=new R((n,i)=>{e.cancelOpen=i})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new V.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,r=this._state;return new R((n,i)=>{let o=()=>{this.close();var s=this._deps.indexedDB.deleteDatabase(this.name);s.onsuccess=de(()=>{ly(this._deps,this.name),n()}),s.onerror=dt(i),s.onblocked=this._fireOnBlocked};if(e)throw new V.InvalidArgument("Arguments not allowed in db.delete()");r.isBeingOpened?r.dbReadyPromise.then(o):o()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){let e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return be(this._allTables).map(e=>this._allTables[e])}transaction(){let e=fy.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,r,n){let i=z.trans;(!i||i.db!==this||e.indexOf("!")!==-1)&&(i=null);let o=e.indexOf("?")!==-1;e=e.replace("!","").replace("?","");let s,a;try{if(a=r.map(l=>{var c=l instanceof this.Table?l.name:l;if(typeof c!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return c}),e=="r"||e===Bs)s=Bs;else if(e=="rw"||e==Ks)s=Ks;else throw new V.InvalidArgument("Invalid transaction mode: "+e);if(i){if(i.mode===Bs&&s===Ks)if(o)i=null;else throw new V.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i&&a.forEach(l=>{if(i&&i.storeNames.indexOf(l)===-1)if(o)i=null;else throw new V.SubTransaction("Table "+l+" not included in parent transaction.")}),o&&i&&!i.active&&(i=null)}}catch(l){return i?i._promise(null,(c,p)=>{p(l)}):je(l)}let u=gu.bind(null,this,s,a,i,n);return i?i._promise(s,u,"lock"):z.trans?Hr(z.transless,()=>this._whenReady(u)):this._whenReady(u)}table(e){if(!Je(this._allTables,e))throw new V.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}},xy=typeof Symbol!="undefined"&&"observable"in Symbol?Symbol.observable:"@@observable",bu=class{constructor(e){this._subscribe=e}subscribe(e,r,n){return this._subscribe(!e||typeof e=="function"?{next:e,error:r,complete:n}:e)}[xy](){return this}};try{sa={indexedDB:ue.indexedDB||ue.mozIndexedDB||ue.webkitIndexedDB||ue.msIndexedDB,IDBKeyRange:ue.IDBKeyRange||ue.webkitIDBKeyRange}}catch{sa={indexedDB:null,IDBKeyRange:null}}pr=St;Rr(pr,ze(ye({},Si),{delete(t){return new pr(t,{addons:[]}).delete()},exists(t){return new pr(t,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1)},getDatabaseNames(t){try{return sy(pr.dependencies).then(t)}catch{return je(new V.MissingAPI)}},defineClass(){function t(e){Ve(this,e)}return t},ignoreTransaction(t){return z.trans?Hr(z.transless,t):t()},vip:ta,async:function(t){return function(){try{var e=ra(t.apply(this,arguments));return!e||typeof e.then!="function"?R.resolve(e):e}catch(r){return je(r)}}},spawn:function(t,e,r){try{var n=ra(t.apply(r,e||[]));return!n||typeof n.then!="function"?R.resolve(n):n}catch(i){return je(i)}},currentTransaction:{get:()=>z.trans||null},waitFor:function(t,e){let r=R.resolve(typeof t=="function"?pr.ignoreTransaction(t):t).timeout(e||6e4);return z.trans?z.trans.waitFor(r):r},Promise:R,debug:{get:()=>ft,set:t=>{Rl(t,t==="dexie"?()=>!0:tu)}},derive:Lr,extend:Ve,props:Rr,override:Dl,Events:Kn,on:Kt,liveQuery:wy,extendObservabilitySet:xu,getByKeyPath:bt,setByKeyPath:ot,delByKeyPath:og,shallowClone:Pl,deepClone:On,getObjectDiff:na,cmp:We,asap:Ol,minKey:Ns,addons:[],connections:Bn,errnames:js,dependencies:sa,semVer:Zl,version:Zl.split(".").map(t=>parseInt(t)).reduce((t,e,r)=>t+e/Math.pow(10,r*2))}));pr.maxKey=Wn(pr.dependencies.IDBKeyRange);typeof dispatchEvent!="undefined"&&typeof addEventListener!="undefined"&&(Kt(Vn,t=>{if(!Ct){let e;Li?(e=document.createEvent("CustomEvent"),e.initCustomEvent(Bt,!0,!0,t)):e=new CustomEvent(Bt,{detail:t}),Ct=!0,dispatchEvent(e),Ct=!1}}),addEventListener(Bt,({detail:t})=>{Ct||Ui(t)}));Ct=!1;if(typeof BroadcastChannel!="undefined"){let t=new BroadcastChannel(Bt);typeof t.unref=="function"&&t.unref(),Kt(Vn,e=>{Ct||t.postMessage(e)}),t.onmessage=e=>{e.data&&Ui(e.data)}}else if(typeof self!="undefined"&&typeof navigator!="undefined"){Kt(Vn,e=>{try{Ct||(typeof localStorage!="undefined"&&localStorage.setItem(Bt,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(r=>r.postMessage({type:Bt,changedParts:e})))}catch{}}),typeof addEventListener!="undefined"&&addEventListener("storage",e=>{if(e.key===Bt){let r=JSON.parse(e.newValue);r&&Ui(r.changedParts)}});let t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",jy)}R.rejectionMapper=hg;Rl(ft,tu)});var ju,pt,$r,Ae,Gi=A(()=>{wu();ju=ve(require("obsidian")),pt=class extends St{constructor(){super(pt.dbName);this.version(pt.dbVersion).stores({searchHistory:"++id",minisearch:"date"})}static async clearOldDatabases(){let e=(await indexedDB.databases()).filter(r=>r.name===pt.dbName&&r.version!==pt.dbVersion*10);if(e.length){console.log("Omnisearch - Those IndexedDb databases will be deleted:");for(let r of e)r.name&&indexedDB.deleteDatabase(r.name)}}static getInstance(){return pt.instance||(pt.instance=new pt),pt.instance}async clearCache(){new ju.Notice("Omnisearch - Cache cleared. Please restart Obsidian."),await this.minisearch.clear()}},$r=pt;$r.dbVersion=8,$r.dbName="omnisearch/cache/"+app.appId;Ae=$r.getInstance()});async function Au(t){T=Object.assign({},zt,await t.loadData()),hr.set(T.showExcerpt)}async function oe(t){await t.saveData(T)}function la(){return app.loadLocalStorage(Gn)==="1"}function Su(){return T.unsupportedFilesIndexing==="yes"||T.unsupportedFilesIndexing==="default"&&!!app.vault.getConfig("showUnsupportedFiles")}var $,hr,Qi,aa,zt,T,et=A(()=>{$=ve(require("obsidian"));ms();Gi();st();hr=wi(!1),Qi='Needs a restart to fully take effect.',aa=class extends $.PluginSettingTab{constructor(e){super(e.app,e);this.plugin=e,hr.subscribe(async r=>{T.showExcerpt=r,await oe(this.plugin)})}display(){let{containerEl:e}=this;if(e.empty(),this.app.loadLocalStorage(Gn)=="1"){let h=e.createEl("span");h.innerHTML='\u26A0\uFE0F OMNISEARCH IS DISABLED \u26A0\uFE0F'}e.createEl("h2",{text:"Omnisearch"});let r=e.createDiv();r.innerHTML=` Buy Me a Coffee at ko-fi.com `;let n=new DocumentFragment;n.createSpan({},h=>{h.innerHTML='\u26A0\uFE0F Changing indexing settings will clear the cache, and requires a restart of Obsidian.

',Ge()?h.innerHTML+=` \u{1F44D} You have installed Text Extractor, Omnisearch can use it to index PDFs and images contents.
Text extraction only works on desktop, but the cache can be synchronized with your mobile device.`:h.innerHTML+='\u26A0\uFE0F Omnisearch requires Text Extractor to index PDFs and images.'}),new $.Setting(e).setName("Indexing").setHeading().setDesc(n);let i=new DocumentFragment;i.createSpan({},h=>{h.innerHTML="Omnisearch will use Text Extractor to index the content of your PDFs"}),new $.Setting(e).setName(`PDFs content indexing ${Ge()?"":"\u26A0\uFE0F Disabled"}`).setDesc(i).addToggle(h=>h.setValue(T.PDFIndexing).onChange(async y=>{await Ae.clearCache(),T.PDFIndexing=y,await oe(this.plugin)})).setDisabled(!Ge());let o=new DocumentFragment;o.createSpan({},h=>{h.innerHTML="Omnisearch will use Text Extractor to OCR your images and index their content"}),new $.Setting(e).setName(`Images OCR indexing ${Ge()?"":"\u26A0\uFE0F Disabled"}`).setDesc(o).addToggle(h=>h.setValue(T.imagesIndexing).onChange(async y=>{await Ae.clearCache(),T.imagesIndexing=y,await oe(this.plugin)})).setDisabled(!Ge());let s=new DocumentFragment;s.createSpan({},h=>{h.innerHTML='Omnisearch will use Text Extractor to index the content of your office documents (currently
.docx
and
.xlsx
)'}),new $.Setting(e).setName(`Documents content indexing ${Ge()?"":"\u26A0\uFE0F Disabled"}`).setDesc(s).addToggle(h=>h.setValue(T.officeIndexing).onChange(async y=>{await Ae.clearCache(),T.officeIndexing=y,await oe(this.plugin)})).setDisabled(!Ge());let a=new DocumentFragment;a.createSpan({},h=>{h.innerHTML=` Omnisearch can index filenames of "unsupported" files, such as e.g.
.mp4
or non-extracted PDFs & images.
"Obsidian setting" will respect the value of "Files & Links > Detect all file extensions"`}),new $.Setting(e).setName("Index paths of unsupported files").setDesc(a).addDropdown(h=>{h.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(T.unsupportedFilesIndexing).onChange(async y=>{await Ae.clearCache(),T.unsupportedFilesIndexing=y,await oe(this.plugin)})});let u=new DocumentFragment;u.createSpan({},h=>{h.innerHTML=`In addition to standard md files, Omnisearch can also index other PLAINTEXT files.
Add extensions separated by a space, without the dot. Example: "txt org csv".
\u26A0\uFE0F Using extensions of non-plaintext files (like .pptx) WILL cause crashes, because Omnisearch will try to index their content.`}),new $.Setting(e).setName("Additional TEXT files to index").setDesc(u).addText(h=>{h.setValue(T.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org csv").onChange(async y=>{await Ae.clearCache(),T.indexedFileTypes=y.split(" "),await oe(this.plugin)})}),new $.Setting(e).setName("Behavior").setHeading(),new $.Setting(e).setName("Save index to cache").setDesc("Enable caching to speed up indexing time. In rare cases, the cache write may cause a crash in Obsidian. This option will disable itself if it happens.").addToggle(h=>h.setValue(T.useCache).onChange(async y=>{T.useCache=y,await oe(this.plugin)})),new $.Setting(e).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(h=>h.setValue(T.showPreviousQueryResults).onChange(async y=>{T.showPreviousQueryResults=y,await oe(this.plugin)})),new $.Setting(e).setName(`Respect Obsidian's "Excluded Files"`).setDesc(`By default, files that are in Obsidian's "Options > Files & Links > Excluded Files" list are downranked in results. Enable this option to completely hide them`).addToggle(h=>h.setValue(T.hideExcluded).onChange(async y=>{T.hideExcluded=y,await oe(this.plugin)}));let l=new DocumentFragment;l.createSpan({},h=>{h.innerHTML=`Enable this if you want to be able to search for CamelCaseWords as separate words.
\u26A0\uFE0F Changing this setting will clear the cache.
${Qi} `}),new $.Setting(e).setName("Split CamelCaseWords").setDesc(l).addToggle(h=>h.setValue(T.splitCamelCase).onChange(async y=>{await Ae.clearCache(),T.splitCamelCase=y,await oe(this.plugin)})),new $.Setting(e).setName("Simpler search").setDesc(`Enable this if Obsidian often freezes while making searches. Words shorter than 3 characters won't be used as prefixes; this can reduce search delay but will return fewer results.`).addToggle(h=>h.setValue(T.simpleSearch).onChange(async y=>{T.simpleSearch=y,await oe(this.plugin)})),new $.Setting(e).setName("Open in new pane").setDesc("Open and create files in a new pane instead of the current pane.").addToggle(h=>h.setValue(T.openInNewPane).onChange(async y=>{T.openInNewPane=y,await oe(this.plugin)})),new $.Setting(e).setName("Set Vim like navigation keys").setDesc("Navigate down the results with Ctrl/\u2318 + J/N, or navigate up with Ctrl/\u2318 + K/P").addToggle(h=>h.setValue(T.vimLikeNavigationShortcut).onChange(async y=>{T.vimLikeNavigationShortcut=y,await oe(this.plugin)})),new $.Setting(e).setName("Fuzziness").setDesc("Define the level of fuzziness for the search. The higher the fuzziness, the more results you'll get.").addDropdown(h=>h.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(T.fuzziness).onChange(async y=>{["0","1","2"].includes(y)||(y="2"),T.fuzziness=y,await oe(this.plugin)})),new $.Setting(e).setName("User Interface").setHeading(),new $.Setting(e).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(h=>h.setValue(T.ribbonIcon).onChange(async y=>{T.ribbonIcon=y,await oe(this.plugin),y?this.plugin.addRibbonButton():this.plugin.removeRibbonButton()})),new $.Setting(e).setName("Show excerpts").setDesc("Shows the contextual part of the note that matches the search. Disable this to only show filenames in results.").addToggle(h=>h.setValue(T.showExcerpt).onChange(async y=>{hr.set(y)})),new $.Setting(e).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(h=>h.setValue(T.renderLineReturnInExcerpts).onChange(async y=>{T.renderLineReturnInExcerpts=y,await oe(this.plugin)}));let c=new DocumentFragment;if(c.createSpan({},h=>{h.innerHTML=`Shows a button next to the search input, to create a note. Acts the same as the shift \u21B5 shortcut, can be useful for mobile device users.`}),new $.Setting(e).setName('Show "Create note" button').setDesc(c).addToggle(h=>h.setValue(T.showCreateButton).onChange(async y=>{T.showCreateButton=y,await oe(this.plugin)})),new $.Setting(e).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(h=>h.setValue(T.highlight).onChange(async y=>{T.highlight=y,await oe(this.plugin)})),new $.Setting(e).setName("Results weighting").setHeading(),new $.Setting(e).setName(`File name & declared aliases (default: ${zt.weightBasename})`).addSlider(h=>this.weightSlider(h,"weightBasename")),new $.Setting(e).setName(`File directory (default: ${zt.weightDirectory})`).addSlider(h=>this.weightSlider(h,"weightDirectory")),new $.Setting(e).setName(`Headings level 1 (default: ${zt.weightH1})`).addSlider(h=>this.weightSlider(h,"weightH1")),new $.Setting(e).setName(`Headings level 2 (default: ${zt.weightH2})`).addSlider(h=>this.weightSlider(h,"weightH2")),new $.Setting(e).setName(`Headings level 3 (default: ${zt.weightH3})`).addSlider(h=>this.weightSlider(h,"weightH3")),new $.Setting(e).setName(`Tags without the # (default: ${zt.weightUnmarkedTags})`).addSlider(h=>this.weightSlider(h,"weightUnmarkedTags")),new $.Setting(e).setName("Debugging").setHeading(),new $.Setting(e).setName("Enable verbose logging").setDesc("Adds a LOT of logs for debugging purposes. Don't forget to disable it.").addToggle(h=>h.setValue(T.verboseLogging).onChange(async y=>{T.verboseLogging=y,await oe(this.plugin)})),!$.Platform.isMobile){let h=new DocumentFragment;h.createSpan({},y=>{y.innerHTML='Omnisearch can be used through a simple HTTP server (more information).'}),new $.Setting(e).setName("API Access Through HTTP").setHeading().setDesc(h),new $.Setting(e).setName("Enable the HTTP server").addToggle(y=>y.setValue(T.httpApiEnabled).onChange(async j=>{T.httpApiEnabled=j,j?this.plugin.apiHttpServer.listen(T.httpApiPort):this.plugin.apiHttpServer.close(),await oe(this.plugin)})),new $.Setting(e).setName("HTTP Port").addText(y=>{y.setValue(T.httpApiPort).setPlaceholder("51361").onChange(async j=>{parseInt(j)>65535&&(j=T.httpApiPort,y.setValue(T.httpApiPort)),T.httpApiPort=j,T.httpApiEnabled&&(this.plugin.apiHttpServer.close(),this.plugin.apiHttpServer.listen(T.httpApiPort)),await oe(this.plugin)})}),new $.Setting(e).setName("Show a notification when the server starts").setDesc("Will display a notification if the server is enabled, at Obsidian startup.").addToggle(y=>y.setValue(T.httpApiNotice).onChange(async j=>{T.httpApiNotice=j,await oe(this.plugin)}))}new $.Setting(e).setName("Danger Zone").setHeading();let p=new DocumentFragment;p.createSpan({},h=>{h.innerHTML=`Normalize diacritics in search terms. Words like "br\xFBl\xE9e" or "\u017Elu\u0165ou\u010Dk\xFD" will be indexed as "brulee" and "zlutoucky".
\u26A0\uFE0F You probably should NOT disable this.
\u26A0\uFE0F Changing this setting will clear the cache.
${Qi} `}),new $.Setting(e).setName("Ignore diacritics").setDesc(p).addToggle(h=>h.setValue(T.ignoreDiacritics).onChange(async y=>{await Ae.clearCache(),T.ignoreDiacritics=y,await oe(this.plugin)}));let f=new DocumentFragment;if(f.createSpan({},h=>{h.innerHTML=`Disable Omnisearch on this device only.
${Qi}`}),new $.Setting(e).setName("Disable on this device").setDesc(f).addToggle(h=>h.setValue(la()).onChange(async y=>{y?this.app.saveLocalStorage(Gn,"1"):this.app.saveLocalStorage(Gn),new $.Notice("Omnisearch - Disabled. Please restart Obsidian.")})),Et()){let h=new DocumentFragment;h.createSpan({},y=>{y.innerHTML=`Erase all Omnisearch cache data. Use this if Omnisearch results are inconsistent, missing, or appear outdated.
${Qi}`}),new $.Setting(e).setName("Clear cache data").setDesc(h).addButton(y=>{y.setButtonText("Clear cache"),y.onClick(async()=>{await Ae.clearCache()})})}}weightSlider(e,r){e.setLimits(1,5,.1).setValue(T[r]).setDynamicTooltip().onChange(async n=>{T[r]=n,await oe(this.plugin)})}},zt={useCache:!0,hideExcluded:!1,ignoreDiacritics:!0,indexedFileTypes:[],PDFIndexing:!1,officeIndexing:!1,imagesIndexing:!1,unsupportedFilesIndexing:"no",splitCamelCase:!1,openInNewPane:!1,vimLikeNavigationShortcut:app.vault.getConfig("vimMode"),ribbonIcon:!0,showExcerpt:!0,renderLineReturnInExcerpts:!0,showCreateButton:!1,highlight:!0,showPreviousQueryResults:!0,simpleSearch:!1,fuzziness:"1",weightBasename:3,weightDirectory:2,weightH1:1.5,weightH2:1.3,weightH3:1.1,weightUnmarkedTags:1.1,httpApiEnabled:!1,httpApiPort:"51361",httpApiNotice:!0,welcomeMessage:"",verboseLogging:!1},T=Object.assign({},zt)});function ua(t){Du=t}function ca(){return Du}function Ou(){return app.plugins.plugins["cm-chs-patch"]}function Ge(){return app.plugins?.plugins?.["text-extractor"]?.api}function Et(){return!Cu.Platform.isIosApp&&T.useCache}var Cu,Eu,Fu,Qn,Tu,Gn,Q,qi,tt,re,Ht,Du,fa,qn,Iu,st=A(()=>{Fl();ms();et();Cu=ve(require("obsidian")),Eu=/[\u4e00-\u9fa5]/,Fu=100,Qn=300,Tu=`suggestion-highlight omnisearch-highlight ${T.highlight?"omnisearch-default-highlight":""}`,Gn="omnisearch-disabled",Q=new hs,qi={ToggleExcerpts:"toggle-excerpts"},tt=(o=>(o[o.Done=0]="Done",o[o.LoadingCache=1]="LoadingCache",o[o.ReadingFiles=2]="ReadingFiles",o[o.IndexingFiles=3]="IndexingFiles",o[o.WritingCache=4]="WritingCache",o))(tt||{}),re=(c=>(c.Enter="enter",c.OpenInBackground="open-in-background",c.CreateNote="create-note",c.OpenInNewPane="open-in-new-pane",c.InsertLink="insert-link",c.Tab="tab",c.ArrowUp="arrow-up",c.ArrowDown="arrow-down",c.PrevSearchHistory="prev-search-history",c.NextSearchHistory="next-search-history",c))(re||{}),Ht=wi(0),Du=!1;fa=/[|\t\n\r\^= -#%-*,.`\/<>:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/.toString().slice(1,-1),qn=new RegExp(`${fa}+`,"u"),Iu=/[|\[\]\(\)<>\{\} \t\n\r]/u});var Pu=gi((Yn,da)=>{(function(t,e){if(typeof Yn=="object"&&typeof da=="object")da.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var r=e();for(var n in r)(typeof Yn=="object"?Yn:t)[n]=r[n]}})(typeof self!="undefined"?self:Yn,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(n,i,o){r.o(n,i)||Object.defineProperty(n,i,{enumerable:!0,get:o})},r.r=function(n){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,i){if(1&i&&(n=r(n)),8&i||4&i&&typeof n=="object"&&n&&n.__esModule)return n;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:n}),2&i&&typeof n!="string")for(var s in n)r.d(o,s,function(a){return n[a]}.bind(null,s));return o},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";r.r(e),r.d(e,"md5",function(){return j});var n="0123456789abcdef".split(""),i=function(v){for(var d="",b=0;b<4;b++)d+=n[v>>8*b+4&15]+n[v>>8*b&15];return d},o=function(v){for(var d=v.length,b=0;b>>32-S,E)}(d=function(w,S,E,D){return S=s(s(S,w),s(E,D))}(v,d,m,x),g,b)},u=function(v,d,b,m,g,x,_,w){return a(b&m|~b&g,d,b,x,_,w,v)},l=function(v,d,b,m,g,x,_,w){return a(b&g|m&~g,d,b,x,_,w,v)},c=function(v,d,b,m,g,x,_,w){return a(b^m^g,d,b,x,_,w,v)},p=function(v,d,b,m,g,x,_,w){return a(m^(b|~g),d,b,x,_,w,v)},f=function(v,d,b){b===void 0&&(b=s);var m=v[0],g=v[1],x=v[2],_=v[3],w=u.bind(null,b);m=w(m,g,x,_,d[0],7,-680876936),_=w(_,m,g,x,d[1],12,-389564586),x=w(x,_,m,g,d[2],17,606105819),g=w(g,x,_,m,d[3],22,-1044525330),m=w(m,g,x,_,d[4],7,-176418897),_=w(_,m,g,x,d[5],12,1200080426),x=w(x,_,m,g,d[6],17,-1473231341),g=w(g,x,_,m,d[7],22,-45705983),m=w(m,g,x,_,d[8],7,1770035416),_=w(_,m,g,x,d[9],12,-1958414417),x=w(x,_,m,g,d[10],17,-42063),g=w(g,x,_,m,d[11],22,-1990404162),m=w(m,g,x,_,d[12],7,1804603682),_=w(_,m,g,x,d[13],12,-40341101),x=w(x,_,m,g,d[14],17,-1502002290),g=w(g,x,_,m,d[15],22,1236535329);var S=l.bind(null,b);m=S(m,g,x,_,d[1],5,-165796510),_=S(_,m,g,x,d[6],9,-1069501632),x=S(x,_,m,g,d[11],14,643717713),g=S(g,x,_,m,d[0],20,-373897302),m=S(m,g,x,_,d[5],5,-701558691),_=S(_,m,g,x,d[10],9,38016083),x=S(x,_,m,g,d[15],14,-660478335),g=S(g,x,_,m,d[4],20,-405537848),m=S(m,g,x,_,d[9],5,568446438),_=S(_,m,g,x,d[14],9,-1019803690),x=S(x,_,m,g,d[3],14,-187363961),g=S(g,x,_,m,d[8],20,1163531501),m=S(m,g,x,_,d[13],5,-1444681467),_=S(_,m,g,x,d[2],9,-51403784),x=S(x,_,m,g,d[7],14,1735328473),g=S(g,x,_,m,d[12],20,-1926607734);var E=c.bind(null,b);m=E(m,g,x,_,d[5],4,-378558),_=E(_,m,g,x,d[8],11,-2022574463),x=E(x,_,m,g,d[11],16,1839030562),g=E(g,x,_,m,d[14],23,-35309556),m=E(m,g,x,_,d[1],4,-1530992060),_=E(_,m,g,x,d[4],11,1272893353),x=E(x,_,m,g,d[7],16,-155497632),g=E(g,x,_,m,d[10],23,-1094730640),m=E(m,g,x,_,d[13],4,681279174),_=E(_,m,g,x,d[0],11,-358537222),x=E(x,_,m,g,d[3],16,-722521979),g=E(g,x,_,m,d[6],23,76029189),m=E(m,g,x,_,d[9],4,-640364487),_=E(_,m,g,x,d[12],11,-421815835),x=E(x,_,m,g,d[15],16,530742520),g=E(g,x,_,m,d[2],23,-995338651);var D=p.bind(null,b);m=D(m,g,x,_,d[0],6,-198630844),_=D(_,m,g,x,d[7],10,1126891415),x=D(x,_,m,g,d[14],15,-1416354905),g=D(g,x,_,m,d[5],21,-57434055),m=D(m,g,x,_,d[12],6,1700485571),_=D(_,m,g,x,d[3],10,-1894986606),x=D(x,_,m,g,d[10],15,-1051523),g=D(g,x,_,m,d[1],21,-2054922799),m=D(m,g,x,_,d[8],6,1873313359),_=D(_,m,g,x,d[15],10,-30611744),x=D(x,_,m,g,d[6],15,-1560198380),g=D(g,x,_,m,d[13],21,1309151649),m=D(m,g,x,_,d[4],6,-145523070),_=D(_,m,g,x,d[11],10,-1120210379),x=D(x,_,m,g,d[2],15,718787259),g=D(g,x,_,m,d[9],21,-343485551),v[0]=b(m,v[0]),v[1]=b(g,v[1]),v[2]=b(x,v[2]),v[3]=b(_,v[3])},h=function(v){for(var d=[],b=0;b<64;b+=4)d[b>>2]=v.charCodeAt(b)+(v.charCodeAt(b+1)<<8)+(v.charCodeAt(b+2)<<16)+(v.charCodeAt(b+3)<<24);return d},y=function(v,d){var b,m=v.length,g=[1732584193,-271733879,-1732584194,271733878];for(b=64;b<=m;b+=64)f(g,h(v.substring(b-64,b)),d);var x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],_=(v=v.substring(b-64)).length;for(b=0;b<_;b++)x[b>>2]|=v.charCodeAt(b)<<(b%4<<3);if(x[b>>2]|=128<<(b%4<<3),b>55)for(f(g,x,d),b=16;b--;)x[b]=0;return x[14]=8*m,f(g,x,d),g};function j(v){var d;return o(y("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(d=function(b,m){var g=(65535&b)+(65535&m);return(b>>16)+(m>>16)+(g>>16)<<16|65535&g}),o(y(v,d))}}])})});function Ru(t){let e=t.split("/");return e.pop(),e.join("/")}function Yi(t,e){return t.headings?.filter(r=>r.level===e).map(r=>r.heading)??[]}function Ji(t,e){return(t+e)%e}function Lu(t){return t.replace(/(\*|_)+(.+?)(\*|_)+/g,(e,r,n)=>n)}function Nu(t){return t?.frontmatter?(0,mr.parseFrontMatterAliases)(t.frontmatter)??[]:[]}function Bu(t){let e=t?(0,mr.getAllTags)(t)??[]:[];return e=[...new Set(e.reduce((r,n)=>[...r,...n.split("/").filter(i=>i).map(i=>i.startsWith("#")?i:`#${i}`),n],[]))],e}function Ft(t){let r=["\\u30FC","\\u309A","\\u3099"].join("|"),n=new RegExp(`(?!${r})\\p{Diacritic}`,"gu");return t==null?"":(t=t.replaceAll("`","[__omnisearch__backtick__]"),t=t.replaceAll("^","[__omnisearch__caret__]"),t=t.normalize("NFD").replace(n,"").normalize("NFC"),t=t.replaceAll("[__omnisearch__backtick__]","`"),t=t.replaceAll("[__omnisearch__caret__]","^"),t)}function gr(){return mr.Platform.isMacOS?"\u2318":"ctrl"}function Ay(t){let e=!!Ge(),r=e&&T.PDFIndexing,n=e&&T.imagesIndexing;return Xi(t)||Gr(t)||Zi(t)||r&&yr(t)||n&&Ur(t)}function pa(t){return Su()||Xi(t)||Gr(t)||Zi(t)}function Jn(t){return pa(t)||Ay(t)}function Ur(t){let e=Vt(t);return e==="png"||e==="jpg"||e==="jpeg"||e==="webp"}function yr(t){return Vt(t)==="pdf"}function Ku(t){let e=Vt(t);return e==="docx"||e==="xlsx"}function Xi(t){return[...T.indexedFileTypes,"md"].some(e=>t.endsWith(`.${e}`))}function Gr(t){return t.endsWith(".canvas")}function Zi(t){return t.endsWith(".loom")}function Vt(t){let e=t.split(".");return e[e.length-1]??""}function zu(t){return mr.Platform.isMobileApp?(0,Mu.md5)(t.toString()):(0,ku.createHash)("md5").update(t).digest("hex")}function Hu(t,e){let r=[],n=0,i=t.length;for(;nr):[]}function Wu(t){return t.includes("-")?t.split("-").filter(e=>e):[]}function he(...t){Uu(console.log,...t)}function $u(...t){Uu(console.warn,...t)}function Uu(t,...e){if(T.verboseLogging){let r=new Date,n=`${r.getMinutes()}:${r.getSeconds()}:${r.getMilliseconds()}`;t("Omnisearch -",n+" -",...e)}}var mr,ku,Mu,Tt=A(()=>{mr=ve(require("obsidian"));st();et();ku=ve(require("crypto")),Mu=ve(Pu())});async function Sy(t){let e=app.vault.getAbstractFileByPath(t);if(!e)throw new Error(`Invalid file path: "${t}"`);if(!(e instanceof eo.TFile))throw new Error(`Not a TFile: "${t}"`);let r=null,n=Ge();if(Xi(t))r=await app.vault.cachedRead(e);else if(Gr(t)){let s=JSON.parse(await app.vault.cachedRead(e)),a=[];for(let u of s.nodes)u.type==="text"?a.push(u.text):u.type==="file"&&a.push(u.file);for(let u of s.edges.filter(l=>!!l.label))a.push(u.label);r=a.join(`\r `)}else if(Zi(t))try{let s=JSON.parse(await app.vault.cachedRead(e)),a=[],u=l=>{for(let c in l)typeof l[c]=="object"?u(l[c]):c==="content"&&a.push(l[c])};u(s),r=a.join(`\r `)}catch(s){console.error("Omnisearch: Error while parsing Dataloom file",t),console.error(s)}else Ur(t)&&T.imagesIndexing&&n?.canFileBeExtracted(t)?r=await n.extractText(e):yr(t)&&T.PDFIndexing&&n?.canFileBeExtracted(t)?r=await n.extractText(e):Ku(t)&&T.officeIndexing&&n?.canFileBeExtracted(t)?r=await n.extractText(e):pa(t)&&(r=e.path);r==null&&(console.warn(`Omnisearch: ${r} content for file`,e.path),r="");let i=app.metadataCache.getFileCache(e);if(i&&i.frontmatter?.["excalidraw-plugin"]){let s=i.sections?.filter(a=>a.type==="comment")??[];for(let{start:a,end:u}of s.map(l=>l.position))r=r.substring(0,a.offset-1)+r.substring(u.offset)}let o=Bu(i);return{basename:e.basename,content:r,cleanedContent:Lu(Ft(r)),path:e.path,mtime:e.stat.mtime,tags:o,unmarkedTags:o.map(s=>s.replace("#","")),aliases:Nu(i).join(""),headings1:i?Yi(i,1).join(" "):"",headings2:i?Yi(i,2).join(" "):"",headings3:i?Yi(i,3).join(" "):""}}var eo,Gu,Se,Qr=A(()=>{eo=ve(require("obsidian"));st();Gi();Tt();et();Gu=class{constructor(){this.nextQueryIsEmpty=!1;this.documents=new Map}async addToLiveCache(e){try{let r=await Sy(e);if(!r.path){console.error(`Missing .path field in IndexedDocument "${r.basename}", skipping`);return}this.documents.set(e,r)}catch(r){console.warn(`Omnisearch: Error while adding "${e}" to live cache`,r),this.removeFromLiveCache(e)}}removeFromLiveCache(e){this.documents.delete(e)}async getDocument(e){return this.documents.has(e)?this.documents.get(e):(he("Generating IndexedDocument from",e),await this.addToLiveCache(e),this.documents.get(e))}async addToSearchHistory(e){if(!e){this.nextQueryIsEmpty=!0;return}this.nextQueryIsEmpty=!1;let r=await Ae.searchHistory.toArray();r=r.filter(n=>n.query!==e).reverse(),r.unshift({query:e}),r=r.slice(0,10),await Ae.searchHistory.clear(),await Ae.searchHistory.bulkAdd(r)}async getSearchHistory(){let e=(await Ae.searchHistory.toArray()).reverse().map(r=>r.query);return this.nextQueryIsEmpty&&e.unshift(""),e}getDocumentsChecksum(e){return zu(JSON.stringify(e.sort((r,n)=>r.pathn.path?1:0)))}async getMinisearchCache(){try{return(await Ae.minisearch.toArray())[0]}catch(e){return new eo.Notice("Omnisearch - Cache missing or invalid. Some freezes may occur while Omnisearch indexes your vault."),console.error("Omnisearch - Error while loading Minisearch cache"),console.error(e),null}}async writeMinisearchCache(e,r){let n=Array.from(r).map(([i,o])=>({path:i,mtime:o}));await Ae.minisearch.clear(),await Ae.minisearch.add({date:new Date().toISOString(),paths:n,data:e.toJSON()}),console.log("Omnisearch - Search cache written")}},Se=new Gu});var Oy,no,ha=A(()=>{Oy=typeof global=="object"&&global&&global.Object===Object&&global,no=Oy});var Iy,Py,_e,rt=A(()=>{ha();Iy=typeof self=="object"&&self&&self.Object===Object&&self,Py=no||Iy||Function("return this")(),_e=Py});var ky,De,_r=A(()=>{rt();ky=_e.Symbol,De=ky});function Ly(t){var e=My.call(t,Xn),r=t[Xn];try{t[Xn]=void 0;var n=!0}catch{}var i=Ry.call(t);return n&&(e?t[Xn]=r:delete t[Xn]),i}var Ju,My,Ry,Xn,Xu,Zu=A(()=>{_r();Ju=Object.prototype,My=Ju.hasOwnProperty,Ry=Ju.toString,Xn=De?De.toStringTag:void 0;Xu=Ly});function Ky(t){return By.call(t)}var Ny,By,ec,tc=A(()=>{Ny=Object.prototype,By=Ny.toString;ec=Ky});function Vy(t){return t==null?t===void 0?Hy:zy:rc&&rc in Object(t)?Xu(t):ec(t)}var zy,Hy,rc,at,qr=A(()=>{_r();Zu();tc();zy="[object Null]",Hy="[object Undefined]",rc=De?De.toStringTag:void 0;at=Vy});function Wy(t){return t!=null&&typeof t=="object"}var $e,Wt=A(()=>{$e=Wy});function Uy(t){return typeof t=="symbol"||$e(t)&&at(t)==$y}var $y,lt,Yr=A(()=>{qr();Wt();$y="[object Symbol]";lt=Uy});function Gy(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r{Jr=Gy});var Qy,me,nt=A(()=>{Qy=Array.isArray,me=Qy});function oc(t){if(typeof t=="string")return t;if(me(t))return Jr(t,oc)+"";if(lt(t))return ic?ic.call(t):"";var e=t+"";return e=="0"&&1/t==-qy?"-0":e}var qy,nc,ic,sc,ac=A(()=>{_r();ma();nt();Yr();qy=1/0,nc=De?De.prototype:void 0,ic=nc?nc.toString:void 0;sc=oc});function Jy(t){for(var e=t.length;e--&&Yy.test(t.charAt(e)););return e}var Yy,lc,uc=A(()=>{Yy=/\s/;lc=Jy});function Zy(t){return t&&t.slice(0,lc(t)+1).replace(Xy,"")}var Xy,cc,fc=A(()=>{uc();Xy=/^\s+/;cc=Zy});function e_(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ce,ht=A(()=>{Ce=e_});function o_(t){if(typeof t=="number")return t;if(lt(t))return dc;if(Ce(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ce(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=cc(t);var r=r_.test(t);return r||n_.test(t)?i_(t.slice(2),r?2:8):t_.test(t)?dc:+t}var dc,t_,r_,n_,i_,ga,pc=A(()=>{fc();ht();Yr();dc=0/0,t_=/^[-+]0x[0-9a-f]+$/i,r_=/^0b[01]+$/i,n_=/^0o[0-7]+$/i,i_=parseInt;ga=o_});function s_(t){return t}var $t,Zn=A(()=>{$t=s_});function f_(t){if(!Ce(t))return!1;var e=at(t);return e==l_||e==u_||e==a_||e==c_}var a_,l_,u_,c_,io,ya=A(()=>{qr();ht();a_="[object AsyncFunction]",l_="[object Function]",u_="[object GeneratorFunction]",c_="[object Proxy]";io=f_});var d_,oo,hc=A(()=>{rt();d_=_e["__core-js_shared__"],oo=d_});function p_(t){return!!mc&&mc in t}var mc,gc,yc=A(()=>{hc();mc=function(){var t=/[^.]+$/.exec(oo&&oo.keys&&oo.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();gc=p_});function g_(t){if(t!=null){try{return m_.call(t)}catch{}try{return t+""}catch{}}return""}var h_,m_,Dt,_a=A(()=>{h_=Function.prototype,m_=h_.toString;Dt=g_});function A_(t){if(!Ce(t)||gc(t))return!1;var e=io(t)?j_:__;return e.test(Dt(t))}var y_,__,v_,b_,x_,w_,j_,_c,vc=A(()=>{ya();yc();ht();_a();y_=/[\\^$.*+?()[\]{}|]/g,__=/^\[object .+?Constructor\]$/,v_=Function.prototype,b_=Object.prototype,x_=v_.toString,w_=b_.hasOwnProperty,j_=RegExp("^"+x_.call(w_).replace(y_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");_c=A_});function S_(t,e){return t==null?void 0:t[e]}var bc,xc=A(()=>{bc=S_});function C_(t,e){var r=bc(t,e);return _c(r)?r:void 0}var Qe,Ut=A(()=>{vc();xc();Qe=C_});var E_,so,wc=A(()=>{Ut();rt();E_=Qe(_e,"WeakMap"),so=E_});var jc,F_,Ac,Sc=A(()=>{ht();jc=Object.create,F_=function(){function t(){}return function(e){if(!Ce(e))return{};if(jc)return jc(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Ac=F_});function T_(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Cc,Ec=A(()=>{Cc=T_});function D_(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r{Fc=D_});function k_(t){var e=0,r=0;return function(){var n=P_(),i=I_-(n-r);if(r=n,i>0){if(++e>=O_)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var O_,I_,P_,Dc,Oc=A(()=>{O_=800,I_=16,P_=Date.now;Dc=k_});function M_(t){return function(){return t}}var Ic,Pc=A(()=>{Ic=M_});var R_,Xr,va=A(()=>{Ut();R_=function(){try{var t=Qe(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Xr=R_});var L_,kc,Mc=A(()=>{Pc();va();Zn();L_=Xr?function(t,e){return Xr(t,"toString",{configurable:!0,enumerable:!1,value:Ic(e),writable:!0})}:$t,kc=L_});var N_,Rc,Lc=A(()=>{Mc();Oc();N_=Dc(kc),Rc=N_});function B_(t,e){for(var r=-1,n=t==null?0:t.length;++r{Nc=B_});function H_(t,e){var r=typeof t;return e=e??K_,!!e&&(r=="number"||r!="symbol"&&z_.test(t))&&t>-1&&t%1==0&&t{K_=9007199254740991,z_=/^(?:0|[1-9]\d*)$/;Zr=H_});function V_(t,e,r){e=="__proto__"&&Xr?Xr(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var lo,ba=A(()=>{va();lo=V_});function W_(t,e){return t===e||t!==t&&e!==e}var Gt,ei=A(()=>{Gt=W_});function G_(t,e,r){var n=t[e];(!(U_.call(t,e)&&Gt(n,r))||r===void 0&&!(e in t))&&lo(t,e,r)}var $_,U_,uo,xa=A(()=>{ba();ei();$_=Object.prototype,U_=$_.hasOwnProperty;uo=G_});function Q_(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o{xa();ba();Qt=Q_});function q_(t,e,r){return e=Kc(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=Kc(n.length-e,0),s=Array(o);++i{Ec();Kc=Math.max;zc=q_});function Y_(t,e){return Rc(zc(t,e,$t),t+"")}var Vc,Wc=A(()=>{Zn();Hc();Lc();Vc=Y_});function X_(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=J_}var J_,en,co=A(()=>{J_=9007199254740991;en=X_});function Z_(t){return t!=null&&en(t.length)&&!io(t)}var mt,tn=A(()=>{ya();co();mt=Z_});function ev(t,e,r){if(!Ce(r))return!1;var n=typeof e;return(n=="number"?mt(r)&&Zr(e,r.length):n=="string"&&e in r)?Gt(r[e],t):!1}var wa,$c=A(()=>{ei();tn();ao();ht();wa=ev});function rv(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||tv;return t===r}var tv,rn,fo=A(()=>{tv=Object.prototype;rn=rv});function nv(t,e){for(var r=-1,n=Array(t);++r{Uc=nv});function ov(t){return $e(t)&&at(t)==iv}var iv,ja,Qc=A(()=>{qr();Wt();iv="[object Arguments]";ja=ov});var qc,sv,av,lv,nn,po=A(()=>{Qc();Wt();qc=Object.prototype,sv=qc.hasOwnProperty,av=qc.propertyIsEnumerable,lv=ja(function(){return arguments}())?ja:function(t){return $e(t)&&sv.call(t,"callee")&&!av.call(t,"callee")},nn=lv});function uv(){return!1}var Yc,Jc=A(()=>{Yc=uv});var Xc,Zc,cv,ef,fv,dv,vr,ho=A(()=>{rt();Jc();Xc=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zc=Xc&&typeof module=="object"&&module&&!module.nodeType&&module,cv=Zc&&Zc.exports===Xc,ef=cv?_e.Buffer:void 0,fv=ef?ef.isBuffer:void 0,dv=fv||Yc,vr=dv});function Lv(t){return $e(t)&&en(t.length)&&!!ce[at(t)]}var pv,hv,mv,gv,yv,_v,vv,bv,xv,wv,jv,Av,Sv,Cv,Ev,Fv,Tv,Dv,Ov,Iv,Pv,kv,Mv,Rv,ce,tf,rf=A(()=>{qr();co();Wt();pv="[object Arguments]",hv="[object Array]",mv="[object Boolean]",gv="[object Date]",yv="[object Error]",_v="[object Function]",vv="[object Map]",bv="[object Number]",xv="[object Object]",wv="[object RegExp]",jv="[object Set]",Av="[object String]",Sv="[object WeakMap]",Cv="[object ArrayBuffer]",Ev="[object DataView]",Fv="[object Float32Array]",Tv="[object Float64Array]",Dv="[object Int8Array]",Ov="[object Int16Array]",Iv="[object Int32Array]",Pv="[object Uint8Array]",kv="[object Uint8ClampedArray]",Mv="[object Uint16Array]",Rv="[object Uint32Array]",ce={};ce[Fv]=ce[Tv]=ce[Dv]=ce[Ov]=ce[Iv]=ce[Pv]=ce[kv]=ce[Mv]=ce[Rv]=!0;ce[pv]=ce[hv]=ce[Cv]=ce[mv]=ce[Ev]=ce[gv]=ce[yv]=ce[_v]=ce[vv]=ce[bv]=ce[xv]=ce[wv]=ce[jv]=ce[Av]=ce[Sv]=!1;tf=Lv});function Nv(t){return function(e){return t(e)}}var qt,ri=A(()=>{qt=Nv});var nf,ni,Bv,Aa,Kv,Ot,mo=A(()=>{ha();nf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ni=nf&&typeof module=="object"&&module&&!module.nodeType&&module,Bv=ni&&ni.exports===nf,Aa=Bv&&no.process,Kv=function(){try{var t=ni&&ni.require&&ni.require("util").types;return t||Aa&&Aa.binding&&Aa.binding("util")}catch{}}(),Ot=Kv});var of,zv,go,Sa=A(()=>{rf();ri();mo();of=Ot&&Ot.isTypedArray,zv=of?qt(of):tf,go=zv});function Wv(t,e){var r=me(t),n=!r&&nn(t),i=!r&&!n&&vr(t),o=!r&&!n&&!i&&go(t),s=r||n||i||o,a=s?Uc(t.length,String):[],u=a.length;for(var l in t)(e||Vv.call(t,l))&&!(s&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Zr(l,u)))&&a.push(l);return a}var Hv,Vv,yo,Ca=A(()=>{Gc();po();nt();ho();ao();Sa();Hv=Object.prototype,Vv=Hv.hasOwnProperty;yo=Wv});function $v(t,e){return function(r){return t(e(r))}}var _o,Ea=A(()=>{_o=$v});var Uv,sf,af=A(()=>{Ea();Uv=_o(Object.keys,Object),sf=Uv});function qv(t){if(!rn(t))return sf(t);var e=[];for(var r in Object(t))Qv.call(t,r)&&r!="constructor"&&e.push(r);return e}var Gv,Qv,lf,uf=A(()=>{fo();af();Gv=Object.prototype,Qv=Gv.hasOwnProperty;lf=qv});function Yv(t){return mt(t)?yo(t):lf(t)}var gt,on=A(()=>{Ca();uf();tn();gt=Yv});function Jv(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var cf,ff=A(()=>{cf=Jv});function eb(t){if(!Ce(t))return cf(t);var e=rn(t),r=[];for(var n in t)n=="constructor"&&(e||!Zv.call(t,n))||r.push(n);return r}var Xv,Zv,df,pf=A(()=>{ht();fo();ff();Xv=Object.prototype,Zv=Xv.hasOwnProperty;df=eb});function tb(t){return mt(t)?yo(t,!0):df(t)}var sn,vo=A(()=>{Ca();pf();tn();sn=tb});function ib(t,e){if(me(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||lt(t)?!0:nb.test(t)||!rb.test(t)||e!=null&&t in Object(e)}var rb,nb,an,bo=A(()=>{nt();Yr();rb=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nb=/^\w*$/;an=ib});var ob,It,ii=A(()=>{Ut();ob=Qe(Object,"create"),It=ob});function sb(){this.__data__=It?It(null):{},this.size=0}var hf,mf=A(()=>{ii();hf=sb});function ab(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var gf,yf=A(()=>{gf=ab});function fb(t){var e=this.__data__;if(It){var r=e[t];return r===lb?void 0:r}return cb.call(e,t)?e[t]:void 0}var lb,ub,cb,_f,vf=A(()=>{ii();lb="__lodash_hash_undefined__",ub=Object.prototype,cb=ub.hasOwnProperty;_f=fb});function hb(t){var e=this.__data__;return It?e[t]!==void 0:pb.call(e,t)}var db,pb,bf,xf=A(()=>{ii();db=Object.prototype,pb=db.hasOwnProperty;bf=hb});function gb(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=It&&e===void 0?mb:e,this}var mb,wf,jf=A(()=>{ii();mb="__lodash_hash_undefined__";wf=gb});function ln(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{mf();yf();vf();xf();jf();ln.prototype.clear=hf;ln.prototype.delete=gf;ln.prototype.get=_f;ln.prototype.has=bf;ln.prototype.set=wf;Fa=ln});function yb(){this.__data__=[],this.size=0}var Sf,Cf=A(()=>{Sf=yb});function _b(t,e){for(var r=t.length;r--;)if(Gt(t[r][0],e))return r;return-1}var Yt,oi=A(()=>{ei();Yt=_b});function xb(t){var e=this.__data__,r=Yt(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():bb.call(e,r,1),--this.size,!0}var vb,bb,Ef,Ff=A(()=>{oi();vb=Array.prototype,bb=vb.splice;Ef=xb});function wb(t){var e=this.__data__,r=Yt(e,t);return r<0?void 0:e[r][1]}var Tf,Df=A(()=>{oi();Tf=wb});function jb(t){return Yt(this.__data__,t)>-1}var Of,If=A(()=>{oi();Of=jb});function Ab(t,e){var r=this.__data__,n=Yt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var Pf,kf=A(()=>{oi();Pf=Ab});function un(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{Cf();Ff();Df();If();kf();un.prototype.clear=Sf;un.prototype.delete=Ef;un.prototype.get=Tf;un.prototype.has=Of;un.prototype.set=Pf;Jt=un});var Sb,Xt,xo=A(()=>{Ut();rt();Sb=Qe(_e,"Map"),Xt=Sb});function Cb(){this.size=0,this.__data__={hash:new Fa,map:new(Xt||Jt),string:new Fa}}var Mf,Rf=A(()=>{Af();si();xo();Mf=Cb});function Eb(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Lf,Nf=A(()=>{Lf=Eb});function Fb(t,e){var r=t.__data__;return Lf(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Zt,ai=A(()=>{Nf();Zt=Fb});function Tb(t){var e=Zt(this,t).delete(t);return this.size-=e?1:0,e}var Bf,Kf=A(()=>{ai();Bf=Tb});function Db(t){return Zt(this,t).get(t)}var zf,Hf=A(()=>{ai();zf=Db});function Ob(t){return Zt(this,t).has(t)}var Vf,Wf=A(()=>{ai();Vf=Ob});function Ib(t,e){var r=Zt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var $f,Uf=A(()=>{ai();$f=Ib});function cn(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{Rf();Kf();Hf();Wf();Uf();cn.prototype.clear=Mf;cn.prototype.delete=Bf;cn.prototype.get=zf;cn.prototype.has=Vf;cn.prototype.set=$f;br=cn});function Ta(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Pb);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Ta.Cache||br),r}var Pb,Gf,Qf=A(()=>{wo();Pb="Expected a function";Ta.Cache=br;Gf=Ta});function Mb(t){var e=Gf(t,function(n){return r.size===kb&&r.clear(),n}),r=e.cache;return e}var kb,qf,Yf=A(()=>{Qf();kb=500;qf=Mb});var Rb,Lb,Nb,Jf,Xf=A(()=>{Yf();Rb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lb=/\\(\\)?/g,Nb=qf(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Rb,function(r,n,i,o){e.push(i?o.replace(Lb,"$1"):n||r)}),e}),Jf=Nb});function Bb(t){return t==null?"":sc(t)}var jo,Da=A(()=>{ac();jo=Bb});function Kb(t,e){return me(t)?t:an(t,e)?[t]:Jf(jo(t))}var Ao,Oa=A(()=>{nt();bo();Xf();Da();Ao=Kb});function Hb(t){if(typeof t=="string"||lt(t))return t;var e=t+"";return e=="0"&&1/t==-zb?"-0":e}var zb,er,li=A(()=>{Yr();zb=1/0;er=Hb});function Vb(t,e){e=Ao(e,t);for(var r=0,n=e.length;t!=null&&r{Oa();li();fn=Vb});function Wb(t,e,r){var n=t==null?void 0:fn(t,e);return n===void 0?r:n}var Zf,ed=A(()=>{So();Zf=Wb});function $b(t,e){for(var r=-1,n=e.length,i=t.length;++r{dn=$b});function Ub(t){return me(t)||nn(t)||!!(td&&t&&t[td])}var td,rd,nd=A(()=>{_r();po();nt();td=De?De.isConcatSpreadable:void 0;rd=Ub});function id(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=rd),i||(i=[]);++o0&&r(a)?e>1?id(a,e-1,r,n,i):dn(i,a):n||(i[i.length]=a)}return i}var od,sd=A(()=>{Co();nd();od=id});var Gb,Eo,Ia=A(()=>{Ea();Gb=_o(Object.getPrototypeOf,Object),Eo=Gb});function Qb(){this.__data__=new Jt,this.size=0}var ad,ld=A(()=>{si();ad=Qb});function qb(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var ud,cd=A(()=>{ud=qb});function Yb(t){return this.__data__.get(t)}var fd,dd=A(()=>{fd=Yb});function Jb(t){return this.__data__.has(t)}var pd,hd=A(()=>{pd=Jb});function Zb(t,e){var r=this.__data__;if(r instanceof Jt){var n=r.__data__;if(!Xt||n.length{si();xo();wo();Xb=200;md=Zb});function pn(t){var e=this.__data__=new Jt(t);this.size=e.size}var tr,Fo=A(()=>{si();ld();cd();dd();hd();gd();pn.prototype.clear=ad;pn.prototype.delete=ud;pn.prototype.get=fd;pn.prototype.has=pd;pn.prototype.set=md;tr=pn});function ex(t,e){return t&&Qt(e,gt(e),t)}var yd,_d=A(()=>{ti();on();yd=ex});function tx(t,e){return t&&Qt(e,sn(e),t)}var vd,bd=A(()=>{ti();vo();vd=tx});function nx(t,e){if(e)return t.slice();var r=t.length,n=Ad?Ad(r):new t.constructor(r);return t.copy(n),n}var xd,wd,rx,jd,Ad,Sd,Cd=A(()=>{rt();xd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,wd=xd&&typeof module=="object"&&module&&!module.nodeType&&module,rx=wd&&wd.exports===xd,jd=rx?_e.Buffer:void 0,Ad=jd?jd.allocUnsafe:void 0;Sd=nx});function ix(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r{Ed=ix});function ox(){return[]}var To,Pa=A(()=>{To=ox});var sx,ax,Td,lx,hn,Do=A(()=>{Fd();Pa();sx=Object.prototype,ax=sx.propertyIsEnumerable,Td=Object.getOwnPropertySymbols,lx=Td?function(t){return t==null?[]:(t=Object(t),Ed(Td(t),function(e){return ax.call(t,e)}))}:To,hn=lx});function ux(t,e){return Qt(t,hn(t),e)}var Dd,Od=A(()=>{ti();Do();Dd=ux});var cx,fx,Oo,ka=A(()=>{Co();Ia();Do();Pa();cx=Object.getOwnPropertySymbols,fx=cx?function(t){for(var e=[];t;)dn(e,hn(t)),t=Eo(t);return e}:To,Oo=fx});function dx(t,e){return Qt(t,Oo(t),e)}var Id,Pd=A(()=>{ti();ka();Id=dx});function px(t,e,r){var n=e(t);return me(t)?n:dn(n,r(t))}var Io,Ma=A(()=>{Co();nt();Io=px});function hx(t){return Io(t,gt,hn)}var ui,Ra=A(()=>{Ma();Do();on();ui=hx});function mx(t){return Io(t,sn,Oo)}var kd,Md=A(()=>{Ma();ka();vo();kd=mx});var gx,Po,Rd=A(()=>{Ut();rt();gx=Qe(_e,"DataView"),Po=gx});var yx,ko,Ld=A(()=>{Ut();rt();yx=Qe(_e,"Promise"),ko=yx});var _x,Mo,Nd=A(()=>{Ut();rt();_x=Qe(_e,"Set"),Mo=_x});var Bd,vx,Kd,zd,Hd,Vd,bx,xx,wx,jx,Ax,xr,Pt,ci=A(()=>{Rd();xo();Ld();Nd();wc();qr();_a();Bd="[object Map]",vx="[object Object]",Kd="[object Promise]",zd="[object Set]",Hd="[object WeakMap]",Vd="[object DataView]",bx=Dt(Po),xx=Dt(Xt),wx=Dt(ko),jx=Dt(Mo),Ax=Dt(so),xr=at;(Po&&xr(new Po(new ArrayBuffer(1)))!=Vd||Xt&&xr(new Xt)!=Bd||ko&&xr(ko.resolve())!=Kd||Mo&&xr(new Mo)!=zd||so&&xr(new so)!=Hd)&&(xr=function(t){var e=at(t),r=e==vx?t.constructor:void 0,n=r?Dt(r):"";if(n)switch(n){case bx:return Vd;case xx:return Bd;case wx:return Kd;case jx:return zd;case Ax:return Hd}return e});Pt=xr});function Ex(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Cx.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Sx,Cx,Wd,$d=A(()=>{Sx=Object.prototype,Cx=Sx.hasOwnProperty;Wd=Ex});var Fx,mn,La=A(()=>{rt();Fx=_e.Uint8Array,mn=Fx});function Tx(t){var e=new t.constructor(t.byteLength);return new mn(e).set(new mn(t)),e}var gn,Ro=A(()=>{La();gn=Tx});function Dx(t,e){var r=e?gn(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Ud,Gd=A(()=>{Ro();Ud=Dx});function Ix(t){var e=new t.constructor(t.source,Ox.exec(t));return e.lastIndex=t.lastIndex,e}var Ox,Qd,qd=A(()=>{Ox=/\w*$/;Qd=Ix});function Px(t){return Jd?Object(Jd.call(t)):{}}var Yd,Jd,Xd,Zd=A(()=>{_r();Yd=De?De.prototype:void 0,Jd=Yd?Yd.valueOf:void 0;Xd=Px});function kx(t,e){var r=e?gn(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var ep,tp=A(()=>{Ro();ep=kx});function ew(t,e,r){var n=t.constructor;switch(e){case Vx:return gn(t);case Mx:case Rx:return new n(+t);case Wx:return Ud(t,r);case $x:case Ux:case Gx:case Qx:case qx:case Yx:case Jx:case Xx:case Zx:return ep(t,r);case Lx:return new n;case Nx:case zx:return new n(t);case Bx:return Qd(t);case Kx:return new n;case Hx:return Xd(t)}}var Mx,Rx,Lx,Nx,Bx,Kx,zx,Hx,Vx,Wx,$x,Ux,Gx,Qx,qx,Yx,Jx,Xx,Zx,rp,np=A(()=>{Ro();Gd();qd();Zd();tp();Mx="[object Boolean]",Rx="[object Date]",Lx="[object Map]",Nx="[object Number]",Bx="[object RegExp]",Kx="[object Set]",zx="[object String]",Hx="[object Symbol]",Vx="[object ArrayBuffer]",Wx="[object DataView]",$x="[object Float32Array]",Ux="[object Float64Array]",Gx="[object Int8Array]",Qx="[object Int16Array]",qx="[object Int32Array]",Yx="[object Uint8Array]",Jx="[object Uint8ClampedArray]",Xx="[object Uint16Array]",Zx="[object Uint32Array]";rp=ew});function tw(t){return typeof t.constructor=="function"&&!rn(t)?Ac(Eo(t)):{}}var ip,op=A(()=>{Sc();Ia();fo();ip=tw});function nw(t){return $e(t)&&Pt(t)==rw}var rw,sp,ap=A(()=>{ci();Wt();rw="[object Map]";sp=nw});var lp,iw,up,cp=A(()=>{ap();ri();mo();lp=Ot&&Ot.isMap,iw=lp?qt(lp):sp,up=iw});function sw(t){return $e(t)&&Pt(t)==ow}var ow,fp,dp=A(()=>{ci();Wt();ow="[object Set]";fp=sw});var pp,aw,hp,mp=A(()=>{dp();ri();mo();pp=Ot&&Ot.isSet,aw=pp?qt(pp):fp,hp=aw});function Lo(t,e,r,n,i,o){var s,a=e&lw,u=e&uw,l=e&cw;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!Ce(t))return t;var c=me(t);if(c){if(s=Wd(t),!a)return Fc(t,s)}else{var p=Pt(t),f=p==yp||p==mw;if(vr(t))return Sd(t,a);if(p==_p||p==gp||f&&!i){if(s=u||f?{}:ip(t),!a)return u?Id(t,vd(s,t)):Dd(t,yd(s,t))}else{if(!ae[p])return i?t:{};s=rp(t,p,a)}}o||(o=new tr);var h=o.get(t);if(h)return h;o.set(t,s),hp(t)?t.forEach(function(v){s.add(Lo(v,e,r,v,t,o))}):up(t)&&t.forEach(function(v,d){s.set(d,Lo(v,e,r,d,t,o))});var y=l?u?kd:ui:u?sn:gt,j=c?void 0:y(t);return Nc(j||t,function(v,d){j&&(d=v,v=t[d]),uo(s,d,Lo(v,e,r,d,t,o))}),s}var lw,uw,cw,gp,fw,dw,pw,hw,yp,mw,gw,yw,_p,_w,vw,bw,xw,ww,jw,Aw,Sw,Cw,Ew,Fw,Tw,Dw,Ow,Iw,Pw,ae,vp,bp=A(()=>{Fo();Bc();xa();_d();bd();Cd();Tc();Od();Pd();Ra();Md();ci();$d();np();op();nt();ho();cp();ht();mp();on();vo();lw=1,uw=2,cw=4,gp="[object Arguments]",fw="[object Array]",dw="[object Boolean]",pw="[object Date]",hw="[object Error]",yp="[object Function]",mw="[object GeneratorFunction]",gw="[object Map]",yw="[object Number]",_p="[object Object]",_w="[object RegExp]",vw="[object Set]",bw="[object String]",xw="[object Symbol]",ww="[object WeakMap]",jw="[object ArrayBuffer]",Aw="[object DataView]",Sw="[object Float32Array]",Cw="[object Float64Array]",Ew="[object Int8Array]",Fw="[object Int16Array]",Tw="[object Int32Array]",Dw="[object Uint8Array]",Ow="[object Uint8ClampedArray]",Iw="[object Uint16Array]",Pw="[object Uint32Array]",ae={};ae[gp]=ae[fw]=ae[jw]=ae[Aw]=ae[dw]=ae[pw]=ae[Sw]=ae[Cw]=ae[Ew]=ae[Fw]=ae[Tw]=ae[gw]=ae[yw]=ae[_p]=ae[_w]=ae[vw]=ae[bw]=ae[xw]=ae[Dw]=ae[Ow]=ae[Iw]=ae[Pw]=!0;ae[hw]=ae[yp]=ae[ww]=!1;vp=Lo});function Rw(t){return vp(t,kw|Mw)}var kw,Mw,fi,xp=A(()=>{bp();kw=1,Mw=4;fi=Rw});function Nw(t){return this.__data__.set(t,Lw),this}var Lw,wp,jp=A(()=>{Lw="__lodash_hash_undefined__";wp=Nw});function Bw(t){return this.__data__.has(t)}var Ap,Sp=A(()=>{Ap=Bw});function No(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new br;++e{wo();jp();Sp();No.prototype.add=No.prototype.push=wp;No.prototype.has=Ap;Cp=No});function Kw(t,e){for(var r=-1,n=t==null?0:t.length;++r{Fp=Kw});function zw(t,e){return t.has(e)}var Dp,Op=A(()=>{Dp=zw});function Ww(t,e,r,n,i,o){var s=r&Hw,a=t.length,u=e.length;if(a!=u&&!(s&&u>a))return!1;var l=o.get(t),c=o.get(e);if(l&&c)return l==e&&c==t;var p=-1,f=!0,h=r&Vw?new Cp:void 0;for(o.set(t,e),o.set(e,t);++p{Ep();Tp();Op();Hw=1,Vw=2;Bo=Ww});function $w(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var Ip,Pp=A(()=>{Ip=$w});function Uw(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var kp,Mp=A(()=>{kp=Uw});function s0(t,e,r,n,i,o,s){switch(r){case o0:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case i0:return!(t.byteLength!=e.byteLength||!o(new mn(t),new mn(e)));case qw:case Yw:case Zw:return Gt(+t,+e);case Jw:return t.name==e.name&&t.message==e.message;case e0:case r0:return t==e+"";case Xw:var a=Ip;case t0:var u=n&Gw;if(a||(a=kp),t.size!=e.size&&!u)return!1;var l=s.get(t);if(l)return l==e;n|=Qw,s.set(t,e);var c=Bo(a(t),a(e),n,i,o,s);return s.delete(t),c;case n0:if(Ba)return Ba.call(t)==Ba.call(e)}return!1}var Gw,Qw,qw,Yw,Jw,Xw,Zw,e0,t0,r0,n0,i0,o0,Rp,Ba,Lp,Np=A(()=>{_r();La();ei();Na();Pp();Mp();Gw=1,Qw=2,qw="[object Boolean]",Yw="[object Date]",Jw="[object Error]",Xw="[object Map]",Zw="[object Number]",e0="[object RegExp]",t0="[object Set]",r0="[object String]",n0="[object Symbol]",i0="[object ArrayBuffer]",o0="[object DataView]",Rp=De?De.prototype:void 0,Ba=Rp?Rp.valueOf:void 0;Lp=s0});function c0(t,e,r,n,i,o){var s=r&a0,a=ui(t),u=a.length,l=ui(e),c=l.length;if(u!=c&&!s)return!1;for(var p=u;p--;){var f=a[p];if(!(s?f in e:u0.call(e,f)))return!1}var h=o.get(t),y=o.get(e);if(h&&y)return h==e&&y==t;var j=!0;o.set(t,e),o.set(e,t);for(var v=s;++p{Ra();a0=1,l0=Object.prototype,u0=l0.hasOwnProperty;Bp=c0});function p0(t,e,r,n,i,o){var s=me(t),a=me(e),u=s?Hp:Pt(t),l=a?Hp:Pt(e);u=u==zp?Ko:u,l=l==zp?Ko:l;var c=u==Ko,p=l==Ko,f=u==l;if(f&&vr(t)){if(!vr(e))return!1;s=!0,c=!1}if(f&&!c)return o||(o=new tr),s||go(t)?Bo(t,e,r,n,i,o):Lp(t,e,u,r,n,i,o);if(!(r&f0)){var h=c&&Vp.call(t,"__wrapped__"),y=p&&Vp.call(e,"__wrapped__");if(h||y){var j=h?t.value():t,v=y?e.value():e;return o||(o=new tr),i(j,v,r,n,o)}}return f?(o||(o=new tr),Bp(t,e,r,n,i,o)):!1}var f0,zp,Hp,Ko,d0,Vp,Wp,$p=A(()=>{Fo();Na();Np();Kp();ci();nt();ho();Sa();f0=1,zp="[object Arguments]",Hp="[object Array]",Ko="[object Object]",d0=Object.prototype,Vp=d0.hasOwnProperty;Wp=p0});function Up(t,e,r,n,i){return t===e?!0:t==null||e==null||!$e(t)&&!$e(e)?t!==t&&e!==e:Wp(t,e,r,n,Up,i)}var zo,Ka=A(()=>{$p();Wt();zo=Up});function g0(t,e,r,n){var i=r.length,o=i,s=!n;if(t==null)return!o;for(t=Object(t);i--;){var a=r[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i{Fo();Ka();h0=1,m0=2;Gp=g0});function y0(t){return t===t&&!Ce(t)}var Ho,za=A(()=>{ht();Ho=y0});function _0(t){for(var e=gt(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Ho(i)]}return e}var qp,Yp=A(()=>{za();on();qp=_0});function v0(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Vo,Ha=A(()=>{Vo=v0});function b0(t){var e=qp(t);return e.length==1&&e[0][2]?Vo(e[0][0],e[0][1]):function(r){return r===t||Gp(r,t,e)}}var Jp,Xp=A(()=>{Qp();Yp();Ha();Jp=b0});function x0(t,e){return t!=null&&e in Object(t)}var Zp,eh=A(()=>{Zp=x0});function w0(t,e,r){e=Ao(e,t);for(var n=-1,i=e.length,o=!1;++n{Oa();po();nt();ao();co();li();th=w0});function j0(t,e){return t!=null&&th(t,e,Zp)}var nh,ih=A(()=>{eh();rh();nh=j0});function C0(t,e){return an(t)&&Ho(e)?Vo(er(t),e):function(r){var n=Zf(r,t);return n===void 0&&n===e?nh(r,t):zo(e,n,A0|S0)}}var A0,S0,oh,sh=A(()=>{Ka();ed();ih();bo();za();Ha();li();A0=1,S0=2;oh=C0});function E0(t){return function(e){return e==null?void 0:e[t]}}var ah,lh=A(()=>{ah=E0});function F0(t){return function(e){return fn(e,t)}}var uh,ch=A(()=>{So();uh=F0});function T0(t){return an(t)?ah(er(t)):uh(t)}var fh,dh=A(()=>{lh();ch();bo();li();fh=T0});function D0(t){return typeof t=="function"?t:t==null?$t:typeof t=="object"?me(t)?oh(t[0],t[1]):Jp(t):fh(t)}var ph,hh=A(()=>{Xp();sh();Zn();nt();dh();ph=D0});function O0(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++i];if(r(o[u],u,o)===!1)break}return e}}var mh,gh=A(()=>{mh=O0});var I0,yh,_h=A(()=>{gh();I0=mh(),yh=I0});function P0(t,e){return t&&yh(t,e,gt)}var vh,bh=A(()=>{_h();on();vh=P0});function k0(t,e){return function(r,n){if(r==null)return r;if(!mt(r))return t(r,n);for(var i=r.length,o=e?i:-1,s=Object(r);(e?o--:++o{tn();xh=k0});var M0,jh,Ah=A(()=>{bh();wh();M0=xh(vh),jh=M0});var R0,Wo,Sh=A(()=>{rt();R0=function(){return _e.Date.now()},Wo=R0});function K0(t,e,r){var n,i,o,s,a,u,l=0,c=!1,p=!1,f=!0;if(typeof t!="function")throw new TypeError(L0);e=ga(e)||0,Ce(r)&&(c=!!r.leading,p="maxWait"in r,o=p?N0(ga(r.maxWait)||0,e):o,f="trailing"in r?!!r.trailing:f);function h(_){var w=n,S=i;return n=i=void 0,l=_,s=t.apply(S,w),s}function y(_){return l=_,a=setTimeout(d,e),c?h(_):s}function j(_){var w=_-u,S=_-l,E=e-w;return p?B0(E,o-S):E}function v(_){var w=_-u,S=_-l;return u===void 0||w>=e||w<0||p&&S>=o}function d(){var _=Wo();if(v(_))return b(_);a=setTimeout(d,j(_))}function b(_){return a=void 0,f&&n?h(_):(n=i=void 0,s)}function m(){a!==void 0&&clearTimeout(a),l=0,n=u=i=a=void 0}function g(){return a===void 0?s:b(Wo())}function x(){var _=Wo(),w=v(_);if(n=arguments,i=this,u=_,w){if(a===void 0)return y(u);if(p)return clearTimeout(a),a=setTimeout(d,e),h(u)}return a===void 0&&(a=setTimeout(d,e)),s}return x.cancel=m,x.flush=g,x}var L0,N0,B0,Va,Ch=A(()=>{ht();Sh();pc();L0="Expected a function",N0=Math.max,B0=Math.min;Va=K0});function H0(t){return t=jo(t),t&&z0.test(t)?t.replace(Eh,"\\$&"):t}var Eh,z0,wr,Fh=A(()=>{Da();Eh=/[\\^$.*+?()[\]{}|]/g,z0=RegExp(Eh.source);wr=H0});function V0(t,e){var r=-1,n=mt(t)?Array(t.length):[];return jh(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var Th,Dh=A(()=>{Ah();tn();Th=V0});function W0(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var Oh,Ih=A(()=>{Oh=W0});function $0(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,o=lt(t),s=e!==void 0,a=e===null,u=e===e,l=lt(e);if(!a&&!l&&!o&&t>e||o&&s&&u&&!a&&!l||n&&s&&u||!r&&u||!i)return 1;if(!n&&!o&&!l&&t{Yr();Ph=$0});function U0(t,e,r){for(var n=-1,i=t.criteria,o=e.criteria,s=i.length,a=r.length;++n=a)return u;var l=r[n];return u*(l=="desc"?-1:1)}}return t.index-e.index}var Mh,Rh=A(()=>{kh();Mh=U0});function G0(t,e,r){e.length?e=Jr(e,function(o){return me(o)?function(s){return fn(s,o.length===1?o[0]:o)}:o}):e=[$t];var n=-1;e=Jr(e,qt(ph));var i=Th(t,function(o,s,a){var u=Jr(e,function(l){return l(o)});return{criteria:u,index:++n,value:o}});return Oh(i,function(o,s){return Mh(o,s,r)})}var Lh,Nh=A(()=>{ma();So();hh();Dh();Ih();ri();Rh();Zn();nt();Lh=G0});var Q0,Wa,Bh=A(()=>{sd();Nh();Wc();$c();Q0=Vc(function(t,e){if(t==null)return[];var r=e.length;return r>1&&wa(t,e[0],e[1])?e=[]:r>2&&wa(e[0],e[1],e[2])&&(e=[e[0]]),Lh(t,od(e,1),[])}),Wa=Q0});var yn=A(()=>{xp();Ch();Fh();Bh();});function yt(t,e){if(!e.length)return t;try{let r=new RegExp(e.map(i=>`\\b${wr(i.match)}\\b${/[a-zA-Z]/.test(i.match)?"":`|${wr(i.match)}`}`).join("|"),"giu"),n=i=>e.find(s=>i.match(new RegExp(`\\b${wr(s.match)}\\b${/[a-zA-Z]/.test(s.match)?"":`|${wr(s.match)}`}`,"giu")))?`${i}`:i;return t.replace(r,n)}catch(r){return console.error("Omnisearch - Error in highlightText()",r),t}}function q0(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function _n(t){if(!t.length)return/^$/g;t.sort((r,n)=>n.length-r.length);let e=`(${t.map(r=>wr(r)).join("|")})`;return new RegExp(`${e}`,"gui")}function di(t,e,r){let n=new RegExp(fa,"gu"),i=t;t=t.toLowerCase().replace(n," "),T.ignoreDiacritics&&(t=Ft(t));let o=new Date().getTime(),s=null,a=[],u=0;for(;(s=e.exec(t))!==null;){if(++u>=100||new Date().getTime()-o>50){$u("Stopped getMatches at",u,"results");break}let l=s.index,c=l+s[0].length,p=i.substring(l,c).trim();p&&s.index>=0&&a.push({match:p,offset:s.index})}if(r&&(r.query.text.length>1||r.getExactTerms().length>0)){let l=t.indexOf(r.getBestStringForExcerpt());l>-1&&a.find(c=>c.offset===l)&&(a=a.filter(c=>c.offset!==l),a.unshift({offset:l,match:r.getBestStringForExcerpt()}))}return a}function vn(t,e){try{let r=e??-1,n=Math.max(0,r-Fu),i=Math.min(t.length,r+Qn);if(r>-1?t=(n>0?"\u2026":"")+t.slice(n,i).trim()+(ia).join(` `);let s=t.lastIndexOf(` `,r-n);s>0&&(t=t.slice(s))}return t=q0(t),T.renderLineReturnInExcerpts&&(t=t.trim().replaceAll(` `,"
")),{content:t,offset:r}}catch(r){return new Kh.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(r),{content:"",offset:-1}}}var Kh,jr=A(()=>{st();et();Tt();Kh=ve(require("obsidian"));yn()});var Xh=gi(Go=>{Go.parse=function(t,e){if(e?e.offsets=typeof e.offsets=="undefined"?!0:e.offsets:e={offsets:!0},t||(t=""),t.indexOf(":")===-1&&!e.tokenize)return t;if(!e.keywords&&!e.ranges&&!e.tokenize)return t;var r={text:[]};e.offsets&&(r.offsets=[]);for(var n={},i=[],o=/(\S+:'(?:[^'\\]|\\.)*')|(\S+:"(?:[^"\\]|\\.)*")|(-?"(?:[^"\\]|\\.)*")|(-?'(?:[^'\\]|\\.)*')|\S+|\S+:\S+/g,s;(s=o.exec(t))!==null;){var f=s[0],a=f.indexOf(":");if(a!==-1){var u=f.split(":"),l=f.slice(0,a),c=f.slice(a+1);c=c.replace(/^\"|\"$|^\'|\'$/g,""),c=(c+"").replace(/\\(.?)/g,function(_,w){switch(w){case"\\":return"\\";case"0":return"\0";case"":return"";default:return w}}),i.push({keyword:l,value:c,offsetStart:s.index,offsetEnd:s.index+f.length})}else{var p=!1;f[0]==="-"&&(p=!0,f=f.slice(1)),f=f.replace(/^\"|\"$|^\'|\'$/g,""),f=(f+"").replace(/\\(.?)/g,function(_,w){switch(w){case"\\":return"\\";case"0":return"\0";case"":return"";default:return w}}),p?n.text?(n.text instanceof Array||(n.text=[n.text]),n.text.push(f)):n.text=f:i.push({text:f,offsetStart:s.index,offsetEnd:s.index+f.length})}}i.reverse();for(var f;f=i.pop();)if(f.text)r.text.push(f.text),e.offsets&&r.offsets.push(f);else{var l=f.keyword;e.keywords=e.keywords||[];var h=!1,y=!1;if(!/^-/.test(l))h=e.keywords.indexOf(l)!==-1;else if(l[0]==="-"){var j=l.slice(1);h=e.keywords.indexOf(j)!==-1,h&&(l=j,y=!0)}e.ranges=e.ranges||[];var v=e.ranges.indexOf(l)!==-1;if(h){e.offsets&&r.offsets.push({keyword:l,value:f.value,offsetStart:y?f.offsetStart+1:f.offsetStart,offsetEnd:f.offsetEnd});var d=f.value;if(d.length){var b=d.split(",");y?n[l]?n[l]instanceof Array?b.length>1?n[l]=n[l].concat(b):n[l].push(d):(n[l]=[n[l]],n[l].push(d)):b.length>1?n[l]=b:e.alwaysArray?n[l]=[d]:n[l]=d:r[l]?r[l]instanceof Array?b.length>1?r[l]=r[l].concat(b):r[l].push(d):(r[l]=[r[l]],r[l].push(d)):b.length>1?r[l]=b:e.alwaysArray?r[l]=[d]:r[l]=d}}else if(v){e.offsets&&r.offsets.push(f);var d=f.value,m=d.split("-");r[l]={},m.length===2?(r[l].from=m[0],r[l].to=m[1]):!m.length%2||(r[l].from=d)}else{var g=f.keyword+":"+f.value;r.text.push(g),e.offsets&&r.offsets.push({text:g,offsetStart:f.offsetStart,offsetEnd:f.offsetEnd})}}return r.text.length?e.tokenize||(r.text=r.text.join(" ").trim()):delete r.text,r.exclude=n,r};Go.stringify=function(t,e,r){if(e||(e={offsets:!0}),!t)return"";if(typeof t=="string")return t;if(Array.isArray(t))return t.join(" ");if(!Object.keys(t).length)return"";if(Object.keys(t).length===3&&!!t.text&&!!t.offsets&&!!t.exclude&&typeof t.text=="string")return t.text;r||(r="");var n=function(a){return a.indexOf(" ")>-1?JSON.stringify(a):a},i=function(a){return r+a},o=[];if(t.text){var s=[];typeof t.text=="string"?s.push(t.text):s.push.apply(s,t.text),s.length>0&&o.push(s.map(n).map(i).join(" "))}return e.keywords&&e.keywords.forEach(function(a){if(!!t[a]){var u=[];typeof t[a]=="string"?u.push(t[a]):u.push.apply(u,t[a]),u.length>0&&o.push(i(a+":"+u.map(n).join(",")))}}),e.ranges&&e.ranges.forEach(function(a){if(!!t[a]){var u=t[a].from,l=t[a].to;l&&(u=u+"-"+l),u&&o.push(i(a+":"+u))}}),t.exclude&&Object.keys(t.exclude).length>0&&o.push(Go.stringify(t.exclude,e,"-")),o.join(" ")}});var em=gi((hP,Zh)=>{Zh.exports=Xh()});var tm,Ua,Ar,Qo=A(()=>{et();Tt();tm=ve(em()),Ua=["ext","path"],Ar=class{#e;constructor(e=""){T.ignoreDiacritics&&(e=Ft(e));let r=(0,tm.parse)(e.toLowerCase(),{tokenize:!0,keywords:Ua});r.text=r.text??[],r.exclude=r.exclude??{},r.exclude.text=r.exclude.text??[],Array.isArray(r.exclude.text)||(r.exclude.text=[r.exclude.text]),r.exclude.text=r.exclude.text.filter(i=>i.length);for(let i of Ua){let o=r[i];o&&(r[i]=Array.isArray(o)?o:[o]);let s=r.exclude[i];s&&(r.exclude[i]=Array.isArray(s)?s:[s])}this.query=r;let n=this.query.text.filter(i=>i.startsWith(".")).map(i=>i.slice(1));this.query.ext=[...new Set([...n,...this.query.ext??[]])],this.query.text=this.query.text.filter(i=>!i.startsWith(".")),this.#e=e.match(/"([^"]+)"/g)?.map(i=>i.replace(/"/g,""))??[]}isEmpty(){for(let e of Ua)if(this.query[e]?.length||this.query.text.length)return!1;return!0}segmentsToStr(){return this.query.text.join(" ")}getTags(){return this.query.text.filter(e=>e.startsWith("#"))}getTagsWithoutHashtag(){return this.getTags().map(e=>e.replace(/^#/,""))}getExactTerms(){return[...new Set([...this.query.text.filter(e=>e.split(" ").length>1),...this.#e].map(e=>e.toLowerCase()))]}getBestStringForExcerpt(){return this.#e.length?this.#e.sort((e,r)=>r.length-e.length)[0]??"":this.segmentsToStr()}}});function n1(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(c){try{l(n.next(c))}catch(p){s(p)}}function u(c){try{l(n.throw(c))}catch(p){s(p)}}function l(c){c.done?o(c.value):i(c.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function i1(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(r=0)),r;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function xe(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o}var pe,o1,rm,nm,Me,Ga,bn,s1,im,Qa,qo,qa,Ya,a1,om,sm,Ja,pi,Xa,am,l1,Za,el,u1,c1,f1,d1,tl,lm,p1,rl,nl,il,h1,um,cm,fm,Yo,m1,dm=A(()=>{pe=function(){return pe=Object.assign||function(e){for(var r,n=1,i=arguments.length;n0?[{node:n,keys:i}]:[]}return t.prototype.next=function(){var e=this.dive();return this.backtrack(),e},t.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=bn(this._path),r=e.node,n=e.keys;if(bn(n)===Me)return{done:!1,value:this.result()};var i=r.get(bn(n));return this._path.push({node:i,keys:Array.from(i.keys())}),this.dive()},t.prototype.backtrack=function(){if(this._path.length!==0){var e=bn(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},t.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var r=e.keys;return bn(r)}).filter(function(e){return e!==Me}).join("")},t.prototype.value=function(){return bn(this._path).node.get(Me)},t.prototype.result=function(){switch(this._type){case nm:return this.value();case rm:return this.key();default:return[this.key(),this.value()]}},t.prototype[Symbol.iterator]=function(){return this},t}(),bn=function(t){return t[t.length-1]},s1=function(t,e,r){var n=new Map;if(e===void 0)return n;for(var i=e.length+1,o=i+r,s=new Uint8Array(o*i).fill(r+1),a=0;ar)continue e}im(t.get(h),e,r,n,i,j,s,a+h)}}}catch(k){u={error:k}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(u)throw u.error}}},Qa=function(){function t(e,r){e===void 0&&(e=new Map),r===void 0&&(r=""),this._size=void 0,this._tree=e,this._prefix=r}return t.prototype.atPrefix=function(e){var r,n;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var i=xe(qo(this._tree,e.slice(this._prefix.length)),2),o=i[0],s=i[1];if(o===void 0){var a=xe(Ja(s),2),u=a[0],l=a[1];try{for(var c=q(u.keys()),p=c.next();!p.done;p=c.next()){var f=p.value;if(f!==Me&&f.startsWith(l)){var h=new Map;return h.set(f.slice(l.length),u.get(f)),new t(h,e)}}}catch(y){r={error:y}}finally{try{p&&!p.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}return new t(o,e)},t.prototype.clear=function(){this._size=void 0,this._tree.clear()},t.prototype.delete=function(e){return this._size=void 0,a1(this._tree,e)},t.prototype.entries=function(){return new Ga(this,o1)},t.prototype.forEach=function(e){var r,n;try{for(var i=q(this),o=i.next();!o.done;o=i.next()){var s=xe(o.value,2),a=s[0],u=s[1];e(a,u,this)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.fuzzyGet=function(e,r){return s1(this._tree,e,r)},t.prototype.get=function(e){var r=qa(this._tree,e);return r!==void 0?r.get(Me):void 0},t.prototype.has=function(e){var r=qa(this._tree,e);return r!==void 0&&r.has(Me)},t.prototype.keys=function(){return new Ga(this,rm)},t.prototype.set=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Ya(this._tree,e);return n.set(Me,r),this},Object.defineProperty(t.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),t.prototype.update=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Ya(this._tree,e);return n.set(Me,r(n.get(Me))),this},t.prototype.fetch=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Ya(this._tree,e),i=n.get(Me);return i===void 0&&n.set(Me,i=r()),i},t.prototype.values=function(){return new Ga(this,nm)},t.prototype[Symbol.iterator]=function(){return this.entries()},t.from=function(e){var r,n,i=new t;try{for(var o=q(e),s=o.next();!s.done;s=o.next()){var a=xe(s.value,2),u=a[0],l=a[1];i.set(u,l)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},t.fromObject=function(e){return t.from(Object.entries(e))},t}(),qo=function(t,e,r){var n,i;if(r===void 0&&(r=[]),e.length===0||t==null)return[t,r];try{for(var o=q(t.keys()),s=o.next();!s.done;s=o.next()){var a=s.value;if(a!==Me&&e.startsWith(a))return r.push([t,a]),qo(t.get(a),e.slice(a.length),r)}}catch(u){n={error:u}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r.push([t,e]),qo(void 0,"",r)},qa=function(t,e){var r,n;if(e.length===0||t==null)return t;try{for(var i=q(t.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;if(s!==Me&&e.startsWith(s))return qa(t.get(s),e.slice(s.length))}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},Ya=function(t,e){var r,n,i=e.length;e:for(var o=0;t&&o0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Qa,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},t.prototype.discard=function(e){var r=this,n=this._idToShortId.get(e);if(n==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach(function(i,o){r.removeFieldLength(n,o,r._documentCount,i)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},t.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,r=e.minDirtFactor,n=e.minDirtCount,i=e.batchSize,o=e.batchWait;this.conditionalVacuum({batchSize:i,batchWait:o},{minDirtCount:n,minDirtFactor:r})}},t.prototype.discardAll=function(e){var r,n,i=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var o=q(e),s=o.next();!s.done;s=o.next()){var a=s.value;this.discard(a)}}catch(u){r={error:u}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}finally{this._options.autoVacuum=i}this.maybeAutoVacuum()},t.prototype.replace=function(e){var r=this._options,n=r.idField,i=r.extractField,o=i(e,n);this.discard(o),this.add(e)},t.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},t.prototype.conditionalVacuum=function(e,r){var n=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var i=n._enqueuedVacuumConditions;return n._enqueuedVacuumConditions=nl,n.performVacuuming(e,i)}),this._enqueuedVacuum)):this.vacuumConditionsMet(r)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},t.prototype.performVacuuming=function(e,r){return n1(this,void 0,void 0,function(){var n,i,o,s,a,u,l,c,p,f,h,y,j,v,d,b,m,g,x,_,w,S,E,D,O;return i1(this,function(L){switch(L.label){case 0:if(n=this._dirtCount,!this.vacuumConditionsMet(r))return[3,10];i=e.batchSize||rl.batchSize,o=e.batchWait||rl.batchWait,s=1,L.label=1;case 1:L.trys.push([1,7,8,9]),a=q(this._index),u=a.next(),L.label=2;case 2:if(u.done)return[3,6];l=xe(u.value,2),c=l[0],p=l[1];try{for(f=(S=void 0,q(p)),h=f.next();!h.done;h=f.next()){y=xe(h.value,2),j=y[0],v=y[1];try{for(d=(D=void 0,q(v)),b=d.next();!b.done;b=d.next())m=xe(b.value,1),g=m[0],!this._documentIds.has(g)&&(v.size<=1?p.delete(j):v.delete(g))}catch(k){D={error:k}}finally{try{b&&!b.done&&(O=d.return)&&O.call(d)}finally{if(D)throw D.error}}}}catch(k){S={error:k}}finally{try{h&&!h.done&&(E=f.return)&&E.call(f)}finally{if(S)throw S.error}}return this._index.get(c).size===0&&this._index.delete(c),s%i!=0?[3,4]:[4,new Promise(function(k){return setTimeout(k,o)})];case 3:L.sent(),L.label=4;case 4:s+=1,L.label=5;case 5:return u=a.next(),[3,2];case 6:return[3,9];case 7:return x=L.sent(),_={error:x},[3,9];case 8:try{u&&!u.done&&(w=a.return)&&w.call(a)}finally{if(_)throw _.error}return[7];case 9:this._dirtCount-=n,L.label=10;case 10:return[4,null];case 11:return L.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},t.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var r=e.minDirtCount,n=e.minDirtFactor;return r=r||il.minDirtCount,n=n||il.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=n},Object.defineProperty(t.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),t.prototype.has=function(e){return this._idToShortId.has(e)},t.prototype.search=function(e,r){var n,i;r===void 0&&(r={});var o=this.executeQuery(e,r),s=[];try{for(var a=q(o),u=a.next();!u.done;u=a.next()){var l=xe(u.value,2),c=l[0],p=l[1],f=p.score,h=p.terms,y=p.match,j=h.length,v={id:this._documentIds.get(c),score:f*j,terms:Object.keys(y),match:y};Object.assign(v,this._storedFields.get(c)),(r.filter==null||r.filter(v))&&s.push(v)}}catch(d){n={error:d}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s.sort(cm),s},t.prototype.autoSuggest=function(e,r){var n,i,o,s;r===void 0&&(r={}),r=pe(pe({},this._options.autoSuggestOptions),r);var a=new Map;try{for(var u=q(this.search(e,r)),l=u.next();!l.done;l=u.next()){var c=l.value,p=c.score,f=c.terms,h=f.join(" "),y=a.get(h);y!=null?(y.score+=p,y.count+=1):a.set(h,{score:p,terms:f,count:1})}}catch(x){n={error:x}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}var j=[];try{for(var v=q(a),d=v.next();!d.done;d=v.next()){var b=xe(d.value,2),y=b[0],m=b[1],p=m.score,f=m.terms,g=m.count;j.push({suggestion:y,terms:f,score:p/g})}}catch(x){o={error:x}}finally{try{d&&!d.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}return j.sort(cm),j},Object.defineProperty(t.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),t.loadJSON=function(e,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),r)},t.getDefault=function(e){if(tl.hasOwnProperty(e))return el(tl,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},t.loadJS=function(e,r){var n,i,o,s,a,u,l=e.index,c=e.documentCount,p=e.nextId,f=e.documentIds,h=e.fieldIds,y=e.fieldLength,j=e.averageFieldLength,v=e.storedFields,d=e.dirtCount,b=e.serializationVersion;if(b!==1&&b!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var m=new t(r);m._documentCount=c,m._nextId=p,m._documentIds=Yo(f),m._idToShortId=new Map,m._fieldIds=h,m._fieldLength=Yo(y),m._avgFieldLength=j,m._storedFields=Yo(v),m._dirtCount=d||0,m._index=new Qa;try{for(var g=q(m._documentIds),x=g.next();!x.done;x=g.next()){var _=xe(x.value,2),w=_[0],S=_[1];m._idToShortId.set(S,w)}}catch(F){n={error:F}}finally{try{x&&!x.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}try{for(var E=q(l),D=E.next();!D.done;D=E.next()){var O=xe(D.value,2),L=O[0],k=O[1],H=new Map;try{for(var X=(a=void 0,q(Object.keys(k))),Y=X.next();!Y.done;Y=X.next()){var J=Y.value,C=k[J];b===1&&(C=C.ds),H.set(parseInt(J,10),Yo(C))}}catch(F){a={error:F}}finally{try{Y&&!Y.done&&(u=X.return)&&u.call(X)}finally{if(a)throw a.error}}m._index.set(L,H)}}catch(F){o={error:F}}finally{try{D&&!D.done&&(s=E.return)&&s.call(E)}finally{if(o)throw o.error}}return m},t.prototype.executeQuery=function(e,r){var n=this;if(r===void 0&&(r={}),typeof e!="string"){var i=pe(pe(pe({},r),e),{queries:void 0}),o=e.queries.map(function(v){return n.executeQuery(v,i)});return this.combineResults(o,e.combineWith)}var s=this._options,a=s.tokenize,u=s.processTerm,l=s.searchOptions,c=pe(pe({tokenize:a,processTerm:u},l),r),p=c.tokenize,f=c.processTerm,h=p(e).flatMap(function(v){return f(v)}).filter(function(v){return!!v}),y=h.map(d1(c)),j=y.map(function(v){return n.executeQuerySpec(v,c)});return this.combineResults(j,c.combineWith)},t.prototype.executeQuerySpec=function(e,r){var n,i,o,s,a=pe(pe({},this._options.searchOptions),r),u=(a.fields||this._options.fields).reduce(function(J,C){var F;return pe(pe({},J),(F={},F[C]=el(J,C)||1,F))},a.boost||{}),l=a.boostDocument,c=a.weights,p=a.maxFuzzy,f=a.bm25,h=pe(pe({},lm.weights),c),y=h.fuzzy,j=h.prefix,v=this._index.get(e.term),d=this.termResults(e.term,e.term,1,v,u,l,f),b,m;if(e.prefix&&(b=this._index.atPrefix(e.term)),e.fuzzy){var g=e.fuzzy===!0?.2:e.fuzzy,x=g<1?Math.min(p,Math.round(e.term.length*g)):g;x&&(m=this._index.fuzzyGet(e.term,x))}if(b)try{for(var _=q(b),w=_.next();!w.done;w=_.next()){var S=xe(w.value,2),E=S[0],D=S[1],O=E.length-e.term.length;if(!!O){m==null||m.delete(E);var L=j*E.length/(E.length+.3*O);this.termResults(e.term,E,L,D,u,l,f,d)}}}catch(J){n={error:J}}finally{try{w&&!w.done&&(i=_.return)&&i.call(_)}finally{if(n)throw n.error}}if(m)try{for(var k=q(m.keys()),H=k.next();!H.done;H=k.next()){var E=H.value,X=xe(m.get(E),2),Y=X[0],O=X[1];if(!!O){var L=y*E.length/(E.length+O);this.termResults(e.term,E,L,Y,u,l,f,d)}}}catch(J){o={error:J}}finally{try{H&&!H.done&&(s=k.return)&&s.call(k)}finally{if(o)throw o.error}}return d},t.prototype.combineResults=function(e,r){if(r===void 0&&(r=Xa),e.length===0)return new Map;var n=r.toLowerCase();return e.reduce(u1[n])||new Map},t.prototype.toJSON=function(){var e,r,n,i,o=[];try{for(var s=q(this._index),a=s.next();!a.done;a=s.next()){var u=xe(a.value,2),l=u[0],c=u[1],p={};try{for(var f=(n=void 0,q(c)),h=f.next();!h.done;h=f.next()){var y=xe(h.value,2),j=y[0],v=y[1];p[j]=Object.fromEntries(v)}}catch(d){n={error:d}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}o.push([l,p])}}catch(d){e={error:d}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:o,serializationVersion:2}},t.prototype.termResults=function(e,r,n,i,o,s,a,u){var l,c,p,f,h;if(u===void 0&&(u=new Map),i==null)return u;try{for(var y=q(Object.keys(o)),j=y.next();!j.done;j=y.next()){var v=j.value,d=o[v],b=this._fieldIds[v],m=i.get(b);if(m!=null){var g=m.size,x=this._avgFieldLength[b];try{for(var _=(p=void 0,q(m.keys())),w=_.next();!w.done;w=_.next()){var S=w.value;if(!this._documentIds.has(S)){this.removeTerm(b,S,r),g-=1;continue}var E=s?s(this._documentIds.get(S),r):1;if(!!E){var D=m.get(S),O=this._fieldLength.get(S)[b],L=f1(D,g,this._documentCount,O,x,a),k=n*d*E*L,H=u.get(S);if(H){H.score+=k,h1(H.terms,e);var X=el(H.match,r);X?X.push(v):H.match[r]=[v]}else u.set(S,{score:k,terms:[e],match:(h={},h[r]=[v],h)})}}}catch(Y){p={error:Y}}finally{try{w&&!w.done&&(f=_.return)&&f.call(_)}finally{if(p)throw p.error}}}}}catch(Y){l={error:Y}}finally{try{j&&!j.done&&(c=y.return)&&c.call(y)}finally{if(l)throw l.error}}return u},t.prototype.addTerm=function(e,r,n){var i=this._index.fetch(n,fm),o=i.get(e);if(o==null)o=new Map,o.set(r,1),i.set(e,o);else{var s=o.get(r);o.set(r,(s||0)+1)}},t.prototype.removeTerm=function(e,r,n){if(!this._index.has(n)){this.warnDocumentChanged(r,e,n);return}var i=this._index.fetch(n,fm),o=i.get(e);o==null||o.get(r)==null?this.warnDocumentChanged(r,e,n):o.get(r)<=1?o.size<=1?i.delete(e):o.delete(r):o.set(r,o.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)},t.prototype.warnDocumentChanged=function(e,r,n){var i,o;try{for(var s=q(Object.keys(this._fieldIds)),a=s.next();!a.done;a=s.next()){var u=a.value;if(this._fieldIds[u]===r){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(n,'" was not present in field "').concat(u,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(l){i={error:l}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}},t.prototype.addDocumentId=function(e){var r=this._nextId;return this._idToShortId.set(e,r),this._documentIds.set(r,e),this._documentCount+=1,this._nextId+=1,r},t.prototype.addFields=function(e){for(var r=0;r{dm();st();et();Tt();pm=ve(require("obsidian"));Qr();yn();jr();g1=t=>{let e=t.split(Iu),r=t.split(qn);r=[...r,...r.flatMap(Wu)],r=[...r,...r.flatMap(Vu)],r=[...r,...e];let n=Ou();if(n){let i=r.flatMap(o=>Eu.test(o)?n.cut(o):[o]);r=[...r,...i]}return r=[...new Set(r)],r},Jo=class{constructor(){this.indexedDocuments=new Map;this.minisearch=new Za(Jo.options)}async loadCache(){let e=await Se.getMinisearchCache();return e?(this.minisearch=Za.loadJS(e.data,Jo.options),this.indexedDocuments=new Map(e.paths.map(r=>[r.path,r.mtime])),!0):(console.log("Omnisearch - No cache found"),!1)}getDiff(e){let r=new Map(e.map(o=>[o.path,o.mtime])),n=e.filter(o=>!this.indexedDocuments.has(o.path)||this.indexedDocuments.get(o.path)!==o.mtime),i=[...this.indexedDocuments].filter(([o,s])=>!r.has(o)||r.get(o)!==s).map(o=>({path:o[0],mtime:o[1]}));return{toAdd:n,toRemove:i}}async addFromPaths(e){he("Adding files",e);let r=(await Promise.all(e.map(async i=>await Se.getDocument(i)))).filter(i=>!!i?.path);he("Sorting documents to first index markdown"),r=Wa(r,i=>i.path.endsWith(".md")?0:1),this.removeFromPaths(r.filter(i=>this.indexedDocuments.has(i.path)).map(i=>i.path));let n=Hu(r,500);for(let i of n){he("Indexing into search engine",i),i.forEach(s=>this.indexedDocuments.set(s.path,s.mtime));let o=i.filter(s=>this.minisearch.has(s.path));this.removeFromPaths(o.map(s=>s.path)),await this.minisearch.addAllAsync(i)}}removeFromPaths(e){e.forEach(n=>this.indexedDocuments.delete(n));let r=e.filter(n=>this.minisearch.has(n));this.minisearch.discardAll(r)}async search(e,r){if(e.isEmpty())return[];he("=== New search ==="),he("Starting search for",e);let n;switch(T.fuzziness){case"0":n=0;break;case"1":n=.1;break;default:n=.2;break}let i=this.minisearch.search(e.segmentsToStr(),{prefix:l=>l.length>=r.prefixLength,fuzzy:l=>l.length<=3?0:l.length<=5?n/2:n,combineWith:"AND",boost:{basename:T.weightBasename,directory:T.weightDirectory,aliases:T.weightBasename,headings1:T.weightH1,headings2:T.weightH2,headings3:T.weightH3,unmarkedTags:T.weightUnmarkedTags}});if(he("Found",i.length,"results"),e.query.ext?.length&&(i=i.filter(l=>{let c="."+l.id.split(".").pop();return e.query.ext?.some(p=>c.startsWith(p.startsWith(".")?p:"."+p))})),e.query.path&&(i=i.filter(l=>e.query.path?.some(c=>l.id.toLowerCase().includes(c.toLowerCase())))),e.query.exclude.path&&(i=i.filter(l=>!e.query.exclude.path?.some(c=>l.id.toLowerCase().includes(c.toLowerCase())))),!i.length)return[];if(r.singleFilePath)return i.filter(l=>l.id===r.singleFilePath);T.hideExcluded?i=i.filter(l=>!(app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(l.id))):i.forEach(l=>{app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(l.id)&&(l.score/=10)});let o=e.getTags();for(let l of o)for(let c of i)(c.tags??[]).includes(l)&&(c.score*=100);he("Sorting and limiting results"),i=i.sort((l,c)=>c.score-l.score).slice(0,50),i.length&&he("First result:",i[0]);let s=await Promise.all(i.map(async l=>await Se.getDocument(l.id))),a=e.getExactTerms();a.length&&(he("Filtering with quoted terms: ",a),i=i.filter(l=>{let c=s.find(h=>h.path===l.id),p=c?.path.toLowerCase()??"",f=(c?.cleanedContent??"").toLowerCase();return a.every(h=>f.includes(h)||Ft(p).includes(h))}));let u=e.query.exclude.text;return u.length&&(he("Filtering with exclusions"),i=i.filter(l=>{let c=(s.find(p=>p.path===l.id)?.content??"").toLowerCase();return u.every(p=>!c.includes(p))})),he("Deduping"),i=i.filter((l,c,p)=>p.findIndex(f=>f.id===l.id)===c),i}async getSuggestions(e,r){let n;T.simpleSearch?n=await this.search(e,{prefixLength:3,singleFilePath:r?.singleFilePath}):n=await this.search(e,{prefixLength:1,singleFilePath:r?.singleFilePath});let i=await Promise.all(n.map(async s=>await Se.getDocument(s.id)));return n.map(s=>{he("Locating matches for",s.id);let a=i.find(p=>p.path===s.id);a||(console.warn(`Omnisearch - Note "${s.id}" not in the live cache`),a={content:"",basename:s.id,path:s.id});let u=[...Object.keys(s.match),...e.getExactTerms(),...e.getTags()].filter(p=>p.length>1||/\p{Emoji}/u.test(p));he("Matching tokens:",u),he("Getting matches locations...");let l=di(a.content,_n(u),e);return he(`Matches for ${a.basename}`,l),ye({score:s.score,foundWords:u,matches:l},a)})}async writeToCache(){await Se.writeMinisearchCache(this.minisearch,this.indexedDocuments)}},ol=Jo;ol.options={tokenize:g1,extractField:(e,r)=>{if(r==="directory"){let n=e.path.split("/");return n.pop(),n.join("/")}return e[r]},processTerm:e=>(T.ignoreDiacritics?Ft(e):e).toLowerCase(),idField:"path",fields:["basename","directory","aliases","content","headings1","headings2","headings3"],storeFields:["tags"],logger(e,r,n){n==="version_conflict"&&new pm.Notice("Omnisearch - Your index cache may be incorrect or corrupted. If this message keeps appearing, go to Settings to clear the cache.",5e3)}};Ee=new ol});function hm(t){sl.add(t)}async function Xo(){let t=[...sl].map(e=>e.path);t.length&&(Ee.removeFromPaths(t),await Ee.addFromPaths(t),sl.clear())}var sl,Zo=A(()=>{xn();sl=new Set});var mm=gi(es=>{function al(t){return al=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},al(t)}(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof es!="undefined")e(es);else{var r={exports:{}};e(r.exports),t.CancelablePromise=r.exports}})(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:es,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CancelablePromise=void 0,t.cancelable=L,t.default=void 0,t.isCancelablePromise=k;function e(C,F){if(typeof F!="function"&&F!==null)throw new TypeError("Super expression must either be null or a function");C.prototype=Object.create(F&&F.prototype,{constructor:{value:C,writable:!0,configurable:!0}}),Object.defineProperty(C,"prototype",{writable:!1}),F&&r(C,F)}function r(C,F){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(K,Z){return K.__proto__=Z,K},r(C,F)}function n(C){var F=s();return function(){var K=a(C),Z;if(F){var se=a(this).constructor;Z=Reflect.construct(K,arguments,se)}else Z=K.apply(this,arguments);return i(this,Z)}}function i(C,F){if(F&&(al(F)==="object"||typeof F=="function"))return F;if(F!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return o(C)}function o(C){if(C===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C}function s(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function a(C){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(P){return P.__proto__||Object.getPrototypeOf(P)},a(C)}function u(C,F){var P=typeof Symbol!="undefined"&&C[Symbol.iterator]||C["@@iterator"];if(!P){if(Array.isArray(C)||(P=l(C))||F&&C&&typeof C.length=="number"){P&&(C=P);var K=0,Z=function(){};return{s:Z,n:function(){return K>=C.length?{done:!0}:{done:!1,value:C[K++]}},e:function(ge){throw ge},f:Z}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var se=!0,Fe=!1,B;return{s:function(){P=P.call(C)},n:function(){var ge=P.next();return se=ge.done,ge},e:function(ge){Fe=!0,B=ge},f:function(){try{!se&&P.return!=null&&P.return()}finally{if(Fe)throw B}}}}function l(C,F){if(!!C){if(typeof C=="string")return c(C,F);var P=Object.prototype.toString.call(C).slice(8,-1);if(P==="Object"&&C.constructor&&(P=C.constructor.name),P==="Map"||P==="Set")return Array.from(C);if(P==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(P))return c(C,F)}}function c(C,F){(F==null||F>C.length)&&(F=C.length);for(var P=0,K=new Array(F);P{let{score:r,path:n,basename:i,foundWords:o,matches:s,content:a}=e,u=vn(a,s[0]?.offset??-1);return{score:r,vault:app.vault.getName(),path:n,basename:i,foundWords:o,matches:s.map(c=>({match:c.match,offset:c.offset})),excerpt:u.content}})}async function B1(t){let e=new Ar(t),r=await Ee.getSuggestions(e);return N1(r)}function K1(t){rs.push(t),Dm&&t()}function z1(t){rs=rs.filter(e=>e!==t)}function Om(){Dm=!0,rs.forEach(t=>t())}var Dm,rs,mi,ul=A(()=>{Qo();xn();jr();Zo();Dm=!1,rs=[];mi={search:B1,registerOnIndexed:K1,unregisterOnIndexed:z1,refreshIndex:Xo}});var Mm={};gl(Mm,{default:()=>H1,getServer:()=>km});function km(){let t=Im.createServer(async function(e,r){r.setHeader("Access-Control-Allow-Origin","*"),r.setHeader("Access-Control-Allow-Methods","GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE"),r.setHeader("Access-Control-Allow-Headers","Access-Control-Allow-Headers, Origin, Authorization,Accept,x-client-id, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, hypothesis-client-version"),r.setHeader("Access-Control-Allow-Credentials","true");try{if(e.url){let n=Pm.parse(e.url,!0);if(n.pathname==="/search"){let i=n.query.q,o=await mi.search(i);r.statusCode=200,r.setHeader("Content-Type","application/json"),r.end(JSON.stringify(o))}else r.end()}}catch(n){r.statusCode=500,r.end(n)}});return{listen(e){console.log(`Omnisearch - Starting HTTP server on port ${e}`),t.listen({port:parseInt(e),host:"localhost"},()=>{console.log(`Omnisearch - Started HTTP server on port ${e}`),T.httpApiNotice&&new ns.Notice(`Omnisearch - Started HTTP server on port ${e}`)}),t.on("error",r=>{console.error(r),new ns.Notice(`Omnisearch - Cannot start HTTP server on ${e}. See console for more details.`)})},close(){t.close(),console.log("Omnisearch - Terminated HTTP server"),T.httpApiNotice&&new ns.Notice("Omnisearch - Terminated HTTP server")}}}var Im,Pm,ns,H1,Rm=A(()=>{Im=ve(require("http")),Pm=ve(require("url"));ul();ns=ve(require("obsidian"));et();H1=km});gl(exports,{default:()=>cl});var nr=ve(require("obsidian"));var ts=ve(require("obsidian"));Ze();var ut=ve(require("obsidian"));Ze();Ze();var Qu=ve(require("obsidian"));st();Qr();function Cy(t){let e,r,n,i,o,s,a,u,l=t[8].default,c=Fr(l,t,t[7],null);return{c(){e=M("div"),r=M("div"),n=M("input"),o=G(),c&&c.c(),N(n,"class","prompt-input"),N(n,"placeholder",t[0]),N(n,"spellcheck","false"),N(n,"type","text"),N(r,"class","omnisearch-input-field"),N(e,"class","omnisearch-input-container")},m(p,f){U(p,e,f),I(e,r),I(r,n),t[9](n),as(n,t[1]),I(e,o),c&&c.m(e,null),s=!0,a||(u=[Pe(n,"input",t[10]),xl(i=t[3].call(null,n)),Pe(n,"compositionend",t[11]),Pe(n,"compositionstart",t[12]),Pe(n,"input",t[4])],a=!0)},p(p,[f]){(!s||f&1)&&N(n,"placeholder",p[0]),f&2&&n.value!==p[1]&&as(n,p[1]),c&&c.p&&(!s||f&128)&&Dr(c,l,p,p[7],s?Tr(l,p[7],f,null):Or(p[7]),null)},i(p){s||(te(c,p),s=!0)},o(p){ne(c,p),s=!1},d(p){p&&W(e),t[9](null),c&&c.d(p),a=!1,it(u)}}}function Ey(t,e,r){let{$$slots:n={},$$scope:i}=e,{initialValue:o=""}=e,{placeholder:s=""}=e,a=!1,u="",l,c=cs();function p(m){r(1,u=m)}function f(m){m&&!a&&!u&&(a=!0,r(1,u=m),h())}function h(m){kt().then(()=>(l.focus(),kt())).then(()=>{l.select()})}let y=(0,Qu.debounce)(()=>{Se.addToSearchHistory(""),c("input",u)},300);function j(m){_t[m?"unshift":"push"](()=>{l=m,r(2,l)})}function v(){u=this.value,r(1,u)}let d=m=>ua(!1),b=m=>ua(!0);return t.$$set=m=>{"initialValue"in m&&r(5,o=m.initialValue),"placeholder"in m&&r(0,s=m.placeholder),"$$scope"in m&&r(7,i=m.$$scope)},t.$$.update=()=>{if(t.$$.dirty&32){e:f(o)}},[s,u,l,h,y,o,p,i,n,j,v,d,b]}var qu=class extends ke{constructor(e){super();Ne(this,e,Ey,Cy,Te,{initialValue:5,placeholder:0,setInputValue:6})}get setInputValue(){return this.$$.ctx[6]}},to=qu;Ze();function Fy(t){let e,r,n,i,o=t[1].default,s=Fr(o,t,t[0],null);return{c(){e=M("div"),s&&s.c(),N(e,"class","prompt-results")},m(a,u){U(a,e,u),s&&s.m(e,null),r=!0,n||(i=Pe(e,"mousedown",Ty),n=!0)},p(a,[u]){s&&s.p&&(!r||u&1)&&Dr(s,o,a,a[0],r?Tr(o,a[0],u,null):Or(a[0]),null)},i(a){r||(te(s,a),r=!0)},o(a){ne(s,a),r=!1},d(a){a&&W(e),s&&s.d(a),n=!1,i()}}}var Ty=t=>t.preventDefault();function Dy(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}var Yu=class extends ke{constructor(e){super();Ne(this,e,Dy,Fy,Te,{})}},ro=Yu;st();var $a=ve(require("obsidian"));jr();async function $o(t,e=0,r=!1){let n=!1;app.workspace.iterateAllLeaves(s=>{s.view instanceof $a.MarkdownView&&!r&&s.getViewState().state?.file===t.path&&s.getViewState()?.pinned&&(app.workspace.setActiveLeaf(s,{focus:!0}),n=!0)}),n||await app.workspace.openLinkText(t.path,"",r);let i=app.workspace.getActiveViewOfType($a.MarkdownView);if(!i)return;let o=i.editor.offsetToPos(e);i.editor.setCursor(o),i.editor.scrollIntoView({from:{line:o.line-10,ch:0},to:{line:o.line+10,ch:0}})}async function zh(t,e=!1){try{let r;switch(app.vault.getConfig("newFileLocation")){case"current":r=(app.workspace.getActiveFile()?.parent?.path??"")+"/";break;case"folder":r=app.vault.getConfig("newFileFolderPath")+"/";break;default:r="";break}await app.workspace.openLinkText(`${r}${t}.md`,"",e)}catch(r){throw r.message="OmniSearch - Could not create note: "+r.message,console.error(r),r}}Tt();Ze();et();Tt();Ze();Ze();function Y0(t){let e;return{c(){e=M("span"),e.innerHTML='',N(e,"class","suggestion-flair"),N(e,"aria-label","Not created yet, select to create")},m(r,n){U(r,e,n)},p:fe,i:fe,o:fe,d(r){r&&W(e)}}}function J0(t){"use strict";return[]}var Hh=class extends ke{constructor(e){super();Ne(this,e,J0,Y0,Te,{})}},Vh=Hh;function Wh(t){let e,r;return e=new Vh({}),{c(){Ue(e.$$.fragment)},m(n,i){He(e,n,i),r=!0},i(n){r||(te(e.$$.fragment,n),r=!0)},o(n){ne(e.$$.fragment,n),r=!1},d(n){Le(e,n)}}}function X0(t){let e,r,n,i,o,s=t[2]&&Wh(t),a=t[4].default,u=Fr(a,t,t[3],null);return{c(){e=M("div"),s&&s.c(),r=G(),u&&u.c(),N(e,"data-result-id",t[0]),N(e,"class","suggestion-item omnisearch-result"),ls(e,"is-selected",t[1])},m(l,c){U(l,e,c),s&&s.m(e,null),I(e,r),u&&u.m(e,null),n=!0,i||(o=[Pe(e,"mousemove",t[5]),Pe(e,"click",t[6]),Pe(e,"keypress",t[7]),Pe(e,"auxclick",t[8])],i=!0)},p(l,[c]){l[2]?s?c&4&&te(s,1):(s=Wh(l),s.c(),te(s,1),s.m(e,r)):s&&(or(),ne(s,1,1,()=>{s=null}),sr()),u&&u.p&&(!n||c&8)&&Dr(u,a,l,l[3],n?Tr(a,l[3],c,null):Or(l[3]),null),(!n||c&1)&&N(e,"data-result-id",l[0]),(!n||c&2)&&ls(e,"is-selected",l[1])},i(l){n||(te(s),te(u,l),n=!0)},o(l){ne(s),ne(u,l),n=!1},d(l){l&&W(e),s&&s.d(),u&&u.d(l),i=!1,it(o)}}}function Z0(t,e,r){let{$$slots:n={},$$scope:i}=e,{id:o}=e,{selected:s=!1}=e,{glyph:a=!1}=e;function u(f){Ye.call(this,t,f)}function l(f){Ye.call(this,t,f)}function c(f){Ye.call(this,t,f)}function p(f){Ye.call(this,t,f)}return t.$$set=f=>{"id"in f&&r(0,o=f.id),"selected"in f&&r(1,s=f.selected),"glyph"in f&&r(2,a=f.glyph),"$$scope"in f&&r(3,i=f.$$scope)},[o,s,a,i,n,u,l,c,p]}var $h=class extends ke{constructor(e){super();Ne(this,e,Z0,X0,Te,{id:0,selected:1,glyph:2})}},Uo=$h;var rr=ve(require("obsidian"));yn();jr();function Uh(t){let e,r=t[1].matches.length+"",n,i,o=(t[1].matches.length>1?"matches":"match")+"",s;return{c(){e=M("span"),n=Ie(r),i=Ie("\xA0"),s=Ie(o),N(e,"class","omnisearch-result__counter")},m(a,u){U(a,e,u),I(e,n),I(e,i),I(e,s)},p(a,u){u&2&&r!==(r=a[1].matches.length+"")&&ct(n,r),u&2&&o!==(o=(a[1].matches.length>1?"matches":"match")+"")&&ct(s,o)},d(a){a&&W(e)}}}function Gh(t){let e,r,n,i,o=yt(t[3],t[10])+"";return{c(){e=M("div"),r=M("span"),n=G(),i=M("span"),N(e,"class","omnisearch-result__folder-path")},m(s,a){U(s,e,a),I(e,r),t[16](r),I(e,n),I(e,i),i.innerHTML=o},p(s,a){a&1032&&o!==(o=yt(s[3],s[10])+"")&&(i.innerHTML=o)},d(s){s&&W(e),t[16](null)}}}function Qh(t){let e,r=yt(t[6].content,t[9])+"";return{c(){e=M("div"),N(e,"class","omnisearch-result__body")},m(n,i){U(n,e,i),e.innerHTML=r},p(n,i){i&576&&r!==(r=yt(n[6].content,n[9])+"")&&(e.innerHTML=r)},d(n){n&&W(e)}}}function qh(t){let e,r,n;return{c(){e=M("div"),r=M("img"),qe(r,"width","100px"),ss(r.src,n=t[7])||N(r,"src",n),N(r,"alt",""),N(e,"class","omnisearch-result__image-container")},m(i,o){U(i,e,o),I(e,r)},p(i,o){o&128&&!ss(r.src,n=i[7])&&N(r,"src",n)},d(i){i&&W(e)}}}function e1(t){let e,r,n,i,o,s,a=yt(t[2],t[11])+"",u,l,c,p=Vt(t[1].path)+"",f,h,y,j,v,d,b=t[1].matches.length>0&&Uh(t),m=t[3]&&Gh(t),g=t[12]&&Qh(t),x=t[7]&&qh(t);return{c(){e=M("div"),r=M("div"),n=M("span"),i=M("span"),o=G(),s=M("span"),u=G(),l=M("span"),c=Ie("."),f=Ie(p),h=G(),b&&b.c(),y=G(),m&&m.c(),j=G(),v=M("div"),g&&g.c(),d=G(),x&&x.c(),N(l,"class","omnisearch-result__extension"),N(n,"class","omnisearch-result__title"),N(r,"class","omnisearch-result__title-container"),qe(v,"display","flex"),qe(v,"flex-direction","row")},m(_,w){U(_,e,w),I(e,r),I(r,n),I(n,i),t[15](i),I(n,o),I(n,s),s.innerHTML=a,I(n,u),I(n,l),I(l,c),I(l,f),I(n,h),b&&b.m(n,null),I(e,y),m&&m.m(e,null),I(e,j),I(e,v),g&&g.m(v,null),I(v,d),x&&x.m(v,null)},p(_,w){w&2052&&a!==(a=yt(_[2],_[11])+"")&&(s.innerHTML=a),w&2&&p!==(p=Vt(_[1].path)+"")&&ct(f,p),_[1].matches.length>0?b?b.p(_,w):(b=Uh(_),b.c(),b.m(n,null)):b&&(b.d(1),b=null),_[3]?m?m.p(_,w):(m=Gh(_),m.c(),m.m(e,j)):m&&(m.d(1),m=null),_[12]?g?g.p(_,w):(g=Qh(_),g.c(),g.m(v,d)):g&&(g.d(1),g=null),_[7]?x?x.p(_,w):(x=qh(_),x.c(),x.m(v,null)):x&&(x.d(1),x=null)},d(_){_&&W(e),t[15](null),b&&b.d(),m&&m.d(),g&&g.d(),x&&x.d()}}}function t1(t){let e,r;return e=new Uo({props:{glyph:t[8],id:t[1].path,selected:t[0],$$slots:{default:[e1]},$$scope:{ctx:t}}}),e.$on("click",t[17]),e.$on("auxclick",t[18]),e.$on("mousemove",t[19]),{c(){Ue(e.$$.fragment)},m(n,i){He(e,n,i),r=!0},p(n,[i]){let o={};i&256&&(o.glyph=n[8]),i&2&&(o.id=n[1].path),i&1&&(o.selected=n[0]),i&1056510&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(te(e.$$.fragment,n),r=!0)},o(n){ne(e.$$.fragment,n),r=!1},d(n){Le(e,n)}}}function r1(t,e,r){let n,i,o,s,a,u,l;_i(t,hr,w=>r(12,l=w));let{selected:c=!1}=e,{note:p}=e,{app:f}=e,h=null,y="",j="",v,d;function b(w){_t[w?"unshift":"push"](()=>{d=w,r(5,d)})}function m(w){_t[w?"unshift":"push"](()=>{v=w,r(4,v)})}function g(w){Ye.call(this,t,w)}function x(w){Ye.call(this,t,w)}function _(w){Ye.call(this,t,w)}t.$$set=w=>{"selected"in w&&r(0,c=w.selected),"note"in w&&r(1,p=w.note),"app"in w&&r(13,f=w.app)},t.$$.update=()=>{if(t.$$.dirty&8194){e:if(r(7,h=null),Ur(p.path)){let w=f.vault.getAbstractFileByPath(p.path);w instanceof rr.TFile&&r(7,h=f.vault.getResourcePath(w))}}if(t.$$.dirty&2){e:r(14,n=_n(p.foundWords))}if(t.$$.dirty&50){e:r(2,y=p.basename),r(3,j=Ru(p.path)),v&&(0,rr.setIcon)(v,"folder-open"),d&&(Ur(p.path)?(0,rr.setIcon)(d,"image"):yr(p.path)?(0,rr.setIcon)(d,"file-text"):Gr(p.path)?(0,rr.setIcon)(d,"layout-dashboard"):(0,rr.setIcon)(d,"file"))}if(t.$$.dirty&16388){e:r(11,i=di(y,n))}if(t.$$.dirty&16392){e:r(10,o=di(j,n))}if(t.$$.dirty&2){e:r(6,a=vn(p.content,p.matches[0]?.offset??-1))}if(t.$$.dirty&66){e:r(9,s=fi(p.matches).map(w=>(w.offset=w.offset-a.offset,w)))}};e:r(8,u=!1);return[c,p,y,j,v,d,a,h,u,s,o,i,l,f,n,b,m,g,x,_]}var Yh=class extends ke{constructor(e){super();Ne(this,e,r1,t1,Te,{selected:0,note:1,app:13})}},Jh=Yh;Qo();et();Zo();Qr();xn();var gm=ve(mm());yn();function ym(t,e,r){let n=t.slice();return n[38]=e[r],n[40]=r,n}function y1(t){let e,r,n;return{c(){e=M("button"),e.textContent="Create note"},m(i,o){U(i,e,o),r||(n=Pe(e,"click",t[13]),r=!0)},p:fe,d(i){i&&W(e),r=!1,n()}}}function _1(t){let e,r,n;return{c(){e=M("button"),e.textContent="In-File search"},m(i,o){U(i,e,o),r||(n=Pe(e,"click",t[14]),r=!0)},p:fe,d(i){i&&W(e),r=!1,n()}}}function v1(t){let e,r,n=T.showCreateButton&&y1(t),i=ut.Platform.isMobile&&_1(t);return{c(){e=M("div"),n&&n.c(),r=G(),i&&i.c(),N(e,"class","omnisearch-input-container__buttons")},m(o,s){U(o,e,s),n&&n.m(e,null),I(e,r),i&&i.m(e,null)},p(o,s){T.showCreateButton&&n.p(o,s),ut.Platform.isMobile&&i.p(o,s)},d(o){o&&W(e),n&&n.d(),i&&i.d()}}}function _m(t){let e,r,n;return{c(){e=M("div"),r=Ie("\u23F3 Work in progress: "),n=Ie(t[4]),qe(e,"text-align","center"),qe(e,"color","var(--text-accent)"),qe(e,"margin-top","10px")},m(i,o){U(i,e,o),I(e,r),I(e,n)},p(i,o){o[0]&16&&ct(n,i[4])},d(i){i&&W(e)}}}function vm(t){let e,r;function n(...i){return t[20](t[40],...i)}return e=new Jh({props:{app:t[0],selected:t[40]===t[1],note:t[38]}}),e.$on("mousemove",n),e.$on("click",t[11]),e.$on("auxclick",t[21]),{c(){Ue(e.$$.fragment)},m(i,o){He(e,i,o),r=!0},p(i,o){t=i;let s={};o[0]&1&&(s.app=t[0]),o[0]&2&&(s.selected=t[40]===t[1]),o[0]&8&&(s.note=t[38]),e.$set(s)},i(i){r||(te(e.$$.fragment,i),r=!0)},o(i){ne(e.$$.fragment,i),r=!1},d(i){Le(e,i)}}}function b1(t){let e;return{c(){e=Ie("Searching...")},m(r,n){U(r,e,n)},p:fe,d(r){r&&W(e)}}}function x1(t){let e,r=T.simpleSearch&&t[2].split(qn).some(xm),n,i=r&&bm(t);return{c(){e=Ie(`We found 0 result for your search here. `),i&&i.c(),n=An()},m(o,s){U(o,e,s),i&&i.m(o,s),U(o,n,s)},p(o,s){s[0]&4&&(r=T.simpleSearch&&o[2].split(qn).some(xm)),r?i||(i=bm(o),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},d(o){o&&W(e),i&&i.d(o),o&&W(n)}}}function bm(t){let e,r,n;return{c(){e=M("br"),r=G(),n=M("span"),n.textContent=`You have enabled "Simpler Search" in the settings, try to type more characters.`,qe(n,"color","var(--text-accent)"),qe(n,"font-size","small")},m(i,o){U(i,e,o),U(i,r,o),U(i,n,o)},d(i){i&&W(e),i&&W(r),i&&W(n)}}}function w1(t){let e,r,n,i=t[3],o=[];for(let c=0;cne(o[c],1,1,()=>{o[c]=null});function a(c,p){if(!c[3].length&&c[2]&&!c[5])return x1;if(c[5])return b1}let u=a(t,[-1,-1]),l=u&&u(t);return{c(){for(let c=0;c\u2191\u2193to navigate',u=G(),l=M("div"),l.innerHTML=`alt \u2191\u2193 to cycle history`,c=G(),p=M("div"),f=M("span"),h=Ie(t[8]),y=G(),j=M("span"),j.textContent="to open",v=G(),d=M("div"),d.innerHTML=`tab to switch to In-File Search`,b=G(),m=M("div"),g=M("span"),x=Ie(t[7]),_=G(),w=M("span"),w.textContent="to open in a new pane",S=G(),E=M("div"),E.innerHTML=`alt o to open in the background`,D=G(),O=M("div"),L=M("span"),k=Ie(t[10]),H=G(),X=M("span"),X.textContent="to create",Y=G(),J=M("div"),C=M("span"),F=Ie(t[9]),P=G(),K=M("span"),K.textContent="to create in a new pane",Z=G(),se=M("div"),se.innerHTML=`alt \u21B5 to insert a link`,Fe=G(),B=M("div"),B.innerHTML=`ctrl h to toggle excerpts`,le=G(),ge=M("div"),ge.innerHTML='escto close',N(a,"class","prompt-instruction"),N(l,"class","prompt-instruction"),N(f,"class","prompt-instruction-command"),N(p,"class","prompt-instruction"),N(d,"class","prompt-instruction"),N(g,"class","prompt-instruction-command"),N(m,"class","prompt-instruction"),N(E,"class","prompt-instruction"),N(L,"class","prompt-instruction-command"),N(O,"class","prompt-instruction"),N(C,"class","prompt-instruction-command"),N(J,"class","prompt-instruction"),N(se,"class","prompt-instruction"),N(B,"class","prompt-instruction"),N(ge,"class","prompt-instruction"),N(s,"class","prompt-instructions")},m(ee,we){He(e,ee,we),U(ee,r,we),Re&&Re.m(ee,we),U(ee,n,we),He(i,ee,we),U(ee,o,we),U(ee,s,we),I(s,a),I(s,u),I(s,l),I(s,c),I(s,p),I(p,f),I(f,h),I(p,y),I(p,j),I(s,v),I(s,d),I(s,b),I(s,m),I(m,g),I(g,x),I(m,_),I(m,w),I(s,S),I(s,E),I(s,D),I(s,O),I(O,L),I(L,k),I(O,H),I(O,X),I(s,Y),I(s,J),I(J,C),I(C,F),I(J,P),I(J,K),I(s,Z),I(s,se),I(s,Fe),I(s,B),I(s,le),I(s,ge),Oe=!0},p(ee,we){let is={};we[0]&4&&(is.initialValue=ee[2]),we[1]&1024&&(is.$$scope={dirty:we,ctx:ee}),e.$set(is),ee[4]?Re?Re.p(ee,we):(Re=_m(ee),Re.c(),Re.m(n.parentNode,n)):Re&&(Re.d(1),Re=null);let fl={};we[0]&47|we[1]&1024&&(fl.$$scope={dirty:we,ctx:ee}),i.$set(fl),(!Oe||we[0]&256)&&ct(h,ee[8]),(!Oe||we[0]&128)&&ct(x,ee[7]),(!Oe||we[0]&1024)&&ct(k,ee[10]),(!Oe||we[0]&512)&&ct(F,ee[9])},i(ee){Oe||(te(e.$$.fragment,ee),te(i.$$.fragment,ee),Oe=!0)},o(ee){ne(e.$$.fragment,ee),ne(i.$$.fragment,ee),Oe=!1},d(ee){t[18](null),Le(e,ee),ee&&W(r),Re&&Re.d(ee),ee&&W(n),Le(i,ee),ee&&W(o),ee&&W(s)}}}var xm=t=>t.length<3;function A1(t,e,r){let n,i;_i(t,Ht,B=>r(17,i=B));let{modal:o}=e,{previousQuery:s}=e,{app:a}=e,u=0,l=0,c,p=[],f,h="",y=!0,j,v,d,b,m;En(async()=>{Q.enable("vault"),Q.on("vault",re.Enter,D),Q.on("vault",re.OpenInBackground,O),Q.on("vault",re.CreateNote,Y),Q.on("vault",re.OpenInNewPane,L),Q.on("vault",re.InsertLink,J),Q.on("vault",re.Tab,C),Q.on("vault",re.ArrowUp,()=>F(-1)),Q.on("vault",re.ArrowDown,()=>F(1)),Q.on("vault",re.PrevSearchHistory,g),Q.on("vault",re.NextSearchHistory,x),await Xo(),await S()}),Fn(()=>{Q.disable("vault")});async function g(){let B=(await Se.getSearchHistory()).filter(le=>le);++l>=B.length&&(l=0),r(2,c=B[l]),j?.setInputValue(c??"")}async function x(){let B=(await Se.getSearchHistory()).filter(le=>le);--l<0&&(l=B.length?B.length-1:0),r(2,c=B[l]),j?.setInputValue(c??"")}let _=null;async function w(){r(5,y=!0),_&&(_.cancel(),_=null),f=new Ar(c),_=(0,gm.cancelable)(new Promise(B=>{B(Ee.getSuggestions(f))})),r(3,p=await _),r(1,u=0),await P(),r(5,y=!1)}let S=Va(w,0);function E(B){!n||(B?.ctrlKey?L():D(),o.close())}function D(){!n||(H(n),o.close())}function O(){!n||H(n,!0)}function L(){!n||(H(n,!0),o.close())}function k(){c&&Se.addToSearchHistory(c)}function H(B,le=!1){k();let ge=B.matches?.[0]?.offset??0;$o(B,ge,le)}async function X(B){await Y()}async function Y(B){if(c){try{await zh(c,B?.newLeaf)}catch(le){new ut.Notice(le.message);return}o.close()}}function J(){if(!n)return;let B=a.vault.getMarkdownFiles().find(Re=>Re.path===n.path),le=a.workspace.getActiveFile(),ge=a.workspace.getActiveViewOfType(ut.MarkdownView);if(!ge?.editor){new ut.Notice("Omnisearch - Error - No active editor",3e3);return}let Oe;B&&le?Oe=a.fileManager.generateMarkdownLink(B,le.path):Oe=`[[${n.basename}.${Vt(n.path)}]]`;let Cr=ge.editor.getCursor();ge.editor.replaceRange(Oe,Cr,Cr),Cr.ch+=Oe.length,ge.editor.setCursor(Cr),o.close()}function C(){if(!(n&&(yr(n?.path)||!n?.matches.length)))if(k(),o.close(),n){let B=a.vault.getAbstractFileByPath(n.path);B&&B instanceof ut.TFile&&new wn(a,B,c).open()}else{let B=a.workspace.getActiveViewOfType(ut.MarkdownView);B?.file&&new wn(a,B.file,c).open()}}function F(B){r(1,u=Ji(u+B,p.length)),P()}async function P(){await kt(),n&&activeWindow.document.querySelector(`[data-result-id="${n.path}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}function K(B){_t[B?"unshift":"push"](()=>{j=B,r(6,j)})}let Z=B=>r(2,c=B.detail),se=(B,le)=>r(1,u=B),Fe=B=>{B.button==1&&L()};t.$$set=B=>{"modal"in B&&r(15,o=B.modal),"previousQuery"in B&&r(16,s=B.previousQuery),"app"in B&&r(0,a=B.app)},t.$$.update=()=>{if(t.$$.dirty[0]&65540){e:r(2,c=c??s)}if(t.$$.dirty[0]&4){e:c?S():(r(5,y=!1),r(3,p=[]))}if(t.$$.dirty[0]&10){e:n=p[u]}if(t.$$.dirty[0]&131072){e:switch(i){case tt.LoadingCache:r(4,h="Loading cache...");break;case tt.ReadingFiles:r(4,h="Reading files...");break;case tt.IndexingFiles:r(4,h="Indexing files...");break;case tt.WritingCache:S(),r(4,h="Updating cache...");break;default:S(),r(4,h="");break}}};e:T.openInNewPane?(r(7,v="\u21B5"),r(8,d=gr()+" \u21B5"),r(9,b="shift \u21B5"),r(10,m=gr()+" shift \u21B5")):(r(7,v=gr()+" \u21B5"),r(8,d="\u21B5"),r(9,b=gr()+" shift \u21B5"),r(10,m="shift \u21B5"));return[a,u,c,p,h,y,j,v,d,b,m,E,L,X,C,o,s,i,K,Z,se,Fe]}var wm=class extends ke{constructor(e){super();Ne(this,e,A1,j1,Te,{modal:15,previousQuery:16,app:0},null,[-1,-1])}},jm=wm;Ze();st();Tt();var hi=ve(require("obsidian"));Ze();jr();yn();function S1(t){let e,r=yt(t[2].content,t[3])+"";return{c(){e=M("div"),N(e,"class","omnisearch-result__body")},m(n,i){U(n,e,i),e.innerHTML=r},p(n,i){i&12&&r!==(r=yt(n[2].content,n[3])+"")&&(e.innerHTML=r)},d(n){n&&W(e)}}}function C1(t){let e,r;return e=new Uo({props:{id:t[0].toString(),selected:t[1],$$slots:{default:[S1]},$$scope:{ctx:t}}}),e.$on("mousemove",t[6]),e.$on("click",t[7]),e.$on("auxclick",t[8]),{c(){Ue(e.$$.fragment)},m(n,i){He(e,n,i),r=!0},p(n,[i]){let o={};i&1&&(o.id=n[0].toString()),i&2&&(o.selected=n[1]),i&524&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(te(e.$$.fragment,n),r=!0)},o(n){ne(e.$$.fragment,n),r=!1},d(n){Le(e,n)}}}function E1(t,e,r){let n,i,{offset:o}=e,{note:s}=e,{index:a=0}=e,{selected:u=!1}=e;function l(f){Ye.call(this,t,f)}function c(f){Ye.call(this,t,f)}function p(f){Ye.call(this,t,f)}return t.$$set=f=>{"offset"in f&&r(4,o=f.offset),"note"in f&&r(5,s=f.note),"index"in f&&r(0,a=f.index),"selected"in f&&r(1,u=f.selected)},t.$$.update=()=>{if(t.$$.dirty&48){e:r(2,n=vn(s?.content??"",o))}if(t.$$.dirty&36){e:r(3,i=fi(s.matches).map(f=>(f.offset=f.offset-n.offset,f)))}},[a,u,n,i,o,s,l,c,p]}var Am=class extends ke{constructor(e){super();Ne(this,e,E1,C1,Te,{offset:4,note:5,index:0,selected:1})}},Sm=Am;Qo();xn();jr();function Cm(t,e,r){let n=t.slice();return n[20]=e[r],n[22]=r,n}function F1(t){let e,r,n;return{c(){e=M("button"),e.textContent="Vault search"},m(i,o){U(i,e,o),r||(n=Pe(e,"click",t[7]),r=!0)},p:fe,d(i){i&&W(e),r=!1,n()}}}function T1(t){let e,r=hi.Platform.isMobile&&F1(t);return{c(){e=M("div"),r&&r.c(),N(e,"class","omnisearch-input-container__buttons")},m(n,i){U(n,e,i),r&&r.m(e,null)},p(n,i){hi.Platform.isMobile&&r.p(n,i)},d(n){n&&W(e),r&&r.d()}}}function D1(t){let e;return{c(){e=M("div"),e.textContent="We found 0 result for your search here.",qe(e,"text-align","center")},m(r,n){U(r,e,n)},p:fe,i:fe,o:fe,d(r){r&&W(e)}}}function O1(t){let e,r,n=t[4],i=[];for(let s=0;sne(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s{s[c]=null}),sr(),r=s[e],r?r.p(u,l):(r=s[e]=o[e](u),r.c()),te(r,1),r.m(n.parentNode,n))},i(u){i||(te(r),i=!0)},o(u){ne(r),i=!1},d(u){s[e].d(u),u&&W(n)}}}function P1(t){let e;return{c(){e=M("span"),e.textContent="to close"},m(r,n){U(r,e,n)},d(r){r&&W(e)}}}function k1(t){let e;return{c(){e=M("span"),e.textContent="to go back to Vault Search"},m(r,n){U(r,e,n)},d(r){r&&W(e)}}}function M1(t){let e,r,n,i,o,s,a,u,l,c,p,f,h,y,j,v,d,b,m,g;e=new to({props:{placeholder:"Omnisearch - File",initialValue:t[1],$$slots:{default:[T1]},$$scope:{ctx:t}}}),e.$on("input",t[12]),n=new ro({props:{$$slots:{default:[I1]},$$scope:{ctx:t}}});function x(S,E){return S[0]?k1:P1}let _=x(t,-1),w=_(t);return{c(){Ue(e.$$.fragment),r=G(),Ue(n.$$.fragment),i=G(),o=M("div"),s=M("div"),s.innerHTML='\u2191\u2193to navigate',a=G(),u=M("div"),u.innerHTML='\u21B5to open',l=G(),c=M("div"),c.innerHTML=`tab to switch to Vault Search`,p=G(),f=M("div"),h=M("span"),h.textContent="esc",y=G(),w.c(),j=G(),v=M("div"),d=M("span"),d.textContent=`${gr()} \u21B5`,b=G(),m=M("span"),m.textContent="to open in a new pane",N(s,"class","prompt-instruction"),N(u,"class","prompt-instruction"),N(c,"class","prompt-instruction"),N(h,"class","prompt-instruction-command"),N(f,"class","prompt-instruction"),N(d,"class","prompt-instruction-command"),N(v,"class","prompt-instruction"),N(o,"class","prompt-instructions")},m(S,E){He(e,S,E),U(S,r,E),He(n,S,E),U(S,i,E),U(S,o,E),I(o,s),I(o,a),I(o,u),I(o,l),I(o,c),I(o,p),I(o,f),I(f,h),I(f,y),w.m(f,null),I(o,j),I(o,v),I(v,d),I(v,b),I(v,m),g=!0},p(S,[E]){let D={};E&2&&(D.initialValue=S[1]),E&8388608&&(D.$$scope={dirty:E,ctx:S}),e.$set(D);let O={};E&8388664&&(O.$$scope={dirty:E,ctx:S}),n.$set(O),_!==(_=x(S,E))&&(w.d(1),w=_(S),w&&(w.c(),w.m(f,null)))},i(S){g||(te(e.$$.fragment,S),te(n.$$.fragment,S),g=!0)},o(S){ne(e.$$.fragment,S),ne(n.$$.fragment,S),g=!1},d(S){Le(e,S),S&&W(r),Le(n,S),S&&W(i),S&&W(o),w.d()}}}function R1(t,e,r){let n=t.find(i=>i.offset>e);return n?t.filter(i=>i.offset>e&&i.offset<=n.offset+r):[]}function L1(t,e,r){let{modal:n}=e,{parent:i=null}=e,{singleFilePath:o=""}=e,{previousQuery:s}=e,{app:a}=e,u,l=[],c=0,p,f;En(()=>{Q.enable("infile"),Q.on("infile",re.Enter,d),Q.on("infile",re.OpenInNewPane,v),Q.on("infile",re.ArrowUp,()=>y(-1)),Q.on("infile",re.ArrowDown,()=>y(1)),Q.on("infile",re.Tab,b)}),Fn(()=>{Q.disable("infile")});function h(w){let S=[],E=-1,D=0;for(;;){let O=R1(w,E,Qn);if(!O.length||(E=O.last().offset,S.push(O),++D>100))break}return S}function y(w){r(5,c=Ji(c+w,l.length)),j()}async function j(){await kt(),document.querySelector(`[data-result-id="${c}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function v(){return d(!0)}async function d(w=!1){if(p){n.close(),i&&i.close();let S=_n(p.foundWords);S.exec(p.content),await $o(p,S.lastIndex,w);let E=a.workspace.getActiveViewOfType(hi.MarkdownView);if(!E)return;let D=l[c]??0,O=E.editor.offsetToPos(D);O.ch=0,E.editor.setCursor(O),E.editor.scrollIntoView({from:{line:O.line-10,ch:0},to:{line:O.line+10,ch:0}})}}function b(){new Sr(a,u??s).open(),n.close()}let m=w=>r(2,u=w.detail),g=(w,S)=>r(5,c=w),x=w=>d(w.ctrlKey),_=w=>{w.button==1&&d(!0)};return t.$$set=w=>{"modal"in w&&r(8,n=w.modal),"parent"in w&&r(0,i=w.parent),"singleFilePath"in w&&r(9,o=w.singleFilePath),"previousQuery"in w&&r(1,s=w.previousQuery),"app"in w&&r(10,a=w.app)},t.$$.update=()=>{if(t.$$.dirty&2){e:r(2,u=s??"")}if(t.$$.dirty&2564){e:(async()=>{u&&(r(11,f=new Ar(u)),r(3,p=(await Ee.getSuggestions(f,{singleFilePath:o}))[0]??null)),r(5,c=0),await j()})()}if(t.$$.dirty&8){e:if(p){let w=h(p.matches);r(4,l=w.map(S=>Math.round((S.first().offset+S.last().offset)/2)))}}},[i,s,u,p,l,c,d,b,n,o,a,f,m,g,x,_]}var Fm=class extends ke{constructor(e){super();Ne(this,e,L1,M1,Te,{modal:8,parent:0,singleFilePath:9,previousQuery:1,app:10})}},Tm=Fm;st();et();Qr();var ll=class extends ts.Modal{constructor(e){super(e);this.modalEl.replaceChildren(),this.modalEl.addClass("omnisearch-modal","prompt"),this.modalEl.removeClass("modal"),this.modalEl.tabIndex=-1,this.scope.register([],"ArrowDown",s=>{s.preventDefault(),Q.emit(re.ArrowDown)}),this.scope.register([],"ArrowUp",s=>{s.preventDefault(),Q.emit(re.ArrowUp)});for(let s of[{k:"J",dir:"down"},{k:"K",dir:"up"}])for(let a of["Ctrl","Mod"])this.scope.register([a],s.k,u=>{T.vimLikeNavigationShortcut&&Q.emit("arrow-"+s.dir)});for(let s of[{k:"N",dir:"down"},{k:"P",dir:"up"}])for(let a of["Ctrl","Mod"])this.scope.register([a],s.k,u=>{T.vimLikeNavigationShortcut&&Q.emit("arrow-"+s.dir)});let r,n,i,o;T.openInNewPane?(r=["Mod"],n=[],i=["Mod","Shift"],o=["Shift"]):(r=[],n=["Mod"],i=["Shift"],o=["Mod","Shift"]),this.scope.register(n,"Enter",s=>{s.preventDefault(),Q.emit(re.OpenInNewPane)}),this.scope.register(["Alt"],"Enter",s=>{s.preventDefault(),Q.emit(re.InsertLink)}),this.scope.register(i,"Enter",s=>{s.preventDefault(),Q.emit(re.CreateNote)}),this.scope.register(o,"Enter",s=>{s.preventDefault(),Q.emit(re.CreateNote,{newLeaf:!0})}),this.scope.register(r,"Enter",s=>{ca()||(s.preventDefault(),Q.emit(re.Enter))}),this.scope.register(["Alt"],"O",s=>{ca()||(s.preventDefault(),Q.emit(re.OpenInBackground))}),this.scope.register([],"Tab",s=>{s.preventDefault(),Q.emit(re.Tab)}),this.scope.register(["Alt"],"ArrowDown",s=>{s.preventDefault(),Q.emit(re.NextSearchHistory)}),this.scope.register(["Alt"],"ArrowUp",s=>{s.preventDefault(),Q.emit(re.PrevSearchHistory)}),this.scope.register(["Ctrl"],"H",s=>{Q.emit(qi.ToggleExcerpts)})}},Sr=class extends ll{constructor(e,r){super(e);let n=e.workspace.getActiveViewOfType(ts.MarkdownView)?.editor.getSelection();Se.getSearchHistory().then(i=>{let o=T.showPreviousQueryResults?i[0]:null,s=new jm({target:this.modalEl,props:{app:e,modal:this,previousQuery:r||n||o||""}});this.onClose=()=>{s.$destroy()}})}},wn=class extends ll{constructor(e,r,n="",i){super(e);let o=new Tm({target:this.modalEl,props:{app:e,modal:this,singleFilePath:r.path,parent:i,previousQuery:n}});i&&i.containerEl.toggleVisibility(!1),this.onClose=()=>{i&&i.containerEl.toggleVisibility(!0),o.$destroy()}}};et();st();ul();Tt();Gi();Zo();xn();Qr();var cl=class extends nr.Plugin{constructor(){super(...arguments);this.apiHttpServer=null}async onload(){if(await Au(this),this.addSettingTab(new aa(this)),nr.Platform.isMobile||Promise.resolve().then(()=>(Rm(),Mm)).then(e=>this.apiHttpServer=e.getServer()),la()){console.log("Omnisearch - Plugin disabled");return}await V1(this.app),await $r.clearOldDatabases(),W1(this),T.ribbonIcon&&this.addRibbonButton(),Q.disable("vault"),Q.disable("infile"),Q.on("global",qi.ToggleExcerpts,()=>{hr.set(!T.showExcerpt)}),this.addCommand({id:"show-modal",name:"Vault search",callback:()=>{new Sr(this.app).open()}}),this.addCommand({id:"show-modal-infile",name:"In-file search",editorCallback:(e,r)=>{r.file&&new wn(this.app,r.file).open()}}),this.app.workspace.onLayoutReady(async()=>{this.registerEvent(this.app.vault.on("create",e=>{Jn(e.path)&&(he("Indexing new file",e.path),Ee.addFromPaths([e.path]))})),this.registerEvent(this.app.vault.on("delete",e=>{he("Removing file",e.path),Se.removeFromLiveCache(e.path),Ee.removeFromPaths([e.path])})),this.registerEvent(this.app.vault.on("modify",async e=>{Jn(e.path)&&(he("Updating file",e.path),await Se.addToLiveCache(e.path),hm(e))})),this.registerEvent(this.app.vault.on("rename",async(e,r)=>{Jn(e.path)&&(he("Renaming file",e.path),Se.removeFromLiveCache(r),await Se.addToLiveCache(e.path),Ee.removeFromPaths([r]),await Ee.addFromPaths([e.path]))})),await this.executeFirstLaunchTasks(),await this.populateIndex(),this.apiHttpServer&&T.httpApiEnabled&&this.apiHttpServer.listen(T.httpApiPort)})}async executeFirstLaunchTasks(){let e="1.21.0";if(T.welcomeMessage!==e&&Ge()){let r=new DocumentFragment;r.createSpan({},n=>{n.innerHTML="\u{1F50E} Omnisearch can now index .docx and .xlsx documents. Don't forget to update Text Extractor and enable the toggle in Omnisearch settings."}),new nr.Notice(r,2e4)}T.welcomeMessage=e,await this.saveData(T)}async onunload(){delete globalThis.omnisearch,await Ae.clearCache(),this.apiHttpServer.close()}addRibbonButton(){this.ribbonButton=this.addRibbonIcon("search","Omnisearch",e=>{new Sr(this.app).open()})}removeRibbonButton(){this.ribbonButton&&this.ribbonButton.parentNode?.removeChild(this.ribbonButton)}async populateIndex(){console.time("Omnisearch - Indexing total time"),Ht.set(tt.ReadingFiles);let e=this.app.vault.getFiles().filter(n=>Jn(n.path));console.log(`Omnisearch - ${e.length} files total`),console.log(`Omnisearch - Cache is ${Et()?"enabled":"disabled"}`),Et()&&(console.time("Omnisearch - Loading index from cache"),Ht.set(tt.LoadingCache),await Ee.loadCache()&&console.timeEnd("Omnisearch - Loading index from cache"));let r=Ee.getDiff(e.map(n=>({path:n.path,mtime:n.stat.mtime})));Et()&&(r.toAdd.length&&console.log("Omnisearch - Total number of files to add/update: "+r.toAdd.length),r.toRemove.length&&console.log("Omnisearch - Total number of files to remove: "+r.toRemove.length)),r.toAdd.length>=1e3&&Et()&&new nr.Notice(`Omnisearch - ${r.toAdd.length} files need to be indexed. Obsidian may experience stutters and freezes during the process`,1e4),Ht.set(tt.IndexingFiles),Ee.removeFromPaths(r.toRemove.map(n=>n.path)),await Ee.addFromPaths(r.toAdd.map(n=>n.path)),(r.toRemove.length||r.toAdd.length)&&Et()&&(Ht.set(tt.WritingCache),T.useCache=!1,await oe(this),await Ee.writeToCache(),T.useCache=!0,await oe(this)),console.timeEnd("Omnisearch - Indexing total time"),r.toAdd.length>=1e3&&Et()&&new nr.Notice("Omnisearch - Your files have been indexed."),Ht.set(tt.Done),Om()}};async function V1(t){let e=[`${t.vault.configDir}/plugins/omnisearch/searchIndex.json`,`${t.vault.configDir}/plugins/omnisearch/notesCache.json`,`${t.vault.configDir}/plugins/omnisearch/notesCache.data`,`${t.vault.configDir}/plugins/omnisearch/searchIndex.data`,`${t.vault.configDir}/plugins/omnisearch/historyCache.json`,`${t.vault.configDir}/plugins/omnisearch/pdfCache.data`];for(let r of e)if(await t.vault.adapter.exists(r))try{await t.vault.adapter.remove(r)}catch{}}function W1(t){t.registerObsidianProtocolHandler("omnisearch",e=>{new Sr(t.app,e.query).open()}),globalThis.omnisearch=mi,t.app.plugins.plugins.omnisearch.api=mi}