obsidian-template/.obsidian/plugins/omnisearch/main.js
baalajimaestro 2b005aa90d
Add omnisearch plugin
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-03-25 22:06:44 +05:30

45 lines
186 KiB
JavaScript

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var jc=Object.create;var Fr=Object.defineProperty,Ac=Object.defineProperties,Cc=Object.getOwnPropertyDescriptor,Sc=Object.getOwnPropertyDescriptors,Fc=Object.getOwnPropertyNames,to=Object.getOwnPropertySymbols,Ec=Object.getPrototypeOf,ro=Object.prototype.hasOwnProperty,Dc=Object.prototype.propertyIsEnumerable;var no=(t,e,r)=>e in t?Fr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,re=(t,e)=>{for(var r in e||(e={}))ro.call(e,r)&&no(t,r,e[r]);if(to)for(var r of to(e))Dc.call(e,r)&&no(t,r,e[r]);return t},be=(t,e)=>Ac(t,Sc(e)),io=t=>Fr(t,"__esModule",{value:!0});var Tc=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),kc=(t,e)=>{io(t);for(var r in e)Fr(t,r,{get:e[r],enumerable:!0})},Oc=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Fc(e))!ro.call(t,n)&&n!=="default"&&Fr(t,n,{get:()=>e[n],enumerable:!(r=Cc(e,n))||r.enumerable});return t},Ce=t=>Oc(io(Fr(t!=null?jc(Ec(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var ya=Tc((Xr,xs)=>{(function(t,e){if(typeof Xr=="object"&&typeof xs=="object")xs.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var r=e();for(var n in r)(typeof Xr=="object"?Xr:t)[n]=r[n]}})(typeof self!="undefined"?self:Xr,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,s){r.o(n,i)||Object.defineProperty(n,i,{enumerable:!0,get:s})},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 s=Object.create(null);if(r.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:n}),2&i&&typeof n!="string")for(var o in n)r.d(s,o,function(a){return n[a]}.bind(null,o));return s},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 x});var n="0123456789abcdef".split(""),i=function(b){for(var h="",v=0;v<4;v++)h+=n[b>>8*v+4&15]+n[b>>8*v&15];return h},s=function(b){for(var h=b.length,v=0;v<h;v++)b[v]=i(b[v]);return b.join("")},o=function(b,h){return b+h&4294967295},a=function(b,h,v,m,p,_,y){return function(j,A,C){return o(j<<A|j>>>32-A,C)}(h=function(j,A,C,S){return A=o(o(A,j),o(C,S))}(b,h,m,_),p,v)},l=function(b,h,v,m,p,_,y,j){return a(v&m|~v&p,h,v,_,y,j,b)},u=function(b,h,v,m,p,_,y,j){return a(v&p|m&~p,h,v,_,y,j,b)},c=function(b,h,v,m,p,_,y,j){return a(v^m^p,h,v,_,y,j,b)},f=function(b,h,v,m,p,_,y,j){return a(m^(v|~p),h,v,_,y,j,b)},d=function(b,h,v){v===void 0&&(v=o);var m=b[0],p=b[1],_=b[2],y=b[3],j=l.bind(null,v);m=j(m,p,_,y,h[0],7,-680876936),y=j(y,m,p,_,h[1],12,-389564586),_=j(_,y,m,p,h[2],17,606105819),p=j(p,_,y,m,h[3],22,-1044525330),m=j(m,p,_,y,h[4],7,-176418897),y=j(y,m,p,_,h[5],12,1200080426),_=j(_,y,m,p,h[6],17,-1473231341),p=j(p,_,y,m,h[7],22,-45705983),m=j(m,p,_,y,h[8],7,1770035416),y=j(y,m,p,_,h[9],12,-1958414417),_=j(_,y,m,p,h[10],17,-42063),p=j(p,_,y,m,h[11],22,-1990404162),m=j(m,p,_,y,h[12],7,1804603682),y=j(y,m,p,_,h[13],12,-40341101),_=j(_,y,m,p,h[14],17,-1502002290),p=j(p,_,y,m,h[15],22,1236535329);var A=u.bind(null,v);m=A(m,p,_,y,h[1],5,-165796510),y=A(y,m,p,_,h[6],9,-1069501632),_=A(_,y,m,p,h[11],14,643717713),p=A(p,_,y,m,h[0],20,-373897302),m=A(m,p,_,y,h[5],5,-701558691),y=A(y,m,p,_,h[10],9,38016083),_=A(_,y,m,p,h[15],14,-660478335),p=A(p,_,y,m,h[4],20,-405537848),m=A(m,p,_,y,h[9],5,568446438),y=A(y,m,p,_,h[14],9,-1019803690),_=A(_,y,m,p,h[3],14,-187363961),p=A(p,_,y,m,h[8],20,1163531501),m=A(m,p,_,y,h[13],5,-1444681467),y=A(y,m,p,_,h[2],9,-51403784),_=A(_,y,m,p,h[7],14,1735328473),p=A(p,_,y,m,h[12],20,-1926607734);var C=c.bind(null,v);m=C(m,p,_,y,h[5],4,-378558),y=C(y,m,p,_,h[8],11,-2022574463),_=C(_,y,m,p,h[11],16,1839030562),p=C(p,_,y,m,h[14],23,-35309556),m=C(m,p,_,y,h[1],4,-1530992060),y=C(y,m,p,_,h[4],11,1272893353),_=C(_,y,m,p,h[7],16,-155497632),p=C(p,_,y,m,h[10],23,-1094730640),m=C(m,p,_,y,h[13],4,681279174),y=C(y,m,p,_,h[0],11,-358537222),_=C(_,y,m,p,h[3],16,-722521979),p=C(p,_,y,m,h[6],23,76029189),m=C(m,p,_,y,h[9],4,-640364487),y=C(y,m,p,_,h[12],11,-421815835),_=C(_,y,m,p,h[15],16,530742520),p=C(p,_,y,m,h[2],23,-995338651);var S=f.bind(null,v);m=S(m,p,_,y,h[0],6,-198630844),y=S(y,m,p,_,h[7],10,1126891415),_=S(_,y,m,p,h[14],15,-1416354905),p=S(p,_,y,m,h[5],21,-57434055),m=S(m,p,_,y,h[12],6,1700485571),y=S(y,m,p,_,h[3],10,-1894986606),_=S(_,y,m,p,h[10],15,-1051523),p=S(p,_,y,m,h[1],21,-2054922799),m=S(m,p,_,y,h[8],6,1873313359),y=S(y,m,p,_,h[15],10,-30611744),_=S(_,y,m,p,h[6],15,-1560198380),p=S(p,_,y,m,h[13],21,1309151649),m=S(m,p,_,y,h[4],6,-145523070),y=S(y,m,p,_,h[11],10,-1120210379),_=S(_,y,m,p,h[2],15,718787259),p=S(p,_,y,m,h[9],21,-343485551),b[0]=v(m,b[0]),b[1]=v(p,b[1]),b[2]=v(_,b[2]),b[3]=v(y,b[3])},g=function(b){for(var h=[],v=0;v<64;v+=4)h[v>>2]=b.charCodeAt(v)+(b.charCodeAt(v+1)<<8)+(b.charCodeAt(v+2)<<16)+(b.charCodeAt(v+3)<<24);return h},w=function(b,h){var v,m=b.length,p=[1732584193,-271733879,-1732584194,271733878];for(v=64;v<=m;v+=64)d(p,g(b.substring(v-64,v)),h);var _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],y=(b=b.substring(v-64)).length;for(v=0;v<y;v++)_[v>>2]|=b.charCodeAt(v)<<(v%4<<3);if(_[v>>2]|=128<<(v%4<<3),v>55)for(d(p,_,h),v=16;v--;)_[v]=0;return _[14]=8*m,d(p,_,h),p};function x(b){var h;return s(w("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(h=function(v,m){var p=(65535&v)+(65535&m);return(v>>16)+(m>>16)+(p>>16)<<16|65535&p}),s(w(b,h))}}])})});kc(exports,{default:()=>Zs});var Sr=Ce(require("obsidian"));var _c=Ce(require("obsidian"));function ne(){}function Ic(t,e){for(let r in e)t[r]=e[r];return t}function yi(t){return t()}function so(){return Object.create(null)}function Re(t){t.forEach(yi)}function Ut(t){return typeof t=="function"}function fe(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}var an;function vi(t,e){return an||(an=document.createElement("a")),an.href=e,t===an.href}function oo(t){return Object.keys(t).length===0}function ao(t,...e){if(t==null)return ne;let r=t.subscribe(...e);return r.unsubscribe?()=>r.unsubscribe():r}function ln(t,e,r){t.$$.on_destroy.push(ao(e,r))}function Gt(t,e,r,n){if(t){let i=lo(t,e,r,n);return t[0](i)}}function lo(t,e,r,n){return t[1]&&n?Ic(r.ctx.slice(),t[1](n(e))):r.ctx}function qt(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 s=[],o=Math.max(e.dirty.length,i.length);for(let a=0;a<o;a+=1)s[a]=e.dirty[a]|i[a];return s}return e.dirty|i}return e.dirty}function Qt(t,e,r,n,i,s){if(i){let o=lo(e,r,n,s);t.p(o,i)}}function Yt(t){if(t.ctx.length>32){let e=[],r=t.ctx.length/32;for(let n=0;n<r;n++)e[n]=-1;return e}return-1}function uo(t){return t&&Ut(t.destroy)?t.destroy:ne}var co=!1;function Mc(){co=!0}function Pc(){co=!1}function k(t,e){t.appendChild(e)}function z(t,e,r){t.insertBefore(e,r||null)}function K(t){t.parentNode&&t.parentNode.removeChild(t)}function un(t,e){for(let r=0;r<t.length;r+=1)t[r]&&t[r].d(e)}function I(t){return document.createElement(t)}function Se(t){return document.createTextNode(t)}function U(){return Se(" ")}function Jt(){return Se("")}function Te(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function B(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function Rc(t){return Array.from(t.childNodes)}function Ft(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function _i(t,e){t.value=e??""}function ke(t,e,r,n){r===null?t.style.removeProperty(e):t.style.setProperty(e,r,n?"important":"")}function bi(t,e,r){t.classList[r?"add":"remove"](e)}function Bc(t,e,{bubbles:r=!1,cancelable:n=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(t,r,n,e),i}var Er;function Dr(t){Er=t}function xi(){if(!Er)throw new Error("Function called outside component initialization");return Er}function Tr(t){xi().$$.on_mount.push(t)}function kr(t){xi().$$.on_destroy.push(t)}function wi(){let t=xi();return(e,r,{cancelable:n=!1}={})=>{let i=t.$$.callbacks[e];if(i){let s=Bc(e,r,{cancelable:n});return i.slice().forEach(o=>{o.call(t,s)}),!s.defaultPrevented}return!0}}function Me(t,e){let r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}var Or=[];var $e=[],cn=[],fo=[],ho=Promise.resolve(),ji=!1;function po(){ji||(ji=!0,ho.then(mo))}function ot(){return po(),ho}function Ai(t){cn.push(t)}var Ci=new Set,fn=0;function mo(){let t=Er;do{for(;fn<Or.length;){let e=Or[fn];fn++,Dr(e),Lc(e.$$)}for(Dr(null),Or.length=0,fn=0;$e.length;)$e.pop()();for(let e=0;e<cn.length;e+=1){let r=cn[e];Ci.has(r)||(Ci.add(r),r())}cn.length=0}while(Or.length);for(;fo.length;)fo.pop()();ji=!1,Ci.clear(),Dr(t)}function Lc(t){if(t.fragment!==null){t.update(),Re(t.before_update);let e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Ai)}}var dn=new Set,Et;function Dt(){Et={r:0,c:[],p:Et}}function Tt(){Et.r||Re(Et.c),Et=Et.p}function q(t,e){t&&t.i&&(dn.delete(t),t.i(e))}function Q(t,e,r,n){if(t&&t.o){if(dn.has(t))return;dn.add(t),Et.c.push(()=>{dn.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}var Iy=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;function Fe(t){t&&t.c()}function xe(t,e,r,n){let{fragment:i,after_update:s}=t.$$;i&&i.m(e,r),n||Ai(()=>{let o=t.$$.on_mount.map(yi).filter(Ut);t.$$.on_destroy?t.$$.on_destroy.push(...o):Re(o),t.$$.on_mount=[]}),s.forEach(Ai)}function ge(t,e){let r=t.$$;r.fragment!==null&&(Re(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function Nc(t,e){t.$$.dirty[0]===-1&&(Or.push(t),po(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function ye(t,e,r,n,i,s,o,a=[-1]){let l=Er;Dr(t);let u=t.$$={fragment:null,ctx:[],props:s,update:ne,not_equal:i,bound:so(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:so(),dirty:a,skip_bound:!1,root:e.target||l.$$.root};o&&o(u.root);let c=!1;if(u.ctx=r?r(t,e.props||{},(f,d,...g)=>{let w=g.length?g[0]:d;return u.ctx&&i(u.ctx[f],u.ctx[f]=w)&&(!u.skip_bound&&u.bound[f]&&u.bound[f](w),c&&Nc(t,f)),d}):[],u.update(),c=!0,Re(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){Mc();let f=Rc(e.target);u.fragment&&u.fragment.l(f),f.forEach(K)}else u.fragment&&u.fragment.c();e.intro&&q(t.$$.fragment),xe(t,e.target,e.anchor,e.customElement),Pc(),mo()}Dr(l)}var Kc;typeof HTMLElement=="function"&&(Kc=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(yi).filter(Ut);for(let e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(t,e,r){this[t]=r}disconnectedCallback(){Re(this.$$.on_disconnect)}$destroy(){ge(this,1),this.$destroy=ne}$on(t,e){if(!Ut(e))return ne;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&&!oo(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var pe=class{$destroy(){ge(this,1),this.$destroy=ne}$on(e,r){if(!Ut(r))return ne;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&&!oo(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var St=Ce(require("obsidian"));var Ta=Ce(require("obsidian"));var Si=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,s])=>!this.disabled.includes(i.split("@")[0]));for(let[i,s]of n)i.endsWith(`@${e}`)&&s(...r)}};var Xt=[];function hn(t,e=ne){let r,n=new Set;function i(a){if(fe(t,a)&&(t=a,r)){let l=!Xt.length;for(let u of n)u[1](),Xt.push(u,t);if(l){for(let u=0;u<Xt.length;u+=2)Xt[u][0](Xt[u+1]);Xt.length=0}}}function s(a){i(a(t))}function o(a,l=ne){let u=[a,l];return n.add(u),n.size===1&&(r=e(i)||ne),a(t),()=>{n.delete(u),n.size===0&&(r(),r=null)}}return{set:i,update:s,subscribe:o}}var G=Ce(require("obsidian"));var J=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,oe=Object.keys,ve=Array.isArray;typeof Promise!="undefined"&&!J.Promise&&(J.Promise=Promise);function we(t,e){return typeof e!="object"||oe(e).forEach(function(r){t[r]=e[r]}),t}var Ir=Object.getPrototypeOf,zc={}.hasOwnProperty;function Oe(t,e){return zc.call(t,e)}function Zt(t,e){typeof e=="function"&&(e=e(Ir(t))),(typeof Reflect=="undefined"?oe:Reflect.ownKeys)(e).forEach(r=>{We(t,r,e[r])})}var go=Object.defineProperty;function We(t,e,r,n){go(t,e,we(r&&Oe(r,"get")&&typeof r.get=="function"?{get:r.get,set:r.set,configurable:!0}:{value:r,configurable:!0,writable:!0},n))}function er(t){return{from:function(e){return t.prototype=Object.create(e.prototype),We(t.prototype,"constructor",t),{extend:Zt.bind(null,t.prototype)}}}}var Vc=Object.getOwnPropertyDescriptor;function Fi(t,e){let r=Vc(t,e),n;return r||(n=Ir(t))&&Fi(n,e)}var Hc=[].slice;function pn(t,e,r){return Hc.call(t,e,r)}function yo(t,e){return e(t)}function Mr(t){if(!t)throw new Error("Assertion Failed")}function vo(t){J.setImmediate?setImmediate(t):setTimeout(t,0)}function _o(t,e){return t.reduce((r,n,i)=>{var s=e(n,i);return s&&(r[s[0]]=s[1]),r},{})}function $c(t,e,r){try{t.apply(null,r)}catch(n){e&&e(n)}}function Ue(t,e){if(Oe(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var r=[],n=0,i=e.length;n<i;++n){var s=Ue(t,e[n]);r.push(s)}return r}var o=e.indexOf(".");if(o!==-1){var a=t[e.substr(0,o)];return a===void 0?void 0:Ue(a,e.substr(o+1))}}function Be(t,e,r){if(!(!t||e===void 0)&&!("isFrozen"in Object&&Object.isFrozen(t)))if(typeof e!="string"&&"length"in e){Mr(typeof r!="string"&&"length"in r);for(var n=0,i=e.length;n<i;++n)Be(t,e[n],r[n])}else{var s=e.indexOf(".");if(s!==-1){var o=e.substr(0,s),a=e.substr(s+1);if(a==="")r===void 0?ve(t)&&!isNaN(parseInt(o))?t.splice(o,1):delete t[o]:t[o]=r;else{var l=t[o];(!l||!Oe(t,o))&&(l=t[o]={}),Be(l,a,r)}}else r===void 0?ve(t)&&!isNaN(parseInt(e))?t.splice(e,1):delete t[e]:t[e]=r}}function Wc(t,e){typeof e=="string"?Be(t,e,void 0):"length"in e&&[].map.call(e,function(r){Be(t,r,void 0)})}function bo(t){var e={};for(var r in t)Oe(t,r)&&(e[r]=t[r]);return e}var Uc=[].concat;function xo(t){return Uc.apply([],t)}var wo="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(xo([8,16,32,64].map(t=>["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>J[t]),Gc=wo.map(t=>J[t]);_o(wo,t=>[t,!0]);var at=null;function Pr(t){at=typeof WeakMap!="undefined"&&new WeakMap;let e=Ei(t);return at=null,e}function Ei(t){if(!t||typeof t!="object")return t;let e=at&&at.get(t);if(e)return e;if(ve(t)){e=[],at&&at.set(t,e);for(var r=0,n=t.length;r<n;++r)e.push(Ei(t[r]))}else if(Gc.indexOf(t.constructor)>=0)e=t;else{let s=Ir(t);e=s===Object.prototype?{}:Object.create(s),at&&at.set(t,e);for(var i in t)Oe(t,i)&&(e[i]=Ei(t[i]))}return e}var{toString:qc}={};function Di(t){return qc.call(t).slice(8,-1)}var Ti=typeof Symbol!="undefined"?Symbol.iterator:"@@iterator",Qc=typeof Ti=="symbol"?function(t){var e;return t!=null&&(e=t[Ti])&&e.apply(t)}:function(){return null},tr={};function Ge(t){var e,r,n,i;if(arguments.length===1){if(ve(t))return t.slice();if(this===tr&&typeof t=="string")return[t];if(i=Qc(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}var ki=typeof Symbol!="undefined"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1,Ke=typeof location!="undefined"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function jo(t,e){Ke=t,Ao=e}var Ao=()=>!0,Yc=!new Error("").stack;function kt(){if(Yc)try{throw kt.arguments,new Error}catch(t){return t}return new Error}function Oi(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(Ao).map(n=>`
`+n).join("")):""}var Jc=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Co=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Ii=Jc.concat(Co),Xc={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"};function rr(t,e){this._e=kt(),this.name=t,this.message=e}er(rr).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Oi(this._e,2))}},toString:function(){return this.name+": "+this.message}});function So(t,e){return t+". Errors: "+Object.keys(e).map(r=>e[r].toString()).filter((r,n,i)=>i.indexOf(r)===n).join(`
`)}function mn(t,e,r,n){this._e=kt(),this.failures=e,this.failedKeys=n,this.successCount=r,this.message=So(t,e)}er(mn).from(rr);function Rr(t,e){this._e=kt(),this.name="BulkError",this.failures=Object.keys(e).map(r=>e[r]),this.failuresByPos=e,this.message=So(t,e)}er(Rr).from(rr);var Mi=Ii.reduce((t,e)=>(t[e]=e+"Error",t),{}),Zc=rr,L=Ii.reduce((t,e)=>{var r=e+"Error";function n(i,s){this._e=kt(),this.name=r,i?typeof i=="string"?(this.message=`${i}${s?`
`+s:""}`,this.inner=s||null):typeof i=="object"&&(this.message=`${i.name} ${i.message}`,this.inner=i):(this.message=Xc[e]||r,this.inner=null)}return er(n).from(Zc),t[e]=n,t},{});L.Syntax=SyntaxError;L.Type=TypeError;L.Range=RangeError;var Fo=Co.reduce((t,e)=>(t[e+"Error"]=L[e],t),{});function ef(t,e){if(!t||t instanceof rr||t instanceof TypeError||t instanceof SyntaxError||!t.name||!Fo[t.name])return t;var r=new Fo[t.name](e||t.message,t);return"stack"in t&&We(r,"stack",{get:function(){return this.inner.stack}}),r}var gn=Ii.reduce((t,e)=>(["Syntax","Type","Range"].indexOf(e)===-1&&(t[e+"Error"]=L[e]),t),{});gn.ModifyError=mn;gn.DexieError=rr;gn.BulkError=Rr;function Y(){}function Br(t){return t}function tf(t,e){return t==null||t===Br?e:function(r){return e(t(r))}}function Ot(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function rf(t,e){return t===Y?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 s=e.apply(this,arguments);return n&&(this.onsuccess=this.onsuccess?Ot(n,this.onsuccess):n),i&&(this.onerror=this.onerror?Ot(i,this.onerror):i),s!==void 0?s:r}}function nf(t,e){return t===Y?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?Ot(r,this.onsuccess):r),n&&(this.onerror=this.onerror?Ot(n,this.onerror):n)}}function sf(t,e){return t===Y?e:function(r){var n=t.apply(this,arguments);we(r,n);var i=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var o=e.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?Ot(i,this.onsuccess):i),s&&(this.onerror=this.onerror?Ot(s,this.onerror):s),n===void 0?o===void 0?void 0:o:we(n,o)}}function of(t,e){return t===Y?e:function(){return e.apply(this,arguments)===!1?!1:t.apply(this,arguments)}}function Pi(t,e){return t===Y?e:function(){var r=t.apply(this,arguments);if(r&&typeof r.then=="function"){for(var n=this,i=arguments.length,s=new Array(i);i--;)s[i]=arguments[i];return r.then(function(){return e.apply(n,s)})}return e.apply(this,arguments)}}var Lr={},af=100,lf=20,Eo=100,[Ri,yn,Bi]=typeof Promise=="undefined"?[]:(()=>{let t=Promise.resolve();if(typeof crypto=="undefined"||!crypto.subtle)return[t,Ir(t),t];let e=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[e,Ir(e),t]})(),Do=yn&&yn.then,vn=Ri&&Ri.constructor,Li=!!Bi,Ni=!1,uf=Bi?()=>{Bi.then(wn)}:J.setImmediate?setImmediate.bind(null,wn):J.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver(()=>{wn(),t=null}).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(wn,0)},Nr=function(t,e){Kr.push([t,e]),_n&&(uf(),_n=!1)},Ki=!0,_n=!0,It=[],bn=[],zi=null,Vi=Br,nr={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:No,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(t=>{try{No(t[0],t[1])}catch{}})}},R=nr,Kr=[],Mt=0,xn=[];function O(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=Y,this._lib=!1;var e=this._PSD=R;if(Ke&&(this._stackHolder=kt(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==Lr)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&$i(this,this._value);return}this._state=null,this._value=null,++e.ref,ko(this,t)}var Hi={get:function(){var t=R,e=Cn;function r(n,i){var s=!t.global&&(t!==R||e!==Cn);let o=s&&!qe();var a=new O((l,u)=>{Wi(this,new To(Fn(n,t,s,o),Fn(i,t,s,o),l,u,t))});return Ke&&Mo(a,this),a}return r.prototype=Lr,r},set:function(t){We(this,"then",t&&t.prototype===Lr?Hi:{get:function(){return t},set:Hi.set})}};Zt(O.prototype,{then:Hi,_then:function(t,e){Wi(this,new To(null,null,t,e,R))},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):jn(n)):this.then(null,n=>n&&n.name===e?r(n):jn(n))},finally:function(t){return this.then(e=>(t(),e),e=>(t(),jn(e)))},stack:{get:function(){if(this._stack)return this._stack;try{Ni=!0;var t=Io(this,[],lf),e=t.join(`
From previous: `);return this._state!==null&&(this._stack=e),e}finally{Ni=!1}}},timeout:function(t,e){return t<1/0?new O((r,n)=>{var i=setTimeout(()=>n(new L.Timeout(e)),t);this.then(r,n).finally(clearTimeout.bind(null,i))}):this}});typeof Symbol!="undefined"&&Symbol.toStringTag&&We(O.prototype,Symbol.toStringTag,"Dexie.Promise");nr.env=Po();function To(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}Zt(O,{all:function(){var t=Ge.apply(null,arguments).map(Sn);return new O(function(e,r){t.length===0&&e([]);var n=t.length;t.forEach((i,s)=>O.resolve(i).then(o=>{t[s]=o,--n||e(t)},r))})},resolve:t=>{if(t instanceof O)return t;if(t&&typeof t.then=="function")return new O((r,n)=>{t.then(r,n)});var e=new O(Lr,!0,t);return Mo(e,zi),e},reject:jn,race:function(){var t=Ge.apply(null,arguments).map(Sn);return new O((e,r)=>{t.map(n=>O.resolve(n).then(e,r))})},PSD:{get:()=>R,set:t=>R=t},totalEchoes:{get:()=>Cn},newPSD:lt,usePSD:sr,scheduler:{get:()=>Nr,set:t=>{Nr=t}},rejectionMapper:{get:()=>Vi,set:t=>{Vi=t}},follow:(t,e)=>new O((r,n)=>lt((i,s)=>{var o=R;o.unhandleds=[],o.onunhandled=s,o.finalize=Ot(function(){ff(()=>{this.unhandleds.length===0?i():s(this.unhandleds[0])})},o.finalize),t()},e,r,n))});vn&&(vn.allSettled&&We(O,"allSettled",function(){let t=Ge.apply(null,arguments).map(Sn);return new O(e=>{t.length===0&&e([]);let r=t.length,n=new Array(r);t.forEach((i,s)=>O.resolve(i).then(o=>n[s]={status:"fulfilled",value:o},o=>n[s]={status:"rejected",reason:o}).then(()=>--r||e(n)))})}),vn.any&&typeof AggregateError!="undefined"&&We(O,"any",function(){let t=Ge.apply(null,arguments).map(Sn);return new O((e,r)=>{t.length===0&&r(new AggregateError([]));let n=t.length,i=new Array(n);t.forEach((s,o)=>O.resolve(s).then(a=>e(a),a=>{i[o]=a,--n||r(new AggregateError(i))}))})}));function ko(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&&zr();r&&typeof r.then=="function"?ko(t,(i,s)=>{r instanceof O?r._then(i,s):r.then(i,s)}):(t._state=!0,t._value=r,Oo(t)),n&&Vr()}},$i.bind(null,t))}catch(r){$i(t,r)}}function $i(t,e){if(bn.push(e),t._state===null){var r=t._lib&&zr();e=Vi(e),t._state=!1,t._value=e,Ke&&e!==null&&typeof e=="object"&&!e._promise&&$c(()=>{var n=Fi(e,"stack");e._promise=t,We(e,"stack",{get:()=>Ni?n&&(n.get?n.get.apply(e):n.value):t.stack})}),df(t),Oo(t),r&&Vr()}}function Oo(t){var e=t._listeners;t._listeners=[];for(var r=0,n=e.length;r<n;++r)Wi(t,e[r]);var i=t._PSD;--i.ref||i.finalize(),Mt===0&&(++Mt,Nr(()=>{--Mt==0&&Ui()},[]))}function Wi(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,++Mt,Nr(cf,[r,t,e])}function cf(t,e,r){try{zi=e;var n,i=e._value;e._state?n=t(i):(bn.length&&(bn=[]),n=t(i),bn.indexOf(i)===-1&&hf(e)),r.resolve(n)}catch(s){r.reject(s)}finally{zi=null,--Mt==0&&Ui(),--r.psd.ref||r.psd.finalize()}}function Io(t,e,r){if(e.length===r)return e;var n="";if(t._state===!1){var i=t._value,s,o;i!=null?(s=i.name||"Error",o=i.message||i,n=Oi(i,0)):(s=i,o=""),e.push(s+(o?": "+o:"")+n)}return Ke&&(n=Oi(t._stackHolder,2),n&&e.indexOf(n)===-1&&e.push(n),t._prev&&Io(t._prev,e,r)),e}function Mo(t,e){var r=e?e._numPrev+1:0;r<af&&(t._prev=e,t._numPrev=r)}function wn(){zr()&&Vr()}function zr(){var t=Ki;return Ki=!1,_n=!1,t}function Vr(){var t,e,r;do for(;Kr.length>0;)for(t=Kr,Kr=[],r=t.length,e=0;e<r;++e){var n=t[e];n[0].apply(null,n[1])}while(Kr.length>0);Ki=!0,_n=!0}function Ui(){var t=It;It=[],t.forEach(n=>{n._PSD.onunhandled.call(null,n._value,n)});for(var e=xn.slice(0),r=e.length;r;)e[--r]()}function ff(t){function e(){t(),xn.splice(xn.indexOf(e),1)}xn.push(e),++Mt,Nr(()=>{--Mt==0&&Ui()},[])}function df(t){It.some(e=>e._value===t._value)||It.push(t)}function hf(t){for(var e=It.length;e;)if(It[--e]._value===t._value){It.splice(e,1);return}}function jn(t){return new O(Lr,!1,t)}function Z(t,e){var r=R;return function(){var n=zr(),i=R;try{return ut(r,!0),t.apply(this,arguments)}catch(s){e&&e(s)}finally{ut(i,!1),n&&Vr()}}}var _e={awaits:0,echoes:0,id:0},pf=0,An=[],Gi=0,Cn=0,mf=0;function lt(t,e,r,n){var i=R,s=Object.create(i);s.parent=i,s.ref=0,s.global=!1,s.id=++mf;var o=nr.env;s.env=Li?{Promise:O,PromiseProp:{value:O,configurable:!0,writable:!0},all:O.all,race:O.race,allSettled:O.allSettled,any:O.any,resolve:O.resolve,reject:O.reject,nthen:Bo(o.nthen,s),gthen:Bo(o.gthen,s)}:{},e&&we(s,e),++i.ref,s.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=sr(s,t,r,n);return s.ref===0&&s.finalize(),a}function ir(){return _e.id||(_e.id=++pf),++_e.awaits,_e.echoes+=Eo,_e.id}function qe(){return _e.awaits?(--_e.awaits==0&&(_e.id=0),_e.echoes=_e.awaits*Eo,!0):!1}(""+Do).indexOf("[native code]")===-1&&(ir=qe=Y);function Sn(t){return _e.echoes&&t&&t.constructor===vn?(ir(),t.then(e=>(qe(),e),e=>(qe(),le(e)))):t}function gf(t){++Cn,(!_e.echoes||--_e.echoes==0)&&(_e.echoes=_e.id=0),An.push(R),ut(t,!0)}function yf(){var t=An[An.length-1];An.pop(),ut(t,!1)}function ut(t,e){var r=R;if((e?_e.echoes&&(!Gi++||t!==R):Gi&&(!--Gi||t!==R))&&Ro(e?gf.bind(null,t):yf),t!==R&&(R=t,r===nr&&(nr.env=Po()),Li)){var n=nr.env.Promise,i=t.env;yn.then=i.nthen,n.prototype.then=i.gthen,(r.global||t.global)&&(Object.defineProperty(J,"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 Po(){var t=J.Promise;return Li?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(J,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:yn.then,gthen:t.prototype.then}:{}}function sr(t,e,r,n,i){var s=R;try{return ut(t,!0),e(r,n,i)}finally{ut(s,!1)}}function Ro(t){Do.call(Ri,t)}function Fn(t,e,r,n){return typeof t!="function"?t:function(){var i=R;r&&ir(),ut(e,!0);try{return t.apply(this,arguments)}finally{ut(i,!1),n&&Ro(qe)}}}function Bo(t,e){return function(r,n){return t.call(this,Fn(r,e),Fn(n,e))}}var Lo="unhandledrejection";function No(t,e){var r;try{r=e.onuncatched(t)}catch{}if(r!==!1)try{var n,i={promise:e,reason:t};if(J.document&&document.createEvent?(n=document.createEvent("Event"),n.initEvent(Lo,!0,!0),we(n,i)):J.CustomEvent&&(n=new CustomEvent(Lo,{detail:i}),we(n,i)),n&&J.dispatchEvent&&(dispatchEvent(n),!J.PromiseRejectionEvent&&J.onunhandledrejection))try{J.onunhandledrejection(n)}catch{}Ke&&n&&!n.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var le=O.reject;function qi(t,e,r,n){if(!t.idbdb||!t._state.openComplete&&!R.letThrough&&!t._vip){if(t._state.openComplete)return le(new L.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return le(new L.DatabaseClosed);t.open().catch(Y)}return t._state.dbReadyPromise.then(()=>qi(t,e,r,n))}else{var i=t._createTransaction(e,r,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(s){return s.name===Mi.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>qi(t,e,r,n))):le(s)}return i._promise(e,(s,o)=>lt(()=>(R.trans=i,n(s,o,i)))).then(s=>i._completion.then(()=>s))}}var Ko="3.2.2",Pt=String.fromCharCode(65535),Qi=-1/0,Qe="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",zo="String expected.",Hr=[],En=typeof navigator!="undefined"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),vf=En,_f=En,Vo=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),Dn="__dbnames",Yi="readonly",Ji="readwrite";function Rt(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}var Ho={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Tn(t){return typeof t=="string"&&!/\./.test(t)?e=>(e[t]===void 0&&t in e&&(e=Pr(e),delete e[t]),e):e=>e}var $o=class{_trans(e,r,n){let i=this._tx||R.trans,s=this.name;function o(l,u,c){if(!c.schema[s])throw new L.NotFound("Table "+s+" not part of transaction");return r(c.idbtrans,c)}let a=zr();try{return i&&i.db===this.db?i===R.trans?i._promise(e,o,n):lt(()=>i._promise(e,o,n),{trans:i,transless:R.transless||R}):qi(this.db,e,[this.name],o)}finally{a&&Vr()}}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(ve(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let r=oe(e);if(r.length===1)return this.where(r[0]).equals(e[r[0]]);let n=this.schema.indexes.concat(this.schema.primKey).filter(u=>u.compound&&r.every(c=>u.keyPath.indexOf(c)>=0)&&u.keyPath.every(c=>r.indexOf(c)>=0))[0];if(n&&this.db._maxKey!==Pt)return this.where(n.name).equals(n.keyPath.map(u=>e[u]));!n&&Ke&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${r.join("+")}]`);let{idxByName:i}=this.schema,s=this.db._deps.indexedDB;function o(u,c){try{return s.cmp(u,c)===0}catch{return!1}}let[a,l]=r.reduce(([u,c],f)=>{let d=i[f],g=e[f];return[u||d,u||!d?Rt(c,d&&d.multi?w=>{let x=Ue(w,f);return ve(x)&&x.some(b=>o(g,b))}:w=>o(g,Ue(w,f))):c]},[null,null]);return a?this.where(a.name).equals(e[a.keyPath]).filter(l):n?this.filter(l):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,ve(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 s in n)if(Oe(n,s))try{i[s]=n[s]}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){we(this,r)}return this.mapToClass(e)}add(e,r){let{auto:n,keyPath:i}=this.schema.primKey,s=e;return i&&n&&(s=Tn(i)(e)),this._trans("readwrite",o=>this.core.mutate({trans:o,type:"add",keys:r!=null?[r]:null,values:[s]})).then(o=>o.numFailures?O.reject(o.failures[0]):o.lastResult).then(o=>{if(i)try{Be(e,i,o)}catch{}return o})}update(e,r){if(typeof e=="object"&&!ve(e)){let n=Ue(e,this.schema.primKey.keyPath);if(n===void 0)return le(new L.InvalidArgument("Given object does not contain its primary key"));try{typeof r!="function"?oe(r).forEach(i=>{Be(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,s=e;return i&&n&&(s=Tn(i)(e)),this._trans("readwrite",o=>this.core.mutate({trans:o,type:"put",values:[s],keys:r!=null?[r]:null})).then(o=>o.numFailures?O.reject(o.failures[0]):o.lastResult).then(o=>{if(i)try{Be(e,i,o)}catch{}return o})}delete(e){return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:[e]})).then(r=>r.numFailures?O.reject(r.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:Ho})).then(e=>e.numFailures?O.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 s=n?n.allKeys:void 0;return this._trans("readwrite",o=>{let{auto:a,keyPath:l}=this.schema.primKey;if(l&&i)throw new L.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new L.InvalidArgument("Arguments objects and keys must have the same length");let u=e.length,c=l&&a?e.map(Tn(l)):e;return this.core.mutate({trans:o,type:"add",keys:i,values:c,wantResults:s}).then(({numFailures:f,results:d,lastResult:g,failures:w})=>{let x=s?d:g;if(f===0)return x;throw new Rr(`${this.name}.bulkAdd(): ${f} of ${u} operations failed`,w)})})}bulkPut(e,r,n){let i=Array.isArray(r)?r:void 0;n=n||(i?void 0:r);let s=n?n.allKeys:void 0;return this._trans("readwrite",o=>{let{auto:a,keyPath:l}=this.schema.primKey;if(l&&i)throw new L.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new L.InvalidArgument("Arguments objects and keys must have the same length");let u=e.length,c=l&&a?e.map(Tn(l)):e;return this.core.mutate({trans:o,type:"put",keys:i,values:c,wantResults:s}).then(({numFailures:f,results:d,lastResult:g,failures:w})=>{let x=s?d:g;if(f===0)return x;throw new Rr(`${this.name}.bulkPut(): ${f} of ${u} operations failed`,w)})})}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:s})=>{if(n===0)return i;throw new Rr(`${this.name}.bulkDelete(): ${n} of ${r} operations failed`,s)})}};function $r(t){var e={},r=function(a,l){if(l){for(var u=arguments.length,c=new Array(u-1);--u;)c[u-1]=arguments[u];return e[a].subscribe.apply(null,c),t}else if(typeof a=="string")return e[a]};r.addEventType=s;for(var n=1,i=arguments.length;n<i;++n)s(arguments[n]);return r;function s(a,l,u){if(typeof a=="object")return o(a);l||(l=of),u||(u=Y);var c={subscribers:[],fire:u,subscribe:function(f){c.subscribers.indexOf(f)===-1&&(c.subscribers.push(f),c.fire=l(c.fire,f))},unsubscribe:function(f){c.subscribers=c.subscribers.filter(function(d){return d!==f}),c.fire=c.subscribers.reduce(l,u)}};return e[a]=r[a]=c,c}function o(a){oe(a).forEach(function(l){var u=a[l];if(ve(u))s(l,a[l][0],a[l][1]);else if(u==="asap")var c=s(l,Br,function(){for(var d=arguments.length,g=new Array(d);d--;)g[d]=arguments[d];c.subscribers.forEach(function(w){vo(function(){w.apply(null,g)})})});else throw new L.InvalidArgument("Invalid event config")})}}function Wr(t,e){return er(e).from({prototype:t}),e}function bf(t){return Wr($o.prototype,function(r,n,i){this.db=t,this._tx=i,this.name=r,this.schema=n,this.hook=t._allTables[r]?t._allTables[r].hook:$r(null,{creating:[rf,Y],reading:[tf,Br],updating:[sf,Y],deleting:[nf,Y]})})}function or(t,e){return!(t.filter||t.algorithm||t.or)&&(e?t.justLimit:!t.replayFilter)}function Xi(t,e){t.filter=Rt(t.filter,e)}function Zi(t,e,r){var n=t.replayFilter;t.replayFilter=n?()=>Rt(n(),e()):e,t.justLimit=r&&!n}function xf(t,e){t.isMatch=Rt(t.isMatch,e)}function kn(t,e){if(t.isPrimKey)return e.primaryKey;let r=e.getIndexByKeyPath(t.index);if(!r)throw new L.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return r}function Wo(t,e,r){let n=kn(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 On(t,e,r,n){let i=t.replayFilter?Rt(t.filter,t.replayFilter()):t.filter;if(t.or){let s={},o=(a,l,u)=>{if(!i||i(l,u,d=>l.stop(d),d=>l.fail(d))){var c=l.primaryKey,f=""+c;f==="[object ArrayBuffer]"&&(f=""+new Uint8Array(c)),Oe(s,f)||(s[f]=!0,e(a,l,u))}};return Promise.all([t.or._iterate(o,r),Uo(Wo(t,n,r),t.algorithm,o,!t.keysOnly&&t.valueMapper)])}else return Uo(Wo(t,n,r),Rt(t.algorithm,i),e,!t.keysOnly&&t.valueMapper)}function Uo(t,e,r,n){var i=n?(o,a,l)=>r(n(o),a,l):r,s=Z(i);return t.then(o=>{if(o)return o.start(()=>{var a=()=>o.continue();(!e||e(o,l=>a=l,l=>{o.stop(l),a=Y},l=>{o.fail(l),a=Y}))&&s(o.value,o,l=>a=l),a()})})}function je(t,e){try{let r=Go(t),n=Go(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:t<e?-1:0;case"binary":return jf(qo(t),qo(e));case"Array":return wf(t,e)}}catch{}return NaN}function wf(t,e){let r=t.length,n=e.length,i=r<n?r:n;for(let s=0;s<i;++s){let o=je(t[s],e[s]);if(o!==0)return o}return r===n?0:r<n?-1:1}function jf(t,e){let r=t.length,n=e.length,i=r<n?r:n;for(let s=0;s<i;++s)if(t[s]!==e[s])return t[s]<e[s]?-1:1;return r===n?0:r<n?-1:1}function Go(t){let e=typeof t;if(e!=="object")return e;if(ArrayBuffer.isView(t))return"binary";let r=Di(t);return r==="ArrayBuffer"?"binary":r}function qo(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}var Qo=class{_read(e,r){var n=this._ctx;return n.error?n.table._trans(null,le.bind(null,n.error)):n.table._trans("readonly",e).then(r)}_write(e){var r=this._ctx;return r.error?r.table._trans(null,le.bind(null,r.error)):r.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var r=this._ctx;r.algorithm=Rt(r.algorithm,e)}_iterate(e,r){return On(this._ctx,e,r,this._ctx.table.core)}clone(e){var r=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&we(n,e),r._ctx=n,r}raw(){return this._ctx.valueMapper=null,this}each(e){var r=this._ctx;return this._read(n=>On(r,e,n,r.table.core))}count(e){return this._read(r=>{let n=this._ctx,i=n.table.core;if(or(n,!0))return i.count({trans:r,query:{index:kn(n,i.schema),range:n.range}}).then(o=>Math.min(o,n.limit));var s=0;return On(n,()=>(++s,!1),r,i).then(()=>s)}).then(e)}sortBy(e,r){let n=e.split(".").reverse(),i=n[0],s=n.length-1;function o(u,c){return c?o(u[n[c]],c-1):u[i]}var a=this._ctx.dir==="next"?1:-1;function l(u,c){var f=o(u,s),d=o(c,s);return f<d?-a:f>d?a:0}return this.toArray(function(u){return u.sort(l)}).then(r)}toArray(e){return this._read(r=>{var n=this._ctx;if(n.dir==="next"&&or(n,!0)&&n.limit>0){let{valueMapper:i}=n,s=kn(n,n.table.core.schema);return n.table.core.query({trans:r,limit:n.limit,values:!0,query:{index:s,range:n.range}}).then(({result:o})=>i?o.map(i):o)}else{let i=[];return On(n,s=>i.push(s),r,n.table.core).then(()=>i)}},e)}offset(e){var r=this._ctx;return e<=0?this:(r.offset+=e,or(r)?Zi(r,()=>{var n=e;return(i,s)=>n===0?!0:n===1?(--n,!1):(s(()=>{i.advance(n),n=0}),!1)}):Zi(r,()=>{var n=e;return()=>--n<0}),this)}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Zi(this._ctx,()=>{var r=e;return function(n,i,s){return--r<=0&&i(s),r>=0}},!0),this}until(e,r){return Xi(this._ctx,function(n,i,s){return e(n.value)?(i(s),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 Xi(this._ctx,function(r){return e(r.value)}),xf(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,s){n.push(s.key)}).then(function(){return n}).then(e)}primaryKeys(e){var r=this._ctx;if(r.dir==="next"&&or(r,!0)&&r.limit>0)return this._read(i=>{var s=kn(r,r.table.core.schema);return r.table.core.query({trans:i,values:!1,limit:r.limit,query:{index:s,range:r.range}})}).then(({result:i})=>i).then(e);r.keysOnly=!r.isMatch;var n=[];return this.each(function(i,s){n.push(s.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 Xi(this._ctx,function(i){var s=i.primaryKey.toString(),o=Oe(n,s);return n[s]=!0,!o}),this}modify(e){var r=this._ctx;return this._write(n=>{var i;if(typeof e=="function")i=e;else{var s=oe(e),o=s.length;i=function(x){for(var b=!1,h=0;h<o;++h){var v=s[h],m=e[v];Ue(x,v)!==m&&(Be(x,v,m),b=!0)}return b}}let a=r.table.core,{outbound:l,extractKey:u}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,f=[],d=0,g=[],w=(x,b)=>{let{failures:h,numFailures:v}=b;d+=x-v;for(let m of oe(h))f.push(h[m])};return this.clone().primaryKeys().then(x=>{let b=h=>{let v=Math.min(c,x.length-h);return a.getMany({trans:n,keys:x.slice(h,h+v),cache:"immutable"}).then(m=>{let p=[],_=[],y=l?[]:null,j=[];for(let C=0;C<v;++C){let S=m[C],D={value:Pr(S),primKey:x[h+C]};i.call(D,D.value,D)!==!1&&(D.value==null?j.push(x[h+C]):!l&&je(u(S),u(D.value))!==0?(j.push(x[h+C]),p.push(D.value)):(_.push(D.value),l&&y.push(x[h+C])))}let A=or(r)&&r.limit===1/0&&(typeof e!="function"||e===es)&&{index:r.index,range:r.range};return Promise.resolve(p.length>0&&a.mutate({trans:n,type:"add",values:p}).then(C=>{for(let S in C.failures)j.splice(parseInt(S),1);w(p.length,C)})).then(()=>(_.length>0||A&&typeof e=="object")&&a.mutate({trans:n,type:"put",keys:y,values:_,criteria:A,changeSpec:typeof e!="function"&&e}).then(C=>w(_.length,C))).then(()=>(j.length>0||A&&e===es)&&a.mutate({trans:n,type:"delete",keys:j,criteria:A}).then(C=>w(j.length,C))).then(()=>x.length>h+v&&b(h+c))})};return b(0).then(()=>{if(f.length>0)throw new mn("Error modifying one or more objects",f,d,g);return x.length})})})}delete(){var e=this._ctx,r=e.range;return or(e)&&(e.isPrimKey&&!_f||r.type===3)?this._write(n=>{let{primaryKey:i}=e.table.core.schema,s=r;return e.table.core.count({trans:n,query:{index:i,range:s}}).then(o=>e.table.core.mutate({trans:n,type:"deleteRange",range:s}).then(({failures:a,lastResult:l,results:u,numFailures:c})=>{if(c)throw new mn("Could not delete some values",Object.keys(a).map(f=>a[f]),o-c);return o-c}))}):this.modify(es)}},es=(t,e)=>e.value=null;function Af(t){return Wr(Qo.prototype,function(r,n){this.db=t;let i=Ho,s=null;if(n)try{i=n()}catch(u){s=u}let o=r._ctx,a=o.table,l=a.hook.reading.fire;this._ctx={table:a,index:o.index,isPrimKey:!o.index||a.schema.primKey.keyPath&&o.index===a.schema.primKey.name,range:i,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:s,or:o.or,valueMapper:l!==Br?l:null}})}function Cf(t,e){return t<e?-1:t===e?0:1}function Sf(t,e){return t>e?-1:t===e?0:1}function Ie(t,e,r){var n=t instanceof ts?new t.Collection(t):t;return n._ctx.error=r?new r(e):new TypeError(e),n}function ar(t){return new t.Collection(t,()=>Yo("")).limit(0)}function Ff(t){return t==="next"?e=>e.toUpperCase():e=>e.toLowerCase()}function Ef(t){return t==="next"?e=>e.toLowerCase():e=>e.toUpperCase()}function Df(t,e,r,n,i,s){for(var o=Math.min(t.length,n.length),a=-1,l=0;l<o;++l){var u=e[l];if(u!==n[l])return i(t[l],r[l])<0?t.substr(0,l)+r[l]+r.substr(l+1):i(t[l],n[l])<0?t.substr(0,l)+n[l]+r.substr(l+1):a>=0?t.substr(0,a)+e[a]+r.substr(a+1):null;i(t[l],u)<0&&(a=l)}return o<n.length&&s==="next"?t+r.substr(t.length):o<t.length&&s==="prev"?t.substr(0,r.length):a<0?null:t.substr(0,a)+n[a]+r.substr(a+1)}function In(t,e,r,n){var i,s,o,a,l,u,c,f=r.length;if(!r.every(x=>typeof x=="string"))return Ie(t,zo);function d(x){i=Ff(x),s=Ef(x),o=x==="next"?Cf:Sf;var b=r.map(function(h){return{lower:s(h),upper:i(h)}}).sort(function(h,v){return o(h.lower,v.lower)});a=b.map(function(h){return h.upper}),l=b.map(function(h){return h.lower}),u=x,c=x==="next"?"":n}d("next");var g=new t.Collection(t,()=>ct(a[0],l[f-1]+n));g._ondirectionchange=function(x){d(x)};var w=0;return g._addAlgorithm(function(x,b,h){var v=x.key;if(typeof v!="string")return!1;var m=s(v);if(e(m,l,w))return!0;for(var p=null,_=w;_<f;++_){var y=Df(v,m,a[_],l[_],o,u);y===null&&p===null?w=_+1:(p===null||o(p,y)>0)&&(p=y)}return b(p!==null?function(){x.continue(p+c)}:h),!1}),g}function ct(t,e,r,n){return{type:2,lower:t,upper:e,lowerOpen:r,upperOpen:n}}function Yo(t){return{type:1,lower:t,upper:t}}var ts=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)?ar(this):new this.Collection(this,()=>ct(e,r,!n,!i))}catch{return Ie(this,Qe)}}equals(e){return e==null?Ie(this,Qe):new this.Collection(this,()=>Yo(e))}above(e){return e==null?Ie(this,Qe):new this.Collection(this,()=>ct(e,void 0,!0))}aboveOrEqual(e){return e==null?Ie(this,Qe):new this.Collection(this,()=>ct(e,void 0,!1))}below(e){return e==null?Ie(this,Qe):new this.Collection(this,()=>ct(void 0,e,!1,!0))}belowOrEqual(e){return e==null?Ie(this,Qe):new this.Collection(this,()=>ct(void 0,e))}startsWith(e){return typeof e!="string"?Ie(this,zo):this.between(e,e+Pt,!0,!0)}startsWithIgnoreCase(e){return e===""?this.startsWith(e):In(this,(r,n)=>r.indexOf(n[0])===0,[e],Pt)}equalsIgnoreCase(e){return In(this,(r,n)=>r===n[0],[e],"")}anyOfIgnoreCase(){var e=Ge.apply(tr,arguments);return e.length===0?ar(this):In(this,(r,n)=>n.indexOf(r)!==-1,e,"")}startsWithAnyOfIgnoreCase(){var e=Ge.apply(tr,arguments);return e.length===0?ar(this):In(this,(r,n)=>n.some(i=>r.indexOf(i)===0),e,Pt)}anyOf(){let e=Ge.apply(tr,arguments),r=this._cmp;try{e.sort(r)}catch{return Ie(this,Qe)}if(e.length===0)return ar(this);let n=new this.Collection(this,()=>ct(e[0],e[e.length-1]));n._ondirectionchange=s=>{r=s==="next"?this._ascending:this._descending,e.sort(r)};let i=0;return n._addAlgorithm((s,o,a)=>{let l=s.key;for(;r(l,e[i])>0;)if(++i,i===e.length)return o(a),!1;return r(l,e[i])===0?!0:(o(()=>{s.continue(e[i])}),!1)}),n}notEqual(e){return this.inAnyRange([[Qi,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=Ge.apply(tr,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return Ie(this,Qe)}let r=e.reduce((n,i)=>n?n.concat([[n[n.length-1][1],i]]):[[Qi,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,s=this._descending,o=this._min,a=this._max;if(e.length===0)return ar(this);if(!e.every(p=>p[0]!==void 0&&p[1]!==void 0&&i(p[0],p[1])<=0))return Ie(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",L.InvalidArgument);let l=!r||r.includeLowers!==!1,u=r&&r.includeUppers===!0;function c(p,_){let y=0,j=p.length;for(;y<j;++y){let A=p[y];if(n(_[0],A[1])<0&&n(_[1],A[0])>0){A[0]=o(A[0],_[0]),A[1]=a(A[1],_[1]);break}}return y===j&&p.push(_),p}let f=i;function d(p,_){return f(p[0],_[0])}let g;try{g=e.reduce(c,[]),g.sort(d)}catch{return Ie(this,Qe)}let w=0,x=u?p=>i(p,g[w][1])>0:p=>i(p,g[w][1])>=0,b=l?p=>s(p,g[w][0])>0:p=>s(p,g[w][0])>=0;function h(p){return!x(p)&&!b(p)}let v=x,m=new this.Collection(this,()=>ct(g[0][0],g[g.length-1][1],!l,!u));return m._ondirectionchange=p=>{p==="next"?(v=x,f=i):(v=b,f=s),g.sort(d)},m._addAlgorithm((p,_,y)=>{for(var j=p.key;v(j);)if(++w,w===g.length)return _(y),!1;return h(j)?!0:(this._cmp(j,g[w][1])===0||this._cmp(j,g[w][0])===0||_(()=>{f===i?p.continue(g[w][0]):p.continue(g[w][1])}),!1)}),m}startsWithAnyOf(){let e=Ge.apply(tr,arguments);return e.every(r=>typeof r=="string")?e.length===0?ar(this):this.inAnyRange(e.map(r=>[r,r+Pt])):Ie(this,"startsWithAnyOf() only works with strings")}};function Tf(t){return Wr(ts.prototype,function(r,n,i){this.db=t,this._ctx={table:r,index:n===":id"?null:n,or:i};let s=t._deps.indexedDB;if(!s)throw new L.MissingAPI;this._cmp=this._ascending=s.cmp.bind(s),this._descending=(o,a)=>s.cmp(a,o),this._max=(o,a)=>s.cmp(o,a)>0?o:a,this._min=(o,a)=>s.cmp(o,a)<0?o:a,this._IDBKeyRange=t._deps.IDBKeyRange})}function ze(t){return Z(function(e){return Ur(e),t(e.target.error),!1})}function Ur(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}var Gr="storagemutated",ft="x-storagemutated-1",dt=$r(null,Gr),Jo=class{_lock(){return Mr(!R.global),++this._reculock,this._reculock===1&&!R.global&&(R.lockOwnerFor=this),this}_unlock(){if(Mr(!R.global),--this._reculock==0)for(R.global||(R.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{sr(e[1],e[0])}catch{}}return this}_locked(){return this._reculock&&R.lockOwnerFor!==this}create(e){if(!this.mode)return this;let r=this.db.idbdb,n=this.db._state.dbOpenError;if(Mr(!this.idbtrans),!e&&!r)switch(n&&n.name){case"DatabaseClosedError":throw new L.DatabaseClosed(n);case"MissingAPIError":throw new L.MissingAPI(n.message,n);default:throw new L.OpenFailed(n)}if(!this.active)throw new L.TransactionInactive;return Mr(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=Z(i=>{Ur(i),this._reject(e.error)}),e.onabort=Z(i=>{Ur(i),this.active&&this._reject(new L.Abort(e.error)),this.active=!1,this.on("abort").fire(i)}),e.oncomplete=Z(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&dt.storagemutated.fire(e.mutatedParts)}),this}_promise(e,r,n){if(e==="readwrite"&&this.mode!=="readwrite")return le(new L.ReadOnly("Transaction is readonly"));if(!this.active)return le(new L.TransactionInactive);if(this._locked())return new O((s,o)=>{this._blockedFuncs.push([()=>{this._promise(e,r,n).then(s,o)},R])});if(n)return lt(()=>{var s=new O((o,a)=>{this._lock();let l=r(o,a,this);l&&l.then&&l.then(o,a)});return s.finally(()=>this._unlock()),s._lib=!0,s});var i=new O((s,o)=>{var a=r(s,o,this);a&&a.then&&a.then(s,o)});return i._lib=!0,i}_root(){return this.parent?this.parent._root():this}waitFor(e){var r=this._root();let n=O.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 o(){for(++r._spinCount;r._waitingQueue.length;)r._waitingQueue.shift()();r._waitingFor&&(i.get(-1/0).onsuccess=o)})()}var s=r._waitingFor;return new O((o,a)=>{n.then(l=>r._waitingQueue.push(Z(o.bind(null,l))),l=>r._waitingQueue.push(Z(a.bind(null,l)))).finally(()=>{r._waitingFor===s&&(r._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new L.Abort))}table(e){let r=this._memoizedTables||(this._memoizedTables={});if(Oe(r,e))return r[e];let n=this.schema[e];if(!n)throw new L.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}};function kf(t){return Wr(Jo.prototype,function(r,n,i,s,o){this.db=t,this.mode=r,this.storeNames=n,this.schema=i,this.chromeTransactionDurability=s,this.idbtrans=null,this.on=$r(this,"complete","error","abort"),this.parent=o||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 O((a,l)=>{this._resolve=a,this._reject=l}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},a=>{var l=this.active;return this.active=!1,this.on.error.fire(a),this.parent?this.parent._reject(a):l&&this.idbtrans&&this.idbtrans.abort(),le(a)})})}function rs(t,e,r,n,i,s,o){return{name:t,keyPath:e,unique:r,multi:n,auto:i,compound:s,src:(r&&!o?"&":"")+(n?"*":"")+(i?"++":"")+Xo(e)}}function Xo(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function Zo(t,e,r){return{name:t,primKey:e,indexes:r,mappedClass:null,idxByName:_o(r,n=>[n.name,n])}}function Of(t){return t.length===1?t[0]:t}var qr=t=>{try{return t.only([[]]),qr=()=>[[]],[[]]}catch{return qr=()=>Pt,Pt}};function ns(t){return t==null?()=>{}:typeof t=="string"?If(t):e=>Ue(e,t)}function If(t){return t.split(".").length===1?r=>r[t]:r=>Ue(r,t)}function ea(t){return[].slice.call(t)}var Mf=0;function Qr(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Pf(t,e,r){function n(c,f){let d=ea(c.objectStoreNames);return{schema:{name:c.name,tables:d.map(g=>f.objectStore(g)).map(g=>{let{keyPath:w,autoIncrement:x}=g,b=ve(w),h=w==null,v={},m={name:g.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:h,compound:b,keyPath:w,autoIncrement:x,unique:!0,extractKey:ns(w)},indexes:ea(g.indexNames).map(p=>g.index(p)).map(p=>{let{name:_,unique:y,multiEntry:j,keyPath:A}=p,C=ve(A),S={name:_,compound:C,keyPath:A,unique:y,multiEntry:j,extractKey:ns(A)};return v[Qr(A)]=S,S}),getIndexByKeyPath:p=>v[Qr(p)]};return v[":id"]=m.primaryKey,w!=null&&(v[Qr(w)]=m.primaryKey),m})},hasGetAll:d.length>0&&"getAll"in f.objectStore(d[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:f,upper:d,lowerOpen:g,upperOpen:w}=c;return f===void 0?d===void 0?null:e.upperBound(d,!!w):d===void 0?e.lowerBound(f,!!g):e.bound(f,d,!!g,!!w)}function s(c){let f=c.name;function d({trans:x,type:b,keys:h,values:v,range:m}){return new Promise((p,_)=>{p=Z(p);let y=x.objectStore(f),j=y.keyPath==null,A=b==="put"||b==="add";if(!A&&b!=="delete"&&b!=="deleteRange")throw new Error("Invalid operation type: "+b);let{length:C}=h||v||{length:1};if(h&&v&&h.length!==v.length)throw new Error("Given keys array must have same length as given values array.");if(C===0)return p({numFailures:0,failures:{},results:[],lastResult:void 0});let S,D=[],P=[],T=0,N=M=>{++T,Ur(M)};if(b==="deleteRange"){if(m.type===4)return p({numFailures:T,failures:P,results:[],lastResult:void 0});m.type===3?D.push(S=y.clear()):D.push(S=y.delete(i(m)))}else{let[M,F]=A?j?[v,h]:[v,null]:[h,null];if(A)for(let V=0;V<C;++V)D.push(S=F&&F[V]!==void 0?y[b](M[V],F[V]):y[b](M[V])),S.onerror=N;else for(let V=0;V<C;++V)D.push(S=y[b](M[V])),S.onerror=N}let H=M=>{let F=M.target.result;D.forEach((V,te)=>V.error!=null&&(P[te]=V.error)),p({numFailures:T,failures:P,results:b==="delete"?h:D.map(V=>V.result),lastResult:F})};S.onerror=M=>{N(M),H(M)},S.onsuccess=H})}function g({trans:x,values:b,query:h,reverse:v,unique:m}){return new Promise((p,_)=>{p=Z(p);let{index:y,range:j}=h,A=x.objectStore(f),C=y.isPrimaryKey?A:A.index(y.name),S=v?m?"prevunique":"prev":m?"nextunique":"next",D=b||!("openKeyCursor"in C)?C.openCursor(i(j),S):C.openKeyCursor(i(j),S);D.onerror=ze(_),D.onsuccess=Z(P=>{let T=D.result;if(!T){p(null);return}T.___id=++Mf,T.done=!1;let N=T.continue.bind(T),H=T.continuePrimaryKey;H&&(H=H.bind(T));let M=T.advance.bind(T),F=()=>{throw new Error("Cursor not started")},V=()=>{throw new Error("Cursor not stopped")};T.trans=x,T.stop=T.continue=T.continuePrimaryKey=T.advance=F,T.fail=Z(_),T.next=function(){let te=1;return this.start(()=>te--?this.continue():this.stop()).then(()=>this)},T.start=te=>{let Wt=new Promise((st,eo)=>{st=Z(st),D.onerror=ze(eo),T.fail=eo,T.stop=wc=>{T.stop=T.continue=T.continuePrimaryKey=T.advance=V,st(wc)}}),it=()=>{if(D.result)try{te()}catch(st){T.fail(st)}else T.done=!0,T.start=()=>{throw new Error("Cursor behind last entry")},T.stop()};return D.onsuccess=Z(st=>{D.onsuccess=it,it()}),T.continue=N,T.continuePrimaryKey=H,T.advance=M,it(),Wt},p(T)},_)})}function w(x){return b=>new Promise((h,v)=>{h=Z(h);let{trans:m,values:p,limit:_,query:y}=b,j=_===1/0?void 0:_,{index:A,range:C}=y,S=m.objectStore(f),D=A.isPrimaryKey?S:S.index(A.name),P=i(C);if(_===0)return h({result:[]});if(x){let T=p?D.getAll(P,j):D.getAllKeys(P,j);T.onsuccess=N=>h({result:N.target.result}),T.onerror=ze(v)}else{let T=0,N=p||!("openKeyCursor"in D)?D.openCursor(P):D.openKeyCursor(P),H=[];N.onsuccess=M=>{let F=N.result;if(!F)return h({result:H});if(H.push(p?F.value:F.primaryKey),++T===_)return h({result:H});F.continue()},N.onerror=ze(v)}})}return{name:f,schema:c,mutate:d,getMany({trans:x,keys:b}){return new Promise((h,v)=>{h=Z(h);let m=x.objectStore(f),p=b.length,_=new Array(p),y=0,j=0,A,C=D=>{let P=D.target;(_[P._pos]=P.result)!=null,++j===y&&h(_)},S=ze(v);for(let D=0;D<p;++D)b[D]!=null&&(A=m.get(b[D]),A._pos=D,A.onsuccess=C,A.onerror=S,++y);y===0&&h(_)})},get({trans:x,key:b}){return new Promise((h,v)=>{h=Z(h);let p=x.objectStore(f).get(b);p.onsuccess=_=>h(_.target.result),p.onerror=ze(v)})},query:w(a),openCursor:g,count({query:x,trans:b}){let{index:h,range:v}=x;return new Promise((m,p)=>{let _=b.objectStore(f),y=h.isPrimaryKey?_:_.index(h.name),j=i(v),A=j?y.count(j):y.count();A.onsuccess=Z(C=>m(C.target.result)),A.onerror=ze(p)})}}}let{schema:o,hasGetAll:a}=n(t,r),l=o.tables.map(c=>s(c)),u={};return l.forEach(c=>u[c.name]=c),{stack:"dbcore",transaction:t.transaction.bind(t),table(c){if(!u[c])throw new Error(`Table '${c}' not found`);return u[c]},MIN_KEY:-1/0,MAX_KEY:qr(e),schema:o}}function Rf(t,e){return e.reduce((r,{create:n})=>re(re({},r),n(r)),t)}function Bf(t,e,{IDBKeyRange:r,indexedDB:n},i){return{dbcore:Rf(Pf(e,r,i),t.dbcore)}}function is({_novip:t},e){let r=e.db,n=Bf(t._middlewares,r,t._deps,e);t.core=n.dbcore,t.tables.forEach(i=>{let s=i.name;t.core.schema.tables.some(o=>o.name===s)&&(i.core=t.core.table(s),t[s]instanceof t.Table&&(t[s].core=i.core))})}function Mn({_novip:t},e,r,n){r.forEach(i=>{let s=n[i];e.forEach(o=>{let a=Fi(o,i);(!a||"value"in a&&a.value===void 0)&&(o===t.Transaction.prototype||o instanceof t.Transaction?We(o,i,{get(){return this.table(i)},set(l){go(this,i,{value:l,writable:!0,configurable:!0,enumerable:!0})}}):o[i]=new t.Table(i,s))})})}function ss({_novip:t},e){e.forEach(r=>{for(let n in r)r[n]instanceof t.Table&&delete r[n]})}function Lf(t,e){return t._cfg.version-e._cfg.version}function Nf(t,e,r,n){let i=t._dbSchema,s=t._createTransaction("readwrite",t._storeNames,i);s.create(r),s._completion.catch(n);let o=s._reject.bind(s),a=R.transless||R;lt(()=>{R.trans=s,R.transless=a,e===0?(oe(i).forEach(l=>{os(r,l,i[l].primKey,i[l].indexes)}),is(t,r),O.follow(()=>t.on.populate.fire(s)).catch(o)):Kf(t,e,s,r).catch(o)})}function Kf({_novip:t},e,r,n){let i=[],s=t._versions,o=t._dbSchema=ls(t,t.idbdb,n),a=!1;s.filter(c=>c._cfg.version>=e).forEach(c=>{i.push(()=>{let f=o,d=c._cfg.dbschema;us(t,f,n),us(t,d,n),o=t._dbSchema=d;let g=ta(f,d);g.add.forEach(x=>{os(n,x[0],x[1].primKey,x[1].indexes)}),g.change.forEach(x=>{if(x.recreate)throw new L.Upgrade("Not yet support for changing primary key");{let b=n.objectStore(x.name);x.add.forEach(h=>as(b,h)),x.change.forEach(h=>{b.deleteIndex(h.name),as(b,h)}),x.del.forEach(h=>b.deleteIndex(h))}});let w=c._cfg.contentUpgrade;if(w&&c._cfg.version>e){is(t,n),r._memoizedTables={},a=!0;let x=bo(d);g.del.forEach(m=>{x[m]=f[m]}),ss(t,[t.Transaction.prototype]),Mn(t,[t.Transaction.prototype],oe(x),x),r.schema=x;let b=ki(w);b&&ir();let h,v=O.follow(()=>{if(h=w(r),h&&b){var m=qe.bind(null,null);h.then(m,m)}});return h&&typeof h.then=="function"?O.resolve(h):v.then(()=>h)}}),i.push(f=>{if(!a||!vf){let d=c._cfg.dbschema;Vf(d,f)}ss(t,[t.Transaction.prototype]),Mn(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),r.schema=t._dbSchema})});function u(){return i.length?O.resolve(i.shift()(r.idbtrans)).then(u):O.resolve()}return u().then(()=>{zf(o,n)})}function ta(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],s=e[n];if(!i)r.add.push([n,s]);else{let o={name:n,def:s,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(s.primKey.keyPath||"")||i.primKey.auto!==s.primKey.auto&&!En)o.recreate=!0,r.change.push(o);else{let a=i.idxByName,l=s.idxByName,u;for(u in a)l[u]||o.del.push(u);for(u in l){let c=a[u],f=l[u];c?c.src!==f.src&&o.change.push(f):o.add.push(f)}(o.del.length>0||o.add.length>0||o.change.length>0)&&r.change.push(o)}}}return r}function os(t,e,r,n){let i=t.db.createObjectStore(e,r.keyPath?{keyPath:r.keyPath,autoIncrement:r.auto}:{autoIncrement:r.auto});return n.forEach(s=>as(i,s)),i}function zf(t,e){oe(t).forEach(r=>{e.db.objectStoreNames.contains(r)||os(e,r,t[r].primKey,t[r].indexes)})}function Vf(t,e){[].slice.call(e.db.objectStoreNames).forEach(r=>t[r]==null&&e.db.deleteObjectStore(r))}function as(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function ls(t,e,r){let n={};return pn(e.objectStoreNames,0).forEach(s=>{let o=r.objectStore(s),a=o.keyPath,l=rs(Xo(a),a||"",!1,!1,!!o.autoIncrement,a&&typeof a!="string",!0),u=[];for(let f=0;f<o.indexNames.length;++f){let d=o.index(o.indexNames[f]);a=d.keyPath;var c=rs(d.name,a,!!d.unique,!!d.multiEntry,!1,a&&typeof a!="string",!1);u.push(c)}n[s]=Zo(s,l,u)}),n}function Hf({_novip:t},e,r){t.verno=e.version/10;let n=t._dbSchema=ls(t,e,r);t._storeNames=pn(e.objectStoreNames,0),Mn(t,[t._allTables],oe(n),n)}function $f(t,e){let r=ls(t,t.idbdb,e),n=ta(r,t._dbSchema);return!(n.add.length||n.change.some(i=>i.add.length||i.change.length))}function us({_novip:t},e,r){let n=r.db.objectStoreNames;for(let i=0;i<n.length;++i){let s=n[i],o=r.objectStore(s);t._hasGetAll="getAll"in o;for(let a=0;a<o.indexNames.length;++a){let l=o.indexNames[a],u=o.index(l).keyPath,c=typeof u=="string"?u:"["+pn(u).join("+")+"]";if(e[s]){let f=e[s].idxByName[c];f&&(f.name=l,delete e[s].idxByName[c],e[s].idxByName[l]=f)}}}typeof navigator!="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&J.WorkerGlobalScope&&J instanceof J.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}function Wf(t){return t.split(",").map((e,r)=>{e=e.trim();let n=e.replace(/([&*]|\+\+)/g,""),i=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return rs(n,i||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),ve(i),r===0)})}var ra=class{_parseStoresSpec(e,r){oe(e).forEach(n=>{if(e[n]!==null){var i=Wf(e[n]),s=i.shift();if(s.multi)throw new L.Schema("Primary key cannot be multi-valued");i.forEach(o=>{if(o.auto)throw new L.Schema("Only primary key can be marked as autoIncrement (++)");if(!o.keyPath)throw new L.Schema("Index must have a name and cannot be an empty string")}),r[n]=Zo(n,s,i)}})}stores(e){let r=this.db;this._cfg.storesSource=this._cfg.storesSource?we(this._cfg.storesSource,e):e;let n=r._versions,i={},s={};return n.forEach(o=>{we(i,o._cfg.storesSource),s=o._cfg.dbschema={},o._parseStoresSpec(i,s)}),r._dbSchema=s,ss(r,[r._allTables,r,r.Transaction.prototype]),Mn(r,[r._allTables,r,r.Transaction.prototype,this._cfg.tables],oe(s),s),r._storeNames=oe(s),this}upgrade(e){return this._cfg.contentUpgrade=Pi(this._cfg.contentUpgrade||Y,e),this}};function Uf(t){return Wr(ra.prototype,function(r){this.db=t,this._cfg={version:r,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function cs(t,e){let r=t._dbNamesDB;return r||(r=t._dbNamesDB=new Je(Dn,{addons:[],indexedDB:t,IDBKeyRange:e}),r.version(1).stores({dbnames:"name"})),r.table("dbnames")}function fs(t){return t&&typeof t.databases=="function"}function Gf({indexedDB:t,IDBKeyRange:e}){return fs(t)?Promise.resolve(t.databases()).then(r=>r.map(n=>n.name).filter(n=>n!==Dn)):cs(t,e).toCollection().primaryKeys()}function qf({indexedDB:t,IDBKeyRange:e},r){!fs(t)&&r!==Dn&&cs(t,e).put({name:r}).catch(Y)}function Qf({indexedDB:t,IDBKeyRange:e},r){!fs(t)&&r!==Dn&&cs(t,e).delete(r).catch(Y)}function ds(t){return lt(function(){return R.letThrough=!0,t()})}function Yf(){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 Jf(t){let e=t._state,{indexedDB:r}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then(()=>e.dbOpenError?le(e.dbOpenError):t);Ke&&(e.openCanceller._stackHolder=kt()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;let n=e.openCanceller;function i(){if(e.openCanceller!==n)throw new L.DatabaseClosed("db.open() was cancelled")}let s=e.dbReadyResolve,o=null,a=!1;return O.race([n,(typeof navigator=="undefined"?O.resolve():Yf()).then(()=>new O((l,u)=>{if(i(),!r)throw new L.MissingAPI;let c=t.name,f=e.autoSchema?r.open(c):r.open(c,Math.round(t.verno*10));if(!f)throw new L.MissingAPI;f.onerror=ze(u),f.onblocked=Z(t._fireOnBlocked),f.onupgradeneeded=Z(d=>{if(o=f.transaction,e.autoSchema&&!t._options.allowEmptyDB){f.onerror=Ur,o.abort(),f.result.close();let w=r.deleteDatabase(c);w.onsuccess=w.onerror=Z(()=>{u(new L.NoSuchDatabase(`Database ${c} doesnt exist`))})}else{o.onerror=ze(u);var g=d.oldVersion>Math.pow(2,62)?0:d.oldVersion;a=g<1,t._novip.idbdb=f.result,Nf(t,g/10,o,u)}},u),f.onsuccess=Z(()=>{o=null;let d=t._novip.idbdb=f.result,g=pn(d.objectStoreNames);if(g.length>0)try{let w=d.transaction(Of(g),"readonly");e.autoSchema?Hf(t,d,w):(us(t,t._dbSchema,w),$f(t,w)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),is(t,w)}catch{}Hr.push(t),d.onversionchange=Z(w=>{e.vcFired=!0,t.on("versionchange").fire(w)}),d.onclose=Z(w=>{t.on("close").fire(w)}),a&&qf(t._deps,c),l()},u)}))]).then(()=>(i(),e.onReadyBeingFired=[],O.resolve(ds(()=>t.on.ready.fire(t.vip))).then(function l(){if(e.onReadyBeingFired.length>0){let u=e.onReadyBeingFired.reduce(Pi,Y);return e.onReadyBeingFired=[],O.resolve(ds(()=>u(t.vip))).then(l)}}))).finally(()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1}).then(()=>t).catch(l=>{e.dbOpenError=l;try{o&&o.abort()}catch{}return n===e.openCanceller&&t._close(),le(l)}).finally(()=>{e.openComplete=!0,s()})}function hs(t){var e=o=>t.next(o),r=o=>t.throw(o),n=s(e),i=s(r);function s(o){return a=>{var l=o(a),u=l.value;return l.done?u:!u||typeof u.then!="function"?ve(u)?Promise.all(u).then(n,i):n(u):u.then(n,i)}}return s(e)()}function Xf(t,e,r){var n=arguments.length;if(n<2)throw new L.InvalidArgument("Too few arguments");for(var i=new Array(n-1);--n;)i[n-1]=arguments[n];r=i.pop();var s=xo(i);return[t,s,r]}function na(t,e,r,n,i){return O.resolve().then(()=>{let s=R.transless||R,o=t._createTransaction(e,r,t._dbSchema,n),a={trans:o,transless:s};if(n)o.idbtrans=n.idbtrans;else try{o.create(),t._state.PR1398_maxLoop=3}catch(f){return f.name===Mi.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>na(t,e,r,null,i))):le(f)}let l=ki(i);l&&ir();let u,c=O.follow(()=>{if(u=i.call(o,o),u)if(l){var f=qe.bind(null,null);u.then(f,f)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=hs(u))},a);return(u&&typeof u.then=="function"?O.resolve(u).then(f=>o.active?f:le(new L.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):c.then(()=>u)).then(f=>(n&&o._resolve(),o._completion.then(()=>f))).catch(f=>(o._reject(f),le(f)))})}function Pn(t,e,r){let n=ve(t)?t.slice():[t];for(let i=0;i<r;++i)n.push(e);return n}function Zf(t){return be(re({},t),{table(e){let r=t.table(e),{schema:n}=r,i={},s=[];function o(d,g,w){let x=Qr(d),b=i[x]=i[x]||[],h=d==null?0:typeof d=="string"?1:d.length,v=g>0,m=be(re({},w),{isVirtual:v,keyTail:g,keyLength:h,extractKey:ns(d),unique:!v&&w.unique});if(b.push(m),m.isPrimaryKey||s.push(m),h>1){let p=h===2?d[0]:d.slice(0,h-1);o(p,g+1,w)}return b.sort((p,_)=>p.keyTail-_.keyTail),m}let a=o(n.primaryKey.keyPath,0,n.primaryKey);i[":id"]=[a];for(let d of n.indexes)o(d.keyPath,0,d);function l(d){let g=i[Qr(d)];return g&&g[0]}function u(d,g){return{type:d.type===1?2:d.type,lower:Pn(d.lower,d.lowerOpen?t.MAX_KEY:t.MIN_KEY,g),lowerOpen:!0,upper:Pn(d.upper,d.upperOpen?t.MIN_KEY:t.MAX_KEY,g),upperOpen:!0}}function c(d){let g=d.query.index;return g.isVirtual?be(re({},d),{query:{index:g,range:u(d.query.range,g.keyTail)}}):d}return be(re({},r),{schema:be(re({},n),{primaryKey:a,indexes:s,getIndexByKeyPath:l}),count(d){return r.count(c(d))},query(d){return r.query(c(d))},openCursor(d){let{keyTail:g,isVirtual:w,keyLength:x}=d.query.index;if(!w)return r.openCursor(d);function b(h){function v(p){p!=null?h.continue(Pn(p,d.reverse?t.MAX_KEY:t.MIN_KEY,g)):d.unique?h.continue(h.key.slice(0,x).concat(d.reverse?t.MIN_KEY:t.MAX_KEY,g)):h.continue()}return Object.create(h,{continue:{value:v},continuePrimaryKey:{value(p,_){h.continuePrimaryKey(Pn(p,t.MAX_KEY,g),_)}},primaryKey:{get(){return h.primaryKey}},key:{get(){let p=h.key;return x===1?p[0]:p.slice(0,x)}},value:{get(){return h.value}}})}return r.openCursor(c(d)).then(h=>h&&b(h))}})}})}var ed={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:Zf};function ps(t,e,r,n){return r=r||{},n=n||"",oe(t).forEach(i=>{if(!Oe(e,i))r[n+i]=void 0;else{var s=t[i],o=e[i];if(typeof s=="object"&&typeof o=="object"&&s&&o){let a=Di(s),l=Di(o);a!==l?r[n+i]=e[i]:a==="Object"?ps(s,o,r,n+i+"."):s!==o&&(r[n+i]=e[i])}else s!==o&&(r[n+i]=e[i])}}),oe(e).forEach(i=>{Oe(t,i)||(r[n+i]=e[i])}),r}function td(t,e){return e.type==="delete"?e.keys:e.keys||e.values.map(t.extractKey)}var rd={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>be(re({},t),{table(e){let r=t.table(e),{primaryKey:n}=r.schema;return be(re({},r),{mutate(s){let o=R.trans,{deleting:a,creating:l,updating:u}=o.table(e).hook;switch(s.type){case"add":if(l.fire===Y)break;return o._promise("readwrite",()=>c(s),!0);case"put":if(l.fire===Y&&u.fire===Y)break;return o._promise("readwrite",()=>c(s),!0);case"delete":if(a.fire===Y)break;return o._promise("readwrite",()=>c(s),!0);case"deleteRange":if(a.fire===Y)break;return o._promise("readwrite",()=>f(s),!0)}return r.mutate(s);function c(g){let w=R.trans,x=g.keys||td(n,g);if(!x)throw new Error("Keys missing");return g=g.type==="add"||g.type==="put"?be(re({},g),{keys:x}):re({},g),g.type!=="delete"&&(g.values=[...g.values]),g.keys&&(g.keys=[...g.keys]),nd(r,g,x).then(b=>{let h=x.map((v,m)=>{let p=b[m],_={onerror:null,onsuccess:null};if(g.type==="delete")a.fire.call(_,v,p,w);else if(g.type==="add"||p===void 0){let y=l.fire.call(_,v,g.values[m],w);v==null&&y!=null&&(v=y,g.keys[m]=v,n.outbound||Be(g.values[m],n.keyPath,v))}else{let y=ps(p,g.values[m]),j=u.fire.call(_,y,v,p,w);if(j){let A=g.values[m];Object.keys(j).forEach(C=>{Oe(A,C)?A[C]=j[C]:Be(A,C,j[C])})}}return _});return r.mutate(g).then(({failures:v,results:m,numFailures:p,lastResult:_})=>{for(let y=0;y<x.length;++y){let j=m?m[y]:x[y],A=h[y];j==null?A.onerror&&A.onerror(v[y]):A.onsuccess&&A.onsuccess(g.type==="put"&&b[y]?g.values[y]:j)}return{failures:v,results:m,numFailures:p,lastResult:_}}).catch(v=>(h.forEach(m=>m.onerror&&m.onerror(v)),Promise.reject(v)))})}function f(g){return d(g.trans,g.range,1e4)}function d(g,w,x){return r.query({trans:g,values:!1,query:{index:n,range:w},limit:x}).then(({result:b})=>c({type:"delete",keys:b,trans:g}).then(h=>h.numFailures>0?Promise.reject(h.failures[0]):b.length<x?{failures:[],numFailures:0,lastResult:void 0}:d(g,be(re({},w),{lower:b[b.length-1],lowerOpen:!0}),x)))}}})}})};function nd(t,e,r){return e.type==="add"?Promise.resolve([]):t.getMany({trans:e.trans,keys:r,cache:"immutable"})}function ia(t,e,r){try{if(!e||e.keys.length<t.length)return null;let n=[];for(let i=0,s=0;i<e.keys.length&&s<t.length;++i)je(e.keys[i],t[s])===0&&(n.push(r?Pr(e.values[i]):e.values[i]),++s);return n.length===t.length?n:null}catch{return null}}var id={stack:"dbcore",level:-1,create:t=>({table:e=>{let r=t.table(e);return be(re({},r),{getMany:n=>{if(!n.cache)return r.getMany(n);let i=ia(n.keys,n.trans._cache,n.cache==="clone");return i?O.resolve(i):r.getMany(n).then(s=>(n.trans._cache={keys:n.keys,values:n.cache==="clone"?Pr(s):s},s))},mutate:n=>(n.type!=="add"&&(n.trans._cache=null),r.mutate(n))})}})};function ms(t){return!("from"in t)}var Ye=function(t,e){if(this)we(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0});else{let r=new Ye;return t&&"d"in t&&we(r,t),r}};Zt(Ye.prototype,{add(t){return Rn(this,t),this},addKey(t){return Yr(this,t,t),this},addKeys(t){return t.forEach(e=>Yr(this,e,e)),this},[Ti](){return gs(this)}});function Yr(t,e,r){let n=je(e,r);if(isNaN(n))return;if(n>0)throw RangeError();if(ms(t))return we(t,{from:e,to:r,d:1});let i=t.l,s=t.r;if(je(r,t.from)<0)return i?Yr(i,e,r):t.l={from:e,to:r,d:1,l:null,r:null},sa(t);if(je(e,t.to)>0)return s?Yr(s,e,r):t.r={from:e,to:r,d:1,l:null,r:null},sa(t);je(e,t.from)<0&&(t.from=e,t.l=null,t.d=s?s.d+1:1),je(r,t.to)>0&&(t.to=r,t.r=null,t.d=t.l?t.l.d+1:1);let o=!t.r;i&&!t.l&&Rn(t,i),s&&o&&Rn(t,s)}function Rn(t,e){function r(n,{from:i,to:s,l:o,r:a}){Yr(n,i,s),o&&r(n,o),a&&r(n,a)}ms(e)||r(t,e)}function sd(t,e){let r=gs(e),n=r.next();if(n.done)return!1;let i=n.value,s=gs(t),o=s.next(i.from),a=o.value;for(;!n.done&&!o.done;){if(je(a.from,i.to)<=0&&je(a.to,i.from)>=0)return!0;je(i.from,a.from)<0?i=(n=r.next(a.from)).value:a=(o=s.next(i.from)).value}return!1}function gs(t){let e=ms(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&&je(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||je(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 sa(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 s=i==="r"?"l":"r",o=re({},t),a=t[i];t.from=a.from,t.to=a.to,t[i]=a[i],o[i]=a[s],t[s]=o,o.d=oa(o)}t.d=oa(t)}function oa({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}var od={stack:"dbcore",level:0,create:t=>{let e=t.schema.name,r=new Ye(t.MIN_KEY,t.MAX_KEY);return be(re({},t),{table:n=>{let i=t.table(n),{schema:s}=i,{primaryKey:o}=s,{extractKey:a,outbound:l}=o,u=be(re({},i),{mutate:d=>{let g=d.trans,w=g.mutatedParts||(g.mutatedParts={}),x=y=>{let j=`idb://${e}/${n}/${y}`;return w[j]||(w[j]=new Ye)},b=x(""),h=x(":dels"),{type:v}=d,[m,p]=d.type==="deleteRange"?[d.range]:d.type==="delete"?[d.keys]:d.values.length<50?[[],d.values]:[],_=d.trans._cache;return i.mutate(d).then(y=>{if(ve(m)){v!=="delete"&&(m=y.results),b.addKeys(m);let j=ia(m,_);!j&&v!=="add"&&h.addKeys(m),(j||p)&&ad(x,s,j,p)}else if(m){let j={from:m.lower,to:m.upper};h.add(j),b.add(j)}else b.add(r),h.add(r),s.indexes.forEach(j=>x(j.name).add(r));return y})}}),c=({query:{index:d,range:g}})=>{var w,x;return[d,new Ye((w=g.lower)!==null&&w!==void 0?w:t.MIN_KEY,(x=g.upper)!==null&&x!==void 0?x:t.MAX_KEY)]},f={get:d=>[o,new Ye(d.key)],getMany:d=>[o,new Ye().addKeys(d.keys)],count:c,query:c,openCursor:c};return oe(f).forEach(d=>{u[d]=function(g){let{subscr:w}=R;if(w){let x=p=>{let _=`idb://${e}/${n}/${p}`;return w[_]||(w[_]=new Ye)},b=x(""),h=x(":dels"),[v,m]=f[d](g);if(x(v.name||"").add(m),!v.isPrimaryKey)if(d==="count")h.add(r);else{let p=d==="query"&&l&&g.values&&i.query(be(re({},g),{values:!1}));return i[d].apply(this,arguments).then(_=>{if(d==="query"){if(l&&g.values)return p.then(({result:j})=>(b.addKeys(j),_));let y=g.values?_.result.map(a):_.result;g.values?b.addKeys(y):h.addKeys(y)}else if(d==="openCursor"){let y=_,j=g.values;return y&&Object.create(y,{key:{get(){return h.addKey(y.primaryKey),y.key}},primaryKey:{get(){let A=y.primaryKey;return h.addKey(A),A}},value:{get(){return j&&b.addKey(y.primaryKey),y.value}}})}return _})}}return i[d].apply(this,arguments)}}),u}})}};function ad(t,e,r,n){function i(s){let o=t(s.name||"");function a(u){return u!=null?s.extractKey(u):null}let l=u=>s.multiEntry&&ve(u)?u.forEach(c=>o.addKey(c)):o.addKey(u);(r||n).forEach((u,c)=>{let f=r&&a(r[c]),d=n&&a(n[c]);je(f,d)!==0&&(f!=null&&l(f),d!=null&&l(d))})}e.indexes.forEach(i)}var Je=class{constructor(e,r){this._middlewares={},this.verno=0;let n=Je.dependencies;this._options=r=re({addons:Je.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 s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:Y,dbReadyPromise:null,cancelOpen:Y,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};s.dbReadyPromise=new O(o=>{s.dbReadyResolve=o}),s.openCanceller=new O((o,a)=>{s.cancelOpen=a}),this._state=s,this.name=e,this.on=$r(this,"populate","blocked","versionchange","close",{ready:[Pi,Y]}),this.on.ready.subscribe=yo(this.on.ready.subscribe,o=>(a,l)=>{Je.vip(()=>{let u=this._state;if(u.openComplete)u.dbOpenError||O.resolve().then(a),l&&o(a);else if(u.onReadyBeingFired)u.onReadyBeingFired.push(a),l&&o(a);else{o(a);let c=this;l||o(function f(){c.on.ready.unsubscribe(a),c.on.ready.unsubscribe(f)})}})}),this.Collection=Af(this),this.Table=bf(this),this.Transaction=kf(this),this.Version=Uf(this),this.WhereClause=Tf(this),this.on("versionchange",o=>{o.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",o=>{!o.newVersion||o.newVersion<o.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${o.oldVersion/10}`)}),this._maxKey=qr(r.IDBKeyRange),this._createTransaction=(o,a,l,u)=>new this.Transaction(o,a,l,this._options.chromeTransactionDurability,u),this._fireOnBlocked=o=>{this.on("blocked").fire(o),Hr.filter(a=>a.name===this.name&&a!==this&&!a._state.vcFired).map(a=>a.on("versionchange").fire(o))},this.use(ed),this.use(rd),this.use(od),this.use(id),this.vip=Object.create(this,{_vip:{value:!0}}),i.forEach(o=>o(this))}version(e){if(isNaN(e)||e<.1)throw new L.Type("Given version is not a positive number");if(e=Math.round(e*10)/10,this.idbdb||this._state.isBeingOpened)throw new L.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(Lf),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||R.letThrough||this._vip)?e():new O((r,n)=>{if(this._state.openComplete)return n(new L.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen){n(new L.DatabaseClosed);return}this.open().catch(Y)}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 s=this._middlewares[e]||(this._middlewares[e]=[]);return s.push({stack:e,create:r,level:n??10,name:i}),s.sort((o,a)=>o.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 Jf(this)}_close(){let e=this._state,r=Hr.indexOf(this);if(r>=0&&Hr.splice(r,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}e.dbReadyPromise=new O(n=>{e.dbReadyResolve=n}),e.openCanceller=new O((n,i)=>{e.cancelOpen=i})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new L.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,r=this._state;return new O((n,i)=>{let s=()=>{this.close();var o=this._deps.indexedDB.deleteDatabase(this.name);o.onsuccess=Z(()=>{Qf(this._deps,this.name),n()}),o.onerror=ze(i),o.onblocked=this._fireOnBlocked};if(e)throw new L.InvalidArgument("Arguments not allowed in db.delete()");r.isBeingOpened?r.dbReadyPromise.then(s):s()})}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 oe(this._allTables).map(e=>this._allTables[e])}transaction(){let e=Xf.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,r,n){let i=R.trans;(!i||i.db!==this||e.indexOf("!")!==-1)&&(i=null);let s=e.indexOf("?")!==-1;e=e.replace("!","").replace("?","");let o,a;try{if(a=r.map(u=>{var c=u instanceof this.Table?u.name:u;if(typeof c!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return c}),e=="r"||e===Yi)o=Yi;else if(e=="rw"||e==Ji)o=Ji;else throw new L.InvalidArgument("Invalid transaction mode: "+e);if(i){if(i.mode===Yi&&o===Ji)if(s)i=null;else throw new L.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i&&a.forEach(u=>{if(i&&i.storeNames.indexOf(u)===-1)if(s)i=null;else throw new L.SubTransaction("Table "+u+" not included in parent transaction.")}),s&&i&&!i.active&&(i=null)}}catch(u){return i?i._promise(null,(c,f)=>{f(u)}):le(u)}let l=na.bind(null,this,o,a,i,n);return i?i._promise(o,l,"lock"):R.trans?sr(R.transless,()=>this._whenReady(l)):this._whenReady(l)}table(e){if(!Oe(this._allTables,e))throw new L.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}},ld=typeof Symbol!="undefined"&&"observable"in Symbol?Symbol.observable:"@@observable",aa=class{constructor(e){this._subscribe=e}subscribe(e,r,n){return this._subscribe(!e||typeof e=="function"?{next:e,error:r,complete:n}:e)}[ld](){return this}};function la(t,e){return oe(e).forEach(r=>{let n=t[r]||(t[r]=new Ye);Rn(n,e[r])}),t}function ud(t){return new aa(e=>{let r=ki(t);function n(g){r&&ir();let w=()=>lt(t,{subscr:g,trans:null}),x=R.trans?sr(R.transless,w):w();return r&&x.then(qe,qe),x}let i=!1,s={},o={},a={get closed(){return i},unsubscribe:()=>{i=!0,dt.storagemutated.unsubscribe(f)}};e.start&&e.start(a);let l=!1,u=!1;function c(){return oe(o).some(g=>s[g]&&sd(s[g],o[g]))}let f=g=>{la(s,g),c()&&d()},d=()=>{if(l||i)return;s={};let g={},w=n(g);u||(dt(Gr,f),u=!0),l=!0,Promise.resolve(w).then(x=>{l=!1,!i&&(c()?d():(s={},o=g,e.next&&e.next(x)))},x=>{l=!1,e.error&&e.error(x),a.unsubscribe()})};return d(),a})}var ys;try{ys={indexedDB:J.indexedDB||J.mozIndexedDB||J.webkitIndexedDB||J.msIndexedDB,IDBKeyRange:J.IDBKeyRange||J.webkitIDBKeyRange}}catch{ys={indexedDB:null,IDBKeyRange:null}}var Bt=Je;Zt(Bt,be(re({},gn),{delete(t){return new Bt(t,{addons:[]}).delete()},exists(t){return new Bt(t,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1)},getDatabaseNames(t){try{return Gf(Bt.dependencies).then(t)}catch{return le(new L.MissingAPI)}},defineClass(){function t(e){we(this,e)}return t},ignoreTransaction(t){return R.trans?sr(R.transless,t):t()},vip:ds,async:function(t){return function(){try{var e=hs(t.apply(this,arguments));return!e||typeof e.then!="function"?O.resolve(e):e}catch(r){return le(r)}}},spawn:function(t,e,r){try{var n=hs(t.apply(r,e||[]));return!n||typeof n.then!="function"?O.resolve(n):n}catch(i){return le(i)}},currentTransaction:{get:()=>R.trans||null},waitFor:function(t,e){let r=O.resolve(typeof t=="function"?Bt.ignoreTransaction(t):t).timeout(e||6e4);return R.trans?R.trans.waitFor(r):r},Promise:O,debug:{get:()=>Ke,set:t=>{jo(t,t==="dexie"?()=>!0:Vo)}},derive:er,extend:we,props:Zt,override:yo,Events:$r,on:dt,liveQuery:ud,extendObservabilitySet:la,getByKeyPath:Ue,setByKeyPath:Be,delByKeyPath:Wc,shallowClone:bo,deepClone:Pr,getObjectDiff:ps,cmp:je,asap:vo,minKey:Qi,addons:[],connections:Hr,errnames:Mi,dependencies:ys,semVer:Ko,version:Ko.split(".").map(t=>parseInt(t)).reduce((t,e,r)=>t+e/Math.pow(10,r*2))}));Bt.maxKey=qr(Bt.dependencies.IDBKeyRange);typeof dispatchEvent!="undefined"&&typeof addEventListener!="undefined"&&(dt(Gr,t=>{if(!Xe){let e;En?(e=document.createEvent("CustomEvent"),e.initCustomEvent(ft,!0,!0,t)):e=new CustomEvent(ft,{detail:t}),Xe=!0,dispatchEvent(e),Xe=!1}}),addEventListener(ft,({detail:t})=>{Xe||Bn(t)}));function Bn(t){let e=Xe;try{Xe=!0,dt.storagemutated.fire(t)}finally{Xe=e}}var Xe=!1;if(typeof BroadcastChannel!="undefined"){let t=new BroadcastChannel(ft);dt(Gr,e=>{Xe||t.postMessage(e)}),t.onmessage=e=>{e.data&&Bn(e.data)}}else if(typeof self!="undefined"&&typeof navigator!="undefined"){dt(Gr,e=>{try{Xe||(typeof localStorage!="undefined"&&localStorage.setItem(ft,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(r=>r.postMessage({type:ft,changedParts:e})))}catch{}}),typeof addEventListener!="undefined"&&addEventListener("storage",e=>{if(e.key===ft){let r=JSON.parse(e.newValue);r&&Bn(r.changedParts)}});let t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",cd)}function cd({data:t}){t&&t.type===ft&&Bn(t.changedParts)}O.rejectionMapper=ef;jo(Ke,Vo);var Ve=class extends Je{constructor(){super(Ve.dbName);this.version(Ve.dbVersion).stores({searchHistory:"++id",minisearch:"date"})}static async clearOldDatabases(){let e=(await indexedDB.databases()).filter(r=>r.name===Ve.dbName&&r.version!==Ve.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 Ve.instance||(Ve.instance=new Ve),Ve.instance}async clearCache(){await this.minisearch.clear()}},lr=Ve;lr.dbVersion=8,lr.dbName="omnisearch/cache/"+app.appId;var Ee=lr.getInstance();var Lt=hn(!1),vs=class extends G.PluginSettingTab{constructor(e){super(app,e);this.plugin=e,Lt.subscribe(async r=>{E.showExcerpt=r,await ue(this.plugin)})}display(){let{containerEl:e}=this;e.empty(),e.createEl("h2",{text:"Omnisearch"});let r=e.createDiv();r.innerHTML=`
<iframe src="https://github.com/sponsors/scambier/button" title="Sponsor scambier" height="35" width="116" style="border: 0;"></iframe>
<a href='https://ko-fi.com/B0B6LQ2C' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi2.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
`,new G.Setting(e).setName("Indexing").setHeading();let n=new DocumentFragment;He()?n.createSpan({},c=>{c.innerHTML=`\u{1F44D} You have installed <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a>, Omnisearch will use it to index PDFs and images.
<br />Text extraction only works on desktop, but the cache can be synchronized with your mobile device.`}):n.createSpan({},c=>{c.innerHTML='\u26A0\uFE0F Omnisearch requires <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a> to index PDFs and images.'}),new G.Setting(e).setDesc(n);let i=new DocumentFragment;i.createSpan({},c=>{c.innerHTML="Include PDFs in search results"}),new G.Setting(e).setName(`PDFs Indexing ${He()?"":"\u26A0\uFE0F Disabled"}`).setDesc(i).addToggle(c=>c.setValue(E.PDFIndexing).onChange(async f=>{E.PDFIndexing=f,await ue(this.plugin)})).setDisabled(!He());let s=new DocumentFragment;s.createSpan({},c=>{c.innerHTML="Include images in search results"}),new G.Setting(e).setName(`Images Indexing ${He()?"":"\u26A0\uFE0F Disabled"}`).setDesc(s).addToggle(c=>c.setValue(E.imagesIndexing).onChange(async f=>{E.imagesIndexing=f,await ue(this.plugin)})).setDisabled(!He());let o=new DocumentFragment;o.createSpan({},c=>{c.innerHTML=`In addition to standard <code>md</code> files, Omnisearch can also index other <strong style="color: var(--text-accent)">plaintext</strong> files.<br/>
Add extensions separated by a space, without the dot. Example: "<code>txt org</code>".<br />
\u26A0\uFE0F <span style="color: var(--text-accent)">Using extensions of non-plaintext files (like .docx or .pptx) WILL cause crashes,
because Omnisearch will try to index their content.</span><br />
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>`}),new G.Setting(e).setName("Additional files to index").setDesc(o).addText(c=>{c.setValue(E.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org").onChange(async f=>{E.indexedFileTypes=f.split(" "),await ue(this.plugin)})}),new G.Setting(e).setName("Behavior").setHeading(),new G.Setting(e).setName("Save index to cache").setDesc("Enable caching to speed up indexing time. In rare cases, the cache write may cause a freeze in Obsidian. This option will disable itself if it happens.").addToggle(c=>c.setValue(E.useCache).onChange(async f=>{E.useCache=f,await ue(this.plugin)})),new G.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(c=>c.setValue(E.hideExcluded).onChange(async f=>{E.hideExcluded=f,await ue(this.plugin)}));let a=new DocumentFragment;a.createSpan({},c=>{c.innerHTML=`Normalize diacritics in search terms. Words like "br\xFBl\xE9e" or "\u017Elu\u0165ou\u010Dk\xFD" will be indexed as "brulee" and "zlutoucky".<br/>
\u26A0\uFE0F <span style="color: var(--text-accent)">You probably should <strong>NOT</strong> disable this.</span><br>
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>
`}),new G.Setting(e).setName("Ignore diacritics").setDesc(a).addToggle(c=>c.setValue(E.ignoreDiacritics).onChange(async f=>{await Ee.clearCache(),E.ignoreDiacritics=f,await ue(this.plugin)}));let l=new DocumentFragment;l.createSpan({},c=>{c.innerHTML=`Enable this if you want to be able to search for CamelCaseWords as separate words.<br/>
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>
`}),new G.Setting(e).setName("Split CamelCaseWords").setDesc(l).addToggle(c=>c.setValue(E.splitCamelCase).onChange(async f=>{await Ee.clearCache(),E.splitCamelCase=f,await ue(this.plugin)})),new G.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(c=>c.setValue(E.simpleSearch).onChange(async f=>{E.simpleSearch=f,await ue(this.plugin)})),new G.Setting(e).setName("User Interface").setHeading(),new G.Setting(e).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(c=>c.setValue(E.ribbonIcon).onChange(async f=>{E.ribbonIcon=f,await ue(this.plugin),f?this.plugin.addRibbonButton():this.plugin.removeRibbonButton()})),new G.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(c=>c.setValue(E.showExcerpt).onChange(async f=>{Lt.set(f)})),new G.Setting(e).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(c=>c.setValue(E.renderLineReturnInExcerpts).onChange(async f=>{E.renderLineReturnInExcerpts=f,await ue(this.plugin)})),new G.Setting(e).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(c=>c.setValue(E.showPreviousQueryResults).onChange(async f=>{E.showPreviousQueryResults=f,await ue(this.plugin)}));let u=new DocumentFragment;if(u.createSpan({},c=>{c.innerHTML=`Shows a button next to the search input, to create a note.
Acts the same as the <code>shift \u21B5</code> shortcut, can be useful for mobile device users.`}),new G.Setting(e).setName('Show "Create note" button').setDesc(u).addToggle(c=>c.setValue(E.showCreateButton).onChange(async f=>{E.showCreateButton=f,await ue(this.plugin)})),new G.Setting(e).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(c=>c.setValue(E.highlight).onChange(async f=>{E.highlight=f,await ue(this.plugin)})),new G.Setting(e).setName("Results weighting").setHeading(),new G.Setting(e).setName(`File name & declared aliases (default: ${Nt.weightBasename})`).addSlider(c=>this.weightSlider(c,"weightBasename")),new G.Setting(e).setName(`File directory (default: ${Nt.weightDirectory})`).addSlider(c=>this.weightSlider(c,"weightDirectory")),new G.Setting(e).setName(`Headings level 1 (default: ${Nt.weightH1})`).addSlider(c=>this.weightSlider(c,"weightH1")),new G.Setting(e).setName(`Headings level 2 (default: ${Nt.weightH2})`).addSlider(c=>this.weightSlider(c,"weightH2")),new G.Setting(e).setName(`Headings level 3 (default: ${Nt.weightH3})`).addSlider(c=>this.weightSlider(c,"weightH3")),new G.Setting(e).setName("Debugging").setHeading(),new G.Setting(e).setName("Enable verbose logging").setDesc("Adds a LOT of logs for debugging purposes. Don't forget to disable it.").addToggle(c=>c.setValue(E.verboseLogging).onChange(async f=>{E.verboseLogging=f,await ue(this.plugin)})),ht()){new G.Setting(e).setName("Danger Zone").setHeading();let c=new DocumentFragment;c.createSpan({},f=>{f.innerHTML=`Erase all Omnisearch cache data.
Use this if Omnisearch results are inconsistent, missing, or appear outdated.<br>
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>`}),new G.Setting(e).setName("Clear cache data").setDesc(c).addButton(f=>{f.setButtonText("Clear cache"),f.onClick(async()=>{await Ee.clearCache(),new G.Notice("Omnisearch - Cache cleared. Please restart Obsidian.")})})}}weightSlider(e,r){e.setLimits(1,5,.1).setValue(E[r]).setDynamicTooltip().onChange(n=>{E[r]=n,ue(this.plugin)})}},Nt={useCache:!0,hideExcluded:!1,ignoreDiacritics:!0,indexedFileTypes:[],PDFIndexing:!1,imagesIndexing:!1,splitCamelCase:!1,ribbonIcon:!0,showExcerpt:!0,renderLineReturnInExcerpts:!0,showCreateButton:!1,highlight:!0,showPreviousQueryResults:!0,simpleSearch:!1,weightBasename:3,weightDirectory:2,weightH1:1.5,weightH2:1.3,weightH3:1.1,welcomeMessage:"",verboseLogging:!1},E=Object.assign({},Nt);async function ua(t){E=Object.assign({},Nt,await t.loadData()),Lt.set(E.showExcerpt)}async function ue(t){await t.saveData(E)}var ca=Ce(require("obsidian"));var fa=/^"|"$|^'|'$/g,da=/[\u4e00-\u9fa5]/,_s=/(?:^|\s)\.(\w+)/g,ha=100,Jr=300,pa=`suggestion-highlight omnisearch-highlight ${E.highlight?"omnisearch-default-highlight":""}`,$=new Si,Ln={ToggleExcerpts:"toggle-excerpts"},Pe=(s=>(s[s.Done=0]="Done",s[s.LoadingCache=1]="LoadingCache",s[s.ReadingFiles=2]="ReadingFiles",s[s.IndexingFiles=3]="IndexingFiles",s[s.WritingCache=4]="WritingCache",s))(Pe||{});var pt=hn(0),ma=!1;function bs(t){ma=t}function ga(){return ma}function Nn(){return app.plugins.plugins["cm-chs-patch"]}function He(){return app.plugins?.plugins?.["text-extractor"]?.api}function ht(){return!ca.Platform.isIosApp&&E.useCache}var mt=/[|\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]+/u;var Ea=Ce(require("obsidian"));var Ze=Ce(require("obsidian"));var va=Ce(require("crypto")),_a=Ce(ya());function gt(...t){return t[1]!==null&&t[1]!==void 0&&t[2]!==null&&t[2]!==void 0?`${t[1]}<span class="${pa}">${t[2]}</span>`:"&lt;no content&gt;"}function fd(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function ba(t){let e=t.split("/");return e.pop(),e.join("/")}function dd(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"[$&]")}function yt(t){if(!t.length)return/^$/g;let e="("+(Nn()?"":E.splitCamelCase?`^|${mt.source}|[A-Z]`:`^|${mt.source}`)+`)(${t.map(n=>dd(n)).join("|")})`;return new RegExp(`${e}`,"giu")}function Kn(t,e){return t.headings?.filter(r=>r.level===e).map(r=>r.heading)??[]}function zn(t,e){return(t+e)%e}function ur(t,e){try{let r=e??-1,n=Math.max(0,r-ha),i=Math.min(t.length,r+Jr);if(r>-1?t=(n>0?"\u2026":"")+t.slice(n,i).trim()+(i<t.length-1?"\u2026":""):t=t.slice(0,Jr),E.renderLineReturnInExcerpts){let s=new RegExp(/(?:\r\n|\r|\n)/g);t=t.split(s).filter(a=>a).join(`
`);let o=t.lastIndexOf(`
`,r-n);o>0&&(t=t.slice(o))}return t=fd(t),E.renderLineReturnInExcerpts&&(t=t.trim().replaceAll(`
`,"<br>")),t}catch(r){return new Ze.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(r),""}}function xa(t){return t.replace(fa,"")}function ws(t){return t.replace(/(\*|_)+(.+?)(\*|_)+/g,(e,r,n)=>n)}function wa(t){return t?.frontmatter?(0,Ze.parseFrontMatterAliases)(t.frontmatter)??[]:[]}function ja(t){let e=t?(0,Ze.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 et(t){return t==null?"":(t=t.replaceAll("`","[__omnisearch__backtick__]"),t=t.normalize("NFD").replace(/\p{Diacritic}/gu,""),t=t.replaceAll("[__omnisearch__backtick__]","`"),t)}function Vn(){return Ze.Platform.isMacOS?"\u2318":"ctrl"}function Zr(t){let e=!!He(),r=e&&E.PDFIndexing,n=e&&E.imagesIndexing;return js(t)||tn(t)||r&&en(t)||n&&Hn(t)}function Hn(t){let e=Kt(t);return e==="png"||e==="jpg"||e==="jpeg"}function en(t){return Kt(t)==="pdf"}function js(t){return[...E.indexedFileTypes,"md"].some(e=>t.endsWith(`.${e}`))}function tn(t){return t.endsWith(".canvas")}function Kt(t){let e=t.split(".");return e[e.length-1]??""}function Aa(t){return Ze.Platform.isMobileApp?(0,_a.md5)(t.toString()):(0,va.createHash)("md5").update(t).digest("hex")}function Ca(t,e){let r=[],n=0,i=t.length;for(;n<i;)r.push(t.slice(n,n+=e));return r}function Sa(t){return t.replace(/([a-z](?=[A-Z]))/g,"$1 ").split(" ")}function ie(...t){Fa(console.log,...t)}function $n(...t){Fa(console.warn,...t)}function Fa(t,...e){if(E.verboseLogging){let r=new Date,n=`${r.getMinutes()}:${r.getSeconds()}:${r.getMilliseconds()}`;t("Omnisearch -",n+" -",...e)}}async function hd(t){let e=app.vault.getFiles().find(s=>s.path===t);if(!e)throw new Error(`Invalid file path: "${t}"`);let r=null,n=He();if(js(t))r=await app.vault.cachedRead(e);else if(tn(t)){let s=JSON.parse(await app.vault.cachedRead(e)),o=[];for(let a of s.nodes)a.type==="text"?o.push(a.text):a.type==="file"&&o.push(a.file);for(let a of s.edges.filter(l=>!!l.label))o.push(a.label);r=o.join(`\r
`)}else if(n?.canFileBeExtracted(t))r=await n.extractText(e);else throw new Error(`Unsupported file type: "${t}"`);r==null&&(console.warn(`Omnisearch: ${r} content for file`,e.path),r=""),r=et(r);let i=app.metadataCache.getFileCache(e);if(i&&i.frontmatter?.["excalidraw-plugin"]){let s=i.sections?.filter(o=>o.type==="comment")??[];for(let{start:o,end:a}of s.map(l=>l.position))r=r.substring(0,o.offset-1)+r.substring(a.offset)}return{basename:et(e.basename),content:r,path:e.path,mtime:e.stat.mtime,tags:ja(i),aliases:wa(i).join(""),headings1:i?Kn(i,1).join(" "):"",headings2:i?Kn(i,2).join(" "):"",headings3:i?Kn(i,3).join(" "):""}}var Da=class{constructor(){this.nextQueryIsEmpty=!1;this.documents=new Map}async addToLiveCache(e){try{let r=await hd(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):(ie("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 Ee.searchHistory.toArray();r=r.filter(n=>n.query!==e).reverse(),r.unshift({query:e}),r=r.slice(0,10),await Ee.searchHistory.clear(),await Ee.searchHistory.bulkAdd(r)}async getSearchHistory(){let e=(await Ee.searchHistory.toArray()).reverse().map(r=>r.query);return this.nextQueryIsEmpty&&e.unshift(""),e}getDocumentsChecksum(e){return Aa(JSON.stringify(e.sort((r,n)=>r.path<n.path?-1:r.path>n.path?1:0)))}async getMinisearchCache(){try{return(await Ee.minisearch.toArray())[0]}catch(e){return new Ea.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,s])=>({path:i,mtime:s}));await Ee.minisearch.clear(),await Ee.minisearch.add({date:new Date().toISOString(),paths:n,data:e.toJSON()}),console.log("Omnisearch - Search cache written")}},de=new Da;function pd(t){let e,r,n,i,s,o,a,l,u=t[9].default,c=Gt(u,t,t[8],null);return{c(){e=I("div"),r=I("div"),n=I("input"),s=U(),c&&c.c(),B(n,"class","prompt-input"),B(n,"placeholder",t[0]),B(n,"spellcheck","false"),B(n,"type","text"),B(r,"class","omnisearch-input-field"),B(e,"class","omnisearch-input-container")},m(f,d){z(f,e,d),k(e,r),k(r,n),t[10](n),_i(n,t[1]),k(e,s),c&&c.m(e,null),o=!0,a||(l=[Te(n,"input",t[11]),uo(i=t[3].call(null,n)),Te(n,"compositionend",t[12]),Te(n,"compositionstart",t[13]),Te(n,"input",t[4])],a=!0)},p(f,[d]){(!o||d&1)&&B(n,"placeholder",f[0]),d&2&&n.value!==f[1]&&_i(n,f[1]),c&&c.p&&(!o||d&256)&&Qt(c,u,f,f[8],o?qt(u,f[8],d,null):Yt(f[8]),null)},i(f){o||(q(c,f),o=!0)},o(f){Q(c,f),o=!1},d(f){f&&K(e),t[10](null),c&&c.d(f),a=!1,Re(l)}}}function md(t,e,r){let{$$slots:n={},$$scope:i}=e,{initialValue:s=""}=e,o=!1,{placeholder:a=""}=e,l="",u,c=wi();function f(v){r(1,l=v)}function d(v){ot().then(()=>(u.focus(),ot())).then(()=>{u.select()})}let g=(0,Ta.debounce)(()=>{de.addToSearchHistory(""),c("input",l)},250);function w(v){$e[v?"unshift":"push"](()=>{u=v,r(2,u)})}function x(){l=this.value,r(1,l),r(5,s),r(7,o)}let b=v=>bs(!1),h=v=>bs(!0);return t.$$set=v=>{"initialValue"in v&&r(5,s=v.initialValue),"placeholder"in v&&r(0,a=v.placeholder),"$$scope"in v&&r(8,i=v.$$scope)},t.$$.update=()=>{if(t.$$.dirty&162){e:s&&!o&&!l&&(r(7,o=!0),r(1,l=s),d())}},[a,l,u,d,g,s,f,o,i,n,w,x,b,h]}var ka=class extends pe{constructor(e){super();ye(this,e,md,pd,fe,{initialValue:5,placeholder:0,setInputValue:6})}get setInputValue(){return this.$$.ctx[6]}},Wn=ka;function gd(t){let e,r,n,i,s=t[1].default,o=Gt(s,t,t[0],null);return{c(){e=I("div"),o&&o.c(),B(e,"class","prompt-results")},m(a,l){z(a,e,l),o&&o.m(e,null),r=!0,n||(i=Te(e,"mousedown",yd),n=!0)},p(a,[l]){o&&o.p&&(!r||l&1)&&Qt(o,s,a,a[0],r?qt(s,a[0],l,null):Yt(a[0]),null)},i(a){r||(q(o,a),r=!0)},o(a){Q(o,a),r=!1},d(a){a&&K(e),o&&o.d(a),n=!1,i()}}}var yd=t=>t.preventDefault();function vd(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&r(0,i=s.$$scope)},[i,n]}var Oa=class extends pe{constructor(e){super();ye(this,e,vd,gd,fe,{})}},Un=Oa;var As=Ce(require("obsidian"));async function Gn(t,e=!1){let r=yt(t.foundWords);r.exec(t.content);let n=r.lastIndex,i=!1;app.workspace.iterateAllLeaves(a=>{a.view instanceof As.MarkdownView&&!e&&a.getViewState().state?.file===t.path&&a.getViewState()?.pinned&&(app.workspace.setActiveLeaf(a,{focus:!0}),i=!0)}),i||await app.workspace.openLinkText(t.path,"",e);let s=app.workspace.getActiveViewOfType(As.MarkdownView);if(!s)return;let o=s.editor.offsetToPos(n);o.ch=0,s.editor.setCursor(o),s.editor.scrollIntoView({from:{line:o.line-10,ch:0},to:{line:o.line+10,ch:0}})}async function Ia(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}}function _d(t){let e;return{c(){e=I("span"),e.innerHTML='<svg viewBox="0 0 100 100" class="add-note-glyph" width="16" height="16"><path fill="currentColor" stroke="currentColor" d="M23.3,6.7c-3.7,0-6.7,3-6.7,6.7v73.3c0,3.7,3,6.7,6.7,6.7h28.4c-3.2-4.8-5.1-10.5-5.1-16.7c0-16.6,13.4-30,30-30 c2.3,0,4.5,0.3,6.7,0.8V31.7c0-0.9-0.3-1.7-1-2.4L60.7,7.6c-0.6-0.6-1.5-1-2.4-1L23.3,6.7z M56.7,13L77,33.3H60 c-1.8,0-3.3-1.5-3.3-3.3L56.7,13z M76.7,53.3c-12.9,0-23.3,10.4-23.3,23.3S63.8,100,76.7,100S100,89.6,100,76.7 S89.6,53.3,76.7,53.3z M76.7,63.3c1.8,0,3.3,1.5,3.3,3.3v6.7h6.7c1.8,0,3.3,1.5,3.3,3.3c0,1.8-1.5,3.3-3.3,3.3H80v6.7 c0,1.8-1.5,3.3-3.3,3.3c-1.8,0-3.3-1.5-3.3-3.3V80h-6.7c-1.8,0-3.3-1.5-3.3-3.3s1.5-3.3,3.3-3.3h6.7v-6.7 C73.3,64.8,74.8,63.3,76.7,63.3L76.7,63.3z"></path></svg>',B(e,"class","suggestion-flair"),B(e,"aria-label","Not created yet, select to create")},m(r,n){z(r,e,n)},p:ne,i:ne,o:ne,d(r){r&&K(e)}}}function bd(t){"use strict";return[]}var Ma=class extends pe{constructor(e){super();ye(this,e,bd,_d,fe,{})}},Pa=Ma;function Ra(t){let e,r;return e=new Pa({}),{c(){Fe(e.$$.fragment)},m(n,i){xe(e,n,i),r=!0},i(n){r||(q(e.$$.fragment,n),r=!0)},o(n){Q(e.$$.fragment,n),r=!1},d(n){ge(e,n)}}}function xd(t){let e,r,n,i,s,o=t[2]&&Ra(t),a=t[4].default,l=Gt(a,t,t[3],null);return{c(){e=I("div"),o&&o.c(),r=U(),l&&l.c(),B(e,"data-result-id",t[0]),B(e,"class","suggestion-item omnisearch-result"),bi(e,"is-selected",t[1])},m(u,c){z(u,e,c),o&&o.m(e,null),k(e,r),l&&l.m(e,null),n=!0,i||(s=[Te(e,"mousemove",t[5]),Te(e,"click",t[6]),Te(e,"auxclick",t[7])],i=!0)},p(u,[c]){u[2]?o?c&4&&q(o,1):(o=Ra(u),o.c(),q(o,1),o.m(e,r)):o&&(Dt(),Q(o,1,1,()=>{o=null}),Tt()),l&&l.p&&(!n||c&8)&&Qt(l,a,u,u[3],n?qt(a,u[3],c,null):Yt(u[3]),null),(!n||c&1)&&B(e,"data-result-id",u[0]),(!n||c&2)&&bi(e,"is-selected",u[1])},i(u){n||(q(o),q(l,u),n=!0)},o(u){Q(o),Q(l,u),n=!1},d(u){u&&K(e),o&&o.d(),l&&l.d(u),i=!1,Re(s)}}}function wd(t,e,r){let{$$slots:n={},$$scope:i}=e,{id:s}=e,{selected:o=!1}=e,{glyph:a=!1}=e;function l(f){Me.call(this,t,f)}function u(f){Me.call(this,t,f)}function c(f){Me.call(this,t,f)}return t.$$set=f=>{"id"in f&&r(0,s=f.id),"selected"in f&&r(1,o=f.selected),"glyph"in f&&r(2,a=f.glyph),"$$scope"in f&&r(3,i=f.$$scope)},[s,o,a,i,n,l,u,c]}var Ba=class extends pe{constructor(e){super();ye(this,e,wd,xd,fe,{id:0,selected:1,glyph:2})}},qn=Ba;var cr=Ce(require("obsidian"));function La(t){let e,r=t[1].matches.length+"",n,i,s=(t[1].matches.length>1?"matches":"match")+"",o;return{c(){e=I("span"),n=Se(r),i=Se("\xA0"),o=Se(s),B(e,"class","omnisearch-result__counter")},m(a,l){z(a,e,l),k(e,n),k(e,i),k(e,o)},p(a,l){l&2&&r!==(r=a[1].matches.length+"")&&Ft(n,r),l&2&&s!==(s=(a[1].matches.length>1?"matches":"match")+"")&&Ft(o,s)},d(a){a&&K(e)}}}function Na(t){let e,r,n,i,s;return{c(){e=I("div"),r=I("span"),n=U(),i=I("span"),s=Se(t[6]),B(e,"class","omnisearch-result__folder-path")},m(o,a){z(o,e,a),k(e,r),t[12](r),k(e,n),k(e,i),k(i,s)},p(o,a){a&64&&Ft(s,o[6])},d(o){o&&K(e),t[12](null)}}}function Ka(t){let e,r=t[8].replace(t[9],gt)+"";return{c(){e=I("div"),B(e,"class","omnisearch-result__body")},m(n,i){z(n,e,i),e.innerHTML=r},p(n,i){i&768&&r!==(r=n[8].replace(n[9],gt)+"")&&(e.innerHTML=r)},d(n){n&&K(e)}}}function za(t){let e,r,n;return{c(){e=I("div"),r=I("img"),ke(r,"width","100px"),vi(r.src,n=t[5])||B(r,"src",n),B(r,"alt",""),B(e,"class","omnisearch-result__image-container")},m(i,s){z(i,e,s),k(e,r)},p(i,s){s&32&&!vi(r.src,n=i[5])&&B(r,"src",n)},d(i){i&&K(e)}}}function jd(t){let e,r,n,i,s,o,a=t[2].replace(t[9],gt)+"",l,u,c,f=Kt(t[1].path)+"",d,g,w,x,b,h,v=t[1].matches.length>0&&La(t),m=t[6]&&Na(t),p=t[10]&&Ka(t),_=t[5]&&za(t);return{c(){e=I("div"),r=I("div"),n=I("span"),i=I("span"),s=U(),o=I("span"),l=U(),u=I("span"),c=Se("."),d=Se(f),g=U(),v&&v.c(),w=U(),m&&m.c(),x=U(),b=I("div"),p&&p.c(),h=U(),_&&_.c(),B(u,"class","omnisearch-result__extension"),B(n,"class","omnisearch-result__title"),B(r,"class","omnisearch-result__title-container"),ke(b,"display","flex"),ke(b,"flex-direction","row")},m(y,j){z(y,e,j),k(e,r),k(r,n),k(n,i),t[11](i),k(n,s),k(n,o),o.innerHTML=a,k(n,l),k(n,u),k(u,c),k(u,d),k(n,g),v&&v.m(n,null),k(e,w),m&&m.m(e,null),k(e,x),k(e,b),p&&p.m(b,null),k(b,h),_&&_.m(b,null)},p(y,j){j&516&&a!==(a=y[2].replace(y[9],gt)+"")&&(o.innerHTML=a),j&2&&f!==(f=Kt(y[1].path)+"")&&Ft(d,f),y[1].matches.length>0?v?v.p(y,j):(v=La(y),v.c(),v.m(n,null)):v&&(v.d(1),v=null),y[6]?m?m.p(y,j):(m=Na(y),m.c(),m.m(e,x)):m&&(m.d(1),m=null),y[10]?p?p.p(y,j):(p=Ka(y),p.c(),p.m(b,h)):p&&(p.d(1),p=null),y[5]?_?_.p(y,j):(_=za(y),_.c(),_.m(b,null)):_&&(_.d(1),_=null)},d(y){y&&K(e),t[11](null),v&&v.d(),m&&m.d(),p&&p.d(),_&&_.d()}}}function Ad(t){let e,r;return e=new qn({props:{glyph:t[7],id:t[1].path,selected:t[0],$$slots:{default:[jd]},$$scope:{ctx:t}}}),e.$on("click",t[13]),e.$on("auxclick",t[14]),e.$on("mousemove",t[15]),{c(){Fe(e.$$.fragment)},m(n,i){xe(e,n,i),r=!0},p(n,[i]){let s={};i&128&&(s.glyph=n[7]),i&2&&(s.id=n[1].path),i&1&&(s.selected=n[0]),i&67454&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(q(e.$$.fragment,n),r=!0)},o(n){Q(e.$$.fragment,n),r=!1},d(n){ge(e,n)}}}function Cd(t,e,r){let n,i,s,o;ln(t,Lt,m=>r(10,o=m));let{selected:a=!1}=e,{note:l}=e,u=null,c="",f="",d,g;function w(m){$e[m?"unshift":"push"](()=>{g=m,r(4,g)})}function x(m){$e[m?"unshift":"push"](()=>{d=m,r(3,d)})}function b(m){Me.call(this,t,m)}function h(m){Me.call(this,t,m)}function v(m){Me.call(this,t,m)}t.$$set=m=>{"selected"in m&&r(0,a=m.selected),"note"in m&&r(1,l=m.note)},t.$$.update=()=>{if(t.$$.dirty&2){e:if(r(5,u=null),Hn(l.path)){let m=app.vault.getFiles().find(p=>p.path===l.path);m&&r(5,u=app.vault.getResourcePath(m))}}if(t.$$.dirty&2){e:r(9,n=yt(l.foundWords))}if(t.$$.dirty&2){e:r(8,i=ur(l.content,l.matches[0]?.offset??-1))}if(t.$$.dirty&30){e:r(2,c=l.basename),r(6,f=ba(l.path)),E.ignoreDiacritics&&r(2,c=et(c)),d&&(0,cr.setIcon)(d,"folder-open"),g&&(Hn(l.path)?(0,cr.setIcon)(g,"image"):en(l.path)?(0,cr.setIcon)(g,"file-text"):tn(l.path)?(0,cr.setIcon)(g,"layout-dashboard"):(0,cr.setIcon)(g,"file"))}};e:r(7,s=!1);return[a,l,c,d,g,u,f,s,i,n,o,w,x,b,h,v]}var Va=class extends pe{constructor(e){super();ye(this,e,Cd,Ad,fe,{selected:0,note:1})}},Ha=Va;function $a(t,e){e?e.offsets=typeof e.offsets=="undefined"?!0:e.offsets:e={offsets:!0,tokenize:!0},t||(t="");let r={text:[],offsets:[],exclude:{text:[]}};e.offsets&&(r.offsets=[]);let n={text:[]},i=[],s=/(\S+:'(?:[^'\\]|\\.)*')|(\S+:"(?:[^"\\]|\\.)*")|(-?"(?:[^"\\]|\\.)*")|(-?'(?:[^'\\]|\\.)*')|\S+|\S+:\S+/g,o,a=0,l=new Date().getTime();for(;(o=s.exec(t))!==null;){if(++a>=100||new Date().getTime()-l>50){$n("Stopped SearchParserResult at",a,"results");break}let c=o[0],f=c.indexOf(":");if(f!==-1){let d=c.slice(0,f),g=c.slice(f+1);g=(g+"").replace(/\\(.?)/g,function(w,x){switch(x){case"\\":return"\\";case"0":return"\0";case"":return"";default:return x}}),i.push({keyword:d,value:g,offsetStart:o.index,offsetEnd:o.index+c.length})}else{let d=!1;c[0]==="-"&&(d=!0,c=c.slice(1)),c=(c+"").replace(/\\(.?)/g,function(g,w){switch(w){case"\\":return"\\";case"0":return"\0";case"":return"";default:return w}}),d?n.text.push(c):i.push({text:c,offsetStart:o.index,offsetEnd:o.index+c.length})}}i.reverse();let u;for(;u=i.pop();)if(u.text)r.text.push(u.text),e.offsets&&r.offsets.push(u);else if(u.keyword){let c=u.keyword;e.keywords=e.keywords||[];let f=!1,d=!1;if(!/^-/.test(c))f=e.keywords.indexOf(c)!==-1;else if(c[0]==="-"){let w=c.slice(1);f=e.keywords.indexOf(w)!==-1,f&&(c=w,d=!0)}e.ranges=e.ranges||[];let g=e.ranges.indexOf(c)!==-1;if(f){e.offsets&&r.offsets.push({keyword:c,value:u.value,offsetStart:d?u.offsetStart+1:u.offsetStart,offsetEnd:u.offsetEnd});let w=u.value;if(w.length){let x=w.split(",");d?n[c]?n[c]instanceof Array?x.length>1?n[c]=n[c].concat(x):n[c].push(w):(n[c]=[n[c]],n[c].push(w)):x.length>1?n[c]=x:e.alwaysArray?n[c]=[w]:n[c]=w:r[c]?r[c]instanceof Array?x.length>1?r[c]=r[c].concat(x):r[c].push(w):(r[c]=[r[c]],r[c].push(w)):x.length>1?r[c]=x:e.alwaysArray?r[c]=[w]:r[c]=w}}else if(g){e.offsets&&r.offsets.push(u);let w=u.value,x=w.split("-");r[c]={},x.length===2?(r[c].from=x[0],r[c].to=x[1]):r[c].from=w}else{let w=u.keyword+":"+u.value;r.text.push(w),e.offsets&&r.offsets.push({text:w,offsetStart:u.offsetStart,offsetEnd:u.offsetEnd})}}return r.exclude=n,r}var zt=class{constructor(e=""){this.segments=[];this.exclusions=[];this.extensions=[];this.extensions=this.extractExtensions(e),e=this.removeExtensions(e),E.ignoreDiacritics&&(e=et(e));let r=$a(e.toLowerCase(),{tokenize:!0});this.exclusions=r.exclude.text.map(this.formatToken).filter(n=>!!n.value),this.segments=r.text.reduce((n,i)=>{let s=this.formatToken(i);return s.value&&n.push(s),n},[])}isEmpty(){return this.segments.length===0}segmentsToStr(){return this.segments.map(({value:e})=>e).join(" ")}getExactTerms(){return this.segments.filter(({exact:e})=>e).map(({value:e})=>e)}formatToken(e){let r=xa(e);return{value:r,exact:r!==e}}extractExtensions(e){let r=(e.match(_s)??[]).map(n=>n.trim());return r?r.map(n=>n.toLowerCase()):[]}removeExtensions(e){return e.replace(_s,"")}};var ee=function(){return ee=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},ee.apply(this,arguments)};function Sd(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})}function Fd(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(c){u=[6,c],i=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function W(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=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 ae(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}var Ed="ENTRIES",Wa="KEYS",Ua="VALUES",me="",Cs=function(){function t(e,r){var n=e._tree,i=Array.from(n.keys());this.set=e,this._type=r,this._path=i.length>0?[{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=fr(this._path),r=e.node,n=e.keys;if(fr(n)===me)return{done:!1,value:this.result()};var i=r.get(fr(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=fr(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 fr(r)}).filter(function(e){return e!==me}).join("")},t.prototype.value=function(){return fr(this._path).node.get(me)},t.prototype.result=function(){switch(this._type){case Ua:return this.value();case Wa:return this.key();default:return[this.key(),this.value()]}},t.prototype[Symbol.iterator]=function(){return this},t}(),fr=function(t){return t[t.length-1]},Dd=function(t,e,r){var n=new Map;if(e===void 0)return n;for(var i=e.length+1,s=i+r,o=new Uint8Array(s*i).fill(r+1),a=0;a<i;++a)o[a]=a;for(var l=1;l<s;++l)o[l*i]=l;return Ga(t,e,r,n,o,1,i,""),n},Ga=function(t,e,r,n,i,s,o,a){var l,u,c=s*o;try{e:for(var f=W(t.keys()),d=f.next();!d.done;d=f.next()){var g=d.value;if(g===me){var w=i[c-1];w<=r&&n.set(a,[t.get(g),w])}else{for(var x=s,b=0;b<g.length;++b,++x){for(var h=g[b],v=o*x,m=v-o,p=i[v],_=Math.max(0,x-r-1),y=Math.min(o-1,x+r),j=_;j<y;++j){var A=h!==e[j],C=i[m+j]+ +A,S=i[m+j+1]+1,D=i[v+j]+1,P=i[v+j+1]=Math.min(C,S,D);P<p&&(p=P)}if(p>r)continue e}Ga(t.get(g),e,r,n,i,x,o,a+g)}}}catch(T){l={error:T}}finally{try{d&&!d.done&&(u=f.return)&&u.call(f)}finally{if(l)throw l.error}}},Ss=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=ae(Qn(this._tree,e.slice(this._prefix.length)),2),s=i[0],o=i[1];if(s===void 0){var a=ae(Ds(o),2),l=a[0],u=a[1];try{for(var c=W(l.keys()),f=c.next();!f.done;f=c.next()){var d=f.value;if(d!==me&&d.startsWith(u)){var g=new Map;return g.set(d.slice(u.length),l.get(d)),new t(g,e)}}}catch(w){r={error:w}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}return new t(s,e)},t.prototype.clear=function(){this._size=void 0,this._tree.clear()},t.prototype.delete=function(e){return this._size=void 0,Td(this._tree,e)},t.prototype.entries=function(){return new Cs(this,Ed)},t.prototype.forEach=function(e){var r,n;try{for(var i=W(this),s=i.next();!s.done;s=i.next()){var o=ae(s.value,2),a=o[0],l=o[1];e(a,l,this)}}catch(u){r={error:u}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.fuzzyGet=function(e,r){return Dd(this._tree,e,r)},t.prototype.get=function(e){var r=Fs(this._tree,e);return r!==void 0?r.get(me):void 0},t.prototype.has=function(e){var r=Fs(this._tree,e);return r!==void 0&&r.has(me)},t.prototype.keys=function(){return new Cs(this,Wa)},t.prototype.set=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Es(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=Es(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=Es(this._tree,e),i=n.get(me);return i===void 0&&n.set(me,i=r()),i},t.prototype.values=function(){return new Cs(this,Ua)},t.prototype[Symbol.iterator]=function(){return this.entries()},t.from=function(e){var r,n,i=new t;try{for(var s=W(e),o=s.next();!o.done;o=s.next()){var a=ae(o.value,2),l=a[0],u=a[1];i.set(l,u)}}catch(c){r={error:c}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},t.fromObject=function(e){return t.from(Object.entries(e))},t}(),Qn=function(t,e,r){var n,i;if(r===void 0&&(r=[]),e.length===0||t==null)return[t,r];try{for(var s=W(t.keys()),o=s.next();!o.done;o=s.next()){var a=o.value;if(a!==me&&e.startsWith(a))return r.push([t,a]),Qn(t.get(a),e.slice(a.length),r)}}catch(l){n={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return r.push([t,e]),Qn(void 0,"",r)},Fs=function(t,e){var r,n;if(e.length===0||t==null)return t;try{for(var i=W(t.keys()),s=i.next();!s.done;s=i.next()){var o=s.value;if(o!==me&&e.startsWith(o))return Fs(t.get(o),e.slice(o.length))}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},Es=function(t,e){var r,n,i=e.length;e:for(var s=0;t&&s<i;){try{for(var o=(r=void 0,W(t.keys())),a=o.next();!a.done;a=o.next()){var l=a.value;if(l!==me&&e[s]===l[0]){for(var u=Math.min(i-s,l.length),c=1;c<u&&e[s+c]===l[c];)++c;var f=t.get(l);if(c===l.length)t=f;else{var d=new Map;d.set(l.slice(c),f),t.set(e.slice(s,s+c),d),t.delete(l),t=d}s+=c;continue e}}}catch(w){r={error:w}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}var g=new Map;return t.set(e.slice(s),g),g}return t},Td=function(t,e){var r=ae(Qn(t,e),2),n=r[0],i=r[1];if(n!==void 0){if(n.delete(me),n.size===0)qa(i);else if(n.size===1){var s=ae(n.entries().next().value,2),o=s[0],a=s[1];Qa(i,o,a)}}},qa=function(t){if(t.length!==0){var e=ae(Ds(t),2),r=e[0],n=e[1];if(r.delete(n),r.size===0)qa(t.slice(0,-1));else if(r.size===1){var i=ae(r.entries().next().value,2),s=i[0],o=i[1];s!==me&&Qa(t.slice(0,-1),s,o)}}},Qa=function(t,e,r){if(t.length!==0){var n=ae(Ds(t),2),i=n[0],s=n[1];i.set(s+e,r),i.delete(s)}},Ds=function(t){return t[t.length-1]},rn,Ts="or",Ya="and",kd="and_not",ks=function(){function t(e){if((e==null?void 0:e.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');var r=e.autoVacuum==null||e.autoVacuum===!0?Rs:e.autoVacuum;this._options=ee(ee(ee({},Is),e),{autoVacuum:r,searchOptions:ee(ee({},Ja),e.searchOptions||{}),autoSuggestOptions:ee(ee({},Rd),e.autoSuggestOptions||{})}),this._index=new Ss,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=Ps,this.addFields(this._options.fields)}return t.prototype.add=function(e){var r,n,i,s,o,a,l=this._options,u=l.extractField,c=l.tokenize,f=l.processTerm,d=l.fields,g=l.idField,w=u(e,g);if(w==null)throw new Error('MiniSearch: document does not have ID field "'.concat(g,'"'));if(this._idToShortId.has(w))throw new Error("MiniSearch: duplicate ID ".concat(w));var x=this.addDocumentId(w);this.saveStoredFields(x,e);try{for(var b=W(d),h=b.next();!h.done;h=b.next()){var v=h.value,m=u(e,v);if(m!=null){var p=c(m.toString(),v),_=this._fieldIds[v],y=new Set(p).size;this.addFieldLength(x,_,this._documentCount-1,y);try{for(var j=(i=void 0,W(p)),A=j.next();!A.done;A=j.next()){var C=A.value,S=f(C,v);if(Array.isArray(S))try{for(var D=(o=void 0,W(S)),P=D.next();!P.done;P=D.next()){var T=P.value;this.addTerm(_,x,T)}}catch(N){o={error:N}}finally{try{P&&!P.done&&(a=D.return)&&a.call(D)}finally{if(o)throw o.error}}else S&&this.addTerm(_,x,S)}}catch(N){i={error:N}}finally{try{A&&!A.done&&(s=j.return)&&s.call(j)}finally{if(i)throw i.error}}}}}catch(N){r={error:N}}finally{try{h&&!h.done&&(n=b.return)&&n.call(b)}finally{if(r)throw r.error}}},t.prototype.addAll=function(e){var r,n;try{for(var i=W(e),s=i.next();!s.done;s=i.next()){var o=s.value;this.add(o)}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.addAllAsync=function(e,r){var n=this;r===void 0&&(r={});var i=r.chunkSize,s=i===void 0?10:i,o={chunk:[],promise:Promise.resolve()},a=e.reduce(function(c,f,d){var g=c.chunk,w=c.promise;return g.push(f),(d+1)%s==0?{chunk:[],promise:w.then(function(){return new Promise(function(x){return setTimeout(x,0)})}).then(function(){return n.addAll(g)})}:{chunk:g,promise:w}},o),l=a.chunk,u=a.promise;return u.then(function(){return n.addAll(l)})},t.prototype.remove=function(e){var r,n,i,s,o,a,l=this._options,u=l.tokenize,c=l.processTerm,f=l.extractField,d=l.fields,g=l.idField,w=f(e,g);if(w==null)throw new Error('MiniSearch: document does not have ID field "'.concat(g,'"'));var x=this._idToShortId.get(w);if(x==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(w,": it is not in the index"));try{for(var b=W(d),h=b.next();!h.done;h=b.next()){var v=h.value,m=f(e,v);if(m!=null){var p=u(m.toString(),v),_=this._fieldIds[v],y=new Set(p).size;this.removeFieldLength(x,_,this._documentCount,y);try{for(var j=(i=void 0,W(p)),A=j.next();!A.done;A=j.next()){var C=A.value,S=c(C,v);if(Array.isArray(S))try{for(var D=(o=void 0,W(S)),P=D.next();!P.done;P=D.next()){var T=P.value;this.removeTerm(_,x,T)}}catch(N){o={error:N}}finally{try{P&&!P.done&&(a=D.return)&&a.call(D)}finally{if(o)throw o.error}}else S&&this.removeTerm(_,x,S)}}catch(N){i={error:N}}finally{try{A&&!A.done&&(s=j.return)&&s.call(j)}finally{if(i)throw i.error}}}}}catch(N){r={error:N}}finally{try{h&&!h.done&&(n=b.return)&&n.call(b)}finally{if(r)throw r.error}}this._storedFields.delete(x),this._documentIds.delete(x),this._idToShortId.delete(w),this._fieldLength.delete(x),this._documentCount-=1},t.prototype.removeAll=function(e){var r,n;if(e)try{for(var i=W(e),s=i.next();!s.done;s=i.next()){var o=s.value;this.remove(o)}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Ss,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,s){r.removeFieldLength(n,s,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,s=e.batchWait;this.conditionalVacuum({batchSize:i,batchWait:s},{minDirtCount:n,minDirtFactor:r})}},t.prototype.discardAll=function(e){var r,n,i=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var s=W(e),o=s.next();!o.done;o=s.next()){var a=o.value;this.discard(a)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}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,s=i(e,n);this.discard(s),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=Ps,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 Sd(this,void 0,void 0,function(){var n,i,s,o,a,l,u,c,f,d,g,w,x,b,h,v,m,p,_,y,j,A,C,S,D;return Fd(this,function(P){switch(P.label){case 0:if(n=this._dirtCount,!this.vacuumConditionsMet(r))return[3,10];i=e.batchSize||Ms.batchSize,s=e.batchWait||Ms.batchWait,o=1,P.label=1;case 1:P.trys.push([1,7,8,9]),a=W(this._index),l=a.next(),P.label=2;case 2:if(l.done)return[3,6];u=ae(l.value,2),c=u[0],f=u[1];try{for(d=(A=void 0,W(f)),g=d.next();!g.done;g=d.next()){w=ae(g.value,2),x=w[0],b=w[1];try{for(h=(S=void 0,W(b)),v=h.next();!v.done;v=h.next())m=ae(v.value,1),p=m[0],!this._documentIds.has(p)&&(b.size<=1?f.delete(x):b.delete(p))}catch(T){S={error:T}}finally{try{v&&!v.done&&(D=h.return)&&D.call(h)}finally{if(S)throw S.error}}}}catch(T){A={error:T}}finally{try{g&&!g.done&&(C=d.return)&&C.call(d)}finally{if(A)throw A.error}}return this._index.get(c).size===0&&this._index.delete(c),o%i!=0?[3,4]:[4,new Promise(function(T){return setTimeout(T,s)})];case 3:P.sent(),P.label=4;case 4:o+=1,P.label=5;case 5:return l=a.next(),[3,2];case 6:return[3,9];case 7:return _=P.sent(),y={error:_},[3,9];case 8:try{l&&!l.done&&(j=a.return)&&j.call(a)}finally{if(y)throw y.error}return[7];case 9:this._dirtCount-=n,P.label=10;case 10:return[4,null];case 11:return P.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||Rs.minDirtCount,n=n||Rs.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 s=this.executeQuery(e,r),o=[];try{for(var a=W(s),l=a.next();!l.done;l=a.next()){var u=ae(l.value,2),c=u[0],f=u[1],d=f.score,g=f.terms,w=f.match,x=g.length,b={id:this._documentIds.get(c),score:d*x,terms:Object.keys(w),match:w};Object.assign(b,this._storedFields.get(c)),(r.filter==null||r.filter(b))&&o.push(b)}}catch(h){n={error:h}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o.sort(Za),o},t.prototype.autoSuggest=function(e,r){var n,i,s,o;r===void 0&&(r={}),r=ee(ee({},this._options.autoSuggestOptions),r);var a=new Map;try{for(var l=W(this.search(e,r)),u=l.next();!u.done;u=l.next()){var c=u.value,f=c.score,d=c.terms,g=d.join(" "),w=a.get(g);w!=null?(w.score+=f,w.count+=1):a.set(g,{score:f,terms:d,count:1})}}catch(_){n={error:_}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}var x=[];try{for(var b=W(a),h=b.next();!h.done;h=b.next()){var v=ae(h.value,2),w=v[0],m=v[1],f=m.score,d=m.terms,p=m.count;x.push({suggestion:w,terms:d,score:f/p})}}catch(_){s={error:_}}finally{try{h&&!h.done&&(o=b.return)&&o.call(b)}finally{if(s)throw s.error}}return x.sort(Za),x},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(Is.hasOwnProperty(e))return Os(Is,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},t.loadJS=function(e,r){var n,i,s,o,a,l,u=e.index,c=e.documentCount,f=e.nextId,d=e.documentIds,g=e.fieldIds,w=e.fieldLength,x=e.averageFieldLength,b=e.storedFields,h=e.dirtCount,v=e.serializationVersion;if(v!==1&&v!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var m=new t(r);m._documentCount=c,m._nextId=f,m._documentIds=Yn(d),m._idToShortId=new Map,m._fieldIds=g,m._fieldLength=Yn(w),m._avgFieldLength=x,m._storedFields=Yn(b),m._dirtCount=h||0,m._index=new Ss;try{for(var p=W(m._documentIds),_=p.next();!_.done;_=p.next()){var y=ae(_.value,2),j=y[0],A=y[1];m._idToShortId.set(A,j)}}catch(te){n={error:te}}finally{try{_&&!_.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}try{for(var C=W(u),S=C.next();!S.done;S=C.next()){var D=ae(S.value,2),P=D[0],T=D[1],N=new Map;try{for(var H=(a=void 0,W(Object.keys(T))),M=H.next();!M.done;M=H.next()){var F=M.value,V=T[F];v===1&&(V=V.ds),N.set(parseInt(F,10),Yn(V))}}catch(te){a={error:te}}finally{try{M&&!M.done&&(l=H.return)&&l.call(H)}finally{if(a)throw a.error}}m._index.set(P,N)}}catch(te){s={error:te}}finally{try{S&&!S.done&&(o=C.return)&&o.call(C)}finally{if(s)throw s.error}}return m},t.prototype.executeQuery=function(e,r){var n=this;if(r===void 0&&(r={}),typeof e!="string"){var i=ee(ee(ee({},r),e),{queries:void 0}),s=e.queries.map(function(b){return n.executeQuery(b,i)});return this.combineResults(s,e.combineWith)}var o=this._options,a=o.tokenize,l=o.processTerm,u=o.searchOptions,c=ee(ee({tokenize:a,processTerm:l},u),r),f=c.tokenize,d=c.processTerm,g=f(e).flatMap(function(b){return d(b)}).filter(function(b){return!!b}),w=g.map(Pd(c)),x=w.map(function(b){return n.executeQuerySpec(b,c)});return this.combineResults(x,c.combineWith)},t.prototype.executeQuerySpec=function(e,r){var n,i,s,o,a=ee(ee({},this._options.searchOptions),r),l=(a.fields||this._options.fields).reduce(function(F,V){var te;return ee(ee({},F),(te={},te[V]=Os(F,V)||1,te))},a.boost||{}),u=a.boostDocument,c=a.weights,f=a.maxFuzzy,d=a.bm25,g=ee(ee({},Ja.weights),c),w=g.fuzzy,x=g.prefix,b=this._index.get(e.term),h=this.termResults(e.term,e.term,1,b,l,u,d),v,m;if(e.prefix&&(v=this._index.atPrefix(e.term)),e.fuzzy){var p=e.fuzzy===!0?.2:e.fuzzy,_=p<1?Math.min(f,Math.round(e.term.length*p)):p;_&&(m=this._index.fuzzyGet(e.term,_))}if(v)try{for(var y=W(v),j=y.next();!j.done;j=y.next()){var A=ae(j.value,2),C=A[0],S=A[1],D=C.length-e.term.length;if(!!D){m==null||m.delete(C);var P=x*C.length/(C.length+.3*D);this.termResults(e.term,C,P,S,l,u,d,h)}}}catch(F){n={error:F}}finally{try{j&&!j.done&&(i=y.return)&&i.call(y)}finally{if(n)throw n.error}}if(m)try{for(var T=W(m.keys()),N=T.next();!N.done;N=T.next()){var C=N.value,H=ae(m.get(C),2),M=H[0],D=H[1];if(!!D){var P=w*C.length/(C.length+D);this.termResults(e.term,C,P,M,l,u,d,h)}}}catch(F){s={error:F}}finally{try{N&&!N.done&&(o=T.return)&&o.call(T)}finally{if(s)throw s.error}}return h},t.prototype.combineResults=function(e,r){if(r===void 0&&(r=Ts),e.length===0)return new Map;var n=r.toLowerCase();return e.reduce(Od[n])||new Map},t.prototype.toJSON=function(){var e,r,n,i,s=[];try{for(var o=W(this._index),a=o.next();!a.done;a=o.next()){var l=ae(a.value,2),u=l[0],c=l[1],f={};try{for(var d=(n=void 0,W(c)),g=d.next();!g.done;g=d.next()){var w=ae(g.value,2),x=w[0],b=w[1];f[x]=Object.fromEntries(b)}}catch(h){n={error:h}}finally{try{g&&!g.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}s.push([u,f])}}catch(h){e={error:h}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}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:s,serializationVersion:2}},t.prototype.termResults=function(e,r,n,i,s,o,a,l){var u,c,f,d,g;if(l===void 0&&(l=new Map),i==null)return l;try{for(var w=W(Object.keys(s)),x=w.next();!x.done;x=w.next()){var b=x.value,h=s[b],v=this._fieldIds[b],m=i.get(v);if(m!=null){var p=m.size,_=this._avgFieldLength[v];try{for(var y=(f=void 0,W(m.keys())),j=y.next();!j.done;j=y.next()){var A=j.value;if(!this._documentIds.has(A)){this.removeTerm(v,A,r),p-=1;continue}var C=o?o(this._documentIds.get(A),r):1;if(!!C){var S=m.get(A),D=this._fieldLength.get(A)[v],P=Md(S,p,this._documentCount,D,_,a),T=n*h*C*P,N=l.get(A);if(N){N.score+=T,Bd(N.terms,e);var H=Os(N.match,r);H?H.push(b):N.match[r]=[b]}else l.set(A,{score:T,terms:[e],match:(g={},g[r]=[b],g)})}}}catch(M){f={error:M}}finally{try{j&&!j.done&&(d=y.return)&&d.call(y)}finally{if(f)throw f.error}}}}}catch(M){u={error:M}}finally{try{x&&!x.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}return l},t.prototype.addTerm=function(e,r,n){var i=this._index.fetch(n,el),s=i.get(e);if(s==null)s=new Map,s.set(r,1),i.set(e,s);else{var o=s.get(r);s.set(r,(o||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,el),s=i.get(e);s==null||s.get(r)==null?this.warnDocumentChanged(r,e,n):s.get(r)<=1?s.size<=1?i.delete(e):s.delete(r):s.set(r,s.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)},t.prototype.warnDocumentChanged=function(e,r,n){var i,s;try{for(var o=W(Object.keys(this._fieldIds)),a=o.next();!a.done;a=o.next()){var l=a.value;if(this._fieldIds[l]===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(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}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<e.length;r++)this._fieldIds[e[r]]=r},t.prototype.addFieldLength=function(e,r,n,i){var s=this._fieldLength.get(e);s==null&&this._fieldLength.set(e,s=[]),s[r]=i;var o=this._avgFieldLength[r]||0,a=o*n+i;this._avgFieldLength[r]=a/(n+1)},t.prototype.removeFieldLength=function(e,r,n,i){if(n===1){this._avgFieldLength[r]=0;return}var s=this._avgFieldLength[r]*n-i;this._avgFieldLength[r]=s/(n-1)},t.prototype.saveStoredFields=function(e,r){var n,i,s=this._options,o=s.storeFields,a=s.extractField;if(!(o==null||o.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var u=W(o),c=u.next();!c.done;c=u.next()){var f=c.value,d=a(r,f);d!==void 0&&(l[f]=d)}}catch(g){n={error:g}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}},t}(),Os=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0},Od=(rn={},rn[Ts]=function(t,e){var r,n;try{for(var i=W(e.keys()),s=i.next();!s.done;s=i.next()){var o=s.value,a=t.get(o);if(a==null)t.set(o,e.get(o));else{var l=e.get(o),u=l.score,c=l.terms,f=l.match;a.score=a.score+u,a.match=Object.assign(a.match,f),Xa(a.terms,c)}}}catch(d){r={error:d}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},rn[Ya]=function(t,e){var r,n,i=new Map;try{for(var s=W(e.keys()),o=s.next();!o.done;o=s.next()){var a=o.value,l=t.get(a);if(l!=null){var u=e.get(a),c=u.score,f=u.terms,d=u.match;Xa(l.terms,f),i.set(a,{score:l.score+c,terms:l.terms,match:Object.assign(l.match,d)})}}}catch(g){r={error:g}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},rn[kd]=function(t,e){var r,n;try{for(var i=W(e.keys()),s=i.next();!s.done;s=i.next()){var o=s.value;t.delete(o)}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},rn),Id={k:1.2,b:.7,d:.5},Md=function(t,e,r,n,i,s){var o=s.k,a=s.b,l=s.d,u=Math.log(1+(r-e+.5)/(e+.5));return u*(l+t*(o+1)/(t+o*(1-a+a*n/i)))},Pd=function(t){return function(e,r,n){var i=typeof t.fuzzy=="function"?t.fuzzy(e,r,n):t.fuzzy||!1,s=typeof t.prefix=="function"?t.prefix(e,r,n):t.prefix===!0;return{term:e,fuzzy:i,prefix:s}}},Is={idField:"id",extractField:function(t,e){return t[e]},tokenize:function(t,e){return t.split(Ld)},processTerm:function(t,e){return t.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(t,e,r){return console!=null&&console.warn!=null&&console[t](e)},autoVacuum:!0},Ja={combineWith:Ts,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:Id},Rd={combineWith:Ya,prefix:function(t,e,r){return e===r.length-1}},Ms={batchSize:1e3,batchWait:10},Ps={minDirtFactor:.1,minDirtCount:20},Rs=ee(ee({},Ms),Ps),Bd=function(t,e){t.includes(e)||t.push(e)},Xa=function(t,e){var r,n;try{for(var i=W(e),s=i.next();!s.done;s=i.next()){var o=s.value;t.includes(o)||t.push(o)}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},Za=function(t,e){var r=t.score,n=e.score;return n-r},el=function(){return new Map},Yn=function(t){var e,r,n=new Map;try{for(var i=W(Object.keys(t)),s=i.next();!s.done;s=i.next()){var o=s.value;n.set(parseInt(o,10),t[o])}}catch(a){e={error:a}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},Ld=/[\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]+/u;var nc=Ce(require("obsidian"));var Nd=typeof global=="object"&&global&&global.Object===Object&&global,Jn=Nd;var Kd=typeof self=="object"&&self&&self.Object===Object&&self,zd=Jn||Kd||Function("return this")(),he=zd;var Vd=he.Symbol,Ae=Vd;var tl=Object.prototype,Hd=tl.hasOwnProperty,$d=tl.toString,nn=Ae?Ae.toStringTag:void 0;function Wd(t){var e=Hd.call(t,nn),r=t[nn];try{t[nn]=void 0;var n=!0}catch{}var i=$d.call(t);return n&&(e?t[nn]=r:delete t[nn]),i}var rl=Wd;var Ud=Object.prototype,Gd=Ud.toString;function qd(t){return Gd.call(t)}var nl=qd;var Qd="[object Null]",Yd="[object Undefined]",il=Ae?Ae.toStringTag:void 0;function Jd(t){return t==null?t===void 0?Yd:Qd:il&&il in Object(t)?rl(t):nl(t)}var Le=Jd;function Xd(t){return t!=null&&typeof t=="object"}var Ne=Xd;var Zd="[object Symbol]";function eh(t){return typeof t=="symbol"||Ne(t)&&Le(t)==Zd}var tt=eh;function th(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var dr=th;var rh=Array.isArray,se=rh;var nh=1/0,sl=Ae?Ae.prototype:void 0,ol=sl?sl.toString:void 0;function al(t){if(typeof t=="string")return t;if(se(t))return dr(t,al)+"";if(tt(t))return ol?ol.call(t):"";var e=t+"";return e=="0"&&1/t==-nh?"-0":e}var ll=al;function ih(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var vt=ih;function sh(t){return t}var _t=sh;var oh="[object AsyncFunction]",ah="[object Function]",lh="[object GeneratorFunction]",uh="[object Proxy]";function ch(t){if(!vt(t))return!1;var e=Le(t);return e==ah||e==lh||e==oh||e==uh}var Xn=ch;var fh=he["__core-js_shared__"],Zn=fh;var ul=function(){var t=/[^.]+$/.exec(Zn&&Zn.keys&&Zn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function dh(t){return!!ul&&ul in t}var cl=dh;var hh=Function.prototype,ph=hh.toString;function mh(t){if(t!=null){try{return ph.call(t)}catch{}try{return t+""}catch{}}return""}var rt=mh;var gh=/[\\^$.*+?()[\]{}|]/g,yh=/^\[object .+?Constructor\]$/,vh=Function.prototype,_h=Object.prototype,bh=vh.toString,xh=_h.hasOwnProperty,wh=RegExp("^"+bh.call(xh).replace(gh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function jh(t){if(!vt(t)||cl(t))return!1;var e=Xn(t)?wh:yh;return e.test(rt(t))}var fl=jh;function Ah(t,e){return t==null?void 0:t[e]}var dl=Ah;function Ch(t,e){var r=dl(t,e);return fl(r)?r:void 0}var De=Ch;var Sh=De(he,"WeakMap"),ei=Sh;function Fh(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 hl=Fh;var Eh=800,Dh=16,Th=Date.now;function kh(t){var e=0,r=0;return function(){var n=Th(),i=Dh-(n-r);if(r=n,i>0){if(++e>=Eh)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var pl=kh;function Oh(t){return function(){return t}}var ml=Oh;var Ih=function(){try{var t=De(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Bs=Ih;var Mh=Bs?function(t,e){return Bs(t,"toString",{configurable:!0,enumerable:!1,value:ml(e),writable:!0})}:_t,gl=Mh;var Ph=pl(gl),yl=Ph;var Rh=9007199254740991,Bh=/^(?:0|[1-9]\d*)$/;function Lh(t,e){var r=typeof t;return e=e??Rh,!!e&&(r=="number"||r!="symbol"&&Bh.test(t))&&t>-1&&t%1==0&&t<e}var hr=Lh;function Nh(t,e){return t===e||t!==t&&e!==e}var pr=Nh;var vl=Math.max;function Kh(t,e,r){return e=vl(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,s=vl(n.length-e,0),o=Array(s);++i<s;)o[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(o),hl(t,this,a)}}var _l=Kh;function zh(t,e){return yl(_l(t,e,_t),t+"")}var bl=zh;var Vh=9007199254740991;function Hh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Vh}var mr=Hh;function $h(t){return t!=null&&mr(t.length)&&!Xn(t)}var bt=$h;function Wh(t,e,r){if(!vt(r))return!1;var n=typeof e;return(n=="number"?bt(r)&&hr(e,r.length):n=="string"&&e in r)?pr(r[e],t):!1}var Ls=Wh;var Uh=Object.prototype;function Gh(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Uh;return t===r}var xl=Gh;function qh(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var wl=qh;var Qh="[object Arguments]";function Yh(t){return Ne(t)&&Le(t)==Qh}var Ns=Yh;var jl=Object.prototype,Jh=jl.hasOwnProperty,Xh=jl.propertyIsEnumerable,Zh=Ns(function(){return arguments}())?Ns:function(t){return Ne(t)&&Jh.call(t,"callee")&&!Xh.call(t,"callee")},gr=Zh;function ep(){return!1}var Al=ep;var Cl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Sl=Cl&&typeof module=="object"&&module&&!module.nodeType&&module,tp=Sl&&Sl.exports===Cl,Fl=tp?he.Buffer:void 0,rp=Fl?Fl.isBuffer:void 0,np=rp||Al,sn=np;var ip="[object Arguments]",sp="[object Array]",op="[object Boolean]",ap="[object Date]",lp="[object Error]",up="[object Function]",cp="[object Map]",fp="[object Number]",dp="[object Object]",hp="[object RegExp]",pp="[object Set]",mp="[object String]",gp="[object WeakMap]",yp="[object ArrayBuffer]",vp="[object DataView]",_p="[object Float32Array]",bp="[object Float64Array]",xp="[object Int8Array]",wp="[object Int16Array]",jp="[object Int32Array]",Ap="[object Uint8Array]",Cp="[object Uint8ClampedArray]",Sp="[object Uint16Array]",Fp="[object Uint32Array]",X={};X[_p]=X[bp]=X[xp]=X[wp]=X[jp]=X[Ap]=X[Cp]=X[Sp]=X[Fp]=!0;X[ip]=X[sp]=X[yp]=X[op]=X[vp]=X[ap]=X[lp]=X[up]=X[cp]=X[fp]=X[dp]=X[hp]=X[pp]=X[mp]=X[gp]=!1;function Ep(t){return Ne(t)&&mr(t.length)&&!!X[Le(t)]}var El=Ep;function Dp(t){return function(e){return t(e)}}var ti=Dp;var Dl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,on=Dl&&typeof module=="object"&&module&&!module.nodeType&&module,Tp=on&&on.exports===Dl,Ks=Tp&&Jn.process,kp=function(){try{var t=on&&on.require&&on.require("util").types;return t||Ks&&Ks.binding&&Ks.binding("util")}catch{}}(),zs=kp;var Tl=zs&&zs.isTypedArray,Op=Tl?ti(Tl):El,ri=Op;var Ip=Object.prototype,Mp=Ip.hasOwnProperty;function Pp(t,e){var r=se(t),n=!r&&gr(t),i=!r&&!n&&sn(t),s=!r&&!n&&!i&&ri(t),o=r||n||i||s,a=o?wl(t.length,String):[],l=a.length;for(var u in t)(e||Mp.call(t,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||hr(u,l)))&&a.push(u);return a}var kl=Pp;function Rp(t,e){return function(r){return t(e(r))}}var Ol=Rp;var Bp=Ol(Object.keys,Object),Il=Bp;var Lp=Object.prototype,Np=Lp.hasOwnProperty;function Kp(t){if(!xl(t))return Il(t);var e=[];for(var r in Object(t))Np.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ml=Kp;function zp(t){return bt(t)?kl(t):Ml(t)}var yr=zp;var Vp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hp=/^\w*$/;function $p(t,e){if(se(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||tt(t)?!0:Hp.test(t)||!Vp.test(t)||e!=null&&t in Object(e)}var vr=$p;var Wp=De(Object,"create"),nt=Wp;function Up(){this.__data__=nt?nt(null):{},this.size=0}var Pl=Up;function Gp(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Rl=Gp;var qp="__lodash_hash_undefined__",Qp=Object.prototype,Yp=Qp.hasOwnProperty;function Jp(t){var e=this.__data__;if(nt){var r=e[t];return r===qp?void 0:r}return Yp.call(e,t)?e[t]:void 0}var Bl=Jp;var Xp=Object.prototype,Zp=Xp.hasOwnProperty;function em(t){var e=this.__data__;return nt?e[t]!==void 0:Zp.call(e,t)}var Ll=em;var tm="__lodash_hash_undefined__";function rm(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=nt&&e===void 0?tm:e,this}var Nl=rm;function _r(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}_r.prototype.clear=Pl;_r.prototype.delete=Rl;_r.prototype.get=Bl;_r.prototype.has=Ll;_r.prototype.set=Nl;var Vs=_r;function nm(){this.__data__=[],this.size=0}var Kl=nm;function im(t,e){for(var r=t.length;r--;)if(pr(t[r][0],e))return r;return-1}var xt=im;var sm=Array.prototype,om=sm.splice;function am(t){var e=this.__data__,r=xt(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():om.call(e,r,1),--this.size,!0}var zl=am;function lm(t){var e=this.__data__,r=xt(e,t);return r<0?void 0:e[r][1]}var Vl=lm;function um(t){return xt(this.__data__,t)>-1}var Hl=um;function cm(t,e){var r=this.__data__,n=xt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var $l=cm;function br(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}br.prototype.clear=Kl;br.prototype.delete=zl;br.prototype.get=Vl;br.prototype.has=Hl;br.prototype.set=$l;var wt=br;var fm=De(he,"Map"),jt=fm;function dm(){this.size=0,this.__data__={hash:new Vs,map:new(jt||wt),string:new Vs}}var Wl=dm;function hm(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ul=hm;function pm(t,e){var r=t.__data__;return Ul(e)?r[typeof e=="string"?"string":"hash"]:r.map}var At=pm;function mm(t){var e=At(this,t).delete(t);return this.size-=e?1:0,e}var Gl=mm;function gm(t){return At(this,t).get(t)}var ql=gm;function ym(t){return At(this,t).has(t)}var Ql=ym;function vm(t,e){var r=At(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var Yl=vm;function xr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}xr.prototype.clear=Wl;xr.prototype.delete=Gl;xr.prototype.get=ql;xr.prototype.has=Ql;xr.prototype.set=Yl;var Vt=xr;var _m="Expected a function";function Hs(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(_m);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(Hs.Cache||Vt),r}Hs.Cache=Vt;var Jl=Hs;var bm=500;function xm(t){var e=Jl(t,function(n){return r.size===bm&&r.clear(),n}),r=e.cache;return e}var Xl=xm;var wm=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jm=/\\(\\)?/g,Am=Xl(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(wm,function(r,n,i,s){e.push(i?s.replace(jm,"$1"):n||r)}),e}),Zl=Am;function Cm(t){return t==null?"":ll(t)}var eu=Cm;function Sm(t,e){return se(t)?t:vr(t,e)?[t]:Zl(eu(t))}var ni=Sm;var Fm=1/0;function Em(t){if(typeof t=="string"||tt(t))return t;var e=t+"";return e=="0"&&1/t==-Fm?"-0":e}var Ct=Em;function Dm(t,e){e=ni(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Ct(e[r++])];return r&&r==n?t:void 0}var wr=Dm;function Tm(t,e,r){var n=t==null?void 0:wr(t,e);return n===void 0?r:n}var tu=Tm;function km(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var ii=km;var ru=Ae?Ae.isConcatSpreadable:void 0;function Om(t){return se(t)||gr(t)||!!(ru&&t&&t[ru])}var nu=Om;function iu(t,e,r,n,i){var s=-1,o=t.length;for(r||(r=nu),i||(i=[]);++s<o;){var a=t[s];e>0&&r(a)?e>1?iu(a,e-1,r,n,i):ii(i,a):n||(i[i.length]=a)}return i}var su=iu;function Im(){this.__data__=new wt,this.size=0}var ou=Im;function Mm(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var au=Mm;function Pm(t){return this.__data__.get(t)}var lu=Pm;function Rm(t){return this.__data__.has(t)}var uu=Rm;var Bm=200;function Lm(t,e){var r=this.__data__;if(r instanceof wt){var n=r.__data__;if(!jt||n.length<Bm-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Vt(n)}return r.set(t,e),this.size=r.size,this}var cu=Lm;function jr(t){var e=this.__data__=new wt(t);this.size=e.size}jr.prototype.clear=ou;jr.prototype.delete=au;jr.prototype.get=lu;jr.prototype.has=uu;jr.prototype.set=cu;var Ar=jr;function Nm(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r<n;){var o=t[r];e(o,r,t)&&(s[i++]=o)}return s}var fu=Nm;function Km(){return[]}var du=Km;var zm=Object.prototype,Vm=zm.propertyIsEnumerable,hu=Object.getOwnPropertySymbols,Hm=hu?function(t){return t==null?[]:(t=Object(t),fu(hu(t),function(e){return Vm.call(t,e)}))}:du,pu=Hm;function $m(t,e,r){var n=e(t);return se(t)?n:ii(n,r(t))}var mu=$m;function Wm(t){return mu(t,yr,pu)}var $s=Wm;var Um=De(he,"DataView"),si=Um;var Gm=De(he,"Promise"),oi=Gm;var qm=De(he,"Set"),ai=qm;var gu="[object Map]",Qm="[object Object]",yu="[object Promise]",vu="[object Set]",_u="[object WeakMap]",bu="[object DataView]",Ym=rt(si),Jm=rt(jt),Xm=rt(oi),Zm=rt(ai),eg=rt(ei),Ht=Le;(si&&Ht(new si(new ArrayBuffer(1)))!=bu||jt&&Ht(new jt)!=gu||oi&&Ht(oi.resolve())!=yu||ai&&Ht(new ai)!=vu||ei&&Ht(new ei)!=_u)&&(Ht=function(t){var e=Le(t),r=e==Qm?t.constructor:void 0,n=r?rt(r):"";if(n)switch(n){case Ym:return bu;case Jm:return gu;case Xm:return yu;case Zm:return vu;case eg:return _u}return e});var Ws=Ht;var tg=he.Uint8Array,Us=tg;var rg="__lodash_hash_undefined__";function ng(t){return this.__data__.set(t,rg),this}var xu=ng;function ig(t){return this.__data__.has(t)}var wu=ig;function li(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Vt;++e<r;)this.add(t[e])}li.prototype.add=li.prototype.push=xu;li.prototype.has=wu;var ju=li;function sg(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var Au=sg;function og(t,e){return t.has(e)}var Cu=og;var ag=1,lg=2;function ug(t,e,r,n,i,s){var o=r&ag,a=t.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var u=s.get(t),c=s.get(e);if(u&&c)return u==e&&c==t;var f=-1,d=!0,g=r&lg?new ju:void 0;for(s.set(t,e),s.set(e,t);++f<a;){var w=t[f],x=e[f];if(n)var b=o?n(x,w,f,e,t,s):n(w,x,f,t,e,s);if(b!==void 0){if(b)continue;d=!1;break}if(g){if(!Au(e,function(h,v){if(!Cu(g,v)&&(w===h||i(w,h,r,n,s)))return g.push(v)})){d=!1;break}}else if(!(w===x||i(w,x,r,n,s))){d=!1;break}}return s.delete(t),s.delete(e),d}var ui=ug;function cg(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var Su=cg;function fg(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Fu=fg;var dg=1,hg=2,pg="[object Boolean]",mg="[object Date]",gg="[object Error]",yg="[object Map]",vg="[object Number]",_g="[object RegExp]",bg="[object Set]",xg="[object String]",wg="[object Symbol]",jg="[object ArrayBuffer]",Ag="[object DataView]",Eu=Ae?Ae.prototype:void 0,Gs=Eu?Eu.valueOf:void 0;function Cg(t,e,r,n,i,s,o){switch(r){case Ag:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case jg:return!(t.byteLength!=e.byteLength||!s(new Us(t),new Us(e)));case pg:case mg:case vg:return pr(+t,+e);case gg:return t.name==e.name&&t.message==e.message;case _g:case xg:return t==e+"";case yg:var a=Su;case bg:var l=n&dg;if(a||(a=Fu),t.size!=e.size&&!l)return!1;var u=o.get(t);if(u)return u==e;n|=hg,o.set(t,e);var c=ui(a(t),a(e),n,i,s,o);return o.delete(t),c;case wg:if(Gs)return Gs.call(t)==Gs.call(e)}return!1}var Du=Cg;var Sg=1,Fg=Object.prototype,Eg=Fg.hasOwnProperty;function Dg(t,e,r,n,i,s){var o=r&Sg,a=$s(t),l=a.length,u=$s(e),c=u.length;if(l!=c&&!o)return!1;for(var f=l;f--;){var d=a[f];if(!(o?d in e:Eg.call(e,d)))return!1}var g=s.get(t),w=s.get(e);if(g&&w)return g==e&&w==t;var x=!0;s.set(t,e),s.set(e,t);for(var b=o;++f<l;){d=a[f];var h=t[d],v=e[d];if(n)var m=o?n(v,h,d,e,t,s):n(h,v,d,t,e,s);if(!(m===void 0?h===v||i(h,v,r,n,s):m)){x=!1;break}b||(b=d=="constructor")}if(x&&!b){var p=t.constructor,_=e.constructor;p!=_&&"constructor"in t&&"constructor"in e&&!(typeof p=="function"&&p instanceof p&&typeof _=="function"&&_ instanceof _)&&(x=!1)}return s.delete(t),s.delete(e),x}var Tu=Dg;var Tg=1,ku="[object Arguments]",Ou="[object Array]",ci="[object Object]",kg=Object.prototype,Iu=kg.hasOwnProperty;function Og(t,e,r,n,i,s){var o=se(t),a=se(e),l=o?Ou:Ws(t),u=a?Ou:Ws(e);l=l==ku?ci:l,u=u==ku?ci:u;var c=l==ci,f=u==ci,d=l==u;if(d&&sn(t)){if(!sn(e))return!1;o=!0,c=!1}if(d&&!c)return s||(s=new Ar),o||ri(t)?ui(t,e,r,n,i,s):Du(t,e,l,r,n,i,s);if(!(r&Tg)){var g=c&&Iu.call(t,"__wrapped__"),w=f&&Iu.call(e,"__wrapped__");if(g||w){var x=g?t.value():t,b=w?e.value():e;return s||(s=new Ar),i(x,b,r,n,s)}}return d?(s||(s=new Ar),Tu(t,e,r,n,i,s)):!1}var Mu=Og;function Pu(t,e,r,n,i){return t===e?!0:t==null||e==null||!Ne(t)&&!Ne(e)?t!==t&&e!==e:Mu(t,e,r,n,Pu,i)}var fi=Pu;var Ig=1,Mg=2;function Pg(t,e,r,n){var i=r.length,s=i,o=!n;if(t==null)return!s;for(t=Object(t);i--;){var a=r[i];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=r[i];var l=a[0],u=t[l],c=a[1];if(o&&a[2]){if(u===void 0&&!(l in t))return!1}else{var f=new Ar;if(n)var d=n(u,c,l,t,e,f);if(!(d===void 0?fi(c,u,Ig|Mg,n,f):d))return!1}}return!0}var Ru=Pg;function Rg(t){return t===t&&!vt(t)}var di=Rg;function Bg(t){for(var e=yr(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,di(i)]}return e}var Bu=Bg;function Lg(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var hi=Lg;function Ng(t){var e=Bu(t);return e.length==1&&e[0][2]?hi(e[0][0],e[0][1]):function(r){return r===t||Ru(r,t,e)}}var Lu=Ng;function Kg(t,e){return t!=null&&e in Object(t)}var Nu=Kg;function zg(t,e,r){e=ni(e,t);for(var n=-1,i=e.length,s=!1;++n<i;){var o=Ct(e[n]);if(!(s=t!=null&&r(t,o)))break;t=t[o]}return s||++n!=i?s:(i=t==null?0:t.length,!!i&&mr(i)&&hr(o,i)&&(se(t)||gr(t)))}var Ku=zg;function Vg(t,e){return t!=null&&Ku(t,e,Nu)}var zu=Vg;var Hg=1,$g=2;function Wg(t,e){return vr(t)&&di(e)?hi(Ct(t),e):function(r){var n=tu(r,t);return n===void 0&&n===e?zu(r,t):fi(e,n,Hg|$g)}}var Vu=Wg;function Ug(t){return function(e){return e==null?void 0:e[t]}}var Hu=Ug;function Gg(t){return function(e){return wr(e,t)}}var $u=Gg;function qg(t){return vr(t)?Hu(Ct(t)):$u(t)}var Wu=qg;function Qg(t){return typeof t=="function"?t:t==null?_t:typeof t=="object"?se(t)?Vu(t[0],t[1]):Lu(t):Wu(t)}var Uu=Qg;function Yg(t){return function(e,r,n){for(var i=-1,s=Object(e),o=n(e),a=o.length;a--;){var l=o[t?a:++i];if(r(s[l],l,s)===!1)break}return e}}var Gu=Yg;var Jg=Gu(),qu=Jg;function Xg(t,e){return t&&qu(t,e,yr)}var Qu=Xg;function Zg(t,e){return function(r,n){if(r==null)return r;if(!bt(r))return t(r,n);for(var i=r.length,s=e?i:-1,o=Object(r);(e?s--:++s<i)&&n(o[s],s,o)!==!1;);return r}}var Yu=Zg;var ey=Yu(Qu),Ju=ey;function ty(t,e){var r=-1,n=bt(t)?Array(t.length):[];return Ju(t,function(i,s,o){n[++r]=e(i,s,o)}),n}var Xu=ty;function ry(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var Zu=ry;function ny(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,s=tt(t),o=e!==void 0,a=e===null,l=e===e,u=tt(e);if(!a&&!u&&!s&&t>e||s&&o&&l&&!a&&!u||n&&o&&l||!r&&l||!i)return 1;if(!n&&!s&&!u&&t<e||u&&r&&i&&!n&&!s||a&&r&&i||!o&&i||!l)return-1}return 0}var ec=ny;function iy(t,e,r){for(var n=-1,i=t.criteria,s=e.criteria,o=i.length,a=r.length;++n<o;){var l=ec(i[n],s[n]);if(l){if(n>=a)return l;var u=r[n];return l*(u=="desc"?-1:1)}}return t.index-e.index}var tc=iy;function sy(t,e,r){e.length?e=dr(e,function(s){return se(s)?function(o){return wr(o,s.length===1?s[0]:s)}:s}):e=[_t];var n=-1;e=dr(e,ti(Uu));var i=Xu(t,function(s,o,a){var l=dr(e,function(u){return u(s)});return{criteria:l,index:++n,value:s}});return Zu(i,function(s,o){return tc(s,o,r)})}var rc=sy;var oy=bl(function(t,e){if(t==null)return[];var r=e.length;return r>1&&Ls(t,e[0],e[1])?e=[]:r>2&&Ls(e[0],e[1],e[2])&&(e=[e[0]]),rc(t,su(e,1),[])}),qs=oy;var ay=t=>{let e=t.split(mt),r=Nn();return r?e.flatMap(n=>da.test(n)?r.cut(n):[n]):E.splitCamelCase?[...e,...e.flatMap(Sa)]:e},pi=class{constructor(){this.indexedDocuments=new Map;this.previousResults=[];this.previousQuery=null;this.minisearch=new ks(pi.options)}async loadCache(){let e=await de.getMinisearchCache();return e?(this.minisearch=ks.loadJS(e.data,pi.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(s=>[s.path,s.mtime])),n=e.filter(s=>!this.indexedDocuments.has(s.path)||this.indexedDocuments.get(s.path)!==s.mtime),i=[...this.indexedDocuments].filter(([s,o])=>!r.has(s)||r.get(s)!==o).map(s=>({path:s[0],mtime:s[1]}));return{toAdd:n,toRemove:i}}async addFromPaths(e){ie("Adding files",e);let r=(await Promise.all(e.map(async i=>await de.getDocument(i)))).filter(i=>!!i?.path);ie("Sorting documents to first index markdown"),r=qs(r,i=>i.path.endsWith(".md")?0:1),this.removeFromPaths(r.filter(i=>this.indexedDocuments.has(i.path)).map(i=>i.path));let n=Ca(r,500);for(let i of n){ie("Indexing into search engine",i),i.forEach(o=>this.indexedDocuments.set(o.path,o.mtime));let s=i.filter(o=>this.minisearch.has(o.path));this.removeFromPaths(s.map(o=>o.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 this.previousResults=[],this.previousQuery=null,[];ie("Starting search for",e);let n=this.minisearch.search(e.segmentsToStr(),{prefix:l=>l.length>=r.prefixLength,fuzzy:l=>l.length<=3?0:l.length<=5?.1:.2,combineWith:"AND",boost:{basename:E.weightBasename,directory:E.weightDirectory,aliases:E.weightBasename,headings1:E.weightH1,headings2:E.weightH2,headings3:E.weightH3}});if(ie("Found",n.length,"results"),e.extensions.length&&(n=n.filter(l=>{let u="."+l.id.split(".").pop();return e.extensions.some(c=>u.startsWith(c))})),!n.length)return[];if(r.singleFilePath)return n.filter(l=>l.id===r.singleFilePath);E.hideExcluded?n=n.filter(l=>!(app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(l.id))):n.forEach(l=>{app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(l.id)&&(l.score/=10)});let i=e.segments.filter(l=>l.value.startsWith("#")).map(l=>l.value);for(let l of i)for(let u of n)(u.tags??[]).includes(l)&&(u.score*=100);ie("Sorting and limiting results"),n=n.sort((l,u)=>u.score-l.score).slice(0,50);let s=await Promise.all(n.map(async l=>await de.getDocument(l.id))),o=e.getExactTerms();o.length&&(ie("Filtering with quoted terms"),n=n.filter(l=>{let u=s.find(d=>d.path===l.id),c=u?.path.toLowerCase()??"",f=ws(u?.content??"").toLowerCase();return o.every(d=>f.includes(d)||c.includes(d))}));let a=e.exclusions;return a.length&&(ie("Filtering with exclusions"),n=n.filter(l=>{let u=ws(s.find(c=>c.path===l.id)?.content??"").toLowerCase();return a.every(c=>!u.includes(c.value))})),ie("Deduping"),n=n.filter((l,u,c)=>c.findIndex(f=>f.id===l.id)===u),this.previousQuery=e,this.previousResults=n,n}getMatches(e,r,n){let i=new Date().getTime(),s=null,o=[],a=0;for(;(s=r.exec(e))!==null;){if(++a>=100||new Date().getTime()-i>50){$n("Stopped getMatches at",a,"results");break}let u=s[0];u&&o.push({match:u,offset:s.index})}let l=e.toLowerCase().indexOf(n.segmentsToStr());return l>-1&&o.unshift({offset:l,match:n.segmentsToStr()}),o}async getSuggestions(e,r){let n;E.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 o=>await de.getDocument(o.id)));return n.map(o=>{ie("Locating matches for",o.id);let a=i.find(d=>d.path===o.id);a||(console.warn(`Omnisearch - Note "${o.id}" not in the live cache`),a={content:"",basename:o.id,path:o.id}),e.segments.forEach(d=>{d.value=d.value.replace(/^#/,"")});let l=e.segments.filter(d=>d.value.startsWith("#")).map(d=>d.value),u=[...Object.keys(o.match),...e.segments.filter(d=>d.exact).map(d=>d.value),...l].filter(d=>d.length>1||/\p{Emoji}/u.test(d));ie("Matching tokens:",u),ie("Getting matches locations...");let c=this.getMatches(a.content,yt(u),e);return ie("Matches:",c),re({score:o.score,foundWords:u,matches:c},a)})}async writeToCache(){await de.writeMinisearchCache(this.minisearch,this.indexedDocuments)}},Qs=pi;Qs.options={tokenize:ay,extractField:(e,r)=>{if(r==="directory"){let n=e.path.split("/");return n.pop(),n.join("/")}return e[r]},processTerm:e=>(E.ignoreDiacritics?et(e):e).toLowerCase(),idField:"path",fields:["basename","directory","aliases","content","headings1","headings2","headings3"],storeFields:["tags"],logger(e,r,n){n==="version_conflict"&&new nc.Notice("Omnisearch - Your index cache may be incorrect or corrupted. If this message keeps appearing, go to Settings to clear the cache.",5e3)}};var ce=new Qs;var Ys=new Set;function ic(t){Ys.add(t)}async function mi(){let t=[...Ys].map(e=>e.path);t.length&&(ce.removeFromPaths(t),ce.addFromPaths(t),Ys.clear())}function sc(t,e,r){let n=t.slice();return n[30]=e[r],n[32]=r,n}function ly(t){let e,r,n;return{c(){e=I("button"),e.textContent="Create note"},m(i,s){z(i,e,s),r||(n=Te(e,"click",t[8]),r=!0)},p:ne,d(i){i&&K(e),r=!1,n()}}}function uy(t){let e,r=E.showCreateButton&&ly(t);return{c(){r&&r.c(),e=Jt()},m(n,i){r&&r.m(n,i),z(n,e,i)},p(n,i){E.showCreateButton&&r.p(n,i)},d(n){r&&r.d(n),n&&K(e)}}}function oc(t){let e,r,n;return{c(){e=I("div"),r=Se("\u23F3 Work in progress: "),n=Se(t[3]),ke(e,"text-align","center"),ke(e,"color","var(--text-accent)"),ke(e,"margin-top","10px")},m(i,s){z(i,e,s),k(e,r),k(e,n)},p(i,s){s[0]&8&&Ft(n,i[3])},d(i){i&&K(e)}}}function ac(t){let e,r;function n(...i){return t[14](t[32],...i)}return e=new Ha({props:{selected:t[32]===t[0],note:t[30]}}),e.$on("mousemove",n),e.$on("click",t[6]),e.$on("auxclick",t[15]),{c(){Fe(e.$$.fragment)},m(i,s){xe(e,i,s),r=!0},p(i,s){t=i;let o={};s[0]&1&&(o.selected=t[32]===t[0]),s[0]&4&&(o.note=t[30]),e.$set(o)},i(i){r||(q(e.$$.fragment,i),r=!0)},o(i){Q(e.$$.fragment,i),r=!1},d(i){ge(e,i)}}}function cy(t){let e;return{c(){e=Se("Searching...")},m(r,n){z(r,e,n)},p:ne,d(r){r&&K(e)}}}function fy(t){let e,r=E.simpleSearch&&t[1].split(mt).some(uc),n,i=r&&lc(t);return{c(){e=Se(`We found 0 result for your search here.
`),i&&i.c(),n=Jt()},m(s,o){z(s,e,o),i&&i.m(s,o),z(s,n,o)},p(s,o){o[0]&2&&(r=E.simpleSearch&&s[1].split(mt).some(uc)),r?i||(i=lc(s),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},d(s){s&&K(e),i&&i.d(s),s&&K(n)}}}function lc(t){let e,r,n;return{c(){e=I("br"),r=U(),n=I("span"),n.textContent=`You have enabled "Simpler Search" in the settings, try to type more
characters.`,ke(n,"color","var(--text-accent)"),ke(n,"font-size","small")},m(i,s){z(i,e,s),z(i,r,s),z(i,n,s)},d(i){i&&K(e),i&&K(r),i&&K(n)}}}function dy(t){let e,r,n,i=t[2],s=[];for(let c=0;c<i.length;c+=1)s[c]=ac(sc(t,i,c));let o=c=>Q(s[c],1,1,()=>{s[c]=null});function a(c,f){if(!c[2].length&&c[1]&&!c[4])return fy;if(c[4])return cy}let l=a(t,[-1,-1]),u=l&&l(t);return{c(){for(let c=0;c<s.length;c+=1)s[c].c();e=U(),r=I("div"),u&&u.c(),ke(r,"text-align","center")},m(c,f){for(let d=0;d<s.length;d+=1)s[d].m(c,f);z(c,e,f),z(c,r,f),u&&u.m(r,null),n=!0},p(c,f){if(f[0]&197){i=c[2];let d;for(d=0;d<i.length;d+=1){let g=sc(c,i,d);s[d]?(s[d].p(g,f),q(s[d],1)):(s[d]=ac(g),s[d].c(),q(s[d],1),s[d].m(e.parentNode,e))}for(Dt(),d=i.length;d<s.length;d+=1)o(d);Tt()}l===(l=a(c,f))&&u?u.p(c,f):(u&&u.d(1),u=l&&l(c),u&&(u.c(),u.m(r,null)))},i(c){if(!n){for(let f=0;f<i.length;f+=1)q(s[f]);n=!0}},o(c){s=s.filter(Boolean);for(let f=0;f<s.length;f+=1)Q(s[f]);n=!1},d(c){un(s,c),c&&K(e),c&&K(r),u&&u.d()}}}function hy(t){let e,r,n,i,s,o,a,l,u,c,f,d,g,w,x,b,h,v,m,p,_,y,j,A,C,S,D,P,T,N={initialValue:t[1],placeholder:"Omnisearch - Vault",$$slots:{default:[uy]},$$scope:{ctx:t}};e=new Wn({props:N}),t[12](e),e.$on("input",t[13]);let H=t[3]&&oc(t);return i=new Un({props:{$$slots:{default:[dy]},$$scope:{ctx:t}}}),{c(){Fe(e.$$.fragment),r=U(),H&&H.c(),n=U(),Fe(i.$$.fragment),s=U(),o=I("div"),a=I("div"),a.innerHTML='<span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span>',l=U(),u=I("div"),u.innerHTML=`<span class="prompt-instruction-command">alt \u2191\u2193</span>
<span>to cycle history</span>`,c=U(),f=I("div"),f.innerHTML='<span class="prompt-instruction-command">\u21B5</span><span>to open</span>',d=U(),g=I("div"),g.innerHTML=`<span class="prompt-instruction-command">tab</span>
<span>to switch to In-File Search</span>`,w=U(),x=I("div"),b=I("span"),b.textContent=`${Vn()} \u21B5`,h=U(),v=I("span"),v.textContent="to open in a new pane",m=U(),p=I("div"),p.innerHTML=`<span class="prompt-instruction-command">shift \u21B5</span>
<span>to create</span>`,_=U(),y=I("div"),y.innerHTML=`<span class="prompt-instruction-command">ctrl shift \u21B5</span>
<span>to create in a new pane</span>`,j=U(),A=I("div"),A.innerHTML=`<span class="prompt-instruction-command">alt \u21B5</span>
<span>to insert a link</span>`,C=U(),S=I("div"),S.innerHTML=`<span class="prompt-instruction-command">ctrl+h</span>
<span>to toggle excerpts</span>`,D=U(),P=I("div"),P.innerHTML='<span class="prompt-instruction-command">esc</span><span>to close</span>',B(a,"class","prompt-instruction"),B(u,"class","prompt-instruction"),B(f,"class","prompt-instruction"),B(g,"class","prompt-instruction"),B(b,"class","prompt-instruction-command"),B(x,"class","prompt-instruction"),B(p,"class","prompt-instruction"),B(y,"class","prompt-instruction"),B(A,"class","prompt-instruction"),B(S,"class","prompt-instruction"),B(P,"class","prompt-instruction"),B(o,"class","prompt-instructions")},m(M,F){xe(e,M,F),z(M,r,F),H&&H.m(M,F),z(M,n,F),xe(i,M,F),z(M,s,F),z(M,o,F),k(o,a),k(o,l),k(o,u),k(o,c),k(o,f),k(o,d),k(o,g),k(o,w),k(o,x),k(x,b),k(x,h),k(x,v),k(o,m),k(o,p),k(o,_),k(o,y),k(o,j),k(o,A),k(o,C),k(o,S),k(o,D),k(o,P),T=!0},p(M,F){let V={};F[0]&2&&(V.initialValue=M[1]),F[1]&4&&(V.$$scope={dirty:F,ctx:M}),e.$set(V),M[3]?H?H.p(M,F):(H=oc(M),H.c(),H.m(n.parentNode,n)):H&&(H.d(1),H=null);let te={};F[0]&23|F[1]&4&&(te.$$scope={dirty:F,ctx:M}),i.$set(te)},i(M){T||(q(e.$$.fragment,M),q(i.$$.fragment,M),T=!0)},o(M){Q(e.$$.fragment,M),Q(i.$$.fragment,M),T=!1},d(M){t[12](null),ge(e,M),M&&K(r),H&&H.d(M),M&&K(n),ge(i,M),M&&K(s),M&&K(o)}}}var uc=t=>t.length<3;function py(t,e,r){let n,i;ln(t,pt,F=>r(11,i=F));let{modal:s}=e,{previousQuery:o}=e,a=0,l=0,u,c=[],f,d="",g=!0,w;Tr(async()=>{$.enable("vault"),$.on("vault","enter",m),$.on("vault","create-note",A),$.on("vault","open-in-new-pane",p),$.on("vault","insert-link",C),$.on("vault","tab",S),$.on("vault","arrow-up",()=>D(-1)),$.on("vault","arrow-down",()=>D(1)),$.on("vault","prev-search-history",x),$.on("vault","next-search-history",b),await mi(),E.showPreviousQueryResults&&r(9,o=(await de.getSearchHistory())[0])}),kr(()=>{$.disable("vault")});async function x(){let F=(await de.getSearchHistory()).filter(V=>V);++l>=F.length&&(l=0),r(1,u=F[l]),w?.setInputValue(u)}async function b(){let F=(await de.getSearchHistory()).filter(V=>V);--l<0&&(l=F.length?F.length-1:0),r(1,u=F[l]),w?.setInputValue(u)}async function h(){f=new zt(u),r(2,c=await ce.getSuggestions(f)),r(0,a=0),await P()}function v(F){!n||(F?.ctrlKey?p():m(),s.close())}function m(){!n||(y(n),s.close())}function p(){!n||(y(n,!0),s.close())}function _(){u&&de.addToSearchHistory(u)}function y(F,V=!1){_(),Gn(F,V)}async function j(F){await A()}async function A(F){if(u){try{await Ia(u,F?.newLeaf)}catch(V){new St.Notice(V.message);return}s.close()}}function C(){if(!n)return;let F=app.vault.getMarkdownFiles().find(st=>st.path===n.path),V=app.workspace.getActiveFile(),te=app.workspace.getActiveViewOfType(St.MarkdownView);if(!te?.editor){new St.Notice("Omnisearch - Error - No active editor",3e3);return}let Wt;F&&V?Wt=app.fileManager.generateMarkdownLink(F,V.path):Wt=`[[${n.basename}.${Kt(n.path)}]]`;let it=te.editor.getCursor();te.editor.replaceRange(Wt,it,it),it.ch+=Wt.length,te.editor.setCursor(it),s.close()}function S(){if(!(n&&(en(n?.path)||!n?.matches.length)))if(_(),s.close(),n){let F=app.vault.getAbstractFileByPath(n.path);F&&F instanceof St.TFile&&new Cr(app,F,u).open()}else{let F=app.workspace.getActiveViewOfType(St.MarkdownView);F&&new Cr(app,F.file,u).open()}}function D(F){r(0,a=zn(a+F,c.length)),P()}async function P(){await ot(),n&&document.querySelector(`[data-result-id="${n.path}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}function T(F){$e[F?"unshift":"push"](()=>{w=F,r(5,w)})}let N=F=>r(1,u=F.detail),H=(F,V)=>r(0,a=F),M=F=>{F.button==1&&p()};return t.$$set=F=>{"modal"in F&&r(10,s=F.modal),"previousQuery"in F&&r(9,o=F.previousQuery)},t.$$.update=()=>{if(t.$$.dirty[0]&514){e:r(1,u=u??o)}if(t.$$.dirty[0]&2){e:u?(r(4,g=!0),h().then(()=>{r(4,g=!1)})):(r(4,g=!1),r(2,c=[]))}if(t.$$.dirty[0]&5){e:n=c[a]}if(t.$$.dirty[0]&2048){e:switch(i){case Pe.LoadingCache:r(3,d="Loading cache...");break;case Pe.ReadingFiles:r(3,d="Reading files...");break;case Pe.IndexingFiles:r(3,d="Indexing files...");break;case Pe.WritingCache:h(),r(3,d="Updating cache...");break;default:h(),r(3,d="");break}}},[a,u,c,d,g,w,v,p,j,o,s,i,T,N,H,M]}var cc=class extends pe{constructor(e){super();ye(this,e,py,hy,fe,{modal:10,previousQuery:9},null,[-1,-1])}},fc=cc;var pc=Ce(require("obsidian"));function my(t){let e,r=t[2].replace(t[3],gt)+"";return{c(){e=I("div"),B(e,"class","omnisearch-result__body")},m(n,i){z(n,e,i),e.innerHTML=r},p(n,i){i&12&&r!==(r=n[2].replace(n[3],gt)+"")&&(e.innerHTML=r)},d(n){n&&K(e)}}}function gy(t){let e,r;return e=new qn({props:{id:t[0].toString(),selected:t[1],$$slots:{default:[my]},$$scope:{ctx:t}}}),e.$on("mousemove",t[6]),e.$on("click",t[7]),e.$on("auxclick",t[8]),{c(){Fe(e.$$.fragment)},m(n,i){xe(e,n,i),r=!0},p(n,[i]){let s={};i&1&&(s.id=n[0].toString()),i&2&&(s.selected=n[1]),i&524&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(q(e.$$.fragment,n),r=!0)},o(n){Q(e.$$.fragment,n),r=!1},d(n){ge(e,n)}}}function yy(t,e,r){let n,i,{offset:s}=e,{note:o}=e,{index:a=0}=e,{selected:l=!1}=e;function u(d){Me.call(this,t,d)}function c(d){Me.call(this,t,d)}function f(d){Me.call(this,t,d)}return t.$$set=d=>{"offset"in d&&r(4,s=d.offset),"note"in d&&r(5,o=d.note),"index"in d&&r(0,a=d.index),"selected"in d&&r(1,l=d.selected)},t.$$.update=()=>{if(t.$$.dirty&32){e:r(3,n=yt(o.foundWords))}if(t.$$.dirty&48){e:r(2,i=ur(o?.content??"",s))}},[a,l,i,n,s,o,u,c,f]}var dc=class extends pe{constructor(e){super();ye(this,e,yy,gy,fe,{offset:4,note:5,index:0,selected:1})}},hc=dc;function mc(t,e,r){let n=t.slice();return n[19]=e[r],n[21]=r,n}function vy(t){let e;return{c(){e=I("div"),e.textContent="We found 0 result for your search here.",ke(e,"text-align","center")},m(r,n){z(r,e,n)},p:ne,i:ne,o:ne,d(r){r&&K(e)}}}function _y(t){let e,r,n=t[4],i=[];for(let o=0;o<n.length;o+=1)i[o]=gc(mc(t,n,o));let s=o=>Q(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=Jt()},m(o,a){for(let l=0;l<i.length;l+=1)i[l].m(o,a);z(o,e,a),r=!0},p(o,a){if(a&120){n=o[4];let l;for(l=0;l<n.length;l+=1){let u=mc(o,n,l);i[l]?(i[l].p(u,a),q(i[l],1)):(i[l]=gc(u),i[l].c(),q(i[l],1),i[l].m(e.parentNode,e))}for(Dt(),l=n.length;l<i.length;l+=1)s(l);Tt()}},i(o){if(!r){for(let a=0;a<n.length;a+=1)q(i[a]);r=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)Q(i[a]);r=!1},d(o){un(i,o),o&&K(e)}}}function gc(t){let e,r;function n(...i){return t[11](t[21],...i)}return e=new hc({props:{offset:t[19],note:t[3],index:t[21],selected:t[21]===t[5]}}),e.$on("mousemove",n),e.$on("click",t[12]),e.$on("auxclick",t[13]),{c(){Fe(e.$$.fragment)},m(i,s){xe(e,i,s),r=!0},p(i,s){t=i;let o={};s&16&&(o.offset=t[19]),s&8&&(o.note=t[3]),s&32&&(o.selected=t[21]===t[5]),e.$set(o)},i(i){r||(q(e.$$.fragment,i),r=!0)},o(i){Q(e.$$.fragment,i),r=!1},d(i){ge(e,i)}}}function by(t){let e,r,n,i,s=[_y,vy],o=[];function a(l,u){return l[4].length&&l[3]?0:1}return e=a(t,-1),r=o[e]=s[e](t),{c(){r.c(),n=Jt()},m(l,u){o[e].m(l,u),z(l,n,u),i=!0},p(l,u){let c=e;e=a(l,u),e===c?o[e].p(l,u):(Dt(),Q(o[c],1,1,()=>{o[c]=null}),Tt(),r=o[e],r?r.p(l,u):(r=o[e]=s[e](l),r.c()),q(r,1),r.m(n.parentNode,n))},i(l){i||(q(r),i=!0)},o(l){Q(r),i=!1},d(l){o[e].d(l),l&&K(n)}}}function xy(t){let e;return{c(){e=I("span"),e.textContent="to close"},m(r,n){z(r,e,n)},d(r){r&&K(e)}}}function wy(t){let e;return{c(){e=I("span"),e.textContent="to go back to Vault Search"},m(r,n){z(r,e,n)},d(r){r&&K(e)}}}function jy(t){let e,r,n,i,s,o,a,l,u,c,f,d,g,w,x,b,h,v,m,p;e=new Wn({props:{placeholder:"Omnisearch - File",initialValue:t[1]}}),e.$on("input",t[10]),n=new Un({props:{$$slots:{default:[by]},$$scope:{ctx:t}}});function _(A,C){return A[0]?wy:xy}let y=_(t,-1),j=y(t);return{c(){Fe(e.$$.fragment),r=U(),Fe(n.$$.fragment),i=U(),s=I("div"),o=I("div"),o.innerHTML='<span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span>',a=U(),l=I("div"),l.innerHTML='<span class="prompt-instruction-command">\u21B5</span><span>to open</span>',u=U(),c=I("div"),c.innerHTML=`<span class="prompt-instruction-command">tab</span>
<span>to switch to Vault Search</span>`,f=U(),d=I("div"),g=I("span"),g.textContent="esc",w=U(),j.c(),x=U(),b=I("div"),h=I("span"),h.textContent=`${Vn()} \u21B5`,v=U(),m=I("span"),m.textContent="to open in a new pane",B(o,"class","prompt-instruction"),B(l,"class","prompt-instruction"),B(c,"class","prompt-instruction"),B(g,"class","prompt-instruction-command"),B(d,"class","prompt-instruction"),B(h,"class","prompt-instruction-command"),B(b,"class","prompt-instruction"),B(s,"class","prompt-instructions")},m(A,C){xe(e,A,C),z(A,r,C),xe(n,A,C),z(A,i,C),z(A,s,C),k(s,o),k(s,a),k(s,l),k(s,u),k(s,c),k(s,f),k(s,d),k(d,g),k(d,w),j.m(d,null),k(s,x),k(s,b),k(b,h),k(b,v),k(b,m),p=!0},p(A,[C]){let S={};C&2&&(S.initialValue=A[1]),e.$set(S);let D={};C&4194360&&(D.$$scope={dirty:C,ctx:A}),n.$set(D),y!==(y=_(A,C))&&(j.d(1),j=y(A),j&&(j.c(),j.m(d,null)))},i(A){p||(q(e.$$.fragment,A),q(n.$$.fragment,A),p=!0)},o(A){Q(e.$$.fragment,A),Q(n.$$.fragment,A),p=!1},d(A){ge(e,A),A&&K(r),ge(n,A),A&&K(i),A&&K(s),j.d()}}}function Ay(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 Cy(t,e,r){let{modal:n}=e,{parent:i=null}=e,{singleFilePath:s=""}=e,{previousQuery:o}=e,a,l=[],u=0,c,f;Tr(()=>{$.enable("infile"),$.on("infile","enter",b),$.on("infile","open-in-new-pane",x),$.on("infile","arrow-up",()=>g(-1)),$.on("infile","arrow-down",()=>g(1)),$.on("infile","tab",h)}),kr(()=>{$.disable("infile")});function d(y){let j=[],A=-1,C=0;for(;;){let S=Ay(y,A,Jr);if(!S.length||(A=S.last().offset,j.push(S),++C>100))break}return j}function g(y){r(5,u=zn(u+y,l.length)),w()}async function w(){await ot(),document.querySelector(`[data-result-id="${u}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function x(){return b(!0)}async function b(y=!1){if(c){n.close(),i&&i.close(),await Gn(c,y);let j=app.workspace.getActiveViewOfType(pc.MarkdownView);if(!j)return;let A=l[u]??0,C=j.editor.offsetToPos(A);C.ch=0,j.editor.setCursor(C),j.editor.scrollIntoView({from:{line:C.line-10,ch:0},to:{line:C.line+10,ch:0}})}}function h(){new $t(app,o).open(),n.close()}let v=y=>r(2,a=y.detail),m=(y,j)=>r(5,u=y),p=y=>b(y.ctrlKey),_=y=>{y.button==1&&b(!0)};return t.$$set=y=>{"modal"in y&&r(7,n=y.modal),"parent"in y&&r(0,i=y.parent),"singleFilePath"in y&&r(8,s=y.singleFilePath),"previousQuery"in y&&r(1,o=y.previousQuery)},t.$$.update=()=>{if(t.$$.dirty&2){e:r(2,a=o??"")}if(t.$$.dirty&772){e:(async()=>{a&&(r(9,f=new zt(a)),r(3,c=(await ce.getSuggestions(f,{singleFilePath:s}))[0]??null)),r(5,u=0),await w()})()}if(t.$$.dirty&8){e:if(c){let y=d(c.matches);r(4,l=y.map(j=>Math.round((j.first().offset+j.last().offset)/2)))}}},[i,o,a,c,l,u,b,n,s,f,v,m,p,_]}var yc=class extends pe{constructor(e){super();ye(this,e,Cy,jy,fe,{modal:7,parent:0,singleFilePath:8,previousQuery:1})}},vc=yc;var Js=class extends _c.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",r=>{r.preventDefault(),$.emit("arrow-down")}),this.scope.register([],"ArrowUp",r=>{r.preventDefault(),$.emit("arrow-up")});for(let r of[{k:"J",dir:"down"},{k:"K",dir:"up"}])for(let n of["Ctrl","Mod"])this.scope.register([n],r.k,i=>{this.app.vault.getConfig("vimMode")&&$.emit("arrow-"+r.dir)});for(let r of[{k:"N",dir:"down"},{k:"P",dir:"up"}])for(let n of["Ctrl","Mod"])this.scope.register([n],r.k,i=>{this.app.vault.getConfig("vimMode")&&$.emit("arrow-"+r.dir)});this.scope.register(["Mod"],"Enter",r=>{r.preventDefault(),$.emit("open-in-new-pane")}),this.scope.register(["Alt"],"Enter",r=>{r.preventDefault(),$.emit("insert-link")}),this.scope.register(["Shift"],"Enter",r=>{r.preventDefault(),$.emit("create-note")}),this.scope.register(["Ctrl","Shift"],"Enter",r=>{r.preventDefault(),$.emit("create-note",{newLeaf:!0})}),this.scope.register([],"Enter",r=>{ga()||(r.preventDefault(),$.emit("enter"))}),this.scope.register([],"Tab",r=>{r.preventDefault(),$.emit("tab")}),this.scope.register(["Alt"],"ArrowDown",r=>{r.preventDefault(),$.emit("next-search-history")}),this.scope.register(["Alt"],"ArrowUp",r=>{r.preventDefault(),$.emit("prev-search-history")}),this.scope.register(["Ctrl"],"H",r=>{$.emit(Ln.ToggleExcerpts)})}},$t=class extends Js{constructor(e,r){super(e);let n=new fc({target:this.modalEl,props:{modal:this,previousQuery:r}});this.onClose=()=>{n.$destroy()}}},Cr=class extends Js{constructor(e,r,n="",i){super(e);let s=new vc({target:this.modalEl,props:{modal:this,singleFilePath:r.path,parent:i,previousQuery:n}});i&&i.containerEl.toggleVisibility(!1),this.onClose=()=>{i&&i.containerEl.toggleVisibility(!0),s.$destroy()}}};var bc=!1,gi=[];function Sy(t){return t.map(e=>{let{score:r,path:n,basename:i,foundWords:s,matches:o,content:a}=e,l=ur(a,o[0]?.offset??-1);return{score:r,path:n,basename:i,foundWords:s,matches:o.map(u=>({match:u.match,offset:u.offset})),excerpt:l}})}async function Fy(t){let e=new zt(t),r=await ce.getSuggestions(e);return Sy(r)}function Ey(t){gi.push(t),bc&&t()}function Dy(t){gi=gi.filter(e=>e!==t)}function xc(){bc=!0,gi.forEach(t=>t())}var Xs={search:Fy,registerOnIndexed:Ey,unregisterOnIndexed:Dy,refreshIndex:mi};var Zs=class extends Sr.Plugin{async onload(){await ua(this),await Ty(),await lr.clearOldDatabases(),ky(this),E.ribbonIcon&&this.addRibbonButton(),this.addSettingTab(new vs(this)),$.disable("vault"),$.disable("infile"),$.on("global",Ln.ToggleExcerpts,()=>{Lt.set(!E.showExcerpt)}),this.addCommand({id:"show-modal",name:"Vault search",callback:()=>{new $t(app).open()}}),this.addCommand({id:"show-modal-infile",name:"In-file search",editorCallback:(e,r)=>{r.file&&new Cr(app,r.file).open()}}),app.workspace.onLayoutReady(async()=>{this.registerEvent(this.app.vault.on("create",e=>{Zr(e.path)&&(ie("Indexing new file",e.path),ce.addFromPaths([e.path]))})),this.registerEvent(this.app.vault.on("delete",e=>{ie("Removing file",e.path),de.removeFromLiveCache(e.path),ce.removeFromPaths([e.path])})),this.registerEvent(this.app.vault.on("modify",async e=>{Zr(e.path)&&(ie("Updating file",e.path),await de.addToLiveCache(e.path),ic(e))})),this.registerEvent(this.app.vault.on("rename",async(e,r)=>{Zr(e.path)&&(ie("Renaming file",e.path),de.removeFromLiveCache(r),de.addToLiveCache(e.path),ce.removeFromPaths([r]),await ce.addFromPaths([e.path]))})),this.executeFirstLaunchTasks(),await this.populateIndex()})}executeFirstLaunchTasks(){let e="1.10.1";if(E.welcomeMessage!==e){let r=new DocumentFragment;r.createSpan({},n=>{n.innerHTML="\u{1F50E} Omnisearch now requires the <strong>Text Extractor</strong> plugin to index PDF and images. See Omnisearch settings for more information."}),new Sr.Notice(r,2e4)}E.welcomeMessage=e,this.saveData(E)}async onunload(){delete globalThis.omnisearch,await Ee.clearCache()}addRibbonButton(){this.ribbonButton=this.addRibbonIcon("search","Omnisearch",e=>{new $t(app).open()})}removeRibbonButton(){this.ribbonButton&&this.ribbonButton.parentNode?.removeChild(this.ribbonButton)}async populateIndex(){console.time("Omnisearch - Indexing total time"),pt.set(Pe.ReadingFiles);let e=app.vault.getFiles().filter(n=>Zr(n.path));console.log(`Omnisearch - ${e.length} files total`),console.log(`Omnisearch - Cache is ${ht()?"enabled":"disabled"}`),ht()&&(console.time("Omnisearch - Loading index from cache"),pt.set(Pe.LoadingCache),await ce.loadCache()&&console.timeEnd("Omnisearch - Loading index from cache"));let r=ce.getDiff(e.map(n=>({path:n.path,mtime:n.stat.mtime})));ht()&&(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&&ht()&&new Sr.Notice(`Omnisearch - ${r.toAdd.length} files need to be indexed. Obsidian may experience stutters and freezes during the process`,1e4),pt.set(Pe.IndexingFiles),ce.removeFromPaths(r.toRemove.map(n=>n.path)),await ce.addFromPaths(r.toAdd.map(n=>n.path)),(r.toRemove.length||r.toAdd.length)&&ht()&&(pt.set(Pe.WritingCache),E.useCache=!1,ue(this),await ce.writeToCache(),E.useCache=!0,ue(this)),console.timeEnd("Omnisearch - Indexing total time"),r.toAdd.length>=1e3&&new Sr.Notice("Omnisearch - Your files have been indexed."),pt.set(Pe.Done),xc()}};async function Ty(){let t=[`${app.vault.configDir}/plugins/omnisearch/searchIndex.json`,`${app.vault.configDir}/plugins/omnisearch/notesCache.json`,`${app.vault.configDir}/plugins/omnisearch/notesCache.data`,`${app.vault.configDir}/plugins/omnisearch/searchIndex.data`,`${app.vault.configDir}/plugins/omnisearch/historyCache.json`,`${app.vault.configDir}/plugins/omnisearch/pdfCache.data`];for(let e of t)if(await app.vault.adapter.exists(e))try{await app.vault.adapter.remove(e)}catch{}}function ky(t){t.registerObsidianProtocolHandler("omnisearch",e=>{new $t(app,e.query).open()}),globalThis.omnisearch=Xs,app.plugins.plugins.omnisearch.api=Xs}