@yoopta/themes-shadcn 6.0.2 → 6.0.4
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/accordion.js +1 -1
- package/dist/applyTheme.d.ts.map +1 -1
- package/dist/carousel.js +1 -1
- package/dist/chunks/button-f335deaa.js +1 -0
- package/dist/chunks/{dropdown-menu-eb328f8d.js → dropdown-menu-36750aec.js} +3 -3
- package/dist/chunks/{hover-card-d6a71398.js → hover-card-8048e9ce.js} +1 -1
- package/dist/chunks/index-371259c9.js +1 -0
- package/dist/chunks/{index-f85dae42.js → index-5b487f4e.js} +1 -1
- package/dist/chunks/{index-ba3032f8.js → index-a77c7d53.js} +1 -1
- package/dist/chunks/{index-23db6fea.js → index-bd6363d4.js} +1 -1
- package/dist/chunks/label-35a74462.js +1 -0
- package/dist/chunks/{language-select-89735035.js → language-select-ee2698cf.js} +1 -1
- package/dist/chunks/pen-d6258303.js +7 -0
- package/dist/chunks/popover-dae0ce5f.js +1 -0
- package/dist/chunks/{scroll-area-dae47c2c.js → scroll-area-8321348a.js} +1 -1
- package/dist/chunks/{select-a8bcd8b5.js → select-a3724728.js} +1 -1
- package/dist/chunks/separator-f4e74aca.js +1 -0
- package/dist/chunks/{tabs-294764a6.js → tabs-370c3f2c.js} +1 -1
- package/dist/chunks/{tooltip-65b9c3a0.js → tooltip-5defff1d.js} +2 -2
- package/dist/code-group.js +1 -1
- package/dist/code.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/embed/elements/embed/embed-inline-toolbar.d.ts.map +1 -1
- package/dist/embed.js +2 -2
- package/dist/emoji.js +1 -1
- package/dist/file/elements/file/file-inline-toolbar.d.ts.map +1 -1
- package/dist/file.js +3 -3
- package/dist/image/elements/image/image-inline-toolbar.d.ts.map +1 -1
- package/dist/image.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/link.js +1 -7
- package/dist/math/elements/math/math-edit.d.ts +13 -0
- package/dist/math/elements/math/math-edit.d.ts.map +1 -0
- package/dist/math/elements/math/math-element.d.ts +3 -0
- package/dist/math/elements/math/math-element.d.ts.map +1 -0
- package/dist/math/elements/math/math-preview.d.ts +10 -0
- package/dist/math/elements/math/math-preview.d.ts.map +1 -0
- package/dist/math/elements/math-block/math-block-element.d.ts +3 -0
- package/dist/math/elements/math-block/math-block-element.d.ts.map +1 -0
- package/dist/math/index.d.ts +15 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/math.js +1 -0
- package/dist/mention.js +3 -3
- package/dist/steps.js +1 -1
- package/dist/table-of-contents/elements/table-of-contents.d.ts.map +1 -1
- package/dist/table-of-contents.js +1 -1
- package/dist/table.js +3 -3
- package/dist/tabs.js +1 -1
- package/dist/video/elements/video/video-inline-toolbar.d.ts.map +1 -1
- package/dist/video.js +2 -2
- package/package.json +20 -13
- package/dist/chunks/button-7aec29d6.js +0 -1
- package/dist/chunks/index-23c7fb16.js +0 -1
- package/dist/chunks/label-21d46c31.js +0 -1
- package/dist/chunks/popover-8e6ee2ab.js +0 -1
- package/dist/chunks/separator-219dc1f7.js +0 -1
package/dist/accordion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{_ as n}from"./chunks/_tslib-35bb891d.js";import*as o from"react";import r,{forwardRef as i,useReducer as a,useMemo as s,useCallback as c}from"react";import{c as d,P as l,a as p,u}from"./chunks/index-17323747.js";import{c as f}from"./chunks/index-f85dae42.js";import{u as m}from"./chunks/index-91a5b8d5.js";import{u as h}from"./chunks/index-ff0e3962.js";import{P as b}from"./chunks/index-23db6fea.js";import{u as g}from"./chunks/index-ce60ba41.js";import{u as y}from"./chunks/index-13505606.js";import{c as v}from"./chunks/utils-3345eade.js";import{useYooptaEditor as k,Blocks as x,Elements as w}from"@yoopta/editor";import{Editor as j,Path as N,Transforms as C,Element as O}from"slate";import{P as _}from"./chunks/plus-840fe920.js";import{T as A}from"./chunks/trash-2-f36597ff.js";import{C as I}from"./chunks/chevron-down-28dfb290.js";import{s as E}from"./chunks/style-inject.es-e87a8d02.js";import"react-dom";import"./chunks/createLucideIcon-8605f860.js";var R="Collapsible",[D,P]=d(R),[S,B]=D(R),T=o.forwardRef((t,n)=>{const{__scopeCollapsible:r,open:i,defaultOpen:a,disabled:s,onOpenChange:c,...d}=t,[p,u]=h({prop:i,defaultProp:a??!1,onChange:c,caller:R});return e(S,{scope:r,disabled:s,contentId:g(),open:p,onOpenToggle:o.useCallback(()=>u(e=>!e),[u]),children:e(l.div,{"data-state":F(p),"data-disabled":s?"":void 0,...d,ref:n})})});T.displayName=R;var V="CollapsibleTrigger",z=o.forwardRef((t,n)=>{const{__scopeCollapsible:o,...r}=t,i=B(V,o);return e(l.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":F(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:n,onClick:p(t.onClick,i.onOpenToggle)})});z.displayName=V;var H="CollapsibleContent",L=o.forwardRef((t,n)=>{const{forceMount:o,...r}=t,i=B(H,t.__scopeCollapsible);return e(b,{present:o||i.open,children:({present:t})=>e(q,{...r,ref:n,present:t})})});L.displayName=H;var q=o.forwardRef((t,n)=>{const{__scopeCollapsible:r,present:i,children:a,...s}=t,c=B(H,r),[d,p]=o.useState(i),f=o.useRef(null),h=m(n,f),b=o.useRef(0),g=b.current,y=o.useRef(0),v=y.current,k=c.open||d,x=o.useRef(k),w=o.useRef(void 0);return o.useEffect(()=>{const e=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(e)},[]),u(()=>{const e=f.current;if(e){w.current=w.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";const t=e.getBoundingClientRect();b.current=t.height,y.current=t.width,x.current||(e.style.transitionDuration=w.current.transitionDuration,e.style.animationName=w.current.animationName),p(i)}},[c.open,i]),e(l.div,{"data-state":F(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!k,...s,ref:h,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...t.style},children:k&&a})});function F(e){return e?"open":"closed"}var K=T,M=z,U=L,$="Accordion",G=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[J,Q,W]=f($),[X,Y]=d($,[W,P]),Z=P(),ee=r.forwardRef((t,n)=>{const{type:o,...r}=t,i=r,a=r;return e(J.Provider,{scope:t.__scopeAccordion,children:"multiple"===o?e(ae,{...a,ref:n}):e(ie,{...i,ref:n})})});ee.displayName=$;var[te,ne]=X($),[oe,re]=X($,{collapsible:!1}),ie=r.forwardRef((t,n)=>{const{value:o,defaultValue:i,onValueChange:a=()=>{},collapsible:s=!1,...c}=t,[d,l]=h({prop:o,defaultProp:i??"",onChange:a,caller:$});return e(te,{scope:t.__scopeAccordion,value:r.useMemo(()=>d?[d]:[],[d]),onItemOpen:l,onItemClose:r.useCallback(()=>s&&l(""),[s,l]),children:e(oe,{scope:t.__scopeAccordion,collapsible:s,children:e(de,{...c,ref:n})})})}),ae=r.forwardRef((t,n)=>{const{value:o,defaultValue:i,onValueChange:a=()=>{},...s}=t,[c,d]=h({prop:o,defaultProp:i??[],onChange:a,caller:$}),l=r.useCallback(e=>d((t=[])=>[...t,e]),[d]),p=r.useCallback(e=>d((t=[])=>t.filter(t=>t!==e)),[d]);return e(te,{scope:t.__scopeAccordion,value:c,onItemOpen:l,onItemClose:p,children:e(oe,{scope:t.__scopeAccordion,collapsible:!0,children:e(de,{...s,ref:n})})})}),[se,ce]=X($),de=r.forwardRef((t,n)=>{const{__scopeAccordion:o,disabled:i,dir:a,orientation:s="vertical",...c}=t,d=r.useRef(null),u=m(d,n),f=Q(o),h="ltr"===y(a),b=p(t.onKeyDown,e=>{if(!G.includes(e.key))return;const t=e.target,n=f().filter(e=>!e.ref.current?.disabled),o=n.findIndex(e=>e.ref.current===t),r=n.length;if(-1===o)return;e.preventDefault();let i=o;const a=r-1,c=()=>{i=o+1,i>a&&(i=0)},d=()=>{i=o-1,i<0&&(i=a)};switch(e.key){case"Home":i=0;break;case"End":i=a;break;case"ArrowRight":"horizontal"===s&&(h?c():d());break;case"ArrowDown":"vertical"===s&&c();break;case"ArrowLeft":"horizontal"===s&&(h?d():c());break;case"ArrowUp":"vertical"===s&&d()}const l=i%r;n[l].ref.current?.focus()});return e(se,{scope:o,disabled:i,direction:a,orientation:s,children:e(J.Slot,{scope:o,children:e(l.div,{...c,"data-orientation":s,ref:u,onKeyDown:i?void 0:b})})})}),le="AccordionItem",[pe,ue]=X(le),fe=r.forwardRef((t,n)=>{const{__scopeAccordion:o,value:r,...i}=t,a=ce(le,o),s=ne(le,o),c=Z(o),d=g(),l=r&&s.value.includes(r)||!1,p=a.disabled||t.disabled;return e(pe,{scope:o,open:l,disabled:p,triggerId:d,children:e(K,{"data-orientation":a.orientation,"data-state":ve(l),...c,...i,ref:n,disabled:p,open:l,onOpenChange:e=>{e?s.onItemOpen(r):s.onItemClose(r)}})})});fe.displayName=le;var me="AccordionHeader";r.forwardRef((t,n)=>{const{__scopeAccordion:o,...r}=t,i=ce($,o),a=ue(me,o);return e(l.h3,{"data-orientation":i.orientation,"data-state":ve(a.open),"data-disabled":a.disabled?"":void 0,...r,ref:n})}).displayName=me;var he="AccordionTrigger",be=r.forwardRef((t,n)=>{const{__scopeAccordion:o,...r}=t,i=ce($,o),a=ue(he,o),s=re(he,o),c=Z(o);return e(J.ItemSlot,{scope:o,children:e(M,{"aria-disabled":a.open&&!s.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...c,...r,ref:n})})});be.displayName=he;var ge="AccordionContent",ye=r.forwardRef((t,n)=>{const{__scopeAccordion:o,...r}=t,i=ce($,o),a=ue(ge,o),s=Z(o);return e(U,{role:"region","aria-labelledby":a.triggerId,"data-orientation":i.orientation,...s,...r,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});function ve(e){return e?"open":"closed"}ye.displayName=ge;var ke=ee,xe=fe,we=be,je=ye;const Ne=i((t,o)=>{var{children:r,className:i}=t,a=n(t,["children","className"]);return e(ke,Object.assign({},a,{className:v("w-full rounded-md border",i),ref:o,"data-slot":"accordion"},{children:r}))});Ne.displayName="Accordion";const Ce=i((t,o)=>{var{children:r}=t,i=n(t,["children"]);return e(xe,Object.assign({},i,{ref:o,"data-slot":"accordion-item",className:"border-b last:border-b-0"},{children:r}))});Ce.displayName="AccordionItem";const Oe=t=>{var{children:o}=t,r=n(t,["children"]);return e(we,Object.assign({},r,{type:"button",contentEditable:!1,"data-slot":"accordion-trigger",className:"flex shrink-0 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},{children:o}))},_e=i((t,o)=>{var{children:r}=t,i=n(t,["children"]);return e(je,Object.assign({},i,{ref:o,"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"},{children:e("div",Object.assign({className:"pt-0 pb-4 text-muted-foreground px-5"},{children:r}))}))});_e.displayName="AccordionContent";E("[data-element-type=accordion-list-item-content] [data-slate-node=element],[data-element-type=accordion-list-item-heading] [data-slate-node=element]{margin:0}");const Ae={"accordion-list":{render:t=>{const{attributes:n,children:o,blockId:r,element:i}=t,a=k(),c=s(()=>{const e=[];return i.children.forEach(t=>{var n;"accordion-list-item"===t.type&&(null===(n=t.props)||void 0===n?void 0:n.isExpanded)&&e.push(t.id)}),e},[i]);return e(Ne,Object.assign({},n,{type:"multiple",value:c,onValueChange:e=>{const t=x.getBlockSlate(a,{id:r});if(!t)return;const n=j.nodes(t,{match:e=>O.isElement(e)&&"accordion-list-item"===e.type});j.withoutNormalizing(t,()=>{var o;for(const[r,i]of n){const n=r,a=n.id,s=e.includes(a);(null===(o=n.props)||void 0===o?void 0:o.isExpanded)!==s&&C.setNodes(t,{props:Object.assign(Object.assign({},n.props),{isExpanded:s})},{at:i})}})},className:"w-full mt-2 rounded-md border"},{children:o}))}},"accordion-list-item":{render:t=>{var n;const{attributes:o,children:r,element:i}=t;return e(Ce,Object.assign({value:i.id,"data-state":(null===(n=i.props)||void 0===n?void 0:n.isExpanded)?"open":"closed"},o,{children:r}))}},"accordion-list-item-heading":{render:n=>{var o,r;const{attributes:i,children:d,element:l,blockId:p}=n,u=k(),[,f]=a(e=>e+1,0),m=s(()=>{const e=x.getBlockSlate(u,{id:p});if(e)try{const t=w.getElementPath(u,{blockId:p,element:l});return j.parent(e,t)[0]}catch(e){}},[u,p,l]),h=s(()=>{if(!m)return;if(x.getBlockSlate(u,{id:p}))try{return w.getElementPath(u,{blockId:p,element:m})}catch(e){}},[u,p,m]),b=null!==(r=null===(o=null==m?void 0:m.props)||void 0===o?void 0:o.isExpanded)&&void 0!==r&&r,g=c(()=>{m&&h&&w.updateElement(u,{blockId:p,type:m.type,props:Object.assign(Object.assign({},m.props),{isExpanded:!b}),path:h}),f()},[u,p,m,h,b]),y=c(e=>{if(u.readOnly)return;if(e.preventDefault(),e.stopPropagation(),!m||!h)return;const t=w.getElementChildren(u,{blockId:p,type:"accordion-list"});1!==(null==t?void 0:t.length)?w.deleteElement(u,{blockId:p,type:"accordion-list-item",path:h}):x.deleteBlock(u,{blockId:p})},[u,p,m,h]),v=c(e=>{if(u.readOnly)return;e.preventDefault(),e.stopPropagation();const t=x.getBlockSlate(u,{id:p});if(!t||!h)return;const n=u.y("accordion-list-item",{props:{isExpanded:!1},children:[u.y("accordion-list-item-heading"),u.y("accordion-list-item-content")]});j.withoutNormalizing(t,()=>{const e=N.next(h);C.insertNodes(t,n,{at:e});const o=[...e,0,0];setTimeout(()=>{C.select(t,{offset:0,path:o})},0)})},[u,p,h]);return t("div",Object.assign({},i,{className:"flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all px-5"},{children:[e("div",Object.assign({className:"flex-1 min-w-0"},{children:d})),t("div",Object.assign({className:"flex shrink-0 items-center gap-1",contentEditable:!1},{children:[!u.readOnly&&e("button",Object.assign({type:"button",contentEditable:!1,onClick:v,className:"flex items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 p-1",title:"Add accordion item"},{children:e(_,{className:"h-4 w-4 shrink-0 text-muted-foreground"})})),!u.readOnly&&e("button",Object.assign({type:"button",contentEditable:!1,onClick:y,className:"flex items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 p-1",title:"Delete accordion item"},{children:e(A,{className:"h-4 w-4 shrink-0 text-muted-foreground"})})),e(Oe,Object.assign({type:"button",contentEditable:!1,"data-slot":"accordion-trigger",onClick:g,className:"flex shrink-0 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},{children:e(I,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200 "+(b?"rotate-180":"")})}))]}))]}))}},"accordion-list-item-content":{render:t=>{const{attributes:n,children:o}=t;return e(_e,Object.assign({},n,{className:"text-muted-foreground px-5"},{children:o}))}}};export{Ae as AccordionUI};
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{_ as n}from"./chunks/_tslib-35bb891d.js";import*as o from"react";import r,{forwardRef as i,useReducer as a,useMemo as s,useCallback as c}from"react";import{c as d,P as l,a as p,u}from"./chunks/index-17323747.js";import{c as f}from"./chunks/index-5b487f4e.js";import{u as m}from"./chunks/index-91a5b8d5.js";import{u as h}from"./chunks/index-ff0e3962.js";import{P as b}from"./chunks/index-bd6363d4.js";import{u as g}from"./chunks/index-ce60ba41.js";import{u as y}from"./chunks/index-13505606.js";import{c as v}from"./chunks/utils-3345eade.js";import{useYooptaEditor as k,Blocks as x,Elements as w}from"@yoopta/editor";import{Editor as j,Path as N,Transforms as C,Element as O}from"slate";import{P as _}from"./chunks/plus-840fe920.js";import{T as A}from"./chunks/trash-2-f36597ff.js";import{C as I}from"./chunks/chevron-down-28dfb290.js";import{s as E}from"./chunks/style-inject.es-e87a8d02.js";import"react-dom";import"./chunks/createLucideIcon-8605f860.js";var R="Collapsible",[D,P]=d(R),[S,B]=D(R),T=o.forwardRef((t,n)=>{const{__scopeCollapsible:r,open:i,defaultOpen:a,disabled:s,onOpenChange:c,...d}=t,[p,u]=h({prop:i,defaultProp:a??!1,onChange:c,caller:R});return e(S,{scope:r,disabled:s,contentId:g(),open:p,onOpenToggle:o.useCallback(()=>u(e=>!e),[u]),children:e(l.div,{"data-state":K(p),"data-disabled":s?"":void 0,...d,ref:n})})});T.displayName=R;var V="CollapsibleTrigger",z=o.forwardRef((t,n)=>{const{__scopeCollapsible:o,...r}=t,i=B(V,o);return e(l.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":K(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:n,onClick:p(t.onClick,i.onOpenToggle)})});z.displayName=V;var H="CollapsibleContent",L=o.forwardRef((t,n)=>{const{forceMount:o,...r}=t,i=B(H,t.__scopeCollapsible);return e(b,{present:o||i.open,children:({present:t})=>e(F,{...r,ref:n,present:t})})});L.displayName=H;var F=o.forwardRef((t,n)=>{const{__scopeCollapsible:r,present:i,children:a,...s}=t,c=B(H,r),[d,p]=o.useState(i),f=o.useRef(null),h=m(n,f),b=o.useRef(0),g=b.current,y=o.useRef(0),v=y.current,k=c.open||d,x=o.useRef(k),w=o.useRef(void 0);return o.useEffect(()=>{const e=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(e)},[]),u(()=>{const e=f.current;if(e){w.current=w.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";const t=e.getBoundingClientRect();b.current=t.height,y.current=t.width,x.current||(e.style.transitionDuration=w.current.transitionDuration,e.style.animationName=w.current.animationName),p(i)}},[c.open,i]),e(l.div,{"data-state":K(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!k,...s,ref:h,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...t.style},children:k&&a})});function K(e){return e?"open":"closed"}var M=T,U=z,$=L,q="Accordion",G=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[J,Q,W]=f(q),[X,Y]=d(q,[W,P]),Z=P(),ee=r.forwardRef((t,n)=>{const{type:o,...r}=t,i=r,a=r;return e(J.Provider,{scope:t.__scopeAccordion,children:"multiple"===o?e(ae,{...a,ref:n}):e(ie,{...i,ref:n})})});ee.displayName=q;var[te,ne]=X(q),[oe,re]=X(q,{collapsible:!1}),ie=r.forwardRef((t,n)=>{const{value:o,defaultValue:i,onValueChange:a=()=>{},collapsible:s=!1,...c}=t,[d,l]=h({prop:o,defaultProp:i??"",onChange:a,caller:q});return e(te,{scope:t.__scopeAccordion,value:r.useMemo(()=>d?[d]:[],[d]),onItemOpen:l,onItemClose:r.useCallback(()=>s&&l(""),[s,l]),children:e(oe,{scope:t.__scopeAccordion,collapsible:s,children:e(de,{...c,ref:n})})})}),ae=r.forwardRef((t,n)=>{const{value:o,defaultValue:i,onValueChange:a=()=>{},...s}=t,[c,d]=h({prop:o,defaultProp:i??[],onChange:a,caller:q}),l=r.useCallback(e=>d((t=[])=>[...t,e]),[d]),p=r.useCallback(e=>d((t=[])=>t.filter(t=>t!==e)),[d]);return e(te,{scope:t.__scopeAccordion,value:c,onItemOpen:l,onItemClose:p,children:e(oe,{scope:t.__scopeAccordion,collapsible:!0,children:e(de,{...s,ref:n})})})}),[se,ce]=X(q),de=r.forwardRef((t,n)=>{const{__scopeAccordion:o,disabled:i,dir:a,orientation:s="vertical",...c}=t,d=r.useRef(null),u=m(d,n),f=Q(o),h="ltr"===y(a),b=p(t.onKeyDown,e=>{if(!G.includes(e.key))return;const t=e.target,n=f().filter(e=>!e.ref.current?.disabled),o=n.findIndex(e=>e.ref.current===t),r=n.length;if(-1===o)return;e.preventDefault();let i=o;const a=r-1,c=()=>{i=o+1,i>a&&(i=0)},d=()=>{i=o-1,i<0&&(i=a)};switch(e.key){case"Home":i=0;break;case"End":i=a;break;case"ArrowRight":"horizontal"===s&&(h?c():d());break;case"ArrowDown":"vertical"===s&&c();break;case"ArrowLeft":"horizontal"===s&&(h?d():c());break;case"ArrowUp":"vertical"===s&&d()}const l=i%r;n[l].ref.current?.focus()});return e(se,{scope:o,disabled:i,direction:a,orientation:s,children:e(J.Slot,{scope:o,children:e(l.div,{...c,"data-orientation":s,ref:u,onKeyDown:i?void 0:b})})})}),le="AccordionItem",[pe,ue]=X(le),fe=r.forwardRef((t,n)=>{const{__scopeAccordion:o,value:r,...i}=t,a=ce(le,o),s=ne(le,o),c=Z(o),d=g(),l=r&&s.value.includes(r)||!1,p=a.disabled||t.disabled;return e(pe,{scope:o,open:l,disabled:p,triggerId:d,children:e(M,{"data-orientation":a.orientation,"data-state":ve(l),...c,...i,ref:n,disabled:p,open:l,onOpenChange:e=>{e?s.onItemOpen(r):s.onItemClose(r)}})})});fe.displayName=le;var me="AccordionHeader";r.forwardRef((t,n)=>{const{__scopeAccordion:o,...r}=t,i=ce(q,o),a=ue(me,o);return e(l.h3,{"data-orientation":i.orientation,"data-state":ve(a.open),"data-disabled":a.disabled?"":void 0,...r,ref:n})}).displayName=me;var he="AccordionTrigger",be=r.forwardRef((t,n)=>{const{__scopeAccordion:o,...r}=t,i=ce(q,o),a=ue(he,o),s=re(he,o),c=Z(o);return e(J.ItemSlot,{scope:o,children:e(U,{"aria-disabled":a.open&&!s.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...c,...r,ref:n})})});be.displayName=he;var ge="AccordionContent",ye=r.forwardRef((t,n)=>{const{__scopeAccordion:o,...r}=t,i=ce(q,o),a=ue(ge,o),s=Z(o);return e($,{role:"region","aria-labelledby":a.triggerId,"data-orientation":i.orientation,...s,...r,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});function ve(e){return e?"open":"closed"}ye.displayName=ge;var ke=ee,xe=fe,we=be,je=ye;const Ne=i((t,o)=>{var{children:r,className:i}=t,a=n(t,["children","className"]);return e(ke,Object.assign({},a,{className:v("w-full rounded-md border",i),ref:o,"data-slot":"accordion"},{children:r}))});Ne.displayName="Accordion";const Ce=i((t,o)=>{var{children:r}=t,i=n(t,["children"]);return e(xe,Object.assign({},i,{ref:o,"data-slot":"accordion-item",className:"border-b last:border-b-0"},{children:r}))});Ce.displayName="AccordionItem";const Oe=t=>{var{children:o}=t,r=n(t,["children"]);return e(we,Object.assign({},r,{type:"button",contentEditable:!1,"data-slot":"accordion-trigger",className:"flex shrink-0 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},{children:o}))},_e=i((t,o)=>{var{children:r}=t,i=n(t,["children"]);return e(je,Object.assign({},i,{ref:o,"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"},{children:e("div",Object.assign({className:"pt-0 pb-4 text-muted-foreground px-5"},{children:r}))}))});_e.displayName="AccordionContent";E("[data-element-type=accordion-list-item-content] [data-slate-node=element],[data-element-type=accordion-list-item-heading] [data-slate-node=element]{margin:0}");const Ae={"accordion-list":{render:t=>{const{attributes:n,children:o,blockId:r,element:i}=t,a=k(),c=s(()=>{const e=[];return i.children.forEach(t=>{var n;"accordion-list-item"===t.type&&(null===(n=t.props)||void 0===n?void 0:n.isExpanded)&&e.push(t.id)}),e},[i]);return e(Ne,Object.assign({},n,{type:"multiple",value:c,onValueChange:e=>{const t=x.getBlockSlate(a,{id:r});if(!t)return;const n=j.nodes(t,{match:e=>O.isElement(e)&&"accordion-list-item"===e.type});j.withoutNormalizing(t,()=>{var o;for(const[r,i]of n){const n=r,a=n.id,s=e.includes(a);(null===(o=n.props)||void 0===o?void 0:o.isExpanded)!==s&&C.setNodes(t,{props:Object.assign(Object.assign({},n.props),{isExpanded:s})},{at:i})}})},className:"w-full mt-2 rounded-md border"},{children:o}))}},"accordion-list-item":{render:t=>{var n;const{attributes:o,children:r,element:i}=t;return e(Ce,Object.assign({value:i.id,"data-state":(null===(n=i.props)||void 0===n?void 0:n.isExpanded)?"open":"closed"},o,{children:r}))}},"accordion-list-item-heading":{render:n=>{var o,r;const{attributes:i,children:d,element:l,blockId:p}=n,u=k(),[,f]=a(e=>e+1,0),m=s(()=>{const e=x.getBlockSlate(u,{id:p});if(e)try{const t=w.getElementPath(u,{blockId:p,element:l});return j.parent(e,t)[0]}catch(e){}},[u,p,l]),h=s(()=>{if(!m)return;if(x.getBlockSlate(u,{id:p}))try{return w.getElementPath(u,{blockId:p,element:m})}catch(e){}},[u,p,m]),b=null!==(r=null===(o=null==m?void 0:m.props)||void 0===o?void 0:o.isExpanded)&&void 0!==r&&r,g=c(()=>{m&&h&&w.updateElement(u,{blockId:p,type:m.type,props:Object.assign(Object.assign({},m.props),{isExpanded:!b}),path:h}),f()},[u,p,m,h,b]),y=c(e=>{if(u.readOnly)return;if(e.preventDefault(),e.stopPropagation(),!m||!h)return;const t=w.getElementChildren(u,{blockId:p,type:"accordion-list"});1!==(null==t?void 0:t.length)?w.deleteElement(u,{blockId:p,type:"accordion-list-item",path:h}):x.deleteBlock(u,{blockId:p})},[u,p,m,h]),v=c(e=>{if(u.readOnly)return;e.preventDefault(),e.stopPropagation();const t=x.getBlockSlate(u,{id:p});if(!t||!h)return;const n=u.y("accordion-list-item",{props:{isExpanded:!1},children:[u.y("accordion-list-item-heading"),u.y("accordion-list-item-content")]});j.withoutNormalizing(t,()=>{const e=N.next(h);C.insertNodes(t,n,{at:e});const o=[...e,0,0];setTimeout(()=>{C.select(t,{offset:0,path:o})},0)})},[u,p,h]);return t("div",Object.assign({},i,{className:"flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all px-5"},{children:[e("div",Object.assign({className:"flex-1 min-w-0"},{children:d})),t("div",Object.assign({className:"flex shrink-0 items-center gap-1",contentEditable:!1},{children:[!u.readOnly&&e("button",Object.assign({type:"button",contentEditable:!1,onClick:v,className:"flex items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 p-1",title:"Add accordion item"},{children:e(_,{className:"h-4 w-4 shrink-0 text-muted-foreground"})})),!u.readOnly&&e("button",Object.assign({type:"button",contentEditable:!1,onClick:y,className:"flex items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 p-1",title:"Delete accordion item"},{children:e(A,{className:"h-4 w-4 shrink-0 text-muted-foreground"})})),e(Oe,Object.assign({type:"button",contentEditable:!1,"data-slot":"accordion-trigger",onClick:g,className:"flex shrink-0 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},{children:e(I,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200 "+(b?"rotate-180":"")})}))]}))]}))}},"accordion-list-item-content":{render:t=>{const{attributes:n,children:o}=t;return e(_e,Object.assign({},n,{className:"text-muted-foreground px-5"},{children:o}))}}};export{Ae as AccordionUI};
|
package/dist/applyTheme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyTheme.d.ts","sourceRoot":"","sources":["../src/applyTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"applyTheme.d.ts","sourceRoot":"","sources":["../src/applyTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAyBnD,KAAK,YAAY,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAG3C,KAAK,gBAAgB,GAAG,MAAM,CAC5B,MAAM,EACN;IACE,yBAAyB,CAAC,EAAE,YAAY,EAAE,CAAC;IAE3C,MAAM,CAAC,EAAE,GAAG,CAAC;IAEb,OAAO,CAAC,EAAE,GAAG,CAAC;IAEd,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,YAAY,EAAE,EACvB,UAAU,CAAC,EAAE,gBAAgB,GAC5B,YAAY,EAAE,CAyDhB"}
|
package/dist/carousel.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as n,jsxs as t}from"react/jsx-runtime";import{useRef as e,useState as r,useCallback as o,useEffect as i,createContext as s,forwardRef as c,useMemo as a,useContext as u}from"react";import{_ as l}from"./chunks/_tslib-35bb891d.js";import{B as d}from"./chunks/button-7aec29d6.js";import{c as f}from"./chunks/utils-3345eade.js";import{A as p,a as m}from"./chunks/arrow-right-38c3a9bd.js";import{C as g,c as h}from"./chunks/card-05710740.js";import"./chunks/createLucideIcon-8605f860.js";function v(n){return function(n){return"[object Object]"===Object.prototype.toString.call(n)}(n)||Array.isArray(n)}function x(n,t){const e=Object.keys(n),r=Object.keys(t);if(e.length!==r.length)return!1;return JSON.stringify(Object.keys(n.breakpoints||{}))===JSON.stringify(Object.keys(t.breakpoints||{}))&&e.every(e=>{const r=n[e],o=t[e];return"function"==typeof r?`${r}`==`${o}`:v(r)&&v(o)?x(r,o):r===o})}function b(n){return n.concat().sort((n,t)=>n.name>t.name?1:-1).map(n=>n.options)}function y(n){return"number"==typeof n}function w(n){return"string"==typeof n}function S(n){return"boolean"==typeof n}function N(n){return"[object Object]"===Object.prototype.toString.call(n)}function O(n){return Math.abs(n)}function j(n){return Math.sign(n)}function E(n,t){return O(n-t)}function L(n){return I(n).map(Number)}function z(n){return n[k(n)]}function k(n){return Math.max(0,n.length-1)}function A(n,t){return t===k(n)}function D(n,t=0){return Array.from(Array(n),(n,e)=>t+e)}function I(n){return Object.keys(n)}function P(n,t){return[n,t].reduce((n,t)=>(I(t).forEach(e=>{const r=n[e],o=t[e],i=N(r)&&N(o);n[e]=i?P(r,o):o}),n),{})}function M(n,t){return void 0!==t.MouseEvent&&n instanceof t.MouseEvent}function F(){let n=[];const t={add:function(e,r,o,i={passive:!0}){let s;if("addEventListener"in e)e.addEventListener(r,o,i),s=()=>e.removeEventListener(r,o,i);else{const n=e;n.addListener(o),s=()=>n.removeListener(o)}return n.push(s),t},clear:function(){n=n.filter(n=>n())}};return t}function T(n,t,e,r){const o=F(),i=1e3/60;let s=null,c=0,a=0;function u(n){if(!a)return;s||(s=n,e(),e());const o=n-s;for(s=n,c+=o;c>=i;)e(),c-=i;r(c/i),a&&(a=t.requestAnimationFrame(u))}function l(){t.cancelAnimationFrame(a),s=null,c=0,a=0}return{init:function(){o.add(n,"visibilitychange",()=>{n.hidden&&(s=null,c=0)})},destroy:function(){l(),o.clear()},start:function(){a||(a=t.requestAnimationFrame(u))},stop:l,update:e,render:r}}function C(n=0,t=0){const e=O(n-t);function r(t){return t<n}function o(n){return n>t}function i(n){return r(n)||o(n)}return{length:e,max:t,min:n,constrain:function(e){return i(e)?r(e)?n:t:e},reachedAny:i,reachedMax:o,reachedMin:r,removeOffset:function(n){return e?n-e*Math.ceil((n-t)/e):n}}}function H(n,t,e){const{constrain:r}=C(0,n),o=n+1;let i=s(t);function s(n){return e?O((o+n)%o):r(n)}function c(){return i}function a(){return H(n,c(),e)}const u={get:c,set:function(n){return i=s(n),u},add:function(n){return a().set(c()+n)},clone:a};return u}function V(n,t,e,r,o,i,s,c,a,u,l,d,f,p,m,g,h,v,x){const{cross:b,direction:y}=n,w=["INPUT","SELECT","TEXTAREA"],N={passive:!1},L=F(),z=F(),k=C(50,225).constrain(p.measure(20)),A={mouse:300,touch:400},D={mouse:500,touch:600},I=m?43:25;let P=!1,T=0,H=0,V=!1,B=!1,R=!1,q=!1;function G(n){if(!M(n,r)&&n.touches.length>=2)return $(n);const t=i.readPoint(n),e=i.readPoint(n,b),s=E(t,T),a=E(e,H);if(!B&&!q){if(!n.cancelable)return $(n);if(B=s>a,!B)return $(n)}const l=i.pointerMove(n);s>g&&(R=!0),u.useFriction(.3).useDuration(.75),c.start(),o.add(y(l)),n.preventDefault()}function $(n){const t=l.byDistance(0,!1).index!==d.get(),e=i.pointerUp(n)*(m?D:A)[q?"mouse":"touch"],r=function(n,t){const e=d.add(-1*j(n)),r=l.byDistance(n,!m).distance;return m||O(n)<k?r:h&&t?.5*r:l.byIndex(e.get(),0).distance}(y(e),t),o=function(n,t){if(0===n||0===t)return 0;if(O(n)<=O(t))return 0;const e=E(O(n),O(t));return O(e/n)}(e,r),s=I-10*o,c=v+o/50;B=!1,V=!1,z.clear(),u.useDuration(s).useFriction(c),a.distance(r,!m),q=!1,f.emit("pointerUp")}function U(n){R&&(n.stopPropagation(),n.preventDefault(),R=!1)}return{init:function(n){if(!x)return;function c(c){(S(x)||x(n,c))&&function(n){const c=M(n,r);if(q=c,R=m&&c&&!n.buttons&&P,P=E(o.get(),s.get())>=2,c&&0!==n.button)return;if(function(n){const t=n.nodeName||"";return w.includes(t)}(n.target))return;V=!0,i.pointerDown(n),u.useFriction(0).useDuration(0),o.set(s),function(){const n=q?e:t;z.add(n,"touchmove",G,N).add(n,"touchend",$).add(n,"mousemove",G,N).add(n,"mouseup",$)}(),T=i.readPoint(n),H=i.readPoint(n,b),f.emit("pointerDown")}(c)}const a=t;L.add(a,"dragstart",n=>n.preventDefault(),N).add(a,"touchmove",()=>{},N).add(a,"touchend",()=>{}).add(a,"touchstart",c).add(a,"mousedown",c).add(a,"touchcancel",$).add(a,"contextmenu",$).add(a,"click",U,!0)},destroy:function(){L.clear(),z.clear()},pointerDown:function(){return V}}}function B(n,t){let e,r;function o(n){return n.timeStamp}function i(e,r){const o="client"+("x"===(r||n.scroll)?"X":"Y");return(M(e,t)?e:e.touches[0])[o]}return{pointerDown:function(n){return e=n,r=n,i(n)},pointerMove:function(n){const t=i(n)-i(r),s=o(n)-o(e)>170;return r=n,s&&(e=n),t},pointerUp:function(n){if(!e||!r)return 0;const t=i(r)-i(e),s=o(n)-o(e),c=o(n)-o(r)>170,a=t/s;return s&&!c&&O(a)>.1?a:0},readPoint:i}}function R(n,t,e,r,o,i,s){const c=[n].concat(r);let a,u,l=[],d=!1;function f(n){return o.measureSize(s.measure(n))}return{init:function(o){i&&(u=f(n),l=r.map(f),a=new ResizeObserver(e=>{(S(i)||i(o,e))&&function(e){for(const i of e){if(d)return;const e=i.target===n,s=r.indexOf(i.target),c=e?u:l[s];if(O(f(e?n:r[s])-c)>=.5){o.reInit(),t.emit("resize");break}}}(e)}),e.requestAnimationFrame(()=>{c.forEach(n=>a.observe(n))}))},destroy:function(){d=!0,a&&a.disconnect()}}}function q(n,t,e,r,o){const i=o.measure(10),s=o.measure(50),c=C(.1,.99);let a=!1;function u(){return!a&&(!!n.reachedAny(e.get())&&!!n.reachedAny(t.get()))}return{shouldConstrain:u,constrain:function(o){if(!u())return;const a=n.reachedMin(t.get())?"min":"max",l=O(n[a]-t.get()),d=e.get()-t.get(),f=c.constrain(l/s);e.subtract(d*f),!o&&O(d)<i&&(e.set(n.constrain(e.get())),r.useDuration(25).useBaseFriction())},toggleActive:function(n){a=!n}}}function G(n,t,e,r){const o=t.min+.1,i=t.max+.1,{reachedMin:s,reachedMax:c}=C(o,i);return{loop:function(t){if(!function(n){return 1===n?c(e.get()):-1===n&&s(e.get())}(t))return;const o=n*(-1*t);r.forEach(n=>n.add(o))}}}function $(n,t,e,r,o){const{reachedAny:i,removeOffset:s,constrain:c}=r;function a(n){return n.concat().sort((n,t)=>O(n)-O(t))[0]}function u(t,r){const o=[t,t+e,t-e];if(!n)return t;if(!r)return a(o);const i=o.filter(n=>j(n)===r);return i.length?a(i):z(o)-e}return{byDistance:function(e,r){const a=o.get()+e,{index:l,distance:d}=function(e){const r=n?s(e):c(e),o=t.map((n,t)=>({diff:u(n-r,0),index:t})).sort((n,t)=>O(n.diff)-O(t.diff)),{index:i}=o[0];return{index:i,distance:r}}(a),f=!n&&i(a);return!r||f?{index:l,distance:e}:{index:l,distance:e+u(t[l]-d,0)}},byIndex:function(n,e){return{index:n,distance:u(t[n]-o.get(),e)}},shortcut:u}}function U(n,t,e,r,o,i,s,c){const a={passive:!0,capture:!0};let u=0;function l(n){"Tab"===n.code&&(u=(new Date).getTime())}return{init:function(d){c&&(i.add(document,"keydown",l,!1),t.forEach((t,l)=>{i.add(t,"focus",t=>{(S(c)||c(d,t))&&function(t){if((new Date).getTime()-u>10)return;s.emit("slideFocusStart"),n.scrollLeft=0;const i=e.findIndex(n=>n.includes(t));y(i)&&(o.useDuration(0),r.index(i,0),s.emit("slideFocus"))}(l)},a)}))}}}function W(n){let t=n;function e(n){return y(n)?n:n.get()}return{get:function(){return t},set:function(n){t=e(n)},add:function(n){t+=e(n)},subtract:function(n){t-=e(n)}}}function J(n,t){const e="x"===n.scroll?function(n){return`translate3d(${n}px,0px,0px)`}:function(n){return`translate3d(0px,${n}px,0px)`},r=t.style;let o=null,i=!1;return{clear:function(){i||(r.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){if(i)return;const s=(c=n.direction(t),Math.round(100*c)/100);var c;s!==o&&(r.transform=e(s),o=s)},toggleActive:function(n){i=!n}}}function Q(n,t,e,r,o,i,s,c,a){const u=L(o),l=L(o).reverse(),d=function(){const n=s[0];return m(p(l,n),e,!1)}().concat(function(){const n=t-s[0]-1;return m(p(u,n),-e,!0)}());function f(n,t){return n.reduce((n,t)=>n-o[t],t)}function p(n,t){return n.reduce((n,e)=>f(n,t)>0?n.concat([e]):n,[])}function m(o,s,u){const l=function(n){return i.map((e,o)=>({start:e-r[o]+.5+n,end:e+t-.5+n}))}(s);return o.map(t=>{const r=u?0:-e,o=u?e:0,i=u?"end":"start",s=l[t][i];return{index:t,loopPoint:s,slideLocation:W(-1),translate:J(n,a[t]),target:()=>c.get()>s?r:o}})}return{canLoop:function(){return d.every(({index:n})=>f(u.filter(t=>t!==n),t)<=.1)},clear:function(){d.forEach(n=>n.translate.clear())},loop:function(){d.forEach(n=>{const{target:t,translate:e,slideLocation:r}=n,o=t();o!==r.get()&&(e.to(o),r.set(o))})},loopPoints:d}}function X(n,t,e){let r,o=!1;return{init:function(i){e&&(r=new MutationObserver(n=>{o||(S(e)||e(i,n))&&function(n){for(const e of n)if("childList"===e.type){i.reInit(),t.emit("slidesChanged");break}}(n)}),r.observe(n,{childList:!0}))},destroy:function(){r&&r.disconnect(),o=!0}}}function _(n,t,e,r){const o={};let i,s=null,c=null,a=!1;return{init:function(){i=new IntersectionObserver(n=>{a||(n.forEach(n=>{const e=t.indexOf(n.target);o[e]=n}),s=null,c=null,e.emit("slidesInView"))},{root:n.parentElement,threshold:r}),t.forEach(n=>i.observe(n))},destroy:function(){i&&i.disconnect(),a=!0},get:function(n=!0){if(n&&s)return s;if(!n&&c)return c;const t=function(n){return I(o).reduce((t,e)=>{const r=parseInt(e),{isIntersecting:i}=o[r];return(n&&i||!n&&!i)&&t.push(r),t},[])}(n);return n&&(s=t),n||(c=t),t}}}function K(n,t,e,r,o,i,s,c,a){const{startEdge:u,endEdge:l,direction:d}=n,f=y(e);return{groupSlides:function(n){return f?function(n,t){return L(n).filter(n=>n%t===0).map(e=>n.slice(e,e+t))}(n,e):function(n){return n.length?L(n).reduce((e,f,p)=>{const m=z(e)||0,g=0===m,h=f===k(n),v=o[u]-i[m][u],x=o[u]-i[f][l],b=!r&&g?d(s):0,y=O(x-(!r&&h?d(c):0)-(v+b));return p&&y>t+a&&e.push(f),h&&e.push(n.length),e},[]).map((t,e,r)=>{const o=Math.max(r[e-1]||0);return n.slice(o,t)}):[]}(n)}}}function Y(n,t,e,r,o,i,s){const{align:c,axis:a,direction:u,startIndex:l,loop:d,duration:f,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:h,skipSnaps:v,containScroll:x,watchResize:b,watchSlides:y,watchDrag:S,watchFocus:N}=i,I={measure:function(n){const{offsetTop:t,offsetLeft:e,offsetWidth:r,offsetHeight:o}=n;return{top:t,right:e+r,bottom:t+o,left:e,width:r,height:o}}},P=I.measure(t),M=e.map(I.measure),Y=function(n,t){const e="rtl"===t,r="y"===n,o=!r&&e?-1:1;return{scroll:r?"y":"x",cross:r?"x":"y",startEdge:r?"top":e?"right":"left",endEdge:r?"bottom":e?"left":"right",measureSize:function(n){const{height:t,width:e}=n;return r?t:e},direction:function(n){return n*o}}}(a,u),Z=Y.measureSize(P),nn=function(n){return{measure:function(t){return n*(t/100)}}}(Z),tn=function(n,t){const e={start:function(){return 0},center:function(n){return r(n)/2},end:r};function r(n){return t-n}return{measure:function(r,o){return w(n)?e[n](r):n(t,r,o)}}}(c,Z),en=!d&&!!x,rn=d||!!x,{slideSizes:on,slideSizesWithGaps:sn,startGap:cn,endGap:an}=function(n,t,e,r,o,i){const{measureSize:s,startEdge:c,endEdge:a}=n,u=e[0]&&o,l=function(){if(!u)return 0;const n=e[0];return O(t[c]-n[c])}(),d=function(){if(!u)return 0;const n=i.getComputedStyle(z(r));return parseFloat(n.getPropertyValue(`margin-${a}`))}(),f=e.map(s),p=e.map((n,t,e)=>{const r=!t,o=A(e,t);return r?f[t]+l:o?f[t]+d:e[t+1][c]-n[c]}).map(O);return{slideSizes:f,slideSizesWithGaps:p,startGap:l,endGap:d}}(Y,P,M,e,rn,o),un=K(Y,Z,h,d,P,M,cn,an,2),{snaps:ln,snapsAligned:dn}=function(n,t,e,r,o){const{startEdge:i,endEdge:s}=n,{groupSlides:c}=o,a=c(r).map(n=>z(n)[s]-n[0][i]).map(O).map(t.measure),u=r.map(n=>e[i]-n[i]).map(n=>-O(n)),l=c(u).map(n=>n[0]).map((n,t)=>n+a[t]);return{snaps:u,snapsAligned:l}}(Y,tn,P,M,un),fn=-z(ln)+z(sn),{snapsContained:pn,scrollContainLimit:mn}=function(n,t,e,r,o){const i=C(-t+n,0),s=e.map((n,t)=>{const{min:r,max:o}=i,s=i.constrain(n),c=!t,u=A(e,t);return c?o:u||a(r,s)?r:a(o,s)?o:s}).map(n=>parseFloat(n.toFixed(3))),c=function(){const n=s[0],t=z(s);return C(s.lastIndexOf(n),s.indexOf(t)+1)}();function a(n,t){return E(n,t)<=1}return{snapsContained:function(){if(t<=n+o)return[i.max];if("keepSnaps"===r)return s;const{min:e,max:a}=c;return s.slice(e,a)}(),scrollContainLimit:c}}(Z,fn,dn,x,2),gn=en?pn:dn,{limit:hn}=function(n,t,e){const r=t[0];return{limit:C(e?r-n:z(t),r)}}(fn,gn,d),vn=H(k(gn),l,d),xn=vn.clone(),bn=L(e),yn=T(r,o,()=>(({dragHandler:n,scrollBody:t,scrollBounds:e,options:{loop:r}})=>{r||e.constrain(n.pointerDown()),t.seek()})(Mn),n=>(({scrollBody:n,translate:t,location:e,offsetLocation:r,previousLocation:o,scrollLooper:i,slideLooper:s,dragHandler:c,animation:a,eventHandler:u,scrollBounds:l,options:{loop:d}},f)=>{const p=n.settled(),m=!l.shouldConstrain(),g=d?p:p&&m,h=g&&!c.pointerDown();h&&a.stop();const v=e.get()*f+o.get()*(1-f);r.set(v),d&&(i.loop(n.direction()),s.loop()),t.to(r.get()),h&&u.emit("settle"),g||u.emit("scroll")})(Mn,n)),wn=gn[vn.get()],Sn=W(wn),Nn=W(wn),On=W(wn),jn=W(wn),En=function(n,t,e,r,o,i){let s=0,c=0,a=o,u=i,l=n.get(),d=0;function f(n){return a=n,m}function p(n){return u=n,m}const m={direction:function(){return c},duration:function(){return a},velocity:function(){return s},seek:function(){const t=r.get()-n.get();let o=0;return a?(e.set(n),s+=t/a,s*=u,l+=s,n.add(s),o=l-d):(s=0,e.set(r),n.set(r),o=t),c=j(o),d=l,m},settled:function(){return O(r.get()-t.get())<.001},useBaseFriction:function(){return p(i)},useBaseDuration:function(){return f(o)},useFriction:p,useDuration:f};return m}(Sn,On,Nn,jn,f,.68),Ln=$(d,gn,fn,hn,jn),zn=function(n,t,e,r,o,i,s){function c(o){const c=o.distance,a=o.index!==t.get();i.add(c),c&&(r.duration()?n.start():(n.update(),n.render(1),n.update())),a&&(e.set(t.get()),t.set(o.index),s.emit("select"))}return{distance:function(n,t){c(o.byDistance(n,t))},index:function(n,e){const r=t.clone().set(n);c(o.byIndex(r.get(),e))}}}(yn,vn,xn,En,Ln,jn,s),kn=function(n){const{max:t,length:e}=n;return{get:function(n){return e?(n-t)/-e:0}}}(hn),An=F(),Dn=_(t,e,s,g),{slideRegistry:In}=function(n,t,e,r,o,i){const{groupSlides:s}=o,{min:c,max:a}=r;return{slideRegistry:function(){const r=s(i),o=!n||"keepSnaps"===t;return 1===e.length?[i]:o?r:r.slice(c,a).map((n,t,e)=>{const r=!t,o=A(e,t);return r?D(z(e[0])+1):o?D(k(i)-z(e)[0]+1,z(e)[0]):n})}()}}(en,x,gn,mn,un,bn),Pn=U(n,e,In,zn,En,An,s,N),Mn={ownerDocument:r,ownerWindow:o,eventHandler:s,containerRect:P,slideRects:M,animation:yn,axis:Y,dragHandler:V(Y,n,r,o,jn,B(Y,o),Sn,yn,zn,En,Ln,vn,s,nn,p,m,v,.68,S),eventStore:An,percentOfView:nn,index:vn,indexPrevious:xn,limit:hn,location:Sn,offsetLocation:On,previousLocation:Nn,options:i,resizeHandler:R(t,s,o,e,Y,b,I),scrollBody:En,scrollBounds:q(hn,On,jn,En,nn),scrollLooper:G(fn,hn,On,[Sn,On,Nn,jn]),scrollProgress:kn,scrollSnapList:gn.map(kn.get),scrollSnaps:gn,scrollTarget:Ln,scrollTo:zn,slideLooper:Q(Y,Z,fn,on,sn,ln,gn,On,e),slideFocus:Pn,slidesHandler:X(t,s,y),slidesInView:Dn,slideIndexes:bn,slideRegistry:In,slidesToScroll:un,target:jn,translate:J(Y,t)};return Mn}const Z={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function nn(n){function t(n,t){return P(n,t||{})}const e={mergeOptions:t,optionsAtMedia:function(e){const r=e.breakpoints||{},o=I(r).filter(t=>n.matchMedia(t).matches).map(n=>r[n]).reduce((n,e)=>t(n,e),{});return t(e,o)},optionsMediaQueries:function(t){return t.map(n=>I(n.breakpoints||{})).reduce((n,t)=>n.concat(t),[]).map(n.matchMedia)}};return e}function tn(n,t,e){const r=n.ownerDocument,o=r.defaultView,i=nn(o),s=function(n){let t=[];return{init:function(e,r){return t=r.filter(({options:t})=>!1!==n.optionsAtMedia(t).active),t.forEach(t=>t.init(e,n)),r.reduce((n,t)=>Object.assign(n,{[t.name]:t}),{})},destroy:function(){t=t.filter(n=>n.destroy())}}}(i),c=F(),a=function(){let n,t={};function e(n){return t[n]||[]}const r={init:function(t){n=t},emit:function(t){return e(t).forEach(e=>e(n,t)),r},off:function(n,o){return t[n]=e(n).filter(n=>n!==o),r},on:function(n,o){return t[n]=e(n).concat([o]),r},clear:function(){t={}}};return r}(),{mergeOptions:u,optionsAtMedia:l,optionsMediaQueries:d}=i,{on:f,off:p,emit:m}=a,g=L;let h,v,x,b,y=!1,S=u(Z,tn.globalOptions),N=u(S),O=[];function j(t){const e=Y(n,x,b,r,o,t,a);if(t.loop&&!e.slideLooper.canLoop()){return j(Object.assign({},t,{loop:!1}))}return e}function E(t,e){y||(S=u(S,t),N=l(S),O=e||O,function(){const{container:t,slides:e}=N,r=w(t)?n.querySelector(t):t;x=r||n.children[0];const o=w(e)?x.querySelectorAll(e):e;b=[].slice.call(o||x.children)}(),h=j(N),d([S,...O.map(({options:n})=>n)]).forEach(n=>c.add(n,"change",L)),N.active&&(h.translate.to(h.location.get()),h.animation.init(),h.slidesInView.init(),h.slideFocus.init(D),h.eventHandler.init(D),h.resizeHandler.init(D),h.slidesHandler.init(D),h.options.loop&&h.slideLooper.loop(),x.offsetParent&&b.length&&h.dragHandler.init(D),v=s.init(D,O)))}function L(n,t){const e=A();z(),E(u({startIndex:e},n),t),a.emit("reInit")}function z(){h.dragHandler.destroy(),h.eventStore.clear(),h.translate.clear(),h.slideLooper.clear(),h.resizeHandler.destroy(),h.slidesHandler.destroy(),h.slidesInView.destroy(),h.animation.destroy(),s.destroy(),c.clear()}function k(n,t,e){N.active&&!y&&(h.scrollBody.useBaseFriction().useDuration(!0===t?0:N.duration),h.scrollTo.index(n,e||0))}function A(){return h.index.get()}const D={canScrollNext:function(){return h.index.add(1).get()!==A()},canScrollPrev:function(){return h.index.add(-1).get()!==A()},containerNode:function(){return x},internalEngine:function(){return h},destroy:function(){y||(y=!0,c.clear(),z(),a.emit("destroy"),a.clear())},off:p,on:f,emit:m,plugins:function(){return v},previousScrollSnap:function(){return h.indexPrevious.get()},reInit:g,rootNode:function(){return n},scrollNext:function(n){k(h.index.add(1).get(),n,-1)},scrollPrev:function(n){k(h.index.add(-1).get(),n,1)},scrollProgress:function(){return h.scrollProgress.get(h.offsetLocation.get())},scrollSnapList:function(){return h.scrollSnapList},scrollTo:k,selectedScrollSnap:A,slideNodes:function(){return b},slidesInView:function(){return h.slidesInView.get()},slidesNotInView:function(){return h.slidesInView.get(!1)}};return E(t,e),setTimeout(()=>a.emit("init"),0),D}function en(n={},t=[]){const s=e(n),c=e(t),[a,u]=r(),[l,d]=r(),f=o(()=>{a&&a.reInit(s.current,c.current)},[a]);return i(()=>{x(s.current,n)||(s.current=n,f())},[n,f]),i(()=>{(function(n,t){if(n.length!==t.length)return!1;const e=b(n),r=b(t);return e.every((n,t)=>x(n,r[t]))})(c.current,t)||(c.current=t,f())},[t,f]),i(()=>{if("undefined"!=typeof window&&window.document&&window.document.createElement&&l){tn.globalOptions=en.globalOptions;const n=tn(l,s.current,c.current);return u(n),()=>n.destroy()}u(void 0)},[l,u]),[d,a]}tn.globalOptions=void 0,en.globalOptions=void 0;const rn=s(null);function on(){const n=u(rn);if(!n)throw new Error("useCarousel must be used within a <Carousel />");return n}const sn=c((t,e)=>{var{orientation:s="horizontal",opts:c,setApi:u,plugins:d,className:p,children:m}=t,g=l(t,["orientation","opts","setApi","plugins","className","children"]);const[h,v]=en(Object.assign(Object.assign({},c),{axis:"horizontal"===s?"x":"y"}),d),[x,b]=r(!1),[y,w]=r(!1),S=o(n=>{n&&(b(n.canScrollPrev()),w(n.canScrollNext()))},[]),N=o(()=>{null==v||v.scrollPrev()},[v]),O=o(()=>{null==v||v.scrollNext()},[v]),j=o(n=>{"ArrowLeft"===n.key?(n.preventDefault(),N()):"ArrowRight"===n.key&&(n.preventDefault(),O())},[N,O]);i(()=>{v&&u&&u(v)},[v,u]),i(()=>{if(v)return S(v),v.on("reInit",S),v.on("select",S),()=>{null==v||v.off("select",S)}},[v,S]);const E=a(()=>({carouselRef:h,api:v,opts:c,orientation:s||("y"===(null==c?void 0:c.axis)?"vertical":"horizontal"),scrollPrev:N,scrollNext:O,canScrollPrev:x,canScrollNext:y}),[h,v,c,s,N,O,x,y]);return n(rn.Provider,Object.assign({value:E},{children:n("div",Object.assign({onKeyDownCapture:j,className:f("relative",p),role:"region","aria-roledescription":"carousel","data-slot":"carousel",ref:e},g,{children:m}))}))});sn.displayName="Carousel";const cn=c((t,e)=>{var{className:r}=t,o=l(t,["className"]);const{carouselRef:i,orientation:s}=on();return n("div",Object.assign({ref:i,className:"overflow-hidden","data-slot":"carousel-content"},{children:n("div",Object.assign({ref:e,className:f("flex","horizontal"===s?"-ml-4":"-mt-4 flex-col",r)},o))}))});cn.displayName="CarouselContent";const an=c((t,e)=>{var{className:r}=t,o=l(t,["className"]);const{orientation:i}=on();return n("div",Object.assign({ref:e,role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:f("min-w-0 shrink-0 grow-0 basis-full","horizontal"===i?"pl-4":"pt-4",r)},o))});an.displayName="CarouselItem";const un=e=>{var{className:r,variant:o="outline",size:i="icon"}=e,s=l(e,["className","variant","size"]);const{orientation:c,scrollPrev:a,canScrollPrev:u}=on();return t(d,Object.assign({"data-slot":"carousel-previous",variant:o,size:i,className:f("absolute size-8 rounded-full","horizontal"===c?"top-1/2 -left-12 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",r),disabled:!u,onClick:a},s,{children:[n(p,{}),n("span",Object.assign({className:"sr-only"},{children:"Previous slide"}))]}))},ln=e=>{var{className:r,variant:o="outline",size:i="icon"}=e,s=l(e,["className","variant","size"]);const{orientation:c,scrollNext:a,canScrollNext:u}=on();return t(d,Object.assign({"data-slot":"carousel-next",variant:o,size:i,className:f("absolute size-8 rounded-full","horizontal"===c?"top-1/2 -right-12 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",r),disabled:!u,onClick:a},s,{children:[n(m,{}),n("span",Object.assign({className:"sr-only"},{children:"Next slide"}))]}))},dn={"carousel-container":{render:e=>{const{attributes:o,children:s}=e,[c,a]=r(),[u,l]=r(0),[d,f]=r(0);return i(()=>{c&&(f(c.scrollSnapList().length),l(c.selectedScrollSnap()+1),c.on("select",()=>{l(c.selectedScrollSnap()+1)}))},[c]),n("div",Object.assign({className:"flex w-full justify-center data-[align=center]:items-center data-[align=end]:items-end data-[align=start]:items-start"},{children:t("div",Object.assign({className:"mx-auto\n "},{children:[t(sn,Object.assign({},o,{setApi:a,opts:{align:"start",axis:"x",loop:!0},orientation:"horizontal",className:"w-full max-w-lg"},{children:[n(cn,{children:s}),n(un,{contentEditable:!1,className:"select-none"}),n(ln,{contentEditable:!1,className:"select-none"})]})),t("div",Object.assign({contentEditable:!1,className:"select-none text-muted-foreground py-2 text-center text-sm"},{children:["Slide ",u," of ",d]}))]}))}))}},"carousel-list-item":{render:t=>{const{children:e}=t;return n(an,Object.assign({className:"md:basis-1/2 lg:basis-1/3"},{children:n("div",Object.assign({className:"p-1"},{children:n(g,{children:n(h,Object.assign({className:"flex aspect-square items-center justify-center p-6"},{children:e}))})}))}))}}};export{dn as CarouselUI};
|
|
1
|
+
import{jsx as n,jsxs as t}from"react/jsx-runtime";import{useRef as e,useState as r,useCallback as o,useEffect as i,createContext as s,forwardRef as c,useMemo as a,useContext as u}from"react";import{_ as l}from"./chunks/_tslib-35bb891d.js";import{B as d}from"./chunks/button-f335deaa.js";import{c as f}from"./chunks/utils-3345eade.js";import{A as p,a as m}from"./chunks/arrow-right-38c3a9bd.js";import{C as g,c as h}from"./chunks/card-05710740.js";import"./chunks/createLucideIcon-8605f860.js";function v(n){return function(n){return"[object Object]"===Object.prototype.toString.call(n)}(n)||Array.isArray(n)}function x(n,t){const e=Object.keys(n),r=Object.keys(t);if(e.length!==r.length)return!1;return JSON.stringify(Object.keys(n.breakpoints||{}))===JSON.stringify(Object.keys(t.breakpoints||{}))&&e.every(e=>{const r=n[e],o=t[e];return"function"==typeof r?`${r}`==`${o}`:v(r)&&v(o)?x(r,o):r===o})}function b(n){return n.concat().sort((n,t)=>n.name>t.name?1:-1).map(n=>n.options)}function y(n){return"number"==typeof n}function w(n){return"string"==typeof n}function S(n){return"boolean"==typeof n}function N(n){return"[object Object]"===Object.prototype.toString.call(n)}function O(n){return Math.abs(n)}function j(n){return Math.sign(n)}function E(n,t){return O(n-t)}function L(n){return I(n).map(Number)}function k(n){return n[z(n)]}function z(n){return Math.max(0,n.length-1)}function A(n,t){return t===z(n)}function D(n,t=0){return Array.from(Array(n),(n,e)=>t+e)}function I(n){return Object.keys(n)}function P(n,t){return[n,t].reduce((n,t)=>(I(t).forEach(e=>{const r=n[e],o=t[e],i=N(r)&&N(o);n[e]=i?P(r,o):o}),n),{})}function M(n,t){return void 0!==t.MouseEvent&&n instanceof t.MouseEvent}function F(){let n=[];const t={add:function(e,r,o,i={passive:!0}){let s;if("addEventListener"in e)e.addEventListener(r,o,i),s=()=>e.removeEventListener(r,o,i);else{const n=e;n.addListener(o),s=()=>n.removeListener(o)}return n.push(s),t},clear:function(){n=n.filter(n=>n())}};return t}function T(n,t,e,r){const o=F(),i=1e3/60;let s=null,c=0,a=0;function u(n){if(!a)return;s||(s=n,e(),e());const o=n-s;for(s=n,c+=o;c>=i;)e(),c-=i;r(c/i),a&&(a=t.requestAnimationFrame(u))}function l(){t.cancelAnimationFrame(a),s=null,c=0,a=0}return{init:function(){o.add(n,"visibilitychange",()=>{n.hidden&&(s=null,c=0)})},destroy:function(){l(),o.clear()},start:function(){a||(a=t.requestAnimationFrame(u))},stop:l,update:e,render:r}}function C(n=0,t=0){const e=O(n-t);function r(t){return t<n}function o(n){return n>t}function i(n){return r(n)||o(n)}return{length:e,max:t,min:n,constrain:function(e){return i(e)?r(e)?n:t:e},reachedAny:i,reachedMax:o,reachedMin:r,removeOffset:function(n){return e?n-e*Math.ceil((n-t)/e):n}}}function H(n,t,e){const{constrain:r}=C(0,n),o=n+1;let i=s(t);function s(n){return e?O((o+n)%o):r(n)}function c(){return i}function a(){return H(n,c(),e)}const u={get:c,set:function(n){return i=s(n),u},add:function(n){return a().set(c()+n)},clone:a};return u}function B(n,t,e,r,o,i,s,c,a,u,l,d,f,p,m,g,h,v,x){const{cross:b,direction:y}=n,w=["INPUT","SELECT","TEXTAREA"],N={passive:!1},L=F(),k=F(),z=C(50,225).constrain(p.measure(20)),A={mouse:300,touch:400},D={mouse:500,touch:600},I=m?43:25;let P=!1,T=0,H=0,B=!1,V=!1,R=!1,q=!1;function G(n){if(!M(n,r)&&n.touches.length>=2)return $(n);const t=i.readPoint(n),e=i.readPoint(n,b),s=E(t,T),a=E(e,H);if(!V&&!q){if(!n.cancelable)return $(n);if(V=s>a,!V)return $(n)}const l=i.pointerMove(n);s>g&&(R=!0),u.useFriction(.3).useDuration(.75),c.start(),o.add(y(l)),n.preventDefault()}function $(n){const t=l.byDistance(0,!1).index!==d.get(),e=i.pointerUp(n)*(m?D:A)[q?"mouse":"touch"],r=function(n,t){const e=d.add(-1*j(n)),r=l.byDistance(n,!m).distance;return m||O(n)<z?r:h&&t?.5*r:l.byIndex(e.get(),0).distance}(y(e),t),o=function(n,t){if(0===n||0===t)return 0;if(O(n)<=O(t))return 0;const e=E(O(n),O(t));return O(e/n)}(e,r),s=I-10*o,c=v+o/50;V=!1,B=!1,k.clear(),u.useDuration(s).useFriction(c),a.distance(r,!m),q=!1,f.emit("pointerUp")}function U(n){R&&(n.stopPropagation(),n.preventDefault(),R=!1)}return{init:function(n){if(!x)return;function c(c){(S(x)||x(n,c))&&function(n){const c=M(n,r);if(q=c,R=m&&c&&!n.buttons&&P,P=E(o.get(),s.get())>=2,c&&0!==n.button)return;if(function(n){const t=n.nodeName||"";return w.includes(t)}(n.target))return;B=!0,i.pointerDown(n),u.useFriction(0).useDuration(0),o.set(s),function(){const n=q?e:t;k.add(n,"touchmove",G,N).add(n,"touchend",$).add(n,"mousemove",G,N).add(n,"mouseup",$)}(),T=i.readPoint(n),H=i.readPoint(n,b),f.emit("pointerDown")}(c)}const a=t;L.add(a,"dragstart",n=>n.preventDefault(),N).add(a,"touchmove",()=>{},N).add(a,"touchend",()=>{}).add(a,"touchstart",c).add(a,"mousedown",c).add(a,"touchcancel",$).add(a,"contextmenu",$).add(a,"click",U,!0)},destroy:function(){L.clear(),k.clear()},pointerDown:function(){return B}}}function V(n,t){let e,r;function o(n){return n.timeStamp}function i(e,r){const o="client"+("x"===(r||n.scroll)?"X":"Y");return(M(e,t)?e:e.touches[0])[o]}return{pointerDown:function(n){return e=n,r=n,i(n)},pointerMove:function(n){const t=i(n)-i(r),s=o(n)-o(e)>170;return r=n,s&&(e=n),t},pointerUp:function(n){if(!e||!r)return 0;const t=i(r)-i(e),s=o(n)-o(e),c=o(n)-o(r)>170,a=t/s;return s&&!c&&O(a)>.1?a:0},readPoint:i}}function R(n,t,e,r,o,i,s){const c=[n].concat(r);let a,u,l=[],d=!1;function f(n){return o.measureSize(s.measure(n))}return{init:function(o){i&&(u=f(n),l=r.map(f),a=new ResizeObserver(e=>{(S(i)||i(o,e))&&function(e){for(const i of e){if(d)return;const e=i.target===n,s=r.indexOf(i.target),c=e?u:l[s];if(O(f(e?n:r[s])-c)>=.5){o.reInit(),t.emit("resize");break}}}(e)}),e.requestAnimationFrame(()=>{c.forEach(n=>a.observe(n))}))},destroy:function(){d=!0,a&&a.disconnect()}}}function q(n,t,e,r,o){const i=o.measure(10),s=o.measure(50),c=C(.1,.99);let a=!1;function u(){return!a&&(!!n.reachedAny(e.get())&&!!n.reachedAny(t.get()))}return{shouldConstrain:u,constrain:function(o){if(!u())return;const a=n.reachedMin(t.get())?"min":"max",l=O(n[a]-t.get()),d=e.get()-t.get(),f=c.constrain(l/s);e.subtract(d*f),!o&&O(d)<i&&(e.set(n.constrain(e.get())),r.useDuration(25).useBaseFriction())},toggleActive:function(n){a=!n}}}function G(n,t,e,r){const o=t.min+.1,i=t.max+.1,{reachedMin:s,reachedMax:c}=C(o,i);return{loop:function(t){if(!function(n){return 1===n?c(e.get()):-1===n&&s(e.get())}(t))return;const o=n*(-1*t);r.forEach(n=>n.add(o))}}}function $(n,t,e,r,o){const{reachedAny:i,removeOffset:s,constrain:c}=r;function a(n){return n.concat().sort((n,t)=>O(n)-O(t))[0]}function u(t,r){const o=[t,t+e,t-e];if(!n)return t;if(!r)return a(o);const i=o.filter(n=>j(n)===r);return i.length?a(i):k(o)-e}return{byDistance:function(e,r){const a=o.get()+e,{index:l,distance:d}=function(e){const r=n?s(e):c(e),o=t.map((n,t)=>({diff:u(n-r,0),index:t})).sort((n,t)=>O(n.diff)-O(t.diff)),{index:i}=o[0];return{index:i,distance:r}}(a),f=!n&&i(a);return!r||f?{index:l,distance:e}:{index:l,distance:e+u(t[l]-d,0)}},byIndex:function(n,e){return{index:n,distance:u(t[n]-o.get(),e)}},shortcut:u}}function U(n,t,e,r,o,i,s,c){const a={passive:!0,capture:!0};let u=0;function l(n){"Tab"===n.code&&(u=(new Date).getTime())}return{init:function(d){c&&(i.add(document,"keydown",l,!1),t.forEach((t,l)=>{i.add(t,"focus",t=>{(S(c)||c(d,t))&&function(t){if((new Date).getTime()-u>10)return;s.emit("slideFocusStart"),n.scrollLeft=0;const i=e.findIndex(n=>n.includes(t));y(i)&&(o.useDuration(0),r.index(i,0),s.emit("slideFocus"))}(l)},a)}))}}}function W(n){let t=n;function e(n){return y(n)?n:n.get()}return{get:function(){return t},set:function(n){t=e(n)},add:function(n){t+=e(n)},subtract:function(n){t-=e(n)}}}function J(n,t){const e="x"===n.scroll?function(n){return`translate3d(${n}px,0px,0px)`}:function(n){return`translate3d(0px,${n}px,0px)`},r=t.style;let o=null,i=!1;return{clear:function(){i||(r.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){if(i)return;const s=(c=n.direction(t),Math.round(100*c)/100);var c;s!==o&&(r.transform=e(s),o=s)},toggleActive:function(n){i=!n}}}function Q(n,t,e,r,o,i,s,c,a){const u=L(o),l=L(o).reverse(),d=function(){const n=s[0];return m(p(l,n),e,!1)}().concat(function(){const n=t-s[0]-1;return m(p(u,n),-e,!0)}());function f(n,t){return n.reduce((n,t)=>n-o[t],t)}function p(n,t){return n.reduce((n,e)=>f(n,t)>0?n.concat([e]):n,[])}function m(o,s,u){const l=function(n){return i.map((e,o)=>({start:e-r[o]+.5+n,end:e+t-.5+n}))}(s);return o.map(t=>{const r=u?0:-e,o=u?e:0,i=u?"end":"start",s=l[t][i];return{index:t,loopPoint:s,slideLocation:W(-1),translate:J(n,a[t]),target:()=>c.get()>s?r:o}})}return{canLoop:function(){return d.every(({index:n})=>f(u.filter(t=>t!==n),t)<=.1)},clear:function(){d.forEach(n=>n.translate.clear())},loop:function(){d.forEach(n=>{const{target:t,translate:e,slideLocation:r}=n,o=t();o!==r.get()&&(e.to(o),r.set(o))})},loopPoints:d}}function X(n,t,e){let r,o=!1;return{init:function(i){e&&(r=new MutationObserver(n=>{o||(S(e)||e(i,n))&&function(n){for(const e of n)if("childList"===e.type){i.reInit(),t.emit("slidesChanged");break}}(n)}),r.observe(n,{childList:!0}))},destroy:function(){r&&r.disconnect(),o=!0}}}function _(n,t,e,r){const o={};let i,s=null,c=null,a=!1;return{init:function(){i=new IntersectionObserver(n=>{a||(n.forEach(n=>{const e=t.indexOf(n.target);o[e]=n}),s=null,c=null,e.emit("slidesInView"))},{root:n.parentElement,threshold:r}),t.forEach(n=>i.observe(n))},destroy:function(){i&&i.disconnect(),a=!0},get:function(n=!0){if(n&&s)return s;if(!n&&c)return c;const t=function(n){return I(o).reduce((t,e)=>{const r=parseInt(e),{isIntersecting:i}=o[r];return(n&&i||!n&&!i)&&t.push(r),t},[])}(n);return n&&(s=t),n||(c=t),t}}}function K(n,t,e,r,o,i,s,c,a){const{startEdge:u,endEdge:l,direction:d}=n,f=y(e);return{groupSlides:function(n){return f?function(n,t){return L(n).filter(n=>n%t===0).map(e=>n.slice(e,e+t))}(n,e):function(n){return n.length?L(n).reduce((e,f,p)=>{const m=k(e)||0,g=0===m,h=f===z(n),v=o[u]-i[m][u],x=o[u]-i[f][l],b=!r&&g?d(s):0,y=O(x-(!r&&h?d(c):0)-(v+b));return p&&y>t+a&&e.push(f),h&&e.push(n.length),e},[]).map((t,e,r)=>{const o=Math.max(r[e-1]||0);return n.slice(o,t)}):[]}(n)}}}function Y(n,t,e,r,o,i,s){const{align:c,axis:a,direction:u,startIndex:l,loop:d,duration:f,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:h,skipSnaps:v,containScroll:x,watchResize:b,watchSlides:y,watchDrag:S,watchFocus:N}=i,I={measure:function(n){const{offsetTop:t,offsetLeft:e,offsetWidth:r,offsetHeight:o}=n;return{top:t,right:e+r,bottom:t+o,left:e,width:r,height:o}}},P=I.measure(t),M=e.map(I.measure),Y=function(n,t){const e="rtl"===t,r="y"===n,o=!r&&e?-1:1;return{scroll:r?"y":"x",cross:r?"x":"y",startEdge:r?"top":e?"right":"left",endEdge:r?"bottom":e?"left":"right",measureSize:function(n){const{height:t,width:e}=n;return r?t:e},direction:function(n){return n*o}}}(a,u),Z=Y.measureSize(P),nn=function(n){return{measure:function(t){return n*(t/100)}}}(Z),tn=function(n,t){const e={start:function(){return 0},center:function(n){return r(n)/2},end:r};function r(n){return t-n}return{measure:function(r,o){return w(n)?e[n](r):n(t,r,o)}}}(c,Z),en=!d&&!!x,rn=d||!!x,{slideSizes:on,slideSizesWithGaps:sn,startGap:cn,endGap:an}=function(n,t,e,r,o,i){const{measureSize:s,startEdge:c,endEdge:a}=n,u=e[0]&&o,l=function(){if(!u)return 0;const n=e[0];return O(t[c]-n[c])}(),d=function(){if(!u)return 0;const n=i.getComputedStyle(k(r));return parseFloat(n.getPropertyValue(`margin-${a}`))}(),f=e.map(s),p=e.map((n,t,e)=>{const r=!t,o=A(e,t);return r?f[t]+l:o?f[t]+d:e[t+1][c]-n[c]}).map(O);return{slideSizes:f,slideSizesWithGaps:p,startGap:l,endGap:d}}(Y,P,M,e,rn,o),un=K(Y,Z,h,d,P,M,cn,an,2),{snaps:ln,snapsAligned:dn}=function(n,t,e,r,o){const{startEdge:i,endEdge:s}=n,{groupSlides:c}=o,a=c(r).map(n=>k(n)[s]-n[0][i]).map(O).map(t.measure),u=r.map(n=>e[i]-n[i]).map(n=>-O(n)),l=c(u).map(n=>n[0]).map((n,t)=>n+a[t]);return{snaps:u,snapsAligned:l}}(Y,tn,P,M,un),fn=-k(ln)+k(sn),{snapsContained:pn,scrollContainLimit:mn}=function(n,t,e,r,o){const i=C(-t+n,0),s=e.map((n,t)=>{const{min:r,max:o}=i,s=i.constrain(n),c=!t,u=A(e,t);return c?o:u||a(r,s)?r:a(o,s)?o:s}).map(n=>parseFloat(n.toFixed(3))),c=function(){const n=s[0],t=k(s);return C(s.lastIndexOf(n),s.indexOf(t)+1)}();function a(n,t){return E(n,t)<=1}return{snapsContained:function(){if(t<=n+o)return[i.max];if("keepSnaps"===r)return s;const{min:e,max:a}=c;return s.slice(e,a)}(),scrollContainLimit:c}}(Z,fn,dn,x,2),gn=en?pn:dn,{limit:hn}=function(n,t,e){const r=t[0];return{limit:C(e?r-n:k(t),r)}}(fn,gn,d),vn=H(z(gn),l,d),xn=vn.clone(),bn=L(e),yn=T(r,o,()=>(({dragHandler:n,scrollBody:t,scrollBounds:e,options:{loop:r}})=>{r||e.constrain(n.pointerDown()),t.seek()})(Mn),n=>(({scrollBody:n,translate:t,location:e,offsetLocation:r,previousLocation:o,scrollLooper:i,slideLooper:s,dragHandler:c,animation:a,eventHandler:u,scrollBounds:l,options:{loop:d}},f)=>{const p=n.settled(),m=!l.shouldConstrain(),g=d?p:p&&m,h=g&&!c.pointerDown();h&&a.stop();const v=e.get()*f+o.get()*(1-f);r.set(v),d&&(i.loop(n.direction()),s.loop()),t.to(r.get()),h&&u.emit("settle"),g||u.emit("scroll")})(Mn,n)),wn=gn[vn.get()],Sn=W(wn),Nn=W(wn),On=W(wn),jn=W(wn),En=function(n,t,e,r,o,i){let s=0,c=0,a=o,u=i,l=n.get(),d=0;function f(n){return a=n,m}function p(n){return u=n,m}const m={direction:function(){return c},duration:function(){return a},velocity:function(){return s},seek:function(){const t=r.get()-n.get();let o=0;return a?(e.set(n),s+=t/a,s*=u,l+=s,n.add(s),o=l-d):(s=0,e.set(r),n.set(r),o=t),c=j(o),d=l,m},settled:function(){return O(r.get()-t.get())<.001},useBaseFriction:function(){return p(i)},useBaseDuration:function(){return f(o)},useFriction:p,useDuration:f};return m}(Sn,On,Nn,jn,f,.68),Ln=$(d,gn,fn,hn,jn),kn=function(n,t,e,r,o,i,s){function c(o){const c=o.distance,a=o.index!==t.get();i.add(c),c&&(r.duration()?n.start():(n.update(),n.render(1),n.update())),a&&(e.set(t.get()),t.set(o.index),s.emit("select"))}return{distance:function(n,t){c(o.byDistance(n,t))},index:function(n,e){const r=t.clone().set(n);c(o.byIndex(r.get(),e))}}}(yn,vn,xn,En,Ln,jn,s),zn=function(n){const{max:t,length:e}=n;return{get:function(n){return e?(n-t)/-e:0}}}(hn),An=F(),Dn=_(t,e,s,g),{slideRegistry:In}=function(n,t,e,r,o,i){const{groupSlides:s}=o,{min:c,max:a}=r;return{slideRegistry:function(){const r=s(i),o=!n||"keepSnaps"===t;return 1===e.length?[i]:o?r:r.slice(c,a).map((n,t,e)=>{const r=!t,o=A(e,t);return r?D(k(e[0])+1):o?D(z(i)-k(e)[0]+1,k(e)[0]):n})}()}}(en,x,gn,mn,un,bn),Pn=U(n,e,In,kn,En,An,s,N),Mn={ownerDocument:r,ownerWindow:o,eventHandler:s,containerRect:P,slideRects:M,animation:yn,axis:Y,dragHandler:B(Y,n,r,o,jn,V(Y,o),Sn,yn,kn,En,Ln,vn,s,nn,p,m,v,.68,S),eventStore:An,percentOfView:nn,index:vn,indexPrevious:xn,limit:hn,location:Sn,offsetLocation:On,previousLocation:Nn,options:i,resizeHandler:R(t,s,o,e,Y,b,I),scrollBody:En,scrollBounds:q(hn,On,jn,En,nn),scrollLooper:G(fn,hn,On,[Sn,On,Nn,jn]),scrollProgress:zn,scrollSnapList:gn.map(zn.get),scrollSnaps:gn,scrollTarget:Ln,scrollTo:kn,slideLooper:Q(Y,Z,fn,on,sn,ln,gn,On,e),slideFocus:Pn,slidesHandler:X(t,s,y),slidesInView:Dn,slideIndexes:bn,slideRegistry:In,slidesToScroll:un,target:jn,translate:J(Y,t)};return Mn}const Z={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function nn(n){function t(n,t){return P(n,t||{})}const e={mergeOptions:t,optionsAtMedia:function(e){const r=e.breakpoints||{},o=I(r).filter(t=>n.matchMedia(t).matches).map(n=>r[n]).reduce((n,e)=>t(n,e),{});return t(e,o)},optionsMediaQueries:function(t){return t.map(n=>I(n.breakpoints||{})).reduce((n,t)=>n.concat(t),[]).map(n.matchMedia)}};return e}function tn(n,t,e){const r=n.ownerDocument,o=r.defaultView,i=nn(o),s=function(n){let t=[];return{init:function(e,r){return t=r.filter(({options:t})=>!1!==n.optionsAtMedia(t).active),t.forEach(t=>t.init(e,n)),r.reduce((n,t)=>Object.assign(n,{[t.name]:t}),{})},destroy:function(){t=t.filter(n=>n.destroy())}}}(i),c=F(),a=function(){let n,t={};function e(n){return t[n]||[]}const r={init:function(t){n=t},emit:function(t){return e(t).forEach(e=>e(n,t)),r},off:function(n,o){return t[n]=e(n).filter(n=>n!==o),r},on:function(n,o){return t[n]=e(n).concat([o]),r},clear:function(){t={}}};return r}(),{mergeOptions:u,optionsAtMedia:l,optionsMediaQueries:d}=i,{on:f,off:p,emit:m}=a,g=L;let h,v,x,b,y=!1,S=u(Z,tn.globalOptions),N=u(S),O=[];function j(t){const e=Y(n,x,b,r,o,t,a);if(t.loop&&!e.slideLooper.canLoop()){return j(Object.assign({},t,{loop:!1}))}return e}function E(t,e){y||(S=u(S,t),N=l(S),O=e||O,function(){const{container:t,slides:e}=N,r=w(t)?n.querySelector(t):t;x=r||n.children[0];const o=w(e)?x.querySelectorAll(e):e;b=[].slice.call(o||x.children)}(),h=j(N),d([S,...O.map(({options:n})=>n)]).forEach(n=>c.add(n,"change",L)),N.active&&(h.translate.to(h.location.get()),h.animation.init(),h.slidesInView.init(),h.slideFocus.init(D),h.eventHandler.init(D),h.resizeHandler.init(D),h.slidesHandler.init(D),h.options.loop&&h.slideLooper.loop(),x.offsetParent&&b.length&&h.dragHandler.init(D),v=s.init(D,O)))}function L(n,t){const e=A();k(),E(u({startIndex:e},n),t),a.emit("reInit")}function k(){h.dragHandler.destroy(),h.eventStore.clear(),h.translate.clear(),h.slideLooper.clear(),h.resizeHandler.destroy(),h.slidesHandler.destroy(),h.slidesInView.destroy(),h.animation.destroy(),s.destroy(),c.clear()}function z(n,t,e){N.active&&!y&&(h.scrollBody.useBaseFriction().useDuration(!0===t?0:N.duration),h.scrollTo.index(n,e||0))}function A(){return h.index.get()}const D={canScrollNext:function(){return h.index.add(1).get()!==A()},canScrollPrev:function(){return h.index.add(-1).get()!==A()},containerNode:function(){return x},internalEngine:function(){return h},destroy:function(){y||(y=!0,c.clear(),k(),a.emit("destroy"),a.clear())},off:p,on:f,emit:m,plugins:function(){return v},previousScrollSnap:function(){return h.indexPrevious.get()},reInit:g,rootNode:function(){return n},scrollNext:function(n){z(h.index.add(1).get(),n,-1)},scrollPrev:function(n){z(h.index.add(-1).get(),n,1)},scrollProgress:function(){return h.scrollProgress.get(h.offsetLocation.get())},scrollSnapList:function(){return h.scrollSnapList},scrollTo:z,selectedScrollSnap:A,slideNodes:function(){return b},slidesInView:function(){return h.slidesInView.get()},slidesNotInView:function(){return h.slidesInView.get(!1)}};return E(t,e),setTimeout(()=>a.emit("init"),0),D}function en(n={},t=[]){const s=e(n),c=e(t),[a,u]=r(),[l,d]=r(),f=o(()=>{a&&a.reInit(s.current,c.current)},[a]);return i(()=>{x(s.current,n)||(s.current=n,f())},[n,f]),i(()=>{(function(n,t){if(n.length!==t.length)return!1;const e=b(n),r=b(t);return e.every((n,t)=>x(n,r[t]))})(c.current,t)||(c.current=t,f())},[t,f]),i(()=>{if("undefined"!=typeof window&&window.document&&window.document.createElement&&l){tn.globalOptions=en.globalOptions;const n=tn(l,s.current,c.current);return u(n),()=>n.destroy()}u(void 0)},[l,u]),[d,a]}tn.globalOptions=void 0,en.globalOptions=void 0;const rn=s(null);function on(){const n=u(rn);if(!n)throw new Error("useCarousel must be used within a <Carousel />");return n}const sn=c((t,e)=>{var{orientation:s="horizontal",opts:c,setApi:u,plugins:d,className:p,children:m}=t,g=l(t,["orientation","opts","setApi","plugins","className","children"]);const[h,v]=en(Object.assign(Object.assign({},c),{axis:"horizontal"===s?"x":"y"}),d),[x,b]=r(!1),[y,w]=r(!1),S=o(n=>{n&&(b(n.canScrollPrev()),w(n.canScrollNext()))},[]),N=o(()=>{null==v||v.scrollPrev()},[v]),O=o(()=>{null==v||v.scrollNext()},[v]),j=o(n=>{"ArrowLeft"===n.key?(n.preventDefault(),N()):"ArrowRight"===n.key&&(n.preventDefault(),O())},[N,O]);i(()=>{v&&u&&u(v)},[v,u]),i(()=>{if(v)return S(v),v.on("reInit",S),v.on("select",S),()=>{null==v||v.off("select",S)}},[v,S]);const E=a(()=>({carouselRef:h,api:v,opts:c,orientation:s||("y"===(null==c?void 0:c.axis)?"vertical":"horizontal"),scrollPrev:N,scrollNext:O,canScrollPrev:x,canScrollNext:y}),[h,v,c,s,N,O,x,y]);return n(rn.Provider,Object.assign({value:E},{children:n("div",Object.assign({onKeyDownCapture:j,className:f("relative",p),role:"region","aria-roledescription":"carousel","data-slot":"carousel",ref:e},g,{children:m}))}))});sn.displayName="Carousel";const cn=c((t,e)=>{var{className:r}=t,o=l(t,["className"]);const{carouselRef:i,orientation:s}=on();return n("div",Object.assign({ref:i,className:"overflow-hidden","data-slot":"carousel-content"},{children:n("div",Object.assign({ref:e,className:f("flex","horizontal"===s?"-ml-4":"-mt-4 flex-col",r)},o))}))});cn.displayName="CarouselContent";const an=c((t,e)=>{var{className:r}=t,o=l(t,["className"]);const{orientation:i}=on();return n("div",Object.assign({ref:e,role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:f("min-w-0 shrink-0 grow-0 basis-full","horizontal"===i?"pl-4":"pt-4",r)},o))});an.displayName="CarouselItem";const un=e=>{var{className:r,variant:o="outline",size:i="icon"}=e,s=l(e,["className","variant","size"]);const{orientation:c,scrollPrev:a,canScrollPrev:u}=on();return t(d,Object.assign({"data-slot":"carousel-previous",variant:o,size:i,className:f("absolute size-8 rounded-full","horizontal"===c?"top-1/2 -left-12 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",r),disabled:!u,onClick:a},s,{children:[n(p,{}),n("span",Object.assign({className:"sr-only"},{children:"Previous slide"}))]}))},ln=e=>{var{className:r,variant:o="outline",size:i="icon"}=e,s=l(e,["className","variant","size"]);const{orientation:c,scrollNext:a,canScrollNext:u}=on();return t(d,Object.assign({"data-slot":"carousel-next",variant:o,size:i,className:f("absolute size-8 rounded-full","horizontal"===c?"top-1/2 -right-12 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",r),disabled:!u,onClick:a},s,{children:[n(m,{}),n("span",Object.assign({className:"sr-only"},{children:"Next slide"}))]}))},dn={"carousel-container":{render:e=>{const{attributes:o,children:s}=e,[c,a]=r(),[u,l]=r(0),[d,f]=r(0);return i(()=>{c&&(f(c.scrollSnapList().length),l(c.selectedScrollSnap()+1),c.on("select",()=>{l(c.selectedScrollSnap()+1)}))},[c]),n("div",Object.assign({className:"flex w-full justify-center data-[align=center]:items-center data-[align=end]:items-end data-[align=start]:items-start"},{children:t("div",Object.assign({className:"mx-auto\n "},{children:[t(sn,Object.assign({},o,{setApi:a,opts:{align:"start",axis:"x",loop:!0},orientation:"horizontal",className:"w-full max-w-lg"},{children:[n(cn,{children:s}),n(un,{contentEditable:!1,className:"select-none"}),n(ln,{contentEditable:!1,className:"select-none"})]})),t("div",Object.assign({contentEditable:!1,className:"select-none text-muted-foreground py-2 text-center text-sm"},{children:["Slide ",u," of ",d]}))]}))}))}},"carousel-list-item":{render:t=>{const{children:e}=t;return n(an,Object.assign({className:"md:basis-1/2 lg:basis-1/3"},{children:n("div",Object.assign({className:"p-1"},{children:n(g,{children:n(h,Object.assign({className:"flex aspect-square items-center justify-center p-6"},{children:e}))})}))}))}}};export{dn as CarouselUI};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./_tslib-35bb891d.js";import{jsx as r}from"react/jsx-runtime";import*as t from"react";import{a as s,c as n}from"./utils-3345eade.js";const a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,o=s,i=(e,r)=>t=>{var s;if(null==(null==r?void 0:r.variants))return o(e,null==t?void 0:t.class,null==t?void 0:t.className);const{variants:n,defaultVariants:i}=r,l=Object.keys(n).map(e=>{const r=null==t?void 0:t[e],s=null==i?void 0:i[e];if(null===r)return null;const o=a(r)||a(s);return n[e][o]}),d=t&&Object.entries(t).reduce((e,r)=>{let[t,s]=r;return void 0===s||(e[t]=s),e},{}),u=null==r||null===(s=r.compoundVariants)||void 0===s?void 0:s.reduce((e,r)=>{let{class:t,className:s,...n}=r;return Object.entries(n).every(e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...i,...d}[r]):{...i,...d}[r]===t})?[...e,t,s]:e},[]);return o(e,l,u,null==t?void 0:t.class,null==t?void 0:t.className)},l=i("cursor-pointer inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},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"}}),d=t.forwardRef((t,s)=>{var{className:a,variant:o,size:i}=t,d=e(t,["className","variant","size"]);return r("button",Object.assign({className:n(l({variant:o,size:i,className:a})),ref:s},d))});d.displayName="Button";export{d as B,i as c};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{c as e}from"./createLucideIcon-8605f860.js";import{_ as n}from"./_tslib-35bb891d.js";import{jsx as r,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{c as a,a as s,P as i,d}from"./index-17323747.js";import{c,u}from"./index-91a5b8d5.js";import{u as l}from"./index-ff0e3962.js";import{c as p}from"./index-
|
|
1
|
+
import{c as e}from"./createLucideIcon-8605f860.js";import{_ as n}from"./_tslib-35bb891d.js";import{jsx as r,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{c as a,a as s,P as i,d}from"./index-17323747.js";import{c,u}from"./index-91a5b8d5.js";import{u as l}from"./index-ff0e3962.js";import{c as p}from"./index-5b487f4e.js";import{u as f}from"./index-13505606.js";import{c as m,A as g,D as h,C as v,a as w,R as y,P as _}from"./index-371259c9.js";import{h as b,u as M,F as x,R as C}from"./Combination-575d4475.js";import{u as D}from"./index-ce60ba41.js";import{P as R}from"./index-bd6363d4.js";import{c as O,R as k,I as P}from"./index-a77c7d53.js";import{u as N}from"./index-70f4e709.js";import{c as I}from"./utils-3345eade.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.294.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
6
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const
|
|
7
|
+
*/const E=e("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),S=e("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),T=e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),F=e("MoreVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);
|
|
8
8
|
/**
|
|
9
9
|
* @license lucide-react v0.294.0 - ISC
|
|
10
10
|
*
|
|
11
11
|
* This source code is licensed under the ISC license.
|
|
12
12
|
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/function j(e){const n=o.forwardRef((e,n)=>{const{children:r,...t}=e;if(o.isValidElement(r)){const e=function(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning;if(r)return e.ref;if(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),a=function(e,n){const r={...n};for(const t in n){const o=e[t],a=n[t];/^on[A-Z]/.test(t)?o&&a?r[t]=(...e)=>{const n=a(...e);return o(...e),n}:o&&(r[t]=o):"style"===t?r[t]={...o,...a}:"className"===t&&(r[t]=[o,a].filter(Boolean).join(" "))}return{...e,...r}}(t,r.props);return r.type!==o.Fragment&&(a.ref=n?c(n,e):e),o.cloneElement(r,a)}return o.Children.count(r)>1?o.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var A=Symbol("radix.slottable");function L(e){return o.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===A}var K=["Enter"," "],V=["ArrowUp","PageDown","End"],z=["ArrowDown","PageUp","Home",...V],G={ltr:[...K,"ArrowRight"],rtl:[...K,"ArrowLeft"]},U={ltr:["ArrowLeft"],rtl:["ArrowRight"]},B="Menu",[W,X,q]=p(B),[Y,Z]=a(B,[q,m,O]),$=m(),H=O(),[J,Q]=Y(B),[ee,ne]=Y(B),re=e=>{const{__scopeMenu:n,open:t=!1,children:a,dir:s,onOpenChange:i,modal:d=!0}=e,c=$(n),[u,l]=o.useState(null),p=o.useRef(!1),m=N(i),g=f(s);return o.useEffect(()=>{const e=()=>{p.current=!0,document.addEventListener("pointerdown",n,{capture:!0,once:!0}),document.addEventListener("pointermove",n,{capture:!0,once:!0})},n=()=>p.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",n,{capture:!0}),document.removeEventListener("pointermove",n,{capture:!0})}},[]),r(y,{...c,children:r(J,{scope:n,open:t,onOpenChange:m,content:u,onContentChange:l,children:r(ee,{scope:n,onClose:o.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:p,dir:g,modal:d,children:a})})})};re.displayName=B;var te=o.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e,a=$(t);return r(g,{...a,...o,ref:n})});te.displayName="MenuAnchor";var oe="MenuPortal",[ae,se]=Y(oe,{forceMount:void 0}),ie=e=>{const{__scopeMenu:n,forceMount:t,children:o,container:a}=e,s=Q(oe,n);return r(ae,{scope:n,forceMount:t,children:r(R,{present:t||s.open,children:r(_,{asChild:!0,container:a,children:o})})})};ie.displayName=oe;var de="MenuContent",[ce,ue]=Y(de),le=o.forwardRef((e,n)=>{const t=se(de,e.__scopeMenu),{forceMount:o=t.forceMount,...a}=e,s=Q(de,e.__scopeMenu),i=ne(de,e.__scopeMenu);return r(W.Provider,{scope:e.__scopeMenu,children:r(R,{present:o||s.open,children:r(W.Slot,{scope:e.__scopeMenu,children:i.modal?r(pe,{...a,ref:n}):r(fe,{...a,ref:n})})})})}),pe=o.forwardRef((e,n)=>{const t=Q(de,e.__scopeMenu),a=o.useRef(null),i=u(n,a);return o.useEffect(()=>{const e=a.current;if(e)return b(e)},[]),r(ge,{...e,ref:i,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:s(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)})}),fe=o.forwardRef((e,n)=>{const t=Q(de,e.__scopeMenu);return r(ge,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)})}),me=function(e){const n=j(e),t=o.forwardRef((e,t)=>{const{children:a,...s}=e,i=o.Children.toArray(a),d=i.find(L);if(d){const e=d.props.children,a=i.map(n=>n===d?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:n);return r(n,{...s,ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,a):null})}return r(n,{...s,ref:t,children:a})});return t.displayName=`${e}.Slot`,t}("MenuContent.ScrollLock"),ge=o.forwardRef((e,n)=>{const{__scopeMenu:t,loop:a=!1,trapFocus:i,onOpenAutoFocus:d,onCloseAutoFocus:c,disableOutsidePointerEvents:l,onEntryFocus:p,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:w,onDismiss:y,disableOutsideScroll:_,...b}=e,D=Q(de,t),R=ne(de,t),O=$(t),P=H(t),N=X(t),[E,I]=o.useState(null),S=o.useRef(null),T=u(n,S,D.onContentChange),F=o.useRef(0),j=o.useRef(""),A=o.useRef(0),L=o.useRef(null),K=o.useRef("right"),G=o.useRef(0),U=_?C:o.Fragment,B=_?{as:me,allowPinchZoom:!0}:void 0,W=e=>{const n=j.current+e,r=N().filter(e=>!e.disabled),t=document.activeElement,o=r.find(e=>e.ref.current===t)?.textValue,a=function(e,n,r){const t=n.length>1&&Array.from(n).every(e=>e===n[0]),o=t?n[0]:n,a=r?e.indexOf(r):-1;let s=(i=e,d=Math.max(a,0),i.map((e,n)=>i[(d+n)%i.length]));var i,d;1===o.length&&(s=s.filter(e=>e!==r));const c=s.find(e=>e.toLowerCase().startsWith(o.toLowerCase()));return c!==r?c:void 0}(r.map(e=>e.textValue),n,o),s=r.find(e=>e.textValue===a)?.ref.current;!function e(n){j.current=n,window.clearTimeout(F.current),""!==n&&(F.current=window.setTimeout(()=>e(""),1e3))}(n),s&&setTimeout(()=>s.focus())};o.useEffect(()=>()=>window.clearTimeout(F.current),[]),M();const q=o.useCallback(e=>K.current===L.current?.side&&function(e,n){if(!n)return!1;const r={x:e.clientX,y:e.clientY};return function(e,n){const{x:r,y:t}=e;let o=!1;for(let e=0,a=n.length-1;e<n.length;a=e++){const s=n[e],i=n[a],d=s.x,c=s.y,u=i.x,l=i.y;c>t!=l>t&&r<(u-d)*(t-c)/(l-c)+d&&(o=!o)}return o}(r,n)}(e,L.current?.area),[]);return r(ce,{scope:t,searchRef:j,onItemEnter:o.useCallback(e=>{q(e)&&e.preventDefault()},[q]),onItemLeave:o.useCallback(e=>{q(e)||(S.current?.focus(),I(null))},[q]),onTriggerLeave:o.useCallback(e=>{q(e)&&e.preventDefault()},[q]),pointerGraceTimerRef:A,onPointerGraceIntentChange:o.useCallback(e=>{L.current=e},[]),children:r(U,{...B,children:r(x,{asChild:!0,trapped:i,onMountAutoFocus:s(d,e=>{e.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:r(h,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:w,onDismiss:y,children:r(k,{asChild:!0,...P,dir:R.dir,orientation:"vertical",loop:a,currentTabStopId:E,onCurrentTabStopIdChange:I,onEntryFocus:s(p,e=>{R.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:r(v,{role:"menu","aria-orientation":"vertical","data-state":Ue(D.open),"data-radix-menu-content":"",dir:R.dir,...O,...b,ref:T,style:{outline:"none",...b.style},onKeyDown:s(b.onKeyDown,e=>{const n=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,t=1===e.key.length;n&&("Tab"===e.key&&e.preventDefault(),!r&&t&&W(e.key));const o=S.current;if(e.target!==o)return;if(!z.includes(e.key))return;e.preventDefault();const a=N().filter(e=>!e.disabled).map(e=>e.ref.current);V.includes(e.key)&&a.reverse(),function(e){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus(),document.activeElement!==n)return}}(a)}),onBlur:s(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(F.current),j.current="")}),onPointerMove:s(e.onPointerMove,Xe(e=>{const n=e.target,r=G.current!==e.clientX;if(e.currentTarget.contains(n)&&r){const n=e.clientX>G.current?"right":"left";K.current=n,G.current=e.clientX}}))})})})})})})});le.displayName=de;var he=o.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e;return r(i.div,{role:"group",...o,ref:n})});he.displayName="MenuGroup";var ve=o.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e;return r(i.div,{...o,ref:n})});ve.displayName="MenuLabel";var we="MenuItem",ye="menu.itemSelect",_e=o.forwardRef((e,n)=>{const{disabled:t=!1,onSelect:a,...i}=e,c=o.useRef(null),l=ne(we,e.__scopeMenu),p=ue(we,e.__scopeMenu),f=u(n,c),m=o.useRef(!1);return r(be,{...i,ref:f,disabled:t,onClick:s(e.onClick,()=>{const e=c.current;if(!t&&e){const n=new CustomEvent(ye,{bubbles:!0,cancelable:!0});e.addEventListener(ye,e=>a?.(e),{once:!0}),d(e,n),n.defaultPrevented?m.current=!1:l.onClose()}}),onPointerDown:n=>{e.onPointerDown?.(n),m.current=!0},onPointerUp:s(e.onPointerUp,e=>{m.current||e.currentTarget?.click()}),onKeyDown:s(e.onKeyDown,e=>{const n=""!==p.searchRef.current;t||n&&" "===e.key||K.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});_e.displayName=we;var be=o.forwardRef((e,n)=>{const{__scopeMenu:t,disabled:a=!1,textValue:d,...c}=e,l=ue(we,t),p=H(t),f=o.useRef(null),m=u(n,f),[g,h]=o.useState(!1),[v,w]=o.useState("");return o.useEffect(()=>{const e=f.current;e&&w((e.textContent??"").trim())},[c.children]),r(W.ItemSlot,{scope:t,disabled:a,textValue:d??v,children:r(P,{asChild:!0,...p,focusable:!a,children:r(i.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...c,ref:m,onPointerMove:s(e.onPointerMove,Xe(e=>{if(a)l.onItemLeave(e);else if(l.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus({preventScroll:!0})}})),onPointerLeave:s(e.onPointerLeave,Xe(e=>l.onItemLeave(e))),onFocus:s(e.onFocus,()=>h(!0)),onBlur:s(e.onBlur,()=>h(!1))})})})}),Me=o.forwardRef((e,n)=>{const{checked:t=!1,onCheckedChange:o,...a}=e;return r(Ne,{scope:e.__scopeMenu,checked:t,children:r(_e,{role:"menuitemcheckbox","aria-checked":Be(t)?"mixed":t,...a,ref:n,"data-state":We(t),onSelect:s(a.onSelect,()=>o?.(!!Be(t)||!t),{checkForDefaultPrevented:!1})})})});Me.displayName="MenuCheckboxItem";var xe="MenuRadioGroup",[Ce,De]=Y(xe,{value:void 0,onValueChange:()=>{}}),Re=o.forwardRef((e,n)=>{const{value:t,onValueChange:o,...a}=e,s=N(o);return r(Ce,{scope:e.__scopeMenu,value:t,onValueChange:s,children:r(he,{...a,ref:n})})});Re.displayName=xe;var Oe="MenuRadioItem",ke=o.forwardRef((e,n)=>{const{value:t,...o}=e,a=De(Oe,e.__scopeMenu),i=t===a.value;return r(Ne,{scope:e.__scopeMenu,checked:i,children:r(_e,{role:"menuitemradio","aria-checked":i,...o,ref:n,"data-state":We(i),onSelect:s(o.onSelect,()=>a.onValueChange?.(t),{checkForDefaultPrevented:!1})})})});ke.displayName=Oe;var Pe="MenuItemIndicator",[Ne,Ee]=Y(Pe,{checked:!1}),Ie=o.forwardRef((e,n)=>{const{__scopeMenu:t,forceMount:o,...a}=e,s=Ee(Pe,t);return r(R,{present:o||Be(s.checked)||!0===s.checked,children:r(i.span,{...a,ref:n,"data-state":We(s.checked)})})});Ie.displayName=Pe;var Se=o.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e;return r(i.div,{role:"separator","aria-orientation":"horizontal",...o,ref:n})});Se.displayName="MenuSeparator";var Te=o.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e,a=$(t);return r(w,{...a,...o,ref:n})});Te.displayName="MenuArrow";var Fe="MenuSub",[je,Ae]=Y(Fe),Le=e=>{const{__scopeMenu:n,children:t,open:a=!1,onOpenChange:s}=e,i=Q(Fe,n),d=$(n),[c,u]=o.useState(null),[l,p]=o.useState(null),f=N(s);return o.useEffect(()=>(!1===i.open&&f(!1),()=>f(!1)),[i.open,f]),r(y,{...d,children:r(J,{scope:n,open:a,onOpenChange:f,content:l,onContentChange:p,children:r(je,{scope:n,contentId:D(),triggerId:D(),trigger:c,onTriggerChange:u,children:t})})})};Le.displayName=Fe;var Ke="MenuSubTrigger",Ve=o.forwardRef((e,n)=>{const t=Q(Ke,e.__scopeMenu),a=ne(Ke,e.__scopeMenu),i=Ae(Ke,e.__scopeMenu),d=ue(Ke,e.__scopeMenu),u=o.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:p}=d,f={__scopeMenu:e.__scopeMenu},m=o.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return o.useEffect(()=>m,[m]),o.useEffect(()=>{const e=l.current;return()=>{window.clearTimeout(e),p(null)}},[l,p]),r(te,{asChild:!0,...f,children:r(be,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":t.open,"aria-controls":i.contentId,"data-state":Ue(t.open),...e,ref:c(n,i.onTriggerChange),onClick:n=>{e.onClick?.(n),e.disabled||n.defaultPrevented||(n.currentTarget.focus(),t.open||t.onOpenChange(!0))},onPointerMove:s(e.onPointerMove,Xe(n=>{d.onItemEnter(n),n.defaultPrevented||e.disabled||t.open||u.current||(d.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{t.onOpenChange(!0),m()},100))})),onPointerLeave:s(e.onPointerLeave,Xe(e=>{m();const n=t.content?.getBoundingClientRect();if(n){const r=t.content?.dataset.side,o="right"===r,a=o?-5:5,s=n[o?"left":"right"],i=n[o?"right":"left"];d.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:n.top},{x:i,y:n.top},{x:i,y:n.bottom},{x:s,y:n.bottom}],side:r}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>d.onPointerGraceIntentChange(null),300)}else{if(d.onTriggerLeave(e),e.defaultPrevented)return;d.onPointerGraceIntentChange(null)}})),onKeyDown:s(e.onKeyDown,n=>{const r=""!==d.searchRef.current;e.disabled||r&&" "===n.key||G[a.dir].includes(n.key)&&(t.onOpenChange(!0),t.content?.focus(),n.preventDefault())})})})});Ve.displayName=Ke;var ze="MenuSubContent",Ge=o.forwardRef((e,n)=>{const t=se(de,e.__scopeMenu),{forceMount:a=t.forceMount,...i}=e,d=Q(de,e.__scopeMenu),c=ne(de,e.__scopeMenu),l=Ae(ze,e.__scopeMenu),p=o.useRef(null),f=u(n,p);return r(W.Provider,{scope:e.__scopeMenu,children:r(R,{present:a||d.open,children:r(W.Slot,{scope:e.__scopeMenu,children:r(ge,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:f,align:"start",side:"rtl"===c.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&p.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:s(e.onFocusOutside,e=>{e.target!==l.trigger&&d.onOpenChange(!1)}),onEscapeKeyDown:s(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:s(e.onKeyDown,e=>{const n=e.currentTarget.contains(e.target),r=U[c.dir].includes(e.key);n&&r&&(d.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});function Ue(e){return e?"open":"closed"}function Be(e){return"indeterminate"===e}function We(e){return Be(e)?"indeterminate":e?"checked":"unchecked"}function Xe(e){return n=>"mouse"===n.pointerType?e(n):void 0}Ge.displayName=ze;var qe=re,Ye=te,Ze=ie,$e=le,He=he,Je=ve,Qe=_e,en=Me,nn=Re,rn=ke,tn=Ie,on=Se,an=Te,sn=Le,dn=Ve,cn=Ge,un="DropdownMenu",[ln,pn]=a(un,[Z]),fn=Z(),[mn,gn]=ln(un),hn=e=>{const{__scopeDropdownMenu:n,children:t,dir:a,open:s,defaultOpen:i,onOpenChange:d,modal:c=!0}=e,u=fn(n),p=o.useRef(null),[f,m]=l({prop:s,defaultProp:i??!1,onChange:d,caller:un});return r(mn,{scope:n,triggerId:D(),triggerRef:p,contentId:D(),open:f,onOpenChange:m,onOpenToggle:o.useCallback(()=>m(e=>!e),[m]),modal:c,children:r(qe,{...u,open:f,onOpenChange:m,dir:a,modal:c,children:t})})};hn.displayName=un;var vn="DropdownMenuTrigger",wn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,disabled:o=!1,...a}=e,d=gn(vn,t),u=fn(t);return r(Ye,{asChild:!0,...u,children:r(i.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,...a,ref:c(n,d.triggerRef),onPointerDown:s(e.onPointerDown,e=>{o||0!==e.button||!1!==e.ctrlKey||(d.onOpenToggle(),d.open||e.preventDefault())}),onKeyDown:s(e.onKeyDown,e=>{o||(["Enter"," "].includes(e.key)&&d.onOpenToggle(),"ArrowDown"===e.key&&d.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});wn.displayName=vn;var yn=e=>{const{__scopeDropdownMenu:n,...t}=e,o=fn(n);return r(Ze,{...o,...t})};yn.displayName="DropdownMenuPortal";var _n="DropdownMenuContent",bn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...a}=e,i=gn(_n,t),d=fn(t),c=o.useRef(!1);return r($e,{id:i.contentId,"aria-labelledby":i.triggerId,...d,...a,ref:n,onCloseAutoFocus:s(e.onCloseAutoFocus,e=>{c.current||i.triggerRef.current?.focus(),c.current=!1,e.preventDefault()}),onInteractOutside:s(e.onInteractOutside,e=>{const n=e.detail.originalEvent,r=0===n.button&&!0===n.ctrlKey,t=2===n.button||r;i.modal&&!t||(c.current=!0)}),style:{...e.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)"}})});bn.displayName=_n;o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(He,{...a,...o,ref:n})}).displayName="DropdownMenuGroup";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(Je,{...a,...o,ref:n})}).displayName="DropdownMenuLabel";var Mn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(Qe,{...a,...o,ref:n})});Mn.displayName="DropdownMenuItem";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(en,{...a,...o,ref:n})}).displayName="DropdownMenuCheckboxItem";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(nn,{...a,...o,ref:n})}).displayName="DropdownMenuRadioGroup";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(rn,{...a,...o,ref:n})}).displayName="DropdownMenuRadioItem";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(tn,{...a,...o,ref:n})}).displayName="DropdownMenuItemIndicator";var xn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(on,{...a,...o,ref:n})});xn.displayName="DropdownMenuSeparator";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(an,{...a,...o,ref:n})}).displayName="DropdownMenuArrow";var Cn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(dn,{...a,...o,ref:n})});Cn.displayName="DropdownMenuSubTrigger";var Dn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(cn,{...a,...o,ref:n,style:{...e.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)"}})});Dn.displayName="DropdownMenuSubContent";var Rn=hn,On=wn,kn=yn,Pn=bn,Nn=Mn,En=xn,In=e=>{const{__scopeDropdownMenu:n,children:t,open:o,onOpenChange:a,defaultOpen:s}=e,i=fn(n),[d,c]=l({prop:o,defaultProp:s??!1,onChange:a,caller:"DropdownMenuSub"});return r(sn,{...i,open:d,onOpenChange:c,children:t})},Sn=Cn,Tn=Dn;const Fn=e=>{var t=n(e,[]);return r(Rn,Object.assign({"data-slot":"dropdown-menu"},t))},jn=e=>{var t=n(e,[]);return r(On,Object.assign({"data-slot":"dropdown-menu-trigger"},t))},An=e=>{var{className:t,sideOffset:o=4}=e,a=n(e,["className","sideOffset"]);return r(kn,{children:r(Pn,Object.assign({"data-slot":"dropdown-menu-content",sideOffset:o,className:E("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t)},a))})},Ln=e=>{var{className:t,inset:o,variant:a="default"}=e,s=n(e,["className","inset","variant"]);return r(Nn,Object.assign({"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":a,className:E("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t)},s))},Kn=e=>{var{className:t}=e,o=n(e,["className"]);return r(En,Object.assign({"data-slot":"dropdown-menu-separator",className:E("bg-border -mx-1 my-1 h-px",t)},o))},Vn=e=>{var t=n(e,[]);return r(In,Object.assign({"data-slot":"dropdown-menu-sub"},t))},zn=e=>{var{className:o,inset:a,children:s}=e,i=n(e,["className","inset","children"]);return t(Sn,Object.assign({"data-slot":"dropdown-menu-sub-trigger","data-inset":a,className:E("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o)},i,{children:[s,r(T,{className:"ml-auto size-4"})]}))},Gn=e=>{var{className:t}=e,o=n(e,["className"]);return r(Tn,Object.assign({"data-slot":"dropdown-menu-sub-content",className:E("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t)},o))};export{S as A,Fn as D,F as M,jn as a,An as b,Ln as c,I as d,Kn as e,Vn as f,zn as g,Gn as h};
|
|
13
|
+
*/function j(e){const n=o.forwardRef((e,n)=>{const{children:r,...t}=e;if(o.isValidElement(r)){const e=function(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning;if(r)return e.ref;if(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),a=function(e,n){const r={...n};for(const t in n){const o=e[t],a=n[t];/^on[A-Z]/.test(t)?o&&a?r[t]=(...e)=>{const n=a(...e);return o(...e),n}:o&&(r[t]=o):"style"===t?r[t]={...o,...a}:"className"===t&&(r[t]=[o,a].filter(Boolean).join(" "))}return{...e,...r}}(t,r.props);return r.type!==o.Fragment&&(a.ref=n?c(n,e):e),o.cloneElement(r,a)}return o.Children.count(r)>1?o.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var A=Symbol("radix.slottable");function L(e){return o.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===A}var K=["Enter"," "],V=["ArrowUp","PageDown","End"],z=["ArrowDown","PageUp","Home",...V],G={ltr:[...K,"ArrowRight"],rtl:[...K,"ArrowLeft"]},U={ltr:["ArrowLeft"],rtl:["ArrowRight"]},B="Menu",[W,X,q]=p(B),[Y,Z]=a(B,[q,m,O]),$=m(),H=O(),[J,Q]=Y(B),[ee,ne]=Y(B),re=e=>{const{__scopeMenu:n,open:t=!1,children:a,dir:s,onOpenChange:i,modal:d=!0}=e,c=$(n),[u,l]=o.useState(null),p=o.useRef(!1),m=N(i),g=f(s);return o.useEffect(()=>{const e=()=>{p.current=!0,document.addEventListener("pointerdown",n,{capture:!0,once:!0}),document.addEventListener("pointermove",n,{capture:!0,once:!0})},n=()=>p.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",n,{capture:!0}),document.removeEventListener("pointermove",n,{capture:!0})}},[]),r(y,{...c,children:r(J,{scope:n,open:t,onOpenChange:m,content:u,onContentChange:l,children:r(ee,{scope:n,onClose:o.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:p,dir:g,modal:d,children:a})})})};re.displayName=B;var te=o.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e,a=$(t);return r(g,{...a,...o,ref:n})});te.displayName="MenuAnchor";var oe="MenuPortal",[ae,se]=Y(oe,{forceMount:void 0}),ie=e=>{const{__scopeMenu:n,forceMount:t,children:o,container:a}=e,s=Q(oe,n);return r(ae,{scope:n,forceMount:t,children:r(R,{present:t||s.open,children:r(_,{asChild:!0,container:a,children:o})})})};ie.displayName=oe;var de="MenuContent",[ce,ue]=Y(de),le=o.forwardRef((e,n)=>{const t=se(de,e.__scopeMenu),{forceMount:o=t.forceMount,...a}=e,s=Q(de,e.__scopeMenu),i=ne(de,e.__scopeMenu);return r(W.Provider,{scope:e.__scopeMenu,children:r(R,{present:o||s.open,children:r(W.Slot,{scope:e.__scopeMenu,children:i.modal?r(pe,{...a,ref:n}):r(fe,{...a,ref:n})})})})}),pe=o.forwardRef((e,n)=>{const t=Q(de,e.__scopeMenu),a=o.useRef(null),i=u(n,a);return o.useEffect(()=>{const e=a.current;if(e)return b(e)},[]),r(ge,{...e,ref:i,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:s(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)})}),fe=o.forwardRef((e,n)=>{const t=Q(de,e.__scopeMenu);return r(ge,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)})}),me=function(e){const n=j(e),t=o.forwardRef((e,t)=>{const{children:a,...s}=e,i=o.Children.toArray(a),d=i.find(L);if(d){const e=d.props.children,a=i.map(n=>n===d?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:n);return r(n,{...s,ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,a):null})}return r(n,{...s,ref:t,children:a})});return t.displayName=`${e}.Slot`,t}("MenuContent.ScrollLock"),ge=o.forwardRef((e,n)=>{const{__scopeMenu:t,loop:a=!1,trapFocus:i,onOpenAutoFocus:d,onCloseAutoFocus:c,disableOutsidePointerEvents:l,onEntryFocus:p,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:w,onDismiss:y,disableOutsideScroll:_,...b}=e,D=Q(de,t),R=ne(de,t),O=$(t),P=H(t),N=X(t),[I,E]=o.useState(null),S=o.useRef(null),T=u(n,S,D.onContentChange),F=o.useRef(0),j=o.useRef(""),A=o.useRef(0),L=o.useRef(null),K=o.useRef("right"),G=o.useRef(0),U=_?C:o.Fragment,B=_?{as:me,allowPinchZoom:!0}:void 0,W=e=>{const n=j.current+e,r=N().filter(e=>!e.disabled),t=document.activeElement,o=r.find(e=>e.ref.current===t)?.textValue,a=function(e,n,r){const t=n.length>1&&Array.from(n).every(e=>e===n[0]),o=t?n[0]:n,a=r?e.indexOf(r):-1;let s=(i=e,d=Math.max(a,0),i.map((e,n)=>i[(d+n)%i.length]));var i,d;1===o.length&&(s=s.filter(e=>e!==r));const c=s.find(e=>e.toLowerCase().startsWith(o.toLowerCase()));return c!==r?c:void 0}(r.map(e=>e.textValue),n,o),s=r.find(e=>e.textValue===a)?.ref.current;!function e(n){j.current=n,window.clearTimeout(F.current),""!==n&&(F.current=window.setTimeout(()=>e(""),1e3))}(n),s&&setTimeout(()=>s.focus())};o.useEffect(()=>()=>window.clearTimeout(F.current),[]),M();const q=o.useCallback(e=>K.current===L.current?.side&&function(e,n){if(!n)return!1;const r={x:e.clientX,y:e.clientY};return function(e,n){const{x:r,y:t}=e;let o=!1;for(let e=0,a=n.length-1;e<n.length;a=e++){const s=n[e],i=n[a],d=s.x,c=s.y,u=i.x,l=i.y;c>t!=l>t&&r<(u-d)*(t-c)/(l-c)+d&&(o=!o)}return o}(r,n)}(e,L.current?.area),[]);return r(ce,{scope:t,searchRef:j,onItemEnter:o.useCallback(e=>{q(e)&&e.preventDefault()},[q]),onItemLeave:o.useCallback(e=>{q(e)||(S.current?.focus(),E(null))},[q]),onTriggerLeave:o.useCallback(e=>{q(e)&&e.preventDefault()},[q]),pointerGraceTimerRef:A,onPointerGraceIntentChange:o.useCallback(e=>{L.current=e},[]),children:r(U,{...B,children:r(x,{asChild:!0,trapped:i,onMountAutoFocus:s(d,e=>{e.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:r(h,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:w,onDismiss:y,children:r(k,{asChild:!0,...P,dir:R.dir,orientation:"vertical",loop:a,currentTabStopId:I,onCurrentTabStopIdChange:E,onEntryFocus:s(p,e=>{R.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:r(v,{role:"menu","aria-orientation":"vertical","data-state":Ue(D.open),"data-radix-menu-content":"",dir:R.dir,...O,...b,ref:T,style:{outline:"none",...b.style},onKeyDown:s(b.onKeyDown,e=>{const n=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,t=1===e.key.length;n&&("Tab"===e.key&&e.preventDefault(),!r&&t&&W(e.key));const o=S.current;if(e.target!==o)return;if(!z.includes(e.key))return;e.preventDefault();const a=N().filter(e=>!e.disabled).map(e=>e.ref.current);V.includes(e.key)&&a.reverse(),function(e){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus(),document.activeElement!==n)return}}(a)}),onBlur:s(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(F.current),j.current="")}),onPointerMove:s(e.onPointerMove,Xe(e=>{const n=e.target,r=G.current!==e.clientX;if(e.currentTarget.contains(n)&&r){const n=e.clientX>G.current?"right":"left";K.current=n,G.current=e.clientX}}))})})})})})})});le.displayName=de;var he=o.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e;return r(i.div,{role:"group",...o,ref:n})});he.displayName="MenuGroup";var ve=o.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e;return r(i.div,{...o,ref:n})});ve.displayName="MenuLabel";var we="MenuItem",ye="menu.itemSelect",_e=o.forwardRef((e,n)=>{const{disabled:t=!1,onSelect:a,...i}=e,c=o.useRef(null),l=ne(we,e.__scopeMenu),p=ue(we,e.__scopeMenu),f=u(n,c),m=o.useRef(!1);return r(be,{...i,ref:f,disabled:t,onClick:s(e.onClick,()=>{const e=c.current;if(!t&&e){const n=new CustomEvent(ye,{bubbles:!0,cancelable:!0});e.addEventListener(ye,e=>a?.(e),{once:!0}),d(e,n),n.defaultPrevented?m.current=!1:l.onClose()}}),onPointerDown:n=>{e.onPointerDown?.(n),m.current=!0},onPointerUp:s(e.onPointerUp,e=>{m.current||e.currentTarget?.click()}),onKeyDown:s(e.onKeyDown,e=>{const n=""!==p.searchRef.current;t||n&&" "===e.key||K.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});_e.displayName=we;var be=o.forwardRef((e,n)=>{const{__scopeMenu:t,disabled:a=!1,textValue:d,...c}=e,l=ue(we,t),p=H(t),f=o.useRef(null),m=u(n,f),[g,h]=o.useState(!1),[v,w]=o.useState("");return o.useEffect(()=>{const e=f.current;e&&w((e.textContent??"").trim())},[c.children]),r(W.ItemSlot,{scope:t,disabled:a,textValue:d??v,children:r(P,{asChild:!0,...p,focusable:!a,children:r(i.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...c,ref:m,onPointerMove:s(e.onPointerMove,Xe(e=>{if(a)l.onItemLeave(e);else if(l.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus({preventScroll:!0})}})),onPointerLeave:s(e.onPointerLeave,Xe(e=>l.onItemLeave(e))),onFocus:s(e.onFocus,()=>h(!0)),onBlur:s(e.onBlur,()=>h(!1))})})})}),Me=o.forwardRef((e,n)=>{const{checked:t=!1,onCheckedChange:o,...a}=e;return r(Ne,{scope:e.__scopeMenu,checked:t,children:r(_e,{role:"menuitemcheckbox","aria-checked":Be(t)?"mixed":t,...a,ref:n,"data-state":We(t),onSelect:s(a.onSelect,()=>o?.(!!Be(t)||!t),{checkForDefaultPrevented:!1})})})});Me.displayName="MenuCheckboxItem";var xe="MenuRadioGroup",[Ce,De]=Y(xe,{value:void 0,onValueChange:()=>{}}),Re=o.forwardRef((e,n)=>{const{value:t,onValueChange:o,...a}=e,s=N(o);return r(Ce,{scope:e.__scopeMenu,value:t,onValueChange:s,children:r(he,{...a,ref:n})})});Re.displayName=xe;var Oe="MenuRadioItem",ke=o.forwardRef((e,n)=>{const{value:t,...o}=e,a=De(Oe,e.__scopeMenu),i=t===a.value;return r(Ne,{scope:e.__scopeMenu,checked:i,children:r(_e,{role:"menuitemradio","aria-checked":i,...o,ref:n,"data-state":We(i),onSelect:s(o.onSelect,()=>a.onValueChange?.(t),{checkForDefaultPrevented:!1})})})});ke.displayName=Oe;var Pe="MenuItemIndicator",[Ne,Ie]=Y(Pe,{checked:!1}),Ee=o.forwardRef((e,n)=>{const{__scopeMenu:t,forceMount:o,...a}=e,s=Ie(Pe,t);return r(R,{present:o||Be(s.checked)||!0===s.checked,children:r(i.span,{...a,ref:n,"data-state":We(s.checked)})})});Ee.displayName=Pe;var Se=o.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e;return r(i.div,{role:"separator","aria-orientation":"horizontal",...o,ref:n})});Se.displayName="MenuSeparator";var Te=o.forwardRef((e,n)=>{const{__scopeMenu:t,...o}=e,a=$(t);return r(w,{...a,...o,ref:n})});Te.displayName="MenuArrow";var Fe="MenuSub",[je,Ae]=Y(Fe),Le=e=>{const{__scopeMenu:n,children:t,open:a=!1,onOpenChange:s}=e,i=Q(Fe,n),d=$(n),[c,u]=o.useState(null),[l,p]=o.useState(null),f=N(s);return o.useEffect(()=>(!1===i.open&&f(!1),()=>f(!1)),[i.open,f]),r(y,{...d,children:r(J,{scope:n,open:a,onOpenChange:f,content:l,onContentChange:p,children:r(je,{scope:n,contentId:D(),triggerId:D(),trigger:c,onTriggerChange:u,children:t})})})};Le.displayName=Fe;var Ke="MenuSubTrigger",Ve=o.forwardRef((e,n)=>{const t=Q(Ke,e.__scopeMenu),a=ne(Ke,e.__scopeMenu),i=Ae(Ke,e.__scopeMenu),d=ue(Ke,e.__scopeMenu),u=o.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:p}=d,f={__scopeMenu:e.__scopeMenu},m=o.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return o.useEffect(()=>m,[m]),o.useEffect(()=>{const e=l.current;return()=>{window.clearTimeout(e),p(null)}},[l,p]),r(te,{asChild:!0,...f,children:r(be,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":t.open,"aria-controls":i.contentId,"data-state":Ue(t.open),...e,ref:c(n,i.onTriggerChange),onClick:n=>{e.onClick?.(n),e.disabled||n.defaultPrevented||(n.currentTarget.focus(),t.open||t.onOpenChange(!0))},onPointerMove:s(e.onPointerMove,Xe(n=>{d.onItemEnter(n),n.defaultPrevented||e.disabled||t.open||u.current||(d.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{t.onOpenChange(!0),m()},100))})),onPointerLeave:s(e.onPointerLeave,Xe(e=>{m();const n=t.content?.getBoundingClientRect();if(n){const r=t.content?.dataset.side,o="right"===r,a=o?-5:5,s=n[o?"left":"right"],i=n[o?"right":"left"];d.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:n.top},{x:i,y:n.top},{x:i,y:n.bottom},{x:s,y:n.bottom}],side:r}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>d.onPointerGraceIntentChange(null),300)}else{if(d.onTriggerLeave(e),e.defaultPrevented)return;d.onPointerGraceIntentChange(null)}})),onKeyDown:s(e.onKeyDown,n=>{const r=""!==d.searchRef.current;e.disabled||r&&" "===n.key||G[a.dir].includes(n.key)&&(t.onOpenChange(!0),t.content?.focus(),n.preventDefault())})})})});Ve.displayName=Ke;var ze="MenuSubContent",Ge=o.forwardRef((e,n)=>{const t=se(de,e.__scopeMenu),{forceMount:a=t.forceMount,...i}=e,d=Q(de,e.__scopeMenu),c=ne(de,e.__scopeMenu),l=Ae(ze,e.__scopeMenu),p=o.useRef(null),f=u(n,p);return r(W.Provider,{scope:e.__scopeMenu,children:r(R,{present:a||d.open,children:r(W.Slot,{scope:e.__scopeMenu,children:r(ge,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:f,align:"start",side:"rtl"===c.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&p.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:s(e.onFocusOutside,e=>{e.target!==l.trigger&&d.onOpenChange(!1)}),onEscapeKeyDown:s(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:s(e.onKeyDown,e=>{const n=e.currentTarget.contains(e.target),r=U[c.dir].includes(e.key);n&&r&&(d.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});function Ue(e){return e?"open":"closed"}function Be(e){return"indeterminate"===e}function We(e){return Be(e)?"indeterminate":e?"checked":"unchecked"}function Xe(e){return n=>"mouse"===n.pointerType?e(n):void 0}Ge.displayName=ze;var qe=re,Ye=te,Ze=ie,$e=le,He=he,Je=ve,Qe=_e,en=Me,nn=Re,rn=ke,tn=Ee,on=Se,an=Te,sn=Le,dn=Ve,cn=Ge,un="DropdownMenu",[ln,pn]=a(un,[Z]),fn=Z(),[mn,gn]=ln(un),hn=e=>{const{__scopeDropdownMenu:n,children:t,dir:a,open:s,defaultOpen:i,onOpenChange:d,modal:c=!0}=e,u=fn(n),p=o.useRef(null),[f,m]=l({prop:s,defaultProp:i??!1,onChange:d,caller:un});return r(mn,{scope:n,triggerId:D(),triggerRef:p,contentId:D(),open:f,onOpenChange:m,onOpenToggle:o.useCallback(()=>m(e=>!e),[m]),modal:c,children:r(qe,{...u,open:f,onOpenChange:m,dir:a,modal:c,children:t})})};hn.displayName=un;var vn="DropdownMenuTrigger",wn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,disabled:o=!1,...a}=e,d=gn(vn,t),u=fn(t);return r(Ye,{asChild:!0,...u,children:r(i.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,...a,ref:c(n,d.triggerRef),onPointerDown:s(e.onPointerDown,e=>{o||0!==e.button||!1!==e.ctrlKey||(d.onOpenToggle(),d.open||e.preventDefault())}),onKeyDown:s(e.onKeyDown,e=>{o||(["Enter"," "].includes(e.key)&&d.onOpenToggle(),"ArrowDown"===e.key&&d.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});wn.displayName=vn;var yn=e=>{const{__scopeDropdownMenu:n,...t}=e,o=fn(n);return r(Ze,{...o,...t})};yn.displayName="DropdownMenuPortal";var _n="DropdownMenuContent",bn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...a}=e,i=gn(_n,t),d=fn(t),c=o.useRef(!1);return r($e,{id:i.contentId,"aria-labelledby":i.triggerId,...d,...a,ref:n,onCloseAutoFocus:s(e.onCloseAutoFocus,e=>{c.current||i.triggerRef.current?.focus(),c.current=!1,e.preventDefault()}),onInteractOutside:s(e.onInteractOutside,e=>{const n=e.detail.originalEvent,r=0===n.button&&!0===n.ctrlKey,t=2===n.button||r;i.modal&&!t||(c.current=!0)}),style:{...e.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)"}})});bn.displayName=_n;o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(He,{...a,...o,ref:n})}).displayName="DropdownMenuGroup";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(Je,{...a,...o,ref:n})}).displayName="DropdownMenuLabel";var Mn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(Qe,{...a,...o,ref:n})});Mn.displayName="DropdownMenuItem";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(en,{...a,...o,ref:n})}).displayName="DropdownMenuCheckboxItem";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(nn,{...a,...o,ref:n})}).displayName="DropdownMenuRadioGroup";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(rn,{...a,...o,ref:n})}).displayName="DropdownMenuRadioItem";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(tn,{...a,...o,ref:n})}).displayName="DropdownMenuItemIndicator";var xn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(on,{...a,...o,ref:n})});xn.displayName="DropdownMenuSeparator";o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(an,{...a,...o,ref:n})}).displayName="DropdownMenuArrow";var Cn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(dn,{...a,...o,ref:n})});Cn.displayName="DropdownMenuSubTrigger";var Dn=o.forwardRef((e,n)=>{const{__scopeDropdownMenu:t,...o}=e,a=fn(t);return r(cn,{...a,...o,ref:n,style:{...e.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)"}})});Dn.displayName="DropdownMenuSubContent";var Rn=hn,On=wn,kn=yn,Pn=bn,Nn=Mn,In=xn,En=e=>{const{__scopeDropdownMenu:n,children:t,open:o,onOpenChange:a,defaultOpen:s}=e,i=fn(n),[d,c]=l({prop:o,defaultProp:s??!1,onChange:a,caller:"DropdownMenuSub"});return r(sn,{...i,open:d,onOpenChange:c,children:t})},Sn=Cn,Tn=Dn;const Fn=e=>{var t=n(e,[]);return r(Rn,Object.assign({"data-slot":"dropdown-menu"},t))},jn=e=>{var t=n(e,[]);return r(On,Object.assign({"data-slot":"dropdown-menu-trigger"},t))},An=e=>{var{className:t,sideOffset:o=4}=e,a=n(e,["className","sideOffset"]);return r(kn,{children:r(Pn,Object.assign({"data-slot":"dropdown-menu-content",sideOffset:o,className:I("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t)},a))})},Ln=e=>{var{className:t,inset:o,variant:a="default"}=e,s=n(e,["className","inset","variant"]);return r(Nn,Object.assign({"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":a,className:I("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t)},s))},Kn=e=>{var{className:t}=e,o=n(e,["className"]);return r(In,Object.assign({"data-slot":"dropdown-menu-separator",className:I("bg-border -mx-1 my-1 h-px",t)},o))},Vn=e=>{var t=n(e,[]);return r(En,Object.assign({"data-slot":"dropdown-menu-sub"},t))},zn=e=>{var{className:o,inset:a,children:s}=e,i=n(e,["className","inset","children"]);return t(Sn,Object.assign({"data-slot":"dropdown-menu-sub-trigger","data-inset":a,className:I("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o)},i,{children:[s,r(T,{className:"ml-auto size-4"})]}))},Gn=e=>{var{className:t}=e,o=n(e,["className"]);return r(Tn,Object.assign({"data-slot":"dropdown-menu-sub-content",className:I("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t)},o))};export{S as A,Fn as D,F as M,jn as a,An as b,Ln as c,E as d,Kn as e,Vn as f,zn as g,Gn as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./_tslib-35bb891d.js";import{jsx as r}from"react/jsx-runtime";import*as t from"react";import{c as o,P as n,a}from"./index-17323747.js";import{u as s}from"./index-ff0e3962.js";import{u as i}from"./index-91a5b8d5.js";import{c,A as d,D as l,C as u,a as p,R as f,P as m}from"./index-
|
|
1
|
+
import{_ as e}from"./_tslib-35bb891d.js";import{jsx as r}from"react/jsx-runtime";import*as t from"react";import{c as o,P as n,a}from"./index-17323747.js";import{u as s}from"./index-ff0e3962.js";import{u as i}from"./index-91a5b8d5.js";import{c,A as d,D as l,C as u,a as p,R as f,P as m}from"./index-371259c9.js";import{P as h}from"./index-bd6363d4.js";import{c as v}from"./utils-3345eade.js";var g,C="HoverCard",[w,b]=o(C,[c]),O=c(),[x,P]=w(C),R=e=>{const{__scopeHoverCard:o,children:n,open:a,defaultOpen:i,onOpenChange:c,openDelay:d=700,closeDelay:l=300}=e,u=O(o),p=t.useRef(0),m=t.useRef(0),h=t.useRef(!1),v=t.useRef(!1),[g,w]=s({prop:a,defaultProp:i??!1,onChange:c,caller:C}),b=t.useCallback(()=>{clearTimeout(m.current),p.current=window.setTimeout(()=>w(!0),d)},[d,w]),P=t.useCallback(()=>{clearTimeout(p.current),h.current||v.current||(m.current=window.setTimeout(()=>w(!1),l))},[l,w]),R=t.useCallback(()=>w(!1),[w]);return t.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(m.current)},[]),r(x,{scope:o,open:g,onOpenChange:w,onOpen:b,onClose:P,onDismiss:R,hasSelectionRef:h,isPointerDownOnContentRef:v,children:r(f,{...u,children:n})})};R.displayName=C;var E="HoverCardTrigger",S=t.forwardRef((e,t)=>{const{__scopeHoverCard:o,...s}=e,i=P(E,o),c=O(o);return r(d,{asChild:!0,...c,children:r(n.a,{"data-state":i.open?"open":"closed",...s,ref:t,onPointerEnter:a(e.onPointerEnter,F(i.onOpen)),onPointerLeave:a(e.onPointerLeave,F(i.onClose)),onFocus:a(e.onFocus,i.onOpen),onBlur:a(e.onBlur,i.onClose),onTouchStart:a(e.onTouchStart,e=>e.preventDefault())})})});S.displayName=E;var y="HoverCardPortal",[D,_]=w(y,{forceMount:void 0}),T=e=>{const{__scopeHoverCard:t,forceMount:o,children:n,container:a}=e,s=P(y,t);return r(D,{scope:t,forceMount:o,children:r(h,{present:o||s.open,children:r(m,{asChild:!0,container:a,children:n})})})};T.displayName=y;var N="HoverCardContent",H=t.forwardRef((e,t)=>{const o=_(N,e.__scopeHoverCard),{forceMount:n=o.forceMount,...s}=e,i=P(N,e.__scopeHoverCard);return r(h,{present:n||i.open,children:r(j,{"data-state":i.open?"open":"closed",...s,onPointerEnter:a(e.onPointerEnter,F(i.onOpen)),onPointerLeave:a(e.onPointerLeave,F(i.onClose)),ref:t})})});H.displayName=N;var j=t.forwardRef((e,o)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:p,...f}=e,m=P(N,n),h=O(n),v=t.useRef(null),C=i(o,v),[w,b]=t.useState(!1);return t.useEffect(()=>{if(w){const e=document.body;return g=e.style.userSelect||e.style.webkitUserSelect,e.style.userSelect="none",e.style.webkitUserSelect="none",()=>{e.style.userSelect=g,e.style.webkitUserSelect=g}}},[w]),t.useEffect(()=>{if(v.current){const e=()=>{b(!1),m.isPointerDownOnContentRef.current=!1,setTimeout(()=>{""!==document.getSelection()?.toString()&&(m.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",e),()=>{document.removeEventListener("pointerup",e),m.hasSelectionRef.current=!1,m.isPointerDownOnContentRef.current=!1}}},[m.isPointerDownOnContentRef,m.hasSelectionRef]),t.useEffect(()=>{if(v.current){(function(e){const r=[],t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;t.nextNode();)r.push(t.currentNode);return r})(v.current).forEach(e=>e.setAttribute("tabindex","-1"))}}),r(l,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:p,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:a(d,e=>{e.preventDefault()}),onDismiss:m.onDismiss,children:r(u,{...h,...f,onPointerDown:a(f.onPointerDown,e=>{e.currentTarget.contains(e.target)&&b(!0),m.hasSelectionRef.current=!1,m.isPointerDownOnContentRef.current=!0}),ref:C,style:{...f.style,userSelect:w?"text":void 0,WebkitUserSelect:w?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})});function F(e){return r=>"touch"===r.pointerType?void 0:e()}t.forwardRef((e,t)=>{const{__scopeHoverCard:o,...n}=e,a=O(o);return r(p,{...a,...n,ref:t})}).displayName="HoverCardArrow";var L=R,k=S,I=T,M=H;const z=t=>{var o=e(t,[]);return r(L,Object.assign({"data-slot":"hover-card"},o))},A=t=>{var o=e(t,[]);return r(k,Object.assign({"data-slot":"hover-card-trigger"},o))},U=t=>{var{className:o,align:n="center",sideOffset:a=4}=t,s=e(t,["className","align","sideOffset"]);return r(I,Object.assign({"data-slot":"hover-card-portal"},{children:r(M,Object.assign({"data-slot":"hover-card-content",align:n,sideOffset:a,className:v("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",o)},s))}))};export{z as H,A as a,U as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"react";import{useLayoutEffect as e}from"react";import{P as n,a as r,d as o,u as i,c as s}from"./index-17323747.js";import{u as a}from"./index-91a5b8d5.js";import{u as l}from"./index-70f4e709.js";import{jsx as c}from"react/jsx-runtime";import*as f from"react-dom";import u from"react-dom";var d,p="dismissableLayer.update",m="dismissableLayer.pointerDownOutside",h="dismissableLayer.focusOutside",g=t.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),y=t.forwardRef((e,o)=>{const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:s,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:y,onDismiss:x,...b}=e,E=t.useContext(g),[R,P]=t.useState(null),A=R?.ownerDocument??globalThis?.document,[,O]=t.useState({}),S=a(o,t=>P(t)),L=Array.from(E.layers),[C]=[...E.layersWithOutsidePointerEventsDisabled].slice(-1),D=L.indexOf(C),T=R?L.indexOf(R):-1,k=E.layersWithOutsidePointerEventsDisabled.size>0,W=T>=D,F=function(e,n=globalThis?.document){const r=l(e),o=t.useRef(!1),i=t.useRef(()=>{});return t.useEffect(()=>{const t=t=>{if(t.target&&!o.current){let e=function(){v(m,r,o,{discrete:!0})};const o={originalEvent:t};"touch"===t.pointerType?(n.removeEventListener("click",i.current),i.current=e,n.addEventListener("click",i.current,{once:!0})):e()}else n.removeEventListener("click",i.current);o.current=!1},e=window.setTimeout(()=>{n.addEventListener("pointerdown",t)},0);return()=>{window.clearTimeout(e),n.removeEventListener("pointerdown",t),n.removeEventListener("click",i.current)}},[n,r]),{onPointerDownCapture:()=>o.current=!0}}(t=>{const e=t.target,n=[...E.branches].some(t=>t.contains(e));W&&!n&&(f?.(t),y?.(t),t.defaultPrevented||x?.())},A),H=function(e,n=globalThis?.document){const r=l(e),o=t.useRef(!1);return t.useEffect(()=>{const t=t=>{if(t.target&&!o.current){v(h,r,{originalEvent:t},{discrete:!1})}};return n.addEventListener("focusin",t),()=>n.removeEventListener("focusin",t)},[n,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}(t=>{const e=t.target;[...E.branches].some(t=>t.contains(e))||(u?.(t),y?.(t),t.defaultPrevented||x?.())},A);return function(e,n=globalThis?.document){const r=l(e);t.useEffect(()=>{const t=t=>{"Escape"===t.key&&r(t)};return n.addEventListener("keydown",t,{capture:!0}),()=>n.removeEventListener("keydown",t,{capture:!0})},[r,n])}(t=>{T===E.layers.size-1&&(s?.(t),!t.defaultPrevented&&x&&(t.preventDefault(),x()))},A),t.useEffect(()=>{if(R)return i&&(0===E.layersWithOutsidePointerEventsDisabled.size&&(d=A.body.style.pointerEvents,A.body.style.pointerEvents="none"),E.layersWithOutsidePointerEventsDisabled.add(R)),E.layers.add(R),w(),()=>{i&&1===E.layersWithOutsidePointerEventsDisabled.size&&(A.body.style.pointerEvents=d)}},[R,A,i,E]),t.useEffect(()=>()=>{R&&(E.layers.delete(R),E.layersWithOutsidePointerEventsDisabled.delete(R),w())},[R,E]),t.useEffect(()=>{const t=()=>O({});return document.addEventListener(p,t),()=>document.removeEventListener(p,t)},[]),c(n.div,{...b,ref:S,style:{pointerEvents:k?W?"auto":"none":void 0,...e.style},onFocusCapture:r(e.onFocusCapture,H.onFocusCapture),onBlurCapture:r(e.onBlurCapture,H.onBlurCapture),onPointerDownCapture:r(e.onPointerDownCapture,F.onPointerDownCapture)})});y.displayName="DismissableLayer";function w(){const t=new CustomEvent(p);document.dispatchEvent(t)}function v(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?o(i,s):i.dispatchEvent(s)}t.forwardRef((e,r)=>{const o=t.useContext(g),i=t.useRef(null),s=a(r,i);return t.useEffect(()=>{const t=i.current;if(t)return o.branches.add(t),()=>{o.branches.delete(t)}},[o.branches]),c(n.div,{...e,ref:s})}).displayName="DismissableLayerBranch";const x=["top","right","bottom","left"],b=Math.min,E=Math.max,R=Math.round,P=Math.floor,A=t=>({x:t,y:t}),O={left:"right",right:"left",bottom:"top",top:"bottom"},S={start:"end",end:"start"};function L(t,e,n){return E(t,b(e,n))}function C(t,e){return"function"==typeof t?t(e):t}function D(t){return t.split("-")[0]}function T(t){return t.split("-")[1]}function k(t){return"x"===t?"y":"x"}function W(t){return"y"===t?"height":"width"}const F=new Set(["top","bottom"]);function H(t){return F.has(D(t))?"y":"x"}function B(t){return k(H(t))}function z(t){return t.replace(/start|end/g,t=>S[t])}const M=["left","right"],N=["right","left"],$=["top","bottom"],_=["bottom","top"];function j(t,e,n,r){const o=T(t);let i=function(t,e,n){switch(t){case"top":case"bottom":return n?e?N:M:e?M:N;case"left":case"right":return e?$:_;default:return[]}}(D(t),"start"===n,r);return o&&(i=i.map(t=>t+"-"+o),e&&(i=i.concat(i.map(z)))),i}function V(t){return t.replace(/left|right|bottom|top/g,t=>O[t])}function Y(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function I(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function X(t,e,n){let{reference:r,floating:o}=t;const i=H(e),s=B(e),a=W(s),l=D(e),c="y"===i,f=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[a]/2-o[a]/2;let p;switch(l){case"top":p={x:f,y:r.y-o.height};break;case"bottom":p={x:f,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(T(e)){case"start":p[s]-=d*(n&&c?-1:1);break;case"end":p[s]+=d*(n&&c?-1:1)}return p}async function q(t,e){var n;void 0===e&&(e={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=C(e,t),m=Y(p),h=a[d?"floating"===u?"reference":"floating":u],g=I(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:f,strategy:l})),y="floating"===u?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,w=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),v=await(null==i.isElement?void 0:i.isElement(w))&&await(null==i.getScale?void 0:i.getScale(w))||{x:1,y:1},x=I(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:l}):y);return{top:(g.top-x.top+m.top)/v.y,bottom:(x.bottom-g.bottom+m.bottom)/v.y,left:(g.left-x.left+m.left)/v.x,right:(x.right-g.right+m.right)/v.x}}function K(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function G(t){return x.some(e=>t[e]>=0)}const J=new Set(["left","top"]);function Q(){return"undefined"!=typeof window}function U(t){return et(t)?(t.nodeName||"").toLowerCase():"#document"}function Z(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function tt(t){var e;return null==(e=(et(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function et(t){return!!Q()&&(t instanceof Node||t instanceof Z(t).Node)}function nt(t){return!!Q()&&(t instanceof Element||t instanceof Z(t).Element)}function rt(t){return!!Q()&&(t instanceof HTMLElement||t instanceof Z(t).HTMLElement)}function ot(t){return!(!Q()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof Z(t).ShadowRoot)}const it=new Set(["inline","contents"]);function st(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=wt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!it.has(o)}const at=new Set(["table","td","th"]);function lt(t){return at.has(U(t))}const ct=[":popover-open",":modal"];function ft(t){return ct.some(e=>{try{return t.matches(e)}catch(t){return!1}})}const ut=["transform","translate","scale","rotate","perspective"],dt=["transform","translate","scale","rotate","perspective","filter"],pt=["paint","layout","strict","content"];function mt(t){const e=ht(),n=nt(t)?wt(t):t;return ut.some(t=>!!n[t]&&"none"!==n[t])||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||dt.some(t=>(n.willChange||"").includes(t))||pt.some(t=>(n.contain||"").includes(t))}function ht(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const gt=new Set(["html","body","#document"]);function yt(t){return gt.has(U(t))}function wt(t){return Z(t).getComputedStyle(t)}function vt(t){return nt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function xt(t){if("html"===U(t))return t;const e=t.assignedSlot||t.parentNode||ot(t)&&t.host||tt(t);return ot(e)?e.host:e}function bt(t){const e=xt(t);return yt(e)?t.ownerDocument?t.ownerDocument.body:t.body:rt(e)&&st(e)?e:bt(e)}function Et(t,e,n){var r;void 0===e&&(e=[]),void 0===n&&(n=!0);const o=bt(t),i=o===(null==(r=t.ownerDocument)?void 0:r.body),s=Z(o);if(i){const t=Rt(s);return e.concat(s,s.visualViewport||[],st(o)?o:[],t&&n?Et(t):[])}return e.concat(o,Et(o,[],n))}function Rt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Pt(t){const e=wt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=rt(t),i=o?t.offsetWidth:n,s=o?t.offsetHeight:r,a=R(n)!==i||R(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function At(t){return nt(t)?t:t.contextElement}function Ot(t){const e=At(t);if(!rt(e))return A(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:i}=Pt(e);let s=(i?R(n.width):n.width)/r,a=(i?R(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const St=A(0);function Lt(t){const e=Z(t);return ht()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:St}function Ct(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=!1);const o=t.getBoundingClientRect(),i=At(t);let s=A(1);e&&(r?nt(r)&&(s=Ot(r)):s=Ot(t));const a=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==Z(t))&&e}(i,n,r)?Lt(i):A(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,f=o.width/s.x,u=o.height/s.y;if(i){const t=Z(i),e=r&&nt(r)?Z(r):r;let n=t,o=Rt(n);for(;o&&r&&e!==n;){const t=Ot(o),e=o.getBoundingClientRect(),r=wt(o),i=e.left+(o.clientLeft+parseFloat(r.paddingLeft))*t.x,s=e.top+(o.clientTop+parseFloat(r.paddingTop))*t.y;l*=t.x,c*=t.y,f*=t.x,u*=t.y,l+=i,c+=s,n=Z(o),o=Rt(n)}}return I({width:f,height:u,x:l,y:c})}function Dt(t,e){const n=vt(t).scrollLeft;return e?e.left+n:Ct(tt(t)).left+n}function Tt(t,e){const n=t.getBoundingClientRect();return{x:n.left+e.scrollLeft-Dt(t,n),y:n.top+e.scrollTop}}const kt=new Set(["absolute","fixed"]);function Wt(t,e,n){let r;if("viewport"===e)r=function(t,e){const n=Z(t),r=tt(t),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const t=ht();(!t||t&&"fixed"===e)&&(a=o.offsetLeft,l=o.offsetTop)}const c=Dt(r);if(c<=0){const t=r.ownerDocument,e=t.body,n=getComputedStyle(e),o="CSS1Compat"===t.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-e.clientWidth-o);s<=25&&(i-=s)}else c<=25&&(i+=c);return{width:i,height:s,x:a,y:l}}(t,n);else if("document"===e)r=function(t){const e=tt(t),n=vt(t),r=t.ownerDocument.body,o=E(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=E(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Dt(t);const a=-n.scrollTop;return"rtl"===wt(r).direction&&(s+=E(e.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}(tt(t));else if(nt(e))r=function(t,e){const n=Ct(t,!0,"fixed"===e),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=rt(t)?Ot(t):A(1);return{width:t.clientWidth*i.x,height:t.clientHeight*i.y,x:o*i.x,y:r*i.y}}(e,n);else{const n=Lt(t);r={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return I(r)}function Ft(t,e){const n=xt(t);return!(n===e||!nt(n)||yt(n))&&("fixed"===wt(n).position||Ft(n,e))}function Ht(t,e,n){const r=rt(e),o=tt(e),i="fixed"===n,s=Ct(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=A(0);function c(){l.x=Dt(o)}if(r||!r&&!i)if(("body"!==U(e)||st(o))&&(a=vt(e)),r){const t=Ct(e,!0,i,e);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else o&&c();i&&!r&&o&&c();const f=!o||r||i?A(0):Tt(o,a);return{x:s.left+a.scrollLeft-l.x-f.x,y:s.top+a.scrollTop-l.y-f.y,width:s.width,height:s.height}}function Bt(t){return"static"===wt(t).position}function zt(t,e){if(!rt(t)||"fixed"===wt(t).position)return null;if(e)return e(t);let n=t.offsetParent;return tt(t)===n&&(n=n.ownerDocument.body),n}function Mt(t,e){const n=Z(t);if(ft(t))return n;if(!rt(t)){let e=xt(t);for(;e&&!yt(e);){if(nt(e)&&!Bt(e))return e;e=xt(e)}return n}let r=zt(t,e);for(;r&<(r)&&Bt(r);)r=zt(r,e);return r&&yt(r)&&Bt(r)&&!mt(r)?n:r||function(t){let e=xt(t);for(;rt(e)&&!yt(e);){if(mt(e))return e;if(ft(e))return null;e=xt(e)}return null}(t)||n}const Nt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const i="fixed"===o,s=tt(r),a=!!e&&ft(e.floating);if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=A(1);const f=A(0),u=rt(r);if((u||!u&&!i)&&(("body"!==U(r)||st(s))&&(l=vt(r)),rt(r))){const t=Ct(r);c=Ot(r),f.x=t.x+r.clientLeft,f.y=t.y+r.clientTop}const d=!s||u||i?A(0):Tt(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+d.x,y:n.y*c.y-l.scrollTop*c.y+f.y+d.y}},getDocumentElement:tt,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const i=[..."clippingAncestors"===n?ft(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let r=Et(t,[],!1).filter(t=>nt(t)&&"body"!==U(t)),o=null;const i="fixed"===wt(t).position;let s=i?xt(t):t;for(;nt(s)&&!yt(s);){const e=wt(s),n=mt(s);n||"fixed"!==e.position||(o=null),(i?!n&&!o:!n&&"static"===e.position&&o&&kt.has(o.position)||st(s)&&!n&&Ft(t,s))?r=r.filter(t=>t!==s):o=e,s=xt(s)}return e.set(t,r),r}(e,this._c):[].concat(n),r],s=i[0],a=i.reduce((t,n)=>{const r=Wt(e,n,o);return t.top=E(r.top,t.top),t.right=b(r.right,t.right),t.bottom=b(r.bottom,t.bottom),t.left=E(r.left,t.left),t},Wt(e,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Mt,getElementRects:async function(t){const e=this.getOffsetParent||Mt,n=this.getDimensions,r=await n(t.floating);return{reference:Ht(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=Pt(t);return{width:e,height:n}},getScale:Ot,isElement:nt,isRTL:function(t){return"rtl"===wt(t).direction}};function $t(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function _t(t,e,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=At(t),f=o||i?[...c?Et(c):[],...Et(e)]:[];f.forEach(t=>{o&&t.addEventListener("scroll",n,{passive:!0}),i&&t.addEventListener("resize",n)});const u=c&&a?function(t,e){let n,r=null;const o=tt(t);function i(){var t;clearTimeout(n),null==(t=r)||t.disconnect(),r=null}return function s(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),i();const c=t.getBoundingClientRect(),{left:f,top:u,width:d,height:p}=c;if(a||e(),!d||!p)return;const m={rootMargin:-P(u)+"px "+-P(o.clientWidth-(f+d))+"px "+-P(o.clientHeight-(u+p))+"px "+-P(f)+"px",threshold:E(0,b(1,l))||1};let h=!0;function g(e){const r=e[0].intersectionRatio;if(r!==l){if(!h)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||$t(c,t.getBoundingClientRect())||s(),h=!1}try{r=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(t){r=new IntersectionObserver(g,m)}r.observe(t)}(!0),i}(c,n):null;let d,p=-1,m=null;s&&(m=new ResizeObserver(t=>{let[r]=t;r&&r.target===c&&m&&(m.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var t;null==(t=m)||t.observe(e)})),n()}),c&&!l&&m.observe(c),m.observe(e));let h=l?Ct(t):null;return l&&function e(){const r=Ct(t);h&&!$t(h,r)&&n();h=r,d=requestAnimationFrame(e)}(),n(),()=>{var t;f.forEach(t=>{o&&t.removeEventListener("scroll",n),i&&t.removeEventListener("resize",n)}),null==u||u(),null==(t=m)||t.disconnect(),m=null,l&&cancelAnimationFrame(d)}}const jt=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=e,l=await async function(t,e){const{placement:n,platform:r,elements:o}=t,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),s=D(n),a=T(n),l="y"===H(n),c=J.has(s)?-1:1,f=i&&l?-1:1,u=C(e,t);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&"number"==typeof m&&(p="end"===a?-1*m:m),l?{x:p*f,y:d*c}:{x:d*c,y:p*f}}(e,t);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},Vt=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o,platform:i}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...c}=C(t,e),f={x:n,y:r},u=await i.detectOverflow(e,c),d=H(D(o)),p=k(d);let m=f[p],h=f[d];if(s){const t="y"===p?"bottom":"right";m=L(m+u["y"===p?"top":"left"],m,m-u[t])}if(a){const t="y"===d?"bottom":"right";h=L(h+u["y"===d?"top":"left"],h,h-u[t])}const g=l.fn({...e,[p]:m,[d]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:s,[d]:a}}}}}},Yt=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=C(t,e);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=D(o),w=H(a),v=D(a)===a,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),b=d||(v||!h?[V(a)]:function(t){const e=V(t);return[z(t),e,z(e)]}(a)),E="none"!==m;!d&&E&&b.push(...j(a,h,m,x));const R=[a,...b],P=await l.detectOverflow(e,g),A=[];let O=(null==(r=i.flip)?void 0:r.overflows)||[];if(f&&A.push(P[y]),u){const t=function(t,e,n){void 0===n&&(n=!1);const r=T(t),o=B(t),i=W(o);let s="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=V(s)),[s,V(s)]}(o,s,x);A.push(P[t[0]],P[t[1]])}if(O=[...O,{placement:o,overflows:A}],!A.every(t=>t<=0)){var S,L;const t=((null==(S=i.flip)?void 0:S.index)||0)+1,e=R[t];if(e){if(!("alignment"===u&&w!==H(e))||O.every(t=>H(t.placement)!==w||t.overflows[0]>0))return{data:{index:t,overflows:O},reset:{placement:e}}}let n=null==(L=O.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:L.placement;if(!n)switch(p){case"bestFit":{var k;const t=null==(k=O.filter(t=>{if(E){const e=H(t.placement);return e===w||"y"===e}return!0}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:k[0];t&&(n=t);break}case"initialPlacement":n=a}if(o!==n)return{reset:{placement:n}}}return{}}}},It=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:i,platform:s,elements:a}=e,{apply:l=()=>{},...c}=C(t,e),f=await s.detectOverflow(e,c),u=D(o),d=T(o),p="y"===H(o),{width:m,height:h}=i.floating;let g,y;"top"===u||"bottom"===u?(g=u,y=d===(await(null==s.isRTL?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(y=u,g="end"===d?"top":"bottom");const w=h-f.top-f.bottom,v=m-f.left-f.right,x=b(h-f[g],w),R=b(m-f[y],v),P=!e.middlewareData.shift;let A=x,O=R;if(null!=(n=e.middlewareData.shift)&&n.enabled.x&&(O=v),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(A=w),P&&!d){const t=E(f.left,0),e=E(f.right,0),n=E(f.top,0),r=E(f.bottom,0);p?O=m-2*(0!==t||0!==e?t+e:E(f.left,f.right)):A=h-2*(0!==n||0!==r?n+r:E(f.top,f.bottom))}await l({...e,availableWidth:O,availableHeight:A});const S=await s.getDimensions(a.floating);return m!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}},Xt=function(t){return void 0===t&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:o="referenceHidden",...i}=C(t,e);switch(o){case"referenceHidden":{const t=K(await r.detectOverflow(e,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:t,referenceHidden:G(t)}}}case"escaped":{const t=K(await r.detectOverflow(e,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:t,escaped:G(t)}}}default:return{}}}}},qt=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=e,{element:c,padding:f=0}=C(t,e)||{};if(null==c)return{};const u=Y(f),d={x:n,y:r},p=B(o),m=W(p),h=await s.getDimensions(c),g="y"===p,y=g?"top":"left",w=g?"bottom":"right",v=g?"clientHeight":"clientWidth",x=i.reference[m]+i.reference[p]-d[p]-i.floating[m],E=d[p]-i.reference[p],R=await(null==s.getOffsetParent?void 0:s.getOffsetParent(c));let P=R?R[v]:0;P&&await(null==s.isElement?void 0:s.isElement(R))||(P=a.floating[v]||i.floating[m]);const A=x/2-E/2,O=P/2-h[m]/2-1,S=b(u[y],O),D=b(u[w],O),k=S,F=P-h[m]-D,H=P/2-h[m]/2+A,z=L(k,H,F),M=!l.arrow&&null!=T(o)&&H!==z&&i.reference[m]/2-(H<k?S:D)-h[m]/2<0,N=M?H<k?H-k:H-F:0;return{[p]:d[p]+N,data:{[p]:z,centerOffset:H-z-N,...M&&{alignmentOffset:N}},reset:M}}}),Kt=function(t){return void 0===t&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=C(t,e),f={x:n,y:r},u=H(o),d=k(u);let p=f[d],m=f[u];const h=C(a,e),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const t="y"===d?"height":"width",e=i.reference[d]-i.floating[t]+g.mainAxis,n=i.reference[d]+i.reference[t]-g.mainAxis;p<e?p=e:p>n&&(p=n)}if(c){var y,w;const t="y"===d?"width":"height",e=J.has(D(o)),n=i.reference[u]-i.floating[t]+(e&&(null==(y=s.offset)?void 0:y[u])||0)+(e?0:g.crossAxis),r=i.reference[u]+i.reference[t]+(e?0:(null==(w=s.offset)?void 0:w[u])||0)-(e?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[d]:p,[u]:m}}}},Gt=(t,e,n)=>{const r=new Map,o={platform:Nt,...n},i={...o.platform,_c:r};return(async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(null==s.isRTL?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:f,y:u}=X(c,r,l),d=r,p={},m=0;for(let n=0;n<a.length;n++){var h;const{name:i,fn:g}=a[n],{x:y,y:w,data:v,reset:x}=await g({x:f,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:c,platform:{...s,detectOverflow:null!=(h=s.detectOverflow)?h:q},elements:{reference:t,floating:e}});f=null!=y?y:f,u=null!=w?w:u,p={...p,[i]:{...p[i],...v}},x&&m<=50&&(m++,"object"==typeof x&&(x.placement&&(d=x.placement),x.rects&&(c=!0===x.rects?await s.getElementRects({reference:t,floating:e,strategy:o}):x.rects),({x:f,y:u}=X(c,d,l))),n=-1)}return{x:f,y:u,placement:d,strategy:o,middlewareData:p}})(t,e,{...o,platform:i})};var Jt="undefined"!=typeof document?e:function(){};function Qt(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if("function"==typeof t&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&"object"==typeof t){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;0!==r--;)if(!Qt(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(("_owner"!==n||!t.$$typeof)&&!Qt(t[n],e[n]))return!1}return!0}return t!=t&&e!=e}function Ut(t){if("undefined"==typeof window)return 1;return(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Zt(t,e){const n=Ut(t);return Math.round(e*n)/n}function te(e){const n=t.useRef(e);return Jt(()=>{n.current=e}),n}function ee(e){void 0===e&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,p]=t.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=t.useState(o);Qt(m,o)||h(o);const[g,y]=t.useState(null),[w,v]=t.useState(null),x=t.useCallback(t=>{t!==P.current&&(P.current=t,y(t))},[]),b=t.useCallback(t=>{t!==A.current&&(A.current=t,v(t))},[]),E=s||g,R=a||w,P=t.useRef(null),A=t.useRef(null),O=t.useRef(d),S=null!=c,L=te(c),C=te(i),D=te(u),T=t.useCallback(()=>{if(!P.current||!A.current)return;const t={placement:n,strategy:r,middleware:m};C.current&&(t.platform=C.current),Gt(P.current,A.current,t).then(t=>{const e={...t,isPositioned:!1!==D.current};k.current&&!Qt(O.current,e)&&(O.current=e,f.flushSync(()=>{p(e)}))})},[m,n,r,C,D]);Jt(()=>{!1===u&&O.current.isPositioned&&(O.current.isPositioned=!1,p(t=>({...t,isPositioned:!1})))},[u]);const k=t.useRef(!1);Jt(()=>(k.current=!0,()=>{k.current=!1}),[]),Jt(()=>{if(E&&(P.current=E),R&&(A.current=R),E&&R){if(L.current)return L.current(E,R,T);T()}},[E,R,T,L,S]);const W=t.useMemo(()=>({reference:P,floating:A,setReference:x,setFloating:b}),[x,b]),F=t.useMemo(()=>({reference:E,floating:R}),[E,R]),H=t.useMemo(()=>{const t={position:r,left:0,top:0};if(!F.floating)return t;const e=Zt(F.floating,d.x),n=Zt(F.floating,d.y);return l?{...t,transform:"translate("+e+"px, "+n+"px)",...Ut(F.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:e,top:n}},[r,l,F.floating,d.x,d.y]);return t.useMemo(()=>({...d,update:T,refs:W,elements:F,floatingStyles:H}),[d,T,W,F,H])}const ne=t=>({name:"arrow",options:t,fn(e){const{element:n,padding:r}="function"==typeof t?t(e):t;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?qt({element:n.current,padding:r}).fn(e):{}:n?qt({element:n,padding:r}).fn(e):{};var o}}),re=(t,e)=>({...jt(t),options:[t,e]}),oe=(t,e)=>({...Vt(t),options:[t,e]}),ie=(t,e)=>({...Yt(t),options:[t,e]}),se=(t,e)=>({...It(t),options:[t,e]}),ae=(t,e)=>({...Xt(t),options:[t,e]}),le=(t,e)=>({...ne(t),options:[t,e]});var ce=t.forwardRef((t,e)=>{const{children:r,width:o=10,height:i=5,...s}=t;return c(n.svg,{...s,ref:e,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:c("polygon",{points:"0,0 30,0 15,10"})})});ce.displayName="Arrow";var fe=ce;function ue(e){const[n,r]=t.useState(void 0);return i(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let o,i;if("borderBoxSize"in n){const t=n.borderBoxSize,e=Array.isArray(t)?t[0]:t;o=e.inlineSize,i=e.blockSize}else o=e.offsetWidth,i=e.offsetHeight;r({width:o,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),n}var de="Popper",[pe,me]=s(de),[he,ge]=pe(de),ye=e=>{const{__scopePopper:n,children:r}=e,[o,i]=t.useState(null);return c(he,{scope:n,anchor:o,onAnchorChange:i,children:r})};ye.displayName=de;var we="PopperAnchor",ve=t.forwardRef((e,r)=>{const{__scopePopper:o,virtualRef:i,...s}=e,l=ge(we,o),f=t.useRef(null),u=a(r,f),d=t.useRef(null);return t.useEffect(()=>{const t=d.current;d.current=i?.current||f.current,t!==d.current&&l.onAnchorChange(d.current)}),i?null:c(n.div,{...s,ref:u})});ve.displayName=we;var xe="PopperContent",[be,Ee]=pe(xe),Re=t.forwardRef((e,r)=>{const{__scopePopper:o,side:s="bottom",sideOffset:f=0,align:u="center",alignOffset:d=0,arrowPadding:p=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:g=0,sticky:y="partial",hideWhenDetached:w=!1,updatePositionStrategy:v="optimized",onPlaced:x,...b}=e,E=ge(xe,o),[R,P]=t.useState(null),A=a(r,t=>P(t)),[O,S]=t.useState(null),L=ue(O),C=L?.width??0,D=L?.height??0,T=s+("center"!==u?"-"+u:""),k="number"==typeof g?g:{top:0,right:0,bottom:0,left:0,...g},W=Array.isArray(h)?h:[h],F=W.length>0,H={padding:k,boundary:W.filter(Se),altBoundary:F},{refs:B,floatingStyles:z,placement:M,isPositioned:N,middlewareData:$}=ee({strategy:"fixed",placement:T,whileElementsMounted:(...t)=>_t(...t,{animationFrame:"always"===v}),elements:{reference:E.anchor},middleware:[re({mainAxis:f+D,alignmentAxis:d}),m&&oe({mainAxis:!0,crossAxis:!1,limiter:"partial"===y?{...Kt(_),options:[_,j]}:void 0,...H}),m&&ie({...H}),se({...H,apply:({elements:t,rects:e,availableWidth:n,availableHeight:r})=>{const{width:o,height:i}=e.reference,s=t.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${o}px`),s.setProperty("--radix-popper-anchor-height",`${i}px`)}}),O&&le({element:O,padding:p}),Le({arrowWidth:C,arrowHeight:D}),w&&ae({strategy:"referenceHidden",...H})]});var _,j;const[V,Y]=Ce(M),I=l(x);i(()=>{N&&I?.()},[N,I]);const X=$.arrow?.x,q=$.arrow?.y,K=0!==$.arrow?.centerOffset,[G,J]=t.useState();return i(()=>{R&&J(window.getComputedStyle(R).zIndex)},[R]),c("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:N?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[$.transformOrigin?.x,$.transformOrigin?.y].join(" "),...$.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c(be,{scope:o,placedSide:V,onArrowChange:S,arrowX:X,arrowY:q,shouldHideArrow:K,children:c(n.div,{"data-side":V,"data-align":Y,...b,ref:A,style:{...b.style,animation:N?void 0:"none"}})})})});Re.displayName=xe;var Pe="PopperArrow",Ae={top:"bottom",right:"left",bottom:"top",left:"right"},Oe=t.forwardRef(function(t,e){const{__scopePopper:n,...r}=t,o=Ee(Pe,n),i=Ae[o.placedSide];return c("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:c(fe,{...r,ref:e,style:{...r.style,display:"block"}})})});function Se(t){return null!==t}Oe.displayName=Pe;var Le=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:o}=e,i=0!==o.arrow?.centerOffset,s=i?0:t.arrowWidth,a=i?0:t.arrowHeight,[l,c]=Ce(n),f={start:"0%",center:"50%",end:"100%"}[c],u=(o.arrow?.x??0)+s/2,d=(o.arrow?.y??0)+a/2;let p="",m="";return"bottom"===l?(p=i?f:`${u}px`,m=-a+"px"):"top"===l?(p=i?f:`${u}px`,m=`${r.floating.height+a}px`):"right"===l?(p=-a+"px",m=i?f:`${d}px`):"left"===l&&(p=`${r.floating.width+a}px`,m=i?f:`${d}px`),{data:{x:p,y:m}}}});function Ce(t){const[e,n="center"]=t.split("-");return[e,n]}var De=ye,Te=ve,ke=Re,We=Oe,Fe=t.forwardRef((e,r)=>{const{container:o,...s}=e,[a,l]=t.useState(!1);i(()=>l(!0),[]);const f=o||a&&globalThis?.document?.body;return f?u.createPortal(c(n.div,{...s,ref:r}),f):null});Fe.displayName="Portal";export{Te as A,ke as C,y as D,Fe as P,De as R,We as a,_t as b,me as c,nt as d,ue as e,ie as f,ot as i,re as o,oe as s,ee as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import r from"react";import{c as n}from"./index-17323747.js";import{c as t,u as o}from"./index-91a5b8d5.js";import{jsx as
|
|
1
|
+
import*as e from"react";import r from"react";import{c as n}from"./index-17323747.js";import{c as t,u as o}from"./index-91a5b8d5.js";import{jsx as i}from"react/jsx-runtime";function l(r){const n=c(r),t=e.forwardRef((r,t)=>{const{children:o,...l}=r,c=e.Children.toArray(o),s=c.find(a);if(s){const r=s.props.children,o=c.map(n=>n===s?e.Children.count(r)>1?e.Children.only(null):e.isValidElement(r)?r.props.children:null:n);return i(n,{...l,ref:t,children:e.isValidElement(r)?e.cloneElement(r,void 0,o):null})}return i(n,{...l,ref:t,children:o})});return t.displayName=`${r}.Slot`,t}function c(r){const n=e.forwardRef((r,n)=>{const{children:o,...i}=r;if(e.isValidElement(o)){const r=function(e){let r=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=r&&"isReactWarning"in r&&r.isReactWarning;if(n)return e.ref;if(r=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=r&&"isReactWarning"in r&&r.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(o),l=function(e,r){const n={...r};for(const t in r){const o=e[t],i=r[t];/^on[A-Z]/.test(t)?o&&i?n[t]=(...e)=>{const r=i(...e);return o(...e),r}:o&&(n[t]=o):"style"===t?n[t]={...o,...i}:"className"===t&&(n[t]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(i,o.props);return o.type!==e.Fragment&&(l.ref=n?t(n,r):r),e.cloneElement(o,l)}return e.Children.count(o)>1?e.Children.only(null):null});return n.displayName=`${r}.SlotClone`,n}var s=Symbol("radix.slottable");function a(r){return e.isValidElement(r)&&"function"==typeof r.type&&"__radixId"in r.type&&r.type.__radixId===s}function f(e){const t=e+"CollectionProvider",[c,s]=n(t),[a,f]=c(t,{collectionRef:{current:null},itemMap:new Map}),u=e=>{const{scope:n,children:t}=e,o=r.useRef(null),l=r.useRef(new Map).current;return i(a,{scope:n,itemMap:l,collectionRef:o,children:t})};u.displayName=t;const d=e+"CollectionSlot",p=l(d),m=r.forwardRef((e,r)=>{const{scope:n,children:t}=e,l=f(d,n),c=o(r,l.collectionRef);return i(p,{ref:c,children:t})});m.displayName=d;const y=e+"CollectionItemSlot",h="data-radix-collection-item",R=l(y),C=r.forwardRef((e,n)=>{const{scope:t,children:l,...c}=e,s=r.useRef(null),a=o(n,s),u=f(y,t);return r.useEffect(()=>(u.itemMap.set(s,{ref:s,...c}),()=>{u.itemMap.delete(s)})),i(R,{[h]:"",ref:a,children:l})});return C.displayName=y,[{Provider:u,Slot:m,ItemSlot:C},function(n){const t=f(e+"CollectionConsumer",n);return r.useCallback(()=>{const e=t.collectionRef.current;if(!e)return[];const r=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(t.itemMap.values()).sort((e,n)=>r.indexOf(e.ref.current)-r.indexOf(n.ref.current))},[t.collectionRef,t.itemMap])},s]}export{f as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{c as o,P as r,a as t}from"./index-17323747.js";import{c as n}from"./index-
|
|
1
|
+
import*as e from"react";import{c as o,P as r,a as t}from"./index-17323747.js";import{c as n}from"./index-5b487f4e.js";import{u as a}from"./index-91a5b8d5.js";import{u as s}from"./index-ce60ba41.js";import{u}from"./index-70f4e709.js";import{u as i}from"./index-ff0e3962.js";import{u as c}from"./index-13505606.js";import{jsx as l}from"react/jsx-runtime";var f="rovingFocusGroup.onEntryFocus",p={bubbles:!1,cancelable:!0},d="RovingFocusGroup",[m,v,b]=n(d),[w,g]=o(d,[b]),[h,F]=w(d),I=e.forwardRef((e,o)=>l(m.Provider,{scope:e.__scopeRovingFocusGroup,children:l(m.Slot,{scope:e.__scopeRovingFocusGroup,children:l(R,{...e,ref:o})})}));I.displayName=d;var R=e.forwardRef((o,n)=>{const{__scopeRovingFocusGroup:s,orientation:m,loop:b=!1,dir:w,currentTabStopId:g,defaultCurrentTabStopId:F,onCurrentTabStopIdChange:I,onEntryFocus:R,preventScrollOnEntryFocus:y=!1,...S}=o,T=e.useRef(null),A=a(n,T),E=c(w),[D,C]=i({prop:g,defaultProp:F??null,onChange:I,caller:d}),[j,_]=e.useState(!1),G=u(R),K=v(s),k=e.useRef(!1),[L,P]=e.useState(0);return e.useEffect(()=>{const e=T.current;if(e)return e.addEventListener(f,G),()=>e.removeEventListener(f,G)},[G]),l(h,{scope:s,orientation:m,dir:E,loop:b,currentTabStopId:D,onItemFocus:e.useCallback(e=>C(e),[C]),onItemShiftTab:e.useCallback(()=>_(!0),[]),onFocusableItemAdd:e.useCallback(()=>P(e=>e+1),[]),onFocusableItemRemove:e.useCallback(()=>P(e=>e-1),[]),children:l(r.div,{tabIndex:j||0===L?-1:0,"data-orientation":m,...S,ref:A,style:{outline:"none",...o.style},onMouseDown:t(o.onMouseDown,()=>{k.current=!0}),onFocus:t(o.onFocus,e=>{const o=!k.current;if(e.target===e.currentTarget&&o&&!j){const o=new CustomEvent(f,p);if(e.currentTarget.dispatchEvent(o),!o.defaultPrevented){const e=K().filter(e=>e.focusable);x([e.find(e=>e.active),e.find(e=>e.id===D),...e].filter(Boolean).map(e=>e.ref.current),y)}}k.current=!1}),onBlur:t(o.onBlur,()=>_(!1))})})}),y="RovingFocusGroupItem",S=e.forwardRef((o,n)=>{const{__scopeRovingFocusGroup:a,focusable:u=!0,active:i=!1,tabStopId:c,children:f,...p}=o,d=s(),b=c||d,w=F(y,a),g=w.currentTabStopId===b,h=v(a),{onFocusableItemAdd:I,onFocusableItemRemove:R,currentTabStopId:S}=w;return e.useEffect(()=>{if(u)return I(),()=>R()},[u,I,R]),l(m.ItemSlot,{scope:a,id:b,focusable:u,active:i,children:l(r.span,{tabIndex:g?0:-1,"data-orientation":w.orientation,...p,ref:n,onMouseDown:t(o.onMouseDown,e=>{u?w.onItemFocus(b):e.preventDefault()}),onFocus:t(o.onFocus,()=>w.onItemFocus(b)),onKeyDown:t(o.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void w.onItemShiftTab();if(e.target!==e.currentTarget)return;const o=function(e,o,r){const t=function(e,o){return"rtl"!==o?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===o&&["ArrowLeft","ArrowRight"].includes(t)||"horizontal"===o&&["ArrowUp","ArrowDown"].includes(t)?void 0:T[t]}(e,w.orientation,w.dir);if(void 0!==o){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===o)n.reverse();else if("prev"===o||"next"===o){"prev"===o&&n.reverse();const a=n.indexOf(e.currentTarget);n=w.loop?(t=a+1,(r=n).map((e,o)=>r[(t+o)%r.length])):n.slice(a+1)}setTimeout(()=>x(n))}var r,t}),children:"function"==typeof f?f({isCurrentTabStop:g,hasTabStop:null!=S}):f})})});S.displayName=y;var T={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function x(e,o=!1){const r=document.activeElement;for(const t of e){if(t===r)return;if(t.focus({preventScroll:o}),document.activeElement!==r)return}}var A=I,E=S;export{E as I,A as R,g as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{u as n}from"./index-91a5b8d5.js";import{u as t}from"./index-17323747.js";var r=r=>{const{present:o,children:u}=r,s=function(n){const[r,o]=e.useState(),u=e.useRef(null),s=e.useRef(n),a=e.useRef("none"),c=n?"mounted":"unmounted",[d
|
|
1
|
+
import*as e from"react";import{u as n}from"./index-91a5b8d5.js";import{u as t}from"./index-17323747.js";var r=r=>{const{present:o,children:u}=r,s=function(n){const[r,o]=e.useState(),u=e.useRef(null),s=e.useRef(n),a=e.useRef("none"),c=n?"mounted":"unmounted",[m,d]=function(n,t){return e.useReducer((e,n)=>t[e][n]??e,n)}(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return e.useEffect(()=>{const e=i(u.current);a.current="mounted"===m?e:"none"},[m]),t(()=>{const e=u.current,t=s.current;if(t!==n){const r=a.current,o=i(e);if(n)d("MOUNT");else if("none"===o||"none"===e?.display)d("UNMOUNT");else{d(t&&r!==o?"ANIMATION_OUT":"UNMOUNT")}s.current=n}},[n,d]),t(()=>{if(r){let e;const n=r.ownerDocument.defaultView??window,t=t=>{const o=i(u.current).includes(CSS.escape(t.animationName));if(t.target===r&&o&&(d("ANIMATION_END"),!s.current)){const t=r.style.animationFillMode;r.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===r.style.animationFillMode&&(r.style.animationFillMode=t)})}},o=e=>{e.target===r&&(a.current=i(u.current))};return r.addEventListener("animationstart",o),r.addEventListener("animationcancel",t),r.addEventListener("animationend",t),()=>{n.clearTimeout(e),r.removeEventListener("animationstart",o),r.removeEventListener("animationcancel",t),r.removeEventListener("animationend",t)}}d("ANIMATION_END")},[r,d]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:e.useCallback(e=>{u.current=e?getComputedStyle(e):null,o(e)},[])}}(o),a="function"==typeof u?u({present:s.isPresent}):e.Children.only(u),c=n(s.ref,function(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=n&&"isReactWarning"in n&&n.isReactWarning;if(t)return e.ref;if(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t)return e.props.ref;return e.props.ref||e.ref}(a));return"function"==typeof u||s.isPresent?e.cloneElement(a,{ref:c}):null};function i(e){return e?.animationName||"none"}r.displayName="Presence";export{r as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./_tslib-35bb891d.js";import{jsx as r}from"react/jsx-runtime";import*as a from"react";import"react-dom";import{c as t}from"./index-a5cba5f7.js";import{c as o}from"./button-f335deaa.js";import{c as s}from"./utils-3345eade.js";var i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,o)=>{const s=t(`Primitive.${o}`),i=a.forwardRef((e,a)=>{const{asChild:t,...i}=e,l=t?s:o;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),r(l,{...i,ref:a})});return i.displayName=`Primitive.${o}`,{...e,[o]:i}},{}),l=a.forwardRef((e,a)=>r(i.label,{...e,ref:a,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));l.displayName="Label";var n=l;const m=o("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=a.forwardRef((a,t)=>{var{className:o}=a,i=e(a,["className"]);return r(n,Object.assign({ref:t,className:s(m(),o)},i))});d.displayName=n.displayName;export{d as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as a,jsx as o}from"react/jsx-runtime";import{useYooptaReadOnly as e}from"@yoopta/editor";import{S as s,a as t,b as n,c as r,d as i}from"./select-
|
|
1
|
+
import{jsxs as a,jsx as o}from"react/jsx-runtime";import{useYooptaReadOnly as e}from"@yoopta/editor";import{S as s,a as t,b as n,c as r,d as i}from"./select-a3724728.js";import{c as l}from"./utils-3345eade.js";const c=({value:c,options:p,onValueChange:m,currentLabel:u,className:d,style:g})=>{const b=e();return a(s,Object.assign({value:c,onValueChange:m,disabled:b},{children:[o(t,Object.assign({size:"sm",className:l("h-7 gap-1.5 text-xs font-mono border-transparent hover:border-current/20",d),style:g,contentEditable:!1,onMouseDown:a=>a.stopPropagation(),onClick:a=>a.stopPropagation()},{children:o(n,Object.assign({placeholder:u},{children:u}))})),o(r,Object.assign({align:"start",position:"popper",className:"max-h-[200px]",onMouseDown:a=>a.stopPropagation(),onClick:a=>a.stopPropagation()},{children:p.map(a=>o(i,Object.assign({value:a.value,className:"text-xs font-mono"},{children:a.label}),a.value))}))]}))};export{c as L};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{c as e}from"./createLucideIcon-8605f860.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.294.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const s=e("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);export{s as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./_tslib-35bb891d.js";import{jsx as o}from"react/jsx-runtime";import*as r from"react";import{c as t,P as n,a}from"./index-17323747.js";import{c as s,u as i}from"./index-91a5b8d5.js";import{c,A as d,D as l,C as p,a as u,P as f,R as m}from"./index-371259c9.js";import{h,R as v,u as g,F as P}from"./Combination-575d4475.js";import{u as C}from"./index-ce60ba41.js";import{P as y}from"./index-bd6363d4.js";import{u as O}from"./index-ff0e3962.js";import{c as b}from"./utils-3345eade.js";function R(e){const o=r.forwardRef((e,o)=>{const{children:t,...n}=e;if(r.isValidElement(t)){const e=function(e){let o=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=o&&"isReactWarning"in o&&o.isReactWarning;if(r)return e.ref;if(o=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=o&&"isReactWarning"in o&&o.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(t),a=function(e,o){const r={...o};for(const t in o){const n=e[t],a=o[t];/^on[A-Z]/.test(t)?n&&a?r[t]=(...e)=>{const o=a(...e);return n(...e),o}:n&&(r[t]=n):"style"===t?r[t]={...n,...a}:"className"===t&&(r[t]=[n,a].filter(Boolean).join(" "))}return{...e,...r}}(n,t.props);return t.type!==r.Fragment&&(a.ref=o?s(o,e):e),r.cloneElement(t,a)}return r.Children.count(t)>1?r.Children.only(null):null});return o.displayName=`${e}.SlotClone`,o}var w=Symbol("radix.slottable");function _(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===w}var x="Popover",[A,F]=t(x,[c]),D=c(),[E,N]=A(x),j=e=>{const{__scopePopover:t,children:n,open:a,defaultOpen:s,onOpenChange:i,modal:c=!1}=e,d=D(t),l=r.useRef(null),[p,u]=r.useState(!1),[f,h]=O({prop:a,defaultProp:s??!1,onChange:i,caller:x});return o(m,{...d,children:o(E,{scope:t,contentId:C(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:r.useCallback(()=>h(e=>!e),[h]),hasCustomAnchor:p,onCustomAnchorAdd:r.useCallback(()=>u(!0),[]),onCustomAnchorRemove:r.useCallback(()=>u(!1),[]),modal:c,children:n})})};j.displayName=x;var k="PopoverAnchor";r.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,s=N(k,n),i=D(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=s;return r.useEffect(()=>(c(),()=>l()),[c,l]),o(d,{...i,...a,ref:t})}).displayName=k;var I="PopoverTrigger",M=r.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,c=N(I,t),l=D(t),p=i(r,c.triggerRef),u=o(n.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":G(c.open),...s,ref:p,onClick:a(e.onClick,c.onOpenToggle)});return c.hasCustomAnchor?u:o(d,{asChild:!0,...l,children:u})});M.displayName=I;var S="PopoverPortal",[z,V]=A(S,{forceMount:void 0}),W=e=>{const{__scopePopover:r,forceMount:t,children:n,container:a}=e,s=N(S,r);return o(z,{scope:r,forceMount:t,children:o(y,{present:t||s.open,children:o(f,{asChild:!0,container:a,children:n})})})};W.displayName=S;var K="PopoverContent",T=r.forwardRef((e,r)=>{const t=V(K,e.__scopePopover),{forceMount:n=t.forceMount,...a}=e,s=N(K,e.__scopePopover);return o(y,{present:n||s.open,children:s.modal?o($,{...a,ref:r}):o(B,{...a,ref:r})})});T.displayName=K;var Z=function(e){const t=R(e),n=r.forwardRef((e,n)=>{const{children:a,...s}=e,i=r.Children.toArray(a),c=i.find(_);if(c){const e=c.props.children,a=i.map(o=>o===c?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:o);return o(t,{...s,ref:n,children:r.isValidElement(e)?r.cloneElement(e,void 0,a):null})}return o(t,{...s,ref:n,children:a})});return n.displayName=`${e}.Slot`,n}("PopoverContent.RemoveScroll"),$=r.forwardRef((e,t)=>{const n=N(K,e.__scopePopover),s=r.useRef(null),c=i(t,s),d=r.useRef(!1);return r.useEffect(()=>{const e=s.current;if(e)return h(e)},[]),o(v,{as:Z,allowPinchZoom:!0,children:o(U,{...e,ref:c,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:a(e.onCloseAutoFocus,e=>{e.preventDefault(),d.current||n.triggerRef.current?.focus()}),onPointerDownOutside:a(e.onPointerDownOutside,e=>{const o=e.detail.originalEvent,r=0===o.button&&!0===o.ctrlKey,t=2===o.button||r;d.current=t},{checkForDefaultPrevented:!1}),onFocusOutside:a(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),B=r.forwardRef((e,t)=>{const n=N(K,e.__scopePopover),a=r.useRef(!1),s=r.useRef(!1);return o(U,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(a.current||n.triggerRef.current?.focus(),o.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(a.current=!0,"pointerdown"===o.detail.originalEvent.type&&(s.current=!0));const r=o.target,t=n.triggerRef.current?.contains(r);t&&o.preventDefault(),"focusin"===o.detail.originalEvent.type&&s.current&&o.preventDefault()}})}),U=r.forwardRef((e,r)=>{const{__scopePopover:t,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,...m}=e,h=N(K,t),v=D(t);return g(),o(P,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o(l,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:o(p,{"data-state":G(h.open),role:"dialog",id:h.contentId,...v,...m,ref:r,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),q="PopoverClose";r.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,i=N(q,t);return o(n.button,{type:"button",...s,ref:r,onClick:a(e.onClick,()=>i.onOpenChange(!1))})}).displayName=q;function G(e){return e?"open":"closed"}r.forwardRef((e,r)=>{const{__scopePopover:t,...n}=e,a=D(t);return o(u,{...a,...n,ref:r})}).displayName="PopoverArrow";var H=W,J=T;const L=j,Q=M,X=r.forwardRef((r,t)=>{var{className:n,align:a="center",sideOffset:s=4}=r,i=e(r,["className","align","sideOffset"]);return o(H,{children:o(J,Object.assign({ref:t,align:a,sideOffset:s,className:b("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",n)},i))})});X.displayName=J.displayName;export{L as P,Q as a,X as b};
|