randmarcomps 1.451.0 → 1.453.0
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/randmarcomps.js +10 -2
- package/dist/randmarcomps.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/randmarcomps.js
CHANGED
|
@@ -8609,7 +8609,15 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
8609
8609
|
function ProductInventoryGrid({ inventory: t, showBinLocation: e, className: n }) {
|
|
8610
8610
|
const o = (F, z, Q = !1, V = !0) => {
|
|
8611
8611
|
const j = F.WarehouseType === "Fulfillment Center", te = j ? "bg-white" : "bg-white/70 text-gray-600", ne = V && z > 0 ? "border-t" : "", ae = Q ? "border-r" : "", Oe = F.Status ?? "Unknown", ge = Oe === "Active";
|
|
8612
|
-
let se =
|
|
8612
|
+
let se = "bg-emerald-100 text-emerald-800 ring-1 ring-emerald-200";
|
|
8613
|
+
switch (F.WarehouseType) {
|
|
8614
|
+
case "Last Mile":
|
|
8615
|
+
se = "bg-blue-100 text-blue-800 ring-1 ring-blue-200";
|
|
8616
|
+
break;
|
|
8617
|
+
case "First Mile":
|
|
8618
|
+
se = "bg-purple-100 text-purple-800 ring-1 ring-purple-200";
|
|
8619
|
+
break;
|
|
8620
|
+
}
|
|
8613
8621
|
switch (Oe) {
|
|
8614
8622
|
case "Closing":
|
|
8615
8623
|
se = "bg-yellow-100 text-yellow-800 ring-1 ring-yellow-200";
|
|
@@ -59817,7 +59825,7 @@ const LinkSection = ({ appID: t, activeChatObj: e }) => {
|
|
|
59817
59825
|
] }),
|
|
59818
59826
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
59819
59827
|
/* @__PURE__ */ jsx(Label$2, { htmlFor: "link-url", children: "URL" }),
|
|
59820
|
-
/* @__PURE__ */ jsx(Input, { id: "link-url", required: !0, minLength: 2 })
|
|
59828
|
+
/* @__PURE__ */ jsx(Input, { id: "link-url", type: "url", required: !0, minLength: 2, placeholder: "https://" })
|
|
59821
59829
|
] }),
|
|
59822
59830
|
/* @__PURE__ */ jsx(Button$1, { type: "submit", children: "Add Link" })
|
|
59823
59831
|
] })
|
|
@@ -506,7 +506,7 @@
|
|
|
506
506
|
|
|
507
507
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
508
508
|
|
|
509
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return React__namespace.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},DESCRIPTION_WARNING_NAME="DialogDescriptionWarning",DescriptionWarning$1=({contentRef:t,descriptionId:e})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${useWarningContext(DESCRIPTION_WARNING_NAME).contentName}}.`;return React__namespace.useEffect(()=>{var d;const l=(d=t.current)==null?void 0:d.getAttribute("aria-describedby");e&&l&&(document.getElementById(e)||console.warn(o))},[o,t,e]),null},Root$a=Dialog$1,Trigger$6=DialogTrigger$1,Portal$4=DialogPortal$1,Overlay=DialogOverlay$1,Content$3=DialogContent$1,Title$1=DialogTitle$1,Description$1=DialogDescription$1,Close$1=DialogClose$1;const Dialog=({modal:t=!1,...e})=>jsxRuntime.jsx(Root$a,{modal:t,...e});Dialog.displayName=Root$a.displayName;const DialogTrigger=Trigger$6,DialogPortal=Portal$4,DialogClose=Close$1,DialogOverlay=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Overlay,{ref:n,className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));DialogOverlay.displayName=Overlay.displayName;const DialogContent=React__namespace.forwardRef(({className:t,children:e,animateExit:n=!0,...o},l)=>jsxRuntime.jsxs(DialogPortal,{forceMount:o.forceMount,children:[jsxRuntime.jsx(DialogOverlay,{}),jsxRuntime.jsxs(Content$3,{ref:l,className:cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-2xl shadow-primary duration-200 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n&&"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",t),...o,children:[e,jsxRuntime.jsxs(Close$1,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[jsxRuntime.jsx(X$1,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));DialogContent.displayName=Content$3.displayName;const DialogHeader=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});DialogHeader.displayName="DialogHeader";const DialogFooter=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});DialogFooter.displayName="DialogFooter";const DialogTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title$1,{ref:n,className:cn("text-lg font-semibold leading-none tracking-tight",t),...e}));DialogTitle.displayName=Title$1.displayName;const DialogDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description$1,{ref:n,className:cn("text-sm text-muted-foreground",t),...e}));DialogDescription.displayName=Description$1.displayName;const sides=["top","right","bottom","left"],min$4=Math.min,max$4=Math.max,round$1=Math.round,floor=Math.floor,createCoords=t=>({x:t,y:t}),oppositeSideMap={left:"right",right:"left",bottom:"top",top:"bottom"},oppositeAlignmentMap={start:"end",end:"start"};function clamp$1(t,e,n){return max$4(t,min$4(e,n))}function evaluate(t,e){return typeof t=="function"?t(e):t}function getSide$1(t){return t.split("-")[0]}function getAlignment(t){return t.split("-")[1]}function getOppositeAxis(t){return t==="x"?"y":"x"}function getAxisLength(t){return t==="y"?"height":"width"}const yAxisSides=new Set(["top","bottom"]);function getSideAxis(t){return yAxisSides.has(getSide$1(t))?"y":"x"}function getAlignmentAxis(t){return getOppositeAxis(getSideAxis(t))}function getAlignmentSides(t,e,n){n===void 0&&(n=!1);const o=getAlignment(t),l=getAlignmentAxis(t),d=getAxisLength(l);let f=l==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[d]>e.floating[d]&&(f=getOppositePlacement(f)),[f,getOppositePlacement(f)]}function getExpandedPlacements(t){const e=getOppositePlacement(t);return[getOppositeAlignmentPlacement(t),e,getOppositeAlignmentPlacement(e)]}function getOppositeAlignmentPlacement(t){return t.replace(/start|end/g,e=>oppositeAlignmentMap[e])}const lrPlacement=["left","right"],rlPlacement=["right","left"],tbPlacement=["top","bottom"],btPlacement=["bottom","top"];function getSideList(t,e,n){switch(t){case"top":case"bottom":return n?e?rlPlacement:lrPlacement:e?lrPlacement:rlPlacement;case"left":case"right":return e?tbPlacement:btPlacement;default:return[]}}function getOppositeAxisPlacements(t,e,n,o){const l=getAlignment(t);let d=getSideList(getSide$1(t),n==="start",o);return l&&(d=d.map(f=>f+"-"+l),e&&(d=d.concat(d.map(getOppositeAlignmentPlacement)))),d}function getOppositePlacement(t){return t.replace(/left|right|bottom|top/g,e=>oppositeSideMap[e])}function expandPaddingObject(t){return{top:0,right:0,bottom:0,left:0,...t}}function getPaddingObject(t){return typeof t!="number"?expandPaddingObject(t):{top:t,right:t,bottom:t,left:t}}function rectToClientRect(t){const{x:e,y:n,width:o,height:l}=t;return{width:o,height:l,top:n,left:e,right:e+o,bottom:n+l,x:e,y:n}}function computeCoordsFromPlacement(t,e,n){let{reference:o,floating:l}=t;const d=getSideAxis(e),f=getAlignmentAxis(e),g=getAxisLength(f),b=getSide$1(e),_=d==="y",S=o.x+o.width/2-l.width/2,R=o.y+o.height/2-l.height/2,C=o[g]/2-l[g]/2;let E;switch(b){case"top":E={x:S,y:o.y-l.height};break;case"bottom":E={x:S,y:o.y+o.height};break;case"right":E={x:o.x+o.width,y:R};break;case"left":E={x:o.x-l.width,y:R};break;default:E={x:o.x,y:o.y}}switch(getAlignment(e)){case"start":E[f]-=C*(n&&_?-1:1);break;case"end":E[f]+=C*(n&&_?-1:1);break}return E}const computePosition$1=async(t,e,n)=>{const{placement:o="bottom",strategy:l="absolute",middleware:d=[],platform:f}=n,g=d.filter(Boolean),b=await(f.isRTL==null?void 0:f.isRTL(e));let _=await f.getElementRects({reference:t,floating:e,strategy:l}),{x:S,y:R}=computeCoordsFromPlacement(_,o,b),C=o,E={},A=0;for(let M=0;M<g.length;M++){const{name:I,fn:j}=g[M],{x:F,y:z,data:Q,reset:O}=await j({x:S,y:R,initialPlacement:o,placement:C,strategy:l,middlewareData:E,rects:_,platform:f,elements:{reference:t,floating:e}});S=F??S,R=z??R,E={...E,[I]:{...E[I],...Q}},O&&A<=50&&(A++,typeof O=="object"&&(O.placement&&(C=O.placement),O.rects&&(_=O.rects===!0?await f.getElementRects({reference:t,floating:e,strategy:l}):O.rects),{x:S,y:R}=computeCoordsFromPlacement(_,C,b)),M=-1)}return{x:S,y:R,placement:C,strategy:l,middlewareData:E}};async function detectOverflow(t,e){var n;e===void 0&&(e={});const{x:o,y:l,platform:d,rects:f,elements:g,strategy:b}=t,{boundary:_="clippingAncestors",rootBoundary:S="viewport",elementContext:R="floating",altBoundary:C=!1,padding:E=0}=evaluate(e,t),A=getPaddingObject(E),I=g[C?R==="floating"?"reference":"floating":R],j=rectToClientRect(await d.getClippingRect({element:(n=await(d.isElement==null?void 0:d.isElement(I)))==null||n?I:I.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(g.floating)),boundary:_,rootBoundary:S,strategy:b})),F=R==="floating"?{x:o,y:l,width:f.floating.width,height:f.floating.height}:f.reference,z=await(d.getOffsetParent==null?void 0:d.getOffsetParent(g.floating)),Q=await(d.isElement==null?void 0:d.isElement(z))?await(d.getScale==null?void 0:d.getScale(z))||{x:1,y:1}:{x:1,y:1},O=rectToClientRect(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:g,rect:F,offsetParent:z,strategy:b}):F);return{top:(j.top-O.top+A.top)/Q.y,bottom:(O.bottom-j.bottom+A.bottom)/Q.y,left:(j.left-O.left+A.left)/Q.x,right:(O.right-j.right+A.right)/Q.x}}const arrow$4=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:l,rects:d,platform:f,elements:g,middlewareData:b}=e,{element:_,padding:S=0}=evaluate(t,e)||{};if(_==null)return{};const R=getPaddingObject(S),C={x:n,y:o},E=getAlignmentAxis(l),A=getAxisLength(E),M=await f.getDimensions(_),I=E==="y",j=I?"top":"left",F=I?"bottom":"right",z=I?"clientHeight":"clientWidth",Q=d.reference[A]+d.reference[E]-C[E]-d.floating[A],O=C[E]-d.reference[E],V=await(f.getOffsetParent==null?void 0:f.getOffsetParent(_));let te=V?V[z]:0;(!te||!await(f.isElement==null?void 0:f.isElement(V)))&&(te=g.floating[z]||d.floating[A]);const ne=Q/2-O/2,ae=te/2-M[A]/2-1,$e=min$4(R[j],ae),ge=min$4(R[F],ae),se=$e,je=te-M[A]-ge,Ae=te/2-M[A]/2+ne,Ne=clamp$1(se,Ae,je),Ve=!b.arrow&&getAlignment(l)!=null&&Ae!==Ne&&d.reference[A]/2-(Ae<se?$e:ge)-M[A]/2<0,Fe=Ve?Ae<se?Ae-se:Ae-je:0;return{[E]:C[E]+Fe,data:{[E]:Ne,centerOffset:Ae-Ne-Fe,...Ve&&{alignmentOffset:Fe}},reset:Ve}}}),flip$2=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:l,middlewareData:d,rects:f,initialPlacement:g,platform:b,elements:_}=e,{mainAxis:S=!0,crossAxis:R=!0,fallbackPlacements:C,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:M=!0,...I}=evaluate(t,e);if((n=d.arrow)!=null&&n.alignmentOffset)return{};const j=getSide$1(l),F=getSideAxis(g),z=getSide$1(g)===g,Q=await(b.isRTL==null?void 0:b.isRTL(_.floating)),O=C||(z||!M?[getOppositePlacement(g)]:getExpandedPlacements(g)),V=A!=="none";!C&&V&&O.push(...getOppositeAxisPlacements(g,M,A,Q));const te=[g,...O],ne=await detectOverflow(e,I),ae=[];let $e=((o=d.flip)==null?void 0:o.overflows)||[];if(S&&ae.push(ne[j]),R){const Ae=getAlignmentSides(l,f,Q);ae.push(ne[Ae[0]],ne[Ae[1]])}if($e=[...$e,{placement:l,overflows:ae}],!ae.every(Ae=>Ae<=0)){var ge,se;const Ae=(((ge=d.flip)==null?void 0:ge.index)||0)+1,Ne=te[Ae];if(Ne&&(!(R==="alignment"?F!==getSideAxis(Ne):!1)||$e.every(Oe=>getSideAxis(Oe.placement)===F?Oe.overflows[0]>0:!0)))return{data:{index:Ae,overflows:$e},reset:{placement:Ne}};let Ve=(se=$e.filter(Fe=>Fe.overflows[0]<=0).sort((Fe,Oe)=>Fe.overflows[1]-Oe.overflows[1])[0])==null?void 0:se.placement;if(!Ve)switch(E){case"bestFit":{var je;const Fe=(je=$e.filter(Oe=>{if(V){const Be=getSideAxis(Oe.placement);return Be===F||Be==="y"}return!0}).map(Oe=>[Oe.placement,Oe.overflows.filter(Be=>Be>0).reduce((Be,Ue)=>Be+Ue,0)]).sort((Oe,Be)=>Oe[1]-Be[1])[0])==null?void 0:je[0];Fe&&(Ve=Fe);break}case"initialPlacement":Ve=g;break}if(l!==Ve)return{reset:{placement:Ve}}}return{}}}};function getSideOffsets(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function isAnySideFullyClipped(t){return sides.some(e=>t[e]>=0)}const hide$2=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:o="referenceHidden",...l}=evaluate(t,e);switch(o){case"referenceHidden":{const d=await detectOverflow(e,{...l,elementContext:"reference"}),f=getSideOffsets(d,n.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:isAnySideFullyClipped(f)}}}case"escaped":{const d=await detectOverflow(e,{...l,altBoundary:!0}),f=getSideOffsets(d,n.floating);return{data:{escapedOffsets:f,escaped:isAnySideFullyClipped(f)}}}default:return{}}}}},originSides=new Set(["left","top"]);async function convertValueToCoords(t,e){const{placement:n,platform:o,elements:l}=t,d=await(o.isRTL==null?void 0:o.isRTL(l.floating)),f=getSide$1(n),g=getAlignment(n),b=getSideAxis(n)==="y",_=originSides.has(f)?-1:1,S=d&&b?-1:1,R=evaluate(e,t);let{mainAxis:C,crossAxis:E,alignmentAxis:A}=typeof R=="number"?{mainAxis:R,crossAxis:0,alignmentAxis:null}:{mainAxis:R.mainAxis||0,crossAxis:R.crossAxis||0,alignmentAxis:R.alignmentAxis};return g&&typeof A=="number"&&(E=g==="end"?A*-1:A),b?{x:E*S,y:C*_}:{x:C*_,y:E*S}}const offset$2=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:l,y:d,placement:f,middlewareData:g}=e,b=await convertValueToCoords(e,t);return f===((n=g.offset)==null?void 0:n.placement)&&(o=g.arrow)!=null&&o.alignmentOffset?{}:{x:l+b.x,y:d+b.y,data:{...b,placement:f}}}}},shift$3=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:l}=e,{mainAxis:d=!0,crossAxis:f=!1,limiter:g={fn:I=>{let{x:j,y:F}=I;return{x:j,y:F}}},...b}=evaluate(t,e),_={x:n,y:o},S=await detectOverflow(e,b),R=getSideAxis(getSide$1(l)),C=getOppositeAxis(R);let E=_[C],A=_[R];if(d){const I=C==="y"?"top":"left",j=C==="y"?"bottom":"right",F=E+S[I],z=E-S[j];E=clamp$1(F,E,z)}if(f){const I=R==="y"?"top":"left",j=R==="y"?"bottom":"right",F=A+S[I],z=A-S[j];A=clamp$1(F,A,z)}const M=g.fn({...e,[C]:E,[R]:A});return{...M,data:{x:M.x-n,y:M.y-o,enabled:{[C]:d,[R]:f}}}}}},limitShift$2=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:l,rects:d,middlewareData:f}=e,{offset:g=0,mainAxis:b=!0,crossAxis:_=!0}=evaluate(t,e),S={x:n,y:o},R=getSideAxis(l),C=getOppositeAxis(R);let E=S[C],A=S[R];const M=evaluate(g,e),I=typeof M=="number"?{mainAxis:M,crossAxis:0}:{mainAxis:0,crossAxis:0,...M};if(b){const z=C==="y"?"height":"width",Q=d.reference[C]-d.floating[z]+I.mainAxis,O=d.reference[C]+d.reference[z]-I.mainAxis;E<Q?E=Q:E>O&&(E=O)}if(_){var j,F;const z=C==="y"?"width":"height",Q=originSides.has(getSide$1(l)),O=d.reference[R]-d.floating[z]+(Q&&((j=f.offset)==null?void 0:j[R])||0)+(Q?0:I.crossAxis),V=d.reference[R]+d.reference[z]+(Q?0:((F=f.offset)==null?void 0:F[R])||0)-(Q?I.crossAxis:0);A<O?A=O:A>V&&(A=V)}return{[C]:E,[R]:A}}}},size$2=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:l,rects:d,platform:f,elements:g}=e,{apply:b=()=>{},..._}=evaluate(t,e),S=await detectOverflow(e,_),R=getSide$1(l),C=getAlignment(l),E=getSideAxis(l)==="y",{width:A,height:M}=d.floating;let I,j;R==="top"||R==="bottom"?(I=R,j=C===(await(f.isRTL==null?void 0:f.isRTL(g.floating))?"start":"end")?"left":"right"):(j=R,I=C==="end"?"top":"bottom");const F=M-S.top-S.bottom,z=A-S.left-S.right,Q=min$4(M-S[I],F),O=min$4(A-S[j],z),V=!e.middlewareData.shift;let te=Q,ne=O;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(ne=z),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(te=F),V&&!C){const $e=max$4(S.left,0),ge=max$4(S.right,0),se=max$4(S.top,0),je=max$4(S.bottom,0);E?ne=A-2*($e!==0||ge!==0?$e+ge:max$4(S.left,S.right)):te=M-2*(se!==0||je!==0?se+je:max$4(S.top,S.bottom))}await b({...e,availableWidth:ne,availableHeight:te});const ae=await f.getDimensions(g.floating);return A!==ae.width||M!==ae.height?{reset:{rects:!0}}:{}}}};function hasWindow(){return typeof window<"u"}function getNodeName(t){return isNode(t)?(t.nodeName||"").toLowerCase():"#document"}function getWindow(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function getDocumentElement(t){var e;return(e=(isNode(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function isNode(t){return hasWindow()?t instanceof Node||t instanceof getWindow(t).Node:!1}function isElement(t){return hasWindow()?t instanceof Element||t instanceof getWindow(t).Element:!1}function isHTMLElement$2(t){return hasWindow()?t instanceof HTMLElement||t instanceof getWindow(t).HTMLElement:!1}function isShadowRoot(t){return!hasWindow()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof getWindow(t).ShadowRoot}const invalidOverflowDisplayValues=new Set(["inline","contents"]);function isOverflowElement(t){const{overflow:e,overflowX:n,overflowY:o,display:l}=getComputedStyle$1(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!invalidOverflowDisplayValues.has(l)}const tableElements=new Set(["table","td","th"]);function isTableElement(t){return tableElements.has(getNodeName(t))}const topLayerSelectors=[":popover-open",":modal"];function isTopLayer(t){return topLayerSelectors.some(e=>{try{return t.matches(e)}catch{return!1}})}const transformProperties=["transform","translate","scale","rotate","perspective"],willChangeValues=["transform","translate","scale","rotate","perspective","filter"],containValues=["paint","layout","strict","content"];function isContainingBlock(t){const e=isWebKit(),n=isElement(t)?getComputedStyle$1(t):t;return transformProperties.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||willChangeValues.some(o=>(n.willChange||"").includes(o))||containValues.some(o=>(n.contain||"").includes(o))}function getContainingBlock(t){let e=getParentNode(t);for(;isHTMLElement$2(e)&&!isLastTraversableNode(e);){if(isContainingBlock(e))return e;if(isTopLayer(e))return null;e=getParentNode(e)}return null}function isWebKit(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const lastTraversableNodeNames=new Set(["html","body","#document"]);function isLastTraversableNode(t){return lastTraversableNodeNames.has(getNodeName(t))}function getComputedStyle$1(t){return getWindow(t).getComputedStyle(t)}function getNodeScroll(t){return isElement(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function getParentNode(t){if(getNodeName(t)==="html")return t;const e=t.assignedSlot||t.parentNode||isShadowRoot(t)&&t.host||getDocumentElement(t);return isShadowRoot(e)?e.host:e}function getNearestOverflowAncestor(t){const e=getParentNode(t);return isLastTraversableNode(e)?t.ownerDocument?t.ownerDocument.body:t.body:isHTMLElement$2(e)&&isOverflowElement(e)?e:getNearestOverflowAncestor(e)}function getOverflowAncestors(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const l=getNearestOverflowAncestor(t),d=l===((o=t.ownerDocument)==null?void 0:o.body),f=getWindow(l);if(d){const g=getFrameElement(f);return e.concat(f,f.visualViewport||[],isOverflowElement(l)?l:[],g&&n?getOverflowAncestors(g):[])}return e.concat(l,getOverflowAncestors(l,[],n))}function getFrameElement(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function getCssDimensions(t){const e=getComputedStyle$1(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const l=isHTMLElement$2(t),d=l?t.offsetWidth:n,f=l?t.offsetHeight:o,g=round$1(n)!==d||round$1(o)!==f;return g&&(n=d,o=f),{width:n,height:o,$:g}}function unwrapElement(t){return isElement(t)?t:t.contextElement}function getScale(t){const e=unwrapElement(t);if(!isHTMLElement$2(e))return createCoords(1);const n=e.getBoundingClientRect(),{width:o,height:l,$:d}=getCssDimensions(e);let f=(d?round$1(n.width):n.width)/o,g=(d?round$1(n.height):n.height)/l;return(!f||!Number.isFinite(f))&&(f=1),(!g||!Number.isFinite(g))&&(g=1),{x:f,y:g}}const noOffsets=createCoords(0);function getVisualOffsets(t){const e=getWindow(t);return!isWebKit()||!e.visualViewport?noOffsets:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function shouldAddVisualOffsets(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==getWindow(t)?!1:e}function getBoundingClientRect(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const l=t.getBoundingClientRect(),d=unwrapElement(t);let f=createCoords(1);e&&(o?isElement(o)&&(f=getScale(o)):f=getScale(t));const g=shouldAddVisualOffsets(d,n,o)?getVisualOffsets(d):createCoords(0);let b=(l.left+g.x)/f.x,_=(l.top+g.y)/f.y,S=l.width/f.x,R=l.height/f.y;if(d){const C=getWindow(d),E=o&&isElement(o)?getWindow(o):o;let A=C,M=getFrameElement(A);for(;M&&o&&E!==A;){const I=getScale(M),j=M.getBoundingClientRect(),F=getComputedStyle$1(M),z=j.left+(M.clientLeft+parseFloat(F.paddingLeft))*I.x,Q=j.top+(M.clientTop+parseFloat(F.paddingTop))*I.y;b*=I.x,_*=I.y,S*=I.x,R*=I.y,b+=z,_+=Q,A=getWindow(M),M=getFrameElement(A)}}return rectToClientRect({width:S,height:R,x:b,y:_})}function getWindowScrollBarX(t,e){const n=getNodeScroll(t).scrollLeft;return e?e.left+n:getBoundingClientRect(getDocumentElement(t)).left+n}function getHTMLOffset(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-getWindowScrollBarX(t,n),l=n.top+e.scrollTop;return{x:o,y:l}}function convertOffsetParentRelativeRectToViewportRelativeRect(t){let{elements:e,rect:n,offsetParent:o,strategy:l}=t;const d=l==="fixed",f=getDocumentElement(o),g=e?isTopLayer(e.floating):!1;if(o===f||g&&d)return n;let b={scrollLeft:0,scrollTop:0},_=createCoords(1);const S=createCoords(0),R=isHTMLElement$2(o);if((R||!R&&!d)&&((getNodeName(o)!=="body"||isOverflowElement(f))&&(b=getNodeScroll(o)),isHTMLElement$2(o))){const E=getBoundingClientRect(o);_=getScale(o),S.x=E.x+o.clientLeft,S.y=E.y+o.clientTop}const C=f&&!R&&!d?getHTMLOffset(f,b):createCoords(0);return{width:n.width*_.x,height:n.height*_.y,x:n.x*_.x-b.scrollLeft*_.x+S.x+C.x,y:n.y*_.y-b.scrollTop*_.y+S.y+C.y}}function getClientRects(t){return Array.from(t.getClientRects())}function getDocumentRect(t){const e=getDocumentElement(t),n=getNodeScroll(t),o=t.ownerDocument.body,l=max$4(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),d=max$4(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let f=-n.scrollLeft+getWindowScrollBarX(t);const g=-n.scrollTop;return getComputedStyle$1(o).direction==="rtl"&&(f+=max$4(e.clientWidth,o.clientWidth)-l),{width:l,height:d,x:f,y:g}}const SCROLLBAR_MAX=25;function getViewportRect(t,e){const n=getWindow(t),o=getDocumentElement(t),l=n.visualViewport;let d=o.clientWidth,f=o.clientHeight,g=0,b=0;if(l){d=l.width,f=l.height;const S=isWebKit();(!S||S&&e==="fixed")&&(g=l.offsetLeft,b=l.offsetTop)}const _=getWindowScrollBarX(o);if(_<=0){const S=o.ownerDocument,R=S.body,C=getComputedStyle(R),E=S.compatMode==="CSS1Compat"&&parseFloat(C.marginLeft)+parseFloat(C.marginRight)||0,A=Math.abs(o.clientWidth-R.clientWidth-E);A<=SCROLLBAR_MAX&&(d-=A)}else _<=SCROLLBAR_MAX&&(d+=_);return{width:d,height:f,x:g,y:b}}const absoluteOrFixed=new Set(["absolute","fixed"]);function getInnerBoundingClientRect(t,e){const n=getBoundingClientRect(t,!0,e==="fixed"),o=n.top+t.clientTop,l=n.left+t.clientLeft,d=isHTMLElement$2(t)?getScale(t):createCoords(1),f=t.clientWidth*d.x,g=t.clientHeight*d.y,b=l*d.x,_=o*d.y;return{width:f,height:g,x:b,y:_}}function getClientRectFromClippingAncestor(t,e,n){let o;if(e==="viewport")o=getViewportRect(t,n);else if(e==="document")o=getDocumentRect(getDocumentElement(t));else if(isElement(e))o=getInnerBoundingClientRect(e,n);else{const l=getVisualOffsets(t);o={x:e.x-l.x,y:e.y-l.y,width:e.width,height:e.height}}return rectToClientRect(o)}function hasFixedPositionAncestor(t,e){const n=getParentNode(t);return n===e||!isElement(n)||isLastTraversableNode(n)?!1:getComputedStyle$1(n).position==="fixed"||hasFixedPositionAncestor(n,e)}function getClippingElementAncestors(t,e){const n=e.get(t);if(n)return n;let o=getOverflowAncestors(t,[],!1).filter(g=>isElement(g)&&getNodeName(g)!=="body"),l=null;const d=getComputedStyle$1(t).position==="fixed";let f=d?getParentNode(t):t;for(;isElement(f)&&!isLastTraversableNode(f);){const g=getComputedStyle$1(f),b=isContainingBlock(f);!b&&g.position==="fixed"&&(l=null),(d?!b&&!l:!b&&g.position==="static"&&!!l&&absoluteOrFixed.has(l.position)||isOverflowElement(f)&&!b&&hasFixedPositionAncestor(t,f))?o=o.filter(S=>S!==f):l=g,f=getParentNode(f)}return e.set(t,o),o}function getClippingRect(t){let{element:e,boundary:n,rootBoundary:o,strategy:l}=t;const f=[...n==="clippingAncestors"?isTopLayer(e)?[]:getClippingElementAncestors(e,this._c):[].concat(n),o],g=f[0],b=f.reduce((_,S)=>{const R=getClientRectFromClippingAncestor(e,S,l);return _.top=max$4(R.top,_.top),_.right=min$4(R.right,_.right),_.bottom=min$4(R.bottom,_.bottom),_.left=max$4(R.left,_.left),_},getClientRectFromClippingAncestor(e,g,l));return{width:b.right-b.left,height:b.bottom-b.top,x:b.left,y:b.top}}function getDimensions(t){const{width:e,height:n}=getCssDimensions(t);return{width:e,height:n}}function getRectRelativeToOffsetParent(t,e,n){const o=isHTMLElement$2(e),l=getDocumentElement(e),d=n==="fixed",f=getBoundingClientRect(t,!0,d,e);let g={scrollLeft:0,scrollTop:0};const b=createCoords(0);function _(){b.x=getWindowScrollBarX(l)}if(o||!o&&!d)if((getNodeName(e)!=="body"||isOverflowElement(l))&&(g=getNodeScroll(e)),o){const E=getBoundingClientRect(e,!0,d,e);b.x=E.x+e.clientLeft,b.y=E.y+e.clientTop}else l&&_();d&&!o&&l&&_();const S=l&&!o&&!d?getHTMLOffset(l,g):createCoords(0),R=f.left+g.scrollLeft-b.x-S.x,C=f.top+g.scrollTop-b.y-S.y;return{x:R,y:C,width:f.width,height:f.height}}function isStaticPositioned(t){return getComputedStyle$1(t).position==="static"}function getTrueOffsetParent(t,e){if(!isHTMLElement$2(t)||getComputedStyle$1(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return getDocumentElement(t)===n&&(n=n.ownerDocument.body),n}function getOffsetParent(t,e){const n=getWindow(t);if(isTopLayer(t))return n;if(!isHTMLElement$2(t)){let l=getParentNode(t);for(;l&&!isLastTraversableNode(l);){if(isElement(l)&&!isStaticPositioned(l))return l;l=getParentNode(l)}return n}let o=getTrueOffsetParent(t,e);for(;o&&isTableElement(o)&&isStaticPositioned(o);)o=getTrueOffsetParent(o,e);return o&&isLastTraversableNode(o)&&isStaticPositioned(o)&&!isContainingBlock(o)?n:o||getContainingBlock(t)||n}const getElementRects=async function(t){const e=this.getOffsetParent||getOffsetParent,n=this.getDimensions,o=await n(t.floating);return{reference:getRectRelativeToOffsetParent(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function isRTL(t){return getComputedStyle$1(t).direction==="rtl"}const platform={convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement,getClippingRect,getOffsetParent,getElementRects,getClientRects,getDimensions,getScale,isElement,isRTL};function rectsAreEqual(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function observeMove(t,e){let n=null,o;const l=getDocumentElement(t);function d(){var g;clearTimeout(o),(g=n)==null||g.disconnect(),n=null}function f(g,b){g===void 0&&(g=!1),b===void 0&&(b=1),d();const _=t.getBoundingClientRect(),{left:S,top:R,width:C,height:E}=_;if(g||e(),!C||!E)return;const A=floor(R),M=floor(l.clientWidth-(S+C)),I=floor(l.clientHeight-(R+E)),j=floor(S),z={rootMargin:-A+"px "+-M+"px "+-I+"px "+-j+"px",threshold:max$4(0,min$4(1,b))||1};let Q=!0;function O(V){const te=V[0].intersectionRatio;if(te!==b){if(!Q)return f();te?f(!1,te):o=setTimeout(()=>{f(!1,1e-7)},1e3)}te===1&&!rectsAreEqual(_,t.getBoundingClientRect())&&f(),Q=!1}try{n=new IntersectionObserver(O,{...z,root:l.ownerDocument})}catch{n=new IntersectionObserver(O,z)}n.observe(t)}return f(!0),d}function autoUpdate(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:l=!0,ancestorResize:d=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:g=typeof IntersectionObserver=="function",animationFrame:b=!1}=o,_=unwrapElement(t),S=l||d?[..._?getOverflowAncestors(_):[],...getOverflowAncestors(e)]:[];S.forEach(j=>{l&&j.addEventListener("scroll",n,{passive:!0}),d&&j.addEventListener("resize",n)});const R=_&&g?observeMove(_,n):null;let C=-1,E=null;f&&(E=new ResizeObserver(j=>{let[F]=j;F&&F.target===_&&E&&(E.unobserve(e),cancelAnimationFrame(C),C=requestAnimationFrame(()=>{var z;(z=E)==null||z.observe(e)})),n()}),_&&!b&&E.observe(_),E.observe(e));let A,M=b?getBoundingClientRect(t):null;b&&I();function I(){const j=getBoundingClientRect(t);M&&!rectsAreEqual(M,j)&&n(),M=j,A=requestAnimationFrame(I)}return n(),()=>{var j;S.forEach(F=>{l&&F.removeEventListener("scroll",n),d&&F.removeEventListener("resize",n)}),R==null||R(),(j=E)==null||j.disconnect(),E=null,b&&cancelAnimationFrame(A)}}const offset$1=offset$2,shift$2=shift$3,flip$1=flip$2,size$1=size$2,hide$1=hide$2,arrow$3=arrow$4,limitShift$1=limitShift$2,computePosition=(t,e,n)=>{const o=new Map,l={platform,...n},d={...l.platform,_c:o};return computePosition$1(t,e,{...l,platform:d})};var isClient=typeof document<"u",noop$2=function(){},index=isClient?React.useLayoutEffect:noop$2;function deepEqual$3(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,l;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!deepEqual$3(t[o],e[o]))return!1;return!0}if(l=Object.keys(t),n=l.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,l[o]))return!1;for(o=n;o--!==0;){const d=l[o];if(!(d==="_owner"&&t.$$typeof)&&!deepEqual$3(t[d],e[d]))return!1}return!0}return t!==t&&e!==e}function getDPR(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function roundByDPR(t,e){const n=getDPR(t);return Math.round(e*n)/n}function useLatestRef(t){const e=React__namespace.useRef(t);return index(()=>{e.current=t}),e}function useFloating(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:l,elements:{reference:d,floating:f}={},transform:g=!0,whileElementsMounted:b,open:_}=t,[S,R]=React__namespace.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[C,E]=React__namespace.useState(o);deepEqual$3(C,o)||E(o);const[A,M]=React__namespace.useState(null),[I,j]=React__namespace.useState(null),F=React__namespace.useCallback(Oe=>{Oe!==V.current&&(V.current=Oe,M(Oe))},[]),z=React__namespace.useCallback(Oe=>{Oe!==te.current&&(te.current=Oe,j(Oe))},[]),Q=d||A,O=f||I,V=React__namespace.useRef(null),te=React__namespace.useRef(null),ne=React__namespace.useRef(S),ae=b!=null,$e=useLatestRef(b),ge=useLatestRef(l),se=useLatestRef(_),je=React__namespace.useCallback(()=>{if(!V.current||!te.current)return;const Oe={placement:e,strategy:n,middleware:C};ge.current&&(Oe.platform=ge.current),computePosition(V.current,te.current,Oe).then(Be=>{const Ue={...Be,isPositioned:se.current!==!1};Ae.current&&!deepEqual$3(ne.current,Ue)&&(ne.current=Ue,ReactDOM__namespace.flushSync(()=>{R(Ue)}))})},[C,e,n,ge,se]);index(()=>{_===!1&&ne.current.isPositioned&&(ne.current.isPositioned=!1,R(Oe=>({...Oe,isPositioned:!1})))},[_]);const Ae=React__namespace.useRef(!1);index(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]),index(()=>{if(Q&&(V.current=Q),O&&(te.current=O),Q&&O){if($e.current)return $e.current(Q,O,je);je()}},[Q,O,je,$e,ae]);const Ne=React__namespace.useMemo(()=>({reference:V,floating:te,setReference:F,setFloating:z}),[F,z]),Ve=React__namespace.useMemo(()=>({reference:Q,floating:O}),[Q,O]),Fe=React__namespace.useMemo(()=>{const Oe={position:n,left:0,top:0};if(!Ve.floating)return Oe;const Be=roundByDPR(Ve.floating,S.x),Ue=roundByDPR(Ve.floating,S.y);return g?{...Oe,transform:"translate("+Be+"px, "+Ue+"px)",...getDPR(Ve.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Be,top:Ue}},[n,g,Ve.floating,S.x,S.y]);return React__namespace.useMemo(()=>({...S,update:je,refs:Ne,elements:Ve,floatingStyles:Fe}),[S,je,Ne,Ve,Fe])}const arrow$1=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:l}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?arrow$3({element:o.current,padding:l}).fn(n):{}:o?arrow$3({element:o,padding:l}).fn(n):{}}}},offset=(t,e)=>({...offset$1(t),options:[t,e]}),shift$1=(t,e)=>({...shift$2(t),options:[t,e]}),limitShift=(t,e)=>({...limitShift$1(t),options:[t,e]}),flip=(t,e)=>({...flip$1(t),options:[t,e]}),size=(t,e)=>({...size$1(t),options:[t,e]}),hide=(t,e)=>({...hide$1(t),options:[t,e]}),arrow$2=(t,e)=>({...arrow$1(t),options:[t,e]});var NAME$3="Arrow",Arrow$1=React__namespace.forwardRef((t,e)=>{const{children:n,width:o=10,height:l=5,...d}=t;return jsxRuntime.jsx(Primitive$4.svg,{...d,ref:e,width:o,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:jsxRuntime.jsx("polygon",{points:"0,0 30,0 15,10"})})});Arrow$1.displayName=NAME$3;var Root$9=Arrow$1,POPPER_NAME="Popper",[createPopperContext,createPopperScope]=createContextScope$2(POPPER_NAME),[PopperProvider,usePopperContext]=createPopperContext(POPPER_NAME),Popper=t=>{const{__scopePopper:e,children:n}=t,[o,l]=React__namespace.useState(null);return jsxRuntime.jsx(PopperProvider,{scope:e,anchor:o,onAnchorChange:l,children:n})};Popper.displayName=POPPER_NAME;var ANCHOR_NAME$2="PopperAnchor",PopperAnchor=React__namespace.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:o,...l}=t,d=usePopperContext(ANCHOR_NAME$2,n),f=React__namespace.useRef(null),g=useComposedRefs(e,f),b=React__namespace.useRef(null);return React__namespace.useEffect(()=>{const _=b.current;b.current=(o==null?void 0:o.current)||f.current,_!==b.current&&d.onAnchorChange(b.current)}),o?null:jsxRuntime.jsx(Primitive$4.div,{...l,ref:g})});PopperAnchor.displayName=ANCHOR_NAME$2;var CONTENT_NAME$9="PopperContent",[PopperContentProvider,useContentContext]=createPopperContext(CONTENT_NAME$9),PopperContent=React__namespace.forwardRef((t,e)=>{var Ke,at,nt,st,lt,Ge;const{__scopePopper:n,side:o="bottom",sideOffset:l=0,align:d="center",alignOffset:f=0,arrowPadding:g=0,avoidCollisions:b=!0,collisionBoundary:_=[],collisionPadding:S=0,sticky:R="partial",hideWhenDetached:C=!1,updatePositionStrategy:E="optimized",onPlaced:A,...M}=t,I=usePopperContext(CONTENT_NAME$9,n),[j,F]=React__namespace.useState(null),z=useComposedRefs(e,Ct=>F(Ct)),[Q,O]=React__namespace.useState(null),V=useSize(Q),te=(V==null?void 0:V.width)??0,ne=(V==null?void 0:V.height)??0,ae=o+(d!=="center"?"-"+d:""),$e=typeof S=="number"?S:{top:0,right:0,bottom:0,left:0,...S},ge=Array.isArray(_)?_:[_],se=ge.length>0,je={padding:$e,boundary:ge.filter(isNotNull),altBoundary:se},{refs:Ae,floatingStyles:Ne,placement:Ve,isPositioned:Fe,middlewareData:Oe}=useFloating({strategy:"fixed",placement:ae,whileElementsMounted:(...Ct)=>autoUpdate(...Ct,{animationFrame:E==="always"}),elements:{reference:I.anchor},middleware:[offset({mainAxis:l+ne,alignmentAxis:f}),b&&shift$1({mainAxis:!0,crossAxis:!1,limiter:R==="partial"?limitShift():void 0,...je}),b&&flip({...je}),size({...je,apply:({elements:Ct,rects:tt,availableWidth:yt,availableHeight:ct})=>{const{width:Rt,height:Mt}=tt.reference,It=Ct.floating.style;It.setProperty("--radix-popper-available-width",`${yt}px`),It.setProperty("--radix-popper-available-height",`${ct}px`),It.setProperty("--radix-popper-anchor-width",`${Rt}px`),It.setProperty("--radix-popper-anchor-height",`${Mt}px`)}}),Q&&arrow$2({element:Q,padding:g}),transformOrigin({arrowWidth:te,arrowHeight:ne}),C&&hide({strategy:"referenceHidden",...je})]}),[Be,Ue]=getSideAndAlignFromPlacement(Ve),ze=useCallbackRef$1(A);useLayoutEffect2(()=>{Fe&&(ze==null||ze())},[Fe,ze]);const He=(Ke=Oe.arrow)==null?void 0:Ke.x,Qe=(at=Oe.arrow)==null?void 0:at.y,et=((nt=Oe.arrow)==null?void 0:nt.centerOffset)!==0,[Je,Ze]=React__namespace.useState();return useLayoutEffect2(()=>{j&&Ze(window.getComputedStyle(j).zIndex)},[j]),jsxRuntime.jsx("div",{ref:Ae.setFloating,"data-radix-popper-content-wrapper":"",style:{...Ne,transform:Fe?Ne.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Je,"--radix-popper-transform-origin":[(st=Oe.transformOrigin)==null?void 0:st.x,(lt=Oe.transformOrigin)==null?void 0:lt.y].join(" "),...((Ge=Oe.hide)==null?void 0:Ge.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:jsxRuntime.jsx(PopperContentProvider,{scope:n,placedSide:Be,onArrowChange:O,arrowX:He,arrowY:Qe,shouldHideArrow:et,children:jsxRuntime.jsx(Primitive$4.div,{"data-side":Be,"data-align":Ue,...M,ref:z,style:{...M.style,animation:Fe?void 0:"none"}})})})});PopperContent.displayName=CONTENT_NAME$9;var ARROW_NAME$5="PopperArrow",OPPOSITE_SIDE={top:"bottom",right:"left",bottom:"top",left:"right"},PopperArrow=React__namespace.forwardRef(function(e,n){const{__scopePopper:o,...l}=e,d=useContentContext(ARROW_NAME$5,o),f=OPPOSITE_SIDE[d.placedSide];return jsxRuntime.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:jsxRuntime.jsx(Root$9,{...l,ref:n,style:{...l.style,display:"block"}})})});PopperArrow.displayName=ARROW_NAME$5;function isNotNull(t){return t!==null}var transformOrigin=t=>({name:"transformOrigin",options:t,fn(e){var I,j,F;const{placement:n,rects:o,middlewareData:l}=e,f=((I=l.arrow)==null?void 0:I.centerOffset)!==0,g=f?0:t.arrowWidth,b=f?0:t.arrowHeight,[_,S]=getSideAndAlignFromPlacement(n),R={start:"0%",center:"50%",end:"100%"}[S],C=(((j=l.arrow)==null?void 0:j.x)??0)+g/2,E=(((F=l.arrow)==null?void 0:F.y)??0)+b/2;let A="",M="";return _==="bottom"?(A=f?R:`${C}px`,M=`${-b}px`):_==="top"?(A=f?R:`${C}px`,M=`${o.floating.height+b}px`):_==="right"?(A=`${-b}px`,M=f?R:`${E}px`):_==="left"&&(A=`${o.floating.width+b}px`,M=f?R:`${E}px`),{data:{x:A,y:M}}}});function getSideAndAlignFromPlacement(t){const[e,n="center"]=t.split("-");return[e,n]}var Root2$7=Popper,Anchor=PopperAnchor,Content$2=PopperContent,Arrow=PopperArrow;function createSlot$3(t){const e=createSlotClone$3(t),n=React__namespace.forwardRef((o,l)=>{const{children:d,...f}=o,g=React__namespace.Children.toArray(d),b=g.find(isSlottable$3);if(b){const _=b.props.children,S=g.map(R=>R===b?React__namespace.Children.count(_)>1?React__namespace.Children.only(null):React__namespace.isValidElement(_)?_.props.children:null:R);return jsxRuntime.jsx(e,{...f,ref:l,children:React__namespace.isValidElement(_)?React__namespace.cloneElement(_,void 0,S):null})}return jsxRuntime.jsx(e,{...f,ref:l,children:d})});return n.displayName=`${t}.Slot`,n}function createSlotClone$3(t){const e=React__namespace.forwardRef((n,o)=>{const{children:l,...d}=n;if(React__namespace.isValidElement(l)){const f=getElementRef$3(l),g=mergeProps$3(d,l.props);return l.type!==React__namespace.Fragment&&(g.ref=o?composeRefs(o,f):f),React__namespace.cloneElement(l,g)}return React__namespace.Children.count(l)>1?React__namespace.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var SLOTTABLE_IDENTIFIER$5=Symbol("radix.slottable");function isSlottable$3(t){return React__namespace.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===SLOTTABLE_IDENTIFIER$5}function mergeProps$3(t,e){const n={...e};for(const o in e){const l=t[o],d=e[o];/^on[A-Z]/.test(o)?l&&d?n[o]=(...g)=>{const b=d(...g);return l(...g),b}:l&&(n[o]=l):o==="style"?n[o]={...l,...d}:o==="className"&&(n[o]=[l,d].filter(Boolean).join(" "))}return{...t,...n}}function getElementRef$3(t){var o,l;let e=(o=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(l=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:l.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var SELECTION_KEYS$1=["Enter"," "],FIRST_KEYS=["ArrowDown","PageUp","Home"],LAST_KEYS=["ArrowUp","PageDown","End"],FIRST_LAST_KEYS=[...FIRST_KEYS,...LAST_KEYS],SUB_OPEN_KEYS={ltr:[...SELECTION_KEYS$1,"ArrowRight"],rtl:[...SELECTION_KEYS$1,"ArrowLeft"]},SUB_CLOSE_KEYS={ltr:["ArrowLeft"],rtl:["ArrowRight"]},MENU_NAME="Menu",[Collection$3,useCollection$3,createCollectionScope$3]=createCollection(MENU_NAME),[createMenuContext,createMenuScope]=createContextScope$2(MENU_NAME,[createCollectionScope$3,createPopperScope,createRovingFocusGroupScope]),usePopperScope$3=createPopperScope(),useRovingFocusGroupScope$1=createRovingFocusGroupScope(),[MenuProvider,useMenuContext]=createMenuContext(MENU_NAME),[MenuRootProvider,useMenuRootContext]=createMenuContext(MENU_NAME),Menu=t=>{const{__scopeMenu:e,open:n=!1,children:o,dir:l,onOpenChange:d,modal:f=!0}=t,g=usePopperScope$3(e),[b,_]=React__namespace.useState(null),S=React__namespace.useRef(!1),R=useCallbackRef$1(d),C=useDirection(l);return React__namespace.useEffect(()=>{const E=()=>{S.current=!0,document.addEventListener("pointerdown",A,{capture:!0,once:!0}),document.addEventListener("pointermove",A,{capture:!0,once:!0})},A=()=>S.current=!1;return document.addEventListener("keydown",E,{capture:!0}),()=>{document.removeEventListener("keydown",E,{capture:!0}),document.removeEventListener("pointerdown",A,{capture:!0}),document.removeEventListener("pointermove",A,{capture:!0})}},[]),jsxRuntime.jsx(Root2$7,{...g,children:jsxRuntime.jsx(MenuProvider,{scope:e,open:n,onOpenChange:R,content:b,onContentChange:_,children:jsxRuntime.jsx(MenuRootProvider,{scope:e,onClose:React__namespace.useCallback(()=>R(!1),[R]),isUsingKeyboardRef:S,dir:C,modal:f,children:o})})})};Menu.displayName=MENU_NAME;var ANCHOR_NAME$1="MenuAnchor",MenuAnchor=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t,l=usePopperScope$3(n);return jsxRuntime.jsx(Anchor,{...l,...o,ref:e})});MenuAnchor.displayName=ANCHOR_NAME$1;var PORTAL_NAME$5="MenuPortal",[PortalProvider$2,usePortalContext$2]=createMenuContext(PORTAL_NAME$5,{forceMount:void 0}),MenuPortal=t=>{const{__scopeMenu:e,forceMount:n,children:o,container:l}=t,d=useMenuContext(PORTAL_NAME$5,e);return jsxRuntime.jsx(PortalProvider$2,{scope:e,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};MenuPortal.displayName=PORTAL_NAME$5;var CONTENT_NAME$8="MenuContent",[MenuContentProvider,useMenuContentContext]=createMenuContext(CONTENT_NAME$8),MenuContent=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$2(CONTENT_NAME$8,t.__scopeMenu),{forceMount:o=n.forceMount,...l}=t,d=useMenuContext(CONTENT_NAME$8,t.__scopeMenu),f=useMenuRootContext(CONTENT_NAME$8,t.__scopeMenu);return jsxRuntime.jsx(Collection$3.Provider,{scope:t.__scopeMenu,children:jsxRuntime.jsx(Presence,{present:o||d.open,children:jsxRuntime.jsx(Collection$3.Slot,{scope:t.__scopeMenu,children:f.modal?jsxRuntime.jsx(MenuRootContentModal,{...l,ref:e}):jsxRuntime.jsx(MenuRootContentNonModal,{...l,ref:e})})})})}),MenuRootContentModal=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(CONTENT_NAME$8,t.__scopeMenu),o=React__namespace.useRef(null),l=useComposedRefs(e,o);return React__namespace.useEffect(()=>{const d=o.current;if(d)return hideOthers(d)},[]),jsxRuntime.jsx(MenuContentImpl,{...t,ref:l,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:composeEventHandlers(t.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),MenuRootContentNonModal=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(CONTENT_NAME$8,t.__scopeMenu);return jsxRuntime.jsx(MenuContentImpl,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Slot$3=createSlot$3("MenuContent.ScrollLock"),MenuContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:l,onOpenAutoFocus:d,onCloseAutoFocus:f,disableOutsidePointerEvents:g,onEntryFocus:b,onEscapeKeyDown:_,onPointerDownOutside:S,onFocusOutside:R,onInteractOutside:C,onDismiss:E,disableOutsideScroll:A,...M}=t,I=useMenuContext(CONTENT_NAME$8,n),j=useMenuRootContext(CONTENT_NAME$8,n),F=usePopperScope$3(n),z=useRovingFocusGroupScope$1(n),Q=useCollection$3(n),[O,V]=React__namespace.useState(null),te=React__namespace.useRef(null),ne=useComposedRefs(e,te,I.onContentChange),ae=React__namespace.useRef(0),$e=React__namespace.useRef(""),ge=React__namespace.useRef(0),se=React__namespace.useRef(null),je=React__namespace.useRef("right"),Ae=React__namespace.useRef(0),Ne=A?ReactRemoveScroll:React__namespace.Fragment,Ve=A?{as:Slot$3,allowPinchZoom:!0}:void 0,Fe=Be=>{var Ke,at;const Ue=$e.current+Be,ze=Q().filter(nt=>!nt.disabled),He=document.activeElement,Qe=(Ke=ze.find(nt=>nt.ref.current===He))==null?void 0:Ke.textValue,et=ze.map(nt=>nt.textValue),Je=getNextMatch(et,Ue,Qe),Ze=(at=ze.find(nt=>nt.textValue===Je))==null?void 0:at.ref.current;(function nt(st){$e.current=st,window.clearTimeout(ae.current),st!==""&&(ae.current=window.setTimeout(()=>nt(""),1e3))})(Ue),Ze&&setTimeout(()=>Ze.focus())};React__namespace.useEffect(()=>()=>window.clearTimeout(ae.current),[]),useFocusGuards();const Oe=React__namespace.useCallback(Be=>{var ze,He;return je.current===((ze=se.current)==null?void 0:ze.side)&&isPointerInGraceArea(Be,(He=se.current)==null?void 0:He.area)},[]);return jsxRuntime.jsx(MenuContentProvider,{scope:n,searchRef:$e,onItemEnter:React__namespace.useCallback(Be=>{Oe(Be)&&Be.preventDefault()},[Oe]),onItemLeave:React__namespace.useCallback(Be=>{var Ue;Oe(Be)||((Ue=te.current)==null||Ue.focus(),V(null))},[Oe]),onTriggerLeave:React__namespace.useCallback(Be=>{Oe(Be)&&Be.preventDefault()},[Oe]),pointerGraceTimerRef:ge,onPointerGraceIntentChange:React__namespace.useCallback(Be=>{se.current=Be},[]),children:jsxRuntime.jsx(Ne,{...Ve,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:l,onMountAutoFocus:composeEventHandlers(d,Be=>{var Ue;Be.preventDefault(),(Ue=te.current)==null||Ue.focus({preventScroll:!0})}),onUnmountAutoFocus:f,children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:g,onEscapeKeyDown:_,onPointerDownOutside:S,onFocusOutside:R,onInteractOutside:C,onDismiss:E,children:jsxRuntime.jsx(Root$c,{asChild:!0,...z,dir:j.dir,orientation:"vertical",loop:o,currentTabStopId:O,onCurrentTabStopIdChange:V,onEntryFocus:composeEventHandlers(b,Be=>{j.isUsingKeyboardRef.current||Be.preventDefault()}),preventScrollOnEntryFocus:!0,children:jsxRuntime.jsx(Content$2,{role:"menu","aria-orientation":"vertical","data-state":getOpenState(I.open),"data-radix-menu-content":"",dir:j.dir,...F,...M,ref:ne,style:{outline:"none",...M.style},onKeyDown:composeEventHandlers(M.onKeyDown,Be=>{const ze=Be.target.closest("[data-radix-menu-content]")===Be.currentTarget,He=Be.ctrlKey||Be.altKey||Be.metaKey,Qe=Be.key.length===1;ze&&(Be.key==="Tab"&&Be.preventDefault(),!He&&Qe&&Fe(Be.key));const et=te.current;if(Be.target!==et||!FIRST_LAST_KEYS.includes(Be.key))return;Be.preventDefault();const Ze=Q().filter(Ke=>!Ke.disabled).map(Ke=>Ke.ref.current);LAST_KEYS.includes(Be.key)&&Ze.reverse(),focusFirst$1(Ze)}),onBlur:composeEventHandlers(t.onBlur,Be=>{Be.currentTarget.contains(Be.target)||(window.clearTimeout(ae.current),$e.current="")}),onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(Be=>{const Ue=Be.target,ze=Ae.current!==Be.clientX;if(Be.currentTarget.contains(Ue)&&ze){const He=Be.clientX>Ae.current?"right":"left";je.current=He,Ae.current=Be.clientX}}))})})})})})})});MenuContent.displayName=CONTENT_NAME$8;var GROUP_NAME$2="MenuGroup",MenuGroup=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive$4.div,{role:"group",...o,ref:e})});MenuGroup.displayName=GROUP_NAME$2;var LABEL_NAME$2="MenuLabel",MenuLabel=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive$4.div,{...o,ref:e})});MenuLabel.displayName=LABEL_NAME$2;var ITEM_NAME$3="MenuItem",ITEM_SELECT="menu.itemSelect",MenuItem=React__namespace.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:o,...l}=t,d=React__namespace.useRef(null),f=useMenuRootContext(ITEM_NAME$3,t.__scopeMenu),g=useMenuContentContext(ITEM_NAME$3,t.__scopeMenu),b=useComposedRefs(e,d),_=React__namespace.useRef(!1),S=()=>{const R=d.current;if(!n&&R){const C=new CustomEvent(ITEM_SELECT,{bubbles:!0,cancelable:!0});R.addEventListener(ITEM_SELECT,E=>o==null?void 0:o(E),{once:!0}),dispatchDiscreteCustomEvent(R,C),C.defaultPrevented?_.current=!1:f.onClose()}};return jsxRuntime.jsx(MenuItemImpl,{...l,ref:b,disabled:n,onClick:composeEventHandlers(t.onClick,S),onPointerDown:R=>{var C;(C=t.onPointerDown)==null||C.call(t,R),_.current=!0},onPointerUp:composeEventHandlers(t.onPointerUp,R=>{var C;_.current||(C=R.currentTarget)==null||C.click()}),onKeyDown:composeEventHandlers(t.onKeyDown,R=>{const C=g.searchRef.current!=="";n||C&&R.key===" "||SELECTION_KEYS$1.includes(R.key)&&(R.currentTarget.click(),R.preventDefault())})})});MenuItem.displayName=ITEM_NAME$3;var MenuItemImpl=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:o=!1,textValue:l,...d}=t,f=useMenuContentContext(ITEM_NAME$3,n),g=useRovingFocusGroupScope$1(n),b=React__namespace.useRef(null),_=useComposedRefs(e,b),[S,R]=React__namespace.useState(!1),[C,E]=React__namespace.useState("");return React__namespace.useEffect(()=>{const A=b.current;A&&E((A.textContent??"").trim())},[d.children]),jsxRuntime.jsx(Collection$3.ItemSlot,{scope:n,disabled:o,textValue:l??C,children:jsxRuntime.jsx(Item$3,{asChild:!0,...g,focusable:!o,children:jsxRuntime.jsx(Primitive$4.div,{role:"menuitem","data-highlighted":S?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...d,ref:_,onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(A=>{o?f.onItemLeave(A):(f.onItemEnter(A),A.defaultPrevented||A.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:composeEventHandlers(t.onPointerLeave,whenMouse(A=>f.onItemLeave(A))),onFocus:composeEventHandlers(t.onFocus,()=>R(!0)),onBlur:composeEventHandlers(t.onBlur,()=>R(!1))})})})}),CHECKBOX_ITEM_NAME$1="MenuCheckboxItem",MenuCheckboxItem=React__namespace.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:o,...l}=t;return jsxRuntime.jsx(ItemIndicatorProvider,{scope:t.__scopeMenu,checked:n,children:jsxRuntime.jsx(MenuItem,{role:"menuitemcheckbox","aria-checked":isIndeterminate$1(n)?"mixed":n,...l,ref:e,"data-state":getCheckedState(n),onSelect:composeEventHandlers(l.onSelect,()=>o==null?void 0:o(isIndeterminate$1(n)?!0:!n),{checkForDefaultPrevented:!1})})})});MenuCheckboxItem.displayName=CHECKBOX_ITEM_NAME$1;var RADIO_GROUP_NAME$1="MenuRadioGroup",[RadioGroupProvider,useRadioGroupContext]=createMenuContext(RADIO_GROUP_NAME$1,{value:void 0,onValueChange:()=>{}}),MenuRadioGroup=React__namespace.forwardRef((t,e)=>{const{value:n,onValueChange:o,...l}=t,d=useCallbackRef$1(o);return jsxRuntime.jsx(RadioGroupProvider,{scope:t.__scopeMenu,value:n,onValueChange:d,children:jsxRuntime.jsx(MenuGroup,{...l,ref:e})})});MenuRadioGroup.displayName=RADIO_GROUP_NAME$1;var RADIO_ITEM_NAME$1="MenuRadioItem",MenuRadioItem=React__namespace.forwardRef((t,e)=>{const{value:n,...o}=t,l=useRadioGroupContext(RADIO_ITEM_NAME$1,t.__scopeMenu),d=n===l.value;return jsxRuntime.jsx(ItemIndicatorProvider,{scope:t.__scopeMenu,checked:d,children:jsxRuntime.jsx(MenuItem,{role:"menuitemradio","aria-checked":d,...o,ref:e,"data-state":getCheckedState(d),onSelect:composeEventHandlers(o.onSelect,()=>{var f;return(f=l.onValueChange)==null?void 0:f.call(l,n)},{checkForDefaultPrevented:!1})})})});MenuRadioItem.displayName=RADIO_ITEM_NAME$1;var ITEM_INDICATOR_NAME$1="MenuItemIndicator",[ItemIndicatorProvider,useItemIndicatorContext]=createMenuContext(ITEM_INDICATOR_NAME$1,{checked:!1}),MenuItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:o,...l}=t,d=useItemIndicatorContext(ITEM_INDICATOR_NAME$1,n);return jsxRuntime.jsx(Presence,{present:o||isIndeterminate$1(d.checked)||d.checked===!0,children:jsxRuntime.jsx(Primitive$4.span,{...l,ref:e,"data-state":getCheckedState(d.checked)})})});MenuItemIndicator.displayName=ITEM_INDICATOR_NAME$1;var SEPARATOR_NAME$2="MenuSeparator",MenuSeparator=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive$4.div,{role:"separator","aria-orientation":"horizontal",...o,ref:e})});MenuSeparator.displayName=SEPARATOR_NAME$2;var ARROW_NAME$4="MenuArrow",MenuArrow=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t,l=usePopperScope$3(n);return jsxRuntime.jsx(Arrow,{...l,...o,ref:e})});MenuArrow.displayName=ARROW_NAME$4;var SUB_NAME="MenuSub",[MenuSubProvider,useMenuSubContext]=createMenuContext(SUB_NAME),MenuSub=t=>{const{__scopeMenu:e,children:n,open:o=!1,onOpenChange:l}=t,d=useMenuContext(SUB_NAME,e),f=usePopperScope$3(e),[g,b]=React__namespace.useState(null),[_,S]=React__namespace.useState(null),R=useCallbackRef$1(l);return React__namespace.useEffect(()=>(d.open===!1&&R(!1),()=>R(!1)),[d.open,R]),jsxRuntime.jsx(Root2$7,{...f,children:jsxRuntime.jsx(MenuProvider,{scope:e,open:o,onOpenChange:R,content:_,onContentChange:S,children:jsxRuntime.jsx(MenuSubProvider,{scope:e,contentId:useId(),triggerId:useId(),trigger:g,onTriggerChange:b,children:n})})})};MenuSub.displayName=SUB_NAME;var SUB_TRIGGER_NAME$1="MenuSubTrigger",MenuSubTrigger=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),o=useMenuRootContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),l=useMenuSubContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),d=useMenuContentContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),f=React__namespace.useRef(null),{pointerGraceTimerRef:g,onPointerGraceIntentChange:b}=d,_={__scopeMenu:t.__scopeMenu},S=React__namespace.useCallback(()=>{f.current&&window.clearTimeout(f.current),f.current=null},[]);return React__namespace.useEffect(()=>S,[S]),React__namespace.useEffect(()=>{const R=g.current;return()=>{window.clearTimeout(R),b(null)}},[g,b]),jsxRuntime.jsx(MenuAnchor,{asChild:!0,..._,children:jsxRuntime.jsx(MenuItemImpl,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":l.contentId,"data-state":getOpenState(n.open),...t,ref:composeRefs(e,l.onTriggerChange),onClick:R=>{var C;(C=t.onClick)==null||C.call(t,R),!(t.disabled||R.defaultPrevented)&&(R.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(R=>{d.onItemEnter(R),!R.defaultPrevented&&!t.disabled&&!n.open&&!f.current&&(d.onPointerGraceIntentChange(null),f.current=window.setTimeout(()=>{n.onOpenChange(!0),S()},100))})),onPointerLeave:composeEventHandlers(t.onPointerLeave,whenMouse(R=>{var E,A;S();const C=(E=n.content)==null?void 0:E.getBoundingClientRect();if(C){const M=(A=n.content)==null?void 0:A.dataset.side,I=M==="right",j=I?-5:5,F=C[I?"left":"right"],z=C[I?"right":"left"];d.onPointerGraceIntentChange({area:[{x:R.clientX+j,y:R.clientY},{x:F,y:C.top},{x:z,y:C.top},{x:z,y:C.bottom},{x:F,y:C.bottom}],side:M}),window.clearTimeout(g.current),g.current=window.setTimeout(()=>d.onPointerGraceIntentChange(null),300)}else{if(d.onTriggerLeave(R),R.defaultPrevented)return;d.onPointerGraceIntentChange(null)}})),onKeyDown:composeEventHandlers(t.onKeyDown,R=>{var E;const C=d.searchRef.current!=="";t.disabled||C&&R.key===" "||SUB_OPEN_KEYS[o.dir].includes(R.key)&&(n.onOpenChange(!0),(E=n.content)==null||E.focus(),R.preventDefault())})})})});MenuSubTrigger.displayName=SUB_TRIGGER_NAME$1;var SUB_CONTENT_NAME$1="MenuSubContent",MenuSubContent=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$2(CONTENT_NAME$8,t.__scopeMenu),{forceMount:o=n.forceMount,...l}=t,d=useMenuContext(CONTENT_NAME$8,t.__scopeMenu),f=useMenuRootContext(CONTENT_NAME$8,t.__scopeMenu),g=useMenuSubContext(SUB_CONTENT_NAME$1,t.__scopeMenu),b=React__namespace.useRef(null),_=useComposedRefs(e,b);return jsxRuntime.jsx(Collection$3.Provider,{scope:t.__scopeMenu,children:jsxRuntime.jsx(Presence,{present:o||d.open,children:jsxRuntime.jsx(Collection$3.Slot,{scope:t.__scopeMenu,children:jsxRuntime.jsx(MenuContentImpl,{id:g.contentId,"aria-labelledby":g.triggerId,...l,ref:_,align:"start",side:f.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:S=>{var R;f.isUsingKeyboardRef.current&&((R=b.current)==null||R.focus()),S.preventDefault()},onCloseAutoFocus:S=>S.preventDefault(),onFocusOutside:composeEventHandlers(t.onFocusOutside,S=>{S.target!==g.trigger&&d.onOpenChange(!1)}),onEscapeKeyDown:composeEventHandlers(t.onEscapeKeyDown,S=>{f.onClose(),S.preventDefault()}),onKeyDown:composeEventHandlers(t.onKeyDown,S=>{var E;const R=S.currentTarget.contains(S.target),C=SUB_CLOSE_KEYS[f.dir].includes(S.key);R&&C&&(d.onOpenChange(!1),(E=g.trigger)==null||E.focus(),S.preventDefault())})})})})})});MenuSubContent.displayName=SUB_CONTENT_NAME$1;function getOpenState(t){return t?"open":"closed"}function isIndeterminate$1(t){return t==="indeterminate"}function getCheckedState(t){return isIndeterminate$1(t)?"indeterminate":t?"checked":"unchecked"}function focusFirst$1(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function wrapArray$1(t,e){return t.map((n,o)=>t[(e+o)%t.length])}function getNextMatch(t,e,n){const l=e.length>1&&Array.from(e).every(_=>_===e[0])?e[0]:e,d=n?t.indexOf(n):-1;let f=wrapArray$1(t,Math.max(d,0));l.length===1&&(f=f.filter(_=>_!==n));const b=f.find(_=>_.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function isPointInPolygon$1(t,e){const{x:n,y:o}=t;let l=!1;for(let d=0,f=e.length-1;d<e.length;f=d++){const g=e[d],b=e[f],_=g.x,S=g.y,R=b.x,C=b.y;S>o!=C>o&&n<(R-_)*(o-S)/(C-S)+_&&(l=!l)}return l}function isPointerInGraceArea(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return isPointInPolygon$1(n,e)}function whenMouse(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Root3$1=Menu,Anchor2$1=MenuAnchor,Portal$3=MenuPortal,Content2$6=MenuContent,Group$1=MenuGroup,Label$4=MenuLabel,Item2$1=MenuItem,CheckboxItem=MenuCheckboxItem,RadioGroup=MenuRadioGroup,RadioItem=MenuRadioItem,ItemIndicator$1=MenuItemIndicator,Separator$3=MenuSeparator,Arrow2=MenuArrow,Sub=MenuSub,SubTrigger=MenuSubTrigger,SubContent=MenuSubContent,DROPDOWN_MENU_NAME="DropdownMenu",[createDropdownMenuContext]=createContextScope$2(DROPDOWN_MENU_NAME,[createMenuScope]),useMenuScope=createMenuScope(),[DropdownMenuProvider,useDropdownMenuContext]=createDropdownMenuContext(DROPDOWN_MENU_NAME),DropdownMenu$1=t=>{const{__scopeDropdownMenu:e,children:n,dir:o,open:l,defaultOpen:d,onOpenChange:f,modal:g=!0}=t,b=useMenuScope(e),_=React__namespace.useRef(null),[S,R]=useControllableState({prop:l,defaultProp:d??!1,onChange:f,caller:DROPDOWN_MENU_NAME});return jsxRuntime.jsx(DropdownMenuProvider,{scope:e,triggerId:useId(),triggerRef:_,contentId:useId(),open:S,onOpenChange:R,onOpenToggle:React__namespace.useCallback(()=>R(C=>!C),[R]),modal:g,children:jsxRuntime.jsx(Root3$1,{...b,open:S,onOpenChange:R,dir:o,modal:g,children:n})})};DropdownMenu$1.displayName=DROPDOWN_MENU_NAME;var TRIGGER_NAME$8="DropdownMenuTrigger",DropdownMenuTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...l}=t,d=useDropdownMenuContext(TRIGGER_NAME$8,n),f=useMenuScope(n);return jsxRuntime.jsx(Anchor2$1,{asChild:!0,...f,children:jsxRuntime.jsx(Primitive$4.button,{type:"button",id:d.triggerId,"aria-haspopup":"menu","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":d.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...l,ref:composeRefs(e,d.triggerRef),onPointerDown:composeEventHandlers(t.onPointerDown,g=>{!o&&g.button===0&&g.ctrlKey===!1&&(d.onOpenToggle(),d.open||g.preventDefault())}),onKeyDown:composeEventHandlers(t.onKeyDown,g=>{o||(["Enter"," "].includes(g.key)&&d.onOpenToggle(),g.key==="ArrowDown"&&d.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(g.key)&&g.preventDefault())})})})});DropdownMenuTrigger$1.displayName=TRIGGER_NAME$8;var PORTAL_NAME$4="DropdownMenuPortal",DropdownMenuPortal$1=t=>{const{__scopeDropdownMenu:e,...n}=t,o=useMenuScope(e);return jsxRuntime.jsx(Portal$3,{...o,...n})};DropdownMenuPortal$1.displayName=PORTAL_NAME$4;var CONTENT_NAME$7="DropdownMenuContent",DropdownMenuContent$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useDropdownMenuContext(CONTENT_NAME$7,n),d=useMenuScope(n),f=React__namespace.useRef(!1);return jsxRuntime.jsx(Content2$6,{id:l.contentId,"aria-labelledby":l.triggerId,...d,...o,ref:e,onCloseAutoFocus:composeEventHandlers(t.onCloseAutoFocus,g=>{var b;f.current||(b=l.triggerRef.current)==null||b.focus(),f.current=!1,g.preventDefault()}),onInteractOutside:composeEventHandlers(t.onInteractOutside,g=>{const b=g.detail.originalEvent,_=b.button===0&&b.ctrlKey===!0,S=b.button===2||_;(!l.modal||S)&&(f.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DropdownMenuContent$1.displayName=CONTENT_NAME$7;var GROUP_NAME$1="DropdownMenuGroup",DropdownMenuGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Group$1,{...l,...o,ref:e})});DropdownMenuGroup$1.displayName=GROUP_NAME$1;var LABEL_NAME$1="DropdownMenuLabel",DropdownMenuLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Label$4,{...l,...o,ref:e})});DropdownMenuLabel$1.displayName=LABEL_NAME$1;var ITEM_NAME$2="DropdownMenuItem",DropdownMenuItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Item2$1,{...l,...o,ref:e})});DropdownMenuItem$1.displayName=ITEM_NAME$2;var CHECKBOX_ITEM_NAME="DropdownMenuCheckboxItem",DropdownMenuCheckboxItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(CheckboxItem,{...l,...o,ref:e})});DropdownMenuCheckboxItem$1.displayName=CHECKBOX_ITEM_NAME;var RADIO_GROUP_NAME="DropdownMenuRadioGroup",DropdownMenuRadioGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(RadioGroup,{...l,...o,ref:e})});DropdownMenuRadioGroup$1.displayName=RADIO_GROUP_NAME;var RADIO_ITEM_NAME="DropdownMenuRadioItem",DropdownMenuRadioItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(RadioItem,{...l,...o,ref:e})});DropdownMenuRadioItem$1.displayName=RADIO_ITEM_NAME;var INDICATOR_NAME$2="DropdownMenuItemIndicator",DropdownMenuItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(ItemIndicator$1,{...l,...o,ref:e})});DropdownMenuItemIndicator.displayName=INDICATOR_NAME$2;var SEPARATOR_NAME$1="DropdownMenuSeparator",DropdownMenuSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Separator$3,{...l,...o,ref:e})});DropdownMenuSeparator$1.displayName=SEPARATOR_NAME$1;var ARROW_NAME$3="DropdownMenuArrow",DropdownMenuArrow=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Arrow2,{...l,...o,ref:e})});DropdownMenuArrow.displayName=ARROW_NAME$3;var DropdownMenuSub$1=t=>{const{__scopeDropdownMenu:e,children:n,open:o,onOpenChange:l,defaultOpen:d}=t,f=useMenuScope(e),[g,b]=useControllableState({prop:o,defaultProp:d??!1,onChange:l,caller:"DropdownMenuSub"});return jsxRuntime.jsx(Sub,{...f,open:g,onOpenChange:b,children:n})},SUB_TRIGGER_NAME="DropdownMenuSubTrigger",DropdownMenuSubTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(SubTrigger,{...l,...o,ref:e})});DropdownMenuSubTrigger$1.displayName=SUB_TRIGGER_NAME;var SUB_CONTENT_NAME="DropdownMenuSubContent",DropdownMenuSubContent$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(SubContent,{...l,...o,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DropdownMenuSubContent$1.displayName=SUB_CONTENT_NAME;var Root2$6=DropdownMenu$1,Trigger$5=DropdownMenuTrigger$1,Portal2$1=DropdownMenuPortal$1,Content2$5=DropdownMenuContent$1,Group2=DropdownMenuGroup$1,Label2=DropdownMenuLabel$1,Item2=DropdownMenuItem$1,CheckboxItem2=DropdownMenuCheckboxItem$1,RadioGroup2=DropdownMenuRadioGroup$1,RadioItem2=DropdownMenuRadioItem$1,ItemIndicator2=DropdownMenuItemIndicator,Separator2=DropdownMenuSeparator$1,Sub2=DropdownMenuSub$1,SubTrigger2=DropdownMenuSubTrigger$1,SubContent2=DropdownMenuSubContent$1;const DropdownMenu=Root2$6,DropdownMenuTrigger=Trigger$5,DropdownMenuGroup=Group2,DropdownMenuPortal=Portal2$1,DropdownMenuSub=Sub2,DropdownMenuRadioGroup=RadioGroup2,DropdownMenuSubTrigger=React__namespace.forwardRef(({className:t,inset:e,children:n,...o},l)=>jsxRuntime.jsxs(SubTrigger2,{ref:l,className:cn("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",t),...o,children:[n,jsxRuntime.jsx(ChevronRight,{className:"ml-auto"})]}));DropdownMenuSubTrigger.displayName=SubTrigger2.displayName;const DropdownMenuSubContent=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(SubContent2,{ref:n,className:cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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 origin-[--radix-dropdown-menu-content-transform-origin]",t),...e}));DropdownMenuSubContent.displayName=SubContent2.displayName;const DropdownMenuContent=React__namespace.forwardRef(({className:t,sideOffset:e=4,...n},o)=>jsxRuntime.jsx(Portal2$1,{children:jsxRuntime.jsx(Content2$5,{ref:o,sideOffset:e,className:cn("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-dropdown-menu-content-transform-origin]",t),...n})}));DropdownMenuContent.displayName=Content2$5.displayName;const DropdownMenuItem=React__namespace.forwardRef(({className:t,inset:e,...n},o)=>jsxRuntime.jsx(Item2,{ref:o,className:cn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",e&&"pl-8",t),...n}));DropdownMenuItem.displayName=Item2.displayName;const DropdownMenuCheckboxItem=React__namespace.forwardRef(({className:t,children:e,checked:n,...o},l)=>jsxRuntime.jsxs(CheckboxItem2,{ref:l,className:cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...o,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator2,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),e]}));DropdownMenuCheckboxItem.displayName=CheckboxItem2.displayName;const DropdownMenuRadioItem=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(RadioItem2,{ref:o,className:cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator2,{children:jsxRuntime.jsx(Circle,{className:"h-2 w-2 fill-current"})})}),e]}));DropdownMenuRadioItem.displayName=RadioItem2.displayName;const DropdownMenuLabel=React__namespace.forwardRef(({className:t,inset:e,...n},o)=>jsxRuntime.jsx(Label2,{ref:o,className:cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));DropdownMenuLabel.displayName=Label2.displayName;const DropdownMenuSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator2,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",t),...e}));DropdownMenuSeparator.displayName=Separator2.displayName;const DropdownMenuShortcut=({className:t,...e})=>jsxRuntime.jsx("span",{className:cn("ml-auto text-xs tracking-widest opacity-60",t),...e});DropdownMenuShortcut.displayName="DropdownMenuShortcut";function ProductInventoryGrid({inventory:t,showBinLocation:e,className:n}){const o=(F,z,Q=!1,O=!0)=>{const V=F.WarehouseType==="Fulfillment Center",te=V?"bg-white":"bg-white/70 text-gray-600",ne=O&&z>0?"border-t":"",ae=Q?"border-r":"",$e=F.Status??"Unknown",ge=$e==="Active";let se=V?"bg-emerald-100 text-emerald-800 ring-1 ring-emerald-200":"bg-gray-100 text-gray-700";switch($e){case"Closing":se="bg-yellow-100 text-yellow-800 ring-1 ring-yellow-200";break;case"Closed":se="bg-red-100 text-red-800 ring-1 ring-red-200";break}return jsxRuntime.jsxs("article",{"aria-labelledby":`wh-${F.WarehouseId}-name`,className:`p-3 text-sm ${ne} ${ae} ${te}`,children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("h3",{id:`wh-${F.WarehouseId}-name`,className:`text-sm font-medium ${V?"text-gray-900":"text-gray-800"}`,children:F.Name}),jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-2 rounded-full px-2 py-0.5 text-xs font-semibold ${se}`,"aria-hidden":"false",title:ge?V?"Fulfillment Center":"Satellite Warehouse":`Status: ${$e}`,children:[V?jsxRuntime.jsx(Warehouse,{className:"h-3 w-3","aria-hidden":"true"}):jsxRuntime.jsx(Truck,{className:`h-3 w-3 ${ge?"opacity-80":"opacity-95"}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"sr-only",children:ge?F.WarehouseType?`${F.WarehouseType} warehouse`:"Warehouse":`Status: ${$e}`}),jsxRuntime.jsx("span",{"aria-hidden":"true",children:ge?F.WarehouseType||(V?"Fulfillment Center":"Satellite"):$e})]})]}),jsxRuntime.jsx("div",{className:"text-right",children:jsxRuntime.jsx("div",{className:"text-sm font-medium",children:formatNumber(F.AvailableQuantity??0)})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-1 text-xs text-gray-600",children:[jsxRuntime.jsx("span",{children:"Expecting"}),jsxRuntime.jsx("span",{children:F.PurchaseOrderQuantity?formatNumber(F.PurchaseOrderQuantity):"—"})]}),e&&jsxRuntime.jsxs("div",{className:"flex justify-between mt-1 text-xs text-gray-600",children:[jsxRuntime.jsx("span",{children:"Bin Location"}),jsxRuntime.jsx("span",{children:F.BinLocation||"—"})]})]},`warehouse-${F.WarehouseId}`)},l=["MTL","TOR"],d=["VAN","EDM"],f=[...t].sort((F,z)=>(F.Name||"").localeCompare(z.Name||"")),g=f.filter(F=>F.Country==="US"),b=f.filter(F=>F.Country==="CA"),_=f.filter(F=>d.includes(F.WarehouseId||"")),S=f.filter(F=>l.includes(F.WarehouseId||"")),R=b.filter(F=>!l.includes(F.WarehouseId||"")&&!d.includes(F.WarehouseId||"")),C=F=>F.reduce((z,Q)=>z+(Q.AvailableQuantity||0),0),E=C(b),A=C(S),M=C(_),I=C(g),j=E+I;return jsxRuntime.jsxs("div",{className:`border rounded-md overflow-hidden ${n??""}`,children:[b.length>0&&g.length>0&&jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-b",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"Total"}),jsxRuntime.jsx("span",{children:j})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),b.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-b bg-gray-50",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"Canada"}),jsxRuntime.jsx("span",{children:formatNumber(E)})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2",children:[jsxRuntime.jsxs("div",{className:"border-r",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"West"}),jsxRuntime.jsx("span",{children:formatNumber(M)})]}),_.map((F,z)=>o(F,z))]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"East"}),jsxRuntime.jsx("span",{children:formatNumber(A)})]}),S.map((F,z)=>o(F,z))]})]}),R.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"border-t p-3 font-semibold text-sm",children:jsxRuntime.jsx("span",{children:"Other"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-2",children:R.map((F,z)=>o(F,z,z%2===0,!0))})]})]}),g.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-t bg-gray-50",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"United States"}),jsxRuntime.jsx("span",{children:formatNumber(I)})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2",children:g.map((F,z)=>o(F,z,z%2===0,!0))})]}),t.length===0&&jsxRuntime.jsx("div",{className:"p-6 text-center text-gray-500",children:"No inventory information available"})]})}var REACT_LAZY_TYPE=Symbol.for("react.lazy"),use=React__namespace[" use ".trim().toString()];function isPromiseLike(t){return typeof t=="object"&&t!==null&&"then"in t}function isLazyComponent(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===REACT_LAZY_TYPE&&"_payload"in t&&isPromiseLike(t._payload)}function createSlot$2(t){const e=createSlotClone$2(t),n=React__namespace.forwardRef((o,l)=>{let{children:d,...f}=o;isLazyComponent(d)&&typeof use=="function"&&(d=use(d._payload));const g=React__namespace.Children.toArray(d),b=g.find(isSlottable$2);if(b){const _=b.props.children,S=g.map(R=>R===b?React__namespace.Children.count(_)>1?React__namespace.Children.only(null):React__namespace.isValidElement(_)?_.props.children:null:R);return jsxRuntime.jsx(e,{...f,ref:l,children:React__namespace.isValidElement(_)?React__namespace.cloneElement(_,void 0,S):null})}return jsxRuntime.jsx(e,{...f,ref:l,children:d})});return n.displayName=`${t}.Slot`,n}var Slot$2=createSlot$2("Slot");function createSlotClone$2(t){const e=React__namespace.forwardRef((n,o)=>{let{children:l,...d}=n;if(isLazyComponent(l)&&typeof use=="function"&&(l=use(l._payload)),React__namespace.isValidElement(l)){const f=getElementRef$2(l),g=mergeProps$2(d,l.props);return l.type!==React__namespace.Fragment&&(g.ref=o?composeRefs(o,f):f),React__namespace.cloneElement(l,g)}return React__namespace.Children.count(l)>1?React__namespace.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var SLOTTABLE_IDENTIFIER$4=Symbol("radix.slottable");function isSlottable$2(t){return React__namespace.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===SLOTTABLE_IDENTIFIER$4}function mergeProps$2(t,e){const n={...e};for(const o in e){const l=t[o],d=e[o];/^on[A-Z]/.test(o)?l&&d?n[o]=(...g)=>{const b=d(...g);return l(...g),b}:l&&(n[o]=l):o==="style"?n[o]={...l,...d}:o==="className"&&(n[o]=[l,d].filter(Boolean).join(" "))}return{...t,...n}}function getElementRef$2(t){var o,l;let e=(o=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(l=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:l.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const falsyToString=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,cx=clsx,cva=(t,e)=>n=>{var o;if((e==null?void 0:e.variants)==null)return cx(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:l,defaultVariants:d}=e,f=Object.keys(l).map(_=>{const S=n==null?void 0:n[_],R=d==null?void 0:d[_];if(S===null)return null;const C=falsyToString(S)||falsyToString(R);return l[_][C]}),g=n&&Object.entries(n).reduce((_,S)=>{let[R,C]=S;return C===void 0||(_[R]=C),_},{}),b=e==null||(o=e.compoundVariants)===null||o===void 0?void 0:o.reduce((_,S)=>{let{class:R,className:C,...E}=S;return Object.entries(E).every(A=>{let[M,I]=A;return Array.isArray(I)?I.includes({...d,...g}[M]):{...d,...g}[M]===I})?[..._,R,C]:_},[]);return cx(t,f,b,n==null?void 0:n.class,n==null?void 0:n.className)},buttonVariants=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input text-foreground bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",defaultOutline:"border border-red-600/30 text-red-600 bg-background shadow-xs hover:bg-red-600/5 ",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",blue:"bg-randmar-blue text-gray-100 shadow-sm hover:bg-randmar-blue/90",red:"bg-randmar-red text-gray-100 shadow-sm hover:bg-randmar-red/90",purple:"bg-randmar-purple text-gray-100 shadow-sm hover:bg-randmar-purple/90",none:""},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Button$1=React__namespace.forwardRef(({className:t,variant:e,size:n,asChild:o=!1,confirmationDialog:l,onClick:d,...f},g)=>{const b=o?Slot$2:"button";if(!l)return jsxRuntime.jsx(b,{className:cn(buttonVariants({variant:e,size:n,className:t})),ref:g,onClick:d,...f});d&&console.warn("Button: You provided both onClick and confirmationDialog props. The onClick prop will be ignored. Use the onConfirm callback in confirmationDialog instead.");const{title:_,content:S,onConfirm:R,confirmText:C="Confirm",cancelText:E="Cancel"}=l,A=()=>{R()};return jsxRuntime.jsxs(Dialog,{children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(b,{className:cn(buttonVariants({variant:e,size:n,className:t})),ref:g,...f})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:_}),jsxRuntime.jsx(DialogDescription,{children:S})]}),jsxRuntime.jsxs(DialogFooter,{className:"flex justify-end gap-2 pt-4",children:[jsxRuntime.jsx(DialogClose,{asChild:!0,children:jsxRuntime.jsx(Button$1,{variant:"outline",children:E})}),jsxRuntime.jsx(DialogClose,{asChild:!0,children:jsxRuntime.jsx(Button$1,{onClick:A,children:C})})]})]})]})});Button$1.displayName="Button";var SLOTTABLE_IDENTIFIER$3=Symbol("radix.slottable");function createSlottable$1(t){const e=({children:n})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=SLOTTABLE_IDENTIFIER$3,e}var VISUALLY_HIDDEN_STYLES=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),NAME$2="VisuallyHidden",VisuallyHidden=React__namespace.forwardRef((t,e)=>jsxRuntime.jsx(Primitive$4.span,{...t,ref:e,style:{...VISUALLY_HIDDEN_STYLES,...t.style}}));VisuallyHidden.displayName=NAME$2;var Root$8=VisuallyHidden,[createTooltipContext]=createContextScope$2("Tooltip",[createPopperScope]),usePopperScope$2=createPopperScope(),PROVIDER_NAME$1="TooltipProvider",DEFAULT_DELAY_DURATION=700,TOOLTIP_OPEN="tooltip.open",[TooltipProviderContextProvider,useTooltipProviderContext]=createTooltipContext(PROVIDER_NAME$1),TooltipProvider$1=t=>{const{__scopeTooltip:e,delayDuration:n=DEFAULT_DELAY_DURATION,skipDelayDuration:o=300,disableHoverableContent:l=!1,children:d}=t,f=React__namespace.useRef(!0),g=React__namespace.useRef(!1),b=React__namespace.useRef(0);return React__namespace.useEffect(()=>{const _=b.current;return()=>window.clearTimeout(_)},[]),jsxRuntime.jsx(TooltipProviderContextProvider,{scope:e,isOpenDelayedRef:f,delayDuration:n,onOpen:React__namespace.useCallback(()=>{window.clearTimeout(b.current),f.current=!1},[]),onClose:React__namespace.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>f.current=!0,o)},[o]),isPointerInTransitRef:g,onPointerInTransitChange:React__namespace.useCallback(_=>{g.current=_},[]),disableHoverableContent:l,children:d})};TooltipProvider$1.displayName=PROVIDER_NAME$1;var TOOLTIP_NAME="Tooltip",[TooltipContextProvider,useTooltipContext]=createTooltipContext(TOOLTIP_NAME),Tooltip$2=t=>{const{__scopeTooltip:e,children:n,open:o,defaultOpen:l,onOpenChange:d,disableHoverableContent:f,delayDuration:g}=t,b=useTooltipProviderContext(TOOLTIP_NAME,t.__scopeTooltip),_=usePopperScope$2(e),[S,R]=React__namespace.useState(null),C=useId(),E=React__namespace.useRef(0),A=f??b.disableHoverableContent,M=g??b.delayDuration,I=React__namespace.useRef(!1),[j,F]=useControllableState({prop:o,defaultProp:l??!1,onChange:te=>{te?(b.onOpen(),document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))):b.onClose(),d==null||d(te)},caller:TOOLTIP_NAME}),z=React__namespace.useMemo(()=>j?I.current?"delayed-open":"instant-open":"closed",[j]),Q=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=0,I.current=!1,F(!0)},[F]),O=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=0,F(!1)},[F]),V=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=window.setTimeout(()=>{I.current=!0,F(!0),E.current=0},M)},[M,F]);return React__namespace.useEffect(()=>()=>{E.current&&(window.clearTimeout(E.current),E.current=0)},[]),jsxRuntime.jsx(Root2$7,{..._,children:jsxRuntime.jsx(TooltipContextProvider,{scope:e,contentId:C,open:j,stateAttribute:z,trigger:S,onTriggerChange:R,onTriggerEnter:React__namespace.useCallback(()=>{b.isOpenDelayedRef.current?V():Q()},[b.isOpenDelayedRef,V,Q]),onTriggerLeave:React__namespace.useCallback(()=>{A?O():(window.clearTimeout(E.current),E.current=0)},[O,A]),onOpen:Q,onClose:O,disableHoverableContent:A,children:n})})};Tooltip$2.displayName=TOOLTIP_NAME;var TRIGGER_NAME$7="TooltipTrigger",TooltipTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,...o}=t,l=useTooltipContext(TRIGGER_NAME$7,n),d=useTooltipProviderContext(TRIGGER_NAME$7,n),f=usePopperScope$2(n),g=React__namespace.useRef(null),b=useComposedRefs(e,g,l.onTriggerChange),_=React__namespace.useRef(!1),S=React__namespace.useRef(!1),R=React__namespace.useCallback(()=>_.current=!1,[]);return React__namespace.useEffect(()=>()=>document.removeEventListener("pointerup",R),[R]),jsxRuntime.jsx(Anchor,{asChild:!0,...f,children:jsxRuntime.jsx(Primitive$4.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...o,ref:b,onPointerMove:composeEventHandlers(t.onPointerMove,C=>{C.pointerType!=="touch"&&!S.current&&!d.isPointerInTransitRef.current&&(l.onTriggerEnter(),S.current=!0)}),onPointerLeave:composeEventHandlers(t.onPointerLeave,()=>{l.onTriggerLeave(),S.current=!1}),onPointerDown:composeEventHandlers(t.onPointerDown,()=>{l.open&&l.onClose(),_.current=!0,document.addEventListener("pointerup",R,{once:!0})}),onFocus:composeEventHandlers(t.onFocus,()=>{_.current||l.onOpen()}),onBlur:composeEventHandlers(t.onBlur,l.onClose),onClick:composeEventHandlers(t.onClick,l.onClose)})})});TooltipTrigger$1.displayName=TRIGGER_NAME$7;var PORTAL_NAME$3="TooltipPortal",[PortalProvider$1,usePortalContext$1]=createTooltipContext(PORTAL_NAME$3,{forceMount:void 0}),TooltipPortal=t=>{const{__scopeTooltip:e,forceMount:n,children:o,container:l}=t,d=useTooltipContext(PORTAL_NAME$3,e);return jsxRuntime.jsx(PortalProvider$1,{scope:e,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};TooltipPortal.displayName=PORTAL_NAME$3;var CONTENT_NAME$6="TooltipContent",TooltipContent$1=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$1(CONTENT_NAME$6,t.__scopeTooltip),{forceMount:o=n.forceMount,side:l="top",...d}=t,f=useTooltipContext(CONTENT_NAME$6,t.__scopeTooltip);return jsxRuntime.jsx(Presence,{present:o||f.open,children:f.disableHoverableContent?jsxRuntime.jsx(TooltipContentImpl,{side:l,...d,ref:e}):jsxRuntime.jsx(TooltipContentHoverable,{side:l,...d,ref:e})})}),TooltipContentHoverable=React__namespace.forwardRef((t,e)=>{const n=useTooltipContext(CONTENT_NAME$6,t.__scopeTooltip),o=useTooltipProviderContext(CONTENT_NAME$6,t.__scopeTooltip),l=React__namespace.useRef(null),d=useComposedRefs(e,l),[f,g]=React__namespace.useState(null),{trigger:b,onClose:_}=n,S=l.current,{onPointerInTransitChange:R}=o,C=React__namespace.useCallback(()=>{g(null),R(!1)},[R]),E=React__namespace.useCallback((A,M)=>{const I=A.currentTarget,j={x:A.clientX,y:A.clientY},F=getExitSideFromRect(j,I.getBoundingClientRect()),z=getPaddedExitPoints(j,F),Q=getPointsFromRect(M.getBoundingClientRect()),O=getHull([...z,...Q]);g(O),R(!0)},[R]);return React__namespace.useEffect(()=>()=>C(),[C]),React__namespace.useEffect(()=>{if(b&&S){const A=I=>E(I,S),M=I=>E(I,b);return b.addEventListener("pointerleave",A),S.addEventListener("pointerleave",M),()=>{b.removeEventListener("pointerleave",A),S.removeEventListener("pointerleave",M)}}},[b,S,E,C]),React__namespace.useEffect(()=>{if(f){const A=M=>{const I=M.target,j={x:M.clientX,y:M.clientY},F=(b==null?void 0:b.contains(I))||(S==null?void 0:S.contains(I)),z=!isPointInPolygon(j,f);F?C():z&&(C(),_())};return document.addEventListener("pointermove",A),()=>document.removeEventListener("pointermove",A)}},[b,S,f,_,C]),jsxRuntime.jsx(TooltipContentImpl,{...t,ref:d})}),[VisuallyHiddenContentContextProvider,useVisuallyHiddenContentContext]=createTooltipContext(TOOLTIP_NAME,{isInside:!1}),Slottable$1=createSlottable$1("TooltipContent"),TooltipContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,children:o,"aria-label":l,onEscapeKeyDown:d,onPointerDownOutside:f,...g}=t,b=useTooltipContext(CONTENT_NAME$6,n),_=usePopperScope$2(n),{onClose:S}=b;return React__namespace.useEffect(()=>(document.addEventListener(TOOLTIP_OPEN,S),()=>document.removeEventListener(TOOLTIP_OPEN,S)),[S]),React__namespace.useEffect(()=>{if(b.trigger){const R=C=>{const E=C.target;E!=null&&E.contains(b.trigger)&&S()};return window.addEventListener("scroll",R,{capture:!0}),()=>window.removeEventListener("scroll",R,{capture:!0})}},[b.trigger,S]),jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:R=>R.preventDefault(),onDismiss:S,children:jsxRuntime.jsxs(Content$2,{"data-state":b.stateAttribute,..._,...g,ref:e,style:{...g.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[jsxRuntime.jsx(Slottable$1,{children:o}),jsxRuntime.jsx(VisuallyHiddenContentContextProvider,{scope:n,isInside:!0,children:jsxRuntime.jsx(Root$8,{id:b.contentId,role:"tooltip",children:l||o})})]})})});TooltipContent$1.displayName=CONTENT_NAME$6;var ARROW_NAME$2="TooltipArrow",TooltipArrow=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,...o}=t,l=usePopperScope$2(n);return useVisuallyHiddenContentContext(ARROW_NAME$2,n).isInside?null:jsxRuntime.jsx(Arrow,{...l,...o,ref:e})});TooltipArrow.displayName=ARROW_NAME$2;function getExitSideFromRect(t,e){const n=Math.abs(e.top-t.y),o=Math.abs(e.bottom-t.y),l=Math.abs(e.right-t.x),d=Math.abs(e.left-t.x);switch(Math.min(n,o,l,d)){case d:return"left";case l:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function getPaddedExitPoints(t,e,n=5){const o=[];switch(e){case"top":o.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":o.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":o.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":o.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return o}function getPointsFromRect(t){const{top:e,right:n,bottom:o,left:l}=t;return[{x:l,y:e},{x:n,y:e},{x:n,y:o},{x:l,y:o}]}function isPointInPolygon(t,e){const{x:n,y:o}=t;let l=!1;for(let d=0,f=e.length-1;d<e.length;f=d++){const g=e[d],b=e[f],_=g.x,S=g.y,R=b.x,C=b.y;S>o!=C>o&&n<(R-_)*(o-S)/(C-S)+_&&(l=!l)}return l}function getHull(t){const e=t.slice();return e.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),getHullPresorted(e)}function getHullPresorted(t){if(t.length<=1)return t.slice();const e=[];for(let o=0;o<t.length;o++){const l=t[o];for(;e.length>=2;){const d=e[e.length-1],f=e[e.length-2];if((d.x-f.x)*(l.y-f.y)>=(d.y-f.y)*(l.x-f.x))e.pop();else break}e.push(l)}e.pop();const n=[];for(let o=t.length-1;o>=0;o--){const l=t[o];for(;n.length>=2;){const d=n[n.length-1],f=n[n.length-2];if((d.x-f.x)*(l.y-f.y)>=(d.y-f.y)*(l.x-f.x))n.pop();else break}n.push(l)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var Provider$1=TooltipProvider$1,Root3=Tooltip$2,Trigger$4=TooltipTrigger$1,Portal$2=TooltipPortal,Content2$4=TooltipContent$1;const TooltipProvider=Provider$1,Tooltip$1=Root3,TooltipTrigger=Trigger$4,TooltipContent=React__namespace.forwardRef(({className:t,sideOffset:e=4,...n},o)=>jsxRuntime.jsx(Portal$2,{children:jsxRuntime.jsx(Content2$4,{ref:o,sideOffset:e,className:cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground 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",t),...n})}));TooltipContent.displayName=Content2$4.displayName;const Input=React__namespace.forwardRef(({className:t,type:e,mask:n,onChange:o,placeholder:l,...d},f)=>{const[g,b]=React__namespace.useState(!1),_=React__namespace.useRef(null),R=l||(n==="phone"?"(999) 999-9999":n==="postal-code-ca"?"A9A 9A9":n==="zip-code-us"?"99999":""),C=()=>n==="phone"?"Only enter numbers. Formatting will be added automatically.":n==="postal-code-ca"?"Enter letters and numbers only. Spacing will be applied automatically.":n==="zip-code-us"?"Only enter numbers. Formatting will be added automatically.":"",E=()=>{b(!0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{b(!1)},3e3)};React__namespace.useEffect(()=>()=>{_.current&&clearTimeout(_.current)},[]);const A=M=>{if(n){const I=M.target.value;let j=I;if(I.length>0){const F=I[I.length-1];/[^a-zA-Z0-9]/.test(F)&&(console.log("Non-alphanumeric detected:",F),E())}if(n==="phone"){const F=I.replace(/\D/g,"");F.length<=3?j=F:F.length<=6?j=`(${F.slice(0,3)}) ${F.slice(3)}`:j=`(${F.slice(0,3)}) ${F.slice(3,6)}-${F.slice(6,10)}`}else if(n==="postal-code-ca"){const F=I.replace(/[^a-zA-Z0-9]/g,"").toUpperCase();let z="";for(let Q=0;Q<Math.min(F.length,6);Q++){const O=F[Q];Q===0||Q===2||Q===4?/[A-Z]/.test(O)&&(z+=O):(Q===1||Q===3||Q===5)&&/[0-9]/.test(O)&&(z+=O)}z.length<=3?j=z:j=`${z.slice(0,3)} ${z.slice(3,6)}`}else if(n==="zip-code-us"){const F=I.replace(/\D/g,"");F.length<=5?j=F:j=`${F.slice(0,5)}-${F.slice(5,9)}`}M.target.value=j}o==null||o(M)};return jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{open:g&&!!n,children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx("input",{type:e,className:cn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),onChange:A,placeholder:R,ref:f,...d})}),jsxRuntime.jsx(TooltipContent,{side:"top",className:"bg-sidebar text-sidebar-foreground",children:C()})]})})});Input.displayName="Input";var NODES$3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Primitive$3=NODES$3.reduce((t,e)=>{const n=createSlot$2(`Primitive.${e}`),o=React__namespace.forwardRef((l,d)=>{const{asChild:f,...g}=l,b=f?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntime.jsx(b,{...g,ref:d})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{}),NAME$1="Separator",DEFAULT_ORIENTATION="horizontal",ORIENTATIONS=["horizontal","vertical"],Separator$2=React__namespace.forwardRef((t,e)=>{const{decorative:n,orientation:o=DEFAULT_ORIENTATION,...l}=t,d=isValidOrientation(o)?o:DEFAULT_ORIENTATION,g=n?{role:"none"}:{"aria-orientation":d==="vertical"?d:void 0,role:"separator"};return jsxRuntime.jsx(Primitive$3.div,{"data-orientation":d,...g,...l,ref:e})});Separator$2.displayName=NAME$1;function isValidOrientation(t){return ORIENTATIONS.includes(t)}var Root$7=Separator$2;const Separator$1=React__namespace.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...o},l)=>jsxRuntime.jsx(Root$7,{ref:l,decorative:n,orientation:e,className:cn("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...o}));Separator$1.displayName=Root$7.displayName;const Sheet=Root$a,SheetTrigger=Trigger$6,SheetClose=Close$1,SheetPortal=Portal$4,SheetOverlay=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Overlay,{className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));SheetOverlay.displayName=Overlay.displayName;const sheetVariants=cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),SheetContent=React__namespace.forwardRef(({side:t="right",className:e,children:n,...o},l)=>jsxRuntime.jsxs(SheetPortal,{children:[jsxRuntime.jsx(SheetOverlay,{}),jsxRuntime.jsxs(Content$3,{ref:l,className:cn(sheetVariants({side:t}),e),...o,children:[jsxRuntime.jsxs(Close$1,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[jsxRuntime.jsx(X$1,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]}),n]})]}));SheetContent.displayName=Content$3.displayName;const SheetHeader=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});SheetHeader.displayName="SheetHeader";const SheetFooter=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});SheetFooter.displayName="SheetFooter";const SheetTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title$1,{ref:n,className:cn("text-lg font-semibold text-foreground",t),...e}));SheetTitle.displayName=Title$1.displayName;const SheetDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description$1,{ref:n,className:cn("text-sm text-muted-foreground",t),...e}));SheetDescription.displayName=Description$1.displayName;function useIntersectionObserver({elementRef:t,threshold:e=0,rootMargin:n="0px",freezeOnceVisible:o=!1}){const[l,d]=React.useState(!1);return React.useEffect(()=>{const f=t.current;if(!f){d(!1);return}const g=new IntersectionObserver(([b])=>{const _=b.isIntersecting;o&&_?(d(!0),g.unobserve(f)):d(_)},{threshold:e,rootMargin:n});return g.observe(f),()=>{g.unobserve(f)}},[t,e,n,o]),l}function formatProdErrorMessage$1(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var randomString=()=>Math.random().toString(36).substring(7).split("").join("."),ActionTypes={INIT:`@@redux/INIT${randomString()}`,REPLACE:`@@redux/REPLACE${randomString()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${randomString()}`},actionTypes_default=ActionTypes;function isPlainObject$4(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function miniKindOf(t){if(t===void 0)return"undefined";if(t===null)return"null";const e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(isDate$1(t))return"date";if(isError(t))return"error";const n=ctorName(t);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"")}function ctorName(t){return typeof t.constructor=="function"?t.constructor.name:null}function isError(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function isDate$1(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function kindOf(t){let e=typeof t;return process.env.NODE_ENV!=="production"&&(e=miniKindOf(t)),e}function warning(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function getUnexpectedStateShapeWarningMessage(t,e,n,o){const l=Object.keys(e),d=n&&n.type===actionTypes_default.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(l.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!isPlainObject$4(t))return`The ${d} has unexpected type of "${kindOf(t)}". Expected argument to be an object with the following keys: "${l.join('", "')}"`;const f=Object.keys(t).filter(g=>!e.hasOwnProperty(g)&&!o[g]);if(f.forEach(g=>{o[g]=!0}),!(n&&n.type===actionTypes_default.REPLACE)&&f.length>0)return`Unexpected ${f.length>1?"keys":"key"} "${f.join('", "')}" found in ${d}. Expected to find one of the known reducer keys instead: "${l.join('", "')}". Unexpected keys will be ignored.`}function assertReducerShape(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:actionTypes_default.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(12):`The slice reducer for key "${e}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:actionTypes_default.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(13):`The slice reducer for key "${e}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function combineReducers(t){const e=Object.keys(t),n={};for(let f=0;f<e.length;f++){const g=e[f];process.env.NODE_ENV!=="production"&&typeof t[g]>"u"&&warning(`No reducer provided for key "${g}"`),typeof t[g]=="function"&&(n[g]=t[g])}const o=Object.keys(n);let l;process.env.NODE_ENV!=="production"&&(l={});let d;try{assertReducerShape(n)}catch(f){d=f}return function(g={},b){if(d)throw d;if(process.env.NODE_ENV!=="production"){const R=getUnexpectedStateShapeWarningMessage(g,n,b,l);R&&warning(R)}let _=!1;const S={};for(let R=0;R<o.length;R++){const C=o[R],E=n[C],A=g[C],M=E(A,b);if(typeof M>"u"){const I=b&&b.type;throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(14):`When called with an action of type ${I?`"${String(I)}"`:"(unknown type)"}, the slice reducer for key "${C}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}S[C]=M,_=_||M!==A}return _=_||o.length!==Object.keys(g).length,_?S:g}}function isAction(t){return isPlainObject$4(t)&&"type"in t&&typeof t.type=="string"}var NOTHING=Symbol.for("immer-nothing"),DRAFTABLE=Symbol.for("immer-draftable"),DRAFT_STATE=Symbol.for("immer-state"),errors=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function die(t,...e){if(process.env.NODE_ENV!=="production"){const n=errors[t],o=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf$1=Object.getPrototypeOf;function isDraft(t){return!!t&&!!t[DRAFT_STATE]}function isDraftable(t){var e;return t?isPlainObject$3(t)||Array.isArray(t)||!!t[DRAFTABLE]||!!((e=t.constructor)!=null&&e[DRAFTABLE])||isMap(t)||isSet(t):!1}var objectCtorString=Object.prototype.constructor.toString(),cachedCtorStrings=new WeakMap;function isPlainObject$3(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);if(e===null||e===Object.prototype)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let o=cachedCtorStrings.get(n);return o===void 0&&(o=Function.toString.call(n),cachedCtorStrings.set(n,o)),o===objectCtorString}function original(t){return isDraft(t)||die(15,t),t[DRAFT_STATE].base_}function each(t,e,n=!0){getArchtype(t)===0?(n?Reflect.ownKeys(t):Object.keys(t)).forEach(l=>{e(l,t[l],t)}):t.forEach((o,l)=>e(l,o,t))}function getArchtype(t){const e=t[DRAFT_STATE];return e?e.type_:Array.isArray(t)?1:isMap(t)?2:isSet(t)?3:0}function has$1(t,e){return getArchtype(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function get$3(t,e){return getArchtype(t)===2?t.get(e):t[e]}function set$2(t,e,n){const o=getArchtype(t);o===2?t.set(e,n):o===3?t.add(n):t[e]=n}function is$1(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function isMap(t){return t instanceof Map}function isSet(t){return t instanceof Set}function latest(t){return t.copy_||t.base_}function shallowCopy(t,e){if(isMap(t))return new Map(t);if(isSet(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=isPlainObject$3(t);if(e===!0||e==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(t);delete o[DRAFT_STATE];let l=Reflect.ownKeys(o);for(let d=0;d<l.length;d++){const f=l[d],g=o[f];g.writable===!1&&(g.writable=!0,g.configurable=!0),(g.get||g.set)&&(o[f]={configurable:!0,writable:!0,enumerable:g.enumerable,value:t[f]})}return Object.create(getPrototypeOf$1(t),o)}else{const o=getPrototypeOf$1(t);if(o!==null&&n)return{...t};const l=Object.create(o);return Object.assign(l,t)}}function freeze$1(t,e=!1){return isFrozen$1(t)||isDraft(t)||!isDraftable(t)||(getArchtype(t)>1&&Object.defineProperties(t,{set:dontMutateMethodOverride,add:dontMutateMethodOverride,clear:dontMutateMethodOverride,delete:dontMutateMethodOverride}),Object.freeze(t),e&&Object.values(t).forEach(n=>freeze$1(n,!0))),t}function dontMutateFrozenCollections(){die(2)}var dontMutateMethodOverride={value:dontMutateFrozenCollections};function isFrozen$1(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var plugins={};function getPlugin(t){const e=plugins[t];return e||die(0,t),e}function loadPlugin(t,e){plugins[t]||(plugins[t]=e)}var currentScope;function getCurrentScope(){return currentScope}function createScope(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope(t,e){e&&(getPlugin("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function revokeScope(t){leaveScope(t),t.drafts_.forEach(revokeDraft),t.drafts_=null}function leaveScope(t){t===currentScope&&(currentScope=t.parent_)}function enterScope(t){return currentScope=createScope(currentScope,t)}function revokeDraft(t){const e=t[DRAFT_STATE];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function processResult(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[DRAFT_STATE].modified_&&(revokeScope(e),die(4)),isDraftable(t)&&(t=finalize(e,t),e.parent_||maybeFreeze(e,t)),e.patches_&&getPlugin("Patches").generateReplacementPatches_(n[DRAFT_STATE].base_,t,e.patches_,e.inversePatches_)):t=finalize(e,n,[]),revokeScope(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==NOTHING?t:void 0}function finalize(t,e,n){if(isFrozen$1(e))return e;const o=t.immer_.shouldUseStrictIteration(),l=e[DRAFT_STATE];if(!l)return each(e,(d,f)=>finalizeProperty(t,l,e,d,f,n),o),e;if(l.scope_!==t)return e;if(!l.modified_)return maybeFreeze(t,l.base_,!0),l.base_;if(!l.finalized_){l.finalized_=!0,l.scope_.unfinalizedDrafts_--;const d=l.copy_;let f=d,g=!1;l.type_===3&&(f=new Set(d),d.clear(),g=!0),each(f,(b,_)=>finalizeProperty(t,l,d,b,_,n,g),o),maybeFreeze(t,d,!1),n&&t.patches_&&getPlugin("Patches").generatePatches_(l,n,t.patches_,t.inversePatches_)}return l.copy_}function finalizeProperty(t,e,n,o,l,d,f){if(l==null||typeof l!="object"&&!f)return;const g=isFrozen$1(l);if(!(g&&!f)){if(process.env.NODE_ENV!=="production"&&l===n&&die(5),isDraft(l)){const b=d&&e&&e.type_!==3&&!has$1(e.assigned_,o)?d.concat(o):void 0,_=finalize(t,l,b);if(set$2(n,o,_),isDraft(_))t.canAutoFreeze_=!1;else return}else f&&n.add(l);if(isDraftable(l)&&!g){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[o]===l&&g)return;finalize(t,l),(!e||!e.scope_.parent_)&&typeof o!="symbol"&&(isMap(n)?n.has(o):Object.prototype.propertyIsEnumerable.call(n,o))&&maybeFreeze(t,l)}}}function maybeFreeze(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&freeze$1(e,n)}function createProxyProxy(t,e){const n=Array.isArray(t),o={type_:n?1:0,scope_:e?e.scope_:getCurrentScope(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let l=o,d=objectTraps;n&&(l=[o],d=arrayTraps);const{revoke:f,proxy:g}=Proxy.revocable(l,d);return o.draft_=g,o.revoke_=f,g}var objectTraps={get(t,e){if(e===DRAFT_STATE)return t;const n=latest(t);if(!has$1(n,e))return readPropFromProto(t,n,e);const o=n[e];return t.finalized_||!isDraftable(o)?o:o===peek(t.base_,e)?(prepareCopy(t),t.copy_[e]=createProxy(o,t)):o},has(t,e){return e in latest(t)},ownKeys(t){return Reflect.ownKeys(latest(t))},set(t,e,n){const o=getDescriptorFromProto(latest(t),e);if(o!=null&&o.set)return o.set.call(t.draft_,n),!0;if(!t.modified_){const l=peek(latest(t),e),d=l==null?void 0:l[DRAFT_STATE];if(d&&d.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(is$1(n,l)&&(n!==void 0||has$1(t.base_,e)))return!0;prepareCopy(t),markChanged(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return peek(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,prepareCopy(t),markChanged(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=latest(t),o=Reflect.getOwnPropertyDescriptor(n,e);return o&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:o.enumerable,value:n[e]}},defineProperty(){die(11)},getPrototypeOf(t){return getPrototypeOf$1(t.base_)},setPrototypeOf(){die(12)}},arrayTraps={};each(objectTraps,(t,e)=>{arrayTraps[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),arrayTraps.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&die(13),arrayTraps.set.call(this,t,e,void 0)},arrayTraps.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&die(14),objectTraps.set.call(this,t[0],e,n,t[0])};function peek(t,e){const n=t[DRAFT_STATE];return(n?latest(n):t)[e]}function readPropFromProto(t,e,n){var l;const o=getDescriptorFromProto(e,n);return o?"value"in o?o.value:(l=o.get)==null?void 0:l.call(t.draft_):void 0}function getDescriptorFromProto(t,e){if(!(e in t))return;let n=getPrototypeOf$1(t);for(;n;){const o=Object.getOwnPropertyDescriptor(n,e);if(o)return o;n=getPrototypeOf$1(n)}}function markChanged(t){t.modified_||(t.modified_=!0,t.parent_&&markChanged(t.parent_))}function prepareCopy(t){t.copy_||(t.copy_=shallowCopy(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Immer2=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,o)=>{if(typeof e=="function"&&typeof n!="function"){const d=n;n=e;const f=this;return function(b=d,..._){return f.produce(b,S=>n.call(this,S,..._))}}typeof n!="function"&&die(6),o!==void 0&&typeof o!="function"&&die(7);let l;if(isDraftable(e)){const d=enterScope(this),f=createProxy(e,void 0);let g=!0;try{l=n(f),g=!1}finally{g?revokeScope(d):leaveScope(d)}return usePatchesInScope(d,o),processResult(l,d)}else if(!e||typeof e!="object"){if(l=n(e),l===void 0&&(l=e),l===NOTHING&&(l=void 0),this.autoFreeze_&&freeze$1(l,!0),o){const d=[],f=[];getPlugin("Patches").generateReplacementPatches_(e,l,d,f),o(d,f)}return l}else die(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(f,...g)=>this.produceWithPatches(f,b=>e(b,...g));let o,l;return[this.produce(e,n,(f,g)=>{o=f,l=g}),o,l]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){isDraftable(t)||die(8),isDraft(t)&&(t=current(t));const e=enterScope(this),n=createProxy(t,void 0);return n[DRAFT_STATE].isManual_=!0,leaveScope(e),n}finishDraft(t,e){const n=t&&t[DRAFT_STATE];(!n||!n.isManual_)&&die(9);const{scope_:o}=n;return usePatchesInScope(o,e),processResult(void 0,o)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const l=e[n];if(l.path.length===0&&l.op==="replace"){t=l.value;break}}n>-1&&(e=e.slice(n+1));const o=getPlugin("Patches").applyPatches_;return isDraft(t)?o(t,e):this.produce(t,l=>o(l,e))}};function createProxy(t,e){const n=isMap(t)?getPlugin("MapSet").proxyMap_(t,e):isSet(t)?getPlugin("MapSet").proxySet_(t,e):createProxyProxy(t,e);return(e?e.scope_:getCurrentScope()).drafts_.push(n),n}function current(t){return isDraft(t)||die(10,t),currentImpl(t)}function currentImpl(t){if(!isDraftable(t)||isFrozen$1(t))return t;const e=t[DRAFT_STATE];let n,o=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=shallowCopy(t,e.scope_.immer_.useStrictShallowCopy_),o=e.scope_.immer_.shouldUseStrictIteration()}else n=shallowCopy(t,!0);return each(n,(l,d)=>{set$2(n,l,currentImpl(d))},o),e&&(e.finalized_=!1),n}function enablePatches(){process.env.NODE_ENV!=="production"&&errors.push('Sets cannot have "replace" patches.',function(C){return"Unsupported patch operation: "+C},function(C){return"Cannot apply patch, path doesn't resolve: "+C},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const e="replace",n="add",o="remove";function l(C,E,A,M){switch(C.type_){case 0:case 2:return f(C,E,A,M);case 1:return d(C,E,A,M);case 3:return g(C,E,A,M)}}function d(C,E,A,M){let{base_:I,assigned_:j}=C,F=C.copy_;F.length<I.length&&([I,F]=[F,I],[A,M]=[M,A]);for(let z=0;z<I.length;z++)if(j[z]&&F[z]!==I[z]){const Q=E.concat([z]);A.push({op:e,path:Q,value:R(F[z])}),M.push({op:e,path:Q,value:R(I[z])})}for(let z=I.length;z<F.length;z++){const Q=E.concat([z]);A.push({op:n,path:Q,value:R(F[z])})}for(let z=F.length-1;I.length<=z;--z){const Q=E.concat([z]);M.push({op:o,path:Q})}}function f(C,E,A,M){const{base_:I,copy_:j}=C;each(C.assigned_,(F,z)=>{const Q=get$3(I,F),O=get$3(j,F),V=z?has$1(I,F)?e:n:o;if(Q===O&&V===e)return;const te=E.concat(F);A.push(V===o?{op:V,path:te}:{op:V,path:te,value:O}),M.push(V===n?{op:o,path:te}:V===o?{op:n,path:te,value:R(Q)}:{op:e,path:te,value:R(Q)})})}function g(C,E,A,M){let{base_:I,copy_:j}=C,F=0;I.forEach(z=>{if(!j.has(z)){const Q=E.concat([F]);A.push({op:o,path:Q,value:z}),M.unshift({op:n,path:Q,value:z})}F++}),F=0,j.forEach(z=>{if(!I.has(z)){const Q=E.concat([F]);A.push({op:n,path:Q,value:z}),M.unshift({op:o,path:Q,value:z})}F++})}function b(C,E,A,M){A.push({op:e,path:[],value:E===NOTHING?void 0:E}),M.push({op:e,path:[],value:C})}function _(C,E){return E.forEach(A=>{const{path:M,op:I}=A;let j=C;for(let O=0;O<M.length-1;O++){const V=getArchtype(j);let te=M[O];typeof te!="string"&&typeof te!="number"&&(te=""+te),(V===0||V===1)&&(te==="__proto__"||te==="constructor")&&die(19),typeof j=="function"&&te==="prototype"&&die(19),j=get$3(j,te),typeof j!="object"&&die(18,M.join("/"))}const F=getArchtype(j),z=S(A.value),Q=M[M.length-1];switch(I){case e:switch(F){case 2:return j.set(Q,z);case 3:die(16);default:return j[Q]=z}case n:switch(F){case 1:return Q==="-"?j.push(z):j.splice(Q,0,z);case 2:return j.set(Q,z);case 3:return j.add(z);default:return j[Q]=z}case o:switch(F){case 1:return j.splice(Q,1);case 2:return j.delete(Q);case 3:return j.delete(A.value);default:return delete j[Q]}default:die(17,I)}}),C}function S(C){if(!isDraftable(C))return C;if(Array.isArray(C))return C.map(S);if(isMap(C))return new Map(Array.from(C.entries()).map(([A,M])=>[A,S(M)]));if(isSet(C))return new Set(Array.from(C).map(S));const E=Object.create(getPrototypeOf$1(C));for(const A in C)E[A]=S(C[A]);return has$1(C,DRAFTABLE)&&(E[DRAFTABLE]=C[DRAFTABLE]),E}function R(C){return isDraft(C)?S(C):C}loadPlugin("Patches",{applyPatches_:_,generatePatches_:l,generateReplacementPatches_:b})}var immer=new Immer2,produce=immer.produce,produceWithPatches=immer.produceWithPatches.bind(immer),setUseStrictIteration=immer.setUseStrictIteration.bind(immer),applyPatches=immer.applyPatches.bind(immer),runIdentityFunctionCheck=(t,e,n)=>{if(e.length===1&&e[0]===n){let o=!1;try{const l={};t(l)===l&&(o=!0)}catch{}if(o){let l;try{throw new Error}catch(d){({stack:l}=d)}console.warn(`The result function returned its own inputs without modification. e.g
|
|
509
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return React__namespace.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},DESCRIPTION_WARNING_NAME="DialogDescriptionWarning",DescriptionWarning$1=({contentRef:t,descriptionId:e})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${useWarningContext(DESCRIPTION_WARNING_NAME).contentName}}.`;return React__namespace.useEffect(()=>{var d;const l=(d=t.current)==null?void 0:d.getAttribute("aria-describedby");e&&l&&(document.getElementById(e)||console.warn(o))},[o,t,e]),null},Root$a=Dialog$1,Trigger$6=DialogTrigger$1,Portal$4=DialogPortal$1,Overlay=DialogOverlay$1,Content$3=DialogContent$1,Title$1=DialogTitle$1,Description$1=DialogDescription$1,Close$1=DialogClose$1;const Dialog=({modal:t=!1,...e})=>jsxRuntime.jsx(Root$a,{modal:t,...e});Dialog.displayName=Root$a.displayName;const DialogTrigger=Trigger$6,DialogPortal=Portal$4,DialogClose=Close$1,DialogOverlay=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Overlay,{ref:n,className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));DialogOverlay.displayName=Overlay.displayName;const DialogContent=React__namespace.forwardRef(({className:t,children:e,animateExit:n=!0,...o},l)=>jsxRuntime.jsxs(DialogPortal,{forceMount:o.forceMount,children:[jsxRuntime.jsx(DialogOverlay,{}),jsxRuntime.jsxs(Content$3,{ref:l,className:cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-2xl shadow-primary duration-200 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n&&"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",t),...o,children:[e,jsxRuntime.jsxs(Close$1,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[jsxRuntime.jsx(X$1,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));DialogContent.displayName=Content$3.displayName;const DialogHeader=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});DialogHeader.displayName="DialogHeader";const DialogFooter=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});DialogFooter.displayName="DialogFooter";const DialogTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title$1,{ref:n,className:cn("text-lg font-semibold leading-none tracking-tight",t),...e}));DialogTitle.displayName=Title$1.displayName;const DialogDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description$1,{ref:n,className:cn("text-sm text-muted-foreground",t),...e}));DialogDescription.displayName=Description$1.displayName;const sides=["top","right","bottom","left"],min$4=Math.min,max$4=Math.max,round$1=Math.round,floor=Math.floor,createCoords=t=>({x:t,y:t}),oppositeSideMap={left:"right",right:"left",bottom:"top",top:"bottom"},oppositeAlignmentMap={start:"end",end:"start"};function clamp$1(t,e,n){return max$4(t,min$4(e,n))}function evaluate(t,e){return typeof t=="function"?t(e):t}function getSide$1(t){return t.split("-")[0]}function getAlignment(t){return t.split("-")[1]}function getOppositeAxis(t){return t==="x"?"y":"x"}function getAxisLength(t){return t==="y"?"height":"width"}const yAxisSides=new Set(["top","bottom"]);function getSideAxis(t){return yAxisSides.has(getSide$1(t))?"y":"x"}function getAlignmentAxis(t){return getOppositeAxis(getSideAxis(t))}function getAlignmentSides(t,e,n){n===void 0&&(n=!1);const o=getAlignment(t),l=getAlignmentAxis(t),d=getAxisLength(l);let f=l==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[d]>e.floating[d]&&(f=getOppositePlacement(f)),[f,getOppositePlacement(f)]}function getExpandedPlacements(t){const e=getOppositePlacement(t);return[getOppositeAlignmentPlacement(t),e,getOppositeAlignmentPlacement(e)]}function getOppositeAlignmentPlacement(t){return t.replace(/start|end/g,e=>oppositeAlignmentMap[e])}const lrPlacement=["left","right"],rlPlacement=["right","left"],tbPlacement=["top","bottom"],btPlacement=["bottom","top"];function getSideList(t,e,n){switch(t){case"top":case"bottom":return n?e?rlPlacement:lrPlacement:e?lrPlacement:rlPlacement;case"left":case"right":return e?tbPlacement:btPlacement;default:return[]}}function getOppositeAxisPlacements(t,e,n,o){const l=getAlignment(t);let d=getSideList(getSide$1(t),n==="start",o);return l&&(d=d.map(f=>f+"-"+l),e&&(d=d.concat(d.map(getOppositeAlignmentPlacement)))),d}function getOppositePlacement(t){return t.replace(/left|right|bottom|top/g,e=>oppositeSideMap[e])}function expandPaddingObject(t){return{top:0,right:0,bottom:0,left:0,...t}}function getPaddingObject(t){return typeof t!="number"?expandPaddingObject(t):{top:t,right:t,bottom:t,left:t}}function rectToClientRect(t){const{x:e,y:n,width:o,height:l}=t;return{width:o,height:l,top:n,left:e,right:e+o,bottom:n+l,x:e,y:n}}function computeCoordsFromPlacement(t,e,n){let{reference:o,floating:l}=t;const d=getSideAxis(e),f=getAlignmentAxis(e),g=getAxisLength(f),b=getSide$1(e),_=d==="y",S=o.x+o.width/2-l.width/2,R=o.y+o.height/2-l.height/2,C=o[g]/2-l[g]/2;let E;switch(b){case"top":E={x:S,y:o.y-l.height};break;case"bottom":E={x:S,y:o.y+o.height};break;case"right":E={x:o.x+o.width,y:R};break;case"left":E={x:o.x-l.width,y:R};break;default:E={x:o.x,y:o.y}}switch(getAlignment(e)){case"start":E[f]-=C*(n&&_?-1:1);break;case"end":E[f]+=C*(n&&_?-1:1);break}return E}const computePosition$1=async(t,e,n)=>{const{placement:o="bottom",strategy:l="absolute",middleware:d=[],platform:f}=n,g=d.filter(Boolean),b=await(f.isRTL==null?void 0:f.isRTL(e));let _=await f.getElementRects({reference:t,floating:e,strategy:l}),{x:S,y:R}=computeCoordsFromPlacement(_,o,b),C=o,E={},A=0;for(let M=0;M<g.length;M++){const{name:I,fn:j}=g[M],{x:F,y:z,data:Q,reset:O}=await j({x:S,y:R,initialPlacement:o,placement:C,strategy:l,middlewareData:E,rects:_,platform:f,elements:{reference:t,floating:e}});S=F??S,R=z??R,E={...E,[I]:{...E[I],...Q}},O&&A<=50&&(A++,typeof O=="object"&&(O.placement&&(C=O.placement),O.rects&&(_=O.rects===!0?await f.getElementRects({reference:t,floating:e,strategy:l}):O.rects),{x:S,y:R}=computeCoordsFromPlacement(_,C,b)),M=-1)}return{x:S,y:R,placement:C,strategy:l,middlewareData:E}};async function detectOverflow(t,e){var n;e===void 0&&(e={});const{x:o,y:l,platform:d,rects:f,elements:g,strategy:b}=t,{boundary:_="clippingAncestors",rootBoundary:S="viewport",elementContext:R="floating",altBoundary:C=!1,padding:E=0}=evaluate(e,t),A=getPaddingObject(E),I=g[C?R==="floating"?"reference":"floating":R],j=rectToClientRect(await d.getClippingRect({element:(n=await(d.isElement==null?void 0:d.isElement(I)))==null||n?I:I.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(g.floating)),boundary:_,rootBoundary:S,strategy:b})),F=R==="floating"?{x:o,y:l,width:f.floating.width,height:f.floating.height}:f.reference,z=await(d.getOffsetParent==null?void 0:d.getOffsetParent(g.floating)),Q=await(d.isElement==null?void 0:d.isElement(z))?await(d.getScale==null?void 0:d.getScale(z))||{x:1,y:1}:{x:1,y:1},O=rectToClientRect(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:g,rect:F,offsetParent:z,strategy:b}):F);return{top:(j.top-O.top+A.top)/Q.y,bottom:(O.bottom-j.bottom+A.bottom)/Q.y,left:(j.left-O.left+A.left)/Q.x,right:(O.right-j.right+A.right)/Q.x}}const arrow$4=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:l,rects:d,platform:f,elements:g,middlewareData:b}=e,{element:_,padding:S=0}=evaluate(t,e)||{};if(_==null)return{};const R=getPaddingObject(S),C={x:n,y:o},E=getAlignmentAxis(l),A=getAxisLength(E),M=await f.getDimensions(_),I=E==="y",j=I?"top":"left",F=I?"bottom":"right",z=I?"clientHeight":"clientWidth",Q=d.reference[A]+d.reference[E]-C[E]-d.floating[A],O=C[E]-d.reference[E],V=await(f.getOffsetParent==null?void 0:f.getOffsetParent(_));let te=V?V[z]:0;(!te||!await(f.isElement==null?void 0:f.isElement(V)))&&(te=g.floating[z]||d.floating[A]);const ne=Q/2-O/2,ae=te/2-M[A]/2-1,$e=min$4(R[j],ae),ge=min$4(R[F],ae),se=$e,je=te-M[A]-ge,Ae=te/2-M[A]/2+ne,Ne=clamp$1(se,Ae,je),Ve=!b.arrow&&getAlignment(l)!=null&&Ae!==Ne&&d.reference[A]/2-(Ae<se?$e:ge)-M[A]/2<0,Fe=Ve?Ae<se?Ae-se:Ae-je:0;return{[E]:C[E]+Fe,data:{[E]:Ne,centerOffset:Ae-Ne-Fe,...Ve&&{alignmentOffset:Fe}},reset:Ve}}}),flip$2=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:l,middlewareData:d,rects:f,initialPlacement:g,platform:b,elements:_}=e,{mainAxis:S=!0,crossAxis:R=!0,fallbackPlacements:C,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:M=!0,...I}=evaluate(t,e);if((n=d.arrow)!=null&&n.alignmentOffset)return{};const j=getSide$1(l),F=getSideAxis(g),z=getSide$1(g)===g,Q=await(b.isRTL==null?void 0:b.isRTL(_.floating)),O=C||(z||!M?[getOppositePlacement(g)]:getExpandedPlacements(g)),V=A!=="none";!C&&V&&O.push(...getOppositeAxisPlacements(g,M,A,Q));const te=[g,...O],ne=await detectOverflow(e,I),ae=[];let $e=((o=d.flip)==null?void 0:o.overflows)||[];if(S&&ae.push(ne[j]),R){const Ae=getAlignmentSides(l,f,Q);ae.push(ne[Ae[0]],ne[Ae[1]])}if($e=[...$e,{placement:l,overflows:ae}],!ae.every(Ae=>Ae<=0)){var ge,se;const Ae=(((ge=d.flip)==null?void 0:ge.index)||0)+1,Ne=te[Ae];if(Ne&&(!(R==="alignment"?F!==getSideAxis(Ne):!1)||$e.every(Oe=>getSideAxis(Oe.placement)===F?Oe.overflows[0]>0:!0)))return{data:{index:Ae,overflows:$e},reset:{placement:Ne}};let Ve=(se=$e.filter(Fe=>Fe.overflows[0]<=0).sort((Fe,Oe)=>Fe.overflows[1]-Oe.overflows[1])[0])==null?void 0:se.placement;if(!Ve)switch(E){case"bestFit":{var je;const Fe=(je=$e.filter(Oe=>{if(V){const Be=getSideAxis(Oe.placement);return Be===F||Be==="y"}return!0}).map(Oe=>[Oe.placement,Oe.overflows.filter(Be=>Be>0).reduce((Be,Ue)=>Be+Ue,0)]).sort((Oe,Be)=>Oe[1]-Be[1])[0])==null?void 0:je[0];Fe&&(Ve=Fe);break}case"initialPlacement":Ve=g;break}if(l!==Ve)return{reset:{placement:Ve}}}return{}}}};function getSideOffsets(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function isAnySideFullyClipped(t){return sides.some(e=>t[e]>=0)}const hide$2=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:o="referenceHidden",...l}=evaluate(t,e);switch(o){case"referenceHidden":{const d=await detectOverflow(e,{...l,elementContext:"reference"}),f=getSideOffsets(d,n.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:isAnySideFullyClipped(f)}}}case"escaped":{const d=await detectOverflow(e,{...l,altBoundary:!0}),f=getSideOffsets(d,n.floating);return{data:{escapedOffsets:f,escaped:isAnySideFullyClipped(f)}}}default:return{}}}}},originSides=new Set(["left","top"]);async function convertValueToCoords(t,e){const{placement:n,platform:o,elements:l}=t,d=await(o.isRTL==null?void 0:o.isRTL(l.floating)),f=getSide$1(n),g=getAlignment(n),b=getSideAxis(n)==="y",_=originSides.has(f)?-1:1,S=d&&b?-1:1,R=evaluate(e,t);let{mainAxis:C,crossAxis:E,alignmentAxis:A}=typeof R=="number"?{mainAxis:R,crossAxis:0,alignmentAxis:null}:{mainAxis:R.mainAxis||0,crossAxis:R.crossAxis||0,alignmentAxis:R.alignmentAxis};return g&&typeof A=="number"&&(E=g==="end"?A*-1:A),b?{x:E*S,y:C*_}:{x:C*_,y:E*S}}const offset$2=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:l,y:d,placement:f,middlewareData:g}=e,b=await convertValueToCoords(e,t);return f===((n=g.offset)==null?void 0:n.placement)&&(o=g.arrow)!=null&&o.alignmentOffset?{}:{x:l+b.x,y:d+b.y,data:{...b,placement:f}}}}},shift$3=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:l}=e,{mainAxis:d=!0,crossAxis:f=!1,limiter:g={fn:I=>{let{x:j,y:F}=I;return{x:j,y:F}}},...b}=evaluate(t,e),_={x:n,y:o},S=await detectOverflow(e,b),R=getSideAxis(getSide$1(l)),C=getOppositeAxis(R);let E=_[C],A=_[R];if(d){const I=C==="y"?"top":"left",j=C==="y"?"bottom":"right",F=E+S[I],z=E-S[j];E=clamp$1(F,E,z)}if(f){const I=R==="y"?"top":"left",j=R==="y"?"bottom":"right",F=A+S[I],z=A-S[j];A=clamp$1(F,A,z)}const M=g.fn({...e,[C]:E,[R]:A});return{...M,data:{x:M.x-n,y:M.y-o,enabled:{[C]:d,[R]:f}}}}}},limitShift$2=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:l,rects:d,middlewareData:f}=e,{offset:g=0,mainAxis:b=!0,crossAxis:_=!0}=evaluate(t,e),S={x:n,y:o},R=getSideAxis(l),C=getOppositeAxis(R);let E=S[C],A=S[R];const M=evaluate(g,e),I=typeof M=="number"?{mainAxis:M,crossAxis:0}:{mainAxis:0,crossAxis:0,...M};if(b){const z=C==="y"?"height":"width",Q=d.reference[C]-d.floating[z]+I.mainAxis,O=d.reference[C]+d.reference[z]-I.mainAxis;E<Q?E=Q:E>O&&(E=O)}if(_){var j,F;const z=C==="y"?"width":"height",Q=originSides.has(getSide$1(l)),O=d.reference[R]-d.floating[z]+(Q&&((j=f.offset)==null?void 0:j[R])||0)+(Q?0:I.crossAxis),V=d.reference[R]+d.reference[z]+(Q?0:((F=f.offset)==null?void 0:F[R])||0)-(Q?I.crossAxis:0);A<O?A=O:A>V&&(A=V)}return{[C]:E,[R]:A}}}},size$2=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:l,rects:d,platform:f,elements:g}=e,{apply:b=()=>{},..._}=evaluate(t,e),S=await detectOverflow(e,_),R=getSide$1(l),C=getAlignment(l),E=getSideAxis(l)==="y",{width:A,height:M}=d.floating;let I,j;R==="top"||R==="bottom"?(I=R,j=C===(await(f.isRTL==null?void 0:f.isRTL(g.floating))?"start":"end")?"left":"right"):(j=R,I=C==="end"?"top":"bottom");const F=M-S.top-S.bottom,z=A-S.left-S.right,Q=min$4(M-S[I],F),O=min$4(A-S[j],z),V=!e.middlewareData.shift;let te=Q,ne=O;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(ne=z),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(te=F),V&&!C){const $e=max$4(S.left,0),ge=max$4(S.right,0),se=max$4(S.top,0),je=max$4(S.bottom,0);E?ne=A-2*($e!==0||ge!==0?$e+ge:max$4(S.left,S.right)):te=M-2*(se!==0||je!==0?se+je:max$4(S.top,S.bottom))}await b({...e,availableWidth:ne,availableHeight:te});const ae=await f.getDimensions(g.floating);return A!==ae.width||M!==ae.height?{reset:{rects:!0}}:{}}}};function hasWindow(){return typeof window<"u"}function getNodeName(t){return isNode(t)?(t.nodeName||"").toLowerCase():"#document"}function getWindow(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function getDocumentElement(t){var e;return(e=(isNode(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function isNode(t){return hasWindow()?t instanceof Node||t instanceof getWindow(t).Node:!1}function isElement(t){return hasWindow()?t instanceof Element||t instanceof getWindow(t).Element:!1}function isHTMLElement$2(t){return hasWindow()?t instanceof HTMLElement||t instanceof getWindow(t).HTMLElement:!1}function isShadowRoot(t){return!hasWindow()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof getWindow(t).ShadowRoot}const invalidOverflowDisplayValues=new Set(["inline","contents"]);function isOverflowElement(t){const{overflow:e,overflowX:n,overflowY:o,display:l}=getComputedStyle$1(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!invalidOverflowDisplayValues.has(l)}const tableElements=new Set(["table","td","th"]);function isTableElement(t){return tableElements.has(getNodeName(t))}const topLayerSelectors=[":popover-open",":modal"];function isTopLayer(t){return topLayerSelectors.some(e=>{try{return t.matches(e)}catch{return!1}})}const transformProperties=["transform","translate","scale","rotate","perspective"],willChangeValues=["transform","translate","scale","rotate","perspective","filter"],containValues=["paint","layout","strict","content"];function isContainingBlock(t){const e=isWebKit(),n=isElement(t)?getComputedStyle$1(t):t;return transformProperties.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||willChangeValues.some(o=>(n.willChange||"").includes(o))||containValues.some(o=>(n.contain||"").includes(o))}function getContainingBlock(t){let e=getParentNode(t);for(;isHTMLElement$2(e)&&!isLastTraversableNode(e);){if(isContainingBlock(e))return e;if(isTopLayer(e))return null;e=getParentNode(e)}return null}function isWebKit(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const lastTraversableNodeNames=new Set(["html","body","#document"]);function isLastTraversableNode(t){return lastTraversableNodeNames.has(getNodeName(t))}function getComputedStyle$1(t){return getWindow(t).getComputedStyle(t)}function getNodeScroll(t){return isElement(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function getParentNode(t){if(getNodeName(t)==="html")return t;const e=t.assignedSlot||t.parentNode||isShadowRoot(t)&&t.host||getDocumentElement(t);return isShadowRoot(e)?e.host:e}function getNearestOverflowAncestor(t){const e=getParentNode(t);return isLastTraversableNode(e)?t.ownerDocument?t.ownerDocument.body:t.body:isHTMLElement$2(e)&&isOverflowElement(e)?e:getNearestOverflowAncestor(e)}function getOverflowAncestors(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const l=getNearestOverflowAncestor(t),d=l===((o=t.ownerDocument)==null?void 0:o.body),f=getWindow(l);if(d){const g=getFrameElement(f);return e.concat(f,f.visualViewport||[],isOverflowElement(l)?l:[],g&&n?getOverflowAncestors(g):[])}return e.concat(l,getOverflowAncestors(l,[],n))}function getFrameElement(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function getCssDimensions(t){const e=getComputedStyle$1(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const l=isHTMLElement$2(t),d=l?t.offsetWidth:n,f=l?t.offsetHeight:o,g=round$1(n)!==d||round$1(o)!==f;return g&&(n=d,o=f),{width:n,height:o,$:g}}function unwrapElement(t){return isElement(t)?t:t.contextElement}function getScale(t){const e=unwrapElement(t);if(!isHTMLElement$2(e))return createCoords(1);const n=e.getBoundingClientRect(),{width:o,height:l,$:d}=getCssDimensions(e);let f=(d?round$1(n.width):n.width)/o,g=(d?round$1(n.height):n.height)/l;return(!f||!Number.isFinite(f))&&(f=1),(!g||!Number.isFinite(g))&&(g=1),{x:f,y:g}}const noOffsets=createCoords(0);function getVisualOffsets(t){const e=getWindow(t);return!isWebKit()||!e.visualViewport?noOffsets:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function shouldAddVisualOffsets(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==getWindow(t)?!1:e}function getBoundingClientRect(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const l=t.getBoundingClientRect(),d=unwrapElement(t);let f=createCoords(1);e&&(o?isElement(o)&&(f=getScale(o)):f=getScale(t));const g=shouldAddVisualOffsets(d,n,o)?getVisualOffsets(d):createCoords(0);let b=(l.left+g.x)/f.x,_=(l.top+g.y)/f.y,S=l.width/f.x,R=l.height/f.y;if(d){const C=getWindow(d),E=o&&isElement(o)?getWindow(o):o;let A=C,M=getFrameElement(A);for(;M&&o&&E!==A;){const I=getScale(M),j=M.getBoundingClientRect(),F=getComputedStyle$1(M),z=j.left+(M.clientLeft+parseFloat(F.paddingLeft))*I.x,Q=j.top+(M.clientTop+parseFloat(F.paddingTop))*I.y;b*=I.x,_*=I.y,S*=I.x,R*=I.y,b+=z,_+=Q,A=getWindow(M),M=getFrameElement(A)}}return rectToClientRect({width:S,height:R,x:b,y:_})}function getWindowScrollBarX(t,e){const n=getNodeScroll(t).scrollLeft;return e?e.left+n:getBoundingClientRect(getDocumentElement(t)).left+n}function getHTMLOffset(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-getWindowScrollBarX(t,n),l=n.top+e.scrollTop;return{x:o,y:l}}function convertOffsetParentRelativeRectToViewportRelativeRect(t){let{elements:e,rect:n,offsetParent:o,strategy:l}=t;const d=l==="fixed",f=getDocumentElement(o),g=e?isTopLayer(e.floating):!1;if(o===f||g&&d)return n;let b={scrollLeft:0,scrollTop:0},_=createCoords(1);const S=createCoords(0),R=isHTMLElement$2(o);if((R||!R&&!d)&&((getNodeName(o)!=="body"||isOverflowElement(f))&&(b=getNodeScroll(o)),isHTMLElement$2(o))){const E=getBoundingClientRect(o);_=getScale(o),S.x=E.x+o.clientLeft,S.y=E.y+o.clientTop}const C=f&&!R&&!d?getHTMLOffset(f,b):createCoords(0);return{width:n.width*_.x,height:n.height*_.y,x:n.x*_.x-b.scrollLeft*_.x+S.x+C.x,y:n.y*_.y-b.scrollTop*_.y+S.y+C.y}}function getClientRects(t){return Array.from(t.getClientRects())}function getDocumentRect(t){const e=getDocumentElement(t),n=getNodeScroll(t),o=t.ownerDocument.body,l=max$4(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),d=max$4(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let f=-n.scrollLeft+getWindowScrollBarX(t);const g=-n.scrollTop;return getComputedStyle$1(o).direction==="rtl"&&(f+=max$4(e.clientWidth,o.clientWidth)-l),{width:l,height:d,x:f,y:g}}const SCROLLBAR_MAX=25;function getViewportRect(t,e){const n=getWindow(t),o=getDocumentElement(t),l=n.visualViewport;let d=o.clientWidth,f=o.clientHeight,g=0,b=0;if(l){d=l.width,f=l.height;const S=isWebKit();(!S||S&&e==="fixed")&&(g=l.offsetLeft,b=l.offsetTop)}const _=getWindowScrollBarX(o);if(_<=0){const S=o.ownerDocument,R=S.body,C=getComputedStyle(R),E=S.compatMode==="CSS1Compat"&&parseFloat(C.marginLeft)+parseFloat(C.marginRight)||0,A=Math.abs(o.clientWidth-R.clientWidth-E);A<=SCROLLBAR_MAX&&(d-=A)}else _<=SCROLLBAR_MAX&&(d+=_);return{width:d,height:f,x:g,y:b}}const absoluteOrFixed=new Set(["absolute","fixed"]);function getInnerBoundingClientRect(t,e){const n=getBoundingClientRect(t,!0,e==="fixed"),o=n.top+t.clientTop,l=n.left+t.clientLeft,d=isHTMLElement$2(t)?getScale(t):createCoords(1),f=t.clientWidth*d.x,g=t.clientHeight*d.y,b=l*d.x,_=o*d.y;return{width:f,height:g,x:b,y:_}}function getClientRectFromClippingAncestor(t,e,n){let o;if(e==="viewport")o=getViewportRect(t,n);else if(e==="document")o=getDocumentRect(getDocumentElement(t));else if(isElement(e))o=getInnerBoundingClientRect(e,n);else{const l=getVisualOffsets(t);o={x:e.x-l.x,y:e.y-l.y,width:e.width,height:e.height}}return rectToClientRect(o)}function hasFixedPositionAncestor(t,e){const n=getParentNode(t);return n===e||!isElement(n)||isLastTraversableNode(n)?!1:getComputedStyle$1(n).position==="fixed"||hasFixedPositionAncestor(n,e)}function getClippingElementAncestors(t,e){const n=e.get(t);if(n)return n;let o=getOverflowAncestors(t,[],!1).filter(g=>isElement(g)&&getNodeName(g)!=="body"),l=null;const d=getComputedStyle$1(t).position==="fixed";let f=d?getParentNode(t):t;for(;isElement(f)&&!isLastTraversableNode(f);){const g=getComputedStyle$1(f),b=isContainingBlock(f);!b&&g.position==="fixed"&&(l=null),(d?!b&&!l:!b&&g.position==="static"&&!!l&&absoluteOrFixed.has(l.position)||isOverflowElement(f)&&!b&&hasFixedPositionAncestor(t,f))?o=o.filter(S=>S!==f):l=g,f=getParentNode(f)}return e.set(t,o),o}function getClippingRect(t){let{element:e,boundary:n,rootBoundary:o,strategy:l}=t;const f=[...n==="clippingAncestors"?isTopLayer(e)?[]:getClippingElementAncestors(e,this._c):[].concat(n),o],g=f[0],b=f.reduce((_,S)=>{const R=getClientRectFromClippingAncestor(e,S,l);return _.top=max$4(R.top,_.top),_.right=min$4(R.right,_.right),_.bottom=min$4(R.bottom,_.bottom),_.left=max$4(R.left,_.left),_},getClientRectFromClippingAncestor(e,g,l));return{width:b.right-b.left,height:b.bottom-b.top,x:b.left,y:b.top}}function getDimensions(t){const{width:e,height:n}=getCssDimensions(t);return{width:e,height:n}}function getRectRelativeToOffsetParent(t,e,n){const o=isHTMLElement$2(e),l=getDocumentElement(e),d=n==="fixed",f=getBoundingClientRect(t,!0,d,e);let g={scrollLeft:0,scrollTop:0};const b=createCoords(0);function _(){b.x=getWindowScrollBarX(l)}if(o||!o&&!d)if((getNodeName(e)!=="body"||isOverflowElement(l))&&(g=getNodeScroll(e)),o){const E=getBoundingClientRect(e,!0,d,e);b.x=E.x+e.clientLeft,b.y=E.y+e.clientTop}else l&&_();d&&!o&&l&&_();const S=l&&!o&&!d?getHTMLOffset(l,g):createCoords(0),R=f.left+g.scrollLeft-b.x-S.x,C=f.top+g.scrollTop-b.y-S.y;return{x:R,y:C,width:f.width,height:f.height}}function isStaticPositioned(t){return getComputedStyle$1(t).position==="static"}function getTrueOffsetParent(t,e){if(!isHTMLElement$2(t)||getComputedStyle$1(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return getDocumentElement(t)===n&&(n=n.ownerDocument.body),n}function getOffsetParent(t,e){const n=getWindow(t);if(isTopLayer(t))return n;if(!isHTMLElement$2(t)){let l=getParentNode(t);for(;l&&!isLastTraversableNode(l);){if(isElement(l)&&!isStaticPositioned(l))return l;l=getParentNode(l)}return n}let o=getTrueOffsetParent(t,e);for(;o&&isTableElement(o)&&isStaticPositioned(o);)o=getTrueOffsetParent(o,e);return o&&isLastTraversableNode(o)&&isStaticPositioned(o)&&!isContainingBlock(o)?n:o||getContainingBlock(t)||n}const getElementRects=async function(t){const e=this.getOffsetParent||getOffsetParent,n=this.getDimensions,o=await n(t.floating);return{reference:getRectRelativeToOffsetParent(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function isRTL(t){return getComputedStyle$1(t).direction==="rtl"}const platform={convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement,getClippingRect,getOffsetParent,getElementRects,getClientRects,getDimensions,getScale,isElement,isRTL};function rectsAreEqual(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function observeMove(t,e){let n=null,o;const l=getDocumentElement(t);function d(){var g;clearTimeout(o),(g=n)==null||g.disconnect(),n=null}function f(g,b){g===void 0&&(g=!1),b===void 0&&(b=1),d();const _=t.getBoundingClientRect(),{left:S,top:R,width:C,height:E}=_;if(g||e(),!C||!E)return;const A=floor(R),M=floor(l.clientWidth-(S+C)),I=floor(l.clientHeight-(R+E)),j=floor(S),z={rootMargin:-A+"px "+-M+"px "+-I+"px "+-j+"px",threshold:max$4(0,min$4(1,b))||1};let Q=!0;function O(V){const te=V[0].intersectionRatio;if(te!==b){if(!Q)return f();te?f(!1,te):o=setTimeout(()=>{f(!1,1e-7)},1e3)}te===1&&!rectsAreEqual(_,t.getBoundingClientRect())&&f(),Q=!1}try{n=new IntersectionObserver(O,{...z,root:l.ownerDocument})}catch{n=new IntersectionObserver(O,z)}n.observe(t)}return f(!0),d}function autoUpdate(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:l=!0,ancestorResize:d=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:g=typeof IntersectionObserver=="function",animationFrame:b=!1}=o,_=unwrapElement(t),S=l||d?[..._?getOverflowAncestors(_):[],...getOverflowAncestors(e)]:[];S.forEach(j=>{l&&j.addEventListener("scroll",n,{passive:!0}),d&&j.addEventListener("resize",n)});const R=_&&g?observeMove(_,n):null;let C=-1,E=null;f&&(E=new ResizeObserver(j=>{let[F]=j;F&&F.target===_&&E&&(E.unobserve(e),cancelAnimationFrame(C),C=requestAnimationFrame(()=>{var z;(z=E)==null||z.observe(e)})),n()}),_&&!b&&E.observe(_),E.observe(e));let A,M=b?getBoundingClientRect(t):null;b&&I();function I(){const j=getBoundingClientRect(t);M&&!rectsAreEqual(M,j)&&n(),M=j,A=requestAnimationFrame(I)}return n(),()=>{var j;S.forEach(F=>{l&&F.removeEventListener("scroll",n),d&&F.removeEventListener("resize",n)}),R==null||R(),(j=E)==null||j.disconnect(),E=null,b&&cancelAnimationFrame(A)}}const offset$1=offset$2,shift$2=shift$3,flip$1=flip$2,size$1=size$2,hide$1=hide$2,arrow$3=arrow$4,limitShift$1=limitShift$2,computePosition=(t,e,n)=>{const o=new Map,l={platform,...n},d={...l.platform,_c:o};return computePosition$1(t,e,{...l,platform:d})};var isClient=typeof document<"u",noop$2=function(){},index=isClient?React.useLayoutEffect:noop$2;function deepEqual$3(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,l;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!deepEqual$3(t[o],e[o]))return!1;return!0}if(l=Object.keys(t),n=l.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,l[o]))return!1;for(o=n;o--!==0;){const d=l[o];if(!(d==="_owner"&&t.$$typeof)&&!deepEqual$3(t[d],e[d]))return!1}return!0}return t!==t&&e!==e}function getDPR(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function roundByDPR(t,e){const n=getDPR(t);return Math.round(e*n)/n}function useLatestRef(t){const e=React__namespace.useRef(t);return index(()=>{e.current=t}),e}function useFloating(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:l,elements:{reference:d,floating:f}={},transform:g=!0,whileElementsMounted:b,open:_}=t,[S,R]=React__namespace.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[C,E]=React__namespace.useState(o);deepEqual$3(C,o)||E(o);const[A,M]=React__namespace.useState(null),[I,j]=React__namespace.useState(null),F=React__namespace.useCallback(Oe=>{Oe!==V.current&&(V.current=Oe,M(Oe))},[]),z=React__namespace.useCallback(Oe=>{Oe!==te.current&&(te.current=Oe,j(Oe))},[]),Q=d||A,O=f||I,V=React__namespace.useRef(null),te=React__namespace.useRef(null),ne=React__namespace.useRef(S),ae=b!=null,$e=useLatestRef(b),ge=useLatestRef(l),se=useLatestRef(_),je=React__namespace.useCallback(()=>{if(!V.current||!te.current)return;const Oe={placement:e,strategy:n,middleware:C};ge.current&&(Oe.platform=ge.current),computePosition(V.current,te.current,Oe).then(Be=>{const Ue={...Be,isPositioned:se.current!==!1};Ae.current&&!deepEqual$3(ne.current,Ue)&&(ne.current=Ue,ReactDOM__namespace.flushSync(()=>{R(Ue)}))})},[C,e,n,ge,se]);index(()=>{_===!1&&ne.current.isPositioned&&(ne.current.isPositioned=!1,R(Oe=>({...Oe,isPositioned:!1})))},[_]);const Ae=React__namespace.useRef(!1);index(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]),index(()=>{if(Q&&(V.current=Q),O&&(te.current=O),Q&&O){if($e.current)return $e.current(Q,O,je);je()}},[Q,O,je,$e,ae]);const Ne=React__namespace.useMemo(()=>({reference:V,floating:te,setReference:F,setFloating:z}),[F,z]),Ve=React__namespace.useMemo(()=>({reference:Q,floating:O}),[Q,O]),Fe=React__namespace.useMemo(()=>{const Oe={position:n,left:0,top:0};if(!Ve.floating)return Oe;const Be=roundByDPR(Ve.floating,S.x),Ue=roundByDPR(Ve.floating,S.y);return g?{...Oe,transform:"translate("+Be+"px, "+Ue+"px)",...getDPR(Ve.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Be,top:Ue}},[n,g,Ve.floating,S.x,S.y]);return React__namespace.useMemo(()=>({...S,update:je,refs:Ne,elements:Ve,floatingStyles:Fe}),[S,je,Ne,Ve,Fe])}const arrow$1=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:l}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?arrow$3({element:o.current,padding:l}).fn(n):{}:o?arrow$3({element:o,padding:l}).fn(n):{}}}},offset=(t,e)=>({...offset$1(t),options:[t,e]}),shift$1=(t,e)=>({...shift$2(t),options:[t,e]}),limitShift=(t,e)=>({...limitShift$1(t),options:[t,e]}),flip=(t,e)=>({...flip$1(t),options:[t,e]}),size=(t,e)=>({...size$1(t),options:[t,e]}),hide=(t,e)=>({...hide$1(t),options:[t,e]}),arrow$2=(t,e)=>({...arrow$1(t),options:[t,e]});var NAME$3="Arrow",Arrow$1=React__namespace.forwardRef((t,e)=>{const{children:n,width:o=10,height:l=5,...d}=t;return jsxRuntime.jsx(Primitive$4.svg,{...d,ref:e,width:o,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:jsxRuntime.jsx("polygon",{points:"0,0 30,0 15,10"})})});Arrow$1.displayName=NAME$3;var Root$9=Arrow$1,POPPER_NAME="Popper",[createPopperContext,createPopperScope]=createContextScope$2(POPPER_NAME),[PopperProvider,usePopperContext]=createPopperContext(POPPER_NAME),Popper=t=>{const{__scopePopper:e,children:n}=t,[o,l]=React__namespace.useState(null);return jsxRuntime.jsx(PopperProvider,{scope:e,anchor:o,onAnchorChange:l,children:n})};Popper.displayName=POPPER_NAME;var ANCHOR_NAME$2="PopperAnchor",PopperAnchor=React__namespace.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:o,...l}=t,d=usePopperContext(ANCHOR_NAME$2,n),f=React__namespace.useRef(null),g=useComposedRefs(e,f),b=React__namespace.useRef(null);return React__namespace.useEffect(()=>{const _=b.current;b.current=(o==null?void 0:o.current)||f.current,_!==b.current&&d.onAnchorChange(b.current)}),o?null:jsxRuntime.jsx(Primitive$4.div,{...l,ref:g})});PopperAnchor.displayName=ANCHOR_NAME$2;var CONTENT_NAME$9="PopperContent",[PopperContentProvider,useContentContext]=createPopperContext(CONTENT_NAME$9),PopperContent=React__namespace.forwardRef((t,e)=>{var Ke,at,nt,st,lt,Ge;const{__scopePopper:n,side:o="bottom",sideOffset:l=0,align:d="center",alignOffset:f=0,arrowPadding:g=0,avoidCollisions:b=!0,collisionBoundary:_=[],collisionPadding:S=0,sticky:R="partial",hideWhenDetached:C=!1,updatePositionStrategy:E="optimized",onPlaced:A,...M}=t,I=usePopperContext(CONTENT_NAME$9,n),[j,F]=React__namespace.useState(null),z=useComposedRefs(e,Ct=>F(Ct)),[Q,O]=React__namespace.useState(null),V=useSize(Q),te=(V==null?void 0:V.width)??0,ne=(V==null?void 0:V.height)??0,ae=o+(d!=="center"?"-"+d:""),$e=typeof S=="number"?S:{top:0,right:0,bottom:0,left:0,...S},ge=Array.isArray(_)?_:[_],se=ge.length>0,je={padding:$e,boundary:ge.filter(isNotNull),altBoundary:se},{refs:Ae,floatingStyles:Ne,placement:Ve,isPositioned:Fe,middlewareData:Oe}=useFloating({strategy:"fixed",placement:ae,whileElementsMounted:(...Ct)=>autoUpdate(...Ct,{animationFrame:E==="always"}),elements:{reference:I.anchor},middleware:[offset({mainAxis:l+ne,alignmentAxis:f}),b&&shift$1({mainAxis:!0,crossAxis:!1,limiter:R==="partial"?limitShift():void 0,...je}),b&&flip({...je}),size({...je,apply:({elements:Ct,rects:tt,availableWidth:yt,availableHeight:ct})=>{const{width:Rt,height:Mt}=tt.reference,It=Ct.floating.style;It.setProperty("--radix-popper-available-width",`${yt}px`),It.setProperty("--radix-popper-available-height",`${ct}px`),It.setProperty("--radix-popper-anchor-width",`${Rt}px`),It.setProperty("--radix-popper-anchor-height",`${Mt}px`)}}),Q&&arrow$2({element:Q,padding:g}),transformOrigin({arrowWidth:te,arrowHeight:ne}),C&&hide({strategy:"referenceHidden",...je})]}),[Be,Ue]=getSideAndAlignFromPlacement(Ve),ze=useCallbackRef$1(A);useLayoutEffect2(()=>{Fe&&(ze==null||ze())},[Fe,ze]);const He=(Ke=Oe.arrow)==null?void 0:Ke.x,Qe=(at=Oe.arrow)==null?void 0:at.y,et=((nt=Oe.arrow)==null?void 0:nt.centerOffset)!==0,[Je,Ze]=React__namespace.useState();return useLayoutEffect2(()=>{j&&Ze(window.getComputedStyle(j).zIndex)},[j]),jsxRuntime.jsx("div",{ref:Ae.setFloating,"data-radix-popper-content-wrapper":"",style:{...Ne,transform:Fe?Ne.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Je,"--radix-popper-transform-origin":[(st=Oe.transformOrigin)==null?void 0:st.x,(lt=Oe.transformOrigin)==null?void 0:lt.y].join(" "),...((Ge=Oe.hide)==null?void 0:Ge.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:jsxRuntime.jsx(PopperContentProvider,{scope:n,placedSide:Be,onArrowChange:O,arrowX:He,arrowY:Qe,shouldHideArrow:et,children:jsxRuntime.jsx(Primitive$4.div,{"data-side":Be,"data-align":Ue,...M,ref:z,style:{...M.style,animation:Fe?void 0:"none"}})})})});PopperContent.displayName=CONTENT_NAME$9;var ARROW_NAME$5="PopperArrow",OPPOSITE_SIDE={top:"bottom",right:"left",bottom:"top",left:"right"},PopperArrow=React__namespace.forwardRef(function(e,n){const{__scopePopper:o,...l}=e,d=useContentContext(ARROW_NAME$5,o),f=OPPOSITE_SIDE[d.placedSide];return jsxRuntime.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:jsxRuntime.jsx(Root$9,{...l,ref:n,style:{...l.style,display:"block"}})})});PopperArrow.displayName=ARROW_NAME$5;function isNotNull(t){return t!==null}var transformOrigin=t=>({name:"transformOrigin",options:t,fn(e){var I,j,F;const{placement:n,rects:o,middlewareData:l}=e,f=((I=l.arrow)==null?void 0:I.centerOffset)!==0,g=f?0:t.arrowWidth,b=f?0:t.arrowHeight,[_,S]=getSideAndAlignFromPlacement(n),R={start:"0%",center:"50%",end:"100%"}[S],C=(((j=l.arrow)==null?void 0:j.x)??0)+g/2,E=(((F=l.arrow)==null?void 0:F.y)??0)+b/2;let A="",M="";return _==="bottom"?(A=f?R:`${C}px`,M=`${-b}px`):_==="top"?(A=f?R:`${C}px`,M=`${o.floating.height+b}px`):_==="right"?(A=`${-b}px`,M=f?R:`${E}px`):_==="left"&&(A=`${o.floating.width+b}px`,M=f?R:`${E}px`),{data:{x:A,y:M}}}});function getSideAndAlignFromPlacement(t){const[e,n="center"]=t.split("-");return[e,n]}var Root2$7=Popper,Anchor=PopperAnchor,Content$2=PopperContent,Arrow=PopperArrow;function createSlot$3(t){const e=createSlotClone$3(t),n=React__namespace.forwardRef((o,l)=>{const{children:d,...f}=o,g=React__namespace.Children.toArray(d),b=g.find(isSlottable$3);if(b){const _=b.props.children,S=g.map(R=>R===b?React__namespace.Children.count(_)>1?React__namespace.Children.only(null):React__namespace.isValidElement(_)?_.props.children:null:R);return jsxRuntime.jsx(e,{...f,ref:l,children:React__namespace.isValidElement(_)?React__namespace.cloneElement(_,void 0,S):null})}return jsxRuntime.jsx(e,{...f,ref:l,children:d})});return n.displayName=`${t}.Slot`,n}function createSlotClone$3(t){const e=React__namespace.forwardRef((n,o)=>{const{children:l,...d}=n;if(React__namespace.isValidElement(l)){const f=getElementRef$3(l),g=mergeProps$3(d,l.props);return l.type!==React__namespace.Fragment&&(g.ref=o?composeRefs(o,f):f),React__namespace.cloneElement(l,g)}return React__namespace.Children.count(l)>1?React__namespace.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var SLOTTABLE_IDENTIFIER$5=Symbol("radix.slottable");function isSlottable$3(t){return React__namespace.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===SLOTTABLE_IDENTIFIER$5}function mergeProps$3(t,e){const n={...e};for(const o in e){const l=t[o],d=e[o];/^on[A-Z]/.test(o)?l&&d?n[o]=(...g)=>{const b=d(...g);return l(...g),b}:l&&(n[o]=l):o==="style"?n[o]={...l,...d}:o==="className"&&(n[o]=[l,d].filter(Boolean).join(" "))}return{...t,...n}}function getElementRef$3(t){var o,l;let e=(o=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(l=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:l.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var SELECTION_KEYS$1=["Enter"," "],FIRST_KEYS=["ArrowDown","PageUp","Home"],LAST_KEYS=["ArrowUp","PageDown","End"],FIRST_LAST_KEYS=[...FIRST_KEYS,...LAST_KEYS],SUB_OPEN_KEYS={ltr:[...SELECTION_KEYS$1,"ArrowRight"],rtl:[...SELECTION_KEYS$1,"ArrowLeft"]},SUB_CLOSE_KEYS={ltr:["ArrowLeft"],rtl:["ArrowRight"]},MENU_NAME="Menu",[Collection$3,useCollection$3,createCollectionScope$3]=createCollection(MENU_NAME),[createMenuContext,createMenuScope]=createContextScope$2(MENU_NAME,[createCollectionScope$3,createPopperScope,createRovingFocusGroupScope]),usePopperScope$3=createPopperScope(),useRovingFocusGroupScope$1=createRovingFocusGroupScope(),[MenuProvider,useMenuContext]=createMenuContext(MENU_NAME),[MenuRootProvider,useMenuRootContext]=createMenuContext(MENU_NAME),Menu=t=>{const{__scopeMenu:e,open:n=!1,children:o,dir:l,onOpenChange:d,modal:f=!0}=t,g=usePopperScope$3(e),[b,_]=React__namespace.useState(null),S=React__namespace.useRef(!1),R=useCallbackRef$1(d),C=useDirection(l);return React__namespace.useEffect(()=>{const E=()=>{S.current=!0,document.addEventListener("pointerdown",A,{capture:!0,once:!0}),document.addEventListener("pointermove",A,{capture:!0,once:!0})},A=()=>S.current=!1;return document.addEventListener("keydown",E,{capture:!0}),()=>{document.removeEventListener("keydown",E,{capture:!0}),document.removeEventListener("pointerdown",A,{capture:!0}),document.removeEventListener("pointermove",A,{capture:!0})}},[]),jsxRuntime.jsx(Root2$7,{...g,children:jsxRuntime.jsx(MenuProvider,{scope:e,open:n,onOpenChange:R,content:b,onContentChange:_,children:jsxRuntime.jsx(MenuRootProvider,{scope:e,onClose:React__namespace.useCallback(()=>R(!1),[R]),isUsingKeyboardRef:S,dir:C,modal:f,children:o})})})};Menu.displayName=MENU_NAME;var ANCHOR_NAME$1="MenuAnchor",MenuAnchor=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t,l=usePopperScope$3(n);return jsxRuntime.jsx(Anchor,{...l,...o,ref:e})});MenuAnchor.displayName=ANCHOR_NAME$1;var PORTAL_NAME$5="MenuPortal",[PortalProvider$2,usePortalContext$2]=createMenuContext(PORTAL_NAME$5,{forceMount:void 0}),MenuPortal=t=>{const{__scopeMenu:e,forceMount:n,children:o,container:l}=t,d=useMenuContext(PORTAL_NAME$5,e);return jsxRuntime.jsx(PortalProvider$2,{scope:e,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};MenuPortal.displayName=PORTAL_NAME$5;var CONTENT_NAME$8="MenuContent",[MenuContentProvider,useMenuContentContext]=createMenuContext(CONTENT_NAME$8),MenuContent=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$2(CONTENT_NAME$8,t.__scopeMenu),{forceMount:o=n.forceMount,...l}=t,d=useMenuContext(CONTENT_NAME$8,t.__scopeMenu),f=useMenuRootContext(CONTENT_NAME$8,t.__scopeMenu);return jsxRuntime.jsx(Collection$3.Provider,{scope:t.__scopeMenu,children:jsxRuntime.jsx(Presence,{present:o||d.open,children:jsxRuntime.jsx(Collection$3.Slot,{scope:t.__scopeMenu,children:f.modal?jsxRuntime.jsx(MenuRootContentModal,{...l,ref:e}):jsxRuntime.jsx(MenuRootContentNonModal,{...l,ref:e})})})})}),MenuRootContentModal=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(CONTENT_NAME$8,t.__scopeMenu),o=React__namespace.useRef(null),l=useComposedRefs(e,o);return React__namespace.useEffect(()=>{const d=o.current;if(d)return hideOthers(d)},[]),jsxRuntime.jsx(MenuContentImpl,{...t,ref:l,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:composeEventHandlers(t.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),MenuRootContentNonModal=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(CONTENT_NAME$8,t.__scopeMenu);return jsxRuntime.jsx(MenuContentImpl,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Slot$3=createSlot$3("MenuContent.ScrollLock"),MenuContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:l,onOpenAutoFocus:d,onCloseAutoFocus:f,disableOutsidePointerEvents:g,onEntryFocus:b,onEscapeKeyDown:_,onPointerDownOutside:S,onFocusOutside:R,onInteractOutside:C,onDismiss:E,disableOutsideScroll:A,...M}=t,I=useMenuContext(CONTENT_NAME$8,n),j=useMenuRootContext(CONTENT_NAME$8,n),F=usePopperScope$3(n),z=useRovingFocusGroupScope$1(n),Q=useCollection$3(n),[O,V]=React__namespace.useState(null),te=React__namespace.useRef(null),ne=useComposedRefs(e,te,I.onContentChange),ae=React__namespace.useRef(0),$e=React__namespace.useRef(""),ge=React__namespace.useRef(0),se=React__namespace.useRef(null),je=React__namespace.useRef("right"),Ae=React__namespace.useRef(0),Ne=A?ReactRemoveScroll:React__namespace.Fragment,Ve=A?{as:Slot$3,allowPinchZoom:!0}:void 0,Fe=Be=>{var Ke,at;const Ue=$e.current+Be,ze=Q().filter(nt=>!nt.disabled),He=document.activeElement,Qe=(Ke=ze.find(nt=>nt.ref.current===He))==null?void 0:Ke.textValue,et=ze.map(nt=>nt.textValue),Je=getNextMatch(et,Ue,Qe),Ze=(at=ze.find(nt=>nt.textValue===Je))==null?void 0:at.ref.current;(function nt(st){$e.current=st,window.clearTimeout(ae.current),st!==""&&(ae.current=window.setTimeout(()=>nt(""),1e3))})(Ue),Ze&&setTimeout(()=>Ze.focus())};React__namespace.useEffect(()=>()=>window.clearTimeout(ae.current),[]),useFocusGuards();const Oe=React__namespace.useCallback(Be=>{var ze,He;return je.current===((ze=se.current)==null?void 0:ze.side)&&isPointerInGraceArea(Be,(He=se.current)==null?void 0:He.area)},[]);return jsxRuntime.jsx(MenuContentProvider,{scope:n,searchRef:$e,onItemEnter:React__namespace.useCallback(Be=>{Oe(Be)&&Be.preventDefault()},[Oe]),onItemLeave:React__namespace.useCallback(Be=>{var Ue;Oe(Be)||((Ue=te.current)==null||Ue.focus(),V(null))},[Oe]),onTriggerLeave:React__namespace.useCallback(Be=>{Oe(Be)&&Be.preventDefault()},[Oe]),pointerGraceTimerRef:ge,onPointerGraceIntentChange:React__namespace.useCallback(Be=>{se.current=Be},[]),children:jsxRuntime.jsx(Ne,{...Ve,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:l,onMountAutoFocus:composeEventHandlers(d,Be=>{var Ue;Be.preventDefault(),(Ue=te.current)==null||Ue.focus({preventScroll:!0})}),onUnmountAutoFocus:f,children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:g,onEscapeKeyDown:_,onPointerDownOutside:S,onFocusOutside:R,onInteractOutside:C,onDismiss:E,children:jsxRuntime.jsx(Root$c,{asChild:!0,...z,dir:j.dir,orientation:"vertical",loop:o,currentTabStopId:O,onCurrentTabStopIdChange:V,onEntryFocus:composeEventHandlers(b,Be=>{j.isUsingKeyboardRef.current||Be.preventDefault()}),preventScrollOnEntryFocus:!0,children:jsxRuntime.jsx(Content$2,{role:"menu","aria-orientation":"vertical","data-state":getOpenState(I.open),"data-radix-menu-content":"",dir:j.dir,...F,...M,ref:ne,style:{outline:"none",...M.style},onKeyDown:composeEventHandlers(M.onKeyDown,Be=>{const ze=Be.target.closest("[data-radix-menu-content]")===Be.currentTarget,He=Be.ctrlKey||Be.altKey||Be.metaKey,Qe=Be.key.length===1;ze&&(Be.key==="Tab"&&Be.preventDefault(),!He&&Qe&&Fe(Be.key));const et=te.current;if(Be.target!==et||!FIRST_LAST_KEYS.includes(Be.key))return;Be.preventDefault();const Ze=Q().filter(Ke=>!Ke.disabled).map(Ke=>Ke.ref.current);LAST_KEYS.includes(Be.key)&&Ze.reverse(),focusFirst$1(Ze)}),onBlur:composeEventHandlers(t.onBlur,Be=>{Be.currentTarget.contains(Be.target)||(window.clearTimeout(ae.current),$e.current="")}),onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(Be=>{const Ue=Be.target,ze=Ae.current!==Be.clientX;if(Be.currentTarget.contains(Ue)&&ze){const He=Be.clientX>Ae.current?"right":"left";je.current=He,Ae.current=Be.clientX}}))})})})})})})});MenuContent.displayName=CONTENT_NAME$8;var GROUP_NAME$2="MenuGroup",MenuGroup=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive$4.div,{role:"group",...o,ref:e})});MenuGroup.displayName=GROUP_NAME$2;var LABEL_NAME$2="MenuLabel",MenuLabel=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive$4.div,{...o,ref:e})});MenuLabel.displayName=LABEL_NAME$2;var ITEM_NAME$3="MenuItem",ITEM_SELECT="menu.itemSelect",MenuItem=React__namespace.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:o,...l}=t,d=React__namespace.useRef(null),f=useMenuRootContext(ITEM_NAME$3,t.__scopeMenu),g=useMenuContentContext(ITEM_NAME$3,t.__scopeMenu),b=useComposedRefs(e,d),_=React__namespace.useRef(!1),S=()=>{const R=d.current;if(!n&&R){const C=new CustomEvent(ITEM_SELECT,{bubbles:!0,cancelable:!0});R.addEventListener(ITEM_SELECT,E=>o==null?void 0:o(E),{once:!0}),dispatchDiscreteCustomEvent(R,C),C.defaultPrevented?_.current=!1:f.onClose()}};return jsxRuntime.jsx(MenuItemImpl,{...l,ref:b,disabled:n,onClick:composeEventHandlers(t.onClick,S),onPointerDown:R=>{var C;(C=t.onPointerDown)==null||C.call(t,R),_.current=!0},onPointerUp:composeEventHandlers(t.onPointerUp,R=>{var C;_.current||(C=R.currentTarget)==null||C.click()}),onKeyDown:composeEventHandlers(t.onKeyDown,R=>{const C=g.searchRef.current!=="";n||C&&R.key===" "||SELECTION_KEYS$1.includes(R.key)&&(R.currentTarget.click(),R.preventDefault())})})});MenuItem.displayName=ITEM_NAME$3;var MenuItemImpl=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:o=!1,textValue:l,...d}=t,f=useMenuContentContext(ITEM_NAME$3,n),g=useRovingFocusGroupScope$1(n),b=React__namespace.useRef(null),_=useComposedRefs(e,b),[S,R]=React__namespace.useState(!1),[C,E]=React__namespace.useState("");return React__namespace.useEffect(()=>{const A=b.current;A&&E((A.textContent??"").trim())},[d.children]),jsxRuntime.jsx(Collection$3.ItemSlot,{scope:n,disabled:o,textValue:l??C,children:jsxRuntime.jsx(Item$3,{asChild:!0,...g,focusable:!o,children:jsxRuntime.jsx(Primitive$4.div,{role:"menuitem","data-highlighted":S?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...d,ref:_,onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(A=>{o?f.onItemLeave(A):(f.onItemEnter(A),A.defaultPrevented||A.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:composeEventHandlers(t.onPointerLeave,whenMouse(A=>f.onItemLeave(A))),onFocus:composeEventHandlers(t.onFocus,()=>R(!0)),onBlur:composeEventHandlers(t.onBlur,()=>R(!1))})})})}),CHECKBOX_ITEM_NAME$1="MenuCheckboxItem",MenuCheckboxItem=React__namespace.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:o,...l}=t;return jsxRuntime.jsx(ItemIndicatorProvider,{scope:t.__scopeMenu,checked:n,children:jsxRuntime.jsx(MenuItem,{role:"menuitemcheckbox","aria-checked":isIndeterminate$1(n)?"mixed":n,...l,ref:e,"data-state":getCheckedState(n),onSelect:composeEventHandlers(l.onSelect,()=>o==null?void 0:o(isIndeterminate$1(n)?!0:!n),{checkForDefaultPrevented:!1})})})});MenuCheckboxItem.displayName=CHECKBOX_ITEM_NAME$1;var RADIO_GROUP_NAME$1="MenuRadioGroup",[RadioGroupProvider,useRadioGroupContext]=createMenuContext(RADIO_GROUP_NAME$1,{value:void 0,onValueChange:()=>{}}),MenuRadioGroup=React__namespace.forwardRef((t,e)=>{const{value:n,onValueChange:o,...l}=t,d=useCallbackRef$1(o);return jsxRuntime.jsx(RadioGroupProvider,{scope:t.__scopeMenu,value:n,onValueChange:d,children:jsxRuntime.jsx(MenuGroup,{...l,ref:e})})});MenuRadioGroup.displayName=RADIO_GROUP_NAME$1;var RADIO_ITEM_NAME$1="MenuRadioItem",MenuRadioItem=React__namespace.forwardRef((t,e)=>{const{value:n,...o}=t,l=useRadioGroupContext(RADIO_ITEM_NAME$1,t.__scopeMenu),d=n===l.value;return jsxRuntime.jsx(ItemIndicatorProvider,{scope:t.__scopeMenu,checked:d,children:jsxRuntime.jsx(MenuItem,{role:"menuitemradio","aria-checked":d,...o,ref:e,"data-state":getCheckedState(d),onSelect:composeEventHandlers(o.onSelect,()=>{var f;return(f=l.onValueChange)==null?void 0:f.call(l,n)},{checkForDefaultPrevented:!1})})})});MenuRadioItem.displayName=RADIO_ITEM_NAME$1;var ITEM_INDICATOR_NAME$1="MenuItemIndicator",[ItemIndicatorProvider,useItemIndicatorContext]=createMenuContext(ITEM_INDICATOR_NAME$1,{checked:!1}),MenuItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:o,...l}=t,d=useItemIndicatorContext(ITEM_INDICATOR_NAME$1,n);return jsxRuntime.jsx(Presence,{present:o||isIndeterminate$1(d.checked)||d.checked===!0,children:jsxRuntime.jsx(Primitive$4.span,{...l,ref:e,"data-state":getCheckedState(d.checked)})})});MenuItemIndicator.displayName=ITEM_INDICATOR_NAME$1;var SEPARATOR_NAME$2="MenuSeparator",MenuSeparator=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t;return jsxRuntime.jsx(Primitive$4.div,{role:"separator","aria-orientation":"horizontal",...o,ref:e})});MenuSeparator.displayName=SEPARATOR_NAME$2;var ARROW_NAME$4="MenuArrow",MenuArrow=React__namespace.forwardRef((t,e)=>{const{__scopeMenu:n,...o}=t,l=usePopperScope$3(n);return jsxRuntime.jsx(Arrow,{...l,...o,ref:e})});MenuArrow.displayName=ARROW_NAME$4;var SUB_NAME="MenuSub",[MenuSubProvider,useMenuSubContext]=createMenuContext(SUB_NAME),MenuSub=t=>{const{__scopeMenu:e,children:n,open:o=!1,onOpenChange:l}=t,d=useMenuContext(SUB_NAME,e),f=usePopperScope$3(e),[g,b]=React__namespace.useState(null),[_,S]=React__namespace.useState(null),R=useCallbackRef$1(l);return React__namespace.useEffect(()=>(d.open===!1&&R(!1),()=>R(!1)),[d.open,R]),jsxRuntime.jsx(Root2$7,{...f,children:jsxRuntime.jsx(MenuProvider,{scope:e,open:o,onOpenChange:R,content:_,onContentChange:S,children:jsxRuntime.jsx(MenuSubProvider,{scope:e,contentId:useId(),triggerId:useId(),trigger:g,onTriggerChange:b,children:n})})})};MenuSub.displayName=SUB_NAME;var SUB_TRIGGER_NAME$1="MenuSubTrigger",MenuSubTrigger=React__namespace.forwardRef((t,e)=>{const n=useMenuContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),o=useMenuRootContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),l=useMenuSubContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),d=useMenuContentContext(SUB_TRIGGER_NAME$1,t.__scopeMenu),f=React__namespace.useRef(null),{pointerGraceTimerRef:g,onPointerGraceIntentChange:b}=d,_={__scopeMenu:t.__scopeMenu},S=React__namespace.useCallback(()=>{f.current&&window.clearTimeout(f.current),f.current=null},[]);return React__namespace.useEffect(()=>S,[S]),React__namespace.useEffect(()=>{const R=g.current;return()=>{window.clearTimeout(R),b(null)}},[g,b]),jsxRuntime.jsx(MenuAnchor,{asChild:!0,..._,children:jsxRuntime.jsx(MenuItemImpl,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":l.contentId,"data-state":getOpenState(n.open),...t,ref:composeRefs(e,l.onTriggerChange),onClick:R=>{var C;(C=t.onClick)==null||C.call(t,R),!(t.disabled||R.defaultPrevented)&&(R.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:composeEventHandlers(t.onPointerMove,whenMouse(R=>{d.onItemEnter(R),!R.defaultPrevented&&!t.disabled&&!n.open&&!f.current&&(d.onPointerGraceIntentChange(null),f.current=window.setTimeout(()=>{n.onOpenChange(!0),S()},100))})),onPointerLeave:composeEventHandlers(t.onPointerLeave,whenMouse(R=>{var E,A;S();const C=(E=n.content)==null?void 0:E.getBoundingClientRect();if(C){const M=(A=n.content)==null?void 0:A.dataset.side,I=M==="right",j=I?-5:5,F=C[I?"left":"right"],z=C[I?"right":"left"];d.onPointerGraceIntentChange({area:[{x:R.clientX+j,y:R.clientY},{x:F,y:C.top},{x:z,y:C.top},{x:z,y:C.bottom},{x:F,y:C.bottom}],side:M}),window.clearTimeout(g.current),g.current=window.setTimeout(()=>d.onPointerGraceIntentChange(null),300)}else{if(d.onTriggerLeave(R),R.defaultPrevented)return;d.onPointerGraceIntentChange(null)}})),onKeyDown:composeEventHandlers(t.onKeyDown,R=>{var E;const C=d.searchRef.current!=="";t.disabled||C&&R.key===" "||SUB_OPEN_KEYS[o.dir].includes(R.key)&&(n.onOpenChange(!0),(E=n.content)==null||E.focus(),R.preventDefault())})})})});MenuSubTrigger.displayName=SUB_TRIGGER_NAME$1;var SUB_CONTENT_NAME$1="MenuSubContent",MenuSubContent=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$2(CONTENT_NAME$8,t.__scopeMenu),{forceMount:o=n.forceMount,...l}=t,d=useMenuContext(CONTENT_NAME$8,t.__scopeMenu),f=useMenuRootContext(CONTENT_NAME$8,t.__scopeMenu),g=useMenuSubContext(SUB_CONTENT_NAME$1,t.__scopeMenu),b=React__namespace.useRef(null),_=useComposedRefs(e,b);return jsxRuntime.jsx(Collection$3.Provider,{scope:t.__scopeMenu,children:jsxRuntime.jsx(Presence,{present:o||d.open,children:jsxRuntime.jsx(Collection$3.Slot,{scope:t.__scopeMenu,children:jsxRuntime.jsx(MenuContentImpl,{id:g.contentId,"aria-labelledby":g.triggerId,...l,ref:_,align:"start",side:f.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:S=>{var R;f.isUsingKeyboardRef.current&&((R=b.current)==null||R.focus()),S.preventDefault()},onCloseAutoFocus:S=>S.preventDefault(),onFocusOutside:composeEventHandlers(t.onFocusOutside,S=>{S.target!==g.trigger&&d.onOpenChange(!1)}),onEscapeKeyDown:composeEventHandlers(t.onEscapeKeyDown,S=>{f.onClose(),S.preventDefault()}),onKeyDown:composeEventHandlers(t.onKeyDown,S=>{var E;const R=S.currentTarget.contains(S.target),C=SUB_CLOSE_KEYS[f.dir].includes(S.key);R&&C&&(d.onOpenChange(!1),(E=g.trigger)==null||E.focus(),S.preventDefault())})})})})})});MenuSubContent.displayName=SUB_CONTENT_NAME$1;function getOpenState(t){return t?"open":"closed"}function isIndeterminate$1(t){return t==="indeterminate"}function getCheckedState(t){return isIndeterminate$1(t)?"indeterminate":t?"checked":"unchecked"}function focusFirst$1(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function wrapArray$1(t,e){return t.map((n,o)=>t[(e+o)%t.length])}function getNextMatch(t,e,n){const l=e.length>1&&Array.from(e).every(_=>_===e[0])?e[0]:e,d=n?t.indexOf(n):-1;let f=wrapArray$1(t,Math.max(d,0));l.length===1&&(f=f.filter(_=>_!==n));const b=f.find(_=>_.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function isPointInPolygon$1(t,e){const{x:n,y:o}=t;let l=!1;for(let d=0,f=e.length-1;d<e.length;f=d++){const g=e[d],b=e[f],_=g.x,S=g.y,R=b.x,C=b.y;S>o!=C>o&&n<(R-_)*(o-S)/(C-S)+_&&(l=!l)}return l}function isPointerInGraceArea(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return isPointInPolygon$1(n,e)}function whenMouse(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Root3$1=Menu,Anchor2$1=MenuAnchor,Portal$3=MenuPortal,Content2$6=MenuContent,Group$1=MenuGroup,Label$4=MenuLabel,Item2$1=MenuItem,CheckboxItem=MenuCheckboxItem,RadioGroup=MenuRadioGroup,RadioItem=MenuRadioItem,ItemIndicator$1=MenuItemIndicator,Separator$3=MenuSeparator,Arrow2=MenuArrow,Sub=MenuSub,SubTrigger=MenuSubTrigger,SubContent=MenuSubContent,DROPDOWN_MENU_NAME="DropdownMenu",[createDropdownMenuContext]=createContextScope$2(DROPDOWN_MENU_NAME,[createMenuScope]),useMenuScope=createMenuScope(),[DropdownMenuProvider,useDropdownMenuContext]=createDropdownMenuContext(DROPDOWN_MENU_NAME),DropdownMenu$1=t=>{const{__scopeDropdownMenu:e,children:n,dir:o,open:l,defaultOpen:d,onOpenChange:f,modal:g=!0}=t,b=useMenuScope(e),_=React__namespace.useRef(null),[S,R]=useControllableState({prop:l,defaultProp:d??!1,onChange:f,caller:DROPDOWN_MENU_NAME});return jsxRuntime.jsx(DropdownMenuProvider,{scope:e,triggerId:useId(),triggerRef:_,contentId:useId(),open:S,onOpenChange:R,onOpenToggle:React__namespace.useCallback(()=>R(C=>!C),[R]),modal:g,children:jsxRuntime.jsx(Root3$1,{...b,open:S,onOpenChange:R,dir:o,modal:g,children:n})})};DropdownMenu$1.displayName=DROPDOWN_MENU_NAME;var TRIGGER_NAME$8="DropdownMenuTrigger",DropdownMenuTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...l}=t,d=useDropdownMenuContext(TRIGGER_NAME$8,n),f=useMenuScope(n);return jsxRuntime.jsx(Anchor2$1,{asChild:!0,...f,children:jsxRuntime.jsx(Primitive$4.button,{type:"button",id:d.triggerId,"aria-haspopup":"menu","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":d.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...l,ref:composeRefs(e,d.triggerRef),onPointerDown:composeEventHandlers(t.onPointerDown,g=>{!o&&g.button===0&&g.ctrlKey===!1&&(d.onOpenToggle(),d.open||g.preventDefault())}),onKeyDown:composeEventHandlers(t.onKeyDown,g=>{o||(["Enter"," "].includes(g.key)&&d.onOpenToggle(),g.key==="ArrowDown"&&d.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(g.key)&&g.preventDefault())})})})});DropdownMenuTrigger$1.displayName=TRIGGER_NAME$8;var PORTAL_NAME$4="DropdownMenuPortal",DropdownMenuPortal$1=t=>{const{__scopeDropdownMenu:e,...n}=t,o=useMenuScope(e);return jsxRuntime.jsx(Portal$3,{...o,...n})};DropdownMenuPortal$1.displayName=PORTAL_NAME$4;var CONTENT_NAME$7="DropdownMenuContent",DropdownMenuContent$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useDropdownMenuContext(CONTENT_NAME$7,n),d=useMenuScope(n),f=React__namespace.useRef(!1);return jsxRuntime.jsx(Content2$6,{id:l.contentId,"aria-labelledby":l.triggerId,...d,...o,ref:e,onCloseAutoFocus:composeEventHandlers(t.onCloseAutoFocus,g=>{var b;f.current||(b=l.triggerRef.current)==null||b.focus(),f.current=!1,g.preventDefault()}),onInteractOutside:composeEventHandlers(t.onInteractOutside,g=>{const b=g.detail.originalEvent,_=b.button===0&&b.ctrlKey===!0,S=b.button===2||_;(!l.modal||S)&&(f.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DropdownMenuContent$1.displayName=CONTENT_NAME$7;var GROUP_NAME$1="DropdownMenuGroup",DropdownMenuGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Group$1,{...l,...o,ref:e})});DropdownMenuGroup$1.displayName=GROUP_NAME$1;var LABEL_NAME$1="DropdownMenuLabel",DropdownMenuLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Label$4,{...l,...o,ref:e})});DropdownMenuLabel$1.displayName=LABEL_NAME$1;var ITEM_NAME$2="DropdownMenuItem",DropdownMenuItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Item2$1,{...l,...o,ref:e})});DropdownMenuItem$1.displayName=ITEM_NAME$2;var CHECKBOX_ITEM_NAME="DropdownMenuCheckboxItem",DropdownMenuCheckboxItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(CheckboxItem,{...l,...o,ref:e})});DropdownMenuCheckboxItem$1.displayName=CHECKBOX_ITEM_NAME;var RADIO_GROUP_NAME="DropdownMenuRadioGroup",DropdownMenuRadioGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(RadioGroup,{...l,...o,ref:e})});DropdownMenuRadioGroup$1.displayName=RADIO_GROUP_NAME;var RADIO_ITEM_NAME="DropdownMenuRadioItem",DropdownMenuRadioItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(RadioItem,{...l,...o,ref:e})});DropdownMenuRadioItem$1.displayName=RADIO_ITEM_NAME;var INDICATOR_NAME$2="DropdownMenuItemIndicator",DropdownMenuItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(ItemIndicator$1,{...l,...o,ref:e})});DropdownMenuItemIndicator.displayName=INDICATOR_NAME$2;var SEPARATOR_NAME$1="DropdownMenuSeparator",DropdownMenuSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Separator$3,{...l,...o,ref:e})});DropdownMenuSeparator$1.displayName=SEPARATOR_NAME$1;var ARROW_NAME$3="DropdownMenuArrow",DropdownMenuArrow=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(Arrow2,{...l,...o,ref:e})});DropdownMenuArrow.displayName=ARROW_NAME$3;var DropdownMenuSub$1=t=>{const{__scopeDropdownMenu:e,children:n,open:o,onOpenChange:l,defaultOpen:d}=t,f=useMenuScope(e),[g,b]=useControllableState({prop:o,defaultProp:d??!1,onChange:l,caller:"DropdownMenuSub"});return jsxRuntime.jsx(Sub,{...f,open:g,onOpenChange:b,children:n})},SUB_TRIGGER_NAME="DropdownMenuSubTrigger",DropdownMenuSubTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(SubTrigger,{...l,...o,ref:e})});DropdownMenuSubTrigger$1.displayName=SUB_TRIGGER_NAME;var SUB_CONTENT_NAME="DropdownMenuSubContent",DropdownMenuSubContent$1=React__namespace.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...o}=t,l=useMenuScope(n);return jsxRuntime.jsx(SubContent,{...l,...o,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DropdownMenuSubContent$1.displayName=SUB_CONTENT_NAME;var Root2$6=DropdownMenu$1,Trigger$5=DropdownMenuTrigger$1,Portal2$1=DropdownMenuPortal$1,Content2$5=DropdownMenuContent$1,Group2=DropdownMenuGroup$1,Label2=DropdownMenuLabel$1,Item2=DropdownMenuItem$1,CheckboxItem2=DropdownMenuCheckboxItem$1,RadioGroup2=DropdownMenuRadioGroup$1,RadioItem2=DropdownMenuRadioItem$1,ItemIndicator2=DropdownMenuItemIndicator,Separator2=DropdownMenuSeparator$1,Sub2=DropdownMenuSub$1,SubTrigger2=DropdownMenuSubTrigger$1,SubContent2=DropdownMenuSubContent$1;const DropdownMenu=Root2$6,DropdownMenuTrigger=Trigger$5,DropdownMenuGroup=Group2,DropdownMenuPortal=Portal2$1,DropdownMenuSub=Sub2,DropdownMenuRadioGroup=RadioGroup2,DropdownMenuSubTrigger=React__namespace.forwardRef(({className:t,inset:e,children:n,...o},l)=>jsxRuntime.jsxs(SubTrigger2,{ref:l,className:cn("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",t),...o,children:[n,jsxRuntime.jsx(ChevronRight,{className:"ml-auto"})]}));DropdownMenuSubTrigger.displayName=SubTrigger2.displayName;const DropdownMenuSubContent=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(SubContent2,{ref:n,className:cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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 origin-[--radix-dropdown-menu-content-transform-origin]",t),...e}));DropdownMenuSubContent.displayName=SubContent2.displayName;const DropdownMenuContent=React__namespace.forwardRef(({className:t,sideOffset:e=4,...n},o)=>jsxRuntime.jsx(Portal2$1,{children:jsxRuntime.jsx(Content2$5,{ref:o,sideOffset:e,className:cn("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-dropdown-menu-content-transform-origin]",t),...n})}));DropdownMenuContent.displayName=Content2$5.displayName;const DropdownMenuItem=React__namespace.forwardRef(({className:t,inset:e,...n},o)=>jsxRuntime.jsx(Item2,{ref:o,className:cn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",e&&"pl-8",t),...n}));DropdownMenuItem.displayName=Item2.displayName;const DropdownMenuCheckboxItem=React__namespace.forwardRef(({className:t,children:e,checked:n,...o},l)=>jsxRuntime.jsxs(CheckboxItem2,{ref:l,className:cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...o,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator2,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),e]}));DropdownMenuCheckboxItem.displayName=CheckboxItem2.displayName;const DropdownMenuRadioItem=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(RadioItem2,{ref:o,className:cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator2,{children:jsxRuntime.jsx(Circle,{className:"h-2 w-2 fill-current"})})}),e]}));DropdownMenuRadioItem.displayName=RadioItem2.displayName;const DropdownMenuLabel=React__namespace.forwardRef(({className:t,inset:e,...n},o)=>jsxRuntime.jsx(Label2,{ref:o,className:cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));DropdownMenuLabel.displayName=Label2.displayName;const DropdownMenuSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator2,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",t),...e}));DropdownMenuSeparator.displayName=Separator2.displayName;const DropdownMenuShortcut=({className:t,...e})=>jsxRuntime.jsx("span",{className:cn("ml-auto text-xs tracking-widest opacity-60",t),...e});DropdownMenuShortcut.displayName="DropdownMenuShortcut";function ProductInventoryGrid({inventory:t,showBinLocation:e,className:n}){const o=(F,z,Q=!1,O=!0)=>{const V=F.WarehouseType==="Fulfillment Center",te=V?"bg-white":"bg-white/70 text-gray-600",ne=O&&z>0?"border-t":"",ae=Q?"border-r":"",$e=F.Status??"Unknown",ge=$e==="Active";let se="bg-emerald-100 text-emerald-800 ring-1 ring-emerald-200";switch(F.WarehouseType){case"Last Mile":se="bg-blue-100 text-blue-800 ring-1 ring-blue-200";break;case"First Mile":se="bg-purple-100 text-purple-800 ring-1 ring-purple-200";break}switch($e){case"Closing":se="bg-yellow-100 text-yellow-800 ring-1 ring-yellow-200";break;case"Closed":se="bg-red-100 text-red-800 ring-1 ring-red-200";break}return jsxRuntime.jsxs("article",{"aria-labelledby":`wh-${F.WarehouseId}-name`,className:`p-3 text-sm ${ne} ${ae} ${te}`,children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("h3",{id:`wh-${F.WarehouseId}-name`,className:`text-sm font-medium ${V?"text-gray-900":"text-gray-800"}`,children:F.Name}),jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-2 rounded-full px-2 py-0.5 text-xs font-semibold ${se}`,"aria-hidden":"false",title:ge?V?"Fulfillment Center":"Satellite Warehouse":`Status: ${$e}`,children:[V?jsxRuntime.jsx(Warehouse,{className:"h-3 w-3","aria-hidden":"true"}):jsxRuntime.jsx(Truck,{className:`h-3 w-3 ${ge?"opacity-80":"opacity-95"}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"sr-only",children:ge?F.WarehouseType?`${F.WarehouseType} warehouse`:"Warehouse":`Status: ${$e}`}),jsxRuntime.jsx("span",{"aria-hidden":"true",children:ge?F.WarehouseType||(V?"Fulfillment Center":"Satellite"):$e})]})]}),jsxRuntime.jsx("div",{className:"text-right",children:jsxRuntime.jsx("div",{className:"text-sm font-medium",children:formatNumber(F.AvailableQuantity??0)})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-1 text-xs text-gray-600",children:[jsxRuntime.jsx("span",{children:"Expecting"}),jsxRuntime.jsx("span",{children:F.PurchaseOrderQuantity?formatNumber(F.PurchaseOrderQuantity):"—"})]}),e&&jsxRuntime.jsxs("div",{className:"flex justify-between mt-1 text-xs text-gray-600",children:[jsxRuntime.jsx("span",{children:"Bin Location"}),jsxRuntime.jsx("span",{children:F.BinLocation||"—"})]})]},`warehouse-${F.WarehouseId}`)},l=["MTL","TOR"],d=["VAN","EDM"],f=[...t].sort((F,z)=>(F.Name||"").localeCompare(z.Name||"")),g=f.filter(F=>F.Country==="US"),b=f.filter(F=>F.Country==="CA"),_=f.filter(F=>d.includes(F.WarehouseId||"")),S=f.filter(F=>l.includes(F.WarehouseId||"")),R=b.filter(F=>!l.includes(F.WarehouseId||"")&&!d.includes(F.WarehouseId||"")),C=F=>F.reduce((z,Q)=>z+(Q.AvailableQuantity||0),0),E=C(b),A=C(S),M=C(_),I=C(g),j=E+I;return jsxRuntime.jsxs("div",{className:`border rounded-md overflow-hidden ${n??""}`,children:[b.length>0&&g.length>0&&jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-b",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"Total"}),jsxRuntime.jsx("span",{children:j})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),b.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-b bg-gray-50",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"Canada"}),jsxRuntime.jsx("span",{children:formatNumber(E)})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2",children:[jsxRuntime.jsxs("div",{className:"border-r",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"West"}),jsxRuntime.jsx("span",{children:formatNumber(M)})]}),_.map((F,z)=>o(F,z))]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"East"}),jsxRuntime.jsx("span",{children:formatNumber(A)})]}),S.map((F,z)=>o(F,z))]})]}),R.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"border-t p-3 font-semibold text-sm",children:jsxRuntime.jsx("span",{children:"Other"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-2",children:R.map((F,z)=>o(F,z,z%2===0,!0))})]})]}),g.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 border-t bg-gray-50",children:[jsxRuntime.jsxs("div",{className:"p-3 font-semibold text-sm flex justify-between",children:[jsxRuntime.jsx("span",{children:"United States"}),jsxRuntime.jsx("span",{children:formatNumber(I)})]}),jsxRuntime.jsx("div",{className:"p-3"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2",children:g.map((F,z)=>o(F,z,z%2===0,!0))})]}),t.length===0&&jsxRuntime.jsx("div",{className:"p-6 text-center text-gray-500",children:"No inventory information available"})]})}var REACT_LAZY_TYPE=Symbol.for("react.lazy"),use=React__namespace[" use ".trim().toString()];function isPromiseLike(t){return typeof t=="object"&&t!==null&&"then"in t}function isLazyComponent(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===REACT_LAZY_TYPE&&"_payload"in t&&isPromiseLike(t._payload)}function createSlot$2(t){const e=createSlotClone$2(t),n=React__namespace.forwardRef((o,l)=>{let{children:d,...f}=o;isLazyComponent(d)&&typeof use=="function"&&(d=use(d._payload));const g=React__namespace.Children.toArray(d),b=g.find(isSlottable$2);if(b){const _=b.props.children,S=g.map(R=>R===b?React__namespace.Children.count(_)>1?React__namespace.Children.only(null):React__namespace.isValidElement(_)?_.props.children:null:R);return jsxRuntime.jsx(e,{...f,ref:l,children:React__namespace.isValidElement(_)?React__namespace.cloneElement(_,void 0,S):null})}return jsxRuntime.jsx(e,{...f,ref:l,children:d})});return n.displayName=`${t}.Slot`,n}var Slot$2=createSlot$2("Slot");function createSlotClone$2(t){const e=React__namespace.forwardRef((n,o)=>{let{children:l,...d}=n;if(isLazyComponent(l)&&typeof use=="function"&&(l=use(l._payload)),React__namespace.isValidElement(l)){const f=getElementRef$2(l),g=mergeProps$2(d,l.props);return l.type!==React__namespace.Fragment&&(g.ref=o?composeRefs(o,f):f),React__namespace.cloneElement(l,g)}return React__namespace.Children.count(l)>1?React__namespace.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var SLOTTABLE_IDENTIFIER$4=Symbol("radix.slottable");function isSlottable$2(t){return React__namespace.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===SLOTTABLE_IDENTIFIER$4}function mergeProps$2(t,e){const n={...e};for(const o in e){const l=t[o],d=e[o];/^on[A-Z]/.test(o)?l&&d?n[o]=(...g)=>{const b=d(...g);return l(...g),b}:l&&(n[o]=l):o==="style"?n[o]={...l,...d}:o==="className"&&(n[o]=[l,d].filter(Boolean).join(" "))}return{...t,...n}}function getElementRef$2(t){var o,l;let e=(o=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(l=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:l.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const falsyToString=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,cx=clsx,cva=(t,e)=>n=>{var o;if((e==null?void 0:e.variants)==null)return cx(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:l,defaultVariants:d}=e,f=Object.keys(l).map(_=>{const S=n==null?void 0:n[_],R=d==null?void 0:d[_];if(S===null)return null;const C=falsyToString(S)||falsyToString(R);return l[_][C]}),g=n&&Object.entries(n).reduce((_,S)=>{let[R,C]=S;return C===void 0||(_[R]=C),_},{}),b=e==null||(o=e.compoundVariants)===null||o===void 0?void 0:o.reduce((_,S)=>{let{class:R,className:C,...E}=S;return Object.entries(E).every(A=>{let[M,I]=A;return Array.isArray(I)?I.includes({...d,...g}[M]):{...d,...g}[M]===I})?[..._,R,C]:_},[]);return cx(t,f,b,n==null?void 0:n.class,n==null?void 0:n.className)},buttonVariants=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input text-foreground bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",defaultOutline:"border border-red-600/30 text-red-600 bg-background shadow-xs hover:bg-red-600/5 ",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",blue:"bg-randmar-blue text-gray-100 shadow-sm hover:bg-randmar-blue/90",red:"bg-randmar-red text-gray-100 shadow-sm hover:bg-randmar-red/90",purple:"bg-randmar-purple text-gray-100 shadow-sm hover:bg-randmar-purple/90",none:""},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Button$1=React__namespace.forwardRef(({className:t,variant:e,size:n,asChild:o=!1,confirmationDialog:l,onClick:d,...f},g)=>{const b=o?Slot$2:"button";if(!l)return jsxRuntime.jsx(b,{className:cn(buttonVariants({variant:e,size:n,className:t})),ref:g,onClick:d,...f});d&&console.warn("Button: You provided both onClick and confirmationDialog props. The onClick prop will be ignored. Use the onConfirm callback in confirmationDialog instead.");const{title:_,content:S,onConfirm:R,confirmText:C="Confirm",cancelText:E="Cancel"}=l,A=()=>{R()};return jsxRuntime.jsxs(Dialog,{children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(b,{className:cn(buttonVariants({variant:e,size:n,className:t})),ref:g,...f})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:_}),jsxRuntime.jsx(DialogDescription,{children:S})]}),jsxRuntime.jsxs(DialogFooter,{className:"flex justify-end gap-2 pt-4",children:[jsxRuntime.jsx(DialogClose,{asChild:!0,children:jsxRuntime.jsx(Button$1,{variant:"outline",children:E})}),jsxRuntime.jsx(DialogClose,{asChild:!0,children:jsxRuntime.jsx(Button$1,{onClick:A,children:C})})]})]})]})});Button$1.displayName="Button";var SLOTTABLE_IDENTIFIER$3=Symbol("radix.slottable");function createSlottable$1(t){const e=({children:n})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=SLOTTABLE_IDENTIFIER$3,e}var VISUALLY_HIDDEN_STYLES=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),NAME$2="VisuallyHidden",VisuallyHidden=React__namespace.forwardRef((t,e)=>jsxRuntime.jsx(Primitive$4.span,{...t,ref:e,style:{...VISUALLY_HIDDEN_STYLES,...t.style}}));VisuallyHidden.displayName=NAME$2;var Root$8=VisuallyHidden,[createTooltipContext]=createContextScope$2("Tooltip",[createPopperScope]),usePopperScope$2=createPopperScope(),PROVIDER_NAME$1="TooltipProvider",DEFAULT_DELAY_DURATION=700,TOOLTIP_OPEN="tooltip.open",[TooltipProviderContextProvider,useTooltipProviderContext]=createTooltipContext(PROVIDER_NAME$1),TooltipProvider$1=t=>{const{__scopeTooltip:e,delayDuration:n=DEFAULT_DELAY_DURATION,skipDelayDuration:o=300,disableHoverableContent:l=!1,children:d}=t,f=React__namespace.useRef(!0),g=React__namespace.useRef(!1),b=React__namespace.useRef(0);return React__namespace.useEffect(()=>{const _=b.current;return()=>window.clearTimeout(_)},[]),jsxRuntime.jsx(TooltipProviderContextProvider,{scope:e,isOpenDelayedRef:f,delayDuration:n,onOpen:React__namespace.useCallback(()=>{window.clearTimeout(b.current),f.current=!1},[]),onClose:React__namespace.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>f.current=!0,o)},[o]),isPointerInTransitRef:g,onPointerInTransitChange:React__namespace.useCallback(_=>{g.current=_},[]),disableHoverableContent:l,children:d})};TooltipProvider$1.displayName=PROVIDER_NAME$1;var TOOLTIP_NAME="Tooltip",[TooltipContextProvider,useTooltipContext]=createTooltipContext(TOOLTIP_NAME),Tooltip$2=t=>{const{__scopeTooltip:e,children:n,open:o,defaultOpen:l,onOpenChange:d,disableHoverableContent:f,delayDuration:g}=t,b=useTooltipProviderContext(TOOLTIP_NAME,t.__scopeTooltip),_=usePopperScope$2(e),[S,R]=React__namespace.useState(null),C=useId(),E=React__namespace.useRef(0),A=f??b.disableHoverableContent,M=g??b.delayDuration,I=React__namespace.useRef(!1),[j,F]=useControllableState({prop:o,defaultProp:l??!1,onChange:te=>{te?(b.onOpen(),document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))):b.onClose(),d==null||d(te)},caller:TOOLTIP_NAME}),z=React__namespace.useMemo(()=>j?I.current?"delayed-open":"instant-open":"closed",[j]),Q=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=0,I.current=!1,F(!0)},[F]),O=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=0,F(!1)},[F]),V=React__namespace.useCallback(()=>{window.clearTimeout(E.current),E.current=window.setTimeout(()=>{I.current=!0,F(!0),E.current=0},M)},[M,F]);return React__namespace.useEffect(()=>()=>{E.current&&(window.clearTimeout(E.current),E.current=0)},[]),jsxRuntime.jsx(Root2$7,{..._,children:jsxRuntime.jsx(TooltipContextProvider,{scope:e,contentId:C,open:j,stateAttribute:z,trigger:S,onTriggerChange:R,onTriggerEnter:React__namespace.useCallback(()=>{b.isOpenDelayedRef.current?V():Q()},[b.isOpenDelayedRef,V,Q]),onTriggerLeave:React__namespace.useCallback(()=>{A?O():(window.clearTimeout(E.current),E.current=0)},[O,A]),onOpen:Q,onClose:O,disableHoverableContent:A,children:n})})};Tooltip$2.displayName=TOOLTIP_NAME;var TRIGGER_NAME$7="TooltipTrigger",TooltipTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,...o}=t,l=useTooltipContext(TRIGGER_NAME$7,n),d=useTooltipProviderContext(TRIGGER_NAME$7,n),f=usePopperScope$2(n),g=React__namespace.useRef(null),b=useComposedRefs(e,g,l.onTriggerChange),_=React__namespace.useRef(!1),S=React__namespace.useRef(!1),R=React__namespace.useCallback(()=>_.current=!1,[]);return React__namespace.useEffect(()=>()=>document.removeEventListener("pointerup",R),[R]),jsxRuntime.jsx(Anchor,{asChild:!0,...f,children:jsxRuntime.jsx(Primitive$4.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...o,ref:b,onPointerMove:composeEventHandlers(t.onPointerMove,C=>{C.pointerType!=="touch"&&!S.current&&!d.isPointerInTransitRef.current&&(l.onTriggerEnter(),S.current=!0)}),onPointerLeave:composeEventHandlers(t.onPointerLeave,()=>{l.onTriggerLeave(),S.current=!1}),onPointerDown:composeEventHandlers(t.onPointerDown,()=>{l.open&&l.onClose(),_.current=!0,document.addEventListener("pointerup",R,{once:!0})}),onFocus:composeEventHandlers(t.onFocus,()=>{_.current||l.onOpen()}),onBlur:composeEventHandlers(t.onBlur,l.onClose),onClick:composeEventHandlers(t.onClick,l.onClose)})})});TooltipTrigger$1.displayName=TRIGGER_NAME$7;var PORTAL_NAME$3="TooltipPortal",[PortalProvider$1,usePortalContext$1]=createTooltipContext(PORTAL_NAME$3,{forceMount:void 0}),TooltipPortal=t=>{const{__scopeTooltip:e,forceMount:n,children:o,container:l}=t,d=useTooltipContext(PORTAL_NAME$3,e);return jsxRuntime.jsx(PortalProvider$1,{scope:e,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};TooltipPortal.displayName=PORTAL_NAME$3;var CONTENT_NAME$6="TooltipContent",TooltipContent$1=React__namespace.forwardRef((t,e)=>{const n=usePortalContext$1(CONTENT_NAME$6,t.__scopeTooltip),{forceMount:o=n.forceMount,side:l="top",...d}=t,f=useTooltipContext(CONTENT_NAME$6,t.__scopeTooltip);return jsxRuntime.jsx(Presence,{present:o||f.open,children:f.disableHoverableContent?jsxRuntime.jsx(TooltipContentImpl,{side:l,...d,ref:e}):jsxRuntime.jsx(TooltipContentHoverable,{side:l,...d,ref:e})})}),TooltipContentHoverable=React__namespace.forwardRef((t,e)=>{const n=useTooltipContext(CONTENT_NAME$6,t.__scopeTooltip),o=useTooltipProviderContext(CONTENT_NAME$6,t.__scopeTooltip),l=React__namespace.useRef(null),d=useComposedRefs(e,l),[f,g]=React__namespace.useState(null),{trigger:b,onClose:_}=n,S=l.current,{onPointerInTransitChange:R}=o,C=React__namespace.useCallback(()=>{g(null),R(!1)},[R]),E=React__namespace.useCallback((A,M)=>{const I=A.currentTarget,j={x:A.clientX,y:A.clientY},F=getExitSideFromRect(j,I.getBoundingClientRect()),z=getPaddedExitPoints(j,F),Q=getPointsFromRect(M.getBoundingClientRect()),O=getHull([...z,...Q]);g(O),R(!0)},[R]);return React__namespace.useEffect(()=>()=>C(),[C]),React__namespace.useEffect(()=>{if(b&&S){const A=I=>E(I,S),M=I=>E(I,b);return b.addEventListener("pointerleave",A),S.addEventListener("pointerleave",M),()=>{b.removeEventListener("pointerleave",A),S.removeEventListener("pointerleave",M)}}},[b,S,E,C]),React__namespace.useEffect(()=>{if(f){const A=M=>{const I=M.target,j={x:M.clientX,y:M.clientY},F=(b==null?void 0:b.contains(I))||(S==null?void 0:S.contains(I)),z=!isPointInPolygon(j,f);F?C():z&&(C(),_())};return document.addEventListener("pointermove",A),()=>document.removeEventListener("pointermove",A)}},[b,S,f,_,C]),jsxRuntime.jsx(TooltipContentImpl,{...t,ref:d})}),[VisuallyHiddenContentContextProvider,useVisuallyHiddenContentContext]=createTooltipContext(TOOLTIP_NAME,{isInside:!1}),Slottable$1=createSlottable$1("TooltipContent"),TooltipContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,children:o,"aria-label":l,onEscapeKeyDown:d,onPointerDownOutside:f,...g}=t,b=useTooltipContext(CONTENT_NAME$6,n),_=usePopperScope$2(n),{onClose:S}=b;return React__namespace.useEffect(()=>(document.addEventListener(TOOLTIP_OPEN,S),()=>document.removeEventListener(TOOLTIP_OPEN,S)),[S]),React__namespace.useEffect(()=>{if(b.trigger){const R=C=>{const E=C.target;E!=null&&E.contains(b.trigger)&&S()};return window.addEventListener("scroll",R,{capture:!0}),()=>window.removeEventListener("scroll",R,{capture:!0})}},[b.trigger,S]),jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:R=>R.preventDefault(),onDismiss:S,children:jsxRuntime.jsxs(Content$2,{"data-state":b.stateAttribute,..._,...g,ref:e,style:{...g.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[jsxRuntime.jsx(Slottable$1,{children:o}),jsxRuntime.jsx(VisuallyHiddenContentContextProvider,{scope:n,isInside:!0,children:jsxRuntime.jsx(Root$8,{id:b.contentId,role:"tooltip",children:l||o})})]})})});TooltipContent$1.displayName=CONTENT_NAME$6;var ARROW_NAME$2="TooltipArrow",TooltipArrow=React__namespace.forwardRef((t,e)=>{const{__scopeTooltip:n,...o}=t,l=usePopperScope$2(n);return useVisuallyHiddenContentContext(ARROW_NAME$2,n).isInside?null:jsxRuntime.jsx(Arrow,{...l,...o,ref:e})});TooltipArrow.displayName=ARROW_NAME$2;function getExitSideFromRect(t,e){const n=Math.abs(e.top-t.y),o=Math.abs(e.bottom-t.y),l=Math.abs(e.right-t.x),d=Math.abs(e.left-t.x);switch(Math.min(n,o,l,d)){case d:return"left";case l:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function getPaddedExitPoints(t,e,n=5){const o=[];switch(e){case"top":o.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":o.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":o.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":o.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return o}function getPointsFromRect(t){const{top:e,right:n,bottom:o,left:l}=t;return[{x:l,y:e},{x:n,y:e},{x:n,y:o},{x:l,y:o}]}function isPointInPolygon(t,e){const{x:n,y:o}=t;let l=!1;for(let d=0,f=e.length-1;d<e.length;f=d++){const g=e[d],b=e[f],_=g.x,S=g.y,R=b.x,C=b.y;S>o!=C>o&&n<(R-_)*(o-S)/(C-S)+_&&(l=!l)}return l}function getHull(t){const e=t.slice();return e.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),getHullPresorted(e)}function getHullPresorted(t){if(t.length<=1)return t.slice();const e=[];for(let o=0;o<t.length;o++){const l=t[o];for(;e.length>=2;){const d=e[e.length-1],f=e[e.length-2];if((d.x-f.x)*(l.y-f.y)>=(d.y-f.y)*(l.x-f.x))e.pop();else break}e.push(l)}e.pop();const n=[];for(let o=t.length-1;o>=0;o--){const l=t[o];for(;n.length>=2;){const d=n[n.length-1],f=n[n.length-2];if((d.x-f.x)*(l.y-f.y)>=(d.y-f.y)*(l.x-f.x))n.pop();else break}n.push(l)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var Provider$1=TooltipProvider$1,Root3=Tooltip$2,Trigger$4=TooltipTrigger$1,Portal$2=TooltipPortal,Content2$4=TooltipContent$1;const TooltipProvider=Provider$1,Tooltip$1=Root3,TooltipTrigger=Trigger$4,TooltipContent=React__namespace.forwardRef(({className:t,sideOffset:e=4,...n},o)=>jsxRuntime.jsx(Portal$2,{children:jsxRuntime.jsx(Content2$4,{ref:o,sideOffset:e,className:cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground 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",t),...n})}));TooltipContent.displayName=Content2$4.displayName;const Input=React__namespace.forwardRef(({className:t,type:e,mask:n,onChange:o,placeholder:l,...d},f)=>{const[g,b]=React__namespace.useState(!1),_=React__namespace.useRef(null),R=l||(n==="phone"?"(999) 999-9999":n==="postal-code-ca"?"A9A 9A9":n==="zip-code-us"?"99999":""),C=()=>n==="phone"?"Only enter numbers. Formatting will be added automatically.":n==="postal-code-ca"?"Enter letters and numbers only. Spacing will be applied automatically.":n==="zip-code-us"?"Only enter numbers. Formatting will be added automatically.":"",E=()=>{b(!0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{b(!1)},3e3)};React__namespace.useEffect(()=>()=>{_.current&&clearTimeout(_.current)},[]);const A=M=>{if(n){const I=M.target.value;let j=I;if(I.length>0){const F=I[I.length-1];/[^a-zA-Z0-9]/.test(F)&&(console.log("Non-alphanumeric detected:",F),E())}if(n==="phone"){const F=I.replace(/\D/g,"");F.length<=3?j=F:F.length<=6?j=`(${F.slice(0,3)}) ${F.slice(3)}`:j=`(${F.slice(0,3)}) ${F.slice(3,6)}-${F.slice(6,10)}`}else if(n==="postal-code-ca"){const F=I.replace(/[^a-zA-Z0-9]/g,"").toUpperCase();let z="";for(let Q=0;Q<Math.min(F.length,6);Q++){const O=F[Q];Q===0||Q===2||Q===4?/[A-Z]/.test(O)&&(z+=O):(Q===1||Q===3||Q===5)&&/[0-9]/.test(O)&&(z+=O)}z.length<=3?j=z:j=`${z.slice(0,3)} ${z.slice(3,6)}`}else if(n==="zip-code-us"){const F=I.replace(/\D/g,"");F.length<=5?j=F:j=`${F.slice(0,5)}-${F.slice(5,9)}`}M.target.value=j}o==null||o(M)};return jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{open:g&&!!n,children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx("input",{type:e,className:cn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),onChange:A,placeholder:R,ref:f,...d})}),jsxRuntime.jsx(TooltipContent,{side:"top",className:"bg-sidebar text-sidebar-foreground",children:C()})]})})});Input.displayName="Input";var NODES$3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Primitive$3=NODES$3.reduce((t,e)=>{const n=createSlot$2(`Primitive.${e}`),o=React__namespace.forwardRef((l,d)=>{const{asChild:f,...g}=l,b=f?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntime.jsx(b,{...g,ref:d})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{}),NAME$1="Separator",DEFAULT_ORIENTATION="horizontal",ORIENTATIONS=["horizontal","vertical"],Separator$2=React__namespace.forwardRef((t,e)=>{const{decorative:n,orientation:o=DEFAULT_ORIENTATION,...l}=t,d=isValidOrientation(o)?o:DEFAULT_ORIENTATION,g=n?{role:"none"}:{"aria-orientation":d==="vertical"?d:void 0,role:"separator"};return jsxRuntime.jsx(Primitive$3.div,{"data-orientation":d,...g,...l,ref:e})});Separator$2.displayName=NAME$1;function isValidOrientation(t){return ORIENTATIONS.includes(t)}var Root$7=Separator$2;const Separator$1=React__namespace.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...o},l)=>jsxRuntime.jsx(Root$7,{ref:l,decorative:n,orientation:e,className:cn("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...o}));Separator$1.displayName=Root$7.displayName;const Sheet=Root$a,SheetTrigger=Trigger$6,SheetClose=Close$1,SheetPortal=Portal$4,SheetOverlay=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Overlay,{className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));SheetOverlay.displayName=Overlay.displayName;const sheetVariants=cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),SheetContent=React__namespace.forwardRef(({side:t="right",className:e,children:n,...o},l)=>jsxRuntime.jsxs(SheetPortal,{children:[jsxRuntime.jsx(SheetOverlay,{}),jsxRuntime.jsxs(Content$3,{ref:l,className:cn(sheetVariants({side:t}),e),...o,children:[jsxRuntime.jsxs(Close$1,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[jsxRuntime.jsx(X$1,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]}),n]})]}));SheetContent.displayName=Content$3.displayName;const SheetHeader=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});SheetHeader.displayName="SheetHeader";const SheetFooter=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});SheetFooter.displayName="SheetFooter";const SheetTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title$1,{ref:n,className:cn("text-lg font-semibold text-foreground",t),...e}));SheetTitle.displayName=Title$1.displayName;const SheetDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description$1,{ref:n,className:cn("text-sm text-muted-foreground",t),...e}));SheetDescription.displayName=Description$1.displayName;function useIntersectionObserver({elementRef:t,threshold:e=0,rootMargin:n="0px",freezeOnceVisible:o=!1}){const[l,d]=React.useState(!1);return React.useEffect(()=>{const f=t.current;if(!f){d(!1);return}const g=new IntersectionObserver(([b])=>{const _=b.isIntersecting;o&&_?(d(!0),g.unobserve(f)):d(_)},{threshold:e,rootMargin:n});return g.observe(f),()=>{g.unobserve(f)}},[t,e,n,o]),l}function formatProdErrorMessage$1(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var randomString=()=>Math.random().toString(36).substring(7).split("").join("."),ActionTypes={INIT:`@@redux/INIT${randomString()}`,REPLACE:`@@redux/REPLACE${randomString()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${randomString()}`},actionTypes_default=ActionTypes;function isPlainObject$4(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function miniKindOf(t){if(t===void 0)return"undefined";if(t===null)return"null";const e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(isDate$1(t))return"date";if(isError(t))return"error";const n=ctorName(t);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"")}function ctorName(t){return typeof t.constructor=="function"?t.constructor.name:null}function isError(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function isDate$1(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function kindOf(t){let e=typeof t;return process.env.NODE_ENV!=="production"&&(e=miniKindOf(t)),e}function warning(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function getUnexpectedStateShapeWarningMessage(t,e,n,o){const l=Object.keys(e),d=n&&n.type===actionTypes_default.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(l.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!isPlainObject$4(t))return`The ${d} has unexpected type of "${kindOf(t)}". Expected argument to be an object with the following keys: "${l.join('", "')}"`;const f=Object.keys(t).filter(g=>!e.hasOwnProperty(g)&&!o[g]);if(f.forEach(g=>{o[g]=!0}),!(n&&n.type===actionTypes_default.REPLACE)&&f.length>0)return`Unexpected ${f.length>1?"keys":"key"} "${f.join('", "')}" found in ${d}. Expected to find one of the known reducer keys instead: "${l.join('", "')}". Unexpected keys will be ignored.`}function assertReducerShape(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:actionTypes_default.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(12):`The slice reducer for key "${e}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:actionTypes_default.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(13):`The slice reducer for key "${e}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function combineReducers(t){const e=Object.keys(t),n={};for(let f=0;f<e.length;f++){const g=e[f];process.env.NODE_ENV!=="production"&&typeof t[g]>"u"&&warning(`No reducer provided for key "${g}"`),typeof t[g]=="function"&&(n[g]=t[g])}const o=Object.keys(n);let l;process.env.NODE_ENV!=="production"&&(l={});let d;try{assertReducerShape(n)}catch(f){d=f}return function(g={},b){if(d)throw d;if(process.env.NODE_ENV!=="production"){const R=getUnexpectedStateShapeWarningMessage(g,n,b,l);R&&warning(R)}let _=!1;const S={};for(let R=0;R<o.length;R++){const C=o[R],E=n[C],A=g[C],M=E(A,b);if(typeof M>"u"){const I=b&&b.type;throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(14):`When called with an action of type ${I?`"${String(I)}"`:"(unknown type)"}, the slice reducer for key "${C}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}S[C]=M,_=_||M!==A}return _=_||o.length!==Object.keys(g).length,_?S:g}}function isAction(t){return isPlainObject$4(t)&&"type"in t&&typeof t.type=="string"}var NOTHING=Symbol.for("immer-nothing"),DRAFTABLE=Symbol.for("immer-draftable"),DRAFT_STATE=Symbol.for("immer-state"),errors=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function die(t,...e){if(process.env.NODE_ENV!=="production"){const n=errors[t],o=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf$1=Object.getPrototypeOf;function isDraft(t){return!!t&&!!t[DRAFT_STATE]}function isDraftable(t){var e;return t?isPlainObject$3(t)||Array.isArray(t)||!!t[DRAFTABLE]||!!((e=t.constructor)!=null&&e[DRAFTABLE])||isMap(t)||isSet(t):!1}var objectCtorString=Object.prototype.constructor.toString(),cachedCtorStrings=new WeakMap;function isPlainObject$3(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);if(e===null||e===Object.prototype)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let o=cachedCtorStrings.get(n);return o===void 0&&(o=Function.toString.call(n),cachedCtorStrings.set(n,o)),o===objectCtorString}function original(t){return isDraft(t)||die(15,t),t[DRAFT_STATE].base_}function each(t,e,n=!0){getArchtype(t)===0?(n?Reflect.ownKeys(t):Object.keys(t)).forEach(l=>{e(l,t[l],t)}):t.forEach((o,l)=>e(l,o,t))}function getArchtype(t){const e=t[DRAFT_STATE];return e?e.type_:Array.isArray(t)?1:isMap(t)?2:isSet(t)?3:0}function has$1(t,e){return getArchtype(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function get$3(t,e){return getArchtype(t)===2?t.get(e):t[e]}function set$2(t,e,n){const o=getArchtype(t);o===2?t.set(e,n):o===3?t.add(n):t[e]=n}function is$1(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function isMap(t){return t instanceof Map}function isSet(t){return t instanceof Set}function latest(t){return t.copy_||t.base_}function shallowCopy(t,e){if(isMap(t))return new Map(t);if(isSet(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=isPlainObject$3(t);if(e===!0||e==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(t);delete o[DRAFT_STATE];let l=Reflect.ownKeys(o);for(let d=0;d<l.length;d++){const f=l[d],g=o[f];g.writable===!1&&(g.writable=!0,g.configurable=!0),(g.get||g.set)&&(o[f]={configurable:!0,writable:!0,enumerable:g.enumerable,value:t[f]})}return Object.create(getPrototypeOf$1(t),o)}else{const o=getPrototypeOf$1(t);if(o!==null&&n)return{...t};const l=Object.create(o);return Object.assign(l,t)}}function freeze$1(t,e=!1){return isFrozen$1(t)||isDraft(t)||!isDraftable(t)||(getArchtype(t)>1&&Object.defineProperties(t,{set:dontMutateMethodOverride,add:dontMutateMethodOverride,clear:dontMutateMethodOverride,delete:dontMutateMethodOverride}),Object.freeze(t),e&&Object.values(t).forEach(n=>freeze$1(n,!0))),t}function dontMutateFrozenCollections(){die(2)}var dontMutateMethodOverride={value:dontMutateFrozenCollections};function isFrozen$1(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var plugins={};function getPlugin(t){const e=plugins[t];return e||die(0,t),e}function loadPlugin(t,e){plugins[t]||(plugins[t]=e)}var currentScope;function getCurrentScope(){return currentScope}function createScope(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope(t,e){e&&(getPlugin("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function revokeScope(t){leaveScope(t),t.drafts_.forEach(revokeDraft),t.drafts_=null}function leaveScope(t){t===currentScope&&(currentScope=t.parent_)}function enterScope(t){return currentScope=createScope(currentScope,t)}function revokeDraft(t){const e=t[DRAFT_STATE];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function processResult(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[DRAFT_STATE].modified_&&(revokeScope(e),die(4)),isDraftable(t)&&(t=finalize(e,t),e.parent_||maybeFreeze(e,t)),e.patches_&&getPlugin("Patches").generateReplacementPatches_(n[DRAFT_STATE].base_,t,e.patches_,e.inversePatches_)):t=finalize(e,n,[]),revokeScope(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==NOTHING?t:void 0}function finalize(t,e,n){if(isFrozen$1(e))return e;const o=t.immer_.shouldUseStrictIteration(),l=e[DRAFT_STATE];if(!l)return each(e,(d,f)=>finalizeProperty(t,l,e,d,f,n),o),e;if(l.scope_!==t)return e;if(!l.modified_)return maybeFreeze(t,l.base_,!0),l.base_;if(!l.finalized_){l.finalized_=!0,l.scope_.unfinalizedDrafts_--;const d=l.copy_;let f=d,g=!1;l.type_===3&&(f=new Set(d),d.clear(),g=!0),each(f,(b,_)=>finalizeProperty(t,l,d,b,_,n,g),o),maybeFreeze(t,d,!1),n&&t.patches_&&getPlugin("Patches").generatePatches_(l,n,t.patches_,t.inversePatches_)}return l.copy_}function finalizeProperty(t,e,n,o,l,d,f){if(l==null||typeof l!="object"&&!f)return;const g=isFrozen$1(l);if(!(g&&!f)){if(process.env.NODE_ENV!=="production"&&l===n&&die(5),isDraft(l)){const b=d&&e&&e.type_!==3&&!has$1(e.assigned_,o)?d.concat(o):void 0,_=finalize(t,l,b);if(set$2(n,o,_),isDraft(_))t.canAutoFreeze_=!1;else return}else f&&n.add(l);if(isDraftable(l)&&!g){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[o]===l&&g)return;finalize(t,l),(!e||!e.scope_.parent_)&&typeof o!="symbol"&&(isMap(n)?n.has(o):Object.prototype.propertyIsEnumerable.call(n,o))&&maybeFreeze(t,l)}}}function maybeFreeze(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&freeze$1(e,n)}function createProxyProxy(t,e){const n=Array.isArray(t),o={type_:n?1:0,scope_:e?e.scope_:getCurrentScope(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let l=o,d=objectTraps;n&&(l=[o],d=arrayTraps);const{revoke:f,proxy:g}=Proxy.revocable(l,d);return o.draft_=g,o.revoke_=f,g}var objectTraps={get(t,e){if(e===DRAFT_STATE)return t;const n=latest(t);if(!has$1(n,e))return readPropFromProto(t,n,e);const o=n[e];return t.finalized_||!isDraftable(o)?o:o===peek(t.base_,e)?(prepareCopy(t),t.copy_[e]=createProxy(o,t)):o},has(t,e){return e in latest(t)},ownKeys(t){return Reflect.ownKeys(latest(t))},set(t,e,n){const o=getDescriptorFromProto(latest(t),e);if(o!=null&&o.set)return o.set.call(t.draft_,n),!0;if(!t.modified_){const l=peek(latest(t),e),d=l==null?void 0:l[DRAFT_STATE];if(d&&d.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(is$1(n,l)&&(n!==void 0||has$1(t.base_,e)))return!0;prepareCopy(t),markChanged(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return peek(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,prepareCopy(t),markChanged(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=latest(t),o=Reflect.getOwnPropertyDescriptor(n,e);return o&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:o.enumerable,value:n[e]}},defineProperty(){die(11)},getPrototypeOf(t){return getPrototypeOf$1(t.base_)},setPrototypeOf(){die(12)}},arrayTraps={};each(objectTraps,(t,e)=>{arrayTraps[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),arrayTraps.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&die(13),arrayTraps.set.call(this,t,e,void 0)},arrayTraps.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&die(14),objectTraps.set.call(this,t[0],e,n,t[0])};function peek(t,e){const n=t[DRAFT_STATE];return(n?latest(n):t)[e]}function readPropFromProto(t,e,n){var l;const o=getDescriptorFromProto(e,n);return o?"value"in o?o.value:(l=o.get)==null?void 0:l.call(t.draft_):void 0}function getDescriptorFromProto(t,e){if(!(e in t))return;let n=getPrototypeOf$1(t);for(;n;){const o=Object.getOwnPropertyDescriptor(n,e);if(o)return o;n=getPrototypeOf$1(n)}}function markChanged(t){t.modified_||(t.modified_=!0,t.parent_&&markChanged(t.parent_))}function prepareCopy(t){t.copy_||(t.copy_=shallowCopy(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Immer2=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,o)=>{if(typeof e=="function"&&typeof n!="function"){const d=n;n=e;const f=this;return function(b=d,..._){return f.produce(b,S=>n.call(this,S,..._))}}typeof n!="function"&&die(6),o!==void 0&&typeof o!="function"&&die(7);let l;if(isDraftable(e)){const d=enterScope(this),f=createProxy(e,void 0);let g=!0;try{l=n(f),g=!1}finally{g?revokeScope(d):leaveScope(d)}return usePatchesInScope(d,o),processResult(l,d)}else if(!e||typeof e!="object"){if(l=n(e),l===void 0&&(l=e),l===NOTHING&&(l=void 0),this.autoFreeze_&&freeze$1(l,!0),o){const d=[],f=[];getPlugin("Patches").generateReplacementPatches_(e,l,d,f),o(d,f)}return l}else die(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(f,...g)=>this.produceWithPatches(f,b=>e(b,...g));let o,l;return[this.produce(e,n,(f,g)=>{o=f,l=g}),o,l]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){isDraftable(t)||die(8),isDraft(t)&&(t=current(t));const e=enterScope(this),n=createProxy(t,void 0);return n[DRAFT_STATE].isManual_=!0,leaveScope(e),n}finishDraft(t,e){const n=t&&t[DRAFT_STATE];(!n||!n.isManual_)&&die(9);const{scope_:o}=n;return usePatchesInScope(o,e),processResult(void 0,o)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const l=e[n];if(l.path.length===0&&l.op==="replace"){t=l.value;break}}n>-1&&(e=e.slice(n+1));const o=getPlugin("Patches").applyPatches_;return isDraft(t)?o(t,e):this.produce(t,l=>o(l,e))}};function createProxy(t,e){const n=isMap(t)?getPlugin("MapSet").proxyMap_(t,e):isSet(t)?getPlugin("MapSet").proxySet_(t,e):createProxyProxy(t,e);return(e?e.scope_:getCurrentScope()).drafts_.push(n),n}function current(t){return isDraft(t)||die(10,t),currentImpl(t)}function currentImpl(t){if(!isDraftable(t)||isFrozen$1(t))return t;const e=t[DRAFT_STATE];let n,o=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=shallowCopy(t,e.scope_.immer_.useStrictShallowCopy_),o=e.scope_.immer_.shouldUseStrictIteration()}else n=shallowCopy(t,!0);return each(n,(l,d)=>{set$2(n,l,currentImpl(d))},o),e&&(e.finalized_=!1),n}function enablePatches(){process.env.NODE_ENV!=="production"&&errors.push('Sets cannot have "replace" patches.',function(C){return"Unsupported patch operation: "+C},function(C){return"Cannot apply patch, path doesn't resolve: "+C},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const e="replace",n="add",o="remove";function l(C,E,A,M){switch(C.type_){case 0:case 2:return f(C,E,A,M);case 1:return d(C,E,A,M);case 3:return g(C,E,A,M)}}function d(C,E,A,M){let{base_:I,assigned_:j}=C,F=C.copy_;F.length<I.length&&([I,F]=[F,I],[A,M]=[M,A]);for(let z=0;z<I.length;z++)if(j[z]&&F[z]!==I[z]){const Q=E.concat([z]);A.push({op:e,path:Q,value:R(F[z])}),M.push({op:e,path:Q,value:R(I[z])})}for(let z=I.length;z<F.length;z++){const Q=E.concat([z]);A.push({op:n,path:Q,value:R(F[z])})}for(let z=F.length-1;I.length<=z;--z){const Q=E.concat([z]);M.push({op:o,path:Q})}}function f(C,E,A,M){const{base_:I,copy_:j}=C;each(C.assigned_,(F,z)=>{const Q=get$3(I,F),O=get$3(j,F),V=z?has$1(I,F)?e:n:o;if(Q===O&&V===e)return;const te=E.concat(F);A.push(V===o?{op:V,path:te}:{op:V,path:te,value:O}),M.push(V===n?{op:o,path:te}:V===o?{op:n,path:te,value:R(Q)}:{op:e,path:te,value:R(Q)})})}function g(C,E,A,M){let{base_:I,copy_:j}=C,F=0;I.forEach(z=>{if(!j.has(z)){const Q=E.concat([F]);A.push({op:o,path:Q,value:z}),M.unshift({op:n,path:Q,value:z})}F++}),F=0,j.forEach(z=>{if(!I.has(z)){const Q=E.concat([F]);A.push({op:n,path:Q,value:z}),M.unshift({op:o,path:Q,value:z})}F++})}function b(C,E,A,M){A.push({op:e,path:[],value:E===NOTHING?void 0:E}),M.push({op:e,path:[],value:C})}function _(C,E){return E.forEach(A=>{const{path:M,op:I}=A;let j=C;for(let O=0;O<M.length-1;O++){const V=getArchtype(j);let te=M[O];typeof te!="string"&&typeof te!="number"&&(te=""+te),(V===0||V===1)&&(te==="__proto__"||te==="constructor")&&die(19),typeof j=="function"&&te==="prototype"&&die(19),j=get$3(j,te),typeof j!="object"&&die(18,M.join("/"))}const F=getArchtype(j),z=S(A.value),Q=M[M.length-1];switch(I){case e:switch(F){case 2:return j.set(Q,z);case 3:die(16);default:return j[Q]=z}case n:switch(F){case 1:return Q==="-"?j.push(z):j.splice(Q,0,z);case 2:return j.set(Q,z);case 3:return j.add(z);default:return j[Q]=z}case o:switch(F){case 1:return j.splice(Q,1);case 2:return j.delete(Q);case 3:return j.delete(A.value);default:return delete j[Q]}default:die(17,I)}}),C}function S(C){if(!isDraftable(C))return C;if(Array.isArray(C))return C.map(S);if(isMap(C))return new Map(Array.from(C.entries()).map(([A,M])=>[A,S(M)]));if(isSet(C))return new Set(Array.from(C).map(S));const E=Object.create(getPrototypeOf$1(C));for(const A in C)E[A]=S(C[A]);return has$1(C,DRAFTABLE)&&(E[DRAFTABLE]=C[DRAFTABLE]),E}function R(C){return isDraft(C)?S(C):C}loadPlugin("Patches",{applyPatches_:_,generatePatches_:l,generateReplacementPatches_:b})}var immer=new Immer2,produce=immer.produce,produceWithPatches=immer.produceWithPatches.bind(immer),setUseStrictIteration=immer.setUseStrictIteration.bind(immer),applyPatches=immer.applyPatches.bind(immer),runIdentityFunctionCheck=(t,e,n)=>{if(e.length===1&&e[0]===n){let o=!1;try{const l={};t(l)===l&&(o=!0)}catch{}if(o){let l;try{throw new Error}catch(d){({stack:l}=d)}console.warn(`The result function returned its own inputs without modification. e.g
|
|
510
510
|
\`createSelector([state => state.todos], todos => todos)\`
|
|
511
511
|
This could lead to inefficient memoization and unnecessary re-renders.
|
|
512
512
|
Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:l})}}},runInputStabilityCheck=(t,e,n)=>{const{memoize:o,memoizeOptions:l}=e,{inputSelectorResults:d,inputSelectorResultsCopy:f}=t,g=o(()=>({}),...l);if(!(g.apply(null,d)===g.apply(null,f))){let _;try{throw new Error}catch(S){({stack:_}=S)}console.warn(`An input selector returned a different result when passed same arguments.
|
|
@@ -1130,7 +1130,7 @@ ${t}</tr>
|
|
|
1130
1130
|
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${escape2(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const o=this.parser.parseInline(n),l=cleanUrl(t);if(l===null)return o;t=l;let d='<a href="'+t+'"';return e&&(d+=' title="'+escape2(e)+'"'),d+=">"+o+"</a>",d}image({href:t,title:e,text:n,tokens:o}){o&&(n=this.parser.parseInline(o,this.parser.textRenderer));const l=cleanUrl(t);if(l===null)return escape2(n);t=l;let d=`<img src="${t}" alt="${n}"`;return e&&(d+=` title="${escape2(e)}"`),d+=">",d}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:escape2(t.text)}},_TextRenderer=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},_Parser=class yr{constructor(e){Zt(this,"options");Zt(this,"renderer");Zt(this,"textRenderer");this.options=e||_defaults,this.options.renderer=this.options.renderer||new _Renderer,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _TextRenderer}static parse(e,n){return new yr(n).parse(e)}static parseInline(e,n){return new yr(n).parseInline(e)}parse(e,n=!0){var l,d;let o="";for(let f=0;f<e.length;f++){const g=e[f];if((d=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&d[g.type]){const _=g,S=this.options.extensions.renderers[_.type].call({parser:this},_);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(_.type)){o+=S||"";continue}}const b=g;switch(b.type){case"space":{o+=this.renderer.space(b);continue}case"hr":{o+=this.renderer.hr(b);continue}case"heading":{o+=this.renderer.heading(b);continue}case"code":{o+=this.renderer.code(b);continue}case"table":{o+=this.renderer.table(b);continue}case"blockquote":{o+=this.renderer.blockquote(b);continue}case"list":{o+=this.renderer.list(b);continue}case"html":{o+=this.renderer.html(b);continue}case"paragraph":{o+=this.renderer.paragraph(b);continue}case"text":{let _=b,S=this.renderer.text(_);for(;f+1<e.length&&e[f+1].type==="text";)_=e[++f],S+=`
|
|
1131
1131
|
`+this.renderer.text(_);n?o+=this.renderer.paragraph({type:"paragraph",raw:S,text:S,tokens:[{type:"text",raw:S,text:S,escaped:!0}]}):o+=S;continue}default:{const _='Token with "'+b.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return o}parseInline(e,n=this.renderer){var l,d;let o="";for(let f=0;f<e.length;f++){const g=e[f];if((d=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&d[g.type]){const _=this.options.extensions.renderers[g.type].call({parser:this},g);if(_!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(g.type)){o+=_||"";continue}}const b=g;switch(b.type){case"escape":{o+=n.text(b);break}case"html":{o+=n.html(b);break}case"link":{o+=n.link(b);break}case"image":{o+=n.image(b);break}case"strong":{o+=n.strong(b);break}case"em":{o+=n.em(b);break}case"codespan":{o+=n.codespan(b);break}case"br":{o+=n.br(b);break}case"del":{o+=n.del(b);break}case"text":{o+=n.text(b);break}default:{const _='Token with "'+b.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return o}},_Hooks=(on=class{constructor(t){Zt(this,"options");Zt(this,"block");this.options=t||_defaults}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?_Lexer.lex:_Lexer.lexInline}provideParser(){return this.block?_Parser.parse:_Parser.parseInline}},Zt(on,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),on),Marked=class{constructor(...t){Zt(this,"defaults",_getDefaults());Zt(this,"options",this.setOptions);Zt(this,"parse",this.parseMarkdown(!0));Zt(this,"parseInline",this.parseMarkdown(!1));Zt(this,"Parser",_Parser);Zt(this,"Renderer",_Renderer);Zt(this,"TextRenderer",_TextRenderer);Zt(this,"Lexer",_Lexer);Zt(this,"Tokenizer",_Tokenizer);Zt(this,"Hooks",_Hooks);this.use(...t)}walkTokens(t,e){var o,l;let n=[];for(const d of t)switch(n=n.concat(e.call(this,d)),d.type){case"table":{const f=d;for(const g of f.header)n=n.concat(this.walkTokens(g.tokens,e));for(const g of f.rows)for(const b of g)n=n.concat(this.walkTokens(b.tokens,e));break}case"list":{const f=d;n=n.concat(this.walkTokens(f.items,e));break}default:{const f=d;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[f.type]?this.defaults.extensions.childTokens[f.type].forEach(g=>{const b=f[g].flat(1/0);n=n.concat(this.walkTokens(b,e))}):f.tokens&&(n=n.concat(this.walkTokens(f.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const o={...n};if(o.async=this.defaults.async||o.async||!1,n.extensions&&(n.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const d=e.renderers[l.name];d?e.renderers[l.name]=function(...f){let g=l.renderer.apply(this,f);return g===!1&&(g=d.apply(this,f)),g}:e.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const d=e[l.level];d?d.unshift(l.tokenizer):e[l.level]=[l.tokenizer],l.start&&(l.level==="block"?e.startBlock?e.startBlock.push(l.start):e.startBlock=[l.start]:l.level==="inline"&&(e.startInline?e.startInline.push(l.start):e.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(e.childTokens[l.name]=l.childTokens)}),o.extensions=e),n.renderer){const l=this.defaults.renderer||new _Renderer(this.defaults);for(const d in n.renderer){if(!(d in l))throw new Error(`renderer '${d}' does not exist`);if(["options","parser"].includes(d))continue;const f=d,g=n.renderer[f],b=l[f];l[f]=(..._)=>{let S=g.apply(l,_);return S===!1&&(S=b.apply(l,_)),S||""}}o.renderer=l}if(n.tokenizer){const l=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const d in n.tokenizer){if(!(d in l))throw new Error(`tokenizer '${d}' does not exist`);if(["options","rules","lexer"].includes(d))continue;const f=d,g=n.tokenizer[f],b=l[f];l[f]=(..._)=>{let S=g.apply(l,_);return S===!1&&(S=b.apply(l,_)),S}}o.tokenizer=l}if(n.hooks){const l=this.defaults.hooks||new _Hooks;for(const d in n.hooks){if(!(d in l))throw new Error(`hook '${d}' does not exist`);if(["options","block"].includes(d))continue;const f=d,g=n.hooks[f],b=l[f];_Hooks.passThroughHooks.has(d)?l[f]=_=>{if(this.defaults.async)return Promise.resolve(g.call(l,_)).then(R=>b.call(l,R));const S=g.call(l,_);return b.call(l,S)}:l[f]=(..._)=>{let S=g.apply(l,_);return S===!1&&(S=b.apply(l,_)),S}}o.hooks=l}if(n.walkTokens){const l=this.defaults.walkTokens,d=n.walkTokens;o.walkTokens=function(f){let g=[];return g.push(d.call(this,f)),l&&(g=g.concat(l.call(this,f))),g}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return _Lexer.lex(t,e??this.defaults)}parser(t,e){return _Parser.parse(t,e??this.defaults)}parseMarkdown(t){return(n,o)=>{const l={...o},d={...this.defaults,...l},f=this.onError(!!d.silent,!!d.async);if(this.defaults.async===!0&&l.async===!1)return f(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return f(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return f(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));d.hooks&&(d.hooks.options=d,d.hooks.block=t);const g=d.hooks?d.hooks.provideLexer():t?_Lexer.lex:_Lexer.lexInline,b=d.hooks?d.hooks.provideParser():t?_Parser.parse:_Parser.parseInline;if(d.async)return Promise.resolve(d.hooks?d.hooks.preprocess(n):n).then(_=>g(_,d)).then(_=>d.hooks?d.hooks.processAllTokens(_):_).then(_=>d.walkTokens?Promise.all(this.walkTokens(_,d.walkTokens)).then(()=>_):_).then(_=>b(_,d)).then(_=>d.hooks?d.hooks.postprocess(_):_).catch(f);try{d.hooks&&(n=d.hooks.preprocess(n));let _=g(n,d);d.hooks&&(_=d.hooks.processAllTokens(_)),d.walkTokens&&this.walkTokens(_,d.walkTokens);let S=b(_,d);return d.hooks&&(S=d.hooks.postprocess(S)),S}catch(_){return f(_)}}}onError(t,e){return n=>{if(n.message+=`
|
|
1132
1132
|
Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+escape2(n.message+"",!0)+"</pre>";return e?Promise.resolve(o):o}if(e)return Promise.reject(n);throw n}}},markedInstance=new Marked;function marked(t,e){return markedInstance.parse(t,e)}marked.options=marked.setOptions=function(t){return markedInstance.setOptions(t),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.getDefaults=_getDefaults,marked.defaults=_defaults,marked.use=function(...t){return markedInstance.use(...t),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.walkTokens=function(t,e){return markedInstance.walkTokens(t,e)},marked.parseInline=markedInstance.parseInline,marked.Parser=_Parser,marked.parser=_Parser.parse,marked.Renderer=_Renderer,marked.TextRenderer=_TextRenderer,marked.Lexer=_Lexer,marked.lexer=_Lexer.lex,marked.Tokenizer=_Tokenizer,marked.Hooks=_Hooks,marked.parse=marked,marked.options,marked.setOptions,marked.use,marked.walkTokens,marked.parseInline,_Parser.parse,_Lexer.lex;/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries,setPrototypeOf,isFrozen,getPrototypeOf,getOwnPropertyDescriptor}=Object;let{freeze,seal,create}=Object,{apply:apply$1,construct}=typeof Reflect<"u"&&Reflect;freeze||(freeze=function(e){return e}),seal||(seal=function(e){return e}),apply$1||(apply$1=function(e,n){for(var o=arguments.length,l=new Array(o>2?o-2:0),d=2;d<o;d++)l[d-2]=arguments[d];return e.apply(n,l)}),construct||(construct=function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),l=1;l<n;l++)o[l-1]=arguments[l];return new e(...o)});const arrayForEach=unapply(Array.prototype.forEach),arrayLastIndexOf=unapply(Array.prototype.lastIndexOf),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),arraySplice=unapply(Array.prototype.splice),stringToLowerCase=unapply(String.prototype.toLowerCase),stringToString=unapply(String.prototype.toString),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),objectHasOwnProperty=unapply(Object.prototype.hasOwnProperty),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=unconstruct(TypeError);function unapply(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),l=1;l<n;l++)o[l-1]=arguments[l];return apply$1(t,e,o)}}function unconstruct(t){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return construct(t,n)}}function addToSet(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:stringToLowerCase;setPrototypeOf&&setPrototypeOf(t,null);let o=e.length;for(;o--;){let l=e[o];if(typeof l=="string"){const d=n(l);d!==l&&(isFrozen(e)||(e[o]=d),l=d)}t[l]=!0}return t}function cleanArray(t){for(let e=0;e<t.length;e++)objectHasOwnProperty(t,e)||(t[e]=null);return t}function clone(t){const e=create(null);for(const[n,o]of entries(t))objectHasOwnProperty(t,n)&&(Array.isArray(o)?e[n]=cleanArray(o):o&&typeof o=="object"&&o.constructor===Object?e[n]=clone(o):e[n]=o);return e}function lookupGetter(t,e){for(;t!==null;){const o=getOwnPropertyDescriptor(t,e);if(o){if(o.get)return unapply(o.get);if(typeof o.value=="function")return unapply(o.value)}t=getPrototypeOf(t)}function n(){return null}return n}const html$1=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg$1=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl$1=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text$1=freeze(["#text"]),html=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),svg=freeze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl=freeze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ERB_EXPR=seal(/<%[\w\W]*|[\w\W]*%>/gm),TMPLIT_EXPR=seal(/\$\{[\w\W]*/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i);var EXPRESSIONS=Object.freeze({__proto__:null,ARIA_ATTR,ATTR_WHITESPACE,CUSTOM_ELEMENT,DATA_ATTR,DOCTYPE_NAME,ERB_EXPR,IS_ALLOWED_URI,IS_SCRIPT_OR_DATA,MUSTACHE_EXPR,TMPLIT_EXPR});const NODE_TYPE={element:1,text:3,progressingInstruction:7,comment:8,document:9},getGlobal=function t(){return typeof window>"u"?null:window},_createTrustedTypesPolicy=function t(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null;const l="data-tt-policy-suffix";n&&n.hasAttribute(l)&&(o=n.getAttribute(l));const d="dompurify"+(o?"#"+o:"");try{return e.createPolicy(d,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},_createHooksMap=function t(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function createDOMPurify(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:getGlobal();const e=Yt=>createDOMPurify(Yt);if(e.version="3.3.0",e.removed=[],!t||!t.document||t.document.nodeType!==NODE_TYPE.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const o=n,l=o.currentScript,{DocumentFragment:d,HTMLTemplateElement:f,Node:g,Element:b,NodeFilter:_,NamedNodeMap:S=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:R,DOMParser:C,trustedTypes:E}=t,A=b.prototype,M=lookupGetter(A,"cloneNode"),I=lookupGetter(A,"remove"),j=lookupGetter(A,"nextSibling"),F=lookupGetter(A,"childNodes"),z=lookupGetter(A,"parentNode");if(typeof f=="function"){const Yt=n.createElement("template");Yt.content&&Yt.content.ownerDocument&&(n=Yt.content.ownerDocument)}let Q,O="";const{implementation:V,createNodeIterator:te,createDocumentFragment:ne,getElementsByTagName:ae}=n,{importNode:$e}=o;let ge=_createHooksMap();e.isSupported=typeof entries=="function"&&typeof z=="function"&&V&&V.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:se,ERB_EXPR:je,TMPLIT_EXPR:Ae,DATA_ATTR:Ne,ARIA_ATTR:Ve,IS_SCRIPT_OR_DATA:Fe,ATTR_WHITESPACE:Oe,CUSTOM_ELEMENT:Be}=EXPRESSIONS;let{IS_ALLOWED_URI:Ue}=EXPRESSIONS,ze=null;const He=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text$1]);let Qe=null;const et=addToSet({},[...html,...svg,...mathMl,...xml]);let Je=Object.seal(create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ze=null,Ke=null;const at=Object.seal(create(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let nt=!0,st=!0,lt=!1,Ge=!0,Ct=!1,tt=!0,yt=!1,ct=!1,Rt=!1,Mt=!1,It=!1,We=!1,Ye=!0,rt=!1;const ut="user-content-";let pt=!0,ft=!1,mt={},Ut=null;const Wt=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let sn=null;const pn=addToSet({},["audio","video","img","source","image","track"]);let qt=null;const Tn=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vn="http://www.w3.org/1998/Math/MathML",Sn="http://www.w3.org/2000/svg",yn="http://www.w3.org/1999/xhtml";let Rn=yn,jn=!1,Nn=null;const Qt=addToSet({},[vn,Sn,yn],stringToString);let en=addToSet({},["mi","mo","mn","ms","mtext"]),Kt=addToSet({},["annotation-xml"]);const Jt=addToSet({},["title","style","font","a","script"]);let dn=null;const Vt=["application/xhtml+xml","text/html"],Gn="text/html";let hn=null,$n=null;const On=n.createElement("form"),Pn=function(it){return it instanceof RegExp||it instanceof Function},Xn=function(){let it=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!($n&&$n===it)){if((!it||typeof it!="object")&&(it={}),it=clone(it),dn=Vt.indexOf(it.PARSER_MEDIA_TYPE)===-1?Gn:it.PARSER_MEDIA_TYPE,hn=dn==="application/xhtml+xml"?stringToString:stringToLowerCase,ze=objectHasOwnProperty(it,"ALLOWED_TAGS")?addToSet({},it.ALLOWED_TAGS,hn):He,Qe=objectHasOwnProperty(it,"ALLOWED_ATTR")?addToSet({},it.ALLOWED_ATTR,hn):et,Nn=objectHasOwnProperty(it,"ALLOWED_NAMESPACES")?addToSet({},it.ALLOWED_NAMESPACES,stringToString):Qt,qt=objectHasOwnProperty(it,"ADD_URI_SAFE_ATTR")?addToSet(clone(Tn),it.ADD_URI_SAFE_ATTR,hn):Tn,sn=objectHasOwnProperty(it,"ADD_DATA_URI_TAGS")?addToSet(clone(pn),it.ADD_DATA_URI_TAGS,hn):pn,Ut=objectHasOwnProperty(it,"FORBID_CONTENTS")?addToSet({},it.FORBID_CONTENTS,hn):Wt,Ze=objectHasOwnProperty(it,"FORBID_TAGS")?addToSet({},it.FORBID_TAGS,hn):clone({}),Ke=objectHasOwnProperty(it,"FORBID_ATTR")?addToSet({},it.FORBID_ATTR,hn):clone({}),mt=objectHasOwnProperty(it,"USE_PROFILES")?it.USE_PROFILES:!1,nt=it.ALLOW_ARIA_ATTR!==!1,st=it.ALLOW_DATA_ATTR!==!1,lt=it.ALLOW_UNKNOWN_PROTOCOLS||!1,Ge=it.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ct=it.SAFE_FOR_TEMPLATES||!1,tt=it.SAFE_FOR_XML!==!1,yt=it.WHOLE_DOCUMENT||!1,Mt=it.RETURN_DOM||!1,It=it.RETURN_DOM_FRAGMENT||!1,We=it.RETURN_TRUSTED_TYPE||!1,Rt=it.FORCE_BODY||!1,Ye=it.SANITIZE_DOM!==!1,rt=it.SANITIZE_NAMED_PROPS||!1,pt=it.KEEP_CONTENT!==!1,ft=it.IN_PLACE||!1,Ue=it.ALLOWED_URI_REGEXP||IS_ALLOWED_URI,Rn=it.NAMESPACE||yn,en=it.MATHML_TEXT_INTEGRATION_POINTS||en,Kt=it.HTML_INTEGRATION_POINTS||Kt,Je=it.CUSTOM_ELEMENT_HANDLING||{},it.CUSTOM_ELEMENT_HANDLING&&Pn(it.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Je.tagNameCheck=it.CUSTOM_ELEMENT_HANDLING.tagNameCheck),it.CUSTOM_ELEMENT_HANDLING&&Pn(it.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Je.attributeNameCheck=it.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),it.CUSTOM_ELEMENT_HANDLING&&typeof it.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Je.allowCustomizedBuiltInElements=it.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ct&&(st=!1),It&&(Mt=!0),mt&&(ze=addToSet({},text$1),Qe=[],mt.html===!0&&(addToSet(ze,html$1),addToSet(Qe,html)),mt.svg===!0&&(addToSet(ze,svg$1),addToSet(Qe,svg),addToSet(Qe,xml)),mt.svgFilters===!0&&(addToSet(ze,svgFilters),addToSet(Qe,svg),addToSet(Qe,xml)),mt.mathMl===!0&&(addToSet(ze,mathMl$1),addToSet(Qe,mathMl),addToSet(Qe,xml))),it.ADD_TAGS&&(typeof it.ADD_TAGS=="function"?at.tagCheck=it.ADD_TAGS:(ze===He&&(ze=clone(ze)),addToSet(ze,it.ADD_TAGS,hn))),it.ADD_ATTR&&(typeof it.ADD_ATTR=="function"?at.attributeCheck=it.ADD_ATTR:(Qe===et&&(Qe=clone(Qe)),addToSet(Qe,it.ADD_ATTR,hn))),it.ADD_URI_SAFE_ATTR&&addToSet(qt,it.ADD_URI_SAFE_ATTR,hn),it.FORBID_CONTENTS&&(Ut===Wt&&(Ut=clone(Ut)),addToSet(Ut,it.FORBID_CONTENTS,hn)),pt&&(ze["#text"]=!0),yt&&addToSet(ze,["html","head","body"]),ze.table&&(addToSet(ze,["tbody"]),delete Ze.tbody),it.TRUSTED_TYPES_POLICY){if(typeof it.TRUSTED_TYPES_POLICY.createHTML!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof it.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Q=it.TRUSTED_TYPES_POLICY,O=Q.createHTML("")}else Q===void 0&&(Q=_createTrustedTypesPolicy(E,l)),Q!==null&&typeof O=="string"&&(O=Q.createHTML(""));freeze&&freeze(it),$n=it}},Bn=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),Ln=addToSet({},[...mathMl$1,...mathMlDisallowed]),ar=function(it){let $t=z(it);(!$t||!$t.tagName)&&($t={namespaceURI:Rn,tagName:"template"});const zt=stringToLowerCase(it.tagName),fn=stringToLowerCase($t.tagName);return Nn[it.namespaceURI]?it.namespaceURI===Sn?$t.namespaceURI===yn?zt==="svg":$t.namespaceURI===vn?zt==="svg"&&(fn==="annotation-xml"||en[fn]):!!Bn[zt]:it.namespaceURI===vn?$t.namespaceURI===yn?zt==="math":$t.namespaceURI===Sn?zt==="math"&&Kt[fn]:!!Ln[zt]:it.namespaceURI===yn?$t.namespaceURI===Sn&&!Kt[fn]||$t.namespaceURI===vn&&!en[fn]?!1:!Ln[zt]&&(Jt[zt]||!Bn[zt]):!!(dn==="application/xhtml+xml"&&Nn[it.namespaceURI]):!1},Cn=function(it){arrayPush(e.removed,{element:it});try{z(it).removeChild(it)}catch{I(it)}},Dn=function(it,$t){try{arrayPush(e.removed,{attribute:$t.getAttributeNode(it),from:$t})}catch{arrayPush(e.removed,{attribute:null,from:$t})}if($t.removeAttribute(it),it==="is")if(Mt||It)try{Cn($t)}catch{}else try{$t.setAttribute(it,"")}catch{}},Qn=function(it){let $t=null,zt=null;if(Rt)it="<remove></remove>"+it;else{const mn=stringMatch(it,/^[\r\n\t ]+/);zt=mn&&mn[0]}dn==="application/xhtml+xml"&&Rn===yn&&(it='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+it+"</body></html>");const fn=Q?Q.createHTML(it):it;if(Rn===yn)try{$t=new C().parseFromString(fn,dn)}catch{}if(!$t||!$t.documentElement){$t=V.createDocument(Rn,"template",null);try{$t.documentElement.innerHTML=jn?O:fn}catch{}}const xn=$t.body||$t.documentElement;return it&&zt&&xn.insertBefore(n.createTextNode(zt),xn.childNodes[0]||null),Rn===yn?ae.call($t,yt?"html":"body")[0]:yt?$t.documentElement:xn},Zn=function(it){return te.call(it.ownerDocument||it,it,_.SHOW_ELEMENT|_.SHOW_COMMENT|_.SHOW_TEXT|_.SHOW_PROCESSING_INSTRUCTION|_.SHOW_CDATA_SECTION,null)},zn=function(it){return it instanceof R&&(typeof it.nodeName!="string"||typeof it.textContent!="string"||typeof it.removeChild!="function"||!(it.attributes instanceof S)||typeof it.removeAttribute!="function"||typeof it.setAttribute!="function"||typeof it.namespaceURI!="string"||typeof it.insertBefore!="function"||typeof it.hasChildNodes!="function")},sr=function(it){return typeof g=="function"&&it instanceof g};function kn(Yt,it,$t){arrayForEach(Yt,zt=>{zt.call(e,it,$t,$n)})}const or=function(it){let $t=null;if(kn(ge.beforeSanitizeElements,it,null),zn(it))return Cn(it),!0;const zt=hn(it.nodeName);if(kn(ge.uponSanitizeElement,it,{tagName:zt,allowedTags:ze}),tt&&it.hasChildNodes()&&!sr(it.firstElementChild)&®ExpTest(/<[/\w!]/g,it.innerHTML)&®ExpTest(/<[/\w!]/g,it.textContent)||it.nodeType===NODE_TYPE.progressingInstruction||tt&&it.nodeType===NODE_TYPE.comment&®ExpTest(/<[/\w]/g,it.data))return Cn(it),!0;if(!(at.tagCheck instanceof Function&&at.tagCheck(zt))&&(!ze[zt]||Ze[zt])){if(!Ze[zt]&&er(zt)&&(Je.tagNameCheck instanceof RegExp&®ExpTest(Je.tagNameCheck,zt)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(zt)))return!1;if(pt&&!Ut[zt]){const fn=z(it)||it.parentNode,xn=F(it)||it.childNodes;if(xn&&fn){const mn=xn.length;for(let _n=mn-1;_n>=0;--_n){const An=M(xn[_n],!0);An.__removalCount=(it.__removalCount||0)+1,fn.insertBefore(An,j(it))}}}return Cn(it),!0}return it instanceof b&&!ar(it)||(zt==="noscript"||zt==="noembed"||zt==="noframes")&®ExpTest(/<\/no(script|embed|frames)/i,it.innerHTML)?(Cn(it),!0):(Ct&&it.nodeType===NODE_TYPE.text&&($t=it.textContent,arrayForEach([se,je,Ae],fn=>{$t=stringReplace($t,fn," ")}),it.textContent!==$t&&(arrayPush(e.removed,{element:it.cloneNode()}),it.textContent=$t)),kn(ge.afterSanitizeElements,it,null),!1)},lr=function(it,$t,zt){if(Ye&&($t==="id"||$t==="name")&&(zt in n||zt in On))return!1;if(!(st&&!Ke[$t]&®ExpTest(Ne,$t))){if(!(nt&®ExpTest(Ve,$t))){if(!(at.attributeCheck instanceof Function&&at.attributeCheck($t,it))){if(!Qe[$t]||Ke[$t]){if(!(er(it)&&(Je.tagNameCheck instanceof RegExp&®ExpTest(Je.tagNameCheck,it)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(it))&&(Je.attributeNameCheck instanceof RegExp&®ExpTest(Je.attributeNameCheck,$t)||Je.attributeNameCheck instanceof Function&&Je.attributeNameCheck($t,it))||$t==="is"&&Je.allowCustomizedBuiltInElements&&(Je.tagNameCheck instanceof RegExp&®ExpTest(Je.tagNameCheck,zt)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(zt))))return!1}else if(!qt[$t]){if(!regExpTest(Ue,stringReplace(zt,Oe,""))){if(!(($t==="src"||$t==="xlink:href"||$t==="href")&&it!=="script"&&stringIndexOf(zt,"data:")===0&&sn[it])){if(!(lt&&!regExpTest(Fe,stringReplace(zt,Oe,"")))){if(zt)return!1}}}}}}}return!0},er=function(it){return it!=="annotation-xml"&&stringMatch(it,Be)},tr=function(it){kn(ge.beforeSanitizeAttributes,it,null);const{attributes:$t}=it;if(!$t||zn(it))return;const zt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Qe,forceKeepAttr:void 0};let fn=$t.length;for(;fn--;){const xn=$t[fn],{name:mn,namespaceURI:_n,value:An}=xn,Fn=hn(mn),Ht=An;let gn=mn==="value"?Ht:stringTrim(Ht);if(zt.attrName=Fn,zt.attrValue=gn,zt.keepAttr=!0,zt.forceKeepAttr=void 0,kn(ge.uponSanitizeAttribute,it,zt),gn=zt.attrValue,rt&&(Fn==="id"||Fn==="name")&&(Dn(mn,it),gn=ut+gn),tt&®ExpTest(/((--!?|])>)|<\/(style|title|textarea)/i,gn)){Dn(mn,it);continue}if(Fn==="attributename"&&stringMatch(gn,"href")){Dn(mn,it);continue}if(zt.forceKeepAttr)continue;if(!zt.keepAttr){Dn(mn,it);continue}if(!Ge&®ExpTest(/\/>/i,gn)){Dn(mn,it);continue}Ct&&arrayForEach([se,je,Ae],ur=>{gn=stringReplace(gn,ur," ")});const wn=hn(it.nodeName);if(!lr(wn,Fn,gn)){Dn(mn,it);continue}if(Q&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!_n)switch(E.getAttributeType(wn,Fn)){case"TrustedHTML":{gn=Q.createHTML(gn);break}case"TrustedScriptURL":{gn=Q.createScriptURL(gn);break}}if(gn!==Ht)try{_n?it.setAttributeNS(_n,mn,gn):it.setAttribute(mn,gn),zn(it)?Cn(it):arrayPop(e.removed)}catch{Dn(mn,it)}}kn(ge.afterSanitizeAttributes,it,null)},cr=function Yt(it){let $t=null;const zt=Zn(it);for(kn(ge.beforeSanitizeShadowDOM,it,null);$t=zt.nextNode();)kn(ge.uponSanitizeShadowNode,$t,null),or($t),tr($t),$t.content instanceof d&&Yt($t.content);kn(ge.afterSanitizeShadowDOM,it,null)};return e.sanitize=function(Yt){let it=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$t=null,zt=null,fn=null,xn=null;if(jn=!Yt,jn&&(Yt="<!-->"),typeof Yt!="string"&&!sr(Yt))if(typeof Yt.toString=="function"){if(Yt=Yt.toString(),typeof Yt!="string")throw typeErrorCreate("dirty is not a string, aborting")}else throw typeErrorCreate("toString is not a function");if(!e.isSupported)return Yt;if(ct||Xn(it),e.removed=[],typeof Yt=="string"&&(ft=!1),ft){if(Yt.nodeName){const An=hn(Yt.nodeName);if(!ze[An]||Ze[An])throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}}else if(Yt instanceof g)$t=Qn("<!---->"),zt=$t.ownerDocument.importNode(Yt,!0),zt.nodeType===NODE_TYPE.element&&zt.nodeName==="BODY"||zt.nodeName==="HTML"?$t=zt:$t.appendChild(zt);else{if(!Mt&&!Ct&&!yt&&Yt.indexOf("<")===-1)return Q&&We?Q.createHTML(Yt):Yt;if($t=Qn(Yt),!$t)return Mt?null:We?O:""}$t&&Rt&&Cn($t.firstChild);const mn=Zn(ft?Yt:$t);for(;fn=mn.nextNode();)or(fn),tr(fn),fn.content instanceof d&&cr(fn.content);if(ft)return Yt;if(Mt){if(It)for(xn=ne.call($t.ownerDocument);$t.firstChild;)xn.appendChild($t.firstChild);else xn=$t;return(Qe.shadowroot||Qe.shadowrootmode)&&(xn=$e.call(o,xn,!0)),xn}let _n=yt?$t.outerHTML:$t.innerHTML;return yt&&ze["!doctype"]&&$t.ownerDocument&&$t.ownerDocument.doctype&&$t.ownerDocument.doctype.name&®ExpTest(DOCTYPE_NAME,$t.ownerDocument.doctype.name)&&(_n="<!DOCTYPE "+$t.ownerDocument.doctype.name+`>
|
|
1133
|
-
`+_n),Ct&&arrayForEach([se,je,Ae],An=>{_n=stringReplace(_n,An," ")}),Q&&We?Q.createHTML(_n):_n},e.setConfig=function(){let Yt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xn(Yt),ct=!0},e.clearConfig=function(){$n=null,ct=!1},e.isValidAttribute=function(Yt,it,$t){$n||Xn({});const zt=hn(Yt),fn=hn(it);return lr(zt,fn,$t)},e.addHook=function(Yt,it){typeof it=="function"&&arrayPush(ge[Yt],it)},e.removeHook=function(Yt,it){if(it!==void 0){const $t=arrayLastIndexOf(ge[Yt],it);return $t===-1?void 0:arraySplice(ge[Yt],$t,1)[0]}return arrayPop(ge[Yt])},e.removeHooks=function(Yt){ge[Yt]=[]},e.removeAllHooks=function(){ge=_createHooksMap()},e}var purify=createDOMPurify();function markdownToSafeHTML(t){const e=marked(t,{async:!1});return purify.sanitize(e,{ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","b","strong","i","em","u","s","sub","sup","mark","blockquote","q","ul","ol","li","dl","dt","dd","p","div","span","br","hr","table","thead","tbody","tfoot","tr","th","td"]})}function SkeletonMessage({botStatus:t}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 mt-1 rounded-full bg-gray-300 animate-pulse flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsx("p",{className:"mb-1",children:"Assistant"}),jsxRuntime.jsxs("div",{className:"flex items-end gap-2",children:[jsxRuntime.jsx("div",{className:"rounded-md p-3 break-words bg-white border rounded-tl-none",children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-150"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-300"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:t})]})}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})})]})]})]})}function ChatMessages({messages:t,appID:e,botStatus:n,isAssistantChat:o}){const l=(()=>{const d=new Set;let f=null;for(const g of t){const b=(g.senderName??"").trim();b&&(f===b?d.add(g.id):f=b)}return d})();return jsxRuntime.jsxs("div",{children:[t.map(d=>{var g;const f=d.fromPartnerID===e;return jsxRuntime.jsx("div",{className:cn("flex items-start gap-2 mt-2 mb-2",f&&"flex-row-reverse"),children:jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[!l.has(d.id)&&!!((g=d.senderName)!=null&&g.trim())&&jsxRuntime.jsx("p",{className:cn("mb-1 flex",f&&"flex-row-reverse"),children:d.senderName}),jsxRuntime.jsxs("div",{className:cn("flex items-baseline gap-2",f&&"flex-row-reverse"),children:[jsxRuntime.jsx("div",{className:cn("rounded-md p-3 break-words [&_li]:ml-6 [&_li]:list-disc [&_h1]:text-lg [&_h1]:font-bold [&_h1]:mt-4 [&_h2]:font-bold [&_h2]:mt-4 [&_h3]:mt-4 ",f?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:parser(markdownToSafeHTML(d.content))}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:(()=>{const b=new Date(d.timestamp);return isToday(b)?b.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(b)?`Yesterday, ${b.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${b.toLocaleDateString([],{month:"short",day:"numeric"})} ${b.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`})()})]})]})},d.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),t.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}const Textarea=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("textarea",{className:cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));Textarea.displayName="Textarea";function ChatMainArea({activeChat:t,activeChatObj:e,appID:n,messagesEndRef:o,inputRef:l,content:d,setContent:f,handleSendMessage:g,isPostBizDevConvoLoading:b,acceptChat:_}){return jsxRuntime.jsx("div",{className:"flex-5 flex flex-col",children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center p-4 border-b",children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(PartnerLogo,{id:t[0]===n?t[1]:t[0],width:72,height:72})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:e==null?void 0:e.name})]}),e!=null&&e.pending&&e.partner1==n?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:[jsxRuntime.jsx(ChatMessages,{messages:(e==null?void 0:e.messages)??[],appID:n,isAssistantChat:!1,botStatus:""}),jsxRuntime.jsx("div",{ref:o})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t border-r flex",children:[(e==null?void 0:e.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button$1,{disabled:b,onClick:()=>_(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button$1,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:l,placeholder:"Type a message...",value:d,onChange:S=>f(S.target.value),onKeyDown:S=>{S.key!=="Enter"||S.shiftKey||(S.preventDefault(),g())},className:e!=null&&e.pending?"collapse":"flex-1 resize-none field-sizing-content max-h-[30em]",disabled:e==null?void 0:e.pending}),jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsx(Button$1,{size:"icon",variant:"default",className:e!=null&&e.pending?"collapse":"ml-2 h-8 w-8",disabled:e==null?void 0:e.pending,onClick:g,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})})})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})})}function ChatRightSidebar({activeChatObj:t,appID:e,sendChatToAssistant:n,isAnalyzingPartnership:o,analyzePartnership:l}){const d=t?[t.partner1,t.partner2]:void 0;return jsxRuntime.jsx("div",{className:"flex border-l flex-1",children:jsxRuntime.jsxs("div",{className:"flex flex-col p-4 border-b gap-2",children:[jsxRuntime.jsx("p",{className:"h-9 font-medium text-base/9",children:"Actions"}),jsxRuntime.jsx(reactRouterDom.Link,{className:"w-full",inert:d===void 0,to:`/${e}/Partner/${(d==null?void 0:d[0])===e?d[1]:d==null?void 0:d[0]}`,children:jsxRuntime.jsx(Button$1,{className:"w-full",disabled:d===void 0,children:"View Partner"})}),jsxRuntime.jsx(Button$1,{disabled:((t==null?void 0:t.messages)??[]).length<1,onClick:()=>n(t.messages),children:"Export to Randmar Assistant"}),jsxRuntime.jsx(Button$1,{disabled:d===void 0||o,onClick:l,children:o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Analyzing..."]}):"Analyze Partnership"}),jsxRuntime.jsx("p",{className:"font-medium pt-2 border-t",children:"People"}),jsxRuntime.jsx("p",{className:"font-light",children:"Members of this conversation will show up here."}),jsxRuntime.jsx(LinkSection,{appID:e,activeChatObj:t})]})})}const LinkSection=({appID:t,activeChatObj:e})=>{const[n,o]=React.useState(!1),{data:l,isLoading:d}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdLinksQuery({routeApplicationId:t,conversationId:e==null?void 0:e.conversationID},{skip:!(e!=null&&e.conversationID)});console.log(l);const[f]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdLinkMutation(),[g]=useDeleteV4PartnerByRouteApplicationIdBusinessDevelopmentConversationLinkAndLinkIdMutation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("p",{className:"font-medium pt-2 border-t",children:"Links"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[d?jsxRuntime.jsx("p",{children:"Loading links..."}):(l==null?void 0:l.length)===0?jsxRuntime.jsx("p",{children:"No links attached."}):null,l==null?void 0:l.map(b=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("a",{href:b.URL,target:"_blank",rel:"noopener noreferrer",className:"text-randmar-red underline break-all",children:b.Title}),jsxRuntime.jsx(Button$1,{variant:"secondary",size:"icon",onClick:()=>g({routeApplicationId:t,linkId:b.LinkId}),children:jsxRuntime.jsx(Trash2,{className:"h-4 w-4"})})]},b.LinkId))]}),jsxRuntime.jsxs(Dialog,{open:n,onOpenChange:o,children:[jsxRuntime.jsx(DialogTrigger$1,{asChild:!0,children:jsxRuntime.jsx(Button$1,{className:"p-0",disabled:e===void 0,children:"Add Link"})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle$1,{children:"Add Link"}),jsxRuntime.jsx(DialogDescription$1,{children:"Please enter the details for the new link."})]}),jsxRuntime.jsxs("form",{className:"space-y-4",onSubmit:b=>{b.preventDefault();const _=document.getElementById("link-title").value,S=document.getElementById("link-url").value;f({routeApplicationId:t,conversationId:e==null?void 0:e.conversationID,createLinkRequest:{Title:_,Url:S}}),o(!1)},children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"link-title",children:"Title"}),jsxRuntime.jsx(Input,{id:"link-title",required:!0,minLength:2})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"link-url",children:"URL"}),jsxRuntime.jsx(Input,{id:"link-url",required:!0,minLength:2})]}),jsxRuntime.jsx(Button$1,{type:"submit",children:"Add Link"})]})]})]})]})},UserSetupForm=t=>{const[e]=usePostV4UserByFieldNameMutation(),[n,o]=React.useState(""),[l,d]=React.useState(""),[f,g]=React.useState(!1),[b]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation();return jsxRuntime.jsxs("div",{className:"mx-auto mt-2",children:[jsxRuntime.jsx("p",{className:"mb-4",children:"Before you can start chatting, please set up your profile."}),jsxRuntime.jsxs("form",{className:"space-y-2",onSubmit:_=>{f||(g(!0),_.preventDefault(),e({fieldName:"Name",newValue:n}).then(()=>{b({routeApplicationId:t.appID,partnerId:"2"})}),e({fieldName:"Role",newValue:l}))},children:[jsxRuntime.jsx(Label$2,{htmlFor:"name",children:"Name"}),jsxRuntime.jsx(Input,{id:"name",required:!0,minLength:2,value:n,onChange:_=>o(_.target.value)}),jsxRuntime.jsx(Label$2,{htmlFor:"role",children:"Role"}),jsxRuntime.jsx(Input,{id:"role",required:!0,minLength:2,value:l,onChange:_=>d(_.target.value)}),jsxRuntime.jsx(Button$1,{type:"submit",disabled:f,children:f?"Saving...":"Save"})]})]})},sortChats=(t,e)=>t.unread>0&&e.unread===0?-1:e.unread>0&&t.unread===0?1:t.name.localeCompare(e.name);function ChatLayout({appID:t,inputRef:e,className:n}){const{setHasUnreads:o}=useChat(),{data:l,refetch:d}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsQuery({routeApplicationId:t}),[f,g]=React.useState(!1),[b,{isLoading:_}]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),S=React.useRef(null),[R]=useLazyGetV4PartnerByApplicationIdAccountQuery(),{sendPrompt:C}=useGemini({outputFormat:"text",useProModel:!0}),[E,A]=React.useState(!1),[M]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[I]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdReadMutation(),[j]=useLazyGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),[F]=useLazyGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery(),[z,Q]=React.useState(!1);React.useEffect(()=>{l&&(se(ct=>{const Rt=l.map(Mt=>{var We;const It=ct.find(Ye=>Ye.conversationID===Mt.ConversationId);return{partner1:Mt.Participant1,partner2:Mt.Participant2,name:((We=Mt.Participant)==null?void 0:We.PublicName)??"missing public name",unread:(It==null?void 0:It.unread)??0,pending:Mt.Status!=="Approved",messages:(It==null?void 0:It.messages)??[],conversationID:Mt.ConversationId,lastMessageTime:Mt.LastMessageTime??null}});return Rt.sort(sortChats),Rt}),g(!0),setTimeout(()=>{var ct;return(ct=Be.current)==null?void 0:ct.focus()},50))},[l,t]);const[O,V]=React.useState(void 0),[te,ne]=React.useState(""),[ae,$e]=React.useState(null),[ge,se]=React.useState([]),[je,Ae]=React.useState(null),Ne=React.useRef(null),Ve=React.useRef(null),[Fe,Oe]=React.useState([]),Be=e||Ve,Ue=React.useRef(null),{toast:ze}=useToast(),He=()=>ge.find(ct=>ct.partner1===(O==null?void 0:O[0])&&ct.partner2===(O==null?void 0:O[1]));function Qe(){const ct=He();ct&&I({routeApplicationId:t,conversationId:ct.conversationID})}const et=ct=>Oe(Rt=>[...Rt,ct]);React.useEffect(()=>{if(Fe.length==0)return;console.log(Fe.length,"unprocessedMessages detected");const ct=(Mt,It)=>It.partner1===Mt.toPartnerID&&It.partner2===Mt.fromPartnerID||It.partner2===Mt.toPartnerID&&It.partner1===Mt.fromPartnerID;let Rt=!1;Fe.forEach(Mt=>{if(!ge.some(It=>ct(Mt,It))){console.log("message received for unknown convo ID - need to refetch!"),Rt=!0;return}se(It=>It.map(We=>{if(!ct(Mt,We)||We.messages.some(ut=>ut.id===Mt.id))return We;let Ye=1;const rt=document.activeElement&&document.activeElement===Be.current;return(O==null?void 0:O[0])==We.partner1&&O[1]==We.partner2&&rt&&(rt&&(Ye=0,Qe()),setTimeout(()=>{var ut;return(ut=Ne.current)==null?void 0:ut.scrollIntoView({behavior:"smooth"})},50)),{...We,pending:!1,unread:We.unread+Ye,messages:[...We.messages,Mt]}}).sort(sortChats))}),console.log("need refetch:",Rt),Rt&&d(),Oe([])},[Fe,Oe,se,V,O]),React.useEffect(()=>{const ct=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":t}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return ct.on("ReceiveMessage",et),ct.start().catch(Rt=>console.error("Error connecting to SignalR hub:",Rt)),Ae(ct),()=>{ct&&ct.stop()}},[t]),React.useEffect(()=>{var Rt;!O||!He()||((Rt=Be.current)==null||Rt.focus(),setTimeout(()=>{var Mt;return(Mt=Ne.current)==null?void 0:Mt.scrollIntoView({behavior:"smooth"})},50))},[O]),React.useEffect(()=>{if(!O)return;const ct=He();ct&&ct.conversationID!==-1&&(async()=>{var Rt;try{const It=((Rt=(await j({routeApplicationId:t,conversationId:ct.conversationID})).data)==null?void 0:Rt.map(We=>({id:"history"+We.MessageId,fromPartnerID:We.SenderId,toPartnerID:We.SenderId==ct.partner1?ct.partner2:ct.partner1,senderName:We.SenderName??"missing name",timestamp:new Date(We.SentDate+"Z").getTime(),content:We.Content??"no content"})))??[];se(We=>We.map(Ye=>Ye.conversationID===ct.conversationID?{...Ye,messages:It}:Ye).sort(sortChats))}catch(Mt){console.error("Error fetching conversation messages:",Mt)}})()},[O,j,t]),React.useEffect(()=>{if(!O)return;const ct=He();if(!ct)return;const Rt=document.activeElement&&document.activeElement===Be.current;ct.unread>0&&Rt&&(Qe(),se(Mt=>Mt.map(It=>It.partner1===O[0]&&It.partner2===O[1]?{...It,unread:0}:It)))},[O,ge]);const{sendMessage:Je}=useChat(),Ze=React.useCallback(ct=>{Je(`We have been talking with another Randmar partner and would like you to have the conversation as context for follow-up questions. Please acknowledge your reception of this chat history (one line summary of recent messages will do) and let me know that you're ready to answer questions: ${JSON.stringify(ct,null,2)}`)},[Je]),Ke=React.useCallback(async()=>{if(O)try{Q(!0);const ct=await R({applicationId:t}),Rt=O[0]===t?O[1]:O[0],Mt=await F({routeApplicationId:t,partnerId:Rt,withSpecification:!0}),It=buildPartnershipAssistantPrompt(ct.data,Mt.data);It?Je(It):ze({title:"Missing data",description:"We couldn't load enough data to analyze this partnership yet. Please try again shortly.",variant:"destructive"})}catch(ct){console.error("Error preparing partnership analysis:",ct),ze({title:"Error",description:"Could not analyze the partnership. Please try again later.",variant:"destructive"})}finally{Q(!1)}},[O,R,F,Je,ze,t]);React.useEffect(()=>{o(ge.some(ct=>ct.unread>0))},[ge,o]);const at=(ct,Rt)=>{Rt=Rt.replace(/\n/g,`
|
|
1133
|
+
`+_n),Ct&&arrayForEach([se,je,Ae],An=>{_n=stringReplace(_n,An," ")}),Q&&We?Q.createHTML(_n):_n},e.setConfig=function(){let Yt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xn(Yt),ct=!0},e.clearConfig=function(){$n=null,ct=!1},e.isValidAttribute=function(Yt,it,$t){$n||Xn({});const zt=hn(Yt),fn=hn(it);return lr(zt,fn,$t)},e.addHook=function(Yt,it){typeof it=="function"&&arrayPush(ge[Yt],it)},e.removeHook=function(Yt,it){if(it!==void 0){const $t=arrayLastIndexOf(ge[Yt],it);return $t===-1?void 0:arraySplice(ge[Yt],$t,1)[0]}return arrayPop(ge[Yt])},e.removeHooks=function(Yt){ge[Yt]=[]},e.removeAllHooks=function(){ge=_createHooksMap()},e}var purify=createDOMPurify();function markdownToSafeHTML(t){const e=marked(t,{async:!1});return purify.sanitize(e,{ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","b","strong","i","em","u","s","sub","sup","mark","blockquote","q","ul","ol","li","dl","dt","dd","p","div","span","br","hr","table","thead","tbody","tfoot","tr","th","td"]})}function SkeletonMessage({botStatus:t}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 mt-1 rounded-full bg-gray-300 animate-pulse flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsx("p",{className:"mb-1",children:"Assistant"}),jsxRuntime.jsxs("div",{className:"flex items-end gap-2",children:[jsxRuntime.jsx("div",{className:"rounded-md p-3 break-words bg-white border rounded-tl-none",children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-150"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-300"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:t})]})}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})})]})]})]})}function ChatMessages({messages:t,appID:e,botStatus:n,isAssistantChat:o}){const l=(()=>{const d=new Set;let f=null;for(const g of t){const b=(g.senderName??"").trim();b&&(f===b?d.add(g.id):f=b)}return d})();return jsxRuntime.jsxs("div",{children:[t.map(d=>{var g;const f=d.fromPartnerID===e;return jsxRuntime.jsx("div",{className:cn("flex items-start gap-2 mt-2 mb-2",f&&"flex-row-reverse"),children:jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[!l.has(d.id)&&!!((g=d.senderName)!=null&&g.trim())&&jsxRuntime.jsx("p",{className:cn("mb-1 flex",f&&"flex-row-reverse"),children:d.senderName}),jsxRuntime.jsxs("div",{className:cn("flex items-baseline gap-2",f&&"flex-row-reverse"),children:[jsxRuntime.jsx("div",{className:cn("rounded-md p-3 break-words [&_li]:ml-6 [&_li]:list-disc [&_h1]:text-lg [&_h1]:font-bold [&_h1]:mt-4 [&_h2]:font-bold [&_h2]:mt-4 [&_h3]:mt-4 ",f?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:parser(markdownToSafeHTML(d.content))}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:(()=>{const b=new Date(d.timestamp);return isToday(b)?b.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(b)?`Yesterday, ${b.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${b.toLocaleDateString([],{month:"short",day:"numeric"})} ${b.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`})()})]})]})},d.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),t.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}const Textarea=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("textarea",{className:cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));Textarea.displayName="Textarea";function ChatMainArea({activeChat:t,activeChatObj:e,appID:n,messagesEndRef:o,inputRef:l,content:d,setContent:f,handleSendMessage:g,isPostBizDevConvoLoading:b,acceptChat:_}){return jsxRuntime.jsx("div",{className:"flex-5 flex flex-col",children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center p-4 border-b",children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(PartnerLogo,{id:t[0]===n?t[1]:t[0],width:72,height:72})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:e==null?void 0:e.name})]}),e!=null&&e.pending&&e.partner1==n?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:[jsxRuntime.jsx(ChatMessages,{messages:(e==null?void 0:e.messages)??[],appID:n,isAssistantChat:!1,botStatus:""}),jsxRuntime.jsx("div",{ref:o})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t border-r flex",children:[(e==null?void 0:e.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button$1,{disabled:b,onClick:()=>_(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button$1,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:l,placeholder:"Type a message...",value:d,onChange:S=>f(S.target.value),onKeyDown:S=>{S.key!=="Enter"||S.shiftKey||(S.preventDefault(),g())},className:e!=null&&e.pending?"collapse":"flex-1 resize-none field-sizing-content max-h-[30em]",disabled:e==null?void 0:e.pending}),jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsx(Button$1,{size:"icon",variant:"default",className:e!=null&&e.pending?"collapse":"ml-2 h-8 w-8",disabled:e==null?void 0:e.pending,onClick:g,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})})})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})})}function ChatRightSidebar({activeChatObj:t,appID:e,sendChatToAssistant:n,isAnalyzingPartnership:o,analyzePartnership:l}){const d=t?[t.partner1,t.partner2]:void 0;return jsxRuntime.jsx("div",{className:"flex border-l flex-1",children:jsxRuntime.jsxs("div",{className:"flex flex-col p-4 border-b gap-2",children:[jsxRuntime.jsx("p",{className:"h-9 font-medium text-base/9",children:"Actions"}),jsxRuntime.jsx(reactRouterDom.Link,{className:"w-full",inert:d===void 0,to:`/${e}/Partner/${(d==null?void 0:d[0])===e?d[1]:d==null?void 0:d[0]}`,children:jsxRuntime.jsx(Button$1,{className:"w-full",disabled:d===void 0,children:"View Partner"})}),jsxRuntime.jsx(Button$1,{disabled:((t==null?void 0:t.messages)??[]).length<1,onClick:()=>n(t.messages),children:"Export to Randmar Assistant"}),jsxRuntime.jsx(Button$1,{disabled:d===void 0||o,onClick:l,children:o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Analyzing..."]}):"Analyze Partnership"}),jsxRuntime.jsx("p",{className:"font-medium pt-2 border-t",children:"People"}),jsxRuntime.jsx("p",{className:"font-light",children:"Members of this conversation will show up here."}),jsxRuntime.jsx(LinkSection,{appID:e,activeChatObj:t})]})})}const LinkSection=({appID:t,activeChatObj:e})=>{const[n,o]=React.useState(!1),{data:l,isLoading:d}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdLinksQuery({routeApplicationId:t,conversationId:e==null?void 0:e.conversationID},{skip:!(e!=null&&e.conversationID)});console.log(l);const[f]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdLinkMutation(),[g]=useDeleteV4PartnerByRouteApplicationIdBusinessDevelopmentConversationLinkAndLinkIdMutation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("p",{className:"font-medium pt-2 border-t",children:"Links"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[d?jsxRuntime.jsx("p",{children:"Loading links..."}):(l==null?void 0:l.length)===0?jsxRuntime.jsx("p",{children:"No links attached."}):null,l==null?void 0:l.map(b=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("a",{href:b.URL,target:"_blank",rel:"noopener noreferrer",className:"text-randmar-red underline break-all",children:b.Title}),jsxRuntime.jsx(Button$1,{variant:"secondary",size:"icon",onClick:()=>g({routeApplicationId:t,linkId:b.LinkId}),children:jsxRuntime.jsx(Trash2,{className:"h-4 w-4"})})]},b.LinkId))]}),jsxRuntime.jsxs(Dialog,{open:n,onOpenChange:o,children:[jsxRuntime.jsx(DialogTrigger$1,{asChild:!0,children:jsxRuntime.jsx(Button$1,{className:"p-0",disabled:e===void 0,children:"Add Link"})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle$1,{children:"Add Link"}),jsxRuntime.jsx(DialogDescription$1,{children:"Please enter the details for the new link."})]}),jsxRuntime.jsxs("form",{className:"space-y-4",onSubmit:b=>{b.preventDefault();const _=document.getElementById("link-title").value,S=document.getElementById("link-url").value;f({routeApplicationId:t,conversationId:e==null?void 0:e.conversationID,createLinkRequest:{Title:_,Url:S}}),o(!1)},children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"link-title",children:"Title"}),jsxRuntime.jsx(Input,{id:"link-title",required:!0,minLength:2})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"link-url",children:"URL"}),jsxRuntime.jsx(Input,{id:"link-url",type:"url",required:!0,minLength:2,placeholder:"https://"})]}),jsxRuntime.jsx(Button$1,{type:"submit",children:"Add Link"})]})]})]})]})},UserSetupForm=t=>{const[e]=usePostV4UserByFieldNameMutation(),[n,o]=React.useState(""),[l,d]=React.useState(""),[f,g]=React.useState(!1),[b]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation();return jsxRuntime.jsxs("div",{className:"mx-auto mt-2",children:[jsxRuntime.jsx("p",{className:"mb-4",children:"Before you can start chatting, please set up your profile."}),jsxRuntime.jsxs("form",{className:"space-y-2",onSubmit:_=>{f||(g(!0),_.preventDefault(),e({fieldName:"Name",newValue:n}).then(()=>{b({routeApplicationId:t.appID,partnerId:"2"})}),e({fieldName:"Role",newValue:l}))},children:[jsxRuntime.jsx(Label$2,{htmlFor:"name",children:"Name"}),jsxRuntime.jsx(Input,{id:"name",required:!0,minLength:2,value:n,onChange:_=>o(_.target.value)}),jsxRuntime.jsx(Label$2,{htmlFor:"role",children:"Role"}),jsxRuntime.jsx(Input,{id:"role",required:!0,minLength:2,value:l,onChange:_=>d(_.target.value)}),jsxRuntime.jsx(Button$1,{type:"submit",disabled:f,children:f?"Saving...":"Save"})]})]})},sortChats=(t,e)=>t.unread>0&&e.unread===0?-1:e.unread>0&&t.unread===0?1:t.name.localeCompare(e.name);function ChatLayout({appID:t,inputRef:e,className:n}){const{setHasUnreads:o}=useChat(),{data:l,refetch:d}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsQuery({routeApplicationId:t}),[f,g]=React.useState(!1),[b,{isLoading:_}]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),S=React.useRef(null),[R]=useLazyGetV4PartnerByApplicationIdAccountQuery(),{sendPrompt:C}=useGemini({outputFormat:"text",useProModel:!0}),[E,A]=React.useState(!1),[M]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[I]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdReadMutation(),[j]=useLazyGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),[F]=useLazyGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery(),[z,Q]=React.useState(!1);React.useEffect(()=>{l&&(se(ct=>{const Rt=l.map(Mt=>{var We;const It=ct.find(Ye=>Ye.conversationID===Mt.ConversationId);return{partner1:Mt.Participant1,partner2:Mt.Participant2,name:((We=Mt.Participant)==null?void 0:We.PublicName)??"missing public name",unread:(It==null?void 0:It.unread)??0,pending:Mt.Status!=="Approved",messages:(It==null?void 0:It.messages)??[],conversationID:Mt.ConversationId,lastMessageTime:Mt.LastMessageTime??null}});return Rt.sort(sortChats),Rt}),g(!0),setTimeout(()=>{var ct;return(ct=Be.current)==null?void 0:ct.focus()},50))},[l,t]);const[O,V]=React.useState(void 0),[te,ne]=React.useState(""),[ae,$e]=React.useState(null),[ge,se]=React.useState([]),[je,Ae]=React.useState(null),Ne=React.useRef(null),Ve=React.useRef(null),[Fe,Oe]=React.useState([]),Be=e||Ve,Ue=React.useRef(null),{toast:ze}=useToast(),He=()=>ge.find(ct=>ct.partner1===(O==null?void 0:O[0])&&ct.partner2===(O==null?void 0:O[1]));function Qe(){const ct=He();ct&&I({routeApplicationId:t,conversationId:ct.conversationID})}const et=ct=>Oe(Rt=>[...Rt,ct]);React.useEffect(()=>{if(Fe.length==0)return;console.log(Fe.length,"unprocessedMessages detected");const ct=(Mt,It)=>It.partner1===Mt.toPartnerID&&It.partner2===Mt.fromPartnerID||It.partner2===Mt.toPartnerID&&It.partner1===Mt.fromPartnerID;let Rt=!1;Fe.forEach(Mt=>{if(!ge.some(It=>ct(Mt,It))){console.log("message received for unknown convo ID - need to refetch!"),Rt=!0;return}se(It=>It.map(We=>{if(!ct(Mt,We)||We.messages.some(ut=>ut.id===Mt.id))return We;let Ye=1;const rt=document.activeElement&&document.activeElement===Be.current;return(O==null?void 0:O[0])==We.partner1&&O[1]==We.partner2&&rt&&(rt&&(Ye=0,Qe()),setTimeout(()=>{var ut;return(ut=Ne.current)==null?void 0:ut.scrollIntoView({behavior:"smooth"})},50)),{...We,pending:!1,unread:We.unread+Ye,messages:[...We.messages,Mt]}}).sort(sortChats))}),console.log("need refetch:",Rt),Rt&&d(),Oe([])},[Fe,Oe,se,V,O]),React.useEffect(()=>{const ct=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":t}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return ct.on("ReceiveMessage",et),ct.start().catch(Rt=>console.error("Error connecting to SignalR hub:",Rt)),Ae(ct),()=>{ct&&ct.stop()}},[t]),React.useEffect(()=>{var Rt;!O||!He()||((Rt=Be.current)==null||Rt.focus(),setTimeout(()=>{var Mt;return(Mt=Ne.current)==null?void 0:Mt.scrollIntoView({behavior:"smooth"})},50))},[O]),React.useEffect(()=>{if(!O)return;const ct=He();ct&&ct.conversationID!==-1&&(async()=>{var Rt;try{const It=((Rt=(await j({routeApplicationId:t,conversationId:ct.conversationID})).data)==null?void 0:Rt.map(We=>({id:"history"+We.MessageId,fromPartnerID:We.SenderId,toPartnerID:We.SenderId==ct.partner1?ct.partner2:ct.partner1,senderName:We.SenderName??"missing name",timestamp:new Date(We.SentDate+"Z").getTime(),content:We.Content??"no content"})))??[];se(We=>We.map(Ye=>Ye.conversationID===ct.conversationID?{...Ye,messages:It}:Ye).sort(sortChats))}catch(Mt){console.error("Error fetching conversation messages:",Mt)}})()},[O,j,t]),React.useEffect(()=>{if(!O)return;const ct=He();if(!ct)return;const Rt=document.activeElement&&document.activeElement===Be.current;ct.unread>0&&Rt&&(Qe(),se(Mt=>Mt.map(It=>It.partner1===O[0]&&It.partner2===O[1]?{...It,unread:0}:It)))},[O,ge]);const{sendMessage:Je}=useChat(),Ze=React.useCallback(ct=>{Je(`We have been talking with another Randmar partner and would like you to have the conversation as context for follow-up questions. Please acknowledge your reception of this chat history (one line summary of recent messages will do) and let me know that you're ready to answer questions: ${JSON.stringify(ct,null,2)}`)},[Je]),Ke=React.useCallback(async()=>{if(O)try{Q(!0);const ct=await R({applicationId:t}),Rt=O[0]===t?O[1]:O[0],Mt=await F({routeApplicationId:t,partnerId:Rt,withSpecification:!0}),It=buildPartnershipAssistantPrompt(ct.data,Mt.data);It?Je(It):ze({title:"Missing data",description:"We couldn't load enough data to analyze this partnership yet. Please try again shortly.",variant:"destructive"})}catch(ct){console.error("Error preparing partnership analysis:",ct),ze({title:"Error",description:"Could not analyze the partnership. Please try again later.",variant:"destructive"})}finally{Q(!1)}},[O,R,F,Je,ze,t]);React.useEffect(()=>{o(ge.some(ct=>ct.unread>0))},[ge,o]);const at=(ct,Rt)=>{Rt=Rt.replace(/\n/g,`
|
|
1134
1134
|
`),console.log("doSend",Rt),console.log("target",ct);const Mt={id:crypto.randomUUID(),senderName:(lt==null?void 0:lt.Name)??(lt==null?void 0:lt.EmailAddress)??"User",fromPartnerID:t,toPartnerID:ct.partner1===t?ct.partner2:ct.partner1,content:Rt,timestamp:Date.now()};et(Mt),je.invoke("NewMessage",Mt).catch(It=>console.error("Error sending message:",It)),ne(""),Ue.current&&(Ue.current.value="")},nt=()=>{let ct=te.trim();!yt||!ct||!O||!je||(yt.unread>0&&(Qe(),se(Rt=>Rt.map(Mt=>Mt.partner1===O[0]&&Mt.partner2===O[1]?{...Mt,unread:0}:Mt))),at(yt,ct))},st=(ct,Rt)=>$e([ct,Rt]);React.useEffect(()=>{if(ae===null)return;const ct=ge.find(Mt=>Mt.conversationID===ae[0]);if(!ct||(V([ct.partner1,ct.partner2]),!je))return;const Rt=ae[1];$e(null),Rt&&at(ct,Rt)},[ae,ge,V,je]);const{data:lt,isLoading:Ge}=useGetV4UserQuery();if(!f||Ge)return jsxRuntime.jsx(LoaderCircle,{className:"h-12 w-12 animate-spin mx-auto mb-4"});if(!(lt!=null&<.Name))return jsxRuntime.jsx(UserSetupForm,{appID:(lt==null?void 0:lt.ApplicationId)??""});const Ct=async()=>{var ct,Rt,Mt,It,We;S.current&&(S.current.disabled=!0),A(!0);try{const Ye=await R({applicationId:t}),rt=((ct=Ye.data)==null?void 0:ct.About)??"a new business venture",ut=[];(Rt=Ye.data)!=null&&Rt.IsManufacturer&&ut.push("Manufacturer"),(Mt=Ye.data)!=null&&Mt.IsReseller&&ut.push("Reseller"),(It=Ye.data)!=null&&It.IsSalesAgency&&ut.push("Sales Agency");const ft=`
|
|
1135
1135
|
Your task is to draft a ready-to-send opening message from a user to the Randmar team.
|
|
1136
1136
|
|