ragbits-chat 1.4.0.dev202511290233__py3-none-any.whl → 1.4.0.dev202512030235__py3-none-any.whl
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.
- ragbits/chat/ui-build/assets/{AuthGuard-BTxv1Dj_.js → AuthGuard-0_PL4fVX.js} +1 -1
- ragbits/chat/ui-build/assets/{ChatHistory-C7A2uiIQ.js → ChatHistory-DXJFh5OF.js} +2 -2
- ragbits/chat/ui-build/assets/{ChatOptionsForm-x2g6iEPU.js → ChatOptionsForm-qNtrae8b.js} +1 -1
- ragbits/chat/ui-build/assets/{FeedbackForm-BPycljsV.js → FeedbackForm-D54-Ucqr.js} +1 -1
- ragbits/chat/ui-build/assets/{Login-BWGQs3cn.js → Login-Owv53qnj.js} +1 -1
- ragbits/chat/ui-build/assets/{LogoutButton-gJF91B1i.js → LogoutButton-CmhKreNa.js} +1 -1
- ragbits/chat/ui-build/assets/{ShareButton-DS3Dsf4s.js → ShareButton-DayYwYWS.js} +1 -1
- ragbits/chat/ui-build/assets/{UsageButton-Bu-ZOHWk.js → UsageButton-DstwX8_2.js} +1 -1
- ragbits/chat/ui-build/assets/{authStore-w3touTBX.js → authStore-Dtjh8LvS.js} +1 -1
- ragbits/chat/ui-build/assets/{chunk-IGSAU2ZA-CZpYjJJG.js → chunk-IGSAU2ZA-DCwEaDm9.js} +1 -1
- ragbits/chat/ui-build/assets/{chunk-SSA7SXE4-26fqANp7.js → chunk-SSA7SXE4-D2nwPcpz.js} +1 -1
- ragbits/chat/ui-build/assets/{index-BMhtIjmr.js → index-BAUrj1ow.js} +1 -1
- ragbits/chat/ui-build/assets/index-CN_ylOby.js +1 -0
- ragbits/chat/ui-build/assets/{index-V0bFpjmJ.js → index-CYAMgynD.js} +2 -2
- ragbits/chat/ui-build/assets/{index-aPw21Xcf.js → index-anmhb6wk.js} +6 -6
- ragbits/chat/ui-build/assets/{useMenuTriggerState-B-4lUpkM.js → useMenuTriggerState-C6GDlwil.js} +1 -1
- ragbits/chat/ui-build/assets/{useSelectableItem-BaL4tj6I.js → useSelectableItem-BIhPf2mL.js} +1 -1
- ragbits/chat/ui-build/index.html +1 -1
- {ragbits_chat-1.4.0.dev202511290233.dist-info → ragbits_chat-1.4.0.dev202512030235.dist-info}/METADATA +2 -2
- {ragbits_chat-1.4.0.dev202511290233.dist-info → ragbits_chat-1.4.0.dev202512030235.dist-info}/RECORD +21 -21
- ragbits/chat/ui-build/assets/index-BoBogvMe.js +0 -1
- {ragbits_chat-1.4.0.dev202511290233.dist-info → ragbits_chat-1.4.0.dev202512030235.dist-info}/WHEEL +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as s,aW as c,h as x,aE as g,bp as m,bq as p,br as v,bs as b,bt as j}from"./index-
|
|
1
|
+
import{r as a,j as s,aW as c,h as x,aE as g,bp as m,bq as p,br as v,bs as b,bt as j}from"./index-anmhb6wk.js";import{a as r}from"./authStore-Dtjh8LvS.js";const k=a.createContext(null);function A({children:o}){const[n]=a.useState(()=>r);return s.jsx(k.Provider,{value:n,children:o})}function C(){const{token:o,tokenExpiration:n,logout:l}=c(r,e=>e),i=x(e=>e.isLoading),u=g(),d=a.useRef(i);a.useEffect(()=>{d.current=i},[i]);const t=a.useCallback(()=>{const e=()=>{d.current?setTimeout(e,500):(l(),u("/login"))};e()},[l,u]);return a.useEffect(()=>{if(!o||!n)return;const e=Date.now(),h=n-e;if(h<=0){t();return}const f=setTimeout(()=>{t()},h);return()=>clearTimeout(f)},[o,n,t]),null}function S({children:o}){const n=m(),l=c(r,t=>t.isAuthenticated),i=c(r,t=>t.hasHydrated),u=c(r,t=>t.token?.access_token),d=c(r,t=>t.logout);return i?n.pathname==="/login"?o:l&&u?s.jsx(A,{children:s.jsxs(v,{baseUrl:b,auth:{getToken:()=>u,onUnauthorized:d},children:[o,s.jsx(C,{})]})}):s.jsx(j,{to:"/login",replace:!0}):s.jsx(p,{})}export{S as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as P,t as ae,k as Xe,Z as W,ax as Me,$ as Ze,j as t,q as me,L as xe,_ as Ye,n as ye,T as Pe,s as et,v as R,V as tt,d as X,l as se,aq as Ie,o as ot,H as ke,a9 as rt,J as Ne,ay as at,ac as pe,U as st,X as _e,af as he,az as nt,aA as lt,ag as it,K as dt,O as be,Q as ct,W as ut,a0 as pt,ah as ft,a2 as K,a3 as Ae,ai as vt,R as ht,aB as bt,a8 as gt,aC as mt,aD as xt,a5 as yt,a as Pt,aE as Ct,i as fe,aF as Ce,aG as ve,D as we,I as Q,as as wt,aH as $t,aI as $e}from"./index-aPw21Xcf.js";import{u as jt,b as St,c as je,d as Dt,e as Mt,m as It,$ as kt,a as Nt}from"./useMenuTriggerState-B-4lUpkM.js";import{$ as _t}from"./useSelectableItem-BaL4tj6I.js";import{i as At}from"./chunk-SSA7SXE4-26fqANp7.js";var Ot=(e,r)=>{var n;let s=[];const a=(n=P.Children.map(e,d=>P.isValidElement(d)&&d.type===r?(s.push(d),null):d))==null?void 0:n.filter(Boolean),u=s.length>=0?s:void 0;return[a,u]},Ft=ae({base:["w-full","p-1","min-w-[200px]"]});ae({slots:{base:["flex","group","gap-2","items-center","justify-between","relative","px-2","py-1.5","w-full","h-full","box-border","rounded-small","outline-hidden","cursor-pointer","tap-highlight-transparent","data-[pressed=true]:opacity-70",...Xe,"data-[focus-visible=true]:dark:ring-offset-background-content1"],wrapper:"w-full flex flex-col items-start justify-center",title:"flex-1 text-small font-normal truncate",description:["w-full","text-tiny","text-foreground-500","group-hover:text-current"],selectedIcon:["text-inherit","w-3","h-3","shrink-0"],shortcut:["px-1","py-0.5","rounded-sm","font-sans","text-foreground-500","text-tiny","border-small","border-default-300","group-hover:border-current"]},variants:{variant:{solid:{base:""},bordered:{base:"border-medium border-transparent bg-transparent"},light:{base:"bg-transparent"},faded:{base:"border-small border-transparent hover:border-default data-[hover=true]:bg-default-100"},flat:{base:""},shadow:{base:"data-[hover=true]:shadow-lg"}},color:{default:{},primary:{},secondary:{},success:{},warning:{},danger:{}},isDisabled:{true:{base:"opacity-disabled pointer-events-none"}},disableAnimation:{true:{},false:{}}},defaultVariants:{variant:"solid",color:"default"},compoundVariants:[{variant:"solid",color:"default",class:{base:"data-[hover=true]:bg-default data-[hover=true]:text-default-foreground"}},{variant:"solid",color:"primary",class:{base:"data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground"}},{variant:"solid",color:"secondary",class:{base:"data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground"}},{variant:"solid",color:"success",class:{base:"data-[hover=true]:bg-success data-[hover=true]:text-success-foreground"}},{variant:"solid",color:"warning",class:{base:"data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground"}},{variant:"solid",color:"danger",class:{base:"data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground"}},{variant:"shadow",color:"default",class:{base:"data-[hover=true]:shadow-default/50 data-[hover=true]:bg-default data-[hover=true]:text-default-foreground"}},{variant:"shadow",color:"primary",class:{base:"data-[hover=true]:shadow-primary/30 data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground"}},{variant:"shadow",color:"secondary",class:{base:"data-[hover=true]:shadow-secondary/30 data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground"}},{variant:"shadow",color:"success",class:{base:"data-[hover=true]:shadow-success/30 data-[hover=true]:bg-success data-[hover=true]:text-success-foreground"}},{variant:"shadow",color:"warning",class:{base:"data-[hover=true]:shadow-warning/30 data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground"}},{variant:"shadow",color:"danger",class:{base:"data-[hover=true]:shadow-danger/30 data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground"}},{variant:"bordered",color:"default",class:{base:"data-[hover=true]:border-default"}},{variant:"bordered",color:"primary",class:{base:"data-[hover=true]:border-primary data-[hover=true]:text-primary"}},{variant:"bordered",color:"secondary",class:{base:"data-[hover=true]:border-secondary data-[hover=true]:text-secondary"}},{variant:"bordered",color:"success",class:{base:"data-[hover=true]:border-success data-[hover=true]:text-success"}},{variant:"bordered",color:"warning",class:{base:"data-[hover=true]:border-warning data-[hover=true]:text-warning"}},{variant:"bordered",color:"danger",class:{base:"data-[hover=true]:border-danger data-[hover=true]:text-danger"}},{variant:"flat",color:"default",class:{base:"data-[hover=true]:bg-default/40 data-[hover=true]:text-default-foreground"}},{variant:"flat",color:"primary",class:{base:"data-[hover=true]:bg-primary/20 data-[hover=true]:text-primary"}},{variant:"flat",color:"secondary",class:{base:"data-[hover=true]:bg-secondary/20 data-[hover=true]:text-secondary"}},{variant:"flat",color:"success",class:{base:"data-[hover=true]:bg-success/20 data-[hover=true]:text-success "}},{variant:"flat",color:"warning",class:{base:"data-[hover=true]:bg-warning/20 data-[hover=true]:text-warning"}},{variant:"flat",color:"danger",class:{base:"data-[hover=true]:bg-danger/20 data-[hover=true]:text-danger"}},{variant:"faded",color:"default",class:{base:"data-[hover=true]:text-default-foreground"}},{variant:"faded",color:"primary",class:{base:"data-[hover=true]:text-primary"}},{variant:"faded",color:"secondary",class:{base:"data-[hover=true]:text-secondary"}},{variant:"faded",color:"success",class:{base:"data-[hover=true]:text-success"}},{variant:"faded",color:"warning",class:{base:"data-[hover=true]:text-warning"}},{variant:"faded",color:"danger",class:{base:"data-[hover=true]:text-danger"}},{variant:"light",color:"default",class:{base:"data-[hover=true]:text-default-500"}},{variant:"light",color:"primary",class:{base:"data-[hover=true]:text-primary"}},{variant:"light",color:"secondary",class:{base:"data-[hover=true]:text-secondary"}},{variant:"light",color:"success",class:{base:"data-[hover=true]:text-success"}},{variant:"light",color:"warning",class:{base:"data-[hover=true]:text-warning"}},{variant:"light",color:"danger",class:{base:"data-[hover=true]:text-danger"}}]});ae({slots:{base:"relative mb-2",heading:"pl-1 text-tiny text-foreground-500",group:"data-[has-title=true]:pt-1",divider:"mt-2"}});ae({base:"w-full flex flex-col gap-0.5 p-1"});var Et=(e,r)=>{if(!e&&!r)return{};const n=new Set([...Object.keys(e||{}),...Object.keys(r||{})]);return Array.from(n).reduce((s,a)=>({...s,[a]:W(e?.[a],r?.[a])}),{})},[Tt,Oe]=Me({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Popover />`"}),Se=()=>Ye(()=>import("./index-BoBogvMe.js"),__vite__mapDeps([0,1,2])).then(e=>e.default),Fe=e=>{const{as:r,children:n,className:s,...a}=e,{Component:u,placement:d,backdrop:h,motionProps:l,disableAnimation:c,getPopoverProps:p,getDialogProps:w,getBackdropProps:b,getContentProps:x,isNonModal:I,onClose:j}=Oe(),f=P.useRef(null),{dialogProps:M,titleProps:D}=Ze({},f),y=w({ref:f,...M,...a}),S=r||u||"div",i=t.jsxs(t.Fragment,{children:[!I&&t.jsx(me,{onDismiss:j}),t.jsx(S,{...y,children:t.jsx("div",{...x({className:s}),children:typeof n=="function"?n(D):n})}),t.jsx(me,{onDismiss:j})]}),v=P.useMemo(()=>h==="transparent"?null:c?t.jsx("div",{...b()}):t.jsx(xe,{features:Se,children:t.jsx(ye.div,{animate:"enter",exit:"exit",initial:"exit",variants:Pe.fade,...b()})}),[h,c,b]),k=d?et(d==="center"?"top":d):void 0,o=t.jsx(t.Fragment,{children:c?i:t.jsx(xe,{features:Se,children:t.jsx(ye.div,{animate:"enter",exit:"exit",initial:"initial",style:k,variants:Pe.scaleSpringOpacity,...l,children:i})})});return t.jsxs("div",{...p(),children:[v,o]})};Fe.displayName="HeroUI.PopoverContent";var Rt=Fe,Ee=e=>{var r;const{triggerRef:n,getTriggerProps:s}=Oe(),{children:a,...u}=e,d=P.useMemo(()=>typeof a=="string"?t.jsx("p",{children:a}):P.Children.only(a),[a]),h=(r=d.props.ref)!=null?r:d.ref,{onPress:l,isDisabled:c,...p}=P.useMemo(()=>s(R(u,d.props),h),[s,d.props,u,h]),[,w]=Ot(a,X),{buttonProps:b}=tt({onPress:l,isDisabled:c},n),x=P.useMemo(()=>w?.[0]!==void 0,[w]);return x||delete p.preventFocusOnPress,P.cloneElement(d,R(p,x?{onPress:l,isDisabled:c}:b))};Ee.displayName="HeroUI.PopoverTrigger";var Ht=Ee,Te=se((e,r)=>{const{children:n,...s}=e,a=jt({...s,ref:r}),[u,d]=P.Children.toArray(n),h=t.jsx(ot,{portalContainer:a.portalContainer,children:d});return t.jsxs(Tt,{value:a,children:[u,a.disableAnimation&&a.isOpen?h:t.jsx(Ie,{children:a.isOpen?h:null})]})});Te.displayName="HeroUI.Popover";var Ut=Te,[Kt,Re]=Me({name:"DropdownContext",errorMessage:"useDropdownContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Dropdown />`"});function Bt(e){const{isSelected:r,disableAnimation:n,...s}=e;return t.jsx("svg",{"aria-hidden":"true","data-selected":r,role:"presentation",viewBox:"0 0 17 18",...s,children:t.jsx("polyline",{fill:"none",points:"1 9 7 14 15 4",stroke:"currentColor",strokeDasharray:22,strokeDashoffset:r?44:66,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,style:n?{}:{transition:"stroke-dashoffset 200ms ease"}})})}const He=new WeakMap;function Vt(e,r,n){let{shouldFocusWrap:s=!0,onKeyDown:a,onKeyUp:u,...d}=e;!e["aria-label"]&&e["aria-labelledby"];let h=ke(e,{labelable:!0}),{listProps:l}=rt({...d,ref:n,selectionManager:r.selectionManager,collection:r.collection,disabledKeys:r.disabledKeys,shouldFocusWrap:s,linkBehavior:"override"});return He.set(r,{onClose:e.onClose,onAction:e.onAction,shouldUseVirtualFocus:e.shouldUseVirtualFocus}),{menuProps:Ne(h,{onKeyDown:a,onKeyUp:u},{role:"menu",...l,onKeyDown:c=>{var p;(c.key!=="Escape"||e.shouldUseVirtualFocus)&&((p=l.onKeyDown)===null||p===void 0||p.call(l,c))}})}}function Lt(e,r,n){let{id:s,key:a,closeOnSelect:u,isVirtualized:d,"aria-haspopup":h,onPressStart:l,onPressUp:c,onPress:p,onPressChange:w,onPressEnd:b,onHoverStart:x,onHoverChange:I,onHoverEnd:j,onKeyDown:f,onKeyUp:M,onFocus:D,onFocusChange:y,onBlur:S,selectionManager:i=r.selectionManager}=e,v=!!h,k=v&&e["aria-expanded"]==="true";var o;let C=(o=e.isDisabled)!==null&&o!==void 0?o:i.isDisabled(a);var _;let A=(_=e.isSelected)!==null&&_!==void 0?_:i.isSelected(a),N=He.get(r),g=r.collection.getItem(a),T=e.onClose||N.onClose,B=at(),$=m=>{var J;if(!v){if(!(g==null||(J=g.props)===null||J===void 0)&&J.onAction?g.props.onAction():e.onAction&&e.onAction(a),N.onAction){let ce=N.onAction;ce(a)}m.target instanceof HTMLAnchorElement&&g&&B.open(m.target,m,g.props.href,g.props.routerOptions)}},E="menuitem";v||(i.selectionMode==="single"?E="menuitemradio":i.selectionMode==="multiple"&&(E="menuitemcheckbox"));let O=pe(),H=pe(),q=pe(),V={id:s,"aria-disabled":C||void 0,role:E,"aria-label":e["aria-label"],"aria-labelledby":O,"aria-describedby":[H,q].filter(Boolean).join(" ")||void 0,"aria-controls":e["aria-controls"],"aria-haspopup":h,"aria-expanded":e["aria-expanded"]};i.selectionMode!=="none"&&!v&&(V["aria-checked"]=A),d&&(V["aria-posinset"]=g?.index,V["aria-setsize"]=St(r.collection));let G=m=>{m.pointerType==="keyboard"&&$(m),l?.(m)},Z=()=>{!v&&T&&(u??(i.selectionMode!=="multiple"||i.isLink(a)))&&T()},Y=m=>{m.pointerType==="mouse"&&($(m),Z()),c?.(m)},ne=m=>{m.pointerType!=="keyboard"&&m.pointerType!=="mouse"&&($(m),Z()),p?.(m)},{itemProps:L,isFocused:ee}=_t({id:s,selectionManager:i,key:a,ref:n,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,linkBehavior:"none",shouldUseVirtualFocus:N.shouldUseVirtualFocus}),{pressProps:le,isPressed:te}=st({onPressStart:G,onPress:ne,onPressUp:Y,onPressChange:w,onPressEnd:b,isDisabled:C}),{hoverProps:ie}=_e({isDisabled:C,onHoverStart(m){!he()&&!(k&&h)&&(i.setFocused(!0),i.setFocusedKey(a)),x?.(m)},onHoverChange:I,onHoverEnd:j}),{keyboardProps:oe}=nt({onKeyDown:m=>{if(m.repeat){m.continuePropagation();return}switch(m.key){case" ":!C&&i.selectionMode==="none"&&!v&&u!==!1&&T&&T();break;case"Enter":!C&&u!==!1&&!v&&T&&T();break;default:v||m.continuePropagation(),f?.(m);break}},onKeyUp:M}),{focusProps:U}=lt({onBlur:S,onFocus:D,onFocusChange:y}),re=ke(g?.props);delete re.id;let de=it(g?.props);return{menuItemProps:{...V,...Ne(re,de,v?{onFocus:L.onFocus,"data-collection":L["data-collection"],"data-key":L["data-key"]}:L,le,ie,oe,U,N.shouldUseVirtualFocus||v?{onMouseDown:m=>m.preventDefault()}:void 0),tabIndex:L.tabIndex!=null&&k&&!N.shouldUseVirtualFocus?-1:L.tabIndex},labelProps:{id:O},descriptionProps:{id:H},keyboardShortcutProps:{id:q},isFocused:ee,isFocusVisible:ee&&i.isFocused&&he()&&!k,isSelected:A,isPressed:te,isDisabled:C}}function zt(e){let{heading:r,"aria-label":n}=e,s=dt();return{itemProps:{role:"presentation"},headingProps:r?{id:s,role:"presentation"}:{},groupProps:{role:"group","aria-label":n,"aria-labelledby":r?s:void 0}}}function Wt(e){var r,n;const s=be(),[a,u]=ct(e,je.variantKeys),{as:d,item:h,state:l,shortcut:c,description:p,startContent:w,endContent:b,isVirtualized:x,selectedIcon:I,className:j,classNames:f,onAction:M,autoFocus:D,onPress:y,onPressStart:S,onPressUp:i,onPressEnd:v,onPressChange:k,onHoverStart:o,onHoverChange:C,onHoverEnd:_,hideSelectedIcon:A=!1,isReadOnly:N=!1,closeOnSelect:g,onClose:T,onClick:B,...$}=a,E=(n=(r=e.disableAnimation)!=null?r:s?.disableAnimation)!=null?n:!1,O=P.useRef(null),H=d||($?.href?"a":"li"),q=typeof H=="string",{rendered:V,key:G}=h,Z=l.disabledKeys.has(G)||e.isDisabled,Y=l.selectionManager.selectionMode!=="none",ne=Dt(),{isFocusVisible:L,focusProps:ee}=ut({autoFocus:D}),le=P.useCallback(F=>{B?.(F),y?.(F)},[B,y]),{isPressed:te,isFocused:ie,isSelected:oe,isDisabled:U,menuItemProps:re,labelProps:de,descriptionProps:m,keyboardShortcutProps:J}=Lt({key:G,onClose:T,isDisabled:Z,onPress:le,onPressStart:S,onPressUp:i,onPressEnd:v,onPressChange:k,"aria-label":a["aria-label"],closeOnSelect:g,isVirtualized:x,onAction:M},l,O);let{hoverProps:ce,isHovered:ge}=_e({isDisabled:U,onHoverStart(F){he()||(l.selectionManager.setFocused(!0),l.selectionManager.setFocusedKey(G)),o?.(F)},onHoverChange:C,onHoverEnd:_}),ue=re;const z=P.useMemo(()=>je({...u,isDisabled:U,disableAnimation:E,hasTitleTextChild:typeof V=="string",hasDescriptionTextChild:typeof p=="string"}),[pt(u),U,E,V,p]),ze=W(f?.base,j);N&&(ue=ft(ue));const We=(F={})=>({ref:O,...R(N?{}:ee,Ae($,{enabled:q}),ue,ce,F),"data-focus":K(ie),"data-selectable":K(Y),"data-hover":K(ne?ge||te:ge),"data-disabled":K(U),"data-selected":K(oe),"data-pressed":K(te),"data-focus-visible":K(L),className:z.base({class:W(ze,F.className)})}),qe=(F={})=>({...R(de,F),className:z.title({class:f?.title})}),Ge=(F={})=>({...R(m,F),className:z.description({class:f?.description})}),Je=(F={})=>({...R(J,F),className:z.shortcut({class:f?.shortcut})}),Qe=P.useCallback((F={})=>({"aria-hidden":K(!0),"data-disabled":K(U),className:z.selectedIcon({class:f?.selectedIcon}),...F}),[U,z,f]);return{Component:H,domRef:O,slots:z,classNames:f,isSelectable:Y,isSelected:oe,isDisabled:U,rendered:V,shortcut:c,description:p,startContent:w,endContent:b,selectedIcon:I,disableAnimation:E,getItemProps:We,getLabelProps:qe,hideSelectedIcon:A,getDescriptionProps:Ge,getKeyboardShortcutProps:Je,getSelectedIconProps:Qe}}var Ue=e=>{const{Component:r,slots:n,classNames:s,rendered:a,shortcut:u,description:d,isSelectable:h,isSelected:l,isDisabled:c,selectedIcon:p,startContent:w,endContent:b,disableAnimation:x,hideSelectedIcon:I,getItemProps:j,getLabelProps:f,getDescriptionProps:M,getKeyboardShortcutProps:D,getSelectedIconProps:y}=Wt(e),S=P.useMemo(()=>{const i=t.jsx(Bt,{disableAnimation:x,isSelected:l});return typeof p=="function"?p({icon:i,isSelected:l,isDisabled:c}):p||i},[p,l,c,x]);return t.jsxs(r,{...j(),children:[w,d?t.jsxs("div",{className:n.wrapper({class:s?.wrapper}),children:[t.jsx("span",{...f(),children:a}),t.jsx("span",{...M(),children:d})]}):t.jsx("span",{...f(),children:a}),u&&t.jsx("kbd",{...D(),children:u}),h&&!I&&t.jsx("span",{...y(),children:S}),b]})};Ue.displayName="HeroUI.MenuItem";var Ke=Ue,Be=se(({item:e,state:r,as:n,variant:s,color:a,disableAnimation:u,onAction:d,closeOnSelect:h,className:l,classNames:c,showDivider:p=!1,hideSelectedIcon:w,dividerProps:b={},itemClasses:x,title:I,...j},f)=>{const M=n||"li",D=P.useMemo(()=>Mt(),[]),y=W(c?.base,l),S=W(c?.divider,b?.className),{itemProps:i,headingProps:v,groupProps:k}=zt({heading:e.rendered,"aria-label":e["aria-label"]});return t.jsxs(M,{"data-slot":"base",...R(i,j),className:D.base({class:y}),children:[e.rendered&&t.jsx("span",{...v,className:D.heading({class:c?.heading}),"data-slot":"heading",children:e.rendered}),t.jsxs("ul",{...k,className:D.group({class:c?.group}),"data-has-title":!!e.rendered,"data-slot":"group",children:[[...e.childNodes].map(o=>{const{key:C,props:_}=o;let A=t.jsx(Ke,{classNames:x,closeOnSelect:h,color:a,disableAnimation:u,hideSelectedIcon:w,item:o,state:r,variant:s,onAction:d,..._},C);return o.wrapper&&(A=o.wrapper(A)),A}),p&&t.jsx(vt,{as:"li",className:D.divider({class:S}),...b})]})]})});Be.displayName="HeroUI.MenuSection";var qt=Be;function Gt(e){var r;const n=be(),{as:s,ref:a,variant:u,color:d,children:h,disableAnimation:l=(r=n?.disableAnimation)!=null?r:!1,onAction:c,closeOnSelect:p,itemClasses:w,className:b,state:x,topContent:I,bottomContent:j,hideEmptyContent:f=!1,hideSelectedIcon:M=!1,emptyContent:D="No items.",menuProps:y,onClose:S,classNames:i,...v}=e,k=s||"ul",o=ht(a),C=typeof k=="string",_=bt({...v,...y,children:h}),A=x||_,{menuProps:N}=Vt({...v,...y,onAction:c},A,o),g=P.useMemo(()=>It({className:b}),[b]),T=W(i?.base,b);return{Component:k,state:A,variant:u,color:d,disableAnimation:l,onClose:S,topContent:I,bottomContent:j,closeOnSelect:p,className:b,itemClasses:w,getBaseProps:(O={})=>({ref:o,"data-slot":"base",className:g.base({class:T}),...Ae(v,{enabled:C}),...O}),getListProps:(O={})=>({"data-slot":"list",className:g.list({class:i?.list}),...N,...O}),hideEmptyContent:f,hideSelectedIcon:M,getEmptyContentProps:(O={})=>({children:D,className:g.emptyContent({class:i?.emptyContent}),...O})}}var Jt=se(function(r,n){const{Component:s,state:a,closeOnSelect:u,color:d,disableAnimation:h,hideSelectedIcon:l,hideEmptyContent:c,variant:p,onClose:w,topContent:b,bottomContent:x,itemClasses:I,getBaseProps:j,getListProps:f,getEmptyContentProps:M}=Gt({...r,ref:n}),D=t.jsxs(s,{...f(),children:[!a.collection.size&&!c&&t.jsx("li",{children:t.jsx("div",{...M()})}),[...a.collection].map(y=>{const S={closeOnSelect:u,color:d,disableAnimation:h,item:y,state:a,variant:p,onClose:w,hideSelectedIcon:l,...y.props},i=Et(I,S?.classNames);if(y.type==="section")return t.jsx(qt,{...S,itemClasses:i},y.key);let v=t.jsx(Ke,{...S,classNames:i},y.key);return y.wrapper&&(v=y.wrapper(v)),v})]});return t.jsxs("div",{...j(),children:[b,D,x]})}),Qt=Jt,Xt=gt,De=Xt,Zt=se(function(r,n){const{getMenuProps:s}=Re();return t.jsx(Rt,{children:t.jsx(mt,{contain:!0,restoreFocus:!0,children:t.jsx(Qt,{...s(r,n)})})})}),Yt=Zt,Ve=e=>{const{getMenuTriggerProps:r}=Re(),{children:n,...s}=e;return t.jsx(Ht,{...r(s),children:n})};Ve.displayName="HeroUI.DropdownTrigger";var eo=Ve,to=(e,r)=>{if(e){const n=Array.isArray(e.children)?e.children:[...e?.items||[]];if(n&&n.length)return n.find(a=>{if(a&&a.key===r)return a})||{}}return null},oo=(e,r,n)=>{const s=n||to(e,r);return s&&s.props&&"closeOnSelect"in s.props?s.props.closeOnSelect:e?.closeOnSelect};function ro(e){var r;const n=be(),{as:s,triggerRef:a,isOpen:u,defaultOpen:d,onOpenChange:h,isDisabled:l,type:c="menu",trigger:p="press",placement:w="bottom",closeOnSelect:b=!0,shouldBlockScroll:x=!0,classNames:I,disableAnimation:j=(r=n?.disableAnimation)!=null?r:!1,onClose:f,className:M,...D}=e,y=s||"div",S=P.useRef(null),i=a||S,v=P.useRef(null),k=P.useRef(null),o=kt({trigger:p,isOpen:u,defaultOpen:d,onOpenChange:$=>{h?.($),$||f?.()}}),{menuTriggerProps:C,menuProps:_}=Nt({type:c,trigger:p,isDisabled:l},o,i),A=P.useMemo(()=>Ft({className:M}),[M]),N=$=>{$!==void 0&&!$||b&&o.close()},g=($={})=>{const E=R(D,$);return{state:o,placement:w,ref:k,disableAnimation:j,shouldBlockScroll:x,scrollRef:v,triggerRef:i,...E,classNames:{...I,...$.classNames,content:W(A,I?.content,$.className)}}},T=($={})=>{const{onPress:E,onPressStart:O,...H}=C;return R(H,{isDisabled:l},$)},B=($,E=null)=>({ref:xt(E,v),menuProps:_,closeOnSelect:b,...R($,{onAction:(O,H)=>{const q=oo($,O,H);N(q)},onClose:o.close})});return{Component:y,menuRef:v,menuProps:_,closeOnSelect:b,onClose:o.close,autoFocus:o.focusStrategy||!0,disableAnimation:j,getPopoverProps:g,getMenuProps:B,getMenuTriggerProps:T}}var Le=e=>{const{children:r,...n}=e,s=ro(n),[a,u]=yt.Children.toArray(r);return t.jsx(Kt,{value:s,children:t.jsxs(Ut,{...s.getPopoverProps(),children:[a,u]})})};Le.displayName="HeroUI.Dropdown";var ao=Le;function co(){const{selectConversation:e,deleteConversation:r,newConversation:n,setConversationProperties:s}=Pt(),a=Ct(),u=fe(Ce(o=>Object.keys(o.conversations).reverse())),d=fe(Ce(o=>Object.values(o.conversations).reverse().map(C=>C.summary))),h=fe(o=>o.currentConversation),[l,c]=P.useState(!1),[p,w]=P.useState(null),[b,x]=P.useState(""),[I,j]=P.useState(!1),f=P.useRef(null),M=l?"Open sidebar":"Close sidebar",D=t.jsx(Q,{icon:"heroicons:pencil-square"}),y=(o,C)=>{w(o),x(C??""),j(!0),setTimeout(()=>{f.current?.focus?.(),setTimeout(()=>j(!1),120)},0)},S=o=>{if(p!==o)return;const C=(b||"").trim();C&&s(o,{summary:C}),w(null),x(""),j(!1)},i=()=>{w(null),x(""),j(!1)},v=()=>{const o=n();a($e(o))},k=o=>{e(o),a($e(o))};return t.jsx(ve.div,{initial:!1,animate:{maxWidth:l?"4.5rem":"16rem"},className:"rounded-l-medium border-small border-divider ml-4 flex h-full w-full min-w-[4.5rem] flex-grow flex-col space-y-2 overflow-hidden border-r-0 p-4 py-3",children:t.jsxs(Ie,{children:[t.jsx(we,{content:M,placement:"bottom",children:t.jsx(X,{isIconOnly:!0,"aria-label":M,variant:"ghost",onPress:()=>c(o=>!o),"data-testid":"chat-history-collapse-button",className:"ml-auto",children:t.jsx(Q,{icon:l?"heroicons:chevron-double-right":"heroicons:chevron-double-left"})})},"collapse-button"),!l&&t.jsx(ve.p,{initial:!1,animate:{opacity:1,width:"100%",height:"auto"},exit:{opacity:0,width:0,height:0,marginBottom:0},className:"text-small text-foreground truncate leading-5 font-semibold",children:"Conversations"},"conversations"),t.jsx(we,{content:"New conversation",placement:"right",children:t.jsx(X,{"aria-label":"New conversation",variant:"ghost",onPress:v,"data-testid":"chat-history-clear-chat-button",startContent:D,isIconOnly:l,children:!l&&"New conversation"})},"new-conversation-button"),!l&&t.jsx(ve.div,{className:"mt-2 flex flex-1 flex-col gap-2 overflow-auto overflow-x-hidden",initial:!1,animate:{opacity:1,width:"100%"},exit:{opacity:0,width:0},children:wt.zip(u,d).map(([o,C])=>{if(!o||$t(o))return null;const _=o===h,A=o===p,N=_?"solid":"light";return t.jsxs("div",{className:"flex w-full justify-between gap-2",children:[A?t.jsx(At,{ref:f,size:"sm",variant:"bordered",value:b,onChange:g=>x(g.target.value),onBlur:()=>{I||S(o)},onKeyDown:g=>{g.key==="Enter"&&S(o),g.key==="Escape"&&i()},className:"flex-1","data-testid":`input-conversation-${o}`}):t.jsx(X,{variant:N,"aria-label":`Select conversation ${o}`,"data-active":_,onPress:()=>k(o),title:C??o,"data-testid":`select-conversation-${o}`,className:"flex-1 justify-start",children:t.jsx("div",{className:"text-small truncate",children:C??o})}),t.jsxs(ao,{children:[t.jsx(eo,{children:t.jsx(X,{isIconOnly:!0,variant:"light","aria-label":`Conversation actions for ${o}`,"data-testid":`dropdown-conversation-${o}`,children:t.jsx(Q,{icon:"heroicons:ellipsis-vertical",className:"rotate-90"})})}),t.jsxs(Yt,{"aria-label":"Conversation actions",children:[t.jsx(De,{startContent:t.jsx(Q,{icon:"heroicons:pencil-square",className:"mb-0.5"}),onPress:()=>y(o,C??o),"data-testid":`edit-conversation-${o}`,children:"Edit"},"edit"),t.jsx(De,{className:"text-danger mb-0.5",color:"danger",startContent:t.jsx(Q,{icon:"heroicons:trash"}),onPress:()=>r(o),"data-testid":`delete-conversation-${o}`,children:"Delete conversation"},"delete")]})]})]},`${o}-${N}`)})},"conversation-list")]})})}export{co as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CN_ylOby.js","assets/index-anmhb6wk.js","assets/index-DlZV-Rce.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as P,t as ae,k as Xe,Z as W,ax as Me,$ as Ze,j as t,q as me,L as xe,_ as Ye,n as ye,T as Pe,s as et,v as R,V as tt,d as X,l as se,aq as Ie,o as ot,H as ke,a9 as rt,J as Ne,ay as at,ac as pe,U as st,X as _e,af as he,az as nt,aA as lt,ag as it,K as dt,O as be,Q as ct,W as ut,a0 as pt,ah as ft,a2 as K,a3 as Ae,ai as vt,R as ht,aB as bt,a8 as gt,aC as mt,aD as xt,a5 as yt,a as Pt,aE as Ct,i as fe,aF as Ce,aG as ve,D as we,I as Q,as as wt,aH as $t,aI as $e}from"./index-anmhb6wk.js";import{u as jt,b as St,c as je,d as Dt,e as Mt,m as It,$ as kt,a as Nt}from"./useMenuTriggerState-C6GDlwil.js";import{$ as _t}from"./useSelectableItem-BIhPf2mL.js";import{i as At}from"./chunk-SSA7SXE4-D2nwPcpz.js";var Ot=(e,r)=>{var n;let s=[];const a=(n=P.Children.map(e,d=>P.isValidElement(d)&&d.type===r?(s.push(d),null):d))==null?void 0:n.filter(Boolean),u=s.length>=0?s:void 0;return[a,u]},Ft=ae({base:["w-full","p-1","min-w-[200px]"]});ae({slots:{base:["flex","group","gap-2","items-center","justify-between","relative","px-2","py-1.5","w-full","h-full","box-border","rounded-small","outline-hidden","cursor-pointer","tap-highlight-transparent","data-[pressed=true]:opacity-70",...Xe,"data-[focus-visible=true]:dark:ring-offset-background-content1"],wrapper:"w-full flex flex-col items-start justify-center",title:"flex-1 text-small font-normal truncate",description:["w-full","text-tiny","text-foreground-500","group-hover:text-current"],selectedIcon:["text-inherit","w-3","h-3","shrink-0"],shortcut:["px-1","py-0.5","rounded-sm","font-sans","text-foreground-500","text-tiny","border-small","border-default-300","group-hover:border-current"]},variants:{variant:{solid:{base:""},bordered:{base:"border-medium border-transparent bg-transparent"},light:{base:"bg-transparent"},faded:{base:"border-small border-transparent hover:border-default data-[hover=true]:bg-default-100"},flat:{base:""},shadow:{base:"data-[hover=true]:shadow-lg"}},color:{default:{},primary:{},secondary:{},success:{},warning:{},danger:{}},isDisabled:{true:{base:"opacity-disabled pointer-events-none"}},disableAnimation:{true:{},false:{}}},defaultVariants:{variant:"solid",color:"default"},compoundVariants:[{variant:"solid",color:"default",class:{base:"data-[hover=true]:bg-default data-[hover=true]:text-default-foreground"}},{variant:"solid",color:"primary",class:{base:"data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground"}},{variant:"solid",color:"secondary",class:{base:"data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground"}},{variant:"solid",color:"success",class:{base:"data-[hover=true]:bg-success data-[hover=true]:text-success-foreground"}},{variant:"solid",color:"warning",class:{base:"data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground"}},{variant:"solid",color:"danger",class:{base:"data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground"}},{variant:"shadow",color:"default",class:{base:"data-[hover=true]:shadow-default/50 data-[hover=true]:bg-default data-[hover=true]:text-default-foreground"}},{variant:"shadow",color:"primary",class:{base:"data-[hover=true]:shadow-primary/30 data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground"}},{variant:"shadow",color:"secondary",class:{base:"data-[hover=true]:shadow-secondary/30 data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground"}},{variant:"shadow",color:"success",class:{base:"data-[hover=true]:shadow-success/30 data-[hover=true]:bg-success data-[hover=true]:text-success-foreground"}},{variant:"shadow",color:"warning",class:{base:"data-[hover=true]:shadow-warning/30 data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground"}},{variant:"shadow",color:"danger",class:{base:"data-[hover=true]:shadow-danger/30 data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground"}},{variant:"bordered",color:"default",class:{base:"data-[hover=true]:border-default"}},{variant:"bordered",color:"primary",class:{base:"data-[hover=true]:border-primary data-[hover=true]:text-primary"}},{variant:"bordered",color:"secondary",class:{base:"data-[hover=true]:border-secondary data-[hover=true]:text-secondary"}},{variant:"bordered",color:"success",class:{base:"data-[hover=true]:border-success data-[hover=true]:text-success"}},{variant:"bordered",color:"warning",class:{base:"data-[hover=true]:border-warning data-[hover=true]:text-warning"}},{variant:"bordered",color:"danger",class:{base:"data-[hover=true]:border-danger data-[hover=true]:text-danger"}},{variant:"flat",color:"default",class:{base:"data-[hover=true]:bg-default/40 data-[hover=true]:text-default-foreground"}},{variant:"flat",color:"primary",class:{base:"data-[hover=true]:bg-primary/20 data-[hover=true]:text-primary"}},{variant:"flat",color:"secondary",class:{base:"data-[hover=true]:bg-secondary/20 data-[hover=true]:text-secondary"}},{variant:"flat",color:"success",class:{base:"data-[hover=true]:bg-success/20 data-[hover=true]:text-success "}},{variant:"flat",color:"warning",class:{base:"data-[hover=true]:bg-warning/20 data-[hover=true]:text-warning"}},{variant:"flat",color:"danger",class:{base:"data-[hover=true]:bg-danger/20 data-[hover=true]:text-danger"}},{variant:"faded",color:"default",class:{base:"data-[hover=true]:text-default-foreground"}},{variant:"faded",color:"primary",class:{base:"data-[hover=true]:text-primary"}},{variant:"faded",color:"secondary",class:{base:"data-[hover=true]:text-secondary"}},{variant:"faded",color:"success",class:{base:"data-[hover=true]:text-success"}},{variant:"faded",color:"warning",class:{base:"data-[hover=true]:text-warning"}},{variant:"faded",color:"danger",class:{base:"data-[hover=true]:text-danger"}},{variant:"light",color:"default",class:{base:"data-[hover=true]:text-default-500"}},{variant:"light",color:"primary",class:{base:"data-[hover=true]:text-primary"}},{variant:"light",color:"secondary",class:{base:"data-[hover=true]:text-secondary"}},{variant:"light",color:"success",class:{base:"data-[hover=true]:text-success"}},{variant:"light",color:"warning",class:{base:"data-[hover=true]:text-warning"}},{variant:"light",color:"danger",class:{base:"data-[hover=true]:text-danger"}}]});ae({slots:{base:"relative mb-2",heading:"pl-1 text-tiny text-foreground-500",group:"data-[has-title=true]:pt-1",divider:"mt-2"}});ae({base:"w-full flex flex-col gap-0.5 p-1"});var Et=(e,r)=>{if(!e&&!r)return{};const n=new Set([...Object.keys(e||{}),...Object.keys(r||{})]);return Array.from(n).reduce((s,a)=>({...s,[a]:W(e?.[a],r?.[a])}),{})},[Tt,Oe]=Me({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Popover />`"}),Se=()=>Ye(()=>import("./index-CN_ylOby.js"),__vite__mapDeps([0,1,2])).then(e=>e.default),Fe=e=>{const{as:r,children:n,className:s,...a}=e,{Component:u,placement:d,backdrop:h,motionProps:l,disableAnimation:c,getPopoverProps:p,getDialogProps:w,getBackdropProps:b,getContentProps:x,isNonModal:I,onClose:j}=Oe(),f=P.useRef(null),{dialogProps:M,titleProps:D}=Ze({},f),y=w({ref:f,...M,...a}),S=r||u||"div",i=t.jsxs(t.Fragment,{children:[!I&&t.jsx(me,{onDismiss:j}),t.jsx(S,{...y,children:t.jsx("div",{...x({className:s}),children:typeof n=="function"?n(D):n})}),t.jsx(me,{onDismiss:j})]}),v=P.useMemo(()=>h==="transparent"?null:c?t.jsx("div",{...b()}):t.jsx(xe,{features:Se,children:t.jsx(ye.div,{animate:"enter",exit:"exit",initial:"exit",variants:Pe.fade,...b()})}),[h,c,b]),k=d?et(d==="center"?"top":d):void 0,o=t.jsx(t.Fragment,{children:c?i:t.jsx(xe,{features:Se,children:t.jsx(ye.div,{animate:"enter",exit:"exit",initial:"initial",style:k,variants:Pe.scaleSpringOpacity,...l,children:i})})});return t.jsxs("div",{...p(),children:[v,o]})};Fe.displayName="HeroUI.PopoverContent";var Rt=Fe,Ee=e=>{var r;const{triggerRef:n,getTriggerProps:s}=Oe(),{children:a,...u}=e,d=P.useMemo(()=>typeof a=="string"?t.jsx("p",{children:a}):P.Children.only(a),[a]),h=(r=d.props.ref)!=null?r:d.ref,{onPress:l,isDisabled:c,...p}=P.useMemo(()=>s(R(u,d.props),h),[s,d.props,u,h]),[,w]=Ot(a,X),{buttonProps:b}=tt({onPress:l,isDisabled:c},n),x=P.useMemo(()=>w?.[0]!==void 0,[w]);return x||delete p.preventFocusOnPress,P.cloneElement(d,R(p,x?{onPress:l,isDisabled:c}:b))};Ee.displayName="HeroUI.PopoverTrigger";var Ht=Ee,Te=se((e,r)=>{const{children:n,...s}=e,a=jt({...s,ref:r}),[u,d]=P.Children.toArray(n),h=t.jsx(ot,{portalContainer:a.portalContainer,children:d});return t.jsxs(Tt,{value:a,children:[u,a.disableAnimation&&a.isOpen?h:t.jsx(Ie,{children:a.isOpen?h:null})]})});Te.displayName="HeroUI.Popover";var Ut=Te,[Kt,Re]=Me({name:"DropdownContext",errorMessage:"useDropdownContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Dropdown />`"});function Bt(e){const{isSelected:r,disableAnimation:n,...s}=e;return t.jsx("svg",{"aria-hidden":"true","data-selected":r,role:"presentation",viewBox:"0 0 17 18",...s,children:t.jsx("polyline",{fill:"none",points:"1 9 7 14 15 4",stroke:"currentColor",strokeDasharray:22,strokeDashoffset:r?44:66,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,style:n?{}:{transition:"stroke-dashoffset 200ms ease"}})})}const He=new WeakMap;function Vt(e,r,n){let{shouldFocusWrap:s=!0,onKeyDown:a,onKeyUp:u,...d}=e;!e["aria-label"]&&e["aria-labelledby"];let h=ke(e,{labelable:!0}),{listProps:l}=rt({...d,ref:n,selectionManager:r.selectionManager,collection:r.collection,disabledKeys:r.disabledKeys,shouldFocusWrap:s,linkBehavior:"override"});return He.set(r,{onClose:e.onClose,onAction:e.onAction,shouldUseVirtualFocus:e.shouldUseVirtualFocus}),{menuProps:Ne(h,{onKeyDown:a,onKeyUp:u},{role:"menu",...l,onKeyDown:c=>{var p;(c.key!=="Escape"||e.shouldUseVirtualFocus)&&((p=l.onKeyDown)===null||p===void 0||p.call(l,c))}})}}function Lt(e,r,n){let{id:s,key:a,closeOnSelect:u,isVirtualized:d,"aria-haspopup":h,onPressStart:l,onPressUp:c,onPress:p,onPressChange:w,onPressEnd:b,onHoverStart:x,onHoverChange:I,onHoverEnd:j,onKeyDown:f,onKeyUp:M,onFocus:D,onFocusChange:y,onBlur:S,selectionManager:i=r.selectionManager}=e,v=!!h,k=v&&e["aria-expanded"]==="true";var o;let C=(o=e.isDisabled)!==null&&o!==void 0?o:i.isDisabled(a);var _;let A=(_=e.isSelected)!==null&&_!==void 0?_:i.isSelected(a),N=He.get(r),g=r.collection.getItem(a),T=e.onClose||N.onClose,B=at(),$=m=>{var J;if(!v){if(!(g==null||(J=g.props)===null||J===void 0)&&J.onAction?g.props.onAction():e.onAction&&e.onAction(a),N.onAction){let ce=N.onAction;ce(a)}m.target instanceof HTMLAnchorElement&&g&&B.open(m.target,m,g.props.href,g.props.routerOptions)}},E="menuitem";v||(i.selectionMode==="single"?E="menuitemradio":i.selectionMode==="multiple"&&(E="menuitemcheckbox"));let O=pe(),H=pe(),q=pe(),V={id:s,"aria-disabled":C||void 0,role:E,"aria-label":e["aria-label"],"aria-labelledby":O,"aria-describedby":[H,q].filter(Boolean).join(" ")||void 0,"aria-controls":e["aria-controls"],"aria-haspopup":h,"aria-expanded":e["aria-expanded"]};i.selectionMode!=="none"&&!v&&(V["aria-checked"]=A),d&&(V["aria-posinset"]=g?.index,V["aria-setsize"]=St(r.collection));let G=m=>{m.pointerType==="keyboard"&&$(m),l?.(m)},Z=()=>{!v&&T&&(u??(i.selectionMode!=="multiple"||i.isLink(a)))&&T()},Y=m=>{m.pointerType==="mouse"&&($(m),Z()),c?.(m)},ne=m=>{m.pointerType!=="keyboard"&&m.pointerType!=="mouse"&&($(m),Z()),p?.(m)},{itemProps:L,isFocused:ee}=_t({id:s,selectionManager:i,key:a,ref:n,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,linkBehavior:"none",shouldUseVirtualFocus:N.shouldUseVirtualFocus}),{pressProps:le,isPressed:te}=st({onPressStart:G,onPress:ne,onPressUp:Y,onPressChange:w,onPressEnd:b,isDisabled:C}),{hoverProps:ie}=_e({isDisabled:C,onHoverStart(m){!he()&&!(k&&h)&&(i.setFocused(!0),i.setFocusedKey(a)),x?.(m)},onHoverChange:I,onHoverEnd:j}),{keyboardProps:oe}=nt({onKeyDown:m=>{if(m.repeat){m.continuePropagation();return}switch(m.key){case" ":!C&&i.selectionMode==="none"&&!v&&u!==!1&&T&&T();break;case"Enter":!C&&u!==!1&&!v&&T&&T();break;default:v||m.continuePropagation(),f?.(m);break}},onKeyUp:M}),{focusProps:U}=lt({onBlur:S,onFocus:D,onFocusChange:y}),re=ke(g?.props);delete re.id;let de=it(g?.props);return{menuItemProps:{...V,...Ne(re,de,v?{onFocus:L.onFocus,"data-collection":L["data-collection"],"data-key":L["data-key"]}:L,le,ie,oe,U,N.shouldUseVirtualFocus||v?{onMouseDown:m=>m.preventDefault()}:void 0),tabIndex:L.tabIndex!=null&&k&&!N.shouldUseVirtualFocus?-1:L.tabIndex},labelProps:{id:O},descriptionProps:{id:H},keyboardShortcutProps:{id:q},isFocused:ee,isFocusVisible:ee&&i.isFocused&&he()&&!k,isSelected:A,isPressed:te,isDisabled:C}}function zt(e){let{heading:r,"aria-label":n}=e,s=dt();return{itemProps:{role:"presentation"},headingProps:r?{id:s,role:"presentation"}:{},groupProps:{role:"group","aria-label":n,"aria-labelledby":r?s:void 0}}}function Wt(e){var r,n;const s=be(),[a,u]=ct(e,je.variantKeys),{as:d,item:h,state:l,shortcut:c,description:p,startContent:w,endContent:b,isVirtualized:x,selectedIcon:I,className:j,classNames:f,onAction:M,autoFocus:D,onPress:y,onPressStart:S,onPressUp:i,onPressEnd:v,onPressChange:k,onHoverStart:o,onHoverChange:C,onHoverEnd:_,hideSelectedIcon:A=!1,isReadOnly:N=!1,closeOnSelect:g,onClose:T,onClick:B,...$}=a,E=(n=(r=e.disableAnimation)!=null?r:s?.disableAnimation)!=null?n:!1,O=P.useRef(null),H=d||($?.href?"a":"li"),q=typeof H=="string",{rendered:V,key:G}=h,Z=l.disabledKeys.has(G)||e.isDisabled,Y=l.selectionManager.selectionMode!=="none",ne=Dt(),{isFocusVisible:L,focusProps:ee}=ut({autoFocus:D}),le=P.useCallback(F=>{B?.(F),y?.(F)},[B,y]),{isPressed:te,isFocused:ie,isSelected:oe,isDisabled:U,menuItemProps:re,labelProps:de,descriptionProps:m,keyboardShortcutProps:J}=Lt({key:G,onClose:T,isDisabled:Z,onPress:le,onPressStart:S,onPressUp:i,onPressEnd:v,onPressChange:k,"aria-label":a["aria-label"],closeOnSelect:g,isVirtualized:x,onAction:M},l,O);let{hoverProps:ce,isHovered:ge}=_e({isDisabled:U,onHoverStart(F){he()||(l.selectionManager.setFocused(!0),l.selectionManager.setFocusedKey(G)),o?.(F)},onHoverChange:C,onHoverEnd:_}),ue=re;const z=P.useMemo(()=>je({...u,isDisabled:U,disableAnimation:E,hasTitleTextChild:typeof V=="string",hasDescriptionTextChild:typeof p=="string"}),[pt(u),U,E,V,p]),ze=W(f?.base,j);N&&(ue=ft(ue));const We=(F={})=>({ref:O,...R(N?{}:ee,Ae($,{enabled:q}),ue,ce,F),"data-focus":K(ie),"data-selectable":K(Y),"data-hover":K(ne?ge||te:ge),"data-disabled":K(U),"data-selected":K(oe),"data-pressed":K(te),"data-focus-visible":K(L),className:z.base({class:W(ze,F.className)})}),qe=(F={})=>({...R(de,F),className:z.title({class:f?.title})}),Ge=(F={})=>({...R(m,F),className:z.description({class:f?.description})}),Je=(F={})=>({...R(J,F),className:z.shortcut({class:f?.shortcut})}),Qe=P.useCallback((F={})=>({"aria-hidden":K(!0),"data-disabled":K(U),className:z.selectedIcon({class:f?.selectedIcon}),...F}),[U,z,f]);return{Component:H,domRef:O,slots:z,classNames:f,isSelectable:Y,isSelected:oe,isDisabled:U,rendered:V,shortcut:c,description:p,startContent:w,endContent:b,selectedIcon:I,disableAnimation:E,getItemProps:We,getLabelProps:qe,hideSelectedIcon:A,getDescriptionProps:Ge,getKeyboardShortcutProps:Je,getSelectedIconProps:Qe}}var Ue=e=>{const{Component:r,slots:n,classNames:s,rendered:a,shortcut:u,description:d,isSelectable:h,isSelected:l,isDisabled:c,selectedIcon:p,startContent:w,endContent:b,disableAnimation:x,hideSelectedIcon:I,getItemProps:j,getLabelProps:f,getDescriptionProps:M,getKeyboardShortcutProps:D,getSelectedIconProps:y}=Wt(e),S=P.useMemo(()=>{const i=t.jsx(Bt,{disableAnimation:x,isSelected:l});return typeof p=="function"?p({icon:i,isSelected:l,isDisabled:c}):p||i},[p,l,c,x]);return t.jsxs(r,{...j(),children:[w,d?t.jsxs("div",{className:n.wrapper({class:s?.wrapper}),children:[t.jsx("span",{...f(),children:a}),t.jsx("span",{...M(),children:d})]}):t.jsx("span",{...f(),children:a}),u&&t.jsx("kbd",{...D(),children:u}),h&&!I&&t.jsx("span",{...y(),children:S}),b]})};Ue.displayName="HeroUI.MenuItem";var Ke=Ue,Be=se(({item:e,state:r,as:n,variant:s,color:a,disableAnimation:u,onAction:d,closeOnSelect:h,className:l,classNames:c,showDivider:p=!1,hideSelectedIcon:w,dividerProps:b={},itemClasses:x,title:I,...j},f)=>{const M=n||"li",D=P.useMemo(()=>Mt(),[]),y=W(c?.base,l),S=W(c?.divider,b?.className),{itemProps:i,headingProps:v,groupProps:k}=zt({heading:e.rendered,"aria-label":e["aria-label"]});return t.jsxs(M,{"data-slot":"base",...R(i,j),className:D.base({class:y}),children:[e.rendered&&t.jsx("span",{...v,className:D.heading({class:c?.heading}),"data-slot":"heading",children:e.rendered}),t.jsxs("ul",{...k,className:D.group({class:c?.group}),"data-has-title":!!e.rendered,"data-slot":"group",children:[[...e.childNodes].map(o=>{const{key:C,props:_}=o;let A=t.jsx(Ke,{classNames:x,closeOnSelect:h,color:a,disableAnimation:u,hideSelectedIcon:w,item:o,state:r,variant:s,onAction:d,..._},C);return o.wrapper&&(A=o.wrapper(A)),A}),p&&t.jsx(vt,{as:"li",className:D.divider({class:S}),...b})]})]})});Be.displayName="HeroUI.MenuSection";var qt=Be;function Gt(e){var r;const n=be(),{as:s,ref:a,variant:u,color:d,children:h,disableAnimation:l=(r=n?.disableAnimation)!=null?r:!1,onAction:c,closeOnSelect:p,itemClasses:w,className:b,state:x,topContent:I,bottomContent:j,hideEmptyContent:f=!1,hideSelectedIcon:M=!1,emptyContent:D="No items.",menuProps:y,onClose:S,classNames:i,...v}=e,k=s||"ul",o=ht(a),C=typeof k=="string",_=bt({...v,...y,children:h}),A=x||_,{menuProps:N}=Vt({...v,...y,onAction:c},A,o),g=P.useMemo(()=>It({className:b}),[b]),T=W(i?.base,b);return{Component:k,state:A,variant:u,color:d,disableAnimation:l,onClose:S,topContent:I,bottomContent:j,closeOnSelect:p,className:b,itemClasses:w,getBaseProps:(O={})=>({ref:o,"data-slot":"base",className:g.base({class:T}),...Ae(v,{enabled:C}),...O}),getListProps:(O={})=>({"data-slot":"list",className:g.list({class:i?.list}),...N,...O}),hideEmptyContent:f,hideSelectedIcon:M,getEmptyContentProps:(O={})=>({children:D,className:g.emptyContent({class:i?.emptyContent}),...O})}}var Jt=se(function(r,n){const{Component:s,state:a,closeOnSelect:u,color:d,disableAnimation:h,hideSelectedIcon:l,hideEmptyContent:c,variant:p,onClose:w,topContent:b,bottomContent:x,itemClasses:I,getBaseProps:j,getListProps:f,getEmptyContentProps:M}=Gt({...r,ref:n}),D=t.jsxs(s,{...f(),children:[!a.collection.size&&!c&&t.jsx("li",{children:t.jsx("div",{...M()})}),[...a.collection].map(y=>{const S={closeOnSelect:u,color:d,disableAnimation:h,item:y,state:a,variant:p,onClose:w,hideSelectedIcon:l,...y.props},i=Et(I,S?.classNames);if(y.type==="section")return t.jsx(qt,{...S,itemClasses:i},y.key);let v=t.jsx(Ke,{...S,classNames:i},y.key);return y.wrapper&&(v=y.wrapper(v)),v})]});return t.jsxs("div",{...j(),children:[b,D,x]})}),Qt=Jt,Xt=gt,De=Xt,Zt=se(function(r,n){const{getMenuProps:s}=Re();return t.jsx(Rt,{children:t.jsx(mt,{contain:!0,restoreFocus:!0,children:t.jsx(Qt,{...s(r,n)})})})}),Yt=Zt,Ve=e=>{const{getMenuTriggerProps:r}=Re(),{children:n,...s}=e;return t.jsx(Ht,{...r(s),children:n})};Ve.displayName="HeroUI.DropdownTrigger";var eo=Ve,to=(e,r)=>{if(e){const n=Array.isArray(e.children)?e.children:[...e?.items||[]];if(n&&n.length)return n.find(a=>{if(a&&a.key===r)return a})||{}}return null},oo=(e,r,n)=>{const s=n||to(e,r);return s&&s.props&&"closeOnSelect"in s.props?s.props.closeOnSelect:e?.closeOnSelect};function ro(e){var r;const n=be(),{as:s,triggerRef:a,isOpen:u,defaultOpen:d,onOpenChange:h,isDisabled:l,type:c="menu",trigger:p="press",placement:w="bottom",closeOnSelect:b=!0,shouldBlockScroll:x=!0,classNames:I,disableAnimation:j=(r=n?.disableAnimation)!=null?r:!1,onClose:f,className:M,...D}=e,y=s||"div",S=P.useRef(null),i=a||S,v=P.useRef(null),k=P.useRef(null),o=kt({trigger:p,isOpen:u,defaultOpen:d,onOpenChange:$=>{h?.($),$||f?.()}}),{menuTriggerProps:C,menuProps:_}=Nt({type:c,trigger:p,isDisabled:l},o,i),A=P.useMemo(()=>Ft({className:M}),[M]),N=$=>{$!==void 0&&!$||b&&o.close()},g=($={})=>{const E=R(D,$);return{state:o,placement:w,ref:k,disableAnimation:j,shouldBlockScroll:x,scrollRef:v,triggerRef:i,...E,classNames:{...I,...$.classNames,content:W(A,I?.content,$.className)}}},T=($={})=>{const{onPress:E,onPressStart:O,...H}=C;return R(H,{isDisabled:l},$)},B=($,E=null)=>({ref:xt(E,v),menuProps:_,closeOnSelect:b,...R($,{onAction:(O,H)=>{const q=oo($,O,H);N(q)},onClose:o.close})});return{Component:y,menuRef:v,menuProps:_,closeOnSelect:b,onClose:o.close,autoFocus:o.focusStrategy||!0,disableAnimation:j,getPopoverProps:g,getMenuProps:B,getMenuTriggerProps:T}}var Le=e=>{const{children:r,...n}=e,s=ro(n),[a,u]=yt.Children.toArray(r);return t.jsx(Kt,{value:s,children:t.jsxs(Ut,{...s.getPopoverProps(),children:[a,u]})})};Le.displayName="HeroUI.Dropdown";var ao=Le;function co(){const{selectConversation:e,deleteConversation:r,newConversation:n,setConversationProperties:s}=Pt(),a=Ct(),u=fe(Ce(o=>Object.keys(o.conversations).reverse())),d=fe(Ce(o=>Object.values(o.conversations).reverse().map(C=>C.summary))),h=fe(o=>o.currentConversation),[l,c]=P.useState(!1),[p,w]=P.useState(null),[b,x]=P.useState(""),[I,j]=P.useState(!1),f=P.useRef(null),M=l?"Open sidebar":"Close sidebar",D=t.jsx(Q,{icon:"heroicons:pencil-square"}),y=(o,C)=>{w(o),x(C??""),j(!0),setTimeout(()=>{f.current?.focus?.(),setTimeout(()=>j(!1),120)},0)},S=o=>{if(p!==o)return;const C=(b||"").trim();C&&s(o,{summary:C}),w(null),x(""),j(!1)},i=()=>{w(null),x(""),j(!1)},v=()=>{const o=n();a($e(o))},k=o=>{e(o),a($e(o))};return t.jsx(ve.div,{initial:!1,animate:{maxWidth:l?"4.5rem":"16rem"},className:"rounded-l-medium border-small border-divider ml-4 flex h-full w-full min-w-[4.5rem] flex-grow flex-col space-y-2 overflow-hidden border-r-0 p-4 py-3",children:t.jsxs(Ie,{children:[t.jsx(we,{content:M,placement:"bottom",children:t.jsx(X,{isIconOnly:!0,"aria-label":M,variant:"ghost",onPress:()=>c(o=>!o),"data-testid":"chat-history-collapse-button",className:"ml-auto",children:t.jsx(Q,{icon:l?"heroicons:chevron-double-right":"heroicons:chevron-double-left"})})},"collapse-button"),!l&&t.jsx(ve.p,{initial:!1,animate:{opacity:1,width:"100%",height:"auto"},exit:{opacity:0,width:0,height:0,marginBottom:0},className:"text-small text-foreground truncate leading-5 font-semibold",children:"Conversations"},"conversations"),t.jsx(we,{content:"New conversation",placement:"right",children:t.jsx(X,{"aria-label":"New conversation",variant:"ghost",onPress:v,"data-testid":"chat-history-clear-chat-button",startContent:D,isIconOnly:l,children:!l&&"New conversation"})},"new-conversation-button"),!l&&t.jsx(ve.div,{className:"mt-2 flex flex-1 flex-col gap-2 overflow-auto overflow-x-hidden",initial:!1,animate:{opacity:1,width:"100%"},exit:{opacity:0,width:0},children:wt.zip(u,d).map(([o,C])=>{if(!o||$t(o))return null;const _=o===h,A=o===p,N=_?"solid":"light";return t.jsxs("div",{className:"flex w-full justify-between gap-2",children:[A?t.jsx(At,{ref:f,size:"sm",variant:"bordered",value:b,onChange:g=>x(g.target.value),onBlur:()=>{I||S(o)},onKeyDown:g=>{g.key==="Enter"&&S(o),g.key==="Escape"&&i()},className:"flex-1","data-testid":`input-conversation-${o}`}):t.jsx(X,{variant:N,"aria-label":`Select conversation ${o}`,"data-active":_,onPress:()=>k(o),title:C??o,"data-testid":`select-conversation-${o}`,className:"flex-1 justify-start",children:t.jsx("div",{className:"text-small truncate",children:C??o})}),t.jsxs(ao,{children:[t.jsx(eo,{children:t.jsx(X,{isIconOnly:!0,variant:"light","aria-label":`Conversation actions for ${o}`,"data-testid":`dropdown-conversation-${o}`,children:t.jsx(Q,{icon:"heroicons:ellipsis-vertical",className:"rotate-90"})})}),t.jsxs(Yt,{"aria-label":"Conversation actions",children:[t.jsx(De,{startContent:t.jsx(Q,{icon:"heroicons:pencil-square",className:"mb-0.5"}),onPress:()=>y(o,C??o),"data-testid":`edit-conversation-${o}`,children:"Edit"},"edit"),t.jsx(De,{className:"text-danger mb-0.5",color:"danger",startContent:t.jsx(Q,{icon:"heroicons:trash"}),onPress:()=>r(o),"data-testid":`delete-conversation-${o}`,children:"Delete conversation"},"delete")]})]})]},`${o}-${N}`)})},"conversation-list")]})})}export{co as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as z,r as f,u as ie,h as ce,a as ue,i as le,b as fe,p as Y,C as Q,j as l,D as de,d as A,I as me,m as ge,e as he,f as pe}from"./index-
|
|
1
|
+
import{g as z,r as f,u as ie,h as ce,a as ue,i as le,b as fe,p as Y,C as Q,j as l,D as de,d as A,I as me,m as ge,e as he,f as pe}from"./index-anmhb6wk.js";import{g as Z,v as W,F as ve,t as be}from"./index-CYAMgynD.js";import{m as Se}from"./chunk-IGSAU2ZA-DCwEaDm9.js";import"./chunk-SSA7SXE4-D2nwPcpz.js";import"./useMenuTriggerState-C6GDlwil.js";import"./useSelectableItem-BIhPf2mL.js";import"./index-BAUrj1ow.js";var B,V;function xe(){if(V)return B;V=1;var n="Expected a function",t=NaN,s="[object Symbol]",m=/^\s+|\s+$/g,g=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,i=/^0o[0-7]+$/i,b=parseInt,S=typeof z=="object"&&z&&z.Object===Object&&z,y=typeof self=="object"&&self&&self.Object===Object&&self,C=S||y||Function("return this")(),d=Object.prototype,r=d.toString,c=Math.max,O=Math.min,E=function(){return C.Date.now()};function $(e,u,v){var T,L,P,I,p,j,R=0,G=!1,D=!1,k=!0;if(typeof e!="function")throw new TypeError(n);u=q(u)||0,_(v)&&(G=!!v.leading,D="maxWait"in v,P=D?c(q(v.maxWait)||0,u):P,k="trailing"in v?!!v.trailing:k);function H(o){var x=T,F=L;return T=L=void 0,R=o,I=e.apply(F,x),I}function re(o){return R=o,p=setTimeout(N,u),G?H(o):I}function oe(o){var x=o-j,F=o-R,X=u-x;return D?O(X,P-F):X}function U(o){var x=o-j,F=o-R;return j===void 0||x>=u||x<0||D&&F>=P}function N(){var o=E();if(U(o))return K(o);p=setTimeout(N,oe(o))}function K(o){return p=void 0,k&&T?H(o):(T=L=void 0,I)}function se(){p!==void 0&&clearTimeout(p),R=0,T=j=L=p=void 0}function ae(){return p===void 0?I:K(E())}function M(){var o=E(),x=U(o);if(T=arguments,L=this,j=o,x){if(p===void 0)return re(j);if(D)return p=setTimeout(N,u),H(j)}return p===void 0&&(p=setTimeout(N,u)),I}return M.cancel=se,M.flush=ae,M}function _(e){var u=typeof e;return!!e&&(u=="object"||u=="function")}function a(e){return!!e&&typeof e=="object"}function w(e){return typeof e=="symbol"||a(e)&&r.call(e)==s}function q(e){if(typeof e=="number")return e;if(w(e))return t;if(_(e)){var u=typeof e.valueOf=="function"?e.valueOf():e;e=_(u)?u+"":u}if(typeof e!="string")return e===0?e:+e;e=e.replace(m,"");var v=h.test(e);return v||i.test(e)?b(e.slice(2),v?2:8):g.test(e)?t:+e}return B=$,B}xe();var ne=typeof window<"u"?f.useLayoutEffect:f.useEffect;function ee(n,t,s,m){const g=f.useRef(t);ne(()=>{g.current=t},[t]),f.useEffect(()=>{const h=window;if(!(h&&h.addEventListener))return;const i=b=>{g.current(b)};return h.addEventListener(n,i,m),()=>{h.removeEventListener(n,i,m)}},[n,s,m])}function te(n){const t=f.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return ne(()=>{t.current=n},[n]),f.useCallback((...s)=>{var m;return(m=t.current)==null?void 0:m.call(t,...s)},[t])}var J=typeof window>"u";function ye(n,t,s={}){const{initializeWithValue:m=!0}=s,g=f.useCallback(r=>s.serializer?s.serializer(r):JSON.stringify(r),[s]),h=f.useCallback(r=>{if(s.deserializer)return s.deserializer(r);if(r==="undefined")return;const c=t instanceof Function?t():t;let O;try{O=JSON.parse(r)}catch(E){return console.error("Error parsing JSON:",E),c}return O},[s,t]),i=f.useCallback(()=>{const r=t instanceof Function?t():t;if(J)return r;try{const c=window.localStorage.getItem(n);return c?h(c):r}catch(c){return console.warn(`Error reading localStorage key “${n}”:`,c),r}},[t,n,h]),[b,S]=f.useState(()=>m?i():t instanceof Function?t():t),y=te(r=>{J&&console.warn(`Tried setting localStorage key “${n}” even though environment is not a client`);try{const c=r instanceof Function?r(i()):r;window.localStorage.setItem(n,g(c)),S(c),window.dispatchEvent(new StorageEvent("local-storage",{key:n}))}catch(c){console.warn(`Error setting localStorage key “${n}”:`,c)}}),C=te(()=>{J&&console.warn(`Tried removing localStorage key “${n}” even though environment is not a client`);const r=t instanceof Function?t():t;window.localStorage.removeItem(n),S(r),window.dispatchEvent(new StorageEvent("local-storage",{key:n}))});f.useEffect(()=>{S(i())},[n]);const d=f.useCallback(r=>{r.key&&r.key!==n||S(i())},[n,i]);return ee("storage",d),ee("local-storage",d),[b,y,C]}const Ce="ragbits-no-history-chat-options";function Le(){const{isOpen:n,onOpen:t,onClose:s}=ie(),m=ce(a=>a.chatOptions),g=f.useRef(null),{setConversationProperties:h,initializeChatOptions:i}=ue(),b=le(a=>a.currentConversation),{config:{user_settings:S}}=fe(),[y,C]=ye(Ce,null),d=S?.form,r=a=>{Y.isPluginActivated(Q.name)||C(a)},c=()=>{t()},O=(a,w)=>{w.preventDefault(),g.current=a.formData,s()},E=()=>{if(!d)return;const a=Z(W,d);g.current=a,s()},$=()=>{s()},_=a=>{if(a!=="exit"||!g.current)return;const w=g.current;h(b,{chatOptions:w}),r(w),g.current=null};return f.useEffect(()=>{if(!d)return;const a=Z(W,d);Y.isPluginActivated(Q.name)?i(a):y!==null?i(y):(i(a),C(a))},[i,d,b,y,C]),d?l.jsxs(l.Fragment,{children:[l.jsx(de,{content:"Chat Options",placement:"bottom",children:l.jsx(A,{isIconOnly:!0,variant:"ghost",className:"p-0","aria-label":"Open chat options",onPress:c,"data-testid":"open-chat-options",children:l.jsx(me,{icon:"heroicons:cog-6-tooth"})})}),l.jsx(ge,{isOpen:n,onOpenChange:$,motionProps:{onAnimationComplete:_},children:l.jsxs(he,{children:[l.jsx(Se,{className:"text-default-900 flex flex-col gap-1",children:d.title||"Chat Options"}),l.jsx(pe,{children:l.jsx("div",{className:"flex flex-col gap-4",children:l.jsx(ve,{schema:d,validator:W,formData:m,onSubmit:O,transformErrors:be,liveValidate:!0,children:l.jsxs("div",{className:"flex justify-end gap-4 py-4",children:[l.jsx(A,{className:"mr-auto",color:"primary",variant:"light",onPress:E,"aria-label":"Restore default user settings",children:"Restore defaults"}),l.jsx(A,{color:"danger",variant:"light",onPress:s,"aria-label":"Close chat options form",children:"Cancel"}),l.jsx(A,{color:"primary",type:"submit","aria-label":"Save chat options","data-testid":"chat-options-submit",children:"Save"})]})})})})]})})]}):null}export{Le as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as g,a as v,b as C,r as _,F as s,c as T,j as e,D as b,d as n,I as u,m as w,e as D,f as I}from"./index-
|
|
1
|
+
import{u as g,a as v,b as C,r as _,F as s,c as T,j as e,D as b,d as n,I as u,m as w,e as D,f as I}from"./index-anmhb6wk.js";import{F as O,t as S,v as E}from"./index-CYAMgynD.js";import{m as N}from"./chunk-IGSAU2ZA-DCwEaDm9.js";import"./chunk-SSA7SXE4-D2nwPcpz.js";import"./useMenuTriggerState-C6GDlwil.js";import"./useSelectableItem-BIhPf2mL.js";import"./index-BAUrj1ow.js";function z({message:t}){const{isOpen:f,onOpen:h,onClose:r}=g(),{mergeExtensions:p}=v(),{config:{feedback:o}}=C(),[i,x]=_.useState(s.Like),k=T("/api/feedback",{headers:{"Content-Type":"application/json"},method:"POST"}),l=o[i].form,j=()=>{r()},c=async a=>{if(!t.serverId)throw new Error('Feedback is only available for messages with "serverId" set');try{await k.call({body:{message_id:t.serverId,feedback:i,payload:a??{}}})}catch(F){console.error(F)}},y=a=>{p(t.id,{feedbackType:i}),c(a.formData),r()},d=async a=>{if(x(a),o[a].form===null){await c(null);return}h()};if(!l)return null;const m=t.extensions?.feedbackType;return e.jsxs(e.Fragment,{children:[o.like.enabled&&e.jsx(b,{content:"Like",placement:"bottom",children:e.jsx(n,{isIconOnly:!0,variant:"ghost",className:"p-0","aria-label":"Rate message as helpful",onPress:()=>d(s.Like),"data-testid":"feedback-like",children:e.jsx(u,{icon:m===s.Like?"heroicons:hand-thumb-up-solid":"heroicons:hand-thumb-up"})})}),o.dislike.enabled&&e.jsx(b,{content:"Dislike",placement:"bottom",children:e.jsx(n,{isIconOnly:!0,variant:"ghost",className:"p-0","aria-label":"Rate message as unhelpful",onPress:()=>d(s.Dislike),"data-testid":"feedback-dislike",children:e.jsx(u,{icon:m===s.Dislike?"heroicons:hand-thumb-down-solid":"heroicons:hand-thumb-down"})})}),e.jsx(w,{isOpen:f,onOpenChange:j,children:e.jsx(D,{children:a=>e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"text-default-900 flex flex-col gap-1",children:l.title}),e.jsx(I,{children:e.jsx("div",{className:"flex flex-col gap-4",children:e.jsx(O,{schema:l,validator:E,onSubmit:y,transformErrors:S,liveValidate:!0,children:e.jsxs("div",{className:"flex justify-end gap-4 py-4",children:[e.jsx(n,{color:"danger",variant:"light",onPress:a,"aria-label":"Close feedback form",children:"Cancel"}),e.jsx(n,{color:"primary",type:"submit","aria-label":"Submit feedback","data-testid":"feedback-submit",children:"Submit"})]})})})})]})})})]})}export{z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,bm as w,c as y,aW as b,aE as S,j as e,aq as j,aG as v,d as C,bn as P}from"./index-
|
|
1
|
+
import{r as n,bm as w,c as y,aW as b,aE as S,j as e,aq as j,aG as v,d as C,bn as P}from"./index-anmhb6wk.js";import{a as E}from"./authStore-Dtjh8LvS.js";import{i as c}from"./chunk-SSA7SXE4-D2nwPcpz.js";const N=()=>{const a=n.useContext(w);if(!a)throw new Error("useInitializeUserStore must be used within a HistoryStoreContextProvider");return a.initializeUserStore};function U(){const[a,m]=n.useState({username:"",password:""}),u=y("/api/auth/login",{headers:{"Content-Type":"application/json"},method:"POST"}),p=b(E,s=>s.login),g=S(),x=N(),[f,o]=n.useState(!1),h=async s=>{o(!1),s.preventDefault(),s.stopPropagation();const r=new FormData(s.currentTarget),i=r.get("username"),l=r.get("password");try{const t=await u.call({body:{username:i,password:l}});if(!t.success||!t.jwt_token||!t.user){o(!0);return}p(t.user,t.jwt_token),x(t.user.user_id),g("/")}catch(t){o(!0),console.error("Failed to login",t)}},d=s=>r=>m(i=>P(i,l=>{l[s]=r.target.value}));return n.useEffect(()=>{document.title="Login"},[]),e.jsx("div",{className:"flex h-screen w-screen",children:e.jsxs("form",{className:"rounded-medium border-small border-divider m-auto flex w-full max-w-xs flex-col gap-4 p-4",onSubmit:h,children:[e.jsxs("div",{className:"text-small",children:[e.jsx("div",{className:"text-foreground truncate leading-5 font-semibold",children:"Sign in"}),e.jsx("div",{className:"text-default-500 truncate leading-5 font-normal",children:"Sign in to start chatting."})]}),e.jsx(c,{label:"Username",name:"username",labelPlacement:"outside",placeholder:"Your username",required:!0,isRequired:!0,value:a.username,onChange:d("username")}),e.jsx(c,{label:"Password",labelPlacement:"outside",id:"password",name:"password",type:"password",placeholder:"••••••••",required:!0,isRequired:!0,value:a.password,onChange:d("password")}),e.jsx(j,{children:f&&!u.isLoading&&e.jsx(v.div,{className:"text-small text-danger",initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.3,ease:"easeOut"},children:"We couldn't sign you in. Please verify your credentials and try again."})}),e.jsx(C,{type:"submit",color:a.password&&a.username?"primary":"default",children:"Sign in"})]})})}export{U as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as u,aW as s,aE as i,j as o,D as g,d,I as p}from"./index-
|
|
1
|
+
import{c as u,aW as s,aE as i,j as o,D as g,d,I as p}from"./index-anmhb6wk.js";import{a as n}from"./authStore-Dtjh8LvS.js";function m(){const r=u("/api/auth/logout",{headers:{"Content-Type":"application/json"},method:"POST"}),c=s(n,t=>t.logout),e=s(n,t=>t.token?.access_token),a=i(),l=async()=>{if(!e){a("/login");return}try{if(!(await r.call({body:{token:e}})).success)return;c(),a("/login")}catch(t){console.error("Failed to logout",t)}};return o.jsx(g,{content:"Logout",placement:"bottom",children:o.jsx(d,{isIconOnly:!0,"aria-label":"Logout",variant:"ghost",onPress:l,"data-testid":"logout-button",children:o.jsx(p,{icon:"heroicons:arrow-left-start-on-rectangle"})})})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{av as Gr,u as Jr,r as hr,i as Wr,j as I,D as qr,d as gr,I as Yr,m as Kr,e as Lr,f as Qr,aw as Vr}from"./index-aPw21Xcf.js";import{m as Xr}from"./chunk-IGSAU2ZA-CZpYjJJG.js";var T=Uint8Array,$=Uint16Array,jr=Int32Array,lr=new T([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),sr=new T([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pr=new T([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Nr=function(r,e){for(var a=new $(31),n=0;n<31;++n)a[n]=e+=1<<r[n-1];for(var t=new jr(a[30]),n=1;n<30;++n)for(var o=a[n];o<a[n+1];++o)t[o]=o-a[n]<<5|n;return{b:a,r:t}},_r=Nr(lr,2),zr=_r.b,mr=_r.r;zr[28]=258,mr[258]=28;var Rr=Nr(sr,0),Zr=Rr.b,Mr=Rr.r,Cr=new $(32768);for(var y=0;y<32768;++y){var Q=(y&43690)>>1|(y&21845)<<1;Q=(Q&52428)>>2|(Q&13107)<<2,Q=(Q&61680)>>4|(Q&3855)<<4,Cr[y]=((Q&65280)>>8|(Q&255)<<8)>>1}var q=function(r,e,a){for(var n=r.length,t=0,o=new $(e);t<n;++t)r[t]&&++o[r[t]-1];var v=new $(e);for(t=1;t<e;++t)v[t]=v[t-1]+o[t-1]<<1;var l;if(a){l=new $(1<<e);var h=15-e;for(t=0;t<n;++t)if(r[t])for(var c=t<<4|r[t],f=e-r[t],i=v[r[t]-1]++<<f,u=i|(1<<f)-1;i<=u;++i)l[Cr[i]>>h]=c}else for(l=new $(n),t=0;t<n;++t)r[t]&&(l[t]=Cr[v[r[t]-1]++]>>15-r[t]);return l},V=new T(288);for(var y=0;y<144;++y)V[y]=8;for(var y=144;y<256;++y)V[y]=9;for(var y=256;y<280;++y)V[y]=7;for(var y=280;y<288;++y)V[y]=8;var fr=new T(32);for(var y=0;y<32;++y)fr[y]=5;var re=q(V,9,0),ee=q(V,9,1),ae=q(fr,5,0),ne=q(fr,5,1),wr=function(r){for(var e=r[0],a=1;a<r.length;++a)r[a]>e&&(e=r[a]);return e},J=function(r,e,a){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&a},xr=function(r,e){var a=e/8|0;return(r[a]|r[a+1]<<8|r[a+2]<<16)>>(e&7)},Ar=function(r){return(r+7)/8|0},cr=function(r,e,a){return(e==null||e<0)&&(e=0),(a==null||a>r.length)&&(a=r.length),new T(r.subarray(e,a))},te=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],G=function(r,e,a){var n=new Error(e||te[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,G),!a)throw n;return n},oe=function(r,e,a,n){var t=r.length,o=0;if(!t||e.f&&!e.l)return a||new T(0);var v=!a,l=v||e.i!=2,h=e.i;v&&(a=new T(t*3));var c=function(ar){var nr=a.length;if(ar>nr){var rr=new T(Math.max(nr*2,ar));rr.set(a),a=rr}},f=e.f||0,i=e.p||0,u=e.b||0,x=e.l,S=e.d,w=e.m,d=e.n,m=t*8;do{if(!x){f=J(r,i,1);var R=J(r,i+1,3);if(i+=3,R)if(R==1)x=ee,S=ne,w=9,d=5;else if(R==2){var N=J(r,i,31)+257,A=J(r,i+10,15)+4,g=N+J(r,i+5,31)+1;i+=14;for(var s=new T(g),M=new T(19),C=0;C<A;++C)M[pr[C]]=J(r,i+C*3,7);i+=A*3;for(var k=wr(M),L=(1<<k)-1,U=q(M,k,1),C=0;C<g;){var _=U[J(r,i,L)];i+=_&15;var j=_>>4;if(j<16)s[C++]=j;else{var E=0,b=0;for(j==16?(b=3+J(r,i,3),i+=2,E=s[C-1]):j==17?(b=3+J(r,i,7),i+=3):j==18&&(b=11+J(r,i,127),i+=7);b--;)s[C++]=E}}var z=s.subarray(0,N),F=s.subarray(N);w=wr(z),d=wr(F),x=q(z,w,1),S=q(F,d,1)}else G(1);else{var j=Ar(i)+4,D=r[j-4]|r[j-3]<<8,O=j+D;if(O>t){h&&G(0);break}l&&c(u+D),a.set(r.subarray(j,O),u),e.b=u+=D,e.p=i=O*8,e.f=f;continue}if(i>m){h&&G(0);break}}l&&c(u+131072);for(var er=(1<<w)-1,B=(1<<d)-1,Y=i;;Y=i){var E=x[xr(r,i)&er],H=E>>4;if(i+=E&15,i>m){h&&G(0);break}if(E||G(2),H<256)a[u++]=H;else if(H==256){Y=i,x=null;break}else{var P=H-254;if(H>264){var C=H-257,p=lr[C];P=J(r,i,(1<<p)-1)+zr[C],i+=p}var W=S[xr(r,i)&B],X=W>>4;W||G(3),i+=W&15;var F=Zr[X];if(X>3){var p=sr[X];F+=xr(r,i)&(1<<p)-1,i+=p}if(i>m){h&&G(0);break}l&&c(u+131072);var Z=u+P;if(u<F){var ir=o-F,vr=Math.min(F,Z);for(ir+u<0&&G(3);u<vr;++u)a[u]=n[ir+u]}for(;u<Z;++u)a[u]=a[u-F]}}e.l=x,e.p=Y,e.b=u,e.f=f,x&&(f=1,e.m=w,e.d=S,e.n=d)}while(!f);return u!=a.length&&v?cr(a,0,u):a.subarray(0,u)},K=function(r,e,a){a<<=e&7;var n=e/8|0;r[n]|=a,r[n+1]|=a>>8},tr=function(r,e,a){a<<=e&7;var n=e/8|0;r[n]|=a,r[n+1]|=a>>8,r[n+2]|=a>>16},yr=function(r,e){for(var a=[],n=0;n<r.length;++n)r[n]&&a.push({s:n,f:r[n]});var t=a.length,o=a.slice();if(!t)return{t:Hr,l:0};if(t==1){var v=new T(a[0].s+1);return v[a[0].s]=1,{t:v,l:1}}a.sort(function(O,N){return O.f-N.f}),a.push({s:-1,f:25001});var l=a[0],h=a[1],c=0,f=1,i=2;for(a[0]={s:-1,f:l.f+h.f,l,r:h};f!=t-1;)l=a[a[c].f<a[i].f?c++:i++],h=a[c!=f&&a[c].f<a[i].f?c++:i++],a[f++]={s:-1,f:l.f+h.f,l,r:h};for(var u=o[0].s,n=1;n<t;++n)o[n].s>u&&(u=o[n].s);var x=new $(u+1),S=Tr(a[f-1],x,0);if(S>e){var n=0,w=0,d=S-e,m=1<<d;for(o.sort(function(N,A){return x[A.s]-x[N.s]||N.f-A.f});n<t;++n){var R=o[n].s;if(x[R]>e)w+=m-(1<<S-x[R]),x[R]=e;else break}for(w>>=d;w>0;){var j=o[n].s;x[j]<e?w-=1<<e-x[j]++-1:++n}for(;n>=0&&w;--n){var D=o[n].s;x[D]==e&&(--x[D],++w)}S=e}return{t:new T(x),l:S}},Tr=function(r,e,a){return r.s==-1?Math.max(Tr(r.l,e,a+1),Tr(r.r,e,a+1)):e[r.s]=a},Er=function(r){for(var e=r.length;e&&!r[--e];);for(var a=new $(++e),n=0,t=r[0],o=1,v=function(h){a[n++]=h},l=1;l<=e;++l)if(r[l]==t&&l!=e)++o;else{if(!t&&o>2){for(;o>138;o-=138)v(32754);o>2&&(v(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(v(t),--o;o>6;o-=6)v(8304);o>2&&(v(o-3<<5|8208),o=0)}for(;o--;)v(t);o=1,t=r[l]}return{c:a.subarray(0,n),n:e}},or=function(r,e){for(var a=0,n=0;n<e.length;++n)a+=r[n]*e[n];return a},Ur=function(r,e,a){var n=a.length,t=Ar(e+2);r[t]=n&255,r[t+1]=n>>8,r[t+2]=r[t]^255,r[t+3]=r[t+1]^255;for(var o=0;o<n;++o)r[t+o+4]=a[o];return(t+4+n)*8},Fr=function(r,e,a,n,t,o,v,l,h,c,f){K(e,f++,a),++t[256];for(var i=yr(t,15),u=i.t,x=i.l,S=yr(o,15),w=S.t,d=S.l,m=Er(u),R=m.c,j=m.n,D=Er(w),O=D.c,N=D.n,A=new $(19),g=0;g<R.length;++g)++A[R[g]&31];for(var g=0;g<O.length;++g)++A[O[g]&31];for(var s=yr(A,7),M=s.t,C=s.l,k=19;k>4&&!M[pr[k-1]];--k);var L=c+5<<3,U=or(t,V)+or(o,fr)+v,_=or(t,u)+or(o,w)+v+14+3*k+or(A,M)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&L<=U&&L<=_)return Ur(e,f,r.subarray(h,h+c));var E,b,z,F;if(K(e,f,1+(_<U)),f+=2,_<U){E=q(u,x,0),b=u,z=q(w,d,0),F=w;var er=q(M,C,0);K(e,f,j-257),K(e,f+5,N-1),K(e,f+10,k-4),f+=14;for(var g=0;g<k;++g)K(e,f+3*g,M[pr[g]]);f+=3*k;for(var B=[R,O],Y=0;Y<2;++Y)for(var H=B[Y],g=0;g<H.length;++g){var P=H[g]&31;K(e,f,er[P]),f+=M[P],P>15&&(K(e,f,H[g]>>5&127),f+=H[g]>>12)}}else E=re,b=V,z=ae,F=fr;for(var g=0;g<l;++g){var p=n[g];if(p>255){var P=p>>18&31;tr(e,f,E[P+257]),f+=b[P+257],P>7&&(K(e,f,p>>23&31),f+=lr[P]);var W=p&31;tr(e,f,z[W]),f+=F[W],W>3&&(tr(e,f,p>>5&8191),f+=sr[W])}else tr(e,f,E[p]),f+=b[p]}return tr(e,f,E[256]),f+b[256]},fe=new jr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hr=new T(0),ie=function(r,e,a,n,t,o){var v=o.z||r.length,l=new T(n+v+5*(1+Math.ceil(v/7e3))+t),h=l.subarray(n,l.length-t),c=o.l,f=(o.r||0)&7;if(e){f&&(h[0]=o.r>>3);for(var i=fe[e-1],u=i>>13,x=i&8191,S=(1<<a)-1,w=o.p||new $(32768),d=o.h||new $(S+1),m=Math.ceil(a/3),R=2*m,j=function(ur){return(r[ur]^r[ur+1]<<m^r[ur+2]<<R)&S},D=new jr(25e3),O=new $(288),N=new $(32),A=0,g=0,s=o.i||0,M=0,C=o.w||0,k=0;s+2<v;++s){var L=j(s),U=s&32767,_=d[L];if(w[U]=_,d[L]=U,C<=s){var E=v-s;if((A>7e3||M>24576)&&(E>423||!c)){f=Fr(r,h,0,D,O,N,g,M,k,s-k,f),M=A=g=0,k=s;for(var b=0;b<286;++b)O[b]=0;for(var b=0;b<30;++b)N[b]=0}var z=2,F=0,er=x,B=U-_&32767;if(E>2&&L==j(s-B))for(var Y=Math.min(u,E)-1,H=Math.min(32767,s),P=Math.min(258,E);B<=H&&--er&&U!=_;){if(r[s+z]==r[s+z-B]){for(var p=0;p<P&&r[s+p]==r[s+p-B];++p);if(p>z){if(z=p,F=B,p>Y)break;for(var W=Math.min(B,p-2),X=0,b=0;b<W;++b){var Z=s-B+b&32767,ir=w[Z],vr=Z-ir&32767;vr>X&&(X=vr,_=Z)}}}U=_,_=w[U],B+=U-_&32767}if(F){D[M++]=268435456|mr[z]<<18|Mr[F];var ar=mr[z]&31,nr=Mr[F]&31;g+=lr[ar]+sr[nr],++O[257+ar],++N[nr],C=s+z,++A}else D[M++]=r[s],++O[r[s]]}}for(s=Math.max(s,C);s<v;++s)D[M++]=r[s],++O[r[s]];f=Fr(r,h,c,D,O,N,g,M,k,s-k,f),c||(o.r=f&7|h[f/8|0]<<3,f-=7,o.h=d,o.p=w,o.i=s,o.w=C)}else{for(var s=o.w||0;s<v+c;s+=65535){var rr=s+65535;rr>=v&&(h[f/8|0]=c,rr=v),f=Ur(h,f+1,r.subarray(s,rr))}o.i=v}return cr(l,0,n+Ar(f)+t)},Pr=function(){var r=1,e=0;return{p:function(a){for(var n=r,t=e,o=a.length|0,v=0;v!=o;){for(var l=Math.min(v+2655,o);v<l;++v)t+=n+=a[v];n=(n&65535)+15*(n>>16),t=(t&65535)+15*(t>>16)}r=n,e=t},d:function(){return r%=65521,e%=65521,(r&255)<<24|(r&65280)<<8|(e&255)<<8|e>>8}}},ve=function(r,e,a,n,t){if(!t&&(t={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),v=new T(o.length+r.length);v.set(o),v.set(r,o.length),r=v,t.w=o.length}return ie(r,e.level==null?6:e.level,e.mem==null?t.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+e.mem,a,n,t)},$r=function(r,e,a){for(;a;++e)r[e]=a,a>>>=8},le=function(r,e){var a=e.level,n=a==0?0:a<6?1:a==9?3:2;if(r[0]=120,r[1]=n<<6|(e.dictionary&&32),r[1]|=31-(r[0]<<8|r[1])%31,e.dictionary){var t=Pr();t.p(e.dictionary),$r(r,2,t.d())}},se=function(r,e){return((r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31)&&G(6,"invalid zlib data"),(r[1]>>5&1)==1&&G(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function ce(r,e){e||(e={});var a=Pr();a.p(r);var n=ve(r,e,e.dictionary?6:2,4);return le(n,e),$r(n,n.length-4,a.d()),n}function ue(r,e){return oe(r.subarray(se(r),-4),{i:2},e,e)}var Or=typeof TextEncoder<"u"&&new TextEncoder,dr=typeof TextDecoder<"u"&&new TextDecoder,he=0;try{dr.decode(Hr,{stream:!0}),he=1}catch{}var ge=function(r){for(var e="",a=0;;){var n=r[a++],t=(n>127)+(n>223)+(n>239);if(a+t>r.length)return{s:e,r:cr(r,a-1)};t?t==3?(n=((n&15)<<18|(r[a++]&63)<<12|(r[a++]&63)<<6|r[a++]&63)-65536,e+=String.fromCharCode(55296|n>>10,56320|n&1023)):t&1?e+=String.fromCharCode((n&31)<<6|r[a++]&63):e+=String.fromCharCode((n&15)<<12|(r[a++]&63)<<6|r[a++]&63):e+=String.fromCharCode(n)}};function kr(r,e){if(e){for(var a=new T(r.length),n=0;n<r.length;++n)a[n]=r.charCodeAt(n);return a}if(Or)return Or.encode(r);for(var t=r.length,o=new T(r.length+(r.length>>1)),v=0,l=function(f){o[v++]=f},n=0;n<t;++n){if(v+5>o.length){var h=new T(v+8+(t-n<<1));h.set(o),o=h}var c=r.charCodeAt(n);c<128||e?l(c):c<2048?(l(192|c>>6),l(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|r.charCodeAt(++n)&1023,l(240|c>>18),l(128|c>>12&63),l(128|c>>6&63),l(128|c&63)):(l(224|c>>12),l(128|c>>6&63),l(128|c&63))}return cr(o,0,v)}function Ir(r,e){if(e){for(var a="",n=0;n<r.length;n+=16384)a+=String.fromCharCode.apply(null,r.subarray(n,n+16384));return a}else{if(dr)return dr.decode(r);var t=ge(r),o=t.s,a=t.r;return a.length&&G(8),o}}const Dr="heroicons:share",we="heroicons:check",Br="RAGBITS-STATE",Sr=`<${Br}>`,br=`</${Br}>`;function xe(r){if(typeof r!="object"||r===null)return!1;const e=r;return!(typeof e.history!="object"||"followupMessages"in e&&typeof e.followupMessages!="object"||"chatOptions"in e&&typeof e.chatOptions!="object"||"serverState"in e&&typeof e.serverState!="object"||"conversationId"in e&&typeof e.conversationId!="string"&&typeof e.conversationId!="object")}function be(){const{restore:r}=Gr(),{isOpen:e,onOpen:a,onClose:n}=Jr(),[t,o]=hr.useState(Dr),v=hr.useRef(null),{getCurrentConversation:l}=Wr(f=>f.primitives),h=()=>{const{chatOptions:f,history:i,serverState:u,conversationId:x,followupMessages:S}=l(),w=Vr({chatOptions:f,history:i,serverState:u,conversationId:x,followupMessages:S}),d=kr(`${Sr}${JSON.stringify(w)}${br}`),m=btoa(Ir(ce(d,{level:9}),!0));navigator.clipboard.writeText(m),o(we),n(),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{o(Dr)},2e3)},c=()=>{n()};return hr.useEffect(()=>{const f=i=>{if(!i.clipboardData)return;const u=i.clipboardData.types;if(!u.includes("text/plain")&&!u.includes("text"))return;const x=i.clipboardData.getData("text/plain")??i.clipboardData.getData("text");try{const S=atob(x);if(!S.startsWith("xÚ"))return;const w=Ir(ue(kr(S,!0)));if(!w.startsWith(Sr)||!w.endsWith(br))return;i.preventDefault(),i.stopPropagation();const d=w.slice(Sr.length,-br.length),m=JSON.parse(d);if(!xe(m))return;r(m.history,m.followupMessages,m.chatOptions,m.serverState,m.conversationId)}catch(S){console.error("Couldn't parse pasted string as valid Ragbits state",S)}};return window.addEventListener("paste",f),()=>{window.removeEventListener("paste",f)}}),I.jsxs(I.Fragment,{children:[I.jsx(qr,{content:"Share conversation",placement:"bottom",children:I.jsx(gr,{isIconOnly:!0,variant:"ghost",className:"p-0","aria-label":"Share conversation",onPress:a,children:I.jsx(Yr,{icon:t})})}),I.jsx(Kr,{isOpen:e,onOpenChange:c,children:I.jsx(Lr,{children:f=>I.jsxs(I.Fragment,{children:[I.jsx(Xr,{className:"text-default-900 flex flex-col gap-1",children:"Share conversation"}),I.jsx(Qr,{children:I.jsxs("div",{className:"flex flex-col gap-4",children:[I.jsx("p",{className:"text-medium text-default-500",children:"You are about to copy a code that allows sharing and storing your current app state. Once copied, you can paste this code anywhere on the site to instantly return to this exact setup. It’s a quick way to save your progress or share it with others."}),I.jsxs("div",{className:"flex justify-end gap-4 py-4",children:[I.jsx(gr,{color:"danger",variant:"light",onPress:f,"aria-label":"Close share modal",children:"Cancel"}),I.jsx(gr,{color:"primary",onPress:h,"aria-label":"Copy to clipboard to share the conversation",children:"Copy to clipboard"})]})]})})]})})})]})}export{be as default};
|
|
1
|
+
import{av as Gr,u as Jr,r as hr,i as Wr,j as I,D as qr,d as gr,I as Yr,m as Kr,e as Lr,f as Qr,aw as Vr}from"./index-anmhb6wk.js";import{m as Xr}from"./chunk-IGSAU2ZA-DCwEaDm9.js";var T=Uint8Array,$=Uint16Array,jr=Int32Array,lr=new T([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),sr=new T([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pr=new T([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Nr=function(r,e){for(var a=new $(31),n=0;n<31;++n)a[n]=e+=1<<r[n-1];for(var t=new jr(a[30]),n=1;n<30;++n)for(var o=a[n];o<a[n+1];++o)t[o]=o-a[n]<<5|n;return{b:a,r:t}},_r=Nr(lr,2),zr=_r.b,mr=_r.r;zr[28]=258,mr[258]=28;var Rr=Nr(sr,0),Zr=Rr.b,Mr=Rr.r,Cr=new $(32768);for(var y=0;y<32768;++y){var Q=(y&43690)>>1|(y&21845)<<1;Q=(Q&52428)>>2|(Q&13107)<<2,Q=(Q&61680)>>4|(Q&3855)<<4,Cr[y]=((Q&65280)>>8|(Q&255)<<8)>>1}var q=function(r,e,a){for(var n=r.length,t=0,o=new $(e);t<n;++t)r[t]&&++o[r[t]-1];var v=new $(e);for(t=1;t<e;++t)v[t]=v[t-1]+o[t-1]<<1;var l;if(a){l=new $(1<<e);var h=15-e;for(t=0;t<n;++t)if(r[t])for(var c=t<<4|r[t],f=e-r[t],i=v[r[t]-1]++<<f,u=i|(1<<f)-1;i<=u;++i)l[Cr[i]>>h]=c}else for(l=new $(n),t=0;t<n;++t)r[t]&&(l[t]=Cr[v[r[t]-1]++]>>15-r[t]);return l},V=new T(288);for(var y=0;y<144;++y)V[y]=8;for(var y=144;y<256;++y)V[y]=9;for(var y=256;y<280;++y)V[y]=7;for(var y=280;y<288;++y)V[y]=8;var fr=new T(32);for(var y=0;y<32;++y)fr[y]=5;var re=q(V,9,0),ee=q(V,9,1),ae=q(fr,5,0),ne=q(fr,5,1),wr=function(r){for(var e=r[0],a=1;a<r.length;++a)r[a]>e&&(e=r[a]);return e},J=function(r,e,a){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&a},xr=function(r,e){var a=e/8|0;return(r[a]|r[a+1]<<8|r[a+2]<<16)>>(e&7)},Ar=function(r){return(r+7)/8|0},cr=function(r,e,a){return(e==null||e<0)&&(e=0),(a==null||a>r.length)&&(a=r.length),new T(r.subarray(e,a))},te=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],G=function(r,e,a){var n=new Error(e||te[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,G),!a)throw n;return n},oe=function(r,e,a,n){var t=r.length,o=0;if(!t||e.f&&!e.l)return a||new T(0);var v=!a,l=v||e.i!=2,h=e.i;v&&(a=new T(t*3));var c=function(ar){var nr=a.length;if(ar>nr){var rr=new T(Math.max(nr*2,ar));rr.set(a),a=rr}},f=e.f||0,i=e.p||0,u=e.b||0,x=e.l,S=e.d,w=e.m,d=e.n,m=t*8;do{if(!x){f=J(r,i,1);var R=J(r,i+1,3);if(i+=3,R)if(R==1)x=ee,S=ne,w=9,d=5;else if(R==2){var N=J(r,i,31)+257,A=J(r,i+10,15)+4,g=N+J(r,i+5,31)+1;i+=14;for(var s=new T(g),M=new T(19),C=0;C<A;++C)M[pr[C]]=J(r,i+C*3,7);i+=A*3;for(var k=wr(M),L=(1<<k)-1,U=q(M,k,1),C=0;C<g;){var _=U[J(r,i,L)];i+=_&15;var j=_>>4;if(j<16)s[C++]=j;else{var E=0,b=0;for(j==16?(b=3+J(r,i,3),i+=2,E=s[C-1]):j==17?(b=3+J(r,i,7),i+=3):j==18&&(b=11+J(r,i,127),i+=7);b--;)s[C++]=E}}var z=s.subarray(0,N),F=s.subarray(N);w=wr(z),d=wr(F),x=q(z,w,1),S=q(F,d,1)}else G(1);else{var j=Ar(i)+4,D=r[j-4]|r[j-3]<<8,O=j+D;if(O>t){h&&G(0);break}l&&c(u+D),a.set(r.subarray(j,O),u),e.b=u+=D,e.p=i=O*8,e.f=f;continue}if(i>m){h&&G(0);break}}l&&c(u+131072);for(var er=(1<<w)-1,B=(1<<d)-1,Y=i;;Y=i){var E=x[xr(r,i)&er],H=E>>4;if(i+=E&15,i>m){h&&G(0);break}if(E||G(2),H<256)a[u++]=H;else if(H==256){Y=i,x=null;break}else{var P=H-254;if(H>264){var C=H-257,p=lr[C];P=J(r,i,(1<<p)-1)+zr[C],i+=p}var W=S[xr(r,i)&B],X=W>>4;W||G(3),i+=W&15;var F=Zr[X];if(X>3){var p=sr[X];F+=xr(r,i)&(1<<p)-1,i+=p}if(i>m){h&&G(0);break}l&&c(u+131072);var Z=u+P;if(u<F){var ir=o-F,vr=Math.min(F,Z);for(ir+u<0&&G(3);u<vr;++u)a[u]=n[ir+u]}for(;u<Z;++u)a[u]=a[u-F]}}e.l=x,e.p=Y,e.b=u,e.f=f,x&&(f=1,e.m=w,e.d=S,e.n=d)}while(!f);return u!=a.length&&v?cr(a,0,u):a.subarray(0,u)},K=function(r,e,a){a<<=e&7;var n=e/8|0;r[n]|=a,r[n+1]|=a>>8},tr=function(r,e,a){a<<=e&7;var n=e/8|0;r[n]|=a,r[n+1]|=a>>8,r[n+2]|=a>>16},yr=function(r,e){for(var a=[],n=0;n<r.length;++n)r[n]&&a.push({s:n,f:r[n]});var t=a.length,o=a.slice();if(!t)return{t:Hr,l:0};if(t==1){var v=new T(a[0].s+1);return v[a[0].s]=1,{t:v,l:1}}a.sort(function(O,N){return O.f-N.f}),a.push({s:-1,f:25001});var l=a[0],h=a[1],c=0,f=1,i=2;for(a[0]={s:-1,f:l.f+h.f,l,r:h};f!=t-1;)l=a[a[c].f<a[i].f?c++:i++],h=a[c!=f&&a[c].f<a[i].f?c++:i++],a[f++]={s:-1,f:l.f+h.f,l,r:h};for(var u=o[0].s,n=1;n<t;++n)o[n].s>u&&(u=o[n].s);var x=new $(u+1),S=Tr(a[f-1],x,0);if(S>e){var n=0,w=0,d=S-e,m=1<<d;for(o.sort(function(N,A){return x[A.s]-x[N.s]||N.f-A.f});n<t;++n){var R=o[n].s;if(x[R]>e)w+=m-(1<<S-x[R]),x[R]=e;else break}for(w>>=d;w>0;){var j=o[n].s;x[j]<e?w-=1<<e-x[j]++-1:++n}for(;n>=0&&w;--n){var D=o[n].s;x[D]==e&&(--x[D],++w)}S=e}return{t:new T(x),l:S}},Tr=function(r,e,a){return r.s==-1?Math.max(Tr(r.l,e,a+1),Tr(r.r,e,a+1)):e[r.s]=a},Er=function(r){for(var e=r.length;e&&!r[--e];);for(var a=new $(++e),n=0,t=r[0],o=1,v=function(h){a[n++]=h},l=1;l<=e;++l)if(r[l]==t&&l!=e)++o;else{if(!t&&o>2){for(;o>138;o-=138)v(32754);o>2&&(v(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(v(t),--o;o>6;o-=6)v(8304);o>2&&(v(o-3<<5|8208),o=0)}for(;o--;)v(t);o=1,t=r[l]}return{c:a.subarray(0,n),n:e}},or=function(r,e){for(var a=0,n=0;n<e.length;++n)a+=r[n]*e[n];return a},Ur=function(r,e,a){var n=a.length,t=Ar(e+2);r[t]=n&255,r[t+1]=n>>8,r[t+2]=r[t]^255,r[t+3]=r[t+1]^255;for(var o=0;o<n;++o)r[t+o+4]=a[o];return(t+4+n)*8},Fr=function(r,e,a,n,t,o,v,l,h,c,f){K(e,f++,a),++t[256];for(var i=yr(t,15),u=i.t,x=i.l,S=yr(o,15),w=S.t,d=S.l,m=Er(u),R=m.c,j=m.n,D=Er(w),O=D.c,N=D.n,A=new $(19),g=0;g<R.length;++g)++A[R[g]&31];for(var g=0;g<O.length;++g)++A[O[g]&31];for(var s=yr(A,7),M=s.t,C=s.l,k=19;k>4&&!M[pr[k-1]];--k);var L=c+5<<3,U=or(t,V)+or(o,fr)+v,_=or(t,u)+or(o,w)+v+14+3*k+or(A,M)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&L<=U&&L<=_)return Ur(e,f,r.subarray(h,h+c));var E,b,z,F;if(K(e,f,1+(_<U)),f+=2,_<U){E=q(u,x,0),b=u,z=q(w,d,0),F=w;var er=q(M,C,0);K(e,f,j-257),K(e,f+5,N-1),K(e,f+10,k-4),f+=14;for(var g=0;g<k;++g)K(e,f+3*g,M[pr[g]]);f+=3*k;for(var B=[R,O],Y=0;Y<2;++Y)for(var H=B[Y],g=0;g<H.length;++g){var P=H[g]&31;K(e,f,er[P]),f+=M[P],P>15&&(K(e,f,H[g]>>5&127),f+=H[g]>>12)}}else E=re,b=V,z=ae,F=fr;for(var g=0;g<l;++g){var p=n[g];if(p>255){var P=p>>18&31;tr(e,f,E[P+257]),f+=b[P+257],P>7&&(K(e,f,p>>23&31),f+=lr[P]);var W=p&31;tr(e,f,z[W]),f+=F[W],W>3&&(tr(e,f,p>>5&8191),f+=sr[W])}else tr(e,f,E[p]),f+=b[p]}return tr(e,f,E[256]),f+b[256]},fe=new jr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hr=new T(0),ie=function(r,e,a,n,t,o){var v=o.z||r.length,l=new T(n+v+5*(1+Math.ceil(v/7e3))+t),h=l.subarray(n,l.length-t),c=o.l,f=(o.r||0)&7;if(e){f&&(h[0]=o.r>>3);for(var i=fe[e-1],u=i>>13,x=i&8191,S=(1<<a)-1,w=o.p||new $(32768),d=o.h||new $(S+1),m=Math.ceil(a/3),R=2*m,j=function(ur){return(r[ur]^r[ur+1]<<m^r[ur+2]<<R)&S},D=new jr(25e3),O=new $(288),N=new $(32),A=0,g=0,s=o.i||0,M=0,C=o.w||0,k=0;s+2<v;++s){var L=j(s),U=s&32767,_=d[L];if(w[U]=_,d[L]=U,C<=s){var E=v-s;if((A>7e3||M>24576)&&(E>423||!c)){f=Fr(r,h,0,D,O,N,g,M,k,s-k,f),M=A=g=0,k=s;for(var b=0;b<286;++b)O[b]=0;for(var b=0;b<30;++b)N[b]=0}var z=2,F=0,er=x,B=U-_&32767;if(E>2&&L==j(s-B))for(var Y=Math.min(u,E)-1,H=Math.min(32767,s),P=Math.min(258,E);B<=H&&--er&&U!=_;){if(r[s+z]==r[s+z-B]){for(var p=0;p<P&&r[s+p]==r[s+p-B];++p);if(p>z){if(z=p,F=B,p>Y)break;for(var W=Math.min(B,p-2),X=0,b=0;b<W;++b){var Z=s-B+b&32767,ir=w[Z],vr=Z-ir&32767;vr>X&&(X=vr,_=Z)}}}U=_,_=w[U],B+=U-_&32767}if(F){D[M++]=268435456|mr[z]<<18|Mr[F];var ar=mr[z]&31,nr=Mr[F]&31;g+=lr[ar]+sr[nr],++O[257+ar],++N[nr],C=s+z,++A}else D[M++]=r[s],++O[r[s]]}}for(s=Math.max(s,C);s<v;++s)D[M++]=r[s],++O[r[s]];f=Fr(r,h,c,D,O,N,g,M,k,s-k,f),c||(o.r=f&7|h[f/8|0]<<3,f-=7,o.h=d,o.p=w,o.i=s,o.w=C)}else{for(var s=o.w||0;s<v+c;s+=65535){var rr=s+65535;rr>=v&&(h[f/8|0]=c,rr=v),f=Ur(h,f+1,r.subarray(s,rr))}o.i=v}return cr(l,0,n+Ar(f)+t)},Pr=function(){var r=1,e=0;return{p:function(a){for(var n=r,t=e,o=a.length|0,v=0;v!=o;){for(var l=Math.min(v+2655,o);v<l;++v)t+=n+=a[v];n=(n&65535)+15*(n>>16),t=(t&65535)+15*(t>>16)}r=n,e=t},d:function(){return r%=65521,e%=65521,(r&255)<<24|(r&65280)<<8|(e&255)<<8|e>>8}}},ve=function(r,e,a,n,t){if(!t&&(t={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),v=new T(o.length+r.length);v.set(o),v.set(r,o.length),r=v,t.w=o.length}return ie(r,e.level==null?6:e.level,e.mem==null?t.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+e.mem,a,n,t)},$r=function(r,e,a){for(;a;++e)r[e]=a,a>>>=8},le=function(r,e){var a=e.level,n=a==0?0:a<6?1:a==9?3:2;if(r[0]=120,r[1]=n<<6|(e.dictionary&&32),r[1]|=31-(r[0]<<8|r[1])%31,e.dictionary){var t=Pr();t.p(e.dictionary),$r(r,2,t.d())}},se=function(r,e){return((r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31)&&G(6,"invalid zlib data"),(r[1]>>5&1)==1&&G(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function ce(r,e){e||(e={});var a=Pr();a.p(r);var n=ve(r,e,e.dictionary?6:2,4);return le(n,e),$r(n,n.length-4,a.d()),n}function ue(r,e){return oe(r.subarray(se(r),-4),{i:2},e,e)}var Or=typeof TextEncoder<"u"&&new TextEncoder,dr=typeof TextDecoder<"u"&&new TextDecoder,he=0;try{dr.decode(Hr,{stream:!0}),he=1}catch{}var ge=function(r){for(var e="",a=0;;){var n=r[a++],t=(n>127)+(n>223)+(n>239);if(a+t>r.length)return{s:e,r:cr(r,a-1)};t?t==3?(n=((n&15)<<18|(r[a++]&63)<<12|(r[a++]&63)<<6|r[a++]&63)-65536,e+=String.fromCharCode(55296|n>>10,56320|n&1023)):t&1?e+=String.fromCharCode((n&31)<<6|r[a++]&63):e+=String.fromCharCode((n&15)<<12|(r[a++]&63)<<6|r[a++]&63):e+=String.fromCharCode(n)}};function kr(r,e){if(e){for(var a=new T(r.length),n=0;n<r.length;++n)a[n]=r.charCodeAt(n);return a}if(Or)return Or.encode(r);for(var t=r.length,o=new T(r.length+(r.length>>1)),v=0,l=function(f){o[v++]=f},n=0;n<t;++n){if(v+5>o.length){var h=new T(v+8+(t-n<<1));h.set(o),o=h}var c=r.charCodeAt(n);c<128||e?l(c):c<2048?(l(192|c>>6),l(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|r.charCodeAt(++n)&1023,l(240|c>>18),l(128|c>>12&63),l(128|c>>6&63),l(128|c&63)):(l(224|c>>12),l(128|c>>6&63),l(128|c&63))}return cr(o,0,v)}function Ir(r,e){if(e){for(var a="",n=0;n<r.length;n+=16384)a+=String.fromCharCode.apply(null,r.subarray(n,n+16384));return a}else{if(dr)return dr.decode(r);var t=ge(r),o=t.s,a=t.r;return a.length&&G(8),o}}const Dr="heroicons:share",we="heroicons:check",Br="RAGBITS-STATE",Sr=`<${Br}>`,br=`</${Br}>`;function xe(r){if(typeof r!="object"||r===null)return!1;const e=r;return!(typeof e.history!="object"||"followupMessages"in e&&typeof e.followupMessages!="object"||"chatOptions"in e&&typeof e.chatOptions!="object"||"serverState"in e&&typeof e.serverState!="object"||"conversationId"in e&&typeof e.conversationId!="string"&&typeof e.conversationId!="object")}function be(){const{restore:r}=Gr(),{isOpen:e,onOpen:a,onClose:n}=Jr(),[t,o]=hr.useState(Dr),v=hr.useRef(null),{getCurrentConversation:l}=Wr(f=>f.primitives),h=()=>{const{chatOptions:f,history:i,serverState:u,conversationId:x,followupMessages:S}=l(),w=Vr({chatOptions:f,history:i,serverState:u,conversationId:x,followupMessages:S}),d=kr(`${Sr}${JSON.stringify(w)}${br}`),m=btoa(Ir(ce(d,{level:9}),!0));navigator.clipboard.writeText(m),o(we),n(),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{o(Dr)},2e3)},c=()=>{n()};return hr.useEffect(()=>{const f=i=>{if(!i.clipboardData)return;const u=i.clipboardData.types;if(!u.includes("text/plain")&&!u.includes("text"))return;const x=i.clipboardData.getData("text/plain")??i.clipboardData.getData("text");try{const S=atob(x);if(!S.startsWith("xÚ"))return;const w=Ir(ue(kr(S,!0)));if(!w.startsWith(Sr)||!w.endsWith(br))return;i.preventDefault(),i.stopPropagation();const d=w.slice(Sr.length,-br.length),m=JSON.parse(d);if(!xe(m))return;r(m.history,m.followupMessages,m.chatOptions,m.serverState,m.conversationId)}catch(S){console.error("Couldn't parse pasted string as valid Ragbits state",S)}};return window.addEventListener("paste",f),()=>{window.removeEventListener("paste",f)}}),I.jsxs(I.Fragment,{children:[I.jsx(qr,{content:"Share conversation",placement:"bottom",children:I.jsx(gr,{isIconOnly:!0,variant:"ghost",className:"p-0","aria-label":"Share conversation",onPress:a,children:I.jsx(Yr,{icon:t})})}),I.jsx(Kr,{isOpen:e,onOpenChange:c,children:I.jsx(Lr,{children:f=>I.jsxs(I.Fragment,{children:[I.jsx(Xr,{className:"text-default-900 flex flex-col gap-1",children:"Share conversation"}),I.jsx(Qr,{children:I.jsxs("div",{className:"flex flex-col gap-4",children:[I.jsx("p",{className:"text-medium text-default-500",children:"You are about to copy a code that allows sharing and storing your current app state. Once copied, you can paste this code anywhere on the site to instantly return to this exact setup. It’s a quick way to save your progress or share it with others."}),I.jsxs("div",{className:"flex justify-end gap-4 py-4",children:[I.jsx(gr,{color:"danger",variant:"light",onPress:f,"aria-label":"Close share modal",children:"Cancel"}),I.jsx(gr,{color:"primary",onPress:h,"aria-label":"Copy to clipboard to share the conversation",children:"Copy to clipboard"})]})]})})]})})})]})}export{be as default};
|