Files
G4G0-1/.obsidian/plugins/omnisearch/main.js
2024-01-15 20:14:10 +00:00

51 lines
203 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 Gf=Object.create;var Zr=Object.defineProperty,Qf=Object.defineProperties,qf=Object.getOwnPropertyDescriptor,Yf=Object.getOwnPropertyDescriptors,Jf=Object.getOwnPropertyNames,Hs=Object.getOwnPropertySymbols,Xf=Object.getPrototypeOf,$s=Object.prototype.hasOwnProperty,Zf=Object.prototype.propertyIsEnumerable;var Ws=(t,e,r)=>e in t?Zr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pe=(t,e)=>{for(var r in e||(e={}))$s.call(e,r)&&Ws(t,r,e[r]);if(Hs)for(var r of Hs(e))Zf.call(e,r)&&Ws(t,r,e[r]);return t},Me=(t,e)=>Qf(t,Yf(e)),Us=t=>Zr(t,"__esModule",{value:!0});var Mn=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ed=(t,e)=>{Us(t);for(var r in e)Zr(t,r,{get:e[r],enumerable:!0})},td=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Jf(e))!$s.call(t,n)&&n!=="default"&&Zr(t,n,{get:()=>e[n],enumerable:!(r=qf(e,n))||r.enumerable});return t},je=t=>td(Us(Zr(t!=null?Gf(Xf(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var ol=Mn((Fn,ds)=>{(function(t,e){if(typeof Fn=="object"&&typeof ds=="object")ds.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var r=e();for(var n in r)(typeof Fn=="object"?Fn:t)[n]=r[n]}})(typeof self!="undefined"?self:Fn,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(n,i,o){r.o(n,i)||Object.defineProperty(n,i,{enumerable:!0,get:o})},r.r=function(n){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,i){if(1&i&&(n=r(n)),8&i||4&i&&typeof n=="object"&&n&&n.__esModule)return n;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:n}),2&i&&typeof n!="string")for(var s in n)r.d(o,s,function(a){return n[a]}.bind(null,s));return o},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";r.r(e),r.d(e,"md5",function(){return x});var n="0123456789abcdef".split(""),i=function(v){for(var d="",b=0;b<4;b++)d+=n[v>>8*b+4&15]+n[v>>8*b&15];return d},o=function(v){for(var d=v.length,b=0;b<d;b++)v[b]=i(v[b]);return v.join("")},s=function(v,d){return v+d&4294967295},a=function(v,d,b,m,g,y,_){return function(j,A,F){return s(j<<A|j>>>32-A,F)}(d=function(j,A,F,E){return A=s(s(A,j),s(F,E))}(v,d,m,y),g,b)},u=function(v,d,b,m,g,y,_,j){return a(b&m|~b&g,d,b,y,_,j,v)},l=function(v,d,b,m,g,y,_,j){return a(b&g|m&~g,d,b,y,_,j,v)},f=function(v,d,b,m,g,y,_,j){return a(b^m^g,d,b,y,_,j,v)},p=function(v,d,b,m,g,y,_,j){return a(m^(b|~g),d,b,y,_,j,v)},c=function(v,d,b){b===void 0&&(b=s);var m=v[0],g=v[1],y=v[2],_=v[3],j=u.bind(null,b);m=j(m,g,y,_,d[0],7,-680876936),_=j(_,m,g,y,d[1],12,-389564586),y=j(y,_,m,g,d[2],17,606105819),g=j(g,y,_,m,d[3],22,-1044525330),m=j(m,g,y,_,d[4],7,-176418897),_=j(_,m,g,y,d[5],12,1200080426),y=j(y,_,m,g,d[6],17,-1473231341),g=j(g,y,_,m,d[7],22,-45705983),m=j(m,g,y,_,d[8],7,1770035416),_=j(_,m,g,y,d[9],12,-1958414417),y=j(y,_,m,g,d[10],17,-42063),g=j(g,y,_,m,d[11],22,-1990404162),m=j(m,g,y,_,d[12],7,1804603682),_=j(_,m,g,y,d[13],12,-40341101),y=j(y,_,m,g,d[14],17,-1502002290),g=j(g,y,_,m,d[15],22,1236535329);var A=l.bind(null,b);m=A(m,g,y,_,d[1],5,-165796510),_=A(_,m,g,y,d[6],9,-1069501632),y=A(y,_,m,g,d[11],14,643717713),g=A(g,y,_,m,d[0],20,-373897302),m=A(m,g,y,_,d[5],5,-701558691),_=A(_,m,g,y,d[10],9,38016083),y=A(y,_,m,g,d[15],14,-660478335),g=A(g,y,_,m,d[4],20,-405537848),m=A(m,g,y,_,d[9],5,568446438),_=A(_,m,g,y,d[14],9,-1019803690),y=A(y,_,m,g,d[3],14,-187363961),g=A(g,y,_,m,d[8],20,1163531501),m=A(m,g,y,_,d[13],5,-1444681467),_=A(_,m,g,y,d[2],9,-51403784),y=A(y,_,m,g,d[7],14,1735328473),g=A(g,y,_,m,d[12],20,-1926607734);var F=f.bind(null,b);m=F(m,g,y,_,d[5],4,-378558),_=F(_,m,g,y,d[8],11,-2022574463),y=F(y,_,m,g,d[11],16,1839030562),g=F(g,y,_,m,d[14],23,-35309556),m=F(m,g,y,_,d[1],4,-1530992060),_=F(_,m,g,y,d[4],11,1272893353),y=F(y,_,m,g,d[7],16,-155497632),g=F(g,y,_,m,d[10],23,-1094730640),m=F(m,g,y,_,d[13],4,681279174),_=F(_,m,g,y,d[0],11,-358537222),y=F(y,_,m,g,d[3],16,-722521979),g=F(g,y,_,m,d[6],23,76029189),m=F(m,g,y,_,d[9],4,-640364487),_=F(_,m,g,y,d[12],11,-421815835),y=F(y,_,m,g,d[15],16,530742520),g=F(g,y,_,m,d[2],23,-995338651);var E=p.bind(null,b);m=E(m,g,y,_,d[0],6,-198630844),_=E(_,m,g,y,d[7],10,1126891415),y=E(y,_,m,g,d[14],15,-1416354905),g=E(g,y,_,m,d[5],21,-57434055),m=E(m,g,y,_,d[12],6,1700485571),_=E(_,m,g,y,d[3],10,-1894986606),y=E(y,_,m,g,d[10],15,-1051523),g=E(g,y,_,m,d[1],21,-2054922799),m=E(m,g,y,_,d[8],6,1873313359),_=E(_,m,g,y,d[15],10,-30611744),y=E(y,_,m,g,d[6],15,-1560198380),g=E(g,y,_,m,d[13],21,1309151649),m=E(m,g,y,_,d[4],6,-145523070),_=E(_,m,g,y,d[11],10,-1120210379),y=E(y,_,m,g,d[2],15,718787259),g=E(g,y,_,m,d[9],21,-343485551),v[0]=b(m,v[0]),v[1]=b(g,v[1]),v[2]=b(y,v[2]),v[3]=b(_,v[3])},h=function(v){for(var d=[],b=0;b<64;b+=4)d[b>>2]=v.charCodeAt(b)+(v.charCodeAt(b+1)<<8)+(v.charCodeAt(b+2)<<16)+(v.charCodeAt(b+3)<<24);return d},w=function(v,d){var b,m=v.length,g=[1732584193,-271733879,-1732584194,271733878];for(b=64;b<=m;b+=64)c(g,h(v.substring(b-64,b)),d);var y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],_=(v=v.substring(b-64)).length;for(b=0;b<_;b++)y[b>>2]|=v.charCodeAt(b)<<(b%4<<3);if(y[b>>2]|=128<<(b%4<<3),b>55)for(c(g,y,d),b=16;b--;)y[b]=0;return y[14]=8*m,c(g,y,d),g};function x(v){var d;return o(w("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(d=function(b,m){var g=(65535&b)+(65535&m);return(b>>16)+(m>>16)+(g>>16)<<16|65535&g}),o(w(v,d))}}])})});var df=Mn(Yi=>{Yi.parse=function(t,e){if(e?e.offsets=typeof e.offsets=="undefined"?!0:e.offsets:e={offsets:!0},t||(t=""),t.indexOf(":")===-1&&!e.tokenize)return t;if(!e.keywords&&!e.ranges&&!e.tokenize)return t;var r={text:[]};e.offsets&&(r.offsets=[]);for(var n={},i=[],o=/(\S+:'(?:[^'\\]|\\.)*')|(\S+:"(?:[^"\\]|\\.)*")|(-?"(?:[^"\\]|\\.)*")|(-?'(?:[^'\\]|\\.)*')|\S+|\S+:\S+/g,s;(s=o.exec(t))!==null;){var c=s[0],a=c.indexOf(":");if(a!==-1){var u=c.split(":"),l=c.slice(0,a),f=c.slice(a+1);f=f.replace(/^\"|\"$|^\'|\'$/g,""),f=(f+"").replace(/\\(.?)/g,function(_,j){switch(j){case"\\":return"\\";case"0":return"\0";case"":return"";default:return j}}),i.push({keyword:l,value:f,offsetStart:s.index,offsetEnd:s.index+c.length})}else{var p=!1;c[0]==="-"&&(p=!0,c=c.slice(1)),c=c.replace(/^\"|\"$|^\'|\'$/g,""),c=(c+"").replace(/\\(.?)/g,function(_,j){switch(j){case"\\":return"\\";case"0":return"\0";case"":return"";default:return j}}),p?n.text?(n.text instanceof Array||(n.text=[n.text]),n.text.push(c)):n.text=c:i.push({text:c,offsetStart:s.index,offsetEnd:s.index+c.length})}}i.reverse();for(var c;c=i.pop();)if(c.text)r.text.push(c.text),e.offsets&&r.offsets.push(c);else{var l=c.keyword;e.keywords=e.keywords||[];var h=!1,w=!1;if(!/^-/.test(l))h=e.keywords.indexOf(l)!==-1;else if(l[0]==="-"){var x=l.slice(1);h=e.keywords.indexOf(x)!==-1,h&&(l=x,w=!0)}e.ranges=e.ranges||[];var v=e.ranges.indexOf(l)!==-1;if(h){e.offsets&&r.offsets.push({keyword:l,value:c.value,offsetStart:w?c.offsetStart+1:c.offsetStart,offsetEnd:c.offsetEnd});var d=c.value;if(d.length){var b=d.split(",");w?n[l]?n[l]instanceof Array?b.length>1?n[l]=n[l].concat(b):n[l].push(d):(n[l]=[n[l]],n[l].push(d)):b.length>1?n[l]=b:e.alwaysArray?n[l]=[d]:n[l]=d:r[l]?r[l]instanceof Array?b.length>1?r[l]=r[l].concat(b):r[l].push(d):(r[l]=[r[l]],r[l].push(d)):b.length>1?r[l]=b:e.alwaysArray?r[l]=[d]:r[l]=d}}else if(v){e.offsets&&r.offsets.push(c);var d=c.value,m=d.split("-");r[l]={},m.length===2?(r[l].from=m[0],r[l].to=m[1]):!m.length%2||(r[l].from=d)}else{var g=c.keyword+":"+c.value;r.text.push(g),e.offsets&&r.offsets.push({text:g,offsetStart:c.offsetStart,offsetEnd:c.offsetEnd})}}return r.text.length?e.tokenize||(r.text=r.text.join(" ").trim()):delete r.text,r.exclude=n,r};Yi.stringify=function(t,e,r){if(e||(e={offsets:!0}),!t)return"";if(typeof t=="string")return t;if(Array.isArray(t))return t.join(" ");if(!Object.keys(t).length)return"";if(Object.keys(t).length===3&&!!t.text&&!!t.offsets&&!!t.exclude&&typeof t.text=="string")return t.text;r||(r="");var n=function(a){return a.indexOf(" ")>-1?JSON.stringify(a):a},i=function(a){return r+a},o=[];if(t.text){var s=[];typeof t.text=="string"?s.push(t.text):s.push.apply(s,t.text),s.length>0&&o.push(s.map(n).map(i).join(" "))}return e.keywords&&e.keywords.forEach(function(a){if(!!t[a]){var u=[];typeof t[a]=="string"?u.push(t[a]):u.push.apply(u,t[a]),u.length>0&&o.push(i(a+":"+u.map(n).join(",")))}}),e.ranges&&e.ranges.forEach(function(a){if(!!t[a]){var u=t[a].from,l=t[a].to;l&&(u=u+"-"+l),u&&o.push(i(a+":"+u))}}),t.exclude&&Object.keys(t.exclude).length>0&&o.push(Yi.stringify(t.exclude,e,"-")),o.join(" ")}});var hf=Mn((HE,pf)=>{pf.exports=df()});var Ef=Mn(to=>{function Bs(t){return Bs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bs(t)}(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof to!="undefined")e(to);else{var r={exports:{}};e(r.exports),t.CancelablePromise=r.exports}})(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:to,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CancelablePromise=void 0,t.cancelable=L,t.default=void 0,t.isCancelablePromise=k;function e(C,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function");C.prototype=Object.create(S&&S.prototype,{constructor:{value:C,writable:!0,configurable:!0}}),Object.defineProperty(C,"prototype",{writable:!1}),S&&r(C,S)}function r(C,S){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(N,X){return N.__proto__=X,N},r(C,S)}function n(C){var S=s();return function(){var N=a(C),X;if(S){var P=a(this).constructor;X=Reflect.construct(N,arguments,P)}else X=N.apply(this,arguments);return i(this,X)}}function i(C,S){if(S&&(Bs(S)==="object"||typeof S=="function"))return S;if(S!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return o(C)}function o(C){if(C===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C}function s(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function a(C){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(I){return I.__proto__||Object.getPrototypeOf(I)},a(C)}function u(C,S){var I=typeof Symbol!="undefined"&&C[Symbol.iterator]||C["@@iterator"];if(!I){if(Array.isArray(C)||(I=l(C))||S&&C&&typeof C.length=="number"){I&&(C=I);var N=0,X=function(){};return{s:X,n:function(){return N>=C.length?{done:!0}:{done:!1,value:C[N++]}},e:function(me){throw me},f:X}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var P=!0,re=!1,Ke;return{s:function(){I=I.call(C)},n:function(){var me=I.next();return P=me.done,me},e:function(me){re=!0,Ke=me},f:function(){try{!P&&I.return!=null&&I.return()}finally{if(re)throw Ke}}}}function l(C,S){if(!!C){if(typeof C=="string")return f(C,S);var I=Object.prototype.toString.call(C).slice(8,-1);if(I==="Object"&&C.constructor&&(I=C.constructor.name),I==="Map"||I==="Set")return Array.from(C);if(I==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(I))return f(C,S)}}function f(C,S){(S==null||S>C.length)&&(S=C.length);for(var I=0,N=new Array(S);I<S;I++)N[I]=C[I];return N}function p(C,S){if(!(C instanceof S))throw new TypeError("Cannot call a class as a function")}function c(C,S){for(var I=0;I<S.length;I++){var N=S[I];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(C,N.key,N)}}function h(C,S,I){return S&&c(C.prototype,S),I&&c(C,I),Object.defineProperty(C,"prototype",{writable:!1}),C}function w(C,S,I){return S in C?Object.defineProperty(C,S,{value:I,enumerable:!0,configurable:!0,writable:!0}):C[S]=I,C}function x(C,S,I){v(C,S),S.set(C,I)}function v(C,S){if(S.has(C))throw new TypeError("Cannot initialize the same private elements twice on an object")}function d(C,S){var I=g(C,S,"get");return b(C,I)}function b(C,S){return S.get?S.get.call(C):S.value}function m(C,S,I){var N=g(C,S,"set");return y(C,N,I),I}function g(C,S,I){if(!S.has(C))throw new TypeError("attempted to "+I+" private field on non-instance");return S.get(C)}function y(C,S,I){if(S.set)S.set.call(C,I);else{if(!S.writable)throw new TypeError("attempted to set read only private field");S.value=I}}var _=typeof Symbol!="undefined"?Symbol.toStringTag:"@@toStringTag",j=new WeakMap,A=new WeakMap,F=function(){function C(S){var I=S.executor,N=I===void 0?function(){}:I,X=S.internals,P=X===void 0?q():X,re=S.promise,Ke=re===void 0?new Promise(function(we,me){return N(we,me,function(ze){P.onCancelList.push(ze)})}):re;p(this,C),x(this,j,{writable:!0,value:void 0}),x(this,A,{writable:!0,value:void 0}),w(this,_,"CancelablePromise"),this.cancel=this.cancel.bind(this),m(this,j,P),m(this,A,Ke||new Promise(function(we,me){return N(we,me,function(ze){P.onCancelList.push(ze)})}))}return h(C,[{key:"then",value:function(I,N){return J(d(this,A).then(z(I,d(this,j)),z(N,d(this,j))),d(this,j))}},{key:"catch",value:function(I){return J(d(this,A).catch(z(I,d(this,j))),d(this,j))}},{key:"finally",value:function(I,N){var X=this;return N&&d(this,j).onCancelList.push(I),J(d(this,A).finally(z(function(){if(I)return N&&(d(X,j).onCancelList=d(X,j).onCancelList.filter(function(P){return P!==I})),I()},d(this,j))),d(this,j))}},{key:"cancel",value:function(){d(this,j).isCanceled=!0;var I=d(this,j).onCancelList;d(this,j).onCancelList=[];var N=u(I),X;try{for(N.s();!(X=N.n()).done;){var P=X.value;if(typeof P=="function")try{P()}catch(re){console.error(re)}}}catch(re){N.e(re)}finally{N.f()}}},{key:"isCanceled",value:function(){return d(this,j).isCanceled===!0}}]),C}(),E=function(C){e(I,C);var S=n(I);function I(N){return p(this,I),S.call(this,{executor:N})}return h(I)}(F);t.CancelablePromise=E,w(E,"all",function(S){return Y(S,Promise.all(S))}),w(E,"allSettled",function(S){return Y(S,Promise.allSettled(S))}),w(E,"any",function(S){return Y(S,Promise.any(S))}),w(E,"race",function(S){return Y(S,Promise.race(S))}),w(E,"resolve",function(S){return L(Promise.resolve(S))}),w(E,"reject",function(S){return L(Promise.reject(S))}),w(E,"isCancelable",k);var O=E;t.default=O;function L(C){return J(C,q())}function k(C){return C instanceof E||C instanceof F}function z(C,S){if(C)return function(I){if(!S.isCanceled){var N=C(I);return k(N)&&S.onCancelList.push(N.cancel),N}return I}}function J(C,S){return new F({internals:S,promise:C})}function Y(C,S){var I=q();return I.onCancelList.push(function(){var N=u(C),X;try{for(N.s();!(X=N.n()).done;){var P=X.value;k(P)&&P.cancel()}}catch(re){N.e(re)}finally{N.f()}}),new F({internals:I,promise:S})}function q(){return{isCanceled:!1,onCancelList:[]}}})});ed(exports,{default:()=>zs});var fr=je(require("obsidian"));var ro=je(require("obsidian"));function he(){}function rd(t,e){for(let r in e)t[r]=e[r];return t}function oo(t){return t()}function Gs(){return Object.create(null)}function Xe(t){t.forEach(oo)}function dr(t){return typeof t=="function"}function Ae(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}var Rn;function so(t,e){return Rn||(Rn=document.createElement("a")),Rn.href=e,t===Rn.href}function Qs(t){return Object.keys(t).length===0}function qs(t,...e){if(t==null)return he;let r=t.subscribe(...e);return r.unsubscribe?()=>r.unsubscribe():r}function Ln(t,e,r){t.$$.on_destroy.push(qs(e,r))}function pr(t,e,r,n){if(t){let i=Ys(t,e,r,n);return t[0](i)}}function Ys(t,e,r,n){return t[1]&&n?rd(r.ctx.slice(),t[1](n(e))):r.ctx}function hr(t,e,r,n){if(t[2]&&n){let i=t[2](n(r));if(e.dirty===void 0)return i;if(typeof i=="object"){let o=[],s=Math.max(e.dirty.length,i.length);for(let a=0;a<s;a+=1)o[a]=e.dirty[a]|i[a];return o}return e.dirty|i}return e.dirty}function mr(t,e,r,n,i,o){if(i){let s=Ys(e,r,n,o);t.p(s,i)}}function gr(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 Js(t){return t&&dr(t.destroy)?t.destroy:he}var Xs=!1;function nd(){Xs=!0}function id(){Xs=!1}function D(t,e){t.appendChild(e)}function $(t,e,r){t.insertBefore(e,r||null)}function H(t){t.parentNode&&t.parentNode.removeChild(t)}function Bn(t,e){for(let r=0;r<t.length;r+=1)t[r]&&t[r].d(e)}function M(t){return document.createElement(t)}function Ce(t){return document.createTextNode(t)}function W(){return Ce(" ")}function yr(){return Ce("")}function He(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 od(t){return Array.from(t.childNodes)}function Ze(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function ao(t,e){t.value=e??""}function Ge(t,e,r,n){r===null?t.style.removeProperty(e):t.style.setProperty(e,r,n?"important":"")}function lo(t,e,r){t.classList[r?"add":"remove"](e)}function sd(t,e,{bubbles:r=!1,cancelable:n=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(t,r,n,e),i}var en;function tn(t){en=t}function uo(){if(!en)throw new Error("Function called outside component initialization");return en}function rn(t){uo().$$.on_mount.push(t)}function nn(t){uo().$$.on_destroy.push(t)}function co(){let t=uo();return(e,r,{cancelable:n=!1}={})=>{let i=t.$$.callbacks[e];if(i){let o=sd(e,r,{cancelable:n});return i.slice().forEach(s=>{s.call(t,o)}),!o.defaultPrevented}return!0}}function Qe(t,e){let r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}var on=[];var lt=[],Nn=[],Zs=[],ea=Promise.resolve(),fo=!1;function ta(){fo||(fo=!0,ea.then(ra))}function jt(){return ta(),ea}function po(t){Nn.push(t)}var ho=new Set,Kn=0;function ra(){let t=en;do{for(;Kn<on.length;){let e=on[Kn];Kn++,tn(e),ad(e.$$)}for(tn(null),on.length=0,Kn=0;lt.length;)lt.pop()();for(let e=0;e<Nn.length;e+=1){let r=Nn[e];ho.has(r)||(ho.add(r),r())}Nn.length=0}while(on.length);for(;Zs.length;)Zs.pop()();fo=!1,ho.clear(),tn(t)}function ad(t){if(t.fragment!==null){t.update(),Xe(t.before_update);let e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(po)}}var zn=new Set,Wt;function Ut(){Wt={r:0,c:[],p:Wt}}function Gt(){Wt.r||Xe(Wt.c),Wt=Wt.p}function ee(t,e){t&&t.i&&(zn.delete(t),t.i(e))}function ne(t,e,r,n){if(t&&t.o){if(zn.has(t))return;zn.add(t),Wt.c.push(()=>{zn.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}var Lb=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;function $e(t){t&&t.c()}function Re(t,e,r,n){let{fragment:i,after_update:o}=t.$$;i&&i.m(e,r),n||po(()=>{let s=t.$$.on_mount.map(oo).filter(dr);t.$$.on_destroy?t.$$.on_destroy.push(...s):Xe(s),t.$$.on_mount=[]}),o.forEach(po)}function Ie(t,e){let r=t.$$;r.fragment!==null&&(Xe(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function ld(t,e){t.$$.dirty[0]===-1&&(on.push(t),ta(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Oe(t,e,r,n,i,o,s,a=[-1]){let u=en;tn(t);let l=t.$$={fragment:null,ctx:[],props:o,update:he,not_equal:i,bound:Gs(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(u?u.$$.context:[])),callbacks:Gs(),dirty:a,skip_bound:!1,root:e.target||u.$$.root};s&&s(l.root);let f=!1;if(l.ctx=r?r(t,e.props||{},(p,c,...h)=>{let w=h.length?h[0]:c;return l.ctx&&i(l.ctx[p],l.ctx[p]=w)&&(!l.skip_bound&&l.bound[p]&&l.bound[p](w),f&&ld(t,p)),c}):[],l.update(),f=!0,Xe(l.before_update),l.fragment=n?n(l.ctx):!1,e.target){if(e.hydrate){nd();let p=od(e.target);l.fragment&&l.fragment.l(p),p.forEach(H)}else l.fragment&&l.fragment.c();e.intro&&ee(t.$$.fragment),Re(t,e.target,e.anchor,e.customElement),id(),ra()}tn(u)}var ud;typeof HTMLElement=="function"&&(ud=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(oo).filter(dr);for(let e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(t,e,r){this[t]=r}disconnectedCallback(){Xe(this.$$.on_disconnect)}$destroy(){Ie(this,1),this.$destroy=he}$on(t,e){if(!dr(e))return he;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&&!Qs(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var Te=class{$destroy(){Ie(this,1),this.$destroy=he}$on(e,r){if(!dr(r))return he;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&&!Qs(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var $t=je(require("obsidian"));var vl=je(require("obsidian"));var mo=class{constructor(){this.handlers=new Map;this.disabled=[]}on(e,r,n){if(e.includes("@")||r.includes("@"))throw new Error("Invalid context/event name - Cannot contain @");this.handlers.set(`${e}@${r}`,n)}off(e,r){if(r)this.handlers.delete(`${e}@${r}`);else for(let[n]of this.handlers.entries())n.startsWith(`${e}@`)&&this.handlers.delete(n)}disable(e){this.enable(e),this.disabled.push(e)}enable(e){this.disabled=this.disabled.filter(r=>r!==e)}emit(e,...r){let n=[...this.handlers.entries()].filter(([i,o])=>!this.disabled.includes(i.split("@")[0]));for(let[i,o]of n)i.endsWith(`@${e}`)&&o(...r)}};var _r=[];function Vn(t,e=he){let r,n=new Set;function i(a){if(Ae(t,a)&&(t=a,r)){let u=!_r.length;for(let l of n)l[1](),_r.push(l,t);if(u){for(let l=0;l<_r.length;l+=2)_r[l][0](_r[l+1]);_r.length=0}}}function o(a){i(a(t))}function s(a,u=he){let l=[a,u];return n.add(l),n.size===1&&(r=e(i)||he),a(t),()=>{n.delete(l),n.size===0&&(r(),r=null)}}return{set:i,update:o,subscribe:s}}var G=je(require("obsidian"));var se=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,ge=Object.keys,ke=Array.isArray;typeof Promise!="undefined"&&!se.Promise&&(se.Promise=Promise);function Le(t,e){return typeof e!="object"||ge(e).forEach(function(r){t[r]=e[r]}),t}var sn=Object.getPrototypeOf,cd={}.hasOwnProperty;function qe(t,e){return cd.call(t,e)}function vr(t,e){typeof e=="function"&&(e=e(sn(t))),(typeof Reflect=="undefined"?ge:Reflect.ownKeys)(e).forEach(r=>{ut(t,r,e[r])})}var na=Object.defineProperty;function ut(t,e,r,n){na(t,e,Le(r&&qe(r,"get")&&typeof r.get=="function"?{get:r.get,set:r.set,configurable:!0}:{value:r,configurable:!0,writable:!0},n))}function br(t){return{from:function(e){return t.prototype=Object.create(e.prototype),ut(t.prototype,"constructor",t),{extend:vr.bind(null,t.prototype)}}}}var fd=Object.getOwnPropertyDescriptor;function go(t,e){let r=fd(t,e),n;return r||(n=sn(t))&&go(n,e)}var dd=[].slice;function Hn(t,e,r){return dd.call(t,e,r)}function ia(t,e){return e(t)}function an(t){if(!t)throw new Error("Assertion Failed")}function oa(t){se.setImmediate?setImmediate(t):setTimeout(t,0)}function sa(t,e){return t.reduce((r,n,i)=>{var o=e(n,i);return o&&(r[o[0]]=o[1]),r},{})}function pd(t,e,r){try{t.apply(null,r)}catch(n){e&&e(n)}}function ct(t,e){if(qe(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 o=ct(t,e[n]);r.push(o)}return r}var s=e.indexOf(".");if(s!==-1){var a=t[e.substr(0,s)];return a===void 0?void 0:ct(a,e.substr(s+1))}}function et(t,e,r){if(!(!t||e===void 0)&&!("isFrozen"in Object&&Object.isFrozen(t)))if(typeof e!="string"&&"length"in e){an(typeof r!="string"&&"length"in r);for(var n=0,i=e.length;n<i;++n)et(t,e[n],r[n])}else{var o=e.indexOf(".");if(o!==-1){var s=e.substr(0,o),a=e.substr(o+1);if(a==="")r===void 0?ke(t)&&!isNaN(parseInt(s))?t.splice(s,1):delete t[s]:t[s]=r;else{var u=t[s];(!u||!qe(t,s))&&(u=t[s]={}),et(u,a,r)}}else r===void 0?ke(t)&&!isNaN(parseInt(e))?t.splice(e,1):delete t[e]:t[e]=r}}function hd(t,e){typeof e=="string"?et(t,e,void 0):"length"in e&&[].map.call(e,function(r){et(t,r,void 0)})}function aa(t){var e={};for(var r in t)qe(t,r)&&(e[r]=t[r]);return e}var md=[].concat;function la(t){return md.apply([],t)}var ua="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(la([8,16,32,64].map(t=>["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>se[t]),gd=ua.map(t=>se[t]);sa(ua,t=>[t,!0]);var At=null;function ln(t){At=typeof WeakMap!="undefined"&&new WeakMap;let e=yo(t);return At=null,e}function yo(t){if(!t||typeof t!="object")return t;let e=At&&At.get(t);if(e)return e;if(ke(t)){e=[],At&&At.set(t,e);for(var r=0,n=t.length;r<n;++r)e.push(yo(t[r]))}else if(gd.indexOf(t.constructor)>=0)e=t;else{let o=sn(t);e=o===Object.prototype?{}:Object.create(o),At&&At.set(t,e);for(var i in t)qe(t,i)&&(e[i]=yo(t[i]))}return e}var{toString:yd}={};function _o(t){return yd.call(t).slice(8,-1)}var vo=typeof Symbol!="undefined"?Symbol.iterator:"@@iterator",_d=typeof vo=="symbol"?function(t){var e;return t!=null&&(e=t[vo])&&e.apply(t)}:function(){return null},xr={};function ft(t){var e,r,n,i;if(arguments.length===1){if(ke(t))return t.slice();if(this===xr&&typeof t=="string")return[t];if(i=_d(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 bo=typeof Symbol!="undefined"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1,rt=typeof location!="undefined"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function ca(t,e){rt=t,fa=e}var fa=()=>!0,vd=!new Error("").stack;function Qt(){if(vd)try{throw Qt.arguments,new Error}catch(t){return t}return new Error}function xo(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(fa).map(n=>`
`+n).join("")):""}var bd=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],da=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],wo=bd.concat(da),xd={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 wr(t,e){this._e=Qt(),this.name=t,this.message=e}br(wr).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+xo(this._e,2))}},toString:function(){return this.name+": "+this.message}});function pa(t,e){return t+". Errors: "+Object.keys(e).map(r=>e[r].toString()).filter((r,n,i)=>i.indexOf(r)===n).join(`
`)}function $n(t,e,r,n){this._e=Qt(),this.failures=e,this.failedKeys=n,this.successCount=r,this.message=pa(t,e)}br($n).from(wr);function un(t,e){this._e=Qt(),this.name="BulkError",this.failures=Object.keys(e).map(r=>e[r]),this.failuresByPos=e,this.message=pa(t,e)}br(un).from(wr);var jo=wo.reduce((t,e)=>(t[e]=e+"Error",t),{}),wd=wr,V=wo.reduce((t,e)=>{var r=e+"Error";function n(i,o){this._e=Qt(),this.name=r,i?typeof i=="string"?(this.message=`${i}${o?`
`+o:""}`,this.inner=o||null):typeof i=="object"&&(this.message=`${i.name} ${i.message}`,this.inner=i):(this.message=xd[e]||r,this.inner=null)}return br(n).from(wd),t[e]=n,t},{});V.Syntax=SyntaxError;V.Type=TypeError;V.Range=RangeError;var ha=da.reduce((t,e)=>(t[e+"Error"]=V[e],t),{});function jd(t,e){if(!t||t instanceof wr||t instanceof TypeError||t instanceof SyntaxError||!t.name||!ha[t.name])return t;var r=new ha[t.name](e||t.message,t);return"stack"in t&&ut(r,"stack",{get:function(){return this.inner.stack}}),r}var Wn=wo.reduce((t,e)=>(["Syntax","Type","Range"].indexOf(e)===-1&&(t[e+"Error"]=V[e]),t),{});Wn.ModifyError=$n;Wn.DexieError=wr;Wn.BulkError=un;function ie(){}function cn(t){return t}function Ad(t,e){return t==null||t===cn?e:function(r){return e(t(r))}}function qt(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function Cd(t,e){return t===ie?e:function(){var r=t.apply(this,arguments);r!==void 0&&(arguments[0]=r);var n=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=e.apply(this,arguments);return n&&(this.onsuccess=this.onsuccess?qt(n,this.onsuccess):n),i&&(this.onerror=this.onerror?qt(i,this.onerror):i),o!==void 0?o:r}}function Sd(t,e){return t===ie?e:function(){t.apply(this,arguments);var r=this.onsuccess,n=this.onerror;this.onsuccess=this.onerror=null,e.apply(this,arguments),r&&(this.onsuccess=this.onsuccess?qt(r,this.onsuccess):r),n&&(this.onerror=this.onerror?qt(n,this.onerror):n)}}function Fd(t,e){return t===ie?e:function(r){var n=t.apply(this,arguments);Le(r,n);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var s=e.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?qt(i,this.onsuccess):i),o&&(this.onerror=this.onerror?qt(o,this.onerror):o),n===void 0?s===void 0?void 0:s:Le(n,s)}}function Ed(t,e){return t===ie?e:function(){return e.apply(this,arguments)===!1?!1:t.apply(this,arguments)}}function Ao(t,e){return t===ie?e:function(){var r=t.apply(this,arguments);if(r&&typeof r.then=="function"){for(var n=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return r.then(function(){return e.apply(n,o)})}return e.apply(this,arguments)}}var fn={},Td=100,Dd=20,ma=100,[Co,Un,So]=typeof Promise=="undefined"?[]:(()=>{let t=Promise.resolve();if(typeof crypto=="undefined"||!crypto.subtle)return[t,sn(t),t];let e=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[e,sn(e),t]})(),ga=Un&&Un.then,Gn=Co&&Co.constructor,Fo=!!So,Eo=!1,Id=So?()=>{So.then(Jn)}:se.setImmediate?setImmediate.bind(null,Jn):se.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver(()=>{Jn(),t=null}).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(Jn,0)},dn=function(t,e){pn.push([t,e]),Qn&&(Id(),Qn=!1)},To=!0,Qn=!0,Yt=[],qn=[],Do=null,Io=cn,jr={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Sa,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(t=>{try{Sa(t[0],t[1])}catch{}})}},K=jr,pn=[],Jt=0,Yn=[];function R(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ie,this._lib=!1;var e=this._PSD=K;if(rt&&(this._stackHolder=Qt(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==fn)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&ko(this,this._value);return}this._state=null,this._value=null,++e.ref,_a(this,t)}var Oo={get:function(){var t=K,e=ei;function r(n,i){var o=!t.global&&(t!==K||e!==ei);let s=o&&!dt();var a=new R((u,l)=>{Po(this,new ya(ri(n,t,o,s),ri(i,t,o,s),u,l,t))});return rt&&xa(a,this),a}return r.prototype=fn,r},set:function(t){ut(this,"then",t&&t.prototype===fn?Oo:{get:function(){return t},set:Oo.set})}};vr(R.prototype,{then:Oo,_then:function(t,e){Po(this,new ya(null,null,t,e,K))},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):Xn(n)):this.then(null,n=>n&&n.name===e?r(n):Xn(n))},finally:function(t){return this.then(e=>(t(),e),e=>(t(),Xn(e)))},stack:{get:function(){if(this._stack)return this._stack;try{Eo=!0;var t=ba(this,[],Dd),e=t.join(`
From previous: `);return this._state!==null&&(this._stack=e),e}finally{Eo=!1}}},timeout:function(t,e){return t<1/0?new R((r,n)=>{var i=setTimeout(()=>n(new V.Timeout(e)),t);this.then(r,n).finally(clearTimeout.bind(null,i))}):this}});typeof Symbol!="undefined"&&Symbol.toStringTag&&ut(R.prototype,Symbol.toStringTag,"Dexie.Promise");jr.env=wa();function ya(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}vr(R,{all:function(){var t=ft.apply(null,arguments).map(ti);return new R(function(e,r){t.length===0&&e([]);var n=t.length;t.forEach((i,o)=>R.resolve(i).then(s=>{t[o]=s,--n||e(t)},r))})},resolve:t=>{if(t instanceof R)return t;if(t&&typeof t.then=="function")return new R((r,n)=>{t.then(r,n)});var e=new R(fn,!0,t);return xa(e,Do),e},reject:Xn,race:function(){var t=ft.apply(null,arguments).map(ti);return new R((e,r)=>{t.map(n=>R.resolve(n).then(e,r))})},PSD:{get:()=>K,set:t=>K=t},totalEchoes:{get:()=>ei},newPSD:Ct,usePSD:Cr,scheduler:{get:()=>dn,set:t=>{dn=t}},rejectionMapper:{get:()=>Io,set:t=>{Io=t}},follow:(t,e)=>new R((r,n)=>Ct((i,o)=>{var s=K;s.unhandleds=[],s.onunhandled=o,s.finalize=qt(function(){kd(()=>{this.unhandleds.length===0?i():o(this.unhandleds[0])})},s.finalize),t()},e,r,n))});Gn&&(Gn.allSettled&&ut(R,"allSettled",function(){let t=ft.apply(null,arguments).map(ti);return new R(e=>{t.length===0&&e([]);let r=t.length,n=new Array(r);t.forEach((i,o)=>R.resolve(i).then(s=>n[o]={status:"fulfilled",value:s},s=>n[o]={status:"rejected",reason:s}).then(()=>--r||e(n)))})}),Gn.any&&typeof AggregateError!="undefined"&&ut(R,"any",function(){let t=ft.apply(null,arguments).map(ti);return new R((e,r)=>{t.length===0&&r(new AggregateError([]));let n=t.length,i=new Array(n);t.forEach((o,s)=>R.resolve(o).then(a=>e(a),a=>{i[s]=a,--n||r(new AggregateError(i))}))})}));function _a(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&&hn();r&&typeof r.then=="function"?_a(t,(i,o)=>{r instanceof R?r._then(i,o):r.then(i,o)}):(t._state=!0,t._value=r,va(t)),n&&mn()}},ko.bind(null,t))}catch(r){ko(t,r)}}function ko(t,e){if(qn.push(e),t._state===null){var r=t._lib&&hn();e=Io(e),t._state=!1,t._value=e,rt&&e!==null&&typeof e=="object"&&!e._promise&&pd(()=>{var n=go(e,"stack");e._promise=t,ut(e,"stack",{get:()=>Eo?n&&(n.get?n.get.apply(e):n.value):t.stack})}),Pd(t),va(t),r&&mn()}}function va(t){var e=t._listeners;t._listeners=[];for(var r=0,n=e.length;r<n;++r)Po(t,e[r]);var i=t._PSD;--i.ref||i.finalize(),Jt===0&&(++Jt,dn(()=>{--Jt==0&&Mo()},[]))}function Po(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,++Jt,dn(Od,[r,t,e])}function Od(t,e,r){try{Do=e;var n,i=e._value;e._state?n=t(i):(qn.length&&(qn=[]),n=t(i),qn.indexOf(i)===-1&&Md(e)),r.resolve(n)}catch(o){r.reject(o)}finally{Do=null,--Jt==0&&Mo(),--r.psd.ref||r.psd.finalize()}}function ba(t,e,r){if(e.length===r)return e;var n="";if(t._state===!1){var i=t._value,o,s;i!=null?(o=i.name||"Error",s=i.message||i,n=xo(i,0)):(o=i,s=""),e.push(o+(s?": "+s:"")+n)}return rt&&(n=xo(t._stackHolder,2),n&&e.indexOf(n)===-1&&e.push(n),t._prev&&ba(t._prev,e,r)),e}function xa(t,e){var r=e?e._numPrev+1:0;r<Td&&(t._prev=e,t._numPrev=r)}function Jn(){hn()&&mn()}function hn(){var t=To;return To=!1,Qn=!1,t}function mn(){var t,e,r;do for(;pn.length>0;)for(t=pn,pn=[],r=t.length,e=0;e<r;++e){var n=t[e];n[0].apply(null,n[1])}while(pn.length>0);To=!0,Qn=!0}function Mo(){var t=Yt;Yt=[],t.forEach(n=>{n._PSD.onunhandled.call(null,n._value,n)});for(var e=Yn.slice(0),r=e.length;r;)e[--r]()}function kd(t){function e(){t(),Yn.splice(Yn.indexOf(e),1)}Yn.push(e),++Jt,dn(()=>{--Jt==0&&Mo()},[])}function Pd(t){Yt.some(e=>e._value===t._value)||Yt.push(t)}function Md(t){for(var e=Yt.length;e;)if(Yt[--e]._value===t._value){Yt.splice(e,1);return}}function Xn(t){return new R(fn,!1,t)}function le(t,e){var r=K;return function(){var n=hn(),i=K;try{return St(r,!0),t.apply(this,arguments)}catch(o){e&&e(o)}finally{St(i,!1),n&&mn()}}}var Pe={awaits:0,echoes:0,id:0},Rd=0,Zn=[],Ro=0,ei=0,Ld=0;function Ct(t,e,r,n){var i=K,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Ld;var s=jr.env;o.env=Fo?{Promise:R,PromiseProp:{value:R,configurable:!0,writable:!0},all:R.all,race:R.race,allSettled:R.allSettled,any:R.any,resolve:R.resolve,reject:R.reject,nthen:Aa(s.nthen,o),gthen:Aa(s.gthen,o)}:{},e&&Le(o,e),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=Cr(o,t,r,n);return o.ref===0&&o.finalize(),a}function Ar(){return Pe.id||(Pe.id=++Rd),++Pe.awaits,Pe.echoes+=ma,Pe.id}function dt(){return Pe.awaits?(--Pe.awaits==0&&(Pe.id=0),Pe.echoes=Pe.awaits*ma,!0):!1}(""+ga).indexOf("[native code]")===-1&&(Ar=dt=ie);function ti(t){return Pe.echoes&&t&&t.constructor===Gn?(Ar(),t.then(e=>(dt(),e),e=>(dt(),be(e)))):t}function Bd(t){++ei,(!Pe.echoes||--Pe.echoes==0)&&(Pe.echoes=Pe.id=0),Zn.push(K),St(t,!0)}function Nd(){var t=Zn[Zn.length-1];Zn.pop(),St(t,!1)}function St(t,e){var r=K;if((e?Pe.echoes&&(!Ro++||t!==K):Ro&&(!--Ro||t!==K))&&ja(e?Bd.bind(null,t):Nd),t!==K&&(K=t,r===jr&&(jr.env=wa()),Fo)){var n=jr.env.Promise,i=t.env;Un.then=i.nthen,n.prototype.then=i.gthen,(r.global||t.global)&&(Object.defineProperty(se,"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 wa(){var t=se.Promise;return Fo?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(se,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:Un.then,gthen:t.prototype.then}:{}}function Cr(t,e,r,n,i){var o=K;try{return St(t,!0),e(r,n,i)}finally{St(o,!1)}}function ja(t){ga.call(Co,t)}function ri(t,e,r,n){return typeof t!="function"?t:function(){var i=K;r&&Ar(),St(e,!0);try{return t.apply(this,arguments)}finally{St(i,!1),n&&ja(dt)}}}function Aa(t,e){return function(r,n){return t.call(this,ri(r,e),ri(n,e))}}var Ca="unhandledrejection";function Sa(t,e){var r;try{r=e.onuncatched(t)}catch{}if(r!==!1)try{var n,i={promise:e,reason:t};if(se.document&&document.createEvent?(n=document.createEvent("Event"),n.initEvent(Ca,!0,!0),Le(n,i)):se.CustomEvent&&(n=new CustomEvent(Ca,{detail:i}),Le(n,i)),n&&se.dispatchEvent&&(dispatchEvent(n),!se.PromiseRejectionEvent&&se.onunhandledrejection))try{se.onunhandledrejection(n)}catch{}rt&&n&&!n.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var be=R.reject;function Lo(t,e,r,n){if(!t.idbdb||!t._state.openComplete&&!K.letThrough&&!t._vip){if(t._state.openComplete)return be(new V.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return be(new V.DatabaseClosed);t.open().catch(ie)}return t._state.dbReadyPromise.then(()=>Lo(t,e,r,n))}else{var i=t._createTransaction(e,r,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(o){return o.name===jo.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>Lo(t,e,r,n))):be(o)}return i._promise(e,(o,s)=>Ct(()=>(K.trans=i,n(o,s,i)))).then(o=>i._completion.then(()=>o))}}var Fa="3.2.2",Xt=String.fromCharCode(65535),Bo=-1/0,pt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Ea="String expected.",gn=[],ni=typeof navigator!="undefined"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Kd=ni,zd=ni,Ta=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),ii="__dbnames",No="readonly",Ko="readwrite";function Zt(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}var Da={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function oi(t){return typeof t=="string"&&!/\./.test(t)?e=>(e[t]===void 0&&t in e&&(e=ln(e),delete e[t]),e):e=>e}var Ia=class{_trans(e,r,n){let i=this._tx||K.trans,o=this.name;function s(u,l,f){if(!f.schema[o])throw new V.NotFound("Table "+o+" not part of transaction");return r(f.idbtrans,f)}let a=hn();try{return i&&i.db===this.db?i===K.trans?i._promise(e,s,n):Ct(()=>i._promise(e,s,n),{trans:i,transless:K.transless||K}):Lo(this.db,e,[this.name],s)}finally{a&&mn()}}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(ke(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let r=ge(e);if(r.length===1)return this.where(r[0]).equals(e[r[0]]);let n=this.schema.indexes.concat(this.schema.primKey).filter(l=>l.compound&&r.every(f=>l.keyPath.indexOf(f)>=0)&&l.keyPath.every(f=>r.indexOf(f)>=0))[0];if(n&&this.db._maxKey!==Xt)return this.where(n.name).equals(n.keyPath.map(l=>e[l]));!n&&rt&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${r.join("+")}]`);let{idxByName:i}=this.schema,o=this.db._deps.indexedDB;function s(l,f){try{return o.cmp(l,f)===0}catch{return!1}}let[a,u]=r.reduce(([l,f],p)=>{let c=i[p],h=e[p];return[l||c,l||!c?Zt(f,c&&c.multi?w=>{let x=ct(w,p);return ke(x)&&x.some(v=>s(h,v))}:w=>s(h,ct(w,p))):f]},[null,null]);return a?this.where(a.name).equals(e[a.keyPath]).filter(u):n?this.filter(u):this.where(r).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,ke(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;let r=n=>{if(!n)return n;let i=Object.create(e.prototype);for(var o in n)if(qe(n,o))try{i[o]=n[o]}catch{}return i};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=r,this.hook("reading",r),e}defineClass(){function e(r){Le(this,r)}return this.mapToClass(e)}add(e,r){let{auto:n,keyPath:i}=this.schema.primKey,o=e;return i&&n&&(o=oi(i)(e)),this._trans("readwrite",s=>this.core.mutate({trans:s,type:"add",keys:r!=null?[r]:null,values:[o]})).then(s=>s.numFailures?R.reject(s.failures[0]):s.lastResult).then(s=>{if(i)try{et(e,i,s)}catch{}return s})}update(e,r){if(typeof e=="object"&&!ke(e)){let n=ct(e,this.schema.primKey.keyPath);if(n===void 0)return be(new V.InvalidArgument("Given object does not contain its primary key"));try{typeof r!="function"?ge(r).forEach(i=>{et(e,i,r[i])}):r(e,{value:e,primKey:n})}catch{}return this.where(":id").equals(n).modify(r)}else return this.where(":id").equals(e).modify(r)}put(e,r){let{auto:n,keyPath:i}=this.schema.primKey,o=e;return i&&n&&(o=oi(i)(e)),this._trans("readwrite",s=>this.core.mutate({trans:s,type:"put",values:[o],keys:r!=null?[r]:null})).then(s=>s.numFailures?R.reject(s.failures[0]):s.lastResult).then(s=>{if(i)try{et(e,i,s)}catch{}return s})}delete(e){return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:[e]})).then(r=>r.numFailures?R.reject(r.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:Da})).then(e=>e.numFailures?R.reject(e.failures[0]):void 0)}bulkGet(e){return this._trans("readonly",r=>this.core.getMany({keys:e,trans:r}).then(n=>n.map(i=>this.hook.reading.fire(i))))}bulkAdd(e,r,n){let i=Array.isArray(r)?r:void 0;n=n||(i?void 0:r);let o=n?n.allKeys:void 0;return this._trans("readwrite",s=>{let{auto:a,keyPath:u}=this.schema.primKey;if(u&&i)throw new V.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");let l=e.length,f=u&&a?e.map(oi(u)):e;return this.core.mutate({trans:s,type:"add",keys:i,values:f,wantResults:o}).then(({numFailures:p,results:c,lastResult:h,failures:w})=>{let x=o?c:h;if(p===0)return x;throw new un(`${this.name}.bulkAdd(): ${p} of ${l} operations failed`,w)})})}bulkPut(e,r,n){let i=Array.isArray(r)?r:void 0;n=n||(i?void 0:r);let o=n?n.allKeys:void 0;return this._trans("readwrite",s=>{let{auto:a,keyPath:u}=this.schema.primKey;if(u&&i)throw new V.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");let l=e.length,f=u&&a?e.map(oi(u)):e;return this.core.mutate({trans:s,type:"put",keys:i,values:f,wantResults:o}).then(({numFailures:p,results:c,lastResult:h,failures:w})=>{let x=o?c:h;if(p===0)return x;throw new un(`${this.name}.bulkPut(): ${p} of ${l} 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:o})=>{if(n===0)return i;throw new un(`${this.name}.bulkDelete(): ${n} of ${r} operations failed`,o)})}};function yn(t){var e={},r=function(a,u){if(u){for(var l=arguments.length,f=new Array(l-1);--l;)f[l-1]=arguments[l];return e[a].subscribe.apply(null,f),t}else if(typeof a=="string")return e[a]};r.addEventType=o;for(var n=1,i=arguments.length;n<i;++n)o(arguments[n]);return r;function o(a,u,l){if(typeof a=="object")return s(a);u||(u=Ed),l||(l=ie);var f={subscribers:[],fire:l,subscribe:function(p){f.subscribers.indexOf(p)===-1&&(f.subscribers.push(p),f.fire=u(f.fire,p))},unsubscribe:function(p){f.subscribers=f.subscribers.filter(function(c){return c!==p}),f.fire=f.subscribers.reduce(u,l)}};return e[a]=r[a]=f,f}function s(a){ge(a).forEach(function(u){var l=a[u];if(ke(l))o(u,a[u][0],a[u][1]);else if(l==="asap")var f=o(u,cn,function(){for(var c=arguments.length,h=new Array(c);c--;)h[c]=arguments[c];f.subscribers.forEach(function(w){oa(function(){w.apply(null,h)})})});else throw new V.InvalidArgument("Invalid event config")})}}function _n(t,e){return br(e).from({prototype:t}),e}function Vd(t){return _n(Ia.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:yn(null,{creating:[Cd,ie],reading:[Ad,cn],updating:[Fd,ie],deleting:[Sd,ie]})})}function Sr(t,e){return!(t.filter||t.algorithm||t.or)&&(e?t.justLimit:!t.replayFilter)}function zo(t,e){t.filter=Zt(t.filter,e)}function Vo(t,e,r){var n=t.replayFilter;t.replayFilter=n?()=>Zt(n(),e()):e,t.justLimit=r&&!n}function Hd(t,e){t.isMatch=Zt(t.isMatch,e)}function si(t,e){if(t.isPrimKey)return e.primaryKey;let r=e.getIndexByKeyPath(t.index);if(!r)throw new V.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return r}function Oa(t,e,r){let n=si(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 ai(t,e,r,n){let i=t.replayFilter?Zt(t.filter,t.replayFilter()):t.filter;if(t.or){let o={},s=(a,u,l)=>{if(!i||i(u,l,c=>u.stop(c),c=>u.fail(c))){var f=u.primaryKey,p=""+f;p==="[object ArrayBuffer]"&&(p=""+new Uint8Array(f)),qe(o,p)||(o[p]=!0,e(a,u,l))}};return Promise.all([t.or._iterate(s,r),ka(Oa(t,n,r),t.algorithm,s,!t.keysOnly&&t.valueMapper)])}else return ka(Oa(t,n,r),Zt(t.algorithm,i),e,!t.keysOnly&&t.valueMapper)}function ka(t,e,r,n){var i=n?(s,a,u)=>r(n(s),a,u):r,o=le(i);return t.then(s=>{if(s)return s.start(()=>{var a=()=>s.continue();(!e||e(s,u=>a=u,u=>{s.stop(u),a=ie},u=>{s.fail(u),a=ie}))&&o(s.value,s,u=>a=u),a()})})}function Be(t,e){try{let r=Pa(t),n=Pa(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 Wd(Ma(t),Ma(e));case"Array":return $d(t,e)}}catch{}return NaN}function $d(t,e){let r=t.length,n=e.length,i=r<n?r:n;for(let o=0;o<i;++o){let s=Be(t[o],e[o]);if(s!==0)return s}return r===n?0:r<n?-1:1}function Wd(t,e){let r=t.length,n=e.length,i=r<n?r:n;for(let o=0;o<i;++o)if(t[o]!==e[o])return t[o]<e[o]?-1:1;return r===n?0:r<n?-1:1}function Pa(t){let e=typeof t;if(e!=="object")return e;if(ArrayBuffer.isView(t))return"binary";let r=_o(t);return r==="ArrayBuffer"?"binary":r}function Ma(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}var Ra=class{_read(e,r){var n=this._ctx;return n.error?n.table._trans(null,be.bind(null,n.error)):n.table._trans("readonly",e).then(r)}_write(e){var r=this._ctx;return r.error?r.table._trans(null,be.bind(null,r.error)):r.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var r=this._ctx;r.algorithm=Zt(r.algorithm,e)}_iterate(e,r){return ai(this._ctx,e,r,this._ctx.table.core)}clone(e){var r=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&Le(n,e),r._ctx=n,r}raw(){return this._ctx.valueMapper=null,this}each(e){var r=this._ctx;return this._read(n=>ai(r,e,n,r.table.core))}count(e){return this._read(r=>{let n=this._ctx,i=n.table.core;if(Sr(n,!0))return i.count({trans:r,query:{index:si(n,i.schema),range:n.range}}).then(s=>Math.min(s,n.limit));var o=0;return ai(n,()=>(++o,!1),r,i).then(()=>o)}).then(e)}sortBy(e,r){let n=e.split(".").reverse(),i=n[0],o=n.length-1;function s(l,f){return f?s(l[n[f]],f-1):l[i]}var a=this._ctx.dir==="next"?1:-1;function u(l,f){var p=s(l,o),c=s(f,o);return p<c?-a:p>c?a:0}return this.toArray(function(l){return l.sort(u)}).then(r)}toArray(e){return this._read(r=>{var n=this._ctx;if(n.dir==="next"&&Sr(n,!0)&&n.limit>0){let{valueMapper:i}=n,o=si(n,n.table.core.schema);return n.table.core.query({trans:r,limit:n.limit,values:!0,query:{index:o,range:n.range}}).then(({result:s})=>i?s.map(i):s)}else{let i=[];return ai(n,o=>i.push(o),r,n.table.core).then(()=>i)}},e)}offset(e){var r=this._ctx;return e<=0?this:(r.offset+=e,Sr(r)?Vo(r,()=>{var n=e;return(i,o)=>n===0?!0:n===1?(--n,!1):(o(()=>{i.advance(n),n=0}),!1)}):Vo(r,()=>{var n=e;return()=>--n<0}),this)}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Vo(this._ctx,()=>{var r=e;return function(n,i,o){return--r<=0&&i(o),r>=0}},!0),this}until(e,r){return zo(this._ctx,function(n,i,o){return e(n.value)?(i(o),r):!0}),this}first(e){return this.limit(1).toArray(function(r){return r[0]}).then(e)}last(e){return this.reverse().first(e)}filter(e){return zo(this._ctx,function(r){return e(r.value)}),Hd(this._ctx,e),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(n,i){e(i.key,i)})}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(n,i){e(i.primaryKey,i)})}keys(e){var r=this._ctx;r.keysOnly=!r.isMatch;var n=[];return this.each(function(i,o){n.push(o.key)}).then(function(){return n}).then(e)}primaryKeys(e){var r=this._ctx;if(r.dir==="next"&&Sr(r,!0)&&r.limit>0)return this._read(i=>{var o=si(r,r.table.core.schema);return r.table.core.query({trans:i,values:!1,limit:r.limit,query:{index:o,range:r.range}})}).then(({result:i})=>i).then(e);r.keysOnly=!r.isMatch;var n=[];return this.each(function(i,o){n.push(o.primaryKey)}).then(function(){return n}).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys(function(r){return r[0]}).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,r=e.index&&e.table.schema.idxByName[e.index];if(!r||!r.multi)return this;var n={};return zo(this._ctx,function(i){var o=i.primaryKey.toString(),s=qe(n,o);return n[o]=!0,!s}),this}modify(e){var r=this._ctx;return this._write(n=>{var i;if(typeof e=="function")i=e;else{var o=ge(e),s=o.length;i=function(x){for(var v=!1,d=0;d<s;++d){var b=o[d],m=e[b];ct(x,b)!==m&&(et(x,b,m),v=!0)}return v}}let a=r.table.core,{outbound:u,extractKey:l}=a.schema.primaryKey,f=this.db._options.modifyChunkSize||200,p=[],c=0,h=[],w=(x,v)=>{let{failures:d,numFailures:b}=v;c+=x-b;for(let m of ge(d))p.push(d[m])};return this.clone().primaryKeys().then(x=>{let v=d=>{let b=Math.min(f,x.length-d);return a.getMany({trans:n,keys:x.slice(d,d+b),cache:"immutable"}).then(m=>{let g=[],y=[],_=u?[]:null,j=[];for(let F=0;F<b;++F){let E=m[F],O={value:ln(E),primKey:x[d+F]};i.call(O,O.value,O)!==!1&&(O.value==null?j.push(x[d+F]):!u&&Be(l(E),l(O.value))!==0?(j.push(x[d+F]),g.push(O.value)):(y.push(O.value),u&&_.push(x[d+F])))}let A=Sr(r)&&r.limit===1/0&&(typeof e!="function"||e===Ho)&&{index:r.index,range:r.range};return Promise.resolve(g.length>0&&a.mutate({trans:n,type:"add",values:g}).then(F=>{for(let E in F.failures)j.splice(parseInt(E),1);w(g.length,F)})).then(()=>(y.length>0||A&&typeof e=="object")&&a.mutate({trans:n,type:"put",keys:_,values:y,criteria:A,changeSpec:typeof e!="function"&&e}).then(F=>w(y.length,F))).then(()=>(j.length>0||A&&e===Ho)&&a.mutate({trans:n,type:"delete",keys:j,criteria:A}).then(F=>w(j.length,F))).then(()=>x.length>d+b&&v(d+f))})};return v(0).then(()=>{if(p.length>0)throw new $n("Error modifying one or more objects",p,c,h);return x.length})})})}delete(){var e=this._ctx,r=e.range;return Sr(e)&&(e.isPrimKey&&!zd||r.type===3)?this._write(n=>{let{primaryKey:i}=e.table.core.schema,o=r;return e.table.core.count({trans:n,query:{index:i,range:o}}).then(s=>e.table.core.mutate({trans:n,type:"deleteRange",range:o}).then(({failures:a,lastResult:u,results:l,numFailures:f})=>{if(f)throw new $n("Could not delete some values",Object.keys(a).map(p=>a[p]),s-f);return s-f}))}):this.modify(Ho)}},Ho=(t,e)=>e.value=null;function Ud(t){return _n(Ra.prototype,function(r,n){this.db=t;let i=Da,o=null;if(n)try{i=n()}catch(l){o=l}let s=r._ctx,a=s.table,u=a.hook.reading.fire;this._ctx={table:a,index:s.index,isPrimKey:!s.index||a.schema.primKey.keyPath&&s.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:o,or:s.or,valueMapper:u!==cn?u:null}})}function Gd(t,e){return t<e?-1:t===e?0:1}function Qd(t,e){return t>e?-1:t===e?0:1}function Ye(t,e,r){var n=t instanceof $o?new t.Collection(t):t;return n._ctx.error=r?new r(e):new TypeError(e),n}function Fr(t){return new t.Collection(t,()=>La("")).limit(0)}function qd(t){return t==="next"?e=>e.toUpperCase():e=>e.toLowerCase()}function Yd(t){return t==="next"?e=>e.toLowerCase():e=>e.toUpperCase()}function Jd(t,e,r,n,i,o){for(var s=Math.min(t.length,n.length),a=-1,u=0;u<s;++u){var l=e[u];if(l!==n[u])return i(t[u],r[u])<0?t.substr(0,u)+r[u]+r.substr(u+1):i(t[u],n[u])<0?t.substr(0,u)+n[u]+r.substr(u+1):a>=0?t.substr(0,a)+e[a]+r.substr(a+1):null;i(t[u],l)<0&&(a=u)}return s<n.length&&o==="next"?t+r.substr(t.length):s<t.length&&o==="prev"?t.substr(0,r.length):a<0?null:t.substr(0,a)+n[a]+r.substr(a+1)}function li(t,e,r,n){var i,o,s,a,u,l,f,p=r.length;if(!r.every(x=>typeof x=="string"))return Ye(t,Ea);function c(x){i=qd(x),o=Yd(x),s=x==="next"?Gd:Qd;var v=r.map(function(d){return{lower:o(d),upper:i(d)}}).sort(function(d,b){return s(d.lower,b.lower)});a=v.map(function(d){return d.upper}),u=v.map(function(d){return d.lower}),l=x,f=x==="next"?"":n}c("next");var h=new t.Collection(t,()=>Ft(a[0],u[p-1]+n));h._ondirectionchange=function(x){c(x)};var w=0;return h._addAlgorithm(function(x,v,d){var b=x.key;if(typeof b!="string")return!1;var m=o(b);if(e(m,u,w))return!0;for(var g=null,y=w;y<p;++y){var _=Jd(b,m,a[y],u[y],s,l);_===null&&g===null?w=y+1:(g===null||s(g,_)>0)&&(g=_)}return v(g!==null?function(){x.continue(g+f)}:d),!1}),h}function Ft(t,e,r,n){return{type:2,lower:t,upper:e,lowerOpen:r,upperOpen:n}}function La(t){return{type:1,lower:t,upper:t}}var $o=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)?Fr(this):new this.Collection(this,()=>Ft(e,r,!n,!i))}catch{return Ye(this,pt)}}equals(e){return e==null?Ye(this,pt):new this.Collection(this,()=>La(e))}above(e){return e==null?Ye(this,pt):new this.Collection(this,()=>Ft(e,void 0,!0))}aboveOrEqual(e){return e==null?Ye(this,pt):new this.Collection(this,()=>Ft(e,void 0,!1))}below(e){return e==null?Ye(this,pt):new this.Collection(this,()=>Ft(void 0,e,!1,!0))}belowOrEqual(e){return e==null?Ye(this,pt):new this.Collection(this,()=>Ft(void 0,e))}startsWith(e){return typeof e!="string"?Ye(this,Ea):this.between(e,e+Xt,!0,!0)}startsWithIgnoreCase(e){return e===""?this.startsWith(e):li(this,(r,n)=>r.indexOf(n[0])===0,[e],Xt)}equalsIgnoreCase(e){return li(this,(r,n)=>r===n[0],[e],"")}anyOfIgnoreCase(){var e=ft.apply(xr,arguments);return e.length===0?Fr(this):li(this,(r,n)=>n.indexOf(r)!==-1,e,"")}startsWithAnyOfIgnoreCase(){var e=ft.apply(xr,arguments);return e.length===0?Fr(this):li(this,(r,n)=>n.some(i=>r.indexOf(i)===0),e,Xt)}anyOf(){let e=ft.apply(xr,arguments),r=this._cmp;try{e.sort(r)}catch{return Ye(this,pt)}if(e.length===0)return Fr(this);let n=new this.Collection(this,()=>Ft(e[0],e[e.length-1]));n._ondirectionchange=o=>{r=o==="next"?this._ascending:this._descending,e.sort(r)};let i=0;return n._addAlgorithm((o,s,a)=>{let u=o.key;for(;r(u,e[i])>0;)if(++i,i===e.length)return s(a),!1;return r(u,e[i])===0?!0:(s(()=>{o.continue(e[i])}),!1)}),n}notEqual(e){return this.inAnyRange([[Bo,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=ft.apply(xr,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return Ye(this,pt)}let r=e.reduce((n,i)=>n?n.concat([[n[n.length-1][1],i]]):[[Bo,i]],null);return r.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(r,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,r){let n=this._cmp,i=this._ascending,o=this._descending,s=this._min,a=this._max;if(e.length===0)return Fr(this);if(!e.every(g=>g[0]!==void 0&&g[1]!==void 0&&i(g[0],g[1])<=0))return Ye(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",V.InvalidArgument);let u=!r||r.includeLowers!==!1,l=r&&r.includeUppers===!0;function f(g,y){let _=0,j=g.length;for(;_<j;++_){let A=g[_];if(n(y[0],A[1])<0&&n(y[1],A[0])>0){A[0]=s(A[0],y[0]),A[1]=a(A[1],y[1]);break}}return _===j&&g.push(y),g}let p=i;function c(g,y){return p(g[0],y[0])}let h;try{h=e.reduce(f,[]),h.sort(c)}catch{return Ye(this,pt)}let w=0,x=l?g=>i(g,h[w][1])>0:g=>i(g,h[w][1])>=0,v=u?g=>o(g,h[w][0])>0:g=>o(g,h[w][0])>=0;function d(g){return!x(g)&&!v(g)}let b=x,m=new this.Collection(this,()=>Ft(h[0][0],h[h.length-1][1],!u,!l));return m._ondirectionchange=g=>{g==="next"?(b=x,p=i):(b=v,p=o),h.sort(c)},m._addAlgorithm((g,y,_)=>{for(var j=g.key;b(j);)if(++w,w===h.length)return y(_),!1;return d(j)?!0:(this._cmp(j,h[w][1])===0||this._cmp(j,h[w][0])===0||y(()=>{p===i?g.continue(h[w][0]):g.continue(h[w][1])}),!1)}),m}startsWithAnyOf(){let e=ft.apply(xr,arguments);return e.every(r=>typeof r=="string")?e.length===0?Fr(this):this.inAnyRange(e.map(r=>[r,r+Xt])):Ye(this,"startsWithAnyOf() only works with strings")}};function Xd(t){return _n($o.prototype,function(r,n,i){this.db=t,this._ctx={table:r,index:n===":id"?null:n,or:i};let o=t._deps.indexedDB;if(!o)throw new V.MissingAPI;this._cmp=this._ascending=o.cmp.bind(o),this._descending=(s,a)=>o.cmp(a,s),this._max=(s,a)=>o.cmp(s,a)>0?s:a,this._min=(s,a)=>o.cmp(s,a)<0?s:a,this._IDBKeyRange=t._deps.IDBKeyRange})}function nt(t){return le(function(e){return vn(e),t(e.target.error),!1})}function vn(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}var bn="storagemutated",Et="x-storagemutated-1",Tt=yn(null,bn),Ba=class{_lock(){return an(!K.global),++this._reculock,this._reculock===1&&!K.global&&(K.lockOwnerFor=this),this}_unlock(){if(an(!K.global),--this._reculock==0)for(K.global||(K.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{Cr(e[1],e[0])}catch{}}return this}_locked(){return this._reculock&&K.lockOwnerFor!==this}create(e){if(!this.mode)return this;let r=this.db.idbdb,n=this.db._state.dbOpenError;if(an(!this.idbtrans),!e&&!r)switch(n&&n.name){case"DatabaseClosedError":throw new V.DatabaseClosed(n);case"MissingAPIError":throw new V.MissingAPI(n.message,n);default:throw new V.OpenFailed(n)}if(!this.active)throw new V.TransactionInactive;return an(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=le(i=>{vn(i),this._reject(e.error)}),e.onabort=le(i=>{vn(i),this.active&&this._reject(new V.Abort(e.error)),this.active=!1,this.on("abort").fire(i)}),e.oncomplete=le(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&Tt.storagemutated.fire(e.mutatedParts)}),this}_promise(e,r,n){if(e==="readwrite"&&this.mode!=="readwrite")return be(new V.ReadOnly("Transaction is readonly"));if(!this.active)return be(new V.TransactionInactive);if(this._locked())return new R((o,s)=>{this._blockedFuncs.push([()=>{this._promise(e,r,n).then(o,s)},K])});if(n)return Ct(()=>{var o=new R((s,a)=>{this._lock();let u=r(s,a,this);u&&u.then&&u.then(s,a)});return o.finally(()=>this._unlock()),o._lib=!0,o});var i=new R((o,s)=>{var a=r(o,s,this);a&&a.then&&a.then(o,s)});return i._lib=!0,i}_root(){return this.parent?this.parent._root():this}waitFor(e){var r=this._root();let n=R.resolve(e);if(r._waitingFor)r._waitingFor=r._waitingFor.then(()=>n);else{r._waitingFor=n,r._waitingQueue=[];var i=r.idbtrans.objectStore(r.storeNames[0]);(function s(){for(++r._spinCount;r._waitingQueue.length;)r._waitingQueue.shift()();r._waitingFor&&(i.get(-1/0).onsuccess=s)})()}var o=r._waitingFor;return new R((s,a)=>{n.then(u=>r._waitingQueue.push(le(s.bind(null,u))),u=>r._waitingQueue.push(le(a.bind(null,u)))).finally(()=>{r._waitingFor===o&&(r._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new V.Abort))}table(e){let r=this._memoizedTables||(this._memoizedTables={});if(qe(r,e))return r[e];let n=this.schema[e];if(!n)throw new V.NotFound("Table "+e+" not part of transaction");let i=new this.db.Table(e,n,this);return i.core=this.db.core.table(e),r[e]=i,i}};function Zd(t){return _n(Ba.prototype,function(r,n,i,o,s){this.db=t,this.mode=r,this.storeNames=n,this.schema=i,this.chromeTransactionDurability=o,this.idbtrans=null,this.on=yn(this,"complete","error","abort"),this.parent=s||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new R((a,u)=>{this._resolve=a,this._reject=u}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},a=>{var u=this.active;return this.active=!1,this.on.error.fire(a),this.parent?this.parent._reject(a):u&&this.idbtrans&&this.idbtrans.abort(),be(a)})})}function Wo(t,e,r,n,i,o,s){return{name:t,keyPath:e,unique:r,multi:n,auto:i,compound:o,src:(r&&!s?"&":"")+(n?"*":"")+(i?"++":"")+Na(e)}}function Na(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function Ka(t,e,r){return{name:t,primKey:e,indexes:r,mappedClass:null,idxByName:sa(r,n=>[n.name,n])}}function ep(t){return t.length===1?t[0]:t}var xn=t=>{try{return t.only([[]]),xn=()=>[[]],[[]]}catch{return xn=()=>Xt,Xt}};function Uo(t){return t==null?()=>{}:typeof t=="string"?tp(t):e=>ct(e,t)}function tp(t){return t.split(".").length===1?r=>r[t]:r=>ct(r,t)}function za(t){return[].slice.call(t)}var rp=0;function wn(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function np(t,e,r){function n(f,p){let c=za(f.objectStoreNames);return{schema:{name:f.name,tables:c.map(h=>p.objectStore(h)).map(h=>{let{keyPath:w,autoIncrement:x}=h,v=ke(w),d=w==null,b={},m={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:d,compound:v,keyPath:w,autoIncrement:x,unique:!0,extractKey:Uo(w)},indexes:za(h.indexNames).map(g=>h.index(g)).map(g=>{let{name:y,unique:_,multiEntry:j,keyPath:A}=g,F=ke(A),E={name:y,compound:F,keyPath:A,unique:_,multiEntry:j,extractKey:Uo(A)};return b[wn(A)]=E,E}),getIndexByKeyPath:g=>b[wn(g)]};return b[":id"]=m.primaryKey,w!=null&&(b[wn(w)]=m.primaryKey),m})},hasGetAll:c.length>0&&"getAll"in p.objectStore(c[0])&&!(typeof navigator!="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function i(f){if(f.type===3)return null;if(f.type===4)throw new Error("Cannot convert never type to IDBKeyRange");let{lower:p,upper:c,lowerOpen:h,upperOpen:w}=f;return p===void 0?c===void 0?null:e.upperBound(c,!!w):c===void 0?e.lowerBound(p,!!h):e.bound(p,c,!!h,!!w)}function o(f){let p=f.name;function c({trans:x,type:v,keys:d,values:b,range:m}){return new Promise((g,y)=>{g=le(g);let _=x.objectStore(p),j=_.keyPath==null,A=v==="put"||v==="add";if(!A&&v!=="delete"&&v!=="deleteRange")throw new Error("Invalid operation type: "+v);let{length:F}=d||b||{length:1};if(d&&b&&d.length!==b.length)throw new Error("Given keys array must have same length as given values array.");if(F===0)return g({numFailures:0,failures:{},results:[],lastResult:void 0});let E,O=[],L=[],k=0,z=Y=>{++k,vn(Y)};if(v==="deleteRange"){if(m.type===4)return g({numFailures:k,failures:L,results:[],lastResult:void 0});m.type===3?O.push(E=_.clear()):O.push(E=_.delete(i(m)))}else{let[Y,q]=A?j?[b,d]:[b,null]:[d,null];if(A)for(let C=0;C<F;++C)O.push(E=q&&q[C]!==void 0?_[v](Y[C],q[C]):_[v](Y[C])),E.onerror=z;else for(let C=0;C<F;++C)O.push(E=_[v](Y[C])),E.onerror=z}let J=Y=>{let q=Y.target.result;O.forEach((C,S)=>C.error!=null&&(L[S]=C.error)),g({numFailures:k,failures:L,results:v==="delete"?d:O.map(C=>C.result),lastResult:q})};E.onerror=Y=>{z(Y),J(Y)},E.onsuccess=J})}function h({trans:x,values:v,query:d,reverse:b,unique:m}){return new Promise((g,y)=>{g=le(g);let{index:_,range:j}=d,A=x.objectStore(p),F=_.isPrimaryKey?A:A.index(_.name),E=b?m?"prevunique":"prev":m?"nextunique":"next",O=v||!("openKeyCursor"in F)?F.openCursor(i(j),E):F.openKeyCursor(i(j),E);O.onerror=nt(y),O.onsuccess=le(L=>{let k=O.result;if(!k){g(null);return}k.___id=++rp,k.done=!1;let z=k.continue.bind(k),J=k.continuePrimaryKey;J&&(J=J.bind(k));let Y=k.advance.bind(k),q=()=>{throw new Error("Cursor not started")},C=()=>{throw new Error("Cursor not stopped")};k.trans=x,k.stop=k.continue=k.continuePrimaryKey=k.advance=q,k.fail=le(y),k.next=function(){let S=1;return this.start(()=>S--?this.continue():this.stop()).then(()=>this)},k.start=S=>{let I=new Promise((X,P)=>{X=le(X),O.onerror=nt(P),k.fail=P,k.stop=re=>{k.stop=k.continue=k.continuePrimaryKey=k.advance=C,X(re)}}),N=()=>{if(O.result)try{S()}catch(X){k.fail(X)}else k.done=!0,k.start=()=>{throw new Error("Cursor behind last entry")},k.stop()};return O.onsuccess=le(X=>{O.onsuccess=N,N()}),k.continue=z,k.continuePrimaryKey=J,k.advance=Y,N(),I},g(k)},y)})}function w(x){return v=>new Promise((d,b)=>{d=le(d);let{trans:m,values:g,limit:y,query:_}=v,j=y===1/0?void 0:y,{index:A,range:F}=_,E=m.objectStore(p),O=A.isPrimaryKey?E:E.index(A.name),L=i(F);if(y===0)return d({result:[]});if(x){let k=g?O.getAll(L,j):O.getAllKeys(L,j);k.onsuccess=z=>d({result:z.target.result}),k.onerror=nt(b)}else{let k=0,z=g||!("openKeyCursor"in O)?O.openCursor(L):O.openKeyCursor(L),J=[];z.onsuccess=Y=>{let q=z.result;if(!q)return d({result:J});if(J.push(g?q.value:q.primaryKey),++k===y)return d({result:J});q.continue()},z.onerror=nt(b)}})}return{name:p,schema:f,mutate:c,getMany({trans:x,keys:v}){return new Promise((d,b)=>{d=le(d);let m=x.objectStore(p),g=v.length,y=new Array(g),_=0,j=0,A,F=O=>{let L=O.target;(y[L._pos]=L.result)!=null,++j===_&&d(y)},E=nt(b);for(let O=0;O<g;++O)v[O]!=null&&(A=m.get(v[O]),A._pos=O,A.onsuccess=F,A.onerror=E,++_);_===0&&d(y)})},get({trans:x,key:v}){return new Promise((d,b)=>{d=le(d);let g=x.objectStore(p).get(v);g.onsuccess=y=>d(y.target.result),g.onerror=nt(b)})},query:w(a),openCursor:h,count({query:x,trans:v}){let{index:d,range:b}=x;return new Promise((m,g)=>{let y=v.objectStore(p),_=d.isPrimaryKey?y:y.index(d.name),j=i(b),A=j?_.count(j):_.count();A.onsuccess=le(F=>m(F.target.result)),A.onerror=nt(g)})}}}let{schema:s,hasGetAll:a}=n(t,r),u=s.tables.map(f=>o(f)),l={};return u.forEach(f=>l[f.name]=f),{stack:"dbcore",transaction:t.transaction.bind(t),table(f){if(!l[f])throw new Error(`Table '${f}' not found`);return l[f]},MIN_KEY:-1/0,MAX_KEY:xn(e),schema:s}}function ip(t,e){return e.reduce((r,{create:n})=>pe(pe({},r),n(r)),t)}function op(t,e,{IDBKeyRange:r,indexedDB:n},i){return{dbcore:ip(np(e,r,i),t.dbcore)}}function Go({_novip:t},e){let r=e.db,n=op(t._middlewares,r,t._deps,e);t.core=n.dbcore,t.tables.forEach(i=>{let o=i.name;t.core.schema.tables.some(s=>s.name===o)&&(i.core=t.core.table(o),t[o]instanceof t.Table&&(t[o].core=i.core))})}function ui({_novip:t},e,r,n){r.forEach(i=>{let o=n[i];e.forEach(s=>{let a=go(s,i);(!a||"value"in a&&a.value===void 0)&&(s===t.Transaction.prototype||s instanceof t.Transaction?ut(s,i,{get(){return this.table(i)},set(u){na(this,i,{value:u,writable:!0,configurable:!0,enumerable:!0})}}):s[i]=new t.Table(i,o))})})}function Qo({_novip:t},e){e.forEach(r=>{for(let n in r)r[n]instanceof t.Table&&delete r[n]})}function sp(t,e){return t._cfg.version-e._cfg.version}function ap(t,e,r,n){let i=t._dbSchema,o=t._createTransaction("readwrite",t._storeNames,i);o.create(r),o._completion.catch(n);let s=o._reject.bind(o),a=K.transless||K;Ct(()=>{K.trans=o,K.transless=a,e===0?(ge(i).forEach(u=>{qo(r,u,i[u].primKey,i[u].indexes)}),Go(t,r),R.follow(()=>t.on.populate.fire(o)).catch(s)):lp(t,e,o,r).catch(s)})}function lp({_novip:t},e,r,n){let i=[],o=t._versions,s=t._dbSchema=Jo(t,t.idbdb,n),a=!1;o.filter(f=>f._cfg.version>=e).forEach(f=>{i.push(()=>{let p=s,c=f._cfg.dbschema;Xo(t,p,n),Xo(t,c,n),s=t._dbSchema=c;let h=Va(p,c);h.add.forEach(x=>{qo(n,x[0],x[1].primKey,x[1].indexes)}),h.change.forEach(x=>{if(x.recreate)throw new V.Upgrade("Not yet support for changing primary key");{let v=n.objectStore(x.name);x.add.forEach(d=>Yo(v,d)),x.change.forEach(d=>{v.deleteIndex(d.name),Yo(v,d)}),x.del.forEach(d=>v.deleteIndex(d))}});let w=f._cfg.contentUpgrade;if(w&&f._cfg.version>e){Go(t,n),r._memoizedTables={},a=!0;let x=aa(c);h.del.forEach(m=>{x[m]=p[m]}),Qo(t,[t.Transaction.prototype]),ui(t,[t.Transaction.prototype],ge(x),x),r.schema=x;let v=bo(w);v&&Ar();let d,b=R.follow(()=>{if(d=w(r),d&&v){var m=dt.bind(null,null);d.then(m,m)}});return d&&typeof d.then=="function"?R.resolve(d):b.then(()=>d)}}),i.push(p=>{if(!a||!Kd){let c=f._cfg.dbschema;cp(c,p)}Qo(t,[t.Transaction.prototype]),ui(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),r.schema=t._dbSchema})});function l(){return i.length?R.resolve(i.shift()(r.idbtrans)).then(l):R.resolve()}return l().then(()=>{up(s,n)})}function Va(t,e){let r={del:[],add:[],change:[]},n;for(n in t)e[n]||r.del.push(n);for(n in e){let i=t[n],o=e[n];if(!i)r.add.push([n,o]);else{let s={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!ni)s.recreate=!0,r.change.push(s);else{let a=i.idxByName,u=o.idxByName,l;for(l in a)u[l]||s.del.push(l);for(l in u){let f=a[l],p=u[l];f?f.src!==p.src&&s.change.push(p):s.add.push(p)}(s.del.length>0||s.add.length>0||s.change.length>0)&&r.change.push(s)}}}return r}function qo(t,e,r,n){let i=t.db.createObjectStore(e,r.keyPath?{keyPath:r.keyPath,autoIncrement:r.auto}:{autoIncrement:r.auto});return n.forEach(o=>Yo(i,o)),i}function up(t,e){ge(t).forEach(r=>{e.db.objectStoreNames.contains(r)||qo(e,r,t[r].primKey,t[r].indexes)})}function cp(t,e){[].slice.call(e.db.objectStoreNames).forEach(r=>t[r]==null&&e.db.deleteObjectStore(r))}function Yo(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function Jo(t,e,r){let n={};return Hn(e.objectStoreNames,0).forEach(o=>{let s=r.objectStore(o),a=s.keyPath,u=Wo(Na(a),a||"",!1,!1,!!s.autoIncrement,a&&typeof a!="string",!0),l=[];for(let p=0;p<s.indexNames.length;++p){let c=s.index(s.indexNames[p]);a=c.keyPath;var f=Wo(c.name,a,!!c.unique,!!c.multiEntry,!1,a&&typeof a!="string",!1);l.push(f)}n[o]=Ka(o,u,l)}),n}function fp({_novip:t},e,r){t.verno=e.version/10;let n=t._dbSchema=Jo(t,e,r);t._storeNames=Hn(e.objectStoreNames,0),ui(t,[t._allTables],ge(n),n)}function dp(t,e){let r=Jo(t,t.idbdb,e),n=Va(r,t._dbSchema);return!(n.add.length||n.change.some(i=>i.add.length||i.change.length))}function Xo({_novip:t},e,r){let n=r.db.objectStoreNames;for(let i=0;i<n.length;++i){let o=n[i],s=r.objectStore(o);t._hasGetAll="getAll"in s;for(let a=0;a<s.indexNames.length;++a){let u=s.indexNames[a],l=s.index(u).keyPath,f=typeof l=="string"?l:"["+Hn(l).join("+")+"]";if(e[o]){let p=e[o].idxByName[f];p&&(p.name=u,delete e[o].idxByName[f],e[o].idxByName[u]=p)}}}typeof navigator!="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&se.WorkerGlobalScope&&se instanceof se.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}function pp(t){return t.split(",").map((e,r)=>{e=e.trim();let n=e.replace(/([&*]|\+\+)/g,""),i=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return Wo(n,i||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),ke(i),r===0)})}var Ha=class{_parseStoresSpec(e,r){ge(e).forEach(n=>{if(e[n]!==null){var i=pp(e[n]),o=i.shift();if(o.multi)throw new V.Schema("Primary key cannot be multi-valued");i.forEach(s=>{if(s.auto)throw new V.Schema("Only primary key can be marked as autoIncrement (++)");if(!s.keyPath)throw new V.Schema("Index must have a name and cannot be an empty string")}),r[n]=Ka(n,o,i)}})}stores(e){let r=this.db;this._cfg.storesSource=this._cfg.storesSource?Le(this._cfg.storesSource,e):e;let n=r._versions,i={},o={};return n.forEach(s=>{Le(i,s._cfg.storesSource),o=s._cfg.dbschema={},s._parseStoresSpec(i,o)}),r._dbSchema=o,Qo(r,[r._allTables,r,r.Transaction.prototype]),ui(r,[r._allTables,r,r.Transaction.prototype,this._cfg.tables],ge(o),o),r._storeNames=ge(o),this}upgrade(e){return this._cfg.contentUpgrade=Ao(this._cfg.contentUpgrade||ie,e),this}};function hp(t){return _n(Ha.prototype,function(r){this.db=t,this._cfg={version:r,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function Zo(t,e){let r=t._dbNamesDB;return r||(r=t._dbNamesDB=new mt(ii,{addons:[],indexedDB:t,IDBKeyRange:e}),r.version(1).stores({dbnames:"name"})),r.table("dbnames")}function es(t){return t&&typeof t.databases=="function"}function mp({indexedDB:t,IDBKeyRange:e}){return es(t)?Promise.resolve(t.databases()).then(r=>r.map(n=>n.name).filter(n=>n!==ii)):Zo(t,e).toCollection().primaryKeys()}function gp({indexedDB:t,IDBKeyRange:e},r){!es(t)&&r!==ii&&Zo(t,e).put({name:r}).catch(ie)}function yp({indexedDB:t,IDBKeyRange:e},r){!es(t)&&r!==ii&&Zo(t,e).delete(r).catch(ie)}function ts(t){return Ct(function(){return K.letThrough=!0,t()})}function _p(){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 vp(t){let e=t._state,{indexedDB:r}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then(()=>e.dbOpenError?be(e.dbOpenError):t);rt&&(e.openCanceller._stackHolder=Qt()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;let n=e.openCanceller;function i(){if(e.openCanceller!==n)throw new V.DatabaseClosed("db.open() was cancelled")}let o=e.dbReadyResolve,s=null,a=!1;return R.race([n,(typeof navigator=="undefined"?R.resolve():_p()).then(()=>new R((u,l)=>{if(i(),!r)throw new V.MissingAPI;let f=t.name,p=e.autoSchema?r.open(f):r.open(f,Math.round(t.verno*10));if(!p)throw new V.MissingAPI;p.onerror=nt(l),p.onblocked=le(t._fireOnBlocked),p.onupgradeneeded=le(c=>{if(s=p.transaction,e.autoSchema&&!t._options.allowEmptyDB){p.onerror=vn,s.abort(),p.result.close();let w=r.deleteDatabase(f);w.onsuccess=w.onerror=le(()=>{l(new V.NoSuchDatabase(`Database ${f} doesnt exist`))})}else{s.onerror=nt(l);var h=c.oldVersion>Math.pow(2,62)?0:c.oldVersion;a=h<1,t._novip.idbdb=p.result,ap(t,h/10,s,l)}},l),p.onsuccess=le(()=>{s=null;let c=t._novip.idbdb=p.result,h=Hn(c.objectStoreNames);if(h.length>0)try{let w=c.transaction(ep(h),"readonly");e.autoSchema?fp(t,c,w):(Xo(t,t._dbSchema,w),dp(t,w)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),Go(t,w)}catch{}gn.push(t),c.onversionchange=le(w=>{e.vcFired=!0,t.on("versionchange").fire(w)}),c.onclose=le(w=>{t.on("close").fire(w)}),a&&gp(t._deps,f),u()},l)}))]).then(()=>(i(),e.onReadyBeingFired=[],R.resolve(ts(()=>t.on.ready.fire(t.vip))).then(function u(){if(e.onReadyBeingFired.length>0){let l=e.onReadyBeingFired.reduce(Ao,ie);return e.onReadyBeingFired=[],R.resolve(ts(()=>l(t.vip))).then(u)}}))).finally(()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1}).then(()=>t).catch(u=>{e.dbOpenError=u;try{s&&s.abort()}catch{}return n===e.openCanceller&&t._close(),be(u)}).finally(()=>{e.openComplete=!0,o()})}function rs(t){var e=s=>t.next(s),r=s=>t.throw(s),n=o(e),i=o(r);function o(s){return a=>{var u=s(a),l=u.value;return u.done?l:!l||typeof l.then!="function"?ke(l)?Promise.all(l).then(n,i):n(l):l.then(n,i)}}return o(e)()}function bp(t,e,r){var n=arguments.length;if(n<2)throw new V.InvalidArgument("Too few arguments");for(var i=new Array(n-1);--n;)i[n-1]=arguments[n];r=i.pop();var o=la(i);return[t,o,r]}function $a(t,e,r,n,i){return R.resolve().then(()=>{let o=K.transless||K,s=t._createTransaction(e,r,t._dbSchema,n),a={trans:s,transless:o};if(n)s.idbtrans=n.idbtrans;else try{s.create(),t._state.PR1398_maxLoop=3}catch(p){return p.name===jo.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>$a(t,e,r,null,i))):be(p)}let u=bo(i);u&&Ar();let l,f=R.follow(()=>{if(l=i.call(s,s),l)if(u){var p=dt.bind(null,null);l.then(p,p)}else typeof l.next=="function"&&typeof l.throw=="function"&&(l=rs(l))},a);return(l&&typeof l.then=="function"?R.resolve(l).then(p=>s.active?p:be(new V.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):f.then(()=>l)).then(p=>(n&&s._resolve(),s._completion.then(()=>p))).catch(p=>(s._reject(p),be(p)))})}function ci(t,e,r){let n=ke(t)?t.slice():[t];for(let i=0;i<r;++i)n.push(e);return n}function xp(t){return Me(pe({},t),{table(e){let r=t.table(e),{schema:n}=r,i={},o=[];function s(c,h,w){let x=wn(c),v=i[x]=i[x]||[],d=c==null?0:typeof c=="string"?1:c.length,b=h>0,m=Me(pe({},w),{isVirtual:b,keyTail:h,keyLength:d,extractKey:Uo(c),unique:!b&&w.unique});if(v.push(m),m.isPrimaryKey||o.push(m),d>1){let g=d===2?c[0]:c.slice(0,d-1);s(g,h+1,w)}return v.sort((g,y)=>g.keyTail-y.keyTail),m}let a=s(n.primaryKey.keyPath,0,n.primaryKey);i[":id"]=[a];for(let c of n.indexes)s(c.keyPath,0,c);function u(c){let h=i[wn(c)];return h&&h[0]}function l(c,h){return{type:c.type===1?2:c.type,lower:ci(c.lower,c.lowerOpen?t.MAX_KEY:t.MIN_KEY,h),lowerOpen:!0,upper:ci(c.upper,c.upperOpen?t.MIN_KEY:t.MAX_KEY,h),upperOpen:!0}}function f(c){let h=c.query.index;return h.isVirtual?Me(pe({},c),{query:{index:h,range:l(c.query.range,h.keyTail)}}):c}return Me(pe({},r),{schema:Me(pe({},n),{primaryKey:a,indexes:o,getIndexByKeyPath:u}),count(c){return r.count(f(c))},query(c){return r.query(f(c))},openCursor(c){let{keyTail:h,isVirtual:w,keyLength:x}=c.query.index;if(!w)return r.openCursor(c);function v(d){function b(g){g!=null?d.continue(ci(g,c.reverse?t.MAX_KEY:t.MIN_KEY,h)):c.unique?d.continue(d.key.slice(0,x).concat(c.reverse?t.MIN_KEY:t.MAX_KEY,h)):d.continue()}return Object.create(d,{continue:{value:b},continuePrimaryKey:{value(g,y){d.continuePrimaryKey(ci(g,t.MAX_KEY,h),y)}},primaryKey:{get(){return d.primaryKey}},key:{get(){let g=d.key;return x===1?g[0]:g.slice(0,x)}},value:{get(){return d.value}}})}return r.openCursor(f(c)).then(d=>d&&v(d))}})}})}var wp={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:xp};function ns(t,e,r,n){return r=r||{},n=n||"",ge(t).forEach(i=>{if(!qe(e,i))r[n+i]=void 0;else{var o=t[i],s=e[i];if(typeof o=="object"&&typeof s=="object"&&o&&s){let a=_o(o),u=_o(s);a!==u?r[n+i]=e[i]:a==="Object"?ns(o,s,r,n+i+"."):o!==s&&(r[n+i]=e[i])}else o!==s&&(r[n+i]=e[i])}}),ge(e).forEach(i=>{qe(t,i)||(r[n+i]=e[i])}),r}function jp(t,e){return e.type==="delete"?e.keys:e.keys||e.values.map(t.extractKey)}var Ap={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>Me(pe({},t),{table(e){let r=t.table(e),{primaryKey:n}=r.schema;return Me(pe({},r),{mutate(o){let s=K.trans,{deleting:a,creating:u,updating:l}=s.table(e).hook;switch(o.type){case"add":if(u.fire===ie)break;return s._promise("readwrite",()=>f(o),!0);case"put":if(u.fire===ie&&l.fire===ie)break;return s._promise("readwrite",()=>f(o),!0);case"delete":if(a.fire===ie)break;return s._promise("readwrite",()=>f(o),!0);case"deleteRange":if(a.fire===ie)break;return s._promise("readwrite",()=>p(o),!0)}return r.mutate(o);function f(h){let w=K.trans,x=h.keys||jp(n,h);if(!x)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?Me(pe({},h),{keys:x}):pe({},h),h.type!=="delete"&&(h.values=[...h.values]),h.keys&&(h.keys=[...h.keys]),Cp(r,h,x).then(v=>{let d=x.map((b,m)=>{let g=v[m],y={onerror:null,onsuccess:null};if(h.type==="delete")a.fire.call(y,b,g,w);else if(h.type==="add"||g===void 0){let _=u.fire.call(y,b,h.values[m],w);b==null&&_!=null&&(b=_,h.keys[m]=b,n.outbound||et(h.values[m],n.keyPath,b))}else{let _=ns(g,h.values[m]),j=l.fire.call(y,_,b,g,w);if(j){let A=h.values[m];Object.keys(j).forEach(F=>{qe(A,F)?A[F]=j[F]:et(A,F,j[F])})}}return y});return r.mutate(h).then(({failures:b,results:m,numFailures:g,lastResult:y})=>{for(let _=0;_<x.length;++_){let j=m?m[_]:x[_],A=d[_];j==null?A.onerror&&A.onerror(b[_]):A.onsuccess&&A.onsuccess(h.type==="put"&&v[_]?h.values[_]:j)}return{failures:b,results:m,numFailures:g,lastResult:y}}).catch(b=>(d.forEach(m=>m.onerror&&m.onerror(b)),Promise.reject(b)))})}function p(h){return c(h.trans,h.range,1e4)}function c(h,w,x){return r.query({trans:h,values:!1,query:{index:n,range:w},limit:x}).then(({result:v})=>f({type:"delete",keys:v,trans:h}).then(d=>d.numFailures>0?Promise.reject(d.failures[0]):v.length<x?{failures:[],numFailures:0,lastResult:void 0}:c(h,Me(pe({},w),{lower:v[v.length-1],lowerOpen:!0}),x)))}}})}})};function Cp(t,e,r){return e.type==="add"?Promise.resolve([]):t.getMany({trans:e.trans,keys:r,cache:"immutable"})}function Wa(t,e,r){try{if(!e||e.keys.length<t.length)return null;let n=[];for(let i=0,o=0;i<e.keys.length&&o<t.length;++i)Be(e.keys[i],t[o])===0&&(n.push(r?ln(e.values[i]):e.values[i]),++o);return n.length===t.length?n:null}catch{return null}}var Sp={stack:"dbcore",level:-1,create:t=>({table:e=>{let r=t.table(e);return Me(pe({},r),{getMany:n=>{if(!n.cache)return r.getMany(n);let i=Wa(n.keys,n.trans._cache,n.cache==="clone");return i?R.resolve(i):r.getMany(n).then(o=>(n.trans._cache={keys:n.keys,values:n.cache==="clone"?ln(o):o},o))},mutate:n=>(n.type!=="add"&&(n.trans._cache=null),r.mutate(n))})}})};function is(t){return!("from"in t)}var ht=function(t,e){if(this)Le(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0});else{let r=new ht;return t&&"d"in t&&Le(r,t),r}};vr(ht.prototype,{add(t){return fi(this,t),this},addKey(t){return jn(this,t,t),this},addKeys(t){return t.forEach(e=>jn(this,e,e)),this},[vo](){return os(this)}});function jn(t,e,r){let n=Be(e,r);if(isNaN(n))return;if(n>0)throw RangeError();if(is(t))return Le(t,{from:e,to:r,d:1});let i=t.l,o=t.r;if(Be(r,t.from)<0)return i?jn(i,e,r):t.l={from:e,to:r,d:1,l:null,r:null},Ua(t);if(Be(e,t.to)>0)return o?jn(o,e,r):t.r={from:e,to:r,d:1,l:null,r:null},Ua(t);Be(e,t.from)<0&&(t.from=e,t.l=null,t.d=o?o.d+1:1),Be(r,t.to)>0&&(t.to=r,t.r=null,t.d=t.l?t.l.d+1:1);let s=!t.r;i&&!t.l&&fi(t,i),o&&s&&fi(t,o)}function fi(t,e){function r(n,{from:i,to:o,l:s,r:a}){jn(n,i,o),s&&r(n,s),a&&r(n,a)}is(e)||r(t,e)}function Fp(t,e){let r=os(e),n=r.next();if(n.done)return!1;let i=n.value,o=os(t),s=o.next(i.from),a=s.value;for(;!n.done&&!s.done;){if(Be(a.from,i.to)<=0&&Be(a.to,i.from)>=0)return!0;Be(i.from,a.from)<0?i=(n=r.next(a.from)).value:a=(s=o.next(i.from)).value}return!1}function os(t){let e=is(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&&Be(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||Be(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 Ua(t){var e,r;let n=(((e=t.r)===null||e===void 0?void 0:e.d)||0)-(((r=t.l)===null||r===void 0?void 0:r.d)||0),i=n>1?"r":n<-1?"l":"";if(i){let o=i==="r"?"l":"r",s=pe({},t),a=t[i];t.from=a.from,t.to=a.to,t[i]=a[i],s[i]=a[o],t[o]=s,s.d=Ga(s)}t.d=Ga(t)}function Ga({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}var Ep={stack:"dbcore",level:0,create:t=>{let e=t.schema.name,r=new ht(t.MIN_KEY,t.MAX_KEY);return Me(pe({},t),{table:n=>{let i=t.table(n),{schema:o}=i,{primaryKey:s}=o,{extractKey:a,outbound:u}=s,l=Me(pe({},i),{mutate:c=>{let h=c.trans,w=h.mutatedParts||(h.mutatedParts={}),x=_=>{let j=`idb://${e}/${n}/${_}`;return w[j]||(w[j]=new ht)},v=x(""),d=x(":dels"),{type:b}=c,[m,g]=c.type==="deleteRange"?[c.range]:c.type==="delete"?[c.keys]:c.values.length<50?[[],c.values]:[],y=c.trans._cache;return i.mutate(c).then(_=>{if(ke(m)){b!=="delete"&&(m=_.results),v.addKeys(m);let j=Wa(m,y);!j&&b!=="add"&&d.addKeys(m),(j||g)&&Tp(x,o,j,g)}else if(m){let j={from:m.lower,to:m.upper};d.add(j),v.add(j)}else v.add(r),d.add(r),o.indexes.forEach(j=>x(j.name).add(r));return _})}}),f=({query:{index:c,range:h}})=>{var w,x;return[c,new ht((w=h.lower)!==null&&w!==void 0?w:t.MIN_KEY,(x=h.upper)!==null&&x!==void 0?x:t.MAX_KEY)]},p={get:c=>[s,new ht(c.key)],getMany:c=>[s,new ht().addKeys(c.keys)],count:f,query:f,openCursor:f};return ge(p).forEach(c=>{l[c]=function(h){let{subscr:w}=K;if(w){let x=g=>{let y=`idb://${e}/${n}/${g}`;return w[y]||(w[y]=new ht)},v=x(""),d=x(":dels"),[b,m]=p[c](h);if(x(b.name||"").add(m),!b.isPrimaryKey)if(c==="count")d.add(r);else{let g=c==="query"&&u&&h.values&&i.query(Me(pe({},h),{values:!1}));return i[c].apply(this,arguments).then(y=>{if(c==="query"){if(u&&h.values)return g.then(({result:j})=>(v.addKeys(j),y));let _=h.values?y.result.map(a):y.result;h.values?v.addKeys(_):d.addKeys(_)}else if(c==="openCursor"){let _=y,j=h.values;return _&&Object.create(_,{key:{get(){return d.addKey(_.primaryKey),_.key}},primaryKey:{get(){let A=_.primaryKey;return d.addKey(A),A}},value:{get(){return j&&v.addKey(_.primaryKey),_.value}}})}return y})}}return i[c].apply(this,arguments)}}),l}})}};function Tp(t,e,r,n){function i(o){let s=t(o.name||"");function a(l){return l!=null?o.extractKey(l):null}let u=l=>o.multiEntry&&ke(l)?l.forEach(f=>s.addKey(f)):s.addKey(l);(r||n).forEach((l,f)=>{let p=r&&a(r[f]),c=n&&a(n[f]);Be(p,c)!==0&&(p!=null&&u(p),c!=null&&u(c))})}e.indexes.forEach(i)}var mt=class{constructor(e,r){this._middlewares={},this.verno=0;let n=mt.dependencies;this._options=r=pe({addons:mt.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange},r),this._deps={indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange};let{addons:i}=r;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;let o={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ie,dbReadyPromise:null,cancelOpen:ie,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};o.dbReadyPromise=new R(s=>{o.dbReadyResolve=s}),o.openCanceller=new R((s,a)=>{o.cancelOpen=a}),this._state=o,this.name=e,this.on=yn(this,"populate","blocked","versionchange","close",{ready:[Ao,ie]}),this.on.ready.subscribe=ia(this.on.ready.subscribe,s=>(a,u)=>{mt.vip(()=>{let l=this._state;if(l.openComplete)l.dbOpenError||R.resolve().then(a),u&&s(a);else if(l.onReadyBeingFired)l.onReadyBeingFired.push(a),u&&s(a);else{s(a);let f=this;u||s(function p(){f.on.ready.unsubscribe(a),f.on.ready.unsubscribe(p)})}})}),this.Collection=Ud(this),this.Table=Vd(this),this.Transaction=Zd(this),this.Version=hp(this),this.WhereClause=Xd(this),this.on("versionchange",s=>{s.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()}),this.on("blocked",s=>{!s.newVersion||s.newVersion<s.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${s.oldVersion/10}`)}),this._maxKey=xn(r.IDBKeyRange),this._createTransaction=(s,a,u,l)=>new this.Transaction(s,a,u,this._options.chromeTransactionDurability,l),this._fireOnBlocked=s=>{this.on("blocked").fire(s),gn.filter(a=>a.name===this.name&&a!==this&&!a._state.vcFired).map(a=>a.on("versionchange").fire(s))},this.use(wp),this.use(Ap),this.use(Ep),this.use(Sp),this.vip=Object.create(this,{_vip:{value:!0}}),i.forEach(s=>s(this))}version(e){if(isNaN(e)||e<.1)throw new V.Type("Given version is not a positive number");if(e=Math.round(e*10)/10,this.idbdb||this._state.isBeingOpened)throw new V.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);let r=this._versions;var n=r.filter(i=>i._cfg.version===e)[0];return n||(n=new this.Version(e),r.push(n),r.sort(sp),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||K.letThrough||this._vip)?e():new R((r,n)=>{if(this._state.openComplete)return n(new V.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen){n(new V.DatabaseClosed);return}this.open().catch(ie)}this._state.dbReadyPromise.then(r,n)}).then(e)}use({stack:e,create:r,level:n,name:i}){i&&this.unuse({stack:e,name:i});let o=this._middlewares[e]||(this._middlewares[e]=[]);return o.push({stack:e,create:r,level:n??10,name:i}),o.sort((s,a)=>s.level-a.level),this}unuse({stack:e,name:r,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter(i=>n?i.create!==n:r?i.name!==r:!1)),this}open(){return vp(this)}_close(){let e=this._state,r=gn.indexOf(this);if(r>=0&&gn.splice(r,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}e.dbReadyPromise=new R(n=>{e.dbReadyResolve=n}),e.openCanceller=new R((n,i)=>{e.cancelOpen=i})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new V.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,r=this._state;return new R((n,i)=>{let o=()=>{this.close();var s=this._deps.indexedDB.deleteDatabase(this.name);s.onsuccess=le(()=>{yp(this._deps,this.name),n()}),s.onerror=nt(i),s.onblocked=this._fireOnBlocked};if(e)throw new V.InvalidArgument("Arguments not allowed in db.delete()");r.isBeingOpened?r.dbReadyPromise.then(o):o()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){let e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return ge(this._allTables).map(e=>this._allTables[e])}transaction(){let e=bp.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,r,n){let i=K.trans;(!i||i.db!==this||e.indexOf("!")!==-1)&&(i=null);let o=e.indexOf("?")!==-1;e=e.replace("!","").replace("?","");let s,a;try{if(a=r.map(l=>{var f=l instanceof this.Table?l.name:l;if(typeof f!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return f}),e=="r"||e===No)s=No;else if(e=="rw"||e==Ko)s=Ko;else throw new V.InvalidArgument("Invalid transaction mode: "+e);if(i){if(i.mode===No&&s===Ko)if(o)i=null;else throw new V.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i&&a.forEach(l=>{if(i&&i.storeNames.indexOf(l)===-1)if(o)i=null;else throw new V.SubTransaction("Table "+l+" not included in parent transaction.")}),o&&i&&!i.active&&(i=null)}}catch(l){return i?i._promise(null,(f,p)=>{p(l)}):be(l)}let u=$a.bind(null,this,s,a,i,n);return i?i._promise(s,u,"lock"):K.trans?Cr(K.transless,()=>this._whenReady(u)):this._whenReady(u)}table(e){if(!qe(this._allTables,e))throw new V.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}},Dp=typeof Symbol!="undefined"&&"observable"in Symbol?Symbol.observable:"@@observable",Qa=class{constructor(e){this._subscribe=e}subscribe(e,r,n){return this._subscribe(!e||typeof e=="function"?{next:e,error:r,complete:n}:e)}[Dp](){return this}};function qa(t,e){return ge(e).forEach(r=>{let n=t[r]||(t[r]=new ht);fi(n,e[r])}),t}function Ip(t){return new Qa(e=>{let r=bo(t);function n(h){r&&Ar();let w=()=>Ct(t,{subscr:h,trans:null}),x=K.trans?Cr(K.transless,w):w();return r&&x.then(dt,dt),x}let i=!1,o={},s={},a={get closed(){return i},unsubscribe:()=>{i=!0,Tt.storagemutated.unsubscribe(p)}};e.start&&e.start(a);let u=!1,l=!1;function f(){return ge(s).some(h=>o[h]&&Fp(o[h],s[h]))}let p=h=>{qa(o,h),f()&&c()},c=()=>{if(u||i)return;o={};let h={},w=n(h);l||(Tt(bn,p),l=!0),u=!0,Promise.resolve(w).then(x=>{u=!1,!i&&(f()?c():(o={},s=h,e.next&&e.next(x)))},x=>{u=!1,e.error&&e.error(x),a.unsubscribe()})};return c(),a})}var ss;try{ss={indexedDB:se.indexedDB||se.mozIndexedDB||se.webkitIndexedDB||se.msIndexedDB,IDBKeyRange:se.IDBKeyRange||se.webkitIDBKeyRange}}catch{ss={indexedDB:null,IDBKeyRange:null}}var er=mt;vr(er,Me(pe({},Wn),{delete(t){return new er(t,{addons:[]}).delete()},exists(t){return new er(t,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1)},getDatabaseNames(t){try{return mp(er.dependencies).then(t)}catch{return be(new V.MissingAPI)}},defineClass(){function t(e){Le(this,e)}return t},ignoreTransaction(t){return K.trans?Cr(K.transless,t):t()},vip:ts,async:function(t){return function(){try{var e=rs(t.apply(this,arguments));return!e||typeof e.then!="function"?R.resolve(e):e}catch(r){return be(r)}}},spawn:function(t,e,r){try{var n=rs(t.apply(r,e||[]));return!n||typeof n.then!="function"?R.resolve(n):n}catch(i){return be(i)}},currentTransaction:{get:()=>K.trans||null},waitFor:function(t,e){let r=R.resolve(typeof t=="function"?er.ignoreTransaction(t):t).timeout(e||6e4);return K.trans?K.trans.waitFor(r):r},Promise:R,debug:{get:()=>rt,set:t=>{ca(t,t==="dexie"?()=>!0:Ta)}},derive:br,extend:Le,props:vr,override:ia,Events:yn,on:Tt,liveQuery:Ip,extendObservabilitySet:qa,getByKeyPath:ct,setByKeyPath:et,delByKeyPath:hd,shallowClone:aa,deepClone:ln,getObjectDiff:ns,cmp:Be,asap:oa,minKey:Bo,addons:[],connections:gn,errnames:jo,dependencies:ss,semVer:Fa,version:Fa.split(".").map(t=>parseInt(t)).reduce((t,e,r)=>t+e/Math.pow(10,r*2))}));er.maxKey=xn(er.dependencies.IDBKeyRange);typeof dispatchEvent!="undefined"&&typeof addEventListener!="undefined"&&(Tt(bn,t=>{if(!gt){let e;ni?(e=document.createEvent("CustomEvent"),e.initCustomEvent(Et,!0,!0,t)):e=new CustomEvent(Et,{detail:t}),gt=!0,dispatchEvent(e),gt=!1}}),addEventListener(Et,({detail:t})=>{gt||di(t)}));function di(t){let e=gt;try{gt=!0,Tt.storagemutated.fire(t)}finally{gt=e}}var gt=!1;if(typeof BroadcastChannel!="undefined"){let t=new BroadcastChannel(Et);Tt(bn,e=>{gt||t.postMessage(e)}),t.onmessage=e=>{e.data&&di(e.data)}}else if(typeof self!="undefined"&&typeof navigator!="undefined"){Tt(bn,e=>{try{gt||(typeof localStorage!="undefined"&&localStorage.setItem(Et,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(r=>r.postMessage({type:Et,changedParts:e})))}catch{}}),typeof addEventListener!="undefined"&&addEventListener("storage",e=>{if(e.key===Et){let r=JSON.parse(e.newValue);r&&di(r.changedParts)}});let t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",Op)}function Op({data:t}){t&&t.type===Et&&di(t.changedParts)}R.rejectionMapper=jd;ca(rt,Ta);var Ya=je(require("obsidian")),it=class extends mt{constructor(){super(it.dbName);this.version(it.dbVersion).stores({searchHistory:"++id",minisearch:"date"})}static async clearOldDatabases(){let e=(await indexedDB.databases()).filter(r=>r.name===it.dbName&&r.version!==it.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 it.instance||(it.instance=new it),it.instance}async clearCache(){new Ya.Notice("Omnisearch - Cache cleared. Please restart Obsidian."),await this.minisearch.clear()}},Er=it;Er.dbVersion=8,Er.dbName="omnisearch/cache/"+app.appId;var Se=Er.getInstance();var tr=Vn(!1),pi='<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>',as=class extends G.PluginSettingTab{constructor(e){super(app,e);this.plugin=e,tr.subscribe(async r=>{T.showExcerpt=r,await ce(this.plugin)})}display(){let{containerEl:e}=this;if(e.empty(),app.loadLocalStorage(An)=="1"){let c=e.createEl("span");c.innerHTML='<strong style="color: var(--text-accent)">\u26A0\uFE0F OMNISEARCH IS DISABLED \u26A0\uFE0F</strong>'}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>
`;let n=new DocumentFragment;n.createSpan({},c=>{c.innerHTML='\u26A0\uFE0F <span style="color: var(--text-accent)">Changing indexing settings will clear the cache, and requires a restart of Obsidian.</span><br/><br/>',ot()?c.innerHTML+=`
\u{1F44D} You have installed <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a>, Omnisearch can use it to index PDFs and images contents.
<br />Text extraction only works on desktop, but the cache can be synchronized with your mobile device.`: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).setName("Indexing").setHeading().setDesc(n);let i=new DocumentFragment;i.createSpan({},c=>{c.innerHTML="Omnisearch will use Text Extractor to index the content of your PDFs"}),new G.Setting(e).setName(`PDFs content indexing ${ot()?"":"\u26A0\uFE0F Disabled"}`).setDesc(i).addToggle(c=>c.setValue(T.PDFIndexing).onChange(async h=>{await Se.clearCache(),T.PDFIndexing=h,await ce(this.plugin)})).setDisabled(!ot());let o=new DocumentFragment;o.createSpan({},c=>{c.innerHTML="Omnisearch will use Text Extractor to OCR your images and index their content"}),new G.Setting(e).setName(`Images OCR indexing ${ot()?"":"\u26A0\uFE0F Disabled"}`).setDesc(o).addToggle(c=>c.setValue(T.imagesIndexing).onChange(async h=>{await Se.clearCache(),T.imagesIndexing=h,await ce(this.plugin)})).setDisabled(!ot());let s=new DocumentFragment;s.createSpan({},c=>{c.innerHTML=`
Omnisearch can index file<strong>names</strong> of "unsupported" files, such as e.g. <pre style="display:inline">.mp4</pre>, <pre style="display:inline">.xlsx</pre>,
or non-extracted PDFs & images.<br/>
"Obsidian setting" will respect the value of "Files & Links > Detect all file extensions"`}),new G.Setting(e).setName("Index paths of unsupported files").setDesc(s).addDropdown(c=>{c.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(T.unsupportedFilesIndexing).onChange(async h=>{await Se.clearCache(),T.unsupportedFilesIndexing=h,await ce(this.plugin)})});let a=new DocumentFragment;a.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 csv</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>`}),new G.Setting(e).setName("Additional TEXT files to index").setDesc(a).addText(c=>{c.setValue(T.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org csv").onChange(async h=>{await Se.clearCache(),T.indexedFileTypes=h.split(" "),await ce(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 crash in Obsidian. This option will disable itself if it happens.").addToggle(c=>c.setValue(T.useCache).onChange(async h=>{T.useCache=h,await ce(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(T.hideExcluded).onChange(async h=>{T.hideExcluded=h,await ce(this.plugin)}));let u=new DocumentFragment;u.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>
${pi}
`}),new G.Setting(e).setName("Split CamelCaseWords").setDesc(u).addToggle(c=>c.setValue(T.splitCamelCase).onChange(async h=>{await Se.clearCache(),T.splitCamelCase=h,await ce(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(T.simpleSearch).onChange(async h=>{T.simpleSearch=h,await ce(this.plugin)})),new G.Setting(e).setName("Open in new pane").setDesc("Open and create files in a new pane instead of the current pane.").addToggle(c=>c.setValue(T.openInNewPane).onChange(async h=>{T.openInNewPane=h,await ce(this.plugin)})),new G.Setting(e).setName("Set Vim like navigation keys").setDesc("Navigate down the results with Ctrl/\u2318 + J/N, or navigate up with Ctrl/\u2318 + K/P").addToggle(c=>c.setValue(T.vimLikeNavigationShortcut).onChange(async h=>{T.vimLikeNavigationShortcut=h,await ce(this.plugin)})),new G.Setting(e).setName("Fuzziness").setDesc("Define the level of fuzziness for the search. The higher the fuzziness, the more results you'll get.").addDropdown(c=>c.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(T.fuzziness).onChange(async h=>{["0","1","2"].includes(h)||(h="2"),T.fuzziness=h,await ce(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(T.ribbonIcon).onChange(async h=>{T.ribbonIcon=h,await ce(this.plugin),h?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(T.showExcerpt).onChange(async h=>{tr.set(h)})),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(T.renderLineReturnInExcerpts).onChange(async h=>{T.renderLineReturnInExcerpts=h,await ce(this.plugin)})),new G.Setting(e).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(c=>c.setValue(T.showPreviousQueryResults).onChange(async h=>{T.showPreviousQueryResults=h,await ce(this.plugin)}));let l=new DocumentFragment;l.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(l).addToggle(c=>c.setValue(T.showCreateButton).onChange(async h=>{T.showCreateButton=h,await ce(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(T.highlight).onChange(async h=>{T.highlight=h,await ce(this.plugin)})),new G.Setting(e).setName("Results weighting").setHeading(),new G.Setting(e).setName(`File name & declared aliases (default: ${Dt.weightBasename})`).addSlider(c=>this.weightSlider(c,"weightBasename")),new G.Setting(e).setName(`File directory (default: ${Dt.weightDirectory})`).addSlider(c=>this.weightSlider(c,"weightDirectory")),new G.Setting(e).setName(`Headings level 1 (default: ${Dt.weightH1})`).addSlider(c=>this.weightSlider(c,"weightH1")),new G.Setting(e).setName(`Headings level 2 (default: ${Dt.weightH2})`).addSlider(c=>this.weightSlider(c,"weightH2")),new G.Setting(e).setName(`Headings level 3 (default: ${Dt.weightH3})`).addSlider(c=>this.weightSlider(c,"weightH3")),new G.Setting(e).setName(`Tags without the # (default: ${Dt.weightUnmarkedTags})`).addSlider(c=>this.weightSlider(c,"weightUnmarkedTags")),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(T.verboseLogging).onChange(async h=>{T.verboseLogging=h,await ce(this.plugin)})),new G.Setting(e).setName("Danger Zone").setHeading();let f=new DocumentFragment;f.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>
${pi}
`}),new G.Setting(e).setName("Ignore diacritics").setDesc(f).addToggle(c=>c.setValue(T.ignoreDiacritics).onChange(async h=>{await Se.clearCache(),T.ignoreDiacritics=h,await ce(this.plugin)}));let p=new DocumentFragment;if(p.createSpan({},c=>{c.innerHTML=`Disable Omnisearch on this device only.<br>
${pi}`}),new G.Setting(e).setName("Disable on this device").setDesc(p).addToggle(c=>c.setValue(ls()).onChange(async h=>{h?app.saveLocalStorage(An,"1"):app.saveLocalStorage(An),new G.Notice("Omnisearch - Disabled. Please restart Obsidian.")})),It()){let c=new DocumentFragment;c.createSpan({},h=>{h.innerHTML=`Erase all Omnisearch cache data.
Use this if Omnisearch results are inconsistent, missing, or appear outdated.<br>
${pi}`}),new G.Setting(e).setName("Clear cache data").setDesc(c).addButton(h=>{h.setButtonText("Clear cache"),h.onClick(async()=>{await Se.clearCache()})})}}weightSlider(e,r){e.setLimits(1,5,.1).setValue(T[r]).setDynamicTooltip().onChange(async n=>{T[r]=n,await ce(this.plugin)})}},Dt={useCache:!0,hideExcluded:!1,ignoreDiacritics:!0,indexedFileTypes:[],PDFIndexing:!1,imagesIndexing:!1,unsupportedFilesIndexing:"no",splitCamelCase:!1,openInNewPane:!1,vimLikeNavigationShortcut:app.vault.getConfig("vimMode"),ribbonIcon:!0,showExcerpt:!0,renderLineReturnInExcerpts:!0,showCreateButton:!1,highlight:!0,showPreviousQueryResults:!0,simpleSearch:!1,fuzziness:"1",weightBasename:3,weightDirectory:2,weightH1:1.5,weightH2:1.3,weightH3:1.1,weightUnmarkedTags:1.1,welcomeMessage:"",verboseLogging:!1},T=Object.assign({},Dt);async function Ja(t){T=Object.assign({},Dt,await t.loadData()),tr.set(T.showExcerpt)}async function ce(t){await t.saveData(T)}function ls(){return app.loadLocalStorage(An)==="1"}function Xa(){return T.unsupportedFilesIndexing==="yes"||T.unsupportedFilesIndexing==="default"&&!!app.vault.getConfig("showUnsupportedFiles")}var Za=je(require("obsidian"));var el=/[\u4e00-\u9fa5]/;var tl=100,Cn=300,rl=`suggestion-highlight omnisearch-highlight ${T.highlight?"omnisearch-default-highlight":""}`,An="omnisearch-disabled",U=new mo,hi={ToggleExcerpts:"toggle-excerpts"},Je=(o=>(o[o.Done=0]="Done",o[o.LoadingCache=1]="LoadingCache",o[o.ReadingFiles=2]="ReadingFiles",o[o.IndexingFiles=3]="IndexingFiles",o[o.WritingCache=4]="WritingCache",o))(Je||{}),te=(f=>(f.Enter="enter",f.OpenInBackground="open-in-background",f.CreateNote="create-note",f.OpenInNewPane="open-in-new-pane",f.InsertLink="insert-link",f.Tab="tab",f.ArrowUp="arrow-up",f.ArrowDown="arrow-down",f.PrevSearchHistory="prev-search-history",f.NextSearchHistory="next-search-history",f))(te||{});var Ot=Vn(0),nl=!1;function us(t){nl=t}function cs(){return nl}function mi(){return app.plugins.plugins["cm-chs-patch"]}function ot(){return app.plugins?.plugins?.["text-extractor"]?.api}function It(){return!Za.Platform.isIosApp&&T.useCache}var il=/[|\t\n\r= -#%-*,.`\/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/.toString().slice(1,-1),fs=new RegExp(`${il}`,"u"),Sn=new RegExp(`${il}+`,"u");var yl=je(require("obsidian"));var rr=je(require("obsidian"));var sl=je(require("crypto")),al=je(ol());function ll(t){let e=t.split("/");return e.pop(),e.join("/")}function gi(t,e){return t.headings?.filter(r=>r.level===e).map(r=>r.heading)??[]}function yi(t,e){return(t+e)%e}function ps(t){return t.replace(/(\*|_)+(.+?)(\*|_)+/g,(e,r,n)=>n)}function ul(t){return t?.frontmatter?(0,rr.parseFrontMatterAliases)(t.frontmatter)??[]:[]}function cl(t){let e=t?(0,rr.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 yt(t){return t==null?"":(t=t.replaceAll("`","[__omnisearch__backtick__]"),t=t.normalize("NFD").replace(/\p{Diacritic}/gu,""),t=t.replaceAll("[__omnisearch__backtick__]","`"),t)}function nr(){return rr.Platform.isMacOS?"\u2318":"ctrl"}function kp(t){let e=!!ot(),r=e&&T.PDFIndexing,n=e&&T.imagesIndexing;return _i(t)||Dr(t)||vi(t)||r&&ir(t)||n&&Tr(t)}function hs(t){return Xa()||_i(t)||Dr(t)||vi(t)}function En(t){return hs(t)||kp(t)}function Tr(t){let e=or(t);return e==="png"||e==="jpg"||e==="jpeg"||e==="webp"}function ir(t){return or(t)==="pdf"}function _i(t){return[...T.indexedFileTypes,"md"].some(e=>t.endsWith(`.${e}`))}function Dr(t){return t.endsWith(".canvas")}function vi(t){return t.endsWith(".loom")||t.endsWith(".dashboard")}function or(t){let e=t.split(".");return e[e.length-1]??""}function fl(t){return rr.Platform.isMobileApp?(0,al.md5)(t.toString()):(0,sl.createHash)("md5").update(t).digest("hex")}function dl(t,e){let r=[],n=0,i=t.length;for(;n<i;)r.push(t.slice(n,n+=e));return r}function pl(t){return/[a-z][A-Z]/.test(t)?t.replace(/([a-z](?=[A-Z]))/g,"$1 ").split(" ").filter(r=>r):[]}function hl(t){return t.includes("-")?t.split("-").filter(e=>e):[]}function fe(...t){gl(console.log,...t)}function ml(...t){gl(console.warn,...t)}function gl(t,...e){if(T.verboseLogging){let r=new Date,n=`${r.getMinutes()}:${r.getSeconds()}:${r.getMilliseconds()}`;t("Omnisearch -",n+" -",...e)}}async function Pp(t){let e=app.vault.getFiles().find(s=>s.path===t);if(!e)throw new Error(`Invalid file path: "${t}"`);let r=null,n=ot();if(_i(t))r=await app.vault.cachedRead(e);else if(Dr(t)){let s=JSON.parse(await app.vault.cachedRead(e)),a=[];for(let u of s.nodes)u.type==="text"?a.push(u.text):u.type==="file"&&a.push(u.file);for(let u of s.edges.filter(l=>!!l.label))a.push(u.label);r=a.join(`\r
`)}else if(vi(t))try{let s=JSON.parse(await app.vault.cachedRead(e)),a=[],u=l=>{for(let f in l)typeof l[f]=="object"?u(l[f]):f==="markdown"&&a.push(l[f])};u(s),r=a.join(`\r
`)}catch(s){console.error("Omnisearch: Error while parsing Dataloom file",t),console.error(s)}else Tr(t)&&T.imagesIndexing&&n?.canFileBeExtracted(t)?r=await n.extractText(e):ir(t)&&T.PDFIndexing&&n?.canFileBeExtracted(t)?r=await n.extractText(e):hs(t)&&(r=e.path);r==null&&(console.warn(`Omnisearch: ${r} content for file`,e.path),r=""),r=yt(r);let i=app.metadataCache.getFileCache(e);if(i&&i.frontmatter?.["excalidraw-plugin"]){let s=i.sections?.filter(a=>a.type==="comment")??[];for(let{start:a,end:u}of s.map(l=>l.position))r=r.substring(0,a.offset-1)+r.substring(u.offset)}let o=cl(i);return{basename:yt(e.basename),content:r,path:e.path,mtime:e.stat.mtime,tags:o,unmarkedTags:o.map(s=>s.replace("#","")),aliases:ul(i).join(""),headings1:i?gi(i,1).join(" "):"",headings2:i?gi(i,2).join(" "):"",headings3:i?gi(i,3).join(" "):""}}var _l=class{constructor(){this.nextQueryIsEmpty=!1;this.documents=new Map}async addToLiveCache(e){try{let r=await Pp(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):(fe("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 Se.searchHistory.toArray();r=r.filter(n=>n.query!==e).reverse(),r.unshift({query:e}),r=r.slice(0,10),await Se.searchHistory.clear(),await Se.searchHistory.bulkAdd(r)}async getSearchHistory(){let e=(await Se.searchHistory.toArray()).reverse().map(r=>r.query);return this.nextQueryIsEmpty&&e.unshift(""),e}getDocumentsChecksum(e){return fl(JSON.stringify(e.sort((r,n)=>r.path<n.path?-1:r.path>n.path?1:0)))}async getMinisearchCache(){try{return(await Se.minisearch.toArray())[0]}catch(e){return new yl.Notice("Omnisearch - Cache missing or invalid. Some freezes may occur while Omnisearch indexes your vault."),console.error("Omnisearch - Error while loading Minisearch cache"),console.error(e),null}}async writeMinisearchCache(e,r){let n=Array.from(r).map(([i,o])=>({path:i,mtime:o}));await Se.minisearch.clear(),await Se.minisearch.add({date:new Date().toISOString(),paths:n,data:e.toJSON()}),console.log("Omnisearch - Search cache written")}},Fe=new _l;function Mp(t){let e,r,n,i,o,s,a,u,l=t[8].default,f=pr(l,t,t[7],null);return{c(){e=M("div"),r=M("div"),n=M("input"),o=W(),f&&f.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(p,c){$(p,e,c),D(e,r),D(r,n),t[9](n),ao(n,t[1]),D(e,o),f&&f.m(e,null),s=!0,a||(u=[He(n,"input",t[10]),Js(i=t[3].call(null,n)),He(n,"compositionend",t[11]),He(n,"compositionstart",t[12]),He(n,"input",t[4])],a=!0)},p(p,[c]){(!s||c&1)&&B(n,"placeholder",p[0]),c&2&&n.value!==p[1]&&ao(n,p[1]),f&&f.p&&(!s||c&128)&&mr(f,l,p,p[7],s?hr(l,p[7],c,null):gr(p[7]),null)},i(p){s||(ee(f,p),s=!0)},o(p){ne(f,p),s=!1},d(p){p&&H(e),t[9](null),f&&f.d(p),a=!1,Xe(u)}}}function Rp(t,e,r){let{$$slots:n={},$$scope:i}=e,{initialValue:o=""}=e,{placeholder:s=""}=e,a=!1,u="",l,f=co();function p(m){r(1,u=m)}function c(m){m&&!a&&!u&&(a=!0,r(1,u=m),h())}function h(m){jt().then(()=>(l.focus(),jt())).then(()=>{l.select()})}let w=(0,vl.debounce)(()=>{Fe.addToSearchHistory(""),f("input",u)},300);function x(m){lt[m?"unshift":"push"](()=>{l=m,r(2,l)})}function v(){u=this.value,r(1,u)}let d=m=>us(!1),b=m=>us(!0);return t.$$set=m=>{"initialValue"in m&&r(5,o=m.initialValue),"placeholder"in m&&r(0,s=m.placeholder),"$$scope"in m&&r(7,i=m.$$scope)},t.$$.update=()=>{if(t.$$.dirty&32){e:c(o)}},[s,u,l,h,w,o,p,i,n,x,v,d,b]}var bl=class extends Te{constructor(e){super();Oe(this,e,Rp,Mp,Ae,{initialValue:5,placeholder:0,setInputValue:6})}get setInputValue(){return this.$$.ctx[6]}},bi=bl;function Lp(t){let e,r,n,i,o=t[1].default,s=pr(o,t,t[0],null);return{c(){e=M("div"),s&&s.c(),B(e,"class","prompt-results")},m(a,u){$(a,e,u),s&&s.m(e,null),r=!0,n||(i=He(e,"mousedown",Bp),n=!0)},p(a,[u]){s&&s.p&&(!r||u&1)&&mr(s,o,a,a[0],r?hr(o,a[0],u,null):gr(a[0]),null)},i(a){r||(ee(s,a),r=!0)},o(a){ne(s,a),r=!1},d(a){a&&H(e),s&&s.d(a),n=!1,i()}}}var Bp=t=>t.preventDefault();function Np(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}var xl=class extends Te{constructor(e){super();Oe(this,e,Np,Lp,Ae,{})}},xi=xl;var ws=je(require("obsidian"));var Zc=je(require("obsidian"));var Kp=typeof global=="object"&&global&&global.Object===Object&&global,wi=Kp;var zp=typeof self=="object"&&self&&self.Object===Object&&self,Vp=wi||zp||Function("return this")(),ye=Vp;var Hp=ye.Symbol,Ee=Hp;var wl=Object.prototype,$p=wl.hasOwnProperty,Wp=wl.toString,Tn=Ee?Ee.toStringTag:void 0;function Up(t){var e=$p.call(t,Tn),r=t[Tn];try{t[Tn]=void 0;var n=!0}catch{}var i=Wp.call(t);return n&&(e?t[Tn]=r:delete t[Tn]),i}var jl=Up;var Gp=Object.prototype,Qp=Gp.toString;function qp(t){return Qp.call(t)}var Al=qp;var Yp="[object Null]",Jp="[object Undefined]",Cl=Ee?Ee.toStringTag:void 0;function Xp(t){return t==null?t===void 0?Jp:Yp:Cl&&Cl in Object(t)?jl(t):Al(t)}var tt=Xp;function Zp(t){return t!=null&&typeof t=="object"}var Ne=Zp;var eh="[object Symbol]";function th(t){return typeof t=="symbol"||Ne(t)&&tt(t)==eh}var _t=th;function rh(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 Ir=rh;var nh=Array.isArray,de=nh;var ih=1/0,Sl=Ee?Ee.prototype:void 0,Fl=Sl?Sl.toString:void 0;function El(t){if(typeof t=="string")return t;if(de(t))return Ir(t,El)+"";if(_t(t))return Fl?Fl.call(t):"";var e=t+"";return e=="0"&&1/t==-ih?"-0":e}var Tl=El;function oh(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var We=oh;function sh(t){return t}var kt=sh;var ah="[object AsyncFunction]",lh="[object Function]",uh="[object GeneratorFunction]",ch="[object Proxy]";function fh(t){if(!We(t))return!1;var e=tt(t);return e==lh||e==uh||e==ah||e==ch}var ji=fh;var dh=ye["__core-js_shared__"],Ai=dh;var Dl=function(){var t=/[^.]+$/.exec(Ai&&Ai.keys&&Ai.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function ph(t){return!!Dl&&Dl in t}var Il=ph;var hh=Function.prototype,mh=hh.toString;function gh(t){if(t!=null){try{return mh.call(t)}catch{}try{return t+""}catch{}}return""}var vt=gh;var yh=/[\\^$.*+?()[\]{}|]/g,_h=/^\[object .+?Constructor\]$/,vh=Function.prototype,bh=Object.prototype,xh=vh.toString,wh=bh.hasOwnProperty,jh=RegExp("^"+xh.call(wh).replace(yh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(t){if(!We(t)||Il(t))return!1;var e=ji(t)?jh:_h;return e.test(vt(t))}var Ol=Ah;function Ch(t,e){return t==null?void 0:t[e]}var kl=Ch;function Sh(t,e){var r=kl(t,e);return Ol(r)?r:void 0}var Ue=Sh;var Fh=Ue(ye,"WeakMap"),Ci=Fh;var Pl=Object.create,Eh=function(){function t(){}return function(e){if(!We(e))return{};if(Pl)return Pl(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Ml=Eh;function Th(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 Rl=Th;function Dh(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var Ll=Dh;var Ih=800,Oh=16,kh=Date.now;function Ph(t){var e=0,r=0;return function(){var n=kh(),i=Oh-(n-r);if(r=n,i>0){if(++e>=Ih)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Bl=Ph;function Mh(t){return function(){return t}}var Nl=Mh;var Rh=function(){try{var t=Ue(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Or=Rh;var Lh=Or?function(t,e){return Or(t,"toString",{configurable:!0,enumerable:!1,value:Nl(e),writable:!0})}:kt,Kl=Lh;var Bh=Bl(Kl),zl=Bh;function Nh(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Vl=Nh;var Kh=9007199254740991,zh=/^(?:0|[1-9]\d*)$/;function Vh(t,e){var r=typeof t;return e=e??Kh,!!e&&(r=="number"||r!="symbol"&&zh.test(t))&&t>-1&&t%1==0&&t<e}var kr=Vh;function Hh(t,e,r){e=="__proto__"&&Or?Or(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Si=Hh;function $h(t,e){return t===e||t!==t&&e!==e}var Pt=$h;var Wh=Object.prototype,Uh=Wh.hasOwnProperty;function Gh(t,e,r){var n=t[e];(!(Uh.call(t,e)&&Pt(n,r))||r===void 0&&!(e in t))&&Si(t,e,r)}var Fi=Gh;function Qh(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var a=e[o],u=n?n(r[a],t[a],a,r,t):void 0;u===void 0&&(u=t[a]),i?Si(r,a,u):Fi(r,a,u)}return r}var Mt=Qh;var Hl=Math.max;function qh(t,e,r){return e=Hl(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=Hl(n.length-e,0),s=Array(o);++i<o;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(s),Rl(t,this,a)}}var $l=qh;function Yh(t,e){return zl($l(t,e,kt),t+"")}var Wl=Yh;var Jh=9007199254740991;function Xh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Jh}var Pr=Xh;function Zh(t){return t!=null&&Pr(t.length)&&!ji(t)}var st=Zh;function em(t,e,r){if(!We(r))return!1;var n=typeof e;return(n=="number"?st(r)&&kr(e,r.length):n=="string"&&e in r)?Pt(r[e],t):!1}var ms=em;var tm=Object.prototype;function rm(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||tm;return t===r}var Mr=rm;function nm(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Ul=nm;var im="[object Arguments]";function om(t){return Ne(t)&&tt(t)==im}var gs=om;var Gl=Object.prototype,sm=Gl.hasOwnProperty,am=Gl.propertyIsEnumerable,lm=gs(function(){return arguments}())?gs:function(t){return Ne(t)&&sm.call(t,"callee")&&!am.call(t,"callee")},Rr=lm;function um(){return!1}var Ql=um;var ql=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Yl=ql&&typeof module=="object"&&module&&!module.nodeType&&module,cm=Yl&&Yl.exports===ql,Jl=cm?ye.Buffer:void 0,fm=Jl?Jl.isBuffer:void 0,dm=fm||Ql,sr=dm;var pm="[object Arguments]",hm="[object Array]",mm="[object Boolean]",gm="[object Date]",ym="[object Error]",_m="[object Function]",vm="[object Map]",bm="[object Number]",xm="[object Object]",wm="[object RegExp]",jm="[object Set]",Am="[object String]",Cm="[object WeakMap]",Sm="[object ArrayBuffer]",Fm="[object DataView]",Em="[object Float32Array]",Tm="[object Float64Array]",Dm="[object Int8Array]",Im="[object Int16Array]",Om="[object Int32Array]",km="[object Uint8Array]",Pm="[object Uint8ClampedArray]",Mm="[object Uint16Array]",Rm="[object Uint32Array]",ae={};ae[Em]=ae[Tm]=ae[Dm]=ae[Im]=ae[Om]=ae[km]=ae[Pm]=ae[Mm]=ae[Rm]=!0;ae[pm]=ae[hm]=ae[Sm]=ae[mm]=ae[Fm]=ae[gm]=ae[ym]=ae[_m]=ae[vm]=ae[bm]=ae[xm]=ae[wm]=ae[jm]=ae[Am]=ae[Cm]=!1;function Lm(t){return Ne(t)&&Pr(t.length)&&!!ae[tt(t)]}var Xl=Lm;function Bm(t){return function(e){return t(e)}}var Rt=Bm;var Zl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dn=Zl&&typeof module=="object"&&module&&!module.nodeType&&module,Nm=Dn&&Dn.exports===Zl,ys=Nm&&wi.process,Km=function(){try{var t=Dn&&Dn.require&&Dn.require("util").types;return t||ys&&ys.binding&&ys.binding("util")}catch{}}(),bt=Km;var eu=bt&&bt.isTypedArray,zm=eu?Rt(eu):Xl,Ei=zm;var Vm=Object.prototype,Hm=Vm.hasOwnProperty;function $m(t,e){var r=de(t),n=!r&&Rr(t),i=!r&&!n&&sr(t),o=!r&&!n&&!i&&Ei(t),s=r||n||i||o,a=s?Ul(t.length,String):[],u=a.length;for(var l in t)(e||Hm.call(t,l))&&!(s&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||kr(l,u)))&&a.push(l);return a}var Ti=$m;function Wm(t,e){return function(r){return t(e(r))}}var Di=Wm;var Um=Di(Object.keys,Object),tu=Um;var Gm=Object.prototype,Qm=Gm.hasOwnProperty;function qm(t){if(!Mr(t))return tu(t);var e=[];for(var r in Object(t))Qm.call(t,r)&&r!="constructor"&&e.push(r);return e}var ru=qm;function Ym(t){return st(t)?Ti(t):ru(t)}var at=Ym;function Jm(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var nu=Jm;var Xm=Object.prototype,Zm=Xm.hasOwnProperty;function eg(t){if(!We(t))return nu(t);var e=Mr(t),r=[];for(var n in t)n=="constructor"&&(e||!Zm.call(t,n))||r.push(n);return r}var iu=eg;function tg(t){return st(t)?Ti(t,!0):iu(t)}var Lr=tg;var rg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ng=/^\w*$/;function ig(t,e){if(de(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||_t(t)?!0:ng.test(t)||!rg.test(t)||e!=null&&t in Object(e)}var Br=ig;var og=Ue(Object,"create"),xt=og;function sg(){this.__data__=xt?xt(null):{},this.size=0}var ou=sg;function ag(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var su=ag;var lg="__lodash_hash_undefined__",ug=Object.prototype,cg=ug.hasOwnProperty;function fg(t){var e=this.__data__;if(xt){var r=e[t];return r===lg?void 0:r}return cg.call(e,t)?e[t]:void 0}var au=fg;var dg=Object.prototype,pg=dg.hasOwnProperty;function hg(t){var e=this.__data__;return xt?e[t]!==void 0:pg.call(e,t)}var lu=hg;var mg="__lodash_hash_undefined__";function gg(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=xt&&e===void 0?mg:e,this}var uu=gg;function Nr(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])}}Nr.prototype.clear=ou;Nr.prototype.delete=su;Nr.prototype.get=au;Nr.prototype.has=lu;Nr.prototype.set=uu;var _s=Nr;function yg(){this.__data__=[],this.size=0}var cu=yg;function _g(t,e){for(var r=t.length;r--;)if(Pt(t[r][0],e))return r;return-1}var Lt=_g;var vg=Array.prototype,bg=vg.splice;function xg(t){var e=this.__data__,r=Lt(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():bg.call(e,r,1),--this.size,!0}var fu=xg;function wg(t){var e=this.__data__,r=Lt(e,t);return r<0?void 0:e[r][1]}var du=wg;function jg(t){return Lt(this.__data__,t)>-1}var pu=jg;function Ag(t,e){var r=this.__data__,n=Lt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var hu=Ag;function Kr(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])}}Kr.prototype.clear=cu;Kr.prototype.delete=fu;Kr.prototype.get=du;Kr.prototype.has=pu;Kr.prototype.set=hu;var Bt=Kr;var Cg=Ue(ye,"Map"),Nt=Cg;function Sg(){this.size=0,this.__data__={hash:new _s,map:new(Nt||Bt),string:new _s}}var mu=Sg;function Fg(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var gu=Fg;function Eg(t,e){var r=t.__data__;return gu(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Kt=Eg;function Tg(t){var e=Kt(this,t).delete(t);return this.size-=e?1:0,e}var yu=Tg;function Dg(t){return Kt(this,t).get(t)}var _u=Dg;function Ig(t){return Kt(this,t).has(t)}var vu=Ig;function Og(t,e){var r=Kt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var bu=Og;function zr(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])}}zr.prototype.clear=mu;zr.prototype.delete=yu;zr.prototype.get=_u;zr.prototype.has=vu;zr.prototype.set=bu;var ar=zr;var kg="Expected a function";function vs(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(kg);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(vs.Cache||ar),r}vs.Cache=ar;var xu=vs;var Pg=500;function Mg(t){var e=xu(t,function(n){return r.size===Pg&&r.clear(),n}),r=e.cache;return e}var wu=Mg;var Rg=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lg=/\\(\\)?/g,Bg=wu(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Rg,function(r,n,i,o){e.push(i?o.replace(Lg,"$1"):n||r)}),e}),ju=Bg;function Ng(t){return t==null?"":Tl(t)}var Ii=Ng;function Kg(t,e){return de(t)?t:Br(t,e)?[t]:ju(Ii(t))}var Oi=Kg;var zg=1/0;function Vg(t){if(typeof t=="string"||_t(t))return t;var e=t+"";return e=="0"&&1/t==-zg?"-0":e}var zt=Vg;function Hg(t,e){e=Oi(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[zt(e[r++])];return r&&r==n?t:void 0}var Vr=Hg;function $g(t,e,r){var n=t==null?void 0:Vr(t,e);return n===void 0?r:n}var Au=$g;function Wg(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var Hr=Wg;var Cu=Ee?Ee.isConcatSpreadable:void 0;function Ug(t){return de(t)||Rr(t)||!!(Cu&&t&&t[Cu])}var Su=Ug;function Fu(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=Su),i||(i=[]);++o<s;){var a=t[o];e>0&&r(a)?e>1?Fu(a,e-1,r,n,i):Hr(i,a):n||(i[i.length]=a)}return i}var Eu=Fu;var Gg=Di(Object.getPrototypeOf,Object),ki=Gg;function Qg(){this.__data__=new Bt,this.size=0}var Tu=Qg;function qg(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Du=qg;function Yg(t){return this.__data__.get(t)}var Iu=Yg;function Jg(t){return this.__data__.has(t)}var Ou=Jg;var Xg=200;function Zg(t,e){var r=this.__data__;if(r instanceof Bt){var n=r.__data__;if(!Nt||n.length<Xg-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new ar(n)}return r.set(t,e),this.size=r.size,this}var ku=Zg;function $r(t){var e=this.__data__=new Bt(t);this.size=e.size}$r.prototype.clear=Tu;$r.prototype.delete=Du;$r.prototype.get=Iu;$r.prototype.has=Ou;$r.prototype.set=ku;var Vt=$r;function ey(t,e){return t&&Mt(e,at(e),t)}var Pu=ey;function ty(t,e){return t&&Mt(e,Lr(e),t)}var Mu=ty;var Ru=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Lu=Ru&&typeof module=="object"&&module&&!module.nodeType&&module,ry=Lu&&Lu.exports===Ru,Bu=ry?ye.Buffer:void 0,Nu=Bu?Bu.allocUnsafe:void 0;function ny(t,e){if(e)return t.slice();var r=t.length,n=Nu?Nu(r):new t.constructor(r);return t.copy(n),n}var Ku=ny;function iy(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o}var zu=iy;function oy(){return[]}var Pi=oy;var sy=Object.prototype,ay=sy.propertyIsEnumerable,Vu=Object.getOwnPropertySymbols,ly=Vu?function(t){return t==null?[]:(t=Object(t),zu(Vu(t),function(e){return ay.call(t,e)}))}:Pi,Wr=ly;function uy(t,e){return Mt(t,Wr(t),e)}var Hu=uy;var cy=Object.getOwnPropertySymbols,fy=cy?function(t){for(var e=[];t;)Hr(e,Wr(t)),t=ki(t);return e}:Pi,Mi=fy;function dy(t,e){return Mt(t,Mi(t),e)}var $u=dy;function py(t,e,r){var n=e(t);return de(t)?n:Hr(n,r(t))}var Ri=py;function hy(t){return Ri(t,at,Wr)}var In=hy;function my(t){return Ri(t,Lr,Mi)}var Wu=my;var gy=Ue(ye,"DataView"),Li=gy;var yy=Ue(ye,"Promise"),Bi=yy;var _y=Ue(ye,"Set"),Ni=_y;var Uu="[object Map]",vy="[object Object]",Gu="[object Promise]",Qu="[object Set]",qu="[object WeakMap]",Yu="[object DataView]",by=vt(Li),xy=vt(Nt),wy=vt(Bi),jy=vt(Ni),Ay=vt(Ci),lr=tt;(Li&&lr(new Li(new ArrayBuffer(1)))!=Yu||Nt&&lr(new Nt)!=Uu||Bi&&lr(Bi.resolve())!=Gu||Ni&&lr(new Ni)!=Qu||Ci&&lr(new Ci)!=qu)&&(lr=function(t){var e=tt(t),r=e==vy?t.constructor:void 0,n=r?vt(r):"";if(n)switch(n){case by:return Yu;case xy:return Uu;case wy:return Gu;case jy:return Qu;case Ay:return qu}return e});var wt=lr;var Cy=Object.prototype,Sy=Cy.hasOwnProperty;function Fy(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Sy.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Ju=Fy;var Ey=ye.Uint8Array,Ur=Ey;function Ty(t){var e=new t.constructor(t.byteLength);return new Ur(e).set(new Ur(t)),e}var Gr=Ty;function Dy(t,e){var r=e?Gr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Xu=Dy;var Iy=/\w*$/;function Oy(t){var e=new t.constructor(t.source,Iy.exec(t));return e.lastIndex=t.lastIndex,e}var Zu=Oy;var ec=Ee?Ee.prototype:void 0,tc=ec?ec.valueOf:void 0;function ky(t){return tc?Object(tc.call(t)):{}}var rc=ky;function Py(t,e){var r=e?Gr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var nc=Py;var My="[object Boolean]",Ry="[object Date]",Ly="[object Map]",By="[object Number]",Ny="[object RegExp]",Ky="[object Set]",zy="[object String]",Vy="[object Symbol]",Hy="[object ArrayBuffer]",$y="[object DataView]",Wy="[object Float32Array]",Uy="[object Float64Array]",Gy="[object Int8Array]",Qy="[object Int16Array]",qy="[object Int32Array]",Yy="[object Uint8Array]",Jy="[object Uint8ClampedArray]",Xy="[object Uint16Array]",Zy="[object Uint32Array]";function e_(t,e,r){var n=t.constructor;switch(e){case Hy:return Gr(t);case My:case Ry:return new n(+t);case $y:return Xu(t,r);case Wy:case Uy:case Gy:case Qy:case qy:case Yy:case Jy:case Xy:case Zy:return nc(t,r);case Ly:return new n;case By:case zy:return new n(t);case Ny:return Zu(t);case Ky:return new n;case Vy:return rc(t)}}var ic=e_;function t_(t){return typeof t.constructor=="function"&&!Mr(t)?Ml(ki(t)):{}}var oc=t_;var r_="[object Map]";function n_(t){return Ne(t)&&wt(t)==r_}var sc=n_;var ac=bt&&bt.isMap,i_=ac?Rt(ac):sc,lc=i_;var o_="[object Set]";function s_(t){return Ne(t)&&wt(t)==o_}var uc=s_;var cc=bt&&bt.isSet,a_=cc?Rt(cc):uc,fc=a_;var l_=1,u_=2,c_=4,dc="[object Arguments]",f_="[object Array]",d_="[object Boolean]",p_="[object Date]",h_="[object Error]",pc="[object Function]",m_="[object GeneratorFunction]",g_="[object Map]",y_="[object Number]",hc="[object Object]",__="[object RegExp]",v_="[object Set]",b_="[object String]",x_="[object Symbol]",w_="[object WeakMap]",j_="[object ArrayBuffer]",A_="[object DataView]",C_="[object Float32Array]",S_="[object Float64Array]",F_="[object Int8Array]",E_="[object Int16Array]",T_="[object Int32Array]",D_="[object Uint8Array]",I_="[object Uint8ClampedArray]",O_="[object Uint16Array]",k_="[object Uint32Array]",oe={};oe[dc]=oe[f_]=oe[j_]=oe[A_]=oe[d_]=oe[p_]=oe[C_]=oe[S_]=oe[F_]=oe[E_]=oe[T_]=oe[g_]=oe[y_]=oe[hc]=oe[__]=oe[v_]=oe[b_]=oe[x_]=oe[D_]=oe[I_]=oe[O_]=oe[k_]=!0;oe[h_]=oe[pc]=oe[w_]=!1;function Ki(t,e,r,n,i,o){var s,a=e&l_,u=e&u_,l=e&c_;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!We(t))return t;var f=de(t);if(f){if(s=Ju(t),!a)return Ll(t,s)}else{var p=wt(t),c=p==pc||p==m_;if(sr(t))return Ku(t,a);if(p==hc||p==dc||c&&!i){if(s=u||c?{}:oc(t),!a)return u?$u(t,Mu(s,t)):Hu(t,Pu(s,t))}else{if(!oe[p])return i?t:{};s=ic(t,p,a)}}o||(o=new Vt);var h=o.get(t);if(h)return h;o.set(t,s),fc(t)?t.forEach(function(v){s.add(Ki(v,e,r,v,t,o))}):lc(t)&&t.forEach(function(v,d){s.set(d,Ki(v,e,r,d,t,o))});var w=l?u?Wu:In:u?Lr:at,x=f?void 0:w(t);return Vl(x||t,function(v,d){x&&(d=v,v=t[d]),Fi(s,d,Ki(v,e,r,d,t,o))}),s}var mc=Ki;var P_=1,M_=4;function R_(t){return mc(t,P_|M_)}var On=R_;var L_="__lodash_hash_undefined__";function B_(t){return this.__data__.set(t,L_),this}var gc=B_;function N_(t){return this.__data__.has(t)}var yc=N_;function zi(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new ar;++e<r;)this.add(t[e])}zi.prototype.add=zi.prototype.push=gc;zi.prototype.has=yc;var _c=zi;function K_(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 vc=K_;function z_(t,e){return t.has(e)}var bc=z_;var V_=1,H_=2;function $_(t,e,r,n,i,o){var s=r&V_,a=t.length,u=e.length;if(a!=u&&!(s&&u>a))return!1;var l=o.get(t),f=o.get(e);if(l&&f)return l==e&&f==t;var p=-1,c=!0,h=r&H_?new _c:void 0;for(o.set(t,e),o.set(e,t);++p<a;){var w=t[p],x=e[p];if(n)var v=s?n(x,w,p,e,t,o):n(w,x,p,t,e,o);if(v!==void 0){if(v)continue;c=!1;break}if(h){if(!vc(e,function(d,b){if(!bc(h,b)&&(w===d||i(w,d,r,n,o)))return h.push(b)})){c=!1;break}}else if(!(w===x||i(w,x,r,n,o))){c=!1;break}}return o.delete(t),o.delete(e),c}var Vi=$_;function W_(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var xc=W_;function U_(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var wc=U_;var G_=1,Q_=2,q_="[object Boolean]",Y_="[object Date]",J_="[object Error]",X_="[object Map]",Z_="[object Number]",ev="[object RegExp]",tv="[object Set]",rv="[object String]",nv="[object Symbol]",iv="[object ArrayBuffer]",ov="[object DataView]",jc=Ee?Ee.prototype:void 0,bs=jc?jc.valueOf:void 0;function sv(t,e,r,n,i,o,s){switch(r){case ov:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case iv:return!(t.byteLength!=e.byteLength||!o(new Ur(t),new Ur(e)));case q_:case Y_:case Z_:return Pt(+t,+e);case J_:return t.name==e.name&&t.message==e.message;case ev:case rv:return t==e+"";case X_:var a=xc;case tv:var u=n&G_;if(a||(a=wc),t.size!=e.size&&!u)return!1;var l=s.get(t);if(l)return l==e;n|=Q_,s.set(t,e);var f=Vi(a(t),a(e),n,i,o,s);return s.delete(t),f;case nv:if(bs)return bs.call(t)==bs.call(e)}return!1}var Ac=sv;var av=1,lv=Object.prototype,uv=lv.hasOwnProperty;function cv(t,e,r,n,i,o){var s=r&av,a=In(t),u=a.length,l=In(e),f=l.length;if(u!=f&&!s)return!1;for(var p=u;p--;){var c=a[p];if(!(s?c in e:uv.call(e,c)))return!1}var h=o.get(t),w=o.get(e);if(h&&w)return h==e&&w==t;var x=!0;o.set(t,e),o.set(e,t);for(var v=s;++p<u;){c=a[p];var d=t[c],b=e[c];if(n)var m=s?n(b,d,c,e,t,o):n(d,b,c,t,e,o);if(!(m===void 0?d===b||i(d,b,r,n,o):m)){x=!1;break}v||(v=c=="constructor")}if(x&&!v){var g=t.constructor,y=e.constructor;g!=y&&"constructor"in t&&"constructor"in e&&!(typeof g=="function"&&g instanceof g&&typeof y=="function"&&y instanceof y)&&(x=!1)}return o.delete(t),o.delete(e),x}var Cc=cv;var fv=1,Sc="[object Arguments]",Fc="[object Array]",Hi="[object Object]",dv=Object.prototype,Ec=dv.hasOwnProperty;function pv(t,e,r,n,i,o){var s=de(t),a=de(e),u=s?Fc:wt(t),l=a?Fc:wt(e);u=u==Sc?Hi:u,l=l==Sc?Hi:l;var f=u==Hi,p=l==Hi,c=u==l;if(c&&sr(t)){if(!sr(e))return!1;s=!0,f=!1}if(c&&!f)return o||(o=new Vt),s||Ei(t)?Vi(t,e,r,n,i,o):Ac(t,e,u,r,n,i,o);if(!(r&fv)){var h=f&&Ec.call(t,"__wrapped__"),w=p&&Ec.call(e,"__wrapped__");if(h||w){var x=h?t.value():t,v=w?e.value():e;return o||(o=new Vt),i(x,v,r,n,o)}}return c?(o||(o=new Vt),Cc(t,e,r,n,i,o)):!1}var Tc=pv;function Dc(t,e,r,n,i){return t===e?!0:t==null||e==null||!Ne(t)&&!Ne(e)?t!==t&&e!==e:Tc(t,e,r,n,Dc,i)}var $i=Dc;var hv=1,mv=2;function gv(t,e,r,n){var i=r.length,o=i,s=!n;if(t==null)return!o;for(t=Object(t);i--;){var a=r[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){a=r[i];var u=a[0],l=t[u],f=a[1];if(s&&a[2]){if(l===void 0&&!(u in t))return!1}else{var p=new Vt;if(n)var c=n(l,f,u,t,e,p);if(!(c===void 0?$i(f,l,hv|mv,n,p):c))return!1}}return!0}var Ic=gv;function yv(t){return t===t&&!We(t)}var Wi=yv;function _v(t){for(var e=at(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Wi(i)]}return e}var Oc=_v;function vv(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Ui=vv;function bv(t){var e=Oc(t);return e.length==1&&e[0][2]?Ui(e[0][0],e[0][1]):function(r){return r===t||Ic(r,t,e)}}var kc=bv;function xv(t,e){return t!=null&&e in Object(t)}var Pc=xv;function wv(t,e,r){e=Oi(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var s=zt(e[n]);if(!(o=t!=null&&r(t,s)))break;t=t[s]}return o||++n!=i?o:(i=t==null?0:t.length,!!i&&Pr(i)&&kr(s,i)&&(de(t)||Rr(t)))}var Mc=wv;function jv(t,e){return t!=null&&Mc(t,e,Pc)}var Rc=jv;var Av=1,Cv=2;function Sv(t,e){return Br(t)&&Wi(e)?Ui(zt(t),e):function(r){var n=Au(r,t);return n===void 0&&n===e?Rc(r,t):$i(e,n,Av|Cv)}}var Lc=Sv;function Fv(t){return function(e){return e==null?void 0:e[t]}}var Bc=Fv;function Ev(t){return function(e){return Vr(e,t)}}var Nc=Ev;function Tv(t){return Br(t)?Bc(zt(t)):Nc(t)}var Kc=Tv;function Dv(t){return typeof t=="function"?t:t==null?kt:typeof t=="object"?de(t)?Lc(t[0],t[1]):kc(t):Kc(t)}var zc=Dv;function Iv(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++i];if(r(o[u],u,o)===!1)break}return e}}var Vc=Iv;var Ov=Vc(),Hc=Ov;function kv(t,e){return t&&Hc(t,e,at)}var $c=kv;function Pv(t,e){return function(r,n){if(r==null)return r;if(!st(r))return t(r,n);for(var i=r.length,o=e?i:-1,s=Object(r);(e?o--:++o<i)&&n(s[o],o,s)!==!1;);return r}}var Wc=Pv;var Mv=Wc($c),Uc=Mv;var Gc=/[\\^$.*+?()[\]{}|]/g,Rv=RegExp(Gc.source);function Lv(t){return t=Ii(t),t&&Rv.test(t)?t.replace(Gc,"\\$&"):t}var kn=Lv;function Bv(t,e){var r=-1,n=st(t)?Array(t.length):[];return Uc(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var Qc=Bv;function Nv(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var qc=Nv;function Kv(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,o=_t(t),s=e!==void 0,a=e===null,u=e===e,l=_t(e);if(!a&&!l&&!o&&t>e||o&&s&&u&&!a&&!l||n&&s&&u||!r&&u||!i)return 1;if(!n&&!o&&!l&&t<e||l&&r&&i&&!n&&!o||a&&r&&i||!s&&i||!u)return-1}return 0}var Yc=Kv;function zv(t,e,r){for(var n=-1,i=t.criteria,o=e.criteria,s=i.length,a=r.length;++n<s;){var u=Yc(i[n],o[n]);if(u){if(n>=a)return u;var l=r[n];return u*(l=="desc"?-1:1)}}return t.index-e.index}var Jc=zv;function Vv(t,e,r){e.length?e=Ir(e,function(o){return de(o)?function(s){return Vr(s,o.length===1?o[0]:o)}:o}):e=[kt];var n=-1;e=Ir(e,Rt(zc));var i=Qc(t,function(o,s,a){var u=Ir(e,function(l){return l(o)});return{criteria:u,index:++n,value:o}});return qc(i,function(o,s){return Jc(o,s,r)})}var Xc=Vv;var Hv=Wl(function(t,e){if(t==null)return[];var r=e.length;return r>1&&ms(t,e[0],e[1])?e=[]:r>2&&ms(e[0],e[1],e[2])&&(e=[e[0]]),Xc(t,Eu(e,1),[])}),xs=Hv;function Ht(t,e){try{return t.replace(new RegExp(e.map(r=>`\\b${kn(r.match)}\\b`).join("|"),"giu"),r=>e.find(i=>r.match(new RegExp(`\\b${kn(i.match)}\\b`,"giu")))?`<span class="${rl}">${r}</span>`:r)}catch(r){return console.error("Omnisearch - Error in highlightText()",r),t}}function $v(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function Qr(t){if(!t.length)return/^$/g;t.sort((r,n)=>n.length-r.length);let e="("+(mi()?"":T.splitCamelCase?`^|${fs.source}|-|[A-Z]`:`^|${fs.source}|-`)+`)(${t.map(r=>kn(r)).join("|")})`;return new RegExp(`${e}`,"gu")}function Gi(t,e,r){t=t.toLowerCase();let n=new Date().getTime(),i=null,o=[],s=0;for(;(i=e.exec(t))!==null;){if(++s>=100||new Date().getTime()-n>50){ml("Stopped getMatches at",s,"results");break}let a=i[2];a&&i.index>=0&&o.push({match:a,offset:i.index+1})}if(r&&r.query.text.length>1){let a=t.indexOf(r.segmentsToStr());a>-1&&o.find(u=>u.offset===a)&&(o=o.filter(u=>u.offset!==a),o.unshift({offset:a,match:r.segmentsToStr()}))}return o}function qr(t,e){try{let r=e??-1,n=Math.max(0,r-tl),i=Math.min(t.length,r+Cn);if(r>-1?t=(n>0?"\u2026":"")+t.slice(n,i).trim()+(i<t.length-1?"\u2026":""):t=t.slice(0,Cn),T.renderLineReturnInExcerpts){let o=new RegExp(/(?:\r\n|\r|\n)/g);t=t.split(o).filter(a=>a).join(`
`);let s=t.lastIndexOf(`
`,r-n);s>0&&(t=t.slice(s))}return t=$v(t),T.renderLineReturnInExcerpts&&(t=t.trim().replaceAll(`
`,"<br>")),{content:t,offset:r}}catch(r){return new Zc.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(r),{content:"",offset:-1}}}async function Qi(t,e=!1){let r=Qr(t.foundWords);r.exec(t.content);let n=r.lastIndex,i=!1;app.workspace.iterateAllLeaves(a=>{a.view instanceof ws.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 o=app.workspace.getActiveViewOfType(ws.MarkdownView);if(!o)return;let s=o.editor.offsetToPos(n);s.ch=0,o.editor.setCursor(s),o.editor.scrollIntoView({from:{line:s.line-10,ch:0},to:{line:s.line+10,ch:0}})}async function ef(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 Wv(t){let e;return{c(){e=M("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){$(r,e,n)},p:he,i:he,o:he,d(r){r&&H(e)}}}function Uv(t){"use strict";return[]}var tf=class extends Te{constructor(e){super();Oe(this,e,Uv,Wv,Ae,{})}},rf=tf;function nf(t){let e,r;return e=new rf({}),{c(){$e(e.$$.fragment)},m(n,i){Re(e,n,i),r=!0},i(n){r||(ee(e.$$.fragment,n),r=!0)},o(n){ne(e.$$.fragment,n),r=!1},d(n){Ie(e,n)}}}function Gv(t){let e,r,n,i,o,s=t[2]&&nf(t),a=t[4].default,u=pr(a,t,t[3],null);return{c(){e=M("div"),s&&s.c(),r=W(),u&&u.c(),B(e,"data-result-id",t[0]),B(e,"class","suggestion-item omnisearch-result"),lo(e,"is-selected",t[1])},m(l,f){$(l,e,f),s&&s.m(e,null),D(e,r),u&&u.m(e,null),n=!0,i||(o=[He(e,"mousemove",t[5]),He(e,"click",t[6]),He(e,"keypress",t[7]),He(e,"auxclick",t[8])],i=!0)},p(l,[f]){l[2]?s?f&4&&ee(s,1):(s=nf(l),s.c(),ee(s,1),s.m(e,r)):s&&(Ut(),ne(s,1,1,()=>{s=null}),Gt()),u&&u.p&&(!n||f&8)&&mr(u,a,l,l[3],n?hr(a,l[3],f,null):gr(l[3]),null),(!n||f&1)&&B(e,"data-result-id",l[0]),(!n||f&2)&&lo(e,"is-selected",l[1])},i(l){n||(ee(s),ee(u,l),n=!0)},o(l){ne(s),ne(u,l),n=!1},d(l){l&&H(e),s&&s.d(),u&&u.d(l),i=!1,Xe(o)}}}function Qv(t,e,r){let{$$slots:n={},$$scope:i}=e,{id:o}=e,{selected:s=!1}=e,{glyph:a=!1}=e;function u(c){Qe.call(this,t,c)}function l(c){Qe.call(this,t,c)}function f(c){Qe.call(this,t,c)}function p(c){Qe.call(this,t,c)}return t.$$set=c=>{"id"in c&&r(0,o=c.id),"selected"in c&&r(1,s=c.selected),"glyph"in c&&r(2,a=c.glyph),"$$scope"in c&&r(3,i=c.$$scope)},[o,s,a,i,n,u,l,f,p]}var of=class extends Te{constructor(e){super();Oe(this,e,Qv,Gv,Ae,{id:0,selected:1,glyph:2})}},qi=of;var Yr=je(require("obsidian"));function sf(t){let e,r=t[1].matches.length+"",n,i,o=(t[1].matches.length>1?"matches":"match")+"",s;return{c(){e=M("span"),n=Ce(r),i=Ce("\xA0"),s=Ce(o),B(e,"class","omnisearch-result__counter")},m(a,u){$(a,e,u),D(e,n),D(e,i),D(e,s)},p(a,u){u&2&&r!==(r=a[1].matches.length+"")&&Ze(n,r),u&2&&o!==(o=(a[1].matches.length>1?"matches":"match")+"")&&Ze(s,o)},d(a){a&&H(e)}}}function af(t){let e,r,n,i,o;return{c(){e=M("div"),r=M("span"),n=W(),i=M("span"),o=Ce(t[7]),B(e,"class","omnisearch-result__folder-path")},m(s,a){$(s,e,a),D(e,r),t[14](r),D(e,n),D(e,i),D(i,o)},p(s,a){a&128&&Ze(o,s[7])},d(s){s&&H(e),t[14](null)}}}function lf(t){let e,r=Ht(t[5].content,t[9])+"";return{c(){e=M("div"),B(e,"class","omnisearch-result__body")},m(n,i){$(n,e,i),e.innerHTML=r},p(n,i){i&544&&r!==(r=Ht(n[5].content,n[9])+"")&&(e.innerHTML=r)},d(n){n&&H(e)}}}function uf(t){let e,r,n;return{c(){e=M("div"),r=M("img"),Ge(r,"width","100px"),so(r.src,n=t[6])||B(r,"src",n),B(r,"alt",""),B(e,"class","omnisearch-result__image-container")},m(i,o){$(i,e,o),D(e,r)},p(i,o){o&64&&!so(r.src,n=i[6])&&B(r,"src",n)},d(i){i&&H(e)}}}function qv(t){let e,r,n,i,o,s,a=Ht(t[2],t[10])+"",u,l,f,p=or(t[1].path)+"",c,h,w,x,v,d,b=t[1].matches.length>0&&sf(t),m=t[7]&&af(t),g=t[11]&&lf(t),y=t[6]&&uf(t);return{c(){e=M("div"),r=M("div"),n=M("span"),i=M("span"),o=W(),s=M("span"),u=W(),l=M("span"),f=Ce("."),c=Ce(p),h=W(),b&&b.c(),w=W(),m&&m.c(),x=W(),v=M("div"),g&&g.c(),d=W(),y&&y.c(),B(l,"class","omnisearch-result__extension"),B(n,"class","omnisearch-result__title"),B(r,"class","omnisearch-result__title-container"),Ge(v,"display","flex"),Ge(v,"flex-direction","row")},m(_,j){$(_,e,j),D(e,r),D(r,n),D(n,i),t[13](i),D(n,o),D(n,s),s.innerHTML=a,D(n,u),D(n,l),D(l,f),D(l,c),D(n,h),b&&b.m(n,null),D(e,w),m&&m.m(e,null),D(e,x),D(e,v),g&&g.m(v,null),D(v,d),y&&y.m(v,null)},p(_,j){j&1028&&a!==(a=Ht(_[2],_[10])+"")&&(s.innerHTML=a),j&2&&p!==(p=or(_[1].path)+"")&&Ze(c,p),_[1].matches.length>0?b?b.p(_,j):(b=sf(_),b.c(),b.m(n,null)):b&&(b.d(1),b=null),_[7]?m?m.p(_,j):(m=af(_),m.c(),m.m(e,x)):m&&(m.d(1),m=null),_[11]?g?g.p(_,j):(g=lf(_),g.c(),g.m(v,d)):g&&(g.d(1),g=null),_[6]?y?y.p(_,j):(y=uf(_),y.c(),y.m(v,null)):y&&(y.d(1),y=null)},d(_){_&&H(e),t[13](null),b&&b.d(),m&&m.d(),g&&g.d(),y&&y.d()}}}function Yv(t){let e,r;return e=new qi({props:{glyph:t[8],id:t[1].path,selected:t[0],$$slots:{default:[qv]},$$scope:{ctx:t}}}),e.$on("click",t[15]),e.$on("auxclick",t[16]),e.$on("mousemove",t[17]),{c(){$e(e.$$.fragment)},m(n,i){Re(e,n,i),r=!0},p(n,[i]){let o={};i&256&&(o.glyph=n[8]),i&2&&(o.id=n[1].path),i&1&&(o.selected=n[0]),i&265982&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(ee(e.$$.fragment,n),r=!0)},o(n){ne(e.$$.fragment,n),r=!1},d(n){Ie(e,n)}}}function Jv(t,e,r){let n,i,o,s,a,u;Ln(t,tr,y=>r(11,u=y));let{selected:l=!1}=e,{note:f}=e,p=null,c="",h="",w,x;function v(y){lt[y?"unshift":"push"](()=>{x=y,r(4,x)})}function d(y){lt[y?"unshift":"push"](()=>{w=y,r(3,w)})}function b(y){Qe.call(this,t,y)}function m(y){Qe.call(this,t,y)}function g(y){Qe.call(this,t,y)}t.$$set=y=>{"selected"in y&&r(0,l=y.selected),"note"in y&&r(1,f=y.note)},t.$$.update=()=>{if(t.$$.dirty&2){e:if(r(6,p=null),Tr(f.path)){let y=app.vault.getFiles().find(_=>_.path===f.path);y&&r(6,p=app.vault.getResourcePath(y))}}if(t.$$.dirty&2){e:r(12,n=Qr(f.foundWords))}if(t.$$.dirty&30){e:r(2,c=f.basename),r(7,h=ll(f.path)),T.ignoreDiacritics&&r(2,c=yt(c)),w&&(0,Yr.setIcon)(w,"folder-open"),x&&(Tr(f.path)?(0,Yr.setIcon)(x,"image"):ir(f.path)?(0,Yr.setIcon)(x,"file-text"):Dr(f.path)?(0,Yr.setIcon)(x,"layout-dashboard"):(0,Yr.setIcon)(x,"file"))}if(t.$$.dirty&4100){e:r(10,i=Gi(c,n))}if(t.$$.dirty&2){e:r(5,s=qr(f.content,f.matches[0]?.offset??-1))}if(t.$$.dirty&34){e:r(9,o=On(f.matches).map(y=>(y.offset=y.offset-s.offset,y)))}};e:r(8,a=!1);return[l,f,c,w,x,s,p,h,a,o,i,u,n,v,d,b,m,g]}var cf=class extends Te{constructor(e){super();Oe(this,e,Jv,Yv,Ae,{selected:0,note:1})}},ff=cf;var mf=je(hf()),js=["ext","path"],ur=class{#e;constructor(e=""){T.ignoreDiacritics&&(e=yt(e));let r=(0,mf.parse)(e.toLowerCase(),{tokenize:!0,keywords:js});r.text=r.text??[],r.exclude=r.exclude??{},r.exclude.text=r.exclude.text??[],Array.isArray(r.exclude.text)||(r.exclude.text=[r.exclude.text]),r.exclude.text=r.exclude.text.filter(n=>n.length);for(let n of js){let i=r[n];i&&(r[n]=Array.isArray(i)?i:[i]);let o=r.exclude[n];o&&(r.exclude[n]=Array.isArray(o)?o:[o])}this.query=r,this.#e=e.match(/"([^"]+)"/g)?.map(n=>n.replace(/"/g,""))??[]}isEmpty(){for(let e of js)if(this.query[e]?.length||this.query.text.length)return!1;return!0}segmentsToStr(){return this.query.text.join(" ")}getTags(){return this.query.text.filter(e=>e.startsWith("#"))}getTagsWithoutHashtag(){return this.getTags().map(e=>e.replace(/^#/,""))}getExactTerms(){return[...new Set([...this.query.text.filter(e=>e.split(" ").length>1),...this.#e].map(e=>e.toLowerCase()))]}};var ue=function(){return ue=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},ue.apply(this,arguments)};function Xv(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(f){try{l(n.next(f))}catch(p){s(p)}}function u(f){try{l(n.throw(f))}catch(p){s(p)}}function l(f){f.done?o(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function Zv(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(r=0)),r;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(l[0]===6&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(f){l=[6,f],i=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Q(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 _e(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o}var eb="ENTRIES",gf="KEYS",yf="VALUES",De="",As=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=Jr(this._path),r=e.node,n=e.keys;if(Jr(n)===De)return{done:!1,value:this.result()};var i=r.get(Jr(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=Jr(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 Jr(r)}).filter(function(e){return e!==De}).join("")},t.prototype.value=function(){return Jr(this._path).node.get(De)},t.prototype.result=function(){switch(this._type){case yf:return this.value();case gf:return this.key();default:return[this.key(),this.value()]}},t.prototype[Symbol.iterator]=function(){return this},t}(),Jr=function(t){return t[t.length-1]},tb=function(t,e,r){var n=new Map;if(e===void 0)return n;for(var i=e.length+1,o=i+r,s=new Uint8Array(o*i).fill(r+1),a=0;a<i;++a)s[a]=a;for(var u=1;u<o;++u)s[u*i]=u;return _f(t,e,r,n,s,1,i,""),n},_f=function(t,e,r,n,i,o,s,a){var u,l,f=o*s;try{e:for(var p=Q(t.keys()),c=p.next();!c.done;c=p.next()){var h=c.value;if(h===De){var w=i[f-1];w<=r&&n.set(a,[t.get(h),w])}else{for(var x=o,v=0;v<h.length;++v,++x){for(var d=h[v],b=s*x,m=b-s,g=i[b],y=Math.max(0,x-r-1),_=Math.min(s-1,x+r),j=y;j<_;++j){var A=d!==e[j],F=i[m+j]+ +A,E=i[m+j+1]+1,O=i[b+j]+1,L=i[b+j+1]=Math.min(F,E,O);L<g&&(g=L)}if(g>r)continue e}_f(t.get(h),e,r,n,i,x,s,a+h)}}}catch(k){u={error:k}}finally{try{c&&!c.done&&(l=p.return)&&l.call(p)}finally{if(u)throw u.error}}},Cs=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=_e(Ji(this._tree,e.slice(this._prefix.length)),2),o=i[0],s=i[1];if(o===void 0){var a=_e(Es(s),2),u=a[0],l=a[1];try{for(var f=Q(u.keys()),p=f.next();!p.done;p=f.next()){var c=p.value;if(c!==De&&c.startsWith(l)){var h=new Map;return h.set(c.slice(l.length),u.get(c)),new t(h,e)}}}catch(w){r={error:w}}finally{try{p&&!p.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}}return new t(o,e)},t.prototype.clear=function(){this._size=void 0,this._tree.clear()},t.prototype.delete=function(e){return this._size=void 0,rb(this._tree,e)},t.prototype.entries=function(){return new As(this,eb)},t.prototype.forEach=function(e){var r,n;try{for(var i=Q(this),o=i.next();!o.done;o=i.next()){var s=_e(o.value,2),a=s[0],u=s[1];e(a,u,this)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.fuzzyGet=function(e,r){return tb(this._tree,e,r)},t.prototype.get=function(e){var r=Ss(this._tree,e);return r!==void 0?r.get(De):void 0},t.prototype.has=function(e){var r=Ss(this._tree,e);return r!==void 0&&r.has(De)},t.prototype.keys=function(){return new As(this,gf)},t.prototype.set=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Fs(this._tree,e);return n.set(De,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=Fs(this._tree,e);return n.set(De,r(n.get(De))),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=Fs(this._tree,e),i=n.get(De);return i===void 0&&n.set(De,i=r()),i},t.prototype.values=function(){return new As(this,yf)},t.prototype[Symbol.iterator]=function(){return this.entries()},t.from=function(e){var r,n,i=new t;try{for(var o=Q(e),s=o.next();!s.done;s=o.next()){var a=_e(s.value,2),u=a[0],l=a[1];i.set(u,l)}}catch(f){r={error:f}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},t.fromObject=function(e){return t.from(Object.entries(e))},t}(),Ji=function(t,e,r){var n,i;if(r===void 0&&(r=[]),e.length===0||t==null)return[t,r];try{for(var o=Q(t.keys()),s=o.next();!s.done;s=o.next()){var a=s.value;if(a!==De&&e.startsWith(a))return r.push([t,a]),Ji(t.get(a),e.slice(a.length),r)}}catch(u){n={error:u}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r.push([t,e]),Ji(void 0,"",r)},Ss=function(t,e){var r,n;if(e.length===0||t==null)return t;try{for(var i=Q(t.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;if(s!==De&&e.startsWith(s))return Ss(t.get(s),e.slice(s.length))}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},Fs=function(t,e){var r,n,i=e.length;e:for(var o=0;t&&o<i;){try{for(var s=(r=void 0,Q(t.keys())),a=s.next();!a.done;a=s.next()){var u=a.value;if(u!==De&&e[o]===u[0]){for(var l=Math.min(i-o,u.length),f=1;f<l&&e[o+f]===u[f];)++f;var p=t.get(u);if(f===u.length)t=p;else{var c=new Map;c.set(u.slice(f),p),t.set(e.slice(o,o+f),c),t.delete(u),t=c}o+=f;continue e}}}catch(w){r={error:w}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}var h=new Map;return t.set(e.slice(o),h),h}return t},rb=function(t,e){var r=_e(Ji(t,e),2),n=r[0],i=r[1];if(n!==void 0){if(n.delete(De),n.size===0)vf(i);else if(n.size===1){var o=_e(n.entries().next().value,2),s=o[0],a=o[1];bf(i,s,a)}}},vf=function(t){if(t.length!==0){var e=_e(Es(t),2),r=e[0],n=e[1];if(r.delete(n),r.size===0)vf(t.slice(0,-1));else if(r.size===1){var i=_e(r.entries().next().value,2),o=i[0],s=i[1];o!==De&&bf(t.slice(0,-1),o,s)}}},bf=function(t,e,r){if(t.length!==0){var n=_e(Es(t),2),i=n[0],o=n[1];i.set(o+e,r),i.delete(o)}},Es=function(t){return t[t.length-1]},Pn,Ts="or",xf="and",nb="and_not",Ds=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?Ms:e.autoVacuum;this._options=ue(ue(ue({},Os),e),{autoVacuum:r,searchOptions:ue(ue({},wf),e.searchOptions||{}),autoSuggestOptions:ue(ue({},lb),e.autoSuggestOptions||{})}),this._index=new Cs,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,o,s,a,u=this._options,l=u.extractField,f=u.tokenize,p=u.processTerm,c=u.fields,h=u.idField,w=l(e,h);if(w==null)throw new Error('MiniSearch: document does not have ID field "'.concat(h,'"'));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 v=Q(c),d=v.next();!d.done;d=v.next()){var b=d.value,m=l(e,b);if(m!=null){var g=f(m.toString(),b),y=this._fieldIds[b],_=new Set(g).size;this.addFieldLength(x,y,this._documentCount-1,_);try{for(var j=(i=void 0,Q(g)),A=j.next();!A.done;A=j.next()){var F=A.value,E=p(F,b);if(Array.isArray(E))try{for(var O=(s=void 0,Q(E)),L=O.next();!L.done;L=O.next()){var k=L.value;this.addTerm(y,x,k)}}catch(z){s={error:z}}finally{try{L&&!L.done&&(a=O.return)&&a.call(O)}finally{if(s)throw s.error}}else E&&this.addTerm(y,x,E)}}catch(z){i={error:z}}finally{try{A&&!A.done&&(o=j.return)&&o.call(j)}finally{if(i)throw i.error}}}}}catch(z){r={error:z}}finally{try{d&&!d.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}},t.prototype.addAll=function(e){var r,n;try{for(var i=Q(e),o=i.next();!o.done;o=i.next()){var s=o.value;this.add(s)}}catch(a){r={error:a}}finally{try{o&&!o.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,o=i===void 0?10:i,s={chunk:[],promise:Promise.resolve()},a=e.reduce(function(f,p,c){var h=f.chunk,w=f.promise;return h.push(p),(c+1)%o==0?{chunk:[],promise:w.then(function(){return new Promise(function(x){return setTimeout(x,0)})}).then(function(){return n.addAll(h)})}:{chunk:h,promise:w}},s),u=a.chunk,l=a.promise;return l.then(function(){return n.addAll(u)})},t.prototype.remove=function(e){var r,n,i,o,s,a,u=this._options,l=u.tokenize,f=u.processTerm,p=u.extractField,c=u.fields,h=u.idField,w=p(e,h);if(w==null)throw new Error('MiniSearch: document does not have ID field "'.concat(h,'"'));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 v=Q(c),d=v.next();!d.done;d=v.next()){var b=d.value,m=p(e,b);if(m!=null){var g=l(m.toString(),b),y=this._fieldIds[b],_=new Set(g).size;this.removeFieldLength(x,y,this._documentCount,_);try{for(var j=(i=void 0,Q(g)),A=j.next();!A.done;A=j.next()){var F=A.value,E=f(F,b);if(Array.isArray(E))try{for(var O=(s=void 0,Q(E)),L=O.next();!L.done;L=O.next()){var k=L.value;this.removeTerm(y,x,k)}}catch(z){s={error:z}}finally{try{L&&!L.done&&(a=O.return)&&a.call(O)}finally{if(s)throw s.error}}else E&&this.removeTerm(y,x,E)}}catch(z){i={error:z}}finally{try{A&&!A.done&&(o=j.return)&&o.call(j)}finally{if(i)throw i.error}}}}}catch(z){r={error:z}}finally{try{d&&!d.done&&(n=v.return)&&n.call(v)}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=Q(e),o=i.next();!o.done;o=i.next()){var s=o.value;this.remove(s)}}catch(a){r={error:a}}finally{try{o&&!o.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 Cs,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},t.prototype.discard=function(e){var r=this,n=this._idToShortId.get(e);if(n==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach(function(i,o){r.removeFieldLength(n,o,r._documentCount,i)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},t.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,r=e.minDirtFactor,n=e.minDirtCount,i=e.batchSize,o=e.batchWait;this.conditionalVacuum({batchSize:i,batchWait:o},{minDirtCount:n,minDirtFactor:r})}},t.prototype.discardAll=function(e){var r,n,i=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var o=Q(e),s=o.next();!s.done;s=o.next()){var a=s.value;this.discard(a)}}catch(u){r={error:u}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}finally{this._options.autoVacuum=i}this.maybeAutoVacuum()},t.prototype.replace=function(e){var r=this._options,n=r.idField,i=r.extractField,o=i(e,n);this.discard(o),this.add(e)},t.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},t.prototype.conditionalVacuum=function(e,r){var n=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var i=n._enqueuedVacuumConditions;return n._enqueuedVacuumConditions=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 Xv(this,void 0,void 0,function(){var n,i,o,s,a,u,l,f,p,c,h,w,x,v,d,b,m,g,y,_,j,A,F,E,O;return Zv(this,function(L){switch(L.label){case 0:if(n=this._dirtCount,!this.vacuumConditionsMet(r))return[3,10];i=e.batchSize||ks.batchSize,o=e.batchWait||ks.batchWait,s=1,L.label=1;case 1:L.trys.push([1,7,8,9]),a=Q(this._index),u=a.next(),L.label=2;case 2:if(u.done)return[3,6];l=_e(u.value,2),f=l[0],p=l[1];try{for(c=(A=void 0,Q(p)),h=c.next();!h.done;h=c.next()){w=_e(h.value,2),x=w[0],v=w[1];try{for(d=(E=void 0,Q(v)),b=d.next();!b.done;b=d.next())m=_e(b.value,1),g=m[0],!this._documentIds.has(g)&&(v.size<=1?p.delete(x):v.delete(g))}catch(k){E={error:k}}finally{try{b&&!b.done&&(O=d.return)&&O.call(d)}finally{if(E)throw E.error}}}}catch(k){A={error:k}}finally{try{h&&!h.done&&(F=c.return)&&F.call(c)}finally{if(A)throw A.error}}return this._index.get(f).size===0&&this._index.delete(f),s%i!=0?[3,4]:[4,new Promise(function(k){return setTimeout(k,o)})];case 3:L.sent(),L.label=4;case 4:s+=1,L.label=5;case 5:return u=a.next(),[3,2];case 6:return[3,9];case 7:return y=L.sent(),_={error:y},[3,9];case 8:try{u&&!u.done&&(j=a.return)&&j.call(a)}finally{if(_)throw _.error}return[7];case 9:this._dirtCount-=n,L.label=10;case 10:return[4,null];case 11:return L.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},t.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var r=e.minDirtCount,n=e.minDirtFactor;return r=r||Ms.minDirtCount,n=n||Ms.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=n},Object.defineProperty(t.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),t.prototype.has=function(e){return this._idToShortId.has(e)},t.prototype.search=function(e,r){var n,i;r===void 0&&(r={});var o=this.executeQuery(e,r),s=[];try{for(var a=Q(o),u=a.next();!u.done;u=a.next()){var l=_e(u.value,2),f=l[0],p=l[1],c=p.score,h=p.terms,w=p.match,x=h.length,v={id:this._documentIds.get(f),score:c*x,terms:Object.keys(w),match:w};Object.assign(v,this._storedFields.get(f)),(r.filter==null||r.filter(v))&&s.push(v)}}catch(d){n={error:d}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s.sort(Af),s},t.prototype.autoSuggest=function(e,r){var n,i,o,s;r===void 0&&(r={}),r=ue(ue({},this._options.autoSuggestOptions),r);var a=new Map;try{for(var u=Q(this.search(e,r)),l=u.next();!l.done;l=u.next()){var f=l.value,p=f.score,c=f.terms,h=c.join(" "),w=a.get(h);w!=null?(w.score+=p,w.count+=1):a.set(h,{score:p,terms:c,count:1})}}catch(y){n={error:y}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}var x=[];try{for(var v=Q(a),d=v.next();!d.done;d=v.next()){var b=_e(d.value,2),w=b[0],m=b[1],p=m.score,c=m.terms,g=m.count;x.push({suggestion:w,terms:c,score:p/g})}}catch(y){o={error:y}}finally{try{d&&!d.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}return x.sort(Af),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(Os.hasOwnProperty(e))return Is(Os,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},t.loadJS=function(e,r){var n,i,o,s,a,u,l=e.index,f=e.documentCount,p=e.nextId,c=e.documentIds,h=e.fieldIds,w=e.fieldLength,x=e.averageFieldLength,v=e.storedFields,d=e.dirtCount,b=e.serializationVersion;if(b!==1&&b!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var m=new t(r);m._documentCount=f,m._nextId=p,m._documentIds=Xi(c),m._idToShortId=new Map,m._fieldIds=h,m._fieldLength=Xi(w),m._avgFieldLength=x,m._storedFields=Xi(v),m._dirtCount=d||0,m._index=new Cs;try{for(var g=Q(m._documentIds),y=g.next();!y.done;y=g.next()){var _=_e(y.value,2),j=_[0],A=_[1];m._idToShortId.set(A,j)}}catch(S){n={error:S}}finally{try{y&&!y.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}try{for(var F=Q(l),E=F.next();!E.done;E=F.next()){var O=_e(E.value,2),L=O[0],k=O[1],z=new Map;try{for(var J=(a=void 0,Q(Object.keys(k))),Y=J.next();!Y.done;Y=J.next()){var q=Y.value,C=k[q];b===1&&(C=C.ds),z.set(parseInt(q,10),Xi(C))}}catch(S){a={error:S}}finally{try{Y&&!Y.done&&(u=J.return)&&u.call(J)}finally{if(a)throw a.error}}m._index.set(L,z)}}catch(S){o={error:S}}finally{try{E&&!E.done&&(s=F.return)&&s.call(F)}finally{if(o)throw o.error}}return m},t.prototype.executeQuery=function(e,r){var n=this;if(r===void 0&&(r={}),typeof e!="string"){var i=ue(ue(ue({},r),e),{queries:void 0}),o=e.queries.map(function(v){return n.executeQuery(v,i)});return this.combineResults(o,e.combineWith)}var s=this._options,a=s.tokenize,u=s.processTerm,l=s.searchOptions,f=ue(ue({tokenize:a,processTerm:u},l),r),p=f.tokenize,c=f.processTerm,h=p(e).flatMap(function(v){return c(v)}).filter(function(v){return!!v}),w=h.map(ab(f)),x=w.map(function(v){return n.executeQuerySpec(v,f)});return this.combineResults(x,f.combineWith)},t.prototype.executeQuerySpec=function(e,r){var n,i,o,s,a=ue(ue({},this._options.searchOptions),r),u=(a.fields||this._options.fields).reduce(function(q,C){var S;return ue(ue({},q),(S={},S[C]=Is(q,C)||1,S))},a.boost||{}),l=a.boostDocument,f=a.weights,p=a.maxFuzzy,c=a.bm25,h=ue(ue({},wf.weights),f),w=h.fuzzy,x=h.prefix,v=this._index.get(e.term),d=this.termResults(e.term,e.term,1,v,u,l,c),b,m;if(e.prefix&&(b=this._index.atPrefix(e.term)),e.fuzzy){var g=e.fuzzy===!0?.2:e.fuzzy,y=g<1?Math.min(p,Math.round(e.term.length*g)):g;y&&(m=this._index.fuzzyGet(e.term,y))}if(b)try{for(var _=Q(b),j=_.next();!j.done;j=_.next()){var A=_e(j.value,2),F=A[0],E=A[1],O=F.length-e.term.length;if(!!O){m==null||m.delete(F);var L=x*F.length/(F.length+.3*O);this.termResults(e.term,F,L,E,u,l,c,d)}}}catch(q){n={error:q}}finally{try{j&&!j.done&&(i=_.return)&&i.call(_)}finally{if(n)throw n.error}}if(m)try{for(var k=Q(m.keys()),z=k.next();!z.done;z=k.next()){var F=z.value,J=_e(m.get(F),2),Y=J[0],O=J[1];if(!!O){var L=w*F.length/(F.length+O);this.termResults(e.term,F,L,Y,u,l,c,d)}}}catch(q){o={error:q}}finally{try{z&&!z.done&&(s=k.return)&&s.call(k)}finally{if(o)throw o.error}}return d},t.prototype.combineResults=function(e,r){if(r===void 0&&(r=Ts),e.length===0)return new Map;var n=r.toLowerCase();return e.reduce(ib[n])||new Map},t.prototype.toJSON=function(){var e,r,n,i,o=[];try{for(var s=Q(this._index),a=s.next();!a.done;a=s.next()){var u=_e(a.value,2),l=u[0],f=u[1],p={};try{for(var c=(n=void 0,Q(f)),h=c.next();!h.done;h=c.next()){var w=_e(h.value,2),x=w[0],v=w[1];p[x]=Object.fromEntries(v)}}catch(d){n={error:d}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}o.push([l,p])}}catch(d){e={error:d}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:o,serializationVersion:2}},t.prototype.termResults=function(e,r,n,i,o,s,a,u){var l,f,p,c,h;if(u===void 0&&(u=new Map),i==null)return u;try{for(var w=Q(Object.keys(o)),x=w.next();!x.done;x=w.next()){var v=x.value,d=o[v],b=this._fieldIds[v],m=i.get(b);if(m!=null){var g=m.size,y=this._avgFieldLength[b];try{for(var _=(p=void 0,Q(m.keys())),j=_.next();!j.done;j=_.next()){var A=j.value;if(!this._documentIds.has(A)){this.removeTerm(b,A,r),g-=1;continue}var F=s?s(this._documentIds.get(A),r):1;if(!!F){var E=m.get(A),O=this._fieldLength.get(A)[b],L=sb(E,g,this._documentCount,O,y,a),k=n*d*F*L,z=u.get(A);if(z){z.score+=k,ub(z.terms,e);var J=Is(z.match,r);J?J.push(v):z.match[r]=[v]}else u.set(A,{score:k,terms:[e],match:(h={},h[r]=[v],h)})}}}catch(Y){p={error:Y}}finally{try{j&&!j.done&&(c=_.return)&&c.call(_)}finally{if(p)throw p.error}}}}}catch(Y){l={error:Y}}finally{try{x&&!x.done&&(f=w.return)&&f.call(w)}finally{if(l)throw l.error}}return u},t.prototype.addTerm=function(e,r,n){var i=this._index.fetch(n,Cf),o=i.get(e);if(o==null)o=new Map,o.set(r,1),i.set(e,o);else{var s=o.get(r);o.set(r,(s||0)+1)}},t.prototype.removeTerm=function(e,r,n){if(!this._index.has(n)){this.warnDocumentChanged(r,e,n);return}var i=this._index.fetch(n,Cf),o=i.get(e);o==null||o.get(r)==null?this.warnDocumentChanged(r,e,n):o.get(r)<=1?o.size<=1?i.delete(e):o.delete(r):o.set(r,o.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)},t.prototype.warnDocumentChanged=function(e,r,n){var i,o;try{for(var s=Q(Object.keys(this._fieldIds)),a=s.next();!a.done;a=s.next()){var u=a.value;if(this._fieldIds[u]===r){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(n,'" was not present in field "').concat(u,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(l){i={error:l}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}},t.prototype.addDocumentId=function(e){var r=this._nextId;return this._idToShortId.set(e,r),this._documentIds.set(r,e),this._documentCount+=1,this._nextId+=1,r},t.prototype.addFields=function(e){for(var r=0;r<e.length;r++)this._fieldIds[e[r]]=r},t.prototype.addFieldLength=function(e,r,n,i){var o=this._fieldLength.get(e);o==null&&this._fieldLength.set(e,o=[]),o[r]=i;var s=this._avgFieldLength[r]||0,a=s*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 o=this._avgFieldLength[r]*n-i;this._avgFieldLength[r]=o/(n-1)},t.prototype.saveStoredFields=function(e,r){var n,i,o=this._options,s=o.storeFields,a=o.extractField;if(!(s==null||s.length===0)){var u=this._storedFields.get(e);u==null&&this._storedFields.set(e,u={});try{for(var l=Q(s),f=l.next();!f.done;f=l.next()){var p=f.value,c=a(r,p);c!==void 0&&(u[p]=c)}}catch(h){n={error:h}}finally{try{f&&!f.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}},t}(),Is=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0},ib=(Pn={},Pn[Ts]=function(t,e){var r,n;try{for(var i=Q(e.keys()),o=i.next();!o.done;o=i.next()){var s=o.value,a=t.get(s);if(a==null)t.set(s,e.get(s));else{var u=e.get(s),l=u.score,f=u.terms,p=u.match;a.score=a.score+l,a.match=Object.assign(a.match,p),jf(a.terms,f)}}}catch(c){r={error:c}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},Pn[xf]=function(t,e){var r,n,i=new Map;try{for(var o=Q(e.keys()),s=o.next();!s.done;s=o.next()){var a=s.value,u=t.get(a);if(u!=null){var l=e.get(a),f=l.score,p=l.terms,c=l.match;jf(u.terms,p),i.set(a,{score:u.score+f,terms:u.terms,match:Object.assign(u.match,c)})}}}catch(h){r={error:h}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},Pn[nb]=function(t,e){var r,n;try{for(var i=Q(e.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;t.delete(s)}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},Pn),ob={k:1.2,b:.7,d:.5},sb=function(t,e,r,n,i,o){var s=o.k,a=o.b,u=o.d,l=Math.log(1+(r-e+.5)/(e+.5));return l*(u+t*(s+1)/(t+s*(1-a+a*n/i)))},ab=function(t){return function(e,r,n){var i=typeof t.fuzzy=="function"?t.fuzzy(e,r,n):t.fuzzy||!1,o=typeof t.prefix=="function"?t.prefix(e,r,n):t.prefix===!0;return{term:e,fuzzy:i,prefix:o}}},Os={idField:"id",extractField:function(t,e){return t[e]},tokenize:function(t,e){return t.split(cb)},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},wf={combineWith:Ts,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:ob},lb={combineWith:xf,prefix:function(t,e,r){return e===r.length-1}},ks={batchSize:1e3,batchWait:10},Ps={minDirtFactor:.1,minDirtCount:20},Ms=ue(ue({},ks),Ps),ub=function(t,e){t.includes(e)||t.push(e)},jf=function(t,e){var r,n;try{for(var i=Q(e),o=i.next();!o.done;o=i.next()){var s=o.value;t.includes(s)||t.push(s)}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},Af=function(t,e){var r=t.score,n=e.score;return n-r},Cf=function(){return new Map},Xi=function(t){var e,r,n=new Map;try{for(var i=Q(Object.keys(t)),o=i.next();!o.done;o=i.next()){var s=o.value;n.set(parseInt(s,10),t[s])}}catch(a){e={error:a}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},cb=/[\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 Sf=je(require("obsidian"));var fb=t=>{let e=t.split(Sn);e=[...e,...e.flatMap(hl)],e=[...e,...e.flatMap(pl)];let r=mi();return r&&(e=e.flatMap(n=>el.test(n)?r.cut(n):[n])),e},Zi=class{constructor(){this.indexedDocuments=new Map;this.minisearch=new Ds(Zi.options)}async loadCache(){let e=await Fe.getMinisearchCache();return e?(this.minisearch=Ds.loadJS(e.data,Zi.options),this.indexedDocuments=new Map(e.paths.map(r=>[r.path,r.mtime])),!0):(console.log("Omnisearch - No cache found"),!1)}getDiff(e){let r=new Map(e.map(o=>[o.path,o.mtime])),n=e.filter(o=>!this.indexedDocuments.has(o.path)||this.indexedDocuments.get(o.path)!==o.mtime),i=[...this.indexedDocuments].filter(([o,s])=>!r.has(o)||r.get(o)!==s).map(o=>({path:o[0],mtime:o[1]}));return{toAdd:n,toRemove:i}}async addFromPaths(e){fe("Adding files",e);let r=(await Promise.all(e.map(async i=>await Fe.getDocument(i)))).filter(i=>!!i?.path);fe("Sorting documents to first index markdown"),r=xs(r,i=>i.path.endsWith(".md")?0:1),this.removeFromPaths(r.filter(i=>this.indexedDocuments.has(i.path)).map(i=>i.path));let n=dl(r,500);for(let i of n){fe("Indexing into search engine",i),i.forEach(s=>this.indexedDocuments.set(s.path,s.mtime));let o=i.filter(s=>this.minisearch.has(s.path));this.removeFromPaths(o.map(s=>s.path)),await this.minisearch.addAllAsync(i)}}removeFromPaths(e){e.forEach(n=>this.indexedDocuments.delete(n));let r=e.filter(n=>this.minisearch.has(n));this.minisearch.discardAll(r)}async search(e,r){if(e.isEmpty())return[];fe("=== New search ==="),fe("Starting search for",e);let n;switch(T.fuzziness){case"0":n=0;break;case"1":n=.1;break;default:n=.2;break}let i=this.minisearch.search(e.segmentsToStr(),{prefix:l=>l.length>=r.prefixLength,fuzzy:l=>l.length<=3?0:l.length<=5?n/2:n,combineWith:"AND",boost:{basename:T.weightBasename,directory:T.weightDirectory,aliases:T.weightBasename,headings1:T.weightH1,headings2:T.weightH2,headings3:T.weightH3,unmarkedTags:T.weightUnmarkedTags}});if(fe("Found",i.length,"results"),e.query.ext?.length&&(i=i.filter(l=>{let f="."+l.id.split(".").pop();return e.query.ext?.some(p=>f.startsWith(p.startsWith(".")?p:"."+p))})),e.query.path&&(i=i.filter(l=>e.query.path?.some(f=>l.id.toLowerCase().includes(f.toLowerCase())))),e.query.exclude.path&&(i=i.filter(l=>!e.query.exclude.path?.some(f=>l.id.toLowerCase().includes(f.toLowerCase())))),!i.length)return[];if(r.singleFilePath)return i.filter(l=>l.id===r.singleFilePath);T.hideExcluded?i=i.filter(l=>!(app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(l.id))):i.forEach(l=>{app.metadataCache.isUserIgnored&&app.metadataCache.isUserIgnored(l.id)&&(l.score/=10)});let o=e.getTags();for(let l of o)for(let f of i)(f.tags??[]).includes(l)&&(f.score*=100);fe("Sorting and limiting results"),i=i.sort((l,f)=>f.score-l.score).slice(0,50),i.length&&fe("First result:",i[0]);let s=await Promise.all(i.map(async l=>await Fe.getDocument(l.id))),a=e.getExactTerms();a.length&&(fe("Filtering with quoted terms: ",a),i=i.filter(l=>{let f=s.find(h=>h.path===l.id),p=f?.path.toLowerCase()??"",c=ps(f?.content??"").toLowerCase();return a.every(h=>c.includes(h)||p.includes(h))}));let u=e.query.exclude.text;return u.length&&(fe("Filtering with exclusions"),i=i.filter(l=>{let f=ps(s.find(p=>p.path===l.id)?.content??"").toLowerCase();return u.every(p=>!f.includes(p))})),fe("Deduping"),i=i.filter((l,f,p)=>p.findIndex(c=>c.id===l.id)===f),i}async getSuggestions(e,r){let n;T.simpleSearch?n=await this.search(e,{prefixLength:3,singleFilePath:r?.singleFilePath}):n=await this.search(e,{prefixLength:1,singleFilePath:r?.singleFilePath});let i=await Promise.all(n.map(async s=>await Fe.getDocument(s.id)));return n.map(s=>{fe("Locating matches for",s.id);let a=i.find(p=>p.path===s.id);a||(console.warn(`Omnisearch - Note "${s.id}" not in the live cache`),a={content:"",basename:s.id,path:s.id});let u=[...Object.keys(s.match),...e.getExactTerms(),...e.getTags()].filter(p=>p.length>1||/\p{Emoji}/u.test(p));fe("Matching tokens:",u),fe("Getting matches locations...");let l=Gi(a.content,Qr(u),e);return fe(`Matches for ${a.basename}`,l),pe({score:s.score,foundWords:u,matches:l},a)})}async writeToCache(){await Fe.writeMinisearchCache(this.minisearch,this.indexedDocuments)}},Rs=Zi;Rs.options={tokenize:fb,extractField:(e,r)=>{if(r==="directory"){let n=e.path.split("/");return n.pop(),n.join("/")}return e[r]},processTerm:e=>(T.ignoreDiacritics?yt(e):e).toLowerCase(),idField:"path",fields:["basename","directory","aliases","content","headings1","headings2","headings3"],storeFields:["tags"],logger(e,r,n){n==="version_conflict"&&new Sf.Notice("Omnisearch - Your index cache may be incorrect or corrupted. If this message keeps appearing, go to Settings to clear the cache.",5e3)}};var xe=new Rs;var Ls=new Set;function Ff(t){Ls.add(t)}async function eo(){let t=[...Ls].map(e=>e.path);t.length&&(xe.removeFromPaths(t),await xe.addFromPaths(t),Ls.clear())}var Tf=je(Ef());function Df(t,e,r){let n=t.slice();return n[36]=e[r],n[38]=r,n}function db(t){let e,r,n;return{c(){e=M("button"),e.textContent="Create note"},m(i,o){$(i,e,o),r||(n=He(e,"click",t[12]),r=!0)},p:he,d(i){i&&H(e),r=!1,n()}}}function pb(t){let e,r=T.showCreateButton&&db(t);return{c(){r&&r.c(),e=yr()},m(n,i){r&&r.m(n,i),$(n,e,i)},p(n,i){T.showCreateButton&&r.p(n,i)},d(n){r&&r.d(n),n&&H(e)}}}function If(t){let e,r,n;return{c(){e=M("div"),r=Ce("\u23F3 Work in progress: "),n=Ce(t[3]),Ge(e,"text-align","center"),Ge(e,"color","var(--text-accent)"),Ge(e,"margin-top","10px")},m(i,o){$(i,e,o),D(e,r),D(e,n)},p(i,o){o[0]&8&&Ze(n,i[3])},d(i){i&&H(e)}}}function Of(t){let e,r;function n(...i){return t[18](t[38],...i)}return e=new ff({props:{selected:t[38]===t[0],note:t[36]}}),e.$on("mousemove",n),e.$on("click",t[10]),e.$on("auxclick",t[19]),{c(){$e(e.$$.fragment)},m(i,o){Re(e,i,o),r=!0},p(i,o){t=i;let s={};o[0]&1&&(s.selected=t[38]===t[0]),o[0]&4&&(s.note=t[36]),e.$set(s)},i(i){r||(ee(e.$$.fragment,i),r=!0)},o(i){ne(e.$$.fragment,i),r=!1},d(i){Ie(e,i)}}}function hb(t){let e;return{c(){e=Ce("Searching...")},m(r,n){$(r,e,n)},p:he,d(r){r&&H(e)}}}function mb(t){let e,r=T.simpleSearch&&t[1].split(Sn).some(Pf),n,i=r&&kf(t);return{c(){e=Ce(`We found 0 result for your search here.
`),i&&i.c(),n=yr()},m(o,s){$(o,e,s),i&&i.m(o,s),$(o,n,s)},p(o,s){s[0]&2&&(r=T.simpleSearch&&o[1].split(Sn).some(Pf)),r?i||(i=kf(o),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},d(o){o&&H(e),i&&i.d(o),o&&H(n)}}}function kf(t){let e,r,n;return{c(){e=M("br"),r=W(),n=M("span"),n.textContent=`You have enabled "Simpler Search" in the settings, try to type more
characters.`,Ge(n,"color","var(--text-accent)"),Ge(n,"font-size","small")},m(i,o){$(i,e,o),$(i,r,o),$(i,n,o)},d(i){i&&H(e),i&&H(r),i&&H(n)}}}function gb(t){let e,r,n,i=t[2],o=[];for(let f=0;f<i.length;f+=1)o[f]=Of(Df(t,i,f));let s=f=>ne(o[f],1,1,()=>{o[f]=null});function a(f,p){if(!f[2].length&&f[1]&&!f[4])return mb;if(f[4])return hb}let u=a(t,[-1,-1]),l=u&&u(t);return{c(){for(let f=0;f<o.length;f+=1)o[f].c();e=W(),r=M("div"),l&&l.c(),Ge(r,"text-align","center")},m(f,p){for(let c=0;c<o.length;c+=1)o[c].m(f,p);$(f,e,p),$(f,r,p),l&&l.m(r,null),n=!0},p(f,p){if(p[0]&3077){i=f[2];let c;for(c=0;c<i.length;c+=1){let h=Df(f,i,c);o[c]?(o[c].p(h,p),ee(o[c],1)):(o[c]=Of(h),o[c].c(),ee(o[c],1),o[c].m(e.parentNode,e))}for(Ut(),c=i.length;c<o.length;c+=1)s(c);Gt()}u===(u=a(f,p))&&l?l.p(f,p):(l&&l.d(1),l=u&&u(f),l&&(l.c(),l.m(r,null)))},i(f){if(!n){for(let p=0;p<i.length;p+=1)ee(o[p]);n=!0}},o(f){o=o.filter(Boolean);for(let p=0;p<o.length;p+=1)ne(o[p]);n=!1},d(f){Bn(o,f),f&&H(e),f&&H(r),l&&l.d()}}}function yb(t){let e,r,n,i,o,s,a,u,l,f,p,c,h,w,x,v,d,b,m,g,y,_,j,A,F,E,O,L,k,z,J,Y,q,C,S,I,N,X,P,re,Ke,we,me,ze,Uf={initialValue:t[1],placeholder:"Omnisearch - Vault",$$slots:{default:[pb]},$$scope:{ctx:t}};e=new bi({props:Uf}),t[16](e),e.$on("input",t[17]);let Ve=t[3]&&If(t);return i=new xi({props:{$$slots:{default:[gb]},$$scope:{ctx:t}}}),{c(){$e(e.$$.fragment),r=W(),Ve&&Ve.c(),n=W(),$e(i.$$.fragment),o=W(),s=M("div"),a=M("div"),a.innerHTML='<span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span>',u=W(),l=M("div"),l.innerHTML=`<span class="prompt-instruction-command">alt \u2191\u2193</span>
<span>to cycle history</span>`,f=W(),p=M("div"),c=M("span"),h=Ce(t[7]),w=W(),x=M("span"),x.textContent="to open",v=W(),d=M("div"),d.innerHTML=`<span class="prompt-instruction-command">tab</span>
<span>to switch to In-File Search</span>`,b=W(),m=M("div"),g=M("span"),y=Ce(t[6]),_=W(),j=M("span"),j.textContent="to open in a new pane",A=W(),F=M("div"),F.innerHTML=`<span class="prompt-instruction-command">alt o</span>
<span>to open in the background</span>`,E=W(),O=M("div"),L=M("span"),k=Ce(t[9]),z=W(),J=M("span"),J.textContent="to create",Y=W(),q=M("div"),C=M("span"),S=Ce(t[8]),I=W(),N=M("span"),N.textContent="to create in a new pane",X=W(),P=M("div"),P.innerHTML=`<span class="prompt-instruction-command">alt \u21B5</span>
<span>to insert a link</span>`,re=W(),Ke=M("div"),Ke.innerHTML=`<span class="prompt-instruction-command">ctrl h</span>
<span>to toggle excerpts</span>`,we=W(),me=M("div"),me.innerHTML='<span class="prompt-instruction-command">esc</span><span>to close</span>',B(a,"class","prompt-instruction"),B(l,"class","prompt-instruction"),B(c,"class","prompt-instruction-command"),B(p,"class","prompt-instruction"),B(d,"class","prompt-instruction"),B(g,"class","prompt-instruction-command"),B(m,"class","prompt-instruction"),B(F,"class","prompt-instruction"),B(L,"class","prompt-instruction-command"),B(O,"class","prompt-instruction"),B(C,"class","prompt-instruction-command"),B(q,"class","prompt-instruction"),B(P,"class","prompt-instruction"),B(Ke,"class","prompt-instruction"),B(me,"class","prompt-instruction"),B(s,"class","prompt-instructions")},m(Z,ve){Re(e,Z,ve),$(Z,r,ve),Ve&&Ve.m(Z,ve),$(Z,n,ve),Re(i,Z,ve),$(Z,o,ve),$(Z,s,ve),D(s,a),D(s,u),D(s,l),D(s,f),D(s,p),D(p,c),D(c,h),D(p,w),D(p,x),D(s,v),D(s,d),D(s,b),D(s,m),D(m,g),D(g,y),D(m,_),D(m,j),D(s,A),D(s,F),D(s,E),D(s,O),D(O,L),D(L,k),D(O,z),D(O,J),D(s,Y),D(s,q),D(q,C),D(C,S),D(q,I),D(q,N),D(s,X),D(s,P),D(s,re),D(s,Ke),D(s,we),D(s,me),ze=!0},p(Z,ve){let io={};ve[0]&2&&(io.initialValue=Z[1]),ve[1]&256&&(io.$$scope={dirty:ve,ctx:Z}),e.$set(io),Z[3]?Ve?Ve.p(Z,ve):(Ve=If(Z),Ve.c(),Ve.m(n.parentNode,n)):Ve&&(Ve.d(1),Ve=null);let Vs={};ve[0]&23|ve[1]&256&&(Vs.$$scope={dirty:ve,ctx:Z}),i.$set(Vs),(!ze||ve[0]&128)&&Ze(h,Z[7]),(!ze||ve[0]&64)&&Ze(y,Z[6]),(!ze||ve[0]&512)&&Ze(k,Z[9]),(!ze||ve[0]&256)&&Ze(S,Z[8])},i(Z){ze||(ee(e.$$.fragment,Z),ee(i.$$.fragment,Z),ze=!0)},o(Z){ne(e.$$.fragment,Z),ne(i.$$.fragment,Z),ze=!1},d(Z){t[16](null),Ie(e,Z),Z&&H(r),Ve&&Ve.d(Z),Z&&H(n),Ie(i,Z),Z&&H(o),Z&&H(s)}}}var Pf=t=>t.length<3;function _b(t,e,r){let n,i;Ln(t,Ot,P=>r(15,i=P));let{modal:o}=e,{previousQuery:s}=e,a=0,u=0,l,f=[],p,c="",h=!0,w,x,v,d,b;rn(async()=>{U.enable("vault"),U.on("vault",te.Enter,A),U.on("vault",te.OpenInBackground,F),U.on("vault",te.CreateNote,z),U.on("vault",te.OpenInNewPane,E),U.on("vault",te.InsertLink,J),U.on("vault",te.Tab,Y),U.on("vault",te.ArrowUp,()=>q(-1)),U.on("vault",te.ArrowDown,()=>q(1)),U.on("vault",te.PrevSearchHistory,m),U.on("vault",te.NextSearchHistory,g),await eo(),T.showPreviousQueryResults&&r(13,s=(await Fe.getSearchHistory())[0])}),nn(()=>{U.disable("vault")});async function m(){let P=(await Fe.getSearchHistory()).filter(re=>re);++u>=P.length&&(u=0),r(1,l=P[u]),w?.setInputValue(l)}async function g(){let P=(await Fe.getSearchHistory()).filter(re=>re);--u<0&&(u=P.length?P.length-1:0),r(1,l=P[u]),w?.setInputValue(l)}let y=null;async function _(){y&&(y.cancel(),y=null),p=new ur(l),y=(0,Tf.cancelable)(new Promise(P=>{P(xe.getSuggestions(p))})),r(2,f=await y),r(0,a=0),await C()}function j(P){!n||(P?.ctrlKey?E():A(),o.close())}function A(){!n||(L(n),o.close())}function F(){!n||L(n,!0)}function E(){!n||(L(n,!0),o.close())}function O(){l&&Fe.addToSearchHistory(l)}function L(P,re=!1){O(),Qi(P,re)}async function k(P){await z()}async function z(P){if(l){try{await ef(l,P?.newLeaf)}catch(re){new $t.Notice(re.message);return}o.close()}}function J(){if(!n)return;let P=app.vault.getMarkdownFiles().find(ze=>ze.path===n.path),re=app.workspace.getActiveFile(),Ke=app.workspace.getActiveViewOfType($t.MarkdownView);if(!Ke?.editor){new $t.Notice("Omnisearch - Error - No active editor",3e3);return}let we;P&&re?we=app.fileManager.generateMarkdownLink(P,re.path):we=`[[${n.basename}.${or(n.path)}]]`;let me=Ke.editor.getCursor();Ke.editor.replaceRange(we,me,me),me.ch+=we.length,Ke.editor.setCursor(me),o.close()}function Y(){if(!(n&&(ir(n?.path)||!n?.matches.length)))if(O(),o.close(),n){let P=app.vault.getAbstractFileByPath(n.path);P&&P instanceof $t.TFile&&new Xr(app,P,l).open()}else{let P=app.workspace.getActiveViewOfType($t.MarkdownView);P&&new Xr(app,P.file,l).open()}}function q(P){r(0,a=yi(a+P,f.length)),C()}async function C(){await jt(),n&&activeWindow.document.querySelector(`[data-result-id="${n.path}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}function S(P){lt[P?"unshift":"push"](()=>{w=P,r(5,w)})}let I=P=>r(1,l=P.detail),N=(P,re)=>r(0,a=P),X=P=>{P.button==1&&E()};t.$$set=P=>{"modal"in P&&r(14,o=P.modal),"previousQuery"in P&&r(13,s=P.previousQuery)},t.$$.update=()=>{if(t.$$.dirty[0]&8194){e:r(1,l=l??s)}if(t.$$.dirty[0]&2){e:l?(r(4,h=!0),_().then(()=>{r(4,h=!1)})):(r(4,h=!1),r(2,f=[]))}if(t.$$.dirty[0]&5){e:n=f[a]}if(t.$$.dirty[0]&32768){e:switch(i){case Je.LoadingCache:r(3,c="Loading cache...");break;case Je.ReadingFiles:r(3,c="Reading files...");break;case Je.IndexingFiles:r(3,c="Indexing files...");break;case Je.WritingCache:_(),r(3,c="Updating cache...");break;default:_(),r(3,c="");break}}};e:T.openInNewPane?(r(6,x="\u21B5"),r(7,v=nr()+" \u21B5"),r(8,d="shift \u21B5"),r(9,b=nr()+" shift \u21B5")):(r(6,x=nr()+" \u21B5"),r(7,v="\u21B5"),r(8,d=nr()+" shift \u21B5"),r(9,b="shift \u21B5"));return[a,l,f,c,h,w,x,v,d,b,j,E,k,s,o,i,S,I,N,X]}var Mf=class extends Te{constructor(e){super();Oe(this,e,_b,yb,Ae,{modal:14,previousQuery:13},null,[-1,-1])}},Rf=Mf;var Nf=je(require("obsidian"));function vb(t){let e,r=Ht(t[2].content,t[3])+"";return{c(){e=M("div"),B(e,"class","omnisearch-result__body")},m(n,i){$(n,e,i),e.innerHTML=r},p(n,i){i&12&&r!==(r=Ht(n[2].content,n[3])+"")&&(e.innerHTML=r)},d(n){n&&H(e)}}}function bb(t){let e,r;return e=new qi({props:{id:t[0].toString(),selected:t[1],$$slots:{default:[vb]},$$scope:{ctx:t}}}),e.$on("mousemove",t[6]),e.$on("click",t[7]),e.$on("auxclick",t[8]),{c(){$e(e.$$.fragment)},m(n,i){Re(e,n,i),r=!0},p(n,[i]){let o={};i&1&&(o.id=n[0].toString()),i&2&&(o.selected=n[1]),i&524&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(ee(e.$$.fragment,n),r=!0)},o(n){ne(e.$$.fragment,n),r=!1},d(n){Ie(e,n)}}}function xb(t,e,r){let n,i,{offset:o}=e,{note:s}=e,{index:a=0}=e,{selected:u=!1}=e;function l(c){Qe.call(this,t,c)}function f(c){Qe.call(this,t,c)}function p(c){Qe.call(this,t,c)}return t.$$set=c=>{"offset"in c&&r(4,o=c.offset),"note"in c&&r(5,s=c.note),"index"in c&&r(0,a=c.index),"selected"in c&&r(1,u=c.selected)},t.$$.update=()=>{if(t.$$.dirty&48){e:r(2,n=qr(s?.content??"",o))}if(t.$$.dirty&36){e:r(3,i=On(s.matches).map(c=>(c.offset=c.offset-n.offset,c)))}},[a,u,n,i,o,s,l,f,p]}var Lf=class extends Te{constructor(e){super();Oe(this,e,xb,bb,Ae,{offset:4,note:5,index:0,selected:1})}},Bf=Lf;function Kf(t,e,r){let n=t.slice();return n[19]=e[r],n[21]=r,n}function wb(t){let e;return{c(){e=M("div"),e.textContent="We found 0 result for your search here.",Ge(e,"text-align","center")},m(r,n){$(r,e,n)},p:he,i:he,o:he,d(r){r&&H(e)}}}function jb(t){let e,r,n=t[4],i=[];for(let s=0;s<n.length;s+=1)i[s]=zf(Kf(t,n,s));let o=s=>ne(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=yr()},m(s,a){for(let u=0;u<i.length;u+=1)i[u].m(s,a);$(s,e,a),r=!0},p(s,a){if(a&120){n=s[4];let u;for(u=0;u<n.length;u+=1){let l=Kf(s,n,u);i[u]?(i[u].p(l,a),ee(i[u],1)):(i[u]=zf(l),i[u].c(),ee(i[u],1),i[u].m(e.parentNode,e))}for(Ut(),u=n.length;u<i.length;u+=1)o(u);Gt()}},i(s){if(!r){for(let a=0;a<n.length;a+=1)ee(i[a]);r=!0}},o(s){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)ne(i[a]);r=!1},d(s){Bn(i,s),s&&H(e)}}}function zf(t){let e,r;function n(...i){return t[11](t[21],...i)}return e=new Bf({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(){$e(e.$$.fragment)},m(i,o){Re(e,i,o),r=!0},p(i,o){t=i;let s={};o&16&&(s.offset=t[19]),o&8&&(s.note=t[3]),o&32&&(s.selected=t[21]===t[5]),e.$set(s)},i(i){r||(ee(e.$$.fragment,i),r=!0)},o(i){ne(e.$$.fragment,i),r=!1},d(i){Ie(e,i)}}}function Ab(t){let e,r,n,i,o=[jb,wb],s=[];function a(u,l){return u[4].length&&u[3]?0:1}return e=a(t,-1),r=s[e]=o[e](t),{c(){r.c(),n=yr()},m(u,l){s[e].m(u,l),$(u,n,l),i=!0},p(u,l){let f=e;e=a(u,l),e===f?s[e].p(u,l):(Ut(),ne(s[f],1,1,()=>{s[f]=null}),Gt(),r=s[e],r?r.p(u,l):(r=s[e]=o[e](u),r.c()),ee(r,1),r.m(n.parentNode,n))},i(u){i||(ee(r),i=!0)},o(u){ne(r),i=!1},d(u){s[e].d(u),u&&H(n)}}}function Cb(t){let e;return{c(){e=M("span"),e.textContent="to close"},m(r,n){$(r,e,n)},d(r){r&&H(e)}}}function Sb(t){let e;return{c(){e=M("span"),e.textContent="to go back to Vault Search"},m(r,n){$(r,e,n)},d(r){r&&H(e)}}}function Fb(t){let e,r,n,i,o,s,a,u,l,f,p,c,h,w,x,v,d,b,m,g;e=new bi({props:{placeholder:"Omnisearch - File",initialValue:t[1]}}),e.$on("input",t[10]),n=new xi({props:{$$slots:{default:[Ab]},$$scope:{ctx:t}}});function y(A,F){return A[0]?Sb:Cb}let _=y(t,-1),j=_(t);return{c(){$e(e.$$.fragment),r=W(),$e(n.$$.fragment),i=W(),o=M("div"),s=M("div"),s.innerHTML='<span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span>',a=W(),u=M("div"),u.innerHTML='<span class="prompt-instruction-command">\u21B5</span><span>to open</span>',l=W(),f=M("div"),f.innerHTML=`<span class="prompt-instruction-command">tab</span>
<span>to switch to Vault Search</span>`,p=W(),c=M("div"),h=M("span"),h.textContent="esc",w=W(),j.c(),x=W(),v=M("div"),d=M("span"),d.textContent=`${nr()} \u21B5`,b=W(),m=M("span"),m.textContent="to open in a new pane",B(s,"class","prompt-instruction"),B(u,"class","prompt-instruction"),B(f,"class","prompt-instruction"),B(h,"class","prompt-instruction-command"),B(c,"class","prompt-instruction"),B(d,"class","prompt-instruction-command"),B(v,"class","prompt-instruction"),B(o,"class","prompt-instructions")},m(A,F){Re(e,A,F),$(A,r,F),Re(n,A,F),$(A,i,F),$(A,o,F),D(o,s),D(o,a),D(o,u),D(o,l),D(o,f),D(o,p),D(o,c),D(c,h),D(c,w),j.m(c,null),D(o,x),D(o,v),D(v,d),D(v,b),D(v,m),g=!0},p(A,[F]){let E={};F&2&&(E.initialValue=A[1]),e.$set(E);let O={};F&4194360&&(O.$$scope={dirty:F,ctx:A}),n.$set(O),_!==(_=y(A,F))&&(j.d(1),j=_(A),j&&(j.c(),j.m(c,null)))},i(A){g||(ee(e.$$.fragment,A),ee(n.$$.fragment,A),g=!0)},o(A){ne(e.$$.fragment,A),ne(n.$$.fragment,A),g=!1},d(A){Ie(e,A),A&&H(r),Ie(n,A),A&&H(i),A&&H(o),j.d()}}}function Eb(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 Tb(t,e,r){let{modal:n}=e,{parent:i=null}=e,{singleFilePath:o=""}=e,{previousQuery:s}=e,a,u=[],l=0,f,p;rn(()=>{U.enable("infile"),U.on("infile",te.Enter,v),U.on("infile",te.OpenInNewPane,x),U.on("infile",te.ArrowUp,()=>h(-1)),U.on("infile",te.ArrowDown,()=>h(1)),U.on("infile",te.Tab,d)}),nn(()=>{U.disable("infile")});function c(_){let j=[],A=-1,F=0;for(;;){let E=Eb(_,A,Cn);if(!E.length||(A=E.last().offset,j.push(E),++F>100))break}return j}function h(_){r(5,l=yi(l+_,u.length)),w()}async function w(){await jt(),document.querySelector(`[data-result-id="${l}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function x(){return v(!0)}async function v(_=!1){if(f){n.close(),i&&i.close(),await Qi(f,_);let j=app.workspace.getActiveViewOfType(Nf.MarkdownView);if(!j)return;let A=u[l]??0,F=j.editor.offsetToPos(A);F.ch=0,j.editor.setCursor(F),j.editor.scrollIntoView({from:{line:F.line-10,ch:0},to:{line:F.line+10,ch:0}})}}function d(){new cr(app,a??s).open(),n.close()}let b=_=>r(2,a=_.detail),m=(_,j)=>r(5,l=_),g=_=>v(_.ctrlKey),y=_=>{_.button==1&&v(!0)};return t.$$set=_=>{"modal"in _&&r(7,n=_.modal),"parent"in _&&r(0,i=_.parent),"singleFilePath"in _&&r(8,o=_.singleFilePath),"previousQuery"in _&&r(1,s=_.previousQuery)},t.$$.update=()=>{if(t.$$.dirty&2){e:r(2,a=s??"")}if(t.$$.dirty&772){e:(async()=>{a&&(r(9,p=new ur(a)),r(3,f=(await xe.getSuggestions(p,{singleFilePath:o}))[0]??null)),r(5,l=0),await w()})()}if(t.$$.dirty&8){e:if(f){let _=c(f.matches);r(4,u=_.map(j=>Math.round((j.first().offset+j.last().offset)/2)))}}},[i,s,a,f,u,l,v,n,o,p,b,m,g,y]}var Vf=class extends Te{constructor(e){super();Oe(this,e,Tb,Fb,Ae,{modal:7,parent:0,singleFilePath:8,previousQuery:1})}},Hf=Vf;var Ns=class extends ro.Modal{constructor(e){super(e);this.modalEl.replaceChildren(),this.modalEl.addClass("omnisearch-modal","prompt"),this.modalEl.removeClass("modal"),this.modalEl.tabIndex=-1,this.scope.register([],"ArrowDown",s=>{s.preventDefault(),U.emit(te.ArrowDown)}),this.scope.register([],"ArrowUp",s=>{s.preventDefault(),U.emit(te.ArrowUp)});for(let s of[{k:"J",dir:"down"},{k:"K",dir:"up"}])for(let a of["Ctrl","Mod"])this.scope.register([a],s.k,u=>{T.vimLikeNavigationShortcut&&U.emit("arrow-"+s.dir)});for(let s of[{k:"N",dir:"down"},{k:"P",dir:"up"}])for(let a of["Ctrl","Mod"])this.scope.register([a],s.k,u=>{T.vimLikeNavigationShortcut&&U.emit("arrow-"+s.dir)});let r,n,i,o;T.openInNewPane?(r=["Mod"],n=[],i=["Mod","Shift"],o=["Shift"]):(r=[],n=["Mod"],i=["Shift"],o=["Mod","Shift"]),this.scope.register(n,"Enter",s=>{s.preventDefault(),U.emit(te.OpenInNewPane)}),this.scope.register(["Alt"],"Enter",s=>{s.preventDefault(),U.emit(te.InsertLink)}),this.scope.register(i,"Enter",s=>{s.preventDefault(),U.emit(te.CreateNote)}),this.scope.register(o,"Enter",s=>{s.preventDefault(),U.emit(te.CreateNote,{newLeaf:!0})}),this.scope.register(r,"Enter",s=>{cs()||(s.preventDefault(),U.emit(te.Enter))}),this.scope.register(["Alt"],"O",s=>{cs()||(s.preventDefault(),U.emit(te.OpenInBackground))}),this.scope.register([],"Tab",s=>{s.preventDefault(),U.emit(te.Tab)}),this.scope.register(["Alt"],"ArrowDown",s=>{s.preventDefault(),U.emit(te.NextSearchHistory)}),this.scope.register(["Alt"],"ArrowUp",s=>{s.preventDefault(),U.emit(te.PrevSearchHistory)}),this.scope.register(["Ctrl"],"H",s=>{U.emit(hi.ToggleExcerpts)})}},cr=class extends Ns{constructor(e,r){super(e);let n=e.workspace.getActiveViewOfType(ro.MarkdownView)?.editor.getSelection(),i=new Rf({target:this.modalEl,props:{modal:this,previousQuery:n??r}});this.onClose=()=>{i.$destroy()}}},Xr=class extends Ns{constructor(e,r,n="",i){super(e);let o=new Hf({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),o.$destroy()}}};var $f=!1,no=[];function Db(t){return t.map(e=>{let{score:r,path:n,basename:i,foundWords:o,matches:s,content:a}=e,u=qr(a,s[0]?.offset??-1);return{score:r,path:n,basename:i,foundWords:o,matches:s.map(f=>({match:f.match,offset:f.offset})),excerpt:u.content}})}async function Ib(t){let e=new ur(t),r=await xe.getSuggestions(e);return Db(r)}function Ob(t){no.push(t),$f&&t()}function kb(t){no=no.filter(e=>e!==t)}function Wf(){$f=!0,no.forEach(t=>t())}var Ks={search:Ib,registerOnIndexed:Ob,unregisterOnIndexed:kb,refreshIndex:eo};var zs=class extends fr.Plugin{async onload(){if(await Ja(this),this.addSettingTab(new as(this)),ls()){console.log("Omnisearch - Plugin disabled");return}await Pb(),await Er.clearOldDatabases(),Mb(this),T.ribbonIcon&&this.addRibbonButton(),U.disable("vault"),U.disable("infile"),U.on("global",hi.ToggleExcerpts,()=>{tr.set(!T.showExcerpt)}),this.addCommand({id:"show-modal",name:"Vault search",callback:()=>{new cr(app).open()}}),this.addCommand({id:"show-modal-infile",name:"In-file search",editorCallback:(e,r)=>{r.file&&new Xr(app,r.file).open()}}),app.workspace.onLayoutReady(async()=>{this.registerEvent(this.app.vault.on("create",e=>{En(e.path)&&(fe("Indexing new file",e.path),xe.addFromPaths([e.path]))})),this.registerEvent(this.app.vault.on("delete",e=>{fe("Removing file",e.path),Fe.removeFromLiveCache(e.path),xe.removeFromPaths([e.path])})),this.registerEvent(this.app.vault.on("modify",async e=>{En(e.path)&&(fe("Updating file",e.path),await Fe.addToLiveCache(e.path),Ff(e))})),this.registerEvent(this.app.vault.on("rename",async(e,r)=>{En(e.path)&&(fe("Renaming file",e.path),Fe.removeFromLiveCache(r),await Fe.addToLiveCache(e.path),xe.removeFromPaths([r]),await xe.addFromPaths([e.path]))})),this.executeFirstLaunchTasks(),await this.populateIndex()})}executeFirstLaunchTasks(){let e="1.10.1";T.welcomeMessage!==e,T.welcomeMessage=e,this.saveData(T)}async onunload(){delete globalThis.omnisearch,await Se.clearCache()}addRibbonButton(){this.ribbonButton=this.addRibbonIcon("search","Omnisearch",e=>{new cr(app).open()})}removeRibbonButton(){this.ribbonButton&&this.ribbonButton.parentNode?.removeChild(this.ribbonButton)}async populateIndex(){console.time("Omnisearch - Indexing total time"),Ot.set(Je.ReadingFiles);let e=app.vault.getFiles().filter(n=>En(n.path));console.log(`Omnisearch - ${e.length} files total`),console.log(`Omnisearch - Cache is ${It()?"enabled":"disabled"}`),It()&&(console.time("Omnisearch - Loading index from cache"),Ot.set(Je.LoadingCache),await xe.loadCache()&&console.timeEnd("Omnisearch - Loading index from cache"));let r=xe.getDiff(e.map(n=>({path:n.path,mtime:n.stat.mtime})));It()&&(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&&It()&&new fr.Notice(`Omnisearch - ${r.toAdd.length} files need to be indexed. Obsidian may experience stutters and freezes during the process`,1e4),Ot.set(Je.IndexingFiles),xe.removeFromPaths(r.toRemove.map(n=>n.path)),await xe.addFromPaths(r.toAdd.map(n=>n.path)),(r.toRemove.length||r.toAdd.length)&&It()&&(Ot.set(Je.WritingCache),T.useCache=!1,await ce(this),await xe.writeToCache(),T.useCache=!0,await ce(this)),console.timeEnd("Omnisearch - Indexing total time"),r.toAdd.length>=1e3&&!fr.Platform.isIosApp&&new fr.Notice("Omnisearch - Your files have been indexed."),Ot.set(Je.Done),Wf()}};async function Pb(){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 Mb(t){t.registerObsidianProtocolHandler("omnisearch",e=>{new cr(app,e.query).open()}),globalThis.omnisearch=Ks,app.plugins.plugins.omnisearch.api=Ks}