react-reason-editor 1.0.61 → 1.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ReasonDocs-B4rT3-HS.cjs +1 -0
- package/dist/{ReasonDocs-B1yliWVq.js → ReasonDocs-DkUKYeNa.js} +19 -17
- package/dist/editor/ReasonDocs.d.ts +14 -1
- package/dist/editor/RightPanel.d.ts +4 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/layout/sidebar/Sidebar.d.ts +1 -1
- package/dist/layout/sidebar/SidebarContent.d.ts +4 -2
- package/dist/layout/sidebar/types.d.ts +17 -0
- package/dist/reason-docs.cjs +1 -1
- package/dist/reason-docs.js +1 -1
- package/package.json +1 -1
- package/dist/ReasonDocs-YyAZ8_Ks.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BeavJI0R.cjs"),t=require("./dist-2-kjLBhJ.cjs"),n=require("./locales-DRkmn37v.cjs"),r=require("./BubbleMenus-Ci-Ltv2c.cjs"),a=require("./Icon-CC1yoE4E.cjs"),s=require("./Comment-B5fwFNa3.cjs"),o=require("./editorConfig-Cx4ilZJV.cjs"),i=require("./dist-B48W0ydl.cjs"),l=require("./floating-ui.dom-WhPyf5CX.cjs"),c=require("./theme.cjs");require("./katex.min-DzTn8og2.cjs");let d=require("react"),u=e.__toESM(d,1);d=e.__toESM(d);let h=require("@radix-ui/react-slot"),m=require("clsx");m=e.__toESM(m,1);let p=require("react/jsx-runtime"),f=require("lucide-react"),g=require("@radix-ui/react-dialog");g=e.__toESM(g,1);let x=require("react-dom"),v=e.__toESM(x,1);x=e.__toESM(x);let y=require("@radix-ui/react-dropdown-menu");y=e.__toESM(y,1);let b=require("@radix-ui/react-label");b=e.__toESM(b,1);let w=require("@radix-ui/react-select");w=e.__toESM(w,1);let S=require("@radix-ui/react-separator");S=e.__toESM(S,1);let j=require("@radix-ui/react-tooltip");j=e.__toESM(j,1);let k=require("@radix-ui/react-switch");k=e.__toESM(k,1);let C=require("@radix-ui/react-tabs");C=e.__toESM(C,1);let N=require("grab-url");N=e.__toESM(N,1);let T=require("re-resizable");var M,E=Object.defineProperty,A=(e,t)=>E(e,"name",{value:t,configurable:!0}),[R,I]=s.createContextScope("AlertDialog",[g.createDialogScope]),D=(0,g.createDialogScope)(),_=A(e=>{const{__scopeAlertDialog:t,...n}=e,r=D(t);return(0,p.jsx)(g.Root,{...r,...n,modal:!0})},"AlertDialog"),z=(u.forwardRef(A(function(e,t){const{__scopeAlertDialog:n,...r}=e,a=D(n);return(0,p.jsx)(g.Trigger,{...a,...r,ref:t})},"AlertDialogTrigger")),A(e=>{const{__scopeAlertDialog:t,...n}=e,r=D(t);return(0,p.jsx)(g.Portal,{...r,...n})},"AlertDialogPortal")),P=u.forwardRef(A(function(e,t){const{__scopeAlertDialog:n,...r}=e,a=D(n);return(0,p.jsx)(g.Overlay,{...a,...r,ref:t})},"AlertDialogOverlay")),[O,L]=R("AlertDialogContent"),F=u.forwardRef(A(function(e,t){const{__scopeAlertDialog:n,children:r,...a}=e,s=D(n),l=u.useRef(null),c=o.useComposedRefs(t,l),d=u.useRef(null);return(0,p.jsx)(O,{scope:n,cancelRef:d,children:(0,p.jsx)(g.Content,{role:"alertdialog",...s,...a,ref:c,onOpenAutoFocus:i.composeEventHandlers(a.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},"AlertDialogContent")),B=u.forwardRef(A(function(e,t){const{__scopeAlertDialog:n,...r}=e,a=D(n);return(0,p.jsx)(g.Title,{...a,...r,ref:t})},"AlertDialogTitle")),H=u.forwardRef(A(function(e,t){const{__scopeAlertDialog:n,...r}=e,a=D(n);return(0,p.jsx)(g.Description,{...a,...r,ref:t})},"AlertDialogDescription")),V=u.forwardRef(A(function(e,t){const{__scopeAlertDialog:n,...r}=e,a=D(n);return(0,p.jsx)(g.Close,{...a,...r,ref:t})},"AlertDialogAction")),$=u.forwardRef(A(function(e,t){const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=L("AlertDialogCancel",n),s=D(n),i=o.useComposedRefs(t,a);return(0,p.jsx)(g.Close,{...s,...r,ref:i})},"AlertDialogCancel")),q=_,U=z,G=P,W=F,K=V,Y=$,X=B,Z=H,J=Object.defineProperty,Q=(e,t)=>J(e,"name",{value:t,configurable:!0}),ee="dismissableLayer.update",te=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ne=u.forwardRef(Q(function(e,t){const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,...m}=e,f=u.useContext(te),[g,x]=u.useState(null),v=g?.ownerDocument??globalThis?.document,[,y]=u.useState({}),b=o.useComposedRefs(t,x),w=Array.from(f.layers),[S]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),j=S?w.indexOf(S):-1,k=g?w.indexOf(g):-1,C=f.layersWithOutsidePointerEventsDisabled.size>0,N=k>=j,T=u.useRef(!1),E=ae(e=>{l?.(e),d?.(e),e.defaultPrevented||h?.()},{ownerDocument:v,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:u.useCallback(e=>{if(!(e instanceof Node))return!1;const t=[...f.branches].some(t=>t.contains(e));return N&&!t},[f.branches,N])}),A=se(e=>{if(r&&T.current)return;const t=e.target;[...f.branches].some(e=>e.contains(t))||(c?.(e),d?.(e),e.defaultPrevented||h?.())},v),R=!!g&&k===w.length-1,I=s.useCallbackRef(e=>{"Escape"===e.key&&(a?.(e),!e.defaultPrevented&&h&&(e.preventDefault(),h()))});return u.useEffect(()=>{if(R)return v.addEventListener("keydown",I,{capture:!0}),()=>v.removeEventListener("keydown",I,{capture:!0})},[v,R,I]),u.useEffect(()=>{if(g)return n&&(0===f.layersWithOutsidePointerEventsDisabled.size&&(M=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(g)),f.layers.add(g),oe(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(g),0===f.layersWithOutsidePointerEventsDisabled.size&&(v.body.style.pointerEvents=M))}},[g,v,n,f]),u.useEffect(()=>()=>{g&&(f.layers.delete(g),f.layersWithOutsidePointerEventsDisabled.delete(g),oe())},[g,f]),u.useEffect(()=>{const e=Q(()=>y({}),"handleUpdate");return document.addEventListener(ee,e),()=>document.removeEventListener(ee,e)},[]),(0,p.jsx)(s.Primitive.div,{...m,ref:b,style:{pointerEvents:C?N?"auto":"none":void 0,...e.style},onFocusCapture:i.composeEventHandlers(e.onFocusCapture,A.onFocusCapture),onBlurCapture:i.composeEventHandlers(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:i.composeEventHandlers(e.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer"));Q(function(){const e=u.useContext(te),[t,n]=u.useState(null);return u.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n},"useDismissableLayerSurface");var re=Q(()=>!0,"IS_TRUE");function ae(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:o,shouldHandlePointerDownOutside:i=re}=t,l=s.useCallbackRef(e),c=u.useRef(!1),d=u.useRef(!1),h=u.useRef(new Map),m=u.useRef(()=>{});return u.useEffect(()=>{function e(){d.current=!1,a.current=!1,h.current.clear()}function t(){return Array.from(h.current.values()).some(Boolean)}function s(e){if(!d.current)return;const t=e.target;t instanceof Node&&[...o].some(e=>e.contains(t))||h.current.set(e.type,!0),"click"===e.type&&window.setTimeout(()=>{d.current&&m.current()},0)}function u(e){d.current&&h.current.set(e.type,!1)}Q(e,"resetOutsideInteraction"),Q(t,"isOutsideInteractionIntercepted"),Q(s,"handleInteractionCapture"),Q(u,"handleInteractionBubble");const p=Q(s=>{if(s.target&&!c.current){let o=function(){n.removeEventListener("click",m.current);const r=t();e(),r||ie("dismissableLayer.pointerDownOutside",l,u,{discrete:!0})};if(Q(o,"handleAndDispatchPointerDownOutsideEvent"),!i(s.target))return n.removeEventListener("click",m.current),e(),void(c.current=!1);const u={originalEvent:s};d.current=!0,a.current=r&&0===s.button,h.current.clear(),r&&0===s.button?(n.removeEventListener("click",m.current),m.current=o,n.addEventListener("click",m.current,{once:!0})):o()}else n.removeEventListener("click",m.current),e();c.current=!1},"handlePointerDown"),f=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const r of f)n.addEventListener(r,s,!0),n.addEventListener(r,u);const g=window.setTimeout(()=>{n.addEventListener("pointerdown",p)},0);return()=>{window.clearTimeout(g),n.removeEventListener("pointerdown",p),n.removeEventListener("click",m.current);for(const e of f)n.removeEventListener(e,s,!0),n.removeEventListener(e,u)}},[n,l,r,a,o,i]),{onPointerDownCapture:Q(()=>c.current=!0,"onPointerDownCapture")}}function se(e,t=globalThis?.document){const n=s.useCallbackRef(e),r=u.useRef(!1);return u.useEffect(()=>{const e=Q(e=>{e.target&&!r.current&&ie("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:Q(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Q(()=>r.current=!1,"onBlurCapture")}}function oe(){const e=new CustomEvent(ee);document.dispatchEvent(e)}function ie(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?s.dispatchDiscreteCustomEvent(a,o):a.dispatchEvent(o)}Q(ae,"usePointerDownOutside"),Q(se,"useFocusOutside"),Q(oe,"dispatchUpdate"),Q(ie,"handleAndDispatchCustomEvent");var le=Object.defineProperty,ce=(e,t)=>le(e,"name",{value:t,configurable:!0}),de=0,ue=null;function he(){u.useEffect(()=>{ue||(ue={start:me(),end:me()});const{start:e,end:t}=ue;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),de++,()=>{1===de&&(ue?.start.remove(),ue?.end.remove(),ue=null),de=Math.max(0,de-1)}},[])}function me(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}ce(function(e){return he(),e.children},"FocusGuards"),ce(he,"useFocusGuards"),ce(me,"createFocusGuard");var pe=Object.defineProperty,fe=(e,t)=>pe(e,"name",{value:t,configurable:!0}),ge="focusScope.autoFocusOnMount",xe="focusScope.autoFocusOnUnmount",ve={bubbles:!1,cancelable:!0},ye=u.forwardRef(fe(function(e,t){const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...l}=e,[c,d]=u.useState(null),h=s.useCallbackRef(a),m=s.useCallbackRef(i),f=u.useRef(null),g=o.useComposedRefs(t,d),x=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(r){let e=function(e){if(x.paused||!c)return;const t=e.target;c.contains(t)?f.current=t:Ne(f.current,{select:!0})},t=function(e){if(x.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||Ne(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Ne(c)};fe(e,"handleFocusIn"),fe(t,"handleFocusOut"),fe(n,"handleMutations"),document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[r,c,x.paused]),u.useEffect(()=>{if(c){Te.add(x);const e=document.activeElement;if(!c.contains(e)){const t=new CustomEvent(ge,ve);c.addEventListener(ge,h),c.dispatchEvent(t),t.defaultPrevented||(be(Ae(Se(c)),{select:!0}),document.activeElement===e&&Ne(c))}return()=>{c.removeEventListener(ge,h),setTimeout(()=>{const t=new CustomEvent(xe,ve);c.addEventListener(xe,m),c.dispatchEvent(t),t.defaultPrevented||Ne(e??document.body,{select:!0}),c.removeEventListener(xe,m),Te.remove(x)},0)}}},[c,h,m,x]);const v=u.useCallback(e=>{if(!n&&!r)return;if(x.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){const t=e.currentTarget,[r,s]=we(t);r&&s?e.shiftKey||a!==s?e.shiftKey&&a===r&&(e.preventDefault(),n&&Ne(s,{select:!0})):(e.preventDefault(),n&&Ne(r,{select:!0})):a===t&&e.preventDefault()}},[n,r,x.paused]);return(0,p.jsx)(s.Primitive.div,{tabIndex:-1,...l,ref:g,onKeyDown:v})},"FocusScope"));function be(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ne(r,{select:t}),document.activeElement!==n)return}function we(e){const t=Se(e);return[je(t,e),je(t.reverse(),e)]}function Se(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:fe(e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}function je(e,t){const n="function"==typeof t.checkVisibility&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ke(r,{upTo:t})))return r}function ke(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Ce(e){return e instanceof HTMLInputElement&&"select"in e}function Ne(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ce(e)&&t&&e.select()}}fe(be,"focusFirst"),fe(we,"getTabbableEdges"),fe(Se,"getTabbableCandidates"),fe(je,"findVisible"),fe(ke,"isHidden"),fe(Ce,"isSelectableInput"),fe(Ne,"focus");var Te=Me();function Me(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ee(e,t),e.unshift(t)},remove(t){e=Ee(e,t),e[0]?.resume()}}}function Ee(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}function Ae(e){return e.filter(e=>"A"!==e.tagName)}fe(Me,"createFocusScopesStack"),fe(Ee,"arrayRemove"),fe(Ae,"removeLinks");function Re(e){const[t,n]=u.useState(void 0);return s.useLayoutEffect2(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let a,s;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,s=t.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}(0,Object.defineProperty)(Re,"name",{value:"useSize",configurable:!0});var Ie=Object.defineProperty,De=(e,t)=>Ie(e,"name",{value:t,configurable:!0}),_e="Popper",[ze,Pe]=s.createContextScope(_e),[Oe,Le]=ze(_e),Fe=De(e=>{const{__scopePopper:t,children:n}=e,[r,a]=u.useState(null),[s,o]=u.useState(void 0);return(0,p.jsx)(Oe,{scope:t,anchor:r,onAnchorChange:a,placementState:s,setPlacementState:o,children:n})},"Popper"),Be=u.forwardRef(De(function(e,t){const{__scopePopper:n,virtualRef:r,...a}=e,i=Le("PopperAnchor",n),l=u.useRef(null),c=i.onAnchorChange,d=u.useCallback(e=>{l.current=e,e&&c(e)},[c]),h=o.useComposedRefs(t,d),m=u.useRef(null);u.useEffect(()=>{if(!r)return;const e=m.current;m.current=r.current,e!==m.current&&c(m.current)});const f=i.placementState&&We(i.placementState),g=f?.[0],x=f?.[1];return r?null:(0,p.jsx)(s.Primitive.div,{"data-radix-popper-side":g,"data-radix-popper-align":x,...a,ref:h})},"PopperAnchor")),He="PopperContent",[Ve,$e]=ze(He),qe=u.forwardRef(De(function(e,t){const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:c="center",alignOffset:d=0,arrowPadding:h=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:g=0,sticky:x="partial",hideWhenDetached:v=!1,updatePositionStrategy:y="optimized",onPlaced:b,...w}=e,S=Le(He,n),[j,k]=u.useState(null),C=o.useComposedRefs(t,k),[N,T]=u.useState(null),M=Re(N),E=M?.width??0,A=M?.height??0,R=r+("center"!==c?"-"+c:""),I="number"==typeof g?g:{top:0,right:0,bottom:0,left:0,...g},D=Array.isArray(f)?f:[f],_=D.length>0,z={padding:I,boundary:D.filter(Ue),altBoundary:_},{refs:P,floatingStyles:O,placement:L,isPositioned:F,middlewareData:B}=i.useFloating({strategy:"fixed",placement:R,whileElementsMounted:De((...e)=>l.autoUpdate(...e,{animationFrame:"always"===y}),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[i.offset({mainAxis:a+A,alignmentAxis:d}),m&&i.shift({mainAxis:!0,crossAxis:!1,limiter:"partial"===x?i.limitShift():void 0,...z}),m&&i.flip({...z}),i.size({...z,apply:De(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:a,height:s}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${n}px`),o.setProperty("--radix-popper-available-height",`${r}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${s}px`)},"apply")}),N&&i.arrow({element:N,padding:h}),Ge({arrowWidth:E,arrowHeight:A}),v&&i.hide({strategy:"referenceHidden",...z,boundary:_?z.boundary:void 0})]}),H=S.setPlacementState;s.useLayoutEffect2(()=>(H(L),()=>{H(void 0)}),[L,H]);const[V,$]=We(L),q=s.useCallbackRef(b);s.useLayoutEffect2(()=>{F&&q?.()},[F,q]);const U=B.arrow?.x,G=B.arrow?.y,W=0!==B.arrow?.centerOffset,[K,Y]=u.useState();return s.useLayoutEffect2(()=>{j&&Y(window.getComputedStyle(j).zIndex)},[j]),(0,p.jsx)("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:F?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:K,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,p.jsx)(Ve,{scope:n,placedSide:V,placedAlign:$,onArrowChange:T,arrowX:U,arrowY:G,shouldHideArrow:W,children:(0,p.jsx)(s.Primitive.div,{"data-side":V,"data-align":$,...w,ref:C,style:{...w.style,animation:F?w.style?.animation:"none"}})})})},"PopperContent"));function Ue(e){return null!==e}De(Ue,"isNotNull");var Ge=De(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:a}=t,s=0!==a.arrow?.centerOffset,o=s?0:e.arrowWidth,i=s?0:e.arrowHeight,[l,c]=We(n),d={start:"0%",center:"50%",end:"100%"}[c],u=(a.arrow?.x??0)+o/2,h=(a.arrow?.y??0)+i/2;let m="",p="";return"bottom"===l?(m=s?d:`${u}px`,p=-i+"px"):"top"===l?(m=s?d:`${u}px`,p=`${r.floating.height+i}px`):"right"===l?(m=-i+"px",p=s?d:`${h}px`):"left"===l&&(m=`${r.floating.width+i}px`,p=s?d:`${h}px`),{data:{x:m,y:p}}}}),"transformOrigin");function We(e){const[t,n="center"]=e.split("-");return[t,n]}De(We,"getSideAndAlignFromPlacement");var Ke=Fe,Ye=Be,Xe=qe,Ze=Object.defineProperty,Je=(e,t)=>Ze(e,"name",{value:t,configurable:!0}),Qe=u.forwardRef(Je(function(e,t){const{container:n,...r}=e,[a,o]=u.useState(!1);s.useLayoutEffect2(()=>o(!0),[]);const i=n||a&&globalThis?.document?.body;return i?v.createPortal((0,p.jsx)(s.Primitive.div,{...r,ref:t}),i):null},"Portal")),et=Object.defineProperty,tt=(e,t)=>et(e,"name",{value:t,configurable:!0});function nt(e,t){return u.useReducer((e,n)=>t[e][n]??e,e)}tt(nt,"useStateMachine");var rt=tt(e=>{const{present:t,children:n}=e,r=at(t),a="function"==typeof n?n({present:r.isPresent}):u.Children.only(n),s=ot(r.ref,lt(a));return"function"==typeof n||r.isPresent?u.cloneElement(a,{ref:s}):null},"Presence");function at(e){const[t,n]=u.useState(),r=u.useRef(null),a=u.useRef(e),o=u.useRef("none"),i=u.useRef(void 0),[l,c]=nt(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{"mounted"===l?(o.current=i.current??it(r.current),i.current=void 0):o.current="none"},[l]),s.useLayoutEffect2(()=>{const t=r.current,n=a.current;if(n!==e){const r=o.current,s=it(t);e?(i.current=s,c("MOUNT")):c("none"===s||"none"===t?.display?"UNMOUNT":n&&r!==s?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),s.useLayoutEffect2(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,s=tt(s=>{const o=it(r.current).includes(CSS.escape(s.animationName));if(s.target===t&&o&&(c("ANIMATION_END"),!a.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},"handleAnimationEnd"),i=tt(e=>{e.target===t&&(o.current=it(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",i),t.addEventListener("animationcancel",s),t.addEventListener("animationend",s),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",i),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}}c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:u.useCallback(e=>{if(e){const t=getComputedStyle(e);r.current=t,i.current=it(t)}else r.current=null;n(e)},[])}}function st(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function ot(...e){const t=u.useRef(e);return t.current=e,u.useCallback(e=>{const n=t.current;let r=!1;const a=n.map(t=>{const n=st(t,e);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let e=0;e<a.length;e++){const t=a[e];"function"==typeof t?t():st(n[e],null)}}},[])}function it(e){return e?.animationName||"none"}function lt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}tt(at,"usePresence"),tt(st,"setRef"),tt(ot,"useStableComposedRefs"),tt(it,"getAnimationName"),tt(lt,"getElementRef");var ct=new WeakMap,dt=new WeakMap,ut={},ht=0,mt=function(e){return e&&(e.host||mt(e.parentNode))},pt=function(e,t,n,r){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=mt(t);return n&&e.contains(n)?n:null}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);ut[n]||(ut[n]=new WeakMap);var s=ut[n],o=[],i=new Set,l=new Set(a),c=function(e){e&&!i.has(e)&&(i.add(e),c(e.parentNode))};a.forEach(c);var d=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(i.has(e))d(e);else try{var t=e.getAttribute(r),a=null!==t&&"false"!==t,l=(ct.get(e)||0)+1,c=(s.get(e)||0)+1;ct.set(e,l),s.set(e,c),o.push(e),1===l&&a&&dt.set(e,!0),1===c&&e.setAttribute(n,"true"),a||e.setAttribute(r,"true")}catch(u){}})};return d(t),i.clear(),ht++,function(){o.forEach(function(e){var t=ct.get(e)-1,a=s.get(e)-1;ct.set(e,t),s.set(e,a),t||(dt.has(e)||e.removeAttribute(r),dt.delete(e)),a||e.removeAttribute(n)}),--ht||(ct=new WeakMap,ct=new WeakMap,dt=new WeakMap,ut={})}},ft=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=t||function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),pt(r,a,n,"aria-hidden")):function(){return null}},gt=function(){return gt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},gt.apply(this,arguments)};function xt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}var vt="right-scroll-bar-position",yt="width-before-scroll-bar";function bt(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var wt="undefined"!=typeof window?d.useLayoutEffect:d.useEffect,St=new WeakMap;function jt(e,t){var n,r,a,s=(n=t||null,r=function(t){return e.forEach(function(e){return bt(e,t)})},a=(0,d.useState)(function(){return{value:n,callback:r,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}})[0],a.callback=r,a.facade);return wt(function(){var t=St.get(s);if(t){var n=new Set(t),r=new Set(e),a=s.current;n.forEach(function(e){r.has(e)||bt(e,null)}),r.forEach(function(e){n.has(e)||bt(e,a)})}St.set(s,e)},[e]),s}function kt(e){return e}var Ct=function(e){var t=e.sideCar,n=xt(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return d.createElement(r,gt({},n))};Ct.isSideCarExport=!0;var Nt=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=kt);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var a=t(e,r);return n.push(a),function(){n=n.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var a=n;n=[],a.forEach(e),t=n}var s=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(s)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=gt({async:!0,ssr:!1},e),t}(),Tt=function(){},Mt=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:Tt,onWheelCapture:Tt,onTouchMoveCapture:Tt}),a=r[0],s=r[1],o=e.forwardProps,i=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,h=e.shards,m=e.sideCar,p=e.noRelative,f=e.noIsolation,g=e.inert,x=e.allowPinchZoom,v=e.as,y=void 0===v?"div":v,b=e.gapMode,w=xt(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=m,j=jt([n,t]),k=gt(gt({},w),a);return d.createElement(d.Fragment,null,u&&d.createElement(S,{sideCar:Nt,removeScrollBar:c,shards:h,noRelative:p,noIsolation:f,inert:g,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:b}),o?d.cloneElement(d.Children.only(i),gt(gt({},k),{ref:j})):d.createElement(y,gt({},k,{className:l,ref:j}),i))});Mt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Mt.classNames={fullWidth:yt,zeroRight:vt};function Et(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var At=function(){var e=0,t=null;return{add:function(n){var r,a;0==e&&(t=Et())&&(a=n,(r=t).styleSheet?r.styleSheet.cssText=a:r.appendChild(document.createTextNode(a)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Rt=function(){var e,t=(e=At(),function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},It={left:0,top:0,right:0,gap:0},Dt=function(e){return parseInt(e||"",10)||0},_t=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return It;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[Dt(n),Dt(r),Dt(a)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},zt=Rt(),Pt="data-scroll-locked",Ot=function(e,t,n,r){var a=e.left,s=e.top,o=e.right,i=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(i,"px ").concat(r,";\n }\n body[").concat(Pt,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(s,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(i,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(vt," {\n right: ").concat(i,"px ").concat(r,";\n }\n \n .").concat(yt," {\n margin-right: ").concat(i,"px ").concat(r,";\n }\n \n .").concat(vt," .").concat(vt," {\n right: 0 ").concat(r,";\n }\n \n .").concat(yt," .").concat(yt," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(Pt,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},Lt=function(){var e=parseInt(document.body.getAttribute("data-scroll-locked")||"0",10);return isFinite(e)?e:0},Ft=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=void 0===r?"margin":r;d.useEffect(function(){return document.body.setAttribute(Pt,(Lt()+1).toString()),function(){var e=Lt()-1;e<=0?document.body.removeAttribute(Pt):document.body.setAttribute(Pt,e.toString())}},[]);var s=d.useMemo(function(){return _t(a)},[a]);return d.createElement(zt,{styles:Ot(s,!t,a,n?"":"!important")})},Bt=!1;if("undefined"!=typeof window)try{var Ht=Object.defineProperty({},"passive",{get:function(){return Bt=!0,!0}});window.addEventListener("test",Ht,Ht),window.removeEventListener("test",Ht,Ht)}catch(bE){Bt=!1}var Vt=!!Bt&&{passive:!1},$t=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},qt=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),Ut(e,r)){var a=Gt(e,r);if(a[1]>a[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ut=function(e,t){return"v"===e?function(e){return $t(e,"overflowY")}(t):function(e){return $t(e,"overflowX")}(t)},Gt=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},Wt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Kt=function(e){return[e.deltaX,e.deltaY]},Yt=function(e){return e&&"current"in e?e.current:e},Xt=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Zt=0,Jt=[];function Qt(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var en,tn=(en=function(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),a=d.useState(Zt++)[0],s=d.useState(Rt)[0],o=d.useRef(e);d.useEffect(function(){o.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=function(e,t,n){if(n||2===arguments.length)for(var r,a=0,s=t.length;a<s;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(Yt),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var i=d.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!o.current.allowPinchZoom;var a,s=Wt(e),i=n.current,l="deltaX"in e?e.deltaX:i[0]-s[0],c="deltaY"in e?e.deltaY:i[1]-s[1],d=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var h=window.getSelection(),m=h&&h.anchorNode;if(m&&(m===d||m.contains(d)))return!1;var p=qt(u,d);if(!p)return!0;if(p?a=u:(a="v"===u?"h":"v",p=qt(u,d)),!p)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=a),!a)return!0;var f=r.current||a;return function(e,t,n,r,a){var s=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),o=s*r,i=n.target,l=t.contains(i),c=!1,d=o>0,u=0,h=0;do{if(!i)break;var m=Gt(e,i),p=m[0],f=m[1]-m[2]-s*p;(p||f)&&Ut(e,i)&&(u+=f,h+=p);var g=i.parentNode;i=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&i!==document.body||l&&(t.contains(i)||t===i));return(d&&(a&&Math.abs(u)<1||!a&&o>u)||!d&&(a&&Math.abs(h)<1||!a&&-o>h))&&(c=!0),c}(f,t,e,"h"===f?l:c,!0)},[]),l=d.useCallback(function(e){var n=e;if(Jt.length&&Jt[Jt.length-1]===s){var r="deltaY"in n?Kt(n):Wt(n),a=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&function(e,t){return e[0]===t[0]&&e[1]===t[1]}(e.delta,r)})[0];if(a&&a.should)n.cancelable&&n.preventDefault();else if(!a){var l=(o.current.shards||[]).map(Yt).filter(Boolean).filter(function(e){return e.contains(n.target)});(l.length>0?i(n,l[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),c=d.useCallback(function(e,n,r,a){var s={name:e,delta:n,target:r,should:a,shadowParent:Qt(r)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),u=d.useCallback(function(e){n.current=Wt(e),r.current=void 0},[]),h=d.useCallback(function(t){c(t.type,Kt(t),t.target,i(t,e.lockRef.current))},[]),m=d.useCallback(function(t){c(t.type,Wt(t),t.target,i(t,e.lockRef.current))},[]);d.useEffect(function(){return Jt.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",l,Vt),document.addEventListener("touchmove",l,Vt),document.addEventListener("touchstart",u,Vt),function(){Jt=Jt.filter(function(e){return e!==s}),document.removeEventListener("wheel",l,Vt),document.removeEventListener("touchmove",l,Vt),document.removeEventListener("touchstart",u,Vt)}},[]);var p=e.removeScrollBar,f=e.inert;return d.createElement(d.Fragment,null,f?d.createElement(s,{styles:Xt(a)}):null,p?d.createElement(Ft,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Nt.useMedium(en),Ct),nn=d.forwardRef(function(e,t){return d.createElement(Mt,gt({},e,{ref:t,sideCar:tn}))});nn.classNames=Mt.classNames;var rn=Object.defineProperty,an=(e,t)=>rn(e,"name",{value:t,configurable:!0}),sn=["Enter"," "],on=["ArrowUp","PageDown","End"],ln=["ArrowDown","PageUp","Home",...on],cn={ltr:[...sn,"ArrowRight"],rtl:[...sn,"ArrowLeft"]},dn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},un="Menu",[hn,mn,pn]=i.createCollection(un),[fn,gn]=s.createContextScope(un,[pn,Pe,i.createRovingFocusGroupScope]),xn=Pe(),vn=i.createRovingFocusGroupScope(),[yn,bn]=fn(un),[wn,Sn]=fn(un),jn=an(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:o,modal:l=!0}=e,c=xn(t),[d,h]=u.useState(null),m=u.useRef(!1),f=s.useCallbackRef(o),g=i.useDirection(a);return u.useEffect(()=>{const e=an(()=>{m.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},"handleKeyDown"),t=an(()=>m.current=!1,"handlePointer");return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),u.useEffect(()=>{if(!n)return;const e=an(()=>f(!1),"handleBlur");return window.addEventListener("blur",e),()=>window.removeEventListener("blur",e)},[n,f]),(0,p.jsx)(Ke,{...c,children:(0,p.jsx)(yn,{scope:t,open:n,onOpenChange:f,content:d,onContentChange:h,children:(0,p.jsx)(wn,{scope:t,onClose:u.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:m,dir:g,modal:l,children:r})})})},"Menu"),kn=u.forwardRef(an(function(e,t){const{__scopeMenu:n,...r}=e,a=xn(n);return(0,p.jsx)(Ye,{...a,...r,ref:t})},"MenuAnchor")),Cn="MenuPortal",[Nn,Tn]=fn(Cn,{forceMount:void 0}),Mn=an(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,s=bn(Cn,t);return(0,p.jsx)(Nn,{scope:t,forceMount:n,children:(0,p.jsx)(rt,{present:n||s.open,children:(0,p.jsx)(Qe,{asChild:!0,container:a,children:r})})})},"MenuPortal"),En="MenuContent",[An,Rn]=fn(En),In=u.forwardRef(an(function(e,t){const n=Tn(En,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,s=bn(En,e.__scopeMenu),o=Sn(En,e.__scopeMenu);return(0,p.jsx)(hn.Provider,{scope:e.__scopeMenu,children:(0,p.jsx)(rt,{present:r||s.open,children:(0,p.jsx)(hn.Slot,{scope:e.__scopeMenu,children:o.modal?(0,p.jsx)(Dn,{...a,ref:t}):(0,p.jsx)(_n,{...a,ref:t})})})})},"MenuContent")),Dn=u.forwardRef(an(function(e,t){const n=bn(En,e.__scopeMenu),r=u.useRef(null),a=o.useComposedRefs(t,r);return u.useEffect(()=>{const e=r.current;if(e)return ft(e)},[]),(0,p.jsx)(Pn,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:i.composeEventHandlers(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},"MenuRootContentModal")),_n=u.forwardRef(an(function(e,t){const n=bn(En,e.__scopeMenu);return(0,p.jsx)(Pn,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},"MenuRootContentNonModal")),zn=(0,h.createSlot)("MenuContent.ScrollLock"),Pn=u.forwardRef(an(function(e,t){const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:g,onDismiss:x,disableOutsideScroll:v,...y}=e,b=bn(En,n),w=Sn(En,n),S=xn(n),j=vn(n),k=mn(n),[C,N]=u.useState(null),T=u.useRef(null),M=o.useComposedRefs(t,T,b.onContentChange),E=u.useRef(0),A=u.useRef(""),R=u.useRef(0),I=u.useRef(null),D=u.useRef("right"),_=u.useRef(0),z=v?nn:u.Fragment,P=v?{as:zn,allowPinchZoom:!0}:void 0,O=an(e=>{const t=A.current+e,n=k().filter(e=>!e.disabled),r=document.activeElement,a=n.find(e=>e.ref.current===r)?.textValue,s=cr(n.map(e=>e.textValue),t,a),o=n.find(e=>e.textValue===s)?.ref.current;an(function e(t){A.current=t,window.clearTimeout(E.current),""!==t&&(E.current=window.setTimeout(()=>e(""),1e3))},"updateSearch")(t),o&&setTimeout(()=>o.focus())},"handleTypeaheadSearch");u.useEffect(()=>()=>window.clearTimeout(E.current),[]),he();const L=u.useCallback(e=>D.current===I.current?.side&&ur(e,I.current?.area),[]);return(0,p.jsx)(An,{scope:n,searchRef:A,onItemEnter:u.useCallback(e=>{L(e)&&e.preventDefault()},[L]),onItemLeave:u.useCallback(e=>{L(e)||(T.current?.focus(),N(null))},[L]),onTriggerLeave:u.useCallback(e=>{L(e)&&e.preventDefault()},[L]),pointerGraceTimerRef:R,onPointerGraceIntentChange:u.useCallback(e=>{I.current=e},[]),children:(0,p.jsx)(z,{...P,children:(0,p.jsx)(ye,{asChild:!0,trapped:a,onMountAutoFocus:i.composeEventHandlers(s,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:(0,p.jsx)(ne,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:g,onDismiss:x,children:(0,p.jsx)(i.Root,{asChild:!0,...j,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:N,onEntryFocus:i.composeEventHandlers(d,e=>{w.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,p.jsx)(Xe,{role:"menu","aria-orientation":"vertical","data-state":ar(b.open),"data-radix-menu-content":"",dir:w.dir,...S,...y,ref:M,style:{outline:"none",...y.style},onKeyDown:i.composeEventHandlers(y.onKeyDown,e=>{const t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!n&&r&&O(e.key));const a=T.current;if(e.target!==a)return;if(!ln.includes(e.key))return;e.preventDefault();const s=k().filter(e=>!e.disabled).map(e=>e.ref.current);on.includes(e.key)&&s.reverse(),ir(s)}),onBlur:i.composeEventHandlers(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),A.current="")}),onPointerMove:i.composeEventHandlers(e.onPointerMove,hr(e=>{const t=e.target,n=_.current!==e.clientX;if(e.currentTarget.contains(t)&&n){const t=e.clientX>_.current?"right":"left";D.current=t,_.current=e.clientX}}))})})})})})})},"MenuContentImpl")),On=u.forwardRef(an(function(e,t){const{__scopeMenu:n,...r}=e;return(0,p.jsx)(s.Primitive.div,{...r,ref:t})},"MenuLabel")),Ln="MenuItem",Fn="menu.itemSelect",Bn=u.forwardRef(an(function(e,t){const{disabled:n=!1,onSelect:r,...a}=e,l=u.useRef(null),c=Sn(Ln,e.__scopeMenu),d=Rn(Ln,e.__scopeMenu),h=o.useComposedRefs(t,l),m=u.useRef(!1),f=an(()=>{const e=l.current;if(!n&&e){const t=new CustomEvent(Fn,{bubbles:!0,cancelable:!0});e.addEventListener(Fn,e=>r?.(e),{once:!0}),s.dispatchDiscreteCustomEvent(e,t),t.defaultPrevented?m.current=!1:c.onClose()}},"handleSelect");return(0,p.jsx)(Hn,{...a,ref:h,disabled:n,onClick:i.composeEventHandlers(e.onClick,f),onPointerDown:t=>{e.onPointerDown?.(t),m.current=!0},onPointerUp:i.composeEventHandlers(e.onPointerUp,e=>{m.current||e.currentTarget?.click()}),onKeyDown:i.composeEventHandlers(e.onKeyDown,e=>{n||e.target!==e.currentTarget||""!==d.searchRef.current&&" "===e.key||sn.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},"MenuItem")),Hn=u.forwardRef(an(function(e,t){const{__scopeMenu:n,disabled:r=!1,textValue:a,...l}=e,c=Rn(Ln,n),d=vn(n),h=u.useRef(null),m=o.useComposedRefs(t,h),[f,g]=u.useState(!1),[x,v]=u.useState("");return u.useEffect(()=>{const e=h.current;e&&v((e.textContent??"").trim())},[l.children]),(0,p.jsx)(hn.ItemSlot,{scope:n,disabled:r,textValue:a??x,children:(0,p.jsx)(i.Item,{asChild:!0,...d,focusable:!r,children:(0,p.jsx)(s.Primitive.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...l,ref:m,onPointerMove:i.composeEventHandlers(e.onPointerMove,hr(e=>{r?c.onItemLeave(e):(c.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:i.composeEventHandlers(e.onPointerLeave,hr(e=>c.onItemLeave(e))),onFocus:i.composeEventHandlers(e.onFocus,()=>g(!0)),onBlur:i.composeEventHandlers(e.onBlur,()=>g(!1))})})})},"MenuItemImpl")),Vn=u.forwardRef(an(function(e,t){const{checked:n=!1,onCheckedChange:r,...a}=e;return(0,p.jsx)(Wn,{scope:e.__scopeMenu,checked:n,children:(0,p.jsx)(Bn,{role:"menuitemcheckbox","aria-checked":sr(n)?"mixed":n,...a,ref:t,"data-state":or(n),onSelect:i.composeEventHandlers(a.onSelect,()=>r?.(!!sr(n)||!n),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),[$n,qn]=fn("MenuRadioGroup",{value:void 0,onValueChange:an(()=>{},"onValueChange")}),Un=u.forwardRef(an(function(e,t){const{value:n,...r}=e,a=qn("MenuRadioItem",e.__scopeMenu),s=n===a.value;return(0,p.jsx)(Wn,{scope:e.__scopeMenu,checked:s,children:(0,p.jsx)(Bn,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":or(s),onSelect:i.composeEventHandlers(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),Gn="MenuItemIndicator",[Wn,Kn]=fn(Gn,{checked:!1}),Yn=u.forwardRef(an(function(e,t){const{__scopeMenu:n,forceMount:r,...a}=e,o=Kn(Gn,n);return(0,p.jsx)(rt,{present:r||sr(o.checked)||!0===o.checked,children:(0,p.jsx)(s.Primitive.span,{...a,ref:t,"data-state":or(o.checked)})})},"MenuItemIndicator")),Xn=u.forwardRef(an(function(e,t){const{__scopeMenu:n,...r}=e;return(0,p.jsx)(s.Primitive.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})},"MenuSeparator")),Zn="MenuSub",[Jn,Qn]=fn(Zn),er=an(e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:a}=e,i=bn(Zn,t),l=xn(t),[c,d]=u.useState(null),[h,m]=u.useState(null),f=s.useCallbackRef(a);return u.useEffect(()=>(!1===i.open&&f(!1),()=>f(!1)),[i.open,f]),(0,p.jsx)(Ke,{...l,children:(0,p.jsx)(yn,{scope:t,open:r,onOpenChange:f,content:h,onContentChange:m,children:(0,p.jsx)(Jn,{scope:t,contentId:o.useId(),triggerId:o.useId(),trigger:c,onTriggerChange:d,children:n})})})},"MenuSub"),tr="MenuSubTrigger",nr=u.forwardRef(an(function(e,t){const n=bn(tr,e.__scopeMenu),r=Sn(tr,e.__scopeMenu),a=Qn(tr,e.__scopeMenu),s=Rn(tr,e.__scopeMenu),l=u.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=s,h={__scopeMenu:e.__scopeMenu},m=u.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);u.useEffect(()=>m,[m]),u.useEffect(()=>{const e=c.current;return()=>{window.clearTimeout(e),d(null)}},[c,d]);const f=o.useComposedRefs(t,a.onTriggerChange);return(0,p.jsx)(kn,{asChild:!0,...h,children:(0,p.jsx)(Hn,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":ar(n.open),...e,ref:f,onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:i.composeEventHandlers(e.onPointerMove,hr(t=>{s.onItemEnter(t),t.defaultPrevented||e.disabled||n.open||l.current||(s.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:i.composeEventHandlers(e.onPointerLeave,hr(e=>{m();const t=n.content?.getBoundingClientRect();if(t){const r=n.content?.dataset.side,a="right"===r,o=a?-5:5,i=t[a?"left":"right"],l=t[a?"right":"left"];s.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:i,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:i,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(e),e.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:i.composeEventHandlers(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||""!==s.searchRef.current&&" "===t.key||cn[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})},"MenuSubTrigger")),rr=u.forwardRef(an(function(e,t){const n=Tn(En,e.__scopeMenu),{forceMount:r=n.forceMount,align:a="start",...s}=e,l=bn(En,e.__scopeMenu),c=Sn(En,e.__scopeMenu),d=Qn("MenuSubContent",e.__scopeMenu),h=u.useRef(null),m=o.useComposedRefs(t,h);return(0,p.jsx)(hn.Provider,{scope:e.__scopeMenu,children:(0,p.jsx)(rt,{present:r||l.open,children:(0,p.jsx)(hn.Slot,{scope:e.__scopeMenu,children:(0,p.jsx)(Pn,{id:d.contentId,"aria-labelledby":d.triggerId,...s,ref:m,align:a,side:"rtl"===c.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&h.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:i.composeEventHandlers(e.onFocusOutside,e=>{e.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:i.composeEventHandlers(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:i.composeEventHandlers(e.onKeyDown,e=>{const t=e.currentTarget.contains(e.target),n=dn[c.dir].includes(e.key);t&&n&&(l.onOpenChange(!1),d.trigger?.focus(),e.preventDefault())})})})})})},"MenuSubContent"));function ar(e){return e?"open":"closed"}function sr(e){return"indeterminate"===e}function or(e){return sr(e)?"indeterminate":e?"checked":"unchecked"}function ir(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}function lr(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function cr(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let s=lr(e,Math.max(a,0));1===r.length&&(s=s.filter(e=>e!==n));const o=s.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o!==n?o:void 0}function dr(e,t){const{x:n,y:r}=e;let a=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const e=t[s],i=t[o],l=e.x,c=e.y,d=i.x,u=i.y;c>r!=u>r&&n<(d-l)*(r-c)/(u-c)+l&&(a=!a)}return a}function ur(e,t){return!!t&&dr({x:e.clientX,y:e.clientY},t)}function hr(e){return t=>"mouse"===t.pointerType?e(t):void 0}an(ar,"getOpenState"),an(sr,"isIndeterminate"),an(or,"getCheckedState"),an(ir,"focusFirst"),an(lr,"wrapArray"),an(cr,"getNextMatch"),an(dr,"isPointInPolygon"),an(ur,"isPointerInGraceArea"),an(hr,"whenMouse");var mr=jn,pr=kn,fr=Mn,gr=In,xr=On,vr=Bn,yr=Vn,br=Un,wr=Yn,Sr=Xn,jr=er,kr=nr,Cr=rr,Nr=Object.defineProperty,Tr=(e,t)=>Nr(e,"name",{value:t,configurable:!0}),Mr="ContextMenu",[Er,Ar]=s.createContextScope(Mr,[gn]),Rr=gn(),[Ir,Dr]=Er(Mr),_r=Tr(e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,open:a,dir:s,modal:o=!0}=e,l=u.useRef(!1);const[c,d]=i.useControllableState({prop:a,defaultProp:!1,onChange:r,caller:Mr}),h=Rr(t);return(0,p.jsx)(Ir,{scope:t,open:c,onOpenChange:d,modal:o,hasInteractedRef:l,children:(0,p.jsx)(mr,{...h,dir:s,open:c,onOpenChange:d,modal:o,children:n})})},"ContextMenu"),zr=u.forwardRef(Tr(function(e,t){const{__scopeContextMenu:n,disabled:r=!1,...a}=e,o=Dr("ContextMenuTrigger",n),l=Rr(n),[c,d]=u.useState({x:0,y:0}),h=u.useMemo(()=>({current:{getBoundingClientRect:Tr(()=>DOMRect.fromRect({width:0,height:0,...c}),"getBoundingClientRect")}}),[c]),m=u.useRef(0),f=u.useCallback(()=>window.clearTimeout(m.current),[]),g=Tr(e=>{o.hasInteractedRef.current=!0,d({x:e.clientX,y:e.clientY}),o.onOpenChange(!0)},"handleOpen");return u.useEffect(()=>f,[f]),u.useEffect(()=>{r&&f()},[r,f]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(pr,{...l,virtualRef:h}),(0,p.jsx)(s.Primitive.span,{"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,...a,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:i.composeEventHandlers(e.onContextMenu,e=>{f(),g(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:i.composeEventHandlers(e.onPointerDown,Wr(e=>{f(),o.open&&o.onOpenChange(!1),m.current=window.setTimeout(()=>g(e),700)})),onPointerMove:r?e.onPointerMove:i.composeEventHandlers(e.onPointerMove,Wr(f)),onPointerCancel:r?e.onPointerCancel:i.composeEventHandlers(e.onPointerCancel,Wr(f)),onPointerUp:r?e.onPointerUp:i.composeEventHandlers(e.onPointerUp,Wr(f))})]})},"ContextMenuTrigger")),Pr=Tr(e=>{const{__scopeContextMenu:t,...n}=e,r=Rr(t);return(0,p.jsx)(fr,{...r,...n})},"ContextMenuPortal"),Or=u.forwardRef(Tr(function(e,t){const{__scopeContextMenu:n,...r}=e,a=Dr("ContextMenuContent",n),s=Rr(n),o=u.useRef(!1);return(0,p.jsx)(gr,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||a.modal||(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"ContextMenuContent")),Lr=u.forwardRef(Tr(function(e,t){const{__scopeContextMenu:n,...r}=e,a=Rr(n);return(0,p.jsx)(xr,{...a,...r,ref:t})},"ContextMenuLabel")),Fr=u.forwardRef(Tr(function(e,t){const{__scopeContextMenu:n,...r}=e,a=Rr(n);return(0,p.jsx)(vr,{...a,...r,ref:t})},"ContextMenuItem")),Br=u.forwardRef(Tr(function(e,t){const{__scopeContextMenu:n,...r}=e,a=Rr(n);return(0,p.jsx)(yr,{...a,...r,ref:t})},"ContextMenuCheckboxItem")),Hr=u.forwardRef(Tr(function(e,t){const{__scopeContextMenu:n,...r}=e,a=Rr(n);return(0,p.jsx)(br,{...a,...r,ref:t})},"ContextMenuRadioItem")),Vr=u.forwardRef(Tr(function(e,t){const{__scopeContextMenu:n,...r}=e,a=Rr(n);return(0,p.jsx)(wr,{...a,...r,ref:t})},"ContextMenuItemIndicator")),$r=u.forwardRef(Tr(function(e,t){const{__scopeContextMenu:n,...r}=e,a=Rr(n);return(0,p.jsx)(Sr,{...a,...r,ref:t})},"ContextMenuSeparator")),qr=Tr(e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,open:a,defaultOpen:s}=e,o=Rr(t),[l,c]=i.useControllableState({prop:a,defaultProp:s??!1,onChange:r,caller:"ContextMenuSub"});return(0,p.jsx)(jr,{...o,open:l,onOpenChange:c,children:n})},"ContextMenuSub"),Ur=u.forwardRef(Tr(function(e,t){const{__scopeContextMenu:n,...r}=e,a=Rr(n);return(0,p.jsx)(kr,{...a,...r,ref:t})},"ContextMenuSubTrigger")),Gr=u.forwardRef(Tr(function(e,t){const{__scopeContextMenu:n,...r}=e,a=Rr(n);return(0,p.jsx)(Cr,{...a,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"ContextMenuSubContent"));function Wr(e){return t=>"mouse"!==t.pointerType?e(t):void 0}Tr(Wr,"whenTouchOrPen");var Kr=_r,Yr=zr,Xr=Pr,Zr=Or,Jr=Lr,Qr=Fr,ea=Br,ta=Hr,na=Vr,ra=$r,aa=qr,sa=Ur,oa=Gr,ia=e.__commonJSMin(e=>{var t="function"==typeof Symbol&&Symbol.for,n=t?Symbol.for("react.element"):60103,r=t?Symbol.for("react.portal"):60106,a=t?Symbol.for("react.fragment"):60107,s=t?Symbol.for("react.strict_mode"):60108,o=t?Symbol.for("react.profiler"):60114,i=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,d=t?Symbol.for("react.concurrent_mode"):60111,u=t?Symbol.for("react.forward_ref"):60112,h=t?Symbol.for("react.suspense"):60113,m=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,f=t?Symbol.for("react.lazy"):60116,g=t?Symbol.for("react.block"):60121,x=t?Symbol.for("react.fundamental"):60117,v=t?Symbol.for("react.responder"):60118,y=t?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case c:case d:case a:case o:case s:case h:return e;default:switch(e=e&&e.$$typeof){case l:case u:case f:case p:case i:return e;default:return t}}case r:return t}}}function w(e){return b(e)===d}e.AsyncMode=c,e.ConcurrentMode=d,e.ContextConsumer=l,e.ContextProvider=i,e.Element=n,e.ForwardRef=u,e.Fragment=a,e.Lazy=f,e.Memo=p,e.Portal=r,e.Profiler=o,e.StrictMode=s,e.Suspense=h,e.isAsyncMode=function(e){return w(e)||b(e)===c},e.isConcurrentMode=w,e.isContextConsumer=function(e){return b(e)===l},e.isContextProvider=function(e){return b(e)===i},e.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===u},e.isFragment=function(e){return b(e)===a},e.isLazy=function(e){return b(e)===f},e.isMemo=function(e){return b(e)===p},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===s},e.isSuspense=function(e){return b(e)===h},e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===o||e===s||e===h||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===i||e.$$typeof===l||e.$$typeof===u||e.$$typeof===x||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b}),la=e.__commonJSMin(e=>{"production"!==process.env.NODE_ENV&&function(){"use strict";var t="function"==typeof Symbol&&Symbol.for,n=t?Symbol.for("react.element"):60103,r=t?Symbol.for("react.portal"):60106,a=t?Symbol.for("react.fragment"):60107,s=t?Symbol.for("react.strict_mode"):60108,o=t?Symbol.for("react.profiler"):60114,i=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,d=t?Symbol.for("react.concurrent_mode"):60111,u=t?Symbol.for("react.forward_ref"):60112,h=t?Symbol.for("react.suspense"):60113,m=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,f=t?Symbol.for("react.lazy"):60116,g=t?Symbol.for("react.block"):60121,x=t?Symbol.for("react.fundamental"):60117,v=t?Symbol.for("react.responder"):60118,y=t?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var m=e.type;switch(m){case c:case d:case a:case o:case s:case h:return m;default:var g=m&&m.$$typeof;switch(g){case l:case u:case f:case p:case i:return g;default:return t}}case r:return t}}}var w=c,S=d,j=l,k=i,C=n,N=u,T=a,M=f,E=p,A=r,R=o,I=s,D=h,_=!1;function z(e){return b(e)===d}e.AsyncMode=w,e.ConcurrentMode=S,e.ContextConsumer=j,e.ContextProvider=k,e.Element=C,e.ForwardRef=N,e.Fragment=T,e.Lazy=M,e.Memo=E,e.Portal=A,e.Profiler=R,e.StrictMode=I,e.Suspense=D,e.isAsyncMode=function(e){return _||(_=!0),z(e)||b(e)===c},e.isConcurrentMode=z,e.isContextConsumer=function(e){return b(e)===l},e.isContextProvider=function(e){return b(e)===i},e.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===u},e.isFragment=function(e){return b(e)===a},e.isLazy=function(e){return b(e)===f},e.isMemo=function(e){return b(e)===p},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===s},e.isSuspense=function(e){return b(e)===h},e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===o||e===s||e===h||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===i||e.$$typeof===l||e.$$typeof===u||e.$$typeof===x||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b}()}),ca=e.__commonJSMin((e,t)=>{"production"===process.env.NODE_ENV?t.exports=ia():t.exports=la()}),da=e.__commonJSMin((e,t)=>{var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(bE){return!1}}()?Object.assign:function(e,t){for(var s,o,i=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l<arguments.length;l++){for(var c in s=Object(arguments[l]))r.call(s,c)&&(i[c]=s[c]);if(n){o=n(s);for(var d=0;d<o.length;d++)a.call(s,o[d])&&(i[o[d]]=s[o[d]])}}return i}}),ua=e.__commonJSMin((e,t)=>{t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}),ha=e.__commonJSMin((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)}),ma=e.__commonJSMin((e,t)=>{var n=function(){};if("production"!==process.env.NODE_ENV){var r=ua(),a={},s=ha();n=function(e){var t="Warning: "+e;try{throw new Error(t)}catch(zy){}}}function o(e,t,o,i,l){if("production"!==process.env.NODE_ENV)for(var c in e)if(s(e,c)){var d;try{if("function"!=typeof e[c]){var u=Error((i||"React class")+": "+o+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}d=e[c](t,c,i,o,null,r)}catch(m){d=m}if(!d||d instanceof Error||n((i||"React class")+": type specification of "+o+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in a)){a[d.message]=!0;var h=l?l():"";n("Failed "+o+" type: "+d.message+(null!=h?h:""))}}}o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(a={})},t.exports=o}),pa=e.__commonJSMin((e,t)=>{var n=ca(),r=da(),a=ua(),s=ha(),o=ma(),i=function(){};function l(){return null}"production"!==process.env.NODE_ENV&&(i=function(e){var t="Warning: "+e;try{throw new Error(t)}catch(zy){}}),t.exports=function(e,t){var c="function"==typeof Symbol&&Symbol.iterator;var d="<<anonymous>>",u={array:f("array"),bigint:f("bigint"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:p(l),arrayOf:function(e){return p(function(t,n,r,s,o){if("function"!=typeof e)return new m("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var i=t[n];if(!Array.isArray(i))return new m("Invalid "+s+" `"+o+"` of type `"+v(i)+"` supplied to `"+r+"`, expected an array.");for(var l=0;l<i.length;l++){var c=e(i,l,r,s,o+"["+l+"]",a);if(c instanceof Error)return c}return null})},element:p(function(t,n,r,a,s){var o=t[n];return e(o)?null:new m("Invalid "+a+" `"+s+"` of type `"+v(o)+"` supplied to `"+r+"`, expected a single ReactElement.")}),elementType:p(function(e,t,r,a,s){var o=e[t];return n.isValidElementType(o)?null:new m("Invalid "+a+" `"+s+"` of type `"+v(o)+"` supplied to `"+r+"`, expected a single ReactElement type.")}),instanceOf:function(e){return p(function(t,n,r,a,s){if(!(t[n]instanceof e)){var o=e.name||d;return new m("Invalid "+a+" `"+s+"` of type `"+((i=t[n]).constructor&&i.constructor.name?i.constructor.name:d)+"` supplied to `"+r+"`, expected instance of `"+o+"`.")}var i;return null})},node:p(function(e,t,n,r,a){return x(e[t])?null:new m("Invalid "+r+" `"+a+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return p(function(t,n,r,o,i){if("function"!=typeof e)return new m("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var l=t[n],c=v(l);if("object"!==c)return new m("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+r+"`, expected an object.");for(var d in l)if(s(l,d)){var u=e(l,d,r,o,i+"."+d,a);if(u instanceof Error)return u}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),l;return p(function(t,n,r,a,s){for(var o=t[n],i=0;i<e.length;i++)if(h(o,e[i]))return null;var l=JSON.stringify(e,function(e,t){return"symbol"===y(t)?String(t):t});return new m("Invalid "+a+" `"+s+"` of value `"+String(o)+"` supplied to `"+r+"`, expected one of "+l+".")})},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i("Invalid argument supplied to oneOfType, expected an instance of array."),l;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+b(n)+" at index "+t+"."),l}return p(function(t,n,r,o,i){for(var l=[],c=0;c<e.length;c++){var d=(0,e[c])(t,n,r,o,i,a);if(null==d)return null;d.data&&s(d.data,"expectedType")&&l.push(d.data.expectedType)}return new m("Invalid "+o+" `"+i+"` supplied to `"+r+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return p(function(t,n,r,s,o){var i=t[n],l=v(i);if("object"!==l)return new m("Invalid "+s+" `"+o+"` of type `"+l+"` supplied to `"+r+"`, expected `object`.");for(var c in e){var d=e[c];if("function"!=typeof d)return g(r,s,o,c,y(d));var u=d(i,c,r,s,o+"."+c,a);if(u)return u}return null})},exact:function(e){return p(function(t,n,o,i,l){var c=t[n],d=v(c);if("object"!==d)return new m("Invalid "+i+" `"+l+"` of type `"+d+"` supplied to `"+o+"`, expected `object`.");for(var u in r({},t[n],e)){var h=e[u];if(s(e,u)&&"function"!=typeof h)return g(o,i,l,u,y(h));if(!h)return new m("Invalid "+i+" `"+l+"` key `"+u+"` supplied to `"+o+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var p=h(c,u,o,i,l+"."+u,a);if(p)return p}return null})}};function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function m(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function p(e){if("production"!==process.env.NODE_ENV)var n={},r=0;function s(s,o,l,c,u,h,p){if(c=c||d,h=h||l,p!==a){if(t){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var g=c+":"+l;!n[g]&&r<3&&(i("You are manually calling a React.PropTypes validation function for the `"+h+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[g]=!0,r++)}}return null==o[l]?s?null===o[l]?new m("The "+u+" `"+h+"` is marked as required in `"+c+"`, but its value is `null`."):new m("The "+u+" `"+h+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(o,l,c,u,h)}var o=s.bind(null,!1);return o.isRequired=s.bind(null,!0),o}function f(e){return p(function(t,n,r,a,s,o){var i=t[n];return v(i)!==e?new m("Invalid "+a+" `"+s+"` of type `"+y(i)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null})}function g(e,t,n,r,a){return new m((e||"React class")+": "+t+" type `"+n+"."+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+a+"`.")}function x(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(x);if(null===t||e(t))return!0;var n=function(e){var t=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!n)return!1;var r,a=n.call(t);if(n!==t.entries){for(;!(r=a.next()).done;)if(!x(r.value))return!1}else for(;!(r=a.next()).done;){var s=r.value;if(s&&!x(s[1]))return!1}return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function y(e){if(null==e)return""+e;var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function b(e){var t=y(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return m.prototype=Error.prototype,u.checkPropTypes=o,u.resetWarningCache=o.resetWarningCache,u.PropTypes=u,u}}),fa=e.__commonJSMin((e,t)=>{var n=ua();function r(){}function a(){}a.resetWarningCache=r,t.exports=function(){function e(e,t,r,a,s,o){if(o!==n){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var s={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:r};return s.PropTypes=s,s}}),ga=e.__commonJSMin((e,t)=>{if("production"!==process.env.NODE_ENV){var n=ca();t.exports=pa()(n.isElement,!0)}else t.exports=fa()()}),xa=e.__toESM(ga()),va={grad:.9,turn:360,rad:360/(2*Math.PI)},ya=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},ba=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},wa=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},Sa=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},ja=function(e){return{r:wa(e.r,0,255),g:wa(e.g,0,255),b:wa(e.b,0,255),a:wa(e.a)}},ka=function(e){return{r:ba(e.r),g:ba(e.g),b:ba(e.b),a:ba(e.a,3)}},Ca=/^#([0-9a-f]{3,8})$/i,Na=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Ta=function(e){var t=e.r,n=e.g,r=e.b,a=e.a,s=Math.max(t,n,r),o=s-Math.min(t,n,r),i=o?s===t?(n-r)/o:s===n?2+(r-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:s?o/s*100:0,v:s/255*100,a:a}},Ma=function(e){var t=e.h,n=e.s,r=e.v,a=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),o=r*(1-n),i=r*(1-(t-s)*n),l=r*(1-(1-t+s)*n),c=s%6;return{r:255*[r,i,o,o,l,r][c],g:255*[l,r,r,i,o,o][c],b:255*[o,o,l,r,r,i][c],a:a}},Ea=function(e){return{h:Sa(e.h),s:wa(e.s,0,100),l:wa(e.l,0,100),a:wa(e.a)}},Aa=function(e){return{h:ba(e.h),s:ba(e.s),l:ba(e.l),a:ba(e.a,3)}},Ra=function(e){return Ma((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},Ia=function(e){return{h:(t=Ta(e)).h,s:(a=(200-(n=t.s))*(r=t.v)/100)>0&&a<200?n*r/100/(a<=100?a:200-a)*100:0,l:a/2,a:t.a};var t,n,r,a},Da=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_a=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,za=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pa=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Oa={string:[[function(e){var t=Ca.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?ba(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?ba(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=za.exec(e)||Pa.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:ja({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t,n,r=Da.exec(e)||_a.exec(e);return r?Ra(Ea({h:(t=r[1],n=r[2],void 0===n&&(n="deg"),Number(t)*(va[n]||1)),s:Number(r[3]),l:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?100:1)})):null},"hsl"]],object:[[function(e){var t=e.r,n=e.g,r=e.b,a=e.a,s=void 0===a?1:a;return ya(t)&&ya(n)&&ya(r)?ja({r:Number(t),g:Number(n),b:Number(r),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,n=e.s,r=e.l,a=e.a,s=void 0===a?1:a;return ya(t)&&ya(n)&&ya(r)?Ra(Ea({h:Number(t),s:Number(n),l:Number(r),a:Number(s)})):null},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,a=e.a,s=void 0===a?1:a;return ya(t)&&ya(n)&&ya(r)?Ma(function(e){return{h:Sa(e.h),s:wa(e.s,0,100),v:wa(e.v,0,100),a:wa(e.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(s)})):null},"hsv"]]},La=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},Fa=function(e,t){var n=Ia(e);return{h:n.h,s:wa(n.s+100*t,0,100),l:n.l,a:n.a}},Ba=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Ha=function(e,t){var n=Ia(e);return{h:n.h,s:n.s,l:wa(n.l+100*t,0,100),a:n.a}},Va=function(){function e(e){this.parsed=function(e){return"string"==typeof e?La(e.trim(),Oa.string):"object"==typeof e&&null!==e?La(e,Oa.object):[null,void 0]}(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return ba(Ba(this.rgba),2)},e.prototype.isDark=function(){return Ba(this.rgba)<.5},e.prototype.isLight=function(){return Ba(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=ka(this.rgba)).r,n=e.g,r=e.b,s=(a=e.a)<1?Na(ba(255*a)):"","#"+Na(t)+Na(n)+Na(r)+s;var e,t,n,r,a,s},e.prototype.toRgb=function(){return ka(this.rgba)},e.prototype.toRgbString=function(){return t=(e=ka(this.rgba)).r,n=e.g,r=e.b,(a=e.a)<1?"rgba("+t+", "+n+", "+r+", "+a+")":"rgb("+t+", "+n+", "+r+")";var e,t,n,r,a},e.prototype.toHsl=function(){return Aa(Ia(this.rgba))},e.prototype.toHslString=function(){return t=(e=Aa(Ia(this.rgba))).h,n=e.s,r=e.l,(a=e.a)<1?"hsla("+t+", "+n+"%, "+r+"%, "+a+")":"hsl("+t+", "+n+"%, "+r+"%)";var e,t,n,r,a},e.prototype.toHsv=function(){return e=Ta(this.rgba),{h:ba(e.h),s:ba(e.s),v:ba(e.v),a:ba(e.a,3)};var e},e.prototype.invert=function(){return $a({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),$a(Fa(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),$a(Fa(this.rgba,-e))},e.prototype.grayscale=function(){return $a(Fa(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),$a(Ha(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),$a(Ha(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?$a({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):ba(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=Ia(this.rgba);return"number"==typeof e?$a({h:e,s:t.s,l:t.l,a:t.a}):ba(t.h)},e.prototype.isEqual=function(e){return this.toHex()===$a(e).toHex()},e}(),$a=function(e){return e instanceof Va?e:new Va(e)},qa=[];var Ua={"3d":d.default.createElement("path",{d:"M18 14.625V3.375L9 0 0 3.375v11.25L9 18l9-3.375zM9 2.136l5.918 2.22-5.98 2.242-5.919-2.22L9 2.137zM2 13.239V5.065l6.438 2.414v8.174L2 13.24zM9.438 15.7L16 13.239V5.018l-6.563 2.46V15.7z",transform:"translate(15 10)",fillRule:"evenodd"}),acrobat:d.default.createElement("path",{d:"M10.15 1.095C9.938.33 9.42-.051 8.984.005c-.528.068-1.09.382-1.314.876-.63 1.416.685 5.582.887 6.279-1.28 3.863-5.66 11.5-7.806 12.017-.045-.505.225-1.965 3.055-3.785.146-.157.315-.348.393-.472-2.392 1.168-5.492 3.044-3.628 4.448.102.079.259.146.439.213 1.426.528 3.425-1.201 5.435-5.121 2.213-.73 3.999-1.28 6.526-1.662 2.762 1.875 4.616 2.257 5.874 1.774.348-.135.898-.573 1.055-1.145-1.022 1.258-3.414.382-5.323-.82 1.763-.191 3.582-.303 4.369-.056 1 .314.965.808.954.876.079-.27.191-.708-.022-1.056-.842-1.37-4.706-.573-6.11-.427-2.212-1.336-3.74-3.717-4.358-5.436.573-2.212 1.19-3.818.742-5.413zm-.954 4.638C8.826 4.42 8.309 1.5 9.14.556c1.628.932.618 3.144.056 5.177zm3.044 6.514c-2.134.393-3.583.944-5.66 1.764.617-1.202 1.785-4.268 2.346-6.29.787 1.573 1.741 3.111 3.314 4.526z",transform:"translate(14 9)",fillRule:"evenodd"}),android:d.default.createElement("path",{d:"M17.6,9.48l1.84-3.18c0.16-0.31,0.04-0.69-0.26-0.85c-0.29-0.15-0.65-0.06-0.83,0.22l-1.88,3.24 c-2.86-1.21-6.08-1.21-8.94,0L5.65,5.67c-0.19-0.29-0.58-0.38-0.87-0.2C4.5,5.65,4.41,6.01,4.56,6.3L6.4,9.48 C3.3,11.25,1.28,14.44,1,18h22C22.72,14.44,20.7,11.25,17.6,9.48z M7,15.25c-0.69,0-1.25-0.56-1.25-1.25 c0-0.69,0.56-1.25,1.25-1.25S8.25,13.31,8.25,14C8.25,14.69,7.69,15.25,7,15.25z M17,15.25c-0.69,0-1.25-0.56-1.25-1.25 c0-0.69,0.56-1.25,1.25-1.25s1.25,0.56,1.25,1.25C18.25,14.69,17.69,15.25,17,15.25z",transform:"translate(12 8)"}),audio:d.default.createElement("path",{d:"M.25 4.75v4.5h3L7 13V1L3.25 4.75h-3zM10.375 7A3.375 3.375 0 0 0 8.5 3.977v6.037A3.355 3.355 0 0 0 10.375 7zM8.5.421v1.545A5.254 5.254 0 0 1 12.25 7a5.254 5.254 0 0 1-3.75 5.032v1.545A6.747 6.747 0 0 0 13.75 7 6.747 6.747 0 0 0 8.5.421z",transform:"translate(17 12)",fillRule:"evenodd"}),binary:d.default.createElement("path",{d:"M2.338 6.112c1.192 0 1.928-1.072 1.928-2.68 0-1.56-.576-2.504-1.8-2.504C1.274.928.538 2 .538 3.608c0 1.56.576 2.504 1.8 2.504zM1.61 3.408c0-1.008.24-1.568.776-1.568.376 0 .616.336.728.888l-1.504.776v-.096zM2.418 5.2c-.368 0-.608-.32-.72-.856l1.496-.768v.056c0 1.008-.24 1.568-.776 1.568zm7.03.8l.088-.944H8.36V.896L7.272.984v.592l-1.184.112.024.824h1.16v2.544h-1.32V6zm5.199 0l.088-.944h-1.176V.896L12.47.984v.592l-1.184.112.024.824h1.16v2.544h-1.32V6zM4.25 14l.088-.944H3.162v-4.16l-1.088.088v.592L.89 9.688l.024.824h1.16v2.544H.754V14zm5.198 0l.088-.944H8.36v-4.16l-1.088.088v.592l-1.184.112.024.824h1.16v2.544h-1.32V14zm3.287.112c1.192 0 1.928-1.072 1.928-2.68 0-1.56-.576-2.504-1.8-2.504-1.192 0-1.928 1.072-1.928 2.68 0 1.56.576 2.504 1.8 2.504zm-.728-2.704c0-1.008.24-1.568.776-1.568.376 0 .616.336.728.888l-1.504.776v-.096zm.808 1.792c-.368 0-.608-.32-.72-.856l1.496-.768v.056c0 1.008-.24 1.568-.776 1.568z",transform:"translate(16 11)",fillRule:"evenodd"}),code:d.default.createElement("path",{d:"M4.078 13.67c-1.875-.527-2.812-1.738-2.812-3.634V9.49C1.266 8.437.844 7.911 0 7.911V6.138c.844 0 1.266-.529 1.266-1.586v-.64c.015-.938.257-1.696.726-2.274C2.466 1.06 3.162.64 4.078.38l.492 1.375c-.656.25-.997.95-1.023 2.102v.695c0 1.167-.482 1.99-1.445 2.469.963.479 1.445 1.304 1.445 2.476v.688c.026 1.15.367 1.851 1.023 2.101l-.492 1.383zm7.844 0c1.875-.527 2.812-1.738 2.812-3.634V9.49c0-1.052.422-1.578 1.266-1.578V6.138c-.844 0-1.266-.529-1.266-1.586v-.64c-.015-.938-.257-1.696-.726-2.274-.474-.578-1.17-.998-2.086-1.258l-.492 1.375c.656.25.997.95 1.023 2.102v.695c0 1.167.482 1.99 1.445 2.469-.963.479-1.445 1.304-1.445 2.476v.688c-.026 1.15-.367 1.851-1.023 2.101l.492 1.383z",transform:"translate(16 13)",fillRule:"evenodd"}),code2:d.default.createElement("path",{d:"M7.4 10.6L2.8 6l4.6-4.6L6 0 0 6l6 6 1.4-1.4zm5.2 0L17.2 6l-4.6-4.6L14 0l6 6-6 6-1.4-1.4z",transform:"translate(14 14)",fillRule:"evenodd"}),compressed:d.default.createElement("path",{d:"M.25 0A.25.25 0 0 0 0 .25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 1.75V.25A.25.25 0 0 0 1.75 0H.25zM1 17a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1H1zm0 4v3h2v-3H1zM2 2.25A.25.25 0 0 1 2.25 2h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 3.75v-1.5zM.25 4a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 5.75v-1.5A.25.25 0 0 0 1.75 4H.25zM2 6.25A.25.25 0 0 1 2.25 6h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 7.75v-1.5zM.25 8a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 9.75v-1.5A.25.25 0 0 0 1.75 8H.25zM2 10.25a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5zM.25 12a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25v-1.5a.25.25 0 0 0-.25-.25H.25zM2 14.25a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5z",transform:"translate(15 1)",fillRule:"evenodd"}),document:d.default.createElement("path",{d:"M12 4H0v2h12V4zM0 10h18V8H0v2zM0 0v2h18V0H0z",transform:"translate(15 15)",fillRule:"evenodd"}),drive:d.default.createElement("path",{d:"M2.199.289A.5.5 0 0 1 2.652 0h8.696a.5.5 0 0 1 .453.289l1.867 4a.5.5 0 0 1-.453.711H.785a.5.5 0 0 1-.453-.711l1.867-4zM13 6H1a.752.752 0 0 0-.75.75v4.5c0 .412.338.75.75.75h12c.412 0 .75-.338.75-.75v-4.5A.752.752 0 0 0 13 6zm-9.75 4.5c-.825 0-1.5-.675-1.5-1.5s.675-1.5 1.5-1.5 1.5.675 1.5 1.5-.675 1.5-1.5 1.5z",transform:"translate(17 13)",fillRule:"evenodd"}),font:d.default.createElement("path",{d:"M3.722 8.702l-.686 1.89c-.053.14-.094.28-.123.421-.03.135-.044.252-.044.352 0 .304.097.527.29.668.2.14.501.21.905.21h.414V13H.083v-.756h.343c.176 0 .325-.018.448-.053a.81.81 0 0 0 .334-.22c.1-.105.193-.249.281-.43.094-.182.197-.416.308-.704L5.787.15h1.406l4.07 11.136c.07.187.14.343.21.466.077.123.165.222.264.298.1.07.214.12.343.15.129.03.281.044.457.044h.237V13H7.826v-.756h.413c.72 0 1.081-.287 1.081-.862 0-.1-.014-.202-.044-.307a3.274 3.274 0 0 0-.105-.36l-.72-2.013H3.72zM7.009 4.65c-.188-.533-.36-1.031-.519-1.494a15.92 15.92 0 0 1-.378-1.354 7.12 7.12 0 0 1-.15.633 16.95 16.95 0 0 1-.395 1.283c-.082.229-.175.484-.28.765L4.063 7.796h4.061L7.009 4.65zm8.411 5.74c0 .562.117.984.351 1.265.24.275.61.413 1.108.413.363 0 .691-.059.984-.176.3-.117.551-.284.756-.5.211-.218.372-.481.483-.792.112-.31.168-.656.168-1.037V8.104l-1.152.053c-.51.023-.937.088-1.283.193-.34.1-.615.243-.826.43a1.546 1.546 0 0 0-.457.678c-.088.27-.132.58-.132.931zm2.18-6.32c-.346 0-.627.05-.844.15a1.182 1.182 0 0 0-.501.404 1.594 1.594 0 0 0-.237.624c-.041.24-.062.5-.062.782-.498 0-.879-.085-1.143-.255-.257-.17-.386-.463-.386-.879 0-.31.085-.574.255-.79.17-.218.401-.393.694-.528.299-.14.644-.243 1.037-.308a7.76 7.76 0 0 1 1.257-.097c.55 0 1.031.056 1.441.167.41.106.753.282 1.029.528.275.246.48.568.615.967.14.392.21.876.21 1.45v4.667c0 .252.021.46.062.624a.928.928 0 0 0 .194.395c.088.1.202.17.343.211.146.041.319.062.518.062h.053V13H19.7l-.281-1.547h-.15c-.187.252-.369.483-.544.694-.176.211-.37.393-.58.545-.211.152-.452.27-.721.352a3.053 3.053 0 0 1-.958.131c-.399 0-.77-.058-1.116-.175a2.369 2.369 0 0 1-.888-.519 2.516 2.516 0 0 1-.58-.896c-.14-.364-.211-.791-.211-1.284 0-.955.34-1.664 1.02-2.127.68-.462 1.707-.714 3.084-.755l1.495-.053V6.285a6.93 6.93 0 0 0-.053-.888 1.778 1.778 0 0 0-.229-.703 1.14 1.14 0 0 0-.51-.457c-.216-.111-.51-.167-.878-.167z",transform:"translate(13 12)",fillRule:"evenodd"}),image:d.default.createElement("path",{d:"M13 0L9.25 5l2.85 3.8-1.6 1.2C8.81 7.75 6 4 6 4l-6 8h22L13 0z",transform:"translate(13 14)",fillRule:"evenodd"}),presentation:d.default.createElement("path",{d:"M2 4H0v10c0 1.1.9 2 2 2h14v-2H2V4zm16-4H6C4.9 0 4 .9 4 2v8c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zm0 10H6V2h12v8z",transform:"matrix(-1 0 0 1 34 12)",fillRule:"evenodd"}),settings:d.default.createElement("path",{d:"M13.572 8.735c.03-.24.053-.48.053-.735s-.023-.495-.053-.735l1.583-1.237a.378.378 0 0 0 .09-.48l-1.5-2.595a.377.377 0 0 0-.457-.165l-1.868.75a5.48 5.48 0 0 0-1.268-.735L9.868.815A.366.366 0 0 0 9.5.5h-3a.366.366 0 0 0-.367.315l-.285 1.988a5.762 5.762 0 0 0-1.268.735l-1.868-.75a.366.366 0 0 0-.457.165l-1.5 2.595a.37.37 0 0 0 .09.48l1.583 1.237c-.03.24-.053.488-.053.735 0 .248.022.495.053.735L.845 9.973a.378.378 0 0 0-.09.48l1.5 2.595c.09.165.292.225.458.165l1.867-.75c.39.3.81.547 1.268.735l.285 1.987c.022.18.18.315.367.315h3a.366.366 0 0 0 .367-.315l.285-1.988a5.762 5.762 0 0 0 1.268-.734l1.867.75c.173.067.368 0 .458-.165l1.5-2.595a.378.378 0 0 0-.09-.48l-1.582-1.238zM8 10.625A2.628 2.628 0 0 1 5.375 8 2.628 2.628 0 0 1 8 5.375 2.628 2.628 0 0 1 10.625 8 2.628 2.628 0 0 1 8 10.625z",transform:"translate(16 11)",fillRule:"evenodd"}),spreadsheet:d.default.createElement("path",{d:"M0 8h6V5H0v3zm0 5h6v-3H0v3zM0 3h6V0H0v3zm8 5h12V5H8v3zm0 5h12v-3H8v3zM8 0v3h12V0H8z",transform:"translate(14 14)",fillRule:"evenodd"}),vector:d.default.createElement("path",{d:"M14.5 2V1a1 1 0 0 0-1-1h-3a1 1 0 0 0-1 1v1H3.937a2 2 0 1 0 0 1h3.936A9 9 0 0 0 3 11v1h2v-1a7.003 7.003 0 0 1 4.594-6.576A1 1 0 0 0 10.5 5h3a1 1 0 0 0 .906-.576A7.003 7.003 0 0 1 19 11v1h2v-1a9 9 0 0 0-4.873-8h3.936a2 2 0 1 0 0-1H14.5zm-1-1h-3v3h3V1zM2 1.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm19 1a1 1 0 1 0 2 0 1 1 0 0 0-2 0z",transform:"translate(12 14)",fillRule:"evenodd"}),video:d.default.createElement("path",{d:"M10.75 3.875V1.25A.752.752 0 0 0 10 .5H1a.752.752 0 0 0-.75.75v7.5c0 .412.338.75.75.75h9c.412 0 .75-.338.75-.75V6.125l3 3V.875l-3 3z",transform:"translate(17 14)"})};!function(e){e.forEach(function(e){qa.indexOf(e)<0&&(e(Va,Oa),qa.push(e))})}([function(e,t){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var a in n)r[n[a]]=a;var s={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,o,i=r[this.toHex()];if(i)return i;if(null==t?void 0:t.closest){var l=this.toRgb(),c=1/0,d="black";if(!s.length)for(var u in n)s[u]=new e(n[u]).toRgb();for(var h in n){var m=(a=l,o=s[h],Math.pow(a.r-o.r,2)+Math.pow(a.g-o.g,2)+Math.pow(a.b-o.b,2));m<c&&(c=m,d=h)}return d}},t.string.push([function(t){var r=t.toLowerCase(),a="transparent"===r?"#0000":n[r];return a?new e(a).toRgb():null},"name"])}]);var Ga={color:xa.default.string,extension:xa.default.string,fold:xa.default.bool,foldColor:xa.default.string,glyphColor:xa.default.string,gradientColor:xa.default.string,gradientOpacity:xa.default.number,labelColor:xa.default.string,labelTextColor:xa.default.string,labelUppercase:xa.default.bool,radius:xa.default.number,type:xa.default.oneOf(["3d","acrobat","android","audio","binary","code","code2","compressed","document","drive","font","image","presentation","settings","spreadsheet","vector","video"])},Wa=40,Ka=48,Ya={WIDTH:Wa,HEIGHT:Ka,X_OFFSET:0},Xa=12,Za=d.default.useId||function(){var e=0;return function(){return e++}}(),Ja=function(e){var t=e.color,n=void 0===t?"whitesmoke":t,r=e.extension,a=e.fold,s=void 0===a||a,o=e.foldColor,i=e.glyphColor,l=e.gradientColor,c=void 0===l?"white":l,u=e.gradientOpacity,h=void 0===u?.25:u,m=e.labelColor,p=e.labelTextColor,f=void 0===p?"white":p,g=e.labelUppercase,x=void 0!==g&&g,v=e.radius,y=void 0===v?4:v,b=e.type,w=Za(),S="undefined"==typeof jest?w:"";return d.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 "+Wa+" "+Ka,width:"100%",style:{maxWidth:"100%"}},d.default.createElement("defs",null,d.default.createElement("clipPath",{id:"pageRadius"+S},d.default.createElement("rect",{x:Ya.X_OFFSET,y:"0",rx:y,ry:y,width:Ya.WIDTH,height:Ya.HEIGHT})),d.default.createElement("clipPath",{id:"foldCrop"+S},d.default.createElement("rect",{width:Ya.WIDTH,height:Xa,transform:"rotate(-45 0 "+Xa+")"})),d.default.createElement("linearGradient",{x1:"100%",y1:"0%",y2:"100%",id:"pageGradient"+S},d.default.createElement("stop",{stopColor:c,stopOpacity:h,offset:"0%"}),d.default.createElement("stop",{stopColor:c,stopOpacity:"0",offset:"66.67%"}))),d.default.createElement("g",{id:"file",clipPath:"url(#pageRadius"+S+")"},s?d.default.createElement(d.default.Fragment,null,d.default.createElement("path",{d:"M"+Ya.X_OFFSET+" 0 h "+(Ya.WIDTH-Xa)+" L "+(Ya.WIDTH+Ya.X_OFFSET)+" "+Xa+" v "+(Ya.HEIGHT-Xa)+" H "+Ya.X_OFFSET+" Z",fill:n}),d.default.createElement("path",{d:"M"+Ya.X_OFFSET+" 0 h "+(Ya.WIDTH-Xa)+" L "+(Ya.WIDTH+Ya.X_OFFSET)+" "+Xa+" v "+(Ya.HEIGHT-Xa)+" H "+Ya.X_OFFSET+" Z",fill:"url(#pageGradient"+S+")"})):d.default.createElement(d.default.Fragment,null,d.default.createElement("rect",{x:Ya.X_OFFSET,y:"0",width:Ya.WIDTH,height:Ya.HEIGHT,fill:n}),d.default.createElement("rect",{x:Ya.X_OFFSET,y:"0",width:Ya.WIDTH,height:Ya.HEIGHT,fill:"url(#pageGradient"+S+")"}))),s&&d.default.createElement("g",{transform:"translate(28 "+Xa+") rotate(-90)"},d.default.createElement("rect",{width:Ya.WIDTH,height:Ya.HEIGHT,fill:o||$a(n).darken(.1).toHex(),rx:y,ry:y,clipPath:"url(#foldCrop"+S+")"})),r&&d.default.createElement(d.default.Fragment,null,d.default.createElement("g",{id:"label"+S},d.default.createElement("rect",{fill:m||$a(n).darken(.3).toHex(),x:Ya.X_OFFSET,y:Ya.HEIGHT-14,width:Ya.WIDTH,height:14,clipPath:"url(#pageRadius"+S+")"})),d.default.createElement("g",{id:"labelText"+S,transform:"translate("+Ya.X_OFFSET+" 34)"},d.default.createElement("text",{x:Ya.WIDTH/2,y:"10",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"9",fill:f,textAnchor:"middle",style:{fontWeight:"bold",textAlign:"center",pointerEvents:"none",textTransform:x?"uppercase":"none",userSelect:"none"}},r))),b&&d.default.createElement("g",{transform:"translate(-4 "+(r?0:6)+")",fill:i||$a(n).darken(.15).toHex()},Ua[b]))};Ja.propTypes=Ga;var Qa={"3dm":{labelColor:"#8D1A11",type:"3d"},"3ds":{labelColor:"#5FB9AD",type:"3d"},"3g2":{type:"video"},"3gp":{type:"video"},"7zip":{type:"compressed"},aab:{type:"android",labelColor:"#3DDC84"},aac:{type:"audio"},aep:{type:"video"},ai:{color:"#423325",gradientOpacity:0,labelColor:"#423325",labelTextColor:"#FF7F18",labelUppercase:!0,foldColor:"#FF7F18",radius:2},aif:{type:"audio"},aiff:{type:"audio"},apk:{type:"android",labelColor:"#3DDC84"},apkm:{type:"android",labelColor:"#3DDC84"},apks:{type:"android",labelColor:"#3DDC84"},asf:{type:"video"},asp:{type:"code"},aspx:{type:"code"},avi:{type:"video"},bin:{type:"binary"},bmp:{type:"image"},c:{type:"code"},cpp:{type:"code"},cs:{type:"code"},css:{type:"code"},csv:{type:"spreadsheet"},cue:{type:"document"},dll:{type:"settings"},dmg:{type:"drive"},doc:{color:"#2C5898",foldColor:"#254A80",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#2C5898",labelUppercase:!0,type:"document"},docx:{color:"#2C5898",foldColor:"#254A80",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#2C5898",labelUppercase:!0,type:"document"},dwg:{type:"vector"},dxf:{type:"vector"},eot:{type:"font"},eps:{type:"vector"},exe:{type:"settings"},flac:{type:"audio"},flv:{type:"video"},fnt:{type:"font"},fodp:{type:"presentation"},fods:{type:"spreadsheet"},fodt:{type:"document"},fon:{type:"font"},gif:{type:"image"},gz:{type:"compressed"},heic:{type:"image"},htm:{type:"code"},html:{type:"code"},indd:{color:"#4B2B36",gradientOpacity:0,labelColor:"#4B2B36",labelTextColor:"#FF408C",labelUppercase:!0,foldColor:"#FF408C",radius:2},ini:{type:"settings"},java:{type:"code"},jpeg:{type:"image"},jpg:{type:"image"},js:{labelColor:"#F7DF1E",type:"code"},json:{type:"code"},jsx:{labelColor:"#00D8FF",type:"code"},m4a:{type:"audio"},m4v:{type:"video"},max:{labelColor:"#5FB9AD",type:"3d"},md:{type:"document"},mid:{type:"audio"},mkv:{type:"video"},mov:{type:"video"},mp3:{type:"audio"},mp4:{type:"video"},mpeg:{type:"video"},mpg:{type:"video"},obj:{type:"3d"},odp:{type:"presentation"},ods:{type:"spreadsheet"},odt:{type:"document"},ogg:{type:"audio"},ogv:{type:"video"},otf:{type:"font"},pdf:{labelColor:"#D93831",type:"acrobat"},php:{labelColor:"#8892BE",type:"code"},pkg:{type:"3d"},plist:{type:"settings"},png:{type:"image"},ppt:{color:"#D14423",foldColor:"#AB381D",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#D14423",labelUppercase:!0,type:"presentation"},pptx:{color:"#D14423",foldColor:"#AB381D",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#D14423",labelUppercase:!0,type:"presentation"},pr:{type:"video"},ps:{type:"vector"},psd:{color:"#34364E",gradientOpacity:0,labelColor:"#34364E",labelTextColor:"#31C5F0",labelUppercase:!0,foldColor:"#31C5F0",radius:2},py:{labelColor:"#FFDE57",type:"code"},rar:{type:"compressed"},rb:{labelColor:"#BB271A",type:"code"},rm:{type:"video"},rtf:{type:"document"},scss:{labelColor:"#C16A98",type:"code"},sitx:{type:"compressed"},skp:{type:"3d"},svg:{type:"vector"},swf:{type:"video"},sys:{type:"settings"},tar:{type:"compressed"},tex:{type:"document"},tif:{type:"image"},tiff:{type:"image"},ts:{labelColor:"#3478C7",type:"code"},ttf:{type:"font"},txt:{type:"document"},wav:{type:"audio"},webm:{type:"video"},wmv:{type:"video"},woff:{type:"font"},wpd:{type:"document"},wps:{type:"document"},xapk:{type:"android",labelColor:"#3DDC84"},xlr:{type:"spreadsheet"},xls:{color:"#1A754C",foldColor:"#16613F",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#1A754C",labelUppercase:!0,type:"spreadsheet"},xlsx:{color:"#1A754C",foldColor:"#16613F",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#1A754C",labelUppercase:!0,type:"spreadsheet"},yml:{type:"code"},zip:{type:"compressed"},zipx:{type:"compressed"}},es=Object.defineProperty,ts=(e,t)=>es(e,"name",{value:t,configurable:!0}),ns="Radio",[rs,as]=s.createContextScope(ns),[ss,os]=rs(ns);function is(e){const{__scopeRadio:t,checked:n=!1,children:r,disabled:a,form:s,name:o,onCheck:i,required:l,value:c="on",internal_do_not_use_render:d}=e,[h,m]=u.useState(null),[f,g]=u.useState(null),x=u.useRef(!1),[v,y]=u.useReducer(e=>e+1,0),b={checked:n,disabled:a,required:l,name:o,form:s,value:c,control:h,setControl:m,hasConsumerStoppedPropagationRef:x,userInteractionCount:v,onUserInteraction:y,isFormControl:!h||(!!s||!!h.closest("form")),bubbleInput:f,setBubbleInput:g,onCheck:ts(()=>i?.(),"onCheck")};return(0,p.jsx)(ss,{scope:t,...b,children:us(d)?d(b):r})}ts(is,"RadioProvider");var ls=u.forwardRef(ts(function({__scopeRadio:e,onClick:t,...n},r){const{checked:a,disabled:l,value:c,setControl:d,onCheck:u,hasConsumerStoppedPropagationRef:h,onUserInteraction:m,isFormControl:f,bubbleInput:g}=os("RadioTrigger",e),x=o.useComposedRefs(r,d);return(0,p.jsx)(s.Primitive.button,{type:"button",role:"radio","aria-checked":a,"data-state":hs(a),"data-disabled":l?"":void 0,disabled:l,value:c,...n,ref:x,onClick:i.composeEventHandlers(t,e=>{a||(m(),u()),g&&f&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})},"RadioTrigger")),cs=u.forwardRef(ts(function(e,t){const{__scopeRadio:n,forceMount:r,...a}=e,o=os("RadioIndicator",n);return(0,p.jsx)(rt,{present:r||o.checked,children:(0,p.jsx)(s.Primitive.span,{"data-state":hs(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t})})},"RadioIndicator")),ds=u.forwardRef(ts(function({__scopeRadio:e,onClick:t,...n},r){const{control:a,checked:l,required:c,disabled:d,name:h,value:m,form:f,bubbleInput:g,setBubbleInput:x,hasConsumerStoppedPropagationRef:v,userInteractionCount:y}=os("RadioBubbleInput",e),b=o.useComposedRefs(r,x),w=Re(a),S=u.useRef(!1),j=u.useRef(l),k=u.useRef(y);u.useEffect(()=>{const e=g;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set,r=y!==k.current;k.current=y;const a=j.current!==l;j.current=l;const s=!(r&&v.current);if(a&&n){S.current=!r;const t=new Event("click",{bubbles:s});n.call(e,l),e.dispatchEvent(t),S.current=!1}},[g,l,v,y]);const C=u.useRef(l);return(0,p.jsx)(s.Primitive.input,{type:"radio","aria-hidden":!0,defaultChecked:C.current,required:c,disabled:d,name:h,value:m,form:f,...n,tabIndex:-1,ref:b,onClick:i.composeEventHandlers(t,e=>{S.current&&e.stopPropagation()}),style:{...n.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function us(e){return"function"==typeof e}function hs(e){return e?"checked":"unchecked"}ts(us,"isFunction"),ts(hs,"getState");var ms=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ps="RadioGroup",[fs,gs]=s.createContextScope(ps,[i.createRovingFocusGroupScope,as]),xs=i.createRovingFocusGroupScope(),vs=as(),[ys,bs]=fs(ps),ws=u.forwardRef(ts(function(e,t){const{__scopeRadioGroup:n,name:r,form:a,defaultValue:l,value:c,required:d=!1,disabled:h=!1,orientation:m,dir:f,loop:g=!0,onValueChange:x,...v}=e,y=xs(n),b=i.useDirection(f),[w,S]=i.useControllableState({prop:c,defaultProp:l??null,onChange:x,caller:ps}),[j,k]=u.useState(null),C=o.useComposedRefs(t,k),N=u.useRef(w);return u.useEffect(()=>{const e=a?j?.ownerDocument.getElementById(a):j?.closest("form");if(e instanceof HTMLFormElement){const t=ts(()=>S(N.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[j,a,S]),(0,p.jsx)(ys,{scope:n,name:r,form:a,required:d,disabled:h,value:w,onValueChange:S,children:(0,p.jsx)(i.Root,{asChild:!0,...y,orientation:m,dir:b,loop:g,children:(0,p.jsx)(s.Primitive.div,{role:"radiogroup","aria-required":d,"aria-orientation":m,"data-disabled":h?"":void 0,dir:b,...v,ref:C})})})},"RadioGroup"));function Ss(e){const{__scopeRadioGroup:t,value:n,disabled:r,children:a,internal_do_not_use_render:s}=e,o=bs("RadioGroupItemProvider",t),i=vs(t),l=o.disabled||r;return(0,p.jsx)(is,{...i,checked:o.value===n,disabled:l,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:s,children:a})}ts(Ss,"RadioGroupItemProvider");var js=u.forwardRef(ts(function(e,t){const{__scopeRadioGroup:n,...r}=e,a=xs(n),s=vs(n),{checked:l,disabled:c}=os("RadioGroupItemTrigger",s.__scopeRadio),d=u.useRef(null),h=o.useComposedRefs(t,d),m=u.useRef(!1);return u.useEffect(()=>{const e=ts(e=>{ms.includes(e.key)&&(m.current=!0)},"handleKeyDown"),t=ts(()=>m.current=!1,"handleKeyUp");return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),(0,p.jsx)(i.Item,{asChild:!0,...a,focusable:!c,active:l,children:(0,p.jsx)(ls,{...s,...r,ref:h,onKeyDown:i.composeEventHandlers(r.onKeyDown,e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:i.composeEventHandlers(r.onFocus,()=>{m.current&&d.current?.click()})})})},"RadioGroupItemTrigger")),ks=u.forwardRef(ts(function(e,t){const{__scopeRadioGroup:n,value:r,disabled:a,...s}=e;return(0,p.jsx)(Ss,{__scopeRadioGroup:n,value:r,disabled:a,internal_do_not_use_render:({isFormControl:e})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(js,{...s,ref:t,__scopeRadioGroup:n}),e&&(0,p.jsx)(Cs,{__scopeRadioGroup:n})]})})},"RadioGroupItem")),Cs=u.forwardRef(ts(function(e,t){const{__scopeRadioGroup:n,...r}=e,a=vs(n);return(0,p.jsx)(ds,{...a,...r,ref:t})},"RadioGroupItemBubbleInput")),Ns=u.forwardRef(ts(function(e,t){const{__scopeRadioGroup:n,...r}=e,a=vs(n);return(0,p.jsx)(cs,{...a,...r,ref:t})},"RadioGroupIndicator")),Ts=Object.defineProperty;function Ms(e,[t,n]){return Math.min(n,Math.max(t,e))}((e,t)=>{Ts(e,"name",{value:t,configurable:!0})})(Ms,"clamp");var Es=Object.defineProperty,As=(e,t)=>Es(e,"name",{value:t,configurable:!0});function Rs(e,t){return u.useReducer((e,n)=>t[e][n]??e,e)}As(Rs,"useStateMachine");var Is="ScrollArea",[Ds,_s]=s.createContextScope(Is),[zs,Ps]=Ds(Is),Os=u.forwardRef(As(function(e,t){const{__scopeScrollArea:n,type:r="hover",dir:a,scrollHideDelay:l=600,...c}=e,[d,h]=u.useState(null),[m,f]=u.useState(null),[g,x]=u.useState(null),[v,y]=u.useState(null),[b,w]=u.useState(null),[S,j]=u.useState(0),[k,C]=u.useState(0),[N,T]=u.useState(!1),[M,E]=u.useState(!1),A=o.useComposedRefs(t,h),R=i.useDirection(a);return(0,p.jsx)(zs,{scope:n,type:r,dir:R,scrollHideDelay:l,scrollArea:d,viewport:m,onViewportChange:f,content:g,onContentChange:x,scrollbarX:v,onScrollbarXChange:y,scrollbarXEnabled:N,onScrollbarXEnabledChange:T,scrollbarY:b,onScrollbarYChange:w,scrollbarYEnabled:M,onScrollbarYEnabledChange:E,onCornerWidthChange:j,onCornerHeightChange:C,children:(0,p.jsx)(s.Primitive.div,{dir:R,...c,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})},"ScrollArea")),Ls=u.forwardRef(As(function(e,t){const{__scopeScrollArea:n,children:r,nonce:a,...i}=e,l=Ps("ScrollAreaViewport",n),c=u.useRef(null),d=o.useComposedRefs(t,c,l.onViewportChange);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Fs,{nonce:a}),(0,p.jsx)(s.Primitive.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,p.jsx)("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})},"ScrollAreaViewport")),Fs=u.memo(As(function({nonce:e}){return(0,p.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:e})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),Bs="ScrollAreaScrollbar",Hs=u.forwardRef(As(function(e,t){const{forceMount:n,...r}=e,a=Ps(Bs,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=a,i="horizontal"===e.orientation;return u.useEffect(()=>(i?s(!0):o(!0),()=>{i?s(!1):o(!1)}),[i,s,o]),"hover"===a.type?(0,p.jsx)(Vs,{...r,ref:t,forceMount:n}):"scroll"===a.type?(0,p.jsx)($s,{...r,ref:t,forceMount:n}):"auto"===a.type?(0,p.jsx)(qs,{...r,ref:t,forceMount:n}):"always"===a.type?(0,p.jsx)(Us,{...r,ref:t,"data-state":"visible"}):null},"ScrollAreaScrollbar")),Vs=u.forwardRef(As(function(e,t){const{forceMount:n,...r}=e,a=Ps(Bs,e.__scopeScrollArea),[s,o]=u.useState(!1);return u.useEffect(()=>{const e=a.scrollArea;let t=0;if(e){const n=As(()=>{window.clearTimeout(t),o(!0)},"handlePointerEnter"),r=As(()=>{t=window.setTimeout(()=>o(!1),a.scrollHideDelay)},"handlePointerLeave");return e.addEventListener("pointerenter",n),e.addEventListener("pointerleave",r),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",n),e.removeEventListener("pointerleave",r)}}},[a.scrollArea,a.scrollHideDelay]),(0,p.jsx)(rt,{present:n||s,children:(0,p.jsx)(qs,{"data-state":s?"visible":"hidden",...r,ref:t})})},"ScrollAreaScrollbarHover")),$s=u.forwardRef(As(function(e,t){const{forceMount:n,...r}=e,a=Ps(Bs,e.__scopeScrollArea),s="horizontal"===e.orientation,o=ho(()=>c("SCROLL_END"),100),[l,c]=Rs("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return u.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>c("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,a.scrollHideDelay,c]),u.useEffect(()=>{const e=a.viewport,t=s?"scrollLeft":"scrollTop";if(e){let n=e[t];const r=As(()=>{const r=e[t];n!==r&&(c("SCROLL"),o()),n=r},"handleScroll");return e.addEventListener("scroll",r),()=>e.removeEventListener("scroll",r)}},[a.viewport,s,c,o]),(0,p.jsx)(rt,{present:n||"hidden"!==l,children:(0,p.jsx)(Us,{"data-state":"hidden"===l?"hidden":"visible",...r,ref:t,onPointerEnter:i.composeEventHandlers(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:i.composeEventHandlers(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),qs=u.forwardRef(As(function(e,t){const n=Ps(Bs,e.__scopeScrollArea),{forceMount:r,...a}=e,[s,o]=u.useState(!1),i="horizontal"===e.orientation,l=ho(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(i?e:t)}},10);return mo(n.viewport,l),mo(n.content,l),(0,p.jsx)(rt,{present:r||s,children:(0,p.jsx)(Us,{"data-state":s?"visible":"hidden",...a,ref:t})})},"ScrollAreaScrollbarAuto")),Us=u.forwardRef(As(function(e,t){const{orientation:n="vertical",...r}=e,a=Ps(Bs,e.__scopeScrollArea),s=u.useRef(null),o=u.useRef(0),[i,l]=u.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=ao(i.viewport,i.content),d={...r,sizes:i,onSizesChange:l,hasThumb:Boolean(c>0&&c<1),onThumbChange:As(e=>s.current=e,"onThumbChange"),onThumbPointerUp:As(()=>o.current=0,"onThumbPointerUp"),onThumbPointerDown:As(e=>o.current=e,"onThumbPointerDown")};function h(e,t){return oo(e,o.current,i,t)}return As(h,"getScrollPosition"),"horizontal"===n?(0,p.jsx)(Gs,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){const e=io(a.viewport.scrollLeft,i,a.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollLeft=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollLeft=h(e,a.dir))}}):"vertical"===n?(0,p.jsx)(Ws,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){const e=io(a.viewport.scrollTop,i);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollTop=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollTop=h(e))}}):null},"ScrollAreaScrollbarVisible")),Gs=u.forwardRef(As(function(e,t){const{sizes:n,onSizesChange:r,...a}=e,s=Ps(Bs,e.__scopeScrollArea),[i,l]=u.useState(),c=u.useRef(null),d=o.useComposedRefs(t,c,s.onScrollbarXChange);return u.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),(0,p.jsx)(Xs,{"data-orientation":"horizontal",...a,ref:d,sizes:n,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":so(n)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(s.viewport){const r=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),co(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:ro(i.paddingLeft),paddingEnd:ro(i.paddingRight)}})}})},"ScrollAreaScrollbarX")),Ws=u.forwardRef(As(function(e,t){const{sizes:n,onSizesChange:r,...a}=e,s=Ps(Bs,e.__scopeScrollArea),[i,l]=u.useState(),c=u.useRef(null),d=o.useComposedRefs(t,c,s.onScrollbarYChange);return u.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),(0,p.jsx)(Xs,{"data-orientation":"vertical",...a,ref:d,sizes:n,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":so(n)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(s.viewport){const r=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),co(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:ro(i.paddingTop),paddingEnd:ro(i.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[Ks,Ys]=Ds(Bs),Xs=u.forwardRef(As(function(e,t){const{__scopeScrollArea:n,sizes:r,hasThumb:a,onThumbChange:l,onThumbPointerUp:c,onThumbPointerDown:d,onThumbPositionChange:h,onDragScroll:m,onWheelScroll:f,onResize:g,...x}=e,v=Ps(Bs,n),[y,b]=u.useState(null),w=o.useComposedRefs(t,b),S=u.useRef(null),j=u.useRef(""),k=v.viewport,C=r.content-r.viewport,N=s.useCallbackRef(f),T=s.useCallbackRef(h),M=ho(g,10);function E(e){if(S.current){const t=e.clientX-S.current.left,n=e.clientY-S.current.top;m({x:t,y:n})}}return As(E,"handleDragScroll"),u.useEffect(()=>{const e=As(e=>{const t=e.target;y?.contains(t)&&N(e,C)},"handleWheel");return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[k,y,C,N]),u.useEffect(T,[r,T]),mo(y,M),mo(v.content,M),(0,p.jsx)(Ks,{scope:n,scrollbar:y,hasThumb:a,onThumbChange:s.useCallbackRef(l),onThumbPointerUp:s.useCallbackRef(c),onThumbPositionChange:T,onThumbPointerDown:s.useCallbackRef(d),children:(0,p.jsx)(s.Primitive.div,{...x,ref:w,style:{position:"absolute",...x.style},onPointerDown:i.composeEventHandlers(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),S.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),E(e))}),onPointerMove:i.composeEventHandlers(e.onPointerMove,E),onPointerUp:i.composeEventHandlers(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=j.current,v.viewport&&(v.viewport.style.scrollBehavior=""),S.current=null})})})},"ScrollAreaScrollbarImpl")),Zs="ScrollAreaThumb",Js=u.forwardRef(As(function(e,t){const{forceMount:n,...r}=e,a=Ys(Zs,e.__scopeScrollArea);return(0,p.jsx)(rt,{present:n||a.hasThumb,children:(0,p.jsx)(Qs,{ref:t,...r})})},"ScrollAreaThumb")),Qs=u.forwardRef(As(function(e,t){const{__scopeScrollArea:n,style:r,...a}=e,l=Ps(Zs,n),c=Ys(Zs,n),{onThumbPositionChange:d}=c,h=o.useComposedRefs(t,c.onThumbChange),m=u.useRef(void 0),f=ho(()=>{m.current&&(m.current(),m.current=void 0)},100);return u.useEffect(()=>{const e=l.viewport;if(e){const t=As(()=>{if(f(),!m.current){const t=uo(e,d);m.current=t,d()}},"handleScroll");return d(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[l.viewport,f,d]),(0,p.jsx)(s.Primitive.div,{"data-state":c.hasThumb?"visible":"hidden",...a,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:i.composeEventHandlers(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;c.onThumbPointerDown({x:n,y:r})}),onPointerUp:i.composeEventHandlers(e.onPointerUp,c.onThumbPointerUp)})},"ScrollAreaThumbImpl")),eo="ScrollAreaCorner",to=u.forwardRef(As(function(e,t){const n=Ps(eo,e.__scopeScrollArea),r=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&r?(0,p.jsx)(no,{...e,ref:t}):null},"ScrollAreaCorner")),no=u.forwardRef(As(function(e,t){const{__scopeScrollArea:n,...r}=e,a=Ps(eo,n),[o,i]=u.useState(0),[l,c]=u.useState(0),d=Boolean(o&&l),{onCornerWidthChange:h,onCornerHeightChange:m}=a;return mo(a.scrollbarX,()=>{const e=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(e),c(e)}),mo(a.scrollbarY,()=>{const e=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(e),i(e)}),u.useEffect(()=>()=>{h(0),m(0)},[h,m]),d?(0,p.jsx)(s.Primitive.div,{...r,ref:t,style:{width:o,height:l,position:"absolute",right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:0,...e.style}}):null},"ScrollAreaCornerImpl"));function ro(e){return e?parseInt(e,10):0}function ao(e,t){const n=e/t;return isNaN(n)?0:n}function so(e){const t=ao(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function oo(e,t,n,r="ltr"){const a=so(n),s=t||a/2,o=a-s,i=n.scrollbar.paddingStart+s,l=n.scrollbar.size-n.scrollbar.paddingEnd-o,c=n.content-n.viewport;return lo([i,l],"ltr"===r?[0,c]:[-1*c,0])(e)}function io(e,t,n="ltr"){const r=so(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-a,o=t.content-t.viewport,i=s-r,l=Ms(e,"ltr"===n?[0,o]:[-1*o,0]);return lo([0,o],[0,i])(l)}function lo(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function co(e,t){return e>0&&e<t}As(ro,"toInt"),As(ao,"getThumbRatio"),As(so,"getThumbSize"),As(oo,"getScrollPositionFromPointer"),As(io,"getThumbOffsetFromScroll"),As(lo,"linearScale"),As(co,"isScrollingWithinScrollbarBounds");var uo=As((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return As(function a(){const s={left:e.scrollLeft,top:e.scrollTop},o=n.left!==s.left,i=n.top!==s.top;(o||i)&&t(),n=s,r=window.requestAnimationFrame(a)},"loop")(),()=>window.cancelAnimationFrame(r)},"addUnlinkedScrollListener");function ho(e,t){const n=s.useCallbackRef(e),r=u.useRef(0);return u.useEffect(()=>()=>window.clearTimeout(r.current),[]),u.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function mo(e,t){const n=s.useCallbackRef(t);s.useLayoutEffect2(()=>{let t=0;if(e){const r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}As(ho,"useDebounceCallback"),As(mo,"useResizeObserver");var po=Os,fo=Ls,go=to;function xo(...e){return t.twMerge((0,m.default)(e))}function vo({...e}){return(0,p.jsx)(g.Root,{"data-slot":"sheet",...e})}function yo({...e}){return(0,p.jsx)(g.Portal,{"data-slot":"sheet-portal",...e})}function bo({className:e,...t}){return(0,p.jsx)(g.Overlay,{"data-slot":"sheet-overlay",className:xo("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function wo({className:e,children:t,side:n="right",...r}){return(0,p.jsxs)(yo,{children:[(0,p.jsx)(bo,{}),(0,p.jsxs)(g.Content,{"data-slot":"sheet-content",className:xo("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===n&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===n&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===n&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===n&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...r,children:[t,(0,p.jsxs)(g.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,p.jsx)(f.XIcon,{className:"size-4"}),(0,p.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function So({className:e,...t}){return(0,p.jsx)("div",{"data-slot":"sheet-header",className:xo("flex flex-col gap-1.5 p-4",e),...t})}function jo({className:e,...t}){return(0,p.jsx)(g.Title,{"data-slot":"sheet-title",className:xo("text-foreground font-semibold",e),...t})}function ko({className:e,...t}){return(0,p.jsx)(g.Description,{"data-slot":"sheet-description",className:xo("text-muted-foreground text-sm",e),...t})}var Co="REASON-file-sources",No="REASON-active-file-source",To={id:"local-default",name:"Local Files",type:"local",isDefault:!0,createdAt:(new Date).toISOString(),updatedAt:(new Date).toISOString()};function Mo(){try{const e=localStorage.getItem(Co);if(e){const t=JSON.parse(e);return t.some(e=>"local-default"===e.id)?t:[To,...t]}}catch(e){}return[To]}function Eo(e){try{localStorage.setItem(Co,JSON.stringify(e))}catch(t){}}function Ao(){try{return localStorage.getItem(No)||"local-default"}catch(e){return"local-default"}}function Ro(e){try{localStorage.setItem(No,e)}catch(t){}}(new Date).valueOf();function Io(e){const[t,n]=(0,u.useState)(e),r=(0,u.useRef)(e);return(0,u.useEffect)(()=>{if(r.current!==e){if(Array.isArray(r.current)&&Array.isArray(e)&&0===r.current.length&&0===e.length)return;r.current=e,n(e)}},[e]),[t,n]}function Do(e,t){return"function"==typeof e?"object"==typeof t?e(t):e():e}function _o(e,t="data-id"){let n=e;for(!n.tagName&&e.target&&(n=e.target);n;){if(n.getAttribute&&n.getAttribute(t))return n;n=n.parentNode}return null}function zo(e,t="data-id"){const n=_o(e,t);return n?Po(n,t):null}function Po(e,t="data-id"){const n=e.getAttribute(t);return n?function(e){if(e.startsWith(":"))return e.substring(1);const t=1*e;return isNaN(t)?e:t}(n):null}function Oo(e){return"string"==typeof e?":"+e:e}var Lo={detect:()=>!0,addEvent:function(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)},addGlobalEvent:function(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)},getTopNode:function(){return window.document.body}};function Fo(e){Object.assign(Lo,e)}function Bo(e,t,n){Lo.addEvent(e,n,function(e){const r=_o(e);if(!r)return;const a=Po(r);if("function"==typeof t)return t(a,e);let s,o=e.target;for(;o!=r;){if(s=o.dataset?o.dataset.action:null,s&&t[s])return void t[s](a,e);o=o.parentNode}t[n]&&t[n](a,e)})}function Ho(e,t){Bo(e,t,"click"),t.dblclick&&Bo(e,t.dblclick,"dblclick")}function Vo(e,t,n){for(let r=0;r<Go.length;r++){if(r===n)continue;const a=Go[r],s=a.props.parent?.();if(s&&e.contains(s)&&a.node.contains(t))return!0}return!1}var $o=new Date,qo=!1,Uo=[],Go=[],Wo=e=>{const t=e.target;if(!qo&&t.isConnected)for(let n=Go.length-1;n>=0;n--){const{node:r,date:a,props:s}=Go[n];if(!(a>$o)&&(!r.contains(t)&&r!==t)){if(Vo(r,t,n))break;if(s.callback&&s.callback(e),s.modal||e.defaultPrevented)break}}else qo=!1},Ko=e=>{$o=new Date,qo=!0;for(let t=Go.length-1;t>=0;t--){const{node:n}=Go[t];if(!n.contains(e.target)&&n!==e.target){qo=!1;break}}};function Yo(e,t){Uo.length||(Uo=[Lo.addGlobalEvent("click",Wo,e),Lo.addGlobalEvent("contextmenu",Wo,e),Lo.addGlobalEvent("mousedown",Ko,e)]),"object"!=typeof t&&(t={callback:t});const n={node:e,date:new Date,props:t};return Go.push(n),{destroy(){!function(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){e.splice(n,1);break}}(Go,n),Go.length||(Uo.forEach(e=>e()),Uo=[])}}}var Xo,Zo,Jo,Qo,ei=e=>-1!==e.indexOf("bottom"),ti=e=>-1!==e.indexOf("left"),ni=e=>-1!==e.indexOf("right"),ri=e=>-1!==e.indexOf("top"),ai=e=>-1!==e.indexOf("fit"),si=e=>-1!==e.indexOf("overlap");function oi(e,t,n="bottom",r=0,a=0){if(!e)return null;Xo=r,Zo=a,Jo="auto";let s=0,o=0,i=n;const l=ii(e),c=si(n)?Lo.getTopNode(e):l;if(!l)return null;const d=l.getBoundingClientRect(),u=e.getBoundingClientRect(),h=c.getBoundingClientRect(),m=window.getComputedStyle(c),p={left:0,top:0,bottom:0,right:0};for(const b in p){const e=`border-${b}-width`;p[b]=parseFloat(m.getPropertyValue(e))}if(t){const e=function(e,t){let n=0;const r=Lo.getTopNode(e);for(;e&&e!==r;){const r=getComputedStyle(e).position;if("absolute"!==r&&"relative"!==r&&"fixed"!==r||(n=parseInt(getComputedStyle(e).zIndex)||0),(e=e.parentNode)===t)break}return n}(t,l);s=Math.max(e+1,20)}if(t){if(Qo=t.getBoundingClientRect(),ai(n)&&(Jo=Qo.width+"px"),"point"!==n)if(n.split("-").every(e=>["center","fit"].indexOf(e)>-1))ai(n)?Xo=0:(Xo=h.width/2,o=1),Zo=(h.height-u.height)/2;else{const e=si(n)?0:1;Xo=ni(n)?Qo.right+e:Qo.left-e,Zo=ei(n)?Qo.bottom+1:Qo.top;const t=(e=>{const t=e.match(/(start|center|end)/);return t?t[0]:null})(n);t&&(ni(n)||ti(n)?"center"===t?Zo-=(u.height-Qo.height)/2:"end"===t&&(Zo-=u.height-Qo.height):(ei(n)||ri(n))&&("center"===t?Xo-=(u.width-Qo.width)/2:"end"===t&&(Xo-=u.width-Qo.width),si(n)||(Xo+=1)))}}else Qo={left:r,right:r,top:a,bottom:a};const f=(ti(n)||ni(n))&&(ei(n)||ri(n));ti(n)&&(o=2);const g=Xo-u.width-h.left;t&&ti(n)&&!f&&g<0&&(Xo=Qo.right,o=0,i=i.replace("left","right"));const x=Xo+u.width*(1-o/2)-h.right;if(x>0)if(ni(n)){const e=Qo.left-h.x-u.width;t&&!f&&e>=0?(Xo=Qo.left-u.width,i=i.replace("right","left")):Xo-=x+p.right}else Xo=h.right-p.right-u.width;o&&(Xo=Math.round(Xo-u.width*o/2));const v=g<0||x>0||!f;ri(n)&&(Zo=Qo.top-u.height,t&&Zo<h.y&&v&&(Zo=Qo.bottom,i=i.replace("top","bottom")));const y=Zo+u.height-h.bottom;return y>0&&(t&&ei(n)&&v?(Zo-=u.height+Qo.height+1,i=i.replace("bottom","top")):Zo-=y+p.bottom),Xo-=d.left+p.left,Zo-=d.top+p.top,Xo=(si(n)?Xo:Math.max(Xo,0))+c.scrollLeft,Zo=(si(n)?Zo:Math.max(Zo,0))+c.scrollTop,{at:i,x:Xo,y:Zo,z:s,width:Jo=Jo||"auto"}}function ii(e){const t=Lo.getTopNode(e);for(e&&(e=e.parentElement);e;){const n=getComputedStyle(e).position;if(e===t||"relative"===n||"absolute"===n||"fixed"===n)return e;e=e.parentNode}return null}var li=(new Date).valueOf();function ci(){return li+=1}function di(e){return e<10?"0"+e:e.toString()}function ui(e){const t=11*Math.floor(e/11);return{start:t,end:t+11}}function hi(e){const t=(e.getDay()+6)%7,n=new Date(e.valueOf());n.setDate(e.getDate()+(3-t)),n.setHours(0,0,0,0);const r=new Date(n.getFullYear(),0,1),a=Math.round((n.getTime()-r.getTime())/864e5);return 1+Math.floor(a/7)}var mi=["",""];function pi(e,t,n){switch(e){case"%d":return di(t.getDate());case"%m":return di(t.getMonth()+1);case"%j":return t.getDate();case"%n":return t.getMonth()+1;case"%y":return di(t.getFullYear()%100);case"%Y":return t.getFullYear();case"%D":return n.dayShort[t.getDay()];case"%l":return n.dayFull[t.getDay()];case"%M":return n.monthShort[t.getMonth()];case"%F":return n.monthFull[t.getMonth()];case"%h":return di((t.getHours()+11)%12+1);case"%g":return(t.getHours()+11)%12+1;case"%G":return t.getHours();case"%H":return di(t.getHours());case"%i":return di(t.getMinutes());case"%a":return((t.getHours()>11?n.pm:n.am)||mi)[0];case"%A":return((t.getHours()>11?n.pm:n.am)||mi)[1];case"%s":return di(t.getSeconds());case"%S":return function(e){const t=di(e);return 2==t.length?"0"+t:t}(t.getMilliseconds());case"%W":return di(hi(t));case"%w":{const e=n.weekStart??1;if(1===e)return di(hi(t));const r=(t.getDay()-e+7)%7,a=(1-e+7)%7,s=new Date(t.valueOf());return s.setDate(t.getDate()+(a-r)),di(hi(s))}case"%c":{let e=t.getFullYear()+"";return e+="-"+di(t.getMonth()+1),e+="-"+di(t.getDate()),e+="T",e+=di(t.getHours()),e+=":"+di(t.getMinutes()),e+=":"+di(t.getSeconds()),e}case"%Q":return Math.floor(t.getMonth()/3)+1;default:return e}}var fi=/%[a-zA-Z]/g;function gi(e,t){return"function"==typeof e?e:function(n){return n?(n.getMonth||(n=new Date(n)),e.replace(fi,e=>pi(e,n,t))):""}}function xi(e){return e&&"object"==typeof e&&!Array.isArray(e)}function vi(e,t){for(const n in t){const r=t[n];xi(e[n])&&xi(r)?e[n]=vi({...e[n]},t[n]):e[n]=t[n]}return e}function yi(e){return{getGroup(t){const n=e[t];return e=>n&&n[e]||e},getRaw:()=>e,extend(t,n){if(!t)return this;let r;return r=n?vi({...t},e):vi({...e},t),yi(r)}}}var bi={core:{ok:"OK",cancel:"Cancel",select:"Select","No data":"No data","Rows per page":"Rows per page","Total pages":"Total pages"},calendar:{monthFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],hours:"Hours",minutes:"Minutes",done:"Done",clear:"Clear",today:"Today",am:["am","AM"],pm:["pm","PM"],weekStart:0,clockFormat:24},formats:{timeFormat:"%H:%i",dateFormat:"%m/%d/%Y",monthYearFormat:"%F %Y",yearFormat:"%Y"},lang:"en-US"},wi=(0,u.createContext)(""),Si=(0,u.createContext)({}),ji=(0,u.createContext)(null),ki=(0,u.createContext)(null),Ci=Object.freeze(Object.defineProperty({__proto__:null,fieldId:ki,helpers:Si,i18n:ji,theme:wi},Symbol.toStringTag,{value:"Module"}));function Ni(e){const t=(0,u.useContext)(ki),[n]=(0,u.useState)(()=>e||t||ci());return n}function Ti({type:e="",css:t="",icon:n="",disabled:r=!1,title:a="",tooltip:s,text:o="",children:i,onClick:l}){const c=(0,u.useMemo)(()=>{let n=e?e.split(" ").filter(e=>""!==e).map(e=>"wx-"+e).join(" "):"";return t+(t?" ":"")+n},[e,t]);return(0,p.jsxs)("button",{title:a,className:`wx-2ZWgb4 wx-button ${c} ${n&&!i?"wx-icon":""}`,disabled:r,onClick:e=>{l&&l(e)},"data-tooltip-text":s,children:[n&&(0,p.jsx)("i",{className:"wx-2ZWgb4 "+n}),i||o||" "]})}function Mi({id:e,label:t="",inputValue:n="",value:r=!1,onChange:a,disabled:s=!1,css:o=""}){const i=Ni(e),[l,c]=Io(r);return(0,p.jsxs)("div",{className:`wx-2IvefP wx-checkbox ${o}`,children:[(0,p.jsx)("input",{type:"checkbox",id:i,disabled:s,className:"wx-2IvefP wx-check",checked:l,value:n,onChange:({target:e})=>{const t=e.checked;c(t),a&&a({value:t,inputValue:n})}}),(0,p.jsxs)("label",{htmlFor:i,className:"wx-2IvefP wx-label",children:[(0,p.jsx)("span",{className:"wx-2IvefP wx-before"}),t&&(0,p.jsx)("span",{className:"wx-2IvefP wx-after",children:t})]})]})}function Ei({theme:e="",target:t,children:n}){const r=(0,u.useRef)(null),a=(0,u.useRef)(null),[s,o]=(0,u.useState)(null);r.current||(r.current=document.createElement("div"));const i=(0,u.useContext)(wi);return(0,u.useEffect)(()=>{o(t||function(e){const t=Lo.getTopNode(e);for(;e&&e!==t&&!e.getAttribute("data-wx-portal-root");)e=e.parentNode;return e}(a.current)||Lo.getTopNode(a.current))},[a.current]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{ref:a,style:{display:"none"}}),a.current&&s?(0,v.createPortal)((0,p.jsx)("div",{className:`wx-3ZWsT0 wx-${e||i}-theme`,children:n}),s):null]})}function Ai({left:e=0,top:t=0,at:n="bottom",parent:r=null,width:a="auto",css:s="",onCancel:o,children:i,trackScroll:l=!1}){const[c,d]=(0,u.useState)(0),[h,m]=(0,u.useState)(0),[f,g]=(0,u.useState)("auto"),[x,v]=(0,u.useState)(!1),y=(0,u.useRef)(null),b=(0,u.useRef)(null),w=(0,u.useRef)(o);(0,u.useEffect)(()=>{w.current=o},[o]);const S=(0,u.useCallback)(()=>{if(!y.current)return;const s=oi(y.current,r,n,e,t);s&&(d(s.x),m(s.y),g(function(e){return r&&(a+"").indexOf("%")>-1?a.replace(/(\d+)%/,(e,t)=>(t=t*r.offsetWidth/100+"px",a.replace(e,t))):a&&"auto"!==a?a:e}(s.width)))},[y,r,n,e,t,a]);return(0,u.useLayoutEffect)(()=>{const e=e=>{w.current&&e.target!==b.current&&y.current&&!y.current.contains(e.target)&&w.current(e)};let t;return requestAnimationFrame(()=>{S(),v(!0),l&&y.current&&(b.current=ii(y.current),b.current&&b.current.addEventListener("scroll",e,!0)),r&&(t=new ResizeObserver(S),t.observe(r))}),()=>{l&&b.current&&b.current.removeEventListener("scroll",e,!0),t?.disconnect()}},[]),(0,u.useLayoutEffect)(()=>{S()},[r,n,e,t]),(0,u.useEffect)(()=>{if(y.current)return Yo(y.current,{callback:e=>{w.current&&w.current(e)},parent:()=>r}).destroy},[r]),(0,p.jsx)("div",{ref:y,className:["wx-37M6Fj","wx-popup",s].filter(Boolean).join(" "),style:{position:"absolute",visibility:x?"visible":"hidden",top:h+"px",left:c+"px",width:f},children:i})}function Ri({position:e="bottom",align:t="start",autoFit:n=!0,onCancel:r=null,width:a="100%",css:s="",children:o}){const i=(0,u.useRef)(null),[l,c]=(0,u.useState)(e),[d,h]=(0,u.useState)(t),m=(0,u.useRef)(r);return(0,u.useEffect)(()=>{m.current=r},[r]),(0,u.useEffect)(()=>{if(n){const e=i.current;if(e){const t=e.getBoundingClientRect(),n=document.body.getBoundingClientRect();t.right>=n.right&&h("end"),t.bottom>=n.bottom&&c("top")}}},[]),(0,u.useEffect)(()=>{if(i.current){const e=e=>{m.current&&m.current(e)};return Yo(i.current,e).destroy}},[]),(0,p.jsx)("div",{ref:i,className:["wx-dropdown",`wx-${l}-${d}`,s||"","wx-aaaVytZW"].filter(Boolean).join(" "),style:{width:a},children:o})}function Ii({position:e="bottom",align:t="start",autoFit:n=!0,inline:r=!1,onCancel:a,width:s="100%",children:o,...i}){const[l,c]=(0,u.useState)(void 0),d=(0,u.useRef)(null),h=(0,u.useMemo)(()=>`${e}-${t}`,[e,t]);return(0,u.useLayoutEffect)(()=>{d.current&&c(d.current.parentNode)},[]),(0,p.jsxs)(p.Fragment,{children:[l&&(r?(0,p.jsx)(Ri,{onCancel:a,position:e,align:t,autoFit:n,width:s,...i,children:o}):(0,p.jsx)(Ei,{children:(0,p.jsx)(Ai,{parent:l,at:h,onCancel:a,width:s,...i,children:o})})),(0,p.jsx)("span",{ref:d,className:"wx-portal-node wx-32GZ52"})]})}function Di(){return yi(bi)}var _i=(0,u.memo)(function({data:e,checkboxes:t,itemTemplate:n,value:r}){return(0,p.jsxs)(p.Fragment,{children:[t&&(0,p.jsx)(Mi,{id:e.id,css:"wx-list-checkbox",value:r&&r.includes(e.id)}),n?Do(n,{option:e}):e.label]})});function zi({visibleItems:e,visibleRange:t,navIndex:n,checkboxes:r,itemTemplate:a,value:s,measureRefCallback:o}){return e.map((e,i)=>{const l=t.start+i;return(0,p.jsx)("div",{ref:0===i?o:void 0,className:"wx-233fr7 wx-item "+(l===n?"wx-focus":""),"data-id":e.id,children:(0,p.jsx)(_i,{data:e,checkboxes:r,itemTemplate:a,value:s})},e.id)})}function Pi({items:e=[],children:t,onSelect:n,onReady:r,virtualized:a=!1,checkboxes:s,multiselect:o,value:i,...l}){const c=(0,u.useRef)(),d=(0,u.useRef)(!1),h=(0,u.useRef)(function(){let e,t,n,r,a=null,s=!1,o=!1;const i=e=>{a=e,s=null!==a,n(a)},l=(t,n)=>{if(!o&&null!==t&&e){const r=e.querySelectorAll(".wx-list > .wx-item")[t];r&&(r.scrollIntoView({block:"nearest"}),n&&n.preventDefault())}},c=(n,r)=>{const s=null===n?null:Math.max(0,Math.min(a+n,t.length-1));s!==a&&(i(s),e?l(s,r):requestAnimationFrame(()=>l(s,r)))};return{move:e=>{const n=zo(e),r=t.findIndex(e=>e.id===n);r!==a&&i(r)},keydown:(e,t)=>{switch(e.code){case"Enter":s?r():i(0);break;case"Space":s||i(0);break;case"Escape":case"Tab":n(a=null);break;case"ArrowDown":c(s?1:t||0,e);break;case"ArrowUp":c(s?-1:t||0,e)}},init:(a,s,i,l,c)=>{e=a,t=s,n=i,r=l,o=c},navigate:c}}()),[m,f]=(0,u.useState)(null),g=(0,u.useRef)(m),[x,v]=(0,u.useState)(0),[y,b]=(0,u.useState)(24),w=(0,u.useRef)(!1),S=((0,u.useContext)(ji)||Di()).getGroup("core"),j=(0,u.useRef)(e);(0,u.useEffect)(()=>{j.current=e},[e]);const k=(0,u.useRef)(i);(0,u.useEffect)(()=>{k.current=i},[i]);const C=(0,u.useRef)(0);(0,u.useEffect)(()=>{C.current=y},[y]);const N=(0,u.useCallback)(e=>{e&&e.stopPropagation();const t=j.current,r=k.current,a=g.current;let s;const i=t[a]?.id;s=o?r&&r.includes(i)?r.filter(e=>e!==i):[...r||[],i]:i,n&&n({id:s})},[o,n]),T=(0,u.useRef)(N);(0,u.useEffect)(()=>{T.current=N},[N]);const M=(0,u.useCallback)(e=>{if(c.current){let t=e*C.current-c.current.clientHeight+C.current;v(t),c.current.scrollTop=t}},[C.current]),E=(0,u.useCallback)(e=>{c.current=e,a&&(e&&!d.current&&null!==g.current&&requestAnimationFrame(()=>{c.current&&(M(g.current),d.current=!0)}),e||(d.current=!1))},[M]),A=(0,u.useCallback)(e=>{if(!e||w.current)return;const t=e.getBoundingClientRect().height;t&&(b(t),C.current=t,w.current=!0)},[]);(0,u.useEffect)(()=>{h.current.init(c.current,e,e=>{f(e),g.current=e},e=>T.current(e),a)},[e,c.current,a]),(0,u.useEffect)(()=>{r&&r({navigate:a?(e,t)=>{h.current.navigate(e,t),M(g.current)}:h.current.navigate,keydown:a?(e,t)=>{const n=g.current,r=j.current;if(0!==n&&n!==r.length-1&&("ArrowDown"===e.key||"ArrowUp"===e.key)&&e.preventDefault(),h.current.keydown(e,t),c.current){const e=c.current.scrollTop<=g.current*C.current,t=c.current.scrollTop+c.current.clientHeight>=g.current*C.current+C.current;e?t||M(g.current):(c.current.scrollTop=g.current*C.current,v(c.current.scrollTop))}}:h.current.keydown,move:h.current.move})},[]);const R=(0,u.useRef)(0),I=(0,u.useRef)(e);I.current!==e&&(I.current=e,R.current+=1);const D=(0,u.useCallback)(()=>{h.current.navigate(null)},[h]),_=(0,u.useCallback)(e=>{a&&v(e.target.scrollTop)},[a]),z=(0,u.useMemo)(()=>Math.ceil((c.current?.clientHeight||0)/y),[y,x]),P=(0,u.useMemo)(()=>{if(!a)return{start:0,end:e.length};if(!e.length)return{start:0,end:0};const t=Math.floor(x/y),n=t+z;return{start:Math.max(0,t-10),end:Math.min(e.length,n+10)}},[a,e,x,y,z]),O=(0,u.useMemo)(()=>{if(!a)return e;const{start:t,end:n}=P;return e.slice(t,n).map(e=>({...e}))},[a,e,P]),L=P.start*y,F=e.length*y;return(0,u.useEffect)(()=>{a&&v(0)},[e,a]),(0,u.useEffect)(()=>{null===m&&(d.current=!1)},[m]),null===m?null:(0,p.jsx)(Ii,{onCancel:D,...l,children:(0,p.jsx)("div",{className:"wx-233fr7 wx-list",ref:E,onClick:N,onMouseMove:h.current.move,onScroll:_,children:e.length?a?(0,p.jsx)("div",{className:"wx-233fr7 wx-list-wrapper",style:{height:`${F}px`},children:(0,p.jsx)("div",{className:"wx-233fr7 wx-list-content",style:{transform:`translateY(${L}px)`},children:(0,p.jsx)(zi,{visibleRange:P,visibleItems:O,navIndex:m,measureRefCallback:A,checkboxes:s,itemTemplate:t,value:i})})}):(0,p.jsx)(zi,{visibleRange:P,visibleItems:O,navIndex:m,measureRefCallback:A,checkboxes:s,itemTemplate:t,value:i}):(0,p.jsx)("div",{className:"wx-233fr7 wx-no-data",children:S("No data")})})},R.current)}function Oi({value:e="",id:t,readonly:n=!1,focus:r=!1,select:a=!1,type:s="text",placeholder:o="",disabled:i=!1,error:l=!1,title:c="",tooltip:d,css:h="",icon:m="",clear:f=!1,onChange:g}){const x=Ni(t),[v,y]=Io(e),b=(0,u.useRef)(null),w=(0,u.useMemo)(()=>m&&-1===h.indexOf("wx-icon-left")?"wx-icon-right "+h:h,[m,h]),S=(0,u.useMemo)(()=>m&&-1!==h.indexOf("wx-icon-left"),[m,h]);(0,u.useEffect)(()=>{const e=setTimeout(()=>{r&&b.current&&b.current.focus(),a&&b.current&&b.current.select()},1);return()=>clearTimeout(e)},[r,a]);const j=(0,u.useCallback)(e=>{const t=e.target.value;y(t),g&&g({value:t,input:!0})},[g]),k=(0,u.useCallback)(e=>g&&g({value:e.target.value}),[g]);let C=s;return"password"!==s&&"number"!==s&&(C="text"),(0,u.useEffect)(()=>{const e=k,t=b.current;return t.addEventListener("change",e),()=>{t&&t.removeEventListener("change",e)}},[k]),(0,p.jsxs)("div",{className:`wx-hQ64J4 wx-text ${w} ${l?"wx-error":""} ${i?"wx-disabled":""} ${f?"wx-clear":""}`,"data-tooltip-text":d,children:[(0,p.jsx)("input",{className:"wx-hQ64J4 wx-input",ref:b,id:x,readOnly:n,disabled:i,placeholder:o,type:C,title:c,value:v,onInput:j}),f&&!i&&v?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:function(e){e.stopPropagation(),y(""),g&&g({value:""})}}),S&&(0,p.jsx)("i",{className:`wx-hQ64J4 wx-icon ${m}`})]}):m?(0,p.jsx)("i",{className:`wx-hQ64J4 wx-icon ${m}`}):null]})}function Li({date:e,type:t,part:n,onShift:r}){const{calendar:a,formats:s}=(0,u.useContext)(ji).getRaw(),o=e.getFullYear(),i=(0,u.useMemo)(()=>{switch(t){case"month":return gi(s.monthYearFormat,a)(e);case"year":return gi(s.yearFormat,a)(e);case"duodecade":{const{start:e,end:t}=ui(o),n=gi(s.yearFormat,a);return`${n(new Date(e,0,1))} - ${n(new Date(t,11,31))}`}default:return""}},[e,t,o,a,s]);return(0,p.jsxs)("div",{className:"wx-8HQVQV wx-header",children:["right"!==n?(0,p.jsx)("i",{className:"wx-8HQVQV wx-pager wxi-angle-left",onClick:()=>r&&r({diff:-1,type:t})}):(0,p.jsx)("span",{className:"wx-8HQVQV wx-spacer"}),(0,p.jsx)("span",{className:"wx-8HQVQV wx-label",onClick:function(){r&&r({diff:0,type:t})},children:i}),"left"!==n?(0,p.jsx)("i",{className:"wx-8HQVQV wx-pager wxi-angle-right",onClick:()=>r&&r({diff:1,type:t})}):(0,p.jsx)("span",{className:"wx-8HQVQV wx-spacer"})]})}function Fi({onClick:e,children:t}){return(0,p.jsx)("button",{className:"wx-3s8W4d wx-button",onClick:e,children:t})}var Bi={month:{component:function({value:e,current:t,part:n="",markers:r=null,css:a="",onCancel:s,onChange:o}){const i=((0,u.useContext)(ji)||Di()).getRaw().calendar,l=(i.weekStart||7)%7,c=i.dayShort.slice(l).concat(i.dayShort.slice(0,l)),d=(e,t,n)=>new Date(e.getFullYear(),e.getMonth()+(t||0),e.getDate()+(n||0));let h="normal"!==n;function m(e){const t=e.getDay();return 0===t||6===t}const f=(0,u.useRef)(0),g=(0,u.useMemo)(()=>"normal"==n?[e?d(e).valueOf():0]:e?[e.start?d(e.start).valueOf():0,e.end?d(e.end).valueOf():0]:[0,0],[n,e]),x=(0,u.useMemo)(()=>{const e=function(){const e=d(t,0,1-t.getDate());return e.setDate(e.getDate()-(e.getDay()-(l-7))%7),e}(),n=function(){const e=d(t,1,-t.getDate());return e.setDate(e.getDate()+(6-e.getDay()+l)%7),e}(),a=t.getMonth();let s=[];for(let t=e;t<=n;t.setDate(t.getDate()+1)){const e={day:t.getDate(),in:t.getMonth()===a,date:t.valueOf()};let n="";if(n+=e.in?"":" wx-inactive",n+=g.indexOf(e.date)>-1?" wx-selected":"",h){const t=e.date==g[0],r=e.date==g[1];t&&!r?n+=" wx-left":r&&!t&&(n+=" wx-right"),e.date>g[0]&&e.date<g[1]&&(n+=" wx-inrange")}if(n+=m(t)?" wx-weekend":"",r){const e=r(t);e&&(n+=" "+e)}s.push({...e,css:n})}return s},[t,g,h,r]),v=(0,u.useRef)(null);let y=(0,u.useRef)({});return y.current.click=function(e,t){t.timeStamp!==f.current&&(f.current=t.timeStamp,t.stopPropagation(),o&&o(new Date(e)),s&&s())},(0,u.useEffect)(()=>{Ho(v.current,y.current)},[]),(0,p.jsxs)("div",{className:`wx-398RBS wx-month ${a}`,children:[(0,p.jsx)("div",{className:"wx-398RBS wx-weekdays",children:c.map(e=>(0,p.jsx)("div",{className:"wx-398RBS wx-weekday",children:e},e))}),(0,p.jsx)("div",{className:"wx-398RBS wx-days",ref:v,children:x.map(e=>(0,p.jsx)("div",{className:`wx-398RBS wx-day ${e.css} ${e.in?"":"wx-out"}`,"data-id":e.date,children:e.day},e.date))})]})},next:function(e){return(e=new Date(e)).setMonth(e.getMonth()+1),e},prev:function(e){return(e=new Date(e)).setMonth(e.getMonth()-1),e}},year:{component:function({value:e,current:t,part:n,onCancel:r,onChange:a,onShift:s}){const o=(0,u.useRef)(new Date),[i,l]=Io(e||o.current),[c,d]=Io(t||o.current),h=(0,u.useContext)(ji).getRaw().calendar,m=h.monthShort||[],f=(0,u.useMemo)(()=>c.getMonth(),[c]),g=(0,u.useCallback)((e,t)=>{if(null!=e){t.stopPropagation();const n=new Date(c);n.setMonth(e),d(n),s&&s({current:n})}"normal"===n&&l(new Date(c)),r&&r()},[c,n,s,r]),x=(0,u.useCallback)(()=>{const e=new Date(Hi(i,n)||c);e.setMonth(c.getMonth()),e.setFullYear(c.getFullYear()),a&&a(e)},[i,c,n,a]),v=(0,u.useCallback)(e=>{const t=e.target.closest("[data-id]");if(t){const n=parseInt(t.getAttribute("data-id"),10);g(n,e)}},[g]);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"wx-34U8T8 wx-months",onClick:v,children:m.map((e,t)=>(0,p.jsx)("div",{className:"wx-34U8T8 wx-month"+(f===t?" wx-current":""),"data-id":t,children:e},t))}),(0,p.jsx)("div",{className:"wx-34U8T8 wx-buttons",children:(0,p.jsx)(Fi,{onClick:x,children:h.done})})]})},next:function(e){return(e=new Date(e)).setFullYear(e.getFullYear()+1),e},prev:function(e){return(e=new Date(e)).setFullYear(e.getFullYear()-1),e}},duodecade:{component:({value:e,current:t,onCancel:n,onChange:r,onShift:a,part:s})=>{const o=(0,u.useContext)(ji).getRaw().calendar,[i,l]=Io(t),[c,d]=Io(e),h=(0,u.useMemo)(()=>i.getFullYear(),[i]),m=(0,u.useMemo)(()=>{const{start:e,end:t}=ui(h),n=[];for(let r=e;r<=t;++r)n.push(r);return n},[h]),f={click:function(e,t){if(e){t.stopPropagation();const n=new Date(i);n.setFullYear(e),l(n),a&&a({current:n})}"normal"===s&&d(new Date(i)),n&&n()}};const g=(0,u.useRef)(null);return(0,u.useEffect)(()=>{g.current&&Ho(g.current,f)},[]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"wx-1XEF33 wx-years",ref:g,children:m.map((e,t)=>(0,p.jsx)("div",{className:`wx-1XEF33 wx-year ${h==e?"wx-current":""} ${0===t?"wx-prev-decade":""} ${11===t?"wx-next-decade":""}`,"data-id":e,children:e},t))}),(0,p.jsx)("div",{className:"wx-1XEF33 wx-buttons",children:(0,p.jsx)(Fi,{onClick:function(){const e=new Date(Hi(c,s)||i);e.setFullYear(i.getFullYear()),r&&r(e)},children:o.done})})]})},next:function(e){return(e=new Date(e)).setFullYear(e.getFullYear()+10),e},prev:function(e){return(e=new Date(e)).setFullYear(e.getFullYear()-10),e}}};function Hi(e,t){let n;if("normal"===t)n=e;else{const{start:r,end:a}=e;n="left"===t?r:("right"==t||r)&&a}return n}var Vi=["clear","today"];function $i({value:e,current:t,onCurrentChange:n,part:r="normal",markers:a=null,buttons:s,css:o="",onShift:i,onChange:l}){const c=(0,u.useContext)(ji).getGroup("calendar"),[d,h]=(0,u.useState)("month"),m=Array.isArray(s)?s:s?Vi:[],f=e=>{const{diff:r,current:a}=e;if(0!==r){if(r){const e=Bi[d];n(r>0?e.next(t):e.prev(t))}else a&&n(a);i&&i()}else"month"===d?h("year"):"year"===d&&h("duodecade")},g=(0,u.useMemo)(()=>Bi[d].component,[d]);return(0,p.jsx)("div",{className:`wx-2Gr4AS wx-calendar ${"normal"!==r&&"both"!==r?"wx-part":""} ${o}`,children:(0,p.jsxs)("div",{className:"wx-2Gr4AS wx-wrap",children:[(0,p.jsx)(Li,{date:t,part:r,type:d,onShift:f}),(0,p.jsxs)("div",{children:[(0,p.jsx)(g,{value:e,current:t,onCurrentChange:n,part:r,markers:a,onCancel:()=>{"duodecade"===d?h("year"):"year"===d&&h("month")},onChange:e=>{h("month"),l&&l({select:!0,value:e})},onShift:f}),"month"===d&&m.length>0&&(0,p.jsx)("div",{className:"wx-2Gr4AS wx-buttons",children:m.map(e=>(0,p.jsx)("div",{className:"wx-2Gr4AS wx-button-item",children:(0,p.jsx)(Fi,{onClick:t=>((e,t)=>{e.preventDefault(),l&&l({value:t})})(t,function(e){return"done"===e?-1:"clear"===e?null:"today"===e?new Date:void 0}(e)),children:c(e)})},e))})]})]})})}function qi(e){let{words:t=null,optional:n=!1,children:r}=e,a=(0,u.useContext)(ji);const s=(0,u.useMemo)(()=>{let e=a;return(!e||!e.extend)&&(e=yi(bi)),null!==t&&(e=e.extend(t,n)),e},[t,n,a]);return(0,p.jsx)(ji.Provider,{value:s,children:r})}function Ui(e,t,n,r){if(!e||r){const e=t?new Date(t):new Date;e.setDate(1),n(e)}else if(1!==e.getDate()){const t=new Date(e);t.setDate(1),n(t)}}var Gi=["clear","today"];function Wi({value:e,current:t,markers:n=null,buttons:r=Gi,css:a="",onChange:s}){const[o,i]=Io(e),[l,c]=Io(t);(0,u.useEffect)(()=>{Ui(l,o,c,!1)},[o,l]);const d=(0,u.useCallback)(e=>{const t=e.value;t?(i(new Date(t)),Ui(l,new Date(t),c,!0)):i(null),s&&s({value:t?new Date(t):null})},[s,l]),h=(0,u.useCallback)(e=>{c(e)},[c]);return l?(0,p.jsx)(qi,{children:(0,p.jsx)($i,{value:o,current:l,markers:n,buttons:r,css:a,onChange:d,onCurrentChange:h})}):null}function Ki(e){return e||(e={}),e.width||(e.width="unset"),e}var Yi=["clear","today"];function Xi({value:e,id:t,disabled:n=!1,error:r=!1,placeholder:a="",format:s="",buttons:o=Yi,css:i="",title:l="",tooltip:c,editable:d=!1,clear:h=!1,onChange:m,dropdown:f={}}){const{calendar:g,formats:x}=((0,u.useContext)(ji)||Di()).getRaw(),v=s||x?.dateFormat;let y="function"==typeof v?v:gi(v,g);const[b,w]=(0,u.useState)(e),[S,j]=(0,u.useState)(!1);function k(){j(!1)}function C(e){const t=e===b||e&&b&&e.valueOf()===b.valueOf()||!e&&!b;w(e),t||m&&m({value:e}),setTimeout(k,1)}(0,u.useEffect)(()=>{w(e)},[e]);const N=(0,u.useMemo)(()=>b?y(b):"",[b,y]);return(0,u.useEffect)(()=>{const e=k;return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[]),(0,p.jsxs)("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>j(!0),children:[(0,p.jsx)(Oi,{css:`wx-date-input ${i}`,title:l,tooltip:c,value:N,id:t,readonly:!d,disabled:n,error:r,placeholder:a,onInput:k,onChange:function({value:e,input:t}){if(!d&&!h||t)return;let n="function"==typeof d?d(e):e?new Date(e):null;n=isNaN(n)?b||null:n||null,C(n)},icon:"wxi-calendar",clear:h}),S&&!n&&(0,p.jsx)(Ii,{onCancel:k,...Ki(f),children:(0,p.jsx)(Wi,{buttons:o,value:b,onChange:e=>C(e.value)})})]})}function Zi({value:e="",options:t=[],textOptions:n=null,placeholder:r="",disabled:a=!1,error:s=!1,title:o="",tooltip:i,textField:l="label",clear:c=!1,css:d="",children:h,onChange:m,dropdown:f={}}){const g=(0,u.useRef)(null),x=(0,u.useRef)(null);let[v,y]=Io(e);const b=(0,u.useMemo)(()=>v||0===v?(n||t).find(e=>e.id===v):null,[v,n,t]),w=(0,u.useCallback)(({id:e})=>{(e||0===e)&&(y(e),g.current(null),m&&m({value:e}))},[y,m]),S=(0,u.useCallback)(e=>{e.stopPropagation(),y(""),m&&m({value:""})},[y,m]),j=(0,u.useCallback)(()=>t.findIndex(e=>e.id===v),[t,v]);return(0,p.jsxs)("div",{className:`wx-2YgblL wx-richselect ${d} ${s?"wx-2YgblL wx-error":""} ${a?"wx-2YgblL wx-disabled":""} ${h?"":"wx-2YgblL wx-nowrap"}`,title:o,onClick:()=>g.current(j()),onKeyDown:e=>x.current(e,j()),tabIndex:0,"data-tooltip-text":i,children:[(0,p.jsx)("div",{className:"wx-2YgblL wx-label",children:b?h?h(b):b[l]:r?(0,p.jsx)("span",{className:"wx-2YgblL wx-placeholder",children:r}):" "}),c&&!a&&v?(0,p.jsx)("i",{className:"wx-2YgblL wx-icon wxi-close",onClick:S}):(0,p.jsx)("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!a&&(0,p.jsx)(Pi,{items:t,onReady:function(e){g.current=e.navigate,x.current=e.keydown},onSelect:w,...f,children:({option:e})=>h?h(e):e[l]})]})}var Ji=({options:e=[],value:t="",css:n="",children:r,onChange:a})=>{const[s,o]=(0,u.useState)(t);return(0,u.useEffect)(()=>{o(t)},[t]),(0,p.jsx)("div",{className:`wx-0hMO7P wx-segmented ${n}`,children:e.map(e=>(0,p.jsx)("button",{className:`wx-0hMO7P wx-segment ${e.css} ${e.id===s?"wx-selected":""}`,title:e.title,onClick:()=>(e=>{o(e),a&&a({value:e})})(e.id),"data-tooltip-text":e.tooltip,children:r?Do(r,{option:e}):(0,p.jsxs)(p.Fragment,{children:[e.icon&&(0,p.jsx)("i",{className:`wx-0hMO7P wx-icon ${e.icon} ${e.label?"":"wx-only"}`}),e.label&&(0,p.jsx)("span",{className:"wx-0hMO7P wx-label",children:e.label})]})},e.id))})};function Qi({notice:e={}}){return(0,p.jsxs)("div",{className:`wx-11sNg5 wx-notice wx-${e.type?e.type:""}`,role:"status","aria-live":"polite",children:[(0,p.jsx)("div",{className:"wx-11sNg5 wx-text",children:e.text}),(0,p.jsx)("div",{className:"wx-11sNg5 wx-button",children:(0,p.jsx)("i",{className:"wx-11sNg5 wxi-close",onClick:function(){e.remove&&e.remove()}})})]})}function el({data:e=[]}){return(0,p.jsx)("div",{className:"wx-3nwoO9 wx-notices",children:e.map(e=>(0,p.jsx)(Qi,{notice:e},e.id))})}function tl({title:e="",buttons:t=["cancel","ok"],header:n,children:r,footer:a,css:s="",onConfirm:o,onCancel:i}){const l=((0,u.useContext)(ji)||Di()).getGroup("core"),c=(0,u.useRef)(null);return(0,u.useEffect)(()=>{c.current?.focus()},[]),(0,p.jsx)("div",{className:`wx-1FxkZa wx-modal ${s}`,ref:c,tabIndex:0,onKeyDown:function(e){switch(e.code){case"Enter":{const t=e.target.tagName;if("TEXTAREA"===t||"BUTTON"===t)return;o&&o({event:e});break}case"Escape":i&&i({event:e})}},children:(0,p.jsxs)("div",{className:"wx-1FxkZa wx-window",children:[n||(e?(0,p.jsx)("div",{className:"wx-1FxkZa wx-header",children:e}):null),(0,p.jsx)("div",{children:r}),a||t&&(0,p.jsx)("div",{className:"wx-1FxkZa wx-buttons",children:t.map(e=>(0,p.jsx)("div",{className:"wx-1FxkZa wx-button",children:(0,p.jsx)(Ti,{type:"block "+("ok"===e?"primary":"secondary"),onClick:t=>function(e,t){const n={event:e,button:t};"cancel"===t?i&&i(n):o&&o(n)}(t,e),children:l(e)})},e))})]})})}var nl=(0,u.forwardRef)(function({children:e},t){const[n,r]=(0,u.useState)(null),[a,s]=(0,u.useState)([]);return(0,u.useImperativeHandle)(t,()=>({showModal:e=>{const t={...e};return r(t),new Promise((e,n)=>{t.resolve=t=>{r(null),e(t)},t.reject=e=>{r(null),n(e)}})},showNotice:e=>{(e={...e}).id=e.id||ci(),e.remove=()=>s(t=>t.filter(t=>t.id!==e.id)),-1!=e.expire&&setTimeout(e.remove,e.expire||5100),s(t=>[...t,e])}}),[]),(0,p.jsxs)(p.Fragment,{children:[e,n&&(0,p.jsx)(tl,{title:n.title,buttons:n.buttons,onConfirm:n.resolve,onCancel:n.reject,children:n.message}),(0,p.jsx)(el,{data:a})]})});function rl(e){let{children:t}=e,n=(0,u.useRef)();const r=(0,u.useMemo)(()=>({showNotice:e=>n.current.showNotice(e),showModal:e=>n.current.showModal(e)}),[]);return(0,p.jsx)(Si.Provider,{value:r,children:(0,p.jsx)(nl,{ref:n,children:t})})}var al=({value:e=!1,type:t="",icon:n="",disabled:r=!1,iconActive:a="",onClick:s,title:o="",tooltip:i,css:l="",text:c="",textActive:d="",children:h,active:m,onChange:f})=>{const[g,x]=Io(e),v=(0,u.useMemo)(()=>(g?"pressed":"")+(t?" "+t:""),[g,t]),y=(0,u.useCallback)(e=>{let t=!g;s&&s(e),e.defaultPrevented||(x(t),f&&f({value:t}))},[g,s,f]);return g&&m?(0,p.jsx)(Ti,{title:o,tooltip:i,text:g&&d||c,css:l,type:v,icon:g&&a||n,onClick:y,disabled:r,children:Do(m,{value:g})}):h?(0,p.jsx)(Ti,{title:o,tooltip:i,text:g&&d||c,css:l,type:v,icon:g&&a||n,onClick:y,disabled:r,children:h}):(0,p.jsx)(Ti,{title:o,tooltip:i,text:g&&d||c,css:l,type:v,icon:g&&a||n,onClick:y,disabled:r})};function sl(){return(0,p.jsx)(p.Fragment,{})}function ol(e){const{fonts:t=!0,children:n}=e;return(0,p.jsx)(wi.Provider,{value:"willow",children:(0,p.jsxs)(p.Fragment,{children:[n&&n&&(0,p.jsx)("div",{className:"wx-theme wx-willow-theme",children:n}),t&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("link",{rel:"preconnect",href:"https://cdn.svar.dev",crossOrigin:"true"}),(0,p.jsx)(sl,{}),(0,p.jsx)("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}Fo(Lo);var il={grid:{"Add before":"Add before","Add after":"Add after",Copy:"Copy",Cut:"Cut",Paste:"Paste",Delete:"Delete","New row":"New row","Move up":"Move up","Move down":"Move down",Undo:"Undo",Redo:"Redo",selected:"selected"}},ll=((new Date).valueOf(),class{constructor(e){this._nextHandler=null,this._dispatch=e,this.exec=this.exec.bind(this)}async exec(e,t){return this._dispatch(e,t),this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}});(new Date).valueOf();var cl=class{constructor(e){const t=new Map;t.set(0,{id:0,$level:0,data:[],parent:null}),this._pool=t,e&&e.length&&this.parse(e,0)}parse(e,t){const n=this._pool;for(let a=0;a<e.length;a++){const r=e[a];r.parent=r.parent||t,r.data=null,n.set(r.id,r)}for(let a=0;a<e.length;a++){const t=e[a],r=n.get(t.parent);r&&(r.data||(r.data=[]),r.data.push(t))}const r=n.get(t);this.setLevel(r,r.$level+1,!1)}add(e,t){const n=this._pool.get(e.parent||0);e.$level=n.$level+1,this._pool.set(e.id,e),n.data?-1===t?n.data=[...n.data,e]:ul(n,t,e):n.data=[e]}addAfter(e,t){if(!t)return this.add(e,-1);const n=this.byId(t),r=this.byId(n.parent),a=hl(r,n.id)+1;e.parent=r.id,e.$level=r.$level+1,this.add(e,a)}remove(e){const t=this._pool.get(e);this._remove(t);const n=this._pool.get(t.parent);n.data=n.data.filter(t=>t.id!=e),this._clearBranch(n)}_remove(e){e.data&&e.data.forEach(e=>this._remove(e)),this._pool.delete(e.id)}update(e,t){let n=this._pool.get(e);const r=this._pool.get(n.parent),a=hl(r,n.id);n={...n,...t},r&&a>=0&&(r.data[a]=n,r.data=[...r.data]),this._pool.set(n.id,n)}move(e,t,n){const r=this._pool.get(e),a="child"===t,s=this._pool.get(n),o=s.$level+(a?1:0);if(!r||!s)return;const i=this._pool.get(r.parent),l=a?s:this._pool.get(s.parent);l.data||(l.data=[]);const c=hl(i,r.id);!function(e,t){const n=[...e.data];n.splice(t,1),e.data=n}(i,c);const d=a?l.data.length:hl(l,s.id)+("after"===t?1:0);if(ul(l,d,r),i.id===l.id&&c===d)return null;r.parent=l.id,r.$level!==o&&(r.$level=o,this.setLevel(r,o+1,!0)),this.update(r.id,r),this._clearBranch(i)}_clearBranch(e){e.data&&!e.data.length&&(e.open&&delete e.open,this.update(e.id,{data:null}))}toArray(){const e=[],t=this._pool.get(0).data;return t&&dl(t,e),e}byId(e){return this._pool.get(e)}getBranch(e){return this._pool.get(e).data}forEach(e){this._pool.forEach((t,n)=>{0!==n&&e(t)})}eachChild(e,t){const n=this.byId(t);!n||!n.data||n.data.forEach((t,n)=>{e(this.byId(t.id),n),this.eachChild(e,t.id)})}setLevel(e,t,n){e.data&&(e.data=e.data.map(e=>(n&&(e={...e},this._pool.set(e.id,e)),e.$level=t,e.data&&this.setLevel(e,t+1,n),e)))}};function dl(e,t){e.forEach(e=>{t.push(e),!0===e.open&&dl(e.data,t)})}function ul(e,t,n){const r=[...e.data];r.splice(t,0,n),e.data=r}function hl(e,t){return e?.data.findIndex(e=>e.id===t)}var ml=class{constructor(e){e&&(this._writable=e.writable,this._async=e.async),this._values={},this._state={}}setState(e,t=0){const n={};return this._wrapProperties(e,this._state,this._values,"",n,t),n}getState(){return this._values}getReactive(){return this._state}_wrapProperties(e,t,n,r,a,s){for(const o in e){const i=t[o],l=n[o],c=e[o];if(i&&(l===c&&"object"!=typeof c||c instanceof Date&&l instanceof Date&&l.getTime()===c.getTime()))continue;const d=r+(r?".":"")+o;i?(i.__parse(c,d,a,s)&&(n[o]=c),2&s?a[d]=i.__trigger:i.__trigger()):(c&&c.__reactive?t[o]=this._wrapNested(c,c,d,a):t[o]=this._wrapWritable(c),n[o]=c),a[d]=a[d]||null}}_wrapNested(e,t,n,r){const a=this._wrapWritable(e);return this._wrapProperties(e,a,t,n,r,0),a.__parse=(e,n,r,s)=>(this._wrapProperties(e,a,t,n,r,s),!1),a}_wrapWritable(e){const t=[],n=function(){for(let n=0;n<t.length;n++)t[n](e)};return{subscribe:n=>(t.push(n),this._async?setTimeout(n,1,e):n(e),()=>{const e=t.indexOf(n);e>=0&&t.splice(e,1)}),__trigger:()=>{t.length&&(this._async?setTimeout(n,1):n())},__parse:function(t){return e=t,!0}}}};function pl(e,t){return Object.defineProperty(e,"__reactive",{value:!0,enumerable:!1,writable:!1}),e}var fl=class{constructor(e,t,n,r){this._setter="function"==typeof e?e:e.setState.bind(e),this._routes=t,this._parsers=n,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(e=>{e.in.forEach(t=>{const n=this._triggers.get(t)||[];n.push(e),this._triggers.set(t,n)}),e.out.forEach(t=>{const n=this._sources.get(t)||{};e.in.forEach(e=>n[e]=!0),this._sources.set(t,n)})}),this._routes.forEach(e=>{e.length=Math.max(...e.in.map(e=>gl(e,this._sources,1)))}),this._bus=r}init(e){const t={};for(const n in e)if(this._prev[n]!==e[n]){const r=this._parsers[n];t[n]=r?r(e[n]):e[n]}this._prev=this._prev?{...this._prev,...e}:{...e},this.setState(t),this._bus&&this._bus.exec("init-state",t)}setStateAsync(e){const t=this._setter(e,2);return this._async?Object.assign(this._async.signals,t):this._async={signals:t,timer:setTimeout(this._applyState.bind(this),1)},t}_applyState(){const e=this._async;if(e){this._async=null,this._triggerUpdates(e.signals,[]);for(const t in e.signals){const n=e.signals[t];n&&n()}}}setState(e,t=[]){const n=this._setter(e);return this._triggerUpdates(n,t),n}_triggerUpdates(e,t){const n=Object.keys(e),r=!t.length;t=t||[];for(let a=0;a<n.length;a++){const e=n[a],r=this._triggers.get(e);r&&r.forEach(e=>{-1==t.indexOf(e)&&t.push(e)})}r&&this._execNext(t)}_execNext(e){for(;e.length;){e.sort((e,t)=>e.length<t.length?1:-1);const t=e[e.length-1];e.splice(e.length-1),t.exec(e)}}};function gl(e,t,n){const r=t.get(e);if(!r)return n;const a=Object.keys(r).map(e=>gl(e,t,n+1));return Math.max(...a)}var xl=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(e,t,n){let r=this._handlers[e];r?n&&n.intercept?r.unshift(t):r.push(t):r=this._handlers[e]=[t],n&&n.tag&&this._tag.set(t,n.tag)}intercept(e,t,n){this.on(e,t,{...n,intercept:!0})}detach(e){for(const t in this._handlers){const n=this._handlers[t];for(let t=n.length-1;t>=0;t--)this._tag.get(n[t])===e&&n.splice(t,1)}}async exec(e,t){const n=this._handlers[e];if(n)for(let r=0;r<n.length;r++){const e=n[r](t);if(!1===e||e&&e.then&&!1===await e)return}return this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}},vl=1024;function yl(e){return e<vl?`${e} B`:e<vl**2?`${(e/vl).toFixed(1)} KB`:e<vl**3?`${(e/vl**2).toFixed(1)} MB`:`${(e/vl**3).toFixed(1)} GB`}function bl(e,t){t||(t={key:"name",order:"asc"});const n=e.filter(e=>"folder"===e.type),r=e.filter(e=>"folder"!==e.type);return[...n.sort(jl(t)),...r.sort(jl(t))]}function wl(e,t){return"string"==typeof e?e.localeCompare(t,void 0,{numeric:!0}):"object"==typeof e?e.getTime()-t.getTime():(e??0)-(t??0)}function Sl(e,t){return"string"==typeof e?-e.localeCompare(t,void 0,{numeric:!0}):"object"==typeof t?t.getTime()-e.getTime():(t??0)-(e??0)}function jl({key:e,order:t}){const n="asc"===t?wl:Sl;return(t,r)=>n(t[e],r[e])}function kl(e,t){const n="/"===e?1:e.split("/").length;return n>=t.length?null:t[n].id}var Cl=class extends cl{constructor(e){super([{id:"/",name:"My files",open:!0,$level:1,parent:0,ext:"",type:"folder"}]),this.parse(e,"/")}parse(e,t,n){!e||!e.length||(e.forEach(e=>this.parseId(e,n?t:void 0)),super.parse(e,t))}parseId(e,t){if(0===e.parent)return;const n=e.id,r=n.lastIndexOf("/");if(e.parent=t??(0===r?"/":n.slice(0,r)),e.name=n.slice(r+1),e.type=e.type||"file","folder"!==e.type){const t=e.name.lastIndexOf("."),n=-1!==t?e.name.slice(t+1):"";e.ext="new"!==n?n?.toLocaleLowerCase():""}}getParents(e){const t=[];let n=this.byId(e);if(!n)return t;for(;0!==n.id;)t.push(n),n=this.byId(n.parent);return t.reverse()}findFiles(e,t="/"){const n=[],r=e.toLocaleLowerCase();return this.eachChild(e=>{-1!==e.name.toLowerCase().indexOf(r)&&n.push(e)},t),n}add(e,t){const n=this.byId(e.parent||"/"),r=e.data?[...e.data]:null;e.data=null,super.add(e,t??n.data?n.data.length:0),r&&r.forEach(e=>this.add(e))}renameFiles(e,t,n){const r=this.byId(e),a=this.normalizeFile(r,t),s=[];return a.data?.forEach(e=>s.push(this.renameFiles(e.id,a.id,n))),s.length&&(a.data=s),n[e]=a.id,a}copyFiles(e,t,n){const r={};return e.forEach(e=>{const a=this.renameFiles(e,t,r);this.add(a),n&&this.remove(e),r[e]=a.id}),r}moveFiles(e,t){if(this.byId(e[0]).parent!==t)return this.copyFiles(e,t,!0)}serialize(e="/"){const t=[],n=this.byId(e);return n?(n.data?.forEach(e=>{const{id:n,date:r,type:a,size:s,lazy:o}=e,i={id:n,date:r,type:a??"file"};o&&(i.lazy=o),s&&(i.size=s),t.push(i);const l=this.serialize(n);l.length&&t.push(...l)}),t):null}normalizeFile(e,t){const n=e.name,r=n.lastIndexOf("."),a=-1!==r?n.slice(r+1):"",s=a?`.${a}`:"";let o=-1!==r?n.slice(0,r):n,i=t+("/"===t?"":"/")+o;for(;this.byId(i+s);){const e=".new";i+=e,o+=e}return{...e,id:i+s,name:o+s,parent:t,ext:a.toLocaleLowerCase()}}},Nl=class extends ml{in;_router;constructor(e){super({writable:e,async:!1});const t=[];for(let a=0;a<2;a++)t.push({in:["data",`panels.${a}.path`],out:[`panels.${a}._crumbs`],exec:e=>{const{data:t,panels:n}=this.getState(),r=[];r[a]={_crumbs:t.getParents(n[a].path)},this.setState({panels:r},e)}}),t.push({in:["data",`panels.${a}.path`,`panels.${a}._sorts`,"search"],out:[`panels.${a}._files`],exec:e=>{const{data:t,panels:n,search:r}=this.getState();let s;s=r?t.findFiles(r,n[a].path):t.byId(n[a].path)?.data||[];const{path:o,_sorts:i}=n[a];s=bl(s,i[o]);const l=[];l[a]={_files:s},this.setState({panels:l},e)}}),t.push({in:["data",`panels.${a}.selected`,`panels.${a}._sorts`],out:[`panels.${a}._selected`],exec:e=>{const{data:t,panels:n}=this.getState(),r=[];n[a].selected.forEach(e=>{const n=t.byId(e);n&&r.push(n)});const{path:s,_sorts:o}=n[a],i=bl(r,o[s]),l=[];l[a]={_selected:i},this.setState({panels:l},e)}});this._router=new fl(super.setState.bind(this),t,{data:e=>new Cl(e)});const n=this.in=new xl;n.on("select-file",({id:e,toggle:t,range:n,panel:r,type:a})=>{const{panels:s,activePanel:o}=this.getState();typeof r>"u"&&(r=o),e||(t=n=!1);let i=[...s[r].selected];if(t){const t=i.indexOf(e);-1===t?i.push(e):i.splice(t,1)}else if(n&&s[r]._lastSelected){const t=s[r]._files;let n=t.findIndex(e=>e.id==s[r]._lastSelected),a=t.findIndex(t=>t.id==e);a<n&&([n,a]=[a,n]);const o=t.slice(n,a+1).map(e=>e.id);i=[...new Set([...i,...o])]}else i=e?[e]:[];const l=[];l[r]={selected:i,_lastSelected:e,_selectNavigation:"navigation"===a},this.setState({panels:l})}),n.on("set-path",({id:e,panel:t,selected:r})=>{const{data:a,activePanel:s}=this.getState(),o=a.byId(e);if(o){const a=[];typeof t>"u"&&(t=s),a[t]={path:e},this.setState({panels:a}),n.exec("select-file",{panel:t}),r&&r.forEach(e=>n.exec("select-file",{id:e,panel:t,toggle:!0})),o.lazy&&n.exec("request-data",{id:e})}}),n.on("provide-data",({id:e,data:t})=>{const{mode:n,data:r}=this.getState(),a=r.byId(e);a&&(a.lazy||(a.data=[]),a.lazy=!1,r.parse(t,e,"search"===n),this.setState({data:r}))}),n.on("open-tree-folder",({id:e,mode:t})=>{const{data:n}=this.getState();n.update(e,{open:t}),this.setState({data:n})}),n.on("show-preview",({mode:e})=>{this.setState({preview:e})}),n.on("rename-file",e=>{const{id:t,name:n}=e,{data:r,panels:a}=this.getState(),s=r.byId(t);if(s.name!==n){s.name=n;const o=r.normalizeFile(s,s.parent);e.newId=o.id,o.data=null,r.add(o);let i={[t]:o.id};s.data?.forEach(e=>i={...r.moveFiles([e.id],o.id),...i});const l=a.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));r.remove(t),this._updatePanels(l,i),this.setState({data:r,panels:l})}}),n.on("create-file",e=>{const{file:t,parent:r}=e,{data:a}=this.getState(),s=a.normalizeFile(t,r);s.type=t.type||"file",e.newId=s.id,a.add(s),this.setState({data:a}),n.exec("select-file",{id:s.id})}),n.on("delete-files",({ids:e})=>{const{data:t,panels:n}=this.getState(),r=n.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));e.forEach(e=>t.remove(e)),this._updatePanels(r,{}),this.setState({data:t,panels:r})}),n.on("copy-files",e=>{const{ids:t,target:r}=e;if(this._isPlacedIntoSelf(t,r))return void(e.skipProvider=!0);const{data:a,panels:s,activePanel:o}=this.getState(),i=a.copyFiles(t,r);e.newIds=t.map(e=>i[e]),this.setState({data:a}),s[o].path==r&&(n.exec("select-file",{}),t.forEach(e=>{n.exec("select-file",{id:i[e],toggle:!0})}))}),n.on("move-files",e=>{const{ids:t,target:r}=e;if(this._isPlacedIntoSelf(t,r))return void(e.skipProvider=!0);const{data:a,panels:s,activePanel:o}=this.getState(),i=a.moveFiles(t,r);if(i){e.newIds=t.map(e=>i[e]);const l=s.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));this._updatePanels(l,i,!0),this.setState({data:a,panels:l}),s[o].path==r&&(n.exec("select-file",{}),t.forEach(e=>{n.exec("select-file",{id:i[e],toggle:!0})}))}});let r=null;n.on("filter-files",({text:e})=>{if(!e)return void(r&&this.setState({...r}));n.exec("select-file",{});const{panels:t,mode:a}=this.getState();r||(r={panels:t,mode:a,search:""}),this.setState({mode:"search",search:e})}),n.on("set-mode",({mode:e})=>{const{activePanel:t}=this.getState(),n=[];n[t]={_selectNavigation:!1};const a={mode:e,search:"",panels:n};r=null,this.setState(a)}),n.on("set-active-panel",({panel:e})=>{this.setState({activePanel:e})}),n.on("sort-files",({key:e,order:t,panel:n,path:r})=>{const{activePanel:a,panels:s}=this.getState();n=n??a,r=r??s[n].path;const o=[];o[n]={_sorts:{...s[n]._sorts,[r]:{key:e,order:t}}},this.setState({panels:o})}),this.initOnce()}initOnce(){const e=[];for(let n=0;n<2;n++)e[n]=pl({_crumbs:[],_files:[],_selected:[],_sorts:{},path:"/",selected:[],...e[n]});const t={panels:pl(e),data:[],search:""};this._router.init(t)}init(e){const t={...e};this._router.init(t)}setState(e,t){return this._router.setState(e,t)}getFile(e){const{data:t}=this.getState();return t.byId(e)||null}serialize(e){const{data:t}=this.getState();return t.serialize(e)}_updatePanels(e,t,n){const{data:r}=this.getState();e.forEach(e=>{const a=[];e.selected.forEach(e=>{r.byId(e)?a.push(e):!n&&t[e]&&a.push(t[e])}),e.selected=a,r.byId(e._lastSelected)||(e._lastSelected=n?null:t[e._lastSelected]||null);const s={};Object.keys(e._sorts).forEach(a=>{r.byId(a)?s[a]=e._sorts[a]:t[a]&&!n&&(s[t[a]]=e._sorts[a])}),e._sorts=s;const o=e._crumbs[e._crumbs.length-1];"/"!==o?.id&&(t[o.id]?e.path=t[o.id]:r.byId(o.id)||(e.path="/"))})}_isPlacedIntoSelf(e,t){return e.some(e=>e===t||this.getState().data.getParents(t).some(t=>t.id===e))}};function Tl(e){switch(e){case"body":return[{icon:"wxi-content-paste",text:"Paste",hotkey:"Ctrl+V",id:"paste"}];case"add":return[{icon:"mdi mdi-folder-plus-outline",text:"Add new file",id:"add-file"},{icon:"mdi mdi-file-plus-outline",text:"Add new folder",id:"add-folder"},{icon:"mdi mdi-file-upload-outline",text:"Upload file",id:"upload",comp:"upload"}];case"multiselect":return[{icon:"wxi-content-copy",text:"Copy",hotkey:"Ctrl+C",id:"copy"},{icon:"wxi-content-cut",text:"Cut",hotkey:"Ctrl+X",id:"move"},{comp:"separator"},{icon:"wxi-close",text:"Delete",hotkey:"Delete",id:"delete"}];default:return["folder"===e?null:{icon:"wxi-download",text:"Download",hotkey:"Ctrl+D",id:"download"},{icon:"wxi-content-copy",text:"Copy",hotkey:"Ctrl+C",id:"copy"},{icon:"wxi-content-cut",text:"Cut",hotkey:"Ctrl+X",id:"move"},{icon:"wxi-content-paste",text:"Paste",hotkey:"Ctrl+V",id:"paste"},{comp:"separator"},{icon:"wxi-edit",text:"Rename",hotkey:"Ctrl+R",id:"rename"},{icon:"wxi-close",text:"Delete",hotkey:"Delete",id:"delete"}].filter(e=>null!==e)}}function Ml(e,t="data-id"){const n=function(e,t="data-id"){let n=e;for(!n.tagName&&e.target&&(n=e.target);n;){if(n.getAttribute&&n.getAttribute(t))return n;n=n.parentNode}return null}(e,t);return n?n.getAttribute(t):null}function El(e,t){const{api:n}=t;function r(e){const r=e.code.replace("Key","").toLowerCase();(function(e,r){const a=t.getPanel(),s=a.selected,o=r.ctrlKey||r.metaKey,i=r.shiftKey;let l;const c=s?.[0]?n.getFile(s[0]):null;l=s?.length?s.length>1?t.menuOptions("multiselect"):t.menuOptions(c.type,c):t.menuOptions("body");const d=`${o?"ctrl+":""}${i?"shift+":""}${e}`,u=!!l&&l.find(e=>e.hotkey?.toLowerCase()===d),h=t.performAction;if(u)switch(d){case"ctrl+c":h("copy");break;case"ctrl+x":h("move");break;case"ctrl+v":h("paste",c);break;case"delete":h("delete");break;case"ctrl+r":r.preventDefault(),h("rename",c);break;case"ctrl+d":r.preventDefault(),h("download",c);break;default:u.handler?.({context:c})}switch(e){case"enter":{if(o||i)break;const{_crumbs:e,_selectNavigation:t}=a;if(t){const t=function(e){return e.length>1?e[e.length-2].id:null}(e);if(t){const r=kl(t,e);n.exec("set-path",{id:t,selected:[r]})}}else if(1===s.length){const e=n.getFile(s[0]);e&&n.exec("folder"===e.type?"set-path":"open-file",{id:e.id})}break}case"arrowup":case"arrowleft":{const{_files:e,_selected:t,path:r,_selectNavigation:s}=a;let l;if(t.length){const a=t.at(0).id,s=e.findIndex(e=>e.id===a);if(-1!==s){const t=s-1;e[t]?l=e[t].id:"/"!==r&&!o&&!i&&n.exec("select-file",{type:"navigation"})}}else{if(s)break;if("/"!==r){n.exec("select-file",{type:"navigation"});break}l=e.at(0)?.id}l&&n.exec("select-file",{id:l,toggle:o,range:i});break}case"arrowdown":case"arrowright":{const{_files:e,_selected:t,path:r,_selectNavigation:s}=a;let l;if(t.length){const n=t.at(-1).id,r=e.findIndex(e=>e.id===n);if(-1!==r){const t=r+1;e[t]&&(l=e[t].id)}}else{if("/"!==r&&!s){n.exec("select-file",{type:"navigation"});break}l=e.at(0)?.id}l&&n.exec("select-file",{id:l,toggle:o,range:i});break}}})(r,e),"tab"==r&&setTimeout(()=>{const e=document.activeElement;-1!=e.className.indexOf("table")&&n.exec("set-active-panel",{panel:+Ml(e,"data-panel")})})}return e.addEventListener("keydown",r),{destroy:()=>{e.removeEventListener("keydown",r)}}}function Al(e,t="data-id"){const n=e.getAttribute(t);return n?function(e){if(e.startsWith(":"))return e.substring(1);const t=1*e;return isNaN(t)?e:t}(n):null}(new Date).valueOf();var Rl={detect:()=>!0,addEvent:function(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)},addGlobalEvent:function(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)},getTopNode:function(){return window.document.body}};(new Date).valueOf();function Il(e){const[t,n]=(0,u.useState)(e),r=(0,u.useRef)(e);return(0,u.useEffect)(()=>{if(r.current!==e){if(Array.isArray(r.current)&&Array.isArray(e)&&0===r.current.length&&0===e.length)return;r.current=e,n(e)}},[e]),[t,n]}function Dl(e,t){const n=e.getState();return function(e,t){const[n,r]=(0,u.useState)(()=>t);return(0,u.useEffect)(()=>{if(e)return e.subscribe(e=>{r(()=>e)})},[e]),n}(e.getReactiveState()[t],n[t])}function _l(e,t){const n=e.getState();return function(e,t){const n=(0,u.useRef)(t);n.current=t;const[r,a]=(0,u.useState)(1);return(0,u.useEffect)(()=>e.subscribe(e=>{n.current=e,a(e=>e+1)}),[e]),[n.current,r]}(e.getReactiveState()[t],n[t])}function zl(e){const t={};return e.split(";").forEach(e=>{const[n,r]=e.split(":");if(r){let e=n.trim();e.indexOf("-")&&(e=e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())),t[e]=r.trim()}}),t}function Pl(e){let t=e,n=[];return{subscribe:e=>{n.push(e),e(t)},unsubscribe:e=>{n=n.filter(t=>t!==e)},set:e=>{t=e,n.forEach(e=>e(t))},update:e=>{t=e(t),n.forEach(e=>e(t))}}}function Ol(e,t,n){return Rl.addEvent(e,n,function(e){const r=function(e,t="data-id"){let n=e;for(!n.tagName&&e.target&&(n=e.target);n;){if(n.getAttribute&&n.getAttribute(t))return n;n=n.parentNode}return null}(e);if(!r)return;const a=Al(r);if("function"==typeof t)return t(a,e);let s,o=e.target;for(;o!=r;){if(s=o.dataset?o.dataset.action:null,s&&t[s])return void t[s](a,e);o=o.parentNode}t[n]&&t[n](a,e)})}function Ll(e,t){return e.map((e,n)=>{const r=t(e,n);return e.data&&e.data.length&&(r.data=Ll(e.data,t)),r}).filter(Boolean)}function Fl(e,t){const n=[];return e.forEach(e=>{if(e.data){const r=Fl(e.data,t);r.length&&n.push({...e,data:r})}else t(e)&&n.push(e)}),n}function Bl(e){return Ll(e,(t,n)=>{const r={...t,id:t.id||ci()};return r.type&&(r.comp=r.type),"separator"===r.comp&&"separator"===e[n-1]?.comp?null:r})}var Hl={};function Vl({onClick:e,onShow:t,option:n}){const r=(0,u.useRef)(null),a=(0,u.useCallback)(()=>{t(!!n.data&&n.id,r.current)},[t,n]),s=(0,u.useCallback)(a=>{if(n.data)return a.stopPropagation(),void t(n.id,r.current);e(a)},[e,t,n]),o=(0,u.useMemo)(()=>n&&n.comp?function(e){return Hl[e]||e}(n.comp):null,[n]);return(0,p.jsxs)("div",{ref:r,className:`wx-cDCz9rZQ wx-option ${n.css||""} ${n.disabled?"wx-disabled":""}`,"data-id":Oo(n.id),onMouseEnter:a,onClick:s,children:[n.icon?(0,p.jsx)("i",{className:`wx-cDCz9rZQ wx-icon ${n.icon}`}):null,n.comp?o?(0,p.jsx)(o,{item:n,option:n}):null:(0,p.jsxs)("span",{className:"wx-cDCz9rZQ wx-value",children:[" ",n.text," "]}),n.subtext?(0,p.jsx)("span",{className:"wx-cDCz9rZQ wx-subtext",children:n.subtext}):null,n.data?(0,p.jsx)("i",{className:"wx-cDCz9rZQ wx-sub-icon wxi-angle-right"}):null]})}function $l({options:e,left:t=0,top:n=0,at:r="bottom",parent:a=null,mount:s=null,context:o=null,css:i="",onClick:l,onCancel:c}){const[d,h]=(0,u.useState)(-1e4),[m,f]=(0,u.useState)(-1e4),[g,x]=(0,u.useState)(20),[v,y]=(0,u.useState)(),b=(0,u.useRef)(null),[w,S]=(0,u.useState)(!1),[j,k]=(0,u.useState)(null),C=(0,u.useCallback)(()=>{const e=oi(b.current,a,r,t,n);e&&(h(e.x),f(e.y),y(e.width));let s=e?.z??20;const o=a?function(e){const t=[];let n=e;const r=Lo.getTopNode(e);for(;n&&n!==r&&!n.getAttribute("data-wx-portal-root");)"absolute"===getComputedStyle(n).position&&t.push(n),n=n.parentNode;return t}(a):[];let i=0;for(const t of o){const e=parseInt(getComputedStyle(t).zIndex,10);e>i&&(i=e)}i>=s&&(s=i+1),x(s)},[a,r,t,n]);(0,u.useEffect)(()=>{s&&s(C)},[]);const N=(0,u.useCallback)(()=>{S(!1)},[]),T=(0,u.useCallback)((e,t)=>{S(e),k(t)},[]),M=(0,u.useMemo)(()=>Bl(e),[e]);(0,u.useEffect)(()=>{C()},[a,C]);const E=(0,u.useRef)(l),A=(0,u.useRef)(c),R=(0,u.useRef)(a);return(0,u.useEffect)(()=>{E.current=l},[l]),(0,u.useEffect)(()=>{A.current=c},[c]),(0,u.useEffect)(()=>{R.current=a},[a]),(0,u.useEffect)(()=>{if(b.current)return Yo(b.current,{callback:function(e){A.current?A.current(e):E.current&&E.current({action:null,option:null})},modal:!0,parent:()=>R.current}).destroy},[]),(0,p.jsx)("div",{ref:b,"data-wx-menu":"true",className:`wx-XMmAGqVx wx-menu ${i}`,style:{position:"absolute",top:m+"px",left:d+"px",width:v,zIndex:g},onMouseLeave:N,children:M.map(e=>(0,p.jsxs)(u.Fragment,{children:["separator"===e.comp?(0,p.jsx)("div",{className:"wx-XMmAGqVx wx-separator"}):(0,p.jsx)(Vl,{option:e,onShow:T,onClick:t=>{if(!e.data&&!t.defaultPrevented){const n={context:o,action:e,option:e,event:t};e.handler&&e.handler(n),l&&l(n),t.stopPropagation()}}}),e.data&&w===e.id?(0,p.jsx)($l,{css:i,options:e.data,at:"right-overlap",parent:j,context:o,onClick:l,onCancel:c}):null]},e.id))})}var ql=(0,u.forwardRef)(function(e,t){const{options:n,at:r="bottom",resolver:a=null,dataKey:s="contextId",filter:o=null,css:i="",children:l,onClick:c}=e,[d,h]=(0,u.useState)(null),[m,f]=(0,u.useState)(null),[g,x]=(0,u.useState)(0),[v,y]=(0,u.useState)(0),b=(0,u.useRef)(null),w=(0,u.useMemo)(()=>`data-${s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,[s]),S=(0,u.useMemo)(()=>null!==d&&o?Fl(n,e=>o(e,d)):n,[d,o,n]);const j=(0,u.useCallback)((e,t)=>{if(!e)return void f(null);if(e.defaultPrevented)return;const n=e.target;if(n&&n.dataset&&n.dataset.menuIgnore)return;if(m&&m===n)return f(null),void e.preventDefault();x(e.clientX+1),y(e.clientY+1);let r=typeof t<"u"?t:zo(n,w);a&&(r=a(r,e),!r)||(h(r),f(n),b.current=e.nativeEvent||e,e.preventDefault())},[m,w,a]);return(0,u.useImperativeHandle)(t,()=>({show:j}),[j]),(0,p.jsxs)(p.Fragment,{children:[l?(0,p.jsx)("span",{onClick:j,"data-menu-ignore":"true",children:"function"==typeof l?l():l}):null,m?(0,p.jsx)(Ei,{children:(0,p.jsx)($l,{css:i,at:r,top:v,left:g,parent:m,context:d,onClick:function(e){f(null),c&&c(e)},onCancel:function(e){b.current!==e?(f(null),c&&c({action:null,option:null})):b.current=null},options:S},m)}):null]})}),Ul=(0,u.forwardRef)(function(e,t){const{options:n,at:r="bottom",css:a="",children:s,onClick:o}=e,[i,l]=(0,u.useState)(null),c=(0,u.useRef)(null);const d=(0,u.useCallback)(e=>{l(e.target),c.current=e.nativeEvent||e,e.preventDefault()},[]);return(0,u.useImperativeHandle)(t,()=>({show:d}),[d]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{onClick:function(e){let t=e.target;for(;!t.dataset.menuIgnore;)l(t),t=t.parentNode},"data-menu-ignore":"true",children:s}),i?(0,p.jsx)(Ei,{children:(0,p.jsx)($l,{css:a,at:r,parent:i,options:n,onClick:function(e){l(null),o&&o(e)},onCancel:function(e){c.current!==e?(l(null),o&&o({action:null,option:null})):c.current=null}})}):null]})}),Gl=(0,u.forwardRef)(function(e,t){const{options:n,at:r="bottom",resolver:a=null,dataKey:s="contextId",filter:o=null,css:i="",children:l,onClick:c}=e,d=(0,u.useRef)(null),h=(0,u.useCallback)((e,t)=>{d.current.show(e,t)},[]);return(0,u.useImperativeHandle)(t,()=>({show:h}),[h]),(0,p.jsxs)(p.Fragment,{children:[l?(0,p.jsx)("span",{onContextMenu:h,"data-menu-ignore":"true",children:l}):null,(0,p.jsx)(ql,{css:i,at:r,options:n,resolver:a,dataKey:s,filter:o,ref:d,onClick:c})]})}),Wl={uploader:{B:"B",KB:"KB",MB:"MB",GB:"GB",TB:"TB",PB:"PB",EB:"EB","Drop files here or":"Drop files here or","select files":"select files"}},Kl=class{constructor(e,t,n,r,a){this.setFiles=e,this.setReady=t,this.setSignal=n,this.setDrag=r,a&&a.length&&this.setFiles(a)}open(e){this.setSignal(["click",e||{}])}getState(){let e="server";const t=this.files;for(let n=0;n<t.length;n++){if("client"===t[n].status)return"client";"error"===t[n].status&&(e="error")}return e}droparea(e,t){t=t||{};const n=()=>{t.dragEnter&&t.dragEnter(),this.setDrag(!0)},r=()=>{t.dragLeave&&t.dragLeave(),this.setDrag(!1)},a=e=>{e.preventDefault()},s=e=>{e.preventDefault(),this.setDrag(!1),this.setSignal(["drop",t,e]),t.dragLeave&&t.dragLeave(),t.drop&&t.drop()};return e.addEventListener("dragenter",n),e.addEventListener("dragleave",r),e.addEventListener("dragover",a,!0),e.addEventListener("drop",s,!0),()=>{e.removeEventListener("dragenter",n),e.removeEventListener("dragleave",r),e.removeEventListener("dragover",a,!0),e.removeEventListener("drop",s,!0)}}updateFile(e,t){const n=this.files.findIndex(t=>t.id===e);if(-1===n)return;const r=[...this.files];return r[n]={...r[n],...t},this.files=r,this.setFiles(this.files),this.files[n]}deleteFile(e){this.files=this.files.filter(t=>t.id!==e),this.setFiles(this.files)}addFile(e,t){this.files=t?[...this.files,e]:[e],this.setFiles(this.files)}deleteAll(){this.files=[],this.setFiles(this.files)}};function Yl(e){const[t,n]=(0,u.useState)(e||[]),[r,a]=(0,u.useState)(Promise.resolve(null)),[s,o]=(0,u.useState)(null),[i,l]=(0,u.useState)(!1),c=(0,u.useRef)();return c.current||(c.current=new Kl(n,a,o,l,e)),c.current.files=t,c.current.ready=r,c.current.signal=s,c.current.drag=i,c.current}var Xl=({data:e,accept:t="",multiple:n=!0,folder:r=!1,uploadURL:a="",apiOnly:s=!1,disabled:o=!1,children:i,onChange:l,onUpload:c})=>{const d=(0,u.useRef)(null),h=(0,u.useRef)(null),[m,f]=(0,u.useState)({}),g=Yl(),x=e||g,v=function(e,t){if(e){const n=e.getGroup(t);if(n)return n}return yi(Wl).getGroup(t)}((0,u.useContext)(Ci.i18n),"uploader");(0,u.useEffect)(()=>{d.current&&r&&(d.current.webkitdirectory=!0)},[r]),(0,u.useEffect)(()=>{if(!s&&h.current&&!o)return x.droparea(h.current)},[s,o,h]);const y=(e,t)=>{const n=x.updateFile(e,t),r={...n,status:x.getState()};n&&n.uploaded&&n.uploaded(r),c&&c(r),n.temp&&x.deleteFile(n.id)},b=e=>{if(!e)return;const t="function"==typeof a?a(e):(e=>{const t=new FormData;return t.append("upload",e.file),fetch(a,{method:"POST",body:t}).then(e=>e.json()).then(t=>({id:e.id,...t}),()=>({id:e.id,status:"error"})).catch(t=>({id:e.id,status:"error"}))})(e);x.setReady(t.then(t=>{t.status=t.status||"server",y(e.id,t)}).catch(t=>{y(e.id,{status:"error",error:t})}))},w=(e,t)=>{const r={...t||m,id:Math.random().toString(36).substr(2,9),status:"client",name:e.name,file:e};r.selected&&r.selected(r),l&&l(r),x.addFile(r,n),b(r),d.current&&(d.current.value="")},S=(e,t,n)=>{e.isFile?e.file(e=>{w(e,n)}):e.isDirectory&&e.createReader().readEntries(e=>{e.forEach(e=>{S(e,t+e.name+"/",n)})})},j=e=>{Array.from(e.target.files).forEach(e=>w(e))},k=()=>{d.current&&d.current.click()};return(0,u.useEffect)(()=>{if(x.signal){const[e,t,n]=x.signal;f(t),"click"===e?k():"drop"===e&&((e,t)=>{Array.from(e.dataTransfer.items).forEach(e=>{const n=e.webkitGetAsEntry();n&&S(n,"",t)})})(n,t),x.setSignal(null)}},[x.signal]),s?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:d,onChange:j,accept:t,multiple:n,disabled:o}),i]}):(0,p.jsxs)("div",{className:`wx-at1A8tb8 wx-label ${x.drag?"wx-active":""} ${o?"wx-disabled":""}`,ref:h,children:[(0,p.jsx)("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:d,onChange:j,accept:t,multiple:n,disabled:o}),i||(0,p.jsx)("div",{className:"wx-at1A8tb8 wx-dropzone",children:(0,p.jsxs)("span",{children:[v("Drop files here or")," ",(0,p.jsx)("span",{className:"wx-at1A8tb8 wx-action",onClick:k,children:v("select files")})]})})]})};(new Date).valueOf();function Zl(e,t){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e||null===e)return e===t;if(typeof e!=typeof t||(null===e||null===t)&&e!==t||e instanceof Date&&t instanceof Date&&e.getTime()!==t.getTime())return!1;if("object"==typeof e){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=e.length-1;n>=0;n--)if(!Zl(e[n],t[n]))return!1;return!0}return function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in t)if(!Zl(e[n],t[n]))return!1;return!0}(e,t)}return e===t}function Jl(e){if("object"!=typeof e||null===e)return e;if(e instanceof Date)return new Date(e);if(e instanceof Array)return e.map(Jl);const t={};for(const n in e)t[n]=Jl(e[n]);return t}var Ql=class{constructor(e){e&&(this._writable=e.writable,this._async=e.async),this._values={},this._state={}}setState(e,t=0){const n={};return this._wrapProperties(e,this._state,this._values,"",n,t),n}getState(){return this._values}getReactive(){return this._state}_wrapProperties(e,t,n,r,a,s){for(const o in e){const i=t[o],l=n[o],c=e[o];if(i&&(l===c&&"object"!=typeof c||c instanceof Date&&l instanceof Date&&l.getTime()===c.getTime()))continue;const d=r+(r?".":"")+o;i?(i.__parse(c,d,a,s)&&(n[o]=c),2&s?a[d]=i.__trigger:i.__trigger()):(c&&c.__reactive?t[o]=this._wrapNested(c,c,d,a):t[o]=this._wrapWritable(c),n[o]=c),a[d]=a[d]||null}}_wrapNested(e,t,n,r){const a=this._wrapWritable(e);return this._wrapProperties(e,a,t,n,r,0),a.__parse=(e,n,r,s)=>(this._wrapProperties(e,a,t,n,r,s),!1),a}_wrapWritable(e){const t=[],n=function(){for(let n=0;n<t.length;n++)t[n](e)};return{subscribe:n=>(t.push(n),this._async?setTimeout(n,1,e):n(e),()=>{const e=t.indexOf(n);e>=0&&t.splice(e,1)}),__trigger:()=>{t.length&&(this._async?setTimeout(n,1):n())},__parse:function(t){return e=t,!0}}}},ec=class{constructor(e,t,n,r){this._setter="function"==typeof e?e:e.setState.bind(e),this._routes=t,this._parsers=n,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(e=>{e.in.forEach(t=>{const n=this._triggers.get(t)||[];n.push(e),this._triggers.set(t,n)}),e.out.forEach(t=>{const n=this._sources.get(t)||{};e.in.forEach(e=>n[e]=!0),this._sources.set(t,n)})}),this._routes.forEach(e=>{e.length=Math.max(...e.in.map(e=>tc(e,this._sources,1)))}),this._bus=r}init(e){const t={};for(const n in e)if(this._prev[n]!==e[n]){const r=this._parsers[n];t[n]=r?r(e[n]):e[n]}this._prev=this._prev?{...this._prev,...e}:{...e},this.setState(t),this._bus&&this._bus.exec("init-state",t)}setStateAsync(e){const t=this._setter(e,2);return this._async?Object.assign(this._async.signals,t):this._async={signals:t,timer:setTimeout(this._applyState.bind(this),1)},t}_applyState(){const e=this._async;if(e){this._async=null,this._triggerUpdates(e.signals,[]);for(const t in e.signals){const n=e.signals[t];n&&n()}}}setState(e,t=[]){const n=this._setter(e);return this._triggerUpdates(n,t),n}_triggerUpdates(e,t){const n=Object.keys(e),r=!t.length;t=t||[];for(let a=0;a<n.length;a++){const e=n[a],r=this._triggers.get(e);r&&r.forEach(e=>{-1==t.indexOf(e)&&t.push(e)})}r&&this._execNext(t)}_execNext(e){for(;e.length;){e.sort((e,t)=>e.length<t.length?1:-1);const t=e[e.length-1];e.splice(e.length-1),t.exec(e)}}};function tc(e,t,n){const r=t.get(e);if(!r)return n;const a=Object.keys(r).map(e=>tc(e,t,n+1));return Math.max(...a)}var nc=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(e,t,n){let r=this._handlers[e];r?n&&n.intercept?r.unshift(t):r.push(t):r=this._handlers[e]=[t],n&&n.tag&&this._tag.set(t,n.tag)}intercept(e,t,n){this.on(e,t,{...n,intercept:!0})}detach(e){for(const t in this._handlers){const n=this._handlers[t];for(let t=n.length-1;t>=0;t--)this._tag.get(n[t])===e&&n.splice(t,1)}}async exec(e,t){const n=this._handlers[e];if(n)for(let r=0;r<n.length;r++){const e=n[r](t);if(!1===e||e&&e.then&&!1===await e)return}return this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}};function rc(e,t){return(t.getter||function(e){return t=>t[e]}(t.id))(e)}function ac(e,t,n){return(t.setter||function(e){return(t,n)=>t[e]=n}(t.id))(e,n)}function sc(e,t){let n=rc(e,t)??"";return t.template?n=t.template(n,e,t):t.optionsMap&&(n=Array.isArray(n)?n.map(e=>t.optionsMap.get(e)).join(", "):t.optionsMap.get(n)),typeof n>"u"?"":n+""}function oc(e,t,n,r,a){const s=/\n|"|;|,/;for(let o=0;o<t[0][e].length;o++){const i=[];for(let n=0;n<t.length;n++){let r=(t[n][e][o].text||"")+"";s.test(r)&&(r='"'+r.replace(/"/g,'""')+'"'),i.push(r)}n+=(n?a:"")+i.join(r)}return n}var ic={a3:{width:11.7,height:16.5},a4:{width:8.27,height:11.7},letter:{width:8.5,height:11}};function lc(e,t){const n=[];let r=[],a=0;const s=e.filter(e=>!e.hidden),o=function(e){const{mode:t,ppi:n,paper:r}=e,{width:a,height:s}=ic[r];return function(e,t){return e*t}("portrait"===t?a:s,n)}(t);return s.forEach((e,t)=>{a+e.width<=o?(a+=e.width,r.push(e)):(r.length&&n.push(r),r=[e],a=e.width),t===s.length-1&&r.length&&n.push(r)}),n}function cc(e,t,n){const r=[];return e.forEach((a,s)=>{const o=a[t];for(let i=0;i<n.length;i++){r[i]||(r[i]=[]);const a={...o[i]};if(null!==r[i][s]){if(!s&&!a.rowspan&&!a.colspan){let r=1,o=e[s+r][t][i],l=a.width;for(;!o.rowspan&&!o.colspan;)r++,o=e[s+r][t][i],l+=o.width;a.colspan=r,a.width=l,a.height=n[i]}if(r[i].push(a),!a.collapsed&&a.colspan>1){let t=a.colspan-1;if(a.colspan+s>e.length){const n=a.colspan-(a.colspan+s-e.length);a.colspan=n,a.width=e.slice(s,s+t+1).reduce((e,t)=>e+t.width,0),n>1&&(t=n-1)}for(let e=0;e<t;e++)r[i].push(null)}if(a.rowspan>1){const e=a.rowspan;for(let t=1;t<e;t++)r[i+t]||(r[i+t]=[]),r[i+t].push(null)}}}if(a.collapsed)for(let e=0;e<r.length;e++){const t=r[e],n=t[s];if(n&&n.collapsed){if(t[s]=null,!e)break}else{const e=n||t.findLast(e=>e?.colspan>=1);e&&(e.colspan=e.colspan-1,e.width=e.width-a.width)}}}),r.map(e=>e.filter(e=>e&&0!==e.colspan))}function dc(e,t){return e.flexgrow?`min-width:${t}px;width:auto`:`width:${e.width}px; max-width:${e.width}px; height:${e.height}px`}function uc(e,t,n){let r=e[n.id];if("richselect"===n.filter.type&&r){const e=n.filter.config?.options||t.find(({id:e})=>e==n.id).options;e&&(r=e.find(({id:e})=>e==r).label)}return r??""}var hc=["resize-column","hide-column","update-cell"],mc=["delete-row","update-row","update-cell"],pc=["move-item"],fc=["resize-column","move-item"],gc=class{undo=[];redo=[];progress={};in;getState;setState;_previousValues={};constructor(e,t,n){this.in=e,this.getState=t,this.setState=n,this.setHandlers(),this.resetStateHistory()}getHandlers(){return{"add-row":{handler:e=>({action:"delete-row",data:{id:e.id},source:{action:"add-row",data:e}})},"delete-row":{handler:e=>{const{id:t}=e,{data:n}=this.getPrev(),r=n.findIndex(e=>e.id===t);return{action:"add-row",data:{id:t,row:n[r],before:r<n.length-1?n[r+1].id:void 0},source:{action:"delete-row",data:e}}}},"update-cell":{handler:e=>{const{id:t,column:n}=e,r=rc(this.getRow(t),this.getColumn(n));return Zl(r,e.value)?null:{action:"update-cell",data:{id:t,column:n,value:r},source:{action:"update-cell",data:e}}}},"update-row":{handler:e=>{const{id:t,row:n}=e,r=this.getRow(t);for(const a in n)Object.keys(r).includes(a)||(r[a]=void 0);return{action:"update-row",data:{id:t,row:r},source:{action:"update-row",data:e}}}},"copy-row":{handler:e=>{const{id:t}=e,{data:n}=this.getState(),r=n.findIndex(e=>e.id===t),a=n[r];return{action:"delete-row",data:{id:t},source:{action:"add-row",data:{id:t,row:a,before:r<n.length-1?n[r+1].id:void 0}}}}},"resize-column":{handler:e=>{const{id:t,width:n}=e,r=this.getColumn(t),{_sizes:a}=this.getState();return{action:"resize-column",data:{id:t,width:r.width??a.columnWidth},source:{action:"resize-column",data:{id:t,width:n}}}}},"hide-column":{handler:e=>{const{id:t}=e;return{action:"hide-column",data:{id:t,mode:this.getColumn(t).hidden},source:{action:"hide-column",data:e}}}},"collapse-column":{handler:e=>{const{id:t,row:n,mode:r}=e;return{action:"collapse-column",data:{id:t,row:n,mode:"boolean"==typeof r?!r:r},source:{action:"collapse-column",data:e}}}},"move-item":{handler:e=>{const{id:t,target:n,mode:r}=e,{flatData:a}=this.getPrev(),s=a.findIndex(e=>e.id===t);return{action:"move-item",data:{id:t,target:a[s+(s?-1:1)].id,mode:s?"after":"before"},source:{action:"move-item",data:{id:t,target:n,mode:r}}}}},"open-row":{handler:e=>{const{id:t,nested:n}=e;return{action:"close-row",data:{id:t,nested:n},source:{action:"open-row",data:e}}}},"close-row":{handler:e=>{const{id:t,nested:n}=e;return{action:"open-row",data:{id:t,nested:n},source:{action:"close-row",data:e}}}}}}resetHistory(){this.undo=[],this.redo=[],this.progress={},this.resetStateHistory()}getPrev(){return this._previousValues}setHandlers(){const e=this.getHandlers();for(const t in e)this.in.intercept(t,e=>{if("undo"!==e.eventSource&&"redo"!==e.eventSource&&!e.skipUndo){if(fc.includes(t))return(e.inProgress&&!this.progress[t]||"boolean"!=typeof e.inProgress)&&(pc.includes(t)&&this.setPrev("flatData"),hc.includes(t)&&this.setPrev("columns")),void(this.progress[t]=e.inProgress);mc.includes(t)&&this.setPrev("data"),hc.includes(t)&&this.setPrev("columns")}}),this.in.on(t,n=>{if("undo"===n.eventSource||"redo"===n.eventSource||n.skipUndo||n.inProgress)return;const r=e[t].handler(n);r&&this.addToHistory(r)})}setPrev(e){this._previousValues[e]=Jl(this.getState()[e])}addToHistory(e){this.undo.push(e),this.redo=[],this.setStateHistory()}handleUndo(){if(!this.undo.length)return;const e=this.undo.pop();this.redo.push({...e.source,source:e}),this.in.exec(e.action,{...e.data,eventSource:"undo"}),this.setStateHistory()}handleRedo(){if(!this.redo.length)return;const e=this.redo.pop();this.undo.push({...e.source,source:e}),this.in.exec(e.action,{...e.data,eventSource:"redo"}),this.setStateHistory()}resetStateHistory(){this.setState({history:{undo:0,redo:0}})}setStateHistory(){this.setState({history:{undo:this.undo.length,redo:this.redo.length}})}getRow(e){const{data:t}=this.getPrev();return this.getState().tree?this.getTreeRow(t,e):t.find(t=>t.id===e)}getTreeRow(e,t){for(let n=0;n<e.length;n++){if(e[n].id===t)return e[n];if(e[n].data){const r=this.getTreeRow(e[n].data,t);if(r)return r}}return null}getColumn(e){const{columns:t}=this.getPrev();return t.find(t=>t.id===e)}};function xc(e,t){return typeof e>"u"||null===e?-1:typeof t>"u"||null===t?1:e===t?0:e>t?1:-1}function vc(e,t){return-xc(e,t)}function yc(e,t){if(!e||!e.length)return;const n=e.map(e=>{const n=t.find(t=>t.id==e.key);return function(e,t){if("function"==typeof t.sort)return function(n,r){const a=t.sort(n,r);return"asc"===e?a:-a};const n="asc"===e?xc:vc;return function(e,r){return n(rc(e,t),rc(r,t))}}(e.order,n)});return 1===e.length?n[0]:function(e,t){for(let r=0;r<n.length;r++){const a=n[r](e,t);if(0!==a)return a}return 0}}function bc(e,t,n,r,a){const s=document.createElement("div"),o=document.createElement("div"),i=document.body;let l,c;a=a?`${a}px`:"auto",o.className=t,s.classList.add(`wx-${n}-theme`),s.style.cssText=`height:auto;position:absolute;top:0px;left:100px;overflow:hidden;width=${a};white-space:nowrap;`,s.appendChild(o),i.appendChild(s),"object"!=typeof e&&(e=[e]);for(let d=0;d<e.length;d++){o.innerText=e[d]+"";const t=s.getBoundingClientRect(),n=Math.ceil(t.width)+(r&&r.length?r[d]:0),a=Math.ceil(t.height);l=Math.max(l||0,n),c=Math.max(c||0,a)}return s.remove(),{width:l,height:c}}function wc(e,t,n,r,a){const s=[];for(let o=0;o<e.length;o++){const i=e[o][t],l=i.length;for(let e=0;e<l;e++){const{text:o,vertical:l,collapsed:c,rowspan:d,css:u}=i[e];if(!o){s[e]=Math.max(s[e]||0,r);continue}let h=0;if(l&&!c){let l=`wx-measure-cell-${t}`;if(l+=u?` ${u}`:"",h=bc(o,l,a).width,(d>1||!i[e+1])&&n>e+1){const t=d||n-e,a=s.slice(e,e+t).reduce((e,t)=>e+t,0);if(a<h){const n=Math.ceil((h-a)/t);for(let a=e;a<e+t;a++)s[a]=(s[a]||r)+n}continue}}s[e]=Math.max(s[e]||r,h)}}return s}var Sc={text:(e,t)=>e?-1!==e.toString().toLowerCase().indexOf(t.toLowerCase()):!t,richselect:(e,t)=>"number"!=typeof t&&!t||e==t,datepicker:(e,t)=>!t||e&&function(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}(e,t),multiselect:(e,t)=>!t||0===t?.length||(Array.isArray(e)?e?.some(e=>t.includes(e)):e&&t.includes(e))};function jc(e){return Sc[e]}var kc=class extends Ql{in;_router;_branches;_xlsxWorker;_historyManager;constructor(e){super({writable:e,async:!1});const t={rowHeight:37,columnWidth:160,headerHeight:36,footerHeight:36};this._router=new ec(super.setState.bind(this),[{in:["columns","sizes","_skin"],out:["_columns","_sizes"],exec:e=>{const{columns:t,sizes:n,_skin:r}=this.getState(),a=this.copyColumns(t),s=a.reduce((e,t)=>Math.max(t.header.length,e),0),o=a.reduce((e,t)=>Math.max(t.footer.length,e),0);a.forEach(this.setCollapsibleColumns);const i=this.normalizeSizes(a,n,s,o,r);for(let l=0;l<a.length;l++)this.normalizeColumns(a,l,"header",s,i),this.normalizeColumns(a,l,"footer",o,i);this.setState({_columns:a,_sizes:i},e)}},{in:["data","tree","_filterIds"],out:["flatData","_rowHeightFromData"],exec:e=>{const{data:t,tree:n,dynamic:r,_filterIds:a}=this.getState(),s=a&&new Set(a),o=n?this.flattenRows(t,[],a):s?t.filter(e=>s.has(e.id)):t,i=!r&&o.some(e=>e.rowHeight);this.setState({flatData:o,_rowHeightFromData:i},e)}}],{sizes:e=>({...t,...e})});const n=this.in=new nc;n.on("close-editor",({ignore:e})=>{const{editor:t}=this.getState();t&&(e||n.exec("update-cell",t),this.setState({editor:null}))}),n.on("open-editor",({id:e,column:t})=>{let r=this.getState().editor;r&&n.exec("close-editor",{});const a=this.getRow(e),s=t?this.getColumn(t):this.getNextEditor(a);if(s?.editor){let t=s.editor;if("function"==typeof t&&(t=t(a,s)),!t)return;r={column:s.id,id:e,value:rc(a,s)??"",renderedValue:sc(a,s),type:t.type||t},"object"==typeof t&&t.config&&(r.config=t.config,t.config.options&&(r.options=t.config.options)),s.options&&!r.options&&(r.options=s.options),this.setState({editor:r})}}),n.on("editor",({value:e})=>{let t=this.getState().editor;if(t){t={...t},t.value=e;const n=this.getColumn(t.column),r={...this.getRow(t.id)};ac(r,n,e),t.renderedValue=sc(r,n),this.setState({editor:t})}}),n.on("add-row",e=>{const t=this.getState();let{data:r}=t;const{select:a,_filterIds:s}=t,{row:o,before:i,after:l,select:c}=e;if(e.id=o.id=e.id||o.id||Nc(),i||l){const t=i||l,n=r.findIndex(e=>e.id===t);r=[...r],r.splice(n+(l?1:0),0,e.row)}else r=[...r,e.row];const d={data:r};s&&(d._filterIds=[...s,e.id]),this.setState(d),("boolean"!=typeof c||c)&&(c||a)&&n.exec("select-row",{id:o.id,show:!0})}),n.on("delete-row",e=>{const{data:t,selectedRows:n,focusCell:r,editor:a}=this.getState(),{id:s}=e,o={data:t.filter(e=>e.id!==s)};this.isSelected(s)&&(o.selectedRows=n.filter(e=>e!==s)),a?.id===s&&(o.editor=null),this.setState(o),r?.row===s&&this.in.exec("focus-cell",{eventSource:"delete-row"})}),n.on("update-cell",e=>{const t=this.getState();let{data:n}=t;n=[...n];const{tree:r}=t,{id:a,column:s,value:o}=e,i=this.getColumn(s);if(r){const e={...this._branches[a]};ac(e,i,o);const t=this.updateTreeRow(e);0===e.$parent&&(n=t)}else{const e=n.findIndex(e=>e.id===a),t={...n[e]};ac(t,i,o),n[e]=t}this.setState({data:n})}),n.on("update-row",e=>{let{data:t}=this.getState();const{id:n,row:r}=e,a=t.findIndex(e=>e.id===n);t=[...t],t[a]={...t[a],...r},this.setState({data:t})}),n.on("select-row",({id:e,toggle:t,range:n,mode:r,show:a,column:s})=>{const o=this.getState(),{focusCell:i}=o;let{selectedRows:l}=o;if(l.length||(n=t=!1),n){const{data:t}=this.getState();let n=t.findIndex(e=>e.id===l[l.length-1]),r=t.findIndex(t=>t.id===e);n>r&&([n,r]=[r,n]),t.slice(n,r+1).forEach(e=>{this.isSelected(e.id)||l.push(e.id)})}else if(t&&this.isSelected(e)){if(!0===r)return;l=l.filter(t=>t!==e)}else if(t){if(!1===r)return;l.push(e)}else l=[e];this.setState({selectedRows:[...l]}),i?.row!==e&&this.in.exec("focus-cell",{eventSource:"select-row"}),a&&this.in.exec("scroll",{row:e,column:s})}),this.in.on("focus-cell",e=>{const{row:t,column:n,eventSource:r}=e,{_columns:a,split:s}=this.getState();t&&n?(this.setState({focusCell:{row:t,column:n}}),"click"!==r&&((!s.left||a.findIndex(t=>t.id===e.column)>=s.left)&&(!s.right||a.findIndex(t=>t.id===e.column)<a.length-s.right)?this.in.exec("scroll",{row:t,column:n}):this.in.exec("scroll",{row:t}))):this.setState({focusCell:null})}),n.on("resize-column",e=>{const{id:t,auto:n,maxRows:r,inProgress:a}=e;if(!1===a)return;let s=e.width||0;const o=[...this.getState().columns],i=this.getColumn(t);if(n){if("data"===n||!0===n){const{flatData:e,_skin:t}=this.getState();let n=e.length;r&&(n=Math.min(r,n)),s=function(e,t,n){const r=[],a=[];let s="wx-measure-cell-body";s+=e.css?` ${e.css}`:"";for(let o=0;o<t.length;o++){const n=sc(t[o],e);n&&(r.push(n),e.treetoggle?a.push(28*t[o].$level+(t[o].$count?28:0)+(e.draggable?28:0)):e.draggable&&a.push(28))}return bc(r,s,n,a).width}(i,e.slice(0,n),t)}if("header"===n||!0===n){const{_skin:e}=this.getState();s=Math.max(function(e,t){const n="wx-measure-cell-header",r=e.sort?20:0;let a,s=e.header;if("string"==typeof s)return bc(s,n,t).width+r;Array.isArray(s)||(s=[s]);for(let o=0;o<s.length;o++){const e=s[o];let i=bc("string"==typeof e?e:e.text,n+("string"==typeof e?"":` ${e.css}`),t).width;o===s.length-1&&(i+=r),a=Math.max(a||0,i)}return a}(i,e),s)}}i.width=Math.max(17,s),delete i.flexgrow,this.setState({columns:o})}),n.on("hide-column",e=>{const{id:t,mode:n}=e,r=[...this.getState().columns],a=this.getColumn(t),s=r.reduce((e,t)=>e+(t.hidden?0:1),0);!n||s>1?(a.hidden=!a.hidden,this.setState({columns:r})):e.skipUndo=!0}),n.on("sort-rows",e=>{const{key:t,add:n,sort:r}=e,a=this.getState(),{columns:s,data:o,tree:i}=a;if(r){const e=[...o];return e.sort(r),void this.setState({data:e})}const{order:l="asc"}=e;let c=a.sortMarks;const d=Object.keys(c),u=d.length;!n||!u||1===u&&c[t]?c={[t]:{order:l}}:(1===u&&(c[d[0]]={...c[d[0]],index:0}),c={...c,[t]:{order:l,index:"number"==typeof n?n:c[t]?.index??u}});const h=Object.keys(c).sort((e,t)=>c[e].index-c[t].index).map(e=>({key:e,order:c[e].order}));this.setState({sortMarks:c});const m=yc(h,s);if(m){const e=[...o];i?this.sortTree(e,m):e.sort(m),this.setState({data:e})}}),n.on("filter-rows",e=>{const{value:t,key:n,filter:r}=e;if(!Object.keys(e).length)return void this.setState({filterValues:{},_filterIds:null});const a=this.getState(),{data:s,tree:o,_columns:i}=a;let l=a.filterValues;const c={};n&&(l={...l,[n]:t},c.filterValues=l);const d=r??function(e,t){const n=[];for(const r in e){const a=t.find(e=>e.id==r),{config:s,type:o}=a.header.find(e=>e.filter).filter,i=e[r];n.push(e=>{const t=rc(e,a);return s?.handler?s.handler(t,i):jc(o)(t,i)})}return e=>{for(let t=0;t<n.length;t++)if(!n[t](e))return!1;return!0}}(l,i);let u=[];o?u=this.filterTree(s,d,u):s.forEach(e=>{d(e)&&u.push(e.id)}),c._filterIds=u,this.setState(c)}),n.on("collapse-column",e=>{const{id:t,row:n,mode:r}=e,a=[...this.getState().columns],s=this.getColumn(t).header,o=Array.isArray(s)?s[n]:s;"object"==typeof o&&(o.collapsed=r??!o.collapsed,this.setState({columns:a}))}),n.on("move-item",e=>{const{id:t,inProgress:n}=e;let{target:r,mode:a="after"}=e;const{data:s,flatData:o,tree:i}=this.getState(),l=o.findIndex(e=>e.id===t);let c,d;if("up"===a||"down"===a){if("up"===a){if(0===l)return;c=l-1,a="before"}else if("down"===a){if(l===o.length-1)return;c=l+1,a="after"}r=o[c]&&o[c].id}else c=o.findIndex(e=>e.id===r);-1!==l&&-1!==c&&!1!==n&&(i||(d=this.moveItem(t,r,s,a)),this.setState({data:i?this.normalizeTreeRows(d):d}))}),n.on("copy-row",e=>{const{id:t,target:n,mode:r="after"}=e,a=this.getState(),{flatData:s,_filterIds:o}=a;let{data:i}=a;const l=this.getRow(t);if(!l)return;const c={...l,id:Nc()};e.id=c.id;const d=s.findIndex(e=>e.id===n);if(-1===d)return;i.splice(d+("after"===r?1:0),0,c),i=[...i];const u={data:i};o&&(u._filterIds=[...o,c.id]),this.setState(u)}),n.on("open-row",e=>{const{id:t,nested:n}=e;this.toggleBranch(t,!0,n)}),n.on("close-row",e=>{const{id:t,nested:n}=e;this.toggleBranch(t,!1,n)}),n.on("export-data",e=>new Promise((t,n)=>{const r=e.format||"csv",a=`${e.fileName||"data"}.${r}`;if("csv"===r){const n=function(e,t){const n=/\n|"|;|,/;let r="";const a=t.rows||"\n",s=t.cols||"\t",o=e._columns,i=e.flatData;!1!==t.header&&o[0].header&&(r=oc("header",o,r,s,a));for(let l=0;l<i.length;l++){const e=[];for(let t=0;t<o.length;t++){let r=sc(i[l],o[t]);n.test(r)&&(r='"'+r.replace(/"/g,'""')+'"'),e.push(r)}r+=(r?a:"")+e.join(s)}return!1!==t.footer&&o[0].footer&&(r=oc("footer",o,r,s,a)),r}(this.getState(),e.csv||{});!1!==e.download?function(e,t){const n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}(new Blob(["\ufeff"+n],{type:"text/csv"}),a):e.result=n,t(!0)}else n()})),n.on("hotkey",({key:e,event:t,isInput:n})=>{switch(e){case"arrowup":{const{flatData:e,focusCell:r,select:a}=this.getState();if(t.preventDefault(),n)return;const s=r?r.column:this._getFirstVisibleColumn()?.id,o=r?this.getPrevRow(r.row)?.id:e[e.length-1]?.id;s&&o&&(this.in.exec("focus-cell",{row:o,column:s,eventSource:"key"}),a&&this.in.exec("select-row",{id:o}));break}case"arrowdown":{const{flatData:e,focusCell:r,select:a}=this.getState();if(t.preventDefault(),n)return;const s=r?r.column:this._getFirstVisibleColumn()?.id,o=r?this.getNextRow(r.row)?.id:e[0]?.id;s&&o&&(this.in.exec("focus-cell",{row:o,column:s,eventSource:"key"}),a&&this.in.exec("select-row",{id:o}));break}case"arrowright":{const{focusCell:e}=this.getState();if(n)return;if(t.preventDefault(),e){const t=this.getNextColumn(e.column,!0)?.id;t&&this.in.exec("focus-cell",{row:e.row,column:t,eventSource:"key"})}break}case"arrowleft":{const{focusCell:e}=this.getState();if(n)return;if(t.preventDefault(),e){const t=this.getPrevColumn(e.column,!0)?.id;t&&this.in.exec("focus-cell",{row:e.row,column:t,eventSource:"key"})}break}case"tab":{const{editor:e,focusCell:n,select:r}=this.getState();if(e){t.preventDefault();const n=e.column;let a=e.id,s=this.getNextEditor(this.getRow(a),this.getColumn(n));if(!s){const e=this.getNextRow(a);e&&(a=e.id,s=this.getNextEditor(e))}s&&(this.in.exec("open-editor",{id:a,column:s.id}),this.in.exec("focus-cell",{row:a,column:s.id,eventSource:"key"}),r&&!this.isSelected(a)&&this.in.exec("select-row",{id:a}))}else n&&this.in.exec("focus-cell",{eventSource:"key"});break}case"shift+tab":{const{editor:e,focusCell:n,select:r}=this.getState();if(e){t.preventDefault();const n=e.column;let a=e.id,s=this.getPrevEditor(this.getRow(a),this.getColumn(n));if(!s){const e=this.getPrevRow(a);e&&(a=e.id,s=this.getPrevEditor(e))}s&&(this.in.exec("open-editor",{id:a,column:s.id}),this.in.exec("focus-cell",{row:a,column:s.id,eventSource:"key"}),r&&!this.isSelected(a)&&this.in.exec("select-row",{id:a}))}else n&&this.in.exec("focus-cell",{eventSource:"key"});break}case"escape":{const{editor:e}=this.getState();e&&(this.in.exec("close-editor",{ignore:"multiselect"!=e.type}),this.in.exec("focus-cell",{row:e.id,column:e.column,eventSource:"key"}));break}case"f2":{const{editor:e,focusCell:t}=this.getState();!e&&t&&this.in.exec("open-editor",{id:t.row,column:t.column});break}case"enter":{const{focusCell:e,tree:t}=this.getState();if(!n&&t&&e&&this.getColumn(e.column).treetoggle){const t=this.getRow(e.row);if(!t.data)return;this.in.exec(t.open?"close-row":"open-row",{id:e.row,nested:!0})}break}case"home":{const{editor:e,focusCell:n}=this.getState();if(!e&&n){t.preventDefault();const e=this._getFirstVisibleColumn()?.id;this.in.exec("focus-cell",{row:n.row,column:e,eventSource:"key"})}break}case"ctrl+home":{const{editor:e,focusCell:n,flatData:r,select:a}=this.getState();if(!e&&n){t.preventDefault();const e=r[0]?.id,n=this._getFirstVisibleColumn()?.id;e&&n&&(this.in.exec("focus-cell",{row:e,column:n,eventSource:"key"}),a&&!this.isSelected(e)&&this.in.exec("select-row",{id:e}))}break}case"end":{const{editor:e,focusCell:n}=this.getState();if(!e&&n){t.preventDefault();const e=this._getLastVisibleColumn()?.id,r=n.row;this.in.exec("focus-cell",{row:r,column:e,eventSource:"key"})}break}case"ctrl+end":{const{editor:e,focusCell:n,flatData:r,select:a}=this.getState();if(!e&&n){t.preventDefault();const e=r.at(-1).id,n=this._getLastVisibleColumn()?.id;e&&n&&(this.in.exec("focus-cell",{row:e,column:n,eventSource:"key"}),a&&!this.isSelected(e)&&this.in.exec("select-row",{id:e}))}break}case"ctrl+z":this.in.exec("undo",{});break;case"ctrl+y":this.in.exec("redo",{})}}),n.on("scroll",e=>{const{_columns:t,split:n,_sizes:r,flatData:a,dynamic:s,_rowHeightFromData:o}=this.getState();let i=-1,l=-1,c=0,d=0;if(e.column){i=0;const r=t.findIndex(t=>t.id===e.column);c=t[r].width;for(let e=n.left??0;e<r;e++){const n=t[e];n.hidden||(i+=n.width)}}if(e.row&&!s){const t=a.findIndex(t=>t.id===e.row);t>=0&&(o?(l=a.slice(0,t).reduce((e,t)=>e+(t.rowHeight||r.rowHeight),0),d=a[t].rowHeight):l=r.rowHeight*t)}this.setState({scroll:{top:l,left:i,width:c,height:d||r.rowHeight}})}),n.on("scroll-to",e=>{const t={};void 0!==e.top&&(t.scrollTop=e.top),void 0!==e.left&&(t.scrollLeft=e.left),Object.keys(t).length&&this.setState(t)}),n.on("print",e=>{const t=function(e={}){const{mode:t,ppi:n,paper:r}=e;return{mode:t||"portrait",ppi:n||100,paper:r||"a4"}}(e);this.setState({_print:t}),this.setStateAsync({_print:null})}),n.on("undo",()=>{this._historyManager?.handleUndo()}),n.on("redo",()=>{this._historyManager?.handleRedo()}),this.initOnce()}getXlsxWorker(e){if(!this._xlsxWorker){const t=window.URL.createObjectURL(new Blob([`importScripts('${e}');`],{type:"text/javascript"}));this._xlsxWorker=new Promise(e=>{const n=new Worker(t);n.addEventListener("message",t=>{"init"===t.data.type&&e(n)})})}return this._xlsxWorker}initOnce(){this._router.init({sortMarks:{},_filterIds:null,data:[],filterValues:{},scroll:null,scrollLeft:0,scrollTop:0,editor:null,focusCell:null,_print:null,history:{undo:0,redo:0},search:null})}init(e){e.hasOwnProperty("_skin")&&!e._skin&&(e._skin=function(){if(typeof document>"u")return"willow";const e=document.querySelector('[class^="wx"][class$="theme"]');return e?e.className.substring(3,e.className.length-6):"willow"}()),e.columns&&e.columns.forEach(e=>{e.options&&(e.optionsMap=new Map(e.options.map(e=>[e.id,e.label])))}),Zl(this.getState().data,e.data)||(e.tree?e.data=this.normalizeTreeRows(e.data):e.data=this.normalizeRows(e.data),this.setState({_filterIds:null,filterValues:{},sortMarks:{},search:null}),this._historyManager&&this._historyManager.resetHistory()),e.tree&&(e.undo=!1,e.reorder=!1),e.split?.right&&(e.split.right=0),e.undo&&!this._historyManager&&(this._historyManager=new gc(this.in,this.getState.bind(this),this.setState.bind(this))),this._router.init({...e})}setState(e,t){return this._router.setState(e,t)}setStateAsync(e){this._router.setStateAsync(e)}getRow(e){const{tree:t}=this.getState();return t?this._branches[e]:this.getState().data.find(t=>t.id===e)}getRowIndex(e,t){return t||(t=this.getState().flatData),t.findIndex(t=>t.id===e)}getNextRow(e){const t=this.getState().flatData;return t[this.getRowIndex(e,t)+1]}getPrevRow(e){const t=this.getState().flatData;return t[this.getRowIndex(e,t)-1]}getColumn(e){return this.getState().columns.find(t=>t.id===e)}getNextColumn(e,t){const n=this.getState()._columns,r=n.findIndex(t=>t.id===e);return t?this._getFirstVisibleColumn(r+1):n[r+1]}getPrevColumn(e,t){const n=this.getState()._columns,r=n.findIndex(t=>t.id===e);return t?this._getLastVisibleColumn(r-1):n[r-1]}_getFirstVisibleColumn(e){const t=this.getState()._columns;let n=e??0;for(;n<t.length&&(t[n]?.hidden||t[n]?.collapsed);)n++;return t[n]}_getLastVisibleColumn(e){const t=this.getState()._columns;let n=e??t.length-1;for(;n<t.length&&(t[n]?.hidden||t[n]?.collapsed);)n--;return t[n]}isCellEditable(e,t){const{editor:n,hidden:r}=t;return!(!n||r)&&("function"!=typeof n||n(e,t))}getNextEditor(e,t){let n=this.getState().columns;if(t){const e=n.findIndex(e=>e.id===t.id);n=n.slice(e+1)}return n.find(t=>this.isCellEditable(e,t))}getPrevEditor(e,t){let n=this.getState().columns;if(t){const e=n.findLastIndex(e=>e.id===t.id);n=n.slice(0,e)}return n.findLast(t=>this.isCellEditable(e,t))}toggleBranch(e,t,n){let r=this._branches[e],{data:a}=this.getState();if(a=[...a],0!==e){r={...r,open:t};const e=this.updateTreeRow(r);0===r.$parent&&(a=e)}n&&r.data?.length&&r.data.forEach(r=>{const s=this.toggleKids(r,t,n);0===e&&(a=s)}),this.setState({data:a})}toggleKids(e,t,n){e={...e,open:t};const r=this.updateTreeRow(e);return n&&e.data?.length&&e.data.forEach(e=>{this.toggleKids(e,t,n)}),r}updateTreeRow(e){const t=e.id;this._branches[t]=e;const n=this._branches[e.$parent],r=n.data.findIndex(e=>e.id===t);return n.data=[...n.data],n.data[r]=e,n.data}isSelected(e){return-1!==this.getState().selectedRows.indexOf(e)}findAndRemove(e,t){for(let n=0;n<e.length;n++){if(e[n].id===t)return e.splice(n,1)[0];if(e[n].data){const r=[...e[n].data],a=this.findAndRemove(r,t);if(a)return e[n]={...e[n],data:r},a}}return null}insertItem(e,t,n,r){for(let a=0;a<e.length;a++){if(e[a].id===t){const t=e[a],s="before"===r?a:a+1;if(t.data){if("before"===r){const t=a>0?e[a-1]:null;return t?.data&&t.open?e[a-1]={...t,data:[...t.data,n]}:e.splice(s,0,n),!0}if(t.open)return e[a]={...t,data:[n,...t.data]},!0}return e.splice(s,0,n),!0}if(e[a].data&&(e[a]={...e[a],data:[...e[a].data]},this.insertItem(e[a].data,t,n,r)))return!0}return!1}moveItem(e,t,n,r){const a=[...n],s=this.findAndRemove(a,e);return this.insertItem(a,t,s,r),a}copyColumns(e){const t=[];for(let n=0;n<e.length;n++){const r={...e[n]};this.copyHeaderFooter(r,"header"),this.copyHeaderFooter(r,"footer"),t[n]=r}return t}copyHeaderFooter(e,t){let n=e[t];n=Array.isArray(n)?[...n]:[n],n.forEach((e,t)=>{n[t]="string"==typeof e?{text:e}:{...e}}),e[t]=n}setCollapsibleColumns(e,t,n){let r=e.header;for(let a=0;a<r.length;a++){const s=r[a];if(s.collapsible&&s.collapsed){if("first"!==s.collapsible){e.collapsed=!0,e.width=36,s.vertical=!0;const t=r.length-a;r=r.slice(0,a+1),r[a].rowspan=t}const o=s.colspan;if(o){const e=r[a+1];let s=1;e&&e.colspan&&!e.collapsed&&(s=e.colspan);for(let r=s;r<o;r++){const e=n[t+r];e&&(e.hidden=!0)}}}}}normalizeColumns(e,t,n,r,a){const s=e[t];s.width||(s.width=s.flexgrow?17:a.columnWidth),s._colindex=t+1;const o=s[n],i=a[`${n}RowHeights`];for(let l=0;l<r;l++){const c=o[l];c.id=s.id,l===o.length-1&&(c.rowspan=c.rowspan?Math.min(c.rowspan,r-l):r-l);for(let r=1;r<c.rowspan;r++){o.splice(l+r,0,{_hidden:!0});for(let a=1;a<c.colspan;a++)e[t+a][n].splice(l+r,0,{})}if(c.rowspan&&(c.height=(c.rowspan===r?i:i.slice(l,c.rowspan+l)).reduce((e,t)=>e+t,0),l+c.rowspan!=r&&c.height--),c.colspan){let n=s.width,r=s.flexgrow||0;const o=c.colspan;for(let s=1;s<o;s++){const o=e[t+s];o&&(o.hidden?c.colspan-=1:o.flexgrow?r+=o.flexgrow:n+=o.width||a.columnWidth),r?c.flexgrow=r:c.width=n}}else c.width=s.width,c.flexgrow=s.flexgrow;"header"===n&&c.filter&&"string"==typeof c.filter&&(c.filter={type:c.filter})}o.length>r&&(o.length=r),s[n]=o}normalizeRows(e){for(let t=0;t<e.length;t++)e[t].id||(e[t].id=Nc());return e}normalizeTreeRows(e,t,n){return!t&&!n&&(this._branches={0:{data:e}}),e.forEach(e=>{e.id||(e.id=Nc()),e.$level=t||0,e.$parent=n||0,this._branches[e.id]=e,e.data&&(e.data.length?(e.$count=e.data.length,this.normalizeTreeRows(e.data,e.$level+1,e.id)):(delete e.data,delete e.$count,delete e.open))}),e}sortTree(e,t){e.sort(t),e.forEach(e=>{e.data&&this.sortTree(e.data,t)})}filterTree(e,t,n){return e.forEach(e=>{t(e)&&n.push(e.id),e.data&&this.filterTree(e.data,t,n)}),n}flattenRows(e,t,n){const r=t;return e.forEach(e=>{(!n||n.includes(e.id))&&r.push(e),e.data?.length&&!1!==e.open&&this.flattenRows(e.data,r,n)}),r}createFilter(e){const{_columns:t}=this.getState(),n=[];for(const r in e){const a=t.find(e=>e.id==r),{config:s,type:o}=a.header.find(e=>e.filter).filter,i=e[r];n.push(e=>{const t=rc(e,a);return s?.handler?s.handler(t,i):jc(o)(t,i)})}return e=>{for(let t=0;t<n.length;t++)if(!n[t](e))return!1;return!0}}searchRows(e,t){e=e.trim().toLowerCase();const n={};if(!e)return n;const{flatData:r,columns:a}=this.getState(),s=t?a.filter(e=>t[e.id]):a;return r.forEach(t=>{const r={};s.forEach(n=>{const a=sc(t,n);String(a).toLowerCase().includes(e)&&(r[n.id]=!0)}),Object.keys(r).length&&(n[t.id]=r)}),n}normalizeSizes(e,t,n,r,a){const s=wc(e,"header",n,t.headerHeight,a),o=wc(e,"footer",r,t.footerHeight,a),i=s.reduce((e,t)=>e+t,0),l=o.reduce((e,t)=>e+t,0);return{...t,headerRowHeights:s,footerRowHeights:o,headerHeight:i,footerHeight:l}}},Cc=(new Date).valueOf();function Nc(){return"temp://"+Cc++}(new Date).valueOf();var Tc=class{constructor(){this.store=new Map}configure(e,t){this.node=t;for(const n in e)if(e[n]){const t=n.toLowerCase().replace(/[ ]/g,""),r=e[n];this.store.set(t,r)}}},Mc=[],Ec=e=>{Ac||(Ac=!0,document.addEventListener("keydown",e=>{if(Mc.length&&(e.ctrlKey||e.altKey||e.metaKey||e.shiftKey||e.key.length>1||" "===e.key)){const t=[];e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.metaKey&&t.push("meta"),e.shiftKey&&t.push("shift");let n=e.code.replace("Key","").toLocaleLowerCase();" "===e.key&&(n="space"),t.push(n);const r=t.join("+");for(let a=Mc.length-1;a>=0;a--){const t=Mc[a],s=t.store.get(r)||t.store.get(n);s&&t.node.contains(e.target)&&s(e,{key:r,evKey:n})}}}));const t=new Tc;return Mc.push(t),e(t),()=>{const e=Mc.findIndex(e=>e===t);e>=0&&Mc.splice(e,1)}},Ac=!1;var Rc={tab:!0,"shift+tab":!0,arrowup:!0,arrowdown:!0,arrowright:!0,arrowleft:!0,enter:!0,escape:!0,f2:!0,home:!0,end:!0,"ctrl+home":!0,"ctrl+end":!0,"ctrl+z":!0,"ctrl+y":!0};var Ic=(0,u.createContext)(null);function Dc(e){const t=e.getBoundingClientRect(),n=document.body,r=t.top+n.scrollTop-n.clientTop||0,a=t.left+n.scrollLeft-n.clientLeft||0;return{y:Math.round(r),x:Math.round(a),width:e.offsetWidth,height:e.offsetHeight}}function _c(e,t){const n=Dc(t);return{x:e.clientX-n.x,y:e.clientY-n.y}}function zc(e,t){const n=t.current;let r,a,s=null,o=!1,i=!1;const l=document.createElement("DIV");function c(){clearTimeout(r),r=null}function d(t){const n=_o(t);n&&(s={container:l,sourceNode:t.target,from:Po(n),pos:_c(t,e)},a=s.pos,u(t))}function u(t){if(!s)return;const r=s.pos=_c(t,e);if(!o){if(!i&&!t?.target?.getAttribute("draggable-data")&&Math.abs(a.x-r.x)<5&&Math.abs(a.y-r.y)<5)return;if(!1===function(t){if(o=!0,n.start){if(!1===n.start(t,s))return!1;e.appendChild(l),document.body.style.cursor="move"}}(t))return w()}if(i){const e=window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft,n=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop;s.targetNode=document.elementFromPoint(t.pageX-e,t.pageY-n)}else s.targetNode=t.target;n.move&&n.move(t,s),l.style.left=-(s.offset?s.offset.x:0)+"px",l.style.top=s.pos.y+(s.offset?s.offset.y:0)+"px"}function h(e){l.parentNode&&l.parentNode.removeChild(l),l.innerHTML="",o&&n.end&&n.end(e,s),s=a=null,w()}function m(e){n.getReorder&&!n.getReorder()||0===e.button&&(b(e),window.addEventListener("mousemove",p),window.addEventListener("mouseup",f),d(e))}function p(e){u(e)}function f(e){h(e)}function g(t){n.getReorder&&!n.getReorder()||(r=setTimeout(()=>{i=!0,d(t.touches[0])},700),b(t),t.target.addEventListener("touchmove",x),t.target.addEventListener("touchend",function e(){r&&c(),t.target.removeEventListener("touchmove",x),t.target.removeEventListener("touchend",e),h(t)}),e.addEventListener("contextmenu",v))}function x(e){o?(e.preventDefault(),u(e.touches[0])):r&&c()}function v(e){if(o||r)return e.preventDefault(),!1}function y(e){e.preventDefault()}function b(e){if(!n.getDraggableInfo)return;const{hasDraggable:t}=n.getDraggableInfo();(!t||e.target.getAttribute("draggable-data"))&&(document.body.style.userSelect="none",document.body.style.webkitUserSelect="none")}function w(t){o=i=!1,document.body.style.cursor="",document.body.style.userSelect="",document.body.style.webkitUserSelect="",window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",f),t&&(e.removeEventListener("mousedown",m),e.removeEventListener("touchstart",g),e.removeEventListener("dragstart",y))}return l.className="wx-drag-zone",l.setAttribute("tabindex",-1),e.addEventListener("mousedown",m),e.addEventListener("touchstart",g),e.addEventListener("dragstart",y),{destroy(){w(!0)}}}function Pc(e,t,n,r){const{node:a,left:s,top:o,bottom:i,sense:l,xScroll:c,yScroll:d}=r,u=_c(e,a);n.scrollState||(n.scrollState={dirX:0,dirY:0,scrollSpeedFactor:1});let h=0,m=0;u.x<s+l?h=-1:u.x>t.width-l&&(h=1),u.y<o+Math.round(l/2)?m=-1:u.y>t.height-i-Math.round(l/2)&&(m=1),(n.scrollState.dirX!==h||n.scrollState.dirY!==m)&&(Oc(n),n.scrollState.dirX=h,n.scrollState.dirY=m),(c&&0!==n.scrollState.dirX||d&&0!==n.scrollState.dirY)&&function(e,t,n){e.autoScrollTimer||(e.autoScrollTimer=setTimeout(()=>{e.activeAutoScroll=setInterval(Lc,15,e,t,n)},250))}(n,r,{x:n.scrollState.dirX,y:n.scrollState.dirY})}function Oc(e){e.scrollSpeedFactor=1,e.autoScrollTimer&&(e.autoScrollTimer=clearTimeout(e.autoScrollTimer),e.activeAutoScroll=clearInterval(e.activeAutoScroll))}function Lc(e,t,n){const{x:r,y:a}=n;e.scrollSpeedFactor+=.004,0!==r&&function(e,t,n){const r=t.node.scrollLeft;Fc(r+Math.round(t.sense/3)*e.scrollSpeedFactor*n,"scrollLeft",t)}(e,t,r),0!==a&&function(e,t,n){const r=t.node.scrollTop;Fc(r+Math.round(t.sense/3)*e.scrollSpeedFactor*n,"scrollTop",t)}(e,t,a)}function Fc(e,t,n){n.node[t]=e}function Bc(e,t,n,r,a,s){const o={};return e&&(o.width=`${e}px`,o.minWidth=`${e}px`),t&&(o.flexGrow=t),s&&(o.height=`${s}px`),n&&(o.position="sticky",n.left&&(o.left=`${r}px`),n.right&&(o.right=`${a}px`)),o}function Hc(e,t,n){let r="";if(e.fixed)for(const a in e.fixed){let n=-1===e.fixed[a];!n&&e.fixed.leftSize&&t.colspan&&(n=t.colspan+e._colindex-1===e.fixed.leftSize),r+=n?"wx-shadow ":"wx-fixed "}return r+=t.rowspan>1?"wx-rowspan ":"",r+=t.colspan>1?"wx-colspan ":"",r+=t.vertical?"wx-vertical ":"",r+=n?n(e)+" ":"",r}function Vc(e){const{row:t,column:n,cellStyle:r=null,columnStyle:a=null,children:s,focusable:o}=e,i=(0,u.useContext)(Ic),l=Dl(i,"focusCell"),c=Dl(i,"search"),d=Dl(i,"reorder"),h=(0,u.useMemo)(()=>c?.rows[t.id]&&c.rows[t.id][n.id],[c,t.id,n.id]),m=(0,u.useMemo)(()=>Bc(n.width,n.flexgrow,n.fixed,n.left,n.right),[n.width,n.flexgrow,n.fixed,n.left,n.right]);const f=(0,u.useMemo)(()=>function(e,r){let a="wx-cell";return a+=n.fixed?" "+(-1===n.fixed?"wx-shadow":"wx-fixed"):"",a+=e?" "+e(n):"",a+=r?" "+r(t,n):"",a+=n.treetoggle?" wx-tree-cell":"",a}(a,r),[a,r,n,t]),g=(0,u.useMemo)(()=>"function"==typeof n.draggable?!1!==n.draggable(t,n):n.draggable,[n,t]),x=(0,u.useRef)(null);(0,u.useEffect)(()=>{x.current&&o&&l?.row===t.id&&l?.column===n.id&&x.current.focus()},[l,o,t.id,n.id]);const v=(0,u.useCallback)(()=>{o&&!l&&i.exec("focus-cell",{row:t.id,column:n.id,eventSource:"focus"})},[i,o,l,t.id,n.id]);const y=(0,u.useMemo)(()=>{const e=n.fixed&&-1===n.fixed.left||-1===n.fixed.right,t=n.fixed&&n.fixed.right;return[f,e?"wx-shadow":"",t?"wx-fixed-right":""].filter(Boolean).join(" ")},[f,n]),b=n.cell;return(0,p.jsxs)("div",{className:"wx-TSCaXsGV "+y,ref:x,onFocus:v,style:m,"data-row-id":Oo(t.id),"data-col-id":Oo(n.id),tabIndex:o?"0":"-1",role:"gridcell","aria-colindex":n._colindex,"aria-readonly":!n.editor||void 0,children:[d&&n.draggable?g?(0,p.jsx)("i",{"draggable-data":"true",className:"wx-TSCaXsGV wx-draggable wxi-drag"}):(0,p.jsx)("i",{className:"wx-TSCaXsGV wx-draggable-stub"}):null,n.treetoggle?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{style:{marginLeft:28*t.$level+"px"}}),t.$count?(0,p.jsx)("i",{"data-action":"toggle-row",className:"wx-TSCaXsGV wx-table-tree-toggle wxi-menu-"+(!1!==t.open?"down":"right")}):null]}):null,b?(0,p.jsx)(b,{api:i,row:t,column:n,onAction:({action:e,data:t})=>i.exec(e,t)}):s?s():h?(0,p.jsx)("span",{children:function(e){const t=new RegExp(`(${c.value.trim()})`,"gi");return String(e).split(t).map(e=>({text:e,highlight:t.test(e)}))}(sc(t,n)).map(({highlight:e,text:t},n)=>e?(0,p.jsx)("mark",{className:"wx-TSCaXsGV wx-search",children:t},n):(0,p.jsx)("span",{children:t},n))}):sc(t,n)]})}function $c(e,t){let n,r;function a(r){n=r.clientX,e.style.opacity=1,document.body.style.cursor="ew-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",s),window.addEventListener("mouseup",o),t&&t.down&&t.down(e)}function s(e){r=e.clientX-n,t&&t.move&&t.move(r)}function o(){e.style.opacity="",document.body.style.cursor="",document.body.style.userSelect="",t&&t.up&&t.up(r),window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",o)}return e.addEventListener("mousedown",a),{destroy(){e.removeEventListener("mousedown",a)}}}function qc(e){const{value:t,options:n=[],placeholder:r="",clear:a=!1,text:s=null,template:o=null,cell:i=null,dropdown:l={},autoOpen:c=!1,onChange:d,onAction:h}=e,[m,f]=Il(t||[]),g=(0,u.useMemo)(()=>(m||[]).map(e=>n.find(t=>t.id===e)).filter(Boolean),[m,n]),x=(0,u.useRef)(null),v=(0,u.useRef)(null),[y,b]=(0,u.useState)(null),w=()=>{const e=m||[];if(!e.length)return 0;const t=n.find(t=>e.includes(t.id));return t?n.indexOf(t):0};return(0,u.useEffect)(()=>{c&&(x.current?.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges())},[]),(0,p.jsxs)("div",{ref:x,className:"wx-multiselect wx-aadNNOwy",onClick:function(){v.current?.(w())},onKeyDown:function(e){y?.(e,w())},tabIndex:0,children:[(0,p.jsx)("div",{className:"wx-label wx-aadNNOwy",children:o?o(g):i?(0,p.jsx)(i,{data:g,onAction:h}):s?(0,p.jsx)("span",{className:"wx-text wx-aadNNOwy",children:s}):g.length?(0,p.jsx)("span",{className:"wx-text wx-aadNNOwy",children:g.map(e=>e.label).join(", ")}):r?(0,p.jsx)("span",{className:"wx-placeholder wx-aadNNOwy",children:r}):" "}),a&&m?.length?(0,p.jsx)("i",{className:"wx-icon wxi-close wx-aadNNOwy",onClick:function(e){e.stopPropagation(),f([]),d&&d({value:[]})}}):(0,p.jsx)("i",{className:"wx-icon wxi-angle-down wx-aadNNOwy"}),(0,p.jsx)(Pi,{items:n,onReady:function(e){v.current=e.navigate,b(()=>e.keydown),c&&e.navigate(w())},onSelect:function({id:e}){f(e),d&&d({value:e})},multiselect:!0,checkboxes:!0,value:m||[],onCancel:function(){v.current?.(null)},...l,children:({option:e})=>(0,p.jsx)("div",{className:"wx-option wx-aadNNOwy",children:o?o(e):i?(0,p.jsx)(i,{data:e,onAction:h}):e.label})})]})}var Uc={text:function({filter:e,column:t,action:n,filterValue:r}){return(0,p.jsx)(Oi,{...e.config??{},value:r,onChange:function({value:e}){n({value:e,key:t.id})}})},richselect:function({filter:e,column:t,action:n,filterValue:r}){const a=Dl((0,u.useContext)(Ic),"flatData"),s=(0,u.useMemo)(()=>e?.config?.options||t?.options||function(){const e=[];return a.forEach(n=>{const r=rc(n,t);e.includes(r)||e.push(r)}),e.map(e=>({id:e,label:e}))}(),[e,t,a]),o=(0,u.useMemo)(()=>e?.config?.template,[e]);return(0,p.jsx)("div",{style:{width:"100%"},onKeyDown:function(e){"Tab"!==e.key&&e.preventDefault()},children:(0,p.jsx)(Zi,{placeholder:"",clear:!0,...e?.config??{},options:s,value:r,onChange:function({value:e}){n({value:e,key:t.id})},children:e=>o?o(e):e.label})})},datepicker:function({filter:e,column:t,action:n,filterValue:r}){return(0,p.jsx)("div",{className:"wx-aaaK5VYO",style:{width:"100%"},children:(0,p.jsx)(Xi,{placeholder:"",clear:!0,...e?.config??{},value:r,onChange:function({value:e}){n({value:e,key:t.id})}})})},multiselect:function({filter:e,column:t,action:n,filterValue:r}){const a=(0,u.useContext)(Ci.i18n)?.getGroup("grid")||yi(il).getGroup("grid"),s=(0,u.useMemo)(()=>({clear:!0,...e?.config||{}}),[e]),o=(0,u.useMemo)(()=>s.options||t.options,[s,t]),i=(0,u.useMemo)(()=>{const e=r?.length;return e?e<3?r.map(e=>t.optionsMap.get(e)).join(", "):e+" "+a("selected"):""},[r,t,a]);return(0,p.jsx)("div",{style:{width:"100%"},onKeyDown:function(e){"Tab"!==e.key&&e.preventDefault()},children:(0,p.jsx)(qc,{placeholder:"",...s,options:o,value:r||[],text:i,onChange:function({value:e}){n({value:e,key:t.id})}})})}};function Gc({filter:e,column:t}){const n=(0,u.useContext)(Ic),r=Dl(n,"filterValues");const a=(0,u.useMemo)(()=>Uc[e.type],[e.type]);return(0,p.jsx)(a,{filter:e,column:t,action:function(e){n.exec("filter-rows",e)},filterValue:r[t.id]})}function Wc(e){const{cell:t,column:n,row:r,lastRow:a,sortRow:s,columnStyle:o,bodyHeight:i,hasSplit:l}=e,c=(0,u.useContext)(Ic),d=Dl(c,"sortMarks"),h=(0,u.useMemo)(()=>d?d[n.id]:void 0,[d,n.id]),m=(0,u.useRef)(),f=(0,u.useCallback)(e=>{m.current=t.flexgrow?e.parentNode.clientWidth:t.width},[t.flexgrow,t.width]),g=(0,u.useCallback)((e,n)=>{c.exec("resize-column",{id:t.id,width:Math.max(1,(m.current||0)+e),inProgress:n})},[c,t.id]),x=(0,u.useCallback)(e=>g(e,!0),[g]),v=(0,u.useCallback)(e=>g(e,!1),[g]),y=(0,u.useCallback)(e=>{if(!n.sort||t.filter)return;let r=h?.order;r&&(r="asc"===r?"desc":"asc"),c.exec("sort-rows",{key:t.id,add:e.ctrlKey||e.metaKey,order:r})},[c,t.id,t.filter,n.sort,h?.order]),b=(0,u.useCallback)(e=>{e&&e.stopPropagation(),c.exec("collapse-column",{id:t.id,row:r})},[c,t.id,r]),w=(0,u.useCallback)(e=>{"Enter"===e.key&&b()},[b]),S=(0,u.useCallback)(e=>{"Enter"===e.key&&!t.filter&&y(e)},[y,t.filter]),j=(0,u.useMemo)(()=>t.collapsed&&n.collapsed,[t.collapsed,n.collapsed]),k=(0,u.useMemo)(()=>j&&!l&&"header"!==t.collapsible,[j,l,t.collapsible]),C=(0,u.useMemo)(()=>k?{top:-i/2,position:"absolute"}:{},[k,i]),N=(0,u.useMemo)(()=>Bc(t.width,t.flexgrow,n.fixed,n.left,t.right??n.right,t.height+(j&&k?i:0)),[t.width,t.flexgrow,n.fixed,n.left,t.right,n.right,t.height,j,k,i]),T=(0,u.useMemo)(()=>Hc(n,t,o),[n,t,o]),M=(0,u.useCallback)(()=>Object.fromEntries(Object.entries(t).filter(([e])=>"cell"!==e)),[t]),E=`wx-cell ${T} ${t.css||""} wx-collapsed`,A=["wx-cell",T,t.css||"",t.filter?"wx-filter":"",n.fixed&&n.fixed.right?"wx-fixed-right":""].filter(Boolean).join(" "),R=(0,u.useRef)(null);return(0,u.useEffect)(()=>{const e=R.current;if(!e)return;const t=$c(e,{down:f,move:x,up:v});return()=>{"function"==typeof t&&t()}},[f,x,v,$c]),j?(0,p.jsx)("div",{className:"wx-RsQD74qC "+E,style:N,role:"button","aria-label":`Expand column ${t.text||""}`,"aria-expanded":!t.collapsed,tabIndex:0,onKeyDown:w,onClick:b,"data-header-id":Oo(n.id),children:(0,p.jsx)("div",{className:"wx-RsQD74qC wx-text",style:C,children:t.text||""})}):(0,p.jsxs)("div",{className:"wx-RsQD74qC "+A,style:N,onClick:y,"data-header-id":Oo(n.id),tabIndex:t._hidden||!n.sort||t.filter?void 0:0,role:"columnheader","aria-colindex":n._colindex,"aria-colspan":t.colspan>1?t.colspan:void 0,"aria-rowspan":t.rowspan>1?t.rowspan:void 0,"aria-sort":!h?.order||t.filter?"none":"asc"===h?.order?"ascending":"descending",onKeyDown:S,children:[t.collapsible?(0,p.jsx)("div",{className:"wx-RsQD74qC wx-collapse",role:"button","aria-label":t.collapsed?"Expand column":"Collapse column","aria-expanded":!t.collapsed,tabIndex:0,onKeyDown:w,onClick:b,children:(0,p.jsx)("i",{className:"wx-RsQD74qC wxi-angle-"+(t.collapsed?"down":"right")})}):null,t.cell?(()=>{const e=t.cell;return(0,p.jsx)(e,{api:c,cell:M(),column:n,row:r,onAction:({action:e,data:t})=>c.exec(e,t)})})():t.filter?(0,p.jsx)(Gc,{filter:t.filter,column:n}):(0,p.jsx)("div",{className:"wx-RsQD74qC wx-text",children:t.text||""}),n.resize&&a&&!t._hidden?(0,p.jsx)("div",{className:"wx-RsQD74qC wx-grip",role:"presentation","aria-label":"Resize column",ref:R,onClick:e=>e.stopPropagation(),children:(0,p.jsx)("div",{})}):null,s?(0,p.jsx)("div",{className:"wx-RsQD74qC wx-sort",children:h?(0,p.jsxs)(p.Fragment,{children:[typeof h.index<"u"?(0,p.jsx)("div",{className:"wx-RsQD74qC wx-order",children:h.index+1}):null,(0,p.jsx)("i",{className:"wx-RsQD74qC wxi-arrow-"+("asc"===h.order?"up":"down")})]}):null}):null]})}function Kc({cell:e,column:t,row:n,columnStyle:r}){const a=(0,u.useContext)(Ic),s=(0,u.useMemo)(()=>Bc(e?.width,e?.flexgrow,t?.fixed,t?.left,e?.right??t?.right,e?.height),[e?.width,e?.flexgrow,t?.fixed,t?.left,e?.right,t?.right,e?.height]),o=(0,u.useMemo)(()=>Hc(t,e,r),[t,e,r]),i=(0,u.useCallback)(()=>Object.fromEntries(Object.entries(e||{}).filter(([e])=>"cell"!==e)),[e]),l=`wx-6Sdi3Dfd wx-cell ${o||""} ${e?.css||""}`+(t?.fixed&&t?.fixed.right?" wx-fixed-right":"");return(0,p.jsx)("div",{className:l,style:s,children:t?.collapsed||e?.collapsed?null:e?.cell?u.default.createElement(e.cell,{api:a,cell:i(),column:t,row:n,onAction:({action:e,data:t})=>a.exec(e,t)}):(0,p.jsx)("div",{className:"wx-6Sdi3Dfd wx-text",children:e?.text||""})})}function Yc({deltaLeft:e,contentWidth:t,columns:n,type:r="header",columnStyle:a,bodyHeight:s}){const o=(0,u.useContext)(Ic),i=Dl(o,"_sizes"),l=Dl(o,"split"),c=(0,u.useMemo)(()=>i?.[`${r}RowHeights`],[i,r]),d=(0,u.useMemo)(()=>{let e=[];if(n&&n.length){const t=n[0][r].length;for(let a=0;a<t;a++){let t=0;e.push([]),n.forEach((n,s)=>{const o={...n[r][a]};t||e[a].push(o),o.colspan>1?t=o.colspan-1:t&&t--})}}return e},[n,r]),h=(0,u.useMemo)(()=>l?.left||l?.right,[l]);function m(e){return n.find(t=>t.id===e)}function f(e,t){let n=t;return e.rowspan&&(n+=e.rowspan-1),n===d.length-1}function g(e,t,n){if(!n.sort)return!1;for(let r=d.length-1;r>=0;r--){const e=n.header[r];if(!e.filter&&!e._hidden)return t===r}return f(e,t)}return(0,p.jsx)("div",{className:`wx-sAsPVaUK wx-${r}`,style:{paddingLeft:`${e}px`,width:`${t}px`},role:"rowgroup",children:d.map((e,t)=>(0,p.jsx)("div",{className:"header"===r?"wx-sAsPVaUK wx-h-row":"wx-sAsPVaUK wx-f-row",style:{height:`${c?.[t]}px`,display:"flex"},role:"row",children:e.map(e=>{const n=m(e.id);return"header"===r?(0,p.jsx)(Wc,{cell:e,columnStyle:a,column:n,row:t,lastRow:f(e,t),bodyHeight:s,sortRow:g(e,t,n),hasSplit:h},e.id):(0,p.jsx)(Kc,{cell:e,columnStyle:a,column:m(e.id),row:t},e.id)})},t))})}function Xc({overlay:e}){const t=(0,u.useContext)(Ic);const n=e;return(0,p.jsx)("div",{className:"wx-1ty666CQ wx-overlay",children:function(e){return"function"==typeof e}(e)?(0,p.jsx)(n,{onAction:({action:e,data:n})=>t.exec(e,n)}):e})}var Zc={text:function(e){const{editor:t,onSave:n,onApply:r}=e,[a,s]=(0,u.useState)(t?.value||""),{type:o="text"}=(0,u.useMemo)(()=>t?.config||{},[t]),i=(0,u.useRef)(null);return(0,u.useEffect)(()=>{i.current&&i.current.focus()},[]),(0,u.useEffect)(()=>{if(!i.current)return;const e=Yo(i.current,()=>n(!0));return()=>e.destroy()},[n]),(0,p.jsx)("input",{className:"wx-e7Ao5ejY wx-text",onInput:function(){i.current&&(s(i.current.value),r(i.current.value))},onKeyDown:function({key:e}){"Enter"===e&&n()},ref:i,type:o,value:a})},combo:function({editor:e,onAction:t,onSave:n,onApply:r,onCancel:a}){const[s,o]=(0,u.useState)(e?.value),[i,l]=(0,u.useState)(e?.renderedValue),[c,d]=(0,u.useState)(e?.options||[]),h=(0,u.useMemo)(()=>e?.config?.template,[e]),m=(0,u.useMemo)(()=>e?.config?.cell,[e]),f=(0,u.useMemo)(()=>e?.config?.dropdown||{},[e]),g=(0,u.useMemo)(()=>({trackScroll:!0,...f}),[f]),x=(0,u.useMemo)(()=>(c||[]).findIndex(e=>e.id===s),[c,s]),v=(0,u.useRef)(null),y=(0,u.useRef)(null),b=(0,u.useCallback)(e=>{v.current=e.navigate,y.current=e.keydown,v.current(x)},[x,v]),w=(0,u.useCallback)(t=>{const n=t?.target?.value??"";l(n);const r=n?(e?.options||[]).filter(e=>(e.label||"").toLowerCase().includes(n.toLowerCase())):e?.options||[];d(r),r.length?v.current(-1/0):v.current(null)},[e]),S=(0,u.useRef)(null);(0,u.useEffect)(()=>{S.current&&S.current.focus()},[]);const j=(0,u.useRef)(n);(0,u.useEffect)(()=>{j.current=n},[n]),(0,u.useEffect)(()=>{if(!S.current)return;const e=Yo(S.current,()=>j.current(!0));return()=>e.destroy()},[]),(0,u.useEffect)(()=>{o(e?.value),l(e?.renderedValue),d(e?.options||[])},[e]);const k=(0,u.useCallback)(({id:e})=>{r(e),n()},[r,n]);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("input",{className:"wx-0UYfSd1x wx-input",ref:S,value:i??"",onChange:w,onKeyDown:e=>y.current?y.current(e,x):void 0}),(0,p.jsx)(Pi,{items:c,onReady:b,onSelect:k,...g,onCancel:a,children:({option:e})=>h?h(e):m?(0,p.jsx)(m,{data:e,onAction:t}):e.label})]})},datepicker:function({editor:e,onAction:t,onSave:n,onApply:r,onCancel:a}){const[s]=(0,u.useState)(()=>e.value||new Date),{template:o,cell:i,dropdown:l={}}=e?.config||{},c=(0,u.useMemo)(()=>({trackScroll:!0,width:"auto",...l}),[l]),d=(0,u.useRef)(null),[h,m]=(0,u.useState)(null);return(0,u.useEffect)(()=>{d.current&&d.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),(0,u.useEffect)(()=>{if(!h)return;const e=Yo(h,()=>n(!0));return()=>e.destroy()},[h,n]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"wx-lNWNYUb6 wx-value",ref:d,tabIndex:0,onClick:a,onKeyDown:e=>e.preventDefault(),children:o?o(s):i?(0,p.jsx)(i,{data:e.value,onAction:t}):(0,p.jsx)("span",{className:"wx-lNWNYUb6 wx-text",children:e.renderedValue})}),(0,p.jsx)(Ii,{...c,onCancel:a,children:(0,p.jsx)("div",{ref:m,className:"wx-lNWNYUb6",children:(0,p.jsx)(Wi,{value:s,onChange:function({value:e}){r(e),n()},buttons:e.config?.buttons})})})]})},richselect:function(e){const{editor:t}=e,n=e.onAction??e.onaction,r=e.onSave??e.onsave,a=e.onApply??e.onapply,s=e.onCancel??e.oncancel,o=t.config||{},{dropdown:i={}}=o,l=(0,u.useMemo)(()=>({trackScroll:!0,...i}),[i]),[c]=(0,u.useState)(t.options.find(e=>e.id===t.value)),[d]=(0,u.useState)(t.value),[h]=(0,u.useState)(t.options),m=(0,u.useMemo)(()=>h.findIndex(e=>e.id===d),[h,d]);let f;const[g,x]=(0,u.useState)(),v=(0,u.useRef)(null);return(0,u.useEffect)(()=>{v.current&&v.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),(0,u.useEffect)(()=>{if(!v.current)return;const e=Yo(v.current,()=>r(!0));return()=>e.destroy()},[r]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{ref:v,className:"wx-ywGRk611 wx-value",tabIndex:0,onClick:s,onKeyDown:e=>{g(e,m),e.preventDefault()},children:o.template?o.template(c):o.cell?(()=>{const e=o.cell;return(0,p.jsx)(e,{data:c,onAction:n})})():(0,p.jsx)("span",{className:"wx-ywGRk611 wx-text",children:t.renderedValue})}),(0,p.jsx)(Pi,{items:h,onReady:function(e){f=e.navigate,x(()=>e.keydown),f(m)},onSelect:function({id:e}){a(e),r()},...l,onCancel:s,children:({option:e})=>o.template?o.template(e):o.cell?(()=>{const t=o.cell;return(0,p.jsx)(t,{data:e,onAction:n})})():e.label})]})},multiselect:function(e){const{editor:t,onAction:n,onSave:r,onApply:a}=e,s=t?.config||{},o=t?.options??[],i=t?.value||[],l=t?.renderedValue,c=(0,u.useMemo)(()=>({trackScroll:!0,...s.dropdown||{}}),[s]),d=(0,u.useRef)(null);return(0,u.useEffect)(()=>{if(!d.current)return;const e=Yo(d.current,()=>r(!0));return()=>e.destroy()},[r]),(0,p.jsx)("div",{ref:d,className:"wx-value wx-aacZ4gNU",onClick:()=>r(!0),children:(0,p.jsx)(qc,{value:i,options:o,text:l,template:s.template,cell:s.cell,clear:s.clear,dropdown:c,autoOpen:!0,onChange:function({value:e}){a(e)},onAction:n})})}};function Jc({column:e,row:t}){const n=(0,u.useContext)(Ic),r=Dl(n,"editor"),a=(0,u.useCallback)((e,t)=>{n.exec("close-editor",{ignore:e}),t&&n.exec("focus-cell",{...t,eventSource:"click"})},[n]),s=(0,u.useCallback)(e=>{a(!1,e?null:{row:r?.id,column:r?.column})},[r,a]),o=(0,u.useCallback)(()=>{a(!0,{row:r?.id,column:r?.column})},[r,a]),i=(0,u.useCallback)(e=>{n.exec("editor",{value:e})},[n]),l=(0,u.useCallback)(t=>{"Enter"===t.key&&r&&("multiselect"===e.editor.type?i(r.value):o())},[r,e.editor,o,i]),c=(0,u.useMemo)(()=>Bc(e.width,e.flexgrow,e.fixed,e.left,e.right),[e.width,e.flexgrow,e.fixed,e.left,e.right]),d=(0,u.useMemo)(()=>{let n=e.editor;if("function"==typeof n&&(n=n(t,e)),!n)return null;let r="string"==typeof n?n:n.type;return Zc[r]},[e,t]),h=(0,u.useRef)(null);(0,u.useEffect)(()=>{h.current&&"string"==typeof c&&h.current.setAttribute("style",c)},[c]);const m=typeof t.$parent<"u"?"gridcell":"cell",f=typeof t.$parent<"u"?!e.editor:void 0;return(0,p.jsx)("div",{className:"wx-8l724t2g wx-cell wx-editor",ref:h,style:"object"==typeof c&&null!==c?c:void 0,role:m,"aria-readonly":f,tabIndex:-1,onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onKeyDown:l,children:d?(0,p.jsx)(d,{editor:r,onSave:s,onApply:i,onCancel:o,onAction:({action:e,data:t})=>n.exec(e,t)}):null})}function Qc(e){const{columns:t,type:n,columnStyle:r}=e,a=(0,u.useContext)(Ic),{filterValues:s,_columns:o,_sizes:i}=a.getState();return(0,p.jsx)(p.Fragment,{children:t.map((e,t)=>(0,p.jsx)("tr",{children:e.map(e=>{const l=o.find(t=>t.id===e.id),c=`wx-print-cell-${n}${function(e){return r?" "+r(e):""}(l)}${e.filter?" wx-print-cell-filter":""}${e.vertical?" wx-vertical":""}`,d=e.cell;return(0,p.jsx)("th",{style:zl(dc(e,i.columnWidth)),className:"wx-Gy81xq2u "+c,rowSpan:e.rowspan,colSpan:e.colspan,children:d?(0,p.jsx)(d,{api:a,cell:Object.fromEntries(Object.entries(e).filter(([e])=>"cell"!==e)),column:l,row:t}):e.filter?(0,p.jsx)("div",{className:"wx-Gy81xq2u wx-print-filter",children:uc(s,o,e)}):(0,p.jsx)("div",{className:"wx-Gy81xq2u wx-text",children:e.text??""})},e.id)})},t))})}function ed(e){const{columns:t,rowStyle:n,columnStyle:r,cellStyle:a,header:s,footer:o,reorder:i}=e,l=(0,u.useContext)(Ic),{flatData:c,_sizes:d}=l.getState(),h=s&&cc(t,"header",d.headerRowHeights),m=o&&cc(t,"footer",d.footerRowHeights);function f(e,t){let n="";return n+=r?" "+r(t):"",n+=a?" "+a(e,t):"",n}function g(e,t){return"function"==typeof t.draggable?!1!==t.draggable(e,t):t.draggable}return(0,p.jsxs)("table",{className:"wx-8NTMLH0z wx-print-grid "+(t.some(e=>e.flexgrow)?"wx-flex-columns":""),children:[s?(0,p.jsx)("thead",{children:(0,p.jsx)(Qc,{columns:h,type:"header",columnStyle:r})}):null,(0,p.jsx)("tbody",{children:c.map((e,r)=>(0,p.jsx)("tr",{className:"wx-8NTMLH0z wx-row"+(n?" "+n(e):""),style:{height:`${e.rowHeight||d.rowHeight}px`},children:t.map(t=>t.collapsed?null:(0,p.jsxs)("td",{className:`wx-8NTMLH0z wx-print-cell wx-cell ${f(e,t)}`,style:zl(dc(t,d.columnWidth)),children:[i&&t.draggable?(0,p.jsx)("span",{className:"wx-8NTMLH0z wx-print-draggable",children:g(e,t)?(0,p.jsx)("i",{className:"wx-8NTMLH0z wxi-drag"}):null}):null,t.treetoggle?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{style:{marginLeft:28*e.$level+"px"}}),e.$count?(0,p.jsx)("i",{className:"wx-8NTMLH0z wx-print-grid-tree-toggle wxi-menu-"+(!1!==e.open?"down":"right")}):null]}):null,t.cell?(()=>{const n=t.cell;return(0,p.jsx)(n,{api:l,row:e,column:t})})():(0,p.jsx)("span",{children:sc(e,t)})]},t.id))},r))}),o?(0,p.jsx)("tfoot",{children:(0,p.jsx)(Qc,{columns:m,type:"footer",columnStyle:r})}):null]})}function td(e){const{config:t,...n}=e,{_skin:r,_columns:a}=(0,u.useContext)(Ic).getState(),s=(0,u.useMemo)(()=>lc(a,t),[]),o=(0,u.useRef)(null);return(0,u.useEffect)(()=>{const e=document.body;e.classList.add("wx-print");const n=o.current;if(!n)return;const r=n.cloneNode(!0);e.appendChild(r);const a=`@media print { @page { size: ${t.paper} ${t.mode}; }`,s=document.createElement("style");s.setAttribute("type","text/css"),s.setAttribute("media","print"),document.getElementsByTagName("head")[0].appendChild(s),s.appendChild(document.createTextNode(a)),window.print(),s.remove(),e.classList.remove("wx-print"),r.remove()},[]),(0,p.jsx)("div",{className:`wx-4zwCKA7C wx-${r}-theme wx-print-container`,ref:o,children:s.map((e,t)=>(0,p.jsx)("div",{className:"wx-4zwCKA7C wx-print-grid-wrapper",children:(0,p.jsx)(ed,{columns:e,...n})},t))})}function nd(e){const{header:t,footer:n,overlay:r,multiselect:a,onreorder:s,rowStyle:o,columnStyle:i,cellStyle:l,autoRowHeight:c,resize:d,clientWidth:h,clientHeight:m,responsiveLevel:f,hotkeys:g}=e,x=(0,u.useContext)(Ic),v=Dl(x,"dynamic"),y=Dl(x,"_columns"),b=Dl(x,"flatData"),w=Dl(x,"split"),S=Dl(x,"_sizes"),[j,k]=_l(x,"selectedRows"),C=Dl(x,"select"),N=Dl(x,"editor"),T=Dl(x,"scrollLeft"),M=Dl(x,"scrollTop"),E=Dl(x,"tree"),A=Dl(x,"focusCell"),R=Dl(x,"_print"),I=Dl(x,"undo"),D=Dl(x,"reorder"),_=Dl(x,"_rowHeightFromData"),[z,P]=(0,u.useState)(0);(0,u.useEffect)(()=>{P(function(){const e=document.createElement("div");e.style.cssText="position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;min-height:100px;overflow-y:scroll;",document.body.appendChild(e);const t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}())},[]);const[O,L]=(0,u.useState)(0),F=(0,u.useMemo)(()=>(y||[]).some(e=>!e.hidden&&e.flexgrow),[y]),B=(0,u.useMemo)(()=>S?.rowHeight||0,[S]),H=(0,u.useRef)(null),[V,$]=(0,u.useState)(null),[q,U]=(0,u.useState)(null),G=(0,u.useMemo)(()=>{let e=[],t=0;return w&&w.left&&(e=(y||[]).slice(0,w.left).filter(e=>!e.hidden).map(e=>({...e})),e.forEach(e=>{e.fixed={left:1,leftSize:w.left},e.left=t,t+=e.width}),e.length&&(e[e.length-1].fixed.left=-1)),{columns:e,width:t}},[w,y]),W=(0,u.useMemo)(()=>{let e=[],t=0;if(w&&w.right){e=(y||[]).slice(-1*w.right).filter(e=>!e.hidden).map(e=>({...e}));for(let n=e.length-1;n>=0;n--){const r=e[n];r.fixed={right:1},r.right=t,t+=r.width}e.length&&(e[0].fixed={right:-1})}return{columns:e,width:t}},[w,y]),K=(0,u.useMemo)(()=>{const e=(y||[]).slice(w?.left||0,(y||[]).length-(w?.right??0)).filter(e=>!e.hidden);return e.forEach(e=>{e.fixed=0}),e},[y,w]),Y=(0,u.useMemo)(()=>(y||[]).reduce((e,t)=>(t.hidden||(e+=t.width),e),0),[y]);function X(e,t,n){let r=t,a=e;if(K.length){let t=K.length;for(let r=e;r>=0;r--)K[r][n].forEach(n=>{n.colspan>1&&r>e-n.colspan&&r<t&&(t=r)});if(t!==K.length&&t<e){for(let n=t;n<e;n++)r-=K[n].width;a=t}}return{index:a,delta:r}}const Z=(0,u.useMemo)(()=>{let e,t,n;const r=T||0,a=(T||0)+(h||0);let s=0,o=0,i=0,l=0;K.forEach((e,t)=>{r>i&&(s=t,l=i),i+=e.width,a>i&&(o=t+1)});const c={header:0,footer:0};for(let h=o;h>=s;h--)["header","footer"].forEach(e=>{K[h]&&K[h][e].forEach(t=>{const n=t.colspan;if(n&&n>1){const t=n-(o-h+1);t>0&&(c[e]=Math.max(c[e],t))}})});const d=X(s,l,"header"),u=X(s,l,"footer"),m=d.delta,p=d.index,f=u.delta,g=u.index;return F&&Y>(h||0)?e=t=n=[...G.columns,...K,...W.columns]:(e=[...G.columns,...K.slice(s,o+1),...W.columns],t=[...G.columns,...K.slice(p,o+c.header+1),...W.columns],n=[...G.columns,...K.slice(g,o+c.footer+1),...W.columns]),{data:e||[],header:t||[],footer:n||[],d:l,df:f,dh:m}},[K,G,W,T,h,F,Y]),J=(0,u.useMemo)(()=>t&&S?.headerHeight||0,[t,S]),Q=(0,u.useMemo)(()=>n&&S?.footerHeight||0,[n,S]),ee=(0,u.useMemo)(()=>!(!h||!m)&&Y>=h,[h,m,Y]),[te,ne]=(0,u.useState)(!1),re=(0,u.useMemo)(()=>(m||0)-J-Q-(ee?z:0),[m,J,Q,ee,z]),ae=(0,u.useMemo)(()=>Math.ceil((re||0)/(B||1))+1,[re,B]),se=(0,u.useRef)([]),[oe,ie]=(0,u.useState)(0),[le,ce]=(0,u.useState)(void 0),de=(0,u.useMemo)(()=>{let e=0,t=0;const n=M||0;if(c){let r=n;for(;r>0;)r-=se.current[e]||B,e++;t=n-r;for(let n=Math.max(0,e-2-1);n<e;n++)t-=se.current[e-n]||B;e=Math.max(0,e-2)}else{if(_){let r=0,a=0;for(let e=0;e<(b||[]).length;e++){const t=b[e].rowHeight||B;if(a+t>n){r=e;break}a+=t}e=Math.max(0,r-2);for(let n=0;n<e;n++)t+=b[n].rowHeight||B;let s=0,o=0;for(let e=r+1;e<(b||[]).length;e++){const t=b[e].rowHeight||B;if(s++,o+t>re)break;o+=t}return{d:t,start:e,end:Math.min(v?v.rowCount:(b||[]).length,r+s+2)}}e=Math.floor(n/(B||1)),e=Math.max(0,e-2),t=e*(B||0)}const r=v?v.rowCount:(b||[]).length;return{d:t,start:e,end:Math.min(r,e+(ae||0)+2)}},[c,_,M,B,v,b,ae,re]),ue=(0,u.useMemo)(()=>{const e=v?v.rowCount:(b||[]).length;if(c)return oe+de.d+(e-(le||0))*(B||0);if(!_)return e*(B||0);let t=0;for(let n=0;n<e;n++)t+=b[n]?.rowHeight||B;return t},[v,b,B,c,_,oe,de.d,le]),he=(0,u.useRef)({});he.current={clientWidth:h,clientHeight:m,fullHeight:ue,headerHeight:J,footerHeight:Q,fullWidth:Y,SCROLLSIZE:z};const me=(0,u.useCallback)(()=>{const e=he.current;ne(!(!e.clientWidth||!e.clientHeight)&&e.fullHeight+e.headerHeight+e.footerHeight>=e.clientHeight-(e.fullWidth>=e.clientWidth?e.SCROLLSIZE:0))},[]);(0,u.useEffect)(()=>{const e=requestAnimationFrame(me);return()=>window.cancelAnimationFrame(e)},[O,me]),(0,u.useEffect)(()=>{me()},[m,me]);const pe=(0,u.useMemo)(()=>F&&Y<=(h||0)?(h||0)-0-(te?z:0):Y,[F,Y,h,te,z,ee]),fe=(0,u.useMemo)(()=>F&&Y<=(h||0)?h||0:pe<(h||0)?Y+(te?z:0):-1,[F,Y,h,pe,te,z]),ge=(0,u.useRef)({});(0,u.useEffect)(()=>{if(v&&(ge.current.start!==de.start||ge.current.end!==de.end)){const{start:e,end:t}=de;ge.current={start:e,end:t},x&&x.exec&&x.exec("request-data",{row:{start:e,end:t}})}},[v,de,x]);const xe=(0,u.useMemo)(()=>v?b||[]:(b||[]).slice(de.start,de.end),[v,b,de]),ve=(0,u.useMemo)(()=>(j||[]).filter(e=>(xe||[]).some(t=>t.id===e)),[k,xe]),ye=(0,u.useMemo)(()=>de.start,[de.start]),be=(0,u.useRef)({top:M,left:T});be.current={top:M,left:T};const we=(0,u.useCallback)(e=>{const t=e.target.scrollTop,n=e.target.scrollLeft,r=be.current;(t!==r.top||n!==r.left)&&x.exec("scroll-to",{top:t,left:n})},[x]),Se=(0,u.useCallback)(e=>{e.shiftKey&&e.preventDefault(),H.current&&H.current.focus&&H.current.focus()},[]),je=(0,u.useCallback)(()=>!!(y||[]).find(e=>!!e.draggable),[y]),ke=(0,u.useRef)(null),Ce=(0,u.useRef)(null),Ne=(0,u.useRef)({dblclick:(e,t)=>{const n={id:e,column:zo(t,"data-col-id")};x.exec("open-editor",n)},click:(e,t)=>{if(t.target.closest("input")||ke.current)return;const n=zo(t,"data-col-id");if(A?.id!==e&&x.exec("focus-cell",{row:e,column:n,eventSource:"click"}),!1===C)return;const r=a&&(t.ctrlKey||t.metaKey),s=a&&t.shiftKey;(r||j.length>1||!j.includes(e))&&x.exec("select-row",{id:e,toggle:r,range:s})},"toggle-row":e=>{const t=x.getRow(e);x.exec(!1!==t.open?"close-row":"open-row",{id:e})},"ignore-click":()=>!1}),Te=(0,u.useMemo)(()=>({top:J,bottom:Q,left:G.width,xScroll:ee,yScroll:te,sense:c&&q?q.offsetHeight:Math.max(S?.rowHeight||0,40),node:H.current&&H.current.firstElementChild}),[J,Q,G.width,ee,te,c,q,S]);const Me=(0,u.useMemo)(()=>fe>0?{width:`${fe}px`}:void 0,[fe]),Ee=(0,u.useRef)(null);(0,u.useEffect)(()=>{xe&&c&&Promise.resolve().then(()=>{let e=0,t=ye;const n=Ee.current;n&&(Array.from(n.children).forEach((n,r)=>{se.current[ye+r]=n.offsetHeight,e+=n.offsetHeight,t++}),ie(e),ce(t))})},[xe,c,ye]);let[Ae,Re]=(0,u.useState)();(0,u.useEffect)(()=>{if(!A||C&&ve.length&&!ve.includes(A.row))if(xe.length&&Z.data.length){if(!Ae||ve.length&&!ve.includes(Ae.row)||-1===xe.findIndex(e=>e.id===Ae.row)||-1===Z.data.findIndex(e=>e.id===Ae.column&&!e.collapsed)){const e=ve[0]||xe[0].id,t=Z.data.findIndex(e=>!e.collapsed);Re(-1!==t?{row:e,column:Z.data[t].id}:null)}}else Re(null);else Re({...A})},[A]);const Ie=(0,u.useRef)(null);(0,u.useEffect)(()=>{const e=H.current;if(!e)return;const t=function(e,t){const n=new ResizeObserver(e=>{requestAnimationFrame(()=>t(e[0].contentRect))});return n.observe(e.parentNode),{destroy(){n.disconnect()}}}(e,d);return()=>{"function"==typeof t&&t()}},[d]);const De=(0,u.useRef)({});Object.assign(De.current,{start:function(e,t){const{container:n,sourceNode:r,from:a}=t;if(je()&&!r.getAttribute("draggable-data"))return!1;$(a),E&&x.getRow(a).open&&x.exec("close-row",{id:a,nested:!0});const s=_o(r),o=s.cloneNode(!0);o.classList.remove("wx-selected"),o.querySelectorAll("[tabindex]").forEach(e=>e.setAttribute("tabindex","-1")),n.appendChild(o),U(o);const i=(T||0)-Z.d,l=te?z:0;n.style.width=Math.min((h||0)-l,F&&Y<=(h||0)?pe:pe-l)+i+"px";const c=Dc(s);t.offset={x:i,y:-Math.round(c.height/2)},Ce.current||(Ce.current=e.clientY)},move:function(e,t){const{from:n}=t,r=t.pos,a=Dc(H.current);r.x=a.x;const o=Te.top;if(r.y<o)r.y=o;else{const e=a.height-(ee&&z>0?z:Math.round(Te.sense/2))-Te.bottom;r.y>e&&(r.y=e)}if(H.current.contains(t.targetNode)){const a=_o(t.targetNode),i=a&&Po(a);if(i&&i!==n){t.to=i;const s=c?q?.offsetHeight:S?.rowHeight;if(q&&(0===(M||0)||r.y>o+s-1)){const t=a.getBoundingClientRect(),r=Dc(q).y>t.y?-1:1,s=1===r?"after":"before",o=x.getState().flatData,l=Math.abs(o.findIndex(e=>e.id===n)-o.findIndex(e=>e.id===i)),c=1!==l?"before"===s?"after":"before":s;if(1===l&&(-1===r&&e.clientY>Ce.current||1===r&&e.clientY<Ce.current))return;Ce.current=e.clientY,x.exec("move-item",{id:n,target:i,mode:c,inProgress:!0})}}s&&s({event:e,context:t})}Pc(e,a,t,Te)},end:function(e,t){const{from:n,to:r}=t;x.exec("move-item",{id:n,target:r,inProgress:!1}),ke.current=setTimeout(()=>{ke.current=0},1),$(null),U(null),Ce.current=null,Oc(t)},getReorder:()=>D,getDraggableInfo:()=>({hasDraggable:je()})}),(0,u.useEffect)(()=>{const e=H.current;return e?zc(e,De).destroy:void 0},[D,H.current]),(0,u.useEffect)(()=>{const e=H.current;return e?function(e,{keys:t,exec:n}){if(!t)return;function r(e){const t=e.target;return"INPUT"===t.tagName||"TEXTAREA"===t.tagName||function(e,t="data-id"){let n=e;for(!n.tagName&&e.target&&(n=e.target);n;){if(n.getAttribute&&n.getAttribute(t))return n;n=n.parentNode}return null}(t,"data-header-id")?.classList.contains("wx-filter")||!!t.closest(".wx-cell.wx-editor")}const a={};for(const o in t){const e=t[o];typeof e<"u"&&("function"==typeof e?a[o]=e:e&&(a[o]=e=>{const t=r(e);n({key:o,event:e,isInput:t})}))}const s=Ec(t=>{t.configure(a,e)});return{destroy:()=>{s()}}}(e,{keys:!1!==g&&{...Rc,"ctrl+z":I,"ctrl+y":I,...g},exec:e=>x.exec("hotkey",e)}).destroy:void 0},[x,I,g]);const _e=(0,u.useRef)({scroll:x.getReactiveState().scroll,scrollLeft:x.getReactiveState().scrollLeft,scrollTop:x.getReactiveState().scrollTop});_e.current.getWidth=()=>(h||0)-(te?z:0),_e.current.getHeight=()=>re,_e.current.getScrollMargin=()=>G.width+W.width,(0,u.useEffect)(()=>{!function(e,t){let n=null;t.scroll.subscribe(r=>{if(!r||r===n)return;n=r;const{left:a,top:s,height:o,width:i}=r,l=t.getHeight(),c=t.getWidth(),d=t.getScrollMargin();if(s>=0){const t=e.scrollTop;s<t?e.scrollTop=s:s+o>t+l&&(e.scrollTop=s-l+o)}if(a>=0){const t=e.scrollLeft;a<t?e.scrollLeft=a:a+i>t+c-d&&(e.scrollLeft=a-c+i+d)}}),t.scrollLeft?.subscribe?.(t=>{requestAnimationFrame(()=>{Math.abs(e.scrollLeft-t)>1&&(e.scrollLeft=t)})}),t.scrollTop?.subscribe?.(t=>{requestAnimationFrame(()=>{Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)})})}(Ie.current,_e.current)},[]);const ze=(0,u.useRef)(null);(0,u.useEffect)(()=>{const e=ze.current;if(!e)return;const t=[];t.push(Yo(e,()=>A&&x.exec("focus-cell",{eventSource:"click"})).destroy),t.push(function(e,t){const n=[Ol(e,t,"click")];return t.dblclick&&n.push(Ol(e,t.dblclick,"dblclick")),()=>{n.forEach(e=>e())}}(e,Ne.current)),L(e.clientHeight);const n=new ResizeObserver(()=>{L(e.clientHeight)});return n.observe(e),t.push(()=>n.disconnect()),()=>t.forEach(e=>e())},[]);const Pe="wx-grid "+(f?`wx-responsive-${f}`:"");return(0,u.useEffect)(()=>{A&&(xe.some(e=>e.id===A.row)&&Z.data.some(e=>e.id===A.column&&!e.collapsed)||x.exec("focus-cell",{eventSource:"destroy"}))},[A,xe,Z.data,x]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"wx-4VuBwK2D "+Pe,style:{"--header-height":`${J}px`,"--footer-height":`${Q}px`,"--split-left-width":`${G.width}px`,"--split-right-width":`${W.width}px`},children:(0,p.jsx)("div",{ref:H,className:"wx-4VuBwK2D wx-table-box",style:Me,role:E?"treegrid":"grid","aria-colcount":Z.data.length,"aria-rowcount":xe.length,"aria-multiselectable":!(!E||!a)||void 0,tabIndex:-1,children:(0,p.jsxs)("div",{ref:Ie,className:"wx-4VuBwK2D wx-scroll",style:{overflowX:ee?"scroll":"hidden",overflowY:te?"scroll":"hidden"},onScroll:we,children:[t?(0,p.jsx)("div",{className:"wx-4VuBwK2D wx-header-wrapper",children:(0,p.jsx)(Yc,{contentWidth:pe,deltaLeft:Z.dh,columns:Z.header,columnStyle:i,bodyHeight:re-+n})}):null,(0,p.jsxs)("div",{ref:ze,className:"wx-4VuBwK2D wx-body",style:{width:`${pe}px`,height:`${ue}px`},onMouseDown:e=>Se(e),children:[r?(0,p.jsx)(Xc,{overlay:r}):null,(0,p.jsx)("div",{ref:Ee,className:"wx-4VuBwK2D wx-data",style:{paddingTop:`${de.d}px`,paddingLeft:`${Z.d}px`},children:xe.map((e,t)=>{const n=-1!==j.indexOf(e.id),r=V===e.id,a="wx-row"+(c?" wx-autoheight":"")+(o?" "+o(e):"")+(n?" wx-selected":"")+(r?" wx-inactive":""),s=c?{minHeight:`${e.rowHeight||B}px`}:{height:`${e.rowHeight||B}px`};return(0,p.jsx)("div",{className:"wx-4VuBwK2D "+a,"data-id":Oo(e.id),"data-context-id":Oo(e.id),style:s,role:"row","aria-rowindex":t,"aria-expanded":e.open,"aria-level":E?e.$level+1:void 0,"aria-selected":E?n:void 0,tabIndex:-1,children:Z.data.map(t=>t.collapsed?(0,p.jsx)("div",{className:"wx-4VuBwK2D wx-cell wx-collapsed"},t.id):N?.id===e.id&&N.column===t.id?(0,p.jsx)(Jc,{row:e,column:t},t.id):(0,p.jsx)(Vc,{row:e,column:t,columnStyle:i,cellStyle:l,reorder:D,focusable:Ae?.row===e.id&&Ae?.column===t.id},t.id))},e.id)})})]}),n&&(b||[]).length?(0,p.jsx)(Yc,{type:"footer",contentWidth:pe,deltaLeft:Z.df,columns:Z.footer,columnStyle:i}):null]})})}),R?(0,p.jsx)(td,{config:R,rowStyle:o,columnStyle:i,cellStyle:l,header:t,footer:n,reorder:D}):null]})}var rd=(0,u.forwardRef)(function({data:e=[],columns:t=[],rowStyle:n=null,columnStyle:r=null,cellStyle:a=null,selectedRows:s,select:o=!0,multiselect:i=!1,header:l=!0,footer:c=!1,dynamic:d=null,overlay:h=null,reorder:m=!1,onReorder:f=null,autoRowHeight:g=!1,sizes:x,split:v,tree:y=!1,autoConfig:b=!1,init:w=null,responsive:S=null,sortMarks:j,undo:k=!1,hotkeys:C=null,filterValues:N,...T},M){const E=(0,u.useRef)();E.current=T;const A=(0,u.useMemo)(()=>new kc(Pl),[]),R=(0,u.useMemo)(()=>A.in,[A]),I=(0,u.useRef)(null);null===I.current&&(I.current=new ll((e,t)=>{const n="on"+e.split("-").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):"").join("");E.current&&E.current[n]&&E.current[n](t)}),R.setNext(I.current));const D=(0,u.useMemo)(()=>({getState:A.getState.bind(A),getReactiveState:A.getReactive.bind(A),getStores:()=>({data:A}),exec:R.exec,setNext:e=>(I.current=I.current.setNext(e),I.current),intercept:R.intercept.bind(R),on:R.on.bind(R),detach:R.detach.bind(R),getRow:A.getRow.bind(A),getColumn:A.getColumn.bind(A)}),[A,R]),[_,z]=(0,u.useState)(0),[P,O]=(0,u.useState)(0),[L,F]=(0,u.useState)(null),[B,H]=(0,u.useState)(null),V=(0,u.useMemo)(()=>{if(b&&!t.length&&e.length){const t=e[0],n=[];for(let e in t)if("id"!==e&&"$"!==e[0]){let t={id:e,header:e[0].toUpperCase()+e.slice(1)};"object"==typeof b&&(t={...t,...b}),n.push(t)}return n}return(B&&B.columns)??t},[b,t,e,B]),$=(0,u.useMemo)(()=>(B&&B.sizes)??x,[B,x]),q=(0,u.useCallback)(e=>{if(z(e.width),O(e.height),S){const t=Object.keys(S).map(Number).sort((e,t)=>e-t).find(t=>e.width<=t)??null;t!==L&&(H(S[t]),F(t))}},[S,L]),U=(0,u.useContext)(Ci.theme),G=(0,u.useRef)(0);return(0,u.useEffect)(()=>{if(G.current){const t=A.getState();A.init({data:e,columns:V,split:v||t.split,sizes:$||t.sizes,selectedRows:s||t.selectedRows,dynamic:d,tree:y,sortMarks:j||t.sortMarks,filterValues:N||t.filterValues,undo:k,reorder:m,_skin:U,_select:o})}else w&&w(D);G.current++},[A,e,V,v,$,s,d,y,j,N,k,m,U,o,w,D]),0===G.current&&A.init({data:e,columns:V,split:v||{left:0},sizes:$||{},selectedRows:s||[],dynamic:d,tree:y,sortMarks:j||{},filterValues:N||{},undo:k,reorder:m,_skin:U,select:o}),(0,u.useImperativeHandle)(M,()=>({...D}),[D]),(0,p.jsx)(Ic.Provider,{value:D,children:(0,p.jsx)(qi,{words:il,optional:!0,children:(0,p.jsx)(nd,{header:l,footer:c,overlay:h,rowStyle:n,columnStyle:r,cellStyle:a,onReorder:f,multiselect:i,autoRowHeight:g,clientWidth:_,clientHeight:P,responsiveLevel:L,resize:q,hotkeys:C})})})});Fo(Lo);var ad=(0,u.createContext)(null),sd=(0,u.createContext)(null),od=(0,u.createContext)(null);function id({children:e}){const t=(0,u.useContext)(Ci.i18n),n=(0,u.useMemo)(()=>t.getGroup("filemanager"),[t]),r=(0,u.useContext)(ad),[a]=_l(r,"panels"),s=a[Dl(r,"activePanel")].path,[o,i]=(0,u.useState)(null),[l,c]=(0,u.useState)(null),[d,h]=(0,u.useState)(""),[m,f]=(0,u.useState)(""),[g,x]=(0,u.useState)(!1);function v(){i(null),x(null),f(""),h("")}const y=(0,u.useMemo)(()=>({showPrompt(e){const t=e.item.name||("folder"===e.item.type?n("New folder"):`${n("New file")}.txt`);f(t),h(t),i({...e})},showConfirm(e){c({...e})}}),[n]);return(0,p.jsxs)(sd.Provider,{value:y,children:[(0,p.jsx)(rl,{children:e}),o?(0,p.jsx)(tl,{title:n(`Enter ${o.item.type} name`),onConfirm:function(){const e=d.trim();e?(o.add?r.exec("create-file",{file:{...o.item,name:e},parent:s}):m!==e&&r.exec("rename-file",{id:o.item.id,name:e}),v()):x(!0)},onCancel:v,children:(0,p.jsx)(Oi,{error:g,select:!0,focus:!0,value:d,onChange:({value:e})=>h(e)})}):null,l?(0,p.jsx)(tl,{title:n("Are you sure you want to delete these items:"),onConfirm:function(){r.exec("delete-files",{ids:l.selected}),c(null)},onCancel:()=>c(null),children:l.selected?(0,p.jsx)("ul",{className:"wx-gq7BMzEP wx-list",children:l.selected.map((e,t)=>(0,p.jsx)("li",{children:e},t))}):null}):null]})}var ld={"7z":!0,rar:!0,zip:!0,css:!0,html:!0,js:!0,php:!0,md:!0,xml:!0,sql:!0,aif:!0,mid:!0,mp3:!0,waw:!0,wma:!0,doc:!0,docx:!0,txt:!0,avi:!0,mov:!0,mp4:!0,mpeg:!0,mpg:!0,pdf:!0,xls:!0,xlsx:!0,gif:!0,jpg:!0,jpeg:!0,png:!0,psd:!0,tiff:!0,svg:!0,folder:!0,file:!0,multiple:!0,search:!0,none:!0};function cd({item:e}){const t=(0,u.useContext)(ad),n=(0,u.useContext)(Ci.i18n).getGroup("filemanager"),r=(0,u.useContext)(ad).templates,[a]=_l(t,"panels"),s=Dl(t,"activePanel"),o=Dl(t,"mode"),i=a[s].selected,l=(0,u.useMemo)(()=>r.preview(e,214,163),[r,e]),c=(0,u.useMemo)(()=>r.icon(e,"big"),[r,e]),[d,h]=(0,u.useMemo)(()=>function(e){const t=e.lastIndexOf("."),n=t>0&&t<e.length-1?Math.min(10,e.length-t):Math.min(5,e.length);return[e.slice(0,-n),e.slice(-n)]}(e.name),[e.name]);return(0,p.jsx)(p.Fragment,{children:"/wx-filemanager-parent-link"===e.id?"search"!==o?(0,p.jsx)("div",{className:"wx-GAOa4kDV wx-back-item",children:(0,p.jsxs)("div",{className:"wx-GAOa4kDV wx-back "+(e.navigation?"wx-selected":""),"data-id":Oo("/wx-filemanager-parent-link"),children:[(0,p.jsx)("i",{className:"wx-GAOa4kDV wxi-arrow-left"}),(0,p.jsx)("span",{children:n("Back to parent folder")})]})}):null:(0,p.jsxs)("div",{className:"wx-GAOa4kDV wx-item "+(i?.length&&i.indexOf(e.id)>=0?"wx-selected":""),"data-id":Oo(e.id),children:[l?(0,p.jsx)("div",{className:"wx-GAOa4kDV wx-preview wx-file-preview",children:(0,p.jsx)("img",{className:"wx-GAOa4kDV wx-card-preview",alt:n("A miniature file preview"),src:l})}):c?(0,p.jsx)("div",{className:"wx-GAOa4kDV wx-preview wx-file-icon",children:(0,p.jsx)("img",{className:"wx-GAOa4kDV wx-card-preview",alt:"",src:c})}):(0,p.jsx)("div",{className:"wx-GAOa4kDV wx-preview",children:(0,p.jsx)("i",{className:`wx-GAOa4kDV wxi-${e.type}`})}),"folder"===e.type?(0,p.jsxs)("div",{className:"wx-GAOa4kDV wx-info",children:[(0,p.jsxs)("div",{className:"wx-GAOa4kDV wx-folder-name",children:[(0,p.jsx)("span",{className:"wx-GAOa4kDV wx-type",children:n("Folder")}),(0,p.jsxs)("span",{className:"wx-GAOa4kDV wx-name",children:[(0,p.jsx)("span",{children:d}),(0,p.jsx)("span",{children:h})]})]}),(0,p.jsx)("div",{"data-action-id":Oo(e.id),className:"wx-GAOa4kDV wx-more",children:(0,p.jsx)("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]}):(0,p.jsxs)("div",{className:"wx-GAOa4kDV wx-info",children:[(0,p.jsx)("div",{className:"wx-GAOa4kDV wx-file-name",children:(0,p.jsxs)("span",{className:"wx-GAOa4kDV wx-name",children:[(0,p.jsx)("span",{children:d}),(0,p.jsx)("span",{children:h})]})}),(0,p.jsx)("div",{"data-action-id":Oo(e.id),className:"wx-GAOa4kDV wx-more",children:(0,p.jsx)("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]})]})})}function dd(){const e=(0,u.useContext)(ad),t=(0,u.useContext)(Ci.i18n),n=(0,u.useMemo)(()=>t.getGroup("filemanager"),[t]),[r]=_l(e,"panels"),a=Dl(e,"activePanel"),s=Dl(e,"mode"),o=r[a]._files,i=r[a].selected,l=r[a].path,c=r[a]._crumbs,d=r[a]._selectNavigation,h=(0,u.useCallback)((t,n)=>{const r=n&&(n.ctrlKey||n.metaKey),s=n&&n.shiftKey;if("/wx-filemanager-parent-link"===t){if(i.length&&(r||s))return;return void e.exec("select-file",{type:"navigation"})}let o="body"===t&&n?null:t;const l=-1!==n.target.className.indexOf("wx-more")||-1!==n.target.className.indexOf("wxi-dots-v");setTimeout(()=>{e.exec("select-file",{id:o,toggle:r&&!l,range:s&&!l,panel:a})},1)},[e,i,a]),m=(0,u.useCallback)(()=>{c.length>1&&e.exec("set-path",{id:c[c.length-2].id,panel:a,selected:[c[c.length-1].id]})},[e,c,a]),f=(0,u.useCallback)(t=>{if("/wx-filemanager-parent-link"===t)return m();"search"===s&&e.exec("filter-files",{text:""});const n=o.find(e=>e.id===t);n&&("folder"==n.type?e.exec("set-path",{id:n.id,panel:a}):e.exec("open-file",{id:n.id}))},[e,m,s,o,a]),g=(0,u.useCallback)((e,t)=>{(!i?.length||!i.filter(t=>t?.id===e).length>0)&&h(e,t)},[i,h]),x=(0,u.useMemo)(()=>"/"!==l?[{id:"/wx-filemanager-parent-link",name:n("Back to parent folder"),navigation:d},...o]:o,[l,n,d,o]),v=(0,u.useRef)(null),y=(0,u.useRef)();return(0,u.useEffect)(()=>{v.current&&(y.current?(y.current.click=h,y.current._dblclick=f,y.current.context=g):(y.current={click:h,dblclick:e=>y.current._dblclick(e),_dblclick:f,context:g},Ho(v.current,y.current)))},[h,f,g]),"search"!=s||x.length?(0,p.jsx)("div",{tabIndex:0,className:"wx-iyjASZCY wx-cards"+("/"!==l&&"search"!==s?" wx-has-back-link":""),"data-id":Oo("body"),ref:v,children:x.map(e=>(0,p.jsx)(cd,{item:e},e.id))}):(0,p.jsx)("div",{className:"wx-iyjASZCY wx-not-found",children:(0,p.jsx)("div",{className:"wx-iyjASZCY wx-not-found-text",children:n("Looks like nothing is here")})})}function ud({name:e="",spin:t=!1,onClick:n}){return(0,p.jsx)("i",{"data-menu-ignore":"true",className:`wx-uwcvNSAG wx-icon wxi-${e} ${t?"wx-spin":""} ${n?"wx-clickable":""}`,onClick:()=>{n&&n()}})}function hd(){const e=(0,u.useContext)(Ci.i18n).getGroup("filemanager"),t=(0,u.useContext)(ad),n=Dl(t,"activePanel"),[r]=_l(t,"panels"),a=(0,u.useMemo)(()=>r[n]._crumbs,[r,n]);return(0,p.jsxs)("div",{className:"wx-GDJvtROw wx-search",children:[(0,p.jsxs)("div",{className:"wx-GDJvtROw wx-toolbar",children:[(0,p.jsx)("div",{className:"wx-GDJvtROw wx-back-icon",children:(0,p.jsx)(ud,{name:"angle-left",onClick:function(){t.exec("filter-files",{text:""})}})}),(0,p.jsxs)("div",{className:"wx-GDJvtROw wx-text",children:[e("Search results in")," ",Array.isArray(a)&&a.map((t,n)=>(0,p.jsxs)(u.Fragment,{children:[n?"/":null,"/"==t.id?e(t.name):t.name]},n))]})]}),(0,p.jsx)(dd,{})]})}function md({narrowMode:e,extraInfo:t}){const n=(0,u.useContext)(ad),{preview:r,icon:a}=n.templates,s=(0,u.useContext)(Ci.i18n),o=(0,u.useMemo)(()=>s.getGroup("filemanager"),[s]),i=(0,u.useMemo)(()=>gi("%D, %d %F %Y, %H:%i",s.getRaw().calendar),[s]),[l,c]=_l(n,"panels"),d=Dl(n,"activePanel"),h=Dl(n,"preview"),m=Dl(n,"search"),f=(0,u.useMemo)(()=>{const e=l&&null!=d&&l[d]?._selected?.length||0;return m&&!e},[m,c,d]),g=(0,u.useMemo)(()=>{const e=l&&null!=d?l[d]:null;return e?f?e._files:e._selected:[]},[f,c,d]),x=(0,u.useCallback)((e,t)=>(e?`${e} ${o(e>1?"folders":"folder")} `:"")+(t?`${t} ${o(t>1?"files":"file")}`:""),[o]),v=(0,u.useCallback)(()=>{n.exec("show-preview",{mode:!h})},[n,h]),y=(0,u.useCallback)(e=>"folder"===e.type?o("Folder"):e.ext||o("Unknown file"),[o]),b=(0,u.useMemo)(()=>{let e,t,n,s,i,l,c,d;if(1!==g.length||f){if(t=i=null,e="",g.length){let t,n=0,r=0,a=0,s=[];g.forEach(e=>{typeof e.size>"u"&&(t=!0,n=void 0),t||(n+=e.size),s.push(y(e)),"folder"===e.type?r++:a++});const i=new Set(s);l=i.size>1?o("multiple"):[...i][0],c=x(r,a),d=n,f||(e=o("Multiple files"))}s=a({type:f?"search":g.length?"multiple":"none"},"big"),n=""}else{t=g[0],e=t.name;const o=r(t,400,500);o?(n=o,s=""):(s=a(t,"big"),n=""),i="folder"!==t.type}return{name:e,item:t,previewSrc:n,iconSrc:s,showDownloadIcon:i,type:l,totalCount:c,totalSize:d}},[g,f,r,a,o,y,x]),w=(0,u.useCallback)(()=>{n.exec("download-file",{id:g[0].id})},[n,g]),S=(0,u.useCallback)(async e=>{if(!t||!e)return null;try{return await t(e)}catch(Ac){return null}},[t]),[j,k]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let e=!1;return k(null),Promise.resolve(S(b.item)).then(t=>{e||k(t)}).catch(()=>{e||k(null)}),()=>{e=!0}},[S,b.item]),(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-wrapper",children:g&&g.length?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"wx-O0BTtRrH wx-preview",children:[(0,p.jsxs)("div",{className:"wx-O0BTtRrH wx-toolbar",children:[(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-name",children:b.name}),(0,p.jsxs)("div",{className:"wx-O0BTtRrH wx-icons",children:[b.showDownloadIcon?(0,p.jsx)(ud,{name:"download",onClick:w}):null,e?(0,p.jsx)(ud,{name:"close",onClick:v}):null]})]}),b.previewSrc?(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:(0,p.jsx)("img",{src:b.previewSrc,alt:o("A miniature file preview")})}):b.iconSrc?(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:(0,p.jsx)("img",{src:b.iconSrc,alt:o("A miniature file preview")})}):(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:b.item?(0,p.jsx)("i",{className:`wx-O0BTtRrH wx-icon wxi-${b.item.type}`}):(0,p.jsx)("i",{className:"wx-O0BTtRrH wx-icon wxi-"+(f?"search":"file-multiple-outline")})})]}),(0,p.jsxs)("div",{className:"wx-O0BTtRrH wx-info-panel",children:[(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-title",children:o(f?"Found":"Information")}),(0,p.jsxs)("div",{className:"wx-O0BTtRrH wx-list",children:[b.item?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:o("Type")}),(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:y(b.item)}),typeof b.item.size<"u"?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:o("Size")}),(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:yl(b.item.size)})]}):null,(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:o("Date")}),(0,p.jsxs)("span",{className:"wx-O0BTtRrH wx-value",children:[i(b.item.date)," "]})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:o("Count")}),(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:b.totalCount}),(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:o("Type")}),(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:b.type}),typeof b.totalSize<"u"?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:o("Size")}),(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:yl(b.totalSize)})]}):null]}),j?Object.entries(j).map(([e,t])=>(0,p.jsxs)(u.default.Fragment,{children:[(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:e}),(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:t})]},e)):null]})]})]}):(0,p.jsxs)("div",{className:"wx-O0BTtRrH wx-no-info-panel",children:[(0,p.jsxs)("div",{className:"wx-O0BTtRrH wx-toolbar",children:[(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-name",children:b.name}),(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-icons",children:e?(0,p.jsx)(ud,{name:"close",onClick:v}):null})]}),(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-no-info-wrapper",children:(0,p.jsxs)("div",{className:"wx-O0BTtRrH wx-no-info",children:[b.previewSrc?(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:(0,p.jsx)("img",{src:b.previewSrc,alt:o("A miniature file preview")})}):b.iconSrc?(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:(0,p.jsx)("img",{src:b.iconSrc,alt:o("A miniature file preview")})}):(0,p.jsx)("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:(0,p.jsx)("i",{className:"wx-O0BTtRrH wx-icon wxi-"+(f?"search":"message-question-outline")})}),(0,p.jsx)("span",{className:"wx-O0BTtRrH wx-text",children:f?"":o("Select file or folder to view details")})]})})]})})}function pd({panel:e}){const t=(0,u.useContext)(ad),n=(0,u.useContext)(Ci.i18n),r=(0,u.useMemo)(()=>n.getGroup("filemanager"),[n]),[a,s]=_l(t,"panels"),o=(0,u.useMemo)(()=>a[e]._files,[s,e]),i=(0,u.useMemo)(()=>a[e]._crumbs||[],[s,e]);function l(n){const r=kl(n,i);t.exec("set-path",{id:n,panel:e,...r&&{selected:[r]}})}const[c,d]=(0,u.useState)(null);(0,u.useEffect)(()=>{o&&d(null)},[o]);const h=(0,u.useRef)(null),m=(0,u.useRef)();return(0,u.useEffect)(()=>{m.current?m.current.click=l:(m.current={click:l},Ho(h.current,m.current))},[l]),(0,p.jsxs)("div",{className:"wx-SNY5LTYx wx-breadcrumbs","data-menu-ignore":"true",ref:h,children:[(0,p.jsx)("div",{className:"wx-SNY5LTYx wx-refresh-icon",children:(0,p.jsx)(ud,{name:"refresh",spin:!!c,onClick:function(){d(!0),t.exec("request-data",{id:i[i.length-1].id}),setTimeout(()=>{d(null)},5e3)}})}),i.map((e,t)=>(0,p.jsxs)(u.default.Fragment,{children:[t?(0,p.jsx)(ud,{name:"angle-right"}):null,(0,p.jsx)("div",{className:"wx-SNY5LTYx wx-item","data-id":Oo(e.id),"data-menu-ignore":"true",children:"/"==e.id?r(e.name):e.name})]},t))]})}function fd({row:e}){const t=(0,u.useContext)(Ci.i18n),[n]=(0,u.useState)(()=>t.getGroup("filemanager")),r=(0,u.useContext)(ad).templates,[a]=(0,u.useState)(()=>r.icon(e,"small"));return(0,p.jsx)("div",{className:"wx-qgAqG6sL wx-name-cell",children:"/wx-filemanager-parent-link"===e.id?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("i",{className:"wx-qgAqG6sL wxi-arrow-left"}),(0,p.jsxs)("span",{className:"wx-qgAqG6sL wx-name",children:[" ",n("Back to parent folder")]})]}):(0,p.jsxs)(p.Fragment,{children:[a?(0,p.jsx)("img",{className:"wx-qgAqG6sL wx-icon",alt:"",src:a,height:"24px",width:"24px"}):(0,p.jsx)("i",{className:`wx-qgAqG6sL wxi-${e.type}`}),(0,p.jsxs)("span",{className:"wx-qgAqG6sL wx-name",children:[" ",e.name," "]})]})})}function gd({children:e}){const t=(0,u.useContext)(ad),n=Dl(t,"activePanel"),r=(0,u.useContext)(od),a=(0,u.useRef)(null);let s=(0,u.useRef)({});return s.current.drop=()=>{const e=function(e,t="data-id"){const n=_o(e,t);return n?n.getAttribute(t):null}(a.current,"data-panel");e&&e!=n&&t.exec("set-active-panel",{panel:1*e})},s.current.dragEnter=()=>{const e=a.current;e&&e.classList.toggle("wx-active")},s.current.dragLeave=()=>{const e=a.current;e&&e.classList.toggle("wx-active")},(0,u.useEffect)(()=>{const e=a.current;return r.droparea(e,s.current)},[]),(0,p.jsx)("div",{className:"wx-LT9X7tb7 wx-upload-area",ref:a,children:e})}function xd({panel:e,active:t=!1,onClick:n,onContextMenu:r}){const a=(0,u.useContext)(ad),s=(0,u.useContext)(Ci.i18n),o=(0,u.useMemo)(()=>s.getGroup("filemanager"),[s]),i=(0,u.useMemo)(()=>gi("%d %M %Y",s.getRaw().calendar),[s]),[l]=_l(a,"panels"),c=l[e].selected,d=l[e].path,h=l[e]._crumbs,m=l[e]._sorts,f=l[e]._selectNavigation,g=l[e]._files,x=(0,u.useMemo)(()=>[{id:"name",header:o("Name"),flexgrow:3,sort:!0,resize:!0,cell:fd},{id:"size",header:o("Size"),width:100,sort:!0,resize:!0,template:e=>"number"==typeof e?yl(e):""},{id:"date",header:o("Date"),width:120,sort:!0,resize:!0,template:e=>e?i(e):""}],[o,i]),v=(0,u.useRef)(null),y=(0,u.useRef)(null),b=(0,u.useMemo)(()=>f?["/wx-filemanager-parent-link"]:[...c],[f,c]);function w(t,n){if(n&&n.target&&n.target.className&&-1!==n.target.className.indexOf("wx-grip"))return;const r=n&&(n.ctrlKey||n.metaKey),s=n&&n.shiftKey;if("/wx-filemanager-parent-link"===t){if(c.length&&(r||s))return;return void a.exec("select-file",{type:"navigation"})}let o="body"===t&&n?null:t;v.current||y.current?(v.current=null,y.current=null):a.exec("select-file",{id:o,toggle:r,range:s,panel:e})}function S(t){if("/wx-filemanager-parent-link"===t)return void(h.length>1&&a.exec("set-path",{id:h[h.length-2].id,panel:e,selected:[h[h.length-1].id]}));const n=g.find(e=>e.id===t);n&&("folder"===n.type?a.exec("set-path",{id:n.id,panel:e}):a.exec("open-file",{id:n.id}))}const j=(0,u.useMemo)(()=>"/"!==d?[{id:"/wx-filemanager-parent-link",name:o("Back to parent folder")},...g]:g,[d,g,o]),k=(0,u.useMemo)(()=>{if(j&&m&&m[d]){const{key:e,order:t}=m[d];return{[e]:{order:t}}}},[j,m,d]),C=(0,u.useRef)(null),N=(0,u.useRef)();return(0,u.useEffect)(()=>{N.current?(N.current.click=w,N.current._dblclick=S):(N.current={click:w,dblclick:e=>N.current._dblclick(e),_dblclick:S},Ho(C.current,N.current))},[w,S]),(0,p.jsxs)("div",{onClick:n,onContextMenu:r,className:"wx-SSaVhET7 wx-wrapper",children:[(0,p.jsx)(pd,{panel:e}),(0,p.jsx)("div",{"data-id":Oo("body"),className:"wx-SSaVhET7 wx-list "+(t?"wx-active":""),ref:C,children:(0,p.jsx)(gd,{children:(0,p.jsx)(rd,{init:function(t){t.intercept("sort-rows",t=>(v.current=!0,function(t){const n=t.key,r=m[d];let s=r?"asc":"desc";r&&r.key===n&&(s="asc"===r.order?"desc":"asc"),a.exec("sort-files",{key:n,order:s,panel:e,path:d})}(t),!1)),t.intercept("select-row",()=>!1),t.on("resize-column",()=>y.current=!0),t.intercept("hotkey",()=>!1)},data:j,columns:x,selectedRows:b,columnStyle:()=>"wx-SSaVhET7 wx-each-cell",sizes:{rowHeight:42,headerHeight:42},sortMarks:k})})})]})}function vd(){const e=(0,u.useContext)(ad),t=Dl(e,"activePanel");function n(t){e.exec("set-active-panel",{panel:t})}return(0,p.jsxs)("div",{className:"wx-L55BfJa2 wx-panels","data-id":Oo("body"),children:[(0,p.jsx)("div",{className:"wx-L55BfJa2 wx-item","data-panel":0,children:(0,p.jsx)(xd,{panel:0,active:0==t,onClick:()=>n(0),onContextMenu:()=>n(0)})}),(0,p.jsx)("div",{className:"wx-L55BfJa2 wx-item","data-panel":1,children:(0,p.jsx)(xd,{panel:1,active:1==t,onClick:()=>n(1),onContextMenu:()=>n(1)})})]})}function yd({folderIcon:e=!1,folder:t={}}){const n=(0,u.useContext)(ad),[r,a]=_l(n,"panels"),s=Dl(n,"activePanel"),o=(0,u.useMemo)(()=>r[s].path,[a,s]),i=(0,u.useContext)(Ci.i18n),l=(0,u.useMemo)(()=>i.getGroup("filemanager"),[i]),c=(0,u.useMemo)(()=>!!t.data?.find(e=>"folder"===e.type),[t]),d=(0,u.useMemo)(()=>"/"==t.id?l(t.name):t.name,[t,l]),h=(0,u.useMemo)(()=>t.$level>1?20*(t.$level-1):0,[t]),m=t.open;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("li",{"data-id":Oo(t.id),className:"wx-NYfhvGIt wx-folder"+(o===t.id?" wx-selected":""),style:{paddingLeft:`${h}px`},children:[c?(0,p.jsx)("i",{className:"wx-NYfhvGIt wx-toggle wxi-"+(m?"angle-down":"angle-right"),"data-action":"toggle"}):(0,p.jsx)("span",{className:"wx-NYfhvGIt wx-toggle-placeholder"}),(0,p.jsx)("i",{className:"wx-NYfhvGIt "+(e||"wxi-folder")}),(0,p.jsxs)("span",{className:"wx-NYfhvGIt wx-name",children:[" ",d," "]})]}),m&&t.data&&t.data.length&&c?(0,p.jsx)(p.Fragment,{children:t.data.map(e=>"folder"===e.type?(0,p.jsx)(yd,{folder:e},e.id):null)}):null]})}function bd(){const e=(0,u.useContext)(ad),[t,n]=_l(e,"data"),[r,a]=_l(e,"panels"),s=Dl(e,"activePanel"),o=(0,u.useMemo)(()=>r[s]._crumbs,[a,s]),i=(0,u.useCallback)(n=>{e.exec("open-tree-folder",{id:n,mode:!t.byId(n).open})},[e,n]),l=(0,u.useCallback)(t=>{const n=kl(t,o);e.exec("set-path",{id:t,panel:s,...n&&{selected:[n]}})},[e,o,s]),[c,d]=(0,u.useState)([]);(0,u.useEffect)(()=>{d(t.byId(0).data)},[n]);const h=(0,u.useRef)(null),m=(0,u.useRef)();return(0,u.useEffect)(()=>{m.current?(m.current.click=l,m.current.toggle=i):(m.current={click:l,toggle:i},Ho(h.current,m.current))},[l,i]),(0,p.jsx)("ul",{ref:h,className:"wx-LyHJ6R6A",children:c.map(e=>"folder"===e.type?(0,p.jsx)(yd,{folder:e},e.id):null)})}function wd(){const e=(0,u.useContext)(ad),t=(0,u.useContext)(Ci.i18n),n=(0,u.useMemo)(()=>t.getGroup("filemanager"),[t]),r=Dl(e,"drive"),a=r?r.used:"",s=r?r.total:"";return a&&s?(0,p.jsxs)("div",{className:"wx-DetSyKGG wx-drive",children:[(0,p.jsx)("progress",{value:a,max:s,className:"wx-DetSyKGG wx-progress"}),(0,p.jsxs)("p",{children:[yl(a)," ",n("of")," ",yl(s)," ",n("used")]})]}):null}function Sd({option:e}){const t=(0,u.useContext)(Ci.i18n).getGroup("filemanager"),n=(0,u.useContext)(od),r=(0,u.useCallback)(()=>{n.open({})},[n]);return(0,p.jsx)("div",{className:"wx-9XiKcxq5 wx-upload-button",onClick:r,children:(0,p.jsx)("span",{children:t(e.text)})})}function jd({readonly:e,menuOptions:t}){const n=(0,u.useContext)(Ci.i18n).getGroup("filemanager"),{showPrompt:r}=(0,u.useContext)(sd);(0,u.useEffect)(()=>{!function(e,t){Hl[e]=t}("upload",Sd)},[]);const a=(0,u.useMemo)(()=>t("add").map(e=>(e.text=n(e.text),e)),[t,n]);return(0,p.jsxs)("div",{className:"wx-FlucfALM wx-wrapper",children:[!e&&(0,p.jsx)("div",{className:"wx-FlucfALM wx-button",children:(0,p.jsx)(Ul,{options:a,at:"bottom-fit",onClick:function({action:e}){e&&("add-file"===e.id?r({item:{type:"file",size:0,date:new Date},add:!0}):"add-folder"===e.id&&r({item:{type:"folder",date:new Date},add:!0}))},children:(0,p.jsx)(Ti,{type:"primary block",children:n("Add New")})})}),(0,p.jsx)("div",{className:"wx-FlucfALM wx-tree",children:(0,p.jsx)(bd,{})}),(0,p.jsx)(wd,{})]})}function kd({value:e="",onSearch:t}){const[n,r]=Il(e),a=(0,u.useContext)(Ci.i18n).getGroup("filemanager"),s=(0,u.useRef)(null),o=(0,u.useMemo)(()=>""!==n?"wxi-close":"wxi-search",[n]);return(0,p.jsxs)("div",{className:"wx-lUZMtgT1 wx-search-input",children:[(0,p.jsx)("i",{className:`wx-lUZMtgT1 wx-icon ${o}`,onClick:function(){r(""),s.current&&s.current.focus(),t&&t({value:""})}}),(0,p.jsx)("input",{type:"text",className:"wx-lUZMtgT1 wx-text",ref:s,value:n,onInput:function(e){const n=e.target.value;r(n),t&&t({value:n})},placeholder:a("Search")})]})}function Cd({narrowMode:e=!1,onShowTree:t}){const n=(0,u.useContext)(ad),r=(0,u.useContext)(Ci.i18n).getGroup("filemanager"),a=Dl(n,"mode"),s=Dl(n,"preview"),o=Dl(n,"search");return(0,p.jsxs)("div",{className:"wx-5PZQQztG wx-toolbar",children:[(0,p.jsxs)("div",{className:"wx-5PZQQztG wx-left "+(e?"wx-left-narrow":""),children:[e?"panels"===a||"search"===a?null:(0,p.jsx)("div",{className:"wx-5PZQQztG wx-sidebar-icon","data-id":Oo("toggle-tree"),children:(0,p.jsx)(ud,{onClick:()=>t&&t(),name:"subtask"})}):(0,p.jsx)("div",{className:"wx-5PZQQztG wx-name",children:r("Files")}),(0,p.jsx)(kd,{onSearch:function(e){n.exec("filter-files",{text:e.value})},value:o})]}),(0,p.jsxs)("div",{className:"wx-5PZQQztG wx-right",children:[e?null:(0,p.jsx)("div",{className:"wx-5PZQQztG wx-preview-icon",children:(0,p.jsx)(al,{onClick:function(e){e.preventDefault(),n.exec("show-preview",{mode:!s})},value:s,children:(0,p.jsx)("i",{className:"wx-5PZQQztG wxi-eye"})})}),(0,p.jsx)("div",{className:"wx-5PZQQztG wx-modes",children:(0,p.jsx)(Ji,{value:a,options:[{icon:"wxi-view-sequential",id:"table"},{icon:"wxi-view-grid",id:"cards"},{icon:"wxi-view-column",id:"panels"}],onChange:function({value:e}){n.exec("set-mode",{mode:e})}})})]})]})}function Nd(){const e=Dl((0,u.useContext)(ad),"activePanel");return(0,p.jsxs)("div",{className:"wx-NwohNJzN wx-wrapper",children:[(0,p.jsx)(pd,{panel:e}),(0,p.jsx)(gd,{children:(0,p.jsx)(dd,{})})]})}function Td({readonly:e=!1,menuOptions:t,extraInfo:n}){const r=(0,u.useRef)(null),a=(0,u.useRef)(null),[s,o]=(0,u.useState)(void 0),[i,l]=(0,u.useState)(void 0),[c,d]=(0,u.useState)(!1),h=Yl(),m=(0,u.useContext)(ad),{showPrompt:f,showConfirm:g}=(0,u.useContext)(sd),x=(0,u.useContext)(Ci.i18n),v=(0,u.useMemo)(()=>x.getGroup("filemanager"),[x]),y=Dl(m,"mode"),b=Dl(m,"preview"),w=Dl(m,"activePanel"),[S,j]=_l(m,"panels"),k=(0,u.useMemo)(()=>(S&&null!=w?S[w]:null)?.selected??[],[j,w]),C=(0,u.useMemo)(()=>(S&&null!=w?S[w]:null)?.path,[j,w]),[N,T]=(0,u.useState)([]);(0,u.useEffect)(()=>{const e=r.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0]?.borderBoxSize?.[0]?.inlineSize;"number"==typeof t&&l(t<768)});return t.observe(e),()=>{t.disconnect()}},[]);const M=(0,u.useCallback)(()=>{d(e=>!e)},[]),E=(0,u.useCallback)(e=>{i&&"toggle-tree"!==zo(e)&&d(!1)},[i]);(0,u.useEffect)(()=>{const e=a.current;if(e)return Yo(e,E).destroy},[E]),(0,u.useEffect)(()=>{const e=a.current;if(!e)return;const t=new ResizeObserver(()=>{e&&o(e.clientWidth)});return t.observe(e),e&&o(e.clientWidth),()=>{t.disconnect()}},[]);const A=(0,u.useMemo)(()=>({icon:"wxi-eye",text:"Preview",id:"preview"}),[]),R=(0,u.useCallback)(e=>{let n=i?[A]:[];return"file"===e&&(n=[...n,...t().filter(e=>"download"===e.id)]),n},[i,A,t]),I=(0,u.useRef)(null),D=(0,u.useCallback)((e,t,n)=>{const r=n?[t.id]:k;switch(e){case"download":m.exec("download-file",{id:t.id});break;case"copy":case"move":I.current={action:e,ids:r};break;case"paste":I.current&&m.exec("copy"===I.current.action?"copy-files":"move-files",{ids:I.current.ids,target:"folder"===t?.type?t.id:C});break;case"rename":f({item:t});break;case"delete":g({selected:r});break;case"preview":m.exec("show-preview",{mode:!b})}},[m,k,C,f,g,b]),_=(0,u.useCallback)(()=>S?.[w],[S,w]);(0,u.useEffect)(()=>{const n=r.current;if(!n)return;const a=El(n,{api:m,menuOptions:e?R:t,performAction:D,getPanel:_});return()=>{"function"==typeof a?a():a&&"function"==typeof a.destroy&&a.destroy()}},[m,e,R,t,D,_]);const z=(0,u.useCallback)((n,r)=>{const a=n?m.getFile(n):null,s=r.target.closest(".tree-item.folder");let o;if(e)o=R(a?.type);else{if("body"===n)o=t(n);else if(a)if(!s&&k.length>1)o=i?[A,...t("multiselect")]:t("multiselect");else if("/"===n)o=t("folder",a).filter(e=>"paste"===e.id);else{const e=t(a.type,a);e&&(o=i?[A,...e]:e)}"search"===y&&(o=o?.filter(e=>"paste"!==e.id))}if(a?.id&&(!k.length||!k.some(e=>e===a.id))&&!s&&m.exec("select-file",{id:a.id}),o?.length)return o.forEach(e=>{s&&(e.hotkey=""),e.text&&(e.text=v(e.text)),e.hotkey&&(e.subtext=e.hotkey)}),T(o),a||{}},[m,e,R,t,k,i,A,y,v]),P=(0,u.useCallback)(e=>{const{action:t,context:n}=e;t&&D(t.id,n,!t.hotkey)},[D]);return(0,p.jsx)("div",{className:"wx-RJbNonjJ wx-filemanager wx-flex",ref:r,"data-menu-ignore":"false",children:i&&b?(0,p.jsx)("div",{className:"wx-RJbNonjJ wx-info-narrow",children:(0,p.jsx)(md,{narrowMode:i,extraInfo:n})}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Cd,{narrowMode:i,onShowTree:M}),(0,p.jsx)(Gl,{dataKey:"id",at:"point",options:N,resolver:z,onClick:P,children:(0,p.jsxs)(ql,{dataKey:"actionId",options:N,resolver:z,onClick:P,children:[(0,p.jsx)(Xl,{data:h,apiOnly:!0,uploadURL:async function(e){await Promise.resolve();const{name:t,size:n}=e.file;m.exec("create-file",{file:{name:t,size:n,date:new Date,file:e.file},parent:C})}}),(0,p.jsx)(od.Provider,{value:h,children:(0,p.jsx)("div",{className:"wx-RJbNonjJ wx-content-wrapper wx-flex",children:"panels"!==y&&"search"!==y?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"wx-RJbNonjJ "+["wx-sidebar",i?"wx-sidebar-narrow":"",c?"wx-sidebar-visible":""].filter(Boolean).join(" "),ref:a,children:(0,p.jsx)(jd,{readonly:e,menuOptions:t})}),(0,p.jsxs)("div",{className:"wx-RJbNonjJ wx-content",style:{width:`calc(100% - ${s||0}px - 10px)`},children:[(0,p.jsx)("div",{className:"wx-RJbNonjJ wx-content-item"+(b?"":"-fit"),"data-id":Oo("body"),children:"table"===y?(0,p.jsx)(xd,{panel:w}):(0,p.jsx)(Nd,{})}),b?(0,p.jsx)("div",{className:"wx-RJbNonjJ wx-info",children:(0,p.jsx)(md,{extraInfo:n})}):null]})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"wx-RJbNonjJ wx-content-item"+(b?"":"-fit"),children:"panels"===y?(0,p.jsx)(vd,{}):(0,p.jsx)(hd,{})}),b?(0,p.jsx)("div",{className:"wx-RJbNonjJ wx-info",children:(0,p.jsx)(md,{extraInfo:n})}):null]})})})]})})]})})}function Md(e,t){const{type:n,ext:r}=e;if("folder"===n)return!1;let a;return a=n&&"file"!==n&&ld[n]?n:r?ld[r]?r:"file":"unknown",`https://cdn.svar.dev/icons/filemanager/vivid/${t}/${a}.svg`}var Ed=(0,u.forwardRef)(function(e,t){const{data:n=[],mode:r="cards",drive:a=null,preview:s=!1,panels:o=null,activePanel:i=0,readonly:l=!1,menuOptions:c=Tl,extraInfo:d=null,init:h=null,icons:m=Md,previews:f=null,...g}=e,x=(0,u.useRef)();x.current=g;const v=(0,u.useMemo)(()=>new Nl(Pl),[]),y=(0,u.useMemo)(()=>v.in,[v]),b=(0,u.useRef)(null);null===b.current&&(b.current=new ll((e,t)=>{const n="on"+e.split("-").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):"").join("");x.current&&x.current[n]&&x.current[n](t)}),y.setNext(b.current));const w=(0,u.useMemo)(()=>({getState:v.getState.bind(v),getReactiveState:v.getReactive.bind(v),getStores:()=>({data:v}),exec:y.exec,setNext:e=>(b.current=b.current.setNext(e),b.current),intercept:y.intercept.bind(y),on:y.on.bind(y),detach:y.detach.bind(y),getFile:v.getFile.bind(v),serialize:v.serialize.bind(v),templates:{preview:f||(()=>null),icon:"simple"===m?()=>null:m}}),[v,y]),S=(0,u.useRef)(0);return(0,u.useEffect)(()=>{if(S.current){const e=v.getState();v.init({data:n,mode:r,drive:a,preview:s,panels:o||e.panels||[],activePanel:i})}else h&&h(w);S.current++},[v,n,r,a,s,o,i,h,w]),0===S.current&&v.init({data:n,mode:r,drive:a,preview:s,panels:o||[],activePanel:i}),(0,u.useImperativeHandle)(t,()=>({...w}),[w]),(0,p.jsx)(ad.Provider,{value:w,children:(0,p.jsx)(qi,{words:il,optional:!0,children:(0,p.jsx)(id,{children:(0,p.jsx)(Td,{readonly:l,menuOptions:c,extraInfo:d})})})})});function Ad({fonts:e=!0,children:t}){return t?(0,p.jsx)(ol,{fonts:e,children:t}):(0,p.jsx)(ol,{fonts:e})}function Rd({...e}){return(0,p.jsx)(g.Root,{"data-slot":"dialog",...e})}function Id({...e}){return(0,p.jsx)(g.Portal,{"data-slot":"dialog-portal",...e})}function Dd({className:e,...t}){return(0,p.jsx)(g.Overlay,{"data-slot":"dialog-overlay",className:xo("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs",e),...t})}function _d({className:e,children:t,hideCloseButton:n=!1,...r}){return(0,p.jsxs)(Id,{"data-slot":"dialog-portal",children:[(0,p.jsx)(Dd,{}),(0,p.jsxs)(g.Content,{"data-slot":"dialog-content","aria-describedby":r["aria-describedby"]??void 0,className:xo("z-[9999] bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200",e),...r,children:[t,!n&&(0,p.jsxs)(g.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,p.jsx)(f.XIcon,{}),(0,p.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function zd({className:e,...t}){return(0,p.jsx)("div",{"data-slot":"dialog-header",className:xo("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Pd({className:e,...t}){return(0,p.jsx)(g.Title,{"data-slot":"dialog-title",className:xo("text-lg leading-none font-semibold",e),...t})}function Od({className:e,...t}){return(0,p.jsx)(g.Description,{"data-slot":"dialog-description",className:xo("text-muted-foreground text-sm",e),...t})}function Ld(e){return(e||"Untitled").trim().replace(/[^a-zA-Z0-9\s-]/g,"").replace(/\s+/g,"-")}function Fd(e=[]){return function(e){const t=new Map;for(const a of e)t.set(a.id,a);function n(e){const n=[Ld(e.title)];let r=e;for(;r.parentId;){const e=t.get(r.parentId);if(!e)break;n.unshift(Ld(e.title)),r=e}return"/"+n.join("/")}function r(e){if(!e.parentId)return"0";const r=t.get(e.parentId);return r?n(r):"0"}return e.map(e=>({id:n(e),parent:r(e),type:e.isFolder?"folder":"file",date:new Date,size:e.isFolder?void 0:e.content?.length||0}))}(e)}Fo(Lo);var Bd=[{id:"1",title:"Welcome to REASON",content:'<h1>Welcome to REASON</h1><p>A powerful note-taking app with nested documents.</p><h2>Features</h2><ul><li><p><strong>Rich text editing</strong> with WYSIWYG editor</p></li><li><p><strong>Nested documents</strong> for better organization</p></li><li><p><strong>Full-text search</strong> to find notes quickly</p></li><li><p><strong>Drag and drop</strong> to reorganize notes</p></li><li><p><strong>Right-click menus</strong> for quick actions</p></li><li><p><strong>Document outline</strong> view</p></li><li><p><strong>Local storage</strong> - your notes stay private</p></li><li><p><strong>Mobile-friendly</strong> with responsive drawer navigation</p></li></ul><h2>Getting Started</h2><p>On mobile, tap the menu icon to access your notes.</p><p>Click the "New Note" button to create your first note, or select this note to start editing.</p><p>You can also create child notes by right-clicking a note.</p><h3>Drag and Drop</h3><p>Drag notes to reorder them or move them under different parent notes.</p><h3>Outline View</h3><p>Click the outline icon to see all headings in the current document.</p><p>Press the search icon (or Ctrl+K) to quickly find any note.</p>',parentId:null,children:[],isExpanded:!0,tags:[]},{id:"2",title:"Projects",content:"",parentId:null,children:[],isExpanded:!0,isFolder:!0,tags:[]},{id:"3",title:"Website Redesign",content:"<h1>Website Redesign</h1><p>Planning for the new website design.</p><h2>Goals</h2><ul><li><p>Modern, clean interface</p></li><li><p>Mobile-first approach</p></li><li><p>Improved accessibility</p></li></ul>",parentId:"2",children:[],isExpanded:!1,tags:["design","web"]},{id:"4",title:"API Integration",content:"<h1>API Integration</h1><p>Notes on integrating the new REST API.</p><h2>Endpoints</h2><ul><li><p>GET /api/documents</p></li><li><p>POST /api/documents</p></li><li><p>PUT /api/documents/:id</p></li></ul>",parentId:"2",children:[],isExpanded:!1,tags:["development","api"]},{id:"5",title:"Research",content:"",parentId:null,children:[],isExpanded:!0,isFolder:!0,tags:[]},{id:"6",title:"Market Analysis",content:"<h1>Market Analysis</h1><p>Research findings on market trends.</p><h2>Key Insights</h2><ul><li><p>Growing demand for productivity tools</p></li><li><p>Users prefer cloud-based solutions</p></li><li><p>Mobile access is essential</p></li></ul>",parentId:"5",children:[],isExpanded:!1,tags:["research","business"]},{id:"7",title:"Competitor Review",content:"<h1>Competitor Review</h1><p>Analysis of competitor products.</p><h2>Top Competitors</h2><ul><li><p>Notion - Versatile but complex</p></li><li><p>Obsidian - Great for developers</p></li><li><p>Roam Research - Powerful linking</p></li></ul>",parentId:"5",children:[],isExpanded:!1,tags:["research","competition"]},{id:"8",title:"Meeting Notes",content:"<h1>Meeting Notes</h1><p>Quick notes from today's team meeting.</p><h2>Action Items</h2><ul><li><p>Review PRs by EOD</p></li><li><p>Update documentation</p></li><li><p>Schedule next sprint planning</p></li></ul>",parentId:null,children:[],isExpanded:!1,tags:["meetings"]}];function Hd({open:e,onOpenChange:t,documents:n=Bd,onSelectDocument:r}){const a=(0,u.useMemo)(()=>Fd(n).map(e=>({id:e.id,parent:e.parent,type:e.type,size:e.size??0,date:e.date??new Date})),[n]),s=(0,u.useMemo)(()=>function(e){const t=new Map;for(const a of e)t.set(a.id,a);function n(e){const n=[Ld(e.title)];let r=e;for(;r.parentId;){const e=t.get(r.parentId);if(!e)break;n.unshift(Ld(e.title)),r=e}return"/"+n.join("/")}const r=new Map;for(const a of e)a.isFolder||r.set(n(a),a.id);return r}(n),[n]),o=(0,u.useRef)(s);o.current=s;const i=(0,u.useRef)(r);i.current=r;const l=(0,u.useRef)(t);l.current=t;const c=(0,u.useCallback)(e=>{e.on("open-file",({id:e})=>{const t=o.current.get(e);t&&i.current&&(i.current(t),l.current(!1))})},[]);return(0,p.jsx)(Rd,{open:e,onOpenChange:t,children:(0,p.jsx)(_d,{className:"!max-w-[98vw] w-[98vw] h-[95vh] max-h-[95vh] p-0 flex flex-col overflow-hidden sm:!max-w-[98vw] !duration-0 data-[state=open]:!zoom-in-100 data-[state=closed]:!zoom-out-100 data-[state=open]:!animate-none data-[state=closed]:!animate-none",children:(0,p.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:(0,p.jsx)("div",{className:"h-[92vh] min-h-[300px] rounded-md overflow-hidden",children:e&&(0,p.jsx)(Ad,{children:(0,p.jsx)(Ed,{data:a,mode:"table",init:c})})})})})})}var Vd=t.cva("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-2xl text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-[1.5px] bg-background hover:bg-accent hover:text-accent-foreground dark:bg-card dark:hover:bg-card/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function $d({className:e,variant:t,size:n,asChild:r=!1,...a}){return(0,p.jsx)(r?h.Slot:"button",{"data-slot":"button",className:xo(Vd({variant:t,size:n,className:e})),...a})}function qd({delayDuration:e=0,...t}){return(0,p.jsx)(j.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Ud({...e}){return(0,p.jsx)(qd,{children:(0,p.jsx)(j.Root,{"data-slot":"tooltip",...e})})}function Gd({...e}){return(0,p.jsx)(j.Trigger,{"data-slot":"tooltip-trigger",...e})}function Wd({className:e,sideOffset:t=0,children:n,...r}){return(0,p.jsx)(j.Portal,{children:(0,p.jsxs)(j.Content,{"data-slot":"tooltip-content","data-richtext-portal":!0,sideOffset:t,className:xo("bg-popover text-popover-foreground border border-border shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-2xl px-3 py-1.5 text-xs text-balance",e),...r,children:[n,(0,p.jsx)(j.Arrow,{className:"bg-popover fill-popover z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Kd({...e}){return(0,p.jsx)(y.Root,{"data-slot":"dropdown-menu",...e})}function Yd({...e}){return(0,p.jsx)(y.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function Xd({className:e,sideOffset:t=4,...n}){return(0,p.jsx)(y.Portal,{children:(0,p.jsx)(y.Content,{collisionPadding:8,"data-richtext-menu":!0,"data-slot":"dropdown-menu-content",sideOffset:t,className:xo("bg-card text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl border p-1 shadow-md",e),...n})})}function Zd({className:e,inset:t,variant:n="default",...r}){return(0,p.jsx)(y.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:xo("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-2xl px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function Jd({className:e,children:t,checked:n,...r}){return(0,p.jsxs)(y.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:xo("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-2xl py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:n,...r,children:[(0,p.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,p.jsx)(y.ItemIndicator,{children:(0,p.jsx)(f.CheckIcon,{className:"size-4"})})}),t]})}function Qd({className:e,inset:t,...n}){return(0,p.jsx)(y.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:xo("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function eu({className:e,...t}){return(0,p.jsx)(y.Separator,{"data-slot":"dropdown-menu-separator",className:xo("bg-border -mx-1 my-1 h-px",e),...t})}var tu=e=>{switch(e){case"local":default:return(0,p.jsx)(f.HardDrive,{className:"h-3.5 w-3.5"});case"ssh":return(0,p.jsx)(f.Server,{className:"h-3.5 w-3.5"});case"s3":return(0,p.jsx)(f.Cloud,{className:"h-3.5 w-3.5"});case"r2":return(0,p.jsx)(f.Database,{className:"h-3.5 w-3.5"});case"gdocs":return(0,p.jsx)(f.FileText,{className:"h-3.5 w-3.5"});case"turso":return(0,p.jsx)(f.Workflow,{className:"h-3.5 w-3.5"})}},nu=e=>{switch(e){case"local":return"Local";case"ssh":return"SSH";case"s3":return"S3";case"r2":return"R2";case"gdocs":return"Google Docs";case"turso":return"Turso DB";default:return e}},ru=[{type:"ai",label:"AI",icon:f.Sparkles},{type:"files",label:"Files",icon:f.FileText},{type:"outline",label:"Outline",icon:f.AlignLeft},{type:"openTabs",label:"Open Tabs",icon:f.Layers},{type:"related",label:"Related",icon:f.Link2}];function au(e,t,n,r){const a=e.includes(n);if(t){if(a){const t=e.filter(e=>e!==n);return 0!==t.length||r?t:e}return[...e,n]}return a?r?[]:e:[n]}function su(e,t){return t||e.length<=1?e:[e[0]]}var ou=({leftPanels:e,onLeftPanelsChange:t,leftSplit:n,onLeftSplitChange:r,rightPanels:a,onRightPanelsChange:s,rightSplit:o,onRightSplitChange:i,showDynamicIsland:l,onToggleDynamicIsland:c,triggerClassName:d,tooltipSide:u="bottom",align:h="end"})=>{const m=n||o||a.length>0;return(0,p.jsxs)(Kd,{children:[(0,p.jsxs)(Ud,{children:[(0,p.jsx)(Gd,{asChild:!0,children:(0,p.jsx)(Yd,{asChild:!0,children:(0,p.jsx)($d,{variant:"ghost",size:"sm",className:xo(d,m&&"bg-sidebar-accent text-sidebar-foreground"),children:(0,p.jsx)(f.Columns2,{className:"h-4 w-4"})})})}),(0,p.jsx)(Wd,{side:u,children:(0,p.jsx)("p",{children:"Split View Options"})})]}),(0,p.jsxs)(Xd,{align:h,className:"w-64",children:[(0,p.jsx)(Qd,{className:"text-xs font-semibold text-muted-foreground",children:"Left Sidebar"}),(0,p.jsx)(Jd,{checked:n,onSelect:e=>e.preventDefault(),onCheckedChange:n=>{r(n),t(su(e,n))},children:"Split View"}),ru.map(({type:r,label:a,icon:s})=>(0,p.jsxs)(Jd,{checked:e.includes(r),onSelect:e=>e.preventDefault(),onCheckedChange:()=>t(au(e,n,r,!1)),children:[(0,p.jsx)(s,{className:"h-4 w-4"}),(0,p.jsx)("span",{children:a})]},`left-${r}`)),(0,p.jsx)(eu,{}),(0,p.jsx)(Qd,{className:"text-xs font-semibold text-muted-foreground",children:"Right Sidebar"}),(0,p.jsx)(Jd,{checked:o,onSelect:e=>e.preventDefault(),onCheckedChange:e=>{i(e),s(su(a,e))},children:"Split View"}),ru.map(({type:e,label:t,icon:n})=>(0,p.jsxs)(Jd,{checked:a.includes(e),onSelect:e=>e.preventDefault(),onCheckedChange:()=>s(au(a,o,e,!0)),children:[(0,p.jsx)(n,{className:"h-4 w-4"}),(0,p.jsx)("span",{children:t})]},`right-${e}`)),c&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eu,{}),(0,p.jsx)(Qd,{className:"text-xs font-semibold text-muted-foreground",children:"Display"}),(0,p.jsx)(Jd,{checked:!!l,onSelect:e=>e.preventDefault(),onCheckedChange:()=>c(),children:"Reading Progress Island"})]})]})]})},iu={sm:14,md:18,lg:24};function lu({filename:e,size:t="sm"}){const n=function(e){const t=e.lastIndexOf(".");return-1!==t?e.slice(t+1).toLowerCase():""}(e),r="number"==typeof t?t:iu[t],a=n?Qa[n]??{}:{};return(0,p.jsx)("span",{className:"shrink-0 inline-flex",style:{width:r,height:r},"aria-hidden":!0,children:(0,p.jsx)(Ja,{extension:n||void 0,...a})})}var cu=({leftPanels:e,leftSplit:t,onLeftPanelsChange:n,onLeftSplitChange:r,rightPanels:a,rightSplit:s,onRightPanelsChange:o,onRightSplitChange:i,activeId:l,onAdd:c,onSearchFocus:d,onFileManagerOpen:u,sources:h,activeSource:m,activeFileSourceId:g,onFileSourceChange:x,onSourceSelect:v,allExpanded:y,expandToggleLabel:b,outlineExpanded:w,onToggleAllExpanded:S,onToggleOutlineExpanded:j,treeRef:k,outlineRef:C,deletedDocs:N=[],onRestore:T,showDynamicIsland:M=!1,onToggleDynamicIsland:E,onSettingsClick:A,isMobile:R,openTabs:I=[],activeTab:D,onTabChange:_,onTabClose:z,documents:P=[],tabItems:O})=>{const L=e=>P.find(t=>t.id===e)?.title||"Untitled",F=O??I.map(e=>({id:e,title:L(e),kind:"file"}));return(0,p.jsx)("div",{className:"flex flex-wrap items-center gap-0.5 px-2 py-1.5 border-b border-sidebar-border",children:(0,p.jsxs)(qd,{delayDuration:300,children:[(e.includes("files")||e.includes("openTabs"))&&(0,p.jsxs)(p.Fragment,{children:[x&&(0,p.jsxs)(Kd,{children:[(0,p.jsxs)(Ud,{children:[(0,p.jsx)(Gd,{asChild:!0,children:(0,p.jsx)(Yd,{asChild:!0,children:(0,p.jsx)($d,{variant:"ghost",size:"sm",className:"size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent",children:m&&tu(m.type)})})}),(0,p.jsx)(Wd,{side:"bottom",children:(0,p.jsxs)("p",{children:["Storage Source: ",m?.name||"Select Source"]})})]}),(0,p.jsxs)(Xd,{align:"start",className:"w-56",children:[h.map((e,t)=>(0,p.jsxs)("div",{children:[t>0&&h[t-1]?.type!==e.type&&(0,p.jsx)(eu,{}),(0,p.jsxs)(Zd,{onClick:()=>v(e.id),className:"flex items-center justify-between cursor-pointer",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[tu(e.type),(0,p.jsxs)("div",{className:"flex flex-col flex-1 min-w-0",children:[(0,p.jsx)("span",{className:"truncate text-sm",children:e.name}),(0,p.jsx)("span",{className:"text-xs text-muted-foreground",children:nu(e.type)})]})]}),e.id===g&&(0,p.jsx)(f.Check,{className:"h-4 w-4 ml-2 shrink-0"})]})]},e.id)),1===h.length&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eu,{}),(0,p.jsx)(Zd,{disabled:!0,className:"text-xs text-center text-muted-foreground",children:"Add sources in Settings"})]})]})]}),(0,p.jsxs)(Ud,{children:[(0,p.jsx)(Gd,{asChild:!0,children:(0,p.jsx)($d,{variant:"ghost",size:"sm",onClick:d,className:"size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent",children:(0,p.jsx)(f.Search,{className:"h-4 w-4"})})}),(0,p.jsx)(Wd,{side:"bottom",children:(0,p.jsx)("p",{children:"Search Notes"})})]}),(0,p.jsxs)(Ud,{children:[(0,p.jsx)(Gd,{asChild:!0,children:(0,p.jsx)($d,{variant:"ghost",size:"sm",onClick:u,className:"size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent",children:(0,p.jsx)(f.Folders,{className:"h-4 w-4"})})}),(0,p.jsx)(Wd,{side:"bottom",children:(0,p.jsx)("p",{children:"File Manager"})})]}),(0,p.jsxs)(Ud,{children:[(0,p.jsx)(Gd,{asChild:!0,children:(0,p.jsx)($d,{variant:"ghost",size:"sm",onClick:()=>c(l,!1),className:"size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent",children:(0,p.jsx)(f.FilePlus,{className:"h-4 w-4"})})}),(0,p.jsx)(Wd,{side:"bottom",children:(0,p.jsx)("p",{children:"New File"})})]}),(0,p.jsxs)(Ud,{children:[(0,p.jsx)(Gd,{asChild:!0,children:(0,p.jsx)($d,{variant:"ghost",size:"sm",onClick:()=>c(l,!0),className:"size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent",children:(0,p.jsx)(f.FolderPlus,{className:"h-4 w-4"})})}),(0,p.jsx)(Wd,{side:"bottom",children:(0,p.jsx)("p",{children:"New Folder"})})]}),(0,p.jsxs)(Ud,{children:[(0,p.jsx)(Gd,{asChild:!0,children:(0,p.jsx)($d,{variant:"ghost",size:"sm",onClick:S,className:"size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent",children:y?(0,p.jsx)(f.ChevronsUpDown,{className:"h-4 w-4"}):(0,p.jsx)(f.ChevronsDownUp,{className:"h-4 w-4"})})}),(0,p.jsx)(Wd,{side:"bottom",children:(0,p.jsx)("p",{children:b})})]}),(0,p.jsxs)(Kd,{children:[(0,p.jsxs)(Ud,{children:[(0,p.jsx)(Gd,{asChild:!0,children:(0,p.jsx)(Yd,{asChild:!0,children:(0,p.jsx)($d,{variant:"ghost",size:"sm",className:"size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent",children:(0,p.jsx)(f.Trash2,{className:"h-4 w-4"})})})}),(0,p.jsx)(Wd,{side:"bottom",children:(0,p.jsx)("p",{children:"Trash"})})]}),(0,p.jsx)(Xd,{align:"end",className:"w-56",children:N.length>0?(0,p.jsxs)(p.Fragment,{children:[N.slice(0,5).map(e=>(0,p.jsxs)(Zd,{className:"flex items-center justify-between",onClick:()=>T?.(e.id),children:[(0,p.jsx)("span",{className:"truncate flex-1",children:e.title||"Untitled"}),(0,p.jsx)(f.RotateCcw,{className:"h-3 w-3 ml-2 opacity-60"})]},e.id)),N.length>5&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eu,{}),(0,p.jsxs)(Zd,{disabled:!0,className:"text-xs text-center",children:[N.length-5," more in trash..."]})]})]}):(0,p.jsx)(Zd,{disabled:!0,className:"text-center text-muted-foreground",children:"Trash is empty"})})]}),F.length>0&&_&&(0,p.jsxs)(Kd,{children:[(0,p.jsxs)(Ud,{children:[(0,p.jsx)(Gd,{asChild:!0,children:(0,p.jsx)(Yd,{asChild:!0,children:(0,p.jsx)($d,{variant:"ghost",size:"sm",className:"size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent",children:(0,p.jsx)(f.MoreHorizontal,{className:"h-4 w-4"})})})}),(0,p.jsx)(Wd,{side:"bottom",children:(0,p.jsx)("p",{children:"All Open Tabs"})})]}),(0,p.jsx)(Xd,{align:"end",className:"w-56 max-h-80 overflow-y-auto",children:F.map(({id:e,title:t,kind:n})=>(0,p.jsxs)(Zd,{className:xo("flex items-center justify-between gap-2 cursor-pointer pr-1",e===D&&"font-semibold text-blue-600"),onSelect:()=>_(e),children:[(0,p.jsxs)("span",{className:"flex items-center gap-2 flex-1 min-w-0",children:["chat"===n?(0,p.jsx)(f.MessageSquare,{className:"shrink-0 h-3.5 w-3.5 text-blue-500"}):(0,p.jsx)(lu,{filename:t,size:14}),(0,p.jsx)("span",{className:"truncate text-sm",children:t})]}),z&&(0,p.jsx)("button",{className:"shrink-0 h-5 w-5 flex items-center justify-center rounded hover:bg-destructive/10 hover:text-destructive",onClick:t=>{t.stopPropagation(),z(e)},children:(0,p.jsx)(f.X,{className:"h-3 w-3"})})]},e))})]})]}),(0,p.jsx)(ou,{leftPanels:e,onLeftPanelsChange:n,leftSplit:t,onLeftSplitChange:r,rightPanels:a,onRightPanelsChange:o,rightSplit:s,onRightSplitChange:i,showDynamicIsland:M,onToggleDynamicIsland:E,triggerClassName:"size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent",tooltipSide:"bottom"}),e.includes("outline")&&(0,p.jsxs)(Ud,{children:[(0,p.jsx)(Gd,{asChild:!0,children:(0,p.jsx)($d,{variant:"ghost",size:"sm",onClick:j,className:"size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent",children:w?(0,p.jsx)(f.ChevronsUpDown,{className:"h-4 w-4"}):(0,p.jsx)(f.ChevronsDownUp,{className:"h-4 w-4"})})}),(0,p.jsx)(Wd,{side:"bottom",children:(0,p.jsx)("p",{children:w?"Collapse All":"Expand All"})})]})]})})},du=Object.defineProperty,uu=Object.defineProperties,hu=Object.getOwnPropertyDescriptors,mu=Object.getOwnPropertySymbols,pu=Object.prototype.hasOwnProperty,fu=Object.prototype.propertyIsEnumerable,gu=(e,t,n)=>t in e?du(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xu=(e,t)=>{for(var n in t||(t={}))pu.call(t,n)&&gu(e,n,t[n]);if(mu)for(var n of mu(t))fu.call(t,n)&&gu(e,n,t[n]);return e},vu=(e,t)=>uu(e,hu(t)),yu=(e,t,n)=>new Promise((r,a)=>{var s=e=>{try{i(n.next(e))}catch(t){a(t)}},o=e=>{try{i(n.throw(e))}catch(t){a(t)}},i=e=>e.done?r(e.value):Promise.resolve(e.value).then(s,o);i((n=n.apply(e,t)).next())});function bu(e,t){return"function"==typeof e?e(t):e}function wu(e,t){return n=>{t.setState(t=>vu(xu({},t),{[e]:bu(n,t[e])}))}}var Su=(e,t=100,n=1e3)=>new Promise(r=>{let a;const s=setInterval(()=>{e()&&(r(),clearInterval(s),clearTimeout(a))},t);a=setTimeout(()=>{clearInterval(s),r()},n)}),ju=e=>Error("Headless Tree: "+e),ku={key:"tree",getInitialState:e=>xu({expandedItems:[],focusedItem:null},e),getDefaultConfig:(e,t)=>xu({setExpandedItems:wu("expandedItems",t),setFocusedItem:wu("focusedItem",t)},e),stateHandlerNames:{expandedItems:"setExpandedItems",focusedItem:"setFocusedItem"},treeInstance:{getItemsMeta:({tree:e})=>{const{rootItemId:t}=e.getConfig(),{expandedItems:n}=e.getState(),r=[],a=new Set(n),s=(t,n,o,i,l)=>{var c;if(n.includes(t))n.join(".");else if(r.push({itemId:t,level:o,index:r.length,parentId:n.at(-1),setSize:i,posInSet:l}),a.has(t)){const r=null!=(c=e.retrieveChildrenIds(t))?c:[];let a=0;for(const e of r)s(e,n.concat(t),o+1,r.length,a++)}},o=e.retrieveChildrenIds(t);let i=0;for(const l of o)s(l,[t],0,o.length,i++);return r},getFocusedItem:({tree:e})=>{var t;const n=e.getState().focusedItem;return null!=(t=null!==n?e.getItemInstance(n):null)?t:e.getItems()[0]},getRootItem:({tree:e})=>{const{rootItemId:t}=e.getConfig();return e.getItemInstance(t)},focusNextItem:({tree:e})=>{var t;const n=e.getFocusedItem().getItemMeta();if(!n)return;const r=Math.min(n.index+1,e.getItems().length-1);null==(t=e.getItems()[r])||t.setFocused()},focusPreviousItem:({tree:e})=>{var t;const n=e.getFocusedItem().getItemMeta();if(!n)return;const r=Math.max(n.index-1,0);null==(t=e.getItems()[r])||t.setFocused()},updateDomFocus:({tree:e})=>{setTimeout(()=>yu(null,null,function*(){var t,n,r,a,s;const o=e.getFocusedItem();null==(n=(t=e.getConfig()).scrollToItem)||n.call(t,o),yield Su(()=>null!==o.getElement(),20,500);const i=o.getElement();if(!i)return null==(r=e.getItems()[0])||r.setFocused(),void(null==(s=null==(a=e.getItems()[0])?void 0:a.getElement())||s.focus());i.focus()}))},getContainerProps:({prev:e,tree:t},n)=>vu(xu({},null==e?void 0:e()),{role:"tree","aria-label":null!=n?n:"",ref:t.registerElement}),isSearchOpen:()=>!1},itemInstance:{scrollTo:(e,t)=>yu(null,[e,t],function*({tree:e,item:t},n){var r,a,s;null==(a=(r=e.getConfig()).scrollToItem)||a.call(r,t),yield Su(()=>null!==t.getElement(),20),null==(s=t.getElement())||s.scrollIntoView(n)}),getId:({itemId:e})=>e,getKey:({itemId:e})=>e,getProps:({item:e,prev:t})=>{const n=e.getItemMeta();return vu(xu({},null==t?void 0:t()),{ref:e.registerElement,role:"treeitem","aria-setsize":n.setSize,"aria-posinset":n.posInSet+1,"aria-selected":"false","aria-label":e.getItemName(),"aria-level":n.level+1,"aria-expanded":e.isFolder()?e.isExpanded():void 0,tabIndex:e.isFocused()?0:-1,onClick:t=>{e.setFocused(),e.primaryAction(),t.ctrlKey||t.shiftKey||t.metaKey||e.isFolder()&&(e.isExpanded()?e.collapse():e.expand())}})},expand:({tree:e,item:t,itemId:n})=>{var r;t.isFolder()&&((null==(r=e.getState().loadingItemChildrens)?void 0:r.includes(n))||(e.applySubStateUpdate("expandedItems",e=>[...e,n]),e.rebuildTree()))},collapse:({tree:e,item:t,itemId:n})=>{t.isFolder()&&(e.applySubStateUpdate("expandedItems",e=>e.filter(e=>e!==n)),e.rebuildTree())},getItemData:({tree:e,itemId:t})=>e.retrieveItemData(t),equals:({item:e},t)=>e.getId()===(null==t?void 0:t.getId()),isExpanded:({tree:e,itemId:t})=>e.getState().expandedItems.includes(t),isDescendentOf:({item:e},t)=>{const n=e.getParent();return Boolean((null==n?void 0:n.getId())===t||(null==n?void 0:n.isDescendentOf(t)))},isFocused:({tree:e,item:t,itemId:n})=>e.getState().focusedItem===n||null===e.getState().focusedItem&&0===t.getItemMeta().index,isFolder:({tree:e,item:t,itemId:n})=>n===e.getConfig().rootItemId||e.getConfig().isItemFolder(t),getItemName:({tree:e,item:t})=>e.getConfig().getItemName(t),setFocused:({tree:e,itemId:t})=>{e.applySubStateUpdate("focusedItem",t)},primaryAction:({tree:e,item:t})=>{var n,r;return null==(r=(n=e.getConfig()).onPrimaryAction)?void 0:r.call(n,t)},getParent:({tree:e,item:t})=>t.getItemMeta().parentId?e.getItemInstance(t.getItemMeta().parentId):void 0,getIndexInParent:({item:e})=>e.getItemMeta().posInSet,getChildren:({tree:e,itemId:t})=>e.retrieveChildrenIds(t).map(t=>e.getItemInstance(t)),getTree:({tree:e})=>e,getItemAbove:({tree:e,item:t})=>e.getItems()[t.getItemMeta().index-1],getItemBelow:({tree:e,item:t})=>e.getItems()[t.getItemMeta().index+1]},hotkeys:{focusNextItem:{hotkey:"ArrowDown",canRepeat:!0,preventDefault:!0,isEnabled:e=>{var t,n;return!(null!=(n=null==(t=e.isSearchOpen)?void 0:t.call(e))&&n||e.getState().dnd)},handler:(e,t)=>{t.focusNextItem(),t.updateDomFocus()}},focusPreviousItem:{hotkey:"ArrowUp",canRepeat:!0,preventDefault:!0,isEnabled:e=>{var t,n;return!(null!=(n=null==(t=e.isSearchOpen)?void 0:t.call(e))&&n||e.getState().dnd)},handler:(e,t)=>{t.focusPreviousItem(),t.updateDomFocus()}},expandOrDown:{hotkey:"ArrowRight",canRepeat:!0,handler:(e,t)=>{const n=t.getFocusedItem();n.isExpanded()||!n.isFolder()?(t.focusNextItem(),t.updateDomFocus()):n.expand()}},collapseOrUp:{hotkey:"ArrowLeft",canRepeat:!0,handler:(e,t)=>{var n;const r=t.getFocusedItem();r.isExpanded()&&r.isFolder()||0===r.getItemMeta().level?r.collapse():(null==(n=r.getParent())||n.setFocused(),t.updateDomFocus())}},focusFirstItem:{hotkey:"Home",handler:(e,t)=>{var n;null==(n=t.getItems()[0])||n.setFocused(),t.updateDomFocus()}},focusLastItem:{hotkey:"End",handler:(e,t)=>{var n;null==(n=t.getItems()[t.getItems().length-1])||n.setFocused(),t.updateDomFocus()}}}},Cu=(e,t,n)=>{const r={};return[r,()=>{const a=n(r);for(let n=0;n<e.length;n++){const s=e[n][t];if(s)e:for(const[e,t]of Object.entries(s)){if(!t)continue e;const n=r[e];r[e]=(...e)=>t(vu(xu({},a),{prev:n}),...e)}}}]},Nu=(e=[])=>{return((e,t)=>{const n=e.length;for(let r=0;r<n;r++)for(let a=r+1;a<n;a++)t(e[a],e[r])<0&&([e[r],e[a]]=[e[a],e[r]]);return e})(e,(t=e,(e,n)=>{var r,a;return n.key&&(null==(r=e.overwrites)?void 0:r.includes(n.key))?1:e.key&&(null==(a=n.overwrites)?void 0:a.includes(e.key))?-1:t.indexOf(e)-t.indexOf(n)}));var t},Tu=e=>{var t,n,r,a;const s=null!=(t=e.instanceBuilder)?t:Cu,o=[ku,...Nu(e.features)];(e=>{var t;const n=null==e?void 0:e.map(e=>e.key);for(const r of null!=e?e:[]){const e=null==(t=r.deps)?void 0:t.find(e=>!(null==n?void 0:n.includes(e)));if(e)throw ju(`${r.key} needs ${e}`)}})(o);const i=[...o],[l,c]=s(i,"treeInstance",e=>({tree:e}));let d=o.reduce((e,t)=>{var n,r;return null!=(r=null==(n=t.getInitialState)?void 0:n.call(t,e,l))?r:e},null!=(r=null!=(n=e.initialState)?n:e.state)?r:{}),u=o.reduce((e,t)=>{var n,r;return null!=(r=null==(n=t.getDefaultConfig)?void 0:n.call(t,e,l))?r:e},e);const h=o.reduce((e,t)=>xu(xu({},e),t.stateHandlerNames),{});let m;const p={current:{}};let f=!1;const g={};let x=[];const v={},y={};let b={};const w={},S=()=>{x=[],b={};const[e,t]=s(i,"itemInstance",e=>({item:e,tree:l,itemId:u.rootItemId}));t(),g[u.rootItemId]=e,b[u.rootItemId]={itemId:u.rootItemId,index:-1,parentId:null,level:-1,posInSet:0,setSize:1};for(const n of l.getItemsMeta())if(b[n.itemId]=n,g[n.itemId])x.push(g[n.itemId]);else{const[e,t]=s(i,"itemInstance",e=>({item:e,tree:l,itemId:n.itemId}));t(),g[n.itemId]=e,x.push(e)}f=!1},j=e=>{for(const t of o)e(t)};i.unshift({key:"main",treeInstance:{getState:()=>d,setState:({},e)=>{var t;null==(t=u.setState)||t.call(u,d)},setMounted:({},e)=>{var t;const n=p.current;n.isMounted=e,e&&(null==(t=n.waitingForMount)||t.forEach(e=>e()),n.waitingForMount=[])},applySubStateUpdate:({},e,t)=>{const n=()=>{d[e]="function"==typeof t?t(d[e]):t;const n=u[h[e]];n?.(d[e])},r=p.current;r.isMounted?n():(r.waitingForMount??=[],r.waitingForMount.push(n))},rebuildTree:()=>{var e;const t=p.current;t.isMounted?(S(),null==(e=u.setState)||e.call(u,d)):(t.waitingForMount??=[],t.waitingForMount.push(()=>{var e;S(),null==(e=u.setState)||e.call(u,d)}))},scheduleRebuildTree:()=>{f=!0},getConfig:()=>u,setConfig:(e,t)=>{var n,r,a;const s="function"==typeof t?t(u):t,o=(null==(n=s.state)?void 0:n.expandedItems)&&(null==(r=s.state)?void 0:r.expandedItems)!==d.expandedItems;u=s,s.state&&(d=xu(xu({},d),s.state)),o&&(S(),null==(a=u.setState)||a.call(u,d))},getItemInstance:({},e)=>{const t=g[e];if(!t){const[t,n]=s(i,"itemInstance",t=>({item:t,tree:l,itemId:e}));return n(),t}return t},getItems:()=>(f&&S(),x),registerElement:({},e)=>{m!==e&&(m&&!e?j(e=>{var t;return null==(t=e.onTreeUnmount)?void 0:t.call(e,l,m)}):!m&&e&&j(t=>{var n;return null==(n=t.onTreeMount)?void 0:n.call(t,l,e)}),m=e)},getElement:()=>m,getDataRef:()=>p,getHotkeyPresets:()=>w},itemInstance:{registerElement:({itemId:e,item:t},n)=>{if(v[e]===n)return;const r=v[e];r&&!n?j(e=>{var n;return null==(n=e.onItemUnmount)?void 0:n.call(e,t,r,l)}):!r&&n&&j(e=>{var r;return null==(r=e.onItemMount)?void 0:r.call(e,t,n,l)}),v[e]=n},getElement:({itemId:e})=>v[e],getDataRef:({itemId:e})=>{var t;return null!=(t=y[e])?t:y[e]={current:{}}},getItemMeta:({itemId:e})=>{var t;return null!=(t=b[e])?t:{itemId:e,parentId:null,level:-1,index:-1,posInSet:0,setSize:1}}}});for(const k of i)Object.assign(w,null!=(a=k.hotkeys)?a:{});return c(),l},Mu=(e=>(e[e.None=0]="None",e[e.Started=1]="Started",e[e.Dragging=2]="Dragging",e[e.Completed=3]="Completed",e[e.Aborted=4]="Aborted",e))(Mu||{}),Eu={key:"selection",getInitialState:e=>xu({selectedItems:[]},e),getDefaultConfig:(e,t)=>xu({setSelectedItems:wu("selectedItems",t)},e),stateHandlerNames:{selectedItems:"setSelectedItems"},treeInstance:{setSelectedItems:({tree:e},t)=>{e.applySubStateUpdate("selectedItems",t)},getSelectedItems:({tree:e})=>e.getState().selectedItems.map(e.getItemInstance)},itemInstance:{select:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();e.setSelectedItems(n.includes(t)?n:[...n,t])},deselect:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();e.setSelectedItems(n.filter(e=>e!==t))},isSelected:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();return n.includes(t)},selectUpTo:({tree:e,item:t,itemId:n},r)=>{const a=t.getItemMeta().index,s=e.getDataRef();if(!s.current.selectUpToAnchorId)return s.current.selectUpToAnchorId=n,void e.setSelectedItems([n]);const o=e.getItemInstance(s.current.selectUpToAnchorId).getItemMeta().index,[i,l]=a<o?[a,o]:[o,a],c=e.getItems().slice(i,l+1).map(e=>e.getItemMeta().itemId);if(!r)return void e.setSelectedItems(c);const{selectedItems:d}=e.getState(),u=[...new Set([...d,...c])];e.setSelectedItems(u)},toggleSelect:({item:e})=>{e.isSelected()?e.deselect():e.select()},getProps:({tree:e,item:t,itemId:n,prev:r})=>vu(xu({},null==r?void 0:r()),{"aria-selected":t.isSelected()?"true":"false",onClick:a=>{var s,o;a.shiftKey?t.selectUpTo(a.ctrlKey||a.metaKey):a.ctrlKey||a.metaKey?t.toggleSelect():e.setSelectedItems([n]),a.shiftKey||(e.getDataRef().current.selectUpToAnchorId=n),null==(o=null==(s=null==r?void 0:r())?void 0:s.onClick)||o.call(s,a)}})},hotkeys:{toggleSelectedItem:{hotkey:"Control+Space",preventDefault:!0,handler:(e,t)=>{t.getFocusedItem().toggleSelect()}},selectUpwards:{hotkey:"Shift+ArrowUp",handler:(e,t)=>{const n=t.getFocusedItem(),r=n.getItemAbove();r&&(n.isSelected()&&r.isSelected()?n.deselect():r.select(),r.setFocused(),t.updateDomFocus())}},selectDownwards:{hotkey:"Shift+ArrowDown",handler:(e,t)=>{const n=t.getFocusedItem(),r=n.getItemBelow();r&&(n.isSelected()&&r.isSelected()?n.deselect():r.select(),r.setFocused(),t.updateDomFocus())}},selectAll:{hotkey:"Control+KeyA",preventDefault:!0,handler:(e,t)=>{t.setSelectedItems(t.getItems().map(e=>e.getId()))}}}},Au=e=>""!==e.code&&"Unidentified"!==e.code?e.code:e.key,Ru={letter:/^Key[A-Z]$/,letterornumber:/^(Key[A-Z]|Digit[0-9])$/,plus:/^(NumpadAdd|Plus)$/,minus:/^(NumpadSubtract|Minus)$/,control:/^(ControlLeft|ControlRight)$/,shift:/^(ShiftLeft|ShiftRight)$/,metaorcontrol:/^(MetaLeft|MetaRight|ControlLeft|ControlRight)$/,enter:/^(Enter|NumpadEnter)$/},Iu=new Set(["MetaLeft","MetaRight","Meta","ControlLeft","ControlRight","Control","AltLeft","AltRight","Alt","ShiftLeft","ShiftRight","Shift"]),Du=(e,t,n,r)=>{var a;return null==(a=Object.entries(xu(xu({},n),r)).find(([,n])=>((e,t,n)=>{const r=n.hotkey.toLowerCase().split("+"),a=r.every(t=>{if(t in Ru)return[...e].some(e=>Ru[t].test(e));const n=[...e].map(e=>e.toLowerCase());return n.includes(t.toLowerCase())||n.includes(`key${t.toLowerCase()}`)}),s=!n.isEnabled||n.isEnabled(t);return a&&s&&e.size===r.length})(e,t,n)))?void 0:a[0]},_u=e=>{e.current.pressedKeys=new Set},zu=(e,t,n,r={})=>{var a,s,o,i;const{isInputFocused:l=!1,releaseAfterDispatch:c=!1}=r,{ignoreHotkeysOnInputs:d,onTreeHotkey:u,hotkeys:h}=e.getConfig();if(l&&d)return;const m=Au({code:null!=(a=n.code)?a:"",key:null!=(s=n.key)?s:""});(o=t.current).pressedKeys??(o.pressedKeys=new Set);const p=!t.current.pressedKeys.has(m);m&&t.current.pressedKeys.add(m);const f=Du(t.current.pressedKeys,e,e.getHotkeyPresets(),h);if(c&&m&&t.current.pressedKeys.delete(m),!f)return;const g=xu(xu({},e.getHotkeyPresets()[f]),null==h?void 0:h[f]);g&&(!g.allowWhenInputFocused&&l||(g.canRepeat||p)&&(g.preventDefault&&(null==(i=n.preventDefault)||i.call(n)),g.handler(n,e),u?.(f,n)))},Pu=(e,t)=>{var n,r,a;const s=Au({code:null!=(n=t.code)?n:"",key:null!=(r=t.key)?r:""});s&&((a=e.current).pressedKeys??(a.pressedKeys=new Set),Iu.has(s)&&(e.current.pressedKeys=new Set([...e.current.pressedKeys].filter(e=>Iu.has(e)))),e.current.pressedKeys.delete(s))},Ou={key:"hotkeys-core",onTreeMount:(e,t)=>{const n=e.getDataRef(),r=t=>{const r=t.target instanceof HTMLInputElement;zu(e,n,t,{isInputFocused:r,releaseAfterDispatch:r})},a=e=>{Pu(n,e)},s=()=>{_u(n)};t.addEventListener("keydown",r),document.addEventListener("keyup",a),window.addEventListener("focus",s),n.current.keydownHandler=r,n.current.keyupHandler=a,n.current.resetHandler=s},onTreeUnmount:(e,t)=>{const n=e.getDataRef();n.current.keyupHandler&&(document.removeEventListener("keyup",n.current.keyupHandler),delete n.current.keyupHandler),n.current.keydownHandler&&(t.removeEventListener("keydown",n.current.keydownHandler),delete n.current.keydownHandler),n.current.resetHandler&&(window.removeEventListener("focus",n.current.resetHandler),delete n.current.resetHandler)}},Lu=e=>{if(!e)throw ju("sync dataLoader returned undefined");if("object"==typeof e&&"then"in e)throw ju("sync dataLoader returned promise");return e},Fu={key:"sync-data-loader",getInitialState:e=>xu({loadingItemData:[],loadingItemChildrens:[]},e),getDefaultConfig:(e,t)=>xu({setLoadingItemData:wu("loadingItemData",t),setLoadingItemChildrens:wu("loadingItemChildrens",t)},e),stateHandlerNames:{loadingItemData:"setLoadingItemData",loadingItemChildrens:"setLoadingItemChildrens"},treeInstance:{waitForItemDataLoaded:()=>yu(null,null,function*(){}),waitForItemChildrenLoaded:()=>yu(null,null,function*(){}),retrieveItemData:({tree:e},t)=>Lu(e.getConfig().dataLoader.getItem(t)),retrieveChildrenIds:({tree:e},t)=>{const{dataLoader:n}=e.getConfig();return"getChildren"in n?Lu(n.getChildren(t)):Lu(n.getChildrenWithData(t)).map(e=>e.data)},loadItemData:({tree:e},t)=>e.retrieveItemData(t),loadChildrenIds:({tree:e},t)=>e.retrieveChildrenIds(t)},itemInstance:{isLoading:()=>!1,hasLoadedData:()=>!0}},Bu=e=>"childIndex"in e,Hu=(e,t,n)=>{var r,a,s;const o=null==(r=n.getState().dnd)?void 0:r.draggedItems,i=n.getConfig();return!(o&&null!=(s=null==(a=i.canDrop)?void 0:a.call(i,o,t))&&!s)&&((!o||!o.some(e=>t.item.getId()===e.getId()||t.item.isDescendentOf(e.getId())))&&!(!o&&e&&i.canDropForeignDragObject&&!i.canDropForeignDragObject(e,t)))},Vu=e=>e.isExpanded()?1:e.getParent()&&e.getIndexInParent()===e.getItemMeta().setSize-1?2:0,$u=(e,t,n)=>{var r;return t-(null!=(r=e.slice(0,t).reduce((e,t)=>t&&(null==n?void 0:n.some(e=>e.getId()===t.getId()))?++e:e,0))?r:0)},qu=(e,t,n,r)=>{var a,s,o,i,l;const c=n.getConfig();if(!c.canReorder)return r?{type:2}:{type:1};const d=null==(a=t.getElement())?void 0:a.getBoundingClientRect(),u=d?(e.clientY-d.top)/d.height:.5,h=d?e.clientX-d.left:0,m=Vu(t),p=r?null!=(s=c.reorderAreaPercentage)?s:.3:.5,f=null!=(o=c.indent)?o:20,g=r?2:1;if(1===m)return u<p?{type:0}:{type:g};if(2===m&&h<t.getItemMeta().level*f){if(u<.5)return{type:0};const e=null!=(l=null==(i=t.getItemBelow())?void 0:i.getItemMeta().level)?l:0;return{type:3,reparentLevel:Math.max(e,Math.floor(h/f))}}return u<p?{type:0}:u>1-p?{type:1}:{type:g}},Uu=(e,t)=>t===e.getItemMeta().level?e:Uu(e.getParent(),t),Gu=(e,t,n)=>{const r=e.getItemMeta(),a=Uu(e,t-1),s=Uu(e,t).getIndexInParent()+1;return{item:a,childIndex:s,insertionIndex:$u(a.getChildren(),s,n),dragLineIndex:r.index+1,dragLineLevel:t}},Wu=(e,t,n,r,a=n.getConfig().canReorder)=>{var s;const o=r?e.dataTransfer:null,i=null==(s=n.getState().dnd)?void 0:s.draggedItems,l=t.getItemMeta(),c=t.getParent(),d={item:t},u=c?{item:c}:null,h=u&&Hu(o,u,n),m=qu(e,t,n,Hu(o,d,n));if(!a&&c&&h&&2!==m.type)return(null==i?void 0:i.some(e=>e.isDescendentOf(c.getId())))?d:u;if(2===m.type)return d;if(!a&&c&&!h)return Wu(e,c,n,r,!1);if(!c)return d;if(!h)return Wu(e,c,n,r,!1);if(3===m.type)return Gu(t,m.reparentLevel,i);const p=0===m.type?0:1,f=t.getIndexInParent()+p;return{item:c,dragLineIndex:l.index+p,dragLineLevel:l.level,childIndex:f,insertionIndex:$u(c.getChildren(),f,i)}},Ku=()=>!1,Yu={key:"drag-and-drop",getDefaultConfig:(e,t)=>xu({canDrop:(e,t)=>t.item.isFolder(),canDropForeignDragObject:Ku,canDragForeignDragObjectOver:e.canDropForeignDragObject!==Ku?e=>"none"!==e.effectAllowed:()=>!1,setDndState:wu("dnd",t),canReorder:!0,openOnDropDelay:800,draggedItemOverwritesSelection:!0},e),stateHandlerNames:{dnd:"setDndState"},onTreeMount:e=>{const t=()=>{e.applySubStateUpdate("dnd",null)};e.getDataRef().current.windowDragEndListener=t,window.addEventListener("dragend",t)},onTreeUnmount:e=>{const{windowDragEndListener:t}=e.getDataRef().current;t&&window.removeEventListener("dragend",t)},treeInstance:{getDragTarget:({tree:e})=>{var t,n;return null!=(n=null==(t=e.getState().dnd)?void 0:t.dragTarget)?n:null},getDragLineData:({tree:e})=>{var t,n,r,a,s,o;const i=e.getDragTarget(),l=(null!=(t=null==i?void 0:i.item.getItemMeta().level)?t:0)+1,c=null==(n=e.getElement())?void 0:n.getBoundingClientRect();if(!i||!c||!Bu(i))return null;const d=i.dragLineLevel*(null!=(r=e.getConfig().indent)?r:1),u=e.getItems()[i.dragLineIndex];if(!u){const t=null==(s=null==(a=e.getItems()[i.dragLineIndex-1])?void 0:a.getElement())?void 0:s.getBoundingClientRect();if(t)return{indent:l,top:t.bottom-c.top,left:t.left+d-c.left,width:t.width-d}}const h=null==(o=null==u?void 0:u.getElement())?void 0:o.getBoundingClientRect();return h?{indent:l,top:h.top-c.top,left:h.left+d-c.left,width:h.width-d}:null},getDragLineStyle:({tree:e},t=-1,n=-8)=>{const r=e.getDragLineData();return r?{position:"absolute",top:`${r.top+t}px`,left:`${r.left+n}px`,width:r.width-n+"px",pointerEvents:"none"}:{display:"none"}},getContainerProps:({prev:e,tree:t},n)=>{const r=null==e?void 0:e(n);return vu(xu({},r),{onDragOver:e=>{e.preventDefault()},onDrop:e=>yu(null,null,function*(){var n,r,a;const s=t.getDataRef(),o={item:t.getRootItem()};if(!Hu(e.dataTransfer,o,t))return;e.preventDefault();const i=t.getConfig(),l=null==(n=t.getState().dnd)?void 0:n.draggedItems;s.current.lastDragCode=void 0,l?yield null==(r=i.onDrop)?void 0:r.call(i,l,o):e.dataTransfer&&(yield null==(a=i.onDropForeignDragObject)?void 0:a.call(i,e.dataTransfer,o))}),style:vu(xu({},null==r?void 0:r.style),{position:"relative"})})}},itemInstance:{getProps:({tree:e,item:t,prev:n})=>vu(xu(xu({},null==n?void 0:n()),e.getConfig().seperateDragHandle?{}:t.getDragHandleProps()),{onDragEnter:e=>e.preventDefault(),onDragOver:n=>{var r,a,s;n.stopPropagation();const o=e.getDataRef(),i=qu(n,t,e,!0),l=((e,t)=>[e.getId(),t.type,3===t.type?t.reparentLevel:0].join("__"))(t,i);if(l===o.current.lastDragCode)return void(o.current.lastAllowDrop&&n.preventDefault());o.current.lastDragCode=l,o.current.lastDragEnter=Date.now(),((e,t,n,r)=>{const{openOnDropDelay:a}=t.getConfig(),s=e.current.lastDragCode;a&&n.isFolder()&&!n.isExpanded()&&2===r.type&&(clearTimeout(e.current.autoExpandTimeout),e.current.autoExpandTimeout=setTimeout(()=>{s===e.current.lastDragCode&&e.current.lastAllowDrop&&n.expand()},a))})(o,e,t,i);const c=Wu(n,t,e,!1);((null==(r=e.getState().dnd)?void 0:r.draggedItems)||n.dataTransfer&&(null==(s=(a=e.getConfig()).canDragForeignDragObjectOver)?void 0:s.call(a,n.dataTransfer,c)))&&Hu(null,c,e)?(e.applySubStateUpdate("dnd",e=>vu(xu({},e),{dragTarget:c,draggingOverItem:t})),o.current.lastAllowDrop=!0,n.preventDefault()):o.current.lastAllowDrop=!1},onDragLeave:()=>{setTimeout(()=>{var t;const n=e.getDataRef();(null!=(t=n.current.lastDragEnter)?t:0)+100>=Date.now()||(n.current.lastDragCode="no-drag",e.applySubStateUpdate("dnd",e=>vu(xu({},e),{draggingOverItem:void 0,dragTarget:void 0})))},100)},onDrop:n=>yu(null,null,function*(){var r,a,s;n.stopPropagation();const o=e.getDataRef(),i=Wu(n,t,e,!0),l=null==(r=e.getState().dnd)?void 0:r.draggedItems,c=Hu(n.dataTransfer,i,e);if(e.applySubStateUpdate("dnd",{draggedItems:void 0,draggingOverItem:void 0,dragTarget:void 0}),!c)return;n.preventDefault();const d=e.getConfig();o.current.lastDragCode=void 0,l?(yield null==(a=d.onDrop)?void 0:a.call(d,l,i),l[0].setFocused()):n.dataTransfer&&(yield null==(s=d.onDropForeignDragObject)?void 0:s.call(d,n.dataTransfer,i)),e.applySubStateUpdate("dnd",null),e.updateDomFocus()})}),getDragHandleProps:({tree:e,item:t,prev:n})=>vu(xu({},null==n?void 0:n()),{draggable:!0,onDragStart:n=>{var r,a,s,o;const{draggedItemOverwritesSelection:i}=e.getConfig(),l=e.getSelectedItems?e.getSelectedItems():[e.getFocusedItem()],c=!l.includes(t)&&i,d=c?[t]:l,u=e.getConfig();if(c&&(null==(r=e.setSelectedItems)||r.call(e,[t.getItemMeta().itemId])),null==(s=null==(a=u.canDrag)?void 0:a.call(u,d))||s){if(u.setDragImage){const{imgElement:e,xOffset:t,yOffset:r}=u.setDragImage(d);null==(o=n.dataTransfer)||o.setDragImage(e,null!=t?t:0,null!=r?r:0)}if(u.createForeignDragObject&&n.dataTransfer){const{format:e,data:t,dropEffect:r,effectAllowed:a}=u.createForeignDragObject(d);n.dataTransfer.setData(e,t),r&&(n.dataTransfer.dropEffect=r),a&&(n.dataTransfer.effectAllowed=a)}e.applySubStateUpdate("dnd",{draggedItems:d,draggingOverItem:e.getFocusedItem()})}else n.preventDefault()},onDragEnd:n=>{var r,a;const{onCompleteForeignDrop:s,canDragForeignDragObjectOver:o}=e.getConfig(),i=null==(r=e.getState().dnd)?void 0:r.draggedItems;if("none"===(null==(a=n.dataTransfer)?void 0:a.dropEffect)||!i)return;const l=Wu(n,t,e,!1);o&&n.dataTransfer&&!o(n.dataTransfer,l)||s?.(i)}}),isDragTarget:({tree:e,item:t})=>{const n=e.getDragTarget();return!!n&&n.item.getId()===t.getId()},isUnorderedDragTarget:({tree:e,item:t})=>{const n=e.getDragTarget();return!!n&&(!Bu(n)&&n.item.getId()===t.getId())},isDragTargetAbove:({tree:e,item:t})=>{const n=e.getDragTarget();return!(!n||!Bu(n)||n.item!==t.getParent())&&n.childIndex===t.getItemMeta().posInSet},isDragTargetBelow:({tree:e,item:t})=>{const n=e.getDragTarget();return!(!n||!Bu(n)||n.item!==t.getParent())&&n.childIndex-1===t.getItemMeta().posInSet},isDraggingOver:({tree:e,item:t})=>{var n,r;return(null==(r=null==(n=e.getState().dnd)?void 0:n.draggingOverItem)?void 0:r.getId())===t.getId()}}},Xu=(e,t,n=(t=>null==(t=e.getState().dnd)?void 0:t.dragTarget)())=>{var r;if(!n)return;const a=((e,t,n)=>{var r,a,s,o;const i=t?0:1,l=null==(r=e.getState().dnd)?void 0:r.draggedItems;if(Bu(n)){const r=n.item.getParent(),c=e.getItems()[n.dragLineIndex-1],d=c?Vu(c):0,u=null!=(a=null==c?void 0:c.getItemMeta().level)?a:0,h=null!=(o=null==(s=null==c?void 0:c.getItemBelow())?void 0:s.getItemMeta().level)?o:0;if(2===d){if(t&&n.dragLineLevel<u)return Gu(c,n.dragLineLevel+1,l);if(!t&&n.dragLineLevel>h&&r)return Gu(c,n.dragLineLevel-1,l)}const m=n.dragLineIndex-1+i,p=e.getItems()[m];return p?{item:p}:void 0}if(1===Vu(n.item)&&!t)return{item:n.item,childIndex:0,insertionIndex:$u(n.item.getChildren(),0,l),dragLineIndex:n.item.getItemMeta().index+i,dragLineLevel:n.item.getItemMeta().level+1};const c=n.item.getIndexInParent()+i;return{item:n.item.getParent(),childIndex:c,insertionIndex:$u(n.item.getParent().getChildren(),c,l),dragLineIndex:n.item.getItemMeta().index+i,dragLineLevel:n.item.getItemMeta().level}})(e,t,n),s=null!=(r=e.getDataRef().current.kDndDataTransfer)?r:null;return a?Hu(s,a,e)?a:Xu(e,t,a):void 0},Zu=e=>{const t=e.getState().dnd;(null==t?void 0:t.dragTarget)&&!Bu(t.dragTarget)&&t.dragTarget.item.scrollTo({block:"nearest",inline:"nearest"})},Ju=(e,t,n)=>{var r,a;const s=e.getFocusedItem(),{canDrag:o}=e.getConfig();if(t&&o&&!o(t))return;t?(e.applySubStateUpdate("dnd",{draggedItems:t}),null==(a=(r=e.getConfig()).onStartKeyboardDrag)||a.call(r,t)):n&&(e.getDataRef().current.kDndDataTransfer=n);const i=Xu(e,!1,{item:s});i&&(e.applySubStateUpdate("dnd",{draggedItems:t,dragTarget:i}),e.applySubStateUpdate("assistiveDndState",1),Zu(e))},Qu=(e,t)=>{var n;const r=Xu(e,t);r&&(e.applySubStateUpdate("dnd",{draggedItems:null==(n=e.getState().dnd)?void 0:n.draggedItems,dragTarget:r}),e.applySubStateUpdate("assistiveDndState",2),Bu(r)||r.item.setFocused(),Zu(e))},eh={key:"keyboard-drag-and-drop",deps:["drag-and-drop"],getDefaultConfig:(e,t)=>xu({setAssistiveDndState:wu("assistiveDndState",t)},e),stateHandlerNames:{assistiveDndState:"setAssistiveDndState"},treeInstance:{startKeyboardDrag:({tree:e},t)=>{Ju(e,t,void 0)},startKeyboardDragOnForeignObject:({tree:e},t)=>{Ju(e,void 0,t)},stopKeyboardDrag:({tree:e})=>{e.getDataRef().current.kDndDataTransfer=void 0,e.applySubStateUpdate("dnd",null),e.applySubStateUpdate("assistiveDndState",0)}},hotkeys:{startDrag:{hotkey:"Control+Shift+KeyD",preventDefault:!0,isEnabled:e=>!e.getState().dnd,handler:(e,t)=>{var n,r;const a=null!=(r=null==(n=t.getSelectedItems)?void 0:n.call(t))?r:[t.getFocusedItem()],s=t.getFocusedItem();t.startKeyboardDrag(a.includes(s)?a:a.concat(s))}},dragUp:{hotkey:"ArrowUp",preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{Qu(t,!0)}},dragDown:{hotkey:"ArrowDown",preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{Qu(t,!1)}},cancelDrag:{hotkey:"Escape",isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{t.stopKeyboardDrag()}},completeDrag:{hotkey:"Enter",preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>yu(null,null,function*(){var n,r,a,s;e.stopPropagation();const o=t.getDataRef(),i=t.getDragTarget(),l=null!=(n=o.current.kDndDataTransfer)?n:null;if(!i||!Hu(l,i,t))return;const c=t.getConfig(),d=null==(r=t.getState().dnd)?void 0:r.draggedItems;o.current.lastDragCode=void 0,t.applySubStateUpdate("dnd",null),d?(yield null==(a=c.onDrop)?void 0:a.call(c,d,i),t.getItemInstance(d[0].getId()).setFocused()):l&&(yield null==(s=c.onDropForeignDragObject)?void 0:s.call(c,l,i)),t.updateDomFocus(),t.applySubStateUpdate("assistiveDndState",3)})}}},th=(((e,t)=>{let n,r=null})(({tree:e})=>[e.getSearchValue(),e.getItems(),e.getConfig().isSearchMatchingItem],(e,t,n)=>t.filter(t=>e&&(null==n?void 0:n(e,t)))),{key:"renaming",overwrites:["drag-and-drop"],getDefaultConfig:(e,t)=>xu({setRenamingItem:wu("renamingItem",t),setRenamingValue:wu("renamingValue",t),canRename:()=>!0},e),stateHandlerNames:{renamingItem:"setRenamingItem",renamingValue:"setRenamingValue"},treeInstance:{getRenamingItem:({tree:e})=>{const t=e.getState().renamingItem;return t?e.getItemInstance(t):null},getRenamingValue:({tree:e})=>e.getState().renamingValue||"",abortRenaming:({tree:e})=>{e.applySubStateUpdate("renamingItem",null),e.updateDomFocus()},completeRenaming:({tree:e})=>{var t;const n=e.getConfig(),r=e.getRenamingItem();r&&(null==(t=n.onRename)||t.call(n,r,e.getState().renamingValue||"")),e.applySubStateUpdate("renamingItem",null),e.updateDomFocus()},isRenamingItem:({tree:e})=>!!e.getState().renamingItem},itemInstance:{startRenaming:({tree:e,item:t,itemId:n})=>{t.canRename()&&(e.applySubStateUpdate("renamingItem",n),e.applySubStateUpdate("renamingValue",t.getItemName()))},getRenameInputProps:({tree:e})=>({ref:e=>null==e?void 0:e.focus(),onBlur:()=>e.abortRenaming(),value:e.getRenamingValue(),onChange:t=>{var n;e.applySubStateUpdate("renamingValue",null==(n=t.target)?void 0:n.value)}}),canRename:({tree:e,item:t})=>{var n,r,a;return null==(a=null==(r=(n=e.getConfig()).canRename)?void 0:r.call(n,t))||a},isRenaming:({tree:e,item:t})=>t.getId()===e.getState().renamingItem,getProps:({prev:e,item:t})=>{var n;const r=t.isRenaming(),a=null!=(n=null==e?void 0:e())?n:{};return r?vu(xu({},a),{draggable:!1,onDragStart:()=>{}}):a}},hotkeys:{renameItem:{hotkey:"F2",handler:(e,t)=>{t.getFocusedItem().startRenaming()}},abortRenaming:{hotkey:"Escape",allowWhenInputFocused:!0,isEnabled:e=>e.isRenamingItem(),handler:(e,t)=>{t.abortRenaming()}},completeRenaming:{hotkey:"Enter",allowWhenInputFocused:!0,isEnabled:e=>e.isRenamingItem(),handler:(e,t)=>{t.completeRenaming()}}}}),nh=Object.defineProperty,rh=Object.defineProperties,ah=Object.getOwnPropertyDescriptors,sh=Object.getOwnPropertySymbols,oh=Object.prototype.hasOwnProperty,ih=Object.prototype.propertyIsEnumerable,lh=(e,t,n)=>t in e?nh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ch=(e,t)=>{for(var n in t||(t={}))oh.call(t,n)&&lh(e,n,t[n]);if(sh)for(var n of sh(t))ih.call(t,n)&&lh(e,n,t[n]);return e},dh=(e,t)=>rh(e,ah(t)),uh={position:"absolute",margin:"-1px",width:"1px",height:"1px",overflow:"hidden",clip:"rect(0 0 0 0)"},hh=(e,t,n)=>{var r,a,s,o,i,l,c,d,u;if(!n.startDrag)return"";const h=null!=(a=null==(r=null==e?void 0:e.draggedItems)?void 0:r.map(e=>e.getItemName()).join(", "))?a:"",m=(null==e?void 0:e.dragTarget)?"childIndex"in e.dragTarget?`${e.dragTarget.childIndex} of ${e.dragTarget.item.getChildren().length} in ${e.dragTarget.item.getItemName()}`:`in ${e.dragTarget.item.getItemName()}`:"None",p=`Press ${null==(s=n.dragUp)?void 0:s.hotkey} and ${null==(o=n.dragDown)?void 0:o.hotkey} to move up or down, ${null==(i=n.completeDrag)?void 0:i.hotkey} to drop, ${null==(l=n.cancelDrag)?void 0:l.hotkey} to abort.`;switch(t){case Mu.Started:return h?`Dragging ${h}. Current position: ${m}. ${p}`:`Current position: ${m}. ${p}`;case Mu.Dragging:return h?`${h}, ${m}`:m;case Mu.Completed:return`Drag completed. Press ${null==(c=n.startDrag)?void 0:c.hotkey} to move selected items`;case Mu.Aborted:return`Drag cancelled. Press ${null==(d=n.startDrag)?void 0:d.hotkey} to move selected items`;case Mu.None:default:return`Press ${null==(u=n.startDrag)?void 0:u.hotkey} to move selected items`}},mh=e=>{var t,n=e,{tree:r,getLabel:a=hh}=n,s=((e,t)=>{var n={};for(var r in e)oh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&sh)for(var r of sh(e))t.indexOf(r)<0&&ih.call(e,r)&&(n[r]=e[r]);return n})(n,["tree","getLabel"]);const o=r.getState();return u.default.createElement("span",dh(ch({"aria-live":"assertive"},s),{style:ch(ch({},uh),s.style)}),a(o.dnd,null!=(t=o.assistiveDndState)?t:Mu.None,r.getHotkeyPresets()))},ph=u.createContext({currentItem:void 0,indent:20,tree:void 0});function fh(){return u.useContext(ph)}function gh({indent:e=20,tree:t,className:n,...r}){const a=t&&"function"==typeof t.getContainerProps?t.getContainerProps():{},{style:s,...o}={...r,...a},i={...s,"--tree-indent":`${e}px`};return(0,p.jsx)(ph.Provider,{value:{indent:e,tree:t},children:(0,p.jsx)("div",{className:xo("flex flex-col",n),"data-slot":"tree",style:i,...o})})}function xh({item:e,className:t,asChild:n,children:r,...a}){const{indent:s}=fh(),o="function"==typeof e.getProps?e.getProps():{},{style:i,...l}={...a,...o},c={...i,"--tree-padding":e.getItemMeta().level*s+"px"},d=n?h.Slot:"button";return(0,p.jsx)(ph.Provider,{value:{currentItem:e,indent:s},children:(0,p.jsx)(d,{"aria-expanded":e.isExpanded(),className:xo("z-10 select-none ps-(--tree-padding) not-last:pb-0.5 outline-hidden focus:z-20 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),"data-drag-target":"function"==typeof e.isDragTarget?e.isDragTarget()||!1:void 0,"data-focus":"function"==typeof e.isFocused?e.isFocused()||!1:void 0,"data-folder":"function"==typeof e.isFolder?e.isFolder()||!1:void 0,"data-search-match":"function"==typeof e.isMatchingSearch?e.isMatchingSearch()||!1:void 0,"data-selected":"function"==typeof e.isSelected?e.isSelected()||!1:void 0,"data-slot":"tree-item",style:c,...l,children:r})})}function vh({item:e,children:t,className:n,...r}){const{currentItem:a}=fh(),s=e||a;return s?(0,p.jsxs)("span",{className:xo("flex items-center gap-2 rounded-sm bg-background in-data-[drag-target=true]:bg-accent in-data-[search-match=true]:bg-blue-400/20! in-data-[selected=true]:bg-accent px-2 py-1.5 in-data-[selected=true]:text-accent-foreground text-sm in-focus-visible:ring-[3px] in-focus-visible:ring-ring/50 transition-colors hover:bg-accent [&_svg]:pointer-events-none [&_svg]:shrink-0",n),"data-slot":"tree-item-label",...r,children:[s.isFolder()?(0,p.jsx)(f.ChevronDownIcon,{className:"in-aria-[expanded=false]:-rotate-90 size-4 shrink-0 text-muted-foreground"}):(0,p.jsx)("span",{className:"size-4 shrink-0","aria-hidden":!0}),t||("function"==typeof s.getItemName?s.getItemName():null)]}):null}function yh({className:e,...t}){const{tree:n}=fh();if(!n||"function"!=typeof n.getDragLineStyle)return null;const r=n.getDragLineStyle();return(0,p.jsx)("div",{className:xo("-mt-px before:-top-[3px] absolute z-30 h-0.5 w-[unset] bg-primary before:absolute before:left-0 before:size-2 before:rounded-full before:border-2 before:border-primary before:bg-background",e),style:r,...t})}function bh({...e}){return(0,p.jsx)(q,{"data-slot":"alert-dialog",...e})}function wh({...e}){return(0,p.jsx)(U,{"data-slot":"alert-dialog-portal",...e})}function Sh({className:e,...t}){return(0,p.jsx)(G,{"data-slot":"alert-dialog-overlay",className:xo("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs",e),...t})}function jh({className:e,...t}){return(0,p.jsxs)(wh,{children:[(0,p.jsx)(Sh,{}),(0,p.jsx)(W,{"data-slot":"alert-dialog-content",className:xo("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function kh({className:e,...t}){return(0,p.jsx)("div",{"data-slot":"alert-dialog-header",className:xo("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Ch({className:e,...t}){return(0,p.jsx)("div",{"data-slot":"alert-dialog-footer",className:xo("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Nh({className:e,...t}){return(0,p.jsx)(X,{"data-slot":"alert-dialog-title",className:xo("text-lg font-semibold",e),...t})}function Th({className:e,...t}){return(0,p.jsx)(Z,{"data-slot":"alert-dialog-description",className:xo("text-muted-foreground text-sm",e),...t})}function Mh({className:e,...t}){return(0,p.jsx)(K,{className:xo(Vd(),e),...t})}function Eh({className:e,...t}){return(0,p.jsx)(Y,{className:xo(Vd({variant:"outline"}),e),...t})}var Ah=Kr,Rh=Yr,Ih=aa,Dh=u.forwardRef(({className:e,inset:t,children:n,...r},a)=>(0,p.jsxs)(sa,{ref:a,className:xo("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent data-[state=open]:text-accent-foreground focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...r,children:[n,(0,p.jsx)(f.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));Dh.displayName=sa.displayName;var _h=u.forwardRef(({className:e,...t},n)=>(0,p.jsx)(oa,{ref:n,className:xo("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));_h.displayName=oa.displayName;var zh=u.forwardRef(({className:e,...t},n)=>(0,p.jsx)(Xr,{children:(0,p.jsx)(Zr,{ref:n,className:xo("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})}));zh.displayName=Zr.displayName;var Ph=u.forwardRef(({className:e,inset:t,...n},r)=>(0,p.jsx)(Qr,{ref:r,className:xo("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...n}));Ph.displayName=Qr.displayName;var Oh=u.forwardRef(({className:e,children:t,checked:n,...r},a)=>(0,p.jsxs)(ea,{ref:a,className:xo("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:n,...r,children:[(0,p.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,p.jsx)(na,{children:(0,p.jsx)(f.CheckIcon,{className:"h-4 w-4"})})}),t]}));Oh.displayName=ea.displayName,u.forwardRef(({className:e,children:t,...n},r)=>(0,p.jsxs)(ta,{ref:r,className:xo("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[(0,p.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,p.jsx)(na,{children:(0,p.jsx)(f.CircleIcon,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=ta.displayName,u.forwardRef(({className:e,inset:t,...n},r)=>(0,p.jsx)(Jr,{ref:r,className:xo("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...n})).displayName=Jr.displayName;var Lh=u.forwardRef(({className:e,...t},n)=>(0,p.jsx)(ra,{ref:n,className:xo("-mx-1 my-1 h-px bg-border",e),...t}));Lh.displayName=ra.displayName;var Fh=({className:e,...t})=>(0,p.jsx)("span",{className:xo("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Fh.displayName="ContextMenuShortcut";var Bh=({children:e,itemId:t,isFolder:n,hasCopiedItem:r,onAddChild:a,onAddChildFolder:s,onAddSibling:o,onAddSiblingFolder:i,onRename:l,onDuplicate:c,onCopy:d,onPaste:h,onDelete:m,onManageTags:g})=>{const x=(0,u.useRef)(null),v=(0,u.useRef)(null),y=()=>{x.current&&(clearTimeout(x.current),x.current=null)};return(0,p.jsxs)(Ah,{children:[(0,p.jsx)(Rh,{asChild:!0,children:(0,p.jsx)("div",{className:"contents",onTouchStart:e=>{const t=e.touches[0];v.current={x:t.clientX,y:t.clientY};const n=e.currentTarget,r=t.clientX,a=t.clientY;x.current=setTimeout(()=>{n.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:r,clientY:a}))},500)},onTouchEnd:y,onTouchCancel:y,onTouchMove:e=>{if(!v.current)return;const t=e.touches[0],n=Math.abs(t.clientX-v.current.x),r=Math.abs(t.clientY-v.current.y);(n>10||r>10)&&y()},children:e})}),(0,p.jsxs)(zh,{className:"w-56",onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[(0,p.jsxs)(Ph,{onClick:()=>n?a?.(t):o?.(t),disabled:n?!a:!o,children:[(0,p.jsx)(f.FileText,{className:"mr-2 h-4 w-4"}),"Add Note"]}),(0,p.jsxs)(Ph,{onClick:()=>n?s?.(t):i?.(t),disabled:n?!s:!i,children:[(0,p.jsx)(f.FolderIcon,{className:"mr-2 h-4 w-4"}),"Add Folder"]}),(0,p.jsxs)(Ph,{onClick:()=>l?.(t),disabled:!l,children:[(0,p.jsx)(f.Pencil,{className:"mr-2 h-4 w-4"}),"Rename",(0,p.jsx)(Fh,{children:"F2"})]}),(0,p.jsxs)(Ph,{onClick:()=>c?.(t),disabled:!c,children:[(0,p.jsx)(f.Copy,{className:"mr-2 h-4 w-4"}),"Duplicate",(0,p.jsx)(Fh,{children:"⌘D"})]}),(0,p.jsx)(Lh,{}),(0,p.jsxs)(Ph,{onClick:()=>d?.(t),disabled:!d,children:[(0,p.jsx)(f.Clipboard,{className:"mr-2 h-4 w-4"}),"Copy",(0,p.jsx)(Fh,{children:"⌘C"})]}),(0,p.jsxs)(Ph,{onClick:()=>{h?.(n?t:null)},disabled:!r||!h,children:[(0,p.jsx)(f.ClipboardPaste,{className:"mr-2 h-4 w-4"}),"Paste",(0,p.jsx)(Fh,{children:"⌘V"})]}),(0,p.jsxs)(Ph,{onClick:()=>g?.(t),disabled:!g,children:[(0,p.jsx)(f.Tag,{className:"mr-2 h-4 w-4"}),"Manage Tags"]}),(0,p.jsx)(Lh,{}),(0,p.jsxs)(Ph,{onClick:()=>m?.(t),disabled:!m,className:"text-destructive focus:text-destructive",children:[(0,p.jsx)(f.Trash2,{className:"mr-2 h-4 w-4"}),"Delete",(0,p.jsx)(Fh,{children:"Del"})]})]})]})},Hh="__root__";var Vh=(0,u.forwardRef)(({activeId:e,documents:t,onMove:n,onRename:r,onSelect:a,onDelete:s,onDuplicate:o,onAddChild:i,onAddChildFolder:l,onAddSibling:c,onAddSiblingFolder:d,onCopy:h,onPaste:m,_onNewFile:g,_onNewFolder:x,onManageTags:v},y)=>{const b=(0,u.useMemo)(()=>function(e){const t={[Hh]:{children:[],documentId:Hh,isFolder:!0,name:"Root"}};for(const n of e)t[n.id]={children:[],documentId:n.id,isFolder:!!n.isFolder,name:n.title||"Untitled"};for(const n of e){const e=n.parentId&&t[n.parentId]?n.parentId:Hh;t[e].children=[...t[e].children??[],n.id]}for(const n of Object.keys(t))n!==Hh&&(t[n].children?.length??0)>0&&(t[n].isFolder=!0);return t}(t),[t]),w=(0,u.useMemo)(()=>t.filter(e=>e.isFolder&&e.isExpanded).map(e=>e.id),[t]),[S,j]=(0,u.useState)({expandedItems:w,selectedItems:e?[e]:[]}),[k,C]=(0,u.useState)(null),[N,T]=(0,u.useState)(null),M={current:!1},E=(e=>{const[t]=(0,u.useState)(()=>({current:Tu(e)})),[n,r]=(0,u.useState)(()=>t.current.getState());return(0,u.useEffect)(()=>(t.current.setMounted(!0),t.current.rebuildTree(),()=>{t.current.setMounted(!1)}),[t]),t.current.setConfig(t=>dh(ch(ch({},t),e),{state:ch(ch({},n),e.state),setState:t=>{var n;r(t),null==(n=e.setState)||n.call(e,t)}})),t.current})({canReorder:!0,dataLoader:{getChildren:e=>{const t=b[e];return t?t.children??[]:[]},getItem:e=>{const t=b[e];return t||{children:[],documentId:e,isFolder:!1,name:"Deleted Item"}}},features:[Fu,Eu,Ou,th,Yu,eh],getItemName:e=>e.getItemData().name,onRename:(e,t)=>{const n=t.trim()||"Untitled";r?.(e.getId(),n)},indent:20,isItemFolder:e=>e.getItemData()?.isFolder??!1,onDrop:(e,t)=>{const r=e.map(e=>e.getId()).filter(e=>e!==Hh);if(0===r.length)return;const a=[...r].reverse(),s=e=>{for(const t of a)n(t,e,"child")};if("childIndex"in t){const e=t.item.getId()===Hh?null:t.item.getId(),o=(b[t.item.getId()]?.children??[]).filter(e=>!r.includes(e)),i=o[t.childIndex];if(i){for(const e of a)n(e,i,"before");return}const l=o[t.childIndex-1];if(l){for(const e of a)n(e,l,"after");return}return void s(e)}s(t.item.getId()===Hh?null:t.item.getId())},rootItemId:Hh,setState:j,state:S});(0,u.useEffect)(()=>{j(t=>({...t,expandedItems:w,selectedItems:e&&b[e]?[e]:[]}))},[e,w,b]),(0,u.useImperativeHandle)(y,()=>({collapseAll:()=>{M.current=!0,E.collapseAll()},edit:e=>{r&&E.getItemInstance(e).startRenaming()},expandAll:()=>{M.current=!1,E.expandAll(M)},expandToLevel:e=>{M.current=!0;const t=function(e,t){if(t<=0)return[];const n=[],r=[{depth:0,id:Hh}];for(;r.length>0;){const a=r.shift();if(!a)break;const s=e[a.id];if(s)for(const o of s.children??[]){if(!e[o]?.isFolder)continue;const s=a.depth+1;s>t||(n.push(o),r.push({depth:s,id:o}))}}return n}(b,e);j(e=>({...e,expandedItems:t}))},cancelExpand:()=>{M.current=!0}}));const A=N?b[N]?.name:"",R=E.getItems();return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"flex h-full flex-col gap-2 overflow-auto",children:(0,p.jsxs)(gh,{indent:20,tree:E,children:[(0,p.jsx)(mh,{tree:E}),R.map(t=>{const n=t.getId();return n===Hh?null:(0,p.jsx)(xh,{item:t,children:(0,p.jsx)(Bh,{itemId:n,isFolder:t.isFolder(),hasCopiedItem:!!k,onAddChild:i,onAddChildFolder:l,onAddSibling:c,onAddSiblingFolder:d,onRename:r?()=>t.startRenaming():void 0,onDuplicate:o,onCopy:h?e=>{C(e),h(e)}:void 0,onPaste:m?()=>{k&&m(t.isFolder()?n:null)}:void 0,onDelete:s?()=>T(n):void 0,onManageTags:v,children:t.isRenaming()?(0,p.jsx)(vh,{className:"w-full text-left",onClick:e=>e.stopPropagation(),children:(0,p.jsx)("input",{...t.getRenameInputProps(),className:"flex-1 w-full rounded border bg-background px-1 text-sm outline-none focus:ring-2 focus:ring-ring"})}):(0,p.jsx)(vh,{className:xo("w-full text-left",e===n&&"bg-accent text-accent-foreground"),onClick:()=>a(n),onDoubleClick:()=>r&&t.startRenaming(),children:(0,p.jsxs)("span",{className:"flex items-center gap-2 w-full min-w-0",children:[t.isFolder()?t.isExpanded()?(0,p.jsx)(f.FolderOpenIcon,{className:"pointer-events-none size-4 shrink-0 text-muted-foreground"}):(0,p.jsx)(f.FolderIcon,{className:"pointer-events-none size-4 shrink-0 text-muted-foreground"}):(0,p.jsx)(lu,{filename:t.getItemName(),size:16}),(0,p.jsx)("span",{className:"flex-1 truncate",children:t.getItemName()})]})})})},n)}),(0,p.jsx)(yh,{})]})}),(0,p.jsx)(bh,{open:!!N,onOpenChange:e=>!e&&T(null),children:(0,p.jsxs)(jh,{children:[(0,p.jsxs)(kh,{children:[(0,p.jsx)(Nh,{children:"Move to Trash?"}),(0,p.jsxs)(Th,{children:['Are you sure you want to move "',A,'" to trash? You can restore it later from the trash.']})]}),(0,p.jsxs)(Ch,{children:[(0,p.jsx)(Eh,{children:"Cancel"}),(0,p.jsx)(Mh,{onClick:()=>{N&&s&&(s(N),T(null),j(e=>({...e,selectedItems:e.selectedItems?.filter(e=>e!==N)??[]})))},children:"Move to Trash"})]})]})})]})});Vh.displayName="FileTree";var $h="outline-collapse-preferences";var qh=(0,u.forwardRef)(({headings:e=[],onNavigate:t,onReorder:n,searchQuery:r="",editorRef:a},s)=>{const[o,i]=(0,u.useState)(new Set),[l,c]=(0,u.useState)(null),d=function(e,t){const[n,r]=(0,u.useState)(null),a=(0,u.useRef)(null);return(0,u.useEffect)(()=>{if(!t?.current||0===e.length)return void r(null);const n=e=>t.current?.getElementByKey(e)??null,s=n(e[0][0]);if(a.current=null,s){let e=s.parentElement;for(;e;){const t=window.getComputedStyle(e);if("auto"===t.overflowY||"scroll"===t.overflowY){a.current=e;break}e=e.parentElement}}const o=()=>{const t=a.current,s=t?t.clientHeight:window.innerHeight,o=t?t.getBoundingClientRect().top:0,i=.3*s,l=[];for(const[r]of e){const e=n(r);if(!e)continue;const t=e.getBoundingClientRect();l.push({key:r,top:t.top-o})}r(function(e,t){let n=null;for(const{key:r,top:a}of e){if(!(a<=t))break;n=r}return!n&&e.length>0&&(n=e[0].key),n}(l,i))},i=a.current??window;return i.addEventListener("scroll",o,{passive:!0}),o(),()=>i.removeEventListener("scroll",o)},[e,t]),n}(e,a),h=(0,u.useRef)(null),m=(0,u.useRef)(new Map);(0,u.useEffect)(()=>{if(!d)return;const e=h.current,t=m.current.get(d);if(!e||!t)return;const n=function(e,t){if(t.offsetTop<e.scrollTop)return t.offsetTop;const n=t.offsetTop+t.offsetHeight;return n>e.scrollTop+e.clientHeight?n-e.clientHeight:null}(e,t);null!==n&&(e.scrollTop=n)},[d]);const g=(0,u.useMemo)(()=>e.map(([e,t,n],r)=>({id:e,level:parseInt(n[1],10),text:t,line:r})),[e]),x=(0,u.useMemo)(()=>{const e=new Map;return g.forEach((t,n)=>e.set(t.id,n)),e},[g]);(0,u.useImperativeHandle)(s,()=>({expandAll:()=>{i(new Set)},collapseAll:()=>{const e=new Set;g.forEach(t=>{1===t.level&&e.add(t.id)}),i(e)}})),(0,u.useEffect)(()=>{try{const e=localStorage.getItem($h);if(e){const t=JSON.parse(e);c(t.defaultCollapseLevel||null),t.defaultCollapseLevel&&w(t.defaultCollapseLevel)}}catch(e){}},[]);const v=e=>{try{localStorage.setItem($h,JSON.stringify({defaultCollapseLevel:e})),c(e)}catch(t){}},y=(0,u.useMemo)(()=>{if(!r.trim())return g;const e=r.toLowerCase();return g.filter(t=>t.text.toLowerCase().includes(e))},[g,r]),b=e=>{i(t=>{const n=new Set(t);return n.has(e)?(n.delete(e),(e=>{const t=g.findIndex(t=>t.id===e);if(-1===t)return[];const n=g[t].level,r=[];for(let a=t+1;a<g.length&&!(g[a].level<=n);a++)r.push(g[a].id);return r})(e).forEach(e=>n.delete(e))):n.add(e),n})},w=e=>{const t=new Set;g.forEach(n=>{n.level===e&&t.add(n.id)}),i(t)};return 0===g.length?(0,p.jsx)("div",{className:"flex h-full items-center justify-center p-6 text-center",children:(0,p.jsxs)("div",{children:[(0,p.jsx)(f.HashIcon,{className:"mx-auto h-12 w-12 text-muted-foreground opacity-50 mb-3"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"No headings found in this document"}),(0,p.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Use the heading buttons in the toolbar"})]})}):(0,p.jsx)("div",{ref:h,className:"flex h-full flex-col overflow-auto",children:y.map(e=>{const n=x.get(e.id),r=g[n+1],a=r&&r.level>e.level,s=o.has(e.id),c=e.id===d;return(e=>{const t=g[e].level;for(let n=e-1;n>=0;n--)if(g[n].level<t){if(o.has(g[n].id))return!0;if(1===g[n].level)break}return!1})(n)?null:(0,p.jsxs)(Ah,{children:[(0,p.jsx)(Rh,{children:(0,p.jsxs)("div",{ref:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)},"data-active":c||void 0,className:xo("flex items-center gap-1 rounded-md cursor-pointer transition-colors hover:bg-sidebar-accent",1===e.level&&"py-1.5 mt-0.5",2===e.level&&"py-1",e.level>=3&&"py-0.5",c&&"bg-sidebar-accent"),style:{paddingLeft:12*(e.level-1)+4+"px",paddingRight:"4px"},onClick:()=>t?.(e.id),children:[(0,p.jsx)("button",{className:xo("h-4 w-4 p-0 shrink-0 flex items-center justify-center hover:bg-transparent",!a&&"invisible"),onClick:t=>{t.stopPropagation(),b(e.id)},children:(0,p.jsx)(f.ChevronRightIcon,{className:xo("h-3 w-3 transition-transform text-muted-foreground",!s&&"rotate-90")})}),(0,p.jsx)(f.HashIcon,{className:xo("shrink-0",1===e.level&&"h-3.5 w-3.5 text-blue-500",2===e.level&&"h-3 w-3 text-indigo-400",e.level>=3&&"h-2.5 w-2.5 text-muted-foreground")}),(0,p.jsx)("span",{className:xo("flex-1 truncate",1===e.level&&"text-sm font-semibold text-foreground",2===e.level&&"text-sm font-medium text-foreground/90",3===e.level&&"text-xs text-foreground/80",e.level>=4&&"text-xs text-muted-foreground",c&&"font-medium text-foreground"),children:e.text})]})}),(0,p.jsxs)(zh,{children:[(0,p.jsxs)(Ih,{children:[(0,p.jsx)(Dh,{children:"Collapse to..."}),(0,p.jsxs)(_h,{children:[(0,p.jsx)(Ph,{onClick:()=>w(1),children:"Heading 1"}),(0,p.jsx)(Ph,{onClick:()=>w(2),children:"Heading 2"}),(0,p.jsx)(Ph,{onClick:()=>w(3),children:"Heading 3"}),(0,p.jsx)(Ph,{onClick:()=>w(4),children:"Heading 4"}),(0,p.jsx)(Ph,{onClick:()=>i(new Set),children:"Expand All"})]})]}),(0,p.jsx)(Lh,{}),(0,p.jsx)(Oh,{checked:null!==l,onCheckedChange:e=>{if(e){const e=g.find(e=>o.has(e.id));e&&v(e.level)}else v(null)},children:"Keep this collapse level as default"})]})]},e.id)})})}),Uh={"&":"&","<":"<",">":">",""":'"',"'":"'"," ":" "};function Gh(e){return e.replace(/<[^>]*>/g," ").replace(/&(?:amp|lt|gt|quot|#39|nbsp);/g,e=>Uh[e]??e).replace(/\s+/g," ").trim()}function Wh(e,t){if(!t)return 0;let n=0,r=e.indexOf(t);for(;-1!==r;)n++,r=e.indexOf(t,r+t.length);return n}var Kh=new Set(["about","above","after","again","against","along","also","always","among","around","because","before","below","between","both","cannot","could","does","doing","down","during","each","either","every","first","from","further","have","having","here","into","just","more","most","once","only","other","over","same","shall","should","since","some","such","than","that","their","them","then","there","these","they","this","those","through","under","until","very","were","what","when","where","which","while","will","with","would","your"]);function Yh(e){const t=`${e.title} ${Gh(e.content)}`.toLowerCase().match(/[a-z0-9]+/g)??[],n=new Set;for(const r of t)r.length>=4&&!Kh.has(r)&&n.add(r);return n}function Xh(e){const t=new Set;for(const n of e.tags??[]){const e=n.trim().toLowerCase();e&&t.add(e)}return t}var Zh=t.cva("inline-flex items-center justify-center rounded-2xl border px-3 py-1.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-gray-100 text-gray-700 [a&]:hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:[a&]:hover:bg-gray-700",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",new:"text-purple-600 dark:text-purple-300 bg-purple-600/30 dark:bg-purple-600/30",beta:"text-blue-600 dark:text-blue-300 bg-blue-600/30 dark:bg-blue-600/30",highlight:"text-green-800 dark:text-green-300 bg-green-600/30 dark:bg-green-600/30"}},defaultVariants:{variant:"default"}});function Jh({className:e,variant:t,asChild:n=!1,...r}){return(0,p.jsx)(n?h.Slot:"span",{"data-slot":"badge",className:xo(Zh({variant:t}),e),...r})}var Qh=[{id:"clarity",name:"Clarity",prompt:"Rewrite this paragraph for maximum clarity and straightforwardness, keeping all original meaning but removing ambiguity and simplifying complex sentences:",color:"blue"},{id:"concise",name:"Concise",prompt:"Rewrite this text to be more concise, removing redundancy and filler while preserving all key points and tone. Aim for about 50% of the original length:",color:"purple"},{id:"summarize",name:"Summarize",prompt:"Summarize the following text into a shorter paragraph, keeping the main ideas and overall tone but removing details and repetition:",color:"green"},{id:"rephrase",name:"Rephrase",prompt:"Rephrase this paragraph with fresh wording and more engaging style, varying sentence structure and word choice while preserving the core message:",color:"orange"},{id:"expand",name:"Expand",prompt:"Keep the original paragraph as-is, then expand it by adding one additional paragraph that elaborates on the main idea, gives an example, or adds helpful context for the reader:",color:"pink"}],em="REASON-rewrite-modes",tm=()=>{try{const e=localStorage.getItem(em);if(e)return JSON.parse(e)}catch(e){}return Qh},nm=e=>{try{localStorage.setItem(em,JSON.stringify(e))}catch(t){}},rm=({originalText:e,suggestedText:t,onApprove:n,onReject:r,onRegenerate:a,isLoading:s=!1,currentMode:o})=>{const[i,l]=(0,u.useState)([]);if((0,u.useEffect)(()=>{l(tm())},[]),s)return(0,p.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-popover p-3 shadow-lg",children:[(0,p.jsx)(f.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}),(0,p.jsx)("span",{className:"text-sm text-muted-foreground",children:"Generating AI suggestion..."})]});const c=e=>{const t={blue:"bg-blue-500/10 text-blue-700 dark:text-blue-300 hover:bg-blue-500/20 border-blue-500/20",purple:"bg-purple-500/10 text-purple-700 dark:text-purple-300 hover:bg-purple-500/20 border-purple-500/20",green:"bg-green-500/10 text-green-700 dark:text-green-300 hover:bg-green-500/20 border-green-500/20",orange:"bg-orange-500/10 text-orange-700 dark:text-orange-300 hover:bg-orange-500/20 border-orange-500/20",pink:"bg-pink-500/10 text-pink-700 dark:text-pink-300 hover:bg-pink-500/20 border-pink-500/20"};return t[e||"blue"]||t.blue};return(0,p.jsxs)("div",{className:"h-full flex flex-col",children:[(0,p.jsxs)("div",{className:"p-3 border-b border-sidebar-border",children:[(0,p.jsx)("div",{className:"text-xs font-semibold text-sidebar-foreground mb-3",children:"AI SUGGESTION"}),a&&i.length>0&&(0,p.jsxs)("div",{className:"mb-3",children:[(0,p.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:"Rewrite Mode:"}),(0,p.jsx)("div",{className:"flex flex-wrap gap-1",children:i.map(e=>(0,p.jsx)(Jh,{variant:"outline",className:xo("cursor-pointer text-xs px-2 py-0.5 transition-colors",c(e.color),o===e.id&&"ring-2 ring-offset-1"),onClick:()=>a(e),children:e.name},e.id))})]})]}),(0,p.jsxs)("div",{className:"flex-1 overflow-auto p-3 space-y-4",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("div",{className:"text-xs font-semibold text-muted-foreground mb-2",children:"Original:"}),(0,p.jsx)("div",{className:"text-sm text-foreground/70 line-through bg-muted/50 p-3 rounded-md",children:e})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("div",{className:"text-xs font-semibold text-muted-foreground mb-2",children:"Suggested:"}),(0,p.jsx)("div",{className:"text-sm text-foreground font-medium bg-primary/10 p-3 rounded-md border border-primary/20",children:t})]})]}),(0,p.jsx)("div",{className:"border-t border-sidebar-border p-3",children:(0,p.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,p.jsxs)($d,{variant:"default",size:"sm",onClick:n,className:"w-full h-9 bg-green-500 hover:bg-green-600 text-white",title:"Approve",children:[(0,p.jsx)(f.Check,{className:"h-4 w-4 mr-1"}),"Approve"]}),(0,p.jsxs)($d,{variant:"outline",size:"sm",onClick:r,className:"w-full h-9",title:"Reject",children:[(0,p.jsx)(f.X,{className:"h-4 w-4 mr-1"}),"Reject"]})]})})]})};function am({className:e,type:t,...n}){return(0,p.jsx)("input",{type:t,"data-slot":"input",className:xo("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-11 w-full min-w-0 rounded-2xl border bg-card px-3 py-1 text-sm font-medium transition-[color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50","focus:outline-none focus:ring-2 focus:ring-primary/50","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}function sm(...e){return e.filter(Boolean).join(" ")}var om=(0,u.forwardRef)(function(e,t){const{className:n,style:r,children:a,defaultSize:s,size:o,minSize:i,maxSize:l,...c}=e,d={position:"relative",outline:"none",overflow:"auto",flex:"none",...r},u=sm("split-pane-pane",n);return(0,p.jsx)("div",{ref:t,className:u,style:d,"data-pane":"true",...c,children:a})});function im(e,t="polite"){if("undefined"==typeof document)return;const n=document.createElement("div");n.setAttribute("role","status"),n.setAttribute("aria-live",t),n.setAttribute("aria-atomic","true"),n.style.position="absolute",n.style.left="-10000px",n.style.width="1px",n.style.height="1px",n.style.overflow="hidden",n.textContent=e,document.body.appendChild(n),setTimeout(()=>{document.body.removeChild(n)},1e3)}function lm(e){return 1e3>e?Math.round(e)+" pixels":Math.round(e/10)/100+" thousand pixels"}function cm(e){const{direction:t,index:n,isDragging:r,disabled:a,onPointerDown:s,onKeyDown:o,className:i,style:l,currentSize:c,minSize:d,maxSize:u,children:h}=e,m="horizontal"===t?"vertical":"horizontal",f={flex:"none",position:"relative",userSelect:"none",touchAction:"none",..."horizontal"===t?{width:"1px",cursor:a?"default":"col-resize"}:{height:"1px",cursor:a?"default":"row-resize"},...r&&{cursor:"horizontal"===t?"col-resize":"row-resize"},...l},g=sm("split-pane-divider",t,r&&"dragging",i),x=function(e,t){return`${"horizontal"===t?"vertical":"horizontal"} divider ${e+1}`}(n,t);return(0,p.jsx)("div",{role:"separator","aria-orientation":m,"aria-label":x,"aria-valuenow":c,"aria-valuemin":d,"aria-valuemax":void 0===u||u===1/0?void 0:u,"aria-description":(v=t,`Use ${"horizontal"===v?"left and right arrow keys":"up and down arrow keys"} to resize. Hold Shift for larger steps. Press Home or End to minimize or maximize.`),tabIndex:a?-1:0,className:g,style:f,onPointerDown:a?void 0:s,onKeyDown:a?void 0:o,"data-divider-index":n,children:h});var v}function dm(e,t){if("number"==typeof e)return e;if(e.endsWith("%"))return parseFloat(e)/100*t;if(e.endsWith("px"))return parseFloat(e);const n=parseFloat(e);return isNaN(n)?0:n}function um(e,t,n){return Math.min(Math.max(e,t),n)}function hm(e,t,n,r,a){const s=[...e],o=e[t]??0,i=e[t+1]??0,l=r[t+1]??0,c=a[t+1]??1/0;let d=um(o+n,r[t]??0,a[t]??1/0),u=um(i-n,l,c);const h=i-u,m=Math.min(Math.abs(d-o),Math.abs(h));return n>0?(d=o+m,u=i-m):(d=o-m,u=i+m),s[t]=d,s[t+1]=u,s}function mm(e){const{direction:t,sizes:n,minSizes:r,maxSizes:a,snapPoints:s=[],snapTolerance:o=10,step:i,onResizeStart:l,onResize:c,onResizeEnd:d}=e,[h,m]=(0,u.useState)(!1),[p,f]=(0,u.useState)(n),g=(0,u.useRef)(null),x=(0,u.useRef)(null),v=(0,u.useRef)(!0),y=(0,u.useRef)(null),b=(0,u.useRef)(p);b.current=p;const w=(0,u.useRef)(d);w.current=d;const S=(0,u.useRef)(n);(0,u.useEffect)(()=>{h||JSON.stringify(n)===JSON.stringify(S.current)||(S.current=n,f(n))},[n,h]),(0,u.useEffect)(()=>(v.current=!0,()=>{v.current=!1,x.current&&(cancelAnimationFrame(x.current),x.current=null)}),[]);const j=(0,u.useCallback)((e,n)=>{if(!g.current||!v.current)return;const{dividerIndex:l,startPosition:d,startSizes:u,pointerType:h}=g.current;let m=("horizontal"===t?e:n)-d;i&&(m=function(e,t){return t>0?Math.round(e/t)*t:e}(m,i));let p=hm(u,l,m,r,a);s.length>0&&(p=p.map(e=>function(e,t,n){for(const r of t)if(n>=Math.abs(e-r))return r;return e}(e,s,o))),f(p),c&&c(p,{sizes:p,source:"pointer",pointerType:h})},[t,i,r,a,s,o,c]),k=(0,u.useCallback)(e=>{g.current&&e.pointerId===g.current.pointerId&&(e.preventDefault(),y.current={x:e.clientX,y:e.clientY},x.current||(x.current=requestAnimationFrame(()=>{x.current=null,v.current&&y.current&&j(y.current.x,y.current.y)})))},[j]),C=(0,u.useCallback)(e=>{if(!g.current||e.pointerId!==g.current.pointerId)return;const{element:t,pointerId:n,pointerType:r}=g.current;t?.hasPointerCapture?.(n)&&t.releasePointerCapture(n),x.current&&(cancelAnimationFrame(x.current),x.current=null),m(!1);const a=b.current,s=w.current;s&&s(a,{sizes:a,source:"pointer",pointerType:r}),g.current=null},[]),N=(0,u.useCallback)(e=>n=>{n.preventDefault();const r="horizontal"===t?n.clientX:n.clientY,a=n.currentTarget;a.setPointerCapture(n.pointerId);const s=n.pointerType;g.current={dividerIndex:e,startPosition:r,startSizes:p,pointerId:n.pointerId,pointerType:s,element:a},m(!0),l&&l({sizes:p,source:"pointer",pointerType:s,originalEvent:n.nativeEvent})},[t,p,l]);return(0,u.useEffect)(()=>{if(h)return document.addEventListener("pointermove",k),document.addEventListener("pointerup",C),document.addEventListener("pointercancel",C),()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",C),document.removeEventListener("pointercancel",C)}},[h,k,C]),{isDragging:h,currentSizes:p,handlePointerDown:N}}var pm=10,fm=50;function gm(e){const{direction:t,sizes:n,minSizes:r,maxSizes:a,step:s=pm,largeStep:o=fm,onResize:i,onResizeEnd:l}=e,c=(0,u.useRef)(null);return{handleKeyDown:(0,u.useCallback)(e=>d=>{if(!("horizontal"===t?["ArrowLeft","ArrowRight"]:["ArrowUp","ArrowDown"]).includes(d.key)&&"Home"!==d.key&&"End"!==d.key&&"Escape"!==d.key)return;if(d.preventDefault(),"Escape"===d.key){if(c.current){const e=c.current;c.current=null,i&&i(e,{sizes:e,source:"keyboard",originalEvent:d.nativeEvent}),l&&l(e,{sizes:e,source:"keyboard",originalEvent:d.nativeEvent}),im("Pane sizes restored")}return}null===c.current&&(c.current=[...n]);let u=0,h=[...n],m="arrow";switch(d.key){case"ArrowLeft":case"ArrowUp":u=-(d.shiftKey?o:s);break;case"ArrowRight":case"ArrowDown":u=d.shiftKey?o:s;break;case"Home":{m="home";const t=e+1,a=r[e]??0,s=(n[e]??0)+(n[t]??0);h[e]=a,h[t]=s-a;break}case"End":{m="end";const t=e,s=e+1,o=(n[t]??0)+(n[s]??0);h[t]=Math.min(a[t]??1/0,o-(r[s]??0)),h[s]=o-h[t];break}}if(0!==u&&(h=hm(n,e,u,r,a)),h=h.map((e,t)=>um(e,r[t]??0,a[t]??1/0)),i&&i(h,{sizes:h,source:"keyboard",originalEvent:d.nativeEvent}),l&&l(h,{sizes:h,source:"keyboard",originalEvent:d.nativeEvent}),"home"===m)im(`Pane ${e+1} minimized to ${lm(h[e]??0)}`);else if("end"===m)im(`Pane ${e+1} maximized to ${lm(h[e]??0)}`);else{const t=u>0?e:e+1;im(`Pane ${t+1} resized to ${lm(h[t]??0)}`)}},[t,n,r,a,s,o,i,l])}}function xm(e){const{direction:t="horizontal",resizable:n=!0,snapPoints:r,snapTolerance:a=10,step:s,onResizeStart:o,onResize:i,onResizeEnd:l,className:c,style:d,divider:h,dividerStyle:m,dividerClassName:f,dividerSize:g=1,children:x}=e,v=(0,u.useRef)(null),[y,b]=(0,u.useState)(0),w=(0,u.useRef)(0),S=(0,u.useMemo)(()=>u.Children.toArray(x).filter(e=>"object"==typeof e&&null!==e&&"props"in e).map(e=>({props:e.props,size:e.props.size,defaultSize:e.props.defaultSize,minSize:e.props.minSize??0,maxSize:e.props.maxSize??1/0})),[x]),j=S.length,k=(0,u.useRef)(!1);2>j&&!k.current&&(k.current=!0);const{minSizes:C,maxSizes:N}=(0,u.useMemo)(()=>{if(0===y)return{minSizes:Array(j).fill(0),maxSizes:Array(j).fill(1/0)};const e=[],t=[];return S.forEach(n=>{e.push(dm(n.minSize,y)),t.push(n.maxSize===1/0?1/0:dm(n.maxSize,y))}),{minSizes:e,maxSizes:t}},[y,j,S]),T=(0,u.useCallback)(e=>{if(0===e)return Array(j).fill(0);const t=e-g*(j-1),n=S.map(e=>{const n=e.size??e.defaultSize;return void 0!==n?dm(n,t):null}),r=n.reduce((e,t)=>e+(t??0),0),a=n.filter(e=>null===e).length,s=a>0?(t-r)/a:0;return n.map(e=>null===e?s:e)},[j,S,g]),[M,E]=(0,u.useState)(()=>T(y));(0,u.useEffect)(()=>{if(0===y)return;if(!S.some(e=>void 0!==e.size))return;const e=T(y);E(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[y,S,T]);const A=(0,u.useCallback)(e=>{const t=w.current;if(w.current=e,0===e)return;const n=S.some(e=>void 0!==e.size),r=e-g*(j-1);E(a=>a.every(e=>0===e)||a.length!==j?T(e):t>0&&t!==e?n?T(e):function(e,t){const n=e.reduce((e,t)=>e+t,0);if(0===n){const n=t/e.length;return e.map(()=>n)}return e.map(e=>e/n*t)}(a,r):0===t?T(e):a)},[j,S,T,g]),R=(0,u.useRef)(0);(0,u.useEffect)(()=>{const e=v.current;if(!e)return;const n=new ResizeObserver(e=>{const n=e[0];n&&(e=>{const n=Math.round("horizontal"===t?e.width:e.height);n>0&&n!==R.current&&(R.current=n,b(n),A(n))})(n.contentRect)});return n.observe(e),()=>{n.disconnect()}},[t,A]);const I=(0,u.useCallback)((e,t)=>{E(e),i?.(e,t)},[i]),{isDragging:D,currentSizes:_,handlePointerDown:z}=mm({direction:t,sizes:M,minSizes:C,maxSizes:N,snapPoints:r,snapTolerance:a,step:s,onResizeStart:o,onResize:I,onResizeEnd:l}),{handleKeyDown:P}=gm({direction:t,sizes:_,minSizes:C,maxSizes:N,step:s,onResize:I,onResizeEnd:l}),O=(0,u.useCallback)(e=>t=>{const n={...t,pointerId:1,pointerType:"mouse",nativeEvent:t.nativeEvent};z(e)(n)},[z]),L=(0,u.useCallback)(e=>t=>{const n=t.touches[0];if(!n)return;const r={...t,clientX:n.clientX,clientY:n.clientY,pointerId:n.identifier,pointerType:"touch",nativeEvent:t.nativeEvent};z(e)(r)},[z]),F=(0,u.useCallback)(()=>{},[]),B={display:"flex",flexDirection:"horizontal"===t?"row":"column",height:"100%",width:"100%",overflow:"hidden",position:"relative",...d},H=sm("split-pane",t,c);return(0,p.jsx)("div",{ref:v,className:H,style:B,children:y>0&&(()=>{if(2>j)return null;const e=[];return S.forEach((r,a)=>{const s=_[a]??0,o={..."horizontal"===t?{width:s+"px",height:"100%"}:{height:s+"px",width:"100%"},...r.props.style};if(e.push((0,p.jsx)(om,{...r.props,style:o,children:r.props.children},"pane-"+a)),j-1>a){const r=C[a],o=N[a];e.push((0,p.jsx)(h??cm,{direction:t,index:a,isDragging:D,disabled:!n,onPointerDown:z(a),onMouseDown:O(a),onTouchStart:L(a),onTouchEnd:F,onKeyDown:P(a),className:f,style:m,currentSize:s,minSize:r,maxSize:o===1/0?void 0:o},"divider-"+a))}}),e})()})}function vm(e){const{key:t,storage:n=localStorage,debounce:r=300}=e,[a,s]=(0,u.useState)(()=>{try{const e=n.getItem(t);return e?JSON.parse(e):[]}catch{return[]}});return(0,u.useEffect)(()=>{if(0===a.length)return;const e=setTimeout(()=>{try{n.setItem(t,JSON.stringify(a))}catch(e){}},r);return()=>clearTimeout(e)},[a,t,n,r]),[a,s]}var ym="undefined"==typeof window?{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},key:()=>null,length:0}:window.localStorage,bm=({panels:e,split:t,persistenceKey:n,activeDocuments:r,activeId:a,activeDocument:s,headings:o=[],isMobile:i,onSelect:l,onAdd:c,onDelete:d,onDuplicate:h,onMove:m,onManageTags:g,onRename:x,onOpenChange:v,treeRef:y,outlineRef:b,editorRef:w,openTabs:S=[],activeTab:j,onTabChange:k,onTabClose:C,onTabRename:N,onSplitRight:T,onReopenLastClosed:M,canReopenLastClosed:E=!1,onNavigate:A,aiProps:R,tipsProps:I,topicsProps:D,tabItems:_,onNewChat:z})=>{const[P,O]=(0,u.useState)(null),[L,F]=(0,u.useState)(""),B=(0,u.useRef)(null),H=(0,u.useRef)(null),V=y??B,$=b??H,q=e=>{l(e),i&&v&&v(!1)},U=e=>{g?.(e),i&&v&&v(!1)},G=(0,u.useCallback)(e=>{O(e)},[]),W=(0,u.useCallback)(e=>{P&&h(P)},[P,h]),K=(0,u.useMemo)(()=>{const e=s?.content||"";if(!e)return[];const t=(new DOMParser).parseFromString(e,"text/html"),n=[];let r="",a=-1;for(const s of Array.from(t.body.children))/^h[1-6]$/i.test(s.tagName)?(a>=0&&(n[a]=r),a++,r=""):a>=0&&(r+=" "+(s.textContent||""));return a>=0&&(n[a]=r),n},[s?.content]),Y=(0,u.useMemo)(()=>{const e=L.trim().toLowerCase();return e?o.filter(([,t],n)=>t.toLowerCase().includes(e)||(K[n]||"").toLowerCase().includes(e)):o},[L,o,K]),[X,Z]=vm({key:`sidebar-panels-${n}`,storage:ym}),J=_??S.map(e=>({id:e,title:r.find(t=>t.id===e)?.title||"Untitled",kind:"file"})),Q=(0,u.useMemo)(()=>function(e,t,n=10){if(!t)return[];const r=Yh(t),a=Xh(t);if(0===r.size&&0===a.size)return[];const s=[];for(const o of e){if(o.id===t.id||o.isFolder||o.isDeleted)continue;const e=Yh(o);let n=0;for(const t of r)e.has(t)&&n++;const i=Xh(o);let l=0;for(const t of a)i.has(t)&&l++;(n>0||l>0)&&s.push({document:o,sharedKeywordCount:n,sharedTagCount:l})}return s.sort((e,t)=>{const n=e.sharedKeywordCount+5*e.sharedTagCount,r=t.sharedKeywordCount+5*t.sharedTagCount;return r!==n?r-n:e.document.title.localeCompare(t.document.title)}),s.slice(0,n)}(r,s),[r,s]),ee=({document:e,sharedKeywordCount:t,sharedTagCount:n})=>(0,p.jsxs)("div",{className:"group flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer transition-colors hover:bg-sidebar-accent",onClick:()=>q(e.id),children:[(0,p.jsx)(f.Link2,{className:"shrink-0 h-4 w-4 text-muted-foreground"}),(0,p.jsx)("span",{className:"flex-1 truncate text-sm",children:e.title}),n>0&&(0,p.jsxs)("span",{className:"shrink-0 flex items-center gap-0.5 text-xs text-muted-foreground",title:`${n} shared tag${1===n?"":"s"}`,children:[(0,p.jsx)(f.Tag,{className:"h-3 w-3"}),n]}),(0,p.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",title:`${t} shared keyword${1===t?"":"s"}`,children:t})]},e.id),te=()=>(0,p.jsxs)("div",{className:"px-3 py-3 border-t border-sidebar-border shrink-0",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between mb-2 gap-2",children:[(0,p.jsxs)("p",{className:"flex items-center gap-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:[(0,p.jsx)(f.Search,{className:"h-3.5 w-3.5 text-primary"}),"Search topics"]}),D?.onGenerateTopics&&(0,p.jsx)("button",{className:"shrink-0 text-xs font-medium text-primary hover:underline disabled:opacity-50 disabled:cursor-not-allowed disabled:no-underline",onClick:D.onGenerateTopics,disabled:D.isTopicsLoading,children:D.isTopicsLoading?"Generating…":D.topics?.length?"Regenerate":"Generate"})]}),D?.isTopicsLoading?(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:"Finding related searches…"}):D?.topics&&D.topics.length>0?(0,p.jsx)("ul",{className:"space-y-1",children:D.topics.map((e,t)=>(0,p.jsx)("li",{children:(0,p.jsxs)("button",{type:"button",className:"w-full flex items-start gap-1.5 text-left text-xs text-muted-foreground rounded-md px-1 py-1 -mx-1 transition-colors hover:bg-sidebar-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed",onClick:()=>D.onSearchTopic?.(e),disabled:!D.onSearchTopic,children:[(0,p.jsx)(f.Search,{className:"shrink-0 h-3 w-3 mt-0.5 text-primary"}),(0,p.jsx)("span",{children:e})]})},t))}):(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:'Click "Generate" for suggested searches about this page.'})]}),ne=e=>{switch(e){case"files":return(0,p.jsx)("div",{className:"h-full overflow-auto",children:(0,p.jsx)(Vh,{ref:V,documents:r,activeId:a,onSelect:q,onMove:m,onRename:x,onDelete:d,onDuplicate:h,onAddChild:e=>c(e,!1),onAddChildFolder:e=>c(e,!0),onAddSibling:e=>{c(r.find(t=>t.id===e)?.parentId||null,!1)},onAddSiblingFolder:e=>{c(r.find(t=>t.id===e)?.parentId||null,!0)},onCopy:G,onPaste:W,onManageTags:U})});case"openTabs":return(0,p.jsx)("div",{className:"h-full overflow-auto",children:(0,p.jsxs)("div",{className:"px-1 py-1",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between px-2 py-1",children:[(0,p.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Open Tabs"}),(0,p.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,p.jsx)("button",{className:"h-5 w-5 flex items-center justify-center rounded text-muted-foreground hover:bg-sidebar-accent hover:text-foreground",title:"New File",onClick:()=>c(null,!1),children:(0,p.jsx)(f.FilePlus2,{className:"h-3.5 w-3.5"})}),z&&(0,p.jsx)("button",{className:"h-5 w-5 flex items-center justify-center rounded text-muted-foreground hover:bg-sidebar-accent hover:text-foreground",title:"New Chat",onClick:z,children:(0,p.jsx)(f.MessageSquarePlus,{className:"h-3.5 w-3.5"})})]})]}),0===J.length?(0,p.jsx)("div",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No open tabs"}):J.map(({id:e,title:t,kind:n})=>{const r=e===j,a="chat"===n;return(0,p.jsxs)(Ah,{children:[(0,p.jsx)(Rh,{children:(0,p.jsxs)("div",{className:xo("group flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer transition-colors hover:bg-sidebar-accent",r&&"bg-sidebar-accent text-blue-600 font-medium"),onClick:()=>k?.(e),children:[a?(0,p.jsx)(f.MessageSquare,{className:"shrink-0 h-4 w-4 text-blue-500"}):(0,p.jsx)(lu,{filename:t,size:16}),(0,p.jsx)("span",{className:"flex-1 truncate text-sm",children:t}),C&&(0,p.jsx)("button",{className:"shrink-0 h-4 w-4 flex items-center justify-center rounded opacity-0 group-hover:opacity-100 hover:bg-destructive/10 hover:text-destructive",onClick:t=>{t.stopPropagation(),C(e)},children:(0,p.jsx)(f.X,{className:"h-3 w-3"})})]})}),(0,p.jsxs)(zh,{children:[N&&!a&&(0,p.jsxs)(Ph,{onClick:()=>{const n=window.prompt("Rename document",t);n?.trim()&&N(e,n.trim())},children:[(0,p.jsx)(f.Edit2,{className:"mr-2 h-4 w-4"}),"Rename"]}),C&&(0,p.jsxs)(Ph,{onClick:()=>C(e),className:"text-destructive focus:text-destructive",children:[(0,p.jsx)(f.X,{className:"mr-2 h-4 w-4"}),"Close"]}),!a&&(T||M)&&(0,p.jsx)(Lh,{}),T&&!a&&(0,p.jsxs)(Ph,{onClick:()=>T(e),children:[(0,p.jsx)(f.SplitSquareVertical,{className:"mr-2 h-4 w-4"}),"Split Right"]}),M&&!a&&(0,p.jsxs)(Ph,{onClick:M,disabled:!E,children:[(0,p.jsx)(f.RotateCcw,{className:"mr-2 h-4 w-4"}),"Reopen Last Closed"]})]})]},e)})]})});case"outline":return(0,p.jsxs)("div",{className:"h-full overflow-hidden flex flex-col",children:[(0,p.jsxs)("div",{className:"px-3 py-2 border-b border-sidebar-border shrink-0",children:[(0,p.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:"Outline"}),(0,p.jsxs)("div",{className:"relative",children:[(0,p.jsx)(f.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none"}),(0,p.jsx)(am,{value:L,onChange:e=>F(e.target.value),placeholder:"Filter headings & text…",className:"h-7 pl-7 pr-7 text-xs"}),L&&(0,p.jsx)("button",{onClick:()=>F(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:(0,p.jsx)(f.X,{className:"h-3 w-3"})})]})]}),(0,p.jsx)("div",{className:"flex-1 overflow-auto",children:(0,p.jsx)(qh,{ref:$,headings:Y,onNavigate:A,editorRef:w})})]});case"related":return(()=>{const{suggested:e,others:t}=function(e){if(0===e.length)return{suggested:null,others:[]};const[t,...n]=e;return{suggested:t,others:n}}(Q);return(0,p.jsxs)("div",{className:"h-full overflow-hidden flex flex-col",children:[(0,p.jsx)("div",{className:"px-3 py-2 border-b border-sidebar-border shrink-0",children:(0,p.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Related"})}),(0,p.jsx)("div",{className:"flex-1 overflow-auto px-1 py-1",children:0===Q.length?(0,p.jsx)("div",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No related documents found"}):(0,p.jsxs)(p.Fragment,{children:[e&&(0,p.jsxs)("div",{className:"group flex items-center gap-2 px-2 py-2 mb-1 rounded-md cursor-pointer border border-primary/30 bg-accent/30 transition-all hover:border-primary hover:bg-primary/10",onClick:()=>q(e.document.id),children:[(0,p.jsx)(f.Sparkles,{className:"shrink-0 h-4 w-4 text-primary"}),(0,p.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,p.jsx)("p",{className:"text-[10px] font-semibold text-primary uppercase tracking-wide",children:"Suggested next"}),(0,p.jsx)("span",{className:"block truncate text-sm font-semibold",children:e.document.title})]}),e.sharedTagCount>0&&(0,p.jsxs)("span",{className:"shrink-0 flex items-center gap-0.5 text-xs text-muted-foreground",title:`${e.sharedTagCount} shared tag${1===e.sharedTagCount?"":"s"}`,children:[(0,p.jsx)(f.Tag,{className:"h-3 w-3"}),e.sharedTagCount]}),(0,p.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",title:`${e.sharedKeywordCount} shared keyword${1===e.sharedKeywordCount?"":"s"}`,children:e.sharedKeywordCount})]}),t.map(ee)]})}),D&&te()]})})();case"ai":return(0,p.jsxs)("div",{className:"h-full overflow-hidden flex flex-col",children:[(0,p.jsx)("div",{className:"px-3 py-2 border-b border-sidebar-border shrink-0",children:(0,p.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"AI Suggestions"})}),(0,p.jsxs)("div",{className:"flex-1 overflow-auto flex flex-col",children:[(0,p.jsx)("div",{className:I?"shrink-0":"flex-1",children:R?.isAiLoading?(0,p.jsx)("div",{className:"h-full flex items-center justify-center p-6",children:(0,p.jsxs)("div",{className:"text-center",children:[(0,p.jsx)(f.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground mx-auto mb-3"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"Generating AI suggestion..."})]})}):R?.aiSuggestion?(0,p.jsx)(rm,{originalText:R.aiSuggestion.originalText,suggestedText:R.aiSuggestion.suggestedText,onApprove:()=>R.onAiApprove?.(),onReject:()=>R.onAiReject?.(),onRegenerate:e=>R.onAiRegenerate?.(e),currentMode:R.aiSuggestion.mode,isLoading:!1}):(0,p.jsx)("div",{className:"flex items-center justify-center p-6 text-center",children:(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select text and click the AI button to get suggestions"})})}),I&&(0,p.jsxs)("div",{className:"px-3 py-3 border-t border-sidebar-border shrink-0",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between mb-2 gap-2",children:[(0,p.jsxs)("p",{className:"flex items-center gap-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:[(0,p.jsx)(f.Lightbulb,{className:"h-3.5 w-3.5 text-primary"}),"Page tips"]}),I?.onGenerateTips&&(0,p.jsx)("button",{className:"shrink-0 text-xs font-medium text-primary hover:underline disabled:opacity-50 disabled:cursor-not-allowed disabled:no-underline",onClick:I.onGenerateTips,disabled:I.isTipsLoading,children:I.isTipsLoading?"Generating…":I.tips?.length?"Regenerate":"Generate"})]}),I?.isTipsLoading?(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:"Generating tips about this page…"}):I?.tips&&I.tips.length>0?(0,p.jsx)("ul",{className:"space-y-1.5",children:I.tips.map((e,t)=>(0,p.jsxs)("li",{className:"flex items-start gap-1.5 text-xs text-muted-foreground",children:[(0,p.jsx)("span",{className:"text-primary",children:"•"}),(0,p.jsx)("span",{children:e})]},t))}):(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:'Click "Generate" for AI tips about this page.'})]})]})]})}};return 0===e.length?(0,p.jsx)("div",{className:"h-full flex items-center justify-center p-6 text-center",children:(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"No panels enabled"})}):1!==e.length&&t?(0,p.jsx)("div",{className:"h-full",children:(0,p.jsx)(xm,{direction:"vertical",onResize:Z,children:e.map((t,n)=>(0,p.jsx)(om,{size:X?.[n]||`${Math.round(100/e.length)}%`,minSize:"0px",children:ne(t)},t))})}):(0,p.jsx)("div",{className:"h-full",children:ne(e[0])})},wm="bg-white/10 dark:bg-black/20 backdrop-blur-md border-white/15 dark:border-white/10",Sm=({documents:e,activeId:t,activeDocument:n,onSelect:r,onAdd:a,onDelete:s,onDuplicate:o,onMove:i,onManageTags:l,onRename:c,onSearchFocus:d,isOpen:h,onOpenChange:m,isMobile:f,leftPanels:g,onLeftPanelsChange:x,leftSplit:v,onLeftSplitChange:y,rightPanels:b,onRightPanelsChange:w,rightSplit:S,onRightSplitChange:j,onSettingsClick:k,onRestore:C,newDocumentId:N,showDynamicIsland:T,onToggleDynamicIsland:M,activeFileSourceId:E="local-default",onFileSourceChange:A,headings:R=[],onNavigate:I,editorRef:D,openTabs:_=[],activeTab:z,onTabChange:P,onTabClose:O,onTabRename:L,onSplitRight:F,onReopenLastClosed:B,canReopenLastClosed:H=!1,aiProps:V,tipsProps:$,topicsProps:q,tabItems:U,onNewChat:G})=>{const W=e.filter(e=>e.isDeleted),K=e.filter(e=>!e.isDeleted),[Y,X]=(0,u.useState)(0),Z=(0,u.useMemo)(()=>{const e=new Map(K.map(e=>[e.id,e]));let t=0;for(const n of K){if(!n.isFolder)continue;let r=1,a=n.parentId;const s=new Set;for(;a&&e.has(a)&&!s.has(a);)s.add(a),r++,a=e.get(a)?.parentId??null;t=Math.max(t,r)}return t},[K]);(0,u.useEffect)(()=>{X(e=>Math.min(e,Z))},[Z]);const[J,Q]=(0,u.useState)(!0),ee=(0,u.useRef)(null),te=(0,u.useRef)(null),[ne]=(0,u.useState)(()=>Mo()),[re,ae]=(0,u.useState)(()=>{const e=Mo();return e.find(e=>e.id===E)||e[0]||null}),[se,oe]=(0,u.useState)(!1);(0,u.useEffect)(()=>{const e=ne.find(e=>e.id===E);e&&e.id!==re?.id&&ae(e)},[E,re?.id,ne]);const ie=Y>0&&Y>=Z,le=0===Y?Z>1?"Expand Level 1":"Expand All":ie?"Collapse All":`Expand Level ${Y+1}`;(0,u.useEffect)(()=>{if(N&&ee.current){const e=setTimeout(()=>{const e=ee.current;e&&"function"==typeof e.edit&&e.edit(N)},100);return()=>clearTimeout(e)}},[N]);const ce={leftPanels:g,leftSplit:v,onLeftPanelsChange:x,onLeftSplitChange:y,rightPanels:b,rightSplit:S,onRightPanelsChange:w,onRightSplitChange:j,activeId:t,onAdd:a,onSearchFocus:d,onFileManagerOpen:()=>oe(!0),sources:ne,activeSource:re,activeFileSourceId:E,onFileSourceChange:A,onSourceSelect:e=>{const t=ne.find(t=>t.id===e);t&&(ae(t),A?.(e))},allExpanded:ie,expandToggleLabel:le,outlineExpanded:J,onToggleAllExpanded:()=>{if(0===Z)return;const e=Y>=Z?0:Y+1;X(e),ee.current&&(0===e?(ee.current.cancelExpand?.(),ee.current.collapseAll()):ee.current.expandToLevel(e))},onToggleOutlineExpanded:()=>{const e=!J;Q(e),te.current&&(e?te.current.expandAll():te.current.collapseAll())},treeRef:ee,outlineRef:te,deletedDocs:W,onRestore:C,onSettingsClick:k,showDynamicIsland:T,onToggleDynamicIsland:M,isMobile:f,openTabs:_,activeTab:z,onTabChange:P,onTabClose:O,documents:e,tabItems:U},de={panels:g,split:v,persistenceKey:"left",activeDocuments:K,activeId:t,activeDocument:n,headings:R,isMobile:f,onSelect:r,onAdd:a,onDelete:s,onDuplicate:o,onMove:i,onManageTags:l,onRename:c,onOpenChange:m,treeRef:ee,outlineRef:te,editorRef:D,openTabs:_,activeTab:z,onTabChange:P,onTabClose:O,onTabRename:L,onSplitRight:F,onReopenLastClosed:B,canReopenLastClosed:H,onNavigate:I,aiProps:V,tipsProps:$,topicsProps:q,tabItems:U,onNewChat:G};return f?(0,p.jsx)(vo,{open:h,onOpenChange:m,children:(0,p.jsx)(wo,{side:"left",className:xo("w-80 p-0",wm),children:(0,p.jsxs)("aside",{className:"h-full flex flex-col",children:[(0,p.jsx)(cu,{...ce}),(0,p.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,p.jsx)(bm,{...de})}),(0,p.jsx)(Hd,{open:se,onOpenChange:oe,documents:K,onSelectDocument:r})]})})}):(0,p.jsxs)("aside",{className:xo("h-screen w-full flex flex-col pt-14",wm),children:[(0,p.jsx)(cu,{...ce}),(0,p.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,p.jsx)(bm,{...de})}),(0,p.jsx)(Hd,{open:se,onOpenChange:oe,documents:K,onSelectDocument:r})]})},jm=({editor:e,theme:t,setTheme:r})=>{const[a,s]=(0,u.useState)(!1);return n.useLocale(),c.useTheme(),(0,u.useEffect)(()=>{c.themeActions.setColor("default"),s(e?.isEditable??!0)},[]),(0,u.useEffect)(()=>(e&&e.on("update",()=>{s(e.isEditable)}),()=>{e&&e.off("update",()=>{s(e.isEditable)})}),[e]),null},km=o.buildExtensions(o.createDefaultConfig());function Cm({className:e,...t}){return(0,p.jsx)(s.Avatar,{"data-slot":"avatar",className:xo("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function Nm({className:e,...t}){return(0,p.jsx)(s.AvatarImage,{"data-slot":"avatar-image",className:xo("aspect-square size-full",e),...t})}function Tm({className:e,...t}){return(0,p.jsx)(s.AvatarFallback,{"data-slot":"avatar-fallback",className:xo("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}function Mm({className:e,...t}){return(0,p.jsx)("textarea",{"data-slot":"textarea",className:xo("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-2xl border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}function Em(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Am({thread:e,active:t,onSelect:n,onSubmitBody:r,onReply:a,onResolve:s,onRemove:o}){const[i,l]=(0,u.useState)(""),c=(0,u.useRef)(null),d=!e.text.trim();(0,u.useEffect)(()=>{t&&d&&c.current?.focus()},[t,d]);const h=()=>{const t=i.trim();t&&(d?r(e.id,t):a(e.id,t),l(""))};return(0,p.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>n(e.id),onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||n(e.id)},className:xo("rounded-lg border bg-card p-3 text-left shadow-sm transition-colors cursor-pointer",t?"border-primary ring-1 ring-primary/40":"hover:border-primary/40",e.resolved&&"opacity-70"),children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(Cm,{className:"h-6 w-6",children:(0,p.jsx)(Tm,{className:"text-[10px]",style:{backgroundColor:e.authorColor,color:"#fff"},children:(m=e.authorName,m.split(" ").map(e=>e[0]).filter(Boolean).slice(0,2).join("").toUpperCase())})}),(0,p.jsx)("span",{className:"text-sm font-medium truncate flex-1",children:e.authorName}),(0,p.jsx)("span",{className:"text-[11px] text-muted-foreground shrink-0",children:Em(e.timestamp)}),e.resolved&&(0,p.jsx)(Jh,{variant:"secondary",className:"shrink-0",children:"Resolved"})]}),!d&&(0,p.jsx)("p",{className:"mt-2 whitespace-pre-wrap break-words text-sm",children:e.text}),e.replies?.length>0&&(0,p.jsx)("div",{className:"mt-2 space-y-2 border-l-2 border-border pl-2",children:e.replies.map(e=>(0,p.jsxs)("div",{children:[(0,p.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,p.jsx)("span",{className:"text-xs font-medium",children:e.authorName}),(0,p.jsx)("span",{className:"text-[10px] text-muted-foreground",children:Em(e.timestamp)})]}),(0,p.jsx)("p",{className:"whitespace-pre-wrap break-words text-sm",children:e.text})]},e.id))}),!e.resolved&&(0,p.jsxs)("div",{className:"mt-2",onClick:e=>e.stopPropagation(),children:[(0,p.jsx)(Mm,{ref:c,value:i,onChange:e=>l(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),h())},placeholder:d?"Write a comment…":"Reply…",className:"min-h-[56px] text-sm"}),(0,p.jsxs)("div",{className:"mt-1.5 flex items-center justify-between",children:[(0,p.jsxs)("div",{className:"flex gap-1",children:[!d&&(0,p.jsxs)($d,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:()=>s(e.id,!0),children:[(0,p.jsx)(f.Check,{className:"h-3.5 w-3.5"})," Resolve"]}),(0,p.jsxs)($d,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>o(e.id),children:[(0,p.jsx)(f.Trash2,{className:"h-3.5 w-3.5"})," Delete"]})]}),(0,p.jsx)($d,{size:"sm",className:"h-7 px-3 text-xs",onClick:h,disabled:!i.trim(),children:d?"Comment":"Reply"})]})]}),e.resolved&&(0,p.jsxs)("div",{className:"mt-2 flex gap-1",onClick:e=>e.stopPropagation(),children:[(0,p.jsxs)($d,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:()=>s(e.id,!1),children:[(0,p.jsx)(f.RotateCcw,{className:"h-3.5 w-3.5"})," Reopen"]}),(0,p.jsxs)($d,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>o(e.id),children:[(0,p.jsx)(f.Trash2,{className:"h-3.5 w-3.5"})," Delete"]})]})]});var m}function Rm({threads:e,activeId:t,onSelect:n,onSubmitBody:r,onReply:a,onResolve:s,onRemove:o,onClose:i}){const l=e.filter(e=>!e.resolved),c=e.filter(e=>e.resolved);return(0,p.jsxs)("aside",{className:"flex h-full w-full flex-col border-l border-border bg-background",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[(0,p.jsx)("h2",{className:"text-sm font-semibold",children:"Comments"}),(0,p.jsx)($d,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,"aria-label":"Close comments",children:(0,p.jsx)(f.X,{className:"h-4 w-4"})})]}),(0,p.jsx)("div",{className:"flex-1 space-y-2 overflow-y-auto p-3",children:0===e.length?(0,p.jsxs)("div",{className:"flex flex-col items-center gap-2 py-10 text-center text-muted-foreground",children:[(0,p.jsx)(f.MessageSquarePlus,{className:"h-8 w-8 opacity-50"}),(0,p.jsx)("p",{className:"text-sm",children:"No comments yet"}),(0,p.jsx)("p",{className:"text-xs",children:"Select text in the document, then choose “Comment”."})]}):(0,p.jsxs)(p.Fragment,{children:[l.map(e=>(0,p.jsx)(Am,{thread:e,active:e.id===t,onSelect:n,onSubmitBody:r,onReply:a,onResolve:s,onRemove:o},e.id)),c.length>0&&(0,p.jsxs)("div",{className:"pt-2",children:[(0,p.jsxs)("p",{className:"mb-1 px-1 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:["Resolved (",c.length,")"]}),(0,p.jsx)("div",{className:"space-y-2",children:c.map(e=>(0,p.jsx)(Am,{thread:e,active:e.id===t,onSelect:n,onSubmitBody:r,onReply:a,onResolve:s,onRemove:o},e.id))})]})]})})]})}var Im="comment";function Dm(e,t){let n=null,r=null;return e.state.doc.descendants((e,a)=>{e.isText&&e.marks.some(e=>e.type.name===Im&&e.attrs.id===t)&&(null===n&&(n=a),r=a+e.nodeSize)}),null===n||null===r?null:{from:n,to:r}}var _m=class e extends Error{constructor(t,n){var r,a,s="KaTeX parse error: "+t,o=n&&n.loc;if(o&&o.start<=o.end){var i=o.lexer.input;r=o.start,a=o.end,r===i.length?s+=" at end of input: ":s+=" at position "+(r+1)+": ";var l=i.slice(r,a).replace(/[^]/g,"$&̲");s+=(r>15?"…"+i.slice(r-15,r):i.slice(0,r))+l+(a+15<i.length?i.slice(a,a+15)+"…":i.slice(a))}super(s),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=r,null!=r&&null!=a&&(this.length=a-r),this.rawMessage=t}},zm=/([A-Z])/g,Pm=e=>e.replace(zm,"-$1").toLowerCase(),Om={"&":"&",">":">","<":"<",'"':""","'":"'"},Lm=/[&><"']/g,Fm=e=>String(e).replace(Lm,e=>Om[e]),Bm=e=>"ordgroup"===e.type||"color"===e.type?1===e.body.length?Bm(e.body[0]):e:"font"===e.type?Bm(e.body):e,Hm=new Set(["mathord","textord","atom"]),Vm=e=>Hm.has(Bm(e).type),$m={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>"Infinity"===e?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function qm(e){return void 0!==e.default?e.default:function(e){if("string"!=typeof e)return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}(Array.isArray(e.type)?e.type[0]:e.type)}function Um(e,t,n,r){var a=n[t];e[t]=void 0!==a?r.processor?r.processor(a):a:qm(r)}var Gm=class{constructor(e){for(var t of(void 0===e&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{},Object.keys($m))){var n=$m[t];n&&Um(this,t,e,n)}}reportNonstrict(e,t,n){var r=this.strict;if("function"==typeof r&&(r=r(e,t,n)),r&&"ignore"!==r&&(!0===r||"error"===r))throw new _m("LaTeX-incompatible input and strict mode is set to 'error': "+t+" ["+e+"]",n)}useStrictBehavior(e,t,n){var r=this.strict;if("function"==typeof r)try{r=r(e,t,n)}catch(a){r="error"}return!(!r||"ignore"===r)&&(!0===r||"error"===r)}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var t=(e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?":"!==t[2]?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?t[1].toLowerCase():null:"_relative"})(e.url);if(null==t)return!1;e.protocol=t}var n="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(n)}},Wm=class{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return Km[Ym[this.id]]}sub(){return Km[Xm[this.id]]}fracNum(){return Km[Zm[this.id]]}fracDen(){return Km[Jm[this.id]]}cramp(){return Km[Qm[this.id]]}text(){return Km[ep[this.id]]}isTight(){return this.size>=2}},Km=[new Wm(0,0,!1),new Wm(1,0,!0),new Wm(2,1,!1),new Wm(3,1,!0),new Wm(4,2,!1),new Wm(5,2,!0),new Wm(6,3,!1),new Wm(7,3,!0)],Ym=[4,5,4,5,6,7,6,7],Xm=[5,5,5,5,7,7,7,7],Zm=[2,3,4,5,6,7,6,7],Jm=[3,3,5,5,7,7,7,7],Qm=[1,1,3,3,5,5,7,7],ep=[0,1,2,3,2,3,2,3],tp={DISPLAY:Km[0],TEXT:Km[2],SCRIPT:Km[4],SCRIPTSCRIPT:Km[6]},np=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var rp=[];function ap(e){for(var t=0;t<rp.length;t+=2)if(e>=rp[t]&&e<=rp[t+1])return!0;return!1}np.forEach(e=>e.blocks.forEach(e=>rp.push(...e)));var sp=e=>e+" "+e,op=80,ip={doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:sp("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:sp("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:sp("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:sp("M40 281 V448H0V74H40V241H400000v40z"),leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:sp("M0 50 h400000 v40H0z m0 194h40000v40H0z"),midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:sp("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:sp("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:sp("M399995 440 h-120 V150 H0 v-120 H399995z"),rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",tilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",tilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",tilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",tilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"};var lp=class{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map(e=>{if("toText"in e)return e.toText();throw new Error("Expected MathDomNode with toText, got "+e.constructor.name)}).join("")}},cp={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},dp={ex:!0,em:!0,mu:!0},up=function(e){return"string"!=typeof e&&(e=e.unit),e in cp||e in dp||"ex"===e},hp=function(e,t){var n;if(e.unit in cp)n=cp[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if("mu"===e.unit)n=t.fontMetrics().cssEmPerMu;else{var r;if(r=t.style.isTight()?t.havingStyle(t.style.text()):t,"ex"===e.unit)n=r.fontMetrics().xHeight;else{if("em"!==e.unit)throw new _m("Invalid unit: '"+e.unit+"'");n=r.fontMetrics().quad}r!==t&&(n*=r.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},mp=function(e){return+e.toFixed(4)+"em"},pp=function(e){return e.filter(e=>e).join(" ")},fp=function(e){var t="";for(var n of Object.keys(e)){var r=e[n];void 0!==r&&(t+=Pm(n)+":"+r+";")}return t},gp=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var r=t.getColor();r&&(this.style.color=r)}},xp=function(e){var t=document.createElement(e);for(var n of(t.className=pp(this.classes),Object.assign(t.style,this.style),Object.keys(this.attributes)))t.setAttribute(n,this.attributes[n]);for(var r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t},vp=/[\s"'>/=\x00-\x1f]/,yp=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+Fm(pp(this.classes))+'"');var n=fp(this.style);for(var r of(n&&(t+=' style="'+Fm(n)+'"'),Object.keys(this.attributes))){if(vp.test(r))throw new _m("Invalid attribute name '"+r+"'");t+=" "+r+'="'+Fm(this.attributes[r])+'"'}t+=">";for(var a=0;a<this.children.length;a++)t+=this.children[a].toMarkup();return t+="</"+e+">"},bp=class{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,gp.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return xp.call(this,"span")}toMarkup(){return yp.call(this,"span")}},wp=class{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,gp.call(this,t,r),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return xp.call(this,"a")}toMarkup(){return yp.call(this,"a")}},Sp=class{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");return e.src=this.src,e.alt=this.alt,e.className="mord",Object.assign(e.style,this.style),e}toMarkup(){var e='<img src="'+Fm(this.src)+'" alt="'+Fm(this.alt)+'"',t=fp(this.style);return t&&(e+=' style="'+Fm(t)+'"'),e+="'/>"}},jp={"î":"ı̂","ï":"ı̈","í":"ı́","ì":"ı̀"},kp=class{constructor(e,t,n,r,a,s,o,i){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=r||0,this.skew=a||0,this.width=s||0,this.classes=o||[],this.style=i||{},this.maxFontSize=0;var l=function(e){for(var t=0;t<np.length;t++)for(var n=np[t],r=0;r<n.blocks.length;r++){var a=n.blocks[r];if(e>=a[0]&&e<=a[1])return n.name}return null}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=jp[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;return this.italic>0&&((t=document.createElement("span")).style.marginRight=mp(this.italic)),this.classes.length>0&&((t=t||document.createElement("span")).className=pp(this.classes)),Object.keys(this.style).length>0&&(t=t||document.createElement("span"),Object.assign(t.style,this.style)),t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=Fm(pp(this.classes)),t+='"');var n="";this.italic>0&&(n+="margin-right:"+mp(this.italic)+";"),(n+=fp(this.style))&&(e=!0,t+=' style="'+Fm(n)+'"');var r=Fm(this.text);return e?(t+=">",t+=r,t+="</span>"):r}},Cp=class{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t of Object.keys(this.attributes))e.setAttribute(t,this.attributes[t]);for(var n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t of Object.keys(this.attributes))e+=" "+t+'="'+Fm(this.attributes[t])+'"';e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>"}},Np=class{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","path");return this.alternate?e.setAttribute("d",this.alternate):e.setAttribute("d",ip[this.pathName]),e}toMarkup(){return this.alternate?'<path d="'+Fm(this.alternate)+'"/>':'<path d="'+Fm(ip[this.pathName])+'"/>'}},Tp=class{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t of Object.keys(this.attributes))e.setAttribute(t,this.attributes[t]);return e}toMarkup(){var e="<line";for(var t of Object.keys(this.attributes))e+=" "+t+'="'+Fm(this.attributes[t])+'"';return e+="/>"}};var Mp={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Ep={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Ap={"Å":"A","Ð":"D","Þ":"o","å":"a","ð":"d","þ":"o","А":"A","Б":"B","В":"B","Г":"F","Д":"A","Е":"E","Ж":"K","З":"3","И":"N","Й":"N","К":"K","Л":"N","М":"M","Н":"H","О":"O","П":"N","Р":"P","С":"C","Т":"T","У":"y","Ф":"O","Х":"X","Ц":"U","Ч":"h","Ш":"W","Щ":"W","Ъ":"B","Ы":"X","Ь":"B","Э":"3","Ю":"X","Я":"R","а":"a","б":"b","в":"a","г":"r","д":"y","е":"e","ж":"m","з":"e","и":"n","й":"n","к":"n","л":"n","м":"m","н":"n","о":"o","п":"n","р":"p","с":"c","т":"o","у":"y","ф":"b","х":"x","ц":"n","ч":"n","ш":"w","щ":"w","ъ":"a","ы":"m","ь":"a","э":"e","ю":"m","я":"r"};function Rp(e,t,n){if(!Mp[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),a=Mp[t][r];if(!a&&e[0]in Ap&&(r=Ap[e[0]].charCodeAt(0),a=Mp[t][r]),a||"text"!==n||ap(r)&&(a=Mp[t][77]),a)return{depth:a[0],height:a[1],italic:a[2],skew:a[3],width:a[4]}}var Ip={};var Dp={math:{},text:{}};function _p(e,t,n,r,a,s){Dp[e][a]={font:t,group:n,replace:r},s&&r&&(Dp[e][r]=Dp[e][a])}var zp="math",Pp="text",Op="main",Lp="ams",Fp="accent-token",Bp="bin",Hp="close",Vp="inner",$p="mathord",qp="op-token",Up="open",Gp="punct",Wp="rel",Kp="spacing",Yp="textord";_p(zp,Op,Wp,"≡","\\equiv",!0),_p(zp,Op,Wp,"≺","\\prec",!0),_p(zp,Op,Wp,"≻","\\succ",!0),_p(zp,Op,Wp,"∼","\\sim",!0),_p(zp,Op,Wp,"⊥","\\perp"),_p(zp,Op,Wp,"⪯","\\preceq",!0),_p(zp,Op,Wp,"⪰","\\succeq",!0),_p(zp,Op,Wp,"≃","\\simeq",!0),_p(zp,Op,Wp,"∣","\\mid",!0),_p(zp,Op,Wp,"≪","\\ll",!0),_p(zp,Op,Wp,"≫","\\gg",!0),_p(zp,Op,Wp,"≍","\\asymp",!0),_p(zp,Op,Wp,"∥","\\parallel"),_p(zp,Op,Wp,"⋈","\\bowtie",!0),_p(zp,Op,Wp,"⌣","\\smile",!0),_p(zp,Op,Wp,"⊑","\\sqsubseteq",!0),_p(zp,Op,Wp,"⊒","\\sqsupseteq",!0),_p(zp,Op,Wp,"≐","\\doteq",!0),_p(zp,Op,Wp,"⌢","\\frown",!0),_p(zp,Op,Wp,"∋","\\ni",!0),_p(zp,Op,Wp,"∝","\\propto",!0),_p(zp,Op,Wp,"⊢","\\vdash",!0),_p(zp,Op,Wp,"⊣","\\dashv",!0),_p(zp,Op,Wp,"∋","\\owns"),_p(zp,Op,Gp,".","\\ldotp"),_p(zp,Op,Gp,"⋅","\\cdotp"),_p(zp,Op,Gp,"⋅","·"),_p(Pp,Op,Yp,"⋅","·"),_p(zp,Op,Yp,"#","\\#"),_p(Pp,Op,Yp,"#","\\#"),_p(zp,Op,Yp,"&","\\&"),_p(Pp,Op,Yp,"&","\\&"),_p(zp,Op,Yp,"ℵ","\\aleph",!0),_p(zp,Op,Yp,"∀","\\forall",!0),_p(zp,Op,Yp,"ℏ","\\hbar",!0),_p(zp,Op,Yp,"∃","\\exists",!0),_p(zp,Op,Yp,"∇","\\nabla",!0),_p(zp,Op,Yp,"♭","\\flat",!0),_p(zp,Op,Yp,"ℓ","\\ell",!0),_p(zp,Op,Yp,"♮","\\natural",!0),_p(zp,Op,Yp,"♣","\\clubsuit",!0),_p(zp,Op,Yp,"℘","\\wp",!0),_p(zp,Op,Yp,"♯","\\sharp",!0),_p(zp,Op,Yp,"♢","\\diamondsuit",!0),_p(zp,Op,Yp,"ℜ","\\Re",!0),_p(zp,Op,Yp,"♡","\\heartsuit",!0),_p(zp,Op,Yp,"ℑ","\\Im",!0),_p(zp,Op,Yp,"♠","\\spadesuit",!0),_p(zp,Op,Yp,"§","\\S",!0),_p(Pp,Op,Yp,"§","\\S"),_p(zp,Op,Yp,"¶","\\P",!0),_p(Pp,Op,Yp,"¶","\\P"),_p(zp,Op,Yp,"†","\\dag"),_p(Pp,Op,Yp,"†","\\dag"),_p(Pp,Op,Yp,"†","\\textdagger"),_p(zp,Op,Yp,"‡","\\ddag"),_p(Pp,Op,Yp,"‡","\\ddag"),_p(Pp,Op,Yp,"‡","\\textdaggerdbl"),_p(zp,Op,Hp,"⎱","\\rmoustache",!0),_p(zp,Op,Up,"⎰","\\lmoustache",!0),_p(zp,Op,Hp,"⟯","\\rgroup",!0),_p(zp,Op,Up,"⟮","\\lgroup",!0),_p(zp,Op,Bp,"∓","\\mp",!0),_p(zp,Op,Bp,"⊖","\\ominus",!0),_p(zp,Op,Bp,"⊎","\\uplus",!0),_p(zp,Op,Bp,"⊓","\\sqcap",!0),_p(zp,Op,Bp,"∗","\\ast"),_p(zp,Op,Bp,"⊔","\\sqcup",!0),_p(zp,Op,Bp,"◯","\\bigcirc",!0),_p(zp,Op,Bp,"∙","\\bullet",!0),_p(zp,Op,Bp,"‡","\\ddagger"),_p(zp,Op,Bp,"≀","\\wr",!0),_p(zp,Op,Bp,"⨿","\\amalg"),_p(zp,Op,Bp,"&","\\And"),_p(zp,Op,Wp,"⟵","\\longleftarrow",!0),_p(zp,Op,Wp,"⇐","\\Leftarrow",!0),_p(zp,Op,Wp,"⟸","\\Longleftarrow",!0),_p(zp,Op,Wp,"⟶","\\longrightarrow",!0),_p(zp,Op,Wp,"⇒","\\Rightarrow",!0),_p(zp,Op,Wp,"⟹","\\Longrightarrow",!0),_p(zp,Op,Wp,"↔","\\leftrightarrow",!0),_p(zp,Op,Wp,"⟷","\\longleftrightarrow",!0),_p(zp,Op,Wp,"⇔","\\Leftrightarrow",!0),_p(zp,Op,Wp,"⟺","\\Longleftrightarrow",!0),_p(zp,Op,Wp,"↦","\\mapsto",!0),_p(zp,Op,Wp,"⟼","\\longmapsto",!0),_p(zp,Op,Wp,"↗","\\nearrow",!0),_p(zp,Op,Wp,"↩","\\hookleftarrow",!0),_p(zp,Op,Wp,"↪","\\hookrightarrow",!0),_p(zp,Op,Wp,"↘","\\searrow",!0),_p(zp,Op,Wp,"↼","\\leftharpoonup",!0),_p(zp,Op,Wp,"⇀","\\rightharpoonup",!0),_p(zp,Op,Wp,"↙","\\swarrow",!0),_p(zp,Op,Wp,"↽","\\leftharpoondown",!0),_p(zp,Op,Wp,"⇁","\\rightharpoondown",!0),_p(zp,Op,Wp,"↖","\\nwarrow",!0),_p(zp,Op,Wp,"⇌","\\rightleftharpoons",!0),_p(zp,Lp,Wp,"≮","\\nless",!0),_p(zp,Lp,Wp,"","\\@nleqslant"),_p(zp,Lp,Wp,"","\\@nleqq"),_p(zp,Lp,Wp,"⪇","\\lneq",!0),_p(zp,Lp,Wp,"≨","\\lneqq",!0),_p(zp,Lp,Wp,"","\\@lvertneqq"),_p(zp,Lp,Wp,"⋦","\\lnsim",!0),_p(zp,Lp,Wp,"⪉","\\lnapprox",!0),_p(zp,Lp,Wp,"⊀","\\nprec",!0),_p(zp,Lp,Wp,"⋠","\\npreceq",!0),_p(zp,Lp,Wp,"⋨","\\precnsim",!0),_p(zp,Lp,Wp,"⪹","\\precnapprox",!0),_p(zp,Lp,Wp,"≁","\\nsim",!0),_p(zp,Lp,Wp,"","\\@nshortmid"),_p(zp,Lp,Wp,"∤","\\nmid",!0),_p(zp,Lp,Wp,"⊬","\\nvdash",!0),_p(zp,Lp,Wp,"⊭","\\nvDash",!0),_p(zp,Lp,Wp,"⋪","\\ntriangleleft"),_p(zp,Lp,Wp,"⋬","\\ntrianglelefteq",!0),_p(zp,Lp,Wp,"⊊","\\subsetneq",!0),_p(zp,Lp,Wp,"","\\@varsubsetneq"),_p(zp,Lp,Wp,"⫋","\\subsetneqq",!0),_p(zp,Lp,Wp,"","\\@varsubsetneqq"),_p(zp,Lp,Wp,"≯","\\ngtr",!0),_p(zp,Lp,Wp,"","\\@ngeqslant"),_p(zp,Lp,Wp,"","\\@ngeqq"),_p(zp,Lp,Wp,"⪈","\\gneq",!0),_p(zp,Lp,Wp,"≩","\\gneqq",!0),_p(zp,Lp,Wp,"","\\@gvertneqq"),_p(zp,Lp,Wp,"⋧","\\gnsim",!0),_p(zp,Lp,Wp,"⪊","\\gnapprox",!0),_p(zp,Lp,Wp,"⊁","\\nsucc",!0),_p(zp,Lp,Wp,"⋡","\\nsucceq",!0),_p(zp,Lp,Wp,"⋩","\\succnsim",!0),_p(zp,Lp,Wp,"⪺","\\succnapprox",!0),_p(zp,Lp,Wp,"≆","\\ncong",!0),_p(zp,Lp,Wp,"","\\@nshortparallel"),_p(zp,Lp,Wp,"∦","\\nparallel",!0),_p(zp,Lp,Wp,"⊯","\\nVDash",!0),_p(zp,Lp,Wp,"⋫","\\ntriangleright"),_p(zp,Lp,Wp,"⋭","\\ntrianglerighteq",!0),_p(zp,Lp,Wp,"","\\@nsupseteqq"),_p(zp,Lp,Wp,"⊋","\\supsetneq",!0),_p(zp,Lp,Wp,"","\\@varsupsetneq"),_p(zp,Lp,Wp,"⫌","\\supsetneqq",!0),_p(zp,Lp,Wp,"","\\@varsupsetneqq"),_p(zp,Lp,Wp,"⊮","\\nVdash",!0),_p(zp,Lp,Wp,"⪵","\\precneqq",!0),_p(zp,Lp,Wp,"⪶","\\succneqq",!0),_p(zp,Lp,Wp,"","\\@nsubseteqq"),_p(zp,Lp,Bp,"⊴","\\unlhd"),_p(zp,Lp,Bp,"⊵","\\unrhd"),_p(zp,Lp,Wp,"↚","\\nleftarrow",!0),_p(zp,Lp,Wp,"↛","\\nrightarrow",!0),_p(zp,Lp,Wp,"⇍","\\nLeftarrow",!0),_p(zp,Lp,Wp,"⇏","\\nRightarrow",!0),_p(zp,Lp,Wp,"↮","\\nleftrightarrow",!0),_p(zp,Lp,Wp,"⇎","\\nLeftrightarrow",!0),_p(zp,Lp,Wp,"△","\\vartriangle"),_p(zp,Lp,Yp,"ℏ","\\hslash"),_p(zp,Lp,Yp,"▽","\\triangledown"),_p(zp,Lp,Yp,"◊","\\lozenge"),_p(zp,Lp,Yp,"Ⓢ","\\circledS"),_p(zp,Lp,Yp,"®","\\circledR"),_p(Pp,Lp,Yp,"®","\\circledR"),_p(zp,Lp,Yp,"∡","\\measuredangle",!0),_p(zp,Lp,Yp,"∄","\\nexists"),_p(zp,Lp,Yp,"℧","\\mho"),_p(zp,Lp,Yp,"Ⅎ","\\Finv",!0),_p(zp,Lp,Yp,"⅁","\\Game",!0),_p(zp,Lp,Yp,"‵","\\backprime"),_p(zp,Lp,Yp,"▲","\\blacktriangle"),_p(zp,Lp,Yp,"▼","\\blacktriangledown"),_p(zp,Lp,Yp,"■","\\blacksquare"),_p(zp,Lp,Yp,"⧫","\\blacklozenge"),_p(zp,Lp,Yp,"★","\\bigstar"),_p(zp,Lp,Yp,"∢","\\sphericalangle",!0),_p(zp,Lp,Yp,"∁","\\complement",!0),_p(zp,Lp,Yp,"ð","\\eth",!0),_p(Pp,Op,Yp,"ð","ð"),_p(zp,Lp,Yp,"╱","\\diagup"),_p(zp,Lp,Yp,"╲","\\diagdown"),_p(zp,Lp,Yp,"□","\\square"),_p(zp,Lp,Yp,"□","\\Box"),_p(zp,Lp,Yp,"◊","\\Diamond"),_p(zp,Lp,Yp,"¥","\\yen",!0),_p(Pp,Lp,Yp,"¥","\\yen",!0),_p(zp,Lp,Yp,"✓","\\checkmark",!0),_p(Pp,Lp,Yp,"✓","\\checkmark"),_p(zp,Lp,Yp,"ℶ","\\beth",!0),_p(zp,Lp,Yp,"ℸ","\\daleth",!0),_p(zp,Lp,Yp,"ℷ","\\gimel",!0),_p(zp,Lp,Yp,"ϝ","\\digamma",!0),_p(zp,Lp,Yp,"ϰ","\\varkappa"),_p(zp,Lp,Up,"┌","\\@ulcorner",!0),_p(zp,Lp,Hp,"┐","\\@urcorner",!0),_p(zp,Lp,Up,"└","\\@llcorner",!0),_p(zp,Lp,Hp,"┘","\\@lrcorner",!0),_p(zp,Lp,Wp,"≦","\\leqq",!0),_p(zp,Lp,Wp,"⩽","\\leqslant",!0),_p(zp,Lp,Wp,"⪕","\\eqslantless",!0),_p(zp,Lp,Wp,"≲","\\lesssim",!0),_p(zp,Lp,Wp,"⪅","\\lessapprox",!0),_p(zp,Lp,Wp,"≊","\\approxeq",!0),_p(zp,Lp,Bp,"⋖","\\lessdot"),_p(zp,Lp,Wp,"⋘","\\lll",!0),_p(zp,Lp,Wp,"≶","\\lessgtr",!0),_p(zp,Lp,Wp,"⋚","\\lesseqgtr",!0),_p(zp,Lp,Wp,"⪋","\\lesseqqgtr",!0),_p(zp,Lp,Wp,"≑","\\doteqdot"),_p(zp,Lp,Wp,"≓","\\risingdotseq",!0),_p(zp,Lp,Wp,"≒","\\fallingdotseq",!0),_p(zp,Lp,Wp,"∽","\\backsim",!0),_p(zp,Lp,Wp,"⋍","\\backsimeq",!0),_p(zp,Lp,Wp,"⫅","\\subseteqq",!0),_p(zp,Lp,Wp,"⋐","\\Subset",!0),_p(zp,Lp,Wp,"⊏","\\sqsubset",!0),_p(zp,Lp,Wp,"≼","\\preccurlyeq",!0),_p(zp,Lp,Wp,"⋞","\\curlyeqprec",!0),_p(zp,Lp,Wp,"≾","\\precsim",!0),_p(zp,Lp,Wp,"⪷","\\precapprox",!0),_p(zp,Lp,Wp,"⊲","\\vartriangleleft"),_p(zp,Lp,Wp,"⊴","\\trianglelefteq"),_p(zp,Lp,Wp,"⊨","\\vDash",!0),_p(zp,Lp,Wp,"⊪","\\Vvdash",!0),_p(zp,Lp,Wp,"⌣","\\smallsmile"),_p(zp,Lp,Wp,"⌢","\\smallfrown"),_p(zp,Lp,Wp,"≏","\\bumpeq",!0),_p(zp,Lp,Wp,"≎","\\Bumpeq",!0),_p(zp,Lp,Wp,"≧","\\geqq",!0),_p(zp,Lp,Wp,"⩾","\\geqslant",!0),_p(zp,Lp,Wp,"⪖","\\eqslantgtr",!0),_p(zp,Lp,Wp,"≳","\\gtrsim",!0),_p(zp,Lp,Wp,"⪆","\\gtrapprox",!0),_p(zp,Lp,Bp,"⋗","\\gtrdot"),_p(zp,Lp,Wp,"⋙","\\ggg",!0),_p(zp,Lp,Wp,"≷","\\gtrless",!0),_p(zp,Lp,Wp,"⋛","\\gtreqless",!0),_p(zp,Lp,Wp,"⪌","\\gtreqqless",!0),_p(zp,Lp,Wp,"≖","\\eqcirc",!0),_p(zp,Lp,Wp,"≗","\\circeq",!0),_p(zp,Lp,Wp,"≜","\\triangleq",!0),_p(zp,Lp,Wp,"∼","\\thicksim"),_p(zp,Lp,Wp,"≈","\\thickapprox"),_p(zp,Lp,Wp,"⫆","\\supseteqq",!0),_p(zp,Lp,Wp,"⋑","\\Supset",!0),_p(zp,Lp,Wp,"⊐","\\sqsupset",!0),_p(zp,Lp,Wp,"≽","\\succcurlyeq",!0),_p(zp,Lp,Wp,"⋟","\\curlyeqsucc",!0),_p(zp,Lp,Wp,"≿","\\succsim",!0),_p(zp,Lp,Wp,"⪸","\\succapprox",!0),_p(zp,Lp,Wp,"⊳","\\vartriangleright"),_p(zp,Lp,Wp,"⊵","\\trianglerighteq"),_p(zp,Lp,Wp,"⊩","\\Vdash",!0),_p(zp,Lp,Wp,"∣","\\shortmid"),_p(zp,Lp,Wp,"∥","\\shortparallel"),_p(zp,Lp,Wp,"≬","\\between",!0),_p(zp,Lp,Wp,"⋔","\\pitchfork",!0),_p(zp,Lp,Wp,"∝","\\varpropto"),_p(zp,Lp,Wp,"◀","\\blacktriangleleft"),_p(zp,Lp,Wp,"∴","\\therefore",!0),_p(zp,Lp,Wp,"∍","\\backepsilon"),_p(zp,Lp,Wp,"▶","\\blacktriangleright"),_p(zp,Lp,Wp,"∵","\\because",!0),_p(zp,Lp,Wp,"⋘","\\llless"),_p(zp,Lp,Wp,"⋙","\\gggtr"),_p(zp,Lp,Bp,"⊲","\\lhd"),_p(zp,Lp,Bp,"⊳","\\rhd"),_p(zp,Lp,Wp,"≂","\\eqsim",!0),_p(zp,Op,Wp,"⋈","\\Join"),_p(zp,Lp,Wp,"≑","\\Doteq",!0),_p(zp,Lp,Bp,"∔","\\dotplus",!0),_p(zp,Lp,Bp,"∖","\\smallsetminus"),_p(zp,Lp,Bp,"⋒","\\Cap",!0),_p(zp,Lp,Bp,"⋓","\\Cup",!0),_p(zp,Lp,Bp,"⩞","\\doublebarwedge",!0),_p(zp,Lp,Bp,"⊟","\\boxminus",!0),_p(zp,Lp,Bp,"⊞","\\boxplus",!0),_p(zp,Lp,Bp,"⋇","\\divideontimes",!0),_p(zp,Lp,Bp,"⋉","\\ltimes",!0),_p(zp,Lp,Bp,"⋊","\\rtimes",!0),_p(zp,Lp,Bp,"⋋","\\leftthreetimes",!0),_p(zp,Lp,Bp,"⋌","\\rightthreetimes",!0),_p(zp,Lp,Bp,"⋏","\\curlywedge",!0),_p(zp,Lp,Bp,"⋎","\\curlyvee",!0),_p(zp,Lp,Bp,"⊝","\\circleddash",!0),_p(zp,Lp,Bp,"⊛","\\circledast",!0),_p(zp,Lp,Bp,"⋅","\\centerdot"),_p(zp,Lp,Bp,"⊺","\\intercal",!0),_p(zp,Lp,Bp,"⋒","\\doublecap"),_p(zp,Lp,Bp,"⋓","\\doublecup"),_p(zp,Lp,Bp,"⊠","\\boxtimes",!0),_p(zp,Lp,Wp,"⇢","\\dashrightarrow",!0),_p(zp,Lp,Wp,"⇠","\\dashleftarrow",!0),_p(zp,Lp,Wp,"⇇","\\leftleftarrows",!0),_p(zp,Lp,Wp,"⇆","\\leftrightarrows",!0),_p(zp,Lp,Wp,"⇚","\\Lleftarrow",!0),_p(zp,Lp,Wp,"↞","\\twoheadleftarrow",!0),_p(zp,Lp,Wp,"↢","\\leftarrowtail",!0),_p(zp,Lp,Wp,"↫","\\looparrowleft",!0),_p(zp,Lp,Wp,"⇋","\\leftrightharpoons",!0),_p(zp,Lp,Wp,"↶","\\curvearrowleft",!0),_p(zp,Lp,Wp,"↺","\\circlearrowleft",!0),_p(zp,Lp,Wp,"↰","\\Lsh",!0),_p(zp,Lp,Wp,"⇈","\\upuparrows",!0),_p(zp,Lp,Wp,"↿","\\upharpoonleft",!0),_p(zp,Lp,Wp,"⇃","\\downharpoonleft",!0),_p(zp,Op,Wp,"⊶","\\origof",!0),_p(zp,Op,Wp,"⊷","\\imageof",!0),_p(zp,Lp,Wp,"⊸","\\multimap",!0),_p(zp,Lp,Wp,"↭","\\leftrightsquigarrow",!0),_p(zp,Lp,Wp,"⇉","\\rightrightarrows",!0),_p(zp,Lp,Wp,"⇄","\\rightleftarrows",!0),_p(zp,Lp,Wp,"↠","\\twoheadrightarrow",!0),_p(zp,Lp,Wp,"↣","\\rightarrowtail",!0),_p(zp,Lp,Wp,"↬","\\looparrowright",!0),_p(zp,Lp,Wp,"↷","\\curvearrowright",!0),_p(zp,Lp,Wp,"↻","\\circlearrowright",!0),_p(zp,Lp,Wp,"↱","\\Rsh",!0),_p(zp,Lp,Wp,"⇊","\\downdownarrows",!0),_p(zp,Lp,Wp,"↾","\\upharpoonright",!0),_p(zp,Lp,Wp,"⇂","\\downharpoonright",!0),_p(zp,Lp,Wp,"⇝","\\rightsquigarrow",!0),_p(zp,Lp,Wp,"⇝","\\leadsto"),_p(zp,Lp,Wp,"⇛","\\Rrightarrow",!0),_p(zp,Lp,Wp,"↾","\\restriction"),_p(zp,Op,Yp,"‘","`"),_p(zp,Op,Yp,"$","\\$"),_p(Pp,Op,Yp,"$","\\$"),_p(Pp,Op,Yp,"$","\\textdollar"),_p(zp,Op,Yp,"%","\\%"),_p(Pp,Op,Yp,"%","\\%"),_p(zp,Op,Yp,"_","\\_"),_p(Pp,Op,Yp,"_","\\_"),_p(Pp,Op,Yp,"_","\\textunderscore"),_p(zp,Op,Yp,"∠","\\angle",!0),_p(zp,Op,Yp,"∞","\\infty",!0),_p(zp,Op,Yp,"′","\\prime"),_p(zp,Op,Yp,"△","\\triangle"),_p(zp,Op,Yp,"Γ","\\Gamma",!0),_p(zp,Op,Yp,"Δ","\\Delta",!0),_p(zp,Op,Yp,"Θ","\\Theta",!0),_p(zp,Op,Yp,"Λ","\\Lambda",!0),_p(zp,Op,Yp,"Ξ","\\Xi",!0),_p(zp,Op,Yp,"Π","\\Pi",!0),_p(zp,Op,Yp,"Σ","\\Sigma",!0),_p(zp,Op,Yp,"Υ","\\Upsilon",!0),_p(zp,Op,Yp,"Φ","\\Phi",!0),_p(zp,Op,Yp,"Ψ","\\Psi",!0),_p(zp,Op,Yp,"Ω","\\Omega",!0),_p(zp,Op,Yp,"A","Α"),_p(zp,Op,Yp,"B","Β"),_p(zp,Op,Yp,"E","Ε"),_p(zp,Op,Yp,"Z","Ζ"),_p(zp,Op,Yp,"H","Η"),_p(zp,Op,Yp,"I","Ι"),_p(zp,Op,Yp,"K","Κ"),_p(zp,Op,Yp,"M","Μ"),_p(zp,Op,Yp,"N","Ν"),_p(zp,Op,Yp,"O","Ο"),_p(zp,Op,Yp,"P","Ρ"),_p(zp,Op,Yp,"T","Τ"),_p(zp,Op,Yp,"X","Χ"),_p(zp,Op,Yp,"¬","\\neg",!0),_p(zp,Op,Yp,"¬","\\lnot"),_p(zp,Op,Yp,"⊤","\\top"),_p(zp,Op,Yp,"⊥","\\bot"),_p(zp,Op,Yp,"∅","\\emptyset"),_p(zp,Lp,Yp,"∅","\\varnothing"),_p(zp,Op,$p,"α","\\alpha",!0),_p(zp,Op,$p,"β","\\beta",!0),_p(zp,Op,$p,"γ","\\gamma",!0),_p(zp,Op,$p,"δ","\\delta",!0),_p(zp,Op,$p,"ϵ","\\epsilon",!0),_p(zp,Op,$p,"ζ","\\zeta",!0),_p(zp,Op,$p,"η","\\eta",!0),_p(zp,Op,$p,"θ","\\theta",!0),_p(zp,Op,$p,"ι","\\iota",!0),_p(zp,Op,$p,"κ","\\kappa",!0),_p(zp,Op,$p,"λ","\\lambda",!0),_p(zp,Op,$p,"μ","\\mu",!0),_p(zp,Op,$p,"ν","\\nu",!0),_p(zp,Op,$p,"ξ","\\xi",!0),_p(zp,Op,$p,"ο","\\omicron",!0),_p(zp,Op,$p,"π","\\pi",!0),_p(zp,Op,$p,"ρ","\\rho",!0),_p(zp,Op,$p,"σ","\\sigma",!0),_p(zp,Op,$p,"τ","\\tau",!0),_p(zp,Op,$p,"υ","\\upsilon",!0),_p(zp,Op,$p,"ϕ","\\phi",!0),_p(zp,Op,$p,"χ","\\chi",!0),_p(zp,Op,$p,"ψ","\\psi",!0),_p(zp,Op,$p,"ω","\\omega",!0),_p(zp,Op,$p,"ε","\\varepsilon",!0),_p(zp,Op,$p,"ϑ","\\vartheta",!0),_p(zp,Op,$p,"ϖ","\\varpi",!0),_p(zp,Op,$p,"ϱ","\\varrho",!0),_p(zp,Op,$p,"ς","\\varsigma",!0),_p(zp,Op,$p,"φ","\\varphi",!0),_p(zp,Op,Bp,"∗","*",!0),_p(zp,Op,Bp,"+","+"),_p(zp,Op,Bp,"−","-",!0),_p(zp,Op,Bp,"⋅","\\cdot",!0),_p(zp,Op,Bp,"∘","\\circ",!0),_p(zp,Op,Bp,"÷","\\div",!0),_p(zp,Op,Bp,"±","\\pm",!0),_p(zp,Op,Bp,"×","\\times",!0),_p(zp,Op,Bp,"∩","\\cap",!0),_p(zp,Op,Bp,"∪","\\cup",!0),_p(zp,Op,Bp,"∖","\\setminus",!0),_p(zp,Op,Bp,"∧","\\land"),_p(zp,Op,Bp,"∨","\\lor"),_p(zp,Op,Bp,"∧","\\wedge",!0),_p(zp,Op,Bp,"∨","\\vee",!0),_p(zp,Op,Yp,"√","\\surd"),_p(zp,Op,Up,"⟨","\\langle",!0),_p(zp,Op,Up,"∣","\\lvert"),_p(zp,Op,Up,"∥","\\lVert"),_p(zp,Op,Hp,"?","?"),_p(zp,Op,Hp,"!","!"),_p(zp,Op,Hp,"⟩","\\rangle",!0),_p(zp,Op,Hp,"∣","\\rvert"),_p(zp,Op,Hp,"∥","\\rVert"),_p(zp,Op,Wp,"=","="),_p(zp,Op,Wp,":",":"),_p(zp,Op,Wp,"≈","\\approx",!0),_p(zp,Op,Wp,"≅","\\cong",!0),_p(zp,Op,Wp,"≥","\\ge"),_p(zp,Op,Wp,"≥","\\geq",!0),_p(zp,Op,Wp,"←","\\gets"),_p(zp,Op,Wp,">","\\gt",!0),_p(zp,Op,Wp,"∈","\\in",!0),_p(zp,Op,Wp,"","\\@not"),_p(zp,Op,Wp,"⊂","\\subset",!0),_p(zp,Op,Wp,"⊃","\\supset",!0),_p(zp,Op,Wp,"⊆","\\subseteq",!0),_p(zp,Op,Wp,"⊇","\\supseteq",!0),_p(zp,Lp,Wp,"⊈","\\nsubseteq",!0),_p(zp,Lp,Wp,"⊉","\\nsupseteq",!0),_p(zp,Op,Wp,"⊨","\\models"),_p(zp,Op,Wp,"←","\\leftarrow",!0),_p(zp,Op,Wp,"≤","\\le"),_p(zp,Op,Wp,"≤","\\leq",!0),_p(zp,Op,Wp,"<","\\lt",!0),_p(zp,Op,Wp,"→","\\rightarrow",!0),_p(zp,Op,Wp,"→","\\to"),_p(zp,Lp,Wp,"≱","\\ngeq",!0),_p(zp,Lp,Wp,"≰","\\nleq",!0),_p(zp,Op,Kp," ","\\ "),_p(zp,Op,Kp," ","\\space"),_p(zp,Op,Kp," ","\\nobreakspace"),_p(Pp,Op,Kp," ","\\ "),_p(Pp,Op,Kp," "," "),_p(Pp,Op,Kp," ","\\space"),_p(Pp,Op,Kp," ","\\nobreakspace"),_p(zp,Op,Kp,"","\\nobreak"),_p(zp,Op,Kp,"","\\allowbreak"),_p(zp,Op,Gp,",",","),_p(zp,Op,Gp,";",";"),_p(zp,Lp,Bp,"⊼","\\barwedge",!0),_p(zp,Lp,Bp,"⊻","\\veebar",!0),_p(zp,Op,Bp,"⊙","\\odot",!0),_p(zp,Op,Bp,"⊕","\\oplus",!0),_p(zp,Op,Bp,"⊗","\\otimes",!0),_p(zp,Op,Yp,"∂","\\partial",!0),_p(zp,Op,Bp,"⊘","\\oslash",!0),_p(zp,Lp,Bp,"⊚","\\circledcirc",!0),_p(zp,Lp,Bp,"⊡","\\boxdot",!0),_p(zp,Op,Bp,"△","\\bigtriangleup"),_p(zp,Op,Bp,"▽","\\bigtriangledown"),_p(zp,Op,Bp,"†","\\dagger"),_p(zp,Op,Bp,"⋄","\\diamond"),_p(zp,Op,Bp,"⋆","\\star"),_p(zp,Op,Bp,"◃","\\triangleleft"),_p(zp,Op,Bp,"▹","\\triangleright"),_p(zp,Op,Up,"{","\\{"),_p(Pp,Op,Yp,"{","\\{"),_p(Pp,Op,Yp,"{","\\textbraceleft"),_p(zp,Op,Hp,"}","\\}"),_p(Pp,Op,Yp,"}","\\}"),_p(Pp,Op,Yp,"}","\\textbraceright"),_p(zp,Op,Up,"{","\\lbrace"),_p(zp,Op,Hp,"}","\\rbrace"),_p(zp,Op,Up,"[","\\lbrack",!0),_p(Pp,Op,Yp,"[","\\lbrack",!0),_p(zp,Op,Hp,"]","\\rbrack",!0),_p(Pp,Op,Yp,"]","\\rbrack",!0),_p(zp,Op,Up,"(","\\lparen",!0),_p(zp,Op,Hp,")","\\rparen",!0),_p(Pp,Op,Yp,"<","\\textless",!0),_p(Pp,Op,Yp,">","\\textgreater",!0),_p(zp,Op,Up,"⌊","\\lfloor",!0),_p(zp,Op,Hp,"⌋","\\rfloor",!0),_p(zp,Op,Up,"⌈","\\lceil",!0),_p(zp,Op,Hp,"⌉","\\rceil",!0),_p(zp,Op,Yp,"\\","\\backslash"),_p(zp,Op,Yp,"∣","|"),_p(zp,Op,Yp,"∣","\\vert"),_p(Pp,Op,Yp,"|","\\textbar",!0),_p(zp,Op,Yp,"∥","\\|"),_p(zp,Op,Yp,"∥","\\Vert"),_p(Pp,Op,Yp,"∥","\\textbardbl"),_p(Pp,Op,Yp,"~","\\textasciitilde"),_p(Pp,Op,Yp,"\\","\\textbackslash"),_p(Pp,Op,Yp,"^","\\textasciicircum"),_p(zp,Op,Wp,"↑","\\uparrow",!0),_p(zp,Op,Wp,"⇑","\\Uparrow",!0),_p(zp,Op,Wp,"↓","\\downarrow",!0),_p(zp,Op,Wp,"⇓","\\Downarrow",!0),_p(zp,Op,Wp,"↕","\\updownarrow",!0),_p(zp,Op,Wp,"⇕","\\Updownarrow",!0),_p(zp,Op,qp,"∐","\\coprod"),_p(zp,Op,qp,"⋁","\\bigvee"),_p(zp,Op,qp,"⋀","\\bigwedge"),_p(zp,Op,qp,"⨄","\\biguplus"),_p(zp,Op,qp,"⋂","\\bigcap"),_p(zp,Op,qp,"⋃","\\bigcup"),_p(zp,Op,qp,"∫","\\int"),_p(zp,Op,qp,"∫","\\intop"),_p(zp,Op,qp,"∬","\\iint"),_p(zp,Op,qp,"∭","\\iiint"),_p(zp,Op,qp,"∏","\\prod"),_p(zp,Op,qp,"∑","\\sum"),_p(zp,Op,qp,"⨂","\\bigotimes"),_p(zp,Op,qp,"⨁","\\bigoplus"),_p(zp,Op,qp,"⨀","\\bigodot"),_p(zp,Op,qp,"∮","\\oint"),_p(zp,Op,qp,"∯","\\oiint"),_p(zp,Op,qp,"∰","\\oiiint"),_p(zp,Op,qp,"⨆","\\bigsqcup"),_p(zp,Op,qp,"∫","\\smallint"),_p(Pp,Op,Vp,"…","\\textellipsis"),_p(zp,Op,Vp,"…","\\mathellipsis"),_p(Pp,Op,Vp,"…","\\ldots",!0),_p(zp,Op,Vp,"…","\\ldots",!0),_p(zp,Op,Vp,"⋯","\\@cdots",!0),_p(zp,Op,Vp,"⋱","\\ddots",!0),_p(zp,Op,Yp,"⋮","\\varvdots"),_p(Pp,Op,Yp,"⋮","\\varvdots"),_p(zp,Op,Fp,"ˊ","\\acute"),_p(zp,Op,Fp,"ˋ","\\grave"),_p(zp,Op,Fp,"¨","\\ddot"),_p(zp,Op,Fp,"~","\\tilde"),_p(zp,Op,Fp,"ˉ","\\bar"),_p(zp,Op,Fp,"˘","\\breve"),_p(zp,Op,Fp,"ˇ","\\check"),_p(zp,Op,Fp,"^","\\hat"),_p(zp,Op,Fp,"⃗","\\vec"),_p(zp,Op,Fp,"˙","\\dot"),_p(zp,Op,Fp,"˚","\\mathring"),_p(zp,Op,$p,"","\\@imath"),_p(zp,Op,$p,"","\\@jmath"),_p(zp,Op,Yp,"ı","ı"),_p(zp,Op,Yp,"ȷ","ȷ"),_p(Pp,Op,Yp,"ı","\\i",!0),_p(Pp,Op,Yp,"ȷ","\\j",!0),_p(Pp,Op,Yp,"ß","\\ss",!0),_p(Pp,Op,Yp,"æ","\\ae",!0),_p(Pp,Op,Yp,"œ","\\oe",!0),_p(Pp,Op,Yp,"ø","\\o",!0),_p(Pp,Op,Yp,"Æ","\\AE",!0),_p(Pp,Op,Yp,"Œ","\\OE",!0),_p(Pp,Op,Yp,"Ø","\\O",!0),_p(Pp,Op,Fp,"ˊ","\\'"),_p(Pp,Op,Fp,"ˋ","\\`"),_p(Pp,Op,Fp,"ˆ","\\^"),_p(Pp,Op,Fp,"˜","\\~"),_p(Pp,Op,Fp,"ˉ","\\="),_p(Pp,Op,Fp,"˘","\\u"),_p(Pp,Op,Fp,"˙","\\."),_p(Pp,Op,Fp,"¸","\\c"),_p(Pp,Op,Fp,"˚","\\r"),_p(Pp,Op,Fp,"ˇ","\\v"),_p(Pp,Op,Fp,"¨",'\\"'),_p(Pp,Op,Fp,"˝","\\H"),_p(Pp,Op,Fp,"◯","\\textcircled");var Xp={"--":!0,"---":!0,"``":!0,"''":!0};_p(Pp,Op,Yp,"–","--",!0),_p(Pp,Op,Yp,"–","\\textendash"),_p(Pp,Op,Yp,"—","---",!0),_p(Pp,Op,Yp,"—","\\textemdash"),_p(Pp,Op,Yp,"‘","`",!0),_p(Pp,Op,Yp,"‘","\\textquoteleft"),_p(Pp,Op,Yp,"’","'",!0),_p(Pp,Op,Yp,"’","\\textquoteright"),_p(Pp,Op,Yp,"“","``",!0),_p(Pp,Op,Yp,"“","\\textquotedblleft"),_p(Pp,Op,Yp,"”","''",!0),_p(Pp,Op,Yp,"”","\\textquotedblright"),_p(zp,Op,Yp,"°","\\degree",!0),_p(Pp,Op,Yp,"°","\\degree"),_p(Pp,Op,Yp,"°","\\textdegree",!0),_p(zp,Op,Yp,"£","\\pounds"),_p(zp,Op,Yp,"£","\\mathsterling",!0),_p(Pp,Op,Yp,"£","\\pounds"),_p(Pp,Op,Yp,"£","\\textsterling",!0),_p(zp,Lp,Yp,"✠","\\maltese"),_p(Pp,Lp,Yp,"✠","\\maltese");for(var Zp='0123456789/@."',Jp=0;Jp<14;Jp++){var Qp=Zp.charAt(Jp);_p(zp,Op,Yp,Qp,Qp)}for(var ef='0123456789!@*()-=+";:?/.,',tf=0;tf<25;tf++){var nf=ef.charAt(tf);_p(Pp,Op,Yp,nf,nf)}for(var rf,af="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",sf=0;sf<52;sf++){var of=af.charAt(sf);_p(zp,Op,$p,of,of),_p(Pp,Op,Yp,of,of)}_p(zp,Lp,Yp,"C","ℂ"),_p(Pp,Lp,Yp,"C","ℂ"),_p(zp,Lp,Yp,"H","ℍ"),_p(Pp,Lp,Yp,"H","ℍ"),_p(zp,Lp,Yp,"N","ℕ"),_p(Pp,Lp,Yp,"N","ℕ"),_p(zp,Lp,Yp,"P","ℙ"),_p(Pp,Lp,Yp,"P","ℙ"),_p(zp,Lp,Yp,"Q","ℚ"),_p(Pp,Lp,Yp,"Q","ℚ"),_p(zp,Lp,Yp,"R","ℝ"),_p(Pp,Lp,Yp,"R","ℝ"),_p(zp,Lp,Yp,"Z","ℤ"),_p(Pp,Lp,Yp,"Z","ℤ"),_p(zp,Op,$p,"h","ℎ"),_p(Pp,Op,$p,"h","ℎ");for(var lf=0;lf<52;lf++){var cf=af.charAt(lf);_p(zp,Op,$p,cf,rf=String.fromCharCode(55349,56320+lf)),_p(Pp,Op,Yp,cf,rf),_p(zp,Op,$p,cf,rf=String.fromCharCode(55349,56372+lf)),_p(Pp,Op,Yp,cf,rf),_p(zp,Op,$p,cf,rf=String.fromCharCode(55349,56424+lf)),_p(Pp,Op,Yp,cf,rf),_p(zp,Op,$p,cf,rf=String.fromCharCode(55349,56580+lf)),_p(Pp,Op,Yp,cf,rf),_p(zp,Op,$p,cf,rf=String.fromCharCode(55349,56684+lf)),_p(Pp,Op,Yp,cf,rf),_p(zp,Op,$p,cf,rf=String.fromCharCode(55349,56736+lf)),_p(Pp,Op,Yp,cf,rf),_p(zp,Op,$p,cf,rf=String.fromCharCode(55349,56788+lf)),_p(Pp,Op,Yp,cf,rf),_p(zp,Op,$p,cf,rf=String.fromCharCode(55349,56840+lf)),_p(Pp,Op,Yp,cf,rf),_p(zp,Op,$p,cf,rf=String.fromCharCode(55349,56944+lf)),_p(Pp,Op,Yp,cf,rf),lf<26&&(_p(zp,Op,$p,cf,rf=String.fromCharCode(55349,56632+lf)),_p(Pp,Op,Yp,cf,rf),_p(zp,Op,$p,cf,rf=String.fromCharCode(55349,56476+lf)),_p(Pp,Op,Yp,cf,rf))}_p(zp,Op,$p,"k",rf=String.fromCharCode(55349,56668)),_p(Pp,Op,Yp,"k",rf);for(var df=0;df<10;df++){var uf=df.toString();_p(zp,Op,$p,uf,rf=String.fromCharCode(55349,57294+df)),_p(Pp,Op,Yp,uf,rf),_p(zp,Op,$p,uf,rf=String.fromCharCode(55349,57314+df)),_p(Pp,Op,Yp,uf,rf),_p(zp,Op,$p,uf,rf=String.fromCharCode(55349,57324+df)),_p(Pp,Op,Yp,uf,rf),_p(zp,Op,$p,uf,rf=String.fromCharCode(55349,57334+df)),_p(Pp,Op,Yp,uf,rf)}for(var hf="ÐÞþ",mf=0;mf<3;mf++){var pf=hf.charAt(mf);_p(zp,Op,$p,pf,pf),_p(Pp,Op,Yp,pf,pf)}var ff={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},gf={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},xf={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},vf={mathClass:"",textClass:"",font:""},yf={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},bf={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},wf={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},Sf={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},jf={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},kf={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},Cf={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},Nf=[ff,ff,gf,gf,xf,xf,{mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},vf,vf,vf,yf,yf,bf,bf,wf,wf,Sf,Sf,jf,jf,kf,kf,vf,vf,Cf,Cf],Tf=[ff,vf,Sf,jf,Cf],Mf=function(e,t,n){if(Dp[n][e]){var r=Dp[n][e].replace;r&&(e=r)}return{value:e,metrics:Rp(e,t,n)}},Ef=function(e,t,n,r,a){var s,o=Mf(e,t,n),i=o.metrics;if(e=o.value,i){var l=i.italic;("text"===n||r&&"mathit"===r.font)&&(l=0),s=new kp(e,i.height,i.depth,l,i.skew,i.width,a)}else s=new kp(e,0,0,0,0,0,a);if(r){s.maxFontSize=r.sizeMultiplier,r.style.isTight()&&s.classes.push("mtight");var c=r.getColor();c&&(s.style.color=c)}return s},Af=function(e,t,n,r){return void 0===r&&(r=[]),"boldsymbol"===n.font&&Mf(e,"Main-Bold",t).metrics?Ef(e,"Main-Bold",t,n,r.concat(["mathbf"])):"\\"===e||"main"===Dp[t][e].font?Ef(e,"Main-Regular",t,n,r):Ef(e,"AMS-Regular",t,n,r.concat(["amsrm"]))},Rf=function(e,t){var n="mathord"===e.type?"mathord":"textord",r=e.mode,a=e.text,s=["mord"],{font:o,fontFamily:i,fontWeight:l,fontShape:c}=t,d="math"===r||"text"===r&&!!o,u=d?o:i,h="",m="";if(55349===a.charCodeAt(0)){var p=(e=>{var t=1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536;if(119808<=t&&t<120484)return Nf[Math.floor((t-119808)/26)];if(120782<=t&&t<=120831)return Tf[Math.floor((t-120782)/10)];if(120485===t||120486===t)return Nf[0];if(120486<t&&t<120782)return vf;throw new _m("Unsupported character: "+e)})(a);h=p.font,m=p[r+"Class"]}if(h)return Ef(a,h,r,t,s.concat(m));if(u){var f,g;if("boldsymbol"===u){var x=function(e,t,n){return"textord"!==n&&Mf(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}}(a,r,n);f=x.fontName,g=[x.fontClass]}else d?(f=$f[o].fontName,g=[o]):(f=Vf(i,l,c),g=[i,l,c]);if(Mf(a,f,r).metrics)return Ef(a,f,r,t,s.concat(g));if(Xp.hasOwnProperty(a)&&"Typewriter"===f.slice(0,10)){for(var v=[],y=0;y<a.length;y++)v.push(Ef(a[y],f,r,t,s.concat(g)));return Lf(v)}}if("mathord"===n)return Ef(a,"Math-Italic",r,t,s.concat(["mathnormal"]));if("textord"===n){var b=Dp[r][a]&&Dp[r][a].font;if("ams"===b)return Ef(a,Vf("amsrm",l,c),r,t,s.concat("amsrm",l,c));if("main"!==b&&b){var w=Vf(b,l,c);return Ef(a,w,r,t,s.concat(w,l,c))}return Ef(a,Vf("textrm",l,c),r,t,s.concat(l,c))}throw new Error("unexpected type: "+n+" in makeOrd")},If=(e,t)=>{if(pp(e.classes)!==pp(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||0!==e.italic&&e.hasClass("mathnormal"))return!1;if(1===e.classes.length){var n=e.classes[0];if("mbin"===n||"mord"===n)return!1}for(var r of Object.keys(e.style))if(e.style[r]!==t.style[r])return!1;for(var a of Object.keys(t.style))if(e.style[a]!==t.style[a])return!1;return!0},Df=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof kp&&r instanceof kp&&If(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,e.splice(t+1,1),t--)}return e},_f=function(e){for(var t=0,n=0,r=0,a=0;a<e.children.length;a++){var s=e.children[a];s.height>t&&(t=s.height),s.depth>n&&(n=s.depth),s.maxFontSize>r&&(r=s.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=r},zf=function(e,t,n,r){var a=new bp(e,t,n,r);return _f(a),a},Pf=(e,t,n,r)=>new bp(e,t,n,r),Of=function(e,t,n){var r=zf([e],[],t);return r.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),r.style.borderBottomWidth=mp(r.height),r.maxFontSize=1,r},Lf=function(e){var t=new lp(e);return _f(t),t},Ff=function(e,t){return e instanceof lp?zf([],[e],t):e},Bf=function(e,t){for(var{children:n,depth:r}=function(e){if("individualShift"===e.positionType){for(var t=e.children,n=[t[0]],r=-t[0].shift-t[0].elem.depth,a=r,s=1;s<t.length;s++){var o=-t[s].shift-a-t[s].elem.depth,i=o-(t[s-1].elem.height+t[s-1].elem.depth);a+=o,n.push({type:"kern",size:i}),n.push(t[s])}return{children:n,depth:r}}var l;if("top"===e.positionType){for(var c=e.positionData,d=0;d<e.children.length;d++){var u=e.children[d];c-="kern"===u.type?u.size:u.elem.height+u.elem.depth}l=c}else if("bottom"===e.positionType)l=-e.positionData;else{var h=e.children[0];if("elem"!==h.type)throw new Error('First child must have type "elem".');if("shift"===e.positionType)l=-h.elem.depth-e.positionData;else{if("firstBaseline"!==e.positionType)throw new Error("Invalid positionType "+e.positionType+".");l=-h.elem.depth}}return{children:e.children,depth:l}}(e),a=0,s=0;s<n.length;s++){var o=n[s];if("elem"===o.type){var i=o.elem;a=Math.max(a,i.maxFontSize,i.height)}}a+=2;var l=zf(["pstrut"],[]);l.style.height=mp(a);for(var c=[],d=r,u=r,h=r,m=0;m<n.length;m++){var p=n[m];if("kern"===p.type)h+=p.size;else{var f=p.elem,g=p.wrapperClasses||[],x=p.wrapperStyle||{},v=zf(g,[l,f],void 0,x);v.style.top=mp(-a-h-f.depth),p.marginLeft&&(v.style.marginLeft=p.marginLeft),p.marginRight&&(v.style.marginRight=p.marginRight),c.push(v),h+=f.height+f.depth}d=Math.min(d,h),u=Math.max(u,h)}var y,b=zf(["vlist"],c);if(b.style.height=mp(u),d<0){var w=zf(["vlist"],[zf([],[])]);w.style.height=mp(-d),y=[zf(["vlist-r"],[b,zf(["vlist-s"],[new kp("")])]),zf(["vlist-r"],[w])]}else y=[zf(["vlist-r"],[b])];var S=zf(["vlist-t"],y);return 2===y.length&&S.classes.push("vlist-t2"),S.height=u,S.depth=-d,S},Hf=(e,t)=>{var n=zf(["mspace"],[],t),r=hp(e,t);return n.style.marginRight=mp(r),n},Vf=(e,t,n)=>{var r;switch(e){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=e}return r+"-"+("textbf"===t&&"textit"===n?"BoldItalic":"textbf"===t?"Bold":"textit"===n?"Italic":"Regular")},$f={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},qf={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Uf=function(e,t){var[n,r,a]=qf[e],s=new Np(n),o=Pf(["overlay"],[new Cp([s],{width:mp(r),height:mp(a),style:"width:"+mp(r),viewBox:"0 0 "+1e3*r+" "+1e3*a,preserveAspectRatio:"xMinYMin"})],t);return o.height=a,o.style.height=mp(a),o.style.width=mp(r),o},Gf={number:3,unit:"mu"},Wf={number:4,unit:"mu"},Kf={number:5,unit:"mu"},Yf={mord:{mop:Gf,mbin:Wf,mrel:Kf,minner:Gf},mop:{mord:Gf,mop:Gf,mrel:Kf,minner:Gf},mbin:{mord:Wf,mop:Wf,mopen:Wf,minner:Wf},mrel:{mord:Kf,mop:Kf,mopen:Kf,minner:Kf},mopen:{},mclose:{mop:Gf,mbin:Wf,mrel:Kf,minner:Gf},mpunct:{mord:Gf,mop:Gf,mrel:Kf,mopen:Gf,mclose:Gf,mpunct:Gf,minner:Gf},minner:{mord:Gf,mop:Gf,mbin:Wf,mrel:Kf,mopen:Gf,mpunct:Gf,minner:Gf}},Xf={mord:{mop:Gf},mop:{mord:Gf,mop:Gf},mbin:{},mrel:{},mopen:{},mclose:{mop:Gf},mpunct:{},minner:{mop:Gf}},Zf={},Jf={},Qf={};function eg(e){for(var{type:t,names:n,htmlBuilder:r,mathmlBuilder:a}=e,s=0;s<n.length;++s)Zf[n[s]]=e;t&&(r&&(Jf[t]=r),a&&(Qf[t]=a))}function tg(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;n&&(Jf[t]=n),r&&(Qf[t]=r)}var ng=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e},rg=function(e){return"ordgroup"===e.type?e.body:[e]},ag=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),sg=new Set(["rightmost","mrel","mclose","mpunct"]),og={display:tp.DISPLAY,text:tp.TEXT,script:tp.SCRIPT,scriptscript:tp.SCRIPTSCRIPT},ig={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},lg=function(e,t,n,r){void 0===r&&(r=[null,null]);for(var a=[],s=0;s<e.length;s++){var o=pg(e[s],t);if(o instanceof lp){var i=o.children;a.push(...i)}else a.push(o)}if(Df(a),!n)return a;var l=t;if(1===e.length){var c=e[0];"sizing"===c.type?l=t.havingSize(c.size):"styling"===c.type&&(l=t.havingStyle(og[c.style]))}var d=zf([r[0]||"leftmost"],[],t),u=zf([r[1]||"rightmost"],[],t),h="root"===n;return cg(a,(e,t)=>{var n=t.classes[0],r=e.classes[0];"mbin"===n&&sg.has(r)?t.classes[0]="mord":"mbin"===r&&ag.has(n)&&(e.classes[0]="mord")},{node:d},u,h),cg(a,(e,t)=>{var n,r,a=hg(t),s=hg(e),o=a&&s?e.hasClass("mtight")?null==(n=Xf[a])?void 0:n[s]:null==(r=Yf[a])?void 0:r[s]:null;if(o)return Hf(o,l)},{node:d},u,h),a},cg=function(e,t,n,r,a){r&&e.push(r);for(var s=0;s<e.length;s++){var o=e[s],i=dg(o);if(i)cg(i.children,t,n,null,a);else{var l=!o.hasClass("mspace");if(l){var c=t(o,n.node);c&&(n.insertAfter?n.insertAfter(c):(e.unshift(c),s++))}l?n.node=o:a&&o.hasClass("newline")&&(n.node=zf(["leftmost"])),n.insertAfter=(t=>n=>{e.splice(t+1,0,n),s++})(s)}}r&&e.pop()},dg=function(e){return e instanceof lp||e instanceof wp||e instanceof bp&&e.hasClass("enclosing")?e:null},ug=function(e,t){var n=dg(e);if(n){var r=n.children;if(r.length){if("right"===t)return ug(r[r.length-1],"right");if("left"===t)return ug(r[0],"left")}}return e},hg=function(e,t){return e?(t&&(e=ug(e,t)),ig[e.classes[0]]||null):null},mg=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return zf(t.concat(n))},pg=function(e,t,n){if(!e)return zf();if(Jf[e.type]){var r=Jf[e.type](e,t);if(n&&t.size!==n.size){r=zf(t.sizingClasses(n),[r],t);var a=t.sizeMultiplier/n.sizeMultiplier;r.height*=a,r.depth*=a}return r}throw new _m("Got group of unknown type: '"+e.type+"'")};function fg(e,t){var n=zf(["base"],e,t),r=zf(["strut"]);return r.style.height=mp(n.height+n.depth),n.depth&&(r.style.verticalAlign=mp(-n.depth)),n.children.unshift(r),n}function gg(e,t){var n=null;1===e.length&&"tag"===e[0].type&&(n=e[0].tag,e=e[0].body);var r,a=lg(e,t,"root");2===a.length&&a[1].hasClass("tag")&&(r=a.pop());for(var s,o=[],i=[],l=0;l<a.length;l++)if(i.push(a[l]),a[l].hasClass("mbin")||a[l].hasClass("mrel")||a[l].hasClass("allowbreak")){for(var c=!1;l<a.length-1&&a[l+1].hasClass("mspace")&&!a[l+1].hasClass("newline");)l++,i.push(a[l]),a[l].hasClass("nobreak")&&(c=!0);c||(o.push(fg(i,t)),i=[])}else a[l].hasClass("newline")&&(i.pop(),i.length>0&&(o.push(fg(i,t)),i=[]),o.push(a[l]));i.length>0&&o.push(fg(i,t)),n?((s=fg(lg(n,t,!0),t)).classes=["tag"],o.push(s)):r&&o.push(r);var d=zf(["katex-html"],o);if(d.setAttribute("aria-hidden","true"),s){var u=s.children[0];u.style.height=mp(d.height+d.depth),d.depth&&(u.style.verticalAlign=mp(-d.depth))}return d}function xg(e){return new lp(e)}var vg=class{constructor(e,t,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=pp(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof yg&&this.children[n+1]instanceof yg){for(var r=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof yg;)r+=this.children[++n].toText();e.appendChild(new yg(r).toNode())}else e.appendChild(this.children[n].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=Fm(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+Fm(pp(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">"}toText(){return this.children.map(e=>e.toText()).join("")}},yg=class{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Fm(this.toText())}toText(){return this.text}},bg=class{constructor(e){this.width=void 0,this.character=void 0,this.width=e,this.character=e>=.05555&&e<=.05556?" ":e>=.1666&&e<=.1667?" ":e>=.2222&&e<=.2223?" ":e>=.2777&&e<=.2778?" ":e>=-.05556&&e<=-.05555?" ":e>=-.1667&&e<=-.1666?" ":e>=-.2223&&e<=-.2222?" ":e>=-.2778&&e<=-.2777?" ":null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",mp(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+mp(this.width)+'"/>'}toText(){return this.character?this.character:" "}},wg=new Set(["\\imath","\\jmath"]),Sg=new Set(["mrow","mtable"]),jg=function(e,t,n){return!Dp[t][e]||!Dp[t][e].replace||55349===e.charCodeAt(0)||Xp.hasOwnProperty(e)&&n&&(n.fontFamily&&"tt"===n.fontFamily.slice(4,6)||n.font&&"tt"===n.font.slice(4,6))||(e=Dp[t][e].replace),new yg(e)},kg=function(e){return 1===e.length?e[0]:new vg("mrow",e)},Cg={mathit:"italic",boldsymbol:e=>"textord"===e.type?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},Ng=(e,t)=>{if("text"===e.mode){if("texttt"===t.fontFamily)return"monospace";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold"}var n=t.font;if(!n||"mathnormal"===n)return null;var r=e.mode,a=Cg[n];if(a)return"function"==typeof a?a(e):a;var s=e.text;if(wg.has(s))return null;if(Dp[r][s]){var o=Dp[r][s].replace;o&&(s=o)}return Rp(s,$f[n].fontName,r)?$f[n].variant:null};function Tg(e){if(!e)return!1;if("mi"===e.type&&1===e.children.length){var t=e.children[0];return t instanceof yg&&"."===t.text}if("mo"===e.type&&1===e.children.length&&"true"===e.getAttribute("separator")&&"0em"===e.getAttribute("lspace")&&"0em"===e.getAttribute("rspace")){var n=e.children[0];return n instanceof yg&&","===n.text}return!1}var Mg=function(e,t,n){if(1===e.length){var r=Ag(e[0],t);return n&&r instanceof vg&&"mo"===r.type&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var a,s=[],o=0;o<e.length;o++){var i=Ag(e[o],t);if(i instanceof vg&&a instanceof vg){if("mtext"===i.type&&"mtext"===a.type&&i.getAttribute("mathvariant")===a.getAttribute("mathvariant")){a.children.push(...i.children);continue}if("mn"===i.type&&"mn"===a.type){a.children.push(...i.children);continue}if(Tg(i)&&"mn"===a.type){a.children.push(...i.children);continue}if("mn"===i.type&&Tg(a))i.children=[...a.children,...i.children],s.pop();else if(("msup"===i.type||"msub"===i.type)&&i.children.length>=1&&("mn"===a.type||Tg(a))){var l=i.children[0];l instanceof vg&&"mn"===l.type&&(l.children=[...a.children,...l.children],s.pop())}else if("mi"===a.type&&1===a.children.length){var c=a.children[0];if(c instanceof yg&&"̸"===c.text&&("mo"===i.type||"mi"===i.type||"mn"===i.type)){var d=i.children[0];d instanceof yg&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),s.pop())}}}s.push(i),a=i}return s},Eg=function(e,t,n){return kg(Mg(e,t,n))},Ag=function(e,t){if(!e)return new vg("mrow");if(Qf[e.type])return Qf[e.type](e,t);throw new _m("Got group of unknown type: '"+e.type+"'")};function Rg(e,t,n,r,a){var s,o=Mg(e,n);s=1===o.length&&o[0]instanceof vg&&Sg.has(o[0].type)?o[0]:new vg("mrow",o);var i=new vg("annotation",[new yg(t)]);i.setAttribute("encoding","application/x-tex");var l=new vg("semantics",[s,i]),c=new vg("math",[l]);return c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block"),zf([a?"katex":"katex-mathml"],[c])}var Ig=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Dg=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],_g=function(e,t){return t.size<2?e:Ig[e-1][t.size-1]},zg=class e{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||e.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=Dg[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(n,t),new e(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:_g(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Dg[e-1]})}havingBaseStyle(t){t=t||this.style.text();var n=_g(e.BASESIZE,t);return this.size===n&&this.textSize===e.BASESIZE&&this.style===t?this:this.extend({style:t,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==e.BASESIZE?["sizing","reset-size"+this.size,"size"+e.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=function(e){var t;if(!Ip[t=e>=5?0:e>=3?1:2]){var n=Ip[t]={cssEmPerMu:Ep.quad[t]/18};for(var r in Ep)Ep.hasOwnProperty(r)&&(n[r]=Ep[r][t])}return Ip[t]}(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}};zg.BASESIZE=6;var Pg=function(e){return new zg({style:e.displayMode?tp.DISPLAY:tp.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Og=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=zf(n,[e])}return e},Lg={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Fg=function(e){var t=new vg("mo",[new yg(Lg[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},Bg={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Hg=new Set(["widehat","widecheck","widetilde","utilde"]),Vg=function(e,t){var{span:n,minWidth:r,height:a}=function(){var n=4e5,r=e.label.slice(1);if(Hg.has(r)&&"base"in e){var a,s,o,i="ordgroup"===e.base.type?e.base.body.length:1;if(i>5)"widehat"===r||"widecheck"===r?(a=420,n=2364,o=.42,s=r+"4"):(a=312,n=2340,o=.34,s="tilde4");else{var l=[1,1,2,2,3,3][i];"widehat"===r||"widecheck"===r?(n=[0,1062,2364,2364,2364][l],a=[0,239,300,360,420][l],o=[0,.24,.3,.3,.36,.42][l],s=r+l):(n=[0,600,1033,2339,2340][l],a=[0,260,286,306,312][l],o=[0,.26,.286,.3,.306,.34][l],s="tilde"+l)}var c=new Np(s);return{span:Pf([],[new Cp([c],{width:"100%",height:mp(o),viewBox:"0 0 "+n+" "+a,preserveAspectRatio:"none"})],t),minWidth:0,height:o}}var d=[],u=Bg[r];if(!u)throw new Error('No SVG data for "'+r+'".');var h,m,[p,f,g]=u,x=g/1e3,v=p.length;if(1===v){if(4!==u.length)throw new Error('Expected 4-tuple for single-path SVG data "'+r+'".');h=["hide-tail"],m=[u[3]]}else if(2===v)h=["halfarrow-left","halfarrow-right"],m=["xMinYMin","xMaxYMin"];else{if(3!==v)throw new Error("Correct katexImagesData or update code here to support\n "+v+" children.");h=["brace-left","brace-center","brace-right"],m=["xMinYMin","xMidYMin","xMaxYMin"]}for(var y=0;y<v;y++){var b=new Np(p[y]),w=new Cp([b],{width:"400em",height:mp(x),viewBox:"0 0 "+n+" "+g,preserveAspectRatio:m[y]+" slice"}),S=Pf([h[y]],[w],t);if(1===v)return{span:S,minWidth:f,height:x};S.style.height=mp(x),d.push(S)}return{span:zf(["stretchy"],d,t),minWidth:f,height:x}}();return n.height=a,n.style.height=mp(a),r>0&&(n.style.minWidth=mp(r)),n},$g={bin:1,close:1,inner:1,open:1,punct:1,rel:1},qg={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function Ug(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function Gg(e){var t=Wg(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function Wg(e){return e&&("atom"===e.type||qg.hasOwnProperty(e.type))?e:null}var Kg=e=>{return e instanceof kp?e:((t=e)instanceof bp||t instanceof wp||t instanceof lp)&&1===e.children.length?Kg(e.children[0]):void 0;var t},Yg=(e,t)=>{var n,r,a;e&&"supsub"===e.type?(n=(r=Ug(e.base,"accent")).base,e.base=n,a=function(e){if(e instanceof bp)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}(pg(e,t)),e.base=r):n=(r=Ug(e,"accent")).base;var s,o,i=pg(n,t.havingCrampedStyle()),l=0;r.isShifty&&Vm(n)&&(l=null!=(s=null==(o=Kg(i))?void 0:o.skew)?s:0);var c,d="\\c"===r.label,u=d?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight);if(r.isStretchy)c=Vg(r,t),c=Bf({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:c,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+mp(2*l)+")",marginLeft:mp(2*l)}:void 0}]});else{var h,m;"\\vec"===r.label?(h=Uf("vec",t),m=qf.vec[1]):(h=function(e){if(e instanceof kp)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}(h=Rf({type:"textord",mode:r.mode,text:r.label},t)),h.italic=0,m=h.width,d&&(u+=h.depth)),c=zf(["accent-body"],[h]);var p="\\textcircled"===r.label;p&&(c.classes.push("accent-full"),u=i.height);var f=l;p||(f-=m/2),c.style.left=mp(f),"\\textcircled"===r.label&&(c.style.top=".2em"),c=Bf({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-u},{type:"elem",elem:c}]})}var g=zf(["mord","accent"],[c],t);return a?(a.children[0]=g,a.height=Math.max(g.height,a.height),a.classes[0]="mord",a):g},Xg=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));eg({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],numArgs:1,handler:(e,t)=>{var n=ng(t[0]),r=!Xg.test(e.funcName),a=!r||"\\widehat"===e.funcName||"\\widetilde"===e.funcName||"\\widecheck"===e.funcName;return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:a,base:n}},htmlBuilder:Yg,mathmlBuilder:(e,t)=>{var n=e.isStretchy?Fg(e.label):new vg("mo",[jg(e.label,e.mode)]),r=new vg("mover",[Ag(e.base,t),n]);return r.setAttribute("accent","true"),r}}),eg({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"],handler:(e,t)=>{var n=t[0],r=e.parser.mode;return"math"===r&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}}}),eg({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],numArgs:1,handler:(e,t)=>{var{parser:n,funcName:r}=e,a=t[0];return{type:"accentUnder",mode:n.mode,label:r,base:a}},htmlBuilder:(e,t)=>{var n=pg(e.base,t),r=Vg(e,t),a="\\utilde"===e.label?.12:0;return zf(["mord","accentunder"],[Bf({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:a},{type:"elem",elem:n}]})],t)},mathmlBuilder:(e,t)=>{var n=Fg(e.label),r=new vg("munder",[Ag(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var Zg=e=>{var t=new vg("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};eg({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],numArgs:1,numOptionalArgs:1,handler(e,t,n){var{parser:r,funcName:a}=e;return{type:"xArrow",mode:r.mode,label:a,body:t[0],below:n[0]}},htmlBuilder(e,t){var n,r=t.style,a=t.havingStyle(r.sup()),s=Ff(pg(e.body,a,t),t),o="\\x"===e.label.slice(0,2)?"x":"cd";s.classes.push(o+"-arrow-pad"),e.below&&(a=t.havingStyle(r.sub()),(n=Ff(pg(e.below,a,t),t)).classes.push(o+"-arrow-pad"));var i,l=Vg(e,t),c=-t.fontMetrics().axisHeight+.5*l.height,d=-t.fontMetrics().axisHeight-.5*l.height-.111;if((s.depth>.25||"\\xleftequilibrium"===e.label)&&(d-=s.depth),n){var u=-t.fontMetrics().axisHeight+n.height+.5*l.height+.111;i=Bf({positionType:"individualShift",children:[{type:"elem",elem:s,shift:d},{type:"elem",elem:l,shift:c,wrapperClasses:["svg-align"]},{type:"elem",elem:n,shift:u}]})}else i=Bf({positionType:"individualShift",children:[{type:"elem",elem:s,shift:d},{type:"elem",elem:l,shift:c,wrapperClasses:["svg-align"]}]});return zf(["mrel","x-arrow"],[i],t)},mathmlBuilder(e,t){var n,r=Fg(e.label);if(r.setAttribute("minsize","x"===e.label.charAt(0)?"1.75em":"3.0em"),e.body){var a=Zg(Ag(e.body,t));if(e.below){var s=Zg(Ag(e.below,t));n=new vg("munderover",[r,s,a])}else n=new vg("mover",[r,a])}else if(e.below){var o=Zg(Ag(e.below,t));n=new vg("munder",[r,o])}else n=Zg(),n=new vg("mover",[r,n]);return n}}),eg({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],numArgs:1,primitive:!0,handler(e,t){var{parser:n,funcName:r}=e,a=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:rg(a),isCharacterBox:Vm(a)}},htmlBuilder:function(e,t){var n=lg(e.body,t,!0);return zf([e.mclass],n,t)},mathmlBuilder:function(e,t){var n,r=Mg(e.body,t);return"minner"===e.mclass?n=new vg("mpadded",r):"mord"===e.mclass?e.isCharacterBox?(n=r[0]).type="mi":n=new vg("mi",r):(e.isCharacterBox?(n=r[0]).type="mo":n=new vg("mo",r),"mbin"===e.mclass?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):"mpunct"===e.mclass?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):"mopen"!==e.mclass&&"mclose"!==e.mclass||(n.attributes.lspace="0em",n.attributes.rspace="0em")),n}});var Jg=e=>{var t="ordgroup"===e.type&&e.body.length?e.body[0]:e;return"atom"!==t.type||"bin"!==t.family&&"rel"!==t.family?"mord":"m"+t.family};eg({type:"mclass",names:["\\@binrel"],numArgs:2,handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:Jg(t[0]),body:rg(t[1]),isCharacterBox:Vm(t[1])}}}),eg({type:"mclass",names:["\\stackrel","\\overset","\\underset"],numArgs:2,handler(e,t){var n,{parser:r,funcName:a}=e,s=t[1],o=t[0];n="\\stackrel"!==a?Jg(s):"mrel";var i={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:"\\stackrel"!==a,body:rg(s)},l="\\underset"===a?{type:"supsub",mode:o.mode,base:i,sub:o}:{type:"supsub",mode:o.mode,base:i,sup:o};return{type:"mclass",mode:r.mode,mclass:n,body:[l],isCharacterBox:Vm(l)}}}),eg({type:"pmb",names:["\\pmb"],numArgs:1,allowedInText:!0,handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:Jg(t[0]),body:rg(t[0])}},htmlBuilder(e,t){var n=lg(e.body,t,!0),r=zf([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=Mg(e.body,t),r=new vg("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Qg={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},ex=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),tx=e=>"textord"===e.type&&"@"===e.text,nx=(e,t)=>("mathord"===e.type||"atom"===e.type)&&e.text===t;function rx(e,t,n){var r=Qg[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":var a={type:"atom",text:r,mode:"math",family:"rel"},s={type:"ordgroup",mode:"math",body:[n.callFunction("\\\\cdleft",[t[0]],[]),n.callFunction("\\Big",[a],[]),n.callFunction("\\\\cdright",[t[1]],[])]};return n.callFunction("\\\\cdparent",[s],[]);case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":return n.callFunction("\\Big",[{type:"textord",text:"\\Vert",mode:"math"}],[]);default:return{type:"textord",text:" ",mode:"math"}}}eg({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],numArgs:1,handler(e,t){var{parser:n,funcName:r}=e;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=Ff(pg(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=mp(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new vg("mrow",[Ag(e.label,t)]);return(n=new vg("mpadded",[n])).setAttribute("width","0"),"left"===e.side&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),(n=new vg("mstyle",[n])).setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}}),eg({type:"cdlabelparent",names:["\\\\cdparent"],numArgs:1,handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=Ff(pg(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder:(e,t)=>new vg("mrow",[Ag(e.fragment,t)])}),eg({type:"textord",names:["\\@char"],numArgs:1,allowedInText:!0,handler(e,t){for(var{parser:n}=e,r=Ug(t[0],"ordgroup").body,a="",s=0;s<r.length;s++){a+=Ug(r[s],"textord").text}var o,i=parseInt(a);if(isNaN(i))throw new _m("\\@char has non-numeric argument "+a);if(i<0||i>=1114111)throw new _m("\\@char with invalid code point "+a);return i<=65535?o=String.fromCharCode(i):(i-=65536,o=String.fromCharCode(55296+(i>>10),56320+(1023&i))),{type:"textord",mode:n.mode,text:o}}});eg({type:"color",names:["\\textcolor"],numArgs:2,allowedInText:!0,argTypes:["color","original"],handler(e,t){var{parser:n}=e,r=Ug(t[0],"color-token").color,a=t[1];return{type:"color",mode:n.mode,color:r,body:rg(a)}},htmlBuilder:(e,t)=>Lf(lg(e.body,t.withColor(e.color),!1)),mathmlBuilder:(e,t)=>{var n=Mg(e.body,t.withColor(e.color)),r=new vg("mstyle",n);return r.setAttribute("mathcolor",e.color),r}}),eg({type:"color",names:["\\color"],numArgs:1,allowedInText:!0,argTypes:["color"],handler(e,t){var{parser:n,breakOnTokenText:r}=e,a=Ug(t[0],"color-token").color;n.gullet.macros.set("\\current@color",a);var s=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:a,body:s}}}),eg({type:"cr",names:["\\\\"],numArgs:0,numOptionalArgs:0,allowedInText:!0,handler(e,t,n){var{parser:r}=e,a="["===r.gullet.future().text?r.parseSizeGroup(!0):null,s=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:s,size:a&&Ug(a,"size").value}},htmlBuilder(e,t){var n=zf(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=mp(hp(e.size,t)))),n},mathmlBuilder(e,t){var n=new vg("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",mp(hp(e.size,t)))),n}});var ax={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},sx=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new _m("Expected a control sequence",e);return t},ox=(e,t,n,r)=>{var a=e.gullet.macros.get(n.text);null==a&&(n.noexpand=!0,a={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,a,r)};eg({type:"internal",names:["\\global","\\long","\\\\globallong"],numArgs:0,allowedInText:!0,handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var r=t.fetch();if(ax[r.text])return"\\global"!==n&&"\\\\globallong"!==n||(r.text=ax[r.text]),Ug(t.parseFunction(),"internal");throw new _m("Invalid token after macro prefix",r)}}),eg({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var{parser:t,funcName:n}=e,r=t.gullet.popToken(),a=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(a))throw new _m("Expected a control sequence",r);for(var s,o=0,i=[[]];"{"!==t.gullet.future().text;)if("#"===(r=t.gullet.popToken()).text){if("{"===t.gullet.future().text){s=t.gullet.future(),i[o].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new _m('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==o+1)throw new _m('Argument number "'+r.text+'" out of order');o++,i.push([])}else{if("EOF"===r.text)throw new _m("Expected a macro definition");i[o].push(r.text)}var{tokens:l}=t.gullet.consumeArg();return s&&l.unshift(s),"\\edef"!==n&&"\\xdef"!==n||(l=t.gullet.expandTokens(l)).reverse(),t.gullet.macros.set(a,{tokens:l,numArgs:o,delimiters:i},n===ax[n]),{type:"internal",mode:t.mode}}}),eg({type:"internal",names:["\\let","\\\\globallet"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var{parser:t,funcName:n}=e,r=sx(t.gullet.popToken());return t.gullet.consumeSpaces(),ox(t,r,(e=>{var t=e.gullet.popToken();return"="===t.text&&" "===(t=e.gullet.popToken()).text&&(t=e.gullet.popToken()),t})(t),"\\\\globallet"===n),{type:"internal",mode:t.mode}}}),eg({type:"internal",names:["\\futurelet","\\\\globalfuture"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var{parser:t,funcName:n}=e,r=sx(t.gullet.popToken()),a=t.gullet.popToken(),s=t.gullet.popToken();return ox(t,r,s,"\\\\globalfuture"===n),t.gullet.pushToken(s),t.gullet.pushToken(a),{type:"internal",mode:t.mode}}});var ix=function(e,t,n){var r=Rp(Dp.math[e]&&Dp.math[e].replace||e,t,n);if(!r)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return r},lx=function(e,t,n,r){var a=n.havingBaseStyle(t),s=zf(r.concat(a.sizingClasses(n)),[e],n),o=a.sizeMultiplier/n.sizeMultiplier;return s.height*=o,s.depth*=o,s.maxFontSize=a.sizeMultiplier,s},cx=function(e,t,n){var r=t.havingBaseStyle(n),a=(1-t.sizeMultiplier/r.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=mp(a),e.height-=a,e.depth+=a},dx=function(e,t,n,r,a,s){var o=function(e,t,n,r){return Ef(e,"Size"+t+"-Regular",n,r)}(e,t,a,r),i=lx(zf(["delimsizing","size"+t],[o],r),tp.TEXT,r,s);return n&&cx(i,r,tp.TEXT),i},ux=function(e,t,n){return{type:"elem",elem:zf(["delimsizinginner","Size1-Regular"===t?"delim-size1":"delim-size4"],[zf([],[Ef(e,t,n)])])}},hx=function(e,t,n){var r=Mp["Size4-Regular"][e.charCodeAt(0)]?Mp["Size4-Regular"][e.charCodeAt(0)][4]:Mp["Size1-Regular"][e.charCodeAt(0)][4],a=new Np("inner",function(e,t){switch(e){case"⎜":return sp("M291 0 H417 V"+t+" H291z");case"∣":return sp("M145 0 H188 V"+t+" H145z");case"∥":return sp("M145 0 H188 V"+t+" H145z")+sp("M367 0 H410 V"+t+" H367z");case"⎟":return sp("M457 0 H583 V"+t+" H457z");case"⎢":return sp("M319 0 H403 V"+t+" H319z");case"⎥":return sp("M263 0 H347 V"+t+" H263z");case"⎪":return sp("M384 0 H504 V"+t+" H384z");case"⏐":return sp("M312 0 H355 V"+t+" H312z");case"‖":return sp("M257 0 H300 V"+t+" H257z")+sp("M478 0 H521 V"+t+" H478z");default:return""}}(e,Math.round(1e3*t))),s=Pf([],[new Cp([a],{width:mp(r),height:mp(t),style:"width:"+mp(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"})],n);return s.height=t,s.style.height=mp(t),s.style.width=mp(r),{type:"elem",elem:s}},mx={type:"kern",size:-.008},px=new Set(["|","\\lvert","\\rvert","\\vert"]),fx=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),gx=function(e,t,n,r,a,s){var o,i,l,c,d="",u=0;o=l=c=e,i=null;var h="Size1-Regular";"\\uparrow"===e?l=c="⏐":"\\Uparrow"===e?l=c="‖":"\\downarrow"===e?o=l="⏐":"\\Downarrow"===e?o=l="‖":"\\updownarrow"===e?(o="\\uparrow",l="⏐",c="\\downarrow"):"\\Updownarrow"===e?(o="\\Uparrow",l="‖",c="\\Downarrow"):px.has(e)?(l="∣",d="vert",u=333):fx.has(e)?(l="∥",d="doublevert",u=556):"["===e||"\\lbrack"===e?(o="⎡",l="⎢",c="⎣",h="Size4-Regular",d="lbrack",u=667):"]"===e||"\\rbrack"===e?(o="⎤",l="⎥",c="⎦",h="Size4-Regular",d="rbrack",u=667):"\\lfloor"===e||"⌊"===e?(l=o="⎢",c="⎣",h="Size4-Regular",d="lfloor",u=667):"\\lceil"===e||"⌈"===e?(o="⎡",l=c="⎢",h="Size4-Regular",d="lceil",u=667):"\\rfloor"===e||"⌋"===e?(l=o="⎥",c="⎦",h="Size4-Regular",d="rfloor",u=667):"\\rceil"===e||"⌉"===e?(o="⎤",l=c="⎥",h="Size4-Regular",d="rceil",u=667):"("===e||"\\lparen"===e?(o="⎛",l="⎜",c="⎝",h="Size4-Regular",d="lparen",u=875):")"===e||"\\rparen"===e?(o="⎞",l="⎟",c="⎠",h="Size4-Regular",d="rparen",u=875):"\\{"===e||"\\lbrace"===e?(o="⎧",i="⎨",c="⎩",l="⎪",h="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(o="⎫",i="⎬",c="⎭",l="⎪",h="Size4-Regular"):"\\lgroup"===e||"⟮"===e?(o="⎧",c="⎩",l="⎪",h="Size4-Regular"):"\\rgroup"===e||"⟯"===e?(o="⎫",c="⎭",l="⎪",h="Size4-Regular"):"\\lmoustache"===e||"⎰"===e?(o="⎧",c="⎭",l="⎪",h="Size4-Regular"):"\\rmoustache"!==e&&"⎱"!==e||(o="⎫",c="⎩",l="⎪",h="Size4-Regular");var m=ix(o,h,a),p=m.height+m.depth,f=ix(l,h,a),g=f.height+f.depth,x=ix(c,h,a),v=x.height+x.depth,y=0,b=1;if(null!==i){var w=ix(i,h,a);y=w.height+w.depth,b=2}var S=p+v+y,j=S+Math.max(0,Math.ceil((t-S)/(b*g)))*b*g,k=r.fontMetrics().axisHeight;n&&(k*=r.sizeMultiplier);var C=j/2-k,N=[];if(d.length>0){var T=j-p-v,M=Math.round(1e3*j),E=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v1759 v84 h347 v-84\nH403z M403 1759 V0 H319 V1759 v"+t+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v"+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z";case"doublevert":return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z\nM367 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v"+t+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+t+" v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+t+" v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v602 h84z\nM403 1759 V0 H319 V1759 v"+t+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v602 h84z\nM347 1759 V0 h-84 V1759 v"+t+" v602 h84z";case"lparen":return"M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0,"+(t+84)+"c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-"+(t+92)+"c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z";case"rparen":return"M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,"+(t+9)+"\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-"+(t+144)+"c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";default:throw new Error("Unknown stretchy delimiter.")}}(d,Math.round(1e3*T)),A=new Np(d,E),R=mp(u/1e3),I=mp(M/1e3),D=Pf([],[new Cp([A],{width:R,height:I,viewBox:"0 0 "+u+" "+M})],r);D.height=M/1e3,D.style.width=R,D.style.height=I,N.push({type:"elem",elem:D})}else{if(N.push(ux(c,h,a)),N.push(mx),null===i){var _=j-p-v+.016;N.push(hx(l,_,r))}else{var z=(j-p-v-y)/2+.016;N.push(hx(l,z,r)),N.push(mx),N.push(ux(i,h,a)),N.push(mx),N.push(hx(l,z,r))}N.push(mx),N.push(ux(o,h,a))}var P=r.havingBaseStyle(tp.TEXT);return lx(zf(["delimsizing","mult"],[Bf({positionType:"bottom",positionData:C,children:N})],P),tp.TEXT,r,s)},xx=.08,vx=function(e,t,n,r,a){var s=function(e,t,n){t*=1e3;var r="";switch(e){case"sqrtMain":r=function(e,t){return"M95,"+(622+e+t)+"\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl"+e/2.075+" -"+e+"\nc5.3,-9.3,12,-14,20,-14\nH400000v"+(40+e)+"H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM"+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,op);break;case"sqrtSize1":r=function(e,t){return"M263,"+(601+e+t)+"c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl"+e/2.084+" -"+e+"\nc4.7,-7.3,11,-11,19,-11\nH40000v"+(40+e)+"H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,op);break;case"sqrtSize2":r=function(e,t){return"M983 "+(10+e+t)+"\nl"+e/3.13+" -"+e+"\nc4,-6.7,10,-10,18,-10 H400000v"+(40+e)+"\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,op);break;case"sqrtSize3":r=function(e,t){return"M424,"+(2398+e+t)+"\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl"+e/4.223+" -"+e+"c4,-6.7,10,-10,18,-10 H400000\nv"+(40+e)+"H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M"+(1001+e)+" "+t+"\nh400000v"+(40+e)+"h-400000z"}(t,op);break;case"sqrtSize4":r=function(e,t){return"M473,"+(2713+e+t)+"\nc339.3,-1799.3,509.3,-2700,510,-2702 l"+e/5.298+" -"+e+"\nc3.3,-7.3,9.3,-11,18,-11 H400000v"+(40+e)+"H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM"+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"}(t,op);break;case"sqrtTall":r=function(e,t,n){return"M702 "+(e+t)+"H400000"+(40+e)+"\nH742v"+(n-54-t-e)+"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 "+t+"H400000v"+(40+e)+"H742z"}(t,op,n)}return r}(e,r,n),o=new Np(e,s);return Pf(["hide-tail"],[new Cp([o],{width:"400em",height:mp(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"})],a)},yx=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),bx=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),wx=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Sx=[0,1.2,1.8,2.4,3],jx=function(e,t,n,r,a){if("<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),yx.has(e)||wx.has(e))return dx(e,t,!1,n,r,a);if(bx.has(e))return gx(e,Sx[t],!1,n,r,a);throw new _m("Illegal delimiter: '"+e+"'")},kx=[{type:"small",style:tp.SCRIPTSCRIPT},{type:"small",style:tp.SCRIPT},{type:"small",style:tp.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Cx=[{type:"small",style:tp.SCRIPTSCRIPT},{type:"small",style:tp.SCRIPT},{type:"small",style:tp.TEXT},{type:"stack"}],Nx=[{type:"small",style:tp.SCRIPTSCRIPT},{type:"small",style:tp.SCRIPT},{type:"small",style:tp.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Tx=function(e){if("small"===e.type)return"Main-Regular";if("large"===e.type)return"Size"+e.size+"-Regular";if("stack"===e.type)return"Size4-Regular";var t=e.type;throw new Error("Add support for delim type '"+t+"' here.")},Mx=function(e,t,n,r){for(var a=Math.min(2,3-r.style.size);a<n.length;a++){var s=n[a];if("stack"===s.type)break;var o=ix(e,Tx(s),"math"),i=o.height+o.depth;if("small"===s.type)i*=r.havingBaseStyle(s.style).sizeMultiplier;if(i>t)return s}return n[n.length-1]},Ex=function(e,t,n,r,a,s){var o;"<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),o=wx.has(e)?kx:yx.has(e)?Nx:Cx;var i=Mx(e,t,o,r);return"small"===i.type?function(e,t,n,r,a,s){var o=lx(Ef(e,"Main-Regular",a,r),t,r,s);return n&&cx(o,r,t),o}(e,i.style,n,r,a,s):"large"===i.type?dx(e,i.size,n,r,a,s):gx(e,t,n,r,a,s)},Ax=function(e,t,n,r,a,s){var o=r.fontMetrics().axisHeight*r.sizeMultiplier,i=5/r.fontMetrics().ptPerEm,l=Math.max(t-o,n+o);return Ex(e,Math.max(l/500*901,2*l-i),!0,r,a,s)},Rx={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Ix=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function Dx(e){return"isMiddle"in e}function _x(e,t){var n=Wg(e);if(n&&Ix.has(n.text))return n;throw new _m(n?"Invalid delimiter '"+n.text+"' after '"+t.funcName+"'":"Invalid delimiter type '"+e.type+"'",e)}function zx(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}eg({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],numArgs:1,argTypes:["primitive"],handler:(e,t)=>{var n=_x(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:Rx[e.funcName].size,mclass:Rx[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>"."===e.delim?zf([e.mclass]):jx(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];"."!==e.delim&&t.push(jg(e.delim,e.mode));var n=new vg("mo",t);"mopen"===e.mclass||"mclose"===e.mclass?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=mp(Sx[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}}),eg({type:"leftright-right",names:["\\right"],numArgs:1,primitive:!0,handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&"string"!=typeof n)throw new _m("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:_x(t[0],e).text,color:n}}}),eg({type:"leftright",names:["\\left"],numArgs:1,primitive:!0,handler:(e,t)=>{var n=_x(t[0],e),r=e.parser;++r.leftrightDepth;var a=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var s=Ug(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:a,left:n.text,right:s.delim,rightColor:s.color}},htmlBuilder:(e,t)=>{zx(e);for(var n,r,a=lg(e.body,t,!0,["mopen","mclose"]),s=0,o=0,i=!1,l=0;l<a.length;l++){Dx(a[l])?i=!0:(s=Math.max(a[l].height,s),o=Math.max(a[l].depth,o))}if(s*=t.sizeMultiplier,o*=t.sizeMultiplier,n="."===e.left?mg(t,["mopen"]):Ax(e.left,s,o,t,e.mode,["mopen"]),a.unshift(n),i)for(var c=1;c<a.length;c++){var d=a[c];if(Dx(d)){var u=d.isMiddle;a[c]=Ax(u.delim,s,o,u.options,e.mode,[])}}if("."===e.right)r=mg(t,["mclose"]);else{var h=e.rightColor?t.withColor(e.rightColor):t;r=Ax(e.right,s,o,h,e.mode,["mclose"])}return a.push(r),zf(["minner"],a,t)},mathmlBuilder:(e,t)=>{zx(e);var n=Mg(e.body,t);if("."!==e.left){var r=new vg("mo",[jg(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if("."!==e.right){var a=new vg("mo",[jg(e.right,e.mode)]);a.setAttribute("fence","true"),e.rightColor&&a.setAttribute("mathcolor",e.rightColor),n.push(a)}return kg(n)}}),eg({type:"middle",names:["\\middle"],numArgs:1,primitive:!0,handler:(e,t)=>{var n=_x(t[0],e);if(!e.parser.leftrightDepth)throw new _m("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return"."===e.delim?n=mg(t,[]):(n=jx(e.delim,1,t,e.mode,[])).isMiddle={delim:e.delim,options:t},n},mathmlBuilder:(e,t)=>{var n="\\vert"===e.delim||"|"===e.delim?jg("|","text"):jg(e.delim,e.mode),r=new vg("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});eg({type:"enclose",names:["\\colorbox"],numArgs:2,allowedInText:!0,argTypes:["color","hbox"],handler(e,t,n){var{parser:r,funcName:a}=e,s=Ug(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:r.mode,label:a,backgroundColor:s,body:o}},htmlBuilder:(e,t)=>{var n,r,a,s=Ff(pg(e.body,t),t),o=e.label.slice(1),i=t.sizeMultiplier,l=Vm(e.body);if("sout"===o)(n=zf(["stretchy","sout"])).height=t.fontMetrics().defaultRuleThickness/i,r=-.5*t.fontMetrics().xHeight;else if("phase"===o){var c=hp({number:.6,unit:"pt"},t),d=hp({number:.35,unit:"ex"},t);i/=t.havingBaseSizing().sizeMultiplier;var u=s.height+s.depth+c+d;s.style.paddingLeft=mp(u/2+c);var h=Math.floor(1e3*u*i),m=function(e){return"M400000 "+e+" H0 L"+e/2+" 0 l65 45 L145 "+(e-80)+" H400000z"}(h);(n=Pf(["hide-tail"],[new Cp([new Np("phase",m)],{width:"400em",height:mp(h/1e3),viewBox:"0 0 400000 "+h,preserveAspectRatio:"xMinYMin slice"})],t)).style.height=mp(u),r=s.depth+c+d}else{var p,f;/cancel/.test(o)?l||s.classes.push("cancel-pad"):"angl"===o?s.classes.push("anglpad"):s.classes.push("boxpad");var g=0;/box/.test(o)?(g=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),f=p=t.fontMetrics().fboxsep+("colorbox"===o?0:g)):"angl"===o?(p=4*(g=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness)),f=Math.max(0,.25-s.depth)):f=p=l?.2:0,n=function(e,t,n,r,a){var s,o=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(s=zf(["stretchy",t],[],a),"fbox"===t){var i=a.color&&a.getColor();i&&(s.style.borderColor=i)}}else{var l=[];/^[bx]cancel$/.test(t)&&l.push(new Tp({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&l.push(new Tp({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"})),s=Pf([],[new Cp(l,{width:"100%",height:mp(o)})],a)}return s.height=o,s.style.height=mp(o),s}(s,o,p,f,t),/fbox|boxed|fcolorbox/.test(o)?(n.style.borderStyle="solid",n.style.borderWidth=mp(g)):"angl"===o&&.049!==g&&(n.style.borderTopWidth=mp(g),n.style.borderRightWidth=mp(g)),r=s.depth+f,e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor,e.borderColor&&(n.style.borderColor=e.borderColor))}if(e.backgroundColor)a=Bf({positionType:"individualShift",children:[{type:"elem",elem:n,shift:r},{type:"elem",elem:s,shift:0}]});else{var x=/cancel|phase/.test(o)?["svg-align"]:[];a=Bf({positionType:"individualShift",children:[{type:"elem",elem:s,shift:0},{type:"elem",elem:n,shift:r,wrapperClasses:x}]})}return/cancel/.test(o)&&(a.height=s.height,a.depth=s.depth),/cancel/.test(o)&&!l?zf(["mord","cancel-lap"],[a],t):zf(["mord"],[a],t)},mathmlBuilder:(e,t)=>{var n,r=new vg(e.label.includes("colorbox")?"mpadded":"menclose",[Ag(e.body,t)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),"\\fcolorbox"===e.label){var a=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute("style","border: "+mp(a)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r}}),eg({type:"enclose",names:["\\fcolorbox"],numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"],handler(e,t,n){var{parser:r,funcName:a}=e,s=Ug(t[0],"color-token").color,o=Ug(t[1],"color-token").color,i=t[2];return{type:"enclose",mode:r.mode,label:a,backgroundColor:o,borderColor:s,body:i}}}),eg({type:"enclose",names:["\\fbox"],numArgs:1,argTypes:["hbox"],allowedInText:!0,handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}}),eg({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],numArgs:1,handler(e,t){var{parser:n,funcName:r}=e,a=t[0];return{type:"enclose",mode:n.mode,label:r,body:a}}}),eg({type:"enclose",names:["\\sout"],numArgs:1,allowedInText:!0,handler(e,t){var{parser:n,funcName:r}=e;"math"===n.mode&&n.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var a=t[0];return{type:"enclose",mode:n.mode,label:r,body:a}}}),eg({type:"enclose",names:["\\angl"],numArgs:1,argTypes:["hbox"],allowedInText:!1,handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var Px={};function Ox(e){for(var{type:t,names:n,props:r,handler:a,htmlBuilder:s,mathmlBuilder:o}=e,i={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:a},l=0;l<n.length;++l)Px[n[l]]=i;s&&(Jf[t]=s),o&&(Qf[t]=o)}var Lx={};function Fx(e,t){Lx[e]=t}var Bx=class e{constructor(e,t,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=n}static range(t,n){return n?t&&t.loc&&n.loc&&t.loc.lexer===n.loc.lexer?new e(t.loc.lexer,t.loc.start,n.loc.end):null:t&&t.loc}},Hx=class e{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(t,n){return new e(n,Bx.range(this,t))}};function Vx(e){var t=[];e.consumeSpaces();var n=e.fetch().text;for("\\relax"===n&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);"\\hline"===n||"\\hdashline"===n;)e.consume(),t.push("\\hdashline"===n),e.consumeSpaces(),n=e.fetch().text;return t}var $x=e=>{if(!e.parser.settings.displayMode)throw new _m("{"+e.envName+"} can be used only in display mode.")},qx=new Set(["gather","gather*"]);function Ux(e){if(!e.includes("ed"))return!e.includes("*")}function Gx(e,t,n){var{hskipBeforeAndAfter:r,addJot:a,cols:s,arraystretch:o,colSeparationType:i,autoTag:l,singleRow:c,emptySingleRow:d,maxNumCols:u,leqno:h}=t;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!o){var m=e.gullet.expandMacroAsText("\\arraystretch");if(null==m)o=1;else if(!(o=parseFloat(m))||o<0)throw new _m("Invalid \\arraystretch: "+m)}e.gullet.beginGroup();var p=[],f=[p],g=[],x=[],v=null!=l?[]:void 0;function y(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function b(){v&&(e.gullet.macros.get("\\df@tag")?(v.push(e.subparse([new Hx("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):v.push(Boolean(l)&&"1"===e.gullet.macros.get("\\@eqnsw")))}for(y(),x.push(Vx(e));;){var w=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var S={type:"ordgroup",mode:e.mode,body:w};n&&(S={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[S]}),p.push(S);var j=e.fetch().text;if("&"===j){if(u&&p.length===u){if(c||i)throw new _m("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else{if("\\end"===j){b(),1===p.length&&"styling"===S.type&&1===S.body.length&&"ordgroup"===S.body[0].type&&0===S.body[0].body.length&&(f.length>1||!d)&&f.pop(),x.length<f.length+1&&x.push([]);break}if("\\\\"!==j)throw new _m("Expected & or \\\\ or \\cr or \\end",e.nextToken);e.consume();var k=void 0;" "!==e.gullet.future().text&&(k=e.parseSizeGroup(!0)),g.push(k?k.value:null),b(),x.push(Vx(e)),p=[],f.push(p),y()}}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:a,arraystretch:o,body:f,cols:s,rowGaps:g,hskipBeforeAndAfter:r,hLinesBeforeRow:x,colSeparationType:i,tags:v,leqno:h}}function Wx(e){return"d"===e.slice(0,1)?"display":"text"}var Kx=function(e,t){var n,r,a=e.body.length,s=e.hLinesBeforeRow,o=0,i=new Array(a),l=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),d=1/t.fontMetrics().ptPerEm,u=5*d;e.colSeparationType&&"small"===e.colSeparationType&&(u=t.havingStyle(tp.SCRIPT).sizeMultiplier/t.sizeMultiplier*.2778);var h="CD"===e.colSeparationType?hp({number:3,unit:"ex"},t):12*d,m=3*d,p=e.arraystretch*h,f=.7*p,g=.3*p,x=0;function v(e){for(var t=0;t<e.length;++t)t>0&&(x+=.25),l.push({pos:x,isDashed:e[t]})}for(v(s[0]),n=0;n<e.body.length;++n){var y=e.body[n],b=f,w=g;o<y.length&&(o=y.length);var S={cells:new Array(y.length),height:0,depth:0,pos:0};for(r=0;r<y.length;++r){var j=pg(y[r],t);w<j.depth&&(w=j.depth),b<j.height&&(b=j.height),S.cells[r]=j}var k=e.rowGaps[n],C=0;k&&(C=hp(k,t))>0&&(w<(C+=g)&&(w=C),C=0),e.addJot&&n<e.body.length-1&&(w+=m),S.height=b,S.depth=w,x+=b,S.pos=x,x+=w+C,i[n]=S,v(s[n+1])}var N,T,M=x/2+t.fontMetrics().axisHeight,E=e.cols||[],A=[],R=[];if(e.tags&&e.tags.some(e=>e))for(n=0;n<a;++n){var I=i[n],D=I.pos-M,_=e.tags[n],z=void 0;(z=!0===_?zf(["eqn-num"],[],t):zf([],!1===_?[]:lg(_,t,!0),t)).depth=I.depth,z.height=I.height,R.push({type:"elem",elem:z,shift:D})}for(r=0,T=0;r<o||T<E.length;++r,++T){for(var P,O=E[T],L=!0;"separator"===(null==(F=O)?void 0:F.type);){var F;if(L||((N=zf(["arraycolsep"],[])).style.width=mp(t.fontMetrics().doubleRuleSep),A.push(N)),"|"!==O.separator&&":"!==O.separator)throw new _m("Invalid separator type: "+O.separator);var B="|"===O.separator?"solid":"dashed",H=zf(["vertical-separator"],[],t);H.style.height=mp(x),H.style.borderRightWidth=mp(c),H.style.borderRightStyle=B,H.style.margin="0 "+mp(-c/2);var V=x-M;V&&(H.style.verticalAlign=mp(-V)),A.push(H),O=E[++T],L=!1}if(!(r>=o)){var $,q,U=void 0;if(r>0||e.hskipBeforeAndAfter)0!==(U=null!=($=null==(q=O)?void 0:q.pregap)?$:u)&&((N=zf(["arraycolsep"],[])).style.width=mp(U),A.push(N));var G=[];for(n=0;n<a;++n){var W=i[n],K=W.cells[r];if(K){var Y=W.pos-M;K.depth=W.depth,K.height=W.height,G.push({type:"elem",elem:K,shift:Y})}}var X,Z,J=Bf({positionType:"individualShift",children:G}),Q=zf(["col-align-"+((null==(P=O)?void 0:P.align)||"c")],[J]);if(A.push(Q),r<o-1||e.hskipBeforeAndAfter)0!==(U=null!=(X=null==(Z=O)?void 0:Z.postgap)?X:u)&&((N=zf(["arraycolsep"],[])).style.width=mp(U),A.push(N))}}var ee=zf(["mtable"],A);if(l.length>0){for(var te=Of("hline",t,c),ne=Of("hdashline",t,c),re=[{type:"elem",elem:ee,shift:0}];l.length>0;){var ae=l.pop(),se=ae.pos-M;ae.isDashed?re.push({type:"elem",elem:ne,shift:se}):re.push({type:"elem",elem:te,shift:se})}ee=Bf({positionType:"individualShift",children:re})}if(0===R.length)return zf(["mord"],[ee],t);var oe=zf(["tag"],[Bf({positionType:"individualShift",children:R})],t);return Lf([ee,oe])},Yx={c:"center ",l:"left ",r:"right "},Xx=function(e,t){for(var n=[],r=new vg("mtd",[],["mtr-glue"]),a=new vg("mtd",[],["mml-eqn-num"]),s=0;s<e.body.length;s++){for(var o=e.body[s],i=[],l=0;l<o.length;l++)i.push(new vg("mtd",[Ag(o[l],t)]));e.tags&&e.tags[s]&&(i.unshift(r),i.push(r),e.leqno?i.unshift(a):i.push(a)),n.push(new vg("mtr",i))}var c=new vg("mtable",n),d=.5===e.arraystretch?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",mp(d));var u="",h="";if(e.cols&&e.cols.length>0){var m=e.cols,p="",f=!1,g=0,x=m.length;"separator"===m[0].type&&(u+="top ",g=1),"separator"===m[m.length-1].type&&(u+="bottom ",x-=1);for(var v=g;v<x;v++){var y=m[v];"align"===y.type?(h+=Yx[y.align],f&&(p+="none "),f=!0):"separator"===y.type&&f&&(p+="|"===y.separator?"solid ":"dashed ",f=!1)}c.setAttribute("columnalign",h.trim()),/[sd]/.test(p)&&c.setAttribute("columnlines",p.trim())}if("align"===e.colSeparationType){for(var b=e.cols||[],w="",S=1;S<b.length;S++)w+=S%2?"0em ":"1em ";c.setAttribute("columnspacing",w.trim())}else"alignat"===e.colSeparationType||"gather"===e.colSeparationType?c.setAttribute("columnspacing","0em"):"small"===e.colSeparationType?c.setAttribute("columnspacing","0.2778em"):"CD"===e.colSeparationType?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var j="",k=e.hLinesBeforeRow;u+=k[0].length>0?"left ":"",u+=k[k.length-1].length>0?"right ":"";for(var C=1;C<k.length-1;C++)j+=0===k[C].length?"none ":k[C][0]?"dashed ":"solid ";return/[sd]/.test(j)&&c.setAttribute("rowlines",j.trim()),""!==u&&(c=new vg("menclose",[c])).setAttribute("notation",u.trim()),e.arraystretch&&e.arraystretch<1&&(c=new vg("mstyle",[c])).setAttribute("scriptlevel","1"),c},Zx=function(e,t){e.envName.includes("ed")||$x(e);var n=[],r="split"===e.envName,a=Gx(e.parser,{cols:n,addJot:!0,autoTag:r?void 0:Ux(e.envName),emptySingleRow:!0,colSeparationType:e.envName.includes("at")?"alignat":"align",maxNumCols:r?2:void 0,leqno:e.parser.settings.leqno},"display"),s=0,o=0,i={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&"ordgroup"===t[0].type){for(var l="",c=0;c<t[0].body.length;c++){l+=Ug(t[0].body[c],"textord").text}s=Number(l),o=2*s}var d=!o;a.body.forEach(function(e){for(var t=1;t<e.length;t+=2)Ug(Ug(e[t],"styling").body[0],"ordgroup").body.unshift(i);if(d)o<e.length&&(o=e.length);else{var n=e.length/2;if(s<n)throw new _m("Too many math in a row: expected "+s+", but got "+n,e[0])}});for(var u=0;u<o;++u){var h="r",m=0;u%2==1?h="l":u>0&&d&&(m=1),n[u]={type:"align",align:h,pregap:m,postgap:0}}return a.colSeparationType=d?"align":"alignat",a};Ox({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=(Wg(t[0])?[t[0]]:Ug(t[0],"ordgroup").body).map(function(e){var t=Gg(e).text;if("lcr".includes(t))return{type:"align",align:t};if("|"===t)return{type:"separator",separator:"|"};if(":"===t)return{type:"separator",separator:":"};throw new _m("Unknown column alignment: "+t,e)}),r={cols:n,hskipBeforeAndAfter:!0,maxNumCols:n.length};return Gx(e.parser,r,Wx(e.envName))},htmlBuilder:Kx,mathmlBuilder:Xx}),Ox({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if("*"===e.envName.charAt(e.envName.length-1)){var a=e.parser;if(a.consumeSpaces(),"["===a.fetch().text){if(a.consume(),a.consumeSpaces(),n=a.fetch().text,!"lcr".includes(n))throw new _m("Expected l or c or r",a.nextToken);a.consume(),a.consumeSpaces(),a.expect("]"),a.consume(),r.cols=[{type:"align",align:n}]}}var s=Gx(e.parser,r,Wx(e.envName)),o=Math.max(0,...s.body.map(e=>e.length));return s.cols=new Array(o).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[s],left:t[0],right:t[1],rightColor:void 0}:s},htmlBuilder:Kx,mathmlBuilder:Xx}),Ox({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t=Gx(e.parser,{arraystretch:.5},"script");return t.colSeparationType="small",t},htmlBuilder:Kx,mathmlBuilder:Xx}),Ox({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=(Wg(t[0])?[t[0]]:Ug(t[0],"ordgroup").body).map(function(e){var t=Gg(e).text;if("lc".includes(t))return{type:"align",align:t};throw new _m("Unknown column alignment: "+t,e)});if(n.length>1)throw new _m("{subarray} can contain only one column");var r={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5},a=Gx(e.parser,r,"script");if(a.body.length>0&&a.body[0].length>1)throw new _m("{subarray} can contain only one column");return a},htmlBuilder:Kx,mathmlBuilder:Xx}),Ox({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t=Gx(e.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},Wx(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Kx,mathmlBuilder:Xx}),Ox({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Zx,htmlBuilder:Kx,mathmlBuilder:Xx}),Ox({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){qx.has(e.envName)&&$x(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Ux(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Gx(e.parser,t,"display")},htmlBuilder:Kx,mathmlBuilder:Xx}),Ox({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Zx,htmlBuilder:Kx,mathmlBuilder:Xx}),Ox({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){$x(e);var t={autoTag:Ux(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Gx(e.parser,t,"display")},htmlBuilder:Kx,mathmlBuilder:Xx}),Ox({type:"array",names:["CD"],props:{numArgs:0},handler:e=>($x(e),function(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if("&"!==n&&"\\\\"!==n){if("\\end"===n){0===t[t.length-1].length&&t.pop();break}throw new _m("Expected \\\\ or \\cr or \\end",e.nextToken)}e.consume()}for(var r=[],a=[r],s=0;s<t.length;s++){for(var o=t[s],i=ex(),l=0;l<o.length;l++)if(tx(o[l])){r.push(i);var c=Gg(o[l+=1]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},"=|.".includes(c));else{if(!"<>AV".includes(c))throw new _m('Expected one of "<>AV=|." after @',o[l]);for(var u=0;u<2;u++){for(var h=!0,m=l+1;m<o.length;m++){if(nx(o[m],c)){h=!1,l=m;break}if(tx(o[m]))throw new _m("Missing a "+c+" character to complete a CD arrow.",o[m]);d[u].body.push(o[m])}if(h)throw new _m("Missing a "+c+" character to complete a CD arrow.",o[l])}}var p={type:"styling",body:[rx(c,d,e)],mode:"math",style:"display",resetFont:!0};r.push(p),i=ex()}else i.body.push(o[l]);s%2==0?r.push(i):r.shift(),r=[],a.push(r)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:"math",body:a,arraystretch:1,addJot:!0,rowGaps:[null],cols:new Array(a[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25}),colSeparationType:"CD",hLinesBeforeRow:new Array(a.length+1).fill([])}}(e.parser)),htmlBuilder:Kx,mathmlBuilder:Xx}),Fx("\\nonumber","\\gdef\\@eqnsw{0}"),Fx("\\notag","\\nonumber"),eg({type:"text",names:["\\hline","\\hdashline"],numArgs:0,allowedInText:!0,allowedInMath:!0,handler(e,t){throw new _m(e.funcName+" valid only within array environment")}});var Jx=Px;eg({type:"environment",names:["\\begin","\\end"],numArgs:1,argTypes:["text"],handler(e,t){var{parser:n,funcName:r}=e,a=t[0];if("ordgroup"!==a.type)throw new _m("Invalid environment name",a);for(var s="",o=0;o<a.body.length;++o)s+=Ug(a.body[o],"textord").text;if("\\begin"===r){if(!Jx.hasOwnProperty(s))throw new _m("No such environment: "+s,a);var i=Jx[s],{args:l,optArgs:c}=n.parseArguments("\\begin{"+s+"}",i),d={mode:n.mode,envName:s,parser:n},u=i.handler(d,l,c);n.expect("\\end",!1);var h=n.nextToken,m=Ug(n.parseFunction(),"environment");if(m.name!==s)throw new _m("Mismatch: \\begin{"+s+"} matched by \\end{"+m.name+"}",h);return u}return{type:"environment",mode:n.mode,name:s,nameGroup:a}}});var Qx={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};eg({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],numArgs:1,allowedInArgument:!0,handler:(e,t)=>{var{parser:n,funcName:r}=e,a=ng(t[0]),s=r in Qx?Qx[r]:r;return{type:"font",mode:n.mode,font:s.slice(1),body:a}},htmlBuilder:(e,t)=>{var n=e.font,r=t.withFont(n);return pg(e.body,r)},mathmlBuilder:(e,t)=>{var n=e.font,r=t.withFont(n);return Ag(e.body,r)}}),eg({type:"mclass",names:["\\boldsymbol","\\bm"],numArgs:1,handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"mclass",mode:n.mode,mclass:Jg(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:Vm(r)}}}),eg({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],numArgs:0,allowedInText:!0,handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:a}=e,{mode:s}=n,o=n.parseExpression(!0,a);return{type:"font",mode:s,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:o}}}});var ev=(e,t)=>t?{type:"styling",mode:e.mode,style:t,body:[e]}:e;eg({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],numArgs:2,allowedInArgument:!0,handler:(e,t)=>{var n,{parser:r,funcName:a}=e,s=t[0],o=t[1],i=null,l=null;switch(a){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":n=!0;break;case"\\\\atopfrac":n=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":n=!1,i="(",l=")";break;case"\\\\bracefrac":n=!1,i="\\{",l="\\}";break;case"\\\\brackfrac":n=!1,i="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c="\\cfrac"===a,d=null;return c||a.startsWith("\\d")?d="display":a.startsWith("\\t")&&(d="text"),ev({type:"genfrac",mode:r.mode,numer:s,denom:o,continued:c,hasBarLine:n,leftDelim:i,rightDelim:l,barSize:null},d)},htmlBuilder:(e,t)=>{var n=t.style,r=n.fracNum(),a=n.fracDen(),s=t.havingStyle(r),o=pg(e.numer,s,t);if(e.continued){var i=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;o.height=o.height<i?i:o.height,o.depth=o.depth<l?l:o.depth}s=t.havingStyle(a);var c,d,u,h,m,p,f,g,x,v,y=pg(e.denom,s,t);if(e.hasBarLine?(e.barSize?(d=hp(e.barSize,t),c=Of("frac-line",t,d)):c=Of("frac-line",t),d=c.height,u=c.height):(c=null,d=0,u=t.fontMetrics().defaultRuleThickness),n.size===tp.DISPLAY.size?(h=t.fontMetrics().num1,m=d>0?3*u:7*u,p=t.fontMetrics().denom1):(d>0?(h=t.fontMetrics().num2,m=u):(h=t.fontMetrics().num3,m=3*u),p=t.fontMetrics().denom2),c){var b=t.fontMetrics().axisHeight;h-o.depth-(b+.5*d)<m&&(h+=m-(h-o.depth-(b+.5*d))),b-.5*d-(y.height-p)<m&&(p+=m-(b-.5*d-(y.height-p))),f=Bf({positionType:"individualShift",children:[{type:"elem",elem:y,shift:p},{type:"elem",elem:c,shift:-(b-.5*d)},{type:"elem",elem:o,shift:-h}]})}else{var w=h-o.depth-(y.height-p);w<m&&(h+=.5*(m-w),p+=.5*(m-w)),f=Bf({positionType:"individualShift",children:[{type:"elem",elem:y,shift:p},{type:"elem",elem:o,shift:-h}]})}return s=t.havingStyle(n),f.height*=s.sizeMultiplier/t.sizeMultiplier,f.depth*=s.sizeMultiplier/t.sizeMultiplier,g=n.size===tp.DISPLAY.size?t.fontMetrics().delim1:n.size===tp.SCRIPTSCRIPT.size?t.havingStyle(tp.SCRIPT).fontMetrics().delim2:t.fontMetrics().delim2,x=null==e.leftDelim?mg(t,["mopen"]):Ex(e.leftDelim,g,!0,t.havingStyle(n),e.mode,["mopen"]),v=e.continued?zf([]):null==e.rightDelim?mg(t,["mclose"]):Ex(e.rightDelim,g,!0,t.havingStyle(n),e.mode,["mclose"]),zf(["mord"].concat(s.sizingClasses(t)),[x,zf(["mfrac"],[f]),v],t)},mathmlBuilder:(e,t)=>{var n=new vg("mfrac",[Ag(e.numer,t),Ag(e.denom,t)]);if(e.hasBarLine){if(e.barSize){var r=hp(e.barSize,t);n.setAttribute("linethickness",mp(r))}}else n.setAttribute("linethickness","0px");if(null!=e.leftDelim||null!=e.rightDelim){var a=[];if(null!=e.leftDelim){var s=new vg("mo",[new yg(e.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),a.push(s)}if(a.push(n),null!=e.rightDelim){var o=new vg("mo",[new yg(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),a.push(o)}return kg(a)}return n}}),eg({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],numArgs:0,infix:!0,handler(e){var t,{parser:n,funcName:r,token:a}=e;switch(r){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;case"\\atop":t="\\\\atopfrac";break;case"\\brace":t="\\\\bracefrac";break;case"\\brack":t="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:n.mode,replaceWith:t,token:a}}});var tv=["display","text","script","scriptscript"],nv=function(e){var t=null;return e.length>0&&(t="."===(t=e)?null:t),t};eg({type:"genfrac",names:["\\genfrac"],numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"],handler(e,t){var n,{parser:r}=e,a=t[4],s=t[5],o=ng(t[0]),i="atom"===o.type&&"open"===o.family?nv(o.text):null,l=ng(t[1]),c="atom"===l.type&&"close"===l.family?nv(l.text):null,d=Ug(t[2],"size"),u=null;n=!!d.isBlank||(u=d.value).number>0;var h=null,m=t[3];if("ordgroup"===m.type){if(m.body.length>0){var p=Ug(m.body[0],"textord");h=tv[Number(p.text)]}}else m=Ug(m,"textord"),h=tv[Number(m.text)];return ev({type:"genfrac",mode:r.mode,numer:a,denom:s,continued:!1,hasBarLine:n,barSize:u,leftDelim:i,rightDelim:c},h)}}),eg({type:"infix",names:["\\above"],numArgs:1,argTypes:["size"],infix:!0,handler(e,t){var{parser:n,funcName:r,token:a}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Ug(t[0],"size").value,token:a}}}),eg({type:"genfrac",names:["\\\\abovefrac"],numArgs:3,argTypes:["math","size","math"],handler:(e,t)=>{var{parser:n,funcName:r}=e,a=t[0],s=Ug(t[1],"infix").size;if(!s)throw new Error("\\\\abovefrac expected size, but got "+String(s));var o=t[2],i=s.number>0;return{type:"genfrac",mode:n.mode,numer:a,denom:o,continued:!1,hasBarLine:i,barSize:s,leftDelim:null,rightDelim:null}}});var rv=(e,t)=>{var n,r,a=t.style;"supsub"===e.type?(n=e.sup?pg(e.sup,t.havingStyle(a.sup()),t):pg(e.sub,t.havingStyle(a.sub()),t),r=Ug(e.base,"horizBrace")):r=Ug(e,"horizBrace");var s,o=pg(r.base,t.havingBaseStyle(tp.DISPLAY)),i=Vg(r,t);if(s=r.isOver?Bf({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:i,wrapperClasses:["svg-align"]}]}):Bf({positionType:"bottom",positionData:o.depth+.1+i.height,children:[{type:"elem",elem:i,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:o}]}),n){var l=zf(["minner",r.isOver?"mover":"munder"],[s],t);s=r.isOver?Bf({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]}):Bf({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]})}return zf(["minner",r.isOver?"mover":"munder"],[s],t)};eg({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],numArgs:1,handler(e,t){var{parser:n,funcName:r}=e;return{type:"horizBrace",mode:n.mode,label:r,isOver:r.includes("\\over"),base:t[0]}},htmlBuilder:rv,mathmlBuilder:(e,t)=>{var n=Fg(e.label);return new vg(e.isOver?"mover":"munder",[Ag(e.base,t),n])}}),eg({type:"href",names:["\\href"],numArgs:2,argTypes:["url","original"],allowedInText:!0,handler:(e,t)=>{var{parser:n}=e,r=t[1],a=Ug(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:a})?{type:"href",mode:n.mode,href:a,body:rg(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=lg(e.body,t,!1);return function(e,t,n,r){var a=new wp(e,t,n,r);return _f(a),a}(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Eg(e.body,t);return n instanceof vg||(n=new vg("mrow",[n])),n.setAttribute("href",e.href),n}}),eg({type:"href",names:["\\url"],numArgs:1,argTypes:["url"],allowedInText:!0,handler:(e,t)=>{var{parser:n}=e,r=Ug(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var a=[],s=0;s<r.length;s++){var o=r[s];"~"===o&&(o="\\textasciitilde"),a.push({type:"textord",mode:"text",text:o})}var i={type:"text",mode:n.mode,font:"\\texttt",body:a};return{type:"href",mode:n.mode,href:r,body:rg(i)}}}),eg({type:"hbox",names:["\\hbox"],numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0,handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:rg(t[0])}},htmlBuilder:(e,t)=>Lf(lg(e.body,t.withFont(""),!1)),mathmlBuilder:(e,t)=>new vg("mrow",Mg(e.body,t.withFont("")))}),eg({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],numArgs:2,argTypes:["raw","original"],allowedInText:!0,handler:(e,t)=>{var n,{parser:r,funcName:a,token:s}=e,o=Ug(t[0],"raw").string,i=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l={};switch(a){case"\\htmlClass":l.class=o,n={command:"\\htmlClass",class:o};break;case"\\htmlId":l.id=o,n={command:"\\htmlId",id:o};break;case"\\htmlStyle":l.style=o,n={command:"\\htmlStyle",style:o};break;case"\\htmlData":for(var c=o.split(","),d=0;d<c.length;d++){var u=c[d],h=u.indexOf("=");if(h<0)throw new _m("\\htmlData key/value '"+u+"' missing equals sign");var m=u.slice(0,h),p=u.slice(h+1);l["data-"+m.trim()]=p}n={command:"\\htmlData",attributes:l};break;default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(n)?{type:"html",mode:r.mode,attributes:l,body:rg(i)}:r.formatUnsupportedCmd(a)},htmlBuilder:(e,t)=>{var n=lg(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var a=zf(r,n,t);for(var s in e.attributes)"class"!==s&&e.attributes.hasOwnProperty(s)&&a.setAttribute(s,e.attributes[s]);return a},mathmlBuilder:(e,t)=>Eg(e.body,t)}),eg({type:"htmlmathml",names:["\\html@mathml"],numArgs:2,allowedInArgument:!0,allowedInText:!0,handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:rg(t[0]),mathml:rg(t[1])}},htmlBuilder:(e,t)=>Lf(lg(e.html,t,!1)),mathmlBuilder:(e,t)=>Eg(e.mathml,t)});var av=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new _m("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!up(n))throw new _m("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};eg({type:"includegraphics",names:["\\includegraphics"],numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1,handler:(e,t,n)=>{var{parser:r}=e,a={number:0,unit:"em"},s={number:.9,unit:"em"},o={number:0,unit:"em"},i="";if(n[0])for(var l=Ug(n[0],"raw").string.split(","),c=0;c<l.length;c++){var d=l[c].split("=");if(2===d.length){var u=d[1].trim();switch(d[0].trim()){case"alt":i=u;break;case"width":a=av(u);break;case"height":s=av(u);break;case"totalheight":o=av(u);break;default:throw new _m("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var h=Ug(t[0],"url").url;return""===i&&(i=(i=(i=h).replace(/^.*[\\/]/,"")).substring(0,i.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:h})?{type:"includegraphics",mode:r.mode,alt:i,width:a,height:s,totalheight:o,src:h}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=hp(e.height,t),r=0;e.totalheight.number>0&&(r=hp(e.totalheight,t)-n);var a=0;e.width.number>0&&(a=hp(e.width,t));var s={height:mp(n+r)};a>0&&(s.width=mp(a)),r>0&&(s.verticalAlign=mp(-r));var o=new Sp(e.src,e.alt,s);return o.height=n,o.depth=r,o},mathmlBuilder:(e,t)=>{var n=new vg("mglyph",[]);n.setAttribute("alt",e.alt);var r=hp(e.height,t),a=0;if(e.totalheight.number>0&&(a=hp(e.totalheight,t)-r,n.setAttribute("valign",mp(-a))),n.setAttribute("height",mp(r+a)),e.width.number>0){var s=hp(e.width,t);n.setAttribute("width",mp(s))}return n.setAttribute("src",e.src),n}}),eg({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0,handler(e,t){var{parser:n,funcName:r}=e,a=Ug(t[0],"size");if(n.settings.strict){var s="m"===r[1],o="mu"===a.value.unit;s?(o||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, not "+a.value.unit+" units"),"math"!==n.mode&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):o&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:a.value}},htmlBuilder:(e,t)=>Hf(e.dimension,t),mathmlBuilder(e,t){var n=hp(e.dimension,t);return new bg(n)}}),eg({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var{parser:n,funcName:r}=e,a=t[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:a}},htmlBuilder:(e,t)=>{var n;"clap"===e.alignment?(n=zf([],[pg(e.body,t)]),n=zf(["inner"],[n],t)):n=zf(["inner"],[pg(e.body,t)]);var r=zf(["fix"],[]),a=zf([e.alignment],[n,r],t),s=zf(["strut"]);return s.style.height=mp(a.height+a.depth),a.depth&&(s.style.verticalAlign=mp(-a.depth)),a.children.unshift(s),a=zf(["thinbox"],[a],t),zf(["mord","vbox"],[a],t)},mathmlBuilder:(e,t)=>{var n=new vg("mpadded",[Ag(e.body,t)]);if("rlap"!==e.alignment){var r="llap"===e.alignment?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}}),eg({type:"styling",names:["\\(","$"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(e,t){var{funcName:n,parser:r}=e,a=r.mode;r.switchMode("math");var s="\\("===n?"\\)":"$",o=r.parseExpression(!1,s);return r.expect(s),r.switchMode(a),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:o}}}),eg({type:"text",names:["\\)","\\]"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(e,t){throw new _m("Mismatched "+e.funcName)}});var sv=(e,t)=>{switch(t.style.size){case tp.DISPLAY.size:return e.display;case tp.TEXT.size:return e.text;case tp.SCRIPT.size:return e.script;case tp.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};eg({type:"mathchoice",names:["\\mathchoice"],numArgs:4,primitive:!0,handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:rg(t[0]),text:rg(t[1]),script:rg(t[2]),scriptscript:rg(t[3])}},htmlBuilder:(e,t)=>Lf(lg(sv(e,t),t,!1)),mathmlBuilder:(e,t)=>Eg(sv(e,t),t)});var ov=(e,t,n,r,a,s,o)=>{e=zf([],[e]);var i,l,c,d=n&&Vm(n);if(t){var u=pg(t,r.havingStyle(a.sup()),r);l={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var h=pg(n,r.havingStyle(a.sub()),r);i={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-h.height)}}if(l&&i)c=Bf({positionType:"bottom",positionData:r.fontMetrics().bigOpSpacing5+i.elem.height+i.elem.depth+i.kern+e.depth+o,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:i.elem,marginLeft:mp(-s)},{type:"kern",size:i.kern},{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:mp(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]});else if(i)c=Bf({positionType:"top",positionData:e.height-o,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:i.elem,marginLeft:mp(-s)},{type:"kern",size:i.kern},{type:"elem",elem:e}]});else{if(!l)return e;c=Bf({positionType:"bottom",positionData:e.depth+o,children:[{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:mp(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}var m=[c];if(i&&0!==s&&!d){var p=zf(["mspace"],[],r);p.style.marginRight=mp(s),m.unshift(p)}return zf(["mop","op-limits"],m,r)},iv=new Set(["\\smallint"]),lv=(e,t)=>{var n,r,a,s=!1;"supsub"===e.type?(n=e.sup,r=e.sub,a=Ug(e.base,"op"),s=!0):a=Ug(e,"op");var o,i,l=t.style,c=!1;if(l.size===tp.DISPLAY.size&&a.symbol&&!iv.has(a.name)&&(c=!0),a.symbol){var d=c?"Size2-Regular":"Size1-Regular",u="";if("\\oiint"!==a.name&&"\\oiiint"!==a.name||(u=a.name.slice(1),a.name="oiint"===u?"\\iint":"\\iiint"),i=(o=Ef(a.name,d,"math",t,["mop","op-symbol",c?"large-op":"small-op"])).italic,u.length>0){var h=Uf(u+"Size"+(c?"2":"1"),t);o=Bf({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:h,shift:c?.08:0}]}),a.name="\\"+u,o.classes.unshift("mop"),o.italic=i}}else if(a.body){var m=lg(a.body,t,!0);1===m.length&&m[0]instanceof kp?(o=m[0]).classes[0]="mop":o=zf(["mop"],m,t)}else{for(var p=[],f=1;f<a.name.length;f++)p.push(Af(a.name[f],a.mode,t));o=zf(["mop"],p,t)}var g,x=0,v=0;(o instanceof kp||"\\oiint"===a.name||"\\oiiint"===a.name)&&!a.suppressBaseShift&&(x=(o.height-o.depth)/2-t.fontMetrics().axisHeight,v=null!=(g=o.italic)?g:0);return s?ov(o,n,r,t,l,v,x):(x&&(o.style.position="relative",o.style.top=mp(x)),o)},cv={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};eg({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],numArgs:0,handler:(e,t)=>{var{parser:n,funcName:r}=e,a=r;return 1===a.length&&(a=cv[a]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:a}},htmlBuilder:lv,mathmlBuilder:(e,t)=>{var n;if(e.symbol)n=new vg("mo",[jg(e.name,e.mode)]),iv.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new vg("mo",Mg(e.body,t));else{n=new vg("mi",[new yg(e.name.slice(1))]);var r=new vg("mo",[jg("","text")]);n=e.parentIsSupSub?new vg("mrow",[n,r]):xg([n,r])}return n}}),eg({type:"op",names:["\\mathop"],numArgs:1,primitive:!0,handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:rg(r)}}});var dv={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};eg({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],numArgs:0,handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}}}),eg({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],numArgs:0,handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}}}),eg({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],numArgs:0,allowedInArgument:!0,handler(e){var{parser:t,funcName:n}=e,r=n;return 1===r.length&&(r=dv[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}}});var uv=(e,t)=>{var n,r,a,s,o=!1;if("supsub"===e.type?(n=e.sup,r=e.sub,a=Ug(e.base,"operatorname"),o=!0):a=Ug(e,"operatorname"),a.body.length>0){for(var i=(lg(a.body.map(e=>{var t="text"in e?e.text:void 0;return"string"==typeof t?{type:"textord",mode:e.mode,text:t}:e}),t.withFont("mathrm"),!0)),l=0;l<i.length;l++){var c=i[l];c instanceof kp&&(c.text=c.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}s=zf(["mop"],i,t)}else s=zf(["mop"],[],t);return o?ov(s,n,r,t,t.style,0,0):s};function hv(e,t,n){for(var r=lg(e,t,!1),a=t.sizeMultiplier/n.sizeMultiplier,s=0;s<r.length;s++){var o=r[s].classes.indexOf("sizing");o<0?Array.prototype.push.apply(r[s].classes,t.sizingClasses(n)):r[s].classes[o+1]==="reset-size"+t.size&&(r[s].classes[o+1]="reset-size"+n.size),r[s].height*=a,r[s].depth*=a}return Lf(r)}eg({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],numArgs:1,handler:(e,t)=>{var{parser:n,funcName:r}=e,a=t[0];return{type:"operatorname",mode:n.mode,body:rg(a),alwaysHandleSupSub:"\\operatornamewithlimits"===r,limits:!1,parentIsSupSub:!1}},htmlBuilder:uv,mathmlBuilder:(e,t)=>{for(var n=Mg(e.body,t.withFont("mathrm")),r=!0,a=0;a<n.length;a++){var s=n[a];if(s instanceof bg);else if(s instanceof vg)switch(s.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":var o=s.children[0];1===s.children.length&&o instanceof yg?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break;default:r=!1}else r=!1}if(r){var i=n.map(e=>e.toText()).join("");n=[new yg(i)]}var l=new vg("mi",n);l.setAttribute("mathvariant","normal");var c=new vg("mo",[jg("","text")]);return e.parentIsSupSub?new vg("mrow",[l,c]):xg([l,c])}}),Fx("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),tg({type:"ordgroup",htmlBuilder:(e,t)=>e.semisimple?Lf(lg(e.body,t,!1)):zf(["mord"],lg(e.body,t,!0),t),mathmlBuilder:(e,t)=>Eg(e.body,t,!0)}),eg({type:"overline",names:["\\overline"],numArgs:1,handler(e,t){var{parser:n}=e,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=pg(e.body,t.havingCrampedStyle()),r=Of("overline-line",t),a=t.fontMetrics().defaultRuleThickness;return zf(["mord","overline"],[Bf({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*a},{type:"elem",elem:r},{type:"kern",size:a}]})],t)},mathmlBuilder(e,t){var n=new vg("mo",[new yg("‾")]);n.setAttribute("stretchy","true");var r=new vg("mover",[Ag(e.body,t),n]);return r.setAttribute("accent","true"),r}}),eg({type:"phantom",names:["\\phantom"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"phantom",mode:n.mode,body:rg(r)}},htmlBuilder:(e,t)=>Lf(lg(e.body,t.withPhantom(),!1)),mathmlBuilder:(e,t)=>{var n=Mg(e.body,t);return new vg("mphantom",n)}}),Fx("\\hphantom","\\smash{\\phantom{#1}}"),eg({type:"vphantom",names:["\\vphantom"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>zf(["mord","rlap"],[zf(["inner"],[pg(e.body,t.withPhantom())]),zf(["fix"],[])],t),mathmlBuilder:(e,t)=>{var n=Mg(rg(e.body),t),r=new vg("mphantom",n),a=new vg("mpadded",[r]);return a.setAttribute("width","0px"),a}}),eg({type:"raisebox",names:["\\raisebox"],numArgs:2,argTypes:["size","hbox"],allowedInText:!0,handler(e,t){var{parser:n}=e,r=Ug(t[0],"size").value,a=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:a}},htmlBuilder(e,t){var n=pg(e.body,t);return Bf({positionType:"shift",positionData:-hp(e.dy,t),children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new vg("mpadded",[Ag(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}}),eg({type:"internal",names:["\\relax"],numArgs:0,allowedInText:!0,allowedInArgument:!0,handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}}),eg({type:"rule",names:["\\rule"],numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"],handler(e,t,n){var{parser:r}=e,a=n[0],s=Ug(t[0],"size"),o=Ug(t[1],"size");return{type:"rule",mode:r.mode,shift:a&&Ug(a,"size").value,width:s.value,height:o.value}},htmlBuilder(e,t){var n=zf(["mord","rule"],[],t),r=hp(e.width,t),a=hp(e.height,t),s=e.shift?hp(e.shift,t):0;return n.style.borderRightWidth=mp(r),n.style.borderTopWidth=mp(a),n.style.bottom=mp(s),n.width=r,n.height=a+s,n.depth=-s,n.maxFontSize=1.125*a*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=hp(e.width,t),r=hp(e.height,t),a=e.shift?hp(e.shift,t):0,s=t.color&&t.getColor()||"black",o=new vg("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",mp(n)),o.setAttribute("height",mp(r));var i=new vg("mpadded",[o]);return a>=0?i.setAttribute("height",mp(a)):(i.setAttribute("height",mp(a)),i.setAttribute("depth",mp(-a))),i.setAttribute("voffset",mp(a)),i}});var mv=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];eg({type:"sizing",names:mv,numArgs:0,allowedInText:!0,handler:(e,t)=>{var{breakOnTokenText:n,funcName:r,parser:a}=e,s=a.parseExpression(!1,n);return{type:"sizing",mode:a.mode,size:mv.indexOf(r)+1,body:s}},htmlBuilder:(e,t)=>{var n=t.havingSize(e.size);return hv(e.body,n,t)},mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=Mg(e.body,n),a=new vg("mstyle",r);return a.setAttribute("mathsize",mp(n.sizeMultiplier)),a}}),eg({type:"smash",names:["\\smash"],numArgs:1,numOptionalArgs:1,allowedInText:!0,handler:(e,t,n)=>{var{parser:r}=e,a=!1,s=!1,o=n[0]&&Ug(n[0],"ordgroup");if(o)for(var i,l=0;l<o.body.length;++l){if("t"===(i=Gg(o.body[l]).text))a=!0;else{if("b"!==i){a=!1,s=!1;break}s=!0}}else a=!0,s=!0;var c=t[0];return{type:"smash",mode:r.mode,body:c,smashHeight:a,smashDepth:s}},htmlBuilder:(e,t)=>{var n=zf([],[pg(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0),e.smashDepth&&(n.depth=0),e.smashHeight&&e.smashDepth)return zf(["mord","smash"],[n],t);if(n.children)for(var r=0;r<n.children.length;r++)e.smashHeight&&(n.children[r].height=0),e.smashDepth&&(n.children[r].depth=0);return zf(["mord"],[Bf({positionType:"firstBaseline",children:[{type:"elem",elem:n}]})],t)},mathmlBuilder:(e,t)=>{var n=new vg("mpadded",[Ag(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}}),eg({type:"sqrt",names:["\\sqrt"],numArgs:1,numOptionalArgs:1,handler(e,t,n){var{parser:r}=e,a=n[0],s=t[0];return{type:"sqrt",mode:r.mode,body:s,index:a}},htmlBuilder(e,t){var n=pg(e.body,t.havingCrampedStyle());0===n.height&&(n.height=t.fontMetrics().xHeight),n=Ff(n,t);var r=t.fontMetrics().defaultRuleThickness,a=r;t.style.id<tp.TEXT.id&&(a=t.fontMetrics().xHeight);var s=r+a/4,{span:o,ruleWidth:i,advanceWidth:l}=function(e,t){var n,r,a,s,o,i=t.havingBaseSizing(),l=Mx("\\surd",e*i.sizeMultiplier,Nx,i),c=i.sizeMultiplier,d=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness);return"small"===l.type?(e<1?c=1:e<1.4&&(c=.7),a=(1+d)/c,(n=vx("sqrtMain",r=(1+d+xx)/c,s=1e3+1e3*d+80,d,t)).style.minWidth="0.853em",o=.833/c):"large"===l.type?(s=1080*Sx[l.size],a=(Sx[l.size]+d)/c,r=(Sx[l.size]+d+xx)/c,(n=vx("sqrtSize"+l.size,r,s,d,t)).style.minWidth="1.02em",o=1/c):(r=e+d+xx,a=e+d,s=Math.floor(1e3*e+d)+80,(n=vx("sqrtTall",r,s,d,t)).style.minWidth="0.742em",o=1.056),n.height=a,n.style.height=mp(r),{span:n,advanceWidth:o,ruleWidth:(t.fontMetrics().sqrtRuleThickness+d)*c}}(n.height+n.depth+s+r,t),c=o.height-i;c>n.height+n.depth+s&&(s=(s+c-n.height-n.depth)/2);var d=o.height-n.height-s-i;n.style.paddingLeft=mp(l);var u=Bf({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+d)},{type:"elem",elem:o},{type:"kern",size:i}]});if(e.index){var h=t.havingStyle(tp.SCRIPTSCRIPT),m=pg(e.index,h,t);return zf(["mord","sqrt"],[zf(["root"],[Bf({positionType:"shift",positionData:-.6*(u.height-u.depth),children:[{type:"elem",elem:m}]})]),u],t)}return zf(["mord","sqrt"],[u],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new vg("mroot",[Ag(n,t),Ag(r,t)]):new vg("msqrt",[Ag(n,t)])}});var pv={display:tp.DISPLAY,text:tp.TEXT,script:tp.SCRIPT,scriptscript:tp.SCRIPTSCRIPT};eg({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],numArgs:0,allowedInText:!0,primitive:!0,handler(e,t){var{breakOnTokenText:n,funcName:r,parser:a}=e,s=a.parseExpression(!0,n),o=r.slice(1,r.length-5);if(!(o in pv))throw new Error("Unknown style: "+o);return{type:"styling",mode:a.mode,style:o,body:s}},htmlBuilder(e,t){var n=pv[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont("")),hv(e.body,r,t)},mathmlBuilder(e,t){var n=pv[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(""));var a=Mg(e.body,r),s=new vg("mstyle",a),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return s.setAttribute("scriptlevel",o[0]),s.setAttribute("displaystyle",o[1]),s}});tg({type:"supsub",htmlBuilder(e,t){var n=function(e,t){var n=e.base;return n?"op"===n.type?n.limits&&(t.style.size===tp.DISPLAY.size||n.alwaysHandleSupSub)?lv:null:"operatorname"===n.type?n.alwaysHandleSupSub&&(t.style.size===tp.DISPLAY.size||n.limits)?uv:null:"accent"===n.type?Vm(n.base)?Yg:null:"horizBrace"===n.type&&!e.sub===n.isOver?rv:null:null}(e,t);if(n)return n(e,t);var r,a,s,{base:o,sup:i,sub:l}=e,c=pg(o,t),d=t.fontMetrics(),u=0,h=0,m=o&&Vm(o);if(i){var p=t.havingStyle(t.style.sup());r=pg(i,p,t),m||(u=c.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(l){var f=t.havingStyle(t.style.sub());a=pg(l,f,t),m||(h=c.depth+f.fontMetrics().subDrop*f.sizeMultiplier/t.sizeMultiplier)}s=t.style===tp.DISPLAY?d.sup1:t.style.cramped?d.sup3:d.sup2;var g,x=t.sizeMultiplier,v=mp(.5/d.ptPerEm/x),y=null;if(a){var b,w=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);if(c instanceof kp||w)y=mp(-(null!=(b=c.italic)?b:0))}if(r&&a){u=Math.max(u,s,r.depth+.25*d.xHeight),h=Math.max(h,d.sub2);var S=4*d.defaultRuleThickness;if(u-r.depth-(a.height-h)<S){h=S-(u-r.depth)+a.height;var j=.8*d.xHeight-(u-r.depth);j>0&&(u+=j,h-=j)}g=Bf({positionType:"individualShift",children:[{type:"elem",elem:a,shift:h,marginRight:v,marginLeft:y},{type:"elem",elem:r,shift:-u,marginRight:v}]})}else if(a)h=Math.max(h,d.sub1,a.height-.8*d.xHeight),g=Bf({positionType:"shift",positionData:h,children:[{type:"elem",elem:a,marginLeft:y,marginRight:v}]});else{if(!r)throw new Error("supsub must have either sup or sub.");u=Math.max(u,s,r.depth+.25*d.xHeight),g=Bf({positionType:"shift",positionData:-u,children:[{type:"elem",elem:r,marginRight:v}]})}return zf([hg(c,"right")||"mord"],[c,zf(["msupsub"],[g])],t)},mathmlBuilder(e,t){var n,r=!1;e.base&&"horizBrace"===e.base.type&&!!e.sup===e.base.isOver&&(r=!0,n=e.base.isOver),!e.base||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0);var a,s=[Ag(e.base,t)];if(e.sub&&s.push(Ag(e.sub,t)),e.sup&&s.push(Ag(e.sup,t)),r)a=n?"mover":"munder";else if(e.sub)if(e.sup){var o=e.base;a=o&&"op"===o.type&&o.limits&&t.style===tp.DISPLAY||o&&"operatorname"===o.type&&o.alwaysHandleSupSub&&(t.style===tp.DISPLAY||o.limits)?"munderover":"msubsup"}else{var i=e.base;a=i&&"op"===i.type&&i.limits&&(t.style===tp.DISPLAY||i.alwaysHandleSupSub)||i&&"operatorname"===i.type&&i.alwaysHandleSupSub&&(i.limits||t.style===tp.DISPLAY)?"munder":"msub"}else{var l=e.base;a=l&&"op"===l.type&&l.limits&&(t.style===tp.DISPLAY||l.alwaysHandleSupSub)||l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||t.style===tp.DISPLAY)?"mover":"msup"}return new vg(a,s)}}),tg({type:"atom",htmlBuilder:(e,t)=>Af(e.text,e.mode,t,["m"+e.family]),mathmlBuilder(e,t){var n=new vg("mo",[jg(e.text,e.mode)]);if("bin"===e.family){var r=Ng(e,t);"bold-italic"===r&&n.setAttribute("mathvariant",r)}else"punct"===e.family?n.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||n.setAttribute("stretchy","false");return n}});var fv={mi:"italic",mn:"normal",mtext:"normal"};tg({type:"mathord",htmlBuilder:(e,t)=>Rf(e,t),mathmlBuilder(e,t){var n=new vg("mi",[jg(e.text,e.mode,t)]),r=Ng(e,t)||"italic";return r!==fv[n.type]&&n.setAttribute("mathvariant",r),n}}),tg({type:"textord",htmlBuilder:(e,t)=>Rf(e,t),mathmlBuilder(e,t){var n,r=jg(e.text,e.mode,t),a=Ng(e,t)||"normal";return n="text"===e.mode?new vg("mtext",[r]):/[0-9]/.test(e.text)?new vg("mn",[r]):"\\prime"===e.text?new vg("mo",[r]):new vg("mi",[r]),a!==fv[n.type]&&n.setAttribute("mathvariant",a),n}});var gv={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},xv={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};tg({type:"spacing",htmlBuilder(e,t){if(xv.hasOwnProperty(e.text)){var n=xv[e.text].className||"";if("text"===e.mode){var r=Rf(e,t);return r.classes.push(n),r}return zf(["mspace",n],[Af(e.text,e.mode,t)],t)}if(gv.hasOwnProperty(e.text))return zf(["mspace",gv[e.text]],[],t);throw new _m('Unknown type of space "'+e.text+'"')},mathmlBuilder(e,t){if(!xv.hasOwnProperty(e.text)){if(gv.hasOwnProperty(e.text))return new vg("mspace");throw new _m('Unknown type of space "'+e.text+'"')}return new vg("mtext",[new yg(" ")])}});var vv=()=>{var e=new vg("mtd",[]);return e.setAttribute("width","50%"),e};tg({type:"tag",mathmlBuilder(e,t){var n=new vg("mtable",[new vg("mtr",[vv(),new vg("mtd",[Eg(e.body,t)]),vv(),new vg("mtd",[Eg(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var yv={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},bv={"\\textbf":"textbf","\\textmd":"textmd"},wv={"\\textit":"textit","\\textup":"textup"},Sv=(e,t)=>{var n=e.font;return n?yv[n]?t.withTextFontFamily(yv[n]):bv[n]?t.withTextFontWeight(bv[n]):"\\emph"===n?"textit"===t.fontShape?t.withTextFontShape("textup"):t.withTextFontShape("textit"):t.withTextFontShape(wv[n]):t};eg({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0,handler(e,t){var{parser:n,funcName:r}=e,a=t[0];return{type:"text",mode:n.mode,body:rg(a),font:r}},htmlBuilder(e,t){var n=Sv(e,t);return zf(["mord","text"],lg(e.body,n,!0),n)},mathmlBuilder(e,t){var n=Sv(e,t);return Eg(e.body,n)}}),eg({type:"underline",names:["\\underline"],numArgs:1,allowedInText:!0,handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=pg(e.body,t),r=Of("underline-line",t),a=t.fontMetrics().defaultRuleThickness;return zf(["mord","underline"],[Bf({positionType:"top",positionData:n.height,children:[{type:"kern",size:a},{type:"elem",elem:r},{type:"kern",size:3*a},{type:"elem",elem:n}]})],t)},mathmlBuilder(e,t){var n=new vg("mo",[new yg("‾")]);n.setAttribute("stretchy","true");var r=new vg("munder",[Ag(e.body,t),n]);return r.setAttribute("accentunder","true"),r}}),eg({type:"vcenter",names:["\\vcenter"],numArgs:1,argTypes:["original"],allowedInText:!1,handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=pg(e.body,t),r=t.fontMetrics().axisHeight;return Bf({positionType:"shift",positionData:.5*(n.height-r-(n.depth+r)),children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new vg("mpadded",[Ag(e.body,t)],["vcenter"]);return new vg("mrow",[n])}}),eg({type:"verb",names:["\\verb"],numArgs:0,allowedInText:!0,handler(e,t,n){throw new _m("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=jv(e),r=[],a=t.havingStyle(t.style.text()),s=0;s<n.length;s++){var o=n[s];"~"===o&&(o="\\textasciitilde"),r.push(Ef(o,"Typewriter-Regular",e.mode,a,["mord","texttt"]))}return zf(["mord","text"].concat(a.sizingClasses(t)),Df(r),a)},mathmlBuilder(e,t){var n=new yg(jv(e)),r=new vg("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var jv=e=>e.body.replace(/ /g,e.star?"␣":" "),kv=Zf,Cv="[ \r\n\t]",Nv="(\\\\[a-zA-Z@]+)"+Cv+"*",Tv="[̀-ͯ]",Mv=new RegExp(Tv+"+$"),Ev="("+Cv+"+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-‧-豈-]"+Tv+"*|[\ud800-\udbff][\udc00-\udfff]"+Tv+"*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|"+Nv+"|\\\\[^\ud800-\udfff])",Av=class{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(Ev,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new Hx("EOF",new Bx(this,t,t));var n=this.tokenRegex.exec(e);if(null===n||n.index!==t)throw new _m("Unexpected character: '"+e[t]+"'",new Hx(e[t],new Bx(this,t,t+1)));var r=n[6]||n[3]||(n[2]?"\\ ":" ");if(14===this.catcodes[r]){var a=e.indexOf("\n",this.tokenRegex.lastIndex);return-1===a?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new Hx(r,new Bx(this,t,this.tokenRegex.lastIndex))}},Rv=class{constructor(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(0===this.undefStack.length)throw new _m("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(null==e[t]?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(void 0===n&&(n=!1),n){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(e)&&(a[e]=this.current[e])}null==t?delete this.current[e]:this.current[e]=t}},Iv=Lx;Fx("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),Fx("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),Fx("\\@firstoftwo",function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),Fx("\\@secondoftwo",function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),Fx("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return 1===t[0].length&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),Fx("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),Fx("\\TextOrMath",function(e){var t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var Dv={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Fx("\\char",function(e){var t,n=e.popToken(),r=0;if("'"===n.text)t=8,n=e.popToken();else if('"'===n.text)t=16,n=e.popToken();else if("`"===n.text)if("\\"===(n=e.popToken()).text[0])r=n.text.charCodeAt(1);else{if("EOF"===n.text)throw new _m("\\char` missing argument");r=n.text.charCodeAt(0)}else t=10;if(t){if(null==(r=Dv[n.text])||r>=t)throw new _m("Invalid base-"+t+" digit "+n.text);for(var a;null!=(a=Dv[e.future().text])&&a<t;)r*=t,r+=a,e.popToken()}return"\\@char{"+r+"}"});var _v=(e,t,n,r)=>{var a=e.consumeArg().tokens;if(1!==a.length)throw new _m("\\newcommand's first argument must be a macro name");var s=a[0].text,o=e.isDefined(s);if(o&&!t)throw new _m("\\newcommand{"+s+"} attempting to redefine "+s+"; use \\renewcommand");if(!o&&!n)throw new _m("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var i=0;if(1===(a=e.consumeArg().tokens).length&&"["===a[0].text){for(var l="",c=e.expandNextToken();"]"!==c.text&&"EOF"!==c.text;)l+=c.text,c=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new _m("Invalid number of arguments: "+l);i=parseInt(l),a=e.consumeArg().tokens}return o&&r||e.macros.set(s,{tokens:a,numArgs:i}),""};Fx("\\newcommand",e=>_v(e,!1,!0,!1)),Fx("\\renewcommand",e=>_v(e,!0,!1,!1)),Fx("\\providecommand",e=>_v(e,!0,!0,!0)),Fx("\\message",e=>{e.consumeArgs(1)[0];return""}),Fx("\\errmessage",e=>{e.consumeArgs(1)[0];return""}),Fx("\\show",e=>{e.popToken().text;return""}),Fx("\\bgroup","{"),Fx("\\egroup","}"),Fx("~","\\nobreakspace"),Fx("\\lq","`"),Fx("\\rq","'"),Fx("\\aa","\\r a"),Fx("\\AA","\\r A"),Fx("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),Fx("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),Fx("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),Fx("ℬ","\\mathscr{B}"),Fx("ℰ","\\mathscr{E}"),Fx("ℱ","\\mathscr{F}"),Fx("ℋ","\\mathscr{H}"),Fx("ℐ","\\mathscr{I}"),Fx("ℒ","\\mathscr{L}"),Fx("ℳ","\\mathscr{M}"),Fx("ℛ","\\mathscr{R}"),Fx("ℭ","\\mathfrak{C}"),Fx("ℌ","\\mathfrak{H}"),Fx("ℨ","\\mathfrak{Z}"),Fx("\\Bbbk","\\Bbb{k}"),Fx("\\llap","\\mathllap{\\textrm{#1}}"),Fx("\\rlap","\\mathrlap{\\textrm{#1}}"),Fx("\\clap","\\mathclap{\\textrm{#1}}"),Fx("\\mathstrut","\\vphantom{(}"),Fx("\\underbar","\\underline{\\text{#1}}"),Fx("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}'),Fx("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),Fx("\\ne","\\neq"),Fx("≠","\\neq"),Fx("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),Fx("∉","\\notin"),Fx("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),Fx("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),Fx("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),Fx("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),Fx("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),Fx("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),Fx("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),Fx("⟂","\\perp"),Fx("‼","\\mathclose{!\\mkern-0.8mu!}"),Fx("∌","\\notni"),Fx("⌜","\\ulcorner"),Fx("⌝","\\urcorner"),Fx("⌞","\\llcorner"),Fx("⌟","\\lrcorner"),Fx("©","\\copyright"),Fx("®","\\textregistered"),Fx("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),Fx("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),Fx("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),Fx("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),Fx("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),Fx("⋮","\\vdots"),Fx("\\varGamma","\\mathit{\\Gamma}"),Fx("\\varDelta","\\mathit{\\Delta}"),Fx("\\varTheta","\\mathit{\\Theta}"),Fx("\\varLambda","\\mathit{\\Lambda}"),Fx("\\varXi","\\mathit{\\Xi}"),Fx("\\varPi","\\mathit{\\Pi}"),Fx("\\varSigma","\\mathit{\\Sigma}"),Fx("\\varUpsilon","\\mathit{\\Upsilon}"),Fx("\\varPhi","\\mathit{\\Phi}"),Fx("\\varPsi","\\mathit{\\Psi}"),Fx("\\varOmega","\\mathit{\\Omega}"),Fx("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),Fx("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),Fx("\\boxed","\\fbox{$\\displaystyle{#1}$}"),Fx("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),Fx("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),Fx("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;"),Fx("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}"),Fx("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var zv={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},Pv=new Set(["bin","rel"]);Fx("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in zv?t=zv[n]:("\\not"===n.slice(0,4)||n in Dp.math&&Pv.has(Dp.math[n].group))&&(t="\\dotsb"),t});var Ov={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Fx("\\dotso",function(e){return e.future().text in Ov?"\\ldots\\,":"\\ldots"}),Fx("\\dotsc",function(e){var t=e.future().text;return t in Ov&&","!==t?"\\ldots\\,":"\\ldots"}),Fx("\\cdots",function(e){return e.future().text in Ov?"\\@cdots\\,":"\\@cdots"}),Fx("\\dotsb","\\cdots"),Fx("\\dotsm","\\cdots"),Fx("\\dotsi","\\!\\cdots"),Fx("\\dotsx","\\ldots\\,"),Fx("\\DOTSI","\\relax"),Fx("\\DOTSB","\\relax"),Fx("\\DOTSX","\\relax"),Fx("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),Fx("\\,","\\tmspace+{3mu}{.1667em}"),Fx("\\thinspace","\\,"),Fx("\\>","\\mskip{4mu}"),Fx("\\:","\\tmspace+{4mu}{.2222em}"),Fx("\\medspace","\\:"),Fx("\\;","\\tmspace+{5mu}{.2777em}"),Fx("\\thickspace","\\;"),Fx("\\!","\\tmspace-{3mu}{.1667em}"),Fx("\\negthinspace","\\!"),Fx("\\negmedspace","\\tmspace-{4mu}{.2222em}"),Fx("\\negthickspace","\\tmspace-{5mu}{.277em}"),Fx("\\enspace","\\kern.5em "),Fx("\\enskip","\\hskip.5em\\relax"),Fx("\\quad","\\hskip1em\\relax"),Fx("\\qquad","\\hskip2em\\relax"),Fx("\\tag","\\@ifstar\\tag@literal\\tag@paren"),Fx("\\tag@paren","\\tag@literal{({#1})}"),Fx("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new _m("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),Fx("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),Fx("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),Fx("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),Fx("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),Fx("\\newline","\\\\\\relax"),Fx("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Lv=mp(Mp["Main-Regular"]["T".charCodeAt(0)][1]-.7*Mp["Main-Regular"]["A".charCodeAt(0)][1]);Fx("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+Lv+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),Fx("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+Lv+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),Fx("\\hspace","\\@ifstar\\@hspacer\\@hspace"),Fx("\\@hspace","\\hskip #1\\relax"),Fx("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),Fx("\\ordinarycolon",":"),Fx("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),Fx("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),Fx("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),Fx("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),Fx("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),Fx("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),Fx("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),Fx("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),Fx("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),Fx("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),Fx("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),Fx("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),Fx("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),Fx("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),Fx("∷","\\dblcolon"),Fx("∹","\\eqcolon"),Fx("≔","\\coloneqq"),Fx("≕","\\eqqcolon"),Fx("⩴","\\Coloneqq"),Fx("\\ratio","\\vcentcolon"),Fx("\\coloncolon","\\dblcolon"),Fx("\\colonequals","\\coloneqq"),Fx("\\coloncolonequals","\\Coloneqq"),Fx("\\equalscolon","\\eqqcolon"),Fx("\\equalscoloncolon","\\Eqqcolon"),Fx("\\colonminus","\\coloneq"),Fx("\\coloncolonminus","\\Coloneq"),Fx("\\minuscolon","\\eqcolon"),Fx("\\minuscoloncolon","\\Eqcolon"),Fx("\\coloncolonapprox","\\Colonapprox"),Fx("\\coloncolonsim","\\Colonsim"),Fx("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Fx("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Fx("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Fx("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Fx("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),Fx("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),Fx("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),Fx("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),Fx("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),Fx("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),Fx("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),Fx("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),Fx("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),Fx("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),Fx("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),Fx("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),Fx("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),Fx("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),Fx("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),Fx("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),Fx("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),Fx("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),Fx("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),Fx("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),Fx("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),Fx("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),Fx("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),Fx("\\imath","\\html@mathml{\\@imath}{ı}"),Fx("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),Fx("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),Fx("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),Fx("⟦","\\llbracket"),Fx("⟧","\\rrbracket"),Fx("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),Fx("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),Fx("⦃","\\lBrace"),Fx("⦄","\\rBrace"),Fx("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),Fx("⦵","\\minuso"),Fx("\\darr","\\downarrow"),Fx("\\dArr","\\Downarrow"),Fx("\\Darr","\\Downarrow"),Fx("\\lang","\\langle"),Fx("\\rang","\\rangle"),Fx("\\uarr","\\uparrow"),Fx("\\uArr","\\Uparrow"),Fx("\\Uarr","\\Uparrow"),Fx("\\N","\\mathbb{N}"),Fx("\\R","\\mathbb{R}"),Fx("\\Z","\\mathbb{Z}"),Fx("\\alef","\\aleph"),Fx("\\alefsym","\\aleph"),Fx("\\Alpha","\\mathrm{A}"),Fx("\\Beta","\\mathrm{B}"),Fx("\\bull","\\bullet"),Fx("\\Chi","\\mathrm{X}"),Fx("\\clubs","\\clubsuit"),Fx("\\cnums","\\mathbb{C}"),Fx("\\Complex","\\mathbb{C}"),Fx("\\Dagger","\\ddagger"),Fx("\\diamonds","\\diamondsuit"),Fx("\\empty","\\emptyset"),Fx("\\Epsilon","\\mathrm{E}"),Fx("\\Eta","\\mathrm{H}"),Fx("\\exist","\\exists"),Fx("\\harr","\\leftrightarrow"),Fx("\\hArr","\\Leftrightarrow"),Fx("\\Harr","\\Leftrightarrow"),Fx("\\hearts","\\heartsuit"),Fx("\\image","\\Im"),Fx("\\infin","\\infty"),Fx("\\Iota","\\mathrm{I}"),Fx("\\isin","\\in"),Fx("\\Kappa","\\mathrm{K}"),Fx("\\larr","\\leftarrow"),Fx("\\lArr","\\Leftarrow"),Fx("\\Larr","\\Leftarrow"),Fx("\\lrarr","\\leftrightarrow"),Fx("\\lrArr","\\Leftrightarrow"),Fx("\\Lrarr","\\Leftrightarrow"),Fx("\\Mu","\\mathrm{M}"),Fx("\\natnums","\\mathbb{N}"),Fx("\\Nu","\\mathrm{N}"),Fx("\\Omicron","\\mathrm{O}"),Fx("\\plusmn","\\pm"),Fx("\\rarr","\\rightarrow"),Fx("\\rArr","\\Rightarrow"),Fx("\\Rarr","\\Rightarrow"),Fx("\\real","\\Re"),Fx("\\reals","\\mathbb{R}"),Fx("\\Reals","\\mathbb{R}"),Fx("\\Rho","\\mathrm{P}"),Fx("\\sdot","\\cdot"),Fx("\\sect","\\S"),Fx("\\spades","\\spadesuit"),Fx("\\sub","\\subset"),Fx("\\sube","\\subseteq"),Fx("\\supe","\\supseteq"),Fx("\\Tau","\\mathrm{T}"),Fx("\\thetasym","\\vartheta"),Fx("\\weierp","\\wp"),Fx("\\Zeta","\\mathrm{Z}"),Fx("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),Fx("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),Fx("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),Fx("\\bra","\\mathinner{\\langle{#1}|}"),Fx("\\ket","\\mathinner{|{#1}\\rangle}"),Fx("\\braket","\\mathinner{\\langle{#1}\\rangle}"),Fx("\\Bra","\\left\\langle#1\\right|"),Fx("\\Ket","\\left|#1\\right\\rangle");var Fv=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,a=t.consumeArg().tokens,s=t.consumeArg().tokens,o=t.macros.get("|"),i=t.macros.get("\\|");t.macros.beginGroup();var l=t=>n=>{e&&(n.macros.set("|",o),a.length&&n.macros.set("\\|",i));var s=t;return!t&&a.length&&"|"===n.future().text&&(n.popToken(),s=!0),{tokens:s?a:r,numArgs:0}};t.macros.set("|",l(!1)),a.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,d=t.expandTokens([...s,...c,...n]);return t.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};Fx("\\bra@ket",Fv(!1)),Fx("\\bra@set",Fv(!0)),Fx("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"),Fx("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"),Fx("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"),Fx("\\angln","{\\angl n}"),Fx("\\blue","\\textcolor{##6495ed}{#1}"),Fx("\\orange","\\textcolor{##ffa500}{#1}"),Fx("\\pink","\\textcolor{##ff00af}{#1}"),Fx("\\red","\\textcolor{##df0030}{#1}"),Fx("\\green","\\textcolor{##28ae7b}{#1}"),Fx("\\gray","\\textcolor{gray}{#1}"),Fx("\\purple","\\textcolor{##9d38bd}{#1}"),Fx("\\blueA","\\textcolor{##ccfaff}{#1}"),Fx("\\blueB","\\textcolor{##80f6ff}{#1}"),Fx("\\blueC","\\textcolor{##63d9ea}{#1}"),Fx("\\blueD","\\textcolor{##11accd}{#1}"),Fx("\\blueE","\\textcolor{##0c7f99}{#1}"),Fx("\\tealA","\\textcolor{##94fff5}{#1}"),Fx("\\tealB","\\textcolor{##26edd5}{#1}"),Fx("\\tealC","\\textcolor{##01d1c1}{#1}"),Fx("\\tealD","\\textcolor{##01a995}{#1}"),Fx("\\tealE","\\textcolor{##208170}{#1}"),Fx("\\greenA","\\textcolor{##b6ffb0}{#1}"),Fx("\\greenB","\\textcolor{##8af281}{#1}"),Fx("\\greenC","\\textcolor{##74cf70}{#1}"),Fx("\\greenD","\\textcolor{##1fab54}{#1}"),Fx("\\greenE","\\textcolor{##0d923f}{#1}"),Fx("\\goldA","\\textcolor{##ffd0a9}{#1}"),Fx("\\goldB","\\textcolor{##ffbb71}{#1}"),Fx("\\goldC","\\textcolor{##ff9c39}{#1}"),Fx("\\goldD","\\textcolor{##e07d10}{#1}"),Fx("\\goldE","\\textcolor{##a75a05}{#1}"),Fx("\\redA","\\textcolor{##fca9a9}{#1}"),Fx("\\redB","\\textcolor{##ff8482}{#1}"),Fx("\\redC","\\textcolor{##f9685d}{#1}"),Fx("\\redD","\\textcolor{##e84d39}{#1}"),Fx("\\redE","\\textcolor{##bc2612}{#1}"),Fx("\\maroonA","\\textcolor{##ffbde0}{#1}"),Fx("\\maroonB","\\textcolor{##ff92c6}{#1}"),Fx("\\maroonC","\\textcolor{##ed5fa6}{#1}"),Fx("\\maroonD","\\textcolor{##ca337c}{#1}"),Fx("\\maroonE","\\textcolor{##9e034e}{#1}"),Fx("\\purpleA","\\textcolor{##ddd7ff}{#1}"),Fx("\\purpleB","\\textcolor{##c6b9fc}{#1}"),Fx("\\purpleC","\\textcolor{##aa87ff}{#1}"),Fx("\\purpleD","\\textcolor{##7854ab}{#1}"),Fx("\\purpleE","\\textcolor{##543b78}{#1}"),Fx("\\mintA","\\textcolor{##f5f9e8}{#1}"),Fx("\\mintB","\\textcolor{##edf2df}{#1}"),Fx("\\mintC","\\textcolor{##e0e5cc}{#1}"),Fx("\\grayA","\\textcolor{##f6f7f7}{#1}"),Fx("\\grayB","\\textcolor{##f0f1f2}{#1}"),Fx("\\grayC","\\textcolor{##e3e5e6}{#1}"),Fx("\\grayD","\\textcolor{##d6d8da}{#1}"),Fx("\\grayE","\\textcolor{##babec2}{#1}"),Fx("\\grayF","\\textcolor{##888d93}{#1}"),Fx("\\grayG","\\textcolor{##626569}{#1}"),Fx("\\grayH","\\textcolor{##3b3e40}{#1}"),Fx("\\grayI","\\textcolor{##21242c}{#1}"),Fx("\\kaBlue","\\textcolor{##314453}{#1}"),Fx("\\kaGreen","\\textcolor{##71B307}{#1}");var Bv={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},Hv=class{constructor(e,t,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new Rv(Iv,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new Av(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,r;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken(),({tokens:r,end:n}=this.consumeArg(["]"]))}else({tokens:r,start:t,end:n}=this.consumeArg());return this.pushToken(new Hx("EOF",n.loc)),this.pushTokens(r),new Hx("",Bx.range(t,n))}consumeSpaces(){for(;" "===this.future().text;)this.stack.pop()}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var r,a=this.future(),s=0,o=0;do{if(r=this.popToken(),t.push(r),"{"===r.text)++s;else if("}"===r.text){if(-1===--s)throw new _m("Extra }",r)}else if("EOF"===r.text)throw new _m("Unexpected end of input in a macro argument, expected '"+(e&&n?e[o]:"}")+"'",r);if(e&&n)if((0===s||1===s&&"{"===e[o])&&r.text===e[o]){if(++o===e.length){t.splice(-o,o);break}}else o=0}while(0!==s||n);return"{"===a.text&&"}"===t[t.length-1].text&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:a,end:r}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new _m("The length of delimiters doesn't match the number of args!");for(var n=t[0],r=0;r<n.length;r++){var a=this.popToken();if(n[r]!==a.text)throw new _m("Use of the macro doesn't match its definition",a)}}for(var s=[],o=0;o<e;o++)s.push(this.consumeArg(t&&t[o+1]).tokens);return s}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new _m("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,r=t.noexpand?null:this._getExpansion(n);if(null==r||e&&r.unexpandable){if(e&&null==r&&"\\"===n[0]&&!this.isDefined(n))throw new _m("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var a=r.tokens,s=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs)for(var o=(a=a.slice()).length-1;o>=0;--o){var i=a[o];if("#"===i.text){if(0===o)throw new _m("Incomplete placeholder at end of macro body",i);if("#"===(i=a[--o]).text)a.splice(o+1,1);else{if(!/^[1-9]$/.test(i.text))throw new _m("Not a valid argument number",i);a.splice(o,2,...s[+i.text-1])}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(!1===this.expandOnce()){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Hx(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(!1===this.expandOnce(!0)){var r=this.stack.pop();r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),t.push(r)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t?t.map(e=>e.text).join(""):t}_getExpansion(e){var t=this.macros.get(e);if(null==t)return t;if(1===e.length){var n=this.lexer.catcodes[e];if(null!=n&&13!==n)return}var r="function"==typeof t?t(this):t;if("string"==typeof r){var a=0;if(r.includes("#"))for(var s=r.replace(/##/g,"");s.includes("#"+(a+1));)++a;for(var o=new Av(r,this.settings),i=[],l=o.lex();"EOF"!==l.text;)i.push(l),l=o.lex();return i.reverse(),{tokens:i,numArgs:a}}return r}isDefined(e){return this.macros.has(e)||kv.hasOwnProperty(e)||Dp.math.hasOwnProperty(e)||Dp.text.hasOwnProperty(e)||Bv.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:kv.hasOwnProperty(e)&&!kv[e].primitive}},Vv=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,$v=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g","ʰ":"h","ⁱ":"i","ʲ":"j","ᵏ":"k","ˡ":"l","ᵐ":"m","ⁿ":"n","ᵒ":"o","ᵖ":"p","ʳ":"r","ˢ":"s","ᵗ":"t","ᵘ":"u","ᵛ":"v","ʷ":"w","ˣ":"x","ʸ":"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),qv={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Uv={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","ḉ":"ḉ","č":"č","ĉ":"ĉ","ċ":"ċ","ç":"ç","ď":"ď","ḋ":"ḋ","ḑ":"ḑ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ḝ":"ḝ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ȩ":"ȩ","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ģ":"ģ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","ḩ":"ḩ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ķ":"ķ","ĺ":"ĺ","ľ":"ľ","ļ":"ļ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ņ":"ņ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ŗ":"ŗ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ş":"ş","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ţ":"ţ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Ḉ":"Ḉ","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ç":"Ç","Ď":"Ď","Ḋ":"Ḋ","Ḑ":"Ḑ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ḝ":"Ḝ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ȩ":"Ȩ","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ģ":"Ģ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Ḩ":"Ḩ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ķ":"Ķ","Ĺ":"Ĺ","Ľ":"Ľ","Ļ":"Ļ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ņ":"Ņ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ŗ":"Ŗ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ş":"Ş","Ť":"Ť","Ṫ":"Ṫ","Ţ":"Ţ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"},Gv=class e{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Hv(e,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(e,t){if(void 0===t&&(t=!0),this.fetch().text!==e)throw new _m("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new Hx("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(t,n){for(var r=[];;){"math"===this.mode&&this.consumeSpaces();var a=this.fetch();if(e.endOfExpression.has(a.text))break;if(n&&a.text===n)break;if(t&&kv[a.text]&&kv[a.text].infix)break;var s=this.parseAtom(n);if(!s)break;"internal"!==s.type&&r.push(s)}return"text"===this.mode&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var t,n=-1,r=0;r<e.length;r++){var a=e[r];if("infix"===a.type){if(-1!==n)throw new _m("only one infix operator per group",a.token);n=r,t=a.replaceWith}}if(-1!==n&&t){var s,o,i=e.slice(0,n),l=e.slice(n+1);return s=1===i.length&&"ordgroup"===i[0].type?i[0]:{type:"ordgroup",mode:this.mode,body:i},o=1===l.length&&"ordgroup"===l[0].type?l[0]:{type:"ordgroup",mode:this.mode,body:l},["\\\\abovefrac"===t?this.callFunction(t,[s,e[n],o],[]):this.callFunction(t,[s,o],[])]}return e}handleSupSubscript(e){var t,n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();do{var a;t=this.parseGroup(e)}while("internal"===(null==(a=t)?void 0:a.type));if(!t)throw new _m("Expected group after '"+r+"'",n);return t}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var r={type:"text",mode:this.mode,body:t};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]}}parseAtom(e){var t,n,r=this.parseGroup("atom",e);if("internal"===(null==r?void 0:r.type))return r;if("text"===this.mode)return r;for(;;){this.consumeSpaces();var a=this.fetch();if("\\limits"===a.text||"\\nolimits"===a.text){if(r&&"op"===r.type)r.limits="\\limits"===a.text,r.alwaysHandleSupSub=!0;else{if(!r||"operatorname"!==r.type)throw new _m("Limit controls must follow a math operator",a);r.alwaysHandleSupSub&&(r.limits="\\limits"===a.text)}this.consume()}else if("^"===a.text){if(t)throw new _m("Double superscript",a);t=this.handleSupSubscript("superscript")}else if("_"===a.text){if(n)throw new _m("Double subscript",a);n=this.handleSupSubscript("subscript")}else if("'"===a.text){if(t)throw new _m("Double superscript",a);var s={type:"textord",mode:this.mode,text:"\\prime"},o=[s];for(this.consume();"'"===this.fetch().text;)o.push(s),this.consume();"^"===this.fetch().text&&o.push(this.handleSupSubscript("superscript")),t={type:"ordgroup",mode:this.mode,body:o}}else{if(!$v[a.text])break;var i=Vv.test(a.text),l=[];for(l.push(new Hx($v[a.text])),this.consume();;){var c=this.fetch().text;if(!$v[c])break;if(Vv.test(c)!==i)break;l.unshift(new Hx($v[c])),this.consume()}var d=this.subparse(l);i?n={type:"ordgroup",mode:"math",body:d}:t={type:"ordgroup",mode:"math",body:d}}}return t&&n?{type:"supsub",mode:this.mode,base:r,sup:t,sub:n}:t?{type:"supsub",mode:this.mode,base:r,sup:t}:n?{type:"supsub",mode:this.mode,base:r,sub:n}:r}parseFunction(e,t){var n=this.fetch(),r=n.text,a=kv[r];if(!a)return null;if(this.consume(),t&&"atom"!==t&&!a.allowedInArgument)throw new _m("Got function '"+r+"' with no arguments"+(t?" as "+t:""),n);if("text"===this.mode&&!a.allowedInText)throw new _m("Can't use function '"+r+"' in text mode",n);if("math"===this.mode&&!1===a.allowedInMath)throw new _m("Can't use function '"+r+"' in math mode",n);var{args:s,optArgs:o}=this.parseArguments(r,a);return this.callFunction(r,s,o,n,e)}callFunction(e,t,n,r,a){var s={funcName:e,parser:this,token:r,breakOnTokenText:a},o=kv[e];if(o&&o.handler)return o.handler(s,t,n);throw new _m("No function handler for "+e)}parseArguments(e,t){var n,r=null!=(n=t.numOptionalArgs)?n:0,a=t.numArgs+r;if(0===a)return{args:[],optArgs:[]};for(var s=[],o=[],i=0;i<a;i++){var l,c=null==(l=t.argTypes)?void 0:l[i],d=i<r;("primitive"in t&&t.primitive&&null==c||"sqrt"===t.type&&1===i&&null==o[0])&&(c="primitive");var u=this.parseGroupOfType("argument to '"+e+"'",c,d);if(d)o.push(u);else{if(null==u)throw new _m("Null argument, please report this as a bug");s.push(u)}}return{args:s,optArgs:o}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":var r=this.parseArgumentGroup(n,"text");return null!=r?{type:"styling",mode:r.mode,body:[r],style:"text",resetFont:!0}:null;case"raw":var a=this.parseStringGroup(n);return null!=a?{type:"raw",mode:"text",string:a.text}:null;case"primitive":if(n)throw new _m("A primitive argument cannot be optional");var s=this.parseGroup(e);if(null==s)throw new _m("Expected group as "+e,this.fetch());return s;case"original":case void 0:return this.parseArgumentGroup(n);default:throw new _m("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;" "===this.fetch().text;)this.consume()}parseStringGroup(e){var t=this.gullet.scanArgument(e);if(null==t)return null;for(var n,r="";"EOF"!==(n=this.fetch()).text;)r+=n.text,this.consume();return this.consume(),t.text=r,t}parseRegexGroup(e,t){for(var n,r=this.fetch(),a=r,s="";"EOF"!==(n=this.fetch()).text&&e.test(s+n.text);)s+=(a=n).text,this.consume();if(""===s)throw new _m("Invalid "+t+": '"+r.text+"'",r);return r.range(a,s)}parseColorGroup(e){var t=this.parseStringGroup(e);if(null==t)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new _m("Invalid color: '"+t.text+"'",t);var r=n[0];return/^[0-9a-f]{6}$/i.test(r)&&(r="#"+r),{type:"color-token",mode:this.mode,color:r}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!(t=e||"{"===this.gullet.future().text?this.parseStringGroup(e):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")))return null;e||0!==t.text.length||(t.text="0pt",n=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!r)throw new _m("Invalid size: '"+t.text+"'",t);var a={number:+(r[1]+r[2]),unit:r[3]};if(!up(a))throw new _m("Invalid unit: '"+a.unit+"'",t);return{type:"size",mode:this.mode,value:a,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup(e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),null==t)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(null==n)return null;var r=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var a=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var s={type:"ordgroup",mode:this.mode,loc:n.loc,body:a};return t&&this.switchMode(r),s}parseGroup(e,t){var n,r=this.fetch(),a=r.text;if("{"===a||"\\begingroup"===a){this.consume();var s="{"===a?"}":"\\endgroup";this.gullet.beginGroup();var o=this.parseExpression(!1,s),i=this.fetch();this.expect(s),this.gullet.endGroup(),n={type:"ordgroup",mode:this.mode,loc:Bx.range(r,i),body:o,semisimple:"\\begingroup"===a||void 0}}else if(null==(n=this.parseFunction(t,e)||this.parseSymbol())&&"\\"===a[0]&&!Bv.hasOwnProperty(a)){if(this.settings.throwOnError)throw new _m("Undefined control sequence: "+a,r);n=this.formatUnsupportedCmd(a),this.consume()}return n}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var r=e[n];if("textord"===r.type){var a=r.text,s=e[n+1];if(s&&"textord"===s.type){if("-"===a&&"-"===s.text){var o=e[n+2];n+1<t&&o&&"textord"===o.type&&"-"===o.text?(e.splice(n,3,{type:"textord",mode:"text",loc:Bx.range(r,o),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:Bx.range(r,s),text:"--"}),t-=1)}"'"!==a&&"`"!==a||s.text!==a||(e.splice(n,2,{type:"textord",mode:"text",loc:Bx.range(r,s),text:a+a}),t-=1)}}}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),r="*"===n.charAt(0);if(r&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new _m("\\verb assertion failed --\n please report what input caused this bug");return{type:"verb",mode:"text",body:n=n.slice(1,-1),star:r}}Uv.hasOwnProperty(t[0])&&!Dp[this.mode][t[0]]&&(this.settings.strict&&"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=Uv[t[0]]+t.slice(1));var a,s=Mv.exec(t);if(s&&("i"===(t=t.substring(0,s.index))?t="ı":"j"===t&&(t="ȷ")),Dp[this.mode][t]){this.settings.strict&&"math"===this.mode&&hf.includes(t)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var o,i=Dp[this.mode][t].group,l=Bx.range(e);o=function(e){return e in $g}(i)?{type:"atom",mode:this.mode,family:i,loc:l,text:t}:{type:i,mode:this.mode,loc:l,text:t},a=o}else{if(!(t.charCodeAt(0)>=128))return null;this.settings.strict&&(ap(t.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'" ('+t.charCodeAt(0)+")",e)),a={type:"textord",mode:"text",loc:Bx.range(e),text:t}}if(this.consume(),s)for(var c=0;c<s[0].length;c++){var d=s[0][c];if(!qv[d])throw new _m("Unknown accent ' "+d+"'",e);var u=qv[d][this.mode]||qv[d].text;if(!u)throw new _m("Accent "+d+" unsupported in "+this.mode+" mode",e);a={type:"accent",mode:this.mode,loc:Bx.range(e),label:u,isStretchy:!1,isShifty:!0,base:a}}return a}};Gv.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Wv=function(e,t){if(!("string"==typeof e||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new Gv(e,t);delete n.gullet.macros.current["\\df@tag"];var r=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new _m("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:n.subparse([new Hx("\\df@tag")])}]}return r},Kv=function(e,t,n){t.textContent="";var r=Xv(e,n).toNode();t.appendChild(r)};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&(Kv=function(){throw new _m("KaTeX doesn't work in quirks mode.")});var Yv=function(e,t,n){if(n.throwOnError||!(e instanceof _m))throw e;var r=zf(["katex-error"],[new kp(t)]);return r.setAttribute("title",e.toString()),r.setAttribute("style","color:"+n.errorColor),r},Xv=function(e,t){var n=new Gm(t);try{return function(e,t,n){var r,a=Pg(n);return"mathml"===n.output?Rg(e,t,a,n.displayMode,!0):(r="html"===n.output?zf(["katex"],[gg(e,a)]):zf(["katex"],[Rg(e,t,a,n.displayMode,!1),gg(e,a)]),Og(r,n))}(Wv(e,n),e,n)}catch(r){return Yv(r,e,n)}},Zv={version:"0.17.0",render:Kv,renderToString:function(e,t){return Xv(e,t).toMarkup()},ParseError:_m,SETTINGS_SCHEMA:$m,__parse:function(e,t){return Wv(e,new Gm(t))},__renderToDomTree:Xv,__renderToHTMLTree:function(e,t){var n=new Gm(t);try{return function(e,t,n){return Og(zf(["katex"],[gg(e,Pg(n))]),n)}(Wv(e,n),0,n)}catch(r){return Yv(r,e,n)}},__setFontMetrics:function(e,t){Mp[e]=t},__defineSymbol:_p,__defineFunction:eg,__defineMacro:Fx,__domTree:{Span:bp,Anchor:wp,SymbolNode:kp,SvgNode:Cp,PathNode:Np,LineNode:Tp}};Zv.__defineMacro("\\ce",function(e){return Jv(e.consumeArgs(1)[0],"ce")}),Zv.__defineMacro("\\pu",function(e){return Jv(e.consumeArgs(1)[0],"pu")}),Zv.__defineMacro("\\tripledash","{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");var Jv=function(e,t){for(var n="",r=e.length&&e[e.length-1].loc.start,a=e.length-1;a>=0;a--)e[a].loc.start>r&&(n+=" ",r=e[a].loc.start),n+=e[a].text,r+=e[a].text.length;return ey.go(Qv.go(n,t))},Qv={go:function(e,t){if(!e)return[];void 0===t&&(t="ce");var n,r="0",a={};a.parenthesisLevel=0,e=(e=(e=e.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var s=10,o=[];;){n!==e?(s=10,n=e):s--;var i=Qv.stateMachines[t],l=i.transitions[r]||i.transitions["*"];e:for(var c=0;c<l.length;c++){var d=Qv.patterns.match_(l[c].pattern,e);if(d){for(var u=l[c].task,h=0;h<u.action_.length;h++){var m;if(i.actions[u.action_[h].type_])m=i.actions[u.action_[h].type_](a,d.match_,u.action_[h].option);else{if(!Qv.actions[u.action_[h].type_])throw["MhchemBugA","mhchem bug A. Please report. ("+u.action_[h].type_+")"];m=Qv.actions[u.action_[h].type_](a,d.match_,u.action_[h].option)}Qv.concatArray(o,m)}if(r=u.nextState||r,!(e.length>0))return o;if(u.revisit||(e=d.remainder),!u.toContinue)break e}}if(s<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(e,t){if(t)if(Array.isArray(t))for(var n=0;n<t.length;n++)e.push(t[n]);else e.push(t)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return t&&t[0]?{match_:t.splice(1),remainder:e.substr(t[0].length)}:null},"(-)(9)^(-9)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return t&&t[0]?{match_:t.splice(1),remainder:e.substr(t[0].length)}:null},"state of aggregation $":function(e){var t=Qv.patterns.findObserveGroups(e,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(t&&t.remainder.match(/^($|[\s,;\)\]\}])/))return t;var n=e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return n?{match_:n[0],remainder:e.substr(n[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(e){return Qv.patterns.findObserveGroups(e,"^{","","","}")},"^($...$)":function(e){return Qv.patterns.findObserveGroups(e,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return Qv.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(e){return Qv.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return Qv.patterns.findObserveGroups(e,"_{","","","}")},"_($...$)":function(e){return Qv.patterns.findObserveGroups(e,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return Qv.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(e){return Qv.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return Qv.patterns.findObserveGroups(e,"","{","}","")},"{(...)}":function(e){return Qv.patterns.findObserveGroups(e,"{","","","}")},"$...$":function(e){return Qv.patterns.findObserveGroups(e,"","$","$","")},"${(...)}$":function(e){return Qv.patterns.findObserveGroups(e,"${","","","}$")},"$(...)$":function(e){return Qv.patterns.findObserveGroups(e,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(e){return Qv.patterns.findObserveGroups(e,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return Qv.patterns.findObserveGroups(e,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return Qv.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(e){return Qv.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(e){return Qv.patterns.findObserveGroups(e,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(e){return Qv.patterns.findObserveGroups(e,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(e){return Qv.patterns.findObserveGroups(e,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(e){return Qv.patterns.findObserveGroups(e,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(e){return Qv.patterns.findObserveGroups(e,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(e){return Qv.patterns.findObserveGroups(e,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(e){return Qv.patterns.findObserveGroups(e,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(e){return Qv.patterns.findObserveGroups(e,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(e){var t=e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/);if(t)return{match_:t[0],remainder:e.substr(t[0].length)};var n=Qv.patterns.findObserveGroups(e,"","$","$","");return n&&(t=n.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/))?{match_:t[0],remainder:e.substr(t[0].length)}:null},amount2:function(e){return this.amount(e)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(e){if(e.match(/^\([a-z]+\)$/))return null;var t=e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return t?{match_:t[0],remainder:e.substr(t[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(e,t,n,r,a,s,o,i,l,c){var d=function(e,t){if("string"==typeof t)return 0!==e.indexOf(t)?null:t;var n=e.match(t);return n?n[0]:null},u=d(e,t);if(null===u)return null;if(e=e.substr(u.length),null===(u=d(e,n)))return null;var h=function(e,t,n){for(var r=0;t<e.length;){var a=e.charAt(t),s=d(e.substr(t),n);if(null!==s&&0===r)return{endMatchBegin:t,endMatchEnd:t+s.length};if("{"===a)r++;else if("}"===a){if(0===r)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];r--}t++}return null}(e,u.length,r||a);if(null===h)return null;var m=e.substring(0,r?h.endMatchEnd:h.endMatchBegin);if(s||o){var p=this.findObserveGroups(e.substr(h.endMatchEnd),s,o,i,l);if(null===p)return null;var f=[m,p.match_];return{match_:c?f.join(""):f,remainder:p.remainder}}return{match_:m,remainder:e.substr(h.endMatchEnd)}},match_:function(e,t){var n=Qv.patterns.patterns[e];if(void 0===n)throw["MhchemBugP","mhchem bug P. Please report. ("+e+")"];if("function"==typeof n)return Qv.patterns.patterns[e](t);var r=t.match(n);return r?{match_:r[2]?[r[1],r[2]]:r[1]?r[1]:r[0],remainder:t.substr(r[0].length)}:null}},actions:{"a=":function(e,t){e.a=(e.a||"")+t},"b=":function(e,t){e.b=(e.b||"")+t},"p=":function(e,t){e.p=(e.p||"")+t},"o=":function(e,t){e.o=(e.o||"")+t},"q=":function(e,t){e.q=(e.q||"")+t},"d=":function(e,t){e.d=(e.d||"")+t},"rm=":function(e,t){e.rm=(e.rm||"")+t},"text=":function(e,t){e.text_=(e.text_||"")+t},insert:function(e,t,n){return{type_:n}},"insert+p1":function(e,t,n){return{type_:n,p1:t}},"insert+p1+p2":function(e,t,n){return{type_:n,p1:t[0],p2:t[1]}},copy:function(e,t){return t},rm:function(e,t){return{type_:"rm",p1:t||""}},text:function(e,t){return Qv.go(t,"text")},"{text}":function(e,t){var n=["{"];return Qv.concatArray(n,Qv.go(t,"text")),n.push("}"),n},"tex-math":function(e,t){return Qv.go(t,"tex-math")},"tex-math tight":function(e,t){return Qv.go(t,"tex-math tight")},bond:function(e,t,n){return{type_:"bond",kind_:n||t}},"color0-output":function(e,t){return{type_:"color0",color:t[0]}},ce:function(e,t){return Qv.go(t)},"1/2":function(e,t){var n=[];t.match(/^[+\-]/)&&(n.push(t.substr(0,1)),t=t.substr(1));var r=t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return r[1]=r[1].replace(/\$/g,""),n.push({type_:"frac",p1:r[1],p2:r[2]}),r[3]&&(r[3]=r[3].replace(/\$/g,""),n.push({type_:"tex-math",p1:r[3]})),n},"9,9":function(e,t){return Qv.go(t,"9,9")}},createTransitions:function(e){var t,n,r,a,s={};for(t in e)for(n in e[t])for(r=n.split("|"),e[t][n].stateArray=r,a=0;a<r.length;a++)s[r[a]]=[];for(t in e)for(n in e[t])for(r=e[t][n].stateArray||[],a=0;a<r.length;a++){var o=e[t][n];if(o.action_){o.action_=[].concat(o.action_);for(var i=0;i<o.action_.length;i++)"string"==typeof o.action_[i]&&(o.action_[i]={type_:o.action_[i]})}else o.action_=[];for(var l=t.split("|"),c=0;c<l.length;c++)if("*"===r[a])for(var d in s)s[d].push({pattern:l[c],task:o});else s[r[a]].push({pattern:l[c],task:o})}return s},stateMachines:{}};Qv.stateMachines={ce:{transitions:Qv.createTransitions({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(e,t){var n;if((e.d||"").match(/^[0-9]+$/)){var r=e.d;e.d=void 0,n=this.output(e),e.b=r}else n=this.output(e);return Qv.actions["o="](e,t),n},"d= kv":function(e,t){e.d=t,e.dType="kv"},"charge or bond":function(e,t){if(e.beginsWithBond){var n=[];return Qv.concatArray(n,this.output(e)),Qv.concatArray(n,Qv.actions.bond(e,t,"-")),n}e.d=t},"- after o/d":function(e,t,n){var r=Qv.patterns.match_("orbital",e.o||""),a=Qv.patterns.match_("one lowercase greek letter $",e.o||""),s=Qv.patterns.match_("one lowercase latin letter $",e.o||""),o=Qv.patterns.match_("$one lowercase latin letter$ $",e.o||""),i="-"===t&&(r&&""===r.remainder||a||s||o);!i||e.a||e.b||e.p||e.d||e.q||r||!s||(e.o="$"+e.o+"$");var l=[];return i?(Qv.concatArray(l,this.output(e)),l.push({type_:"hyphen"})):(r=Qv.patterns.match_("digits",e.d||""),n&&r&&""===r.remainder?(Qv.concatArray(l,Qv.actions["d="](e,t)),Qv.concatArray(l,this.output(e))):(Qv.concatArray(l,this.output(e)),Qv.concatArray(l,Qv.actions.bond(e,t,"-")))),l},"a to o":function(e){e.o=e.a,e.a=void 0},"sb=true":function(e){e.sb=!0},"sb=false":function(e){e.sb=!1},"beginsWithBond=true":function(e){e.beginsWithBond=!0},"beginsWithBond=false":function(e){e.beginsWithBond=!1},"parenthesisLevel++":function(e){e.parenthesisLevel++},"parenthesisLevel--":function(e){e.parenthesisLevel--},"state of aggregation":function(e,t){return{type_:"state of aggregation",p1:Qv.go(t,"o")}},comma:function(e,t){var n=t.replace(/\s*$/,"");return n!==t&&0===e.parenthesisLevel?{type_:"comma enumeration L",p1:n}:{type_:"comma enumeration M",p1:n}},output:function(e,t,n){var r,a,s;e.r?(a="M"===e.rdt?Qv.go(e.rd,"tex-math"):"T"===e.rdt?[{type_:"text",p1:e.rd||""}]:Qv.go(e.rd),s="M"===e.rqt?Qv.go(e.rq,"tex-math"):"T"===e.rqt?[{type_:"text",p1:e.rq||""}]:Qv.go(e.rq),r={type_:"arrow",r:e.r,rd:a,rq:s}):(r=[],(e.a||e.b||e.p||e.o||e.q||e.d||n)&&(e.sb&&r.push({type_:"entitySkip"}),e.o||e.q||e.d||e.b||e.p||2===n?e.o||e.q||e.d||!e.b&&!e.p?e.o&&"kv"===e.dType&&Qv.patterns.match_("d-oxidation$",e.d||"")?e.dType="oxidation":e.o&&"kv"===e.dType&&!e.q&&(e.dType=void 0):(e.o=e.a,e.d=e.b,e.q=e.p,e.a=e.b=e.p=void 0):(e.o=e.a,e.a=void 0),r.push({type_:"chemfive",a:Qv.go(e.a,"a"),b:Qv.go(e.b,"bd"),p:Qv.go(e.p,"pq"),o:Qv.go(e.o,"o"),q:Qv.go(e.q,"pq"),d:Qv.go(e.d,"oxidation"===e.dType?"oxidation":"bd"),dType:e.dType})));for(var o in e)"parenthesisLevel"!==o&&"beginsWithBond"!==o&&delete e[o];return r},"oxidation-output":function(e,t){var n=["{"];return Qv.concatArray(n,Qv.go(t,"oxidation")),n.push("}"),n},"frac-output":function(e,t){return{type_:"frac-ce",p1:Qv.go(t[0]),p2:Qv.go(t[1])}},"overset-output":function(e,t){return{type_:"overset",p1:Qv.go(t[0]),p2:Qv.go(t[1])}},"underset-output":function(e,t){return{type_:"underset",p1:Qv.go(t[0]),p2:Qv.go(t[1])}},"underbrace-output":function(e,t){return{type_:"underbrace",p1:Qv.go(t[0]),p2:Qv.go(t[1])}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:Qv.go(t[1])}},"r=":function(e,t){e.r=t},"rdt=":function(e,t){e.rdt=t},"rd=":function(e,t){e.rd=t},"rqt=":function(e,t){e.rqt=t},"rq=":function(e,t){e.rq=t},operator:function(e,t,n){return{type_:"operator",kind_:n||t}}}},a:{transitions:Qv.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},"$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:Qv.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"{text}"}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:Qv.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(e){if(e.text_){var t={type_:"text",p1:e.text_};for(var n in e)delete e[n];return t}}}},pq:{transitions:Qv.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(e,t){return{type_:"state of aggregation subscript",p1:Qv.go(t,"o")}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:Qv.go(t[1],"pq")}}}},bd:{transitions:Qv.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(e,t){return{type_:"color",color1:t[0],color2:Qv.go(t[1],"bd")}}}},oxidation:{transitions:Qv.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(e,t){return{type_:"roman numeral",p1:t||""}}}},"tex-math":{transitions:Qv.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(e){if(e.o){var t={type_:"tex-math",p1:e.o};for(var n in e)delete e[n];return t}}}},"tex-math tight":{transitions:Qv.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(e,t){e.o=(e.o||"")+"{"+t+"}"},output:function(e){if(e.o){var t={type_:"tex-math",p1:e.o};for(var n in e)delete e[n];return t}}}},"9,9":{transitions:Qv.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:Qv.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(e,t){var n=[];return"+-"===t[0]||"+/-"===t[0]?n.push("\\pm "):t[0]&&n.push(t[0]),t[1]&&(Qv.concatArray(n,Qv.go(t[1],"pu-9,9")),t[2]&&(t[2].match(/[,.]/)?Qv.concatArray(n,Qv.go(t[2],"pu-9,9")):n.push(t[2])),t[3]=t[4]||t[3],t[3]&&(t[3]=t[3].trim(),"e"===t[3]||"*"===t[3].substr(0,1)?n.push({type_:"cdot"}):n.push({type_:"times"}))),t[3]&&n.push("10^{"+t[5]+"}"),n},"number^":function(e,t){var n=[];return"+-"===t[0]||"+/-"===t[0]?n.push("\\pm "):t[0]&&n.push(t[0]),Qv.concatArray(n,Qv.go(t[1],"pu-9,9")),n.push("^{"+t[2]+"}"),n},operator:function(e,t,n){return{type_:"operator",kind_:n||t}},space:function(){return{type_:"pu-space-1"}},output:function(e){var t,n=Qv.patterns.match_("{(...)}",e.d||"");n&&""===n.remainder&&(e.d=n.match_);var r=Qv.patterns.match_("{(...)}",e.q||"");if(r&&""===r.remainder&&(e.q=r.match_),e.d&&(e.d=e.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.d=e.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),e.q){e.q=e.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.q=e.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var a={d:Qv.go(e.d,"pu"),q:Qv.go(e.q,"pu")};"//"===e.o?t={type_:"pu-frac",p1:a.d,p2:a.q}:(t=a.d,a.d.length>1||a.q.length>1?t.push({type_:" / "}):t.push({type_:"/"}),Qv.concatArray(t,a.q))}else t=Qv.go(e.d,"pu-2");for(var s in e)delete e[s];return t}}},"pu-2":{transitions:Qv.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(e,t){e.rm+="^{"+t+"}"},space:function(){return{type_:"pu-space-2"}},output:function(e){var t=[];if(e.rm){var n=Qv.patterns.match_("{(...)}",e.rm||"");t=n&&""===n.remainder?Qv.go(n.match_,"pu"):{type_:"rm",p1:e.rm}}for(var r in e)delete e[r];return t}}},"pu-9,9":{transitions:Qv.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(e){var t=[];if(e.text_=e.text_||"",e.text_.length>4){var n=e.text_.length%3;0===n&&(n=3);for(var r=e.text_.length-3;r>0;r-=3)t.push(e.text_.substr(r,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(0,n)),t.reverse()}else t.push(e.text_);for(var a in e)delete e[a];return t},"output-o":function(e){var t=[];if(e.text_=e.text_||"",e.text_.length>4){for(var n=e.text_.length-3,r=0;r<n;r+=3)t.push(e.text_.substr(r,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(r))}else t.push(e.text_);for(var a in e)delete e[a];return t}}}};var ey={go:function(e,t){if(!e)return"";for(var n="",r=!1,a=0;a<e.length;a++){var s=e[a];"string"==typeof s?n+=s:(n+=ey._go2(s),"1st-level escape"===s.type_&&(r=!0))}return t||r||!n||(n="{"+n+"}"),n},_goInner:function(e){return e?ey.go(e,!0):e},_go2:function(e){var t;switch(e.type_){case"chemfive":t="";var n={a:ey._goInner(e.a),b:ey._goInner(e.b),p:ey._goInner(e.p),o:ey._goInner(e.o),q:ey._goInner(e.q),d:ey._goInner(e.d)};n.a&&(n.a.match(/^[+\-]/)&&(n.a="{"+n.a+"}"),t+=n.a+"\\,"),(n.b||n.p)&&(t+="{\\vphantom{X}}",t+="^{\\hphantom{"+(n.b||"")+"}}_{\\hphantom{"+(n.p||"")+"}}",t+="{\\vphantom{X}}",t+="^{\\smash[t]{\\vphantom{2}}\\mathllap{"+(n.b||"")+"}}",t+="_{\\vphantom{2}\\mathllap{\\smash[t]{"+(n.p||"")+"}}}"),n.o&&(n.o.match(/^[+\-]/)&&(n.o="{"+n.o+"}"),t+=n.o),"kv"===e.dType?((n.d||n.q)&&(t+="{\\vphantom{X}}"),n.d&&(t+="^{"+n.d+"}"),n.q&&(t+="_{\\smash[t]{"+n.q+"}}")):"oxidation"===e.dType?(n.d&&(t+="{\\vphantom{X}}",t+="^{"+n.d+"}"),n.q&&(t+="{\\vphantom{X}}",t+="_{\\smash[t]{"+n.q+"}}")):(n.q&&(t+="{\\vphantom{X}}",t+="_{\\smash[t]{"+n.q+"}}"),n.d&&(t+="{\\vphantom{X}}",t+="^{"+n.d+"}"));break;case"rm":case"roman numeral":t="\\mathrm{"+e.p1+"}";break;case"text":e.p1.match(/[\^_]/)?(e.p1=e.p1.replace(" ","~").replace("-","\\text{-}"),t="\\mathrm{"+e.p1+"}"):t="\\text{"+e.p1+"}";break;case"state of aggregation":t="\\mskip2mu "+ey._goInner(e.p1);break;case"state of aggregation subscript":t="\\mskip1mu "+ey._goInner(e.p1);break;case"bond":if(!(t=ey._getBond(e.kind_)))throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+e.kind_+")"];break;case"frac":var r="\\frac{"+e.p1+"}{"+e.p2+"}";t="\\mathchoice{\\textstyle"+r+"}{"+r+"}{"+r+"}{"+r+"}";break;case"pu-frac":var a="\\frac{"+ey._goInner(e.p1)+"}{"+ey._goInner(e.p2)+"}";t="\\mathchoice{\\textstyle"+a+"}{"+a+"}{"+a+"}{"+a+"}";break;case"tex-math":case"1st-level escape":t=e.p1+" ";break;case"frac-ce":t="\\frac{"+ey._goInner(e.p1)+"}{"+ey._goInner(e.p2)+"}";break;case"overset":t="\\overset{"+ey._goInner(e.p1)+"}{"+ey._goInner(e.p2)+"}";break;case"underset":t="\\underset{"+ey._goInner(e.p1)+"}{"+ey._goInner(e.p2)+"}";break;case"underbrace":t="\\underbrace{"+ey._goInner(e.p1)+"}_{"+ey._goInner(e.p2)+"}";break;case"color":t="{\\color{"+e.color1+"}{"+ey._goInner(e.color2)+"}}";break;case"color0":t="\\color{"+e.color+"}";break;case"arrow":var s={rd:ey._goInner(e.rd),rq:ey._goInner(e.rq)},o="\\x"+ey._getArrow(e.r);s.rq&&(o+="[{"+s.rq+"}]"),t=o+=s.rd?"{"+s.rd+"}":"{}";break;case"operator":t=ey._getOperator(e.kind_);break;case"space":t=" ";break;case"entitySkip":case"pu-space-1":t="~";break;case"pu-space-2":t="\\mkern3mu ";break;case"1000 separator":t="\\mkern2mu ";break;case"commaDecimal":t="{,}";break;case"comma enumeration L":t="{"+e.p1+"}\\mkern6mu ";break;case"comma enumeration M":t="{"+e.p1+"}\\mkern3mu ";break;case"comma enumeration S":t="{"+e.p1+"}\\mkern1mu ";break;case"hyphen":t="\\text{-}";break;case"addition compound":t="\\,{\\cdot}\\,";break;case"electron dot":t="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":t="{\\times}";break;case"prime":t="\\prime ";break;case"cdot":t="\\cdot ";break;case"tight cdot":t="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":t="\\times ";break;case"circa":t="{\\sim}";break;case"^":t="uparrow";break;case"v":t="downarrow";break;case"ellipsis":t="\\ldots ";break;case"/":t="/";break;case" / ":t="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return t},_getArrow:function(e){switch(e){case"->":case"→":case"⟶":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<--\x3e":return"rightleftarrows";case"<=>":case"⇌":return"rightleftharpoons";case"<=>>":return"rightequilibrium";case"<<=>":return"leftequilibrium";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(e){switch(e){case"-":case"1":return"{-}";case"=":case"2":return"{=}";case"#":case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";case"~=":case"~--":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";case"-~-":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(e){switch(e){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":case"$\\approx$":return" {}\\approx{} ";case"v":case"(v)":return" \\downarrow{} ";case"^":case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}};var ty="local-user",ny="You",ry="#4F46E5";function ay(e){if(!e)return[];const t=e.getJSON(),n=[];return(t.content??[]).forEach((e,t)=>{if("heading"===e.type&&e.attrs?.level){const r=(e.content??[]).map(e=>e.text??"").join("");n.push([`${e.attrs.level}:${t}:${r}`,r,`h${e.attrs.level}`])}}),n}var sy=(0,u.forwardRef)(({content:e,contentKey:t,onChange:n,onHeadingsChange:a,readOnly:i},l)=>{const c=function(){const e=(0,u.useRef)({loadedContentKey:null,shouldSuppressNextLoad:!1});return{shouldLoadContent:(0,u.useCallback)(t=>{const n=e.current;return n.shouldSuppressNextLoad?(n.shouldSuppressNextLoad=!1,!1):n.loadedContentKey!==t},[]),markContentLoaded:(0,u.useCallback)(t=>{e.current.loadedContentKey=t},[]),markContentSaved:(0,u.useCallback)(()=>{e.current.shouldSuppressNextLoad=!0},[])}}(),[d,h]=(0,u.useState)("light"),m=t??e.slice(0,40),f=function(){const[e,t]=(0,u.useState)({}),n=(0,u.useRef)(e);n.current=e;const r=(0,u.useCallback)(e=>{t(t=>({...t,[e.id]:e}))},[]),a=(0,u.useCallback)((e,n)=>{t(t=>t[e]?{...t,[e]:{...t[e],text:n}}:t)},[]),s=(0,u.useCallback)((e,n)=>{t(t=>t[e]?{...t,[e]:{...t[e],replies:[...t[e].replies||[],n]}}:t)},[]),o=(0,u.useCallback)((e,n)=>{t(t=>t[e]?{...t,[e]:{...t[e],resolved:n}}:t)},[]),i=(0,u.useCallback)(e=>{t(t=>{if(!t[e])return t;const n={...t};return delete n[e],n})},[]),l=(0,u.useCallback)(e=>{t(t=>{const n={};for(const r of e){const e=t[r.id];n[r.id]=e?{...r,text:e.text||r.text,replies:e.replies}:r}return n})},[]),c=(0,u.useCallback)(e=>Boolean(n.current[e]),[]);return{threads:Object.values(e).sort((e,t)=>t.timestamp-e.timestamp),addThread:r,setThreadText:a,addReply:s,setResolved:o,removeThread:i,hydrate:l,has:c}}(),g=(0,u.useRef)(f);g.current=f;const[x,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(null),[w,S]=(0,u.useState)(!0),j=(0,u.useMemo)(()=>[...km.filter(e=>"comment"!==e.name),s.Comment.configure({authorId:ty,authorName:ny,authorColor:ry,onCommentAdd:e=>g.current.addThread(e),onCommentRemove:e=>g.current.removeThread(e),onCommentResolve:(e,t)=>g.current.setResolved(e,t)})],[]),k=(0,u.useRef)(n),C=(0,u.useRef)(a),N=(0,u.useRef)(!1),T=(0,u.useRef)(null),M=(0,u.useRef)(null),E=(0,u.useRef)(0);(0,u.useEffect)(()=>{k.current=n},[n]),(0,u.useEffect)(()=>{C.current=a},[a]);const A=(0,u.useCallback)(e=>{if(!C.current)return;const t=ay(e),n=Date.now(),r=n-E.current;r>=300?(E.current=n,C.current(t)):(M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{E.current=Date.now(),C.current?.(ay(e))},300-r))},[]),[R,I]=(0,u.useState)(null),D=(0,u.useCallback)(({editor:e})=>{N.current=!0,T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{N.current&&(N.current=!1,c.markContentSaved(),k.current(e.getHTML()))},2e4),A(e)},[A,c]),_=(0,u.useCallback)(({editor:e})=>{S(e.state.selection.empty);const t=function(e){if(!e.isActive(Im))return null;const t=e.getAttributes(Im).id;return"string"==typeof t&&t?t:null}(e);t&&(b(t),v(!0))},[]);(0,u.useEffect)(()=>{R&&c.shouldLoadContent(m)&&(R.commands.setContent(e||""),c.markContentLoaded(m),A(R),g.current.hydrate(function(e){const t=new Map;return e.state.doc.descendants(e=>{if(e.isText)for(const n of e.marks){if(n.type.name!==Im)continue;const e=n.attrs;e.id&&!t.has(e.id)&&t.set(e.id,{id:e.id,authorId:e.authorId??"",authorName:e.authorName??"Anonymous",authorColor:e.authorColor??"#4F46E5",text:e.text??"",timestamp:"number"==typeof e.timestamp?e.timestamp:Date.now(),resolved:Boolean(e.resolved),replies:[]})}}),[...t.values()]}(R)),b(null))},[R,m,c,A]),(0,u.useEffect)(()=>{R&&R.setEditable(!i)},[R,i]),(0,u.useEffect)(()=>{const e=R;return()=>{T.current&&clearTimeout(T.current),M.current&&clearTimeout(M.current),e&&N.current&&(N.current=!1,c.markContentSaved(),k.current(e.getHTML()))}},[R,c]);const z=(0,u.useCallback)(e=>{if(!R)return null;const t=e.indexOf(":"),n=e.indexOf(":",t+1),r=e.slice(0,t),a=e.slice(n+1);for(const s of R.view.dom.querySelectorAll(`h${r}`))if(s.textContent?.trim()===a)return s;return null},[R]);(0,u.useImperativeHandle)(l,()=>({scrollToHeading:e=>z(e)?.scrollIntoView({behavior:"smooth",block:"start"}),getElementByKey:e=>z(e)}),[z]);const P=(0,u.useCallback)(()=>{if(!R)return;const e=`comment-${Date.now()}`;R.chain().focus().setComment({id:e}).run()&&(b(e),v(!0))},[R]),O=(0,u.useCallback)(e=>{b(e),R&&function(e,t){const n=Dm(e,t);!!n&&(e.chain().setTextSelection(n).run(),e.view.dom.querySelector(`[data-comment-id="${t}"]`)?.scrollIntoView({behavior:"smooth",block:"center"}))}(R,e)},[R]),L=(0,u.useCallback)((e,t)=>{f.setResolved(e,t),R&&function(e,t,n){const r=Dm(e,t);if(!r)return!1;const{state:a,view:s}=e,o=a.schema.marks[Im];if(!o)return!1;const i=a.tr;a.doc.nodesBetween(r.from,r.to,(e,a)=>{if(!e.isText)return;const s=e.marks.find(e=>e.type===o&&e.attrs.id===t);if(!s)return;const l=Math.max(a,r.from),c=Math.min(a+e.nodeSize,r.to);i.removeMark(l,c,o),i.addMark(l,c,o.create({...s.attrs,...n}))}),i.docChanged&&s.dispatch(i)}(R,e,{resolved:t})},[R,f]),F=(0,u.useCallback)(e=>{f.removeThread(e),R&&function(e,t){const n=Dm(e,t);if(!n)return!1;const{state:r,view:a}=e,s=r.schema.marks[Im];if(!s)return!1;const o=r.tr.removeMark(n.from,n.to,s);o.docChanged&&a.dispatch(o)}(R,e),b(t=>t===e?null:t)},[R,f]),B=(0,u.useCallback)((e,t)=>{f.addReply(e,{id:`reply-${Date.now()}`,authorId:ty,authorName:ny,authorColor:ry,text:t,timestamp:Date.now()})},[f]),H=f.threads.filter(e=>!e.resolved).length;return(0,p.jsxs)("div",{className:"flex h-full w-full flex-col bg-editor-bg",children:[(0,p.jsx)(jm,{editor:R,theme:d,setTheme:h}),(0,p.jsx)(o.NovelEditor,{className:"flex flex-1 min-h-0 flex-col",extensions:j,initialContent:e,editable:!i,onEditor:I,onUpdate:D,onSelectionUpdate:_,children:({editor:e,EditorSurface:t})=>(0,p.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[!i&&e&&(0,p.jsx)(r.RichTextToolbar,{theme:d,setTheme:h,onAddComment:P,commentDisabled:w,showComments:x,onToggleComments:()=>v(e=>!e),commentCount:H}),(0,p.jsxs)("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[(0,p.jsx)(t,{className:"flex-1 min-h-0 overflow-auto prose dark:prose-invert max-w-none px-4 py-3"}),!i&&x&&(0,p.jsx)("div",{className:"w-80 shrink-0",children:(0,p.jsx)(Rm,{threads:f.threads,activeId:y,onSelect:O,onSubmitBody:f.setThreadText,onReply:B,onResolve:L,onRemove:F,onClose:()=>v(!1)})})]}),!i&&e&&(0,p.jsx)(r.BubbleMenus,{})]})})]})});function oy({activeDocument:e,documents:t,splitViewDocId:n,activeDocId:r,isMobile:a,editorRef:s,onUpdateDocument:o,onHeadingsChange:i,onCloseSplitView:l,aiSuggestion:c,isAiLoading:d,onAiRewrite:u,onAiApprove:h,onAiReject:m,onAiRegenerate:g,onInviteClick:x,onShareClick:v}){if(!e)return(0,p.jsx)("div",{className:"flex h-full items-center justify-center bg-editor-bg",children:(0,p.jsxs)("div",{className:"text-center",children:[(0,p.jsx)(f.FileText,{className:"mx-auto h-16 w-16 text-muted-foreground mb-4"}),(0,p.jsx)("h2",{className:"text-2xl font-serif font-semibold text-foreground mb-2",children:"No Note Selected"}),(0,p.jsx)("p",{className:"text-muted-foreground",children:a?"Tap the menu to select a note":"Select a note from the sidebar or create a new one"})]})});if(n&&n!==r){const r=t.find(e=>e.id===n);return(0,p.jsx)("div",{className:"flex-1 h-full",children:(0,p.jsxs)(xm,{direction:"horizontal",children:[(0,p.jsx)(om,{minSize:"300px",children:(0,p.jsx)("div",{className:"flex flex-col h-full border-r border-border",children:(0,p.jsx)("div",{className:"flex-1 min-h-0",children:(0,p.jsx)(sy,{ref:s,contentKey:e.id,content:e.content,onChange:t=>o(e.id,{content:t}),title:e.title,onTitleChange:t=>o(e.id,{title:t}),scrollToHeading:()=>{},onHeadingsChange:i,aiSuggestion:c,isAiLoading:d,onAiRewrite:u,onAiApprove:h,onAiReject:m,onAiRegenerate:g,onInviteClick:x,onShareClick:v,documentId:e.id})})})}),(0,p.jsx)(om,{minSize:"300px",children:(0,p.jsx)("div",{className:"flex flex-col h-full",children:r?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[(0,p.jsx)("span",{className:"text-sm font-medium",children:r.title}),(0,p.jsx)($d,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:l,title:"Close split view",children:(0,p.jsx)(f.X,{className:"h-3 w-3"})})]}),(0,p.jsx)("div",{className:"flex-1 min-h-0",children:(0,p.jsx)(sy,{content:r.content,onChange:e=>o(r.id,{content:e}),title:r.title,onTitleChange:e=>o(r.id,{title:e}),scrollToHeading:()=>{},onInviteClick:x,onShareClick:v,documentId:r.id})})]}):null})})]})})}return(0,p.jsx)("div",{className:"h-full flex flex-col",children:(0,p.jsx)(sy,{ref:s,contentKey:e.id,content:e.content,onChange:t=>o(e.id,{content:t}),title:e.title,onTitleChange:t=>o(e.id,{title:t}),scrollToHeading:()=>{},onHeadingsChange:i,aiSuggestion:c,isAiLoading:d,onAiRewrite:u,onAiApprove:h,onAiReject:m,onAiRegenerate:g,onInviteClick:x,onShareClick:v,documentId:e.id})})}sy.displayName="TiptapEditorWrapper";var iy="bg-white/10 dark:bg-black/20 backdrop-blur-md border-white/15 dark:border-white/10",ly={top:!1,right:!1,bottom:!1,left:!0,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},cy=Object.fromEntries(ru.map(({type:e,label:t})=>[e,t]));function dy({panels:e,split:t,documents:n,activeId:r,activeDocument:a,onSelect:s,onAdd:o,onDelete:i,onDuplicate:l,onMove:c,onManageTags:d,onRename:h,headings:m,onNavigate:g,openTabs:x,activeTab:v,onTabChange:y,onTabClose:b,onTabRename:w,onSplitRight:S,onReopenLastClosed:j,canReopenLastClosed:k,outlineRef:C,editorRef:N,tabItems:M,onNewChat:E,aiProps:A,tipsProps:R,topicsProps:I,onClose:D,isMobile:_,isOpen:z,onOpenChange:P}){const[O,L]=(0,u.useState)(320),F=1===e.length?cy[e[0]]:"Right Panel",B=(0,p.jsxs)("div",{className:"h-full overflow-hidden flex flex-col",children:[(0,p.jsxs)("div",{className:"px-3 py-2 border-b border-sidebar-border/60 flex items-center justify-between select-none shrink-0",children:[(0,p.jsx)("h3",{className:"text-sm font-semibold text-sidebar-foreground",children:F}),(0,p.jsx)($d,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:D,children:(0,p.jsx)(f.X,{className:"h-4 w-4"})})]}),(0,p.jsx)("div",{className:"flex-1 min-h-0",children:(0,p.jsx)(bm,{panels:e,split:t,persistenceKey:"right",activeDocuments:n,activeId:r,activeDocument:a,headings:m,onSelect:s,onAdd:o,onDelete:i,onDuplicate:l,onMove:c,onManageTags:d,onRename:h,outlineRef:C,editorRef:N,openTabs:x,activeTab:v,onTabChange:y,onTabClose:b,onTabRename:w,onSplitRight:S,onReopenLastClosed:j,canReopenLastClosed:k,onNavigate:g,tabItems:M,onNewChat:E,aiProps:A,tipsProps:R,topicsProps:I})})]});return _?(0,p.jsx)(vo,{open:z,onOpenChange:P,children:(0,p.jsx)(wo,{side:"right",className:xo("w-80 p-0",iy),children:(0,p.jsx)("aside",{className:"h-full flex flex-col",children:B})})}):(0,p.jsx)(T.Resizable,{size:{width:O,height:"100%"},onResizeStop:(e,t,n)=>L(n.offsetWidth),minWidth:260,maxWidth:640,enable:ly,className:xo("h-full flex flex-col border-l shrink-0",iy),children:B})}function uy({className:e,children:t,...n}){return(0,p.jsxs)(po,{"data-slot":"scroll-area",className:xo("relative",e),...n,children:[(0,p.jsx)(fo,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&>div]:!block",children:t}),(0,p.jsx)(hy,{}),(0,p.jsx)(hy,{orientation:"horizontal"}),(0,p.jsx)(go,{})]})}function hy({className:e,orientation:t="vertical",...n}){return(0,p.jsx)(Hs,{"data-slot":"scroll-area-scrollbar",orientation:t,className:xo("flex touch-none p-px transition-colors select-none","vertical"===t&&"h-full w-2.5 border-l border-l-transparent","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent",e),...n,children:(0,p.jsx)(Js,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}var my=u.forwardRef(({className:e,...t},n)=>(0,p.jsx)("span",{ref:n,className:xo("absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0",e),style:{clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)"},...t}));my.displayName="VisuallyHidden";var py=({open:e,onOpenChange:t,documents:n,onSelectDocument:r,onOpenSettings:a,onOpenTeams:s,onToggleTheme:o,currentTheme:i="light"})=>{const[l,c]=(0,u.useState)(""),d=(0,u.useRef)(null),h=(0,u.useMemo)(()=>{const e=[];return a&&e.push({id:"settings",label:"Open Settings",icon:(0,p.jsx)(f.Settings,{className:"h-4 w-4"}),action:()=>{a(),t(!1)},keywords:["settings","preferences","config"]}),s&&e.push({id:"teams",label:"Manage Teams",icon:(0,p.jsx)(f.Users,{className:"h-4 w-4"}),action:()=>{s(),t(!1)},keywords:["teams","organization","members","collaborate"]}),o&&e.push({id:"theme",label:"dark"===i?"Switch to Light Mode":"Switch to Dark Mode",icon:"dark"===i?(0,p.jsx)(f.Sun,{className:"h-4 w-4"}):(0,p.jsx)(f.Moon,{className:"h-4 w-4"}),action:()=>{o()},keywords:["theme","dark","light","mode","appearance"]}),e},[a,s,o,i,t]),m=(0,u.useMemo)(()=>function(e,t){const n=t.trim();if(!n)return[];const r=n.toLowerCase(),a=[];for(const s of e){const e=Gh(s.content),t=e.toLowerCase(),o=Wh(t,r);if(s.title.toLowerCase().includes(r))a.push({document:s,matchType:"title",matchCount:o,preview:e?e.slice(0,120)+(e.length>120?"...":""):void 0});else if(o>0){const i=t.indexOf(r),l=Math.max(0,i-40),c=Math.min(e.length,i+n.length+40);a.push({document:s,matchType:"content",matchCount:o,preview:(l>0?"...":"")+e.slice(l,c)+(c<e.length?"...":"")})}}return a}(n,l),[l,n]),g=(0,u.useMemo)(()=>{if(!l.trim())return h;const e=l.toLowerCase();return h.filter(t=>{const n=t.label.toLowerCase().includes(e),r=t.keywords?.some(t=>t.toLowerCase().includes(e));return n||r})},[l,h]);(0,u.useEffect)(()=>{e?setTimeout(()=>d.current?.focus(),100):c("")},[e]),(0,u.useEffect)(()=>{const n=n=>{e&&"Escape"===n.key&&t(!1)};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e,t]);const x=g.length>0,v=m.length>0,y=""!==l.trim()&&!x&&!v;return(0,p.jsx)(Rd,{open:e,onOpenChange:t,children:(0,p.jsxs)(_d,{className:"max-w-2xl w-[95vw] sm:w-full p-0 gap-0 max-h-[90vh] sm:max-h-[85vh]",children:[(0,p.jsx)(my,{children:(0,p.jsx)(Pd,{children:"Search notes and commands"})}),(0,p.jsx)(zd,{className:"px-4 py-4 border-b border-border",children:(0,p.jsxs)("div",{className:"relative",children:[(0,p.jsx)(f.Command,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,p.jsx)(am,{ref:d,type:"text",placeholder:"Search notes or type a command...",value:l,onChange:e=>c(e.target.value),className:"pl-9 pr-9 border-none shadow-none focus-visible:ring-0 text-sm sm:text-base"}),l&&(0,p.jsx)("button",{onClick:()=>c(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:(0,p.jsx)(f.X,{className:"h-4 w-4"})})]})}),(0,p.jsx)(uy,{className:"max-h-[50vh] sm:max-h-[60vh]",children:""===l.trim()?(0,p.jsxs)("div",{className:"py-2",children:[h.length>0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"px-4 py-2",children:(0,p.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Quick Actions"})}),h.map(e=>(0,p.jsx)("button",{onClick:e.action,className:"w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border last:border-0",children:(0,p.jsxs)("div",{className:"flex items-center gap-3",children:[(0,p.jsx)("div",{className:"flex-shrink-0 text-muted-foreground",children:e.icon}),(0,p.jsx)("span",{className:"text-sm font-medium",children:e.label})]})},e.id))]}),(0,p.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[(0,p.jsx)(f.Search,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"Type to search across all your notes"})]})]}):y?(0,p.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[(0,p.jsx)(f.FileText,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),(0,p.jsxs)("p",{className:"text-sm text-muted-foreground",children:['No results found for "',l,'"']})]}):(0,p.jsxs)("div",{className:"py-2",children:[x&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"px-4 py-2",children:(0,p.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Commands"})}),g.map(e=>(0,p.jsx)("button",{onClick:e.action,className:"w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border",children:(0,p.jsxs)("div",{className:"flex items-center gap-3",children:[(0,p.jsx)("div",{className:"flex-shrink-0 text-muted-foreground",children:e.icon}),(0,p.jsx)("span",{className:"text-sm font-medium",children:e.label})]})},e.id))]}),v&&(0,p.jsxs)(p.Fragment,{children:[x&&(0,p.jsx)("div",{className:"px-4 py-2 mt-2",children:(0,p.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Notes"})}),m.map(e=>(0,p.jsx)("button",{onClick:()=>(e=>{r(e),t(!1),c("")})(e.document.id),className:"w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border last:border-0",children:(0,p.jsxs)("div",{className:"flex items-start gap-3",children:[(0,p.jsx)(f.FileText,{className:"h-4 w-4 mt-1 flex-shrink-0 text-muted-foreground"}),(0,p.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,p.jsx)("h3",{className:"font-medium text-sm truncate",children:e.document.title||"Untitled"}),"content"===e.matchType&&e.matchCount>1&&(0,p.jsxs)("span",{className:"flex-shrink-0 text-xs text-muted-foreground tabular-nums",children:[e.matchCount," matches"]})]}),e.preview&&(0,p.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.preview})]})]})},e.document.id))]})]})}),(0,p.jsxs)("div",{className:"px-4 py-3 border-t border-border bg-muted/30",children:[(0,p.jsxs)("p",{className:"text-xs text-muted-foreground text-center hidden sm:block",children:["Press ",(0,p.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"⌘K"})," or ",(0,p.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"Ctrl+K"})," to open • ",(0,p.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"ESC"})," to close"]}),(0,p.jsxs)("p",{className:"text-xs text-muted-foreground text-center sm:hidden",children:["Tap ",(0,p.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"ESC"})," to close"]})]})]})})};function fy({...e}){return(0,p.jsx)("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function gy({className:e,...t}){return(0,p.jsx)("ol",{"data-slot":"breadcrumb-list",className:xo("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function xy({className:e,...t}){return(0,p.jsx)("li",{"data-slot":"breadcrumb-item",className:xo("inline-flex items-center gap-1.5",e),...t})}function vy({asChild:e,className:t,...n}){return(0,p.jsx)(e?h.Slot:"a",{"data-slot":"breadcrumb-link",className:xo("hover:text-foreground transition-colors",t),...n})}function yy({className:e,...t}){return(0,p.jsx)("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:xo("text-foreground font-normal",e),...t})}function by({children:e,className:t,...n}){return(0,p.jsx)("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:xo("[&>svg]:size-3.5",t),...n,children:e??(0,p.jsx)(f.ChevronRight,{})})}function wy(){const[e,t]=u.useState(void 0);return u.useEffect(()=>{const e=window.matchMedia("(max-width: 1023px)"),n=()=>{t(window.innerWidth<1024)};return e.addEventListener("change",n),t(window.innerWidth<1024),()=>e.removeEventListener("change",n)},[]),!!e}function Sy({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return(0,p.jsx)(S.Root,{"data-slot":"separator",decorative:n,orientation:t,className:xo("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...r})}var jy=u.createContext(null);function ky(){const e=u.useContext(jy);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Cy({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:a,children:s,...o}){const i=wy(),[l,c]=u.useState(!1),[d,h]=u.useState(e),m=t??d,f=u.useCallback(e=>{const t="function"==typeof e?e(m):e;n?n(t):h(t),document.cookie=`sidebar_state=${t}; path=/; max-age=604800`},[n,m]),g=u.useCallback(()=>i?c(e=>!e):f(e=>!e),[i,f,c]);u.useEffect(()=>{const e=e=>{const t=document.activeElement;if(t){const e=t.tagName.toLowerCase();if("input"===e||"textarea"===e||"true"===t.getAttribute("contenteditable")||t.closest(".cm-editor")||t.closest(".ProseMirror"))return}"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),g())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g,null]);const x=m?"expanded":"collapsed",v=u.useMemo(()=>({state:x,open:m,setOpen:f,isMobile:i,openMobile:l,setOpenMobile:c,toggleSidebar:g}),[x,m,f,i,l,c,g]);return(0,p.jsx)(jy.Provider,{value:v,children:(0,p.jsx)(qd,{delayDuration:0,children:(0,p.jsx)("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"420px","--sidebar-width-icon":"5.2875rem",...a},className:xo("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",r),...o,children:s})})})}function Ny({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:a,...s}){const{isMobile:o,state:i,openMobile:l,setOpenMobile:c}=ky();return"none"===n?(0,p.jsx)("div",{"data-slot":"sidebar",className:xo("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",r),...s,children:a}):o?(0,p.jsx)(vo,{open:l,onOpenChange:c,...s,children:(0,p.jsxs)(wo,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":"16.2rem"},side:e,children:[(0,p.jsxs)(So,{className:"sr-only",children:[(0,p.jsx)(jo,{children:"Sidebar"}),(0,p.jsx)(ko,{children:"Displays the mobile sidebar."})]}),(0,p.jsx)("div",{className:"flex h-full w-full flex-col",children:a})]})}):(0,p.jsxs)("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":i,"data-collapsible":"collapsed"===i?n:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[(0,p.jsx)("div",{"data-slot":"sidebar-gap",className:xo("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===t||"inset"===t?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+var(--spacing-4))]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),(0,p.jsx)("div",{"data-slot":"sidebar-container",className:xo("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===t||"inset"===t?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+var(--spacing-4)+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...s,children:(0,p.jsx)("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:a})})]})}function Ty({className:e,...t}){return(0,p.jsx)("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:xo("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function My({className:e,...t}){return(0,p.jsx)("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:xo("relative flex w-full min-w-0 flex-col p-2",e),...t})}function Ey({className:e,...t}){return(0,p.jsx)("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:xo("w-full text-sm",e),...t})}function Ay({className:e,...t}){return(0,p.jsx)("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:xo("flex w-full min-w-0 flex-col gap-1",e),...t})}function Ry({className:e,...t}){return(0,p.jsx)("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:xo("group/menu-item relative",e),...t})}var Iy=t.cva("cursor-pointer peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-2xl p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1.5px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1.5px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Dy({asChild:e=!1,isActive:t=!1,variant:n="default",size:r="default",tooltip:a,className:s,...o}){const i=e?h.Slot:"button",{isMobile:l,state:c}=ky(),d=(0,p.jsx)(i,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":t,className:xo(Iy({variant:n,size:r}),s),...o});return a?("string"==typeof a&&(a={children:a}),(0,p.jsxs)(Ud,{children:[(0,p.jsx)(Gd,{asChild:!0,children:d}),(0,p.jsx)(Wd,{side:"right",align:"center",hidden:"collapsed"!==c||l,...a})]})):d}var _y=(e,t,n,r,a,s,o,i)=>{let l=document.documentElement,c=["light","dark"];function d(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n="class"===e,r=n&&s?a.map(e=>s[e]||e):a;n?(l.classList.remove(...r),l.classList.add(s&&s[t]?s[t]:t)):l.setAttribute(e,t)}),function(e){i&&c.includes(e)&&(l.style.colorScheme=e)}(t)}if(r)d(r);else try{let e=localStorage.getItem(t)||n;d(o&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e)}catch(u){}},zy=u.createContext(void 0),Py={setTheme:e=>{},themes:[]},Oy=()=>{var e;return null!=(e=u.useContext(zy))?e:Py};u.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:a,defaultTheme:s,value:o,themes:i,nonce:l,scriptProps:c})=>{let d=JSON.stringify([n,t,s,e,i,o,r,a]).slice(1,-1);return u.createElement("script",{...c,suppressHydrationWarning:!0,nonce:"undefined"==typeof window?l:"",dangerouslySetInnerHTML:{__html:`(${_y.toString()})(${d})`}})});function Ly({className:e,...t}){return(0,p.jsx)(b.Root,{"data-slot":"label",className:xo("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function Fy({className:e,...t}){return(0,p.jsx)(ws,{"data-slot":"radio-group",className:xo("grid gap-3",e),...t})}function By({className:e,...t}){return(0,p.jsx)(ks,{"data-slot":"radio-group-item",className:xo("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:(0,p.jsx)(Ns,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:(0,p.jsx)(f.CircleIcon,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}var Hy=["modern-minimal","elegant-luxury","cyberpunk","twitter","mocha-mousse","amethyst-haze","notebook","doom-64","catppuccin","graphite","perpetuity","kodama-grove","cosmic-night","tangerine","nature","bold-tech","amber-minimal","supabase","neo-brutalism","quantum-rose","solar-dusk","bubblegum","pink-lemonade","claymorphism","pastel-dreams"],Vy={"modern-minimal":{primary:"#3b82f6",secondary:"#f3f4f6"},"elegant-luxury":{primary:"#9b2c2c",secondary:"#fdf2d6"},cyberpunk:{primary:"#ff00c8",secondary:"#f0f0ff"},twitter:{primary:"#1e9df1",secondary:"#0f1419"},"mocha-mousse":{primary:"#A37764",secondary:"#BAAB92"},bubblegum:{primary:"#d04f99",secondary:"#8acfd1"},"amethyst-haze":{primary:"#8a79ab",secondary:"#dfd9ec"},"pink-lemonade":{primary:"#a84370",secondary:"#f1c4e6"},notebook:{primary:"#606060",secondary:"#dedede"},"doom-64":{primary:"#b71c1c",secondary:"#556b2f"},catppuccin:{primary:"#8839ef",secondary:"#ccd0da"},graphite:{primary:"#606060",secondary:"#e0e0e0"},perpetuity:{primary:"#06858e",secondary:"#d9eaea"},"kodama-grove":{primary:"#8d9d4f",secondary:"#decea0"},"cosmic-night":{primary:"#6e56cf",secondary:"#e4dfff"},tangerine:{primary:"#e05d38",secondary:"#f3f4f6"},"quantum-rose":{primary:"#e6067a",secondary:"#ffd6ff"},nature:{primary:"#2e7d32",secondary:"#e8f5e9"},"bold-tech":{primary:"#8b5cf6",secondary:"#f3f0ff"},"amber-minimal":{primary:"#f59e0b",secondary:"#f3f4f6"},supabase:{primary:"#72e3ad",secondary:"#fdfdfd"},"neo-brutalism":{primary:"#ff3333",secondary:"#ffff00"},"solar-dusk":{primary:"#B45309",secondary:"#E4C090"},claymorphism:{primary:"#6366f1",secondary:"#d6d3d1"},"pastel-dreams":{primary:"#a78bfa",secondary:"#e9d8fd"}};function $y(){const{theme:e,setTheme:t}=Oy(),[n,r]=(0,u.useState)("modern-minimal"),[s,o]=(0,u.useState)(!1),[i,l]=(0,u.useState)(null);(0,u.useEffect)(()=>{o(!0);const e=localStorage.getItem("color-theme");e&&Hy.includes(e)&&r(e)},[]);const c=()=>{i&&(Hy.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${n}`),l(null))};return s?(0,p.jsxs)(Kd,{onOpenChange:e=>!e&&c(),children:[(0,p.jsx)(Yd,{asChild:!0,children:(0,p.jsx)($d,{variant:"ghost",size:"icon",className:"relative",children:(0,p.jsx)(a.IconComponent,{name:"icon-themes",className:"h-5 w-5"})})}),(0,p.jsxs)(Xd,{align:"end",className:"w-56 max-h-[400px] overflow-y-auto",children:[(0,p.jsxs)(Qd,{className:"flex items-center justify-between",children:[(0,p.jsx)("span",{children:"Theme"}),(0,p.jsx)($d,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:n=>{n.stopPropagation(),t("dark"===e?"light":"dark")},children:"dark"===e?(0,p.jsx)(f.Moon,{className:"h-4 w-4"}):(0,p.jsx)(f.Sun,{className:"h-4 w-4"})})]}),(0,p.jsx)(eu,{}),Hy.map(e=>{const t=Vy[e];return(0,p.jsx)(Zd,{onClick:()=>{return r(t=e),localStorage.setItem("color-theme",t),document.cookie=`color-theme=${t}; path=/; max-age=31536000`,Hy.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${t}`),void l(null);var t},onMouseEnter:()=>(e=>{l(e),Hy.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${e}`)})(e),onMouseLeave:c,className:"cursor-pointer "+(n===e?"bg-accent":""),children:(0,p.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[t&&(0,p.jsxs)("div",{className:"flex items-center gap-1",children:[(0,p.jsx)("div",{className:"w-3 h-3 rounded-full border border-border",style:{backgroundColor:t.primary}}),(0,p.jsx)("div",{className:"w-3 h-3 rounded-full border border-border",style:{backgroundColor:t.secondary}})]}),(0,p.jsx)("span",{children:(a=e,a.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "))})]}),n===e&&(0,p.jsx)("span",{className:"text-xs",children:"✓"})]})},e);var a})]})]}):null}var qy=[{value:"light",label:"Light",icon:(0,p.jsx)(f.Sun,{className:"h-4 w-4"}),description:"Clean and bright interface"},{value:"dark",label:"Dark",icon:(0,p.jsx)(f.Moon,{className:"h-4 w-4"}),description:"Easy on the eyes in low light"},{value:"system",label:"System",icon:(0,p.jsx)(f.Monitor,{className:"h-4 w-4"}),description:"Sync with your system preferences"}],Uy=({defaultSidebarView:e,onDefaultSidebarViewChange:t})=>{const{theme:n,setTheme:r}=Oy();return(0,p.jsxs)("div",{className:"space-y-6",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Appearance"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"Choose how REASON looks to you"})]}),(0,p.jsx)(Sy,{}),(0,p.jsxs)("div",{className:"space-y-4",children:[(0,p.jsx)(Ly,{className:"text-base",children:"Theme"}),(0,p.jsx)(Fy,{value:n,onValueChange:r,className:"space-y-3",children:qy.map(e=>(0,p.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,p.jsx)(By,{value:e.value,id:e.value,className:"mt-1"}),(0,p.jsxs)("label",{htmlFor:e.value,className:"flex-1 cursor-pointer",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,p.jsx)("div",{className:"text-muted-foreground",children:e.icon}),(0,p.jsx)("span",{className:"font-medium",children:e.label})]}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:e.description})]})]},e.value))})]}),(0,p.jsxs)("div",{className:"space-y-4",children:[(0,p.jsx)(Ly,{className:"text-base",children:"Color Theme"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Choose from various color themes to customize your interface"}),(0,p.jsx)("div",{className:"flex items-center",children:(0,p.jsx)($y,{})})]}),(0,p.jsx)(Sy,{}),(0,p.jsxs)("div",{className:"space-y-4",children:[(0,p.jsx)(Ly,{className:"text-base",children:"Default Sidebar View"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Choose the default view when opening the application"}),(0,p.jsx)(Fy,{value:e,onValueChange:e=>t?.(e),className:"space-y-3",children:[{value:"tree",label:"Documents Tree",desc:"Show only the document tree"},{value:"outline",label:"Outline Only",desc:"Show only the headings outline"},{value:"split",label:"Split View",desc:"Show both tree and outline side by side"},{value:"last-used",label:"Remember Last Used",desc:"Use the view you had open last time"}].map(e=>(0,p.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,p.jsx)(By,{value:e.value,id:e.value,className:"mt-1"}),(0,p.jsxs)("label",{htmlFor:e.value,className:"flex-1 cursor-pointer",children:[(0,p.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,p.jsx)("span",{className:"font-medium",children:e.label})}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:e.desc})]})]},e.value))})]})]})},Gy=({enableDatabaseSync:e=!1,onEnableDatabaseSyncChange:t})=>(0,p.jsxs)("div",{className:"space-y-6",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Storage"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage how your documents are stored"})]}),(0,p.jsx)(Sy,{}),(0,p.jsxs)("div",{className:"space-y-4",children:[(0,p.jsxs)("div",{className:"flex items-start justify-between",children:[(0,p.jsxs)("div",{className:"space-y-1",children:[(0,p.jsxs)(Ly,{className:"text-base flex items-center gap-2",children:[(0,p.jsx)(f.Database,{className:"h-4 w-4"}),"Database Sync"]}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"Save documents to SQL database for persistent storage"})]}),(0,p.jsx)("input",{type:"checkbox",id:"database-sync",checked:e,onChange:e=>t?.(e.target.checked),className:"h-4 w-4 rounded border-gray-300"})]}),e?(0,p.jsx)("div",{className:"rounded-md bg-muted p-3 space-y-2",children:(0,p.jsxs)("div",{className:"flex items-start gap-2",children:[(0,p.jsx)(f.Info,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),(0,p.jsxs)("div",{className:"space-y-1",children:[(0,p.jsx)("p",{className:"text-sm font-medium",children:"Database Sync Enabled"}),(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your documents will be automatically saved to the database. Changes are synced every 2 seconds after editing."})]})]})}):(0,p.jsx)("div",{className:"rounded-md bg-muted p-3 space-y-2",children:(0,p.jsxs)("div",{className:"flex items-start gap-2",children:[(0,p.jsx)(f.HardDrive,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),(0,p.jsxs)("div",{className:"space-y-1",children:[(0,p.jsx)("p",{className:"text-sm font-medium",children:"Local Storage Only"}),(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your documents are stored in your browser's local storage. They won't be accessible from other devices."})]})]})})]})]});Array(12).fill(0);var Wy=1,Ky=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;const{message:n,...r}=e,a="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:Wy++,s=this.toasts.find(e=>e.id===a),o=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),s?this.toasts=this.toasts.map(t=>t.id===a?(this.publish({...t,...e,id:a,title:n}),{...t,...e,id:a,dismissible:o,title:n}):t):this.addToast({title:n,...r,dismissible:o,id:a}),a},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;void 0!==t.loading&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));const r=Promise.resolve(e instanceof Function?e():e);let a,s=void 0!==n;const o=r.then(async e=>{if(a=["resolve",e],u.default.isValidElement(e))s=!1,this.create({id:n,type:"default",message:e});else if(Yy(e)&&!e.ok){s=!1;const r="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,a="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,o="object"!=typeof r||u.default.isValidElement(r)?{message:r}:r;this.create({id:n,type:"error",description:a,...o})}else if(e instanceof Error){s=!1;const r="function"==typeof t.error?await t.error(e):t.error,a="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof r||u.default.isValidElement(r)?{message:r}:r;this.create({id:n,type:"error",description:a,...o})}else if(void 0!==t.success){s=!1;const r="function"==typeof t.success?await t.success(e):t.success,a="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof r||u.default.isValidElement(r)?{message:r}:r;this.create({id:n,type:"success",description:a,...o})}}).catch(async e=>{if(a=["reject",e],void 0!==t.error){s=!1;const r="function"==typeof t.error?await t.error(e):t.error,a="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof r||u.default.isValidElement(r)?{message:r}:r;this.create({id:n,type:"error",description:a,...o})}}).finally(()=>{s&&(this.dismiss(n),n=void 0),null==t.finally||t.finally.call(t)}),i=()=>new Promise((e,t)=>o.then(()=>"reject"===a[0]?t(a[1]):e(a[1])).catch(t));return"string"!=typeof n&&"number"!=typeof n?{unwrap:i}:Object.assign(n,{unwrap:i})},this.custom=(e,t)=>{const n=(null==t?void 0:t.id)||Wy++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Yy=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,Xy=(e,t)=>{const n=(null==t?void 0:t.id)||Wy++;return Ky.addToast({title:e,...t,id:n}),n},Zy=Object.assign(Xy,{success:Ky.success,info:Ky.info,warning:Ky.warning,error:Ky.error,custom:Ky.custom,message:Ky.message,promise:Ky.promise,dismiss:Ky.dismiss,loading:Ky.loading},{getHistory:()=>Ky.toasts,getToasts:()=>Ky.getActiveToasts()});!function(e){if(!e||"undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");var Jy={name:"",type:"local",credentials:{}},Qy=({open:e})=>{const[t,n]=(0,u.useState)([]),[r,a]=(0,u.useState)(null),[s,o]=(0,u.useState)(Jy);(0,u.useEffect)(()=>{e&&n(Mo())},[e]);const i=()=>{s.name.trim()?(r&&"new"!==r?(!function(e,t){Eo(Mo().map(n=>n.id===e?{...n,...t,updatedAt:(new Date).toISOString()}:n))}(r,{name:s.name,credentials:"local"!==s.type?s.credentials:void 0}),Zy.success("Source updated")):(!function(e){const t={...e,id:`${e.type}-${Date.now()}`,createdAt:(new Date).toISOString(),updatedAt:(new Date).toISOString()};Eo([...Mo(),t])}({name:s.name,type:s.type,credentials:"local"!==s.type?s.credentials:void 0}),Zy.success("Source added")),n(Mo()),a(null),o(Jy)):Zy.error("Please enter a source name")},l=e=>{!function(e){"local-default"!==e&&(Eo(Mo().filter(t=>t.id!==e)),Ao()===e&&Ro("local-default"))}(e),n(Mo()),Zy.success("Source deleted")},c=()=>{a(null),o(Jy)},d=e=>s.credentials[e],h=e=>o(t=>({...t,credentials:{...t.credentials,...e}})),m=({type:e})=>"local"===e?(0,p.jsx)(f.HardDrive,{className:"h-4 w-4"}):"ssh"===e?(0,p.jsx)(f.Server,{className:"h-4 w-4"}):"s3"===e||"b2"===e?(0,p.jsx)(f.Cloud,{className:"h-4 w-4"}):"r2"===e?(0,p.jsx)(f.Database,{className:"h-4 w-4"}):"gdocs"===e?(0,p.jsx)(f.FileText,{className:"h-4 w-4"}):"turso"===e?(0,p.jsx)(f.Workflow,{className:"h-4 w-4"}):null,g=e=>"ssh"===e?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eb,{label:"Host",children:(0,p.jsx)(am,{value:d("host")||"",onChange:e=>h({host:e.target.value}),placeholder:"example.com"})}),(0,p.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,p.jsx)(eb,{label:"Port",children:(0,p.jsx)(am,{type:"number",value:d("port")||22,onChange:e=>h({port:parseInt(e.target.value)}),placeholder:"22"})}),(0,p.jsx)(eb,{label:"Username",children:(0,p.jsx)(am,{value:d("username")||"",onChange:e=>h({username:e.target.value}),placeholder:"user"})})]}),(0,p.jsx)(eb,{label:"Password (Optional)",children:(0,p.jsx)(am,{type:"password",value:d("password")||"",onChange:e=>h({password:e.target.value}),placeholder:"••••••••"})}),(0,p.jsx)(eb,{label:"Base Path (Optional)",children:(0,p.jsx)(am,{value:d("basePath")||"",onChange:e=>h({basePath:e.target.value}),placeholder:"/home/user/documents"})})]}):"s3"===e?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eb,{label:"Access Key ID",children:(0,p.jsx)(am,{value:d("accessKeyId")||"",onChange:e=>h({accessKeyId:e.target.value}),placeholder:"AKIAIOSFODNN7EXAMPLE"})}),(0,p.jsx)(eb,{label:"Secret Access Key",children:(0,p.jsx)(am,{type:"password",value:d("secretAccessKey")||"",onChange:e=>h({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),(0,p.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,p.jsx)(eb,{label:"Region",children:(0,p.jsx)(am,{value:d("region")||"",onChange:e=>h({region:e.target.value}),placeholder:"us-east-1"})}),(0,p.jsx)(eb,{label:"Bucket",children:(0,p.jsx)(am,{value:d("bucket")||"",onChange:e=>h({bucket:e.target.value}),placeholder:"my-bucket"})})]})]}):"r2"===e?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eb,{label:"Account ID",children:(0,p.jsx)(am,{value:d("accountId")||"",onChange:e=>h({accountId:e.target.value}),placeholder:"your-account-id"})}),(0,p.jsx)(eb,{label:"Access Key ID",children:(0,p.jsx)(am,{value:d("accessKeyId")||"",onChange:e=>h({accessKeyId:e.target.value}),placeholder:"your-access-key-id"})}),(0,p.jsx)(eb,{label:"Secret Access Key",children:(0,p.jsx)(am,{type:"password",value:d("secretAccessKey")||"",onChange:e=>h({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),(0,p.jsx)(eb,{label:"Bucket",children:(0,p.jsx)(am,{value:d("bucket")||"",onChange:e=>h({bucket:e.target.value}),placeholder:"my-bucket"})})]}):"b2"===e?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eb,{label:"Access Key ID",children:(0,p.jsx)(am,{value:d("accessKeyId")||"",onChange:e=>h({accessKeyId:e.target.value}),placeholder:"your-key-id"})}),(0,p.jsx)(eb,{label:"Secret Access Key",children:(0,p.jsx)(am,{type:"password",value:d("secretAccessKey")||"",onChange:e=>h({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),(0,p.jsx)(eb,{label:"Bucket",children:(0,p.jsx)(am,{value:d("bucket")||"",onChange:e=>h({bucket:e.target.value}),placeholder:"my-bucket"})}),(0,p.jsx)(eb,{label:"Endpoint (Optional)",children:(0,p.jsx)(am,{value:d("endpoint")||"",onChange:e=>h({endpoint:e.target.value}),placeholder:"https://s3.us-west-004.backblazeb2.com"})})]}):"gdocs"===e?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eb,{label:"Email",children:(0,p.jsx)(am,{value:d("email")||"",onChange:e=>h({email:e.target.value}),placeholder:"user@gmail.com",disabled:!0})}),(0,p.jsxs)(eb,{label:"Folder IDs (comma-separated)",children:[(0,p.jsx)(Mm,{value:d("folderIds")?.join(", ")||"",onChange:e=>h({folderIds:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),placeholder:"folder-id-1, folder-id-2",rows:3}),(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:"Enter Google Drive folder IDs to sync (one per line or comma-separated)"})]}),(0,p.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md",children:[(0,p.jsx)("div",{className:"flex-1",children:(0,p.jsx)("p",{className:"text-sm font-medium",children:d("isAuthenticated")?"Connected to Google":"Not authenticated"})}),(0,p.jsxs)($d,{size:"sm",variant:"outline",children:[(0,p.jsx)(f.LogIn,{className:"h-4 w-4 mr-2"}),d("isAuthenticated")?"Reconnect":"Authenticate"]})]})]}):"turso"===e?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eb,{label:"Database Endpoint",children:(0,p.jsx)(am,{value:d("endpoint")||"",onChange:e=>h({endpoint:e.target.value}),placeholder:"https://your-db.turso.io"})}),(0,p.jsx)(eb,{label:"Auth Token (Optional)",children:(0,p.jsx)(am,{type:"password",value:d("authToken")||"",onChange:e=>h({authToken:e.target.value}),placeholder:"••••••••"})}),(0,p.jsx)(eb,{label:"Database Name (Optional)",children:(0,p.jsx)(am,{value:d("database")||"",onChange:e=>h({database:e.target.value}),placeholder:"my-database"})}),(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("input",{type:"checkbox",id:"gdocs-sync",checked:d("enableGoogleDocsSync")||!1,onChange:e=>h({enableGoogleDocsSync:e.target.checked}),className:"h-4 w-4"}),(0,p.jsx)(Ly,{htmlFor:"gdocs-sync",className:"cursor-pointer",children:"Enable Google Docs Sync"})]}),d("enableGoogleDocsSync")&&(0,p.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md",children:[(0,p.jsx)("div",{className:"flex-1",children:(0,p.jsx)("p",{className:"text-sm",children:"Authenticate with Google to sync documents"})}),(0,p.jsxs)($d,{size:"sm",variant:"outline",children:[(0,p.jsx)(f.LogIn,{className:"h-4 w-4 mr-2"}),"Login with Google"]})]})]}):null;return(0,p.jsxs)("div",{className:"space-y-6",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"File Sources"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage storage sources (SSH, S3, R2, B2, Google Docs, Turso DB)"})]}),(0,p.jsx)(Sy,{}),(0,p.jsxs)("div",{className:"space-y-3",children:[t.map(e=>{return(0,p.jsx)("div",{className:"border rounded-lg p-3 space-y-2",children:r===e.id?(0,p.jsxs)("div",{className:"space-y-3",children:[(0,p.jsx)(eb,{label:"Source Name",children:(0,p.jsx)(am,{value:s.name,onChange:e=>o(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),g(e.type),(0,p.jsx)(tb,{onSave:i,onCancel:c,label:"Save"})]}):(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(m,{type:e.type}),(0,p.jsx)("span",{className:"font-medium",children:e.name}),(0,p.jsx)(Jh,{variant:"outline",className:"text-xs",children:(t=e.type,"gdocs"===t?"Google Docs":"turso"===t?"Turso DB":"b2"===t?"Backblaze B2":t.toUpperCase())})]}),"local-default"!==e.id&&(0,p.jsxs)("div",{className:"flex gap-1",children:[(0,p.jsx)($d,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>(e=>{a(e.id),o({name:e.name,type:e.type,credentials:e.credentials||{}})})(e),children:(0,p.jsx)(f.Edit2,{className:"h-3 w-3"})}),(0,p.jsx)($d,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive",onClick:()=>l(e.id),children:(0,p.jsx)(f.Trash2,{className:"h-3 w-3"})})]})]}),(0,p.jsx)(nb,{source:e})]})},e.id);var t}),"new"===r&&(0,p.jsxs)("div",{className:"border rounded-lg p-3 space-y-3",children:[(0,p.jsx)(eb,{label:"Source Name",children:(0,p.jsx)(am,{value:s.name,onChange:e=>o(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),(0,p.jsx)(eb,{label:"Source Type",children:(0,p.jsxs)("select",{value:s.type,onChange:e=>{const t=e.target.value;o({name:s.name,type:t,credentials:"gdocs"===t?{isAuthenticated:!1}:{}})},className:"w-full border rounded-md px-3 py-2 text-sm",children:[(0,p.jsx)("option",{value:"ssh",children:"SSH"}),(0,p.jsx)("option",{value:"s3",children:"Amazon S3"}),(0,p.jsx)("option",{value:"r2",children:"Cloudflare R2"}),(0,p.jsx)("option",{value:"b2",children:"Backblaze B2"}),(0,p.jsx)("option",{value:"gdocs",children:"Google Docs"}),(0,p.jsx)("option",{value:"turso",children:"Turso DB"})]})}),g(s.type),(0,p.jsx)(tb,{onSave:i,onCancel:c,label:"Add Source"})]})]}),"new"!==r&&(0,p.jsxs)($d,{variant:"outline",size:"sm",onClick:()=>{a("new"),o({name:"",type:"ssh",credentials:{port:22}})},className:"w-full gap-2",children:[(0,p.jsx)(f.Plus,{className:"h-4 w-4"}),"Add New File Source"]})]})},eb=({label:e,children:t})=>(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(Ly,{children:e}),t]}),tb=({onSave:e,onCancel:t,label:n})=>(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsx)($d,{size:"sm",onClick:e,children:n}),(0,p.jsx)($d,{size:"sm",variant:"outline",onClick:t,children:"Cancel"})]}),nb=({source:e})=>{if("ssh"===e.type&&e.credentials){const t=e.credentials;return(0,p.jsxs)("p",{className:"text-xs text-muted-foreground",children:[t.username,"@",t.host,":",t.port||22]})}if("s3"===e.type&&e.credentials){const t=e.credentials;return(0,p.jsxs)("p",{className:"text-xs text-muted-foreground",children:[t.bucket," (",t.region,")"]})}if("r2"===e.type&&e.credentials){const t=e.credentials;return(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:t.bucket})}if("b2"===e.type&&e.credentials){const t=e.credentials;return(0,p.jsxs)("p",{className:"text-xs text-muted-foreground",children:[t.bucket," (",t.endpoint||"default endpoint",")"]})}if("gdocs"===e.type&&e.credentials){const t=e.credentials;return(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:t.isAuthenticated?`${t.email||"Authenticated"} - ${t.folderIds?.length||0} folder(s)`:"Not authenticated"})}if("turso"===e.type&&e.credentials){const t=e.credentials;return(0,p.jsxs)("p",{className:"text-xs text-muted-foreground",children:[t.endpoint,t.enableGoogleDocsSync&&" (Google Docs sync enabled)"]})}return null},rb=["blue","purple","green","orange","pink"],ab=({open:e})=>{const[t,n]=(0,u.useState)([]),[r,a]=(0,u.useState)(null),[s,o]=(0,u.useState)({});(0,u.useEffect)(()=>{e&&n(tm())},[e]);const i=({modeId:e,onSave:t,onCancel:n})=>(0,p.jsxs)("div",{className:"space-y-3",children:[(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(Ly,{htmlFor:`name-${e}`,children:"Mode Name"}),(0,p.jsx)(am,{id:`name-${e}`,value:s.name||"",onChange:e=>o(t=>({...t,name:e.target.value})),placeholder:"Mode name"})]}),(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(Ly,{htmlFor:`prompt-${e}`,children:"Prompt"}),(0,p.jsx)(Mm,{id:`prompt-${e}`,value:s.prompt||"",onChange:e=>o(t=>({...t,prompt:e.target.value})),placeholder:"Rewrite prompt...",rows:4})]}),(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(Ly,{htmlFor:`color-${e}`,children:"Color"}),(0,p.jsx)("select",{id:`color-${e}`,value:s.color||"blue",onChange:e=>o(t=>({...t,color:e.target.value})),className:"w-full border rounded-md px-3 py-2 text-sm",children:rb.map(e=>(0,p.jsx)("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsx)($d,{size:"sm",onClick:t,children:"Save"}),(0,p.jsx)($d,{size:"sm",variant:"outline",onClick:n,children:"Cancel"})]})]});return(0,p.jsxs)("div",{className:"space-y-6",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"AI Rewrite Modes"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"Customize AI rewrite prompts and add your own modes"})]}),(0,p.jsxs)($d,{variant:"outline",size:"sm",onClick:()=>{nm(Qh),n(tm()),Zy.success("Modes reset to defaults")},className:"gap-2",children:[(0,p.jsx)(f.RotateCcw,{className:"h-4 w-4"}),"Reset"]})]}),(0,p.jsx)(Sy,{}),(0,p.jsxs)("div",{className:"space-y-3",children:[t.map(e=>(0,p.jsx)("div",{className:"border rounded-lg p-3 space-y-2",children:r===e.id?(0,p.jsx)(i,{modeId:e.id,onSave:()=>(e=>{const r=t.map(t=>t.id===e.id?e:t);n(r),nm(r),a(null),o({}),Zy.success("Mode updated")})(s),onCancel:()=>{a(null),o({})}}):(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between",children:[(0,p.jsx)(Jh,{variant:"outline",className:"text-sm",children:e.name}),(0,p.jsxs)("div",{className:"flex gap-1",children:[(0,p.jsx)($d,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{a(e.id),o(e)},children:(0,p.jsx)(f.Edit2,{className:"h-3 w-3"})}),(0,p.jsx)($d,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive",onClick:()=>(e=>{const r=t.filter(t=>t.id!==e);n(r),nm(r),Zy.success("Mode deleted")})(e.id),children:(0,p.jsx)(f.Trash2,{className:"h-3 w-3"})})]})]}),(0,p.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.prompt})]})},e.id)),"new"===r&&(0,p.jsx)("div",{className:"border rounded-lg p-3",children:(0,p.jsx)(i,{modeId:"new",onSave:()=>{const e={id:`custom-${Date.now()}`,name:s.name||"New Mode",prompt:s.prompt||"Rewrite this text:",color:s.color||"blue"},r=[...t,e];n(r),nm(r),a(null),o({}),Zy.success("Mode added")},onCancel:()=>{a(null),o({})}})})]}),"new"!==r&&(0,p.jsxs)($d,{variant:"outline",size:"sm",onClick:()=>{a("new"),o({name:"",prompt:"",color:"blue"})},className:"w-full gap-2",children:[(0,p.jsx)(f.Plus,{className:"h-4 w-4"}),"Add New Mode"]})]})},sb=()=>(0,p.jsxs)("div",{className:"space-y-6",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"About"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"Application information"})]}),(0,p.jsx)(Sy,{}),(0,p.jsxs)("div",{className:"text-sm space-y-3",children:[(0,p.jsxs)("div",{className:"space-y-1",children:[(0,p.jsx)("p",{className:"font-medium",children:"REASON"}),(0,p.jsx)("p",{className:"text-muted-foreground",children:"A powerful note-taking application"})]}),(0,p.jsxs)("div",{className:"space-y-1",children:[(0,p.jsx)("p",{className:"font-medium",children:"Version"}),(0,p.jsx)("p",{className:"text-muted-foreground",children:"1.0.0"})]})]})]}),ob=[{name:"Appearance",icon:f.Paintbrush},{name:"Storage",icon:f.Database},{name:"File Sources",icon:f.HardDrive},{name:"AI Rewrite Modes",icon:f.Wand2},{name:"About",icon:f.Info}],ib=({open:e,onOpenChange:t,initialSection:n,defaultSidebarView:r="last-used",onDefaultSidebarViewChange:a,enableDatabaseSync:s=!1,onEnableDatabaseSyncChange:o})=>{const[i,l]=(0,u.useState)(n||"Appearance");(0,u.useEffect)(()=>{e&&l(n||"Appearance")},[e,n]);return(0,p.jsx)(Rd,{open:e,onOpenChange:t,children:(0,p.jsxs)(_d,{className:"overflow-hidden p-0 md:max-h-[500px] md:max-w-[700px] lg:max-w-[800px]",children:[(0,p.jsx)(Pd,{className:"sr-only",children:"Settings"}),(0,p.jsx)(Od,{className:"sr-only",children:"Customize your settings here."}),(0,p.jsxs)(Cy,{className:"items-start",children:[(0,p.jsx)(Ny,{collapsible:"none",className:"hidden md:flex",children:(0,p.jsx)(Ty,{children:(0,p.jsx)(My,{children:(0,p.jsx)(Ey,{children:(0,p.jsx)(Ay,{children:ob.map(e=>(0,p.jsx)(Ry,{children:(0,p.jsx)(Dy,{asChild:!0,isActive:e.name===i,onClick:()=>l(e.name),children:(0,p.jsxs)("a",{href:"#",children:[(0,p.jsx)(e.icon,{}),(0,p.jsx)("span",{children:e.name})]})})},e.name))})})})})}),(0,p.jsxs)("main",{className:"flex h-[480px] flex-1 flex-col overflow-hidden",children:[(0,p.jsx)("header",{className:"flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12",children:(0,p.jsx)("div",{className:"flex items-center gap-2 px-4",children:(0,p.jsx)(fy,{children:(0,p.jsxs)(gy,{children:[(0,p.jsx)(xy,{className:"hidden md:block",children:(0,p.jsxs)(vy,{href:"#",children:[(0,p.jsx)(f.Settings,{className:"h-4 w-4 inline mr-1"}),"Settings"]})}),(0,p.jsx)(by,{className:"hidden md:block"}),(0,p.jsx)(xy,{children:(0,p.jsx)(yy,{children:i})})]})})})}),(0,p.jsx)("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-4 pt-0",children:(()=>{switch(i){case"Appearance":return(0,p.jsx)(Uy,{defaultSidebarView:r,onDefaultSidebarViewChange:a});case"Storage":return(0,p.jsx)(Gy,{enableDatabaseSync:s,onEnableDatabaseSyncChange:o});case"File Sources":return(0,p.jsx)(Qy,{open:e});case"AI Rewrite Modes":return(0,p.jsx)(ab,{open:e});case"About":return(0,p.jsx)(sb,{});default:return null}})()})]})]})]})})};function lb({className:e,...t}){return(0,p.jsx)(C.Root,{"data-slot":"tabs",className:xo("flex flex-col gap-2",e),...t})}function cb({className:e,...t}){return(0,p.jsx)(C.List,{"data-slot":"tabs-list",className:xo("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-2xl p-[3px]",e),...t})}function db({className:e,...t}){return(0,p.jsx)(C.Trigger,{"data-slot":"tabs-trigger",className:xo("cursor-pointer data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-2xl border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function ub({className:e,...t}){return(0,p.jsx)(C.Content,{"data-slot":"tabs-content",className:xo("flex-1 outline-none",e),...t})}var hb=w.Root,mb=w.Value,pb=u.forwardRef(({className:e,children:t,...n},r)=>(0,p.jsxs)(w.Trigger,{ref:r,className:xo("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,(0,p.jsx)(w.Icon,{asChild:!0,children:(0,p.jsx)(f.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));pb.displayName=w.Trigger.displayName;var fb=u.forwardRef(({className:e,...t},n)=>(0,p.jsx)(w.ScrollUpButton,{ref:n,className:xo("flex cursor-default items-center justify-center py-1",e),...t,children:(0,p.jsx)(f.ChevronUp,{className:"h-4 w-4"})}));fb.displayName=w.ScrollUpButton.displayName;var gb=u.forwardRef(({className:e,...t},n)=>(0,p.jsx)(w.ScrollDownButton,{ref:n,className:xo("flex cursor-default items-center justify-center py-1",e),...t,children:(0,p.jsx)(f.ChevronDown,{className:"h-4 w-4"})}));gb.displayName=w.ScrollDownButton.displayName;var xb=u.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>(0,p.jsx)(w.Portal,{children:(0,p.jsxs)(w.Content,{ref:a,className:xo("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[(0,p.jsx)(fb,{}),(0,p.jsx)(w.Viewport,{className:xo("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,p.jsx)(gb,{})]})}));xb.displayName=w.Content.displayName,u.forwardRef(({className:e,...t},n)=>(0,p.jsx)(w.Label,{ref:n,className:xo("px-2 py-1.5 text-sm font-semibold",e),...t})).displayName=w.Label.displayName;var vb=u.forwardRef(({className:e,children:t,...n},r)=>(0,p.jsxs)(w.Item,{ref:r,className:xo("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[(0,p.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,p.jsx)(w.ItemIndicator,{children:(0,p.jsx)(f.Check,{className:"h-4 w-4"})})}),(0,p.jsx)(w.ItemText,{children:t})]}));function yb(e,t){const[n,r]=(0,u.useState)(()=>{try{const n=window.localStorage.getItem(e);if(!n)return t;const r=JSON.parse(n);return Array.isArray(r)&&0===r.length&&Array.isArray(t)&&t.length>0?t:r}catch(n){return t}});return[n,t=>{try{const a=t instanceof Function?t(n):t;r(a),window.localStorage.setItem(e,JSON.stringify(a))}catch(a){}}]}vb.displayName=w.Item.displayName,u.forwardRef(({className:e,...t},n)=>(0,p.jsx)(w.Separator,{ref:n,className:xo("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=w.Separator.displayName;var bb={owner:(0,p.jsx)(f.Crown,{className:"h-3 w-3"}),admin:(0,p.jsx)(f.Shield,{className:"h-3 w-3"}),member:(0,p.jsx)(f.Users,{className:"h-3 w-3"}),viewer:(0,p.jsx)(f.Eye,{className:"h-3 w-3"})},wb={owner:"bg-yellow-500/10 text-yellow-700 dark:text-yellow-400",admin:"bg-purple-500/10 text-purple-700 dark:text-purple-400",member:"bg-blue-500/10 text-blue-700 dark:text-blue-400",viewer:"bg-gray-500/10 text-gray-700 dark:text-gray-400"},Sb=({open:e,onOpenChange:t})=>{const[n,r]=yb("REASON-organizations",[{id:"1",name:"My Organization",slug:"my-org",description:"Your personal workspace",teams:[{id:"1",name:"General",description:"Default team for collaboration",members:[{id:"1",name:"You",email:"you@example.com",role:"owner",joinedAt:new Date}],createdAt:new Date,updatedAt:new Date}],createdAt:new Date,updatedAt:new Date}]),[a,s]=(0,u.useState)(n[0]?.id||null),[o,i]=(0,u.useState)(null),[l,c]=(0,u.useState)(!1),[d,h]=(0,u.useState)(null),[m,g]=(0,u.useState)(""),[x,v]=(0,u.useState)("member"),y=n.find(e=>e.id===a),b=y?.teams.find(e=>e.id===o);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Rd,{open:e,onOpenChange:t,children:(0,p.jsxs)(_d,{className:"max-w-4xl max-h-[85vh]",children:[(0,p.jsxs)(zd,{children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(f.Building2,{className:"h-5 w-5"}),(0,p.jsx)(Pd,{children:"Teams & Organizations"})]}),(0,p.jsx)(Od,{children:"Manage your teams and collaborate with others"})]}),(0,p.jsxs)(lb,{defaultValue:"teams",className:"flex-1",children:[(0,p.jsxs)(cb,{className:"grid w-full grid-cols-2",children:[(0,p.jsx)(db,{value:"teams",children:"Teams"}),(0,p.jsx)(db,{value:"organizations",children:"Organizations"})]}),(0,p.jsxs)(ub,{value:"teams",className:"space-y-4 mt-4",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between",children:[(0,p.jsxs)("div",{className:"space-y-1",children:[(0,p.jsx)("h3",{className:"font-semibold",children:"Your Teams"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"Collaborate with team members"})]}),(0,p.jsxs)($d,{onClick:()=>{if(!a)return;const e={id:Date.now().toString(),name:"New Team",members:[],createdAt:new Date,updatedAt:new Date};r(t=>t.map(t=>t.id===a?{...t,teams:[...t.teams,e],updatedAt:new Date}:t)),i(e.id),Zy.success("Team created")},size:"sm",children:[(0,p.jsx)(f.Plus,{className:"h-4 w-4 mr-2"}),"New Team"]})]}),(0,p.jsx)(Sy,{}),(0,p.jsx)(uy,{className:"h-[50vh]",children:y&&y.teams.length>0?(0,p.jsx)("div",{className:"space-y-4",children:y.teams.map(e=>(0,p.jsxs)("div",{className:"border rounded-lg p-4 space-y-4",children:[(0,p.jsxs)("div",{className:"flex items-start justify-between",children:[(0,p.jsxs)("div",{className:"space-y-1",children:[(0,p.jsxs)("h4",{className:"font-semibold flex items-center gap-2",children:[(0,p.jsx)(f.Users,{className:"h-4 w-4"}),e.name]}),e.description&&(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:e.description}),(0,p.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.members.length," member",1!==e.members.length?"s":""]})]}),(0,p.jsxs)($d,{variant:"outline",size:"sm",onClick:()=>{i(e.id),c(!0)},children:[(0,p.jsx)(f.UserPlus,{className:"h-4 w-4 mr-2"}),"Invite"]})]}),(0,p.jsx)("div",{className:"space-y-2",children:e.members.map(e=>(0,p.jsxs)("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[(0,p.jsxs)("div",{className:"flex items-center gap-3",children:[(0,p.jsxs)(Cm,{className:"h-8 w-8",children:[(0,p.jsx)(Nm,{src:e.avatarUrl}),(0,p.jsx)(Tm,{children:e.name.substring(0,2).toUpperCase()})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"text-sm font-medium",children:e.name}),(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:e.email})]})]}),(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsxs)(Jh,{variant:"secondary",className:wb[e.role],children:[(0,p.jsx)("span",{className:"mr-1",children:bb[e.role]}),e.role]}),"owner"!==e.role&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(hb,{value:e.role,onValueChange:t=>{return n=e.id,s=t,void(a&&o&&(r(e=>e.map(e=>e.id===a?{...e,teams:e.teams.map(e=>e.id===o?{...e,members:e.members.map(e=>e.id===n?{...e,role:s}:e),updatedAt:new Date}:e)}:e)),Zy.success("Role updated")));var n,s},children:[(0,p.jsx)(pb,{className:"h-8 w-28",children:(0,p.jsx)(mb,{})}),(0,p.jsxs)(xb,{children:[(0,p.jsx)(vb,{value:"admin",children:"Admin"}),(0,p.jsx)(vb,{value:"member",children:"Member"}),(0,p.jsx)(vb,{value:"viewer",children:"Viewer"})]})]}),(0,p.jsx)($d,{variant:"ghost",size:"sm",onClick:()=>h(e),children:(0,p.jsx)(f.Trash2,{className:"h-4 w-4 text-destructive"})})]})]})]},e.id))})]},e.id))}):(0,p.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,p.jsx)(f.Users,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"No teams yet. Create your first team to get started."})]})})]}),(0,p.jsxs)(ub,{value:"organizations",className:"space-y-4 mt-4",children:[(0,p.jsxs)("div",{className:"space-y-1",children:[(0,p.jsx)("h3",{className:"font-semibold",children:"Your Organizations"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage organization settings and details"})]}),(0,p.jsx)(Sy,{}),(0,p.jsx)(uy,{className:"h-[50vh]",children:n.map(e=>(0,p.jsx)("div",{className:"border rounded-lg p-4 space-y-4 mb-4",children:(0,p.jsxs)("div",{className:"flex items-start gap-4",children:[(0,p.jsxs)(Cm,{className:"h-16 w-16",children:[(0,p.jsx)(Nm,{src:e.logoUrl}),(0,p.jsx)(Tm,{className:"text-lg",children:e.name.substring(0,2).toUpperCase()})]}),(0,p.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,p.jsx)("h4",{className:"font-semibold text-lg",children:e.name}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:e.slug}),e.description&&(0,p.jsx)("p",{className:"text-sm",children:e.description}),(0,p.jsxs)("div",{className:"flex gap-4 text-xs text-muted-foreground pt-2",children:[(0,p.jsxs)("span",{children:[e.teams.length," teams"]}),(0,p.jsxs)("span",{children:[e.teams.reduce((e,t)=>e+t.members.length,0)," ","members"]})]})]})]})},e.id))})]})]})]})}),(0,p.jsx)(Rd,{open:l,onOpenChange:c,children:(0,p.jsxs)(_d,{children:[(0,p.jsxs)(zd,{children:[(0,p.jsx)(Pd,{children:"Invite Team Member"}),(0,p.jsxs)(Od,{children:["Send an invitation to join ",b?.name]})]}),(0,p.jsxs)("div",{className:"space-y-4 py-4",children:[(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(Ly,{htmlFor:"email",children:"Email Address"}),(0,p.jsxs)("div",{className:"relative",children:[(0,p.jsx)(f.Mail,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,p.jsx)(am,{id:"email",type:"email",placeholder:"colleague@example.com",value:m,onChange:e=>g(e.target.value),className:"pl-9"})]})]}),(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(Ly,{htmlFor:"role",children:"Role"}),(0,p.jsxs)(hb,{value:x,onValueChange:e=>v(e),children:[(0,p.jsx)(pb,{children:(0,p.jsx)(mb,{})}),(0,p.jsxs)(xb,{children:[(0,p.jsx)(vb,{value:"admin",children:"Admin"}),(0,p.jsx)(vb,{value:"member",children:"Member"}),(0,p.jsx)(vb,{value:"viewer",children:"Viewer"})]})]})]})]}),(0,p.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,p.jsx)($d,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,p.jsx)($d,{onClick:()=>{if(!m.trim()||!a||!o)return;const e={id:Date.now().toString(),name:m.split("@")[0],email:m,role:x,joinedAt:new Date};r(t=>t.map(t=>t.id===a?{...t,teams:t.teams.map(t=>t.id===o?{...t,members:[...t.members,e],updatedAt:new Date}:t)}:t)),g(""),v("member"),c(!1),Zy.success("Member invited")},children:"Send Invitation"})]})]})}),(0,p.jsx)(bh,{open:!!d,onOpenChange:()=>h(null),children:(0,p.jsxs)(jh,{children:[(0,p.jsxs)(kh,{children:[(0,p.jsx)(Nh,{children:"Remove Team Member"}),(0,p.jsxs)(Th,{children:["Are you sure you want to remove ",d?.name," from the team? They will lose access to all team resources."]})]}),(0,p.jsxs)(Ch,{children:[(0,p.jsx)(Eh,{children:"Cancel"}),(0,p.jsx)(Mh,{onClick:()=>{return d&&(e=d.id,void(a&&o&&(r(t=>t.map(t=>t.id===a?{...t,teams:t.teams.map(t=>t.id===o?{...t,members:t.members.filter(t=>t.id!==e),updatedAt:new Date}:t)}:t)),h(null),Zy.success("Member removed"))));var e},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})};function jb({className:e,...t}){return(0,p.jsx)(k.Root,{"data-slot":"switch",className:xo("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:(0,p.jsx)(k.Thumb,{"data-slot":"switch-thumb",className:xo("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var kb=({open:e,onOpenChange:t,documentTitle:n,documentId:r,sharingInfo:a,teams:s=[],onUpdateSharing:o})=>{const[i,l]=(0,u.useState)(""),[c,d]=(0,u.useState)("editor"),[h,m]=(0,u.useState)(a?.isPublic||!1),[g,x]=(0,u.useState)(a?.sharedWith||[]),[v,y]=(0,u.useState)(a?.shareLink||null),[b,w]=(0,u.useState)(!1),S=()=>{if(!i.trim())return;if(g.find(e=>e.email===i))return void Zy.error("Already shared with this user");const e={email:i,role:c,sharedAt:(new Date).toISOString()},t=[...g,e];x(t),o&&o({...a,isPublic:h,sharedWith:t}),l(""),Zy.success(`Invited ${i}`)},j=async()=>{if(!b){w(!0);try{const e=await(0,N.default)("doc/share",{method:"POST",headers:{"Content-Type":"application/json"},body:{documentId:r}});return e.success?(y(e.data.shareUrl),o&&o({...a,isPublic:h,sharedWith:g,shareLink:e.data.shareUrl}),e.data.shareUrl):(Zy.error(e.error||"Failed to generate share link"),null)}catch(e){return Zy.error(e.message||"Failed to generate share link"),null}finally{w(!1)}}};return(0,p.jsx)(Rd,{open:e,onOpenChange:t,children:(0,p.jsxs)(_d,{className:"max-w-2xl max-h-[85vh]",children:[(0,p.jsxs)(zd,{children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(f.UserPlus,{className:"h-5 w-5"}),(0,p.jsxs)(Pd,{children:['Share "',n,'"']})]}),(0,p.jsx)(Od,{children:"Invite people or share with teams"})]}),(0,p.jsxs)("div",{className:"space-y-6",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg border bg-muted/30",children:[(0,p.jsxs)("div",{className:"flex items-center gap-3",children:[h?(0,p.jsx)(f.Globe,{className:"h-5 w-5 text-primary"}):(0,p.jsx)(f.Lock,{className:"h-5 w-5 text-muted-foreground"}),(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"font-medium text-sm",children:h?"Public Access":"Private"}),(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:h?"Anyone with the link can view":"Only invited people can access"})]})]}),(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[h&&(0,p.jsx)($d,{variant:"ghost",size:"sm",onClick:async()=>{let e=v;(e||(e=await j(),e))&&(navigator.clipboard.writeText(e),Zy.success("Link copied to clipboard"))},className:"h-8",children:(0,p.jsx)(f.Link2,{className:"h-4 w-4"})}),(0,p.jsx)(jb,{checked:h,onCheckedChange:async e=>{m(e),e&&!v&&await j(),o&&o({...a,isPublic:e,sharedWith:g,shareLink:v}),Zy.success(e?"Document is now public":"Document is now private")}})]})]}),(0,p.jsxs)("div",{className:"space-y-3",children:[(0,p.jsx)(Ly,{children:"Invite by email"}),(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsxs)("div",{className:"relative flex-1",children:[(0,p.jsx)(f.Mail,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,p.jsx)(am,{type:"email",placeholder:"colleague@example.com",value:i,onChange:e=>l(e.target.value),onKeyPress:e=>"Enter"===e.key&&S(),className:"pl-9"})]}),(0,p.jsxs)(hb,{value:c,onValueChange:e=>d(e),children:[(0,p.jsx)(pb,{className:"w-36",children:(0,p.jsx)(mb,{})}),(0,p.jsxs)(xb,{children:[(0,p.jsx)(vb,{value:"editor",children:(0,p.jsxs)("span",{className:"flex items-center gap-2",children:[(0,p.jsx)(f.Edit3,{className:"h-3 w-3"}),"Editor"]})}),(0,p.jsx)(vb,{value:"commentor",children:(0,p.jsxs)("span",{className:"flex items-center gap-2",children:[(0,p.jsx)(f.MessageSquare,{className:"h-3 w-3"}),"Commentor"]})}),(0,p.jsx)(vb,{value:"viewer",children:(0,p.jsxs)("span",{className:"flex items-center gap-2",children:[(0,p.jsx)(f.Eye,{className:"h-3 w-3"}),"Viewer"]})})]})]}),(0,p.jsx)($d,{onClick:S,children:"Invite"})]})]}),(0,p.jsx)(Sy,{}),s.length>0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"space-y-3",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(f.Users,{className:"h-4 w-4 text-muted-foreground"}),(0,p.jsx)("h4",{className:"text-sm font-semibold",children:"Teams with access"})]}),(0,p.jsx)("div",{className:"space-y-2",children:s.map(e=>(0,p.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[(0,p.jsxs)("div",{className:"flex items-center gap-3",children:[(0,p.jsx)(Cm,{className:"h-8 w-8",children:(0,p.jsx)(Tm,{className:"bg-primary/10 text-primary",children:(0,p.jsx)(f.Users,{className:"h-4 w-4"})})}),(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"text-sm font-medium",children:e.name}),(0,p.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.members.length," member",1!==e.members.length?"s":""]})]})]}),(0,p.jsxs)(Jh,{variant:"secondary",className:"bg-blue-500/10 text-blue-700 dark:text-blue-400",children:[(0,p.jsx)(f.Edit3,{className:"h-3 w-3 mr-1"}),"Team"]})]},e.id))})]}),(0,p.jsx)(Sy,{})]}),(0,p.jsxs)("div",{className:"space-y-3",children:[(0,p.jsx)("h4",{className:"text-sm font-semibold",children:"People with access"}),(0,p.jsx)(uy,{className:"max-h-[300px]",children:g.length>0?(0,p.jsx)("div",{className:"space-y-2 pr-4",children:g.map(e=>{return(0,p.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[(0,p.jsxs)("div",{className:"flex items-center gap-3",children:[(0,p.jsx)(Cm,{className:"h-8 w-8",children:(0,p.jsx)(Tm,{className:"bg-gradient-to-br from-primary/20 to-primary/10",children:(t=e.email,t.substring(0,2).toUpperCase())})}),(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"text-sm font-medium",children:e.email}),(0,p.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Added ",new Date(e.sharedAt).toLocaleDateString()]})]})]}),(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsxs)(hb,{value:e.role||"viewer",onValueChange:t=>((e,t)=>{const n=g.map(n=>n.email===e?{...n,role:t}:n);x(n),o&&o({...a,isPublic:h,sharedWith:n}),Zy.success("Role updated")})(e.email,t),children:[(0,p.jsx)(pb,{className:"h-8 w-32",children:(0,p.jsx)(mb,{})}),(0,p.jsxs)(xb,{children:[(0,p.jsx)(vb,{value:"editor",children:(0,p.jsxs)("span",{className:"flex items-center gap-2",children:[(0,p.jsx)(f.Edit3,{className:"h-3 w-3"}),"Editor"]})}),(0,p.jsx)(vb,{value:"commentor",children:(0,p.jsxs)("span",{className:"flex items-center gap-2",children:[(0,p.jsx)(f.MessageSquare,{className:"h-3 w-3"}),"Commentor"]})}),(0,p.jsx)(vb,{value:"viewer",children:(0,p.jsxs)("span",{className:"flex items-center gap-2",children:[(0,p.jsx)(f.Eye,{className:"h-3 w-3"}),"Viewer"]})})]})]}),(0,p.jsx)($d,{variant:"ghost",size:"sm",onClick:()=>(e=>{const t=g.filter(t=>t.email!==e);x(t),o&&o({...a,isPublic:h,sharedWith:t}),Zy.success("Access removed")})(e.email),className:"h-8 w-8 p-0",children:(0,p.jsx)(f.X,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"})})]})]},e.email);var t})}):(0,p.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,p.jsx)(f.UserPlus,{className:"h-12 w-12 text-muted-foreground mb-3 opacity-50"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"No one else has access yet"}),(0,p.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Invite people to collaborate"})]})})]})]})]})})},Cb=({open:e,onOpenChange:t,currentTags:n,onUpdateTags:r})=>{const[a,s]=(0,u.useState)(""),[o,i]=(0,u.useState)(n),l=()=>{if(a.trim()&&!o.includes(a.trim())){const e=[...o,a.trim()];i(e),s("")}};return(0,p.jsx)(Rd,{open:e,onOpenChange:t,children:(0,p.jsxs)(_d,{className:"sm:max-w-md",children:[(0,p.jsx)(zd,{children:(0,p.jsx)(Pd,{children:"Manage Tags"})}),(0,p.jsxs)("div",{className:"space-y-4",children:[(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsx)(am,{value:a,onChange:e=>s(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),l())},placeholder:"Enter tag name...",className:"flex-1"}),(0,p.jsxs)($d,{onClick:l,size:"sm",children:[(0,p.jsx)(f.Plus,{className:"h-4 w-4 mr-1"}),"Add"]})]}),(0,p.jsx)("div",{className:"flex flex-wrap gap-2 min-h-[60px] p-3 border border-border rounded-md bg-muted/20",children:0===o.length?(0,p.jsx)("p",{className:"text-sm text-muted-foreground",children:"No tags added yet"}):o.map(e=>(0,p.jsxs)(Jh,{variant:"secondary",className:"gap-1 pl-2 pr-1",children:[e,(0,p.jsx)("button",{onClick:()=>(e=>{const t=o.filter(t=>t!==e);i(t)})(e),className:"ml-1 hover:bg-background/80 rounded-sm p-0.5",children:(0,p.jsx)(f.X,{className:"h-3 w-3"})})]},e))}),(0,p.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,p.jsx)($d,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),(0,p.jsx)($d,{onClick:()=>{r(o),t(!1)},children:"Save Tags"})]})]})]})})};function Nb({isSearchModalOpen:e,setIsSearchModalOpen:t,isSettingsOpen:n,setIsSettingsOpen:r,settingsInitialSection:a,isTeamsOpen:s,setIsTeamsOpen:o,isInviteModalOpen:i,setIsInviteModalOpen:l,isTagDialogOpen:c,setIsTagDialogOpen:d,documents:u,activeDocument:h,tagManagementDocId:m,defaultSidebarView:f,setDefaultSidebarView:g,enableDatabaseSync:x,setEnableDatabaseSync:v,setDocuments:y,onSelectDocument:b,onToggleTheme:w,currentTheme:S,onUpdateTags:j}){return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(py,{open:e,onOpenChange:t,documents:u,onSelectDocument:b,onOpenSettings:()=>r(!0),onOpenTeams:()=>o(!0),onToggleTheme:w,currentTheme:S}),(0,p.jsx)(ib,{open:n,onOpenChange:r,initialSection:a,defaultSidebarView:f,onDefaultSidebarViewChange:g,enableDatabaseSync:x,onEnableDatabaseSyncChange:v}),(0,p.jsx)(Sb,{open:s,onOpenChange:o}),(0,p.jsx)(kb,{open:i,onOpenChange:l,documentTitle:h?.title||"Untitled",documentId:h?.id||"",sharingInfo:h?.sharing,onUpdateSharing:e=>{h&&y(t=>t.map(t=>t.id===h.id?{...t,sharing:e}:t))}}),(0,p.jsx)(Cb,{open:c,onOpenChange:d,currentTags:m&&u.find(e=>e.id===m)?.tags||[],onUpdateTags:j})]})}function Tb(e){const t=wy(),[n,r]=(0,u.useState)(!1),[a,s]=(0,u.useState)(!1),[o,i]=(0,u.useState)(!1),[l,c]=(0,u.useState)(!1),[d,h]=(0,u.useState)(!1),[m,p]=(0,u.useState)(!1),[f,g]=(0,u.useState)(!1),[x,v]=(0,u.useState)(null),[y,b]=yb("REASON-default-sidebar-view","last-used"),[w,S]=yb("REASON-left-panels",["files","openTabs"]),[j,k]=yb("REASON-left-split",!0),[C,T]=yb("REASON-right-panels",[]),[M,E]=yb("REASON-right-split",!1),[A,R]=yb("REASON-show-dynamic-island",!1),[I,D]=yb("REASON-sidebar-width",25),[_,z]=(0,u.useState)(null),[P,O]=(0,u.useState)(!1),L=(0,u.useRef)(null),[F,B]=(0,u.useState)([]),[H,V]=yb("REASON-documents",Bd),[$,q]=yb("REASON-active-doc",H.length>0?H[0].id:null),[U,G]=yb("REASON-open-tabs",H.length>0?[H[0].id]:[]),[W,K]=(0,u.useState)([]),[Y,X]=(0,u.useState)(null),[Z,J]=(0,u.useState)(""),[Q,ee]=(0,u.useState)(null),[te,ne]=(0,u.useState)(Ao()),[re,ae]=yb("REASON-enable-db-sync",!1),{isSyncing:se,lastSyncTime:oe,saveDocument:ie,deleteDocument:le,queueDocumentForSync:ce}=function(e,t,n={}){const{enableSync:r=!1,syncInterval:a=5e3}=n,[s,o]=(0,u.useState)(!1),[i,l]=(0,u.useState)(null),c=(0,u.useRef)(new Map),d=(0,u.useRef)(void 0),h=(0,u.useCallback)(async()=>{if(r)try{const e=(await(0,N.default)("doc/documents")).map(e=>({id:e.id.toString(),title:e.title||e.name||"Untitled",content:e.content||"",parentId:e.parentId?e.parentId.toString():null,children:[],isExpanded:1===e.isExpanded,isFolder:1===e.isFolder,tags:e.metadata&&JSON.parse(e.metadata).tags||[],metadata:e.metadata?JSON.parse(e.metadata):void 0}));return t(e),l(new Date),e}catch(e){return Zy.error("Failed to load documents from database"),null}},[r,t]),m=(0,u.useCallback)(async e=>{if(r)try{const n={name:e.title||"Untitled",title:e.title||"Untitled",content:e.content||"",parentId:e.parentId?parseInt(e.parentId):null,isFolder:e.isFolder||!1,metadata:{tags:e.tags||[],isExpanded:e.isExpanded||!1,...e.metadata}};if(isNaN(parseInt(e.id))){const r=await(0,N.default)("doc/documents",{method:"POST",headers:{"Content-Type":"application/json"},body:n});return t(t=>t.map(t=>t.id===e.id?{...t,id:r.id.toString()}:t)),r}return await(0,N.default)(`doc/documents/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:n})}catch(n){return Zy.error("Failed to save document to database"),null}},[r,t]),p=(0,u.useCallback)(async()=>{if(r&&0!==c.current.size){o(!0);try{const e=Array.from(c.current.values());await Promise.all(e.map(e=>m(e))),c.current.clear(),l(new Date)}catch(e){}finally{o(!1)}}},[r,m]),f=(0,u.useCallback)(e=>{r&&(c.current.set(e.id,e),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{p()},2e3))},[r,p]),g=(0,u.useCallback)(async e=>{if(r)try{return await(0,N.default)(`doc/documents/${e}`,{method:"DELETE"}),!0}catch(t){return Zy.error("Failed to delete document from database"),!1}},[r]);return(0,u.useEffect)(()=>{if(!r||a<=0)return;const e=setInterval(()=>{c.current.size>0&&p()},a);return()=>clearInterval(e)},[r,a,p]),(0,u.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]),{isSyncing:s,lastSyncTime:i,loadFromDatabase:h,saveDocument:m,deleteDocument:g,queueDocumentForSync:f,syncPendingChanges:p}}(0,V,{enableSync:re,syncInterval:5e3}),de=e=>{const t=new Map,n=[];return e.forEach(e=>{t.set(e.id,{...e,children:[]})}),e.forEach(e=>{const r=t.get(e.id);e.parentId&&t.has(e.parentId)?t.get(e.parentId).children.push(r):n.push(r)}),n},ue=(0,u.useMemo)(()=>de(H),[H]),he=H.find(e=>e.id===$);(0,u.useEffect)(()=>{document.title=he?.title?`${he.title} - Reason Docs`:"Reason - Powerful Note-Taking App"},[he?.title]),(0,u.useEffect)(()=>{B([])},[$]);const me=(0,u.useMemo)(()=>{const e=H.filter(e=>!e.isDeleted);if(!Z.trim())return e;const t=Z.toLowerCase();return e.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t))},[H,Z]),pe=(0,u.useMemo)(()=>Z.trim()?de(me):ue,[me,Z]),fe=async(e,t=!1)=>{let n=null;if(e){const t=H.find(t=>t.id===e);t&&(n=t.isFolder?e:t.parentId)}const r={id:Date.now().toString(),title:t?"New Folder":"",content:"",parentId:n,children:[],isExpanded:t,isFolder:t,tags:[]};V([...H,r]),re&&await ie(r),t||(q(r.id),G([...U,r.id])),ee(r.id),setTimeout(()=>ee(null),500),n&&V(e=>e.map(e=>e.id===n?{...e,isExpanded:!0}:e)),Zy.success(t?"Folder created":"Note created")},ge=async e=>{const t=e=>[e,...H.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],n=t(e),r=H.filter(e=>!n.includes(e.id));if(V(r),re)for(const s of n)await le(s);const a=U.filter(e=>!n.includes(e));G(a),$&&n.includes($)&&q(a.length>0?a[0]:r.length>0?r[0].id:null),Zy.success("Note deleted")},xe=e=>{V(t=>t.map(t=>t.id===e?{...t,isExpanded:!t.isExpanded}:t))};(0,u.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),i(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,u.useEffect)(()=>{e&&(S(["files"]),r(!0))},[e]),(0,u.useEffect)(()=>{"tree"===y?(S(["files"]),k(!1)):"outline"===y?(S(["outline"]),k(!1)):"split"===y&&(S(["files","openTabs","outline"]),k(!0))},[]);const ve=e=>{K([e,...W.slice(0,9)]);const t=U.filter(t=>t!==e);if(G(t),$===e){const n=U.indexOf(e),r=Math.max(0,n-1);q(t[r]||null)}},ye=()=>{if(0===W.length)return;const[e,...t]=W;H.find(t=>t.id===e)?(U.includes(e)||G([...U,e]),q(e),K(t),Zy.success("Tab reopened")):(K(t),t.length>0&&ye())},be=()=>{T(e=>e.filter(e=>"ai"!==e)),S(e=>e.length>1?e.filter(e=>"ai"!==e):e)};return(0,u.useEffect)(()=>{$&&!H.find(e=>e.id===$)&&q(H.length>0?H[0].id:null)},[H,$,q]),{isMobile:t,isSidebarOpen:n,setIsSidebarOpen:r,isRightSidebarOpen:a,setIsRightSidebarOpen:s,isSearchModalOpen:o,setIsSearchModalOpen:i,isSettingsOpen:l,setIsSettingsOpen:c,isTeamsOpen:d,setIsTeamsOpen:h,isInviteModalOpen:m,setIsInviteModalOpen:p,isTagDialogOpen:f,setIsTagDialogOpen:g,tagManagementDocId:x,defaultSidebarView:y,setDefaultSidebarView:b,leftPanels:w,setLeftPanels:S,leftSplit:j,setLeftSplit:k,rightPanels:C,setRightPanels:T,rightSplit:M,setRightSplit:E,showDynamicIsland:A,setShowDynamicIsland:R,sidebarWidth:I,setSidebarWidth:D,aiSuggestion:_,setAiSuggestion:z,isAiLoading:P,setIsAiLoading:O,editorRef:L,headings:F,setHeadings:B,documents:H,setDocuments:V,activeDocId:$,setActiveDocId:q,openTabs:U,setOpenTabs:G,closedTabsHistory:W,splitViewDocId:Y,setSplitViewDocId:X,searchQuery:Z,setSearchQuery:J,newDocumentId:Q,activeFileSourceId:te,enableDatabaseSync:re,setEnableDatabaseSync:ae,isSyncing:se,lastSyncTime:oe,documentTree:ue,activeDocument:he,filteredDocuments:me,filteredTree:pe,handleAddDocument:fe,handleDeleteDocument:ge,handleDuplicateDocument:e=>{const t=H.find(t=>t.id===e);if(!t)return;const n={...t,id:Date.now().toString(),title:t.title+" (Copy)",children:[]};V([...H,n]),q(n.id),G([...U,n.id]),Zy.success("Note duplicated")},handleUpdateDocument:(e,t)=>{V(n=>n.map(n=>{if(n.id===e){const e={...n,...t};return re&&ce(e),e}return n}))},handleToggleExpand:xe,handleMoveDocument:(e,t,n)=>{const r=H.find(t=>t.id===e),a=H.find(e=>e.id===t);if(!r||e===t)return;const s=(e,t)=>H.filter(t=>t.parentId===e).some(e=>e.id===t||s(e.id,t));if(t&&s(e,t))return void Zy.error("Cannot move a note into its own child");let o;o="child"===n?t:a?.parentId||null,V(a=>{const s=a.filter(t=>t.id!==e),i={...r,parentId:o};let l;if("child"===n){const e=s.findIndex(e=>e.id===t),n=s.findIndex((n,r)=>r>e&&n.parentId===t);l=-1!==n?n:e+1}else if("before"===n)l=s.findIndex(e=>e.id===t);else{const e=s.findIndex(e=>e.id===t);let n=e;const r=(e,t)=>{let n=t;for(let a=t+1;a<s.length;a++)if(s[a].parentId===e){n=a;const e=r(s[a].id,a);e>n&&(n=e,a=e)}return n};n=r(t,e),l=n+1}return[...s.slice(0,l),i,...s.slice(l)]}),Zy.success("Note moved")},handleAddTag:(e,t)=>{V(n=>n.map(n=>n.id===e?{...n,tags:[...n.tags||[],t]}:n))},handleRemoveTag:(e,t)=>{V(n=>n.map(n=>n.id===e?{...n,tags:(n.tags||[]).filter(e=>e!==t)}:n))},handleManageTags:e=>{v(e),g(!0)},handleFileSourceChange:async e=>{ne(e),Ro(e);const t=function(){const e=Mo(),t=Ao();return e.find(e=>e.id===t)||To}();try{"local"!==t.type?Zy.info(`Source switching for ${t.type} not yet implemented in standalone mode`):Zy.success("Switched to local storage")}catch(n){Zy.error("Failed to load documents from source")}},handleUpdateTags:e=>{x&&(V(t=>t.map(t=>t.id===x?{...t,tags:e}:t)),Zy.success("Tags updated"))},handleRestoreDocument:e=>{V(t=>t.map(t=>t.id===e?{...t,isDeleted:!1}:t)),Zy.success("Note restored")},handlePermanentDelete:e=>{const t=e=>[e,...H.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],n=t(e),r=H.filter(e=>!n.includes(e.id));V(r);const a=U.filter(e=>!n.includes(e));G(a),$&&n.includes($)&&q(a.length>0?a[0]:r.length>0?r[0].id:null),Zy.success("Note permanently deleted")},handleTabChange:e=>{q(e)},handleTabClose:ve,handleTabAdd:()=>{fe(null)},handleTabDelete:e=>{ve(e),ge(e)},handleReopenLastClosed:ye,handleSplitRight:e=>{X(e),Zy.success("Split view enabled")},handleSelectDocument:e=>{H.find(t=>t.id===e)?.isFolder?xe(e):(U.includes(e)||G([...U,e]),q(e))},handleAIRewrite:async(e,t)=>{Zy.info("AI rewrite is not yet available for this editor")},handleAIApprove:()=>{z(null),be()},handleAIReject:()=>{z(null),be()},handleAIRegenerate:async e=>{Zy.info("AI rewrite is not yet available for this editor")}}}var Mb=(0,u.createContext)({});function Eb(e){const t=(0,u.useRef)(null);return null===t.current&&(t.current=e()),t.current}var Ab="undefined"!=typeof window?u.useLayoutEffect:u.useEffect,Rb=(0,u.createContext)(null);function Ib(e,t){-1===e.indexOf(t)&&e.push(t)}function Db(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}var _b=(e,t,n)=>n>t?t:n<e?e:n;var zb=()=>{},Pb=()=>{};"undefined"!=typeof process&&"production"!==process.env.NODE_ENV&&(zb=(e,t,n)=>{},Pb=(e,t,n)=>{if(!e)throw new Error(function(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}(t,n))});var Ob={},Lb=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Fb=e=>"object"==typeof e&&null!==e,Bb=e=>/^0[^.\s]+$/u.test(e);function Hb(e){let t;return()=>(void 0===t&&(t=e()),t)}var Vb=e=>e,$b=(...e)=>e.reduce((e,t)=>n=>t(e(n))),qb=(e,t,n)=>{const r=t-e;return r?(n-e)/r:1},Ub=class{constructor(){this.subscriptions=[]}add(e){return Ib(this.subscriptions,e),()=>Db(this.subscriptions,e)}notify(e,t,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](e,t,n);else for(let a=0;a<r;a++){const r=this.subscriptions[a];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Gb=e=>1e3*e,Wb=e=>e/1e3,Kb=(e,t)=>t?e*(1e3/t):0,Yb=new Set;function Xb(e,t,n){e||Yb.has(t)||Yb.add(t)}var Zb=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function Jb(e,t,n,r){if(e===t&&n===r)return Vb;const a=t=>function(e,t,n,r,a){let s,o,i=0;do{o=t+(n-t)/2,s=Zb(o,r,a)-e,s>0?n=o:t=o}while(Math.abs(s)>1e-7&&++i<12);return o}(t,0,1,e,n);return e=>0===e||1===e?e:Zb(a(e),t,r)}var Qb=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,ew=e=>t=>1-e(1-t),tw=Jb(.33,1.53,.69,.99),nw=ew(tw),rw=Qb(nw),aw=e=>e>=1?1:(e*=2)<1?.5*nw(e):.5*(2-Math.pow(2,-10*(e-1))),sw=e=>1-Math.sin(Math.acos(e)),ow=ew(sw),iw=Qb(sw),lw=Jb(.42,0,1,1),cw=Jb(0,0,.58,1),dw=Jb(.42,0,.58,1),uw=e=>Array.isArray(e)&&"number"==typeof e[0],hw={linear:Vb,easeIn:lw,easeInOut:dw,easeOut:cw,circIn:sw,circInOut:iw,circOut:ow,backIn:nw,backInOut:rw,backOut:tw,anticipate:aw},mw=e=>{if(uw(e)){Pb(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,r,a]=e;return Jb(t,n,r,a)}return"string"==typeof e?(Pb(void 0!==hw[e],`Invalid easing type '${e}'`,"invalid-easing-type"),hw[e]):e},pw=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function fw(e,t){let n=!1,r=!0;const a={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,o=pw.reduce((e,t)=>(e[t]=function(e){let t=new Set,n=new Set,r=!1,a=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function i(t){s.has(t)&&(l.schedule(t),e()),t(o)}const l={schedule:(e,a=!1,o=!1)=>{const i=o&&r?t:n;return a&&s.add(e),i.add(e),e},cancel:e=>{n.delete(e),s.delete(e)},process:e=>{if(o=e,r)return void(a=!0);r=!0;const s=t;t=n,n=s,t.forEach(i),t.clear(),r=!1,a&&(a=!1,l.process(e))}};return l}(s),e),{}),{setup:i,read:l,resolveKeyframes:c,preUpdate:d,update:u,preRender:h,render:m,postRender:p}=o,f=()=>{const s=Ob.useManualTiming,o=s?a.timestamp:performance.now();n=!1,s||(a.delta=r?1e3/60:Math.max(Math.min(o-a.timestamp,40),1)),a.timestamp=o,a.isProcessing=!0,i.process(a),l.process(a),c.process(a),d.process(a),u.process(a),h.process(a),m.process(a),p.process(a),a.isProcessing=!1,n&&t&&(r=!1,e(f))};return{schedule:pw.reduce((t,s)=>{const i=o[s];return t[s]=(t,s=!1,o=!1)=>(n||(n=!0,r=!0,a.isProcessing||e(f)),i.schedule(t,s,o)),t},{}),cancel:e=>{for(let t=0;t<pw.length;t++)o[pw[t]].cancel(e)},state:a,steps:o}}var gw,{schedule:xw,cancel:vw,state:yw,steps:bw}=fw("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Vb,!0);function ww(){gw=void 0}var Sw={now:()=>(void 0===gw&&Sw.set(yw.isProcessing||Ob.useManualTiming?yw.timestamp:performance.now()),gw),set:e=>{gw=e,queueMicrotask(ww)}},jw=e=>t=>"string"==typeof t&&t.startsWith(e),kw=jw("--"),Cw=jw("var(--"),Nw=e=>!!Cw(e)&&Tw.test(e.split("/*")[0].trim()),Tw=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Mw(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}var Ew={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},Aw={...Ew,transform:e=>_b(0,1,e)},Rw={...Ew,default:1},Iw=e=>Math.round(1e5*e)/1e5,Dw=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;var _w=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,zw=(e,t)=>n=>Boolean("string"==typeof n&&_w.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),Pw=(e,t,n)=>r=>{if("string"!=typeof r)return r;const[a,s,o,i]=r.match(Dw);return{[e]:parseFloat(a),[t]:parseFloat(s),[n]:parseFloat(o),alpha:void 0!==i?parseFloat(i):1}},Ow={...Ew,transform:e=>Math.round((e=>_b(0,255,e))(e))},Lw={test:zw("rgb","red"),parse:Pw("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Ow.transform(e)+", "+Ow.transform(t)+", "+Ow.transform(n)+", "+Iw(Aw.transform(r))+")"};var Fw={test:zw("#"),parse:function(e){let t="",n="",r="",a="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),a=e.substring(4,5),t+=t,n+=n,r+=r,a+=a),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:a?parseInt(a,16)/255:1}},transform:Lw.transform},Bw=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),Hw=Bw("deg"),Vw=Bw("%"),$w=Bw("px"),qw=Bw("vh"),Uw=Bw("vw"),Gw=(()=>({...Vw,parse:e=>Vw.parse(e)/100,transform:e=>Vw.transform(100*e)}))(),Ww={test:zw("hsl","hue"),parse:Pw("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Vw.transform(Iw(t))+", "+Vw.transform(Iw(n))+", "+Iw(Aw.transform(r))+")"},Kw={test:e=>Lw.test(e)||Fw.test(e)||Ww.test(e),parse:e=>Lw.test(e)?Lw.parse(e):Ww.test(e)?Ww.parse(e):Fw.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?Lw.transform(e):Ww.transform(e),getAnimatableNone:e=>{const t=Kw.parse(e);return t.alpha=0,Kw.transform(t)}},Yw=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;var Xw="number",Zw="color",Jw=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Qw(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},a=[];let s=0;return{values:n,split:t.replace(Jw,e=>(Kw.test(e)?(r.color.push(s),a.push(Zw),n.push(Kw.parse(e))):e.startsWith("var(")?(r.var.push(s),a.push("var"),n.push(e)):(r.number.push(s),a.push(Xw),n.push(parseFloat(e))),++s,"${}")).split("${}"),indexes:r,types:a}}function eS({split:e,types:t}){const n=e.length;return r=>{let a="";for(let s=0;s<n;s++)if(a+=e[s],void 0!==r[s]){const e=t[s];a+=e===Xw?Iw(r[s]):e===Zw?Kw.transform(r[s]):r[s]}return a}}var tS=(e,t)=>"number"==typeof e?t?.trim().endsWith("/")?e:0:(e=>"number"==typeof e?0:Kw.test(e)?Kw.getAnimatableNone(e):e)(e);var nS={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(Dw)?.length||0)+(e.match(Yw)?.length||0)>0},parse:function(e){return Qw(e).values},createTransformer:function(e){return eS(Qw(e))},getAnimatableNone:function(e){const t=Qw(e);return eS(t)(t.values.map((e,n)=>tS(e,t.split[n])))}};function rS(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function aS(e,t){return n=>n>0?t:e}var sS=(e,t,n)=>e+(t-e)*n,oS=(e,t,n)=>{const r=e*e,a=n*(t*t-r)+r;return a<0?0:Math.sqrt(a)},iS=[Fw,Lw,Ww];function lS(e){const t=(e=>iS.find(t=>t.test(e)))(e);if(zb(Boolean(t),`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(t))return!1;let n=t.parse(e);return t===Ww&&(n=function({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,n/=100;let a=0,s=0,o=0;if(t/=100){const r=n<.5?n*(1+t):n+t-n*t,i=2*n-r;a=rS(i,r,e+1/3),s=rS(i,r,e),o=rS(i,r,e-1/3)}else a=s=o=n;return{red:Math.round(255*a),green:Math.round(255*s),blue:Math.round(255*o),alpha:r}}(n)),n}var cS=(e,t)=>{const n=lS(e),r=lS(t);if(!n||!r)return aS(e,t);const a={...n};return e=>(a.red=oS(n.red,r.red,e),a.green=oS(n.green,r.green,e),a.blue=oS(n.blue,r.blue,e),a.alpha=sS(n.alpha,r.alpha,e),Lw.transform(a))},dS=new Set(["none","hidden"]);function uS(e,t){return n=>sS(e,t,n)}function hS(e){return"number"==typeof e?uS:"string"==typeof e?Nw(e)?aS:Kw.test(e)?cS:fS:Array.isArray(e)?mS:"object"==typeof e?Kw.test(e)?cS:pS:aS}function mS(e,t){const n=[...e],r=n.length,a=e.map((e,n)=>hS(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=a[t](e);return n}}function pS(e,t){const n={...e,...t},r={};for(const a in n)void 0!==e[a]&&void 0!==t[a]&&(r[a]=hS(e[a])(e[a],t[a]));return e=>{for(const t in r)n[t]=r[t](e);return n}}var fS=(e,t)=>{const n=nS.createTransformer(t),r=Qw(e),a=Qw(t);return r.indexes.var.length===a.indexes.var.length&&r.indexes.color.length===a.indexes.color.length&&r.indexes.number.length>=a.indexes.number.length?dS.has(e)&&!a.values.length||dS.has(t)&&!r.values.length?function(e,t){return dS.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):$b(mS(function(e,t){const n=[],r={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const s=t.types[a],o=e.indexes[s][r[s]],i=e.values[o]??0;n[a]=i,r[s]++}return n}(r,a),a.values),n):(zb(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),aS(e,t))};function gS(e,t,n){return"number"==typeof e&&"number"==typeof t&&"number"==typeof n?sS(e,t,n):hS(e)(e,t)}var xS=e=>{const t=({timestamp:t})=>e(t);return{start:(e=!0)=>xw.update(t,e),stop:()=>vw(t),now:()=>yw.isProcessing?yw.timestamp:Sw.now()}},vS=(e,t,n=10)=>{let r="";const a=Math.max(Math.round(t/n),2);for(let s=0;s<a;s++)r+=Math.round(1e4*e(s/(a-1)))/1e4+", ";return`linear(${r.substring(0,r.length-2)})`};function yS(e){let t=0;let n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}var bS=100,wS=10,SS=1,jS=0,kS=800,CS=.3,NS=.3,TS={granular:.01,default:2},MS={granular:.005,default:.5},ES=.01,AS=10,RS=.05,IS=1;function DS(e,t){return e*Math.sqrt(1-t*t)}var _S=["duration","bounce"],zS=["stiffness","damping","mass"];function PS(e,t){return t.some(t=>void 0!==e[t])}function OS(e){let t={velocity:jS,stiffness:bS,damping:wS,mass:SS,isResolvedFromDuration:!1,...e};if(!PS(e,zS)&&PS(e,_S))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(1.2*n),a=r*r,s=2*_b(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:SS,stiffness:a,damping:s}}else{const n=function({duration:e=kS,bounce:t=CS,velocity:n=jS,mass:r=SS}){let a,s;zb(e<=Gb(AS),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-t;o=_b(RS,IS,o),e=_b(ES,AS,Wb(e)),o<1?(a=t=>{const r=t*o,a=r*e;return.001-(r-n)/DS(t,o)*Math.exp(-a)},s=t=>{const r=t*o*e,s=r*n+n,i=Math.pow(o,2)*Math.pow(t,2)*e,l=Math.exp(-r),c=DS(Math.pow(t,2),o);return(.001-a(t)>0?-1:1)*((s-i)*l)/c}):(a=t=>Math.exp(-t*e)*((t-n)*e+1)-.001,s=t=>Math.exp(-t*e)*(e*e*(n-t)));const i=function(e,t,n){let r=n;for(let a=1;a<12;a++)r-=e(r)/t(r);return r}(a,s,5/e);if(e=Gb(e),isNaN(i))return{stiffness:bS,damping:wS,duration:e};{const t=Math.pow(i,2)*r;return{stiffness:t,damping:2*o*Math.sqrt(r*t),duration:e}}}({...e,velocity:0});t={...t,...n,mass:SS},t.isResolvedFromDuration=!0}return t}function LS(e=NS,t=CS){const n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:a}=n;const s=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],i={done:!1,value:s},{stiffness:l,damping:c,mass:d,duration:u,velocity:h,isResolvedFromDuration:m}=OS({...n,velocity:-Wb(n.velocity||0)}),p=h||0,f=c/(2*Math.sqrt(l*d)),g=o-s,x=Wb(Math.sqrt(l/d)),v=Math.abs(g)<5;let y,b,w,S,j,k;if(r||(r=v?TS.granular:TS.default),a||(a=v?MS.granular:MS.default),f<1)w=DS(x,f),S=(p+f*x*g)/w,y=e=>{const t=Math.exp(-f*x*e);return o-t*(S*Math.sin(w*e)+g*Math.cos(w*e))},j=f*x*S+g*w,k=f*x*g-S*w,b=e=>Math.exp(-f*x*e)*(j*Math.sin(w*e)+k*Math.cos(w*e));else if(1===f){y=e=>o-Math.exp(-x*e)*(g+(p+x*g)*e);const e=p+x*g;b=t=>Math.exp(-x*t)*(x*e*t-p)}else{const e=x*Math.sqrt(f*f-1);y=t=>{const n=Math.exp(-f*x*t),r=Math.min(e*t,300);return o-n*((p+f*x*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};const t=(p+f*x*g)/e,n=f*x*t-g*e,r=f*x*g-t*e;b=t=>{const a=Math.exp(-f*x*t),s=Math.min(e*t,300);return a*(n*Math.sinh(s)+r*Math.cosh(s))}}const C={calculatedDuration:m&&u||null,velocity:e=>Gb(b(e)),next:e=>{if(!m&&f<1){const t=Math.exp(-f*x*e),n=Math.sin(w*e),s=Math.cos(w*e),l=o-t*(S*n+g*s),c=Gb(t*(j*n+k*s));return i.done=Math.abs(c)<=r&&Math.abs(o-l)<=a,i.value=i.done?o:l,i}const t=y(e);if(m)i.done=e>=u;else{const n=Gb(b(e));i.done=Math.abs(n)<=r&&Math.abs(o-t)<=a}return i.value=i.done?o:t,i},toString:()=>{const e=Math.min(yS(C),2e4),t=vS(t=>C.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return C}LS.applyToOptions=e=>{const t=function(e,t=100,n){const r=n({...e,keyframes:[0,t]}),a=Math.min(yS(r),2e4);return{type:"keyframes",ease:e=>r.next(a*e).value/t,duration:Wb(a)}}(e,100,LS);return e.ease=t.ease,e.duration=Gb(t.duration),e.type="keyframes",e};function FS(e,t,n){const r=Math.max(t-5,0);return Kb(n-e(r),t-r)}function BS({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:a=10,bounceStiffness:s=500,modifyTarget:o,min:i,max:l,restDelta:c=.5,restSpeed:d}){const u=e[0],h={done:!1,value:u},m=e=>void 0===i?l:void 0===l||Math.abs(i-e)<Math.abs(l-e)?i:l;let p=n*t;const f=u+p,g=void 0===o?f:o(f);g!==f&&(p=g-u);const x=e=>-p*Math.exp(-e/r),v=e=>g+x(e),y=e=>{const t=x(e),n=v(e);h.done=Math.abs(t)<=c,h.value=h.done?g:n};let b,w;const S=e=>{(e=>void 0!==i&&e<i||void 0!==l&&e>l)(h.value)&&(b=e,w=LS({keyframes:[h.value,m(h.value)],velocity:FS(v,e,h.value),damping:a,stiffness:s,restDelta:c,restSpeed:d}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return w||void 0!==b||(t=!0,y(e),S(e)),void 0!==b&&e>=b?w.next(e-b):(!t&&y(e),h)}}}function HS(e,t,{clamp:n=!0,ease:r,mixer:a}={}){const s=e.length;if(Pb(s===t.length,"Both input and output ranges must be the same length","range-length"),1===s)return()=>t[0];if(2===s&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const i=function(e,t,n){const r=[],a=n||Ob.mix||gS,s=e.length-1;for(let o=0;o<s;o++){let n=a(e[o],e[o+1]);if(t){const e=Array.isArray(t)?t[o]||Vb:t;n=$b(e,n)}r.push(n)}return r}(t,r,a),l=i.length,c=n=>{if(o&&n<e[0])return t[0];let r=0;if(l>1)for(;r<e.length-2&&!(n<e[r+1]);r++);const a=qb(e[r],e[r+1],n);return i[r](a)};return n?t=>c(_b(e[0],e[s-1],t)):c}function VS(e){const t=[0];return function(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const a=qb(0,t,r);e.push(sS(n,1,a))}}(t,e.length-1),t}function $S({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const a=(e=>Array.isArray(e)&&"number"!=typeof e[0])(r)?r.map(mw):mw(r),s={done:!1,value:t[0]},o=function(e,t){return e.map(e=>e*t)}(n&&n.length===t.length?n:VS(t),e),i=HS(o,t,{ease:Array.isArray(a)?a:(l=t,c=a,l.map(()=>c||dw).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(s.value=i(t),s.done=t>=e,s)}}var qS=e=>null!==e;function US(e,{repeat:t,repeatType:n="loop"},r,a=1){const s=e.filter(qS),o=a<0||t&&"loop"!==n&&t%2==1?0:s.length-1;return o&&void 0!==r?r:s[o]}var GS={decay:BS,inertia:BS,tween:$S,keyframes:$S,spring:LS};function WS(e){"string"==typeof e.type&&(e.type=GS[e.type])}var KS=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},YS=e=>e/100,XS=class extends KS{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:e}=this.options;e&&e.updatedAt!==Sw.now()&&this.tick(Sw.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){const{options:e}=this;WS(e);const{type:t=$S,repeat:n=0,repeatDelay:r=0,repeatType:a,velocity:s=0}=e;let{keyframes:o}=e;const i=t||$S;"production"!==process.env.NODE_ENV&&i!==$S&&Pb(o.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${o}`,"spring-two-frames"),i!==$S&&"number"!=typeof o[0]&&(this.mixKeyframes=$b(YS,gS(o[0],o[1])),o=[0,100]);const l=i({...e,keyframes:o});"mirror"===a&&(this.mirroredGenerator=i({...e,keyframes:[...o].reverse(),velocity:-s})),null===l.calculatedDuration&&(l.calculatedDuration=yS(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=l}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:n,totalDuration:r,mixKeyframes:a,mirroredGenerator:s,resolvedDuration:o,calculatedDuration:i}=this;if(null===this.startTime)return n.next(0);const{delay:l=0,keyframes:c,repeat:d,repeatType:u,repeatDelay:h,type:m,onUpdate:p,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=r);let v,y=this.currentTime,b=n;if(d){const e=Math.min(this.currentTime,r)/o;let t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,t=Math.min(t,d+1),Boolean(t%2)&&("reverse"===u?(n=1-n,h&&(n-=h/o)):"mirror"===u&&(b=s)),y=_b(0,1,n)*o}x?(this.delayState.value=c[0],v=this.delayState):v=b.next(y),a&&!x&&(v.value=a(v.value));let{done:w}=v;x||null===i||(w=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return S&&m!==BS&&(v.value=US(c,this.options,f,this.speed)),p&&p(v.value),S&&this.finish(),v}then(e,t){return this.finished.then(e,t)}get duration(){return Wb(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Wb(e)}get time(){return Wb(this.currentTime)}set time(e){e=Gb(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);return FS(e=>this.generator.next(e).value,e,this.generator.next(e).value)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Sw.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Wb(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=xS,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();const n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=t??n),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Sw.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}};var ZS=e=>180*e/Math.PI,JS=e=>{const t=ZS(Math.atan2(e[1],e[0]));return ej(t)},QS={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:JS,rotateZ:JS,skewX:e=>ZS(Math.atan(e[1])),skewY:e=>ZS(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},ej=e=>((e%=360)<0&&(e+=360),e),tj=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),nj=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),rj={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:tj,scaleY:nj,scale:e=>(tj(e)+nj(e))/2,rotateX:e=>ej(ZS(Math.atan2(e[6],e[5]))),rotateY:e=>ej(ZS(Math.atan2(-e[2],e[0]))),rotateZ:JS,rotate:JS,skewX:e=>ZS(Math.atan(e[4])),skewY:e=>ZS(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function aj(e){return e.includes("scale")?1:0}function sj(e,t){if(!e||"none"===e)return aj(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,a;if(n)r=rj,a=n;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=QS,a=t}if(!a)return aj(t);const s=r[t],o=a[1].split(",").map(oj);return"function"==typeof s?s(o):o[s]}function oj(e){return parseFloat(e.trim())}var ij=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],lj=(()=>new Set([...ij,"pathRotation"]))(),cj=e=>e===Ew||e===$w,dj=new Set(["x","y","z"]),uj=ij.filter(e=>!dj.has(e));var hj={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const a=e.max-e.min;return"border-box"===r?a:a-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const a=e.max-e.min;return"border-box"===r?a:a-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>sj(t,"x"),y:(e,{transform:t})=>sj(t,"y")};hj.translateX=hj.x,hj.translateY=hj.y;var mj=new Set,pj=!1,fj=!1,gj=!1;function xj(){if(fj){const e=Array.from(mj).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{const t=function(e){const t=[];return uj.forEach(n=>{const r=e.getValue(n);void 0!==r&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();const t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}fj=!1,pj=!1,mj.forEach(e=>e.complete(gj)),mj.clear()}function vj(){mj.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(fj=!0)})}var yj=class{constructor(e,t,n,r,a,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=a,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(mj.add(this),pj||(pj=!0,xw.read(vj),xw.resolveKeyframes(xj))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(null===e[0]){const a=r?.get(),s=e[e.length-1];if(void 0!==a)e[0]=a;else if(n&&t){const r=n.readValue(t,s);null!=r&&(e[0]=r)}void 0===e[0]&&(e[0]=s),r&&void 0===a&&r.set(e[0])}!function(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),mj.delete(this)}cancel(){"scheduled"===this.state&&(mj.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}};function bj(e,t,n){(e=>e.startsWith("--"))(t)?e.style.setProperty(t,n):e.style[t]=n}var wj={};function Sj(e,t){const n=Hb(e);return()=>wj[t]??n()}var jj=Sj(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),kj=Sj(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),Cj=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Nj={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Cj([0,.65,.55,1]),circOut:Cj([.55,0,1,.45]),backIn:Cj([.31,.01,.66,-.59]),backOut:Cj([.33,1.53,.69,.99])};function Tj(e,t){return e?"function"==typeof e?kj()?vS(e,t):"ease-out":uw(e)?Cj(e):Array.isArray(e)?e.map(e=>Tj(e,t)||Nj.easeOut):Nj[e]:void 0}function Mj(e,t,n,{delay:r=0,duration:a=300,repeat:s=0,repeatType:o="loop",ease:i="easeOut",times:l}={},c=void 0){const d={[t]:n};l&&(d.offset=l);const u=Tj(i,a);Array.isArray(u)&&(d.easing=u);const h={delay:r,duration:a,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:s+1,direction:"reverse"===o?"alternate":"normal"};return c&&(h.pseudoElement=c),e.animate(d,h)}function Ej(e){return"function"==typeof e&&"applyToOptions"in e}var Aj=class extends KS{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:r,pseudoElement:a,allowFlatten:s=!1,finalKeyframe:o,onComplete:i}=e;this.isPseudoElement=Boolean(a),this.allowFlatten=s,this.options=e,Pb("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return Ej(e)&&kj()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=Mj(t,n,r,l,a),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const e=US(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),bj(t,n,e),this.animation.cancel()}i?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Wb(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Wb(e)}get time(){return Wb(Number(this.animation.currentTime)||0)}set time(e){const t=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Gb(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&jj()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),Vb):r(this)}},Rj={anticipate:aw,backInOut:rw,circInOut:iw};function Ij(e){"string"==typeof e.ease&&e.ease in Rj&&(e.ease=Rj[e.ease])}var Dj=class extends Aj{constructor(e){Ij(e),WS(e),super(e),void 0!==e.startTime&&!1!==e.autoplay&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:n,onComplete:r,element:a,...s}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);const o=new XS({...s,autoplay:!1}),i=Math.max(10,Sw.now()-this.startTime),l=_b(0,10,i-10),c=o.sample(i).value,{name:d}=this.options;a&&d&&bj(a,d,c),t.setWithVelocity(o.sample(Math.max(0,i-l)).value,c,l),o.stop()}},_j=(e,t)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!nS.test(e)&&"0"!==e||e.startsWith("url(")));function zj(e){e.duration=0,e.type="keyframes"}var Pj=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),Oj=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;var Lj=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Fj=Hb(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Bj(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:a,damping:s,type:o,keyframes:i}=e,l=t?.owner?.current;if(!(l instanceof HTMLElement||l instanceof SVGElement))return!1;const{onUpdate:c,transformTemplate:d}=t.owner.getProps();return Fj()&&n&&(Pj.has(n)||Lj.has(n)&&function(e){for(let t=0;t<e.length;t++)if("string"==typeof e[t]&&Oj.test(e[t]))return!0;return!1}(i))&&("transform"!==n||!d)&&!c&&!r&&"mirror"!==a&&0!==s&&"inertia"!==o}var Hj=class extends KS{constructor({autoplay:e=!0,delay:t=0,type:n="keyframes",repeat:r=0,repeatDelay:a=0,repeatType:s="loop",keyframes:o,name:i,motionValue:l,element:c,...d}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Sw.now();const u={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:a,repeatType:s,name:i,motionValue:l,element:c,...d},h=c?.KeyframeResolver||yj;this.keyframeResolver=new h(o,(e,t,n)=>this.onKeyframesResolved(e,t,u,!n),i,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;const{name:a,type:s,velocity:o,delay:i,isHandoff:l,onUpdate:c}=n;this.resolvedAt=Sw.now();let d=!0;(function(e,t,n,r){const a=e[0];if(null===a)return!1;if("display"===t||"visibility"===t)return!0;const s=e[e.length-1],o=_j(a,t),i=_j(s,t);return zb(o===i,`You are trying to animate ${t} from "${a}" to "${s}". "${o?s:a}" is not an animatable value.`,"value-not-animatable"),!(!o||!i)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}(e)||("spring"===n||Ej(n))&&r)})(e,a,s,o)||(d=!1,!Ob.instantAnimations&&i||c?.(US(e,n,t)),e[0]=e[e.length-1],zj(n),n.repeat=0);const u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},h=d&&!l&&Bj(u),m=u.motionValue?.owner?.current;let p;if(h)try{p=new Dj({...u,element:m})}catch{p=new XS(u)}else p=new XS(u);p.finished.then(()=>{this.notifyFinished()}).catch(Vb),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),gj=!0,vj(),xj(),gj=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Vj(e,t,n,r=0,a=1){const s=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,i=(o-1)*r;return"function"==typeof n?n(s,o):1===a?s*r:i-s*r}var $j={current:void 0},qj=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{const t=Sw.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const n of this.dependents)n.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Sw.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(e=>!isNaN(parseFloat(e)))(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return"production"!==process.env.NODE_ENV&&Xb(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Ub);const n=this.events[e].add(t);return"change"===e?()=>{n(),xw.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return $j.current&&$j.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=Sw.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Kb(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Uj(e,t){return new qj(e,t)}function Gj(e,t){if(e?.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function Wj(e,t){const n=e?.[t]??e?.default??e;return n!==e?Gj(n,e):n}var Kj={type:"spring",stiffness:500,damping:25,restSpeed:10},Yj={type:"keyframes",duration:.8},Xj={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Zj=(e,{keyframes:t})=>t.length>2?Yj:lj.has(e)?e.startsWith("scale")?(e=>({type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restSpeed:10}))(t[1]):Kj:Xj,Jj=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);var Qj=(e,t,n,r={},a,s)=>o=>{const i=Wj(r,e)||{},l=i.delay||r.delay||0;let{elapsed:c=0}=r;c-=Gb(l);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...i,delay:-c,onUpdate:e=>{t.set(e),i.onUpdate&&i.onUpdate(e)},onComplete:()=>{o(),i.onComplete&&i.onComplete()},name:e,motionValue:t,element:s?void 0:a};(function(e){for(const t in e)if(!Jj.has(t))return!0;return!1})(i)||Object.assign(d,Zj(e,d)),d.duration&&(d.duration=Gb(d.duration)),d.repeatDelay&&(d.repeatDelay=Gb(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let u=!1;if((!1===d.type||0===d.duration&&!d.repeatDelay)&&(zj(d),0===d.delay&&(u=!0)),(Ob.instantAnimations||Ob.skipAnimations||a?.shouldSkipAnimations||i.skipAnimations)&&(u=!0,zj(d),d.delay=0),d.allowFlatten=!i.type&&!i.ease,u&&!s&&void 0!==t.get()){const e=US(d.keyframes,i);if(void 0!==e)return void xw.update(()=>{d.onUpdate(e),d.onComplete()})}return i.isSync?new XS(d):new Hj(d)},ek=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function tk(e,t,n=1){Pb(n<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,a]=function(e){const t=ek.exec(e);if(!t)return[,];const[,n,r,a]=t;return[`--${n??r}`,a]}(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const e=s.trim();return Lb(e)?parseFloat(e):e}return Nw(a)?tk(a,t,n+1):a}function nk(e){const t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function rk(e,t,n,r){if("function"==typeof t){const[a,s]=nk(r);t=t(void 0!==n?n:e.custom,a,s)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[a,s]=nk(r);t=t(void 0!==n?n:e.custom,a,s)}return t}function ak(e,t,n){const r=e.getProps();return rk(r,t,void 0!==n?n:r.custom,e)}var sk=new Set(["width","height","top","left","right","bottom",...ij]),ok=e=>Array.isArray(e);function ik(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Uj(n))}function lk(e){return ok(e)?e[e.length-1]||0:e}var ck=e=>Boolean(e&&e.getVelocity);function dk(e,t){const n=e.getValue("willChange");if(function(e){return Boolean(ck(e)&&e.add)}(n))return n.add(t);if(!n&&Ob.WillChange){const n=new Ob.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function uk(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var hk="data-"+uk("framerAppearId");function mk(e){return e.props[hk]}function pk({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,r}function fk(e,t,{delay:n=0,transitionOverride:r,type:a}={}){let{transition:s,transitionEnd:o,...i}=t;const l=e.getDefaultTransition();s=s?Gj(s,l):l;const c=s?.reduceMotion,d=s?.skipAnimations;r&&(s=r);const u=[],h=a&&e.animationState&&e.animationState.getState()[a],m=s?.path;m&&m.animateVisualElement(e,i,s,n,u);for(const p in i){const t=e.getValue(p,e.latestValues[p]??null),r=i[p];if(void 0===r||h&&pk(h,p))continue;const a={delay:n,...Wj(s||{},p)};d&&(a.skipAnimations=!0);const o=t.get();if(void 0!==o&&!t.isAnimating()&&!Array.isArray(r)&&r===o&&!a.velocity){xw.update(()=>t.set(r));continue}let l=!1;if(window.MotionHandoffAnimation){const t=mk(e);if(t){const e=window.MotionHandoffAnimation(t,p,xw);null!==e&&(a.startTime=e,l=!0)}}dk(e,p);const m=c??e.shouldReduceMotion;t.start(Qj(p,t,r,m&&sk.has(p)?{type:!1}:a,e,l));const f=t.animation;f&&u.push(f)}if(o){const t=()=>xw.update(()=>{o&&function(e,t){let{transitionEnd:n={},transition:r={},...a}=ak(e,t)||{};a={...a,...n};for(const s in a)ik(e,s,lk(a[s]))}(e,o)});u.length?Promise.all(u).then(t):t()}return u}function gk(e,t,n={}){const r=ak(e,t,"exit"===n.type?e.presenceContext?.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(a=n.transitionOverride);const s=r?()=>Promise.all(fk(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{const{delayChildren:s=0,staggerChildren:o,staggerDirection:i}=a;return function(e,t,n=0,r=0,a=0,s=1,o){const i=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),i.push(gk(l,t,{...o,delay:n+("function"==typeof r?0:r)+Vj(e.variantChildren,l,r,a,s)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(i)}(e,t,r,s,o,i,n)}:()=>Promise.resolve(),{when:i}=a;if(i){const[e,t]="beforeChildren"===i?[s,o]:[o,s];return e().then(()=>t())}return Promise.all([s(),o(n.delay)])}var xk=e=>t=>t.test(e),vk=[Ew,$w,Vw,Hw,Uw,qw,{test:e=>"auto"===e,parse:e=>e}],yk=e=>vk.find(xk(e));function bk(e){return"number"==typeof e?0===e:null===e||("none"===e||"0"===e||Bb(e))}var wk=new Set(["brightness","contrast","saturate","opacity"]);function Sk(e){const[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[r]=n.match(Dw)||[];if(!r)return e;const a=n.replace(r,"");let s=wk.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+a+")"}var jk=/\b([a-z-]*)\(.*?\)/gu,kk={...nS,getAnimatableNone:e=>{const t=e.match(jk);return t?t.map(Sk).join(" "):e}},Ck={...nS,getAnimatableNone:e=>{const t=nS.parse(e);return nS.createTransformer(e)(t.map(e=>"number"==typeof e?0:"object"==typeof e?{...e,alpha:1}:e))}},Nk={...Ew,transform:Math.round},Tk={borderWidth:$w,borderTopWidth:$w,borderRightWidth:$w,borderBottomWidth:$w,borderLeftWidth:$w,borderRadius:$w,borderTopLeftRadius:$w,borderTopRightRadius:$w,borderBottomRightRadius:$w,borderBottomLeftRadius:$w,width:$w,maxWidth:$w,height:$w,maxHeight:$w,top:$w,right:$w,bottom:$w,left:$w,inset:$w,insetBlock:$w,insetBlockStart:$w,insetBlockEnd:$w,insetInline:$w,insetInlineStart:$w,insetInlineEnd:$w,padding:$w,paddingTop:$w,paddingRight:$w,paddingBottom:$w,paddingLeft:$w,paddingBlock:$w,paddingBlockStart:$w,paddingBlockEnd:$w,paddingInline:$w,paddingInlineStart:$w,paddingInlineEnd:$w,margin:$w,marginTop:$w,marginRight:$w,marginBottom:$w,marginLeft:$w,marginBlock:$w,marginBlockStart:$w,marginBlockEnd:$w,marginInline:$w,marginInlineStart:$w,marginInlineEnd:$w,fontSize:$w,backgroundPositionX:$w,backgroundPositionY:$w,...{rotate:Hw,pathRotation:Hw,rotateX:Hw,rotateY:Hw,rotateZ:Hw,scale:Rw,scaleX:Rw,scaleY:Rw,scaleZ:Rw,skew:Hw,skewX:Hw,skewY:Hw,distance:$w,translateX:$w,translateY:$w,translateZ:$w,x:$w,y:$w,z:$w,perspective:$w,transformPerspective:$w,opacity:Aw,originX:Gw,originY:Gw,originZ:$w},zIndex:Nk,fillOpacity:Aw,strokeOpacity:Aw,numOctaves:Nk},Mk={...Tk,color:Kw,backgroundColor:Kw,outlineColor:Kw,fill:Kw,stroke:Kw,borderColor:Kw,borderTopColor:Kw,borderRightColor:Kw,borderBottomColor:Kw,borderLeftColor:Kw,filter:kk,WebkitFilter:kk,mask:Ck,WebkitMask:Ck},Ek=e=>Mk[e],Ak=new Set([kk,Ck]);function Rk(e,t){let n=Ek(e);return Ak.has(n)||(n=nS),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Ik=new Set(["auto","none","0"]);var Dk=class extends yj{constructor(e,t,n,r,a){super(e,t,n,r,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let i=0;i<e.length;i++){let n=e[i];if("string"==typeof n&&(n=n.trim(),Nw(n))){const r=tk(n,t.current);void 0!==r&&(e[i]=r),i===e.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!sk.has(n)||2!==e.length)return;const[r,a]=e,s=yk(r),o=yk(a);if(Mw(r)!==Mw(a)&&hj[n])this.needsMeasurement=!0;else if(s!==o)if(cj(s)&&cj(o))for(let i=0;i<e.length;i++){const t=e[i];"string"==typeof t&&(e[i]=parseFloat(t))}else hj[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,n=[];for(let r=0;r<e.length;r++)(null===e[r]||bk(e[r]))&&n.push(r);n.length&&function(e,t,n){let r,a=0;for(;a<e.length&&!r;){const t=e[a];"string"==typeof t&&!Ik.has(t)&&Qw(t).values.length&&(r=e[a]),a++}if(r&&n)for(const s of t)e[s]=Rk(n,r)}(e,n,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=hj[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const r=t[t.length-1];void 0!==r&&e.getValue(n,r).jump(r,!1)}measureEndState(){const{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;const r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);const a=n.length-1,s=n[a];n[a]=hj[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==s&&void 0===this.finalKeyframe&&(this.finalKeyframe=s),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},_k=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function zk(e,t,n){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let r=document;t&&(r=t.current);const a=n?.[e]??r.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(e=>null!=e)}var Pk=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function Ok(e){return Fb(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}var{schedule:Lk,cancel:Fk}=fw(queueMicrotask,!1),Bk={x:!1,y:!1};function Hk(){return Bk.x||Bk.y}function Vk(e,t){const n=zk(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function $k(e,t,n={}){const[r,a,s]=Vk(e,n);return r.forEach(e=>{let n,r=!1,s=!1;const o=t=>{n&&(n(t),n=void 0),e.removeEventListener("pointerleave",l)},i=e=>{r=!1,window.removeEventListener("pointerup",i),window.removeEventListener("pointercancel",i),s&&(s=!1,o(e))},l=e=>{"touch"!==e.pointerType&&(r?s=!0:o(e))};e.addEventListener("pointerenter",r=>{if("touch"===r.pointerType||Hk())return;s=!1;const o=t(e,r);"function"==typeof o&&(n=o,e.addEventListener("pointerleave",l,a))},a),e.addEventListener("pointerdown",()=>{r=!0,window.addEventListener("pointerup",i,a),window.addEventListener("pointercancel",i,a)},a)}),s}var qk=(e,t)=>!!t&&(e===t||qk(e,t.parentElement)),Uk=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,Gk=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);var Wk=new Set(["INPUT","SELECT","TEXTAREA"]);var Kk=new WeakSet;function Yk(e){return t=>{"Enter"===t.key&&e(t)}}function Xk(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function Zk(e){return Uk(e)&&!Hk()}var Jk=new WeakSet;function Qk(e,t,n={}){const[r,a,s]=Vk(e,n),o=e=>{const r=e.currentTarget;if(!Zk(e))return;if(Jk.has(e))return;Kk.add(r),n.stopPropagation&&Jk.add(e);const s=t(r,e),o={...a,capture:!0},i=(e,t)=>{window.removeEventListener("pointerup",l,o),window.removeEventListener("pointercancel",c,o),Kk.has(r)&&Kk.delete(r),Zk(e)&&"function"==typeof s&&s(e,{success:t})},l=e=>{i(e,r===window||r===document||n.useGlobalTarget||qk(r,e.target))},c=e=>{i(e,!1)};window.addEventListener("pointerup",l,o),window.addEventListener("pointercancel",c,o)};return r.forEach(e=>{var t;(n.useGlobalTarget?window:e).addEventListener("pointerdown",o,a),Ok(e)&&(e.addEventListener("focus",e=>((e,t)=>{const n=e.currentTarget;if(!n)return;const r=Yk(()=>{if(Kk.has(n))return;Xk(n,"down");const e=Yk(()=>{Xk(n,"up")});n.addEventListener("keyup",e,t),n.addEventListener("blur",()=>Xk(n,"cancel"),t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)})(e,a)),t=e,Gk.has(t.tagName)||!0===t.isContentEditable||e.hasAttribute("tabindex")||(e.tabIndex=0))}),s}function eC(e){return Fb(e)&&"ownerSVGElement"in e}var tC,nC=new WeakMap,rC=(e,t,n)=>(r,a)=>a&&a[0]?a[0][e+"Size"]:eC(r)&&"getBBox"in r?r.getBBox()[t]:r[n],aC=rC("inline","width","offsetWidth"),sC=rC("block","height","offsetHeight");function oC({target:e,borderBoxSize:t}){nC.get(e)?.forEach(n=>{n(e,{get width(){return aC(e,t)},get height(){return sC(e,t)}})})}function iC(e){e.forEach(oC)}function lC(e,t){tC||"undefined"!=typeof ResizeObserver&&(tC=new ResizeObserver(iC));const n=zk(e);return n.forEach(e=>{let n=nC.get(e);n||(n=new Set,nC.set(e,n)),n.add(t),tC?.observe(e)}),()=>{n.forEach(e=>{const n=nC.get(e);n?.delete(t),n?.size||tC?.unobserve(e)})}}var cC,dC=new Set;function uC(e){return dC.add(e),cC||(cC=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};dC.forEach(t=>t(e))},window.addEventListener("resize",cC)),()=>{dC.delete(e),dC.size||"function"!=typeof cC||(window.removeEventListener("resize",cC),cC=void 0)}}function hC(e,t){return"function"==typeof e?uC(e):lC(e,t)}var mC={value:null,addProjectionMetrics:null};var pC=[...vk,Kw,nS],fC=()=>({x:{min:0,max:0},y:{min:0,max:0}}),gC=new WeakMap;function xC(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function vC(e){return"string"==typeof e||Array.isArray(e)}var yC=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],bC=["initial",...yC];function wC(e){return xC(e.animate)||bC.some(t=>vC(e[t]))}function SC(e){return Boolean(wC(e)||e.variants)}var jC={current:null},kC={current:!1},CC="undefined"!=typeof window;var NC=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],TC={};function MC(e){TC=e}var EC=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:a,blockInitialAnimation:s,visualState:o},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=yj,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const e=Sw.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,xw.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=a,this.options=i,this.blockInitialAnimation=Boolean(s),this.isControllingVariants=wC(t),this.isVariantNode=SC(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:d,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const h in u){const e=u[h];void 0!==l[h]&&ck(e)&&e.set(l[h])}}mount(e){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=e,gC.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(kC.current||function(){if(kC.current=!0,CC)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>jC.current=e.matches;e.addEventListener("change",t),t()}else jC.current=!1}(),this.shouldReduceMotion=jC.current),"production"!==process.env.NODE_ENV&&Xb(!0!==this.shouldReduceMotion,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),vw(this.notifyUpdate),vw(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Pj.has(e)&&this.current instanceof HTMLElement){const{factory:n,keyframes:r,times:a,ease:s,duration:o}=t.accelerate,i=new Aj({element:this.current,name:e,keyframes:r,times:a,ease:s,duration:Gb(o)}),l=n(i);return void this.valueSubscriptions.set(e,()=>{l(),i.cancel()})}const n=lj.has(e);n&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&xw.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),a&&a()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in TC){const t=TC[e];if(!t)continue;const{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let n=0;n<NC.length;n++){const t=NC[n];this.propEventSubscriptions[t]&&(this.propEventSubscriptions[t](),delete this.propEventSubscriptions[t]);const r=e["on"+t];r&&(this.propEventSubscriptions[t]=this.on(t,r))}this.prevMotionValues=function(e,t,n){for(const r in t){const a=t[r],s=n[r];if(ck(a))e.addValue(r,a);else if(ck(s))e.addValue(r,Uj(a,{owner:e}));else if(s!==a)if(e.hasValue(r)){const t=e.getValue(r);!0===t.liveStyle?t.jump(a):t.hasAnimated||t.set(a)}else{const t=e.getStaticValue(r);e.addValue(r,Uj(void 0!==t?t:a,{owner:e}))}}for(const r in n)void 0===t[r]&&e.removeValue(r);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=Uj(null===t?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];return null!=n&&("string"==typeof n&&(Lb(n)||Bb(n))?n=parseFloat(n):!(e=>pC.find(xk(e)))(n)&&nS.test(t)&&(n=Rk(e,t)),this.setBaseTarget(e,ck(n)?n.get():n)),ck(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){const{initial:t}=this.props;let n;if("string"==typeof t||"object"==typeof t){const r=rk(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&void 0!==n)return n;const r=this.getBaseTargetFromProps(this.props,e);return void 0===r||ck(r)?void 0!==this.initialValues[e]&&void 0===n?void 0:this.baseTarget[e]:r}on(e,t){return this.events[e]||(this.events[e]=new Ub),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Lk.render(this.render)}},AC=class extends EC{constructor(){super(...arguments),this.KeyframeResolver=Dk}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){const n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;ck(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}},RC=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function IC({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function DC(e){return void 0===e||1===e}function _C({scale:e,scaleX:t,scaleY:n}){return!DC(e)||!DC(t)||!DC(n)}function zC(e){return _C(e)||PC(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function PC(e){return OC(e.x)||OC(e.y)}function OC(e){return e&&"0%"!==e}function LC(e,t,n){return n+t*(e-n)}function FC(e,t,n,r,a){return void 0!==a&&(e=LC(e,a,r)),LC(e,n,r)+t}function BC(e,t=0,n=1,r,a){e.min=FC(e.min,t,n,r,a),e.max=FC(e.max,t,n,r,a)}function HC(e,{x:t,y:n}){BC(e.x,t.translate,t.scale,t.originPoint),BC(e.y,n.translate,n.scale,n.originPoint)}var VC=.999999999999,$C=1.0000000000001;function qC(e,t){e.min+=t,e.max+=t}function UC(e,t,n,r,a=.5){BC(e,t,n,sS(e.min,e.max,a),r)}function GC(e,t){return"string"==typeof e?parseFloat(e)/100*(t.max-t.min):e}function WC(e,t,n){const r=n??e;UC(e.x,GC(t.x,r.x),t.scaleX,t.scale,t.originX),UC(e.y,GC(t.y,r.y),t.scaleY,t.scale,t.originY)}function KC(e,t){return IC(function(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(e.getBoundingClientRect(),t))}var YC={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},XC=ij.length;function ZC(e,t,n){const{style:r,vars:a,transformOrigin:s}=e;let o=!1,i=!1;for(const l in t){const e=t[l];if(lj.has(l))o=!0;else if(kw(l))a[l]=e;else{const t=Pk(e,Tk[l]);l.startsWith("origin")?(i=!0,s[l]=t):r[l]=t}}if(t.transform||(o||n?r.transform=function(e,t,n){let r="",a=!0;for(let o=0;o<XC;o++){const s=ij[o],i=e[s];if(void 0===i)continue;let l=!0;if("number"==typeof i)l=i===(s.startsWith("scale")?1:0);else{const e=parseFloat(i);l=s.startsWith("scale")?1===e:0===e}if(!l||n){const e=Pk(i,Tk[s]);l||(a=!1,r+=`${YC[s]||s}(${e}) `),n&&(t[s]=e)}}const s=e.pathRotation;return s&&(a=!1,r+=`rotate(${Pk(s,Tk.pathRotation)}) `),r=r.trim(),n?r=n(t,a?"":r):a&&(r="none"),r}(t,e.transform,n):r.transform&&(r.transform="none")),i){const{originX:e="50%",originY:t="50%",originZ:n=0}=s;r.transformOrigin=`${e} ${t} ${n}`}}function JC(e,{style:t,vars:n},r,a){const s=e.style;let o;for(o in t)s[o]=t[o];for(o in a?.applyProjectionStyles(s,r),n)s.setProperty(o,n[o])}function QC(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var eN={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!$w.test(e))return e;e=parseFloat(e)}return`${QC(e,t.target.x)}% ${QC(e,t.target.y)}%`}},tN={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,a=nS.parse(e);if(a.length>5)return r;const s=nS.createTransformer(e),o="number"!=typeof a[0]?1:0,i=n.x.scale*t.x,l=n.y.scale*t.y;a[0+o]/=i,a[1+o]/=l;const c=sS(i,l,.5);return"number"==typeof a[2+o]&&(a[2+o]/=c),"number"==typeof a[3+o]&&(a[3+o]/=c),s(a)}},nN={borderRadius:{...eN,applyTo:[..._k]},borderTopLeftRadius:eN,borderTopRightRadius:eN,borderBottomLeftRadius:eN,borderBottomRightRadius:eN,boxShadow:tN};function rN(e,{layout:t,layoutId:n}){return lj.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!nN[e]||"opacity"===e)}function aN(e,t,n){const r=e.style,a=t?.style,s={};if(!r)return s;for(const o in r)(ck(r[o])||a&&ck(a[o])||rN(o,e)||void 0!==n?.getValue(o)?.liveStyle)&&(s[o]=r[o]);return s}var sN=class extends AC{constructor(){super(...arguments),this.type="html",this.renderInstance=JC}mount(e){Pb(Boolean(e.style),"motion.create() components must forward their ref to a HTML or SVG element","custom-component-ref"),super.mount(e)}readValueFromInstance(e,t){if(lj.has(t))return this.projection?.isProjecting?aj(t):((e,t)=>{const{transform:n="none"}=getComputedStyle(e);return sj(n,t)})(e,t);{const r=(n=e,window.getComputedStyle(n)),a=(kw(t)?r.getPropertyValue(t):r[t])||0;return"string"==typeof a?a.trim():a}var n}measureInstanceViewportBox(e,{transformPagePoint:t}){return KC(e,t)}build(e,t,n){ZC(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return aN(e,t,n)}},oN={offset:"stroke-dashoffset",array:"stroke-dasharray"},iN={offset:"strokeDashoffset",array:"strokeDasharray"};var lN=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function cN(e,{attrX:t,attrY:n,attrScale:r,pathLength:a,pathSpacing:s=1,pathOffset:o=0,...i},l,c,d){if(ZC(e,i,c),l)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:u,style:h}=e;u.transform&&(h.transform=u.transform,delete u.transform),(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.transformBox=d?.transformBox??"fill-box",delete u.transformBox);for(const m of lN)void 0!==u[m]&&(h[m]=u[m],delete u[m]);void 0!==t&&(u.x=t),void 0!==n&&(u.y=n),void 0!==r&&(u.scale=r),void 0!==a&&function(e,t,n=1,r=0,a=!0){e.pathLength=1;const s=a?oN:iN;e[s.offset]=""+-r,e[s.array]=`${t} ${n}`}(u,a,s,o,!1)}var dN=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),uN=e=>"string"==typeof e&&"svg"===e.toLowerCase();function hN(e,t,n){const r=aN(e,t,n);for(const a in e)if(ck(e[a])||ck(t[a])){r[-1!==ij.indexOf(a)?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a]=e[a]}return r}var mN=class extends AC{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=fC}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(lj.has(t)){const e=Ek(t);return e&&e.default||0}return t=dN.has(t)?t:uk(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return hN(e,t,n)}build(e,t,n){cN(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){!function(e,t,n,r){JC(e,t,void 0,r);for(const a in t.attrs)e.setAttribute(dN.has(a)?a:uk(a),t.attrs[a])}(e,t,0,r)}mount(e){this.isSVGTag=uN(e.tagName),super.mount(e)}},pN=bC.length;function fN(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&fN(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let n=0;n<pN;n++){const r=bC[n],a=e.props[r];(vC(a)||!1===a)&&(t[r]=a)}return t}function gN(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var xN=[...yC].reverse(),vN=yC.length;function yN(e){return t=>Promise.all(t.map(({animation:t,options:n})=>function(e,t,n={}){let r;if(e.notify("AnimationStart",t),Array.isArray(t)){const a=t.map(t=>gk(e,t,n));r=Promise.all(a)}else if("string"==typeof t)r=gk(e,t,n);else{const a="function"==typeof t?ak(e,t,n.custom):t;r=Promise.all(fk(e,a,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}(e,t,n)))}function bN(e){let t=yN(e),n=jN(),r=!0,a=!1;const s=t=>(n,r)=>{const a=ak(e,r,"exit"===t?e.presenceContext?.custom:void 0);if(a){const{transition:e,transitionEnd:t,...r}=a;n={...n,...r,...t}}return n};function o(o){const{props:i}=e,l=fN(e.parent)||{},c=[],d=new Set;let u={},h=1/0;for(let t=0;t<vN;t++){const m=xN[t],p=n[m],f=void 0!==i[m]?i[m]:l[m],g=vC(f),x=m===o?p.isActive:null;!1===x&&(h=t);let v=f===l[m]&&f!==i[m]&&g;if(v&&(r||a)&&e.manuallyAnimateOnMount&&(v=!1),p.protectedKeys={...u},!p.isActive&&null===x||!f&&!p.prevProp||xC(f)||"boolean"==typeof f)continue;if("exit"===m&&p.isActive&&!0!==x){p.prevResolvedValues&&(u={...u,...p.prevResolvedValues});continue}const y=wN(p.prevProp,f);let b=y||m===o&&p.isActive&&!v&&g||t>h&&g,w=!1;const S=Array.isArray(f)?f:[f];let j=S.reduce(s(m),{});!1===x&&(j={});const{prevResolvedValues:k={}}=p,C={...k,...j},N=t=>{b=!0,d.has(t)&&(w=!0,d.delete(t)),p.needsAnimating[t]=!0;const n=e.getValue(t);n&&(n.liveStyle=!1)};for(const e in C){const t=j[e],n=k[e];if(u.hasOwnProperty(e))continue;let r=!1;r=ok(t)&&ok(n)?!gN(t,n)||y:t!==n,r?null!=t?N(e):d.add(e):void 0!==t&&d.has(e)?N(e):p.protectedKeys[e]=!0}p.prevProp=f,p.prevResolvedValues=j,p.isActive&&(u={...u,...j}),(r||a)&&e.blockInitialAnimation&&(b=!1);const T=v&&y;!b||T&&!w||c.push(...S.map(t=>{const n={type:m};if("string"==typeof t&&(r||a)&&!T&&e.manuallyAnimateOnMount&&e.parent){const{parent:r}=e,a=ak(r,t);if(r.enteringChildren&&a){const{delayChildren:t}=a.transition||{};n.delay=Vj(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(d.size){const t={};if("boolean"!=typeof i.initial){const n=ak(e,Array.isArray(i.initial)?i.initial[0]:i.initial);n&&n.transition&&(t.transition=n.transition)}d.forEach(n=>{const r=e.getBaseTarget(n),a=e.getValue(n);a&&(a.liveStyle=!0),t[n]=r??null}),c.push({animation:t})}let m=Boolean(c.length);return!r||!1!==i.initial&&i.initial!==i.animate||e.manuallyAnimateOnMount||(m=!1),r=!1,a=!1,m?t(c):Promise.resolve()}return{animateChanges:o,setActive:function(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;const a=o(t);for(const e in n)n[e].protectedKeys={};return a},setAnimateFunction:function(n){t=n(e)},getState:()=>n,reset:()=>{n=jN(),a=!0}}}function wN(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!gN(t,e)}function SN(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function jN(){return{animate:SN(!0),whileInView:SN(),whileHover:SN(),whileTap:SN(),whileDrag:SN(),whileFocus:SN(),exit:SN()}}function kN(e,t){e.min=t.min,e.max=t.max}function CN(e,t){kN(e.x,t.x),kN(e.y,t.y)}function NN(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function TN(e){return e.max-e.min}function MN(e,t,n,r=.5){e.origin=r,e.originPoint=sS(t.min,t.max,e.origin),e.scale=TN(n)/TN(t),e.translate=sS(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function EN(e,t,n,r){MN(e.x,t.x,n.x,r?r.originX:void 0),MN(e.y,t.y,n.y,r?r.originY:void 0)}function AN(e,t,n,r=0){e.min=(r?sS(n.min,n.max,r):n.min)+t.min,e.max=e.min+TN(t)}function RN(e,t,n,r=0){const a=r?sS(n.min,n.max,r):n.min;e.min=t.min-a,e.max=e.min+TN(t)}function IN(e,t,n,r){RN(e.x,t.x,n.x,r?.x),RN(e.y,t.y,n.y,r?.y)}function DN(e,t,n,r,a){return e=LC(e-=t,1/n,r),void 0!==a&&(e=LC(e,1/a,r)),e}function _N(e,t,[n,r,a],s,o){!function(e,t=0,n=1,r=.5,a,s=e,o=e){if(Vw.test(t)&&(t=parseFloat(t),t=sS(o.min,o.max,t/100)-o.min),"number"!=typeof t)return;let i=sS(s.min,s.max,r);e===s&&(i-=t),e.min=DN(e.min,t,n,i,a),e.max=DN(e.max,t,n,i,a)}(e,t[n],t[r],t[a],t.scale,s,o)}var zN=["x","scaleX","originX"],PN=["y","scaleY","originY"];function ON(e,t,n,r){_N(e.x,t,zN,n?n.x:void 0,r?r.x:void 0),_N(e.y,t,PN,n?n.y:void 0,r?r.y:void 0)}function LN(e){return 0===e.translate&&1===e.scale}function FN(e){return LN(e.x)&&LN(e.y)}function BN(e,t){return e.min===t.min&&e.max===t.max}function HN(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function VN(e,t){return HN(e.x,t.x)&&HN(e.y,t.y)}function $N(e){return TN(e.x)/TN(e.y)}function qN(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function UN(e){return[e("x"),e("y")]}var GN=_k.length,WN=e=>"string"==typeof e?parseFloat(e):e,KN=e=>"number"==typeof e||$w.test(e);function YN(e,t){return void 0!==e[t]?e[t]:e.borderRadius}var XN=JN(0,.5,ow),ZN=JN(.5,.95,Vb);function JN(e,t,n){return r=>r<e?0:r>t?1:n(qb(e,t,r))}function QN(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var eT=(e,t)=>e.depth-t.depth,tT=class{constructor(){this.children=[],this.isDirty=!1}add(e){Ib(this.children,e),this.isDirty=!0}remove(e){Db(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(eT),this.isDirty=!1,this.children.forEach(e)}};function nT(e){return ck(e)?e.get():e}var rT=class{constructor(){this.members=[]}add(e){Ib(this.members,e);for(let t=this.members.length-1;t>=0;t--){const n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;const r=n.instance;r&&!1!==r.isConnected||n.snapshot||(Db(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Db(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent&&!1!==e.instance?.isConnected)return this.promote(e),!0}return!1}promote(e,t){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();const{layoutDependency:r}=n.options,{layoutDependency:a}=e.options;void 0!==r&&r===a||(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),!1===e.options.crossfade&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},aT={hasAnimatedSinceResize:!0,hasEverUpdated:!1},sT={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},oT=["","X","Y","Z"],iT=0;function lT(e,t,n,r){const{latestValues:a}=t;a[e]&&(n[e]=a[e],t.setStaticValue(e,0),r&&(r[e]=0))}function cT(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=mk(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",xw,!(t||r))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&cT(r)}function dT({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:a}){return class{constructor(e={},n=t?.()){this.id=iT++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,mC.value&&(sT.nodes=sT.calculatedTargetDeltas=sT.calculatedProjections=0),this.nodes.forEach(mT),this.nodes.forEach(ST),this.nodes.forEach(jT),this.nodes.forEach(pT),mC.addProjectionMetrics&&mC.addProjectionMetrics(sT)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new tT)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Ub),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){const n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;var n;this.isSVG=eC(t)&&!(eC(n=t)&&"svg"===n.tagName),this.instance=t;const{layoutId:r,layout:a,visualElement:s}=this.options;if(s&&!s.current&&s.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(a||r)&&(this.isLayoutDirty=!0),e){let n,r=0;const a=()=>this.root.updateBlockedByResize=!1;xw.read(()=>{r=window.innerWidth}),e(t,()=>{const e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=function(e,t){const n=Sw.now(),r=({timestamp:a})=>{const s=a-n;s>=t&&(vw(r),e(s-t))};return xw.setup(r,!0),()=>vw(r)}(a,250),aT.hasAnimatedSinceResize&&(aT.hasAnimatedSinceResize=!1,this.nodes.forEach(wT)))})}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&s&&(r||a)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const a=this.options.transition||s.getDefaultTransition()||ET,{onLayoutAnimationStart:o,onLayoutAnimationComplete:i}=s.getProps(),l=!this.targetLayout||!VN(this.targetLayout,r),c=!t&&n;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...Wj(a,"layout"),onPlay:o,onComplete:i};(s.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c,t.path)}else t||wT(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),vw(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(kT),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&cT(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let a=0;a<this.path.length;a++){const e=this.path[a];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:t,layout:n}=this.options;if(void 0===t&&!n)return;const r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const e=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(xT),void this.nodes.forEach(gT)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(vT);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(yT),this.nodes.forEach(bT),this.nodes.forEach(uT),this.nodes.forEach(hT)):this.nodes.forEach(vT),this.clearAllSnapshots();const e=Sw.now();yw.delta=_b(0,1e3/60,e-yw.timestamp),yw.timestamp=e,yw.isProcessing=!0,bw.update.process(yw),bw.preRender.process(yw),bw.render.process(yw),yw.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Lk.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(fT),this.sharedNodes.forEach(CT)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,xw.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){xw.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||TN(this.snapshot.measuredBox.x)||TN(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let n=0;n<this.path.length;n++)this.path[n].updateScroll();const e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}}),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){const t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!a)return;const e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!FN(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,s=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||zC(this.latestValues)||s)&&(a(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){const t=this.measurePageBox();let n=this.removeElementScroll(t);var r;return e&&(n=this.removeTransform(n)),IT((r=n).x),IT(r.y),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:e}=this.options;if(!e)return{x:{min:0,max:0},y:{min:0,max:0}};const t=e.measureViewportBox();if(!this.scroll?.wasRoot&&!this.path.some(_T)){const{scroll:e}=this.root;e&&(qC(t.x,e.offset.x),qC(t.y,e.offset.y))}return t}removeElementScroll(e){const t={x:{min:0,max:0},y:{min:0,max:0}};if(CN(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){const r=this.path[n],{scroll:a,options:s}=r;r!==this.root&&a&&s.layoutScroll&&(a.wasRoot&&CN(t,e),qC(t.x,a.offset.x),qC(t.y,a.offset.y))}return t}applyTransform(e,t=!1,n){const r=n||{x:{min:0,max:0},y:{min:0,max:0}};CN(r,e);for(let a=0;a<this.path.length;a++){const e=this.path[a];!t&&e.options.layoutScroll&&e.scroll&&e!==e.root&&(qC(r.x,-e.scroll.offset.x),qC(r.y,-e.scroll.offset.y)),zC(e.latestValues)&&WC(r,e.latestValues,e.layout?.layoutBox)}return zC(this.latestValues)&&WC(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){const t={x:{min:0,max:0},y:{min:0,max:0}};CN(t,e);for(let n=0;n<this.path.length;n++){const e=this.path[n];if(!zC(e.latestValues))continue;let r;e.instance&&(_C(e.latestValues)&&e.updateSnapshot(),r=fC(),CN(r,e.measurePageBox())),ON(t,e.latestValues,e.snapshot?.layoutBox,r)}return zC(this.latestValues)&&ON(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==yw.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){const t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);const n=Boolean(this.resumingFrom)||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:r,layoutId:a}=this.options;if(!this.layout||!r&&!a)return;this.resolvedRelativeTargetAt=yw.timestamp;const s=this.getClosestProjectingParent();s&&this.linkedParentVersion!==s.layoutVersion&&!s.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&s&&s.layout?this.createRelativeTarget(s,this.layout.layoutBox,s.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),function(e,t,n,r){AN(e.x,t.x,n.x,r?.x),AN(e.y,t.y,n.y,r?.y)}(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):CN(this.target,this.layout.layoutBox),HC(this.target,this.targetDelta)):CN(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&s&&Boolean(s.resumingFrom)===Boolean(this.resumingFrom)&&!s.options.layoutScroll&&s.target&&1!==this.animationProgress?this.createRelativeTarget(s,this.target,s.target):this.relativeParent=this.relativeTarget=void 0),mC.value&&sT.calculatedTargetDeltas++)}getClosestProjectingParent(){if(this.parent&&!_C(this.parent.latestValues)&&!PC(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},IN(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),CN(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const e=this.getLead(),t=Boolean(this.resumingFrom)||this!==e;let n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===yw.timestamp&&(n=!1),n)return;const{layout:r,layoutId:a}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!r&&!a)return;CN(this.layoutCorrected,this.layout.layoutBox);const s=this.treeScale.x,o=this.treeScale.y;!function(e,t,n,r=!1){const a=n.length;if(!a)return;let s,o;t.x=t.y=1;for(let i=0;i<a;i++){s=n[i],o=s.projectionDelta;const{visualElement:a}=s.options;a&&a.props.style&&"contents"===a.props.style.display||(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(qC(e.x,-s.scroll.offset.x),qC(e.y,-s.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,HC(e,o)),r&&zC(s.latestValues)&&WC(e,s.latestValues,s.layout?.layoutBox))}t.x<$C&&t.x>VC&&(t.x=1),t.y<$C&&t.y>VC&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,t),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:i}=e;i?(this.projectionDelta&&this.prevProjectionDelta?(NN(this.prevProjectionDelta.x,this.projectionDelta.x),NN(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),EN(this.projectionDelta,this.layoutCorrected,i,this.latestValues),this.treeScale.x===s&&this.treeScale.y===o&&qN(this.projectionDelta.x,this.prevProjectionDelta.x)&&qN(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",i)),mC.value&&sT.calculatedProjections++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,t=!1,n){const r=this.snapshot,a=r?r.latestValues:{},s={...this.latestValues},o={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const i={x:{min:0,max:0},y:{min:0,max:0}},l=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),d=!c||c.members.length<=1,u=Boolean(l&&!d&&!0===this.options.crossfade&&!this.path.some(MT));let h;this.animationProgress=0;const m=n?.interpolateProjection(e);this.mixTargetDelta=t=>{const n=t/1e3,r=m?.(n);var c,p;r?(o.x.translate=r.x,o.x.scale=sS(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=sS(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(NT(o.x,e.x,n),NT(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(IN(i,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),function(e,t,n,r){TT(e.x,t.x,n.x,r),TT(e.y,t.y,n.y,r)}(this.relativeTarget,this.relativeTargetOrigin,i,n),h&&(c=this.relativeTarget,p=h,BN(c.x,p.x)&&BN(c.y,p.y))&&(this.isProjectionDirty=!1),h||(h={x:{min:0,max:0},y:{min:0,max:0}}),CN(h,this.relativeTarget)),l&&(this.animationValues=s,function(e,t,n,r,a,s){a?(e.opacity=sS(0,n.opacity??1,XN(r)),e.opacityExit=sS(t.opacity??1,0,ZN(r))):s&&(e.opacity=sS(t.opacity??1,n.opacity??1,r));for(let o=0;o<GN;o++){const a=_k[o];let s=YN(t,a),i=YN(n,a);void 0===s&&void 0===i||(s||(s=0),i||(i=0),0===s||0===i||KN(s)===KN(i)?(e[a]=Math.max(sS(WN(s),WN(i),r),0),(Vw.test(i)||Vw.test(s))&&(e[a]+="%")):e[a]=i)}(t.rotate||n.rotate)&&(e.rotate=sS(t.rotate||0,n.rotate||0,r))}(s,a,this.latestValues,n,u,d)),r&&void 0!==r.rotate&&(this.animationValues||(this.animationValues=s),this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(vw(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=xw.update(()=>{aT.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Uj(0)),this.motionValue.jump(0,!1),this.currentAnimation=function(e,t,n){const r=ck(e)?e:Uj(e);return r.start(Qj("",r,t,n)),r.animation}(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:n,layout:r,latestValues:a}=e;if(t&&n&&r){if(this!==e&&this.layout&&r&&DT(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=TN(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;const r=TN(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}CN(t,n),WC(t,a),EN(this.projectionDeltaWithTransform,this.layoutCorrected,t,a)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new rT),this.sharedNodes.get(e).add(t);const n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){const{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){const r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;const r={};n.z&&lT("z",e,r,this.animationValues);for(let a=0;a<oT.length;a++)lT(`rotate${oT[a]}`,e,r,this.animationValues),lT(`skew${oT[a]}`,e,r,this.animationValues);e.render();for(const a in r)e.setStaticValue(a,r[a]),this.animationValues&&(this.animationValues[a]=r[a]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(e.visibility="hidden");const n=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=nT(t?.pointerEvents)||"",void(e.transform=n?n(this.latestValues,""):"none");const r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target)return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=nT(t?.pointerEvents)||""),void(this.hasProjected&&!zC(this.latestValues)&&(e.transform=n?n({},""):"none",this.hasProjected=!1));e.visibility="";const a=r.animationValues||r.latestValues;this.applyTransformsToTarget();let s=function(e,t,n){let r="";const a=e.x.translate/t.x,s=e.y.translate/t.y,o=n?.z||0;if((a||s||o)&&(r=`translate3d(${a}px, ${s}px, ${o}px) `),1===t.x&&1===t.y||(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:e,rotate:t,pathRotation:a,rotateX:s,rotateY:o,skewX:i,skewY:l}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),a&&(r+=`rotate(${a}deg) `),s&&(r+=`rotateX(${s}deg) `),o&&(r+=`rotateY(${o}deg) `),i&&(r+=`skewX(${i}deg) `),l&&(r+=`skewY(${l}deg) `)}const i=e.x.scale*t.x,l=e.y.scale*t.y;return 1===i&&1===l||(r+=`scale(${i}, ${l})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,a);n&&(s=n(a,s)),e.transform=s;const{x:o,y:i}=this.projectionDelta;e.transformOrigin=`${100*o.origin}% ${100*i.origin}% 0`,r.animationValues?e.opacity=r===this?a.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:e.opacity=r===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0;for(const l in nN){if(void 0===a[l])continue;const{correct:t,applyTo:n,isCSSVariable:o}=nN[l],i="none"===s?a[l]:t(a[l],r);if(n){const t=n.length;for(let r=0;r<t;r++)e[n[r]]=i}else o?this.options.visualElement.renderState.vars[l]=i:e[l]=i}this.options.layoutId&&(e.pointerEvents=r===this?nT(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(gT),this.root.sharedNodes.clear()}}}function uT(e){e.updateLayout()}function hT(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=e.layout,{animationType:a}=e.options,s=t.source!==e.layout.source;if("size"===a)UN(e=>{const r=s?t.measuredBox[e]:t.layoutBox[e],a=TN(r);r.min=n[e].min,r.max=r.min+a});else if("x"===a||"y"===a){const e="x"===a?"y":"x";kN(s?t.measuredBox[e]:t.layoutBox[e],n[e])}else DT(a,t.layoutBox,n)&&UN(r=>{const a=s?t.measuredBox[r]:t.layoutBox[r],o=TN(n[r]);a.max=a.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});const o={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};EN(o,n,t.layoutBox);const i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};s?EN(i,e.applyTransform(r,!0),t.measuredBox):EN(i,n,t.layoutBox);const l=!FN(o);let c=!1;if(!e.resumeFrom){const r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:a,layout:s}=r;if(a&&s){const o=e.options.layoutAnchor||void 0,i={x:{min:0,max:0},y:{min:0,max:0}};IN(i,t.layoutBox,a.layoutBox,o);const l={x:{min:0,max:0},y:{min:0,max:0}};IN(l,n,s.layoutBox,o),VN(i,l)||(c=!0),r.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=i,e.relativeParent=r)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:i,layoutDelta:o,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function mT(e){mC.value&&sT.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function pT(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function fT(e){e.clearSnapshot()}function gT(e){e.clearMeasurements()}function xT(e){e.isLayoutDirty=!0,e.updateLayout()}function vT(e){e.isLayoutDirty=!1}function yT(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function bT(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function wT(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function ST(e){e.resolveTargetDelta()}function jT(e){e.calcProjection()}function kT(e){e.resetSkewAndRotation()}function CT(e){e.removeLeadSnapshot()}function NT(e,t,n){e.translate=sS(t.translate,0,n),e.scale=sS(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function TT(e,t,n,r){e.min=sS(t.min,n.min,r),e.max=sS(t.max,n.max,r)}function MT(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}var ET={duration:.45,ease:[.4,0,.1,1]},AT=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),RT=AT("applewebkit/")&&!AT("chrome/")?Math.round:Vb;function IT(e){e.min=RT(e.min),e.max=RT(e.max)}function DT(e,t,n){return"position"===e||"preserve-aspect"===e&&!function(e,t,n){return Math.abs(e-t)<=n}($N(t),$N(n),.2)}function _T(e){return e!==e.root&&e.scroll?.wasRoot}var zT=dT({attachResizeListener:(e,t)=>QN(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),PT={current:void 0},OT=dT({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!PT.current){const e=new zT({});e.mount(window),e.setOptions({layoutScroll:!0}),PT.current=e}return PT.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),LT=(0,u.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function FT(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function BT(...e){return u.useCallback(function(...e){return t=>{let n=!1;const r=e.map(e=>{const r=FT(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():FT(e[t],null)}}}}(...e),e)}var HT=class extends u.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(Ok(t)&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){const e=t.offsetParent,n=Ok(e)&&e.offsetWidth||0,r=Ok(e)&&e.offsetHeight||0,a=getComputedStyle(t),s=this.props.sizeRef.current;s.height=parseFloat(a.height),s.width=parseFloat(a.width),s.top=t.offsetTop,s.left=t.offsetLeft,s.right=n-s.width-s.left,s.bottom=r-s.height-s.top,s.direction=a.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function VT({children:e,isPresent:t,anchorX:n,anchorY:r,root:a,pop:s}){const o=(0,u.useId)(),i=(0,u.useRef)(null),l=(0,u.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:c}=(0,u.useContext)(LT),d=!1!==s?e.props?.ref??e?.ref:void 0,h=BT(i,d);return(0,u.useInsertionEffect)(()=>{const{width:e,height:d,top:u,left:h,right:m,bottom:p,direction:f}=l.current;if(t||!1===s||!i.current||!e||!d)return;const g="rtl"===f,x="left"===n?g?`right: ${m}`:`left: ${h}`:g?`left: ${h}`:`right: ${m}`,v="bottom"===r?`bottom: ${p}`:`top: ${u}`;i.current.dataset.motionPopId=o;const y=document.createElement("style");c&&(y.nonce=c);const b=a??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`\n [data-motion-pop-id="${o}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${d}px !important;\n ${x}px !important;\n ${v}px !important;\n }\n `),()=>{i.current?.removeAttribute("data-motion-pop-id"),b.contains(y)&&b.removeChild(y)}},[t]),(0,p.jsx)(HT,{isPresent:t,childRef:i,sizeRef:l,pop:s,children:!1===s?e:u.cloneElement(e,{ref:h})})}var $T=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:a,presenceAffectsLayout:s,mode:o,anchorX:i,anchorY:l,root:c})=>{const d=Eb(qT),h=(0,u.useId)(),m=(0,u.useRef)(n),f=(0,u.useRef)(r);Ab(()=>{m.current=n,f.current=r});let g=!0,x=(0,u.useMemo)(()=>(g=!1,{id:h,initial:t,isPresent:n,custom:a,onExitComplete:e=>{d.set(e,!0);for(const t of d.values())if(!t)return;r&&r()},register:e=>(d.set(e,!1),()=>{d.delete(e),!m.current&&!d.size&&f.current?.()})}),[n,d,r]);return s&&g&&(x={...x}),(0,u.useMemo)(()=>{d.forEach((e,t)=>d.set(t,!1))},[n]),u.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),e=(0,p.jsx)(VT,{pop:"popLayout"===o,isPresent:n,anchorX:i,anchorY:l,root:c,children:e}),(0,p.jsx)(Rb.Provider,{value:x,children:e})};function qT(){return new Map}function UT(e=!0){const t=(0,u.useContext)(Rb);if(null===t)return[!0,null];const{isPresent:n,onExitComplete:r,register:a}=t,s=(0,u.useId)();(0,u.useEffect)(()=>{if(e)return a(s)},[e]);const o=(0,u.useCallback)(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,o]:[!0]}var GT=e=>e.key||"";function WT(e){const t=[];return u.Children.forEach(e,e=>{(0,u.isValidElement)(e)&&t.push(e)}),t}var KT=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:a=!0,mode:s="sync",propagate:o=!1,anchorX:i="left",anchorY:l="top",root:c})=>{const[d,h]=UT(o),m=(0,u.useMemo)(()=>WT(e),[e]),f=o&&!d?[]:m.map(GT),g=(0,u.useRef)(!0),x=(0,u.useRef)(m),v=Eb(()=>new Map),y=(0,u.useRef)(new Set),[b,w]=(0,u.useState)(m),[S,j]=(0,u.useState)(m);Ab(()=>{g.current=!1,x.current=m;for(let e=0;e<S.length;e++){const t=GT(S[e]);f.includes(t)?(v.delete(t),y.current.delete(t)):!0!==v.get(t)&&v.set(t,!1)}},[S,f.length,f.join("-")]);const k=[];if(m!==b){let e=[...m];for(let t=0;t<S.length;t++){const n=S[t],r=GT(n);f.includes(r)||(e.splice(t,0,n),k.push(n))}return"wait"===s&&k.length&&(e=k),j(WT(e)),w(m),null}"production"!==process.env.NODE_ENV&&"wait"===s&&S.length;const{forceRender:C}=(0,u.useContext)(Mb);return(0,p.jsx)(p.Fragment,{children:S.map(e=>{const u=GT(e),b=!(o&&!d)&&(m===S||f.includes(u));return(0,p.jsx)($T,{isPresent:b,initial:!(g.current&&!n)&&void 0,custom:t,presenceAffectsLayout:a,mode:s,root:c,onExitComplete:b?void 0:()=>{if(y.current.has(u))return;if(!v.has(u))return;y.current.add(u),v.set(u,!0);let e=!0;v.forEach(t=>{t||(e=!1)}),e&&(C?.(),j(x.current),o&&h?.(),r&&r())},anchorX:i,anchorY:l,children:e},u)})})},YT=(0,u.createContext)({strict:!1}),XT={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ZT=!1;function JT(){return function(){if(ZT)return;const e={};for(const t in XT)e[t]={isEnabled:e=>XT[t].some(t=>!!e[t])};MC(e),ZT=!0}(),TC}var QT=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function eM(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||QT.has(e)}var tM,nM,rM=e.__exportAll({default:()=>tM}),aM=e.__esmMin(()=>{throw tM={},new Error('Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?')}),sM=e=>!eM(e);try{"function"==typeof(nM=(aM(),e.__toCommonJS(rM)).default)&&(sM=e=>e.startsWith("on")?!eM(e):nM(e))}catch{}var oM=(0,u.createContext)({});function iM(e){const{initial:t,animate:n}=function(e,t){if(wC(e)){const{initial:t,animate:n}=e;return{initial:!1===t||vC(t)?t:void 0,animate:vC(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,(0,u.useContext)(oM));return(0,u.useMemo)(()=>({initial:t,animate:n}),[lM(t),lM(n)])}function lM(e){return Array.isArray(e)?e.join(" "):e}var cM=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function dM(e,t,n){for(const r in t)ck(t[r])||rN(r,n)||(e[r]=t[r])}function uM(e,t){const n={};return dM(n,e.style||{},e),Object.assign(n,function({transformTemplate:e},t){return(0,u.useMemo)(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return ZC(n,t,e),Object.assign({},n.vars,n.style)},[t])}(e,t)),n}function hM(e,t){const n={},r=uM(e,t);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var mM=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function pM(e,t,n,r){const a=(0,u.useMemo)(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return cN(n,t,uN(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){const t={};dM(t,e.style,e),a.style={...t,...a.style}}return a}var fM=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gM(e){return"string"==typeof e&&!e.includes("-")&&!!(fM.indexOf(e)>-1||/[A-Z]/u.test(e))}function xM(e,t,n,{latestValues:r},a,s=!1,o){const i=(o??gM(e)?pM:hM)(t,r,a,e),l=function(e,t,n){const r={};for(const a in e)"values"===a&&"object"==typeof e.values||ck(e[a])||(sM(a)||!0===n&&eM(a)||!t&&!eM(a)||e.draggable&&a.startsWith("onDrag"))&&(r[a]=e[a]);return r}(t,"string"==typeof e,s),c=e!==u.Fragment?{...l,...i,ref:n}:{},{children:d}=t,h=(0,u.useMemo)(()=>ck(d)?d.get():d,[d]);return(0,u.createElement)(e,{...c,children:h})}function vM(e,t,n,r){const a={},s=r(e,{});for(const h in s)a[h]=nT(s[h]);let{initial:o,animate:i}=e;const l=wC(e),c=SC(e);t&&c&&!l&&!1!==e.inherit&&(void 0===o&&(o=t.initial),void 0===i&&(i=t.animate));let d=!!n&&!1===n.initial;d=d||!1===o;const u=d?i:o;if(u&&"boolean"!=typeof u&&!xC(u)){const t=Array.isArray(u)?u:[u];for(let n=0;n<t.length;n++){const r=rk(e,t[n]);if(r){const{transitionEnd:e,transition:t,...n}=r;for(const r in n){let e=n[r];if(Array.isArray(e)){e=e[d?e.length-1:0]}null!==e&&(a[r]=e)}for(const r in e)a[r]=e[r]}}}return a}var yM=e=>(t,n)=>{const r=(0,u.useContext)(oM),a=(0,u.useContext)(Rb),s=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,a){return{latestValues:vM(n,r,a,e),renderState:t()}}(e,t,r,a);return n?s():Eb(s)},bM=yM({scrapeMotionValuesFromProps:aN,createRenderState:cM}),wM=yM({scrapeMotionValuesFromProps:hN,createRenderState:mM}),SM=Symbol.for("motionComponentSymbol");function jM(e,t,n){const r=(0,u.useRef)(n);(0,u.useInsertionEffect)(()=>{r.current=n});const a=(0,u.useRef)(null);return(0,u.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());const s=r.current;if("function"==typeof s)if(n){const e=s(n);"function"==typeof e&&(a.current=e)}else a.current?(a.current(),a.current=null):s(n);else s&&(s.current=n)},[t])}var kM=(0,u.createContext)({});function CM(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function NM(e,t,n,r,a,s){const{visualElement:o}=(0,u.useContext)(oM),i=(0,u.useContext)(YT),l=(0,u.useContext)(Rb),c=(0,u.useContext)(LT),d=c.reducedMotion,h=c.skipAnimations,m=(0,u.useRef)(null),p=(0,u.useRef)(!1);r=r||i.renderer,!m.current&&r&&(m.current=r(e,{visualState:t,parent:o,props:n,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:d,skipAnimations:h,isSVG:s}),p.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));const f=m.current,g=(0,u.useContext)(kM);!f||f.projection||!a||"html"!==f.type&&"svg"!==f.type||function(e,t,n,r){const{layoutId:a,layout:s,drag:o,dragConstraints:i,layoutScroll:l,layoutRoot:c,layoutAnchor:d,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:TM(e.parent)),e.projection.setOptions({layoutId:a,layout:s,alwaysMeasureLayout:Boolean(o)||i&&CM(i),visualElement:e,animationType:"string"==typeof s?s:"both",initialPromotionConfig:r,crossfade:u,layoutScroll:l,layoutRoot:c,layoutAnchor:d})}(m.current,n,a,g);const x=(0,u.useRef)(!1);(0,u.useInsertionEffect)(()=>{f&&x.current&&f.update(n,l)});const v=n[hk],y=(0,u.useRef)(Boolean(v)&&"undefined"!=typeof window&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return Ab(()=>{p.current=!0,f&&(x.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),y.current&&f.animationState&&f.animationState.animateChanges())}),(0,u.useEffect)(()=>{f&&(!y.current&&f.animationState&&f.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),y.current=!1),f.enteringChildren=void 0)}),f}function TM(e){if(e)return!1!==e.options.allowProjection?e.projection:TM(e.parent)}function MM(e,{forwardMotionProps:t=!1,type:n}={},r,a){r&&function(e){const t=JT();for(const n in e)t[n]={...t[n],...e[n]};MC(t)}(r);const s=n?"svg"===n:gM(e),o=s?wM:bM;function i(n,i){let l;const c={...(0,u.useContext)(LT),...n,layoutId:EM(n)},{isStatic:d}=c,h=iM(n),m=o(n,d);if(!d&&"undefined"!=typeof window){!function(e,t){const n=(0,u.useContext)(YT).strict;if("production"!==process.env.NODE_ENV&&t&&n){const t="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?zb(!1,t,"lazy-strict-mode"):Pb(!1,t,"lazy-strict-mode")}}(c,r);const t=function(e){const{drag:t,layout:n}=JT();if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(c);l=t.MeasureLayout,h.visualElement=NM(e,m,c,a,t.ProjectionNode,s)}return(0,p.jsxs)(oM.Provider,{value:h,children:[l&&h.visualElement?(0,p.jsx)(l,{visualElement:h.visualElement,...c}):null,xM(e,n,jM(m,h.visualElement,i),m,d,t,s)]})}i.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;const l=(0,u.forwardRef)(i);return l[SM]=e,l}function EM({layoutId:e}){const t=(0,u.useContext)(Mb).id;return t&&void 0!==e?t+"-"+e:e}function AM(e,t){if("undefined"==typeof Proxy)return MM;const n=new Map,r=(n,r)=>MM(n,r,e,t);return new Proxy((e,t)=>("production"!==process.env.NODE_ENV&&Xb(!1,"motion() is deprecated. Use motion.create() instead."),r(e,t)),{get:(a,s)=>"create"===s?r:(n.has(s)||n.set(s,MM(s,void 0,e,t)),n.get(s))})}var RM=(e,t)=>t.isSVG??gM(e)?new mN(t):new sN(t,{allowProjection:e!==u.Fragment}),IM=0,DM={animation:{Feature:class extends RC{constructor(e){super(e),e.animationState||(e.animationState=bN(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();xC(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends RC{constructor(){super(...arguments),this.id=IM++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&!1===n){if(this.isExitComplete){const{initial:e,custom:t}=this.node.getProps();if("string"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)){const n=ak(this.node,e,t);if(n){const{transition:e,transitionEnd:t,...r}=n;for(const n in r)this.node.getValue(n)?.jump(r[n])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);return void(this.isExitComplete=!1)}const r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function _M(e){return{point:{x:e.pageX,y:e.pageY}}}function zM(e,t,n,r){return QN(e,t,(e=>t=>Uk(t)&&e(t,_M(t)))(n),r)}var PM=({current:e})=>e?e.ownerDocument.defaultView:null,OM=(e,t)=>Math.abs(e-t);var LM=new Set(["auto","scroll"]),FM=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:a=!1,distanceThreshold:s=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=BM(this.lastRawMoveEventInfo,this.transformPagePoint));const e=VM(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){const n=OM(e.x,t.x),r=OM(e.y,t.y);return Math.sqrt(n**2+r**2)}(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;const{point:r}=e,{timestamp:a}=yw;this.history.push({...r,timestamp:a});const{onStart:s,onMove:o}=this.handlers;t||(s&&s(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=BM(t,this.transformPagePoint),xw.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:n,onSessionEnd:r,resumeAnimation:a}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||a&&a(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const s=VM("pointercancel"===e.type?this.lastMoveEventInfo:BM(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,s),r&&r(e,s)},!Uk(e))return;this.dragSnapToOrigin=a,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=s,this.contextWindow=r||window;const i=BM(_M(e),this.transformPagePoint),{point:l}=i,{timestamp:c}=yw;this.history=[{...l,timestamp:c}];const{onSessionStart:d}=t;d&&d(e,VM(i,this.history));const u={passive:!0,capture:!0};this.removeListeners=$b(zM(this.contextWindow,"pointermove",this.handlePointerMove,u),zM(this.contextWindow,"pointerup",this.handlePointerUp,u),zM(this.contextWindow,"pointercancel",this.handlePointerUp,u)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);(LM.has(e.overflowX)||LM.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a=r.x-t.x,s=r.y-t.y;0===a&&0===s||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a,this.lastMoveEventInfo.point.y+=s):this.history.length>0&&(this.history[0].x-=a,this.history[0].y-=s),this.scrollPositions.set(e,r),xw.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),vw(this.updatePoint)}};function BM(e,t){return t?{point:t(e.point)}:e}function HM(e,t){return{x:e.x-t.x,y:e.y-t.y}}function VM({point:e},t){return{point:e,delta:HM(e,qM(t)),offset:HM(e,$M(t)),velocity:UM(t,.1)}}function $M(e){return e[0]}function qM(e){return e[e.length-1]}function UM(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const a=qM(e);for(;n>=0&&(r=e[n],!(a.timestamp-r.timestamp>Gb(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&a.timestamp-r.timestamp>2*Gb(t)&&(r=e[1]);const s=Wb(a.timestamp-r.timestamp);if(0===s)return{x:0,y:0};const o={x:(a.x-r.x)/s,y:(a.y-r.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function GM(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function WM(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}var KM=.35;function YM(e,t,n){return{min:XM(e,t),max:XM(e,n)}}function XM(e,t){return"number"==typeof e?e:e[t]||0}var ZM=new WeakMap,JM=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){const{presenceContext:r}=this.visualElement;if(r&&!1===r.isPresent)return;const{dragSnapToOrigin:a}=this.getProps();this.panSession=new FM(e,{onSessionStart:e=>{t&&this.snapToCursor(_M(e).point),this.stopAnimation()},onStart:(e,t)=>{const{drag:n,dragPropagation:r,onDragStart:a}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(s=n)||"y"===s?Bk[s]?null:(Bk[s]=!0,()=>{Bk[s]=!1}):Bk.x||Bk.y?null:(Bk.x=Bk.y=!0,()=>{Bk.x=Bk.y=!1}),!this.openDragLock))return;var s;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),UN(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Vw.test(t)){const{projection:n}=this.visualElement;if(n&&n.layout){const r=n.layout.layoutBox[e];r&&(t=TN(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),a&&xw.update(()=>a(e,t),!1,!0),dk(this.visualElement,"transform");const{animationState:o}=this.visualElement;o&&o.setActive("whileDrag",!0)},onMove:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;const{dragPropagation:n,dragDirectionLock:r,onDirectionLock:a,onDrag:s}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:o}=t;if(r&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let n=null;Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x");return n}(o),void(null!==this.currentDirection&&a&&a(this.currentDirection));this.updateAxis("x",t.point,o),this.updateAxis("y",t.point,o),this.visualElement.render(),s&&xw.update(()=>s(e,t),!1,!0)},onSessionEnd:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>{const{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})}},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:a,distanceThreshold:n,contextWindow:PM(this.visualElement),element:this.visualElement.current})}stop(e,t){const n=e||this.latestPointerEvent,r=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!r||!n)return;const{velocity:s}=r;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&xw.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){const{drag:r}=this.getProps();if(!n||!eE(e,r,this.currentDirection))return;const a=this.getAxisMotionValue(e);let s=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(s=function(e,{min:t,max:n},r){return void 0!==t&&e<t?e=r?sS(t,e,r.min):Math.max(e,t):void 0!==n&&e>n&&(e=r?sS(n,e,r.max):Math.min(e,n)),e}(s,this.constraints[e],this.elastic[e])),a.set(s)}resolveConstraints(){const{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&CM(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!n)&&function(e,{top:t,left:n,bottom:r,right:a}){return{x:GM(e.x,n,a),y:GM(e.y,t,r)}}(n.layoutBox,e),this.elastic=function(e=KM){return!1===e?e=0:!0===e&&(e=KM),{x:YM(e,"left","right"),y:YM(e,"top","bottom")}}(t),r!==this.constraints&&!CM(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&UN(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const n={};return void 0!==t.min&&(n.min=t.min-e.min),void 0!==t.max&&(n.max=t.max-e.min),n}(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!CM(e))return!1;const n=e.current;Pb(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());const a=function(e,t,n){const r=KC(e,n),{scroll:a}=t;return a&&(qC(r.x,a.offset.x),qC(r.y,a.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let s=function(e,t){return{x:WM(e.x,t.x),y:WM(e.y,t.y)}}(r.layout.layoutBox,a);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(s));this.hasMutatedConstraints=!!e,e&&(s=IC(e))}return s}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:r,dragTransition:a,dragSnapToOrigin:s,onDragTransitionEnd:o}=this.getProps(),i=this.constraints||{},l=UN(o=>{if(!eE(o,t,this.currentDirection))return;let l=i&&i[o]||{};!0!==s&&s!==o||(l={min:0,max:0});const c=r?200:1e6,d=r?40:1e7,u={type:"inertia",velocity:n?e[o]:0,bounceStiffness:c,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...a,...l};return this.startAxisValueAnimation(o,u)});return Promise.all(l).then(o)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return dk(this.visualElement,e),n.start(Qj(e,n,0,t,this.visualElement,!1))}stopAnimation(){UN(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps()[t];return n||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){UN(t=>{const{drag:n}=this.getProps();if(!eE(t,n,this.currentDirection))return;const{projection:r}=this.visualElement,a=this.getAxisMotionValue(t);if(r&&r.layout){const{min:n,max:s}=r.layout.layoutBox[t],o=a.get()||0;a.set(e[t]-sS(n,s,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!CM(t)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};UN(e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const n=t.get();r[e]=function(e,t){let n=.5;const r=TN(e),a=TN(t);return a>r?n=qb(t.min,t.max-r,e.min):r>a&&(n=qb(e.min,e.max-a,t.min)),_b(0,1,n)}({min:n,max:n},this.constraints[e])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),UN(t=>{if(!eE(t,e,null))return;const n=this.getAxisMotionValue(t),{min:a,max:s}=this.constraints[t];n.set(sS(a,s,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;ZM.set(this.visualElement,this);const e=this.visualElement.current,t=zM(e,"pointerdown",t=>{const{drag:n,dragListener:r=!0}=this.getProps(),a=t.target,s=a!==e&&function(e){return Wk.has(e.tagName)||!0===e.isContentEditable}(a);n&&r&&!s&&this.start(t)});let n;const r=()=>{const{dragConstraints:t}=this.getProps();CM(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||(n=function(e,t,n){const r=hC(e,QM(n)),a=hC(t,QM(n));return()=>{r(),a()}}(e,t.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,s=a.addEventListener("measure",r);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),xw.read(r);const o=QN(window,"resize",()=>this.scalePositionWithinConstraints()),i=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(UN(t=>{const n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())});return()=>{o(),t(),s(),i&&i(),n&&n()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:a=!1,dragElastic:s=KM,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:a,dragElastic:s,dragMomentum:o}}};function QM(e){let t=!0;return()=>{t?t=!1:e()}}function eE(e,t,n){return!(!0!==t&&t!==e||null!==n&&n!==e)}var tE=e=>(t,n)=>{e&&xw.update(()=>e(t,n),!1,!0)},nE=!1,rE=class extends u.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:a}=e;a&&(t.group&&t.group.add(a),n&&n.register&&r&&n.register(a),nE&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),aT.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:r,isPresent:a}=this.props,{projection:s}=n;return s?(s.isPresent=a,e.layoutDependency!==t&&s.setOptions({...s.options,layoutDependency:t}),nE=!0,r||e.layoutDependency!==t||void 0===t||e.isPresent!==a?s.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?s.promote():s.relegate()||xw.postRender(()=>{const e=s.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Lk.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;nE=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}};function aE(e){const[t,n]=UT(),r=(0,u.useContext)(Mb);return(0,p.jsx)(rE,{...e,layoutGroup:r,switchLayoutGroup:(0,u.useContext)(kM),isPresent:t,safeToRemove:n})}var sE={pan:{Feature:class extends RC{constructor(){super(...arguments),this.removePointerDownListener=Vb}onPointerDown(e){this.session=new FM(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:PM(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:tE(e),onStart:tE(t),onMove:tE(n),onEnd:(e,t)=>{delete this.session,r&&xw.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=zM(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends RC{constructor(e){super(e),this.removeGroupControls=Vb,this.removeListeners=Vb,this.controls=new JM(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Vb}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:OT,MeasureLayout:aE}};function oE(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover","Start"===n);const a=r["onHover"+n];a&&xw.postRender(()=>a(t,_M(t)))}function iE(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap","Start"===n);const a=r["onTap"+("End"===n?"":n)];a&&xw.postRender(()=>a(t,_M(t)))}var lE=new WeakMap,cE=new WeakMap,dE=e=>{const t=lE.get(e.target);t&&t(e)},uE=e=>{e.forEach(dE)};function hE(e,t,n){const r=function({root:e,...t}){const n=e||document;cE.has(n)||cE.set(n,{});const r=cE.get(n),a=JSON.stringify(t);return r[a]||(r[a]=new IntersectionObserver(uE,{root:e,...t})),r[a]}(t);return lE.set(e,n),r.observe(e),()=>{lE.delete(e),r.unobserve(e)}}var mE={some:0,all:1};var pE={inView:{Feature:class extends RC{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r="some",once:a}=e,s={root:t?t.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:mE[r]};this.stopObserver=hE(this.node.current,s,e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,a&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),s=t?n:r;s&&s(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends RC{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=Qk(e,(e,t)=>(iE(this.node,t,"Start"),(e,{success:t})=>iE(this.node,e,t?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:!1===n?.tap})}unmount(){}}},focus:{Feature:class extends RC{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=$b(QN(this.node.current,"focus",()=>this.onFocus()),QN(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends RC{mount(){const{current:e}=this.node;e&&(this.unmount=$k(e,(e,t)=>(oE(this.node,t,"Start"),e=>oE(this.node,e,"End"))))}unmount(){}}}},fE=AM({...DM,...pE,...sE,...{layout:{ProjectionNode:OT,MeasureLayout:aE}}},RM),gE={type:"tween",ease:[.22,1,.36,1],duration:.5};function xE({percentage:e}){const t=24,n=10.75,r=2*Math.PI*n,a=r-e/100*r;return(0,p.jsxs)("svg",{width:t,height:t,className:"-rotate-90 shrink-0",children:[(0,p.jsx)("circle",{cx:12,cy:12,r:n,fill:"none",stroke:"var(--muted)",strokeWidth:2.5}),(0,p.jsx)(fE.circle,{cx:12,cy:12,r:n,fill:"none",stroke:"var(--foreground)",strokeWidth:2.5,strokeDasharray:r,initial:{strokeDashoffset:r},animate:{strokeDashoffset:a},transition:{duration:.15,ease:"easeOut"},strokeLinecap:"round"})]})}function vE({headings:e,onNavigate:t,editorRef:n}){const[r,a]=(0,u.useState)(null),[s,o]=(0,u.useState)(null),[i,l]=(0,u.useState)(!1),[c,d]=(0,u.useState)(0),[h,m]=(0,u.useState)(44),g=(0,u.useRef)(null);(0,u.useEffect)(()=>{const e=()=>{const e=document.querySelector(".toolbar");e&&m(e.getBoundingClientRect().bottom+6)};e();const t=document.querySelector(".toolbar");if(!t)return;const n=new ResizeObserver(e);return n.observe(t),()=>n.disconnect()},[]);const x=(0,u.useMemo)(()=>0===e.length?1:Math.min(...e.map(([,,e])=>parseInt(e[1],10))),[e]);if((0,u.useEffect)(()=>{(()=>{if(!n?.current)return;const t=e[0]?.[0];if(!t)return;const r=n.current.getElementByKey(t);if(!r)return;let a=r.parentElement;for(;a;){const e=window.getComputedStyle(a);if("auto"===e.overflowY||"scroll"===e.overflowY)return void(g.current=a);a=a.parentElement}g.current=null})()},[e,n]),(0,u.useEffect)(()=>{if(0===e.length)return;const t=e=>n?.current?.getElementByKey(e)??null,r=()=>{const n=g.current,r=n?n.scrollTop:window.scrollY,s=n?n.clientHeight:window.innerHeight,o=(n?n.scrollHeight:document.documentElement.scrollHeight)-s;d(o>0?Math.min(100,Math.max(0,r/o*100)):0);const i=.3*s;let l=null;for(const[a]of e){const e=t(a);if(!e)continue;const r=e.getBoundingClientRect(),s=n?n.getBoundingClientRect().top:0;if(!(r.top-s<=i))break;l=a}!l&&e.length>0&&(l=e[0][0]),a(l)},s=g.current??window;return s.addEventListener("scroll",r,{passive:!0}),r(),()=>s.removeEventListener("scroll",r)},[e,n]),0===e.length)return null;const v=e.find(([e])=>e===r)?.[1]??"Contents";return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(KT,{children:i&&(0,p.jsx)(fE.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:gE,className:"fixed inset-0 z-[9998] bg-black/20 backdrop-blur-[4px]",onClick:()=>l(!1)})}),(0,p.jsx)(fE.div,{initial:{y:-50,opacity:0},animate:{y:0,opacity:1},transition:{type:"spring",stiffness:300,damping:25},style:{top:h},className:"fixed left-1/2 z-[9999] flex -translate-x-1/2 flex-col items-center",children:(0,p.jsxs)(fE.div,{onClick:()=>{i||l(!0)},initial:!1,animate:{width:i?340:280,height:i?400:52,borderRadius:i?24:26},transition:gE,style:{cursor:i?"default":"pointer"},className:"relative overflow-hidden border border-foreground/10 bg-background text-foreground shadow-2xl",children:[(0,p.jsxs)(fE.div,{initial:!1,animate:{opacity:i?0:1,scale:i?.95:1,filter:i?"blur(4px)":"blur(0px)"},transition:{...gE,delay:i?0:.1},className:xo("absolute inset-0 flex items-center gap-4 px-4 sm:px-5",i&&"pointer-events-none"),children:[(0,p.jsx)("div",{className:"h-2 w-2 shrink-0 rounded-full bg-foreground"}),(0,p.jsx)("div",{className:"relative flex h-full flex-1 items-center overflow-hidden text-left",children:(0,p.jsx)(KT,{mode:"popLayout",initial:!1,children:(0,p.jsx)(fE.span,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},exit:{opacity:0,y:-15},transition:{duration:.35,ease:[.16,1,.3,1]},className:"block w-full overflow-hidden text-ellipsis whitespace-nowrap text-sm font-medium text-foreground",children:v},r??"empty")})}),(0,p.jsx)(xE,{percentage:c})]}),(0,p.jsxs)(fE.div,{initial:!1,animate:{opacity:i?1:0,scale:i?1:1.05},transition:{...gE,delay:i?.1:0},className:xo("absolute inset-0 flex flex-col",!i&&"pointer-events-none"),children:[(0,p.jsxs)("div",{className:"flex shrink-0 items-center justify-between px-6 pb-3 pt-5",children:[(0,p.jsx)("span",{className:"text-[11px] font-semibold tracking-[0.08em] text-muted-foreground",children:"TABLE OF CONTENTS"}),(0,p.jsx)("button",{onClick:e=>{e.stopPropagation(),l(!1)},className:"text-muted-foreground transition-colors hover:text-foreground",children:(0,p.jsx)(f.X,{className:"h-5 w-5"})})]}),(0,p.jsx)("div",{className:"flex-1 overflow-y-auto px-3 pb-4",children:(0,p.jsx)("div",{className:"flex flex-col gap-0.5",children:e.map(([e,n,a])=>{const i=parseInt(a[1],10),c=r===e,d=s===e,u=14*Math.max(0,i-x)+12;return(0,p.jsxs)("button",{onMouseEnter:()=>o(e),onMouseLeave:()=>o(null),onClick:n=>{n.stopPropagation(),t(e),l(!1)},style:{paddingLeft:`${u}px`},className:xo("group flex w-full shrink-0 cursor-pointer items-center rounded-lg border-none py-2 pr-3 text-left text-sm transition-all duration-300 ease-out",c&&"bg-foreground/10 font-medium text-foreground",!c&&d&&"bg-foreground/5 text-foreground/85",!c&&!d&&"bg-transparent text-foreground/45"),children:[(0,p.jsx)("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap transition-transform duration-300 group-hover:translate-x-1",children:n}),(0,p.jsx)(fE.div,{initial:!1,animate:{scale:c?1:0,opacity:c?1:0},transition:{duration:.3,ease:"easeOut"},className:"ml-3 h-1.5 w-1.5 shrink-0 rounded-full bg-foreground"})]},e)})})})]})]})})]})}var yE=({mainContent:e,belowMainContent:t,openFilesSidebarSignal:n,extraTabs:r,activeExtraTabId:a,onExtraTabSelect:s,onExtraTabClose:o,onExtraTabAdd:i,onFileTabSelect:l,initialDocId:c,onActiveDocumentChange:d,onGenerateTips:h,onGenerateTopics:m,onSearchTopic:g})=>{const{theme:x,setTheme:v}=Oy(),y=Tb(n),[b,w]=(0,u.useState)(void 0),[S,j]=(0,u.useState)([]),[k,C]=(0,u.useState)(!1),[N,T]=(0,u.useState)([]),[M,E]=(0,u.useState)(!1),A=(0,u.useRef)(!1);(0,u.useEffect)(()=>{!A.current&&c&&y.documents.some(e=>e.id===c)&&(A.current=!0,c!==y.activeDocId&&y.handleSelectDocument(c))},[c,y.documents,y.activeDocId,y.handleSelectDocument]),(0,u.useEffect)(()=>{d?.(y.activeDocId)},[y.activeDocId,d]),(0,u.useEffect)(()=>{j([]),T([])},[y.activeDocId]);const R=h?{tips:S,isTipsLoading:k,onGenerateTips:async()=>{if(h&&y.activeDocument){C(!0);try{const e=await h(y.activeDocument.title,y.activeDocument.content||"");j(e)}catch{j([])}finally{C(!1)}}}}:void 0,I=m?{topics:N,isTopicsLoading:M,onGenerateTopics:async()=>{if(m&&y.activeDocument){E(!0);try{const e=await m(y.activeDocument.title,y.activeDocument.content||"");T(e)}catch{T([])}finally{E(!1)}}},onSearchTopic:g}:void 0,[D,_]=vm({key:"reason-docs-sidebar",storage:ym}),z=(0,u.useMemo)(()=>{const e=y.openTabs.map(e=>({id:e,title:y.documents.find(t=>t.id===e)?.title||"Untitled",kind:"file"}));return[...e,...(r??[]).map(e=>({id:e.id,title:e.title,kind:e.kind}))]},[y.openTabs,y.documents,r]),P=a??y.activeDocId,O=e=>{r?.some(t=>t.id===e)?s?.(e):(y.handleTabChange(e),l?.())},L=e=>{r?.some(t=>t.id===e)?o?.(e):y.handleTabClose(e)},F=(e,t)=>{y.handleAddDocument(e,t),t||l?.()},B=e=>{y.handleSelectDocument(e),l?.()},H={documents:y.documents,activeId:y.activeDocId,activeDocument:y.activeDocument,onSelect:B,onAdd:F,onDelete:y.handleDeleteDocument,onDuplicate:y.handleDuplicateDocument,onToggleExpand:y.handleToggleExpand,onMove:y.handleMoveDocument,onManageTags:y.handleManageTags,onRename:(e,t)=>y.handleUpdateDocument(e,{title:t}),searchQuery:y.searchQuery,onSearchChange:y.setSearchQuery,onSearchClear:()=>y.setSearchQuery(""),onSearchFocus:()=>y.setIsSearchModalOpen(!0),isOpen:y.isSidebarOpen,onOpenChange:y.setIsSidebarOpen,isMobile:y.isMobile,leftPanels:y.leftPanels,onLeftPanelsChange:y.setLeftPanels,leftSplit:y.leftSplit,onLeftSplitChange:y.setLeftSplit,rightPanels:y.rightPanels,onRightPanelsChange:y.setRightPanels,rightSplit:y.rightSplit,onRightSplitChange:y.setRightSplit,onSettingsClick:e=>{w(e),y.setIsSettingsOpen(!0)},onInviteClick:()=>y.setIsInviteModalOpen(!0),onRestore:y.handleRestoreDocument,onPermanentDelete:y.handlePermanentDelete,newDocumentId:y.newDocumentId,showDynamicIsland:y.showDynamicIsland,onToggleDynamicIsland:()=>y.setShowDynamicIsland(!y.showDynamicIsland),activeFileSourceId:y.activeFileSourceId,onFileSourceChange:y.handleFileSourceChange,onNavigate:e=>y.editorRef.current?.scrollToHeading(e),editorRef:y.editorRef,openTabs:y.openTabs,activeTab:P,onTabChange:O,onTabClose:L,onTabRename:(e,t)=>y.handleUpdateDocument(e,{title:t}),onSplitRight:y.handleSplitRight,onReopenLastClosed:y.handleReopenLastClosed,canReopenLastClosed:y.closedTabsHistory.length>0,tabItems:z,onNewChat:i,aiProps:{isAiLoading:y.isAiLoading,aiSuggestion:y.aiSuggestion,onAiApprove:y.handleAIApprove,onAiReject:y.handleAIReject,onAiRegenerate:y.handleAIRegenerate},tipsProps:R,topicsProps:I},V={activeDocument:y.activeDocument,documents:y.documents,splitViewDocId:y.splitViewDocId,activeDocId:y.activeDocId,isMobile:y.isMobile,editorRef:y.editorRef,onUpdateDocument:y.handleUpdateDocument,onHeadingsChange:y.setHeadings,onCloseSplitView:()=>y.setSplitViewDocId(null),aiSuggestion:y.aiSuggestion,isAiLoading:y.isAiLoading,onAiRewrite:y.handleAIRewrite,onAiApprove:y.handleAIApprove,onAiReject:y.handleAIReject,onAiRegenerate:y.handleAIRegenerate,onInviteClick:()=>y.setIsInviteModalOpen(!0),onShareClick:()=>y.setIsInviteModalOpen(!0)},$=y.rightPanels.length>0&&(0,p.jsx)(dy,{panels:y.rightPanels,split:y.rightSplit,documents:y.documents,activeId:y.activeDocId,activeDocument:y.activeDocument,onSelect:B,onAdd:F,onDelete:y.handleDeleteDocument,onDuplicate:y.handleDuplicateDocument,onMove:y.handleMoveDocument,onManageTags:y.handleManageTags,onRename:(e,t)=>y.handleUpdateDocument(e,{title:t}),headings:y.headings,onNavigate:e=>y.editorRef.current?.scrollToHeading(e),editorRef:y.editorRef,openTabs:y.openTabs,activeTab:P,onTabChange:O,onTabClose:L,onTabRename:(e,t)=>y.handleUpdateDocument(e,{title:t}),onSplitRight:y.handleSplitRight,onReopenLastClosed:y.handleReopenLastClosed,canReopenLastClosed:y.closedTabsHistory.length>0,tabItems:z,onNewChat:i,aiProps:{isAiLoading:y.isAiLoading,aiSuggestion:y.aiSuggestion,onAiApprove:y.handleAIApprove,onAiReject:y.handleAIReject,onAiRegenerate:y.handleAIRegenerate},tipsProps:R,topicsProps:I,onClose:()=>y.setRightPanels([]),isMobile:y.isMobile,isOpen:y.isRightSidebarOpen,onOpenChange:y.setIsRightSidebarOpen});return(0,p.jsxs)("div",{className:"h-screen w-screen flex flex-col overflow-hidden",children:[y.isMobile?(0,p.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between h-10 px-1 border-b border-sidebar-border/60 shrink-0",children:[(0,p.jsx)($d,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:()=>y.setIsSidebarOpen(!0),"aria-label":"Open sidebar",children:(0,p.jsx)(f.Menu,{className:"h-5 w-5"})}),y.rightPanels.length>0&&(0,p.jsx)($d,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:()=>y.setIsRightSidebarOpen(!0),"aria-label":"Open right panel",children:(0,p.jsx)(f.PanelRight,{className:"h-5 w-5"})})]}),(0,p.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,p.jsx)(Sm,{...H,headings:y.headings}),(0,p.jsxs)("main",{className:"flex-1 overflow-hidden flex flex-col",children:[(0,p.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:e??(0,p.jsx)(oy,{...V})}),t&&(0,p.jsx)("div",{className:"shrink-0 px-2 pt-1 pb-[60px] sm:pb-2 sm:pr-56",children:t})]}),$]})]}):(0,p.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,p.jsxs)(xm,{direction:"horizontal",onResize:_,children:[(0,p.jsx)(om,{size:D?.[0]||"250px",minSize:"0px",maxSize:"600px",children:(0,p.jsx)("div",{className:"overflow-y-auto overflow-x-hidden bg-background",children:(0,p.jsx)(Sm,{...H,headings:y.headings})})}),(0,p.jsx)(om,{children:(0,p.jsxs)("div",{className:"h-screen flex flex-col bg-background",children:[(0,p.jsxs)("div",{className:"flex-1 flex min-h-0",children:[(0,p.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:e??(0,p.jsx)(oy,{...V})}),$]}),t&&(0,p.jsx)("div",{className:"shrink-0 px-2 pb-2",children:t})]})})]})}),y.headings.length>0&&0===y.rightPanels.length&&y.showDynamicIsland&&(0,p.jsx)(vE,{headings:y.headings,onNavigate:e=>y.editorRef.current?.scrollToHeading(e),editorRef:y.editorRef}),(0,p.jsx)(Nb,{isSearchModalOpen:y.isSearchModalOpen,setIsSearchModalOpen:y.setIsSearchModalOpen,isSettingsOpen:y.isSettingsOpen,setIsSettingsOpen:y.setIsSettingsOpen,settingsInitialSection:b,isTeamsOpen:y.isTeamsOpen,setIsTeamsOpen:y.setIsTeamsOpen,isInviteModalOpen:y.isInviteModalOpen,setIsInviteModalOpen:y.setIsInviteModalOpen,isTagDialogOpen:y.isTagDialogOpen,setIsTagDialogOpen:y.setIsTagDialogOpen,documents:y.documents,activeDocument:y.activeDocument,tagManagementDocId:y.tagManagementDocId,defaultSidebarView:y.defaultSidebarView,setDefaultSidebarView:y.setDefaultSidebarView,enableDatabaseSync:y.enableDatabaseSync,setEnableDatabaseSync:y.setEnableDatabaseSync,setDocuments:y.setDocuments,onSelectDocument:B,onToggleTheme:()=>{v("dark"===x?"light":"dark")},currentTheme:x,onUpdateTags:y.handleUpdateTags})]})};Object.defineProperty(exports,"Index",{enumerable:!0,get:function(){return yE}});
|