pages/assets/chunks/VPLocalSearchBox.CIHWQApR.js

7 lines
69 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var Nt=Object.defineProperty;var Ct=(o,e,t)=>e in o?Nt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var ke=(o,e,t)=>(Ct(o,typeof e!="symbol"?e+"":e,t),t);import{a8 as It,r as ie,w as Ve,b1 as Dt,b2 as kt,k as Ot,s as we,b3 as et,e as xe,b4 as Rt,b5 as _t,f as Mt,b6 as Lt,o as Oe,n as he,a4 as Fe,b7 as Pt,ad as zt,a9 as Bt,a6 as Vt,b8 as $t,p as X,D as Wt,Q as k,ac as Kt,u as G,b9 as Jt,ba as Ut,i as jt,q as te,v as tt,H as Ee,G as rt,F as at,K as de,L as ve,bb as Gt,R as Ht,S as Qt,bc as nt,bd as qt,aT as Yt,aZ as Zt,be as Xt,_ as er}from"./framework.Sr2_9k8k.js";import{u as tr,c as rr}from"./theme.BasSRYMa.js";const ar={root:()=>It(()=>import("./@localSearchIndexroot.Djtwv3bD.js"),[])};/*!
* tabbable 6.2.0
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/var pt=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Te=pt.join(","),yt=typeof Element>"u",se=yt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ne=!yt&&Element.prototype.getRootNode?function(o){var e;return o==null||(e=o.getRootNode)===null||e===void 0?void 0:e.call(o)}:function(o){return o==null?void 0:o.ownerDocument},Ce=function o(e,t){var r;t===void 0&&(t=!0);var n=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),a=n===""||n==="true",i=a||t&&e&&o(e.parentNode);return i},nr=function(e){var t,r=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return r===""||r==="true"},mt=function(e,t,r){if(Ce(e))return[];var n=Array.prototype.slice.apply(e.querySelectorAll(Te));return t&&se.call(e,Te)&&n.unshift(e),n=n.filter(r),n},gt=function o(e,t,r){for(var n=[],a=Array.from(e);a.length;){var i=a.shift();if(!Ce(i,!1))if(i.tagName==="SLOT"){var s=i.assignedElements(),u=s.length?s:i.children,l=o(u,!0,r);r.flatten?n.push.apply(n,l):n.push({scopeParent:i,candidates:l})}else{var d=se.call(i,Te);d&&r.filter(i)&&(t||!e.includes(i))&&n.push(i);var h=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),v=!Ce(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(h&&v){var m=o(h===!0?i.children:h.children,!0,r);r.flatten?n.push.apply(n,m):n.push({scopeParent:i,candidates:m})}else a.unshift.apply(a,i.children)}}return n},bt=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},oe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||nr(e))&&!bt(e)?0:e.tabIndex},ir=function(e,t){var r=oe(e);return r<0&&t&&!bt(e)?0:r},or=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},wt=function(e){return e.tagName==="INPUT"},sr=function(e){return wt(e)&&e.type==="hidden"},ur=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return t},lr=function(e,t){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===t)return e[r]},cr=function(e){if(!e.name)return!0;var t=e.form||Ne(e),r=function(s){return t.querySelectorAll('input[type="radio"][name="'+s+'"]')},n;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")n=r(window.CSS.escape(e.name));else try{n=r(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var a=lr(n,e.form);return!a||a===e},fr=function(e){return wt(e)&&e.type==="radio"},hr=function(e){return fr(e)&&!cr(e)},dr=function(e){var t,r=e&&Ne(e),n=(t=r)===null||t===void 0?void 0:t.host,a=!1;if(r&&r!==e){var i,s,u;for(a=!!((i=n)!==null&&i!==void 0&&(s=i.ownerDocument)!==null&&s!==void 0&&s.contains(n)||e!=null&&(u=e.ownerDocument)!==null&&u!==void 0&&u.contains(e));!a&&n;){var l,d,h;r=Ne(n),n=(l=r)===null||l===void 0?void 0:l.host,a=!!((d=n)!==null&&d!==void 0&&(h=d.ownerDocument)!==null&&h!==void 0&&h.contains(n))}}return a},it=function(e){var t=e.getBoundingClientRect(),r=t.width,n=t.height;return r===0&&n===0},vr=function(e,t){var r=t.displayCheck,n=t.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var a=se.call(e,"details>summary:first-of-type"),i=a?e.parentElement:e;if(se.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof n=="function"){for(var s=e;e;){var u=e.parentElement,l=Ne(e);if(u&&!u.shadowRoot&&n(u)===!0)return it(e);e.assignedSlot?e=e.assignedSlot:!u&&l!==e.ownerDocument?e=l.host:e=u}e=s}if(dr(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return it(e);return!1},pr=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var r=0;r<t.children.length;r++){var n=t.children.item(r);if(n.tagName==="LEGEND")return se.call(t,"fieldset[disabled] *")?!0:!n.contains(e)}return!0}t=t.parentElement}return!1},Ie=function(e,t){return!(t.disabled||Ce(t)||sr(t)||vr(t,e)||ur(t)||pr(t))},$e=function(e,t){return!(hr(t)||oe(t)<0||!Ie(e,t))},yr=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},mr=function o(e){var t=[],r=[];return e.forEach(function(n,a){var i=!!n.scopeParent,s=i?n.scopeParent:n,u=ir(s,i),l=i?o(n.candidates):s;u===0?i?t.push.apply(t,l):t.push(s):r.push({documentOrder:a,tabIndex:u,item:n,isScope:i,content:l})}),r.sort(or).reduce(function(n,a){return a.isScope?n.push.apply(n,a.content):n.push(a.content),n},[]).concat(t)},gr=function(e,t){t=t||{};var r;return t.getShadowRoot?r=gt([e],t.includeContainer,{filter:$e.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:yr}):r=mt(e,t.includeContainer,$e.bind(null,t)),mr(r)},br=function(e,t){t=t||{};var r;return t.getShadowRoot?r=gt([e],t.includeContainer,{filter:Ie.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):r=mt(e,t.includeContainer,Ie.bind(null,t)),r},ue=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return se.call(e,Te)===!1?!1:$e(t,e)},wr=pt.concat("iframe").join(","),Re=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return se.call(e,wr)===!1?!1:Ie(t,e)};/*!
* focus-trap 7.5.4
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
*/function ot(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(o,n).enumerable})),t.push.apply(t,r)}return t}function st(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ot(Object(t),!0).forEach(function(r){xr(o,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):ot(Object(t)).forEach(function(r){Object.defineProperty(o,r,Object.getOwnPropertyDescriptor(t,r))})}return o}function xr(o,e,t){return e=Er(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function Fr(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var r=t.call(o,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}function Er(o){var e=Fr(o,"string");return typeof e=="symbol"?e:String(e)}var ut={activateTrap:function(e,t){if(e.length>0){var r=e[e.length-1];r!==t&&r.pause()}var n=e.indexOf(t);n===-1||e.splice(n,1),e.push(t)},deactivateTrap:function(e,t){var r=e.indexOf(t);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},Sr=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Ar=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},me=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},Tr=function(e){return me(e)&&!e.shiftKey},Nr=function(e){return me(e)&&e.shiftKey},lt=function(e){return setTimeout(e,0)},ct=function(e,t){var r=-1;return e.every(function(n,a){return t(n)?(r=a,!1):!0}),r},pe=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return typeof e=="function"?e.apply(void 0,r):e},Se=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},Cr=[],Ir=function(e,t){var r=(t==null?void 0:t.document)||document,n=(t==null?void 0:t.trapStack)||Cr,a=st({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Tr,isKeyBackward:Nr},t),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},s,u=function(f,c,p){return f&&f[c]!==void 0?f[c]:a[p||c]},l=function(f,c){var p=typeof(c==null?void 0:c.composedPath)=="function"?c.composedPath():void 0;return i.containerGroups.findIndex(function(C){var N=C.container,M=C.tabbableNodes;return N.contains(f)||(p==null?void 0:p.includes(N))||M.find(function(z){return z===f})})},d=function(f){var c=a[f];if(typeof c=="function"){for(var p=arguments.length,C=new Array(p>1?p-1:0),N=1;N<p;N++)C[N-1]=arguments[N];c=c.apply(void 0,C)}if(c===!0&&(c=void 0),!c){if(c===void 0||c===!1)return c;throw new Error("`".concat(f,"` was specified but was not a node, or did not return a node"))}var M=c;if(typeof c=="string"&&(M=r.querySelector(c),!M))throw new Error("`".concat(f,"` as selector refers to no known node"));return M},h=function(){var f=d("initialFocus");if(f===!1)return!1;if(f===void 0||!Re(f,a.tabbableOptions))if(l(r.activeElement)>=0)f=r.activeElement;else{var c=i.tabbableGroups[0],p=c&&c.firstTabbableNode;f=p||d("fallbackFocus")}if(!f)throw new Error("Your focus-trap needs to have at least one focusable element");return f},v=function(){if(i.containerGroups=i.containers.map(function(f){var c=gr(f,a.tabbableOptions),p=br(f,a.tabbableOptions),C=c.length>0?c[0]:void 0,N=c.length>0?c[c.length-1]:void 0,M=p.find(function(w){return ue(w)}),z=p.slice().reverse().find(function(w){return ue(w)}),y=!!c.find(function(w){return oe(w)>0});return{container:f,tabbableNodes:c,focusableNodes:p,posTabIndexesFound:y,firstTabbableNode:C,lastTabbableNode:N,firstDomTabbableNode:M,lastDomTabbableNode:z,nextTabbableNode:function(B){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,K=c.indexOf(B);return K<0?U?p.slice(p.indexOf(B)+1).find(function(J){return ue(J)}):p.slice(0,p.indexOf(B)).reverse().find(function(J){return ue(J)}):c[K+(U?1:-1)]}}}),i.tabbableGroups=i.containerGroups.filter(function(f){return f.tabbableNodes.length>0}),i.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(i.containerGroups.find(function(f){return f.posTabIndexesFound})&&i.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},m=function F(f){var c=f.activeElement;if(c)return c.shadowRoot&&c.shadowRoot.activeElement!==null?F(c.shadowRoot):c},g=function F(f){if(f!==!1&&f!==m(document)){if(!f||!f.focus){F(h());return}f.focus({preventScroll:!!a.preventScroll}),i.mostRecentlyFocusedNode=f,Sr(f)&&f.select()}},b=function(f){var c=d("setReturnFocus",f);return c||(c===!1?!1:f)},x=function(f){var c=f.target,p=f.event,C=f.isBackward,N=C===void 0?!1:C;c=c||Se(p),v();var M=null;if(i.tabbableGroups.length>0){var z=l(c,p),y=z>=0?i.containerGroups[z]:void 0;if(z<0)N?M=i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:M=i.tabbableGroups[0].firstTabbableNode;else if(N){var w=ct(i.tabbableGroups,function(j){var Q=j.firstTabbableNode;return c===Q});if(w<0&&(y.container===c||Re(c,a.tabbableOptions)&&!ue(c,a.tabbableOptions)&&!y.nextTabbableNode(c,!1))&&(w=z),w>=0){var B=w===0?i.tabbableGroups.length-1:w-1,U=i.tabbableGroups[B];M=oe(c)>=0?U.lastTabbableNode:U.lastDomTabbableNode}else me(p)||(M=y.nextTabbableNode(c,!1))}else{var K=ct(i.tabbableGroups,function(j){var Q=j.lastTabbableNode;return c===Q});if(K<0&&(y.container===c||Re(c,a.tabbableOptions)&&!ue(c,a.tabbableOptions)&&!y.nextTabbableNode(c))&&(K=z),K>=0){var J=K===i.tabbableGroups.length-1?0:K+1,V=i.tabbableGroups[J];M=oe(c)>=0?V.firstTabbableNode:V.firstDomTabbableNode}else me(p)||(M=y.nextTabbableNode(c))}}else M=d("fallbackFocus");return M},S=function(f){var c=Se(f);if(!(l(c,f)>=0)){if(pe(a.clickOutsideDeactivates,f)){s.deactivate({returnFocus:a.returnFocusOnDeactivate});return}pe(a.allowOutsideClick,f)||f.preventDefault()}},T=function(f){var c=Se(f),p=l(c,f)>=0;if(p||c instanceof Document)p&&(i.mostRecentlyFocusedNode=c);else{f.stopImmediatePropagation();var C,N=!0;if(i.mostRecentlyFocusedNode)if(oe(i.mostRecentlyFocusedNode)>0){var M=l(i.mostRecentlyFocusedNode),z=i.containerGroups[M].tabbableNodes;if(z.length>0){var y=z.findIndex(function(w){return w===i.mostRecentlyFocusedNode});y>=0&&(a.isKeyForward(i.recentNavEvent)?y+1<z.length&&(C=z[y+1],N=!1):y-1>=0&&(C=z[y-1],N=!1))}}else i.containerGroups.some(function(w){return w.tabbableNodes.some(function(B){return oe(B)>0})})||(N=!1);else N=!1;N&&(C=x({target:i.mostRecentlyFocusedNode,isBackward:a.isKeyBackward(i.recentNavEvent)})),g(C||i.mostRecentlyFocusedNode||h())}i.recentNavEvent=void 0},A=function(f){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i.recentNavEvent=f;var p=x({event:f,isBackward:c});p&&(me(f)&&f.preventDefault(),g(p))},_=function(f){if(Ar(f)&&pe(a.escapeDeactivates,f)!==!1){f.preventDefault(),s.deactivate();return}(a.isKeyForward(f)||a.isKeyBackward(f))&&A(f,a.isKeyBackward(f))},L=function(f){var c=Se(f);l(c,f)>=0||pe(a.clickOutsideDeactivates,f)||pe(a.allowOutsideClick,f)||(f.preventDefault(),f.stopImmediatePropagation())},P=function(){if(i.active)return ut.activateTrap(n,s),i.delayInitialFocusTimer=a.delayInitialFocus?lt(function(){g(h())}):g(h()),r.addEventListener("focusin",T,!0),r.addEventListener("mousedown",S,{capture:!0,passive:!1}),r.addEventListener("touchstart",S,{capture:!0,passive:!1}),r.addEventListener("click",L,{capture:!0,passive:!1}),r.addEventListener("keydown",_,{capture:!0,passive:!1}),s},I=function(){if(i.active)return r.removeEventListener("focusin",T,!0),r.removeEventListener("mousedown",S,!0),r.removeEventListener("touchstart",S,!0),r.removeEventListener("click",L,!0),r.removeEventListener("keydown",_,!0),s},E=function(f){var c=f.some(function(p){var C=Array.from(p.removedNodes);return C.some(function(N){return N===i.mostRecentlyFocusedNode})});c&&g(h())},O=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(E):void 0,R=function(){O&&(O.disconnect(),i.active&&!i.paused&&i.containers.map(function(f){O.observe(f,{subtree:!0,childList:!0})}))};return s={get active(){return i.active},get paused(){return i.paused},activate:function(f){if(i.active)return this;var c=u(f,"onActivate"),p=u(f,"onPostActivate"),C=u(f,"checkCanFocusTrap");C||v(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=r.activeElement,c==null||c();var N=function(){C&&v(),P(),R(),p==null||p()};return C?(C(i.containers.concat()).then(N,N),this):(N(),this)},deactivate:function(f){if(!i.active)return this;var c=st({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},f);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,I(),i.active=!1,i.paused=!1,R(),ut.deactivateTrap(n,s);var p=u(c,"onDeactivate"),C=u(c,"onPostDeactivate"),N=u(c,"checkCanReturnFocus"),M=u(c,"returnFocus","returnFocusOnDeactivate");p==null||p();var z=function(){lt(function(){M&&g(b(i.nodeFocusedBeforeActivation)),C==null||C()})};return M&&N?(N(b(i.nodeFocusedBeforeActivation)).then(z,z),this):(z(),this)},pause:function(f){if(i.paused||!i.active)return this;var c=u(f,"onPause"),p=u(f,"onPostPause");return i.paused=!0,c==null||c(),I(),R(),p==null||p(),this},unpause:function(f){if(!i.paused||!i.active)return this;var c=u(f,"onUnpause"),p=u(f,"onPostUnpause");return i.paused=!1,c==null||c(),v(),P(),R(),p==null||p(),this},updateContainerElements:function(f){var c=[].concat(f).filter(Boolean);return i.containers=c.map(function(p){return typeof p=="string"?r.querySelector(p):p}),i.active&&v(),R(),this}},s.updateContainerElements(e),s};function Dr(o,e={}){let t;const{immediate:r,...n}=e,a=ie(!1),i=ie(!1),s=h=>t&&t.activate(h),u=h=>t&&t.deactivate(h),l=()=>{t&&(t.pause(),i.value=!0)},d=()=>{t&&(t.unpause(),i.value=!1)};return Ve(()=>Dt(o),h=>{h&&(t=Ir(h,{...n,onActivate(){a.value=!0,e.onActivate&&e.onActivate()},onDeactivate(){a.value=!1,e.onDeactivate&&e.onDeactivate()}}),r&&s())},{flush:"post"}),kt(()=>u()),{hasFocus:a,isPaused:i,activate:s,deactivate:u,pause:l,unpause:d}}class ce{constructor(e,t=!0,r=[],n=5e3){this.ctx=e,this.iframes=t,this.exclude=r,this.iframesTimeout=n}static matches(e,t){const r=typeof t=="string"?[t]:t,n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(n){let a=!1;return r.every(i=>n.call(e,i)?(a=!0,!1):!0),a}else return!1}getContexts(){let e,t=[];return typeof this.ctx>"u"||!this.ctx?e=[]:NodeList.prototype.isPrototypeOf(this.ctx)?e=Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?e=this.ctx:typeof this.ctx=="string"?e=Array.prototype.slice.call(document.querySelectorAll(this.ctx)):e=[this.ctx],e.forEach(r=>{const n=t.filter(a=>a.contains(r)).length>0;t.indexOf(r)===-1&&!n&&t.push(r)}),t}getIframeContents(e,t,r=()=>{}){let n;try{const a=e.contentWindow;if(n=a.document,!a||!n)throw new Error("iframe inaccessible")}catch{r()}n&&t(n)}isIframeBlank(e){const t="about:blank",r=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&r!==t&&r}observeIframeLoad(e,t,r){let n=!1,a=null;const i=()=>{if(!n){n=!0,clearTimeout(a);try{this.isIframeBlank(e)||(e.removeEventListener("load",i),this.getIframeContents(e,t,r))}catch{r()}}};e.addEventListener("load",i),a=setTimeout(i,this.iframesTimeout)}onIframeReady(e,t,r){try{e.contentWindow.document.readyState==="complete"?this.isIframeBlank(e)?this.observeIframeLoad(e,t,r):this.getIframeContents(e,t,r):this.observeIframeLoad(e,t,r)}catch{r()}}waitForIframes(e,t){let r=0;this.forEachIframe(e,()=>!0,n=>{r++,this.waitForIframes(n.querySelector("html"),()=>{--r||t()})},n=>{n||t()})}forEachIframe(e,t,r,n=()=>{}){let a=e.querySelectorAll("iframe"),i=a.length,s=0;a=Array.prototype.slice.call(a);const u=()=>{--i<=0&&n(s)};i||u(),a.forEach(l=>{ce.matches(l,this.exclude)?u():this.onIframeReady(l,d=>{t(l)&&(s++,r(d)),u()},u)})}createIterator(e,t,r){return document.createNodeIterator(e,t,r,!1)}createInstanceOnIframe(e){return new ce(e.querySelector("html"),this.iframes)}compareNodeIframe(e,t,r){const n=e.compareDocumentPosition(r),a=Node.DOCUMENT_POSITION_PRECEDING;if(n&a)if(t!==null){const i=t.compareDocumentPosition(r),s=Node.DOCUMENT_POSITION_FOLLOWING;if(i&s)return!0}else return!0;return!1}getIteratorNode(e){const t=e.previousNode();let r;return t===null?r=e.nextNode():r=e.nextNode()&&e.nextNode(),{prevNode:t,node:r}}checkIframeFilter(e,t,r,n){let a=!1,i=!1;return n.forEach((s,u)=>{s.val===r&&(a=u,i=s.handled)}),this.compareNodeIframe(e,t,r)?(a===!1&&!i?n.push({val:r,handled:!0}):a!==!1&&!i&&(n[a].handled=!0),!0):(a===!1&&n.push({val:r,handled:!1}),!1)}handleOpenIframes(e,t,r,n){e.forEach(a=>{a.handled||this.getIframeContents(a.val,i=>{this.createInstanceOnIframe(i).forEachNode(t,r,n)})})}iterateThroughNodes(e,t,r,n,a){const i=this.createIterator(t,e,n);let s=[],u=[],l,d,h=()=>({prevNode:d,node:l}=this.getIteratorNode(i),l);for(;h();)this.iframes&&this.forEachIframe(t,v=>this.checkIframeFilter(l,d,v,s),v=>{this.createInstanceOnIframe(v).forEachNode(e,m=>u.push(m),n)}),u.push(l);u.forEach(v=>{r(v)}),this.iframes&&this.handleOpenIframes(s,e,r,n),a()}forEachNode(e,t,r,n=()=>{}){const a=this.getContexts();let i=a.length;i||n(),a.forEach(s=>{const u=()=>{this.iterateThroughNodes(e,s,t,r,()=>{--i<=0&&n()})};this.iframes?this.waitForIframes(s,u):u()})}}let kr=class{constructor(e){this.ctx=e,this.ie=!1;const t=window.navigator.userAgent;(t.indexOf("MSIE")>-1||t.indexOf("Trident")>-1)&&(this.ie=!0)}set opt(e){this._opt=Object.assign({},{element:"",className:"",exclude:[],iframes:!1,iframesTimeout:5e3,separateWordSearch:!0,diacritics:!0,synonyms:{},accuracy:"partially",acrossElements:!1,caseSensitive:!1,ignoreJoiners:!1,ignoreGroups:0,ignorePunctuation:[],wildcards:"disabled",each:()=>{},noMatch:()=>{},filter:()=>!0,done:()=>{},debug:!1,log:window.console},e)}get opt(){return this._opt}get iterator(){return new ce(this.ctx,this.opt.iframes,this.opt.exclude,this.opt.iframesTimeout)}log(e,t="debug"){const r=this.opt.log;this.opt.debug&&typeof r=="object"&&typeof r[t]=="function"&&r[t](`mark.js: ${e}`)}escapeStr(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}createRegExp(e){return this.opt.wildcards!=="disabled"&&(e=this.setupWildcardsRegExp(e)),e=this.escapeStr(e),Object.keys(this.opt.synonyms).length&&(e=this.createSynonymsRegExp(e)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),this.opt.diacritics&&(e=this.createDiacriticsRegExp(e)),e=this.createMergedBlanksRegExp(e),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.createJoinersRegExp(e)),this.opt.wildcards!=="disabled"&&(e=this.createWildcardsRegExp(e)),e=this.createAccuracyRegExp(e),e}createSynonymsRegExp(e){const t=this.opt.synonyms,r=this.opt.caseSensitive?"":"i",n=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(let a in t)if(t.hasOwnProperty(a)){const i=t[a],s=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(a):this.escapeStr(a),u=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(i):this.escapeStr(i);s!==""&&u!==""&&(e=e.replace(new RegExp(`(${this.escapeStr(s)}|${this.escapeStr(u)})`,`gm${r}`),n+`(${this.processSynomyms(s)}|${this.processSynomyms(u)})`+n))}return e}processSynomyms(e){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),e}setupWildcardsRegExp(e){return e=e.replace(/(?:\\)*\?/g,t=>t.charAt(0)==="\\"?"?":""),e.replace(/(?:\\)*\*/g,t=>t.charAt(0)==="\\"?"*":"")}createWildcardsRegExp(e){let t=this.opt.wildcards==="withSpaces";return e.replace(/\u0001/g,t?"[\\S\\s]?":"\\S?").replace(/\u0002/g,t?"[\\S\\s]*?":"\\S*")}setupIgnoreJoinersRegExp(e){return e.replace(/[^(|)\\]/g,(t,r,n)=>{let a=n.charAt(r+1);return/[(|)\\]/.test(a)||a===""?t:t+"\0"})}createJoinersRegExp(e){let t=[];const r=this.opt.ignorePunctuation;return Array.isArray(r)&&r.length&&t.push(this.escapeStr(r.join(""))),this.opt.ignoreJoiners&&t.push("\\u00ad\\u200b\\u200c\\u200d"),t.length?e.split(/\u0000+/).join(`[${t.join("")}]*`):e}createDiacriticsRegExp(e){const t=this.opt.caseSensitive?"":"i",r=this.opt.caseSensitive?["aàáảãạăằắẳẵặâầấẩẫậäåāą","AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćč","CÇĆČ","dđď","DĐĎ","eèéẻẽẹêềếểễệëěēę","EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïī","IÌÍỈĨỊÎÏĪ","lł","LŁ","nñňń","NÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøō","OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rř","RŘ","sšśșş","SŠŚȘŞ","tťțţ","TŤȚŢ","uùúủũụưừứửữựûüůū","UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿ","YÝỲỶỸỴŸ","zžżź","ZŽŻŹ"]:["aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćčCÇĆČ","dđďDĐĎ","eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïīIÌÍỈĨỊÎÏĪ","lłLŁ","nñňńNÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rřRŘ","sšśșşSŠŚȘŞ","tťțţTŤȚŢ","uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿYÝỲỶỸỴŸ","zžżźZŽŻŹ"];let n=[];return e.split("").forEach(a=>{r.every(i=>{if(i.indexOf(a)!==-1){if(n.indexOf(i)>-1)return!1;e=e.replace(new RegExp(`[${i}]`,`gm${t}`),`[${i}]`),n.push(i)}return!0})}),e}createMergedBlanksRegExp(e){return e.replace(/[\s]+/gmi,"[\\s]+")}createAccuracyRegExp(e){const t="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿";let r=this.opt.accuracy,n=typeof r=="string"?r:r.value,a=typeof r=="string"?[]:r.limiters,i="";switch(a.forEach(s=>{i+=`|${this.escapeStr(s)}`}),n){case"partially":default:return`()(${e})`;case"complementary":return i="\\s"+(i||this.escapeStr(t)),`()([^${i}]*${e}[^${i}]*)`;case"exactly":return`(^|\\s${i})(${e})(?=$|\\s${i})`}}getSeparatedKeywords(e){let t=[];return e.forEach(r=>{this.opt.separateWordSearch?r.split(" ").forEach(n=>{n.trim()&&t.indexOf(n)===-1&&t.push(n)}):r.trim()&&t.indexOf(r)===-1&&t.push(r)}),{keywords:t.sort((r,n)=>n.length-r.length),length:t.length}}isNumeric(e){return Number(parseFloat(e))==e}checkRanges(e){if(!Array.isArray(e)||Object.prototype.toString.call(e[0])!=="[object Object]")return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];const t=[];let r=0;return e.sort((n,a)=>n.start-a.start).forEach(n=>{let{start:a,end:i,valid:s}=this.callNoMatchOnInvalidRanges(n,r);s&&(n.start=a,n.length=i-a,t.push(n),r=i)}),t}callNoMatchOnInvalidRanges(e,t){let r,n,a=!1;return e&&typeof e.start<"u"?(r=parseInt(e.start,10),n=r+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&n-t>0&&n-r>0?a=!0:(this.log(`Ignoring invalid or overlapping range: ${JSON.stringify(e)}`),this.opt.noMatch(e))):(this.log(`Ignoring invalid range: ${JSON.stringify(e)}`),this.opt.noMatch(e)),{start:r,end:n,valid:a}}checkWhitespaceRanges(e,t,r){let n,a=!0,i=r.length,s=t-i,u=parseInt(e.start,10)-s;return u=u>i?i:u,n=u+parseInt(e.length,10),n>i&&(n=i,this.log(`End range automatically set to the max value of ${i}`)),u<0||n-u<0||u>i||n>i?(a=!1,this.log(`Invalid range: ${JSON.stringify(e)}`),this.opt.noMatch(e)):r.substring(u,n).replace(/\s+/g,"")===""&&(a=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:u,end:n,valid:a}}getTextNodes(e){let t="",r=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,n=>{r.push({start:t.length,end:(t+=n.textContent).length,node:n})},n=>this.matchesExclude(n.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT,()=>{e({value:t,nodes:r})})}matchesExclude(e){return ce.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}wrapRangeInTextNode(e,t,r){const n=this.opt.element?this.opt.element:"mark",a=e.splitText(t),i=a.splitText(r-t);let s=document.createElement(n);return s.setAttribute("data-markjs","true"),this.opt.className&&s.setAttribute("class",this.opt.className),s.textContent=a.textContent,a.parentNode.replaceChild(s,a),i}wrapRangeInMappedTextNode(e,t,r,n,a){e.nodes.every((i,s)=>{const u=e.nodes[s+1];if(typeof u>"u"||u.start>t){if(!n(i.node))return!1;const l=t-i.start,d=(r>i.end?i.end:r)-i.start,h=e.value.substr(0,i.start),v=e.value.substr(d+i.start);if(i.node=this.wrapRangeInTextNode(i.node,l,d),e.value=h+v,e.nodes.forEach((m,g)=>{g>=s&&(e.nodes[g].start>0&&g!==s&&(e.nodes[g].start-=d),e.nodes[g].end-=d)}),r-=d,a(i.node.previousSibling,i.start),r>i.end)t=i.end;else return!1}return!0})}wrapMatches(e,t,r,n,a){const i=t===0?0:t+1;this.getTextNodes(s=>{s.nodes.forEach(u=>{u=u.node;let l;for(;(l=e.exec(u.textContent))!==null&&l[i]!=="";){if(!r(l[i],u))continue;let d=l.index;if(i!==0)for(let h=1;h<i;h++)d+=l[h].length;u=this.wrapRangeInTextNode(u,d,d+l[i].length),n(u.previousSibling),e.lastIndex=0}}),a()})}wrapMatchesAcrossElements(e,t,r,n,a){const i=t===0?0:t+1;this.getTextNodes(s=>{let u;for(;(u=e.exec(s.value))!==null&&u[i]!=="";){let l=u.index;if(i!==0)for(let h=1;h<i;h++)l+=u[h].length;const d=l+u[i].length;this.wrapRangeInMappedTextNode(s,l,d,h=>r(u[i],h),(h,v)=>{e.lastIndex=v,n(h)})}a()})}wrapRangeFromIndex(e,t,r,n){this.getTextNodes(a=>{const i=a.value.length;e.forEach((s,u)=>{let{start:l,end:d,valid:h}=this.checkWhitespaceRanges(s,i,a.value);h&&this.wrapRangeInMappedTextNode(a,l,d,v=>t(v,s,a.value.substring(l,d),u),v=>{r(v,s)})}),n()})}unwrapMatches(e){const t=e.parentNode;let r=document.createDocumentFragment();for(;e.firstChild;)r.appendChild(e.removeChild(e.firstChild));t.replaceChild(r,e),this.ie?this.normalizeTextNode(t):t.normalize()}normalizeTextNode(e){if(e){if(e.nodeType===3)for(;e.nextSibling&&e.nextSibling.nodeType===3;)e.nodeValue+=e.nextSibling.nodeValue,e.parentNode.removeChild(e.nextSibling);else this.normalizeTextNode(e.firstChild);this.normalizeTextNode(e.nextSibling)}}markRegExp(e,t){this.opt=t,this.log(`Searching with expression "${e}"`);let r=0,n="wrapMatches";const a=i=>{r++,this.opt.each(i)};this.opt.acrossElements&&(n="wrapMatchesAcrossElements"),this[n](e,this.opt.ignoreGroups,(i,s)=>this.opt.filter(s,i,r),a,()=>{r===0&&this.opt.noMatch(e),this.opt.done(r)})}mark(e,t){this.opt=t;let r=0,n="wrapMatches";const{keywords:a,length:i}=this.getSeparatedKeywords(typeof e=="string"?[e]:e),s=this.opt.caseSensitive?"":"i",u=l=>{let d=new RegExp(this.createRegExp(l),`gm${s}`),h=0;this.log(`Searching with expression "${d}"`),this[n](d,1,(v,m)=>this.opt.filter(m,l,r,h),v=>{h++,r++,this.opt.each(v)},()=>{h===0&&this.opt.noMatch(l),a[i-1]===l?this.opt.done(r):u(a[a.indexOf(l)+1])})};this.opt.acrossElements&&(n="wrapMatchesAcrossElements"),i===0?this.opt.done(r):u(a[0])}markRanges(e,t){this.opt=t;let r=0,n=this.checkRanges(e);n&&n.length?(this.log("Starting to mark with the following ranges: "+JSON.stringify(n)),this.wrapRangeFromIndex(n,(a,i,s,u)=>this.opt.filter(a,i,s,u),(a,i)=>{r++,this.opt.each(a,i)},()=>{this.opt.done(r)})):this.opt.done(r)}unmark(e){this.opt=e;let t=this.opt.element?this.opt.element:"*";t+="[data-markjs]",this.opt.className&&(t+=`.${this.opt.className}`),this.log(`Removal selector "${t}"`),this.iterator.forEachNode(NodeFilter.SHOW_ELEMENT,r=>{this.unwrapMatches(r)},r=>{const n=ce.matches(r,t),a=this.matchesExclude(r);return!n||a?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},this.opt.done)}};function Or(o){const e=new kr(o);return this.mark=(t,r)=>(e.mark(t,r),this),this.markRegExp=(t,r)=>(e.markRegExp(t,r),this),this.markRanges=(t,r)=>(e.markRanges(t,r),this),this.unmark=t=>(e.unmark(t),this),this}var $=function(){return $=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},$.apply(this,arguments)};function Rr(o,e,t,r){function n(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function s(d){try{l(r.next(d))}catch(h){i(h)}}function u(d){try{l(r.throw(d))}catch(h){i(h)}}function l(d){d.done?a(d.value):n(d.value).then(s,u)}l((r=r.apply(o,[])).next())})}function _r(o,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,n,a,i;return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(l){return function(d){return u([l,d])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(t=0)),t;)try{if(r=1,n&&(a=l[0]&2?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,n=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){t.label=l[1];break}if(l[0]===6&&t.label<a[1]){t.label=a[1],a=l;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(l);break}a[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(o,t)}catch(d){l=[6,d],n=0}finally{r=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function D(o){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&o[e],r=0;if(t)return t.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&r>=o.length&&(o=void 0),{value:o&&o[r++],done:!o}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function W(o,e){var t=typeof Symbol=="function"&&o[Symbol.iterator];if(!t)return o;var r=t.call(o),n,a=[],i;try{for(;(e===void 0||e-- >0)&&!(n=r.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return a}var Mr="ENTRIES",xt="KEYS",Ft="VALUES",H="",_e=function(){function o(e,t){var r=e._tree,n=Array.from(r.keys());this.set=e,this._type=t,this._path=n.length>0?[{node:r,keys:n}]:[]}return o.prototype.next=function(){var e=this.dive();return this.backtrack(),e},o.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=le(this._path),t=e.node,r=e.keys;if(le(r)===H)return{done:!1,value:this.result()};var n=t.get(le(r));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()},o.prototype.backtrack=function(){if(this._path.length!==0){var e=le(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},o.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var t=e.keys;return le(t)}).filter(function(e){return e!==H}).join("")},o.prototype.value=function(){return le(this._path).node.get(H)},o.prototype.result=function(){switch(this._type){case Ft:return this.value();case xt:return this.key();default:return[this.key(),this.value()]}},o.prototype[Symbol.iterator]=function(){return this},o}(),le=function(o){return o[o.length-1]},Lr=function(o,e,t){var r=new Map;if(e===void 0)return r;for(var n=e.length+1,a=n+t,i=new Uint8Array(a*n).fill(t+1),s=0;s<n;++s)i[s]=s;for(var u=1;u<a;++u)i[u*n]=u;return Et(o,e,t,r,i,1,n,""),r},Et=function(o,e,t,r,n,a,i,s){var u,l,d=a*i;try{e:for(var h=D(o.keys()),v=h.next();!v.done;v=h.next()){var m=v.value;if(m===H){var g=n[d-1];g<=t&&r.set(s,[o.get(m),g])}else{for(var b=a,x=0;x<m.length;++x,++b){for(var S=m[x],T=i*b,A=T-i,_=n[T],L=Math.max(0,b-t-1),P=Math.min(i-1,b+t),I=L;I<P;++I){var E=S!==e[I],O=n[A+I]+ +E,R=n[A+I+1]+1,F=n[T+I]+1,f=n[T+I+1]=Math.min(O,R,F);f<_&&(_=f)}if(_>t)continue e}Et(o.get(m),e,t,r,n,b,i,s+m)}}}catch(c){u={error:c}}finally{try{v&&!v.done&&(l=h.return)&&l.call(h)}finally{if(u)throw u.error}}},Me=function(){function o(e,t){e===void 0&&(e=new Map),t===void 0&&(t=""),this._size=void 0,this._tree=e,this._prefix=t}return o.prototype.atPrefix=function(e){var t,r;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var n=W(De(this._tree,e.slice(this._prefix.length)),2),a=n[0],i=n[1];if(a===void 0){var s=W(Ue(i),2),u=s[0],l=s[1];try{for(var d=D(u.keys()),h=d.next();!h.done;h=d.next()){var v=h.value;if(v!==H&&v.startsWith(l)){var m=new Map;return m.set(v.slice(l.length),u.get(v)),new o(m,e)}}}catch(g){t={error:g}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}}return new o(a,e)},o.prototype.clear=function(){this._size=void 0,this._tree.clear()},o.prototype.delete=function(e){return this._size=void 0,Pr(this._tree,e)},o.prototype.entries=function(){return new _e(this,Mr)},o.prototype.forEach=function(e){var t,r;try{for(var n=D(this),a=n.next();!a.done;a=n.next()){var i=W(a.value,2),s=i[0],u=i[1];e(s,u,this)}}catch(l){t={error:l}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},o.prototype.fuzzyGet=function(e,t){return Lr(this._tree,e,t)},o.prototype.get=function(e){var t=We(this._tree,e);return t!==void 0?t.get(H):void 0},o.prototype.has=function(e){var t=We(this._tree,e);return t!==void 0&&t.has(H)},o.prototype.keys=function(){return new _e(this,xt)},o.prototype.set=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var r=Le(this._tree,e);return r.set(H,t),this},Object.defineProperty(o.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}),o.prototype.update=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var r=Le(this._tree,e);return r.set(H,t(r.get(H))),this},o.prototype.fetch=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var r=Le(this._tree,e),n=r.get(H);return n===void 0&&r.set(H,n=t()),n},o.prototype.values=function(){return new _e(this,Ft)},o.prototype[Symbol.iterator]=function(){return this.entries()},o.from=function(e){var t,r,n=new o;try{for(var a=D(e),i=a.next();!i.done;i=a.next()){var s=W(i.value,2),u=s[0],l=s[1];n.set(u,l)}}catch(d){t={error:d}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return n},o.fromObject=function(e){return o.from(Object.entries(e))},o}(),De=function(o,e,t){var r,n;if(t===void 0&&(t=[]),e.length===0||o==null)return[o,t];try{for(var a=D(o.keys()),i=a.next();!i.done;i=a.next()){var s=i.value;if(s!==H&&e.startsWith(s))return t.push([o,s]),De(o.get(s),e.slice(s.length),t)}}catch(u){r={error:u}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return t.push([o,e]),De(void 0,"",t)},We=function(o,e){var t,r;if(e.length===0||o==null)return o;try{for(var n=D(o.keys()),a=n.next();!a.done;a=n.next()){var i=a.value;if(i!==H&&e.startsWith(i))return We(o.get(i),e.slice(i.length))}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},Le=function(o,e){var t,r,n=e.length;e:for(var a=0;o&&a<n;){try{for(var i=(t=void 0,D(o.keys())),s=i.next();!s.done;s=i.next()){var u=s.value;if(u!==H&&e[a]===u[0]){for(var l=Math.min(n-a,u.length),d=1;d<l&&e[a+d]===u[d];)++d;var h=o.get(u);if(d===u.length)o=h;else{var v=new Map;v.set(u.slice(d),h),o.set(e.slice(a,a+d),v),o.delete(u),o=v}a+=d;continue e}}}catch(g){t={error:g}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}var m=new Map;return o.set(e.slice(a),m),m}return o},Pr=function(o,e){var t=W(De(o,e),2),r=t[0],n=t[1];if(r!==void 0){if(r.delete(H),r.size===0)St(n);else if(r.size===1){var a=W(r.entries().next().value,2),i=a[0],s=a[1];At(n,i,s)}}},St=function(o){if(o.length!==0){var e=W(Ue(o),2),t=e[0],r=e[1];if(t.delete(r),t.size===0)St(o.slice(0,-1));else if(t.size===1){var n=W(t.entries().next().value,2),a=n[0],i=n[1];a!==H&&At(o.slice(0,-1),a,i)}}},At=function(o,e,t){if(o.length!==0){var r=W(Ue(o),2),n=r[0],a=r[1];n.set(a+e,t),n.delete(a)}},Ue=function(o){return o[o.length-1]},ye,je="or",Tt="and",zr="and_not",Br=function(){function o(e){if((e==null?void 0:e.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');var t=e.autoVacuum==null||e.autoVacuum===!0?Be:e.autoVacuum;this._options=$($($({},ze),e),{autoVacuum:t,searchOptions:$($({},ft),e.searchOptions||{}),autoSuggestOptions:$($({},Jr),e.autoSuggestOptions||{})}),this._index=new Me,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=Je,this.addFields(this._options.fields)}return o.prototype.add=function(e){var t,r,n,a,i,s,u=this._options,l=u.extractField,d=u.tokenize,h=u.processTerm,v=u.fields,m=u.idField,g=l(e,m);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(m,'"'));if(this._idToShortId.has(g))throw new Error("MiniSearch: duplicate ID ".concat(g));var b=this.addDocumentId(g);this.saveStoredFields(b,e);try{for(var x=D(v),S=x.next();!S.done;S=x.next()){var T=S.value,A=l(e,T);if(A!=null){var _=d(A.toString(),T),L=this._fieldIds[T],P=new Set(_).size;this.addFieldLength(b,L,this._documentCount-1,P);try{for(var I=(n=void 0,D(_)),E=I.next();!E.done;E=I.next()){var O=E.value,R=h(O,T);if(Array.isArray(R))try{for(var F=(i=void 0,D(R)),f=F.next();!f.done;f=F.next()){var c=f.value;this.addTerm(L,b,c)}}catch(p){i={error:p}}finally{try{f&&!f.done&&(s=F.return)&&s.call(F)}finally{if(i)throw i.error}}else R&&this.addTerm(L,b,R)}}catch(p){n={error:p}}finally{try{E&&!E.done&&(a=I.return)&&a.call(I)}finally{if(n)throw n.error}}}}}catch(p){t={error:p}}finally{try{S&&!S.done&&(r=x.return)&&r.call(x)}finally{if(t)throw t.error}}},o.prototype.addAll=function(e){var t,r;try{for(var n=D(e),a=n.next();!a.done;a=n.next()){var i=a.value;this.add(i)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},o.prototype.addAllAsync=function(e,t){var r=this;t===void 0&&(t={});var n=t.chunkSize,a=n===void 0?10:n,i={chunk:[],promise:Promise.resolve()},s=e.reduce(function(d,h,v){var m=d.chunk,g=d.promise;return m.push(h),(v+1)%a===0?{chunk:[],promise:g.then(function(){return new Promise(function(b){return setTimeout(b,0)})}).then(function(){return r.addAll(m)})}:{chunk:m,promise:g}},i),u=s.chunk,l=s.promise;return l.then(function(){return r.addAll(u)})},o.prototype.remove=function(e){var t,r,n,a,i,s,u=this._options,l=u.tokenize,d=u.processTerm,h=u.extractField,v=u.fields,m=u.idField,g=h(e,m);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(m,'"'));var b=this._idToShortId.get(g);if(b==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(g,": it is not in the index"));try{for(var x=D(v),S=x.next();!S.done;S=x.next()){var T=S.value,A=h(e,T);if(A!=null){var _=l(A.toString(),T),L=this._fieldIds[T],P=new Set(_).size;this.removeFieldLength(b,L,this._documentCount,P);try{for(var I=(n=void 0,D(_)),E=I.next();!E.done;E=I.next()){var O=E.value,R=d(O,T);if(Array.isArray(R))try{for(var F=(i=void 0,D(R)),f=F.next();!f.done;f=F.next()){var c=f.value;this.removeTerm(L,b,c)}}catch(p){i={error:p}}finally{try{f&&!f.done&&(s=F.return)&&s.call(F)}finally{if(i)throw i.error}}else R&&this.removeTerm(L,b,R)}}catch(p){n={error:p}}finally{try{E&&!E.done&&(a=I.return)&&a.call(I)}finally{if(n)throw n.error}}}}}catch(p){t={error:p}}finally{try{S&&!S.done&&(r=x.return)&&r.call(x)}finally{if(t)throw t.error}}this._storedFields.delete(b),this._documentIds.delete(b),this._idToShortId.delete(g),this._fieldLength.delete(b),this._documentCount-=1},o.prototype.removeAll=function(e){var t,r;if(e)try{for(var n=D(e),a=n.next();!a.done;a=n.next()){var i=a.value;this.remove(i)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Me,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},o.prototype.discard=function(e){var t=this,r=this._idToShortId.get(e);if(r==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(r),this._storedFields.delete(r),(this._fieldLength.get(r)||[]).forEach(function(n,a){t.removeFieldLength(r,a,t._documentCount,n)}),this._fieldLength.delete(r),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},o.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,t=e.minDirtFactor,r=e.minDirtCount,n=e.batchSize,a=e.batchWait;this.conditionalVacuum({batchSize:n,batchWait:a},{minDirtCount:r,minDirtFactor:t})}},o.prototype.discardAll=function(e){var t,r,n=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var a=D(e),i=a.next();!i.done;i=a.next()){var s=i.value;this.discard(s)}}catch(u){t={error:u}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()},o.prototype.replace=function(e){var t=this._options,r=t.idField,n=t.extractField,a=n(e,r);this.discard(a),this.add(e)},o.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},o.prototype.conditionalVacuum=function(e,t){var r=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var n=r._enqueuedVacuumConditions;return r._enqueuedVacuumConditions=Je,r.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},o.prototype.performVacuuming=function(e,t){return Rr(this,void 0,void 0,function(){var r,n,a,i,s,u,l,d,h,v,m,g,b,x,S,T,A,_,L,P,I,E,O,R,F;return _r(this,function(f){switch(f.label){case 0:if(r=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];n=e.batchSize||Ke.batchSize,a=e.batchWait||Ke.batchWait,i=1,f.label=1;case 1:f.trys.push([1,7,8,9]),s=D(this._index),u=s.next(),f.label=2;case 2:if(u.done)return[3,6];l=W(u.value,2),d=l[0],h=l[1];try{for(v=(E=void 0,D(h)),m=v.next();!m.done;m=v.next()){g=W(m.value,2),b=g[0],x=g[1];try{for(S=(R=void 0,D(x)),T=S.next();!T.done;T=S.next())A=W(T.value,1),_=A[0],!this._documentIds.has(_)&&(x.size<=1?h.delete(b):x.delete(_))}catch(c){R={error:c}}finally{try{T&&!T.done&&(F=S.return)&&F.call(S)}finally{if(R)throw R.error}}}}catch(c){E={error:c}}finally{try{m&&!m.done&&(O=v.return)&&O.call(v)}finally{if(E)throw E.error}}return this._index.get(d).size===0&&this._index.delete(d),i%n!==0?[3,4]:[4,new Promise(function(c){return setTimeout(c,a)})];case 3:f.sent(),f.label=4;case 4:i+=1,f.label=5;case 5:return u=s.next(),[3,2];case 6:return[3,9];case 7:return L=f.sent(),P={error:L},[3,9];case 8:try{u&&!u.done&&(I=s.return)&&I.call(s)}finally{if(P)throw P.error}return[7];case 9:this._dirtCount-=r,f.label=10;case 10:return[4,null];case 11:return f.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},o.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var t=e.minDirtCount,r=e.minDirtFactor;return t=t||Be.minDirtCount,r=r||Be.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=r},Object.defineProperty(o.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),o.prototype.has=function(e){return this._idToShortId.has(e)},o.prototype.getStoredFields=function(e){var t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)},o.prototype.search=function(e,t){var r,n;t===void 0&&(t={});var a=this.executeQuery(e,t),i=[];try{for(var s=D(a),u=s.next();!u.done;u=s.next()){var l=W(u.value,2),d=l[0],h=l[1],v=h.score,m=h.terms,g=h.match,b=m.length||1,x={id:this._documentIds.get(d),score:v*b,terms:Object.keys(g),queryTerms:m,match:g};Object.assign(x,this._storedFields.get(d)),(t.filter==null||t.filter(x))&&i.push(x)}}catch(S){r={error:S}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return e===o.wildcard&&t.boostDocument==null&&this._options.searchOptions.boostDocument==null||i.sort(dt),i},o.prototype.autoSuggest=function(e,t){var r,n,a,i;t===void 0&&(t={}),t=$($({},this._options.autoSuggestOptions),t);var s=new Map;try{for(var u=D(this.search(e,t)),l=u.next();!l.done;l=u.next()){var d=l.value,h=d.score,v=d.terms,m=v.join(" "),g=s.get(m);g!=null?(g.score+=h,g.count+=1):s.set(m,{score:h,terms:v,count:1})}}catch(L){r={error:L}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}var b=[];try{for(var x=D(s),S=x.next();!S.done;S=x.next()){var T=W(S.value,2),g=T[0],A=T[1],h=A.score,v=A.terms,_=A.count;b.push({suggestion:g,terms:v,score:h/_})}}catch(L){a={error:L}}finally{try{S&&!S.done&&(i=x.return)&&i.call(x)}finally{if(a)throw a.error}}return b.sort(dt),b},Object.defineProperty(o.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),o.loadJSON=function(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),t)},o.getDefault=function(e){if(ze.hasOwnProperty(e))return Pe(ze,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},o.loadJS=function(e,t){var r,n,a,i,s,u,l=e.index,d=e.documentCount,h=e.nextId,v=e.documentIds,m=e.fieldIds,g=e.fieldLength,b=e.averageFieldLength,x=e.storedFields,S=e.dirtCount,T=e.serializationVersion;if(T!==1&&T!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var A=new o(t);A._documentCount=d,A._nextId=h,A._documentIds=Ae(v),A._idToShortId=new Map,A._fieldIds=m,A._fieldLength=Ae(g),A._avgFieldLength=b,A._storedFields=Ae(x),A._dirtCount=S||0,A._index=new Me;try{for(var _=D(A._documentIds),L=_.next();!L.done;L=_.next()){var P=W(L.value,2),I=P[0],E=P[1];A._idToShortId.set(E,I)}}catch(y){r={error:y}}finally{try{L&&!L.done&&(n=_.return)&&n.call(_)}finally{if(r)throw r.error}}try{for(var O=D(l),R=O.next();!R.done;R=O.next()){var F=W(R.value,2),f=F[0],c=F[1],p=new Map;try{for(var C=(s=void 0,D(Object.keys(c))),N=C.next();!N.done;N=C.next()){var M=N.value,z=c[M];T===1&&(z=z.ds),p.set(parseInt(M,10),Ae(z))}}catch(y){s={error:y}}finally{try{N&&!N.done&&(u=C.return)&&u.call(C)}finally{if(s)throw s.error}}A._index.set(f,p)}}catch(y){a={error:y}}finally{try{R&&!R.done&&(i=O.return)&&i.call(O)}finally{if(a)throw a.error}}return A},o.prototype.executeQuery=function(e,t){var r=this;if(t===void 0&&(t={}),e===o.wildcard)return this.executeWildcardQuery(t);if(typeof e!="string"){var n=$($($({},t),e),{queries:void 0}),a=e.queries.map(function(x){return r.executeQuery(x,n)});return this.combineResults(a,n.combineWith)}var i=this._options,s=i.tokenize,u=i.processTerm,l=i.searchOptions,d=$($({tokenize:s,processTerm:u},l),t),h=d.tokenize,v=d.processTerm,m=h(e).flatMap(function(x){return v(x)}).filter(function(x){return!!x}),g=m.map(Kr(d)),b=g.map(function(x){return r.executeQuerySpec(x,d)});return this.combineResults(b,d.combineWith)},o.prototype.executeQuerySpec=function(e,t){var r,n,a,i,s=$($({},this._options.searchOptions),t),u=(s.fields||this._options.fields).reduce(function(M,z){var y;return $($({},M),(y={},y[z]=Pe(s.boost,z)||1,y))},{}),l=s.boostDocument,d=s.weights,h=s.maxFuzzy,v=s.bm25,m=$($({},ft.weights),d),g=m.fuzzy,b=m.prefix,x=this._index.get(e.term),S=this.termResults(e.term,e.term,1,x,u,l,v),T,A;if(e.prefix&&(T=this._index.atPrefix(e.term)),e.fuzzy){var _=e.fuzzy===!0?.2:e.fuzzy,L=_<1?Math.min(h,Math.round(e.term.length*_)):_;L&&(A=this._index.fuzzyGet(e.term,L))}if(T)try{for(var P=D(T),I=P.next();!I.done;I=P.next()){var E=W(I.value,2),O=E[0],R=E[1],F=O.length-e.term.length;if(F){A==null||A.delete(O);var f=b*O.length/(O.length+.3*F);this.termResults(e.term,O,f,R,u,l,v,S)}}}catch(M){r={error:M}}finally{try{I&&!I.done&&(n=P.return)&&n.call(P)}finally{if(r)throw r.error}}if(A)try{for(var c=D(A.keys()),p=c.next();!p.done;p=c.next()){var O=p.value,C=W(A.get(O),2),N=C[0],F=C[1];if(F){var f=g*O.length/(O.length+F);this.termResults(e.term,O,f,N,u,l,v,S)}}}catch(M){a={error:M}}finally{try{p&&!p.done&&(i=c.return)&&i.call(c)}finally{if(a)throw a.error}}return S},o.prototype.executeWildcardQuery=function(e){var t,r,n=new Map,a=$($({},this._options.searchOptions),e);try{for(var i=D(this._documentIds),s=i.next();!s.done;s=i.next()){var u=W(s.value,2),l=u[0],d=u[1],h=a.boostDocument?a.boostDocument(d,"",this._storedFields.get(l)):1;n.set(l,{score:h,terms:[],match:{}})}}catch(v){t={error:v}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n},o.prototype.combineResults=function(e,t){if(t===void 0&&(t=je),e.length===0)return new Map;var r=t.toLowerCase();return e.reduce(Vr[r])||new Map},o.prototype.toJSON=function(){var e,t,r,n,a=[];try{for(var i=D(this._index),s=i.next();!s.done;s=i.next()){var u=W(s.value,2),l=u[0],d=u[1],h={};try{for(var v=(r=void 0,D(d)),m=v.next();!m.done;m=v.next()){var g=W(m.value,2),b=g[0],x=g[1];h[b]=Object.fromEntries(x)}}catch(S){r={error:S}}finally{try{m&&!m.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}a.push([l,h])}}catch(S){e={error:S}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}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:a,serializationVersion:2}},o.prototype.termResults=function(e,t,r,n,a,i,s,u){var l,d,h,v,m;if(u===void 0&&(u=new Map),n==null)return u;try{for(var g=D(Object.keys(a)),b=g.next();!b.done;b=g.next()){var x=b.value,S=a[x],T=this._fieldIds[x],A=n.get(T);if(A!=null){var _=A.size,L=this._avgFieldLength[T];try{for(var P=(h=void 0,D(A.keys())),I=P.next();!I.done;I=P.next()){var E=I.value;if(!this._documentIds.has(E)){this.removeTerm(T,E,t),_-=1;continue}var O=i?i(this._documentIds.get(E),t,this._storedFields.get(E)):1;if(O){var R=A.get(E),F=this._fieldLength.get(E)[T],f=Wr(R,_,this._documentCount,F,L,s),c=r*S*O*f,p=u.get(E);if(p){p.score+=c,Ur(p.terms,e);var C=Pe(p.match,t);C?C.push(x):p.match[t]=[x]}else u.set(E,{score:c,terms:[e],match:(m={},m[t]=[x],m)})}}}catch(N){h={error:N}}finally{try{I&&!I.done&&(v=P.return)&&v.call(P)}finally{if(h)throw h.error}}}}}catch(N){l={error:N}}finally{try{b&&!b.done&&(d=g.return)&&d.call(g)}finally{if(l)throw l.error}}return u},o.prototype.addTerm=function(e,t,r){var n=this._index.fetch(r,vt),a=n.get(e);if(a==null)a=new Map,a.set(t,1),n.set(e,a);else{var i=a.get(t);a.set(t,(i||0)+1)}},o.prototype.removeTerm=function(e,t,r){if(!this._index.has(r)){this.warnDocumentChanged(t,e,r);return}var n=this._index.fetch(r,vt),a=n.get(e);a==null||a.get(t)==null?this.warnDocumentChanged(t,e,r):a.get(t)<=1?a.size<=1?n.delete(e):a.delete(t):a.set(t,a.get(t)-1),this._index.get(r).size===0&&this._index.delete(r)},o.prototype.warnDocumentChanged=function(e,t,r){var n,a;try{for(var i=D(Object.keys(this._fieldIds)),s=i.next();!s.done;s=i.next()){var u=s.value;if(this._fieldIds[u]===t){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(r,'" was not present in field "').concat(u,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(l){n={error:l}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(n)throw n.error}}},o.prototype.addDocumentId=function(e){var t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t},o.prototype.addFields=function(e){for(var t=0;t<e.length;t++)this._fieldIds[e[t]]=t},o.prototype.addFieldLength=function(e,t,r,n){var a=this._fieldLength.get(e);a==null&&this._fieldLength.set(e,a=[]),a[t]=n;var i=this._avgFieldLength[t]||0,s=i*r+n;this._avgFieldLength[t]=s/(r+1)},o.prototype.removeFieldLength=function(e,t,r,n){if(r===1){this._avgFieldLength[t]=0;return}var a=this._avgFieldLength[t]*r-n;this._avgFieldLength[t]=a/(r-1)},o.prototype.saveStoredFields=function(e,t){var r,n,a=this._options,i=a.storeFields,s=a.extractField;if(!(i==null||i.length===0)){var u=this._storedFields.get(e);u==null&&this._storedFields.set(e,u={});try{for(var l=D(i),d=l.next();!d.done;d=l.next()){var h=d.value,v=s(t,h);v!==void 0&&(u[h]=v)}}catch(m){r={error:m}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}},o.wildcard=Symbol("*"),o}(),Pe=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)?o[e]:void 0},Vr=(ye={},ye[je]=function(o,e){var t,r;try{for(var n=D(e.keys()),a=n.next();!a.done;a=n.next()){var i=a.value,s=o.get(i);if(s==null)o.set(i,e.get(i));else{var u=e.get(i),l=u.score,d=u.terms,h=u.match;s.score=s.score+l,s.match=Object.assign(s.match,h),ht(s.terms,d)}}}catch(v){t={error:v}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return o},ye[Tt]=function(o,e){var t,r,n=new Map;try{for(var a=D(e.keys()),i=a.next();!i.done;i=a.next()){var s=i.value,u=o.get(s);if(u!=null){var l=e.get(s),d=l.score,h=l.terms,v=l.match;ht(u.terms,h),n.set(s,{score:u.score+d,terms:u.terms,match:Object.assign(u.match,v)})}}}catch(m){t={error:m}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return n},ye[zr]=function(o,e){var t,r;try{for(var n=D(e.keys()),a=n.next();!a.done;a=n.next()){var i=a.value;o.delete(i)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return o},ye),$r={k:1.2,b:.7,d:.5},Wr=function(o,e,t,r,n,a){var i=a.k,s=a.b,u=a.d,l=Math.log(1+(t-e+.5)/(e+.5));return l*(u+o*(i+1)/(o+i*(1-s+s*r/n)))},Kr=function(o){return function(e,t,r){var n=typeof o.fuzzy=="function"?o.fuzzy(e,t,r):o.fuzzy||!1,a=typeof o.prefix=="function"?o.prefix(e,t,r):o.prefix===!0;return{term:e,fuzzy:n,prefix:a}}},ze={idField:"id",extractField:function(o,e){return o[e]},tokenize:function(o){return o.split(jr)},processTerm:function(o){return o.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(o,e){typeof(console==null?void 0:console[o])=="function"&&console[o](e)},autoVacuum:!0},ft={combineWith:je,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:$r},Jr={combineWith:Tt,prefix:function(o,e,t){return e===t.length-1}},Ke={batchSize:1e3,batchWait:10},Je={minDirtFactor:.1,minDirtCount:20},Be=$($({},Ke),Je),Ur=function(o,e){o.includes(e)||o.push(e)},ht=function(o,e){var t,r;try{for(var n=D(e),a=n.next();!a.done;a=n.next()){var i=a.value;o.includes(i)||o.push(i)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},dt=function(o,e){var t=o.score,r=e.score;return r-t},vt=function(){return new Map},Ae=function(o){var e,t,r=new Map;try{for(var n=D(Object.keys(o)),a=n.next();!a.done;a=n.next()){var i=a.value;r.set(parseInt(i,10),o[i])}}catch(s){e={error:s}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},jr=/[\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;class Gr{constructor(e=10){ke(this,"max");ke(this,"cache");this.max=e,this.cache=new Map}get(e){let t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.max&&this.cache.delete(this.first()),this.cache.set(e,t)}first(){return this.cache.keys().next().value}clear(){this.cache.clear()}}const Y=o=>(Ht("data-v-639d7ab9"),o=o(),Qt(),o),Hr=["aria-owns"],Qr={class:"shell"},qr=["title"],Yr=Y(()=>k("span",{"aria-hidden":"true",class:"vpi-search search-icon local-search-icon"},null,-1)),Zr=[Yr],Xr={class:"search-actions before"},ea=["title"],ta=Y(()=>k("span",{class:"vpi-arrow-left local-search-icon"},null,-1)),ra=[ta],aa=["placeholder"],na={class:"search-actions"},ia=["title"],oa=Y(()=>k("span",{class:"vpi-layout-list local-search-icon"},null,-1)),sa=[oa],ua=["disabled","title"],la=Y(()=>k("span",{class:"vpi-delete local-search-icon"},null,-1)),ca=[la],fa=["id","role","aria-labelledby"],ha=["aria-selected"],da=["href","aria-label","onMouseenter","onFocusin"],va={class:"titles"},pa=Y(()=>k("span",{class:"title-icon"},"#",-1)),ya=["innerHTML"],ma=Y(()=>k("span",{class:"vpi-chevron-right local-search-icon"},null,-1)),ga={class:"title main"},ba=["innerHTML"],wa={key:0,class:"excerpt-wrapper"},xa={key:0,class:"excerpt",inert:""},Fa=["innerHTML"],Ea=Y(()=>k("div",{class:"excerpt-gradient-bottom"},null,-1)),Sa=Y(()=>k("div",{class:"excerpt-gradient-top"},null,-1)),Aa={key:0,class:"no-results"},Ta={class:"search-keyboard-shortcuts"},Na=["aria-label"],Ca=Y(()=>k("span",{class:"vpi-arrow-up navigate-icon"},null,-1)),Ia=[Ca],Da=["aria-label"],ka=Y(()=>k("span",{class:"vpi-arrow-down navigate-icon"},null,-1)),Oa=[ka],Ra=["aria-label"],_a=Y(()=>k("span",{class:"vpi-corner-down-left navigate-icon"},null,-1)),Ma=[_a],La=["aria-label"],Pa=Ot({__name:"VPLocalSearchBox",emits:["close"],setup(o,{emit:e}){var M,z;const t=we(),r=we(),n=we(ar),a=tr(),{activate:i}=Dr(t,{immediate:!0,allowOutsideClick:!0,clickOutsideDeactivates:!0,escapeDeactivates:!0}),{localeIndex:s,theme:u}=a,l=et(async()=>{var y,w,B,U,K,J,V,j,Q;return nt(Br.loadJSON((B=await((w=(y=n.value)[s.value])==null?void 0:w.call(y)))==null?void 0:B.default,{fields:["title","titles","text"],storeFields:["title","titles"],searchOptions:{fuzzy:.2,prefix:!0,boost:{title:4,text:2,titles:1},...((U=u.value.search)==null?void 0:U.provider)==="local"&&((J=(K=u.value.search.options)==null?void 0:K.miniSearch)==null?void 0:J.searchOptions)},...((V=u.value.search)==null?void 0:V.provider)==="local"&&((Q=(j=u.value.search.options)==null?void 0:j.miniSearch)==null?void 0:Q.options)}))}),h=xe(()=>{var y,w;return((y=u.value.search)==null?void 0:y.provider)==="local"&&((w=u.value.search.options)==null?void 0:w.disableQueryPersistence)===!0}).value?ie(""):Rt("vitepress:local-search-filter",""),v=_t("vitepress:local-search-detailed-list",((M=u.value.search)==null?void 0:M.provider)==="local"&&((z=u.value.search.options)==null?void 0:z.detailedView)===!0),m=xe(()=>{var y,w,B;return((y=u.value.search)==null?void 0:y.provider)==="local"&&(((w=u.value.search.options)==null?void 0:w.disableDetailedView)===!0||((B=u.value.search.options)==null?void 0:B.detailedView)===!1)}),g=xe(()=>{var w,B,U,K,J,V,j;const y=((w=u.value.search)==null?void 0:w.options)??u.value.algolia;return((J=(K=(U=(B=y==null?void 0:y.locales)==null?void 0:B[s.value])==null?void 0:U.translations)==null?void 0:K.button)==null?void 0:J.buttonText)||((j=(V=y==null?void 0:y.translations)==null?void 0:V.button)==null?void 0:j.buttonText)||"Search"});Mt(()=>{m.value&&(v.value=!1)});const b=we([]),x=ie(!1);Ve(h,()=>{x.value=!1});const S=et(async()=>{if(r.value)return nt(new Or(r.value))},null),T=new Gr(16);Lt(()=>[l.value,h.value,v.value],async([y,w,B],U,K)=>{var ge,Ge,He,Qe;(U==null?void 0:U[0])!==y&&T.clear();let J=!1;if(K(()=>{J=!0}),!y)return;b.value=y.search(w).slice(0,16),x.value=!0;const V=B?await Promise.all(b.value.map(q=>A(q.id))):[];if(J)return;for(const{id:q,mod:re}of V){const ae=q.slice(0,q.indexOf("#"));let ee=T.get(ae);if(ee)continue;ee=new Map,T.set(ae,ee);const Z=re.default??re;if(Z!=null&&Z.render||Z!=null&&Z.setup){const ne=qt(Z);ne.config.warnHandler=()=>{},ne.provide(Yt,a),Object.defineProperties(ne.config.globalProperties,{$frontmatter:{get(){return a.frontmatter.value}},$params:{get(){return a.page.value.params}}});const qe=document.createElement("div");ne.mount(qe),qe.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(fe=>{var Xe;const be=(Xe=fe.querySelector("a"))==null?void 0:Xe.getAttribute("href"),Ye=(be==null?void 0:be.startsWith("#"))&&be.slice(1);if(!Ye)return;let Ze="";for(;(fe=fe.nextElementSibling)&&!/^h[1-6]$/i.test(fe.tagName);)Ze+=fe.outerHTML;ee.set(Ye,Ze)}),ne.unmount()}if(J)return}const j=new Set;if(b.value=b.value.map(q=>{const[re,ae]=q.id.split("#"),ee=T.get(re),Z=(ee==null?void 0:ee.get(ae))??"";for(const ne in q.match)j.add(ne);return{...q,text:Z}}),await he(),J)return;await new Promise(q=>{var re;(re=S.value)==null||re.unmark({done:()=>{var ae;(ae=S.value)==null||ae.markRegExp(N(j),{done:q})}})});const Q=((ge=t.value)==null?void 0:ge.querySelectorAll(".result .excerpt"))??[];for(const q of Q)(Ge=q.querySelector('mark[data-markjs="true"]'))==null||Ge.scrollIntoView({block:"center"});(Qe=(He=r.value)==null?void 0:He.firstElementChild)==null||Qe.scrollIntoView({block:"start"})},{debounce:200,immediate:!0});async function A(y){const w=Zt(y.slice(0,y.indexOf("#")));try{if(!w)throw new Error(`Cannot find file for id: ${y}`);return{id:y,mod:await import(w)}}catch(B){return console.error(B),{id:y,mod:{}}}}const _=ie(),L=xe(()=>{var y;return((y=h.value)==null?void 0:y.length)<=0});function P(y=!0){var w,B;(w=_.value)==null||w.focus(),y&&((B=_.value)==null||B.select())}Oe(()=>{P()});function I(y){y.pointerType==="mouse"&&P()}const E=ie(-1),O=ie(!1);Ve(b,y=>{E.value=y.length?0:-1,R()});function R(){he(()=>{const y=document.querySelector(".result.selected");y==null||y.scrollIntoView({block:"nearest"})})}Fe("ArrowUp",y=>{y.preventDefault(),E.value--,E.value<0&&(E.value=b.value.length-1),O.value=!0,R()}),Fe("ArrowDown",y=>{y.preventDefault(),E.value++,E.value>=b.value.length&&(E.value=0),O.value=!0,R()});const F=Pt();Fe("Enter",y=>{if(y.isComposing||y.target instanceof HTMLButtonElement&&y.target.type!=="submit")return;const w=b.value[E.value];if(y.target instanceof HTMLInputElement&&!w){y.preventDefault();return}w&&(F.go(w.id),e("close"))}),Fe("Escape",()=>{e("close")});const c=rr({modal:{displayDetails:"Display detailed list",resetButtonTitle:"Reset search",backButtonTitle:"Close search",noResultsText:"No results for",footer:{selectText:"to select",selectKeyAriaLabel:"enter",navigateText:"to navigate",navigateUpKeyAriaLabel:"up arrow",navigateDownKeyAriaLabel:"down arrow",closeText:"to close",closeKeyAriaLabel:"escape"}}});Oe(()=>{window.history.pushState(null,"",null)}),zt("popstate",y=>{y.preventDefault(),e("close")});const p=Bt(Vt?document.body:null);Oe(()=>{he(()=>{p.value=!0,he().then(()=>i())})}),$t(()=>{p.value=!1});function C(){h.value="",he().then(()=>P(!1))}function N(y){return new RegExp([...y].sort((w,B)=>B.length-w.length).map(w=>`(${Xt(w)})`).join("|"),"gi")}return(y,w)=>{var B,U,K,J;return X(),Wt(Gt,{to:"body"},[k("div",{ref_key:"el",ref:t,role:"button","aria-owns":(B=b.value)!=null&&B.length?"localsearch-list":void 0,"aria-expanded":"true","aria-haspopup":"listbox","aria-labelledby":"localsearch-label",class:"VPLocalSearchBox"},[k("div",{class:"backdrop",onClick:w[0]||(w[0]=V=>y.$emit("close"))}),k("div",Qr,[k("form",{class:"search-bar",onPointerup:w[4]||(w[4]=V=>I(V)),onSubmit:w[5]||(w[5]=Kt(()=>{},["prevent"]))},[k("label",{title:g.value,id:"localsearch-label",for:"localsearch-input"},Zr,8,qr),k("div",Xr,[k("button",{class:"back-button",title:G(c)("modal.backButtonTitle"),onClick:w[1]||(w[1]=V=>y.$emit("close"))},ra,8,ea)]),Jt(k("input",{ref_key:"searchInput",ref:_,"onUpdate:modelValue":w[2]||(w[2]=V=>jt(h)?h.value=V:null),placeholder:g.value,id:"localsearch-input","aria-labelledby":"localsearch-label",class:"search-input"},null,8,aa),[[Ut,G(h)]]),k("div",na,[m.value?Ee("",!0):(X(),te("button",{key:0,class:tt(["toggle-layout-button",{"detailed-list":G(v)}]),type:"button",title:G(c)("modal.displayDetails"),onClick:w[3]||(w[3]=V=>E.value>-1&&(v.value=!G(v)))},sa,10,ia)),k("button",{class:"clear-button",type:"reset",disabled:L.value,title:G(c)("modal.resetButtonTitle"),onClick:C},ca,8,ua)])],32),k("ul",{ref_key:"resultsEl",ref:r,id:(U=b.value)!=null&&U.length?"localsearch-list":void 0,role:(K=b.value)!=null&&K.length?"listbox":void 0,"aria-labelledby":(J=b.value)!=null&&J.length?"localsearch-label":void 0,class:"results",onMousemove:w[7]||(w[7]=V=>O.value=!1)},[(X(!0),te(at,null,rt(b.value,(V,j)=>(X(),te("li",{key:V.id,role:"option","aria-selected":E.value===j?"true":"false"},[k("a",{href:V.id,class:tt(["result",{selected:E.value===j}]),"aria-label":[...V.titles,V.title].join(" > "),onMouseenter:Q=>!O.value&&(E.value=j),onFocusin:Q=>E.value=j,onClick:w[6]||(w[6]=Q=>y.$emit("close"))},[k("div",null,[k("div",va,[pa,(X(!0),te(at,null,rt(V.titles,(Q,ge)=>(X(),te("span",{key:ge,class:"title"},[k("span",{class:"text",innerHTML:Q},null,8,ya),ma]))),128)),k("span",ga,[k("span",{class:"text",innerHTML:V.title},null,8,ba)])]),G(v)?(X(),te("div",wa,[V.text?(X(),te("div",xa,[k("div",{class:"vp-doc",innerHTML:V.text},null,8,Fa)])):Ee("",!0),Ea,Sa])):Ee("",!0)])],42,da)],8,ha))),128)),G(h)&&!b.value.length&&x.value?(X(),te("li",Aa,[de(ve(G(c)("modal.noResultsText"))+' "',1),k("strong",null,ve(G(h)),1),de('" ')])):Ee("",!0)],40,fa),k("div",Ta,[k("span",null,[k("kbd",{"aria-label":G(c)("modal.footer.navigateUpKeyAriaLabel")},Ia,8,Na),k("kbd",{"aria-label":G(c)("modal.footer.navigateDownKeyAriaLabel")},Oa,8,Da),de(" "+ve(G(c)("modal.footer.navigateText")),1)]),k("span",null,[k("kbd",{"aria-label":G(c)("modal.footer.selectKeyAriaLabel")},Ma,8,Ra),de(" "+ve(G(c)("modal.footer.selectText")),1)]),k("span",null,[k("kbd",{"aria-label":G(c)("modal.footer.closeKeyAriaLabel")},"esc",8,La),de(" "+ve(G(c)("modal.footer.closeText")),1)])])])],8,Hr)])}}}),Ka=er(Pa,[["__scopeId","data-v-639d7ab9"]]);export{Ka as default};