MCPcopy Create free account
hub / github.com/Make-md/makemd / hasNativePathMenu

Method hasNativePathMenu

main.js:177–177  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

175If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
176
177For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return Ka.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Tpt="DialogDescriptionWarning",Npt=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${T3e(Tpt).contentName}}.`;return Ka.useEffect(()=>{let i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},N3e=m3e,M3e=g3e,O3e=v3e,F3e=y3e,j3e=b3e,P3e=w3e,_3e=E3e,I3e=C3e;var q3e=ge(Me(),1),sr=ge(Me(),1);function Opt(e){if(!e||typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}var ji={DURATION:.5,EASE:[.32,.72,0,1]},$3e=.4,z3e=sr.default.createContext({drawerRef:{current:null},overlayRef:{current:null},scaleBackground:()=>{},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,handleOnly:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},visible:!1,closeDrawer:()=>{},setVisible:()=>{},direction:"bottom"}),zq=()=>{let e=sr.default.useContext(z3e);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};function ha(e,t,r,n=!1){if(!t||!(t instanceof HTMLElement))return;let i={};Object.entries(r).forEach(([a,o])=>{if(a.startsWith("--")){t.style.setProperty(a,o);return}i[a]=t.style[a],t.style[a]=o}),!n&&e.set(t,i)}function aw(e,t,r){if(!t||!(t instanceof HTMLElement))return;let n=e.get(t);!n||(r?t.style[r]=n[r]:Object.entries(n).forEach(([i,a])=>{t.style[i]=a}))}var zo=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Rq(e,t){if(!e)return null;let r=window.getComputedStyle(e),n=r.transform||r.webkitTransform||r.mozTransform,i=n.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(", ")[zo(t)?13:12]):(i=n.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(", ")[zo(t)?5:4]):null)}function Fpt(e){return 8*(Math.log(e+1)-2)}Opt("[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left]{overflow-x:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]::after{content:'';position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-handle]{display:block;position:relative;opacity:.8;margin-left:auto;margin-right:auto;height:5px;width:56px;border-radius:1rem;touch-action:pan-y;cursor:grab}[vaul-handle]:active,[vaul-handle]:hover{opacity:1}[vaul-handle]:active{cursor:grabbing}[vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@media (hover:hover) and (pointer:fine){[vaul-drawer]{user-select:none}}@media (pointer:fine){[vaul-handle-hitarea]:{width:100%;height:100%}}");function jpt(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Ppt(...e){return t=>e.forEach(r=>jpt(r,t))}function U3e(...e){return q3e.useCallback(Ppt(...e),e)}var W3=null;function _pt({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:i,noBodyStyles:a}){let[o,s]=sr.default.useState(()=>typeof window<"u"?window.location.href:""),l=sr.default.useRef(0),u=sr.default.useCallback(()=>{if(W3===null&&e&&!a){W3={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};let{scrollX:f,innerHeight:d}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-l.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let p=d-window.innerHeight;p&&l.current>=d&&(document.body.style.top=`${-(l.current+p)}px`)}),300)}},[e]),c=sr.default.useCallback(()=>{if(W3!==null&&!a){let f=-parseInt(document.body.style.top,10),d=-parseInt(document.body.style.left,10);Object.assign(document.body.style,W3),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){s(window.location.href);return}window.scrollTo(d,f)}),W3=null}},[o]);return sr.default.useEffect(()=>{function f(){l.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),sr.default.useEffect(()=>{r||!n||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{c()},500)):c())},[e,n,o,t,r,u,c]),{restorePositionSetting:c}}var Ipt=typeof window<"u"?sr.useLayoutEffect:sr.useEffect;function Tte(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}function Bpt(){return Mte(/^Mac/)}function Lpt(){return Mte(/^iPhone/)}function Rpt(){return Mte(/^iPad/)||Bpt()&&navigator.maxTouchPoints>1}function H3e(){return Lpt()||Rpt()}function Mte(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}var kte=typeof document<"u"&&window.visualViewport;function B3e(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function V3e(e){for(B3e(e)&&(e=e.parentElement);e&&!B3e(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var qpt=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),qq=0,Cte;function $pt(e={}){let{isDisabled:t}=e;Ipt(()=>{if(!t)return qq++,qq===1&&(H3e()?Cte=Upt():Cte=zpt()),()=>{qq--,qq===0&&Cte()}},[t])}function zpt(){return Tte(G3e(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`))}function Upt(){let e,t=0,r=f=>{e=V3e(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},n=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let d=f.changedTouches[0].pageY,p=e.scrollTop,h=e.scrollHeight-e.clientHeight;h!==0&&((p<=0&&d>t||p>=h&&d<t)&&f.preventDefault(),t=d)},i=f=>{let d=f.target;Nte(d)&&d!==document.activeElement&&(f.preventDefault(),d.style.transform="translateY(-2000px)",d.focus(),requestAnimationFrame(()=>{d.style.transform=""}))},a=f=>{let d=f.target;Nte(d)&&(d.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{d.style.transform="",kte&&(kte.height<window.innerHeight?requestAnimationFrame(()=>{L3e(d)}):kte.addEventListener("resize",()=>L3e(d),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,l=window.pageYOffset,u=Tte(G3e(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let c=Tte(Q3(document,"touchstart",r,{passive:!1,capture:!0}),Q3(document,"touchmove",n,{passive:!1,capture:!0}),Q3(document,"touchend",i,{passive:!1,capture:!0}),Q3(document,"focus",a,!0),Q3(window,"scroll",o));return()=>{u(),c(),window.scrollTo(s,l)}}function G3e(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function Q3(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function L3e(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=V3e(e);if(r!==document.documentElement&&r!==document.body&&r!==e){let n=r.getBoundingClientRect().top,i=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom,o=r.getBoundingClientRect().bottom;a>o&&(r.scrollTop+=i-n)}e=r.parentElement}}function Nte(e){return e instanceof HTMLInputElement&&!qpt.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function W3e(e){let t=sr.default.useRef(e);return sr.default.useEffect(()=>{t.current=e}),sr.default.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function Hpt({defaultProp:e,onChange:t}){let r=sr.default.useState(e),[n]=r,i=sr.default.useRef(n),a=W3e(t);return sr.default.useEffect(()=>{i.current!==n&&(a(n),i.current=n)},[n,i,a]),r}function Vpt({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,i]=Hpt({defaultProp:t,onChange:r}),a=e!==void 0,o=a?e:n,s=W3e(r),l=sr.default.useCallback(u=>{if(a){let f=typeof u=="function"?u(e):u;f!==e&&s(f)}else i(u)},[a,e,i,s]);return[o,l]}function Gpt({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:i,cacheRef:a,fadeFromIndex:o,onSnapPointChange:s,direction:l="bottom"}){let[u,c]=Vpt({prop:e,defaultProp:r?.[0],onChange:t}),f=sr.default.useMemo(()=>u===r?.[r.length-1]||null,[r,u]),d=r&&r.length>0&&(o||o===0)&&!Number.isNaN(o)&&r[o]===u||!r,p=sr.default.useMemo(()=>r?.findIndex(w=>w===u),[r,u]),h=sr.default.useMemo(()=>{var w;return(w=r?.map(b=>{let y=typeof window<"u",S=typeof b=="string",T=0;if(S&&(T=parseInt(b,10)),zo(l)){let k=S?T:y?b*window.innerHeight:0;return y?l==="bottom"?window.innerHeight-k:-window.innerHeight+k:k}let D=S?T:y?b*window.innerWidth:0;return y?l==="right"?window.innerWidth-D:-window.innerWidth+D:D}))!=null?w:[]},[r]),m=sr.default.useMemo(()=>p!==null?h?.[p]:null,[h,p]),v=sr.default.useCallback(w=>{var b;let y=(b=h?.findIndex(S=>S===w))!=null?b:null;s(y),ha(a.current,n.current,{transition:`transform ${ji.DURATION}s cubic-bezier(${ji.EASE.join(",")})`,transform:zo(l)?`translate3d(0, ${w}px, 0)`:`translate3d(${w}px, 0, 0)`}),h&&y!==h.length-1&&y!==o?ha(a.current,i.current,{transition:`opacity ${ji.DURATION}s cubic-bezier(${ji.EASE.join(",")})`,opacity:"0"}):ha(a.current,i.current,{transition:`opacity ${ji.DURATION}s cubic-bezier(${ji.EASE.join(",")})`,opacity:"1"}),c(y!==null?r?.[y]:null)},[n.current,r,h,o,i,c]);sr.default.useEffect(()=>{if(u||e){var w;let b=(w=r?.findIndex(y=>y===e||y===u))!=null?w:-1;h&&b!==-1&&typeof h[b]=="number"&&v(h[b])}},[u,e,r,h,v]);function A({draggedDistance:w,closeDrawer:b,velocity:y,dismissible:S}){if(o===void 0)return;let T=l==="bottom"||l==="right"?(m??0)-w:(m??0)+w,D=p===o-1,k=p===0,M=w>0;if(D&&ha(a.current,i.current,{transition:`opacity ${ji.DURATION}s cubic-bezier(${ji.EASE.join(",")})`}),y>2&&!M){S?b():v(h[0]);return}if(y>2&&M&&h&&r){v(h[r.length-1]);return}let E=h?.reduce((P,_)=>typeof P!="number"||typeof _!="number"?P:Math.abs(_-T)<Math.abs(P-T)?_:P),O=zo(l)?window.innerHeight:window.innerWidth;if(y>$3e&&Math.abs(w)<O*.4){let P=M?1:-1;if(P>0&&f){v(h[r.length-1]);return}if(k&&P<0&&S&&b(),p===null)return;v(h[p+P]);return}v(E)}function x({draggedDistance:w}){if(m===null)return;let b=l==="bottom"||l==="right"?m-w:m+w;(l==="bottom"||l==="right")&&b<h[h.length-1]||(l==="top"||l==="left")&&b>h[h.length-1]||ha(a.current,n.current,{transform:zo(l)?`translate3d(0, ${b}px, 0)`:`translate3d(${b}px, 0, 0)`})}function g(w,b){if(!r||typeof p!="number"||!h||o===void 0)return null;let y=p===o-1;if(p>=o&&b)return 0;if(y&&!b)return 1;if(!d&&!y)return null;let T=y?p+1:p-1,D=y?h[T]-h[T-1]:h[T+1]-h[T],k=w/Math.abs(D);return y?1-k:k}return{isLastSnapPoint:f,activeSnapPoint:u,shouldFade:d,getPercentageDragged:g,setActiveSnapPoint:c,activeSnapPointIndex:p,onRelease:A,onDrag:x,snapPointsOffset:h}}var Wpt=.25,Qpt=100,$q=8,ow=16,R3e=26,Dte="vaul-dragging";function Q3e({open:e,onOpenChange:t,children:r,shouldScaleBackground:n,onDrag:i,onRelease:a,snapPoints:o,nested:s=!1,setBackgroundColorOnScale:l=!0,closeThreshold:u=Wpt,scrollLockTimeout:c=Qpt,dismissible:f=!0,handleOnly:d=!1,fadeFromIndex:p=o&&o.length-1,activeSnapPoint:h,setActiveSnapPoint:m,fixed:v,modal:A=!0,onClose:x,noBodyStyles:g,direction:w="bottom",preventScrollRestoration:b=!0,disablePreventScroll:y=!1}){var S;let[T=!1,D]=sr.default.useState(!1),[k,M]=sr.default.useState(!1),[E,O]=sr.default.useState(!1),[P,_]=sr.default.useState(!1),[B,F]=sr.default.useState(!1),[L,I]=sr.default.useState(!1),R=sr.default.useRef(null),J=sr.default.useRef(null),Q=sr.default.useRef(null),q=sr.default.useRef(null),ie=sr.default.useRef(null),Ae=sr.default.useRef(!1),le=sr.default.useRef(null),pe=sr.default.useRef(0),ae=sr.default.useRef(!1),oe=sr.default.useRef(0),ue=sr.default.useRef(null),Se=sr.default.useRef(((S=ue.current)==null?void 0:S.getBoundingClientRect().height)||0),H=sr.default.useRef(0),ye=(0,sr.useRef)(null),ne=sr.default.useCallback(We=>{o&&We===Z.length-1&&(J.current=new Date)},[]),{activeSnapPoint:z,activeSnapPointIndex:U,setActiveSnapPoint:V,onRelease:Y,snapPointsOffset:Z,onDrag:re,shouldFade:he,getPercentageDragged:fe}=Gpt({snapPoints:o,cacheRef:ye,activeSnapPointProp:h,setActiveSnapPointProp:m,drawerRef:ue,fadeFromIndex:p,overlayRef:R,onSnapPointChange:ne,direction:w});$pt({isDisabled:!T||B||!A||L||!k||y});let{restorePositionSetting:ke}=_pt({isOpen:T,modal:A,nested:s,hasBeenOpened:k,preventScrollRestoration:b,noBodyStyles:g});function se(){return(window.innerWidth-R3e)/window.innerWidth}function Le(We){var K;!f&&!o||ue.current&&!ue.current.contains(We.target)||(Se.current=((K=ue.current)==null?void 0:K.getBoundingClientRect().height)||0,F(!0),Q.current=new Date,H3e()&&window.addEventListener("touchend",()=>Ae.current=!1,{once:!0}),We.target.setPointerCapture(We.pointerId),pe.current=zo(w)?We.clientY:We.clientX)}function Ne(We,K){var me;let Fe=We,Ce=(me=window.getSelection())==null?void 0:me.toString(),ft=ue.current?Rq(ue.current,w):null,gt=new Date;if(Fe.hasAttribute("data-vaul-no-drag")||Fe.closest("[data-vaul-no-drag]"))return!1;if(w==="right"||w==="left")return!0;if(J.current&&gt.getTime()-J.current.getTime()<500)return!1;if(ft!==null&&(w==="bottom"?ft>0:ft<0))return!0;if(Ce&&Ce.length>0)return!1;if(ie.current&&gt.getTime()-ie.current.getTime()<c&&ft===0||K)return ie.current=gt,!1;for(;Fe;){if(Fe.scrollHeight>Fe.clientHeight){if(Fe.scrollTop!==0)return ie.current=new Date,!1;if(Fe.getAttribute("role")==="dialog")return!0}Fe=Fe.parentNode}return!0}function Ge(We){if(!!ue.current&&B){let K=w==="bottom"||w==="right"?1:-1,me=(pe.current-(zo(w)?We.clientY:We.clientX))*K,Fe=me>0,Ce=o&&!f&&!Fe;if(Ce&&U===0)return;let ft=Math.abs(me),gt=document.querySelector("[vaul-drawer-wrapper]"),rr=ft/Se.current,Nr=fe(ft,Fe);if(Nr!==null&&(rr=Nr),Ce&&rr>=1||!Ae.current&&!Ne(We.target,Fe))return;if(ue.current.classList.add(Dte),Ae.current=!0,ha(ye.current,ue.current,{transition:"none"}),ha(ye.current,R.current,{transition:"none"}),o&&re({draggedDistance:me}),Fe&&!o){let cr=Fpt(me),br=Math.min(cr*-1,0)*K;ha(ye.current,ue.current,{transform:zo(w)?`translate3d(0, ${br}px, 0)`:`translate3d(${br}px, 0, 0)`});return}let Rr=1-rr;if((he||p&&U===p-1)&&(i?.(We,rr),ha(ye.current,R.current,{opacity:`${Rr}`,transition:"none"},!0)),gt&&R.current&&n){let cr=Math.min(se()+rr*(1-se()),1),br=8-rr*8,Br=Math.max(0,14-rr*14);document.querySelectorAll("[vaul-drawer]").forEach(nn=>{nn!==ue.current&&ha(ye.current,nn,{borderRadius:`${br}px`,transform:zo(w)?`scale(${cr}) translate3d(0, ${Br}px, 0)`:`scale(${cr}) translate3d(${Br}px, 0, 0)`,transition:"none"},!0)}),ha(ye.current,gt,{borderRadius:`${br}px`,transform:zo(w)?`scale(${cr}) translate3d(0, ${Br}px, 0)`:`scale(${cr}) translate3d(${Br}px, 0, 0)`,transition:"none"},!0)}if(!o){let cr=ft*K;ha(ye.current,ue.current,{transform:zo(w)?`translate3d(0, ${cr}px, 0)`:`translate3d(${cr}px, 0, 0)`})}}}sr.default.useEffect(()=>()=>{Ie(!1),ke()},[]),sr.default.useEffect(()=>{var We;function K(){if(!ue.current)return;let me=document.activeElement;if(Nte(me)||ae.current){var Fe;let Ce=((Fe=window.visualViewport)==null?void 0:Fe.height)||0,ft=window.innerHeight-Ce,gt=ue.current.getBoundingClientRect().height||0;H.current||(H.current=gt);let rr=ue.current.getBoundingClientRect().top;if(Math.abs(oe.current-ft)>60&&(ae.current=!ae.current),o&&o.length>0&&Z&&U&&(ft+=Z[U]||0),oe.current=ft,gt>Ce||ae.current){let Nr=ue.current.getBoundingClientRect().height,Rr=Nr;Nr>Ce&&(Rr=Ce-R3e),v?ue.current.style.height=`${Nr-Math.max(ft,0)}px`:ue.current.style.height=`${Math.max(Rr,Ce-rr)}px`}else ue.current.style.height=`${H.current}px`;o&&o.length>0&&!ae.current?ue.current.style.bottom="0px":ue.current.style.bottom=`${Math.max(ft,0)}px`}}return(We=window.visualViewport)==null||We.addEventListener("resize",K),()=>{var me;return(me=window.visualViewport)==null?void 0:me.removeEventListener("resize",K)}},[U,o,Z]);function Ye(){!ue.current||(Oe(),x?.(),ha(ye.current,ue.current,{transform:zo(w)?`translate3d(0, ${w==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${w==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${ji.DURATION}s cubic-bezier(${ji.EASE.join(",")})`}),ha(ye.current,R.current,{opacity:"0",transition:`opacity ${ji.DURATION}s cubic-bezier(${ji.EASE.join(",")})`}),Ie(!1),setTimeout(()=>{O(!1),D(!1)},300),setTimeout(()=>{o&&V(o[0])},ji.DURATION*1e3))}sr.default.useEffect(()=>{if(!T&&n){let We=setTimeout(()=>{aw(ye.current,document.body)},200);return()=>clearTimeout(We)}},[T,n]),sr.default.useLayoutEffect(()=>{e?(D(!0),M(!0)):Ye()},[e]),sr.default.useEffect(()=>{P&&t?.(T)},[T]),sr.default.useEffect(()=>{ye.current=new WeakMap,_(!0)},[]);function ve(){if(!ue.current)return;let We=document.querySelector("[vaul-drawer-wrapper]"),K=Rq(ue.current,w);ha(ye.current,ue.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${ji.DURATION}s cubic-bezier(${ji.EASE.join(",")})`}),ha(ye.current,R.current,{transition:`opacity ${ji.DURATION}s cubic-bezier(${ji.EASE.join(",")})`,opacity:"1"}),n&&K&&K>0&&T&&(document.querySelectorAll("[vaul-drawer]").forEach(Fe=>{Fe!==ue.current&&ha(ye.current,Fe,{borderRadius:`${$q}px`,overflow:"hidden",...zo(w)?{transform:`scale(${se()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${se()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ji.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ji.EASE.join(",")})`},!0)}),ha(ye.current,We,{borderRadius:`${$q}px`,overflow:"hidden",...zo(w)?{transform:`scale(${se()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${se()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ji.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ji.EASE.join(",")})`},!0))}function Oe(){!B||!ue.current||(ue.current.classList.remove(Dte),Ae.current=!1,F(!1),q.current=new Date)}function Te(We){if(!B||!ue.current)return;ue.current.classList.remove(Dte),Ae.current=!1,F(!1),q.current=new Date;let K=Rq(ue.current,w);if(!Ne(We.target,!1)||!K||Number.isNaN(K)||Q.current===null)return;let me=q.current.getTime()-Q.current.getTime(),Fe=pe.current-(zo(w)?We.clientY:We.clientX),Ce=Math.abs(Fe)/me;if(Ce>.05&&(I(!0),setTimeout(()=>{I(!1)},200)),o){Y({draggedDistance:Fe*(w==="bottom"||w==="right"?1:-1),closeDrawer:Ye,velocity:Ce,dismissible:f}),a?.(We,!0);return}if(w==="bottom"||w==="right"?Fe>0:Fe<0){ve(),a?.(We,!0);return}if(Ce>$3e){Ye(),a?.(We,!1);return}var ft;let gt=Math.min((ft=ue.current.getBoundingClientRect().height)!=null?ft:0,window.innerHeight);if(K>=gt*u){Ye(),a?.(We,!1);return}a?.(We,!0),ve()}sr.default.useEffect(()=>{T&&(ha(ye.current,document.documentElement,{scrollBehavior:"auto"}),J.current=new Date,Ie(!0))},[T]),sr.default.useEffect(()=>{if(ue.current&&E){var We;let K=ue==null||(We=ue.current)==null?void 0:We.querySelectorAll("*");K?.forEach(me=>{let Fe=me;(Fe.scrollHeight>Fe.clientHeight||Fe.scrollWidth>Fe.clientWidth)&&Fe.classList.add("vaul-scrollable")})}},[E]);function Ie(We){let K=document.querySelector("[vaul-drawer-wrapper]");!K||!n||(We?(l&&(ha(ye.current,document.body,{background:document.body.style.backgroundColor||document.body.style.background}),ha(ye.current,document.body,{background:"black"},!0)),document.querySelectorAll("[vaul-drawer]").forEach(Fe=>{Fe!==ue.current&&ha(ye.current,Fe,{borderRadius:`${$q}px`,overflow:"hidden",...zo(w)?{transform:`scale(${se()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${se()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ji.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ji.EASE.join(",")})`})}),ha(ye.current,K,{borderRadius:`${$q}px`,overflow:"hidden",...zo(w)?{transform:`scale(${se()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${se()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ji.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ji.EASE.join(",")})`})):(document.querySelectorAll("[vaul-drawer]").forEach(Fe=>{Fe!==ue.current&&(aw(ye.current,Fe,"overflow"),aw(ye.current,Fe,"transform"),aw(ye.current,Fe,"borderRadius"),ha(ye.current,Fe,{transitionProperty:"transform, border-radius",transitionDuration:`${ji.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ji.EASE.join(",")})`}))}),aw(ye.current,K,"overflow"),aw(ye.current,K,"transform"),aw(ye.current,K,"borderRadius"),ha(ye.current,K,{transitionProperty:"transform, border-radius",transitionDuration:`${ji.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ji.EASE.join(",")})`})))}function $e(We){let K=We?(window.innerWidth-ow)/window.innerWidth:1,me=We?-ow:0;le.current&&window.clearTimeout(le.current),ha(ye.current,ue.current,{transition:`transform ${ji.DURATION}s cubic-bezier(${ji.EASE.join(",")})`,transform:`scale(${K}) translate3d(0, ${me}px, 0)`}),!We&&ue.current&&(le.current=setTimeout(()=>{let Fe=Rq(ue.current,w);ha(ye.current,ue.current,{transition:"none",transform:zo(w)?`translate3d(0, ${Fe}px, 0)`:`translate3d(${Fe}px, 0, 0)`})},500))}function Ue(We,K){if(K<0)return;let me=zo(w)?window.innerHeight:window.innerWidth,Fe=(me-ow)/me,Ce=Fe+K*(1-Fe),ft=-ow+K*ow;ha(ye.current,ue.current,{transform:zo(w)?`scale(${Ce}) translate3d(0, ${ft}px, 0)`:`scale(${Ce}) translate3d(${ft}px, 0, 0)`,transition:"none"})}function Qe(We,K){let me=zo(w)?window.innerHeight:window.innerWidth,Fe=K?(me-ow)/me:1,Ce=K?-ow:0;K&&ha(ye.current,ue.current,{transition:`transform ${ji.DURATION}s cubic-bezier(${ji.EASE.join(",")})`,transform:zo(w)?`scale(${Fe}) translate3d(0, ${Ce}px, 0)`:`scale(${Fe}) translate3d(${Ce}px, 0, 0)`})}return sr.default.createElement(N3e,{modal:A,onOpenChange:We=>{if(e!==void 0){t?.(We);return}We?(M(!0),D(We)):Ye()},open:T},sr.default.createElement(z3e.Provider,{value:{visible:E,activeSnapPoint:z,snapPoints:o,setActiveSnapPoint:V,drawerRef:ue,overlayRef:R,scaleBackground:Ie,onOpenChange:t,onPress:Le,setVisible:O,onRelease:Te,onDrag:Ge,dismissible:f,handleOnly:d,isOpen:T,isDragging:B,shouldFade:he,closeDrawer:Ye,onNestedDrag:Ue,onNestedOpenChange:$e,onNestedRelease:Qe,keyboardIsOpen:ae,openProp:e,modal:A,snapPointsOffset:Z,direction:w}},r))}var Ypt=250,Xpt=120,Y3e=sr.default.forwardRef(function({preventCycle:e=!1,children:t,...r},n){let{visible:i,closeDrawer:a,isDragging:o,snapPoints:s,activeSnapPoint:l,setActiveSnapPoint:u,dismissible:c,handleOnly:f,onPress:d,onDrag:p}=zq(),h=sr.default.useRef(null),m=sr.default.useRef(!1);function v(){if(m.current){g();return}window.setTimeout(()=>{A()},Xpt)}function A(){if(o||e||m.current){g();return}if(g(),(!s||s.length===0)&&c){a();return}if(l===s[s.length-1]&&c){a();return}let b=s.findIndex(S=>S===l);if(b===-1)return;let y=s[b+1];u(y)}function x(){h.current=window.setTimeout(()=>{m.current=!0},Ypt)}function g(){window.clearTimeout(h.current),m.current=!1}return sr.default.createElement("div",{onClick:v,onDoubleClick:()=>{m.current=!0,a()},onPointerCancel:g,onPointerDown:w=>{f&&d(w),x()},onPointerMove:w=>{f&&p(w)},ref:n,"vaul-drawer-visible":i?"true":"false","vaul-handle":"","aria-hidden":"true",...r},sr.default.createElement("span",{"vaul-handle-hitarea":"","aria-hidden":"true"},t))});Y3e.displayName="Drawer.Handle";var X3e=sr.default.forwardRef(function({children:e,...t},r){let{overlayRef:n,snapPoints:i,onRelease:a,shouldFade:o,isOpen:s,visible:l}=zq(),u=U3e(r,n),c=i&&i.length>0;return sr.default.createElement(F3e,{onMouseUp:a,ref:u,"vaul-drawer-visible":l?"true":"false","vaul-overlay":"","vaul-snap-points":s&&c?"true":"false","vaul-snap-points-overlay":s&&o?"true":"false",...t})});X3e.displayName="Drawer.Overlay";var K3e=sr.default.forwardRef(function({onOpenAutoFocus:e,onPointerDownOutside:t,onAnimationEnd:r,style:n,...i},a){let{drawerRef:o,onPress:s,onRelease:l,onDrag:u,dismissible:c,keyboardIsOpen:f,snapPointsOffset:d,visible:p,closeDrawer:h,modal:m,openProp:v,onOpenChange:A,setVisible:x,handleOnly:g,direction:w}=zq(),b=U3e(a,o),y=sr.default.useRef(null),S=sr.default.useRef(!1),T=(D,k,M=0)=>{if(S.current)return!0;let E=Math.abs(D.y),O=Math.abs(D.x),P=O>E,_=["bottom","right"].includes(k)?1:-1;if(k==="left"||k==="right"){if(!(D.x*_<0)&&O>=0&&O<=M)return P}else if(!(D.y*_<0)&&E>=0&&E<=M)return!P;return S.current=!0,!0};return sr.default.useEffect(()=>{x(!0)},[]),sr.default.createElement(j3e,{"vaul-drawer":"","vaul-drawer-direction":w,"vaul-drawer-visible":p?"true":"false",...i,ref:b,style:d&&d.length>0?{"--snap-point-height":`${d[0]}px`,...n}:n,onOpenAutoFocus:D=>{if(e)e(D);else{var k;D.preventDefault(),(k=o.current)==null||k.focus()}},onPointerDown:D=>{g||(i.onPointerDown==null||i.onPointerDown.call(i,D),y.current={x:D.clientX,y:D.clientY},s(D))},onPointerDownOutside:D=>{if(t?.(D),!m||D.defaultPrevented){D.preventDefault();return}f.current&&(f.current=!1),D.preventDefault(),A?.(!1),!(!c||v!==void 0)&&h()},onFocusOutside:D=>{if(!m){D.preventDefault();return}},onEscapeKeyDown:D=>{if(!m){D.preventDefault();return}},onPointerMove:D=>{if(g||(i.onPointerMove==null||i.onPointerMove.call(i,D),!y.current))return;let k=D.clientY-y.current.y,M=D.clientX-y.current.x,E=D.pointerType==="touch"?10:2;T({x:M,y:k},w,E)?u(D):(Math.abs(M)>E||Math.abs(k)>E)&&(y.current=null)},onPointerUp:D=>{i.onPointerUp==null||i.onPointerUp.call(i,D),y.current=null,S.current=!1,l(D)}})});K3e.displayName="Drawer.Content";function Kpt({onDrag:e,onOpenChange:t,...r}){let{onNestedDrag:n,onNestedOpenChange:i,onNestedRelease:a}=zq();if(!n)throw new Error("Drawer.NestedRoot must be placed in another drawer");return sr.default.createElement(Q3e,{nested:!0,onClose:()=>{i(!1)},onDrag:(o,s)=>{n(o,s),e?.(o,s)},onOpenChange:o=>{o&&i(o),t?.(o)},onRelease:a,...r})}var sw={Root:Q3e,NestedRoot:Kpt,Content:K3e,Handle:Y3e,Overlay:X3e,Trigger:M3e,Portal:O3e,Close:I3e,Title:P3e,Description:_3e};var Uq=e=>{let{newProps:t}=e,[r,n]=sm.default.useState(!0),i=(0,sm.useMemo)(()=>{let a=document.querySelectorAll(".mk-drawer-content"),o=0;return a.forEach(s=>{if(s instanceof HTMLElement){let l=s.getAttribute("data-drawer-index");l&&parseInt(l)>=o&&(o=parseInt(l)+1)}}),o},[]);return sm.default.createElement(sw.Root,{open:r,onOpenChange:a=>{n(a)},shouldScaleBackground:!0,onClose:()=>{n(!1),e.hide(!0)},noBodyStyles:!0},sm.default.createElement(sw.Portal,null,sm.default.createElement(sw.Content,{className:(0,J3e.default)("mk-drawer-content",e.className),"data-drawer-index":i,style:{"--drawer-index":i}},sm.default.createElement(sw.Handle,{className:"mk-drawer-handle"}),sm.default.createElement(sw.Title,{className:"mk-drawer-title",hidden:!(e.title?.length>0)},e.title),(0,sm.cloneElement)(e.fc,{hide:a=>{n(!1),e.hide(a)},...t})),sm.default.createElement(sw.Overlay,{className:"mk-drawer-overlay",style:{"--drawer-index":i}})))};var Jpt=e=>{let t=E1(jf(x0,{activationConstraint:{distance:10}}),jf(w0,{activationConstraint:{delay:250,tolerance:5}}),jf(mg,{coordinateGetter:VE})),r=Vd.default.useRef(null),[n,i]=Vd.default.useState(!1);return(0,Vd.useEffect)(()=>{let a=s=>s.key=="Escape"?(e.hide(!0),!0):!1;function o(s){let l=c=>!!(c.classList.contains("mk-menu")||c.classList.contains("mk-menu-wrapper")||c.classList.contains("mk-modal")),u=s.target;for(;!l(u)&&u.parentElement;)u=u.parentElement;l(u)||r.current&&!r.current.contains(s.target)&&e.hide(!0)}return e.ui.inputManager.on("click",o),e.ui.inputManager.on("contextmenu",o),e.ui.inputManager.on("keydown",a),()=>{e.ui.inputManager.off("click",o),e.ui.inputManager.off("contextmenu",o),e.ui.inputManager.off("keydown",a)}},[e.hide]),(0,Vd.useEffect)(()=>{if(!Il(e.ui))return;let a=new ResizeObserver(o=>{let s=o[0].target.getBoundingClientRect();i(!0)});return r.current&&a.observe(r.current),()=>a.disconnect()},[e.rect]),Vd.default.createElement(k1,{sensors:t,collisionDetection:HE,measuring:{droppable:{strategy:jd.Always}}},Vd.default.createElement("div",{className:`mk-menu-wrapper ${!Il(e.ui)||n?"mk-ready":""}`,ref:r},e.children))},Hq=e=>{let t=e.win.document.createElement("div"),r=Il(e.ui)&&!e.force;r?t.classList.add("mk-menu-mobile"):t.classList.add("mk-menu"),e.win.document.body.appendChild(t);let n=null,a=(()=>{let l=!1;return u=>{e.onHide&&!u&&e.onHide(),n&&n.hide(!0),!l&&(l=!0,setTimeout(()=>{o.unmount(),e.win.document.body.removeChild(t)},50))}})(),o=e.ui.createRoot(t),s=l=>{if(r){o.render(Vd.default.createElement(Uq,{fc:(0,Vd.cloneElement)(e.fc,{onSubmenu:u=>{let c=u(e.rect,()=>{e.onHide&&e.onHide(),a(!0)});n&&n.hide(!0),n=c}}),hide:u=>a(u),newProps:l,className:(0,Z3e.default)("mk-drawer-menu",e.className)}));return}o.render(Vd.default.createElement(Jpt,{rect:e.rect,ui:e.ui,hide:u=>a(u),anchor:e.anchor},(0,Vd.cloneElement)(e.fc,{hide:u=>a(u),onSubmenu:u=>{let c=u(e.rect,()=>{e.onHide&&e.onHide(),a(!0)});n&&n.hide(!0),n=c},...l})))};if(s(e.props),!r)return t.style.position="absolute",t.style.left=`${e.rect.x}px`,t.style.top=`${e.rect.y}px`,new ResizeObserver(u=>{let c=hNe(e.rect,u[0].target.getBoundingClientRect(),{width:e.win.innerWidth,height:e.win.innerHeight},e.anchor);t.style.left=`${c.x}px`,t.style.top=`${c.y}px`}).observe(t),{update:s,hide:a}};var eMe=ge(Me());var lC=(e,t,r,n,i,a)=>Hq({ui:t.ui,rect:e,anchor:n,win:r,fc:eMe.default.createElement(Ote,{...t}),onHide:i,className:t.searchable?"mk-combo-menu":"mk-select-menu",force:a});var Gd=ge(Me());var tMe=(e,t,r,n,i,a)=>{e.ui.openModal(t,Gd.default.createElement(ga,{value:r,saveValue:n,saveLabel:i}),a)},ga=e=>{let[t,r]=(0,Gd.useState)(e.value),n=()=>{e.saveValue(t),e.hide&&e.hide()},i=(0,Gd.useRef)(null);return(0,Gd.useEffect)(()=>{i?.current&&i.current.focus()},[i]),Gd.default.createElement("div",{className:"mk-layout-column mk-gap-8"},Gd.default.createElement("input",{ref:i,value:t,type:"text",onChange:a=>r(a.target.value),className:"mk-input mk-input-large",style:{width:"100%"},onKeyDown:a=>{a.key==="Enter"&&n()}}),Gd.default.createElement("div",{className:"mk-modal-actions"},Gd.default.createElement("button",{onClick:()=>n()},e.saveLabel),Gd.default.createElement("button",{onClick:()=>e.hide&&e.hide()},N.buttons.cancel)))};var rMe=ge(On());var nMe=ge(Me());var Vq=class{constructor(){this.events={};this.handleMouseEvent=t=>{this.emit(t.type,t)};this.handleKeyEvent=t=>{this.emit(t.type,t)};this.addListeners()}on(t,r){this.events[t]||(this.events[t]=[]),this.events[t].push(r)}off(t,r){let n=this.events[t];n&&(this.events[t]=n.filter(i=>i!==r))}emit(t,r){let n=this.events[t];if(n){let i=!1;n.slice().reverse().forEach(a=>{i||(i=a(r))})}}addListeners(){window.addEventListener("mousedown",this.handleMouseEvent,!0),window.addEventListener("click",this.handleMouseEvent,!0),window.addEventListener("contextmenu",this.handleMouseEvent,!0),window.addEventListener("keydown",this.handleKeyEvent),window.addEventListener("keyup",this.handleKeyEvent)}removeListeners(){window.removeEventListener("mousedown",this.handleMouseEvent),window.removeEventListener("click",this.handleMouseEvent),window.removeEventListener("contextmenu",this.handleMouseEvent),window.removeEventListener("keydown",this.handleKeyEvent),window.removeEventListener("keyup",this.handleKeyEvent)}};var lw=class{constructor(t,r){this.resetFunctions=[];this.addResetFunction=t=>{this.resetFunctions.push(t)};this.removeResetFunction=t=>{this.resetFunctions=this.resetFunctions.filter(r=>r!=t)};this.resetSelection=t=>{this.resetFunctions.forEach(r=>r(t))};this.eventsDispatch=new Yv;this.activeState={};this.adapters=[];this.adapters=r??[],t.manager=this,this.mainFrame=t,this.inputManager=new Vq}quickOpen(t,r,n,i){this.mainFrame.quickOpen(t,r,n,i)}availableViews(){return this.mainFrame.availableViews()}defaultAdd(t,r,n){if(t?.path==Qv)this.openModal("New Tag",nMe.default.createElement(ga,{value:"",saveLabel:N.labels.saveView,saveValue:i=>F3(this.superstate,i)}),r);else if(t)if(t?.metadata.template?.length>0){_3(this.superstate,t,t.metadata.template,n);return}else Xa(this.superstate,t,"md",null,!1,null,n);else P0(this.superstate,this.superstate.pathsIndex.get(this.superstate.ui.activePath)).then(i=>{i&&Xa(this.superstate,i,"md",null,!1,null,n)})}setActiveState(t){rMe.default.isEqual(t,this.activeState)||(this.activeState=t,this.eventsDispatch.dispatchEvent("activeStateChanged",null))}setActivePath(t){this.activePath=t,this.eventsDispatch.dispatchEvent("activePathChanged",t)}setActiveSelection(t,r){this.eventsDispatch.dispatchEvent("activeSelectionChanged",{path:t,content:r})}mainMenu(t,r){this.mainFrame.mainMenu(t,r)}navigationHistory(){return this.mainFrame.navigationHistory()}allViews(){return[]}viewsByPath(t){return this.mainFrame.viewsByPath(t)}static create(t,r){return new lw(t,r)}isEverViewOpen(){return this.mainFrame.isEverViewOpen()}getWarnings(){return this.mainFrame.getWarnings()}createRoot(t,r){return this.mainFrame.createRoot(t)}openMenu(t,r,n,i="right",a,o){return lC(t,r,n,i,a,o)}openCustomMenu(t,r,n,i,a="right",o,s,l){return Hq({rect:t,anchor:a,win:i,ui:this,fc:r,props:n,onHide:o,className:s,onSubmenu:l})}notify(t,r){r!="console"&&this.mainFrame.openToast(t)}error(t){}openPalette(t,r,n){return this.mainFrame.openPalette(t,r,n)}openModal(t,r,n,i,a){return this.mainFrame.openModal(t,r,n,i,a)}openPopover(t,r){this.mainFrame.openPopover(t,r)}openPath(t,r,n,i){this.mainFrame.openPath(t,r,n,i)}primaryInteractionType(){return this.mainFrame.primaryInteractionType()}getScreenType(){return this.mainFrame.getScreenType()}getOS(){return this.mainFrame.getOS()}getSticker(t,r){return this.mainFrame.getSticker(t,r)}getPlaceholderImage(t){return mNe[t]}allStickers(){return this.mainFrame.allStickers()}getUIPath(t,r){return t?this.mainFrame.getUIPath(t,r):null}dragStarted(t,r){this.mainFrame.dragStarted(t,r)}dragEnded(t){this.mainFrame.dragEnded(t)}setDragLabel(t){this.mainFrame.setDragLabel(t)}hasNativePathMenu(t){return this.mainFrame.hasNativePathMenu(t)}nativePathMenu(t,r){this.mainFrame.nativePathMenu(t,r)}};var Zc=ge(Me());function I0(e){return Array.isArray?Array.isArray(e):fMe(e)==="[object Array]"}var Zpt=1/0;function emt(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-Zpt?"-0":t}function tmt(e){return e==null?"":emt(e)}function Og(e){return typeof e=="string"}function uMe(e){return typeof e=="number"}function rmt(e){return e===!0||e===!1||nmt(e)&&fMe(e)=="[object Boolean]"}function cMe(e){return typeof e=="object"}function nmt(e){return cMe(e)&&e!==null}function Wd(e){return e!=null}function Fte(e){return!e.trim().length}function fMe(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var imt="Incorrect 'index' type",amt=e=>`Invalid value for key ${e}`,omt=e=>`Pattern length exceeds max of ${e}.`,smt=e=>`Missing ${e} property in key`,lmt=e=>`Property 'weight' in key '${e}' must be a positive integer`,iMe=Object.prototype.hasOwnProperty,jte=class{constructor(t){this._keys=[],this._keyMap={};let r=0;t.forEach(n=>{let i=dMe(n);this._keys.push(i),this._keyMap[i.id]=i,r+=i.weight}),this._keys.forEach(n=>{n.weight/=r})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function dMe(e){let t=null,r=null,n=null,i=1,a=null;if(Og(e)||I0(e))n=e,t=aMe(e),r=Pte(e);else{if(!iMe.call(e,"name"))throw new Error(smt("name"));let o=e.name;if(n=o,iMe.call(e,"weight")&&(i=e.weight,i<=0))throw new Error(lmt(o));t=aMe(o),r=Pte(o),a=e.getFn}return{path:t,id:r,weight:i,src:n,getFn:a}}function aMe(e){return I0(e)?e:e.split(".")}function Pte(e){return I0(e)?e.join("."):e}function umt(e,t){let r=[],n=!1,i=(a,o,s)=>{if(!!Wd(a))if(!o[s])r.push(a);else{let l=o[s],u=a[l];if(!Wd(u))return;if(s===o.length-1&&(Og(u)||uMe(u)||rmt(u)))r.push(tmt(u));else if(I0(u)){n=!0;for(let c=0,f=u.length;c<f;c+=1)i(u[c],o,s+1)}else o.length&&i(u,o,s+1)}};return i(e,Og(t)?t.split("."):t,0),n?r:r[0]}var cmt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},fmt={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},dmt={location:0,threshold:.6,distance:100},pmt={useExtendedSearch:!1,getFn:umt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},on={...fmt,...cmt,...dmt,...pmt},mmt=/[^ ]+/g;function hmt(e=1,t=3){let r=new Map,n=Math.pow(10,t);return{get(i){let a=i.match(mmt).length;if(r.has(a))return r.get(a);let o=1/Math.pow(a,.5*e),s=parseFloat(Math.round(o*n)/n);return r.set(a,s),s},clear(){r.clear()}}}var Y3=class{constructor({getFn:t=on.getFn,fieldNormWeight:r=on.fieldNormWeight}={}){this.norm=hmt(r,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Og(this.docs[0])?this.docs.forEach((t,r)=>{this._addString(t,r)}):this.docs.forEach((t,r)=>{this._addObject(t,r)}),this.norm.clear())}add(t){let r=this.size();Og(t)?this._addString(t,r):this._addObject(t,r)}removeAt(t){this.records.splice(t,1);for(let r=t,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(t,r){return t[this._keysMap[r]]}size(){return this.records.length}_addString(t,r){if(!Wd(t)||Fte(t))return;let n={v:t,i:r,n:this.norm.get(t)};this.records.push(n)}_addObject(t,r){let n={i:r,$:{}};this.keys.forEach((i,a)=>{let o=i.getFn?i.getFn(t):this.getFn(t,i.path);if(!!Wd(o)){if(I0(o)){let s=[],l=[{nestedArrIndex:-1,value:o}];for(;l.length;){let{nestedArrIndex:u,value:c}=l.pop();if(!!Wd(c))if(Og(c)&&!Fte(c)){let f={v:c,i:u,n:this.norm.get(c)};s.push(f)}else I0(c)&&c.forEach((f,d)=>{l.push({nestedArrIndex:d,value:f})})}n.$[a]=s}else if(Og(o)&&!Fte(o)){let s={v:o,n:this.norm.get(o)};n.$[a]=s}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}};function pMe(e,t,{getFn:r=on.getFn,fieldNormWeight:n=on.fieldNormWeight}={}){let i=new Y3({getFn:r,fieldNormWeight:n});return i.setKeys(e.map(dMe)),i.setSources(t),i.create(),i}function gmt(e,{getFn:t=on.getFn,fieldNormWeight:r=on.fieldNormWeight}={}){let{keys:n,records:i}=e,a=new Y3({getFn:t,fieldNormWeight:r});return a.setKeys(n),a.setIndexRecords(i),a}function Gq(e,{errors:t=0,currentLocation:r=0,expectedLocation:n=0,distance:i=on.distance,ignoreLocation:a=on.ignoreLocation}={}){let o=t/e.length;if(a)return o;let s=Math.abs(n-r);return i?o+s/i:s?1:o}function Amt(e=[],t=on.minMatchCharLength){let r=[],n=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let s=e[a];s&&n===-1?n=a:!s&&n!==-1&&(i=a-1,i-n+1>=t&&r.push([n,i]),n=-1)}return e[a-1]&&a-n>=t&&r.push([n,a-1]),r}var uw=32;function vmt(e,t,r,{location:n=on.location,distance:i=on.distance,threshold:a=on.threshold,findAllMatches:o=on.findAllMatches,minMatchCharLength:s=on.minMatchCharLength,includeMatches:l=on.includeMatches,ignoreLocation:u=on.ignoreLocation}={}){if(t.length>uw)throw new Error(omt(uw));let c=t.length,f=e.length,d=Math.max(0,Math.min(n,f)),p=a,h=d,m=s>1||l,v=m?Array(f):[],A;for(;(A=e.indexOf(t,h))>-1;){let S=Gq(t,{currentLocation:A,expectedLocation:d,distance:i,ignoreLocation:u});if(p=Math.min(S,p),h=A+c,m){let T=0;for(;T<c;)v[A+T]=1,T+=1}}h=-1;let x=[],g=1,w=c+f,b=1<<c-1;for(let S=0;S<c;S+=1){let T=0,D=w;for(;T<D;)Gq(t,{errors:S,currentLocation:d+D,expectedLocation:d,distance:i,ignoreLocation:u})<=p?T=D:w=D,D=Math.floor((w-T)/2+T);w=D;let k=Math.max(1,d-D+1),M=o?f:Math.min(d+D,f)+c,E=Array(M+2);E[M+1]=(1<<S)-1;for(let P=M;P>=k;P-=1){let _=P-1,B=r[e.charAt(_)];if(m&&(v[_]=+!!B),E[P]=(E[P+1]<<1|1)&B,S&&(E[P]|=(x[P+1]|x[P])<<1|1|x[P+1]),E[P]&b&&(g=Gq(t,{errors:S,currentLocation:_,expectedLocation:d,distance:i,ignoreLocation:u}),g<=p)){if(p=g,h=_,h<=d)break;k=Math.max(1,2*d-h)}}if(Gq(t,{errors:S+1,currentLocation:d,expectedLocation:d,distance:i,ignoreLocation:u})>p)break;x=E}let y={isMatch:h>=0,score:Math.max(.001,g)};if(m){let S=Amt(v,s);S.length?l&&(y.indices=S):y.isMatch=!1}return y}function ymt(e){let t={};for(let r=0,n=e.length;r<n;r+=1){let i=e.charAt(r);t[i]=(t[i]||0)|1<<n-r-1}return t}var Wq=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e,Qq=class{constructor(t,{location:r=on.location,threshold:n=on.threshold,distance:i=on.distance,includeMatches:a=on.includeMatches,findAllMatches:o=on.findAllMatches,minMatchCharLength:s=on.minMatchCharLength,isCaseSensitive:l=on.isCaseSensitive,ignoreDiacritics:u=on.ignoreDiacritics,ignoreLocation:c=on.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:l,ignoreDiacritics:u,ignoreLocation:c},t=l?t:t.toLowerCase(),t=u?Wq(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;let f=(p,h)=>{this.chunks.push({pattern:p,alphabet:ymt(p),startIndex:h})},d=this.pattern.length;if(d>uw){let p=0,h=d%uw,m=d-h;for(;p<m;)f(this.pattern.substr(p,uw),p),p+=uw;if(h){let v=d-uw;f(this.pattern.substr(v),v)}}else f(this.pattern,0)}searchIn(t){let{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i}=this.options;if(t=r?t:t.toLowerCase(),t=n?Wq(t):t,this.pattern===t){let m={isMatch:!0,score:0};return i&&(m.indices=[[0,t.length-1]]),m}let{location:a,distance:o,threshold:s,findAllMatches:l,minMatchCharLength:u,ignoreLocation:c}=this.options,f=[],d=0,p=!1;this.chunks.forEach(({pattern:m,alphabet:v,startIndex:A})=>{let{isMatch:x,score:g,indices:w}=vmt(t,m,v,{location:a+A,distance:o,threshold:s,findAllMatches:l,minMatchCharLength:u,includeMatches:i,ignoreLocation:c});x&&(p=!0),d+=g,x&&w&&(f=[...f,...w])});let h={isMatch:p,score:p?d/this.chunks.length:1};return p&&i&&(h.indices=f),h}},Fg=class{constructor(t){this.pattern=t}static isMultiMatch(t){return oMe(t,this.multiRegex)}static isSingleMatch(t){return oMe(t,this.singleRegex)}search(){}};function oMe(e,t){let r=e.match(t);return r?r[1]:null}var _te=class extends Fg{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){let r=t===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}},Ite=class extends Fg{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){let n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}},Bte=class extends Fg{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){let r=t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}},Lte=class extends Fg{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){let r=!t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}},Rte=class extends Fg{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){let r=t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},qte=class extends Fg{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){let r=!t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}},Yq=class extends Fg{constructor(t,{location:r=on.location,threshold:n=on.threshold,distance:i=on.distance,includeMatches:a=on.includeMatches,findAllMatches:o=on.findAllMatches,minMatchCharLength:s=on.minMatchCharLength,isCaseSensitive:l=on.isCaseSensitive,ignoreDiacritics:u=on.ignoreDiacritics,ignoreLocation:c=on.ignoreLocation}={}){super(t),this._bitapSearch=new Qq(t,{location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:l,ignoreDiacritics:u,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}},Xq=class extends Fg{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let r=0,n,i=[],a=this.pattern.length;for(;(n=t.indexOf(this.pattern,r))>-1;)r=n+a,i.push([n,r-1]);let o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}},$te=[_te,Xq,Bte,Lte,qte,Rte,Ite,Yq],sMe=$te.length,bmt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,xmt="|";function wmt(e,t={}){return e.split(xmt).map(r=>{let n=r.trim().split(bmt).filter(a=>a&&!!a.trim()),i=[];for(let a=0,o=n.length;a<o;a+=1){let s=n[a],l=!1,u=-1;for(;!l&&++u<sMe;){let c=$te[u],f=c.isMultiMatch(s);f&&(i.push(new c(f,t)),l=!0)}if(!l)for(u=-1;++u<sMe;){let c=$te[u],f=c.isSingleMatch(s);if(f){i.push(new c(f,t));break}}}return i})}var Smt=new Set([Yq.type,Xq.type]),zte=class{constructor(t,{isCaseSensitive:r=on.isCaseSensitive,ignoreDiacritics:n=on.ignoreDiacritics,includeMatches:i=on.includeMatches,minMatchCharLength:a=on.minMatchCharLength,ignoreLocation:o=on.ignoreLocation,findAllMatches:s=on.findAllMatches,location:l=on.location,threshold:u=on.threshold,distance:c=on.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:a,findAllMatches:s,ignoreLocation:o,location:l,threshold:u,distance:c},t=r?t:t.toLowerCase(),t=n?Wq(t):t,this.pattern=t,this.query=wmt(this.pattern,this.options)}static condition(t,r){return r.useExtendedSearch}searchIn(t){let r=this.query;if(!r)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:a}=this.options;t=i?t:t.toLowerCase(),t=a?Wq(t):t;let o=0,s=[],l=0;for(let u=0,c=r.length;u<c;u+=1){let f=r[u];s.length=0,o=0;for(let d=0,p=f.length;d<p;d+=1){let h=f[d],{isMatch:m,indices:v,score:A}=h.search(t);if(m){if(o+=1,l+=A,n){let x=h.constructor.type;Smt.has(x)?s=[...s,...v]:s.push(v)}}else{l=0,o=0,s.length=0;break}}if(o){let d={isMatch:!0,score:l/o};return n&&(d.indices=s),d}}return{isMatch:!1,score:1}}},Ute=[];function Emt(...e){Ute.push(...e)}function Hte(e,t){for(let r=0,n=Ute.length;r<n;r+=1){let i=Ute[r];if(i.condition(e,t))return new i(e,t)}return new Qq(e,t)}var Kq={AND:"$and",OR:"$or"},Vte={PATH:"$path",PATTERN:"$val"},Gte=e=>!!(e[Kq.AND]||e[Kq.OR]),kmt=e=>!!e[Vte.PATH],Cmt=e=>!I0(e)&&cMe(e)&&!Gte(e),lMe=e=>({[Kq.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function mMe(e,t,{auto:r=!0}={}){let n=i=>{let a=Object.keys(i),o=kmt(i);if(!o&&a.length>1&&!Gte(i))return n(lMe(i));if(Cmt(i)){let l=o?i[Vte.PATH]:a[0],u=o?i[Vte.PATTERN]:i[l];if(!Og(u))throw new Error(amt(l));let c={keyId:Pte(l),pattern:u};return r&&(c.searcher=Hte(u,t)),c}let s={children:[],operator:a[0]};return a.forEach(l=>{let u=i[l];I0(u)&&u.forEach(c=>{s.children.push(n(c))})}),s};return Gte(e)||(e=lMe(e)),n(e)}function Dmt(e,{ignoreFieldNorm:t=on.ignoreFieldNorm}){e.forEach(r=>{let n=1;r.matches.forEach(({key:i,norm:a,score:o})=>{let s=i?i.weight:null;n*=Math.pow(o===0&&s?Number.EPSILON:o,(s||1)*(t?1:a))}),r.score=n})}function Tmt(e,t){let r=e.matches;t.matches=[],Wd(r)&&r.forEach(n=>{if(!Wd(n.indices)||!n.indices.length)return;let{indices:i,value:a}=n,o={indices:i,value:a};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),t.matches.push(o)})}function Nmt(e,t){t.score=e.score}function Mmt(e,t,{includeMatches:r=on.includeMatches,includeScore:n=on.includeScore}={}){let i=[];return r&&i.push(Tmt),n&&i.push(Nmt),e.map(a=>{let{idx:o}=a,s={item:t[o],refIndex:o};return i.length&&i.forEach(l=>{l(a,s)}),s})}var Qd=class{constructor(t,r={},n){this.options={...on,...r},this.options.useExtendedSearch,this._keyStore=new jte(this.options.keys),this.setCollection(t,n)}setCollection(t,r){if(this._docs=t,r&&!(r instanceof Y3))throw new Error(imt);this._myIndex=r||pMe(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){!Wd(t)||(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){let r=[];for(let n=0,i=this._docs.length;n<i;n+=1){let a=this._docs[n];t(a,n)&&(this.removeAt(n),n-=1,i-=1,r.push(a))}return r}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:r=-1}={}){let{includeMatches:n,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options,l=Og(t)?Og(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return Dmt(l,{ignoreFieldNorm:s}),a&&l.sort(o),uMe(r)&&r>-1&&(l=l.slice(0,r)),Mmt(l,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(t){let r=Hte(t,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:a,i:o,n:s})=>{if(!Wd(a))return;let{isMatch:l,score:u,indices:c}=r.searchIn(a);l&&i.push({item:a,idx:o,matches:[{score:u,value:a,norm:s,indices:c}]})}),i}_searchLogical(t){let r=mMe(t,this.options),n=(s,l,u)=>{if(!s.children){let{keyId:f,searcher:d}=s,p=this._findMatches({key:this._keyStore.get(f),value:this._myIndex.getValueForItemAtKeyId(l,f),searcher:d});return p&&p.length?[{idx:u,item:l,matches:p}]:[]}let c=[];for(let f=0,d=s.children.length;f<d;f+=1){let p=s.children[f],h=n(p,l,u);if(h.length)c.push(...h);else if(s.operator===Kq.AND)return[]}return c},i=this._myIndex.records,a={},o=[];return i.forEach(({$:s,i:l})=>{if(Wd(s)){let u=n(r,s,l);u.length&&(a[l]||(a[l]={idx:l,item:s,matches:[]},o.push(a[l])),u.forEach(({matches:c})=>{a[l].matches.push(...c)}))}}),o}_searchObjectList(t){let r=Hte(t,this.options),{keys:n,records:i}=this._myIndex,a=[];return i.forEach(({$:o,i:s})=>{if(!Wd(o))return;let l=[];n.forEach((u,c)=>{l.push(...this._findMatches({key:u,value:o[c],searcher:r}))}),l.length&&a.push({idx:s,item:o,matches:l})}),a}_findMatches({key:t,value:r,searcher:n}){if(!Wd(r))return[];let i=[];if(I0(r))r.forEach(({v:a,i:o,n:s})=>{if(!Wd(a))return;let{isMatch:l,score:u,indices:c}=n.searchIn(a);l&&i.push({score:u,key:t,value:a,idx:o,norm:s,indices:c})});else{let{v:a,n:o}=r,{isMatch:s,score:l,indices:u}=n.searchIn(a);s&&i.push({score:l,key:t,value:a,norm:o,indices:u})}return i}};Qd.version="7.1.0";Qd.createIndex=pMe;Qd.parseIndex=gmt;Qd.config=on;Qd.parseQuery=mMe;Emt(zte);var oa=ge(Me());var gu=ge(Me()),Omt={position:"absolute",width:0,height:0,visibility:"hidden",overflow:"scroll",whiteSpace:"pre"},Fmt=["fontSize","fontFamily","fontWeight","fontStyle","letterSpacing","textTransform"],hMe=(0,gu.forwardRef)((e,t)=>{let{classNames:r,inputAttributes:n,inputEventHandlers:i,index:a}=e,o=(0,gu.useRef)(null),[s,l]=(0,gu.useState)(null),[u,c]=(0,gu.useState)("");(0,gu.useEffect)(()=>{f(),d(),setTimeout(()=>{t.current?.focus()},50)},[]),(0,gu.useEffect)(()=>{u!==e.placeholderText&&(c(e.placeholderText),d())},[e.query,e.placeholderText]);let f=()=>{let p=window.getComputedStyle(t.current);Fmt.forEach(h=>{o.current.style[h]=p[h]})},d=()=>{let p=Math.ceil(o.current.scrollWidth)+2;p!==s&&l(p)};return gu.default.createElement("div",{className:r.search},gu.default.createElement("div",{className:r.searchWrapper},gu.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//search")}}),gu.default.createElement("input",{...n,...i,ref:t,value:e.query,placeholder:u,className:r.searchInput,role:"combobox",style:{width:"100%"},onClick:p=>p.stopPropagation()}),gu.default.createElement("div",{ref:o,style:Omt},e.query||u),gu.default.createElement("span",null)))}),gMe=hMe;hMe.displayName="SelectMenuSearch";var Wte=ge(Me()),jmt=e=>Wte.default.createElement("button",{type:"button",className:e.classNames.selectedTag,onClick:e.onDelete},Wte.default.createElement("span",{className:e.classNames.selectedTagName},e.tag.name)),AMe=jmt;var vMe=ge(Me()),yMe=e=>vMe.default.createElement("div",{className:"mk-sticker",dangerouslySetInnerHTML:{__html:e.ui.getSticker(e.sticker)}});var Ki=ge(Me());function bMe(e){return e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")}function uC(e){return new RegExp(bMe(e),"gi")}function xMe(e){return new RegExp(`^${bMe(e)}$`,"i")}function wMe(e,t){let r=uC(t);return e?.replace(r,"<mark>$&</mark>")}var Pmt=e=>{let t=(0,Ki.useRef)(null);return(0,Ki.useEffect)(()=>{e.active&&t?.current?.scrollIntoViewIfNeeded()},[e.active]),Ki.default.createElement(Ki.default.Fragment,null,e.item.icon&&Ki.default.createElement(yMe,{ui:e.ui,sticker:e.item.icon}),Ki.default.createElement("div",{ref:t,className:"mk-menu-options-inner"},e.item.onToggle&&Ki.default.createElement("div",null,N.menu.toggle),Ki.default.createElement("span",{style:e.item.color?.length>0?{background:e.item.color,padding:"2px 4px",borderRadius:"4px",color:e.item.color=="var(--mk-color-none)"?"inherit":"var(--mk-color-white)"}:{},dangerouslySetInnerHTML:{__html:e.query.length>0?wMe(e.item.name,e.query):e.item.name}}),e.item.description&&Ki.default.createElement("span",{"aria-label":e.item.description,className:"mk-menu-options-description",dangerouslySetInnerHTML:{__html:wMe(e.item.description,e.query)}})),e.item.type==1&&Ki.default.createElement("span",null,e.item.value),e.item.type==3&&e.item.value&&Ki.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//check")}}),e.item.onMoreOptions?Ki.default.createElement("div",{onClick:r=>{r.stopPropagation(),r.preventDefault(),e.item.onMoreOptions(r)},className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//options")}}):null,e.item.onRemove&&Ki.default.createElement("div",{onClick:r=>{r.stopPropagation(),r.preventDefault(),e.item.onRemove(),e.onDeleteOption?.(e.item.value)},className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//close")}}),e.item.type==6&&Ki.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//chevron-right")}}))},_mt=e=>{let[t,r]=(0,Ki.useState)(e.value);return Ki.default.createElement("input",{type:"text",value:t,onKeyDown:n=>{n.key=="Enter"&&e.setValue(t)},placeholder:e.placeholder,onMouseDown:n=>n.stopPropagation(),onClick:n=>n.stopPropagation(),onFocus:n=>{n.stopPropagation()},onChange:n=>r(n.target.value),onBlur:n=>e.setValue(t)})},Imt=e=>{let t=e.options.map((r,n)=>{let i=`${e.id}-${n}`,a=r.type==-1?"mk-menu-separator":r.type==2?"mk-menu-input":r.type==5?"mk-menu-custom":`mk-menu-option ${e.index===n&&e.classNames.suggestionActive} ${r.disabled&&e.classNames.suggestionDisabled}`;return Ki.default.createElement("div",{ref:o=>{e.refs?.current&&(e.refs.current[n]=o)},onMouseDown:o=>{e.isDisclosureMenu||o.stopPropagation(),o.preventDefault()},onClick:o=>{if(r.onSubmenu&&e.openSubmenu){let s=e.refs?.current[n].getBoundingClientRect();e.openSubmenu(r.onSubmenu(s,()=>{e.onHide&&e.onHide(),e.hide()}))}else r.onClick?(r.onClick(o),r.type!=6&&r.type!=1&&e.hide()):(r.type==null||r.type==0||r.type==1)&&(e.selectOption(r,{ctrlKey:o.ctrlKey,metaKey:o.metaKey,altKey:o.altKey,shiftKey:o.shiftKey,doubleClick:o.detail==2}),e.isDisclosureMenu||o.stopPropagation())},id:i,key:i,className:a},r.type==-1?Ki.default.createElement(Ki.default.Fragment,null):r.type==-2?Ki.default.createElement("div",{className:"mk-menu-options-section"},r.name):r.type==2?Ki.default.createElement(_mt,{value:r.value,setValue:r.onValueChange,placeholder:r.description}):r.type==5?Ki.default.createElement(r.fragment,{hide:e.hide,onSubmenu:o=>{if(e.openSubmenu){let s=e.refs?.current[n].getBoundingClientRect();e.openSubmenu(o(s,()=>{e.onHide&&e.onHide(),e.hide()}))}}}):Ki.default.createElement(Pmt,{ui:e.ui,item:r,query:e.query,active:n==e.index,onDeleteOption:e.deleteOption}))});return Ki.default.createElement("div",{className:"mk-menu-suggestions"},t,e.query&&e.allowNew&&Ki.default.createElement("div",{className:"mk-menu-option",onMouseDown:r=>r.preventDefault(),onClick:r=>e.selectOption({name:e.query,value:e.query},{ctrlKey:r.ctrlKey,metaKey:r.metaKey,altKey:r.altKey,shiftKey:r.shiftKey})},Ki.default.createElement("div",{className:"mk-sticker",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//plus")}}),Ki.default.createElement("div",{className:"mk-menu-options-inner"},e.addKeyword??"Add"," ",e.query)))},SMe=Imt;function EMe(e,t){let r=e.querySelectorAll("a,button,input"),n=Array.prototype.findIndex.call(r,a=>a===t),i=r[n-1]||r[n+1];i&&i.focus()}var cw={ENTER:"Enter",TAB:"Tab",BACKSPACE:"Backspace",UP_ARROW:"ArrowUp",UP_ARROW_COMPAT:N.menu.up,DOWN_ARROW:"ArrowDown",DOWN_ARROW_COMPAT:N.menu.down,LEFT_ARROW:"ArrowLeft",RIGHT_ARROW:"ArrowRight"},CMe={root:"mk-menu-container",rootFocused:"mk-focused",selected:"mk-menu-input-wrapper",selectedTagWrapper:"mk-menu-selected-tag-wrapper",selectedTag:"mk-menu-selected-tag",selectedTagName:"mk-menu-selected-tag-name",search:"mk-menu-search",searchWrapper:"mk-menu-search-container",searchInput:"mk-menu-search-input",suggestions:"mk-menu-suggestions",suggestionActive:"mk-active",suggestionDisabled:"mk-disabled"},Bmt={ui:null,id:N.menu.selectmenu,tags:[],hide:()=>null,onHide:()=>null,suggestionsOnly:!1,placeholderText:N.labels.optionItemSelectPlaceholder,noSuggestionsText:null,newTagText:null,suggestions:[],suggestionsFilter:Lmt,suggestionsTransform:null,classNames:CMe,delimiters:[cw.ENTER],minQueryLength:2,maxSuggestionsLength:8,inputAttributes:{}},DMe=(e,t)=>e.findIndex(r=>xMe(t).test(r.name)),kMe=(e,t,r,n,i,a)=>{if(t.length>=e.minQueryLength){let o=DMe(n,t),s=r===-1?o:r,l=s>-1?n[s]:null;i(l||{name:t,value:t},a)}};function Lmt(e,t){return uC(t).test(e.name)}function Rmt(e,t,r){let n,i=e.suggestions;r.length>0&&(i=e.suggestions.filter(s=>s.section==r));let a={threshold:0,ignoreLocation:!0,keys:["name","value"]},o=new Qd(i,a);return n=t.length==0?i:o.search(t).map(s=>s.item),n=n.slice(0,e.maxSuggestionsLength),e.newTagText&&DMe(n,t)===-1?n.push({id:0,name:t,value:t}):e.noSuggestionsText&&n.length===0&&n.push({id:0,name:e.noSuggestionsText,value:"",disabled:!0}),n}var TMe=oa.default.forwardRef((e,t)=>{let r={...Bmt,...e},[n,i]=(0,oa.useState)([]),a=(0,oa.useRef)([]),o=(0,oa.useMemo)(()=>r.showSections?[{name:N.labels.all,value:""},...r.sections??Mr(r.suggestions.map(Q=>Q.section)).filter(Q=>Q)]:[],[r.showSections,r.sections,r.suggestions]),s=(0,oa.useRef)(null),[l,u]=(0,oa.useState)(""),[c,f]=(0,oa.useState)(""),[d,p]=(0,oa.useState)(!1),[h,m]=(0,oa.useState)(0),v=(0,oa.useRef)(!1);(0,oa.useEffect)(()=>{t&&(t.current=()=>d?!0:(s?.current?.focus(),p(!0),!1))},[d]),(0,oa.useEffect)(()=>{if(c.length==0&&r.defaultSuggestions){i(r.defaultSuggestions);return}i(Rmt(r,c,l))},[c,r.defaultSuggestions,l,r.suggestions]);let A=(0,oa.useRef)(null),x=Q=>{if(Q.type==="compositionstart"){v.current=!0;return}if(Q.type==="compositionend"){v.current=!1;return}let q=Q.target.value;r.onInput&&r.onInput(q),q.length===c.length+1&&r.delimiters.indexOf(c.slice(-1))>-1?kMe(r,c,h,n,S,{}):q!==c&&f(q)},g=Q=>{v.current||(r.delimiters.indexOf(Q.key)>-1&&((c||h>-1)&&Q.preventDefault(),kMe(r,c,h,n,S,{ctrlKey:Q.ctrlKey,metaKey:Q.metaKey,altKey:Q.altKey,shiftKey:Q.shiftKey})),Q.key!="Escape"&&(Q.key===cw.TAB&&P(Q),Q.key===cw.BACKSPACE&&O(),(Q.key===cw.UP_ARROW||Q.key===cw.UP_ARROW_COMPAT)&&M(Q),(Q.key===cw.DOWN_ARROW||Q.key===cw.DOWN_ARROW_COMPAT)&&E(Q),Q.stopPropagation()))},w=()=>{p(!1),r.onBlur&&r.onBlur()},b=()=>{p(!0),r.onFocus&&r.onFocus()},y=(Q,q)=>{A.current&&EMe(A.current,q.currentTarget),T(Q)},S=(Q,q)=>{Q.disabled||r.onValidate&&!r.onValidate(Q)||(r.onAddition(Q,q),D())},T=Q=>{r.onDelete(Q)},D=()=>{f(""),m(-1)},k=()=>{m(-1)},M=Q=>{Q.preventDefault();let q=n.length-1,ie=h<=0?q:h-1;n[ie].disabled?m(ie<=0?q:ie-1):m(ie)},E=Q=>{Q.preventDefault();let q=n.length-1,ie=h>=q?0:h+1;n[ie].disabled?m(ie>=q?0:ie+1):m(ie)};function O(){c.length||T(r.tags.length-1)}function P(Q){r.showSections&&(Q.preventDefault(),Q.stopPropagation(),u(q=>{let ie=o.findIndex(Ae=>Ae.value==q);return Q.shiftKey?ie==0?q:(r.onSelectSection&&r.onSelectSection(o[ie-1].value),o[ie-1].value):ie==o.length-1?q:(r.onSelectSection&&r.onSelectSection(o[ie+1].value),o[ie+1].value)}))}let _=()=>{s.current.focus()},B={onChange:x,onCompositionEnd:x,onCompositionStart:x};(0,oa.useEffect)(()=>(r.ui.inputManager.on("keydown",g),()=>{r.ui.inputManager.off("keydown",g)}),[n,h]);let F=d&&c.length>=r.minQueryLength,L=Object.assign({},CMe,r.classNames);r.wrapperClass&&(L.root=`${L.root} ${r.wrapperClass}`);let I=[L.root];d&&I.push(L.rootFocused);let R=(0,oa.useRef)(null),J=Q=>{R.current&&R.current.hide(!0),R.current=Q};return oa.default.createElement("div",{ref:A,className:I.join(" "),style:r.suggestionsOnly?{}:{"--mk-menu-max-height":"200px"}},r.suggestionsOnly?null:oa.default.createElement("div",{className:L.selected,"aria-relevant":"additions removals","aria-live":"polite"},r.tags.length>0&&oa.default.createElement("div",{className:L.selectedTagWrapper},r.tags.map((Q,q)=>oa.default.createElement(AMe,{key:q,tag:Q,classNames:L,onDelete:ie=>y(q,ie)}))),oa.default.createElement(gMe,{ui:r.ui,ref:s,query:c,index:h,id:r.id,currentSection:o.find(Q=>Q.value==l),classNames:L,inputAttributes:r.inputAttributes,inputEventHandlers:B,expanded:F,placeholderText:r.placeholderText})),r.showSections?oa.default.createElement("div",{className:"mk-menu-sections"},o.map((Q,q)=>oa.default.createElement("div",{key:q,onClick:ie=>{ie.stopPropagation(),u(Q.value),r.onSelectSection&&r.onSelectSection(Q.value)},className:`${l==Q.value?"is-active":""} mk-menu-section`},Q.name==""?N.labels.all:Q.name))):oa.default.createElement(oa.default.Fragment,null),n.length||r.allowNew?oa.default.createElement(SMe,{ui:r.ui,hide:()=>{r.hide()},addKeyword:r.addKeyword,refs:a,options:n,query:c,setIndex:m,index:h,onHide:r.onHide,id:r.id,classNames:L,expanded:F,selectOption:S,allowNew:r.allowNew,moreOption:r.onMoreOption,deleteOption:r.onDeleteOption,isDisclosureMenu:r.isDisclosure,openSubmenu:J}):null,r.previewComponent)});TMe.displayName="SelectMenuComponent";var NMe=TMe;var MMe=Zc.default.forwardRef((e,t)=>{let[r,n]=(0,Zc.useState)(null),i=(0,Zc.useCallback)(h=>{n(h),e.onSelectSection&&e.onSelectSection(h)},[e]),a=e.options.map((h,m)=>({...h,id:m+1}));(0,Zc.useEffect)(()=>{s(e.options.map((h,m)=>({...h,id:m+1})))},[e.options]);let[o,s]=(0,Zc.useState)(a),[l,u]=(0,Zc.useState)(e.value.map(h=>a.find(m=>m.value==h)??{id:0,name:h,value:h})),c=(0,Zc.useCallback)(h=>{let m=l.filter((v,A)=>A!==h);u(m),e.saveOptions&&e.saveOptions(o.map(v=>v.value),m.map(v=>v.value),!1)},[o,l,e]),f=(0,Zc.useCallback)(h=>{let m=o.filter(A=>A.value!=h),v=l.filter(A=>A.value!=h);s(m),u(v),e.removeOption&&e.removeOption(h),e.hide()},[l,o,e]),d=(0,Zc.useCallback)((h,m)=>{let v=h,A=o,x=l;o.find(g=>g.value==h.value)||(v={id:o.length+1,name:h.name,value:h.value??h.name},A=[...o,v],s(A)),e.multi?l.find(g=>g.value==v.value)||(x=[...l,v],u(x)):(x=[v],u(x)),e.saveOptions&&e.saveOptions(A.map(g=>g.value),x.map(g=>g.value),!0,r),!e.multi&&h.type!=1&&e.hide()},[l,o,r]),p=(0,Zc.useCallback)(h=>!(!e.editable&&!o.find(m=>m.value==h.value)||h.name.length==0),[o]);return Zc.default.createElement(NMe,{tags:e.multi?l:[],suggestions:o,ui:e.ui,ref:t,addKeyword:e.addKeyword,hide:e.hide,onDelete:c,wrapperClass:e.wrapperClass,onDeleteOption:f,onAddition:d,onValidate:p,onSelectSection:i,defaultSuggestions:e.defaultOptions,placeholderText:e.placeholder??"",minQueryLength:0,onHover:e.onHover,showSections:e.showSections,sections:e.sections,maxSuggestionsLength:e.showAll?Math.min(50,e.options.length):25,suggestionsOnly:!e.searchable&&!e.editable,allowNew:e.editable,previewComponent:e.previewComponent,isDisclosure:e.isDisclosure})});MMe.displayName="SelectMenu";var Ote=MMe;var Rs=ge(Me());var Yg=ge(Me());function ry(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}var je=e=>e.defaultView||window;var ml=(e,t,r)=>({name:"",type:2,value:e,onValueChange:t,description:r});var tr={name:"",type:-1,disabled:!0},_t=(e,t)=>({ui:e,multi:!1,value:[],editable:!1,options:t,searchable:!1,showAll:!0});var ny=(e,t,r)=>{e.spaceManager.saveLabel(t,"cover",r)},iy=async(e,t,r)=>{e.spaceManager.saveLabel(t,e.settings.fmKeyColor,r)},X3=(e,t,r,n)=>{let i=Js([n,...Ks(r).filter(a=>a==n)]);return ma(e,t,{[e.settings.fmKeyAlias]:zi("option-multi",i,!0)})};var FMe=async(e,t,r,n,i,a,o,s)=>{if(t.length==1){qmt(e,t[0],r,n,i,a,o,s);return}if(i){let l=a.findIndex(({id:m})=>m===n),u=a[l],c=u.type=="file"?u.depth==0?null:a.find(m=>m.id==u.parentId)?.item:u.item,f=t.filter(m=>!vq(m,c.path)),d=i.insert?n:i.parentId,p=a.find(({id:m})=>m===d)?.item.path,h=d==u.id?-1:u.rank??-1;if(!p)return;cC(e,f,p,i.sortable&&h,s)}},qmt=async(e,t,r,n,i,a,o,s)=>{if(i){let l=a,u=l.findIndex(({id:A})=>A===n),c=l[u],f=i.insert?n:i.parentId,d=i.depth==0&&!i.insert?null:l.find(({id:A})=>A===f)?.item.path,p=f==null?o.findIndex(A=>A?.path==c.id):f==c.id?-1:c.rank??-1;if(!r){OMe(e,t,null,d,i.sortable&&p,s);return}let h=l.findIndex(({id:A})=>A===r),m=l[h],v=m.parentId==null?null:l.find(({id:A})=>A===m.parentId)?.item.path;OMe(e,m.item.path,v,d,i.sortable&&p,s)}},$mt=(e,t,r)=>{let n=e.focuses[e.settings.currentWaypoint]??{sticker:"",name:N.labels.waypoint,paths:[]},a=n.paths.findIndex(s=>s==t)>r?Math.max(0,r-1):r;n.paths=js(n.paths,n.paths.findIndex(s=>s==t),a),e.settings.currentWaypoint>e.focuses.length&&e.spaceManager.saveFocuses([...e.focuses,n]);let o=e.focuses.map((s,l)=>l==e.settings.currentWaypoint?n:s);e.spaceManager.saveFocuses(o)},OMe=async(e,t,r,n,i,a)=>{if(!e.pathsIndex.get(t))return!1;if(!n){$mt(e,t,i);return}let s=e.spacesIndex.get(n);if(r==n){eC(e,t,i,n);return}(s.type=="folder"||s.type=="vault")&&(a=="link"||vq(t,s.path)?Ng(e,s,t,i):zee(e,e.pathsIndex.get(t),s.path,i,a=="copy")),s.type=="tag"&&Tg(e,t,s.name),r&&r!=n&&K1(e,r,[t])},cC=async(e,t,r,n,i)=>{let a=e.spacesIndex.get(r);!a||((a.type=="folder"||a.type=="vault")&&t.forEach(o=>{i=="link"||vq(o,a.path)?Ng(e,a,o,n):zee(e,e.pathsIndex.get(o),a.path,n,i=="copy")}),a.type=="tag"&&t.forEach(o=>Tg(e,o,a.name)))};var ch=async(e,t,r)=>{e.spaceManager.saveLabel(t,e.settings.fmKeySticker,r)},Jq=(e,t)=>{t.forEach(r=>{ch(e,r,"")})};var jMe=(e,t,r)=>{t.forEach(n=>{ch(e,n,r)})},PMe=(e,t,r)=>{t.forEach(n=>{iy(e,n,r)})},fw=(e,t,r)=>{ch(e,t,r)},fC=(e,t)=>{ch(e,t,"")};var tM=ge(Me());var Pi=ge(Me());var dw=e=>{let t;try{t=zmt(e)}catch{t=e}return t};function fh(e){if(!e)return["",""];let t=e.match(/^(.*?)\s*\/\/\s*(.*)$/);return t?[t[1],t[2]]:["",e]}var zmt=e=>{let r=e.split("-").map(n=>`0x${n}`);return String.fromCodePoint(...r)};var Umt=e=>{let[t,r]=(0,Pi.useState)(""),[n,i]=(0,Pi.useState)([]),[a,o]=(0,Pi.useState)([]),[s,l]=(0,Pi.useState)(null),u=w=>w.type=="emoji"?dw(w.html):w.html;(0,Pi.useEffect)(()=>{let w=[];w.push(...e.ui.allStickers()),i(w)},[]);let c=(0,Pi.useMemo)(()=>new Set(n.map(w=>w.type)),[n]),[f,d]=(0,Pi.useState)(1),p=(0,Pi.useCallback)(()=>{d(w=>w+1)},[f]),h=(0,Pi.useRef)(null);(0,Pi.useEffect)(()=>{let w=new IntersectionObserver(b=>{b[0].isIntersecting&&p()});return h.current&&w.observe(h.current),()=>{h.current&&w.unobserve(h.current)}},[p]);let[m,v]=(0,Pi.useState)(null);(0,Pi.useEffect)(()=>{o(n.filter(w=>w.name.includes(t.toLowerCase())&&(m==null||w.type==m)).slice(0,f*250))},[t,n,f,m]);let A=w=>{r(w.target.value)},x=w=>{let b=s;w.key==="ArrowUp"&&b>0?l(b-1):w.key==="ArrowDown"&&b<a.length-1?l(b+1):w.key==="Enter"&&(e.selectedSticker(a[s].type+"//"+a[s].value),e.hide())},g=(0,Pi.useRef)(null);return(0,Pi.useEffect)(()=>{g.current&&g.current.focus()},[g.current]),Pi.default.createElement(Pi.default.Fragment,null,Pi.default.createElement("div",{className:"mk-palette-search"},Pi.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//search")}}),Pi.default.createElement("input",{value:t,onChange:A,onKeyDown:x,placeholder:N.labels.findStickers,ref:g}),Pi.default.createElement("button",{className:"mk-toolbar-button"})),Pi.default.createElement("div",{className:"mk-menu-sections"},Pi.default.createElement("div",{onClick:()=>v(null),className:`${m==null?"is-active":""} mk-menu-section`},N.labels.all),[...c].map(w=>Pi.default.createElement("div",{key:w,onClick:()=>v(w),className:`${m==w?"is-active":""} mk-menu-section`},w))),Pi.default.createElement("div",{className:"mk-layout-row mk-layout-wrap mk-gap-4 mk-padding-12 mk-layout-scroll"},a.map((w,b)=>Pi.default.createElement("div",{key:b,onClick:()=>{e.selectedSticker(a[b].type+"//"+a[b].value),e.hide()},className:s===b?"selected mk-padding-4 mk-border-radius-4 mk-hover":"mk-padding-4 mk-border-radius-4 mk-hover"},Pi.default.createElement("div",{dangerouslySetInnerHTML:{__html:u(w)},className:"mk-sticker"}))),Pi.default.createElement("div",{ref:h})))},Ea=Umt;var ay=ge(Me());var B0=e=>{let{hide:t,confirmAction:r,message:n,confirmLabel:i}=e,a=()=>{r(),t()};return(0,ay.useEffect)(()=>{let o=s=>{s.key==="Enter"&&(s.preventDefault(),s.stopPropagation(),s.stopImmediatePropagation(),a())};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}},[]),ay.default.createElement("div",{className:"mk-modal-contents"},ay.default.createElement("div",{className:"mk-modal-message"},n),ay.default.createElement("div",{className:"mk-button-group"},ay.default.createElement("button",{onClick:()=>a(),tabIndex:0,className:"mod-warning"},i),ay.default.createElement("button",{onClick:()=>t&&t(),tabIndex:0},N.buttons.cancel)))};var Zq=e=>{let t=e.values;t.sort((o,s)=>o.position-s.position),t=t.length==1?[t[0],t[0]]:t;let r=t.map(o=>`${o.color} ${o.position}%`).join(", "),n=e.type,i=["top","left","bottom","right","center"],a=e.direction;return["linear","repeating-linear"].indexOf(n)>=0&&i.indexOf(a)>=0&&(a=a==="center"?"to right":`to ${a}`),["radial","repeating-radial"].indexOf(n)>=0&&i.indexOf(a)>=0&&(a=`circle at ${a}`),r?`${n}-gradient(${a}, ${r})`:""},_Me=e=>{if(!e||typeof e!="string")return null;let t=null,r="90deg",n=["repeating-linear","repeating-radial","linear","radial","conic"];for(let h of n)if(e.includes(`${h}-gradient(`)){t=h;break}if(!t)return null;let i=e.indexOf("(")+1,a=e.lastIndexOf(")");if(i===0||a===-1||i>=a)return null;let o=e.substring(i,a).trim();if(!o)return null;let s=[],l="",u=0;for(let h=0;h<o.length;h++){let m=o[h];m==="("&&u++,m===")"&&u--,m===","&&u===0?(s.push(l.trim()),l=""):l+=m}l.trim()&&s.push(l.trim());let c=s[0],f=h=>h.includes("deg")||h.includes("to ")||h.includes("at ")||/^-?\d+deg$/.test(h.trim())||["to top","to right","to bottom","to left","to top right","to top left","to bottom right","to bottom left"].includes(h.trim()),d=s;c&&f(c)&&(r=c,d=s.slice(1));let p=[];for(let h of d){let m=h.trim();if(!m)continue;let v=m.match(/^(.+?)\s+(\d+(?:\.\d+)?)%\s*$/);if(v){let[,A,x]=v,g=parseFloat(x);isNaN(g)||p.push({color:A.trim(),position:g})}else{let A=m,x=p.length===0?0:100;p.push({color:A,position:x})}}return p.length>1&&p.every(h=>h.position===0||h.position===100)&&p.forEach((h,m)=>{h.position=m/(p.length-1)*100}),p.length<2&&(p.length===1?p.push({color:"#ffffff",position:100}):p.push({color:"#000000",position:0},{color:"#ffffff",position:100})),{type:t,direction:r,values:p.sort((h,m)=>h.position-m.position)}};var R0=ge(On());var Ft=ge(Me());var jg=e=>{let t=e.assetManager||e.assets;return t?t.getColorPalettes()||[]:(console.warn("[ColorPalette] AssetManager not available in superstate"),[])},L0=(e,t)=>jg(e).find(n=>n.id===t),Hmt=e=>L0(e,"default-palette");var K3=e=>Hmt(e)?.colors||[];var J3=e=>K3(e).map(t=>[t.name,t.value]);var e$=28,Qte=(e,t,r)=>{let n,i,a;if(t===0)n=i=a=r;else{let o=(u,c,f)=>(f<0&&(f+=1),f>1&&(f-=1),f<.16666666666666666?u+(c-u)*6*f:f<.5?c:f<.6666666666666666?u+(c-u)*(.6666666666666666-f)*6:u),s=r<.5?r*(1+t):r+t-r*t,l=2*r-s;n=o(l,s,e+1/3),i=o(l,s,e),a=o(l,s,e-1/3)}return[Math.round(n*255),Math.round(i*255),Math.round(a*255)]},IMe=(e,t,r)=>{e/=255,t/=255,r/=255;let n=Math.max(e,t,r),i=Math.min(e,t,r),a=0,o=0,s=(n+i)/2;if(n!==i){let l=n-i;switch(o=s>.5?l/(2-n-i):l/(n+i),n){case e:a=((t-r)/l+(t<r?6:0))/6;break;case t:a=((r-e)/l+2)/6;break;case r:a=((e-t)/l+4)/6;break}}return[a*360,o*100,s*100]},BMe=e=>{let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:null},Vmt=({stop:e,isSelected:t,onSelect:r,onMove:n})=>{let[i,a]=(0,Ft.useState)(!1),o=(0,Ft.useRef)({startX:0,startPosition:0,container:null}),s=l=>{l.stopPropagation(),l.preventDefault(),r(),a(!0);let u=l.target.closest(".mk-gradient-preview");o.current={startX:l.clientX,startPosition:e.position,container:u},document.body.style.cursor="grabbing",document.body.style.userSelect="none"};return(0,Ft.useEffect)(()=>{if(!i)return;let l=c=>{c.preventDefault();let{startX:f,startPosition:d,container:p}=o.current;if(!p)return;let h=p.getBoundingClientRect(),v=(c.clientX-f)/h.width*100,A=Math.max(0,Math.min(100,d+v));n(A)},u=()=>{a(!1),document.body.style.cursor="",document.body.style.userSelect=""};return document.addEventListener("mousemove",l),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u)}},[i,n]),Ft.default.createElement("div",{className:"mk-gradient-stop",style:{position:"absolute",left:`${e.position}%`,top:"-10px",transform:"translateX(-50%)",width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",cursor:i?"grabbing":"grab",zIndex:t?10:5,touchAction:"none"},onMouseDown:s},Ft.default.createElement("div",{style:{width:"12px",height:"12px",backgroundColor:e.color,border:t?"2px solid #007acc":"none",borderRadius:"50%",pointerEvents:"none"}}))},LMe=({color:e,name:t,size:r="medium",onClick:n,className:i="",isGradient:a=!1})=>{let o={small:"mk-color-swatch-small",medium:"mk-color-swatch-medium",large:"mk-color-swatch-large"},s=a?{backgroundImage:e}:{backgroundColor:e};return Ft.default.createElement("div",{className:`mk-color-swatch ${o[r]} ${i} ${a?"mk-gradient-swatch":""}`},Ft.default.createElement("div",{className:"mk-color-swatch-inner",style:s,onClick:n,title:t?`${t}: ${e}`:e}))},Gmt=({angle:e,onChange:t,size:r=40})=>{let n=(0,Ft.useRef)(null),[i,a]=(0,Ft.useState)(!1),o=(d,p)=>{if(n.current){let h=n.current.getBoundingClientRect(),m=h.left+h.width/2,v=h.top+h.height/2,A=d-m,x=p-v,g=(Math.atan2(x,A)*180/Math.PI+90+360)%360;t(Math.round(g))}},s=d=>{a(!0),o(d.clientX,d.clientY)};(0,Ft.useEffect)(()=>{if(!i)return;let d=h=>{o(h.clientX,h.clientY)},p=()=>{a(!1)};return document.addEventListener("mousemove",d),document.addEventListener("mouseup",p),()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",p)}},[i]);let l=e-90,u=r/2-4,c=Math.cos(l*Math.PI/180)*u,f=Math.sin(l*Math.PI/180)*u;return Ft.default.createElement("div",{style:{position:"relative",width:`${r}px`,height:`${r}px`}},Ft.default.createElement("div",{ref:n,style:{width:"100%",height:"100%",borderRadius:"50%",border:"1px solid var(--mk-ui-border)",backgroundColor:"white",cursor:"grab",position:"relative"},onMouseDown:s},Ft.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"4px",height:"4px",borderRadius:"50%",backgroundColor:"var(--mk-ui-text-primary)",pointerEvents:"none"}}),Ft.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:`translate(-50%, -50%) translate(${c}px, ${f}px)`,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"white",border:"2px solid #333",boxShadow:"0 2px 4px rgba(0,0,0,0.3)",pointerEvents:"none",zIndex:2}})))},Wmt=({hue:e,onChange:t,width:r=200,height:n=20})=>{let i=(0,Ft.useRef)(null),[a,o]=(0,Ft.useState)(!1),s=u=>{if(i.current){let c=i.current.getBoundingClientRect(),d=(u-c.left)/c.width*360;t(Math.max(0,Math.min(360,d)))}},l=u=>{o(!0),s(u.clientX)};return(0,Ft.useEffect)(()=>{if(!a)return;let u=f=>{s(f.clientX)},c=()=>{o(!1)};return document.addEventListener("mousemove",u),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",c)}},[a]),Ft.default.createElement("div",{style:{position:"relative",width:`${r}px`,height:`${n}px`}},Ft.default.createElement("div",{ref:i,style:{width:"100%",height:"100%",background:"linear-gradient(to right, #ff0000 0%, #ffff00 16.66%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.66%, #ff00ff 83.33%, #ff0000 100%)",borderRadius:"4px",cursor:"crosshair"},onMouseDown:l}),Ft.default.createElement("div",{style:{position:"absolute",top:0,left:`${e/360*100}%`,transform:"translateX(-50%)",width:"4px",height:"100%",backgroundColor:"white",border:"1px solid #666666",borderRadius:"2px",pointerEvents:"none"}}))},Qmt=({hue:e,saturation:t,lightness:r,onChange:n,size:i=200})=>{let a=(0,Ft.useRef)(null),o=u=>{if(a.current){let c=a.current.getBoundingClientRect(),f=u.clientX-c.left,d=u.clientY-c.top,p=f/c.width*100,h=100-p/100*50,m=h-d/c.height*h;n(Math.max(0,Math.min(100,p)),Math.max(0,Math.min(100,m)))}},s=Qte(e/360,1,.5),l=`rgb(${s[0]}, ${s[1]}, ${s[2]})`;return Ft.default.createElement("div",{style:{position:"relative"}},Ft.default.createElement("div",{ref:a,style:{position:"relative",width:`${i}px`,height:`${i}px`,backgroundColor:l,borderRadius:"4px",cursor:"crosshair"},onClick:o},Ft.default.createElement("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"linear-gradient(to right, #ffffff, transparent)",borderRadius:"4px"}}),Ft.default.createElement("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"linear-gradient(to bottom, transparent, #000000)",borderRadius:"4px"}}),Ft.default.createElement("div",{style:{position:"absolute",width:"12px",height:"12px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 2px 4px rgba(0,0,0,0.3)",pointerEvents:"none",left:`${t}%`,top:`${(()=>{let u=100-t/100*50;return(u-r)/u*100})()}%`,transform:"translate(-50%, -50%)",backgroundColor:`hsl(${e}, ${t}%, ${r}%)`}})))},Ymt=({superstate:e,onColorSelect:t})=>{let[r,n]=(0,Ft.useState)([]);(0,Ft.useEffect)(()=>{let a=jg(e);n(a)},[e]);let i=r;return Ft.default.createElement("div",{className:"mk-color-palette-selector"},i.length>0?i.map(a=>Ft.default.createElement("div",{key:a.id,className:"mk-palette-section"},Ft.default.createElement("div",{className:"mk-palette-name"},a.name),Ft.default.createElement("div",{className:"mk-palette-colors"},a.colors.map((o,s)=>{let l=o.value&&(o.value.includes("linear-gradient")||o.value.includes("radial-gradient")||o.value.includes("conic-gradient"));return Ft.default.createElement(LMe,{key:`${a.id}-${s}`,color:o.value,name:o.name,size:"medium",isGradient:l,onClick:()=>t(o.value)})})))):Ft.default.createElement("div",{className:"mk-palette-empty"},N.menu.noColorPalettesAvailable))},Xmt=e=>{let[t,r]=(0,Ft.useState)(null),[n,i]=(0,Ft.useState)(null),[a,o]=(0,Ft.useState)(e.color??"#eb3b5a"),[s,l]=(0,Ft.useState)(a),[u,c]=(0,Ft.useState)(e.hidePaletteSelector?"solid":"palettes"),[f,d]=(0,Ft.useState)(0),[p,h]=(0,Ft.useState)(50),[m,v]=(0,Ft.useState)(50),A=(0,Ft.useCallback)((0,R0.debounce)(b=>{e.saveValue(b)},150),[e.saveValue]),x=b=>{if(l(b),t&&n){let y={...t},S=y.values.find(D=>D.id==n);S&&(S.color=b),r(y);let T=Zq(y);o(T),A(T);return}o(b),A(b)},g=b=>{let y=Zq(b);o(y),A(y)},w=b=>{b&&(o(b),l(b));let y;if(b&&(b.includes("linear-gradient(")||b.includes("radial-gradient(")||b.includes("conic-gradient(")||b.includes("repeating-linear-gradient(")||b.includes("repeating-radial-gradient(")))try{if(y=_Me(b),y){let T=y.values.map(D=>{let k=t?.values.find(M=>M.position==D.position&&M.color==D.color);return k?{...D,id:k.id??(0,R0.uniqueId)()}:{...D,id:(0,R0.uniqueId)()}});y.values=T}}catch{y=null}y?(r(y),l(y.values[0].color),i(y.values[0].id||null),c("gradient")):(r(null),l(b||"#000000"),c(b===""||b==="transparent"?"none":e.hidePaletteSelector?"solid":"palettes"))};return(0,Ft.useEffect)(()=>{w(e.color)},[e.color]),(0,Ft.useEffect)(()=>{if(u==="solid"||u==="gradient"&&n){let b=BMe(s);if(b){let[y,S,T]=IMe(b[0],b[1],b[2]);d(y),h(S),v(T)}}},[s,u,n]),(0,Ft.useEffect)(()=>{let b=t?.values.find(y=>y.id==n)?.color;if(b&&b!==s){l(b);let y=BMe(b);if(y){let[S,T,D]=IMe(y[0],y[1],y[2]);d(S),h(T),v(D)}}},[n,t]),Ft.default.createElement("div",{className:"mk-ui-color-picker-enhanced",style:{width:"200px"}},Ft.default.createElement("div",{className:"mk-color-mode-selector"},[...e.hidePaletteSelector?[]:["none"],...e.hidePaletteSelector?[]:["palettes"],"solid",...e.allowGradient!==!1?["gradient"]:[]].map(b=>{let y=u===b,S={};switch(b){case"palettes":S={background:`
178 linear-gradient(to right, #3b82f6 0% 50%, #ef4444 50% 100%),
179 linear-gradient(to right, #10b981 0% 50%, #f59e0b 50% 100%)
180 `,backgroundSize:"100% 50%, 100% 50%",backgroundPosition:"0 0, 0 100%",backgroundRepeat:"no-repeat"};break;case"solid":S={backgroundColor:s||"#3b82f6"};break;case"gradient":t&&a?S={backgroundImage:a}:S={backgroundImage:"linear-gradient(135deg, rgba(255, 255, 196, 1.000) 0.000%, rgba(255, 97, 100, 1.000) 50.000%, rgba(176, 0, 18, 1.000) 100.000%)"};break;case"none":S={};break}return Ft.default.createElement("button",{key:b,onClick:()=>{if(c(b),b==="none")A("");else if(b==="solid"&&t)r(null),A(s);else if(b==="gradient"&&!t){let T={type:"linear",direction:"90deg",values:[{id:(0,R0.uniqueId)(),color:s||"#000000",position:0},{id:(0,R0.uniqueId)(),color:"#ffffff",position:100}]};r(T),i(T.values[0].id||null);let D=Zq(T);o(D),A(D)}},className:`mk-color-mode-button ${y?"active":""}`,style:S},b==="none"&&Ft.default.createElement("div",{className:"mk-color-none-icon"},Ft.default.createElement("svg",{width:"100%",height:"100%",viewBox:"0 0 20 20"},Ft.default.createElement("line",{x1:"2",y1:"2",x2:"18",y2:"18",stroke:"#ef4444",strokeWidth:"2"}))))})),u==="gradient"&&t&&Ft.default.createElement("div",{className:"mk-gradient-editor"},Ft.default.createElement("div",{className:"mk-gradient-controls-row",style:{marginBottom:"12px",display:"flex",alignItems:"center",gap:"12px"}},Ft.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},Ft.default.createElement(Gmt,{angle:parseInt(t.direction?.replace("deg","")||"90"),onChange:b=>{let y={...t};y.direction=`${b}deg`,r(y),g(y)},size:40})),Ft.default.createElement("div",{style:{display:"flex",gap:"4px",marginLeft:"auto"}},Ft.default.createElement("button",{onClick:()=>{let b={...t};b.values.push({id:(0,R0.uniqueId)(),color:s||"#ffffff",position:50}),b.values.sort((y,S)=>y.position-S.position),r(b),g(b)},style:{width:`${e$}px`,height:`${e$}px`,padding:"0",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--mk-ui-background)",border:"1px solid var(--mk-ui-border)",borderRadius:"4px",cursor:"pointer",color:"var(--mk-ui-text-primary)"},title:"Add gradient stop"},Ft.default.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},Ft.default.createElement("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),Ft.default.createElement("line",{x1:"5",y1:"12",x2:"19",y2:"12"}))))),Ft.default.createElement("div",{className:"mk-gradient-preview",style:{background:`linear-gradient(to right, ${t.values.sort((b,y)=>b.position-y.position).map(b=>`${b.color} ${b.position}%`).join(", ")})`,position:"relative",height:"40px",borderRadius:"4px",margin:"8px 0",cursor:"pointer"},onClick:b=>{let y=b.currentTarget.getBoundingClientRect(),T=(b.clientX-y.left)/y.width*100,D=b.target.classList.contains("mk-gradient-stop"),k=10,M=t.values.some(E=>Math.abs(E.position-T)<=k);if(!D&&!M){let E={...t};E.values.push({id:(0,R0.uniqueId)(),color:"#ffffff",position:Math.max(0,Math.min(100,T))}),E.values.sort((O,P)=>O.position-P.position),r(E),g(E)}}},t.values.map((b,y)=>Ft.default.createElement("div",{key:`line-${b.id||y}`,style:{position:"absolute",left:`${b.position}%`,top:"0",bottom:"0",width:"1px",backgroundColor:"rgba(255, 255, 255, 0.5)",pointerEvents:"none",zIndex:1}})),t.values.map((b,y)=>Ft.default.createElement(Vmt,{key:b.id||y,stop:b,isSelected:n===b.id,onSelect:()=>b.id&&i(b.id),onMove:S=>{let T={...t},D=T.values.findIndex(k=>k.id===b.id);D>=0&&(T.values[D].position=S),r(T),g(T)}})))),(u==="solid"||u==="gradient")&&Ft.default.createElement("div",{className:"mk-color-canvas-section"},Ft.default.createElement("div",{className:"mk-color-canvas-wrapper"},Ft.default.createElement(Qmt,{hue:f,saturation:p,lightness:m,onChange:(b,y)=>{h(b),v(y);let T=`#${Qte(f/360,b/100,y/100).map(D=>Math.round(D).toString(16).padStart(2,"0")).join("")}`;x(T)},size:200})),Ft.default.createElement("div",{style:{display:"flex",justifyContent:"center",width:"100%"}},Ft.default.createElement(Wmt,{hue:f,onChange:b=>{d(b);let S=`#${Qte(b/360,p/100,m/100).map(T=>Math.round(T).toString(16).padStart(2,"0")).join("")}`;x(S)},width:200,height:20})),Ft.default.createElement("div",{className:"mk-color-current",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%"}},Ft.default.createElement(LMe,{color:s,size:"large",onClick:()=>{}}),Ft.default.createElement("input",{type:"text",value:s,onChange:b=>{/^#[0-9A-F]{6}$/i.test(b.target.value)&&x(b.target.value)},className:"mk-color-hex-input",placeholder:"#000000",style:{flex:1,minWidth:0}})),u==="gradient"&&t&&n&&Ft.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",marginTop:"8px"}},Ft.default.createElement("input",{type:"number",value:t.values.find(b=>b.id===n)?.position||0,onChange:b=>{let y=parseFloat(b.target.value);if(!isNaN(y)&&y>=0&&y<=100){let S={...t},T=S.values.findIndex(D=>D.id===n);T>=0&&(S.values[T].position=y,S.values.sort((D,k)=>D.position-k.position),r(S),g(S))}},min:"0",max:"100",step:"1",style:{flex:1,padding:"4px 8px",border:"1px solid var(--background-modifier-border)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",minWidth:0},placeholder:"0",title:N.menu.stopPosition}),Ft.default.createElement("span",{style:{fontSize:"12px",color:"var(--text-muted)"}},"%"),Ft.default.createElement("button",{onClick:()=>{let b={...t};b.values=b.values.filter(y=>y.id!==n),b.values.length>0&&i(b.values[0].id),r(b),g(b)},disabled:t.values.length<=2,style:{width:`${e$}px`,height:`${e$}px`,padding:"0",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--mk-ui-background)",border:"1px solid var(--mk-ui-border)",borderRadius:"4px",cursor:t.values.length<=2?"not-allowed":"pointer",color:t.values.length<=2?"var(--mk-ui-text-tertiary)":"var(--mk-ui-text-primary)",opacity:t.values.length<=2?.5:1},title:N.menu.removeSelectedGradientStop},Ft.default.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},Ft.default.createElement("line",{x1:"5",y1:"12",x2:"19",y2:"12"}))))),!e.hidePaletteSelector&&(u==="palettes"||u==="none")&&Ft.default.createElement(Ymt,{superstate:e.superstate,onColorSelect:b=>{b.startsWith("linear-gradient")||b.startsWith("radial-gradient")||b.startsWith("conic-gradient")?(o(b),A(b)):x(b)}}),!e.hidePaletteSelector&&u==="none"&&Ft.default.createElement("div",{className:"mk-color-none-display"},Ft.default.createElement("div",{className:"mk-color-none-text"},N.menu.noColor),Ft.default.createElement("div",{className:"mk-color-none-desc"},N.menu.thisElementWillHaveNoColorApplied)))},yo=(e,t,r,n,i,a,o,s)=>e.ui.openCustomMenu(t,Ft.default.createElement(Xmt,{superstate:e,color:n,saveValue:i,stayOpen:a,hidePaletteSelector:s}),{},r,"bottom");var Aa=(e,t,r,n,i,a,o,s)=>{let l=[...r.allSpaces(!0,s)].filter(u=>(i||u.type!="default")&&(!o||u.type=="tag")).map(u=>({name:u.name,value:u.path,icon:r.pathsIndex.get(u.path)?.label?.sticker,section:u.type=="tag"?"tag":u.type=="folder"?"folder":"",description:u.type=="tag"?u.name:(u.type=="folder",u.path)}));return r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:a,addKeyword:"Create",value:[],options:l,sections:o?[]:[{name:N.buttons.tag,value:"tag"},{name:N.menu.folder,value:"folder"}],saveOptions:(u,c,f,d)=>{n(c[0],f,d)},placeholder:N.labels.spaceSelectPlaceholder,detail:!0,searchable:!0,showSections:!o,showAll:!0},t,"bottom")};var n$=ge(Me());var RMe=ge(Me());var qMe=(e,t,r)=>{let n=e.spacesIndex.get(t);hu(e,n.space,{...n.metadata,contexts:r})},Kmt=(e,t,r,n,i)=>{let a=t.spacesIndex.get(r),o=t.spaceManager.readTags(),s=async l=>{let u=Rm(l);qMe(t,a.path,[...a.metadata.contexts.filter(c=>c!=u),u])};return t.ui.openMenu(e,{ui:t.ui,multi:!1,editable:!0,value:[],options:o.map(l=>({name:l,value:l})),saveOptions:(l,u)=>s(u[0]),placeholder:N.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0},n,null,i)},Jmt=(e,t,r,n,i)=>{let a=[];a.push({name:N.buttons.addContext,icon:"ui//plus",type:6,onSubmenu:(s,l)=>Kmt(s,r,t,n,l)}),a.push(tr);let o=r.spacesIndex.get(t);return o.contexts.forEach(s=>{a.push({name:s,icon:"ui//tags",onClick:l=>{r.ui.openPath(ii(s))},onMoreOptions:l=>{let u=l.target.getBoundingClientRect(),c=[];return c.push({name:N.menu.deleteContext,icon:"ui//trash",onClick:f=>{qMe(r,o.path,o.contexts.filter(d=>d!=s))}}),r.ui.openMenu(u,{ui:r.ui,multi:!1,editable:!1,value:[],options:c,placeholder:N.labels.contextItemSelectPlaceholder,searchable:!1,showAll:!0},n)}})}),r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:!1,value:[],options:a,placeholder:N.labels.contextItemSelectPlaceholder,searchable:!1,showAll:!0},n,null,i)},t$=(e,t,r,n)=>{let i=[{name:"Apply Tags",icon:"ui//tags",value:"apply-tags",onSubmenu:(a,o)=>Jmt(a,r.path,t,n,o)},{name:N.menu.setDefaultSticker,icon:"ui//sticker",value:"apply-all-sticker",onClick:()=>{t.ui.openPalette(RMe.default.createElement(Ea,{ui:t.ui,selectedSticker:a=>hu(t,r.space,{...r.metadata,defaultSticker:a})}),n)}}];return t.ui.openMenu(e,_t(t.ui,i),n)};var $Me=ge(On()),Z3=ge(Me());var Au=(e,t,r,n,i)=>{let a=[...r.pathsIndex.values()].filter(s=>!s.hidden).map(s=>({name:s.label.name,value:s.path,description:s.path,icon:s.label?.sticker,section:s.type})),o=Array.from(new Set(a.map(s=>s.section))).map(s=>({name:s,value:s}));return r.ui.openMenu(e,{ui:r.ui,multi:i?.multi,editable:!0,value:i?.value??[],options:a,saveOptions:(s,l)=>{i?.multi?n(l):n(l[0])},placeholder:N.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0,showAll:!0,sections:o,showSections:!0,...i??{}},t)};var zMe=e=>{e.ui.openModal(N.labels.createSection,Z3.default.createElement(ga,{saveLabel:N.buttons.createFolder,value:"",saveValue:t=>{P0(e,e.pathsIndex.get(e.ui.activePath)).then(r=>{let n=e.pathsIndex.get(r?.path);n||(n=e.pathsIndex.get("/"));let i=t.replace(/\//g,""),a=n?.subtype=="folder"?n.path:n.parent?n.parent:"/",o=!a||a=="/"?i:a+"/"+i;if(i.length==0){e.ui.notify(N.notice.newSpaceName);return}if(e.spacesIndex.has(o)){e.ui.notify(N.notice.duplicateSpaceName);return}Uf(e,o,{})})}}),window)},dC=async(e,t,r,n)=>{let i=t;if(i?.path==Qv){e.ui.openModal("New Tag",Z3.default.createElement(ga,{value:"",saveLabel:N.labels.saveView,saveValue:a=>F3(e,a)}),r);return}if((!i||i.type=="tag")&&(i=await P0(e,e.pathsIndex.get(e.ui.activePath))),i?.metadata.template?.length>0){_3(e,i,i.metadata.template,n);return}else Xa(e,i,"md",null,!1,null,n)},r$=(e,t,r,n,i,a)=>{let o=[];if(n.type=="default")o.push({name:"New Tag",icon:"ui//tags",onClick:s=>{e.ui.openModal("New Tag",Z3.default.createElement(ga,{value:"",saveLabel:N.labels.saveView,saveValue:l=>F3(e,l)}),je(s.view.document))}});else if(o.push({name:N.labels.createNote,icon:"ui//edit",onClick:s=>{Xa(e,n,"md",e.settings.newNotePlaceholder,i)}}),o.push({name:N.buttons.createCanvas,icon:"ui//layout-dashboard",onClick:s=>{Xa(e,n,"canvas",null,i)}}),o.push({name:N.labels.createSection,icon:"ui//folder-plus",onClick:s=>{e.ui.openModal(N.labels.createSection,Z3.default.createElement(ga,{saveLabel:N.buttons.createFolder,value:"",saveValue:l=>{let u=e.pathsIndex.get(n?.path);u||(u=e.pathsIndex.get("/"));let c=l.replace(/\//g,""),f=u?.subtype=="folder"?u.path:u.parent?u.parent:"/",d=!f||f=="/"?c:f+"/"+c;if(c.length==0){e.ui.notify(N.notice.newSpaceName);return}if(e.spacesIndex.has(d)){e.ui.notify(N.notice.duplicateSpaceName);return}Uf(e,d,{})}}),je(s.view.document))}}),n.type=="folder"&&o.push({name:N.buttons.addIntoSpace,icon:"ui//pin",onClick:s=>{let l=s.target.getBoundingClientRect();Au(l,je(s.view.document),e,u=>{(0,$Me.isString)(u)&&Ng(e,n,u)}),s.stopPropagation()}}),n.templates.length>0){o.push(tr);for(let s of n.templates)o.push({name:s,icon:"ui//clipboard-pen",onClick:l=>{_3(e,n,s)}})}return e.ui.openMenu(t,_t(e.ui,o),r,"right")};var eM=(e,t,r,n,i,a)=>{let o=e.spacesIndex.get(t.path);if(!o)return;let s=[];s.push({name:N.menu.openFilePane,icon:"ui//go-to-file",onClick:()=>{e.ui.openPath(t.path,!0)}}),s.push(tr),s.push({name:N.menu.new,type:6,onSubmenu:u=>r$(e,u,n,o,!1,!0),icon:"ui//plus"}),s.push(tr),e.settings.spacesStickers&&(s.push({name:N.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:u=>yo(e,u,n,"",c=>iy(e,o.path,c),!1,!0)}),s.push({name:N.buttons.changeIcon,icon:"ui//sticker",onClick:u=>{e.ui.openPalette(n$.default.createElement(Ea,{ui:e.ui,selectedSticker:c=>ch(e,o.path,c)}),n)}}),s.push({name:N.buttons.removeIcon,icon:"ui//file-minus",onClick:u=>{fC(e,o.path)}})),o.metadata?.sort&&(s.push(tr),s.push({name:N.menu.sortBy,icon:"ui//sort-desc",type:6,onSubmenu:u=>{let c=[];c.push({name:N.menu.groupSpaces,icon:"ui//arrow-up-down",value:o.metadata.sort.group==!0,type:3,onClick:y=>{Hf(e,o.path,{field:o.metadata.sort.field,asc:o.metadata.sort.asc,group:!o.metadata.sort.group,recursive:o.metadata.sort.recursive})}}),c.push(tr),c.push({name:N.menu.recursiveSort,icon:"ui//arrow-up-down",value:o.metadata.sort.recursive==!0,type:3,onClick:y=>{Hf(e,o.path,{field:o.metadata.sort.field,asc:o.metadata.sort.asc,group:o.metadata.sort.group,recursive:!o.metadata.sort.recursive})}}),c.push(tr);let f={field:"rank",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:N.menu.customSort,icon:"ui//arrow-up-down",value:o.metadata.sort.field==f.field&&o.metadata.sort.asc==f.asc,type:3,onClick:y=>{Hf(e,o.path,f)}}),c.push(tr);let d={field:"name",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:N.menu.fileNameSortAlphaAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==d.field&&o.metadata.sort.asc==d.asc,type:3,onClick:y=>{Hf(e,o.path,d)}});let p={field:"name",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:N.menu.fileNameSortAlphaDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==p.field&&o.metadata.sort.asc==p.asc,type:3,onClick:y=>{Hf(e,o.path,p)}}),c.push(tr);let h={field:"number",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:N.menu.fileNameSortNumericalAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==h.field&&o.metadata.sort.asc==h.asc,type:3,onClick:y=>{Hf(e,o.path,h)}});let m={field:"number",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:N.menu.fileNameSortNumericalDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==m.field&&o.metadata.sort.asc==m.asc,type:3,onClick:y=>{Hf(e,o.path,m)}}),c.push(tr);let v={field:"ctime",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:N.menu.createdTimeSortAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==v.field&&o.metadata.sort.asc==v.asc,type:3,onClick:y=>{Hf(e,o.path,v)}});let A={field:"ctime",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:N.menu.createdTimeSortDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==A.field&&o.metadata.sort.asc==A.asc,type:3,onClick:y=>{Hf(e,o.path,A)}}),c.push(tr);let x={field:"mtime",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:N.menu.modifiedTimeSortAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==x.field&&o.metadata.sort.asc==x.asc,type:3,onClick:y=>{Hf(e,o.path,x)}});let g={field:"mtime",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:N.menu.modifiedTimeSortDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==g.field&&o.metadata.sort.asc==g.asc,type:3,onClick:y=>{Hf(e,o.path,g)}}),c.push(tr);let w={field:"size",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:N.menu.sizeSortAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==w.field&&o.metadata.sort.asc==w.asc,type:3,onClick:y=>{Hf(e,o.path,w)}});let b={field:"size",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};return c.push({name:N.menu.sizeSortDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==b.field&&o.metadata.sort.asc==b.asc,type:3,onClick:y=>{Hf(e,o.path,b)}}),e.ui.openMenu(u,_t(e.ui,c),n)}})),s.push({name:N.menu.applyItems,icon:"ui//apply-items",value:"apply-all",type:6,onSubmenu:u=>t$(u,e,o,n)}),o.type!="default"&&(s.push(tr),s.push({name:N.menu.rename,icon:"ui//edit",onClick:u=>{e.ui.openModal(N.labels.rename,n$.default.createElement(ga,{saveLabel:N.buttons.rename,value:o.type=="tag"?au(o.name):o.name,saveValue:c=>ZS(e,o.path,c)}),n)}}));let l=e.spacesIndex.get(i);if(o.type=="folder"&&s.push({name:N.buttons.addToSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect();Aa(c,n,e,f=>{let d=e.spacesIndex.get(f);d&&Y1(e,d,o.path,-1)},!0)}}),o.type=="folder"&&s.push({name:N.menu.moveFile,icon:"ui//paper-plane",onClick:u=>{let c=u.target.getBoundingClientRect();Aa(c,n,e,f=>{e.spaceManager.renameSpace(o.path,Jh(o.path,f))})}}),s.push({name:N.menu.duplicate,icon:"ui//documents",onClick:u=>{e.spaceManager.copyPath(t.path,`${t.parent}`)}}),l&&(l.type=="folder"||l.type=="vault")&&s.push({name:N.buttons.saveTemplate,icon:"ui//clipboard-add",onClick:u=>{X1(e,o.path,i)}}),e.ui.hasNativePathMenu(o.path)&&s.push({name:N.menu.openNativeMenu,icon:"ui//options",onClick:u=>{e.ui.nativePathMenu(u,o.path)}}),s.push(tr),Or(e.ui)||s.push({name:e.ui.getOS()=="mac"?N.menu.revealInDefault:N.menu.revealInExplorer,icon:"ui//arrow-up-right",onClick:u=>{e.ui.openPath(o.space.folderPath,"system")}}),s.push(tr),l&&(l.type=="folder"||l.type=="vault")&&i!=t.parent){let u=e.spacesIndex.get(i);u&&s.push({name:N.menu.removeFromSpace.replace("${1}",u.name),icon:"ui//pin-off",onClick:c=>{K1(e,u.path,[o.path])}})}return a&&s.push({name:N.menu.closeSpace,icon:"ui//close",onClick:u=>{a()}}),o.type=="folder"&&s.push({name:N.menu.hide,icon:"ui//eye-off",onClick:u=>{pP(e,o.path)}}),(o.type=="folder"||o.type=="tag")&&s.push({name:N.menu.delete,icon:"ui//trash",onClick:u=>{e.ui.openModal(N.labels.deleteSpace,n$.default.createElement(B0,{confirmAction:()=>wq(e,o.path),confirmLabel:N.buttons.delete,message:N.descriptions.deleteSpace}),n)}}),e.ui.openMenu(r,_t(e.ui,s),n),!1};var UMe=(e,t,r)=>{let n=t.map(a=>a.item.path),i=[];return i.push({name:N.menu.openFilePane,icon:"ui//go-to-file",onClick:a=>{n.forEach(o=>e.ui.openPath(o,!0))}}),e.settings.spacesStickers&&(i.push(tr),i.push({name:N.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:a=>yo(e,a,je(r.view.document),"",o=>PMe(e,n,o),!1,!0)}),i.push({name:N.buttons.changeIcon,icon:"ui//sticker",onClick:a=>{e.ui.openPalette(tM.default.createElement(Ea,{ui:e.ui,selectedSticker:o=>jMe(e,n,o)}),je(a.view.document))}}),i.push({name:N.buttons.removeIcon,icon:"ui//file-minus",onClick:a=>{Jq(e,n)}})),i.push(tr),i.push({name:N.menu.moveFile,icon:"ui//paper-plane",onClick:a=>{let o=a.target.getBoundingClientRect();Aa(o,je(a.view.document),e,s=>{n.forEach(l=>{vde(e,l,s)})})}}),i.push({name:N.buttons.addToSpace,icon:"ui//pin",onClick:a=>{let o=a.target.getBoundingClientRect();Aa(o,je(a.view.document),e,s=>{cC(e,t.map(l=>l.path),s,-1,"link")},!0)}}),i.push(tr),i.push({name:N.menu.hide,icon:"ui//eye-off",onClick:a=>{Ade(e,n)}}),i.push({name:N.menu.delete,icon:"ui//trash",onClick:a=>{e.ui.openModal(N.labels.deleteFiles,tM.default.createElement(B0,{confirmAction:()=>{n.forEach(o=>{Zb(e,o)})},confirmLabel:N.buttons.delete,message:N.descriptions.deleteFiles.replace("${1}",n.length.toString())}),je(a.view.document))}}),e.ui.openMenu(r.target.getBoundingClientRect(),_t(e.ui,i),je(r.view.document)),!1},dh=(e,t,r,n,i,a,o)=>{let s=e.pathsIndex.get(t);if(s.type=="space"){eM(e,s,n,i,r,o);return}if(!s)return;let l=[];if(l.push({name:N.menu.openFilePane,icon:"ui//go-to-file",onClick:u=>{e.ui.openPath(t,!0)}}),l.push(tr),e.settings.spacesStickers&&(l.push(tr),l.push({name:N.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:u=>yo(e,u,i,"",c=>iy(e,t,c),!1,!0)}),l.push({name:N.buttons.changeIcon,icon:"ui//sticker",onClick:u=>{e.ui.openPalette(tM.default.createElement(Ea,{ui:e.ui,selectedSticker:c=>fw(e,t,c)}),je(u.view.document))}}),l.push({name:N.buttons.removeIcon,icon:"ui//file-minus",onClick:u=>{fC(e,t)}})),l.push(tr),s.type=="file"&&s.subtype=="md"&&l.push({name:N.menu.changeToFolderNote,icon:"ui//file-plus-2",onClick:u=>{mP(e,t,!1)}}),l.push({name:N.menu.rename,icon:"ui//edit",onClick:u=>{e.ui.openModal(N.labels.rename,tM.default.createElement(ga,{saveLabel:N.buttons.rename,value:s.name,saveValue:c=>ZS(e,t,c)}),je(u.view.document))}}),l.push({name:N.buttons.addToSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect();Aa(c,je(u.view.document),e,f=>{cC(e,[t],f,-1,"link")},!0)}}),l.push({name:N.menu.moveFile,icon:"ui//paper-plane",onClick:u=>{let c=u.target.getBoundingClientRect();Aa(c,je(u.view.document),e,f=>{let d=e.pathsIndex.get(t);e.spaceManager.renamePath(t,Jh(t,f))})}}),l.push({name:N.menu.duplicate,icon:"ui//documents",onClick:u=>{e.spaceManager.copyPath(t,`${s.parent}`,`${s.name}`)}}),l.push({name:N.buttons.saveTemplate,icon:"ui//clipboard-add",onClick:u=>{X1(e,t,r)}}),e.ui.hasNativePathMenu(t)&&l.push({name:N.menu.openNativeMenu,icon:"ui//options",onClick:u=>{e.ui.nativePathMenu(u,t)}}),l.push(tr),Or(e.ui)||(l.push({name:e.ui.getOS()=="mac"?N.menu.revealInDefault:N.menu.revealInExplorer,icon:"ui//arrow-up-right",onClick:u=>{e.ui.openPath(t,"system")}}),l.push(tr)),o&&l.push({name:N.menu.closeSpace,icon:"ui//close",onClick:u=>{o()}}),r&&r!=s.parent){let u=e.spacesIndex.get(r);u&&l.push({name:N.menu.removeFromSpace.replace("${1}",u.name),icon:"ui//pin-off",onClick:c=>{K1(e,u.path,[t])}})}return l.push({name:N.menu.hide,icon:"ui//eye-off",onClick:u=>{pP(e,t)}}),l.push({name:N.menu.delete,icon:"ui//trash",onClick:u=>{Zb(e,t)}}),e.ui.openMenu(n,_t(e.ui,l),i,a),!1};var Zmt={freq:{label:N.labels.frequency,type:"option",value:{required:!0,options:[{name:N.labels.yearly,value:"YEARLY"},{name:N.labels.monthly,value:"MONTHLY"},{name:N.labels.weekly,value:"WEEKLY"},{name:N.labels.daily,value:"DAILY"},{name:N.labels.hourly,value:"HOURLY"},{name:N.labels.minutely,value:"MINUTELY"},{name:N.labels.secondly,value:"SECONDLY"}]}},until:{label:N.labels.until,type:"date",value:{required:!0}},interval:{label:N.labels.interval,type:"number"},count:{label:N.aggregates.count,type:"number"},wkst:{label:"Week Start",type:"option",value:{options:[{name:N.labels.monday,value:"MO"},{name:N.labels.tuesday,value:"TU"},{name:N.labels.wednesday,value:"WE"},{name:N.labels.thursday,value:"TH"},{name:N.labels.friday,value:"FR"},{name:N.labels.saturday,value:"SA"},{name:N.labels.sunday,value:"SU"}]}},byweekday:{label:"By Weekday",type:"option-multi",value:{alias:"Repeat Event",options:[{name:N.labels.monday,value:"MO"},{name:N.labels.tuesday,value:"TU"},{name:N.labels.wednesday,value:"WE"},{name:N.labels.thursday,value:"TH"},{name:N.labels.friday,value:"FR"},{name:N.labels.saturday,value:"SA"},{name:N.labels.sunday,value:"SU"}]}}},pC={name:N.labels.repeat,type:"object",value:JSON.stringify({typeName:N.labels.repeat,type:Zmt})};var HMe=(e,t)=>{let r={};for(let n of t){let i=e.pathsIndex.get(n)?.metadata?.property;i&&Object.keys(i).forEach(a=>{r[a]=[...r[a]??[],JA(i[a],a)]})}return Object.keys(r).reduce((n,i)=>[...n,{name:i,type:r[i][0]}],[])};var Fn=ge(Me());var eht=0,rM=class{constructor(t,r){this.from=t,this.to=r}},Zn=class{constructor(t={}){this.id=eht++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=vu.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};Zn.closedBy=new Zn({deserialize:e=>e.split(" ")});Zn.openedBy=new Zn({deserialize:e=>e.split(" ")});Zn.group=new Zn({deserialize:e=>e.split(" ")});Zn.isolate=new Zn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Zn.contextHash=new Zn({perNode:!0});Zn.lookAhead=new Zn({perNode:!0});Zn.mounted=new Zn({perNode:!0});var pw=class{constructor(t,r,n,i=!1){this.tree=t,this.overlay=r,this.parser=n,this.bracketed=i}static get(t){return t&&t.props&&t.props[Zn.mounted.id]}},tht=Object.create(null),vu=class{constructor(t,r,n,i=0){this.name=t,this.props=r,this.id=n,this.flags=i}static define(t){let r=t.props&&t.props.length?Object.create(null):tht,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new vu(t.name||"",r,t.id,n);if(t.props){for(let a of t.props)if(Array.isArray(a)||(a=a(i)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let r=this.prop(Zn.group);return r?r.indexOf(t)>-1:!1}return this.id==t}static match(t){let r=Object.create(null);for(let n in t)for(let i of n.split(" "))r[i]=t[n];return n=>{for(let i=n.prop(Zn.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};vu.none=new vu("",Object.create(null),0,8);var mC=class{constructor(t){this.types=t;for(let r=0;r<t.length;r++)if(t[r].id!=r)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let r=[];for(let n of this.types){let i=null;for(let a of t){let o=a(n);if(o){i||(i=Object.assign({},n.props));let s=o[1],l=o[0];l.combine&&l.id in i&&(s=l.combine(i[l.id],s)),i[l.id]=s}}r.push(i?new vu(n.name,i,n.id,n.flags):n)}return new mC(r)}},i$=new WeakMap,VMe=new WeakMap,es;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(es||(es={}));var ja=class{constructor(t,r,n,i,a){if(this.type=t,this.children=r,this.positions=n,this.length=i,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,s]of a)this.props[typeof o=="number"?o:o.id]=s}}toString(){let t=pw.get(this);if(t&&!t.overlay)return t.tree.toString();let r="";for(let n of this.children){let i=n.toString();i&&(r&&(r+=","),r+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(t=0){return new aM(this.topNode,t)}cursorAt(t,r=0,n=0){let i=i$.get(this)||this.topNode,a=new aM(i);return a.moveTo(t,r),i$.set(this,a._tree),a}get topNode(){return new Qf(this,0,0,null)}resolve(t,r=0){let n=iM(i$.get(this)||this.topNode,t,r,!1);return i$.set(this,n),n}resolveInner(t,r=0){let n=iM(VMe.get(this)||this.topNode,t,r,!0);return VMe.set(this,n),n}resolveStack(t,r=0){return rht(this,t,r)}iterate(t){let{enter:r,leave:n,from:i=0,to:a=this.length}=t,o=t.mode||0,s=(o&es.IncludeAnonymous)>0;for(let l=this.cursor(o|es.IncludeAnonymous);;){let u=!1;if(l.from<=a&&l.to>=i&&(!s&&l.type.isAnonymous||r(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&n&&(s||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let r in this.props)t.push([+r,this.props[r]]);return t}balance(t={}){return this.children.length<=8?this:ere(vu.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new ja(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new ja(vu.none,r,n,i)))}static build(t){return nht(t)}};ja.empty=new ja(vu.none,[],[],0);var nM=class{constructor(t,r){this.buffer=t,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new nM(this.buffer,this.index)}},_g=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return vu.none}toString(){let t=[];for(let r=0;r<this.buffer.length;)t.push(this.childString(r)),r=this.buffer[r+3];return t.join(",")}childString(t){let r=this.buffer[t],n=this.buffer[t+3],i=this.set.types[r],a=i.name;if(/\W/.test(a)&&!i.isError&&(a=JSON.stringify(a)),t+=4,n==t)return a;let o=[];for(;t<n;)o.push(this.childString(t)),t=this.buffer[t+3];return a+"("+o.join(",")+")"}findChild(t,r,n,i,a){let{buffer:o}=this,s=-1;for(let l=t;l!=r&&!(QMe(a,i,o[l+1],o[l+2])&&(s=l,n>0));l=o[l+3]);return s}slice(t,r,n){let i=this.buffer,a=new Uint16Array(r-t),o=0;for(let s=t,l=0;s<r;){a[l++]=i[s++],a[l++]=i[s++]-n;let u=a[l++]=i[s++]-n;a[l++]=i[s++]-t,o=Math.max(o,u)}return new _g(a,o,this.set)}};function QMe(e,t,r,n){switch(e){case-2:return r<t;case-1:return n>=t&&r<t;case 0:return r<t&&n>t;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function iM(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to<t);){let o=!n&&e instanceof Qf&&e.index<0?null:e.parent;if(!o)return e;e=o}let a=n?0:es.IgnoreOverlays;if(n)for(let o=e,s=o.parent;s;o=s,s=o.parent)o instanceof Qf&&o.index<0&&((i=s.enter(t,r,a))===null||i===void 0?void 0:i.from)!=o.from&&(e=s);for(;;){let o=e.enter(t,r,a);if(!o)return e;e=o}}var o$=class{cursor(t=0){return new aM(this,t)}getChild(t,r=null,n=null){let i=GMe(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return GMe(this,t,r,n)}resolve(t,r=0){return iM(this,t,r,!1)}resolveInner(t,r=0){return iM(this,t,r,!0)}matchContext(t){return Yte(this.parent,t)}enterUnfinishedNodesBefore(t){let r=this.childBefore(t),n=this;for(;r;){let i=r.lastChild;if(!i||i.to!=r.to)break;i.type.isError&&i.from==i.to?(n=r,r=i.prevSibling):r=i}return n}get node(){return this}get next(){return this.parent}},Qf=class extends o${constructor(t,r,n,i){super(),this._tree=t,this.from=r,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,r,n,i,a=0){var o;for(let s=this;;){for(let{children:l,positions:u}=s._tree,c=r>0?l.length:-1;t!=c;t+=r){let f=l[t],d=u[t]+s.from;if(!(!(a&es.EnterBracketed&&f instanceof ja&&((o=pw.get(f))===null||o===void 0?void 0:o.overlay)===null&&(d>=n||d+f.length<=n))&&!QMe(i,n,d,d+f.length))){if(f instanceof _g){if(a&es.ExcludeBuffers)continue;let p=f.findChild(0,f.buffer.length,r,n-d,i);if(p>-1)return new Pg(new Xte(s,f,t,d),null,p)}else if(a&es.IncludeAnonymous||!f.type.isAnonymous||Zte(f)){let p;if(!(a&es.IgnoreMounts)&&(p=pw.get(f))&&!p.overlay)return new Qf(p.tree,d,t,s);let h=new Qf(f,d,t,s);return a&es.IncludeAnonymous||!h.type.isAnonymous?h:h.nextChild(r<0?f.children.length-1:0,r,n,i,a)}}}if(a&es.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?t=s.index+r:t=r<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,r,n=0){let i;if(!(n&es.IgnoreOverlays)&&(i=pw.get(this._tree))&&i.overlay){let a=t-this.from,o=n&es.EnterBracketed&&i.bracketed;for(let{from:s,to:l}of i.overlay)if((r>0||o?s<=a:s<a)&&(r<0||o?l>=a:l>a))return new Qf(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,r,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function GMe(e,t,r,n){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(r!=null){for(let o=!1;!o;)if(o=i.type.is(r),!i.nextSibling())return a}for(;;){if(n!=null&&i.type.is(n))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return n==null?a:[]}}function Yte(e,t,r=t.length-1){for(let n=e;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}var Xte=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},Pg=class extends o${get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,r,n){super(),this.context=t,this._parent=r,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}child(t,r,n){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.context.start,n);return a<0?null:new Pg(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,r,n=0){if(n&es.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,t-this.context.start,r);return a<0?null:new Pg(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,r=t.buffer[this.index+3];return r<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Pg(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new Pg(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],r=[],{buffer:n}=this.context,i=this.index+4,a=n.buffer[this.index+3];if(a>i){let o=n.buffer[this.index+1];t.push(n.slice(i,a,o)),r.push(0)}return new ja(this.type,t,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function YMe(e){if(!e.length)return null;let t=0,r=e[0];for(let a=1;a<e.length;a++){let o=e[a];(o.from>r.from||o.to<r.to)&&(r=o,t=a)}let n=r instanceof Qf&&r.index<0?null:r.parent,i=e.slice();return n?i[t]=n:i.splice(t,1),new Kte(i,r)}var Kte=class{constructor(t,r){this.heads=t,this.node=r}get next(){return YMe(this.heads)}};function rht(e,t,r){let n=e.resolveInner(t,r),i=null;for(let a=n instanceof Qf?n:n.context.parent;a;a=a.parent)if(a.index<0){let o=a.parent;(i||(i=[n])).push(o.resolve(t,r)),a=o}else{let o=pw.get(a.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let s=new Qf(o.tree,o.overlay[0].from+a.from,-1,a);(i||(i=[n])).push(iM(s,t,r,!1))}}return i?YMe(i):n}var aM=class{get name(){return this.type.name}constructor(t,r=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=r&~es.EnterBracketed,t instanceof Qf)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,r){this.index=t;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[t]],this.from=n+i.buffer[t+1],this.to=n+i.buffer[t+2],!0}yield(t){return t?t instanceof Qf?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,r,n,this.mode));let{buffer:i}=this.buffer,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,r,n=this.mode){return this.buffer?n&es.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&es.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&es.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(t<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let r,n,{buffer:i}=this;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(i.buffer.buffer[a+3]<this.index)return!1;({index:r,parent:n}=i)}else({index:r,_parent:n}=this._tree);for(;n;{index:r,_parent:n}=n)if(r>-1)for(let a=r+t,o=t<0?-1:n._tree.children.length;a!=o;a+=t){let s=n._tree.children[a];if(this.mode&es.IncludeAnonymous||s instanceof _g||!s.type.isAnonymous||Zte(s))return!1}return!0}move(t,r){if(r&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,r=0){for(;(this.from==this.to||(r<1?this.from>=t:this.from>t)||(r>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,r););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,r=null,n=0;if(t&&t.context==this.buffer){e:for(let i=this.index,a=this.stack.length;a>=0;){for(let o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;r=o,n=a+1;break e}i=this.stack[--a]}}for(let i=n;i<this.stack.length;i++)r=new Pg(this.buffer,r,this.stack[i]);return this.bufferNode=new Pg(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,r){for(let n=0;;){let i=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&r&&r(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(t){if(!this.buffer)return Yte(this.node.parent,t);let{buffer:r}=this.buffer,{types:n}=r.set;for(let i=t.length-1,a=this.stack.length-1;i>=0;a--){if(a<0)return Yte(this._tree,t,i);let o=n[r.buffer[this.stack[a]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}};function Zte(e){return e.children.some(t=>t instanceof _g||!t.type.isAnonymous||Zte(t))}function nht(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new nM(r,r.length):r,l=n.types,u=0,c=0;function f(b,y,S,T,D,k){let{id:M,start:E,end:O,size:P}=s,_=c,B=u;if(P<0)if(s.next(),P==-1){let J=a[M];S.push(J),T.push(E-b);return}else if(P==-3){u=M;return}else if(P==-4){c=M;return}else throw new RangeError(`Unrecognized record size: ${P}`);let F=l[M],L,I,R=E-b;if(O-E<=i&&(I=v(s.pos-y,D))){let J=new Uint16Array(I.size-I.skip),Q=s.pos-I.size,q=J.length;for(;s.pos>Q;)q=A(I.start,J,q);L=new _g(J,O-I.start,n),R=I.start-b}else{let J=s.pos-P;s.next();let Q=[],q=[],ie=M>=o?M:-1,Ae=0,le=O;for(;s.pos>J;)ie>=0&&s.id==ie&&s.size>=0?(s.end<=le-i&&(h(Q,q,E,Ae,s.end,le,ie,_,B),Ae=Q.length,le=s.end),s.next()):k>2500?d(E,J,Q,q):f(E,J,Q,q,ie,k+1);if(ie>=0&&Ae>0&&Ae<Q.length&&h(Q,q,E,Ae,E,le,ie,_,B),Q.reverse(),q.reverse(),ie>-1&&Ae>0){let pe=p(F,B);L=ere(F,Q,q,0,Q.length,0,O-E,pe,pe)}else L=m(F,Q,q,O-E,_-O,B)}S.push(L),T.push(R)}function d(b,y,S,T){let D=[],k=0,M=-1;for(;s.pos>y;){let{id:E,start:O,end:P,size:_}=s;if(_>4)s.next();else{if(M>-1&&O<M)break;M<0&&(M=P-i),D.push(E,O,P),k++,s.next()}}if(k){let E=new Uint16Array(k*4),O=D[D.length-2];for(let P=D.length-3,_=0;P>=0;P-=3)E[_++]=D[P],E[_++]=D[P+1]-O,E[_++]=D[P+2]-O,E[_++]=_;S.push(new _g(E,D[2]-O,n)),T.push(O-b)}}function p(b,y){return(S,T,D)=>{let k=0,M=S.length-1,E,O;if(M>=0&&(E=S[M])instanceof ja){if(!M&&E.type==b&&E.length==D)return E;(O=E.prop(Zn.lookAhead))&&(k=T[M]+E.length+O)}return m(b,S,T,D,k,y)}}function h(b,y,S,T,D,k,M,E,O){let P=[],_=[];for(;b.length>T;)P.push(b.pop()),_.push(y.pop()+S-D);b.push(m(n.types[M],P,_,k-D,E-k,O)),y.push(D-S)}function m(b,y,S,T,D,k,M){if(k){let E=[Zn.contextHash,k];M=M?[E].concat(M):[E]}if(D>25){let E=[Zn.lookAhead,D];M=M?[E].concat(M):[E]}return new ja(b,y,S,T,M)}function v(b,y){let S=s.fork(),T=0,D=0,k=0,M=S.end-i,E={size:0,start:0,skip:0};e:for(let O=S.pos-b;S.pos>O;){let P=S.size;if(S.id==y&&P>=0){E.size=T,E.start=D,E.skip=k,k+=4,T+=4,S.next();continue}let _=S.pos-P;if(P<0||_<O||S.start<M)break;let B=S.id>=o?4:0,F=S.start;for(S.next();S.pos>_;){if(S.size<0)if(S.size==-3||S.size==-4)B+=4;else break e;else S.id>=o&&(B+=4);S.next()}D=F,T+=P,k+=B}return(y<0||T==b)&&(E.size=T,E.start=D,E.skip=k),E.size>4?E:void 0}function A(b,y,S){let{id:T,start:D,end:k,size:M}=s;if(s.next(),M>=0&&T<o){let E=S;if(M>4){let O=s.pos-(M-4);for(;s.pos>O;)S=A(b,y,S)}y[--S]=E,y[--S]=k-b,y[--S]=D-b,y[--S]=T}else M==-3?u=T:M==-4&&(c=T);return S}let x=[],g=[];for(;s.pos>0;)f(e.start||0,e.bufferStart||0,x,g,-1,0);let w=(t=e.length)!==null&&t!==void 0?t:x.length?g[0]+x[0].length:0;return new ja(l[e.topID],x.reverse(),g.reverse(),w)}var WMe=new WeakMap;function a$(e,t){if(!e.isAnonymous||t instanceof _g||t.type!=e)return 1;let r=WMe.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof ja)){r=1;break}r+=a$(e,n)}WMe.set(t,r)}return r}function ere(e,t,r,n,i,a,o,s,l){let u=0;for(let h=n;h<i;h++)u+=a$(e,t[h]);let c=Math.ceil(u*1.5/8),f=[],d=[];function p(h,m,v,A,x){for(let g=v;g<A;){let w=g,b=m[g],y=a$(e,h[g]);for(g++;g<A;g++){let S=a$(e,h[g]);if(y+S>=c)break;y+=S}if(g==w+1){if(y>c){let S=h[w];p(S.children,S.positions,0,S.children.length,m[w]+x);continue}f.push(h[w])}else{let S=m[g-1]+h[g-1].length-b;f.push(ere(e,h,m,w,g,b,S,null,l))}d.push(b+x-a)}}return p(t,r,n,i,0),(s||l)(f,d,o)}var Ig=class{constructor(t,r,n,i,a=!1,o=!1){this.from=t,this.to=r,this.tree=n,this.offset=i,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,r=[],n=!1){let i=[new Ig(0,t.length,t,0,!1,n)];for(let a of r)a.to>t.length&&i.push(a);return i}static applyChanges(t,r,n=128){if(!r.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,l=0,u=0;;s++){let c=s<r.length?r[s]:null,f=c?c.fromA:1e9;if(f-l>=n)for(;o&&o.from<f;){let d=o;if(l>=d.from||f<=d.to||u){let p=Math.max(d.from,l)-u,h=Math.min(d.to,f)-u;d=p>=h?null:new Ig(p,h,d.tree,d.offset+u,s>0,!!c)}if(d&&i.push(d),o.to>f)break;o=a<t.length?t[a++]:null}if(!c)break;l=c.toA,u=c.toA-c.toB}return i}},oM=class{startParse(t,r,n){return typeof t=="string"&&(t=new Jte(t)),n=n?n.length?n.map(i=>new rM(i.from,i.to)):[new rM(0,0)]:[new rM(0,t.length)],this.createParse(t,r||[],n)}parse(t,r,n){let i=this.startParse(t,r,n);for(;;){let a=i.advance();if(a)return a}}},Jte=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,r){return this.string.slice(t,r)}};var aNr=new Zn({perNode:!0});var ei=require("@codemirror/state"),_n=require("@codemirror/view");var iht=0,Yf=class{constructor(t,r,n,i){this.name=t,this.set=r,this.base=n,this.modified=i,this.id=iht++}toString(){let{name:t}=this;for(let r of this.modified)r.name&&(t=`${r.name}(${t})`);return t}static define(t,r){let n=typeof t=="string"?t:"?";if(t instanceof Yf&&(r=t),r?.base)throw new Error("Can not derive from a modified tag");let i=new Yf(n,[],null,[]);if(i.set.push(i),r)for(let a of r.set)i.set.push(a);return i}static defineModifier(t){let r=new hC(t);return n=>n.modified.indexOf(r)>-1?n:hC.get(n.base||n,n.modified.concat(r).sort((i,a)=>i.id-a.id))}},aht=0,hC=class{constructor(t){this.name=t,this.instances=[],this.id=aht++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&oht(r,s.modified));if(n)return n;let i=[],a=new Yf(t.name,i,t,r);for(let s of r)s.instances.push(a);let o=sht(r);for(let s of t.set)if(!s.modified.length)for(let l of o)i.push(hC.get(s,l));return a}};function oht(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function sht(e){let t=[[]];for(let r=0;r<e.length;r++)for(let n=0,i=t.length;n<i;n++)t.push(t[n].concat(e[r]));return t.sort((r,n)=>n.length-r.length)}function JMe(e){let t=Object.create(null);for(let r in e){let n=e[r];Array.isArray(n)||(n=[n]);for(let i of r.split(" "))if(i){let a=[],o=2,s=i;for(let f=0;;){if(s=="..."&&f>0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!d)throw new RangeError("Invalid path: "+i);if(a.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let p=i[f++];if(f==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);s=i.slice(f)}let l=a.length-1,u=a[l];if(!u)throw new RangeError("Invalid path: "+i);let c=new hw(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return ZMe.add(t)}var ZMe=new Zn({combine(e,t){let r,n,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),r&&r.mode==i.mode&&!i.context&&!r.context)continue;let a=new hw(i.tags,i.mode,i.context);r?r.next=a:n=a,r=a}return n}}),hw=class{constructor(t,r,n,i){this.tags=t,this.mode=r,this.context=n,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}};hw.empty=new hw([],2,null);function ire(e,t){let r=Object.create(null);for(let a of e)if(!Array.isArray(a.tag))r[a.tag.id]=a.class;else for(let o of a.tag)r[o.id]=a.class;let{scope:n,all:i=null}=t||{};return{style:a=>{let o=i;for(let s of a)for(let l of s.set){let u=r[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:n}}function lht(e,t){let r=null;for(let n of e){let i=n.style(t);i&&(r=r?r+" "+i:i)}return r}function eOe(e,t,r,n=0,i=e.length){let a=new rre(n,Array.isArray(t)?t:[t],r);a.highlightRange(e.cursor(),n,i,"",a.highlighters),a.flush(i)}var rre=class{constructor(t,r,n){this.at=t,this.highlighters=r,this.span=n,this.class=""}startSpan(t,r){r!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=r)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,r,n,i,a){let{type:o,from:s,to:l}=t;if(s>=n||l<=r)return;o.isTop&&(a=this.highlighters.filter(p=>!p.scope||p.scope(o)));let u=i,c=uht(t)||hw.empty,f=lht(a,c.tags);if(f&&(u&&(u+=" "),u+=f,c.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(r,s),u),c.opaque)return;let d=t.tree&&t.tree.prop(Zn.mounted);if(d&&d.overlay){let p=t.node.enter(d.overlay[0].from+s,1),h=this.highlighters.filter(v=>!v.scope||v.scope(d.tree.type)),m=t.firstChild();for(let v=0,A=s;;v++){let x=v<d.overlay.length?d.overlay[v]:null,g=x?x.from+s:l,w=Math.max(r,A),b=Math.min(n,g);if(w<b&&m)for(;t.from<b&&(this.highlightRange(t,w,b,i,a),this.startSpan(Math.min(b,t.to),u),!(t.to>=g||!t.nextSibling())););if(!x||g>n)break;A=x.to+s,A>r&&(this.highlightRange(p.cursor(),Math.max(r,x.from+s),Math.min(n,A),"",h),this.startSpan(Math.min(n,A),u))}m&&t.parent()}else if(t.firstChild()){d&&(i="");do if(!(t.to<=r)){if(t.from>=n)break;this.highlightRange(t,r,n,i,a),this.startSpan(Math.min(n,t.to),u)}while(t.nextSibling());t.parent()}}};function uht(e){let t=e.type.prop(ZMe);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var Ht=Yf.define,s$=Ht(),oy=Ht(),XMe=Ht(oy),KMe=Ht(oy),sy=Ht(),l$=Ht(sy),tre=Ht(sy),Rg=Ht(),mw=Ht(Rg),Bg=Ht(),Lg=Ht(),nre=Ht(),sM=Ht(nre),u$=Ht(),He={comment:s$,lineComment:Ht(s$),blockComment:Ht(s$),docComment:Ht(s$),name:oy,variableName:Ht(oy),typeName:XMe,tagName:Ht(XMe),propertyName:KMe,attributeName:Ht(KMe),className:Ht(oy),labelName:Ht(oy),namespace:Ht(oy),macroName:Ht(oy),literal:sy,string:l$,docString:Ht(l$),character:Ht(l$),attributeValue:Ht(l$),number:tre,integer:Ht(tre),float:Ht(tre),bool:Ht(sy),regexp:Ht(sy),escape:Ht(sy),color:Ht(sy),url:Ht(sy),keyword:Bg,self:Ht(Bg),null:Ht(Bg),atom:Ht(Bg),unit:Ht(Bg),modifier:Ht(Bg),operatorKeyword:Ht(Bg),controlKeyword:Ht(Bg),definitionKeyword:Ht(Bg),moduleKeyword:Ht(Bg),operator:Lg,derefOperator:Ht(Lg),arithmeticOperator:Ht(Lg),logicOperator:Ht(Lg),bitwiseOperator:Ht(Lg),compareOperator:Ht(Lg),updateOperator:Ht(Lg),definitionOperator:Ht(Lg),typeOperator:Ht(Lg),controlOperator:Ht(Lg),punctuation:nre,separator:Ht(nre),bracket:sM,angleBracket:Ht(sM),squareBracket:Ht(sM),paren:Ht(sM),brace:Ht(sM),content:Rg,heading:mw,heading1:Ht(mw),heading2:Ht(mw),heading3:Ht(mw),heading4:Ht(mw),heading5:Ht(mw),heading6:Ht(mw),contentSeparator:Ht(Rg),list:Ht(Rg),quote:Ht(Rg),emphasis:Ht(Rg),strong:Ht(Rg),link:Ht(Rg),monospace:Ht(Rg),strikethrough:Ht(Rg),inserted:Ht(),deleted:Ht(),changed:Ht(),invalid:Ht(),meta:u$,documentMeta:Ht(u$),annotation:Ht(u$),processingInstruction:Ht(u$),definition:Yf.defineModifier("definition"),constant:Yf.defineModifier("constant"),function:Yf.defineModifier("function"),standard:Yf.defineModifier("standard"),local:Yf.defineModifier("local"),special:Yf.defineModifier("special")};for(let e in He){let t=He[e];t instanceof Yf&&(t.name=e)}var lNr=ire([{tag:He.link,class:"tok-link"},{tag:He.heading,class:"tok-heading"},{tag:He.emphasis,class:"tok-emphasis"},{tag:He.strong,class:"tok-strong"},{tag:He.keyword,class:"tok-keyword"},{tag:He.atom,class:"tok-atom"},{tag:He.bool,class:"tok-bool"},{tag:He.url,class:"tok-url"},{tag:He.labelName,class:"tok-labelName"},{tag:He.inserted,class:"tok-inserted"},{tag:He.deleted,class:"tok-deleted"},{tag:He.literal,class:"tok-literal"},{tag:He.string,class:"tok-string"},{tag:He.number,class:"tok-number"},{tag:[He.regexp,He.escape,He.special(He.string)],class:"tok-string2"},{tag:He.variableName,class:"tok-variableName"},{tag:He.local(He.variableName),class:"tok-variableName tok-local"},{tag:He.definition(He.variableName),class:"tok-variableName tok-definition"},{tag:He.special(He.variableName),class:"tok-variableName2"},{tag:He.definition(He.propertyName),class:"tok-propertyName tok-definition"},{tag:He.typeName,class:"tok-typeName"},{tag:He.namespace,class:"tok-namespace"},{tag:He.className,class:"tok-className"},{tag:He.macroName,class:"tok-macroName"},{tag:He.propertyName,class:"tok-propertyName"},{tag:He.operator,class:"tok-operator"},{tag:He.comment,class:"tok-comment"},{tag:He.meta,class:"tok-meta"},{tag:He.invalid,class:"tok-invalid"},{tag:He.punctuation,class:"tok-punctuation"}]);var are="\u037C",tOe=typeof Symbol>"u"?"__"+are:Symbol.for(are),ore=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),rOe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},ph=class{constructor(t,r){this.rules=[];let{finish:n}=r||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function a(o,s,l,u){let c=[],f=/^@(\w+)\b/.exec(o[0]),d=f&&f[1]=="keyframes";if(f&&s==null)return l.push(o[0]+";");for(let p in s){let h=s[p];if(/&/.test(p))a(p.split(/,\s*/).map(m=>o.map(v=>m.replace(/&/,v))).reduce((m,v)=>m.concat(v)),h,l);else if(h&&typeof h=="object"){if(!f)throw new RangeError("The value of a property ("+p+") should be a primitive value.");a(i(p),h,c,d)}else h!=null&&c.push(p.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+h+";")}(c.length||d)&&l.push((n&&!f&&!u?o.map(n):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in t)a(i(o),t[o],this.rules)}getRules(){return this.rules.join(`

Callers 2

eMFunction · 0.45
dhFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected