!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a09faf-51cd-7e82-8562-1e20282100ad")}catch(e){}}();(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,607918,789122,e=>{"use strict";let t=new Map;function r(e,r,i){return null==e?"":(function(e,r){let i=JSON.stringify({locale:e,options:r}),n=t.get(i);if(n)return n;let a=new Intl.NumberFormat(e,r);return t.set(i,a),a})(r,i).format(e)}e.s(["formatNumber",0,r,"formatNumberValue",0,function(e,t,i){return null==e?"":i?r(e,t,i):r(e/100,t,{style:"percent"})}],607918),e.s(["valueToPercent",0,function(e,t,r){return(e-t)*100/(r-t)}],789122)},239718,e=>{"use strict";var t=e.i(270401);let r=t.forwardRef(function({title:e,titleId:r,...i},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":r},i),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 12a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM12.75 12a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM18.75 12a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Z"}))});e.s(["EllipsisHorizontalIcon",0,r],239718)},323813,e=>{"use strict";let t=(0,e.i(202913).default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);e.s(["ChevronsUpDown",0,t],323813)},120612,e=>{"use strict";var t=e.i(222666),r=e.i(505962);e.s([],297422),e.i(297422);var i=e.i(270401),n=e.i(214977),a=e.i(159683),l=e.i(517450),s=e.i(466425),o=e.i(38014),c=e.i(726013),d=e.i(269702),u=e.i(279475),m=e.i(831226),h=e.i(964582),f=e.i(936954),g=e.i(335912),x=e.i(570081);e.s(["Backdrop",()=>o.DialogBackdrop,"Close",()=>c.DialogClose,"Description",()=>d.DialogDescription,"Handle",()=>x.DialogHandle,"Popup",()=>u.DialogPopup,"Portal",()=>m.DialogPortal,"Root",0,function(e){let{children:r,open:o,defaultOpen:c=!1,onOpenChange:d,onOpenChangeComplete:u,actionsRef:m,handle:h,triggerId:f,defaultTriggerId:g=null}=e,x=(0,l.useDialogRootContext)(!0),p=!!x,b=s.DialogStore.useStore(h?.store,{open:c,openProp:o,activeTriggerId:g,triggerIdProp:f,modal:!0,disablePointerDismissal:!0,nested:p,role:"alertdialog"});b.useControlledProp("openProp",o),b.useControlledProp("triggerIdProp",f),b.useSyncedValue("nested",p),b.useContextCallback("onOpenChange",d),b.useContextCallback("onOpenChangeComplete",u);let v=b.useState("payload");(0,a.useDialogRoot)({store:b,actionsRef:m,parentContext:x?.store.context,isDrawer:!1,onOpenChange:d,triggerIdProp:f});let w=i.useMemo(()=>({store:b}),[b]);return(0,t.jsx)(n.IsDrawerContext.Provider,{value:!1,children:(0,t.jsx)(l.DialogRootContext.Provider,{value:w,children:"function"==typeof r?r({payload:v}):r})})},"Title",()=>h.DialogTitle,"Trigger",()=>f.DialogTrigger,"Viewport",()=>g.DialogViewport,"createHandle",0,function(){return new x.DialogHandle(new s.DialogStore({modal:!0,disablePointerDismissal:!0,role:"alertdialog"}))}],246346);var p=e.i(246346),p=p,b=e.i(452473),v=e.i(562580),w=e.i(320187),j=e.i(147680);let y=p.Root,k=p.Portal;function N(e){let i,n,a,l,s,o=(0,r.c)(10);return o[0]!==e?({className:i,ref:a,...n}=e,o[0]=e,o[1]=i,o[2]=n,o[3]=a):(i=o[1],n=o[2],a=o[3]),o[4]!==i?(l=(0,b.cn)("fixed inset-0 z-alert bg-black/50",j.overlayMotion,i),o[4]=i,o[5]=l):l=o[5],o[6]!==n||o[7]!==a||o[8]!==l?(s=(0,t.jsx)(p.Backdrop,{className:l,"data-slot":"alert-dialog-overlay",...n,forceRender:!0,ref:a}),o[6]=n,o[7]=a,o[8]=l,o[9]=s):s=o[9],s}e.s(["AlertDialog",0,y,"AlertDialogAction",0,function(e){let i,n,a,l,s,o=(0,r.c)(10);return o[0]!==e?({className:i,ref:a,...n}=e,o[0]=e,o[1]=i,o[2]=n,o[3]=a):(i=o[1],n=o[2],a=o[3]),o[4]!==i?(l=(0,b.cn)((0,v.buttonVariants)({size:"sm"}),i),o[4]=i,o[5]=l):l=o[5],o[6]!==n||o[7]!==a||o[8]!==l?(s=(0,t.jsx)(p.Close,{ref:a,className:l,...n}),o[6]=n,o[7]=a,o[8]=l,o[9]=s):s=o[9],s},"AlertDialogCancel",0,function(e){let i,n,a,l,s,o=(0,r.c)(10);return o[0]!==e?({className:i,ref:a,...n}=e,o[0]=e,o[1]=i,o[2]=n,o[3]=a):(i=o[1],n=o[2],a=o[3]),o[4]!==i?(l=(0,b.cn)((0,v.buttonVariants)({variant:"outline",size:"sm"}),"mt-2 sm:mt-0",i),o[4]=i,o[5]=l):l=o[5],o[6]!==n||o[7]!==a||o[8]!==l?(s=(0,t.jsx)(p.Close,{ref:a,className:l,...n}),o[6]=n,o[7]=a,o[8]=l,o[9]=s):s=o[9],s},"AlertDialogContent",0,function(e){let i,n,a,l,s,o,c,d,u=(0,r.c)(15);return u[0]!==e?({className:n,children:i,ref:l,...a}=e,u[0]=e,u[1]=i,u[2]=n,u[3]=a,u[4]=l):(i=u[1],n=u[2],a=u[3],l=u[4]),u[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(N,{}),u[5]=s):s=u[5],u[6]!==n?(o=(0,b.cn)("fixed left-[50%] top-[50%] z-alert grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-popover text-popover-foreground p-6 shadow-lg rounded-lg",j.dialogMotion,n),u[6]=n,u[7]=o):o=u[7],u[8]!==i?(c=(0,t.jsx)(w.FloatingLayerProvider,{layer:"alert",children:i}),u[8]=i,u[9]=c):c=u[9],u[10]!==a||u[11]!==l||u[12]!==o||u[13]!==c?(d=(0,t.jsxs)(k,{keepMounted:!0,children:[s,(0,t.jsx)(p.Popup,{ref:l,className:o,...a,children:c})]}),u[10]=a,u[11]=l,u[12]=o,u[13]=c,u[14]=d):d=u[14],d},"AlertDialogDescription",0,function(e){let i,n,a,l,s,o=(0,r.c)(10);return o[0]!==e?({className:i,ref:a,...n}=e,o[0]=e,o[1]=i,o[2]=n,o[3]=a):(i=o[1],n=o[2],a=o[3]),o[4]!==i?(l=(0,b.cn)("text-body text-muted-foreground",i),o[4]=i,o[5]=l):l=o[5],o[6]!==n||o[7]!==a||o[8]!==l?(s=(0,t.jsx)(p.Description,{ref:a,className:l,...n}),o[6]=n,o[7]=a,o[8]=l,o[9]=s):s=o[9],s},"AlertDialogFooter",0,function(e){let i,n,a,l,s=(0,r.c)(8);return s[0]!==e?({className:i,...n}=e,s[0]=e,s[1]=i,s[2]=n):(i=s[1],n=s[2]),s[3]!==i?(a=(0,b.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-x-2",i),s[3]=i,s[4]=a):a=s[4],s[5]!==n||s[6]!==a?(l=(0,t.jsx)("div",{className:a,...n}),s[5]=n,s[6]=a,s[7]=l):l=s[7],l},"AlertDialogHeader",0,function(e){let i,n,a,l,s=(0,r.c)(8);return s[0]!==e?({className:i,...n}=e,s[0]=e,s[1]=i,s[2]=n):(i=s[1],n=s[2]),s[3]!==i?(a=(0,b.cn)("flex flex-col gap-y-2 text-center sm:text-left",i),s[3]=i,s[4]=a):a=s[4],s[5]!==n||s[6]!==a?(l=(0,t.jsx)("div",{className:a,...n}),s[5]=n,s[6]=a,s[7]=l):l=s[7],l},"AlertDialogTitle",0,function(e){let i,n,a,l,s,o=(0,r.c)(10);return o[0]!==e?({className:i,ref:a,...n}=e,o[0]=e,o[1]=i,o[2]=n,o[3]=a):(i=o[1],n=o[2],a=o[3]),o[4]!==i?(l=(0,b.cn)("text-base font-semibold",i),o[4]=i,o[5]=l):l=o[5],o[6]!==n||o[7]!==a||o[8]!==l?(s=(0,t.jsx)(p.Title,{ref:a,className:l,...n}),o[6]=n,o[7]=a,o[8]=l,o[9]=s):s=o[9],s}],120612)},404142,e=>{"use strict";var t=e.i(222666),r=e.i(505962),i=e.i(452473),n=e.i(528164),a=e.i(507869),l=e.i(648156),s=e.i(19379);let o=(0,e.i(202913).default)("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);function c(e){let a,s,c,d,u,m,h,f,g,x=(0,r.c)(29),{title:p,onToggle:b,newAction:v,newActionPlacement:w}=e,j=v.icon,y="header"===w;return x[0]!==p?(a=(0,t.jsx)("h3",{className:"text-base font-medium text-foreground",children:p}),x[0]=p,x[1]=a):a=x[1],x[2]!==j||x[3]!==y||x[4]!==v.ariaLabel||x[5]!==v.label||x[6]!==v.onClick?(s=y?(0,t.jsx)(l.Tooltip,{side:"bottom",delay:0,content:v.label,children:(0,t.jsx)(n.Button,{size:"icon",variant:"ghost","aria-label":v.ariaLabel,onClick:v.onClick,className:"shrink-0",children:(0,t.jsx)(j,{className:"size-5 text-muted-foreground"})})}):null,x[2]=j,x[3]=y,x[4]=v.ariaLabel,x[5]=v.label,x[6]=v.onClick,x[7]=s):s=x[7],x[8]!==b?(c=e=>{e.stopPropagation(),b()},x[8]=b,x[9]=c):c=x[9],x[10]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)(o,{className:"size-5 text-muted-foreground"}),x[10]=d):d=x[10],x[11]!==c?(u=(0,t.jsx)(n.Button,{size:"icon",variant:"ghost","aria-label":"Toggle sidebar",onClick:c,className:"shrink-0",children:d}),x[11]=c,x[12]=u):u=x[12],x[13]!==s||x[14]!==u?(m=(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[s,u]}),x[13]=s,x[14]=u,x[15]=m):m=x[15],x[16]!==a||x[17]!==m?(h=(0,t.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 px-1",children:[a,m]}),x[16]=a,x[17]=m,x[18]=h):h=x[18],x[19]!==j||x[20]!==y||x[21]!==v.ariaLabel||x[22]!==v.label||x[23]!==v.onClick||x[24]!==v.shortcutHint?(f=y?null:(0,t.jsxs)(n.Button,{variant:"outline",size:"md",onClick:v.onClick,"aria-label":v.ariaLabel,className:(0,i.cn)("h-8 w-full justify-start gap-3 px-3","text-foreground hover:bg-card-hover"),children:[(0,t.jsx)(j,{className:"size-4 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{children:v.label}),v.shortcutHint&&(0,t.jsx)("span",{className:"ml-auto hidden text-xs text-muted-foreground md:inline",children:v.shortcutHint})]}),x[19]=j,x[20]=y,x[21]=v.ariaLabel,x[22]=v.label,x[23]=v.onClick,x[24]=v.shortcutHint,x[25]=f):f=x[25],x[26]!==h||x[27]!==f?(g=(0,t.jsxs)(t.Fragment,{children:[h,f]}),x[26]=h,x[27]=f,x[28]=g):g=x[28],g}function d(e){let i,s,c,d,u,m,h,f,g,x,p=(0,r.c)(23),{onToggle:b,newAction:v}=e,w=v.icon;return p[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["Toggle sidebar",(0,t.jsx)(a.Shortcut,{children:"["})]}),p[0]=i):i=p[0],p[1]!==b?(s=e=>{e.stopPropagation(),b()},p[1]=b,p[2]=s):s=p[2],p[3]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)(o,{className:"size-5 text-muted-foreground"}),p[3]=c):c=p[3],p[4]!==s?(d=(0,t.jsx)(l.Tooltip,{side:"right",delay:0,content:i,children:(0,t.jsx)(n.Button,{size:"icon",variant:"ghost","aria-label":"Toggle sidebar",onClick:s,className:"shrink-0 hover:stroke-foreground",children:c})}),p[4]=s,p[5]=d):d=p[5],p[6]!==v.shortcutHint?(u=v.shortcutHint&&(0,t.jsx)(a.Shortcut,{children:v.shortcutHint}),p[6]=v.shortcutHint,p[7]=u):u=p[7],p[8]!==v.label||p[9]!==u?(m=(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[v.label,u]}),p[8]=v.label,p[9]=u,p[10]=m):m=p[10],p[11]!==w?(h=(0,t.jsx)(w,{className:"size-5"}),p[11]=w,p[12]=h):h=p[12],p[13]!==v.ariaLabel||p[14]!==v.onClick||p[15]!==h?(f=(0,t.jsx)(n.Button,{size:"icon",variant:"ghost",onClick:v.onClick,"aria-label":v.ariaLabel,className:"shrink-0",children:h}),p[13]=v.ariaLabel,p[14]=v.onClick,p[15]=h,p[16]=f):f=p[16],p[17]!==m||p[18]!==f?(g=(0,t.jsx)(l.Tooltip,{side:"right",delay:0,content:m,children:f}),p[17]=m,p[18]=f,p[19]=g):g=p[19],p[20]!==d||p[21]!==g?(x=(0,t.jsxs)("div",{className:"flex w-full flex-col items-center gap-1",children:[d,g]}),p[20]=d,p[21]=g,p[22]=x):x=p[22],x}e.s(["HistorySidebar",0,e=>{let n,a,l,o,u,m,h,f,g,x,p,b,v,w,j,y,k,N=(0,r.c)(36);N[0]!==e?({children:n,title:x,isCollapsed:a,onToggle:o,newAction:l,newActionPlacement:h,containerClassName:f,className:g,ref:m,...u}=e,N[0]=e,N[1]=n,N[2]=a,N[3]=l,N[4]=o,N[5]=u,N[6]=m,N[7]=h,N[8]=f,N[9]=g,N[10]=x):(n=N[1],a=N[2],l=N[3],o=N[4],u=N[5],m=N[6],h=N[7],f=N[8],g=N[9],x=N[10]);let C=void 0===h?"row":h,D=void 0===f?"":f,S=void 0===g?"":g,_=!a;(0,s.useKeydown)("[",o);let A=_?"w-[260px]":"w-[54px]";N[11]!==D||N[12]!==A?(p=(0,i.cn)("flex h-full shrink-0 flex-col transition-[width] duration-150 ease-in-out p-px","bg-background border-r border-border",A,D),N[11]=D,N[12]=A,N[13]=p):p=N[13],N[14]!==S?(b=(0,i.cn)("flex h-full w-full flex-col gap-2 p-2",S),N[14]=S,N[15]=b):b=N[15],N[16]!==_||N[17]!==l||N[18]!==C||N[19]!==o||N[20]!==x?(v=_?(0,t.jsx)(c,{title:x,onToggle:o,newAction:l,newActionPlacement:C}):(0,t.jsx)(d,{onToggle:o,newAction:l}),N[16]=_,N[17]=l,N[18]=C,N[19]=o,N[20]=x,N[21]=v):v=N[21];let P=_?"opacity-100 visible pointer-events-auto h-auto":"opacity-0 invisible pointer-events-none h-0";return N[22]!==P?(w=(0,i.cn)("flex-1 min-h-0 overflow-hidden",P,"transition-[opacity,visibility,height] duration-200","py-px"),N[22]=P,N[23]=w):w=N[23],N[24]!==n||N[25]!==w?(j=(0,t.jsx)("div",{className:w,children:n}),N[24]=n,N[25]=w,N[26]=j):j=N[26],N[27]!==j||N[28]!==b||N[29]!==v?(y=(0,t.jsxs)("div",{className:b,children:[v,j]}),N[27]=j,N[28]=b,N[29]=v,N[30]=y):y=N[30],N[31]!==u||N[32]!==m||N[33]!==y||N[34]!==p?(k=(0,t.jsx)("aside",{ref:m,...u,className:p,children:y}),N[31]=u,N[32]=m,N[33]=y,N[34]=p,N[35]=k):k=N[35],k}],404142)},649896,936927,e=>{"use strict";var t=e.i(222666),r=e.i(505962),i=e.i(152533),n=e.i(558200),a=e.i(452473),l=e.i(810563);e.s(["HistorySidebarSearchRow",0,function(e){let s,o,c,d,u,m,h,f=(0,r.c)(15),{placeholder:g,value:x,onValueChange:p}=e;return f[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.cn)("flex h-8 shrink-0 items-center gap-3 rounded-md pl-3 pr-1","border border-border bg-background","focus-within:border-focus-border focus-within:shadow-focus"),o=(0,t.jsx)(i.MagnifyingGlassIcon,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"}),f[0]=s,f[1]=o):(s=f[0],o=f[1]),f[2]!==p?(c=e=>p(e.target.value),f[2]=p,f[3]=c):c=f[3],f[4]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.cn)("h-full flex-1 min-w-0 border-0 bg-transparent px-0 text-sm pointer-coarse:text-base shadow-none","focus-visible:border-transparent focus-visible:shadow-none focus:bg-transparent focus:ring-0","dark:bg-transparent dark:focus:bg-transparent"),f[4]=d):d=f[4],f[5]!==g||f[6]!==c||f[7]!==x?(u=(0,t.jsx)(l.Input,{placeholder:g,value:x,onChange:c,className:d}),f[5]=g,f[6]=c,f[7]=x,f[8]=u):u=f[8],f[9]!==p||f[10]!==x?(m=x&&(0,t.jsx)("button",{type:"button","aria-label":"Clear search",onClick:()=>p(""),className:(0,a.cn)("flex h-5 w-5 shrink-0 items-center justify-center rounded","text-muted-foreground transition-colors hover:bg-card-hover hover:text-accent-foreground"),children:(0,t.jsx)(n.XMarkIcon,{className:"size-3.5"})}),f[9]=p,f[10]=x,f[11]=m):m=f[11],f[12]!==u||f[13]!==m?(h=(0,t.jsxs)("div",{className:s,children:[o,u,m]}),f[12]=u,f[13]=m,f[14]=h):h=f[14],h}],649896);var s=e.i(850658),o=e.i(553215),c=e.i(738286);e.i(530023);var d=e.i(612774),u=e.i(252358),m=e.i(314164),h=e.i(864160),f=e.i(693697),g=e.i(695707),x=e.i(323813),p=e.i(977051);e.i(798823);var b=e.i(429930),v=e.i(22422),w=e.i(624621),j=e.i(48318),y=e.i(328616),k=e.i(408784);function N(e){let i,n,l,s=(0,r.c)(5),{name:o}=e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.cn)("flex size-6 shrink-0 items-center justify-center rounded-md","bg-primary text-xs font-medium text-primary-foreground"),s[0]=i):i=s[0],s[1]!==o?(n=o.trim().charAt(0).toUpperCase()||"?",s[1]=o,s[2]=n):n=s[2],s[3]!==n?(l=(0,t.jsx)("div",{className:i,children:n}),s[3]=n,s[4]=l):l=s[4],l}function C(){return v.chatroomStoreActions.stopGeneration()}function D(e){return e.entity?.clerk_user_id??null}e.s(["WorkspaceSwitcher",0,function(e){let i,n,l,v,S,_,A,P,T,R,z,H,I,M,L,B,E,W,O=(0,r.c)(71),{surface:V,className:Z}=e,{isSignedIn:U}=(0,s.useAuth)(),$=(0,u.usePosthogClient)(),F=(0,g.useQueryClient)(),K=(0,h.useUserStore)(D),G=!0===U;O[0]!==G?(i={isEnabled:G},O[0]=G,O[1]=i):i=O[1];let{workspaces:q,activeWorkspaceId:Q}=(0,j.useUserWorkspaces)(i),{mutate:J,isPending:X}=(0,j.useSetActiveWorkspace)(),Y=(0,p.useFeatureFlag)("hipaaWorkspaces");if(!U||!q||0===q.length||!Q)return null;if(O[2]!==Q||O[3]!==Z||O[4]!==K||O[5]!==Y||O[6]!==X||O[7]!==$||O[8]!==F||O[9]!==J||O[10]!==V||O[11]!==q){let e,r,i,s,u,h,g=[...q].sort((e,t)=>(0,k.compareCanonicalText)(e.created_at,t.created_at)),p=function(e){let t=new Map;for(let r of e)t.set(r.name,(t.get(r.name)??0)+1);return new Map(e.map(e=>[e.id,(t.get(e.name)??0)>1?`${e.name} (${e.slug})`:e.name]))}(g);if(O[26]!==Q||O[27]!==q){let t;O[29]!==Q?(t=e=>e.id===Q,O[29]=Q,O[30]=t):t=O[30],e=q.find(t),O[26]=Q,O[27]=q,O[28]=e}else e=O[28];let j=e;O[31]!==Q||O[32]!==K||O[33]!==$||O[34]!==F||O[35]!==J||O[36]!==V?(r=async e=>{if(e===Q)return;let t=function({rooms:e}){return Object.values(e).some(e=>e.isProcessing||Object.values(e.messages).some(e=>e.type===b.MessageType.Assistant&&(e.isGenerating||e.isRetrying)))}(w.useChatroomStore.getState());if(t&&!window.confirm("A chat response is still streaming. Switching workspaces will cancel it. Switch anyway?"))return;let r=await J({workspaceId:e,surface:V,onPersisted:t?C:void 0});(0,f.isErr)(r)?(0,d.toast)({title:"Unable to switch workspace",description:r.error.message||"Something went wrong. Please try again.",variant:"destructive"}):(await Promise.all([F.resetQueries({exact:!0,queryKey:m.providerPreferencesKeys.detail(K,{includeGuardrails:!1,workspaceId:null})}),F.resetQueries({exact:!0,queryKey:m.providerPreferencesKeys.detail(K,{includeGuardrails:!0,workspaceId:null})})]),$.capture(o.PostHogEvent.SwitchWorkspace,{cancelled_active_chat:t,surface:V}))},O[31]=Q,O[32]=K,O[33]=$,O[34]=F,O[35]=J,O[36]=V,O[37]=r):r=O[37];let D=r;O[38]!==Z?(_=(0,a.cn)("relative -mx-2 shrink-0 bg-background px-2 pt-2",Z),O[38]=Z,O[39]=_):_=O[39],O[40]===Symbol.for("react.memo_cache_sentinel")?(A=(0,t.jsx)("div",{"aria-hidden":"true",className:(0,a.cn)("pointer-events-none absolute inset-x-0 bottom-full h-8","bg-gradient-to-t from-background via-background/80 to-transparent")}),P=(0,t.jsx)("div",{"aria-hidden":"true",className:"absolute inset-x-0 top-0 h-px bg-border"}),O[40]=A,O[41]=P):(A=O[40],P=O[41]),l=c.Select,M="compact",L=Q,O[42]!==D?(v=e=>void D(e),O[42]=D,O[43]=v):v=O[43],O[44]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.cn)("h-10 w-full shrink-0 gap-2 rounded-md px-2","border-transparent bg-transparent hover:bg-card-hover","text-body md:text-body","[&>span:last-child]:hidden"),O[44]=i):i=O[44];let B=j?.name??"";O[45]!==B?(s=(0,t.jsx)(N,{name:B}),O[45]=B,O[46]=s):s=O[46],O[47]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(c.SelectValue,{}),h=(0,t.jsx)(x.ChevronsUpDown,{className:"size-4 shrink-0 text-muted-foreground"}),O[47]=u,O[48]=h):(u=O[47],h=O[48]),O[49]!==X||O[50]!==s?(S=(0,t.jsxs)(c.SelectTrigger,{"aria-label":"Switch workspace",disabled:X,className:i,children:[s,u,h]}),O[49]=X,O[50]=s,O[51]=S):S=O[51],n=c.SelectContent,T="top",R="start",z=!1,H="min-w-56",I=g.map(e=>(0,t.jsx)(c.SelectItem,{value:e.id,textValue:p.get(e.id)??e.name,className:"pl-3 pr-8 text-body md:text-body [&>span:first-child]:left-auto [&>span:first-child]:right-2",children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[p.get(e.id)??e.name,Y&&(0,t.jsx)(y.WorkspaceHipaaBadge,{workspace:e})]})},e.id)),O[2]=Q,O[3]=Z,O[4]=K,O[5]=Y,O[6]=X,O[7]=$,O[8]=F,O[9]=J,O[10]=V,O[11]=q,O[12]=n,O[13]=l,O[14]=v,O[15]=S,O[16]=_,O[17]=A,O[18]=P,O[19]=T,O[20]=R,O[21]=z,O[22]=H,O[23]=I,O[24]=M,O[25]=L}else n=O[12],l=O[13],v=O[14],S=O[15],_=O[16],A=O[17],P=O[18],T=O[19],R=O[20],z=O[21],H=O[22],I=O[23],M=O[24],L=O[25];return O[52]!==n||O[53]!==T||O[54]!==R||O[55]!==z||O[56]!==H||O[57]!==I?(B=(0,t.jsx)(n,{side:T,align:R,showScrollButtons:z,className:H,children:I}),O[52]=n,O[53]=T,O[54]=R,O[55]=z,O[56]=H,O[57]=I,O[58]=B):B=O[58],O[59]!==l||O[60]!==v||O[61]!==S||O[62]!==B||O[63]!==M||O[64]!==L?(E=(0,t.jsxs)(l,{size:M,value:L,onValueChange:v,children:[S,B]}),O[59]=l,O[60]=v,O[61]=S,O[62]=B,O[63]=M,O[64]=L,O[65]=E):E=O[65],O[66]!==_||O[67]!==A||O[68]!==P||O[69]!==E?(W=(0,t.jsxs)("div",{className:_,children:[A,P,E]}),O[66]=_,O[67]=A,O[68]=P,O[69]=E,O[70]=W):W=O[70],W}],936927)},318875,e=>{"use strict";var t=e.i(222666),r=e.i(505962),i=e.i(452473),n=e.i(528164),a=e.i(389097),l=e.i(784510),s=e.i(270401);e.i(406201);var o=e.i(806024);let c=(0,s.memo)(e=>{let s,c,h,f,g,x,p,b,v,w,j=(0,r.c)(21),{open:y,onOpenChange:k,onContinueWithFreeModels:N}=e,{availableTextModels:C}=(0,l.useGlobal)();e:{let e;if(!C?.length){s="/models?max_price=0";break e}j[0]!==C?(e=C.filter(d).sort(u).slice(0,3).map(m).join(","),j[0]=C,j[1]=e):e=j[1];let t=e;s=t?`/chat?models=${t}`:"/models?max_price=0"}let D=s;j[2]!==k?(c=()=>{k(!1)},j[2]=k,j[3]=c):c=j[3];let S=c;return j[4]===Symbol.for("react.memo_cache_sentinel")?(h=(0,i.cn)("max-w-sm"),j[4]=h):h=j[4],j[5]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsxs)(a.DialogHeader,{className:"text-center",children:[(0,t.jsx)(a.DialogTitle,{children:"Insufficient credits"}),(0,t.jsx)(a.DialogDescription,{children:"Add credits to continue using paid models."})]}),j[5]=f):f=j[5],j[6]===Symbol.for("react.memo_cache_sentinel")?(g=(0,t.jsx)(n.Button,{variant:"default",className:"w-full h-10",children:"Buy credits"}),j[6]=g):g=j[6],j[7]!==S?(x=(0,t.jsx)(o.Link,{href:"https://openrouter.ai/settings/credits",className:"w-full",onClick:S,children:g}),j[7]=S,j[8]=x):x=j[8],j[9]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsxs)("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[(0,t.jsx)("span",{className:"h-px bg-border flex-1"}),(0,t.jsx)("span",{children:"or"}),(0,t.jsx)("span",{className:"h-px bg-border flex-1"})]}),j[9]=p):p=j[9],j[10]!==S||j[11]!==D||j[12]!==N?(b=(0,t.jsx)("div",{className:"flex items-center justify-center",children:N?(0,t.jsx)("button",{type:"button",className:"text-sm underline hover:opacity-80 text-muted-foreground",onClick:()=>{S(),N()},children:"Continue with free models"}):(0,t.jsx)(o.Link,{href:D,className:"text-sm underline hover:opacity-80",onClick:S,children:"Continue with free models"})}),j[10]=S,j[11]=D,j[12]=N,j[13]=b):b=j[13],j[14]!==x||j[15]!==b?(v=(0,t.jsxs)(a.DialogContent,{className:h,children:[f,(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[x,p,b]})]}),j[14]=x,j[15]=b,j[16]=v):v=j[16],j[17]!==k||j[18]!==y||j[19]!==v?(w=(0,t.jsx)(a.Dialog,{open:y,onOpenChange:k,children:v}),j[17]=k,j[18]=y,j[19]=v,j[20]=w):w=j[20],w});function d(e){return e.endpoint?.is_free||e.slug.endsWith(":free")}function u(e,t){let r=e.created_at?new Date(e.created_at).getTime():0;return(t.created_at?new Date(t.created_at).getTime():0)-r}function m(e){return e.slug}e.s(["InsufficientCreditsModal",0,c])},797677,e=>{"use strict";var t=e.i(222666),r=e.i(505962),i=e.i(452473),n=e.i(270401);function a(e){window.clearTimeout(e)}e.s(["AutoScrollContainer",0,e=>{let l,s,o,c,d,u,m,h=(0,r.c)(17),{children:f,className:g,itemCount:x,orientation:p}=e,b=void 0===p?"horizontal":p,v=(0,n.useRef)(null),w=(0,n.useRef)(x);h[0]!==x||h[1]!==b?(l=()=>{let e=w.current;if(w.current=x,x<=e)return;let t=()=>{if(v.current){if("horizontal"===b){v.current.scrollLeft=v.current.scrollWidth;return}v.current.scrollTop=v.current.scrollHeight}};t();let r=[window.setTimeout(t,50),window.setTimeout(t,200),window.setTimeout(t,500)];return()=>{r.forEach(a)}},s=[x,b],h[0]=x,h[1]=b,h[2]=l,h[3]=s):(l=h[2],s=h[3]),(0,n.useEffect)(l,s),h[4]!==g?(o=(0,i.cn)("w-full overflow-hidden",g),h[4]=g,h[5]=o):o=h[5];let j="horizontal"===b?"overflow-x-auto overflow-y-hidden":"overflow-y-auto overflow-x-hidden";h[6]!==j?(c=(0,i.cn)("size-full rounded-[inherit]",j),h[6]=j,h[7]=c):c=h[7];let y="horizontal"===b?"w-max":"h-max";return h[8]!==f||h[9]!==y?(d=(0,t.jsx)("div",{className:y,children:f}),h[8]=f,h[9]=y,h[10]=d):d=h[10],h[11]!==c||h[12]!==d?(u=(0,t.jsx)("div",{ref:v,className:c,children:d}),h[11]=c,h[12]=d,h[13]=u):u=h[13],h[14]!==o||h[15]!==u?(m=(0,t.jsx)("div",{className:o,children:u}),h[14]=o,h[15]=u,h[16]=m):m=h[16],m}])},903121,e=>{"use strict";var t=e.i(222666),r=e.i(505962),i=e.i(270401);let n=i.forwardRef(function({title:e,titleId:t,...r},n){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{fillRule:"evenodd",d:"M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6Zm14.25 6a.75.75 0 0 1-.22.53l-2.25 2.25a.75.75 0 1 1-1.06-1.06L15.44 12l-1.72-1.72a.75.75 0 1 1 1.06-1.06l2.25 2.25c.141.14.22.331.22.53Zm-10.28-.53a.75.75 0 0 0 0 1.06l2.25 2.25a.75.75 0 1 0 1.06-1.06L8.56 12l1.72-1.72a.75.75 0 1 0-1.06-1.06l-2.25 2.25Z",clipRule:"evenodd"}))}),a=i.forwardRef(function({title:e,titleId:t,...r},n){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{fillRule:"evenodd",d:"M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0 0 16.5 9h-1.875a1.875 1.875 0 0 1-1.875-1.875V5.25A3.75 3.75 0 0 0 9 1.5H5.625ZM7.5 15a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5h-7.5A.75.75 0 0 1 7.5 15Zm.75 2.25a.75.75 0 0 0 0 1.5H12a.75.75 0 0 0 0-1.5H8.25Z",clipRule:"evenodd"}),i.createElement("path",{d:"M12.971 1.816A5.23 5.23 0 0 1 14.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 0 1 3.434 1.279 9.768 9.768 0 0 0-6.963-6.963Z"}))}),l=i.forwardRef(function({title:e,titleId:t,...r},n){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{fillRule:"evenodd",d:"M1.5 6a2.25 2.25 0 0 1 2.25-2.25h16.5A2.25 2.25 0 0 1 22.5 6v12a2.25 2.25 0 0 1-2.25 2.25H3.75A2.25 2.25 0 0 1 1.5 18V6ZM3 16.06V18c0 .414.336.75.75.75h16.5A.75.75 0 0 0 21 18v-1.94l-2.69-2.689a1.5 1.5 0 0 0-2.12 0l-.88.879.97.97a.75.75 0 1 1-1.06 1.06l-5.16-5.159a1.5 1.5 0 0 0-2.12 0L3 16.061Zm10.125-7.81a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Z",clipRule:"evenodd"}))});var s=e.i(452473);e.s(["ComposerDropZone",0,e=>{let i,o,c,d,u=(0,r.c)(11),{className:m,isValid:h,onDrop:f}=e;u[0]!==f?(i=f?{onDrop:f}:{},u[0]=f,u[1]=i):i=u[1];let g=h?"border-accent-border bg-selected-bg":"border-destructive bg-destructive/10";return u[2]!==m||u[3]!==g?(o=(0,s.cn)("flex h-32 w-full items-center justify-center rounded-lg border-2 border-dashed backdrop-blur-sm",g,"transition-colors duration-200 ease-in-out",m),u[2]=m,u[3]=g,u[4]=o):o=u[4],u[5]!==h?(c=(0,t.jsx)("div",{className:"text-center",children:h?(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2 font-semibold text-foreground",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(l,{className:"size-6 -rotate-6 text-muted-foreground"}),(0,t.jsx)(n,{className:"size-6 text-muted-foreground"}),(0,t.jsx)(a,{className:"size-6 rotate-6 text-muted-foreground"})]}),"Drop files here to add to your message"]}):(0,t.jsx)("p",{className:"font-semibold text-destructive",children:"Invalid file type (images, audio, video, text, PDF)"})}),u[5]=h,u[6]=c):c=u[6],u[7]!==i||u[8]!==o||u[9]!==c?(d=(0,t.jsx)("div",{role:"button",tabIndex:0,...i,className:o,children:c}),u[7]=i,u[8]=o,u[9]=c,u[10]=d):d=u[10],d}],903121)},660298,e=>{"use strict";e.s(["downloadMarkdown",0,function(e,{date:t=new Date().toDateString(),name:r="OpenRouter Chat",ext:i=".md"}={}){let n=`${r} ${t}${i}`.trim(),a=n.length>100?`${n.slice(0,100-i.length)}${i}`:n,l=new Blob([e],{type:"text/markdown;charset=utf-8;"}),s=document.createElement("a"),o=URL.createObjectURL(l);s.setAttribute("href",o),s.setAttribute("download",a),s.style.visibility="hidden",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>URL.revokeObjectURL(o),4e4)}])},328616,e=>{"use strict";var t=e.i(222666),r=e.i(505962),i=e.i(189511),n=e.i(970654);e.s(["WorkspaceHipaaBadge",0,function(e){let a=(0,r.c)(2),{workspace:l,className:s}=e;switch((0,i.deriveWorkspaceMode)(l)){case i.WorkspaceMode.Standard:return null;case i.WorkspaceMode.Hipaa:{let e;return a[0]!==s?(e=(0,t.jsx)(n.Badge,{variant:"info",size:"sm",className:s,children:"HIPAA"}),a[0]=s,a[1]=e):e=a[1],e}default:return null}}])},215370,784814,e=>{"use strict";var t=e.i(850658),r=e.i(586404),i=e.i(48318);function n(e){let{activeWorkspaceId:t,defaultWorkspaceId:r}=e;return t&&r?t===r?null:t:null}e.s(["computeWorkspacePartitionId",0,n,"isInWorkspacePartition",0,function(e,t){return(e.workspaceId??null)===t}],784814);let a={isReady:!1,partitionId:null},l={isReady:!0,partitionId:null},s=null;e.s(["useActiveWorkspacePartition",0,function(){let{isLoaded:e,isSignedIn:o,userId:c,orgId:d}=(0,t.useAuth)(),{workspaces:u,activeWorkspaceId:m,defaultWorkspaceId:h,didFetchFail:f}=(0,i.useUserWorkspaces)({isEnabled:!0===o});if(!e)return a;if(!o||!(0,r.isDefinedAndNotNull)(c))return l;let g=d??null;if(void 0===u)return f&&s?.userId===c&&s.orgId===g?{isReady:!0,partitionId:s.partitionId}:a;let x=n({activeWorkspaceId:m,defaultWorkspaceId:h});return s={userId:c,orgId:g,partitionId:x},{isReady:!0,partitionId:x}}],215370)}]); //# sourceMappingURL=0y0nmmr7_8mau.js.map //# chunkId=01a09faf-51cd-7e82-8562-1e20282100ad