Files
2026-05-06 19:15:57 +08:00

4 lines
64 KiB
JavaScript

import{Z as kt,z as Pe,h as xe,am as Nt,an as He,ao as Ft,ap as Ot,aq as Rt,E as se,d as At,ar as Qe,y as de,as as Ct,at as Mt,x as Lt,au as Dt,p as Oe,U as fe,S as be,av as Pt,aw as zt,$ as Vt,B as jt,a3 as $t,o as U,b as Bt,j as k,a4 as Wt,k as L,ax as Kt,ay as Jt,az as Gt,c as Z,n as Ye,e as ye,H as Ze,G as Xe,a as he,t as pe,aA as Ut,aB as et,aC as qt,aa as Ht,af as Qt,aD as Yt,_ as Zt}from"./framework.CXEBwYRw.js";import{u as ft}from"./theme.CrRTOBPg.js";const Xt={root:()=>kt(()=>import("./@localSearchIndexroot.tqrBkNT3.js"),[])};var ht=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Te=ht.join(","),pt=typeof Element>"u",ne=pt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ee=!pt&&Element.prototype.getRootNode?function(a){var e;return a==null||(e=a.getRootNode)===null||e===void 0?void 0:e.call(a)}:function(a){return a?.ownerDocument},Ie=function(e,t){var n;t===void 0&&(t=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),s=i===""||i==="true",r=s||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Ie(e.parentNode));return r},en=function(e){var t,n=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return n===""||n==="true"},vt=function(e,t,n){if(Ie(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(Te));return t&&ne.call(e,Te)&&i.unshift(e),i=i.filter(n),i},ke=function(e,t,n){for(var i=[],s=Array.from(e);s.length;){var r=s.shift();if(!Ie(r,!1))if(r.tagName==="SLOT"){var o=r.assignedElements(),l=o.length?o:r.children,c=ke(l,!0,n);n.flatten?i.push.apply(i,c):i.push({scopeParent:r,candidates:c})}else{var f=ne.call(r,Te);f&&n.filter(r)&&(t||!e.includes(r))&&i.push(r);var h=r.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(r),p=!Ie(h,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(r));if(h&&p){var y=ke(h===!0?r.children:h.children,!0,n);n.flatten?i.push.apply(i,y):i.push({scopeParent:r,candidates:y})}else s.unshift.apply(s,r.children)}}return i},mt=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},te=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||en(e))&&!mt(e)?0:e.tabIndex},tn=function(e,t){var n=te(e);return n<0&&t&&!mt(e)?0:n},nn=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},gt=function(e){return e.tagName==="INPUT"},rn=function(e){return gt(e)&&e.type==="hidden"},sn=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return t},an=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},on=function(e){if(!e.name)return!0;var t=e.form||Ee(e),n=function(o){return t.querySelectorAll('input[type="radio"][name="'+o+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(r){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",r.message),!1}var s=an(i,e.form);return!s||s===e},ln=function(e){return gt(e)&&e.type==="radio"},cn=function(e){return ln(e)&&!on(e)},un=function(e){var t,n=e&&Ee(e),i=(t=n)===null||t===void 0?void 0:t.host,s=!1;if(n&&n!==e){var r,o,l;for(s=!!((r=i)!==null&&r!==void 0&&(o=r.ownerDocument)!==null&&o!==void 0&&o.contains(i)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&i;){var c,f,h;n=Ee(i),i=(c=n)===null||c===void 0?void 0:c.host,s=!!((f=i)!==null&&f!==void 0&&(h=f.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return s},tt=function(e){var t=e.getBoundingClientRect(),n=t.width,i=t.height;return n===0&&i===0},dn=function(e,t){var n=t.displayCheck,i=t.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var r=ne.call(e,"details>summary:first-of-type"),o=r?e.parentElement:e;if(ne.call(o,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof i=="function"){for(var l=e;e;){var c=e.parentElement,f=Ee(e);if(c&&!c.shadowRoot&&i(c)===!0)return tt(e);e.assignedSlot?e=e.assignedSlot:!c&&f!==e.ownerDocument?e=f.host:e=c}e=l}if(un(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return tt(e);return!1},fn=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var n=0;n<t.children.length;n++){var i=t.children.item(n);if(i.tagName==="LEGEND")return ne.call(t,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}t=t.parentElement}return!1},Ne=function(e,t){return!(t.disabled||rn(t)||dn(t,e)||sn(t)||fn(t))},ze=function(e,t){return!(cn(t)||te(t)<0||!Ne(e,t))},hn=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},bt=function(e){var t=[],n=[];return e.forEach(function(i,s){var r=!!i.scopeParent,o=r?i.scopeParent:i,l=tn(o,r),c=r?bt(i.candidates):o;l===0?r?t.push.apply(t,c):t.push(o):n.push({documentOrder:s,tabIndex:l,item:i,isScope:r,content:c})}),n.sort(nn).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(t)},pn=function(e,t){t=t||{};var n;return t.getShadowRoot?n=ke([e],t.includeContainer,{filter:ze.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:hn}):n=vt(e,t.includeContainer,ze.bind(null,t)),bt(n)},vn=function(e,t){t=t||{};var n;return t.getShadowRoot?n=ke([e],t.includeContainer,{filter:Ne.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):n=vt(e,t.includeContainer,Ne.bind(null,t)),n},re=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return ne.call(e,Te)===!1?!1:ze(t,e)},mn=ht.concat("iframe:not([inert]):not([inert] *)").join(","),Re=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return ne.call(e,mn)===!1?!1:Ne(t,e)};function Ve(a,e){(e==null||e>a.length)&&(e=a.length);for(var t=0,n=Array(e);t<e;t++)n[t]=a[t];return n}function gn(a){if(Array.isArray(a))return Ve(a)}function nt(a,e,t,n,i,s,r){try{var o=a[s](r),l=o.value}catch(c){return void t(c)}o.done?e(l):Promise.resolve(l).then(n,i)}function rt(a){return function(){var e=this,t=arguments;return new Promise(function(n,i){var s=a.apply(e,t);function r(l){nt(s,n,i,r,o,"next",l)}function o(l){nt(s,n,i,r,o,"throw",l)}r(void 0)})}}function it(a,e){var t=typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(!t){if(Array.isArray(a)||(t=yt(a))||e){t&&(a=t);var n=0,i=function(){};return{s:i,n:function(){return n>=a.length?{done:!0}:{done:!1,value:a[n++]}},e:function(l){throw l},f:i}}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 s,r=!0,o=!1;return{s:function(){t=t.call(a)},n:function(){var l=t.next();return r=l.done,l},e:function(l){o=!0,s=l},f:function(){try{r||t.return==null||t.return()}finally{if(o)throw s}}}}function bn(a,e,t){return(e=xn(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function yn(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function wn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function st(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(a,i).enumerable})),t.push.apply(t,n)}return t}function at(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?st(Object(t),!0).forEach(function(n){bn(a,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):st(Object(t)).forEach(function(n){Object.defineProperty(a,n,Object.getOwnPropertyDescriptor(t,n))})}return a}function me(){var a,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function s(y,_,w,T){var O=_&&_.prototype instanceof o?_:o,R=Object.create(O.prototype);return $(R,"_invoke",(function(J,B,K){var C,F,N,j=0,H=K||[],W=!1,P={p:0,n:0,v:a,a:x,f:x.bind(a,4),d:function(u,d){return C=u,F=0,N=a,P.n=d,r}};function x(u,d){for(F=u,N=d,e=0;!W&&j&&!b&&e<H.length;e++){var b,S=H[e],m=P.p,v=S[2];u>3?(b=v===d)&&(N=S[(F=S[4])?5:(F=3,3)],S[4]=S[5]=a):S[0]<=m&&((b=u<2&&m<S[1])?(F=0,P.v=d,P.n=S[1]):m<v&&(b=u<3||S[0]>d||d>v)&&(S[4]=u,S[5]=d,P.n=v,F=0))}if(b||u>1)return r;throw W=!0,d}return function(u,d,b){if(j>1)throw TypeError("Generator is already running");for(W&&d===1&&x(d,b),F=d,N=b;(e=F<2?a:N)||!W;){C||(F?F<3?(F>1&&(P.n=-1),x(F,N)):P.n=N:P.v=N);try{if(j=2,C){if(F||(u="next"),e=C[u]){if(!(e=e.call(C,N)))throw TypeError("iterator result is not an object");if(!e.done)return e;N=e.value,F<2&&(F=0)}else F===1&&(e=C.return)&&e.call(C),F<2&&(N=TypeError("The iterator does not provide a '"+u+"' method"),F=1);C=a}else if((e=(W=P.n<0)?N:J.call(B,P))!==r)break}catch(S){C=a,F=1,N=S}finally{j=1}}return{value:e,done:W}}})(y,w,T),!0),R}var r={};function o(){}function l(){}function c(){}e=Object.getPrototypeOf;var f=[][n]?e(e([][n]())):($(e={},n,function(){return this}),e),h=c.prototype=o.prototype=Object.create(f);function p(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,c):(y.__proto__=c,$(y,i,"GeneratorFunction")),y.prototype=Object.create(h),y}return l.prototype=c,$(h,"constructor",c),$(c,"constructor",l),l.displayName="GeneratorFunction",$(c,i,"GeneratorFunction"),$(h),$(h,i,"Generator"),$(h,n,function(){return this}),$(h,"toString",function(){return"[object Generator]"}),(me=function(){return{w:s,m:p}})()}function $(a,e,t,n){var i=Object.defineProperty;try{i({},"",{})}catch{i=0}$=function(s,r,o,l){function c(f,h){$(s,f,function(p){return this._invoke(f,h,p)})}r?i?i(s,r,{value:o,enumerable:!l,configurable:!l,writable:!l}):s[r]=o:(c("next",0),c("throw",1),c("return",2))},$(a,e,t,n)}function Sn(a){return gn(a)||yn(a)||yt(a)||wn()}function _n(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var n=t.call(a,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function xn(a){var e=_n(a,"string");return typeof e=="symbol"?e:e+""}function yt(a,e){if(a){if(typeof a=="string")return Ve(a,e);var t={}.toString.call(a).slice(8,-1);return t==="Object"&&a.constructor&&(t=a.constructor.name),t==="Map"||t==="Set"?Array.from(a):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ve(a,e):void 0}}var q={getActiveTrap:function(e){return e?.length>0?e[e.length-1]:null},activateTrap:function(e,t){var n=q.getActiveTrap(e);t!==n&&q.pauseTrap(e);var i=e.indexOf(t);i===-1||e.splice(i,1),e.push(t)},deactivateTrap:function(e,t){var n=e.indexOf(t);n!==-1&&e.splice(n,1),q.unpauseTrap(e)},pauseTrap:function(e){var t=q.getActiveTrap(e);t?._setPausedState(!0)},unpauseTrap:function(e){var t=q.getActiveTrap(e);t&&!t._isManuallyPaused()&&t._setPausedState(!1)}},Tn=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},En=function(e){return e?.key==="Escape"||e?.key==="Esc"||e?.keyCode===27},ge=function(e){return e?.key==="Tab"||e?.keyCode===9},In=function(e){return ge(e)&&!e.shiftKey},kn=function(e){return ge(e)&&e.shiftKey},ot=function(e){return setTimeout(e,0)},ve=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return typeof e=="function"?e.apply(void 0,n):e},we=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},Nn=[],Fn=function(e,t){var n=t?.document||document,i=t?.trapStack||Nn,s=at({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,delayReturnFocus:!0,isolateSubtrees:!1,isKeyForward:In,isKeyBackward:kn},t),r={containers:[],containerGroups:[],tabbableGroups:[],adjacentElements:new Set,alreadySilent:new Set,nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,manuallyPaused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(u,d,b){return u&&u[d]!==void 0?u[d]:s[b||d]},c=function(u,d){var b=typeof d?.composedPath=="function"?d.composedPath():void 0;return r.containerGroups.findIndex(function(S){var m=S.container,v=S.tabbableNodes;return m.contains(u)||b?.includes(m)||v.find(function(g){return g===u})})},f=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=d.hasFallback,S=b===void 0?!1:b,m=d.params,v=m===void 0?[]:m,g=s[u];if(typeof g=="function"&&(g=g.apply(void 0,Sn(v))),g===!0&&(g=void 0),!g){if(g===void 0||g===!1)return g;throw new Error("`".concat(u,"` was specified but was not a node, or did not return a node"))}var E=g;if(typeof g=="string"){try{E=n.querySelector(g)}catch(I){throw new Error("`".concat(u,'` appears to be an invalid selector; error="').concat(I.message,'"'))}if(!E&&!S)throw new Error("`".concat(u,"` as selector refers to no known node"))}return E},h=function(){var u=f("initialFocus",{hasFallback:!0});if(u===!1)return!1;if(u===void 0||u&&!Re(u,s.tabbableOptions))if(c(n.activeElement)>=0)u=n.activeElement;else{var d=r.tabbableGroups[0],b=d&&d.firstTabbableNode;u=b||f("fallbackFocus")}else u===null&&(u=f("fallbackFocus"));if(!u)throw new Error("Your focus-trap needs to have at least one focusable element");return u},p=function(){if(r.containerGroups=r.containers.map(function(u){var d=pn(u,s.tabbableOptions),b=vn(u,s.tabbableOptions),S=d.length>0?d[0]:void 0,m=d.length>0?d[d.length-1]:void 0,v=b.find(function(I){return re(I)}),g=b.slice().reverse().find(function(I){return re(I)}),E=!!d.find(function(I){return te(I)>0});return{container:u,tabbableNodes:d,focusableNodes:b,posTabIndexesFound:E,firstTabbableNode:S,lastTabbableNode:m,firstDomTabbableNode:v,lastDomTabbableNode:g,nextTabbableNode:function(A){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,D=d.indexOf(A);return D<0?V?b.slice(b.indexOf(A)+1).find(function(G){return re(G)}):b.slice(0,b.indexOf(A)).reverse().find(function(G){return re(G)}):d[D+(V?1:-1)]}}}),r.tabbableGroups=r.containerGroups.filter(function(u){return u.tabbableNodes.length>0}),r.tabbableGroups.length<=0&&!f("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(r.containerGroups.find(function(u){return u.posTabIndexesFound})&&r.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.")},y=function(u){var d=u.activeElement;if(d)return d.shadowRoot&&d.shadowRoot.activeElement!==null?y(d.shadowRoot):d},_=function(u){if(u!==!1&&u!==y(document)){if(!u||!u.focus){_(h());return}u.focus({preventScroll:!!s.preventScroll}),r.mostRecentlyFocusedNode=u,Tn(u)&&u.select()}},w=function(u){var d=f("setReturnFocus",{params:[u]});return d||(d===!1?!1:u)},T=function(u){var d=u.target,b=u.event,S=u.isBackward,m=S===void 0?!1:S;d=d||we(b),p();var v=null;if(r.tabbableGroups.length>0){var g=c(d,b),E=g>=0?r.containerGroups[g]:void 0;if(g<0)m?v=r.tabbableGroups[r.tabbableGroups.length-1].lastTabbableNode:v=r.tabbableGroups[0].firstTabbableNode;else if(m){var I=r.tabbableGroups.findIndex(function(Q){var Y=Q.firstTabbableNode;return d===Y});if(I<0&&(E.container===d||Re(d,s.tabbableOptions)&&!re(d,s.tabbableOptions)&&!E.nextTabbableNode(d,!1))&&(I=g),I>=0){var A=I===0?r.tabbableGroups.length-1:I-1,V=r.tabbableGroups[A];v=te(d)>=0?V.lastTabbableNode:V.lastDomTabbableNode}else ge(b)||(v=E.nextTabbableNode(d,!1))}else{var D=r.tabbableGroups.findIndex(function(Q){var Y=Q.lastTabbableNode;return d===Y});if(D<0&&(E.container===d||Re(d,s.tabbableOptions)&&!re(d,s.tabbableOptions)&&!E.nextTabbableNode(d))&&(D=g),D>=0){var G=D===r.tabbableGroups.length-1?0:D+1,M=r.tabbableGroups[G];v=te(d)>=0?M.firstTabbableNode:M.firstDomTabbableNode}else ge(b)||(v=E.nextTabbableNode(d))}}else v=f("fallbackFocus");return v},O=function(u){var d=we(u);if(!(c(d,u)>=0)){if(ve(s.clickOutsideDeactivates,u)){o.deactivate({returnFocus:s.returnFocusOnDeactivate});return}ve(s.allowOutsideClick,u)||u.preventDefault()}},R=function(u){var d=we(u),b=c(d,u)>=0;if(b||d instanceof Document)b&&(r.mostRecentlyFocusedNode=d);else{u.stopImmediatePropagation();var S,m=!0;if(r.mostRecentlyFocusedNode)if(te(r.mostRecentlyFocusedNode)>0){var v=c(r.mostRecentlyFocusedNode),g=r.containerGroups[v].tabbableNodes;if(g.length>0){var E=g.findIndex(function(I){return I===r.mostRecentlyFocusedNode});E>=0&&(s.isKeyForward(r.recentNavEvent)?E+1<g.length&&(S=g[E+1],m=!1):E-1>=0&&(S=g[E-1],m=!1))}}else r.containerGroups.some(function(I){return I.tabbableNodes.some(function(A){return te(A)>0})})||(m=!1);else m=!1;m&&(S=T({target:r.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(r.recentNavEvent)})),_(S||r.mostRecentlyFocusedNode||h())}r.recentNavEvent=void 0},J=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;r.recentNavEvent=u;var b=T({event:u,isBackward:d});b&&(ge(u)&&u.preventDefault(),_(b))},B=function(u){(s.isKeyForward(u)||s.isKeyBackward(u))&&J(u,s.isKeyBackward(u))},K=function(u){En(u)&&ve(s.escapeDeactivates,u)!==!1&&(u.preventDefault(),o.deactivate())},C=function(u){var d=we(u);c(d,u)>=0||ve(s.clickOutsideDeactivates,u)||ve(s.allowOutsideClick,u)||(u.preventDefault(),u.stopImmediatePropagation())},F=function(){if(!r.active)return Promise.resolve();q.activateTrap(i,o);var u;return s.delayInitialFocus?u=new Promise(function(d){r.delayInitialFocusTimer=ot(function(){_(h()),d()})}):(u=Promise.resolve(),_(h())),n.addEventListener("focusin",R,!0),n.addEventListener("mousedown",O,{capture:!0,passive:!1}),n.addEventListener("touchstart",O,{capture:!0,passive:!1}),n.addEventListener("click",C,{capture:!0,passive:!1}),n.addEventListener("keydown",B,{capture:!0,passive:!1}),n.addEventListener("keydown",K),u},N=function(u){r.active&&!r.paused&&o._setSubtreeIsolation(!1),r.adjacentElements.clear(),r.alreadySilent.clear();var d=new Set,b=new Set,S=it(u),m;try{for(S.s();!(m=S.n()).done;){var v=m.value;d.add(v);for(var g=typeof ShadowRoot<"u"&&v.getRootNode()instanceof ShadowRoot,E=v;E;){d.add(E);var I=E.parentElement,A=[];I?A=I.children:!I&&g&&(A=E.getRootNode().children,I=E.getRootNode().host,g=typeof ShadowRoot<"u"&&I.getRootNode()instanceof ShadowRoot);var V=it(A),D;try{for(V.s();!(D=V.n()).done;){var G=D.value;b.add(G)}}catch(M){V.e(M)}finally{V.f()}E=I}}}catch(M){S.e(M)}finally{S.f()}d.forEach(function(M){b.delete(M)}),r.adjacentElements=b},j=function(){if(r.active)return n.removeEventListener("focusin",R,!0),n.removeEventListener("mousedown",O,!0),n.removeEventListener("touchstart",O,!0),n.removeEventListener("click",C,!0),n.removeEventListener("keydown",B,!0),n.removeEventListener("keydown",K),o},H=function(u){var d=r.mostRecentlyFocusedNode;if(d){var b=u.some(function(m){var v=Array.from(m.removedNodes);return v.some(function(g){return g===d||typeof g.contains=="function"&&g.contains(d)})});if(b&&r.containers.some(function(m){return m?.isConnected})){p();var S=h();_(S)}}},W=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(H):void 0,P=function(){W&&(W.disconnect(),r.active&&!r.paused&&r.containers.map(function(u){W.observe(u,{subtree:!0,childList:!0})}))};return o={get active(){return r.active},get paused(){return r.paused},activate:function(u){if(r.active)return this;var d=l(u,"onActivate"),b=l(u,"onPostActivate"),S=l(u,"checkCanFocusTrap"),m=q.getActiveTrap(i),v=!1;if(m&&!m.paused){var g;(g=m._setSubtreeIsolation)===null||g===void 0||g.call(m,!1),v=!0}try{S||p(),r.active=!0,r.paused=!1,r.nodeFocusedBeforeActivation=y(n),d?.({trap:o});var E=(function(){var A=rt(me().m(function V(){return me().w(function(D){for(;;)switch(D.n){case 0:return S&&p(),D.n=1,F();case 1:o._setSubtreeIsolation(!0),P(),b?.({trap:o});case 2:return D.a(2)}},V)}));return function(){return A.apply(this,arguments)}})();if(S)return S(r.containers.concat()).then(E,E),this;E()}catch(A){if(m===q.getActiveTrap(i)&&v){var I;(I=m._setSubtreeIsolation)===null||I===void 0||I.call(m,!0)}throw A}return this},deactivate:function(u){if(!r.active)return this;var d=at({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},u);clearTimeout(r.delayInitialFocusTimer),r.delayInitialFocusTimer=void 0,r.paused||o._setSubtreeIsolation(!1),r.alreadySilent.clear(),j(),r.active=!1,r.paused=!1,P(),q.deactivateTrap(i,o);var b=l(d,"onDeactivate"),S=l(d,"onPostDeactivate"),m=l(d,"checkCanReturnFocus"),v=l(d,"delayReturnFocus"),g=l(d,"returnFocus","returnFocusOnDeactivate");b?.({trap:o});var E=function(){g&&_(w(r.nodeFocusedBeforeActivation)),S?.({trap:o})},I=function(){v&&g?ot(E):E()};return g&&m?(m(w(r.nodeFocusedBeforeActivation)).then(I,I),this):(I(),this)},pause:function(u){return r.active?(r.manuallyPaused=!0,this._setPausedState(!0,u)):this},unpause:function(u){return r.active?(r.manuallyPaused=!1,i[i.length-1]!==this?this:this._setPausedState(!1,u)):this},updateContainerElements:function(u){var d=[].concat(u).filter(Boolean);return r.containers=d.map(function(b){return typeof b=="string"?n.querySelector(b):b}),s.isolateSubtrees&&N(r.containers),r.active&&(p(),r.paused||o._setSubtreeIsolation(!0)),P(),this}},Object.defineProperties(o,{_isManuallyPaused:{value:function(){return r.manuallyPaused}},_setPausedState:{value:function(u,d){if(r.paused===u)return this;if(r.paused=u,u){var b=l(d,"onPause"),S=l(d,"onPostPause");b?.({trap:o}),j(),o._setSubtreeIsolation(!1),P(),S?.({trap:o})}else{var m=l(d,"onUnpause"),v=l(d,"onPostUnpause");m?.({trap:o});var g=(function(){var E=rt(me().m(function I(){return me().w(function(A){for(;;)switch(A.n){case 0:return p(),A.n=1,F();case 1:o._setSubtreeIsolation(!0),P(),v?.({trap:o});case 2:return A.a(2)}},I)}));return function(){return E.apply(this,arguments)}})();g()}return this}},_setSubtreeIsolation:{value:function(u){s.isolateSubtrees&&r.adjacentElements.forEach(function(d){var b;u?s.isolateSubtrees==="aria-hidden"?((d.ariaHidden==="true"||((b=d.getAttribute("aria-hidden"))===null||b===void 0?void 0:b.toLowerCase())==="true")&&r.alreadySilent.add(d),d.setAttribute("aria-hidden","true")):((d.inert||d.hasAttribute("inert"))&&r.alreadySilent.add(d),d.setAttribute("inert",!0)):r.alreadySilent.has(d)||(s.isolateSubtrees==="aria-hidden"?d.removeAttribute("aria-hidden"):d.removeAttribute("inert"))})}}}),o.updateContainerElements(e),o};function On(a,e={}){let t;const{immediate:n,...i}=e,s=se(!1),r=se(!1),o=h=>t&&t.activate(h),l=h=>t&&t.deactivate(h),c=()=>{t&&(t.pause(),r.value=!0)},f=()=>{t&&(t.unpause(),r.value=!1)};return Pe(xe(()=>Nt(He(a)).map(h=>{const p=He(h);return typeof p=="string"?p:Ft(p)}).filter(Ot)),h=>{if(h.length)if(!t)t=Fn(h,{...i,onActivate(p){s.value=!0,e.onActivate&&e.onActivate(p)},onDeactivate(p){s.value=!1,e.onDeactivate&&e.onDeactivate(p)}}),n&&o();else{const p=t?.active;t?.updateContainerElements(h),!p&&n&&o()}},{flush:"post"}),Rt(()=>l()),{hasFocus:s,isPaused:r,activate:o,deactivate:l,pause:c,unpause:f}}class ae{constructor(e,t=!0,n=[],i=5e3){this.ctx=e,this.iframes=t,this.exclude=n,this.iframesTimeout=i}static matches(e,t){const n=typeof t=="string"?[t]:t,i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(i){let s=!1;return n.every(r=>i.call(e,r)?(s=!0,!1):!0),s}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(n=>{const i=t.filter(s=>s.contains(n)).length>0;t.indexOf(n)===-1&&!i&&t.push(n)}),t}getIframeContents(e,t,n=()=>{}){let i;try{const s=e.contentWindow;if(i=s.document,!s||!i)throw new Error("iframe inaccessible")}catch{n()}i&&t(i)}isIframeBlank(e){const t="about:blank",n=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&n!==t&&n}observeIframeLoad(e,t,n){let i=!1,s=null;const r=()=>{if(!i){i=!0,clearTimeout(s);try{this.isIframeBlank(e)||(e.removeEventListener("load",r),this.getIframeContents(e,t,n))}catch{n()}}};e.addEventListener("load",r),s=setTimeout(r,this.iframesTimeout)}onIframeReady(e,t,n){try{e.contentWindow.document.readyState==="complete"?this.isIframeBlank(e)?this.observeIframeLoad(e,t,n):this.getIframeContents(e,t,n):this.observeIframeLoad(e,t,n)}catch{n()}}waitForIframes(e,t){let n=0;this.forEachIframe(e,()=>!0,i=>{n++,this.waitForIframes(i.querySelector("html"),()=>{--n||t()})},i=>{i||t()})}forEachIframe(e,t,n,i=()=>{}){let s=e.querySelectorAll("iframe"),r=s.length,o=0;s=Array.prototype.slice.call(s);const l=()=>{--r<=0&&i(o)};r||l(),s.forEach(c=>{ae.matches(c,this.exclude)?l():this.onIframeReady(c,f=>{t(c)&&(o++,n(f)),l()},l)})}createIterator(e,t,n){return document.createNodeIterator(e,t,n,!1)}createInstanceOnIframe(e){return new ae(e.querySelector("html"),this.iframes)}compareNodeIframe(e,t,n){const i=e.compareDocumentPosition(n),s=Node.DOCUMENT_POSITION_PRECEDING;if(i&s)if(t!==null){const r=t.compareDocumentPosition(n),o=Node.DOCUMENT_POSITION_FOLLOWING;if(r&o)return!0}else return!0;return!1}getIteratorNode(e){const t=e.previousNode();let n;return t===null?n=e.nextNode():n=e.nextNode()&&e.nextNode(),{prevNode:t,node:n}}checkIframeFilter(e,t,n,i){let s=!1,r=!1;return i.forEach((o,l)=>{o.val===n&&(s=l,r=o.handled)}),this.compareNodeIframe(e,t,n)?(s===!1&&!r?i.push({val:n,handled:!0}):s!==!1&&!r&&(i[s].handled=!0),!0):(s===!1&&i.push({val:n,handled:!1}),!1)}handleOpenIframes(e,t,n,i){e.forEach(s=>{s.handled||this.getIframeContents(s.val,r=>{this.createInstanceOnIframe(r).forEachNode(t,n,i)})})}iterateThroughNodes(e,t,n,i,s){const r=this.createIterator(t,e,i);let o=[],l=[],c,f,h=()=>({prevNode:f,node:c}=this.getIteratorNode(r),c);for(;h();)this.iframes&&this.forEachIframe(t,p=>this.checkIframeFilter(c,f,p,o),p=>{this.createInstanceOnIframe(p).forEachNode(e,y=>l.push(y),i)}),l.push(c);l.forEach(p=>{n(p)}),this.iframes&&this.handleOpenIframes(o,e,n,i),s()}forEachNode(e,t,n,i=()=>{}){const s=this.getContexts();let r=s.length;r||i(),s.forEach(o=>{const l=()=>{this.iterateThroughNodes(e,o,t,n,()=>{--r<=0&&i()})};this.iframes?this.waitForIframes(o,l):l()})}}let Rn=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 ae(this.ctx,this.opt.iframes,this.opt.exclude,this.opt.iframesTimeout)}log(e,t="debug"){const n=this.opt.log;this.opt.debug&&typeof n=="object"&&typeof n[t]=="function"&&n[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,n=this.opt.caseSensitive?"":"i",i=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(let s in t)if(t.hasOwnProperty(s)){const r=t[s],o=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(s):this.escapeStr(s),l=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(r):this.escapeStr(r);o!==""&&l!==""&&(e=e.replace(new RegExp(`(${this.escapeStr(o)}|${this.escapeStr(l)})`,`gm${n}`),i+`(${this.processSynomyms(o)}|${this.processSynomyms(l)})`+i))}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,n,i)=>{let s=i.charAt(n+1);return/[(|)\\]/.test(s)||s===""?t:t+"\0"})}createJoinersRegExp(e){let t=[];const n=this.opt.ignorePunctuation;return Array.isArray(n)&&n.length&&t.push(this.escapeStr(n.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",n=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 i=[];return e.split("").forEach(s=>{n.every(r=>{if(r.indexOf(s)!==-1){if(i.indexOf(r)>-1)return!1;e=e.replace(new RegExp(`[${r}]`,`gm${t}`),`[${r}]`),i.push(r)}return!0})}),e}createMergedBlanksRegExp(e){return e.replace(/[\s]+/gmi,"[\\s]+")}createAccuracyRegExp(e){const t="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿";let n=this.opt.accuracy,i=typeof n=="string"?n:n.value,s=typeof n=="string"?[]:n.limiters,r="";switch(s.forEach(o=>{r+=`|${this.escapeStr(o)}`}),i){case"partially":default:return`()(${e})`;case"complementary":return r="\\s"+(r||this.escapeStr(t)),`()([^${r}]*${e}[^${r}]*)`;case"exactly":return`(^|\\s${r})(${e})(?=$|\\s${r})`}}getSeparatedKeywords(e){let t=[];return e.forEach(n=>{this.opt.separateWordSearch?n.split(" ").forEach(i=>{i.trim()&&t.indexOf(i)===-1&&t.push(i)}):n.trim()&&t.indexOf(n)===-1&&t.push(n)}),{keywords:t.sort((n,i)=>i.length-n.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 n=0;return e.sort((i,s)=>i.start-s.start).forEach(i=>{let{start:s,end:r,valid:o}=this.callNoMatchOnInvalidRanges(i,n);o&&(i.start=s,i.length=r-s,t.push(i),n=r)}),t}callNoMatchOnInvalidRanges(e,t){let n,i,s=!1;return e&&typeof e.start<"u"?(n=parseInt(e.start,10),i=n+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&i-t>0&&i-n>0?s=!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:n,end:i,valid:s}}checkWhitespaceRanges(e,t,n){let i,s=!0,r=n.length,o=t-r,l=parseInt(e.start,10)-o;return l=l>r?r:l,i=l+parseInt(e.length,10),i>r&&(i=r,this.log(`End range automatically set to the max value of ${r}`)),l<0||i-l<0||l>r||i>r?(s=!1,this.log(`Invalid range: ${JSON.stringify(e)}`),this.opt.noMatch(e)):n.substring(l,i).replace(/\s+/g,"")===""&&(s=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:l,end:i,valid:s}}getTextNodes(e){let t="",n=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,i=>{n.push({start:t.length,end:(t+=i.textContent).length,node:i})},i=>this.matchesExclude(i.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT,()=>{e({value:t,nodes:n})})}matchesExclude(e){return ae.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}wrapRangeInTextNode(e,t,n){const i=this.opt.element?this.opt.element:"mark",s=e.splitText(t),r=s.splitText(n-t);let o=document.createElement(i);return o.setAttribute("data-markjs","true"),this.opt.className&&o.setAttribute("class",this.opt.className),o.textContent=s.textContent,s.parentNode.replaceChild(o,s),r}wrapRangeInMappedTextNode(e,t,n,i,s){e.nodes.every((r,o)=>{const l=e.nodes[o+1];if(typeof l>"u"||l.start>t){if(!i(r.node))return!1;const c=t-r.start,f=(n>r.end?r.end:n)-r.start,h=e.value.substr(0,r.start),p=e.value.substr(f+r.start);if(r.node=this.wrapRangeInTextNode(r.node,c,f),e.value=h+p,e.nodes.forEach((y,_)=>{_>=o&&(e.nodes[_].start>0&&_!==o&&(e.nodes[_].start-=f),e.nodes[_].end-=f)}),n-=f,s(r.node.previousSibling,r.start),n>r.end)t=r.end;else return!1}return!0})}wrapMatches(e,t,n,i,s){const r=t===0?0:t+1;this.getTextNodes(o=>{o.nodes.forEach(l=>{l=l.node;let c;for(;(c=e.exec(l.textContent))!==null&&c[r]!=="";){if(!n(c[r],l))continue;let f=c.index;if(r!==0)for(let h=1;h<r;h++)f+=c[h].length;l=this.wrapRangeInTextNode(l,f,f+c[r].length),i(l.previousSibling),e.lastIndex=0}}),s()})}wrapMatchesAcrossElements(e,t,n,i,s){const r=t===0?0:t+1;this.getTextNodes(o=>{let l;for(;(l=e.exec(o.value))!==null&&l[r]!=="";){let c=l.index;if(r!==0)for(let h=1;h<r;h++)c+=l[h].length;const f=c+l[r].length;this.wrapRangeInMappedTextNode(o,c,f,h=>n(l[r],h),(h,p)=>{e.lastIndex=p,i(h)})}s()})}wrapRangeFromIndex(e,t,n,i){this.getTextNodes(s=>{const r=s.value.length;e.forEach((o,l)=>{let{start:c,end:f,valid:h}=this.checkWhitespaceRanges(o,r,s.value);h&&this.wrapRangeInMappedTextNode(s,c,f,p=>t(p,o,s.value.substring(c,f),l),p=>{n(p,o)})}),i()})}unwrapMatches(e){const t=e.parentNode;let n=document.createDocumentFragment();for(;e.firstChild;)n.appendChild(e.removeChild(e.firstChild));t.replaceChild(n,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 n=0,i="wrapMatches";const s=r=>{n++,this.opt.each(r)};this.opt.acrossElements&&(i="wrapMatchesAcrossElements"),this[i](e,this.opt.ignoreGroups,(r,o)=>this.opt.filter(o,r,n),s,()=>{n===0&&this.opt.noMatch(e),this.opt.done(n)})}mark(e,t){this.opt=t;let n=0,i="wrapMatches";const{keywords:s,length:r}=this.getSeparatedKeywords(typeof e=="string"?[e]:e),o=this.opt.caseSensitive?"":"i",l=c=>{let f=new RegExp(this.createRegExp(c),`gm${o}`),h=0;this.log(`Searching with expression "${f}"`),this[i](f,1,(p,y)=>this.opt.filter(y,c,n,h),p=>{h++,n++,this.opt.each(p)},()=>{h===0&&this.opt.noMatch(c),s[r-1]===c?this.opt.done(n):l(s[s.indexOf(c)+1])})};this.opt.acrossElements&&(i="wrapMatchesAcrossElements"),r===0?this.opt.done(n):l(s[0])}markRanges(e,t){this.opt=t;let n=0,i=this.checkRanges(e);i&&i.length?(this.log("Starting to mark with the following ranges: "+JSON.stringify(i)),this.wrapRangeFromIndex(i,(s,r,o,l)=>this.opt.filter(s,r,o,l),(s,r)=>{n++,this.opt.each(s,r)},()=>{this.opt.done(n)})):this.opt.done(n)}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,n=>{this.unwrapMatches(n)},n=>{const i=ae.matches(n,t),s=this.matchesExclude(n);return!i||s?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},this.opt.done)}};function An(a){const e=new Rn(a);return this.mark=(t,n)=>(e.mark(t,n),this),this.markRegExp=(t,n)=>(e.markRegExp(t,n),this),this.markRanges=(t,n)=>(e.markRanges(t,n),this),this.unmark=t=>(e.unmark(t),this),this}const Cn="ENTRIES",wt="KEYS",St="VALUES",z="";class Ae{constructor(e,t){const n=e._tree,i=Array.from(n.keys());this.set=e,this._type=t,this._path=i.length>0?[{node:n,keys:i}]:[]}next(){const e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};const{node:e,keys:t}=ie(this._path);if(ie(t)===z)return{done:!1,value:this.result()};const n=e.get(ie(t));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const e=ie(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>ie(e)).filter(e=>e!==z).join("")}value(){return ie(this._path).node.get(z)}result(){switch(this._type){case St:return this.value();case wt:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const ie=a=>a[a.length-1],Mn=(a,e,t)=>{const n=new Map;if(e===void 0)return n;const i=e.length+1,s=i+t,r=new Uint8Array(s*i).fill(t+1);for(let o=0;o<i;++o)r[o]=o;for(let o=1;o<s;++o)r[o*i]=o;return _t(a,e,t,n,r,1,i,""),n},_t=(a,e,t,n,i,s,r,o)=>{const l=s*r;e:for(const c of a.keys())if(c===z){const f=i[l-1];f<=t&&n.set(o,[a.get(c),f])}else{let f=s;for(let h=0;h<c.length;++h,++f){const p=c[h],y=r*f,_=y-r;let w=i[y];const T=Math.max(0,f-t-1),O=Math.min(r-1,f+t);for(let R=T;R<O;++R){const J=p!==e[R],B=i[_+R]+ +J,K=i[_+R+1]+1,C=i[y+R]+1,F=i[y+R+1]=Math.min(B,K,C);F<w&&(w=F)}if(w>t)continue e}_t(a.get(c),e,t,n,i,f,r,o+c)}};class X{constructor(e=new Map,t=""){this._size=void 0,this._tree=e,this._prefix=t}atPrefix(e){if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");const[t,n]=Fe(this._tree,e.slice(this._prefix.length));if(t===void 0){const[i,s]=We(n);for(const r of i.keys())if(r!==z&&r.startsWith(s)){const o=new Map;return o.set(r.slice(s.length),i.get(r)),new X(o,e)}}return new X(t,e)}clear(){this._size=void 0,this._tree.clear()}delete(e){return this._size=void 0,Ln(this._tree,e)}entries(){return new Ae(this,Cn)}forEach(e){for(const[t,n]of this)e(t,n,this)}fuzzyGet(e,t){return Mn(this._tree,e,t)}get(e){const t=je(this._tree,e);return t!==void 0?t.get(z):void 0}has(e){const t=je(this._tree,e);return t!==void 0&&t.has(z)}keys(){return new Ae(this,wt)}set(e,t){if(typeof e!="string")throw new Error("key must be a string");return this._size=void 0,Ce(this._tree,e).set(z,t),this}get size(){if(this._size)return this._size;this._size=0;const e=this.entries();for(;!e.next().done;)this._size+=1;return this._size}update(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;const n=Ce(this._tree,e);return n.set(z,t(n.get(z))),this}fetch(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;const n=Ce(this._tree,e);let i=n.get(z);return i===void 0&&n.set(z,i=t()),i}values(){return new Ae(this,St)}[Symbol.iterator](){return this.entries()}static from(e){const t=new X;for(const[n,i]of e)t.set(n,i);return t}static fromObject(e){return X.from(Object.entries(e))}}const Fe=(a,e,t=[])=>{if(e.length===0||a==null)return[a,t];for(const n of a.keys())if(n!==z&&e.startsWith(n))return t.push([a,n]),Fe(a.get(n),e.slice(n.length),t);return t.push([a,e]),Fe(void 0,"",t)},je=(a,e)=>{if(e.length===0||a==null)return a;for(const t of a.keys())if(t!==z&&e.startsWith(t))return je(a.get(t),e.slice(t.length))},Ce=(a,e)=>{const t=e.length;e:for(let n=0;a&&n<t;){for(const s of a.keys())if(s!==z&&e[n]===s[0]){const r=Math.min(t-n,s.length);let o=1;for(;o<r&&e[n+o]===s[o];)++o;const l=a.get(s);if(o===s.length)a=l;else{const c=new Map;c.set(s.slice(o),l),a.set(e.slice(n,n+o),c),a.delete(s),a=c}n+=o;continue e}const i=new Map;return a.set(e.slice(n),i),i}return a},Ln=(a,e)=>{const[t,n]=Fe(a,e);if(t!==void 0){if(t.delete(z),t.size===0)xt(n);else if(t.size===1){const[i,s]=t.entries().next().value;Tt(n,i,s)}}},xt=a=>{if(a.length===0)return;const[e,t]=We(a);if(e.delete(t),e.size===0)xt(a.slice(0,-1));else if(e.size===1){const[n,i]=e.entries().next().value;n!==z&&Tt(a.slice(0,-1),n,i)}},Tt=(a,e,t)=>{if(a.length===0)return;const[n,i]=We(a);n.set(i+e,t),n.delete(i)},We=a=>a[a.length-1],Ke="or",Et="and",Dn="and_not";class oe{constructor(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');const t=e.autoVacuum==null||e.autoVacuum===!0?De:e.autoVacuum;this._options={...Le,...e,autoVacuum:t,searchOptions:{...lt,...e.searchOptions||{}},autoSuggestOptions:{...$n,...e.autoSuggestOptions||{}}},this._index=new X,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=Be,this.addFields(this._options.fields)}add(e){const{extractField:t,stringifyField:n,tokenize:i,processTerm:s,fields:r,idField:o}=this._options,l=t(e,o);if(l==null)throw new Error(`MiniSearch: document does not have ID field "${o}"`);if(this._idToShortId.has(l))throw new Error(`MiniSearch: duplicate ID ${l}`);const c=this.addDocumentId(l);this.saveStoredFields(c,e);for(const f of r){const h=t(e,f);if(h==null)continue;const p=i(n(h,f),f),y=this._fieldIds[f],_=new Set(p).size;this.addFieldLength(c,y,this._documentCount-1,_);for(const w of p){const T=s(w,f);if(Array.isArray(T))for(const O of T)this.addTerm(y,c,O);else T&&this.addTerm(y,c,T)}}}addAll(e){for(const t of e)this.add(t)}addAllAsync(e,t={}){const{chunkSize:n=10}=t,i={chunk:[],promise:Promise.resolve()},{chunk:s,promise:r}=e.reduce(({chunk:o,promise:l},c,f)=>(o.push(c),(f+1)%n===0?{chunk:[],promise:l.then(()=>new Promise(h=>setTimeout(h,0))).then(()=>this.addAll(o))}:{chunk:o,promise:l}),i);return r.then(()=>this.addAll(s))}remove(e){const{tokenize:t,processTerm:n,extractField:i,stringifyField:s,fields:r,idField:o}=this._options,l=i(e,o);if(l==null)throw new Error(`MiniSearch: document does not have ID field "${o}"`);const c=this._idToShortId.get(l);if(c==null)throw new Error(`MiniSearch: cannot remove document with ID ${l}: it is not in the index`);for(const f of r){const h=i(e,f);if(h==null)continue;const p=t(s(h,f),f),y=this._fieldIds[f],_=new Set(p).size;this.removeFieldLength(c,y,this._documentCount,_);for(const w of p){const T=n(w,f);if(Array.isArray(T))for(const O of T)this.removeTerm(y,c,O);else T&&this.removeTerm(y,c,T)}}this._storedFields.delete(c),this._documentIds.delete(c),this._idToShortId.delete(l),this._fieldLength.delete(c),this._documentCount-=1}removeAll(e){if(e)for(const t of e)this.remove(t);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new X,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(e){const t=this._idToShortId.get(e);if(t==null)throw new Error(`MiniSearch: cannot discard document with ID ${e}: it is not in the index`);this._idToShortId.delete(e),this._documentIds.delete(t),this._storedFields.delete(t),(this._fieldLength.get(t)||[]).forEach((n,i)=>{this.removeFieldLength(t,i,this._documentCount,n)}),this._fieldLength.delete(t),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:e,minDirtCount:t,batchSize:n,batchWait:i}=this._options.autoVacuum;this.conditionalVacuum({batchSize:n,batchWait:i},{minDirtCount:t,minDirtFactor:e})}discardAll(e){const t=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const n of e)this.discard(n)}finally{this._options.autoVacuum=t}this.maybeAutoVacuum()}replace(e){const{idField:t,extractField:n}=this._options,i=n(e,t);this.discard(i),this.add(e)}vacuum(e={}){return this.conditionalVacuum(e)}conditionalVacuum(e,t){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const n=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=Be,this.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)}async performVacuuming(e,t){const n=this._dirtCount;if(this.vacuumConditionsMet(t)){const i=e.batchSize||$e.batchSize,s=e.batchWait||$e.batchWait;let r=1;for(const[o,l]of this._index){for(const[c,f]of l)for(const[h]of f)this._documentIds.has(h)||(f.size<=1?l.delete(c):f.delete(h));this._index.get(o).size===0&&this._index.delete(o),r%i===0&&await new Promise(c=>setTimeout(c,s)),r+=1}this._dirtCount-=n}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(e){if(e==null)return!0;let{minDirtCount:t,minDirtFactor:n}=e;return t=t||De.minDirtCount,n=n||De.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=n}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(e){return this._idToShortId.has(e)}getStoredFields(e){const t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)}search(e,t={}){const{searchOptions:n}=this._options,i={...n,...t},s=this.executeQuery(e,t),r=[];for(const[o,{score:l,terms:c,match:f}]of s){const h=c.length||1,p={id:this._documentIds.get(o),score:l*h,terms:Object.keys(f),queryTerms:c,match:f};Object.assign(p,this._storedFields.get(o)),(i.filter==null||i.filter(p))&&r.push(p)}return e===oe.wildcard&&i.boostDocument==null||r.sort(ut),r}autoSuggest(e,t={}){t={...this._options.autoSuggestOptions,...t};const n=new Map;for(const{score:s,terms:r}of this.search(e,t)){const o=r.join(" "),l=n.get(o);l!=null?(l.score+=s,l.count+=1):n.set(o,{score:s,terms:r,count:1})}const i=[];for(const[s,{score:r,terms:o,count:l}]of n)i.push({suggestion:s,terms:o,score:r/l});return i.sort(ut),i}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(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)}static async loadJSONAsync(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(e),t)}static getDefault(e){if(Le.hasOwnProperty(e))return Me(Le,e);throw new Error(`MiniSearch: unknown option "${e}"`)}static loadJS(e,t){const{index:n,documentIds:i,fieldLength:s,storedFields:r,serializationVersion:o}=e,l=this.instantiateMiniSearch(e,t);l._documentIds=Se(i),l._fieldLength=Se(s),l._storedFields=Se(r);for(const[c,f]of l._documentIds)l._idToShortId.set(f,c);for(const[c,f]of n){const h=new Map;for(const p of Object.keys(f)){let y=f[p];o===1&&(y=y.ds),h.set(parseInt(p,10),Se(y))}l._index.set(c,h)}return l}static async loadJSAsync(e,t){const{index:n,documentIds:i,fieldLength:s,storedFields:r,serializationVersion:o}=e,l=this.instantiateMiniSearch(e,t);l._documentIds=await _e(i),l._fieldLength=await _e(s),l._storedFields=await _e(r);for(const[f,h]of l._documentIds)l._idToShortId.set(h,f);let c=0;for(const[f,h]of n){const p=new Map;for(const y of Object.keys(h)){let _=h[y];o===1&&(_=_.ds),p.set(parseInt(y,10),await _e(_))}++c%1e3===0&&await It(0),l._index.set(f,p)}return l}static instantiateMiniSearch(e,t){const{documentCount:n,nextId:i,fieldIds:s,averageFieldLength:r,dirtCount:o,serializationVersion:l}=e;if(l!==1&&l!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const c=new oe(t);return c._documentCount=n,c._nextId=i,c._idToShortId=new Map,c._fieldIds=s,c._avgFieldLength=r,c._dirtCount=o||0,c._index=new X,c}executeQuery(e,t={}){if(e===oe.wildcard)return this.executeWildcardQuery(t);if(typeof e!="string"){const p={...t,...e,queries:void 0},y=e.queries.map(_=>this.executeQuery(_,p));return this.combineResults(y,p.combineWith)}const{tokenize:n,processTerm:i,searchOptions:s}=this._options,r={tokenize:n,processTerm:i,...s,...t},{tokenize:o,processTerm:l}=r,h=o(e).flatMap(p=>l(p)).filter(p=>!!p).map(jn(r)).map(p=>this.executeQuerySpec(p,r));return this.combineResults(h,r.combineWith)}executeQuerySpec(e,t){const n={...this._options.searchOptions,...t},i=(n.fields||this._options.fields).reduce((w,T)=>({...w,[T]:Me(n.boost,T)||1}),{}),{boostDocument:s,weights:r,maxFuzzy:o,bm25:l}=n,{fuzzy:c,prefix:f}={...lt.weights,...r},h=this._index.get(e.term),p=this.termResults(e.term,e.term,1,e.termBoost,h,i,s,l);let y,_;if(e.prefix&&(y=this._index.atPrefix(e.term)),e.fuzzy){const w=e.fuzzy===!0?.2:e.fuzzy,T=w<1?Math.min(o,Math.round(e.term.length*w)):w;T&&(_=this._index.fuzzyGet(e.term,T))}if(y)for(const[w,T]of y){const O=w.length-e.term.length;if(!O)continue;_?.delete(w);const R=f*w.length/(w.length+.3*O);this.termResults(e.term,w,R,e.termBoost,T,i,s,l,p)}if(_)for(const w of _.keys()){const[T,O]=_.get(w);if(!O)continue;const R=c*w.length/(w.length+O);this.termResults(e.term,w,R,e.termBoost,T,i,s,l,p)}return p}executeWildcardQuery(e){const t=new Map,n={...this._options.searchOptions,...e};for(const[i,s]of this._documentIds){const r=n.boostDocument?n.boostDocument(s,"",this._storedFields.get(i)):1;t.set(i,{score:r,terms:[],match:{}})}return t}combineResults(e,t=Ke){if(e.length===0)return new Map;const n=t.toLowerCase(),i=Pn[n];if(!i)throw new Error(`Invalid combination operator: ${t}`);return e.reduce(i)||new Map}toJSON(){const e=[];for(const[t,n]of this._index){const i={};for(const[s,r]of n)i[s]=Object.fromEntries(r);e.push([t,i])}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:e,serializationVersion:2}}termResults(e,t,n,i,s,r,o,l,c=new Map){if(s==null)return c;for(const f of Object.keys(r)){const h=r[f],p=this._fieldIds[f],y=s.get(p);if(y==null)continue;let _=y.size;const w=this._avgFieldLength[p];for(const T of y.keys()){if(!this._documentIds.has(T)){this.removeTerm(p,T,t),_-=1;continue}const O=o?o(this._documentIds.get(T),t,this._storedFields.get(T)):1;if(!O)continue;const R=y.get(T),J=this._fieldLength.get(T)[p],B=Vn(R,_,this._documentCount,J,w,l),K=n*i*h*O*B,C=c.get(T);if(C){C.score+=K,Bn(C.terms,e);const F=Me(C.match,t);F?F.push(f):C.match[t]=[f]}else c.set(T,{score:K,terms:[e],match:{[t]:[f]}})}}return c}addTerm(e,t,n){const i=this._index.fetch(n,dt);let s=i.get(e);if(s==null)s=new Map,s.set(t,1),i.set(e,s);else{const r=s.get(t);s.set(t,(r||0)+1)}}removeTerm(e,t,n){if(!this._index.has(n)){this.warnDocumentChanged(t,e,n);return}const i=this._index.fetch(n,dt),s=i.get(e);s==null||s.get(t)==null?this.warnDocumentChanged(t,e,n):s.get(t)<=1?s.size<=1?i.delete(e):s.delete(t):s.set(t,s.get(t)-1),this._index.get(n).size===0&&this._index.delete(n)}warnDocumentChanged(e,t,n){for(const i of Object.keys(this._fieldIds))if(this._fieldIds[i]===t){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${n}" was not present in field "${i}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(e){const t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t}addFields(e){for(let t=0;t<e.length;t++)this._fieldIds[e[t]]=t}addFieldLength(e,t,n,i){let s=this._fieldLength.get(e);s==null&&this._fieldLength.set(e,s=[]),s[t]=i;const o=(this._avgFieldLength[t]||0)*n+i;this._avgFieldLength[t]=o/(n+1)}removeFieldLength(e,t,n,i){if(n===1){this._avgFieldLength[t]=0;return}const s=this._avgFieldLength[t]*n-i;this._avgFieldLength[t]=s/(n-1)}saveStoredFields(e,t){const{storeFields:n,extractField:i}=this._options;if(n==null||n.length===0)return;let s=this._storedFields.get(e);s==null&&this._storedFields.set(e,s={});for(const r of n){const o=i(t,r);o!==void 0&&(s[r]=o)}}}oe.wildcard=Symbol("*");const Me=(a,e)=>Object.prototype.hasOwnProperty.call(a,e)?a[e]:void 0,Pn={[Ke]:(a,e)=>{for(const t of e.keys()){const n=a.get(t);if(n==null)a.set(t,e.get(t));else{const{score:i,terms:s,match:r}=e.get(t);n.score=n.score+i,n.match=Object.assign(n.match,r),ct(n.terms,s)}}return a},[Et]:(a,e)=>{const t=new Map;for(const n of e.keys()){const i=a.get(n);if(i==null)continue;const{score:s,terms:r,match:o}=e.get(n);ct(i.terms,r),t.set(n,{score:i.score+s,terms:i.terms,match:Object.assign(i.match,o)})}return t},[Dn]:(a,e)=>{for(const t of e.keys())a.delete(t);return a}},zn={k:1.2,b:.7,d:.5},Vn=(a,e,t,n,i,s)=>{const{k:r,b:o,d:l}=s;return Math.log(1+(t-e+.5)/(e+.5))*(l+a*(r+1)/(a+r*(1-o+o*n/i)))},jn=a=>(e,t,n)=>{const i=typeof a.fuzzy=="function"?a.fuzzy(e,t,n):a.fuzzy||!1,s=typeof a.prefix=="function"?a.prefix(e,t,n):a.prefix===!0,r=typeof a.boostTerm=="function"?a.boostTerm(e,t,n):1;return{term:e,fuzzy:i,prefix:s,termBoost:r}},Le={idField:"id",extractField:(a,e)=>a[e],stringifyField:(a,e)=>a.toString(),tokenize:a=>a.split(Wn),processTerm:a=>a.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(a,e)=>{typeof console?.[a]=="function"&&console[a](e)},autoVacuum:!0},lt={combineWith:Ke,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:zn},$n={combineWith:Et,prefix:(a,e,t)=>e===t.length-1},$e={batchSize:1e3,batchWait:10},Be={minDirtFactor:.1,minDirtCount:20},De={...$e,...Be},Bn=(a,e)=>{a.includes(e)||a.push(e)},ct=(a,e)=>{for(const t of e)a.includes(t)||a.push(t)},ut=({score:a},{score:e})=>e-a,dt=()=>new Map,Se=a=>{const e=new Map;for(const t of Object.keys(a))e.set(parseInt(t,10),a[t]);return e},_e=async a=>{const e=new Map;let t=0;for(const n of Object.keys(a))e.set(parseInt(n,10),a[n]),++t%1e3===0&&await It(0);return e},It=a=>new Promise(e=>setTimeout(e,a)),Wn=/[\n\r\p{Z}\p{P}]+/u;class Kn{max;cache;constructor(e=10){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()}}function Jn(a){const{localeIndex:e,theme:t}=ft();function n(i){const s=i.split("."),r=t.value.search?.options,o=r&&typeof r=="object",l=o&&r.locales?.[e.value]?.translations||null,c=o&&r.translations||null;let f=l,h=c,p=a;const y=s.pop();for(const _ of s){let w=null;const T=p?.[_];T&&(w=p=T);const O=h?.[_];O&&(w=h=O);const R=f?.[_];R&&(w=f=R),T||(p=w),O||(h=w),R||(f=w)}return f?.[y]??h?.[y]??p?.[y]??""}return n}const Gn=["aria-owns"],Un={class:"shell"},qn=["title"],Hn={class:"search-actions before"},Qn=["title"],Yn=["aria-activedescendant","aria-controls","placeholder"],Zn={class:"search-actions"},Xn=["title"],er=["disabled","title"],tr=["id","role","aria-labelledby"],nr=["id","aria-selected"],rr=["href","aria-label","onMouseenter","onFocusin","data-index"],ir={class:"titles"},sr=["innerHTML"],ar={class:"title main"},or=["innerHTML"],lr={key:0,class:"excerpt-wrapper"},cr={key:0,class:"excerpt",inert:""},ur=["innerHTML"],dr={key:0,class:"no-results"},fr={class:"search-keyboard-shortcuts"},hr=["aria-label"],pr=["aria-label"],vr=["aria-label"],mr=["aria-label"],gr=At({__name:"VPLocalSearchBox",emits:["close"],setup(a,{emit:e}){const t=e,n=se(),i=se(),s=se(Xt),r=ft(),{activate:o}=On(n,{immediate:!0,allowOutsideClick:!0,clickOutsideDeactivates:!0,escapeDeactivates:!0}),{localeIndex:l,theme:c}=r,f=Qe(async()=>et(oe.loadJSON((await s.value[l.value]?.())?.default,{fields:["title","titles","text"],storeFields:["title","titles"],searchOptions:{fuzzy:.2,prefix:!0,boost:{title:4,text:2,titles:1},...c.value.search?.provider==="local"&&c.value.search.options?.miniSearch?.searchOptions},...c.value.search?.provider==="local"&&c.value.search.options?.miniSearch?.options}))),p=xe(()=>c.value.search?.provider==="local"&&c.value.search.options?.disableQueryPersistence===!0).value?de(""):Ct("vitepress:local-search-filter",""),y=Mt("vitepress:local-search-detailed-list",c.value.search?.provider==="local"&&c.value.search.options?.detailedView===!0),_=xe(()=>c.value.search?.provider==="local"&&(c.value.search.options?.disableDetailedView===!0||c.value.search.options?.detailedView===!1));Lt(()=>{_.value&&(y.value=!1)});const w=se([]),T=de(!1);Pe(p,()=>{T.value=!1});const O=Qe(async()=>{if(i.value)return et(new An(i.value))},null),R=new Kn(16);Dt(()=>[f.value,p.value,y.value],async([m,v,g],E,I)=>{E?.[0]!==m&&R.clear();let A=!1;if(I(()=>{A=!0}),!m)return;w.value=m.search(v).slice(0,16),T.value=!0;const V=g?await Promise.all(w.value.map(M=>J(M.id))):[];if(A)return;for(const{id:M,mod:Q}of V){const Y=M.slice(0,M.indexOf("#"));let le=R.get(Y);if(le)continue;le=new Map,R.set(Y,le);const ce=Q.default??Q;if(ce?.render||ce?.setup){const ee=qt(ce);ee.config.warnHandler=()=>{},ee.provide(Ht,r),Object.defineProperties(ee.config.globalProperties,{$frontmatter:{get(){return r.frontmatter.value}},$params:{get(){return r.page.value.params}}});const Je=document.createElement("div");ee.mount(Je),Je.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(ue=>{const Ge=ue.querySelector("a")?.getAttribute("href"),Ue=Ge?.startsWith("#")&&Ge.slice(1);if(!Ue)return;let qe="";for(;(ue=ue.nextElementSibling)&&!/^h[1-6]$/i.test(ue.tagName);)qe+=ue.outerHTML;le.set(Ue,qe)}),ee.unmount()}if(A)return}const D=new Set;if(w.value=w.value.map(M=>{const[Q,Y]=M.id.split("#"),ce=R.get(Q)?.get(Y)??"";for(const ee in M.match)D.add(ee);return{...M,text:ce}}),await fe(),A)return;await new Promise(M=>{O.value?.unmark({done:()=>{O.value?.markRegExp(b(D),{done:M})}})});const G=n.value?.querySelectorAll(".result .excerpt")??[];for(const M of G)M.querySelector('mark[data-markjs="true"]')?.scrollIntoView({block:"center"});i.value?.firstElementChild?.scrollIntoView({block:"start"})},{debounce:200,immediate:!0});async function J(m){const v=Qt(m.slice(0,m.indexOf("#")));try{if(!v)throw new Error(`Cannot find file for id: ${m}`);return{id:m,mod:await import(v)}}catch(g){return console.error(g),{id:m,mod:{}}}}const B=de(),K=xe(()=>p.value?.length<=0);function C(m=!0){B.value?.focus(),m&&B.value?.select()}Oe(()=>{C()});function F(m){m.pointerType==="mouse"&&C()}const N=de(-1),j=de(!0);Pe(w,m=>{N.value=m.length?0:-1,H()});function H(){fe(()=>{document.querySelector(".result.selected")?.scrollIntoView({block:"nearest"})})}be("ArrowUp",m=>{m.preventDefault(),N.value--,N.value<0&&(N.value=w.value.length-1),j.value=!0,H()}),be("ArrowDown",m=>{m.preventDefault(),N.value++,N.value>=w.value.length&&(N.value=0),j.value=!0,H()});const W=Pt();be("Enter",m=>{if(m.isComposing||m.target instanceof HTMLButtonElement&&m.target.type!=="submit")return;const v=w.value[N.value];if(m.target instanceof HTMLInputElement&&!v){m.preventDefault();return}v&&(W.go(v.id),t("close"))}),be("Escape",()=>{t("close")});const x=Jn({button:{buttonText:"Search"},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",m=>{m.preventDefault(),t("close")});const u=Vt(jt?document.body:null);Oe(()=>{fe(()=>{u.value=!0,fe().then(()=>o())})}),$t(()=>{u.value=!1});function d(){p.value="",fe().then(()=>C(!1))}function b(m){return new RegExp([...m].sort((v,g)=>g.length-v.length).map(v=>`(${Yt(v)})`).join("|"),"gi")}function S(m){if(!j.value)return;const v=m.target?.closest(".result"),g=Number.parseInt(v?.dataset.index);g>=0&&g!==N.value&&(N.value=g),j.value=!1}return(m,v)=>(U(),Bt(Ut,{to:"body"},[k("div",{ref_key:"el",ref:n,role:"button","aria-owns":w.value?.length?"localsearch-list":void 0,"aria-expanded":"true","aria-haspopup":"listbox","aria-labelledby":"localsearch-label",class:"VPLocalSearchBox"},[k("div",{class:"backdrop",onClick:v[0]||(v[0]=g=>m.$emit("close"))}),k("div",Un,[k("form",{class:"search-bar",onPointerup:v[4]||(v[4]=g=>F(g)),onSubmit:v[5]||(v[5]=Wt(()=>{},["prevent"]))},[k("label",{title:L(x)("button.buttonText"),id:"localsearch-label",for:"localsearch-input"},[...v[7]||(v[7]=[k("span",{"aria-hidden":"true",class:"vpi-search search-icon local-search-icon"},null,-1)])],8,qn),k("div",Hn,[k("button",{class:"back-button",title:L(x)("modal.backButtonTitle"),onClick:v[1]||(v[1]=g=>m.$emit("close"))},[...v[8]||(v[8]=[k("span",{class:"vpi-arrow-left local-search-icon"},null,-1)])],8,Qn)]),Kt(k("input",{ref_key:"searchInput",ref:B,"onUpdate:modelValue":v[2]||(v[2]=g=>Gt(p)?p.value=g:null),"aria-activedescendant":N.value>-1?"localsearch-item-"+N.value:void 0,"aria-autocomplete":"both","aria-controls":w.value?.length?"localsearch-list":void 0,"aria-labelledby":"localsearch-label",autocapitalize:"off",autocomplete:"off",autocorrect:"off",class:"search-input",id:"localsearch-input",enterkeyhint:"go",maxlength:"64",placeholder:L(x)("button.buttonText"),spellcheck:"false",type:"search"},null,8,Yn),[[Jt,L(p)]]),k("div",Zn,[_.value?ye("",!0):(U(),Z("button",{key:0,class:Ye(["toggle-layout-button",{"detailed-list":L(y)}]),type:"button",title:L(x)("modal.displayDetails"),onClick:v[3]||(v[3]=g=>N.value>-1&&(y.value=!L(y)))},[...v[9]||(v[9]=[k("span",{class:"vpi-layout-list local-search-icon"},null,-1)])],10,Xn)),k("button",{class:"clear-button",type:"reset",disabled:K.value,title:L(x)("modal.resetButtonTitle"),onClick:d},[...v[10]||(v[10]=[k("span",{class:"vpi-delete local-search-icon"},null,-1)])],8,er)])],32),k("ul",{ref_key:"resultsEl",ref:i,id:w.value?.length?"localsearch-list":void 0,role:w.value?.length?"listbox":void 0,"aria-labelledby":w.value?.length?"localsearch-label":void 0,class:"results",onMousemove:S},[(U(!0),Z(Xe,null,Ze(w.value,(g,E)=>(U(),Z("li",{key:g.id,id:"localsearch-item-"+E,"aria-selected":N.value===E?"true":"false",role:"option"},[k("a",{href:g.id,class:Ye(["result",{selected:N.value===E}]),"aria-label":[...g.titles,g.title].join(" > "),onMouseenter:I=>!j.value&&(N.value=E),onFocusin:I=>N.value=E,onClick:v[6]||(v[6]=I=>m.$emit("close")),"data-index":E},[k("div",null,[k("div",ir,[v[12]||(v[12]=k("span",{class:"title-icon"},"#",-1)),(U(!0),Z(Xe,null,Ze(g.titles,(I,A)=>(U(),Z("span",{key:A,class:"title"},[k("span",{class:"text",innerHTML:I},null,8,sr),v[11]||(v[11]=k("span",{class:"vpi-chevron-right local-search-icon"},null,-1))]))),128)),k("span",ar,[k("span",{class:"text",innerHTML:g.title},null,8,or)])]),L(y)?(U(),Z("div",lr,[g.text?(U(),Z("div",cr,[k("div",{class:"vp-doc",innerHTML:g.text},null,8,ur)])):ye("",!0),v[13]||(v[13]=k("div",{class:"excerpt-gradient-bottom"},null,-1)),v[14]||(v[14]=k("div",{class:"excerpt-gradient-top"},null,-1))])):ye("",!0)])],42,rr)],8,nr))),128)),L(p)&&!w.value.length&&T.value?(U(),Z("li",dr,[he(pe(L(x)("modal.noResultsText"))+' "',1),k("strong",null,pe(L(p)),1),v[15]||(v[15]=he('" ',-1))])):ye("",!0)],40,tr),k("div",fr,[k("span",null,[k("kbd",{"aria-label":L(x)("modal.footer.navigateUpKeyAriaLabel")},[...v[16]||(v[16]=[k("span",{class:"vpi-arrow-up navigate-icon"},null,-1)])],8,hr),k("kbd",{"aria-label":L(x)("modal.footer.navigateDownKeyAriaLabel")},[...v[17]||(v[17]=[k("span",{class:"vpi-arrow-down navigate-icon"},null,-1)])],8,pr),he(" "+pe(L(x)("modal.footer.navigateText")),1)]),k("span",null,[k("kbd",{"aria-label":L(x)("modal.footer.selectKeyAriaLabel")},[...v[18]||(v[18]=[k("span",{class:"vpi-corner-down-left navigate-icon"},null,-1)])],8,vr),he(" "+pe(L(x)("modal.footer.selectText")),1)]),k("span",null,[k("kbd",{"aria-label":L(x)("modal.footer.closeKeyAriaLabel")},"esc",8,mr),he(" "+pe(L(x)("modal.footer.closeText")),1)])])])],8,Gn)]))}}),_r=Zt(gr,[["__scopeId","data-v-8c9d8b44"]]);export{_r as default};