@flexkit/studio 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/activity-nav-button-AESIPODJ.js +2 -0
  2. package/dist/activity-nav-button-AESIPODJ.js.map +1 -0
  3. package/dist/chat-page-S2YGOKO5.js +4 -0
  4. package/dist/{chat-page-YWENJEUP.js.map → chat-page-S2YGOKO5.js.map} +1 -1
  5. package/dist/chunk-2AHDTE5T.js +2 -0
  6. package/dist/{chunk-OFLU53AC.js.map → chunk-2AHDTE5T.js.map} +1 -1
  7. package/dist/chunk-32ZU4MLE.js +2 -0
  8. package/dist/{chunk-ODORXGGY.js.map → chunk-32ZU4MLE.js.map} +1 -1
  9. package/dist/chunk-3C2EG3SI.js +2 -0
  10. package/dist/{chunk-GW37ZTR2.js.map → chunk-3C2EG3SI.js.map} +1 -1
  11. package/dist/chunk-3TGCCDOR.js +2 -0
  12. package/dist/chunk-3TGCCDOR.js.map +1 -0
  13. package/dist/chunk-6NRQMG26.js +2 -0
  14. package/dist/chunk-6NRQMG26.js.map +1 -0
  15. package/dist/{chunk-LYGHDJ5A.js → chunk-6RDPFMLK.js} +2 -2
  16. package/dist/{chunk-LYGHDJ5A.js.map → chunk-6RDPFMLK.js.map} +1 -1
  17. package/dist/chunk-CKNFYN3O.js +3 -0
  18. package/dist/chunk-CKNFYN3O.js.map +1 -0
  19. package/dist/chunk-J2G4C6I5.js +2 -0
  20. package/dist/chunk-J2G4C6I5.js.map +1 -0
  21. package/dist/{chunk-7ZDMZVDA.js → chunk-KWS3NAYS.js} +5 -5
  22. package/dist/{chunk-7ZDMZVDA.js.map → chunk-KWS3NAYS.js.map} +1 -1
  23. package/dist/chunk-LN55VJ35.js +3 -0
  24. package/dist/chunk-LN55VJ35.js.map +1 -0
  25. package/dist/{chunk-Z6IEBNKV.js → chunk-NOFQHWES.js} +2 -2
  26. package/dist/{chunk-Z6IEBNKV.js.map → chunk-NOFQHWES.js.map} +1 -1
  27. package/dist/chunk-NYKATVPZ.js +4 -0
  28. package/dist/{chunk-3FIKCGSP.js.map → chunk-NYKATVPZ.js.map} +1 -1
  29. package/dist/chunk-PWQPA2QL.js +2 -0
  30. package/dist/chunk-PWQPA2QL.js.map +1 -0
  31. package/dist/chunk-SVZY7ZZD.js +8 -0
  32. package/dist/chunk-SVZY7ZZD.js.map +1 -0
  33. package/dist/chunk-TWMX2IQ2.js +3 -0
  34. package/dist/chunk-TWMX2IQ2.js.map +1 -0
  35. package/dist/chunk-U45E5X3H.js +2 -0
  36. package/dist/chunk-U45E5X3H.js.map +1 -0
  37. package/dist/chunk-USNXQOMJ.js +2 -0
  38. package/dist/chunk-USNXQOMJ.js.map +1 -0
  39. package/dist/chunk-YCCFUGWJ.js +7 -0
  40. package/dist/chunk-YCCFUGWJ.js.map +1 -0
  41. package/dist/index.css +41 -0
  42. package/dist/index.d.ts +11 -1
  43. package/dist/index.js +9 -9
  44. package/dist/index.js.map +1 -1
  45. package/dist/list-PNKQAYUK.js +2 -0
  46. package/dist/{list-3K2PBGML.js.map → list-PNKQAYUK.js.map} +1 -1
  47. package/dist/logo-JAWR6P43.js +2 -0
  48. package/dist/logo-JAWR6P43.js.map +1 -0
  49. package/dist/pages-KHFSZ3PH.js +3 -0
  50. package/dist/pages-KHFSZ3PH.js.map +1 -0
  51. package/dist/plugin-pages-SE52XFFW.js +2 -0
  52. package/dist/{plugin-pages-Q77CBW45.js.map → plugin-pages-SE52XFFW.js.map} +1 -1
  53. package/dist/root-44ZJLA4E.js +2 -0
  54. package/dist/root-44ZJLA4E.js.map +1 -0
  55. package/dist/root-BH3PQS2H.js +31 -0
  56. package/dist/{root-EZWV5VA4.js.map → root-BH3PQS2H.js.map} +1 -1
  57. package/dist/root-LFQA2VSE.js +2 -0
  58. package/dist/{root-4TME2KMP.js.map → root-LFQA2VSE.js.map} +1 -1
  59. package/dist/{root-4ZVGVCYY.js → root-X5NDURAN.js} +10 -10
  60. package/dist/{root-4ZVGVCYY.js.map → root-X5NDURAN.js.map} +1 -1
  61. package/dist/search-Q65IC67C.js +2 -0
  62. package/dist/{search-7NX232AW.js.map → search-Q65IC67C.js.map} +1 -1
  63. package/dist/skills-pages-TWOIIU5J.js +2 -0
  64. package/dist/{skills-pages-SMJ4EWZW.js.map → skills-pages-TWOIIU5J.js.map} +1 -1
  65. package/dist/spec-renderer-EX7SCFWH.js +2 -0
  66. package/dist/{spec-renderer-5YGDRF52.js.map → spec-renderer-EX7SCFWH.js.map} +1 -1
  67. package/dist/ui.js +1 -1
  68. package/dist/user-nav-QZTYBG45.js +2 -0
  69. package/dist/user-nav-QZTYBG45.js.map +1 -0
  70. package/package.json +3 -3
  71. package/dist/chat-page-YWENJEUP.js +0 -4
  72. package/dist/chunk-2FQWBOU6.js +0 -6
  73. package/dist/chunk-2FQWBOU6.js.map +0 -1
  74. package/dist/chunk-3FIKCGSP.js +0 -4
  75. package/dist/chunk-4BX7OJJ6.js +0 -2
  76. package/dist/chunk-4BX7OJJ6.js.map +0 -1
  77. package/dist/chunk-5DHOBLAE.js +0 -2
  78. package/dist/chunk-5DHOBLAE.js.map +0 -1
  79. package/dist/chunk-66N44IKJ.js +0 -3
  80. package/dist/chunk-66N44IKJ.js.map +0 -1
  81. package/dist/chunk-GW37ZTR2.js +0 -2
  82. package/dist/chunk-H6TOYVW2.js +0 -3
  83. package/dist/chunk-H6TOYVW2.js.map +0 -1
  84. package/dist/chunk-ODORXGGY.js +0 -2
  85. package/dist/chunk-OFLU53AC.js +0 -2
  86. package/dist/chunk-YIGEER6B.js +0 -7
  87. package/dist/chunk-YIGEER6B.js.map +0 -1
  88. package/dist/list-3K2PBGML.js +0 -2
  89. package/dist/logo-MU7MGYDH.js +0 -3
  90. package/dist/logo-MU7MGYDH.js.map +0 -1
  91. package/dist/pages-BDZ4ZXBS.js +0 -3
  92. package/dist/pages-BDZ4ZXBS.js.map +0 -1
  93. package/dist/plugin-pages-Q77CBW45.js +0 -2
  94. package/dist/root-4TME2KMP.js +0 -2
  95. package/dist/root-EZWV5VA4.js +0 -31
  96. package/dist/root-YKNISFWH.js +0 -2
  97. package/dist/root-YKNISFWH.js.map +0 -1
  98. package/dist/search-7NX232AW.js +0 -2
  99. package/dist/skills-pages-SMJ4EWZW.js +0 -2
  100. package/dist/spec-renderer-5YGDRF52.js +0 -2
  101. package/dist/user-nav-QZFCICK3.js +0 -2
  102. package/dist/user-nav-QZFCICK3.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {q}from'./chunk-SVZY7ZZD.js';import {g,f}from'./chunk-CKNFYN3O.js';import {s}from'./chunk-YCCFUGWJ.js';import {c,h as h$1,i,k,j as j$1}from'./chunk-32ZU4MLE.js';import {e,g as g$1,h,j}from'./chunk-SZEGGBOC.js';import {b}from'./chunk-6NRQMG26.js';import {useState,useEffect,useMemo,useTransition}from'react';import {LoaderCircle,MessageSquareIcon,MoreHorizontalIcon,PencilIcon,Trash2Icon}from'lucide-react';import {useLocation,useNavigate}from'react-router-dom';import H,{useSWRConfig}from'swr';import U from'swr/infinite';import {jsx,jsxs}from'react/jsx-runtime';function ue(){let a=useLocation(),n="/agent",t=a.pathname.indexOf(n);return t===-1?`${a.pathname.replace(/\/$/,"")}/agent`:a.pathname.slice(0,t+n.length)}function de(a,n){let[t,o]=useState(a);return useEffect(()=>{let f=window.setTimeout(()=>{o(a);},n);return ()=>{window.clearTimeout(f);}},[n,a]),t}function Z(a){let n=new Date(a.lastMessageAt??a.updatedAt).getTime(),t=new Date,o=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();return n>=o?"Today":n>=o-864e5?"Yesterday":n>=o-7*864e5?"Previous 7 days":"Older"}function ee(a){let n=[];for(let t of a){let o=Z(t),f=n.find(u=>u.label===o);f?f.chats.push(t):n.push({chats:[t],label:o});}return n}function te({active:a,api:n,chat:t,onChanged:o,onDeleted:f,onOpen:u}){let[r,l]=useState(null),[g,d]=useState(t.title??""),[p,D]=useTransition(),k$1=t.title?.trim()||"New chat";function v(){D(async()=>{await n.renameAgentChat(t.id,g.trim()),l(null),o();});}function y(){D(async()=>{await n.deleteAgentChat(t.id),l(null),f();});}return jsxs("div",{className:`fk:group/chat fk:flex fk:items-center fk:gap-1 fk:rounded-md fk:pr-1 ${a?"fk:bg-sidebar-accent":"fk:hover:bg-accent/60"} fk:corner-squircle`,children:[jsx("button",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:px-2 fk:py-1.5 fk:text-left fk:text-sm",title:k$1,type:"button",onClick:u,children:k$1}),jsxs(e,{children:[jsx(g$1,{asChild:true,children:jsx(b,{className:"fk:size-6 fk:shrink-0 fk:opacity-0 fk:group-hover/chat:opacity-100 fk:data-[state=open]:opacity-100",size:"icon",variant:"ghost",children:jsx(MoreHorizontalIcon,{className:"fk:size-4"})})}),jsxs(h,{align:"start",children:[jsxs(j,{onClick:()=>{d(t.title??""),l("rename");},children:[jsx(PencilIcon,{className:"fk:size-4"}),"Rename"]}),jsxs(j,{className:"fk:text-destructive",onClick:()=>l("delete"),children:[jsx(Trash2Icon,{className:"fk:size-4"}),"Delete"]})]})]}),jsx(c,{open:r==="rename",onOpenChange:m=>l(m?"rename":null),children:jsxs(h$1,{className:"fk:max-w-sm",children:[jsx(i,{children:jsx(k,{children:"Rename chat"})}),jsx(s,{value:g,onChange:m=>d(m.target.value),placeholder:"Chat title"}),jsx(j$1,{children:jsx(b,{disabled:p||!g.trim(),size:"sm",onClick:v,children:p?"Saving...":"Save"})})]})}),jsx(c,{open:r==="delete",onOpenChange:m=>l(m?"delete":null),children:jsxs(h$1,{className:"fk:max-w-sm",children:[jsx(i,{children:jsx(k,{children:"Delete chat?"})}),jsxs("p",{className:"fk:text-sm fk:text-muted-foreground",children:["\u201C",k$1,"\u201D and its messages will be permanently deleted."]}),jsx(j$1,{children:jsx(b,{disabled:p,size:"sm",variant:"destructive",onClick:y,children:p?"Deleting...":"Delete"})})]})})]})}function ne({onOpen:a,projectId:n,query:t}){let{data:o,isLoading:f$1}=H(g(n).agentChatSearch(t),f,{keepPreviousData:true});return f$1&&!o?jsxs("div",{className:"fk:flex fk:items-center fk:gap-2 fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground",children:[jsx(LoaderCircle,{className:"fk:size-3.5 fk:animate-spin"}),"Searching..."]}):o?.results.length?jsx("div",{className:"fk:space-y-1",children:o.results.map(u=>jsxs("button",{className:"fk:block fk:w-full fk:rounded-md fk:px-2 fk:py-1.5 fk:text-left fk:hover:bg-accent/60 fk:corner-squircle",type:"button",onClick:()=>a(u.chatId),children:[jsx("span",{className:"fk:block fk:truncate fk:text-sm",children:u.chatTitle?.trim()||"New chat"}),jsx("span",{className:"fk:block fk:truncate fk:text-xs fk:text-muted-foreground",children:u.snippet})]},u.messageId))}):jsx("p",{className:"fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground",children:"No matching chats."})}function me({query:a}){let{api:n,projectId:t}=q(),o=useNavigate(),f$1=useLocation(),{mutate:u}=useSWRConfig(),r=/\/agent\/chats\/([^/]+)/.exec(f$1.pathname)?.[1],{data:l,isLoading:g$1,mutate:d,setSize:p,size:D}=U((s,c)=>!t||c&&!c.hasMore?null:g(t).agentChats(s*30),f,{revalidateFirstPage:true}),{data:k}=H(t&&r?g(t).agentChat(r):null,f),v=useMemo(()=>{let s=(l??[]).flatMap(h=>h.chats),c=k?.chat.title?.trim();return !r||!c?s:s.map(h=>h.id!==r||h.title?.trim()?h:{...h,title:c})},[k?.chat.title,r,l]),y=l?.[l.length-1]?.hasMore??false,m=useMemo(()=>ee(v),[v]);if(useEffect(()=>{d();},[r,d]),!t||!n)return null;let J=n,z=t;function L(s){o(`agent/chats/${s}`);}function X(s){d(),s===r?o("agent"):u(g(z).agentChat(s),void 0,{revalidate:false});}return jsx("div",{className:"fk:space-y-2",children:a?jsx(ne,{projectId:z,query:a,onOpen:L}):jsxs("div",{className:"fk:space-y-3",children:[m.map(s=>jsxs("div",{children:[jsx("p",{className:"fk:px-2 fk:pb-1 fk:text-xs fk:font-medium fk:text-muted-foreground",children:s.label}),jsx("div",{className:"fk:space-y-0.5",children:s.chats.map(c=>jsx(te,{active:c.id===r,api:J,chat:c,onChanged:()=>{d();},onDeleted:()=>X(c.id),onOpen:()=>L(c.id)},c.id))})]},s.label)),g$1?jsxs("div",{className:"fk:flex fk:items-center fk:gap-2 fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground",children:[jsx(LoaderCircle,{className:"fk:size-3.5 fk:animate-spin"}),"Loading recent chats..."]}):null,!g$1&&v.length===0?jsxs("div",{className:"fk:flex fk:flex-col fk:items-center fk:gap-2 fk:px-2 fk:py-6 fk:text-center fk:text-xs fk:text-muted-foreground",children:[jsx(MessageSquareIcon,{className:"fk:size-5"}),jsx("span",{children:"No chats yet. Start a conversation with the agent."})]}):null,y?jsx(b,{className:"fk:w-full",size:"sm",variant:"ghost",onClick:()=>{p(D+1);},children:"Load more"}):null]})})}export{ue as a,de as b,me as c};//# sourceMappingURL=chunk-2AHDTE5T.js.map
2
+ //# sourceMappingURL=chunk-2AHDTE5T.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/apps/ai/agent/chat-list.tsx"],"names":["useAgentBasePath","location","useLocation","marker","index","useDebouncedValue","value","delayMs","debounced","setDebounced","useState","useEffect","timeout","getChatGroupLabel","chat","timestamp","now","startOfToday","groupChats","chats","groups","label","group","candidate","ChatListItem","active","api","onChanged","onDeleted","onOpen","dialog","setDialog","title","setTitle","isMutating","startMutation","useTransition","handleRename","handleDelete","jsxs","jsx","DropdownMenu","DropdownMenuTrigger","Button","MoreHorizontalIcon","DropdownMenuContent","DropdownMenuItem","PencilIcon","Trash2Icon","Dialog","open","DialogContent","DialogHeader","DialogTitle","Input","event","DialogFooter","SearchResults","projectId","query","data","isLoading","useSWR","paths","fetcher","LoaderCircle","result","AgentChatsSection","useProjectApi","navigate","useNavigate","globalMutate","useSWRConfig","activeChatId","mutate","setSize","size","useSWRInfinite","pageIndex","previousPage","activeChatDetail","useMemo","listed","page","generatedTitle","hasMore","chatApi","chatProjectId","openChat","chatId","handleDeleted","MessageSquareIcon"],"mappings":"8kBAwBO,SAASA,EAAAA,EAA2B,CACzC,IAAMC,CAAAA,CAAWC,WAAAA,EAAY,CACvBC,CAAAA,CAAS,QAAA,CACTC,CAAAA,CAAQH,CAAAA,CAAS,QAAA,CAAS,OAAA,CAAQE,CAAM,CAAA,CAE9C,OAAIC,CAAAA,GAAU,EAAA,CACL,CAAA,EAAGH,CAAAA,CAAS,SAAS,OAAA,CAAQ,KAAA,CAAO,EAAE,CAAC,CAAA,MAAA,CAAA,CAGzCA,CAAAA,CAAS,QAAA,CAAS,KAAA,CAAM,CAAA,CAAGG,CAAAA,CAAQD,CAAAA,CAAO,MAAM,CACzD,CAEO,SAASE,EAAAA,CAAkBC,CAAAA,CAAeC,CAAAA,CAAyB,CACxE,GAAM,CAACC,CAAAA,CAAWC,CAAY,CAAA,CAAIC,QAAAA,CAASJ,CAAK,CAAA,CAEhD,OAAAK,SAAAA,CAAU,IAAM,CACd,IAAMC,CAAAA,CAAU,MAAA,CAAO,UAAA,CAAW,IAAM,CACtCH,CAAAA,CAAaH,CAAK,EACpB,CAAA,CAAGC,CAAO,CAAA,CAEV,OAAO,IAAM,CACX,MAAA,CAAO,YAAA,CAAaK,CAAO,EAC7B,CACF,CAAA,CAAG,CAACL,CAAAA,CAASD,CAAK,CAAC,CAAA,CAEZE,CACT,CAEA,SAASK,CAAAA,CAAkBC,CAAAA,CAAyB,CAClD,IAAMC,CAAAA,CAAY,IAAI,IAAA,CAAKD,CAAAA,CAAK,aAAA,EAAiBA,CAAAA,CAAK,SAAS,CAAA,CAAE,OAAA,EAAQ,CACnEE,CAAAA,CAAM,IAAI,IAAA,CACVC,CAAAA,CAAe,IAAI,IAAA,CAAKD,CAAAA,CAAI,WAAA,EAAY,CAAGA,CAAAA,CAAI,QAAA,EAAS,CAAGA,CAAAA,CAAI,OAAA,EAAS,CAAA,CAAE,OAAA,EAAQ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C,CAAAA,CAAO,CAAC,EAAA,CAAA,CAAG,QAAA,CAAA,WAAA,CAE/F,CAAA,CACE,IAAA,CAAA,CACN,CAAA,CAEJ,CAEJ","file":"chunk-OFLU53AC.js","sourcesContent":["import type { JSX } from 'react';\nimport { useEffect, useMemo, useState, useTransition } from 'react';\nimport { LoaderCircle, MessageSquareIcon, MoreHorizontalIcon, PencilIcon, Trash2Icon } from 'lucide-react';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport useSWR, { useSWRConfig } from 'swr';\nimport useSWRInfinite from 'swr/infinite';\nimport {\n Button,\n Dialog,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n Input,\n} from '../../../ui';\nimport { fetcher, paths, type ApiClient } from '../api';\nimport { useProjectApi } from '../replay';\nimport type { AgentChat, AgentChatDetail, AgentChatSearchResult, AgentChatsList } from '../types';\n\n/** Returns the absolute route prefix of the agent app (`.../ai/agent`). */\nexport function useAgentBasePath(): string {\n const location = useLocation();\n const marker = '/agent';\n const index = location.pathname.indexOf(marker);\n\n if (index === -1) {\n return `${location.pathname.replace(/\\/$/, '')}/agent`;\n }\n\n return location.pathname.slice(0, index + marker.length);\n}\n\nexport function useDebouncedValue(value: string, delayMs: number): string {\n const [debounced, setDebounced] = useState(value);\n\n useEffect(() => {\n const timeout = window.setTimeout(() => {\n setDebounced(value);\n }, delayMs);\n\n return () => {\n window.clearTimeout(timeout);\n };\n }, [delayMs, value]);\n\n return debounced;\n}\n\nfunction getChatGroupLabel(chat: AgentChat): string {\n const timestamp = new Date(chat.lastMessageAt ?? chat.updatedAt).getTime();\n const now = new Date();\n const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();\n\n if (timestamp >= startOfToday) {\n return 'Today';\n }\n\n if (timestamp >= startOfToday - 86_400_000) {\n return 'Yesterday';\n }\n\n if (timestamp >= startOfToday - 7 * 86_400_000) {\n return 'Previous 7 days';\n }\n\n return 'Older';\n}\n\nfunction groupChats(chats: AgentChat[]): { chats: AgentChat[]; label: string }[] {\n const groups: { chats: AgentChat[]; label: string }[] = [];\n\n for (const chat of chats) {\n const label = getChatGroupLabel(chat);\n const group = groups.find((candidate) => candidate.label === label);\n\n if (group) {\n group.chats.push(chat);\n } else {\n groups.push({ chats: [chat], label });\n }\n }\n\n return groups;\n}\n\nfunction ChatListItem({\n active,\n api,\n chat,\n onChanged,\n onDeleted,\n onOpen,\n}: {\n active: boolean;\n api: ApiClient;\n chat: AgentChat;\n onChanged: () => void;\n onDeleted: () => void;\n onOpen: () => void;\n}): JSX.Element {\n const [dialog, setDialog] = useState<'rename' | 'delete' | null>(null);\n const [title, setTitle] = useState(chat.title ?? '');\n const [isMutating, startMutation] = useTransition();\n const label = chat.title?.trim() || 'New chat';\n\n function handleRename(): void {\n startMutation(async () => {\n await api.renameAgentChat(chat.id, title.trim());\n setDialog(null);\n onChanged();\n });\n }\n\n function handleDelete(): void {\n startMutation(async () => {\n await api.deleteAgentChat(chat.id);\n setDialog(null);\n onDeleted();\n });\n }\n\n return (\n <div\n className={`fk:group/chat fk:flex fk:items-center fk:gap-1 fk:rounded-md fk:pr-1 ${\n active ? 'fk:bg-sidebar-accent' : 'fk:hover:bg-accent/60'\n } fk:corner-squircle`}\n >\n <button\n className=\"fk:min-w-0 fk:flex-1 fk:truncate fk:px-2 fk:py-1.5 fk:text-left fk:text-sm\"\n title={label}\n type=\"button\"\n onClick={onOpen}\n >\n {label}\n </button>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n className=\"fk:size-6 fk:shrink-0 fk:opacity-0 fk:group-hover/chat:opacity-100 fk:data-[state=open]:opacity-100\"\n size=\"icon\"\n variant=\"ghost\"\n >\n <MoreHorizontalIcon className=\"fk:size-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\">\n <DropdownMenuItem\n onClick={() => {\n setTitle(chat.title ?? '');\n setDialog('rename');\n }}\n >\n <PencilIcon className=\"fk:size-4\" />\n Rename\n </DropdownMenuItem>\n <DropdownMenuItem className=\"fk:text-destructive\" onClick={() => setDialog('delete')}>\n <Trash2Icon className=\"fk:size-4\" />\n Delete\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n <Dialog open={dialog === 'rename'} onOpenChange={(open) => setDialog(open ? 'rename' : null)}>\n <DialogContent className=\"fk:max-w-sm\">\n <DialogHeader>\n <DialogTitle>Rename chat</DialogTitle>\n </DialogHeader>\n <Input value={title} onChange={(event) => setTitle(event.target.value)} placeholder=\"Chat title\" />\n <DialogFooter>\n <Button disabled={isMutating || !title.trim()} size=\"sm\" onClick={handleRename}>\n {isMutating ? 'Saving...' : 'Save'}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n <Dialog open={dialog === 'delete'} onOpenChange={(open) => setDialog(open ? 'delete' : null)}>\n <DialogContent className=\"fk:max-w-sm\">\n <DialogHeader>\n <DialogTitle>Delete chat?</DialogTitle>\n </DialogHeader>\n <p className=\"fk:text-sm fk:text-muted-foreground\">\n &ldquo;{label}&rdquo; and its messages will be permanently deleted.\n </p>\n <DialogFooter>\n <Button disabled={isMutating} size=\"sm\" variant=\"destructive\" onClick={handleDelete}>\n {isMutating ? 'Deleting...' : 'Delete'}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </div>\n );\n}\n\nfunction SearchResults({\n onOpen,\n projectId,\n query,\n}: {\n onOpen: (_chatId: string) => void;\n projectId: string;\n query: string;\n}): JSX.Element {\n const { data, isLoading } = useSWR<{ results: AgentChatSearchResult[] }>(\n paths(projectId).agentChatSearch(query),\n fetcher,\n { keepPreviousData: true }\n );\n\n if (isLoading && !data) {\n return (\n <div className=\"fk:flex fk:items-center fk:gap-2 fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground\">\n <LoaderCircle className=\"fk:size-3.5 fk:animate-spin\" />\n Searching...\n </div>\n );\n }\n\n if (!data?.results.length) {\n return <p className=\"fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground\">No matching chats.</p>;\n }\n\n return (\n <div className=\"fk:space-y-1\">\n {data.results.map((result) => (\n <button\n className=\"fk:block fk:w-full fk:rounded-md fk:px-2 fk:py-1.5 fk:text-left fk:hover:bg-accent/60 fk:corner-squircle\"\n key={result.messageId}\n type=\"button\"\n onClick={() => onOpen(result.chatId)}\n >\n <span className=\"fk:block fk:truncate fk:text-sm\">{result.chatTitle?.trim() || 'New chat'}</span>\n <span className=\"fk:block fk:truncate fk:text-xs fk:text-muted-foreground\">{result.snippet}</span>\n </button>\n ))}\n </div>\n );\n}\n\n/**\n * ChatGPT-style chats section embedded in the AI sidebar: new chat button and\n * the user's recent chats grouped by date with rename/delete. When `query` is\n * set, the recent list is replaced by hybrid keyword + semantic search results.\n * Rendered inside the app layout route, so relative navigation resolves\n * against the app root (`agent`, `agent/chats/:chatId`).\n */\nexport function AgentChatsSection({ query }: { query: string }): JSX.Element | null {\n const { api, projectId } = useProjectApi();\n const navigate = useNavigate();\n const location = useLocation();\n const { mutate: globalMutate } = useSWRConfig();\n const activeChatId = /\\/agent\\/chats\\/([^/]+)/.exec(location.pathname)?.[1];\n const { data, isLoading, mutate, setSize, size } = useSWRInfinite<AgentChatsList>(\n (pageIndex, previousPage: AgentChatsList | null) => {\n if (!projectId || (previousPage && !previousPage.hasMore)) {\n return null;\n }\n\n return paths(projectId).agentChats(pageIndex * 30);\n },\n fetcher,\n { revalidateFirstPage: true }\n );\n const { data: activeChatDetail } = useSWR<AgentChatDetail>(\n projectId && activeChatId ? paths(projectId).agentChat(activeChatId) : null,\n fetcher\n );\n const chats = useMemo(() => {\n const listed = (data ?? []).flatMap((page) => page.chats);\n const generatedTitle = activeChatDetail?.chat.title?.trim();\n\n if (!activeChatId || !generatedTitle) {\n return listed;\n }\n\n return listed.map((chat) => {\n if (chat.id !== activeChatId || chat.title?.trim()) {\n return chat;\n }\n\n return { ...chat, title: generatedTitle };\n });\n }, [activeChatDetail?.chat.title, activeChatId, data]);\n const hasMore = data?.[data.length - 1]?.hasMore ?? false;\n const groups = useMemo(() => groupChats(chats), [chats]);\n\n // Refresh the list when the user lands on a chat (new chats, fresh titles).\n useEffect(() => {\n void mutate();\n }, [activeChatId, mutate]);\n\n if (!projectId || !api) {\n return null;\n }\n\n const chatApi = api;\n const chatProjectId = projectId;\n\n function openChat(chatId: string): void {\n navigate(`agent/chats/${chatId}`);\n }\n\n function handleDeleted(chatId: string): void {\n void mutate();\n\n if (chatId === activeChatId) {\n navigate('agent');\n } else {\n // Drop the cached detail so a re-open does not show stale data.\n void globalMutate(paths(chatProjectId).agentChat(chatId), undefined, { revalidate: false });\n }\n }\n\n return (\n <div className=\"fk:space-y-2\">\n {query ? (\n <SearchResults projectId={chatProjectId} query={query} onOpen={openChat} />\n ) : (\n <div className=\"fk:space-y-3\">\n {groups.map((group) => (\n <div key={group.label}>\n <p className=\"fk:px-2 fk:pb-1 fk:text-xs fk:font-medium fk:text-muted-foreground\">{group.label}</p>\n <div className=\"fk:space-y-0.5\">\n {group.chats.map((chat) => (\n <ChatListItem\n active={chat.id === activeChatId}\n api={chatApi}\n chat={chat}\n key={chat.id}\n onChanged={() => void mutate()}\n onDeleted={() => handleDeleted(chat.id)}\n onOpen={() => openChat(chat.id)}\n />\n ))}\n </div>\n </div>\n ))}\n {isLoading ? (\n <div className=\"fk:flex fk:items-center fk:gap-2 fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground\">\n <LoaderCircle className=\"fk:size-3.5 fk:animate-spin\" />\n Loading recent chats...\n </div>\n ) : null}\n {!isLoading && chats.length === 0 ? (\n <div className=\"fk:flex fk:flex-col fk:items-center fk:gap-2 fk:px-2 fk:py-6 fk:text-center fk:text-xs fk:text-muted-foreground\">\n <MessageSquareIcon className=\"fk:size-5\" />\n <span>No chats yet. Start a conversation with the agent.</span>\n </div>\n ) : null}\n {hasMore ? (\n <Button className=\"fk:w-full\" size=\"sm\" variant=\"ghost\" onClick={() => void setSize(size + 1)}>\n Load more\n </Button>\n ) : null}\n </div>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/apps/ai/agent/chat-list.tsx"],"names":["useAgentBasePath","location","useLocation","marker","index","useDebouncedValue","value","delayMs","debounced","setDebounced","useState","useEffect","timeout","getChatGroupLabel","chat","timestamp","now","startOfToday","groupChats","chats","groups","label","group","candidate","ChatListItem","active","api","onChanged","onDeleted","onOpen","dialog","setDialog","title","setTitle","isMutating","startMutation","useTransition","handleRename","handleDelete","jsxs","jsx","DropdownMenu","DropdownMenuTrigger","Button","MoreHorizontalIcon","DropdownMenuContent","DropdownMenuItem","PencilIcon","Trash2Icon","Dialog","open","DialogContent","DialogHeader","DialogTitle","Input","event","DialogFooter","SearchResults","projectId","query","data","isLoading","useSWR","paths","fetcher","LoaderCircle","result","AgentChatsSection","useProjectApi","navigate","useNavigate","globalMutate","useSWRConfig","activeChatId","mutate","setSize","size","useSWRInfinite","pageIndex","previousPage","activeChatDetail","useMemo","listed","page","generatedTitle","hasMore","chatApi","chatProjectId","openChat","chatId","handleDeleted","MessageSquareIcon"],"mappings":"8kBAwBO,SAASA,EAAAA,EAA2B,CACzC,IAAMC,CAAAA,CAAWC,WAAAA,EAAY,CACvBC,CAAAA,CAAS,QAAA,CACTC,CAAAA,CAAQH,CAAAA,CAAS,QAAA,CAAS,OAAA,CAAQE,CAAM,CAAA,CAE9C,OAAIC,CAAAA,GAAU,EAAA,CACL,CAAA,EAAGH,CAAAA,CAAS,SAAS,OAAA,CAAQ,KAAA,CAAO,EAAE,CAAC,CAAA,MAAA,CAAA,CAGzCA,CAAAA,CAAS,QAAA,CAAS,KAAA,CAAM,CAAA,CAAGG,CAAAA,CAAQD,CAAAA,CAAO,MAAM,CACzD,CAEO,SAASE,EAAAA,CAAkBC,CAAAA,CAAeC,CAAAA,CAAyB,CACxE,GAAM,CAACC,CAAAA,CAAWC,CAAY,CAAA,CAAIC,QAAAA,CAASJ,CAAK,CAAA,CAEhD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,CACb,QAAA,CAAA,CAAAC,GAAAA,CAACyB,YAAAA,CAAA,CAAa,SAAA,CAAU,6BAAA,CAA8B,CAAA,CAAE,yBAAA,CAAA,CAE1D,CAAA,CACE,IAAA,CACH,CAACJ,GAAAA,EAAa1C,CAAAA,CAAM,MAAA,GAAW,CAAA,CAC9BoB,IAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,iHAAA,CACb,QAAA,CAAA,CAAAC,GAAAA,CAACmD,iBAAAA,CAAA,CAAkB,SAAA,CAAU,WAAA,CAAY,CAAA,CACzCnD,GAAAA,CAAC,MAAA,CAAA,CAAK,QAAA,CAAA,oDAAA,CAAkD,CAAA,CAAA,CAC1D,CAAA,CACE,IAAA,CACH6C,CAAAA,CACC7C,GAAAA,CAACG,CAAAA,CAAA,CAAO,SAAA,CAAU,WAAA,CAAY,IAAA,CAAK,IAAA,CAAK,OAAA,CAAQ,OAAA,CAAQ,OAAA,CAAS,IAAG,CAAQgC,CAAAA,CAAQC,CAAAA,CAAO,CAAC,EAAA,CAAA,CAAG,QAAA,CAAA,WAAA,CAE/F,CAAA,CACE,IAAA,CAAA,CACN,CAAA,CAEJ,CAEJ","file":"chunk-2AHDTE5T.js","sourcesContent":["import type { JSX } from 'react';\nimport { useEffect, useMemo, useState, useTransition } from 'react';\nimport { LoaderCircle, MessageSquareIcon, MoreHorizontalIcon, PencilIcon, Trash2Icon } from 'lucide-react';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport useSWR, { useSWRConfig } from 'swr';\nimport useSWRInfinite from 'swr/infinite';\nimport {\n Button,\n Dialog,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n Input,\n} from '../../../ui';\nimport { fetcher, paths, type ApiClient } from '../api';\nimport { useProjectApi } from '../replay';\nimport type { AgentChat, AgentChatDetail, AgentChatSearchResult, AgentChatsList } from '../types';\n\n/** Returns the absolute route prefix of the agent app (`.../ai/agent`). */\nexport function useAgentBasePath(): string {\n const location = useLocation();\n const marker = '/agent';\n const index = location.pathname.indexOf(marker);\n\n if (index === -1) {\n return `${location.pathname.replace(/\\/$/, '')}/agent`;\n }\n\n return location.pathname.slice(0, index + marker.length);\n}\n\nexport function useDebouncedValue(value: string, delayMs: number): string {\n const [debounced, setDebounced] = useState(value);\n\n useEffect(() => {\n const timeout = window.setTimeout(() => {\n setDebounced(value);\n }, delayMs);\n\n return () => {\n window.clearTimeout(timeout);\n };\n }, [delayMs, value]);\n\n return debounced;\n}\n\nfunction getChatGroupLabel(chat: AgentChat): string {\n const timestamp = new Date(chat.lastMessageAt ?? chat.updatedAt).getTime();\n const now = new Date();\n const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();\n\n if (timestamp >= startOfToday) {\n return 'Today';\n }\n\n if (timestamp >= startOfToday - 86_400_000) {\n return 'Yesterday';\n }\n\n if (timestamp >= startOfToday - 7 * 86_400_000) {\n return 'Previous 7 days';\n }\n\n return 'Older';\n}\n\nfunction groupChats(chats: AgentChat[]): { chats: AgentChat[]; label: string }[] {\n const groups: { chats: AgentChat[]; label: string }[] = [];\n\n for (const chat of chats) {\n const label = getChatGroupLabel(chat);\n const group = groups.find((candidate) => candidate.label === label);\n\n if (group) {\n group.chats.push(chat);\n } else {\n groups.push({ chats: [chat], label });\n }\n }\n\n return groups;\n}\n\nfunction ChatListItem({\n active,\n api,\n chat,\n onChanged,\n onDeleted,\n onOpen,\n}: {\n active: boolean;\n api: ApiClient;\n chat: AgentChat;\n onChanged: () => void;\n onDeleted: () => void;\n onOpen: () => void;\n}): JSX.Element {\n const [dialog, setDialog] = useState<'rename' | 'delete' | null>(null);\n const [title, setTitle] = useState(chat.title ?? '');\n const [isMutating, startMutation] = useTransition();\n const label = chat.title?.trim() || 'New chat';\n\n function handleRename(): void {\n startMutation(async () => {\n await api.renameAgentChat(chat.id, title.trim());\n setDialog(null);\n onChanged();\n });\n }\n\n function handleDelete(): void {\n startMutation(async () => {\n await api.deleteAgentChat(chat.id);\n setDialog(null);\n onDeleted();\n });\n }\n\n return (\n <div\n className={`fk:group/chat fk:flex fk:items-center fk:gap-1 fk:rounded-md fk:pr-1 ${\n active ? 'fk:bg-sidebar-accent' : 'fk:hover:bg-accent/60'\n } fk:corner-squircle`}\n >\n <button\n className=\"fk:min-w-0 fk:flex-1 fk:truncate fk:px-2 fk:py-1.5 fk:text-left fk:text-sm\"\n title={label}\n type=\"button\"\n onClick={onOpen}\n >\n {label}\n </button>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n className=\"fk:size-6 fk:shrink-0 fk:opacity-0 fk:group-hover/chat:opacity-100 fk:data-[state=open]:opacity-100\"\n size=\"icon\"\n variant=\"ghost\"\n >\n <MoreHorizontalIcon className=\"fk:size-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\">\n <DropdownMenuItem\n onClick={() => {\n setTitle(chat.title ?? '');\n setDialog('rename');\n }}\n >\n <PencilIcon className=\"fk:size-4\" />\n Rename\n </DropdownMenuItem>\n <DropdownMenuItem className=\"fk:text-destructive\" onClick={() => setDialog('delete')}>\n <Trash2Icon className=\"fk:size-4\" />\n Delete\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n <Dialog open={dialog === 'rename'} onOpenChange={(open) => setDialog(open ? 'rename' : null)}>\n <DialogContent className=\"fk:max-w-sm\">\n <DialogHeader>\n <DialogTitle>Rename chat</DialogTitle>\n </DialogHeader>\n <Input value={title} onChange={(event) => setTitle(event.target.value)} placeholder=\"Chat title\" />\n <DialogFooter>\n <Button disabled={isMutating || !title.trim()} size=\"sm\" onClick={handleRename}>\n {isMutating ? 'Saving...' : 'Save'}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n <Dialog open={dialog === 'delete'} onOpenChange={(open) => setDialog(open ? 'delete' : null)}>\n <DialogContent className=\"fk:max-w-sm\">\n <DialogHeader>\n <DialogTitle>Delete chat?</DialogTitle>\n </DialogHeader>\n <p className=\"fk:text-sm fk:text-muted-foreground\">\n &ldquo;{label}&rdquo; and its messages will be permanently deleted.\n </p>\n <DialogFooter>\n <Button disabled={isMutating} size=\"sm\" variant=\"destructive\" onClick={handleDelete}>\n {isMutating ? 'Deleting...' : 'Delete'}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </div>\n );\n}\n\nfunction SearchResults({\n onOpen,\n projectId,\n query,\n}: {\n onOpen: (_chatId: string) => void;\n projectId: string;\n query: string;\n}): JSX.Element {\n const { data, isLoading } = useSWR<{ results: AgentChatSearchResult[] }>(\n paths(projectId).agentChatSearch(query),\n fetcher,\n { keepPreviousData: true }\n );\n\n if (isLoading && !data) {\n return (\n <div className=\"fk:flex fk:items-center fk:gap-2 fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground\">\n <LoaderCircle className=\"fk:size-3.5 fk:animate-spin\" />\n Searching...\n </div>\n );\n }\n\n if (!data?.results.length) {\n return <p className=\"fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground\">No matching chats.</p>;\n }\n\n return (\n <div className=\"fk:space-y-1\">\n {data.results.map((result) => (\n <button\n className=\"fk:block fk:w-full fk:rounded-md fk:px-2 fk:py-1.5 fk:text-left fk:hover:bg-accent/60 fk:corner-squircle\"\n key={result.messageId}\n type=\"button\"\n onClick={() => onOpen(result.chatId)}\n >\n <span className=\"fk:block fk:truncate fk:text-sm\">{result.chatTitle?.trim() || 'New chat'}</span>\n <span className=\"fk:block fk:truncate fk:text-xs fk:text-muted-foreground\">{result.snippet}</span>\n </button>\n ))}\n </div>\n );\n}\n\n/**\n * ChatGPT-style chats section embedded in the AI sidebar: new chat button and\n * the user's recent chats grouped by date with rename/delete. When `query` is\n * set, the recent list is replaced by hybrid keyword + semantic search results.\n * Rendered inside the app layout route, so relative navigation resolves\n * against the app root (`agent`, `agent/chats/:chatId`).\n */\nexport function AgentChatsSection({ query }: { query: string }): JSX.Element | null {\n const { api, projectId } = useProjectApi();\n const navigate = useNavigate();\n const location = useLocation();\n const { mutate: globalMutate } = useSWRConfig();\n const activeChatId = /\\/agent\\/chats\\/([^/]+)/.exec(location.pathname)?.[1];\n const { data, isLoading, mutate, setSize, size } = useSWRInfinite<AgentChatsList>(\n (pageIndex, previousPage: AgentChatsList | null) => {\n if (!projectId || (previousPage && !previousPage.hasMore)) {\n return null;\n }\n\n return paths(projectId).agentChats(pageIndex * 30);\n },\n fetcher,\n { revalidateFirstPage: true }\n );\n const { data: activeChatDetail } = useSWR<AgentChatDetail>(\n projectId && activeChatId ? paths(projectId).agentChat(activeChatId) : null,\n fetcher\n );\n const chats = useMemo(() => {\n const listed = (data ?? []).flatMap((page) => page.chats);\n const generatedTitle = activeChatDetail?.chat.title?.trim();\n\n if (!activeChatId || !generatedTitle) {\n return listed;\n }\n\n return listed.map((chat) => {\n if (chat.id !== activeChatId || chat.title?.trim()) {\n return chat;\n }\n\n return { ...chat, title: generatedTitle };\n });\n }, [activeChatDetail?.chat.title, activeChatId, data]);\n const hasMore = data?.[data.length - 1]?.hasMore ?? false;\n const groups = useMemo(() => groupChats(chats), [chats]);\n\n // Refresh the list when the user lands on a chat (new chats, fresh titles).\n useEffect(() => {\n void mutate();\n }, [activeChatId, mutate]);\n\n if (!projectId || !api) {\n return null;\n }\n\n const chatApi = api;\n const chatProjectId = projectId;\n\n function openChat(chatId: string): void {\n navigate(`agent/chats/${chatId}`);\n }\n\n function handleDeleted(chatId: string): void {\n void mutate();\n\n if (chatId === activeChatId) {\n navigate('agent');\n } else {\n // Drop the cached detail so a re-open does not show stale data.\n void globalMutate(paths(chatProjectId).agentChat(chatId), undefined, { revalidate: false });\n }\n }\n\n return (\n <div className=\"fk:space-y-2\">\n {query ? (\n <SearchResults projectId={chatProjectId} query={query} onOpen={openChat} />\n ) : (\n <div className=\"fk:space-y-3\">\n {groups.map((group) => (\n <div key={group.label}>\n <p className=\"fk:px-2 fk:pb-1 fk:text-xs fk:font-medium fk:text-muted-foreground\">{group.label}</p>\n <div className=\"fk:space-y-0.5\">\n {group.chats.map((chat) => (\n <ChatListItem\n active={chat.id === activeChatId}\n api={chatApi}\n chat={chat}\n key={chat.id}\n onChanged={() => void mutate()}\n onDeleted={() => handleDeleted(chat.id)}\n onOpen={() => openChat(chat.id)}\n />\n ))}\n </div>\n </div>\n ))}\n {isLoading ? (\n <div className=\"fk:flex fk:items-center fk:gap-2 fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground\">\n <LoaderCircle className=\"fk:size-3.5 fk:animate-spin\" />\n Loading recent chats...\n </div>\n ) : null}\n {!isLoading && chats.length === 0 ? (\n <div className=\"fk:flex fk:flex-col fk:items-center fk:gap-2 fk:px-2 fk:py-6 fk:text-center fk:text-xs fk:text-muted-foreground\">\n <MessageSquareIcon className=\"fk:size-5\" />\n <span>No chats yet. Start a conversation with the agent.</span>\n </div>\n ) : null}\n {hasMore ? (\n <Button className=\"fk:w-full\" size=\"sm\" variant=\"ghost\" onClick={() => void setSize(size + 1)}>\n Load more\n </Button>\n ) : null}\n </div>\n )}\n </div>\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {b as b$1}from'./chunk-6NRQMG26.js';import {a}from'./chunk-O2QMYUPS.js';import {Slot,Dialog,Separator,ScrollArea}from'radix-ui';import {cva}from'class-variance-authority';import {jsx,jsxs}from'react/jsx-runtime';import {XIcon,SearchIcon}from'lucide-react';import {Command}from'cmdk';var D=cva("fk:inline-flex fk:w-fit fk:shrink-0 fk:items-center fk:justify-center fk:gap-1 fk:overflow-hidden fk:rounded-full fk:border fk:border-transparent fk:px-2 fk:py-0.5 fk:text-xs fk:font-medium fk:whitespace-nowrap fk:transition-[color,box-shadow] fk:focus-visible:border-ring fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:aria-invalid:border-destructive fk:aria-invalid:ring-destructive/20 fk:dark:aria-invalid:ring-destructive/40 fk:[&>svg]:pointer-events-none fk:[&>svg]:size-3 fk:corner-squircle",{variants:{variant:{default:"fk:bg-primary fk:text-primary-foreground fk:[a&]:hover:bg-primary/90",secondary:"fk:bg-secondary fk:text-secondary-foreground fk:[a&]:hover:bg-secondary/90",destructive:"fk:bg-destructive fk:text-white fk:focus-visible:ring-destructive/20 fk:dark:bg-destructive/60 fk:dark:focus-visible:ring-destructive/40 fk:[a&]:hover:bg-destructive/90",outline:"fk:border-border fk:text-foreground fk:[a&]:hover:bg-accent fk:[a&]:hover:text-accent-foreground",ghost:"fk:[a&]:hover:bg-accent fk:[a&]:hover:text-accent-foreground",link:"fk:text-primary fk:underline-offset-4 fk:[a&]:hover:underline"}},defaultVariants:{variant:"default"}});function F({className:t,variant:o="default",asChild:r=false,...i}){let c=r?Slot.Root:"span";return jsx(c,{"data-slot":"badge","data-variant":o,className:a(D({variant:o}),t),...i})}function g({...t}){return jsx(Dialog.Root,{"data-slot":"dialog",...t})}function W({...t}){return jsx(Dialog.Trigger,{"data-slot":"dialog-trigger",...t})}function S({...t}){return jsx(Dialog.Portal,{"data-slot":"dialog-portal",...t})}function Y({...t}){return jsx(Dialog.Close,{"data-slot":"dialog-close",...t})}function z({className:t,...o}){return jsx(Dialog.Overlay,{"data-slot":"dialog-overlay",className:a("fk:fixed fk:inset-0 fk:z-50 fk:bg-black/50 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0",t),...o})}function v({className:t,children:o,showCloseButton:r=true,...i}){return jsxs(S,{"data-slot":"dialog-portal",children:[jsx(z,{}),jsxs(Dialog.Content,{"data-slot":"dialog-content",className:a("fk:fixed fk:top-[50%] fk:left-[50%] fk:z-50 fk:grid fk:w-full fk:max-w-[calc(100%-2rem)] fk:translate-x-[-50%] fk:translate-y-[-50%] fk:gap-4 fk:rounded-lg fk:border fk:bg-background fk:p-6 fk:shadow-lg fk:duration-200 fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95 fk:sm:max-w-lg fk:corner-squircle",t),...i,children:[o,r&&jsxs(Dialog.Close,{"data-slot":"dialog-close",className:"fk:absolute fk:top-4 fk:right-4 fk:rounded-xs fk:opacity-70 fk:ring-offset-background fk:transition-opacity fk:hover:opacity-100 fk:focus:ring-2 fk:focus:ring-ring fk:focus:ring-offset-2 fk:focus:outline-hidden fk:disabled:pointer-events-none fk:data-[state=open]:bg-accent fk:data-[state=open]:text-muted-foreground fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4 fk:corner-squircle",children:[jsx(XIcon,{}),jsx("span",{className:"fk:sr-only",children:"Close"})]})]})]})}function h({className:t,...o}){return jsx("div",{"data-slot":"dialog-header",className:a("fk:flex fk:flex-col fk:gap-2 fk:text-center fk:sm:text-left",t),...o})}function Z({className:t,showCloseButton:o=false,children:r,...i}){return jsxs("div",{"data-slot":"dialog-footer",className:a("fk:flex fk:flex-col-reverse fk:gap-2 fk:sm:flex-row fk:sm:justify-end",t),...i,children:[r,o&&jsx(Dialog.Close,{asChild:true,children:jsx(b$1,{variant:"outline",children:"Close"})})]})}function b({className:t,...o}){return jsx(Dialog.Title,{"data-slot":"dialog-title",className:a("fk:text-lg fk:leading-none fk:font-semibold fk:text-left",t),...o})}function x({className:t,...o}){return jsx(Dialog.Description,{"data-slot":"dialog-description",className:a("fk:text-sm fk:text-muted-foreground fk:text-left",t),...o})}function A({className:t,...o}){return jsx(Command,{"data-slot":"command",className:a("fk:flex fk:h-full fk:w-full fk:flex-col fk:rounded-md fk:bg-popover fk:text-popover-foreground fk:corner-squircle",t),...o})}function at({title:t="Command Palette",description:o="Search for a command to run...",children:r,className:i,showCloseButton:c=true,...P}){return jsxs(g,{...P,children:[jsxs(h,{className:"fk:sr-only",children:[jsx(b,{children:t}),jsx(x,{children:o})]}),jsx(v,{className:a("fk:overflow-hidden fk:p-0",i),showCloseButton:c,children:jsx(A,{className:"fk:**:data-[slot=command-input-wrapper]:h-12 fk:**:[[cmdk-group-heading]]:px-2 fk:**:[[cmdk-group-heading]]:font-medium fk:**:[[cmdk-group-heading]]:text-muted-foreground fk:**:[[cmdk-group]]:px-2 fk:[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 fk:[&_[cmdk-input-wrapper]_svg]:h-5 fk:[&_[cmdk-input-wrapper]_svg]:w-5 fk:**:[[cmdk-input]]:h-12 fk:**:[[cmdk-item]]:px-2 fk:**:[[cmdk-item]]:py-3 fk:[&_[cmdk-item]_svg]:h-5 fk:[&_[cmdk-item]_svg]:w-5",children:r})})]})}function nt({className:t,...o}){return jsxs("div",{"data-slot":"command-input-wrapper",className:"fk:flex fk:h-9 fk:items-center fk:gap-2 fk:border-b fk:px-3",children:[jsx(SearchIcon,{className:"fk:size-4 fk:shrink-0 fk:opacity-50"}),jsx(Command.Input,{"data-slot":"command-input",className:a("fk:flex fk:h-10 fk:w-full fk:rounded-md fk:bg-transparent fk:py-3 fk:text-sm fk:outline-hidden fk:placeholder:text-muted-foreground fk:disabled:cursor-not-allowed fk:disabled:opacity-50 fk:corner-squircle",t),...o})]})}function it({className:t,...o}){return jsx(Command.List,{"data-slot":"command-list",className:a("fk:max-h-[300px] fk:scroll-py-1 fk:overflow-x-hidden fk:overflow-y-auto",t),...o})}function ft({...t}){return jsx(Command.Empty,{"data-slot":"command-empty",className:"fk:py-6 fk:text-center fk:text-sm",...t})}function st({className:t,...o}){return jsx(Command.Group,{"data-slot":"command-group",className:a("fk:overflow-hidden fk:p-1 fk:text-foreground fk:**:[[cmdk-group-heading]]:px-2 fk:**:[[cmdk-group-heading]]:py-1.5 fk:**:[[cmdk-group-heading]]:text-xs fk:**:[[cmdk-group-heading]]:font-medium fk:**:[[cmdk-group-heading]]:text-muted-foreground",t),...o})}function lt({className:t,...o}){return jsx(Command.Separator,{"data-slot":"command-separator",className:a("fk:-mx-1 fk:h-px fk:bg-border",t),...o})}function dt({className:t,...o}){return jsx(Command.Item,{"data-slot":"command-item",className:a("fk:relative fk:flex fk:cursor-default fk:items-center fk:gap-2 fk:rounded-sm fk:px-2 fk:py-1.5 fk:text-sm fk:outline-hidden fk:select-none fk:data-[disabled=true]:pointer-events-none fk:data-[disabled=true]:opacity-50 fk:data-[selected=true]:bg-accent fk:data-[selected=true]:text-accent-foreground fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4 fk:[&_svg:not([class*='text-'])]:text-muted-foreground fk:corner-squircle",t),...o})}function kt({className:t,...o}){return jsx("span",{"data-slot":"command-shortcut",className:a("fk:ml-auto fk:text-xs fk:tracking-widest fk:text-muted-foreground",t),...o})}function C({className:t,orientation:o="horizontal",decorative:r=true,...i}){return jsx(Separator.Root,{"data-slot":"separator",decorative:r,orientation:o,className:a("fk:shrink-0 fk:bg-border fk:data-[orientation=horizontal]:h-px fk:data-[orientation=horizontal]:w-full fk:data-[orientation=vertical]:h-full fk:data-[orientation=vertical]:w-px",t),...i})}function xt({className:t,children:o,...r}){return jsxs(ScrollArea.Root,{"data-slot":"scroll-area",className:a("fk:relative",t),...r,children:[jsx(ScrollArea.Viewport,{"data-slot":"scroll-area-viewport",className:"fk:size-full fk:rounded-[inherit] fk:transition-[color,box-shadow] fk:outline-none fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:focus-visible:outline-1 fk:corner-squircle",children:o}),jsx(T,{}),jsx(ScrollArea.Corner,{})]})}function T({className:t,orientation:o="vertical",...r}){return jsx(ScrollArea.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:o,className:a("fk:flex fk:touch-none fk:p-px fk:transition-colors fk:select-none",o==="vertical"&&"fk:h-full fk:w-2.5 fk:border-l fk:border-l-transparent",o==="horizontal"&&"fk:h-2.5 fk:flex-col fk:border-t fk:border-t-transparent",t),...r,children:jsx(ScrollArea.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"fk:relative fk:flex-1 fk:rounded-full fk:bg-border fk:corner-squircle"})})}var E=cva("fk:flex fk:w-fit fk:items-stretch fk:has-[>[data-slot=button-group]]:gap-2 fk:[&>*]:focus-visible:relative fk:[&>*]:focus-visible:z-10 fk:has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md fk:[&>[data-slot=select-trigger]:not([class*=w-])]:w-fit fk:[&>input]:flex-1",{variants:{orientation:{horizontal:"fk:[&>*:not(:first-child)]:rounded-l-none fk:[&>*:not(:first-child)]:border-l-0 fk:[&>*:not(:last-child)]:rounded-r-none",vertical:"fk:flex-col fk:[&>*:not(:first-child)]:rounded-t-none fk:[&>*:not(:first-child)]:border-t-0 fk:[&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function Nt({className:t,orientation:o,...r}){return jsx("div",{role:"group","data-slot":"button-group","data-orientation":o,className:a(E({orientation:o}),t),...r})}function St({className:t,asChild:o=false,...r}){let i=o?Slot.Root:"div";return jsx(i,{className:a("fk:bg-muted fk:shadow-xs fk:flex fk:items-center fk:gap-2 fk:rounded-md fk:border fk:px-4 fk:text-sm fk:font-medium fk:[&_svg:not([class*=size-])]:size-4 fk:[&_svg]:pointer-events-none fk:corner-squircle",t),...r})}function zt({className:t,orientation:o="vertical",...r}){return jsx(C,{"data-slot":"button-group-separator",orientation:o,className:a("fk:bg-input fk:relative fk:!m-0 fk:self-stretch fk:data-[orientation=vertical]:h-auto",t),...r})}export{St as A,zt as B,D as a,F as b,g as c,W as d,S as e,Y as f,z as g,v as h,h as i,Z as j,b as k,x as l,A as m,at as n,nt as o,it as p,ft as q,st as r,lt as s,dt as t,kt as u,C as v,xt as w,T as x,E as y,Nt as z};//# sourceMappingURL=chunk-32ZU4MLE.js.map
2
+ //# sourceMappingURL=chunk-32ZU4MLE.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ui/primitives/badge.tsx","../src/ui/primitives/dialog.tsx","../src/ui/primitives/command.tsx","../src/ui/primitives/separator.tsx","../src/ui/primitives/scroll-area.tsx","../src/ui/primitives/button-group.tsx"],"names":["badgeVariants","cva","Badge","className","variant","asChild","props","Comp","Slot","jsx","cn","Dialog","DialogPrimitive","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","DialogContent","children","showCloseButton","jsxs","XIcon","DialogHeader","DialogFooter","Button","DialogTitle","DialogDescription","Command","CommandPrimitive","CommandDialog","title","description","CommandInput","SearchIcon","CommandList","CommandEmpty","CommandGroup","CommandSeparator","CommandItem","CommandShortcut","Separator","orientation","decorative","SeparatorPrimitive","ScrollArea","ScrollAreaPrimitive","ScrollBar","buttonGroupVariants","ButtonGroup","ButtonGroupText","ButtonGroupSeparator"],"mappings":"+SAKA,IAAMA,CAAAA,CAAgBC,IACpB,ggBAAA,CACA,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,OAAA,CAAS,sEAAA,CACT,SAAA,CAAW,4EAAA,CACX,WAAA,CACE,0KAAA,CACF,OAAA,CAAS,kGAAA,CACT,MAAO,8DAAA,CACP,IAAA,CAAM,+DACR,CACF,CAAA,CACA,eAAA,CAAiB,CACf,OAAA,CAAS,SACX,CACF,CACF,EAEA,SAASC,EAAM,CACb,SAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CAAU,SAAA,CACV,OAAA,CAAAC,CAAAA,CAAU,KAAA,CACV,GAAGC,CACL,CAAA,CAA8F,CAC5F,IAAMC,EAAOF,CAAAA,CAAUG,IAAAA,CAAK,IAAA,CAAO,MAAA,CAEnC,OACEC,GAAAA,CAACF,EAAA,CAAK,WAAA,CAAU,OAAA,CAAQ,cAAA,CAAcH,CAAAA,CAAS,SAAA,CAAWM,EAAGV,CAAAA,CAAc,CAAE,OAAA,CAAAI,CAAQ,CAAC,CAAA,CAAGD,CAAS,CAAA,CAAI,GAAGG,CAAAA,CAAO,CAEpH,CC5BA,SAASK,CAAAA,CAAO,CAAE,GAAGL,CAAM,CAAA,CAAsD,CAC/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AA,CAAC,KAAA,CAAA,CACC,IAAA,CAAK,OAAA,CACL,WAAA,CAAU,cAAA,CACV,kBAAA,CAAkBgC,CAAAA,CAClB,UAAW/B,CAAAA,CAAGqC,CAAAA,CAAoB,CAAE,WAAA,CAAAN,CAAY,CAAC,CAAA,CAAGtC,CAAS,CAAA,CAC5D,GAAGG,CAAAA,CACN,CAEJ,CAEA,SAAS2C,GAAgB,CACvB,SAAA,CAAA9C,CAAAA,CACA,OAAA,CAAAE,CAAAA,CAAU,KAAA,CACV,GAAGC,CACL,CAAA,CAEG,CACD,IAAMC,CAAAA,CAAOF,CAAAA,CAAUG,KAAK,IAAA,CAAO,KAAA,CAEnC,OACEC,GAAAA,CAACF,CAAAA,CAAA,CACC,SAAA,CAAWG,CAAAA,CACT,6MAAA,CACAP,CACF,CAAA,CACC,GAAGG,CAAAA,CACN,CAEJ,CAEA,SAAS4C,EAAAA,CAAqB,CAC5B,SAAA,CAAA/C,CAAAA,CACA,WAAA,CAAAsC,CAAAA,CAAc,UAAA,CACd,GAAGnC,CACL,CAAA,CAA2C,CACzC,OACEG,GAAAA,CAAC+B,EAAA,CACC,WAAA,CAAU,wBAAA,CACV,WAAA,CAAaC,CAAAA,CACb,SAAA,CAAW/B,CAAAA,CACT,uFAAA,CACAP,CACF,CAAA,CACC,GAAGG,CAAAA,CACN,CAEJ","file":"chunk-ODORXGGY.js","sourcesContent":["import * as React from 'react';\nimport { Slot } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../lib/utils';\n\nconst badgeVariants = cva(\n 'fk:inline-flex fk:w-fit fk:shrink-0 fk:items-center fk:justify-center fk:gap-1 fk:overflow-hidden fk:rounded-full fk:border fk:border-transparent fk:px-2 fk:py-0.5 fk:text-xs fk:font-medium fk:whitespace-nowrap fk:transition-[color,box-shadow] fk:focus-visible:border-ring fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:aria-invalid:border-destructive fk:aria-invalid:ring-destructive/20 fk:dark:aria-invalid:ring-destructive/40 fk:[&>svg]:pointer-events-none fk:[&>svg]:size-3 fk:corner-squircle',\n {\n variants: {\n variant: {\n default: 'fk:bg-primary fk:text-primary-foreground fk:[a&]:hover:bg-primary/90',\n secondary: 'fk:bg-secondary fk:text-secondary-foreground fk:[a&]:hover:bg-secondary/90',\n destructive:\n 'fk:bg-destructive fk:text-white fk:focus-visible:ring-destructive/20 fk:dark:bg-destructive/60 fk:dark:focus-visible:ring-destructive/40 fk:[a&]:hover:bg-destructive/90',\n outline: 'fk:border-border fk:text-foreground fk:[a&]:hover:bg-accent fk:[a&]:hover:text-accent-foreground',\n ghost: 'fk:[a&]:hover:bg-accent fk:[a&]:hover:text-accent-foreground',\n link: 'fk:text-primary fk:underline-offset-4 fk:[a&]:hover:underline',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n);\n\nfunction Badge({\n className,\n variant = 'default',\n asChild = false,\n ...props\n}: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {\n const Comp = asChild ? Slot.Root : 'span';\n\n return (\n <Comp data-slot=\"badge\" data-variant={variant} className={cn(badgeVariants({ variant }), className)} {...props} />\n );\n}\n\nexport { Badge, badgeVariants };\n","'use client';\n\nimport * as React from 'react';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { XIcon } from 'lucide-react';\nimport { cn } from '../lib/utils';\nimport { Button } from './button';\n\nfunction Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n 'fk:fixed fk:inset-0 fk:z-50 fk:bg-black/50 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'fk:fixed fk:top-[50%] fk:left-[50%] fk:z-50 fk:grid fk:w-full fk:max-w-[calc(100%-2rem)] fk:translate-x-[-50%] fk:translate-y-[-50%] fk:gap-4 fk:rounded-lg fk:border fk:bg-background fk:p-6 fk:shadow-lg fk:duration-200 fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95 fk:sm:max-w-lg fk:corner-squircle',\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"fk:absolute fk:top-4 fk:right-4 fk:rounded-xs fk:opacity-70 fk:ring-offset-background fk:transition-opacity fk:hover:opacity-100 fk:focus:ring-2 fk:focus:ring-ring fk:focus:ring-offset-2 fk:focus:outline-hidden fk:disabled:pointer-events-none fk:data-[state=open]:bg-accent fk:data-[state=open]:text-muted-foreground fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4 fk:corner-squircle\"\n >\n <XIcon />\n <span className=\"fk:sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('fk:flex fk:flex-col fk:gap-2 fk:text-center fk:sm:text-left', className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n showCloseButton?: boolean;\n}) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn('fk:flex fk:flex-col-reverse fk:gap-2 fk:sm:flex-row fk:sm:justify-end', className)}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n );\n}\n\nfunction DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('fk:text-lg fk:leading-none fk:font-semibold fk:text-left', className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('fk:text-sm fk:text-muted-foreground fk:text-left', className)}\n {...props}\n />\n );\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","'use client';\n\nimport * as React from 'react';\nimport { Command as CommandPrimitive } from 'cmdk';\nimport { SearchIcon } from 'lucide-react';\nimport { cn } from '../lib/utils';\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from './dialog';\n\ntype CommandChildren = React.ComponentProps<typeof CommandPrimitive>['children'];\n\nfunction Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n 'fk:flex fk:h-full fk:w-full fk:flex-col fk:rounded-md fk:bg-popover fk:text-popover-foreground fk:corner-squircle',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CommandDialog({\n title = 'Command Palette',\n description = 'Search for a command to run...',\n children,\n className,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string;\n description?: string;\n className?: string;\n showCloseButton?: boolean;\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"fk:sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent className={cn('fk:overflow-hidden fk:p-0', className)} showCloseButton={showCloseButton}>\n <Command className=\"fk:**:data-[slot=command-input-wrapper]:h-12 fk:**:[[cmdk-group-heading]]:px-2 fk:**:[[cmdk-group-heading]]:font-medium fk:**:[[cmdk-group-heading]]:text-muted-foreground fk:**:[[cmdk-group]]:px-2 fk:[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 fk:[&_[cmdk-input-wrapper]_svg]:h-5 fk:[&_[cmdk-input-wrapper]_svg]:w-5 fk:**:[[cmdk-input]]:h-12 fk:**:[[cmdk-item]]:px-2 fk:**:[[cmdk-item]]:py-3 fk:[&_[cmdk-item]_svg]:h-5 fk:[&_[cmdk-item]_svg]:w-5\">\n {children as CommandChildren}\n </Command>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div data-slot=\"command-input-wrapper\" className=\"fk:flex fk:h-9 fk:items-center fk:gap-2 fk:border-b fk:px-3\">\n <SearchIcon className=\"fk:size-4 fk:shrink-0 fk:opacity-50\" />\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n 'fk:flex fk:h-10 fk:w-full fk:rounded-md fk:bg-transparent fk:py-3 fk:text-sm fk:outline-hidden fk:placeholder:text-muted-foreground fk:disabled:cursor-not-allowed fk:disabled:opacity-50 fk:corner-squircle',\n className\n )}\n {...props}\n />\n </div>\n );\n}\n\nfunction CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn('fk:max-h-[300px] fk:scroll-py-1 fk:overflow-x-hidden fk:overflow-y-auto', className)}\n {...props}\n />\n );\n}\n\nfunction CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return <CommandPrimitive.Empty data-slot=\"command-empty\" className=\"fk:py-6 fk:text-center fk:text-sm\" {...props} />;\n}\n\nfunction CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n 'fk:overflow-hidden fk:p-1 fk:text-foreground fk:**:[[cmdk-group-heading]]:px-2 fk:**:[[cmdk-group-heading]]:py-1.5 fk:**:[[cmdk-group-heading]]:text-xs fk:**:[[cmdk-group-heading]]:font-medium fk:**:[[cmdk-group-heading]]:text-muted-foreground',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn('fk:-mx-1 fk:h-px fk:bg-border', className)}\n {...props}\n />\n );\n}\n\nfunction CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n \"fk:relative fk:flex fk:cursor-default fk:items-center fk:gap-2 fk:rounded-sm fk:px-2 fk:py-1.5 fk:text-sm fk:outline-hidden fk:select-none fk:data-[disabled=true]:pointer-events-none fk:data-[disabled=true]:opacity-50 fk:data-[selected=true]:bg-accent fk:data-[selected=true]:text-accent-foreground fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4 fk:[&_svg:not([class*='text-'])]:text-muted-foreground fk:corner-squircle\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CommandShortcut({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn('fk:ml-auto fk:text-xs fk:tracking-widest fk:text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n","'use client';\n\nimport * as React from 'react';\nimport { Separator as SeparatorPrimitive } from 'radix-ui';\nimport { cn } from '../lib/utils';\n\nfunction Separator({\n className,\n orientation = 'horizontal',\n decorative = true,\n ...props\n}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {\n return (\n <SeparatorPrimitive.Root\n data-slot=\"separator\"\n decorative={decorative}\n orientation={orientation}\n className={cn(\n 'fk:shrink-0 fk:bg-border fk:data-[orientation=horizontal]:h-px fk:data-[orientation=horizontal]:w-full fk:data-[orientation=vertical]:h-full fk:data-[orientation=vertical]:w-px',\n className\n )}\n {...props}\n />\n );\n}\n\nexport { Separator };\n","'use client';\n\nimport * as React from 'react';\nimport { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';\nimport { cn } from '../lib/utils';\n\nfunction ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {\n return (\n <ScrollAreaPrimitive.Root data-slot=\"scroll-area\" className={cn('fk:relative', className)} {...props}>\n <ScrollAreaPrimitive.Viewport\n data-slot=\"scroll-area-viewport\"\n className=\"fk:size-full fk:rounded-[inherit] fk:transition-[color,box-shadow] fk:outline-none fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:focus-visible:outline-1 fk:corner-squircle\"\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n}\n\nfunction ScrollBar({\n className,\n orientation = 'vertical',\n ...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n className={cn(\n 'fk:flex fk:touch-none fk:p-px fk:transition-colors fk:select-none',\n orientation === 'vertical' && 'fk:h-full fk:w-2.5 fk:border-l fk:border-l-transparent',\n orientation === 'horizontal' && 'fk:h-2.5 fk:flex-col fk:border-t fk:border-t-transparent',\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className=\"fk:relative fk:flex-1 fk:rounded-full fk:bg-border fk:corner-squircle\"\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n}\n\nexport { ScrollArea, ScrollBar };\n","import * as React from 'react';\nimport { Slot } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../lib/utils';\nimport { Separator } from './separator';\n\nconst buttonGroupVariants = cva(\n 'fk:flex fk:w-fit fk:items-stretch fk:has-[>[data-slot=button-group]]:gap-2 fk:[&>*]:focus-visible:relative fk:[&>*]:focus-visible:z-10 fk:has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md fk:[&>[data-slot=select-trigger]:not([class*=w-])]:w-fit fk:[&>input]:flex-1',\n {\n variants: {\n orientation: {\n horizontal:\n 'fk:[&>*:not(:first-child)]:rounded-l-none fk:[&>*:not(:first-child)]:border-l-0 fk:[&>*:not(:last-child)]:rounded-r-none',\n vertical:\n 'fk:flex-col fk:[&>*:not(:first-child)]:rounded-t-none fk:[&>*:not(:first-child)]:border-t-0 fk:[&>*:not(:last-child)]:rounded-b-none',\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n }\n);\n\nfunction ButtonGroup({\n className,\n orientation,\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof buttonGroupVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nfunction ButtonGroupText({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<'div'> & {\n asChild?: boolean;\n}) {\n const Comp = asChild ? Slot.Root : 'div';\n\n return (\n <Comp\n className={cn(\n 'fk:bg-muted fk:shadow-xs fk:flex fk:items-center fk:gap-2 fk:rounded-md fk:border fk:px-4 fk:text-sm fk:font-medium fk:[&_svg:not([class*=size-])]:size-4 fk:[&_svg]:pointer-events-none fk:corner-squircle',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction ButtonGroupSeparator({\n className,\n orientation = 'vertical',\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n 'fk:bg-input fk:relative fk:!m-0 fk:self-stretch fk:data-[orientation=vertical]:h-auto',\n className\n )}\n {...props}\n />\n );\n}\n\nexport { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };\n"]}
1
+ {"version":3,"sources":["../src/ui/primitives/badge.tsx","../src/ui/primitives/dialog.tsx","../src/ui/primitives/command.tsx","../src/ui/primitives/separator.tsx","../src/ui/primitives/scroll-area.tsx","../src/ui/primitives/button-group.tsx"],"names":["badgeVariants","cva","Badge","className","variant","asChild","props","Comp","Slot","jsx","cn","Dialog","DialogPrimitive","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","DialogContent","children","showCloseButton","jsxs","XIcon","DialogHeader","DialogFooter","Button","DialogTitle","DialogDescription","Command","CommandPrimitive","CommandDialog","title","description","CommandInput","SearchIcon","CommandList","CommandEmpty","CommandGroup","CommandSeparator","CommandItem","CommandShortcut","Separator","orientation","decorative","SeparatorPrimitive","ScrollArea","ScrollAreaPrimitive","ScrollBar","buttonGroupVariants","ButtonGroup","ButtonGroupText","ButtonGroupSeparator"],"mappings":"sTAKA,IAAMA,CAAAA,CAAgBC,IACpB,ggBAAA,CACA,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ACC,GAAGG,CAAAA,CACN,CAEJ,CAEA,SAAS4C,EAAAA,CAAqB,CAC5B,SAAA,CAAA/C,CAAAA,CACA,WAAA,CAAAsC,CAAAA,CAAc,UAAA,CACd,GAAGnC,CACL,CAAA,CAA2C,CACzC,OACEG,GAAAA,CAAC+B,EAAA,CACC,WAAA,CAAU,wBAAA,CACV,WAAA,CAAaC,CAAAA,CACb,SAAA,CAAW/B,CAAAA,CACT,uFAAA,CACAP,CACF,CAAA,CACC,GAAGG,CAAAA,CACN,CAEJ","file":"chunk-32ZU4MLE.js","sourcesContent":["import * as React from 'react';\nimport { Slot } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../lib/utils';\n\nconst badgeVariants = cva(\n 'fk:inline-flex fk:w-fit fk:shrink-0 fk:items-center fk:justify-center fk:gap-1 fk:overflow-hidden fk:rounded-full fk:border fk:border-transparent fk:px-2 fk:py-0.5 fk:text-xs fk:font-medium fk:whitespace-nowrap fk:transition-[color,box-shadow] fk:focus-visible:border-ring fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:aria-invalid:border-destructive fk:aria-invalid:ring-destructive/20 fk:dark:aria-invalid:ring-destructive/40 fk:[&>svg]:pointer-events-none fk:[&>svg]:size-3 fk:corner-squircle',\n {\n variants: {\n variant: {\n default: 'fk:bg-primary fk:text-primary-foreground fk:[a&]:hover:bg-primary/90',\n secondary: 'fk:bg-secondary fk:text-secondary-foreground fk:[a&]:hover:bg-secondary/90',\n destructive:\n 'fk:bg-destructive fk:text-white fk:focus-visible:ring-destructive/20 fk:dark:bg-destructive/60 fk:dark:focus-visible:ring-destructive/40 fk:[a&]:hover:bg-destructive/90',\n outline: 'fk:border-border fk:text-foreground fk:[a&]:hover:bg-accent fk:[a&]:hover:text-accent-foreground',\n ghost: 'fk:[a&]:hover:bg-accent fk:[a&]:hover:text-accent-foreground',\n link: 'fk:text-primary fk:underline-offset-4 fk:[a&]:hover:underline',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n);\n\nfunction Badge({\n className,\n variant = 'default',\n asChild = false,\n ...props\n}: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {\n const Comp = asChild ? Slot.Root : 'span';\n\n return (\n <Comp data-slot=\"badge\" data-variant={variant} className={cn(badgeVariants({ variant }), className)} {...props} />\n );\n}\n\nexport { Badge, badgeVariants };\n","'use client';\n\nimport * as React from 'react';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\nimport { XIcon } from 'lucide-react';\nimport { cn } from '../lib/utils';\nimport { Button } from './button';\n\nfunction Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n 'fk:fixed fk:inset-0 fk:z-50 fk:bg-black/50 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'fk:fixed fk:top-[50%] fk:left-[50%] fk:z-50 fk:grid fk:w-full fk:max-w-[calc(100%-2rem)] fk:translate-x-[-50%] fk:translate-y-[-50%] fk:gap-4 fk:rounded-lg fk:border fk:bg-background fk:p-6 fk:shadow-lg fk:duration-200 fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95 fk:sm:max-w-lg fk:corner-squircle',\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"fk:absolute fk:top-4 fk:right-4 fk:rounded-xs fk:opacity-70 fk:ring-offset-background fk:transition-opacity fk:hover:opacity-100 fk:focus:ring-2 fk:focus:ring-ring fk:focus:ring-offset-2 fk:focus:outline-hidden fk:disabled:pointer-events-none fk:data-[state=open]:bg-accent fk:data-[state=open]:text-muted-foreground fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4 fk:corner-squircle\"\n >\n <XIcon />\n <span className=\"fk:sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('fk:flex fk:flex-col fk:gap-2 fk:text-center fk:sm:text-left', className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n showCloseButton?: boolean;\n}) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn('fk:flex fk:flex-col-reverse fk:gap-2 fk:sm:flex-row fk:sm:justify-end', className)}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n );\n}\n\nfunction DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('fk:text-lg fk:leading-none fk:font-semibold fk:text-left', className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('fk:text-sm fk:text-muted-foreground fk:text-left', className)}\n {...props}\n />\n );\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","'use client';\n\nimport * as React from 'react';\nimport { Command as CommandPrimitive } from 'cmdk';\nimport { SearchIcon } from 'lucide-react';\nimport { cn } from '../lib/utils';\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from './dialog';\n\ntype CommandChildren = React.ComponentProps<typeof CommandPrimitive>['children'];\n\nfunction Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n 'fk:flex fk:h-full fk:w-full fk:flex-col fk:rounded-md fk:bg-popover fk:text-popover-foreground fk:corner-squircle',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CommandDialog({\n title = 'Command Palette',\n description = 'Search for a command to run...',\n children,\n className,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string;\n description?: string;\n className?: string;\n showCloseButton?: boolean;\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"fk:sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent className={cn('fk:overflow-hidden fk:p-0', className)} showCloseButton={showCloseButton}>\n <Command className=\"fk:**:data-[slot=command-input-wrapper]:h-12 fk:**:[[cmdk-group-heading]]:px-2 fk:**:[[cmdk-group-heading]]:font-medium fk:**:[[cmdk-group-heading]]:text-muted-foreground fk:**:[[cmdk-group]]:px-2 fk:[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 fk:[&_[cmdk-input-wrapper]_svg]:h-5 fk:[&_[cmdk-input-wrapper]_svg]:w-5 fk:**:[[cmdk-input]]:h-12 fk:**:[[cmdk-item]]:px-2 fk:**:[[cmdk-item]]:py-3 fk:[&_[cmdk-item]_svg]:h-5 fk:[&_[cmdk-item]_svg]:w-5\">\n {children as CommandChildren}\n </Command>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div data-slot=\"command-input-wrapper\" className=\"fk:flex fk:h-9 fk:items-center fk:gap-2 fk:border-b fk:px-3\">\n <SearchIcon className=\"fk:size-4 fk:shrink-0 fk:opacity-50\" />\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n 'fk:flex fk:h-10 fk:w-full fk:rounded-md fk:bg-transparent fk:py-3 fk:text-sm fk:outline-hidden fk:placeholder:text-muted-foreground fk:disabled:cursor-not-allowed fk:disabled:opacity-50 fk:corner-squircle',\n className\n )}\n {...props}\n />\n </div>\n );\n}\n\nfunction CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn('fk:max-h-[300px] fk:scroll-py-1 fk:overflow-x-hidden fk:overflow-y-auto', className)}\n {...props}\n />\n );\n}\n\nfunction CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return <CommandPrimitive.Empty data-slot=\"command-empty\" className=\"fk:py-6 fk:text-center fk:text-sm\" {...props} />;\n}\n\nfunction CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n 'fk:overflow-hidden fk:p-1 fk:text-foreground fk:**:[[cmdk-group-heading]]:px-2 fk:**:[[cmdk-group-heading]]:py-1.5 fk:**:[[cmdk-group-heading]]:text-xs fk:**:[[cmdk-group-heading]]:font-medium fk:**:[[cmdk-group-heading]]:text-muted-foreground',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn('fk:-mx-1 fk:h-px fk:bg-border', className)}\n {...props}\n />\n );\n}\n\nfunction CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n \"fk:relative fk:flex fk:cursor-default fk:items-center fk:gap-2 fk:rounded-sm fk:px-2 fk:py-1.5 fk:text-sm fk:outline-hidden fk:select-none fk:data-[disabled=true]:pointer-events-none fk:data-[disabled=true]:opacity-50 fk:data-[selected=true]:bg-accent fk:data-[selected=true]:text-accent-foreground fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4 fk:[&_svg:not([class*='text-'])]:text-muted-foreground fk:corner-squircle\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CommandShortcut({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn('fk:ml-auto fk:text-xs fk:tracking-widest fk:text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n","'use client';\n\nimport * as React from 'react';\nimport { Separator as SeparatorPrimitive } from 'radix-ui';\nimport { cn } from '../lib/utils';\n\nfunction Separator({\n className,\n orientation = 'horizontal',\n decorative = true,\n ...props\n}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {\n return (\n <SeparatorPrimitive.Root\n data-slot=\"separator\"\n decorative={decorative}\n orientation={orientation}\n className={cn(\n 'fk:shrink-0 fk:bg-border fk:data-[orientation=horizontal]:h-px fk:data-[orientation=horizontal]:w-full fk:data-[orientation=vertical]:h-full fk:data-[orientation=vertical]:w-px',\n className\n )}\n {...props}\n />\n );\n}\n\nexport { Separator };\n","'use client';\n\nimport * as React from 'react';\nimport { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';\nimport { cn } from '../lib/utils';\n\nfunction ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {\n return (\n <ScrollAreaPrimitive.Root data-slot=\"scroll-area\" className={cn('fk:relative', className)} {...props}>\n <ScrollAreaPrimitive.Viewport\n data-slot=\"scroll-area-viewport\"\n className=\"fk:size-full fk:rounded-[inherit] fk:transition-[color,box-shadow] fk:outline-none fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:focus-visible:outline-1 fk:corner-squircle\"\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n}\n\nfunction ScrollBar({\n className,\n orientation = 'vertical',\n ...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n className={cn(\n 'fk:flex fk:touch-none fk:p-px fk:transition-colors fk:select-none',\n orientation === 'vertical' && 'fk:h-full fk:w-2.5 fk:border-l fk:border-l-transparent',\n orientation === 'horizontal' && 'fk:h-2.5 fk:flex-col fk:border-t fk:border-t-transparent',\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className=\"fk:relative fk:flex-1 fk:rounded-full fk:bg-border fk:corner-squircle\"\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n}\n\nexport { ScrollArea, ScrollBar };\n","import * as React from 'react';\nimport { Slot } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../lib/utils';\nimport { Separator } from './separator';\n\nconst buttonGroupVariants = cva(\n 'fk:flex fk:w-fit fk:items-stretch fk:has-[>[data-slot=button-group]]:gap-2 fk:[&>*]:focus-visible:relative fk:[&>*]:focus-visible:z-10 fk:has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md fk:[&>[data-slot=select-trigger]:not([class*=w-])]:w-fit fk:[&>input]:flex-1',\n {\n variants: {\n orientation: {\n horizontal:\n 'fk:[&>*:not(:first-child)]:rounded-l-none fk:[&>*:not(:first-child)]:border-l-0 fk:[&>*:not(:last-child)]:rounded-r-none',\n vertical:\n 'fk:flex-col fk:[&>*:not(:first-child)]:rounded-t-none fk:[&>*:not(:first-child)]:border-t-0 fk:[&>*:not(:last-child)]:rounded-b-none',\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n }\n);\n\nfunction ButtonGroup({\n className,\n orientation,\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof buttonGroupVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nfunction ButtonGroupText({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<'div'> & {\n asChild?: boolean;\n}) {\n const Comp = asChild ? Slot.Root : 'div';\n\n return (\n <Comp\n className={cn(\n 'fk:bg-muted fk:shadow-xs fk:flex fk:items-center fk:gap-2 fk:rounded-md fk:border fk:px-4 fk:text-sm fk:font-medium fk:[&_svg:not([class*=size-])]:size-4 fk:[&_svg]:pointer-events-none fk:corner-squircle',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction ButtonGroupSeparator({\n className,\n orientation = 'vertical',\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n 'fk:bg-input fk:relative fk:!m-0 fk:self-stretch fk:data-[orientation=vertical]:h-auto',\n className\n )}\n {...props}\n />\n );\n}\n\nexport { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };\n"]}
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {t,u,v as v$1}from'./chunk-YCCFUGWJ.js';import {v,b as b$1,m,o,p,q,r,t as t$1,s}from'./chunk-32ZU4MLE.js';import {b}from'./chunk-6NRQMG26.js';import {a}from'./chunk-O2QMYUPS.js';import {CirclePlus,Check}from'lucide-react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';function w({column:s$1,title:i,options:d}){let r$1=new Set(s$1?.getFilterValue());return jsxs(t,{children:[jsx(u,{asChild:true,children:jsxs(b,{variant:"outline",size:"sm",className:"fk:h-8 fk:border-dashed",children:[jsx(CirclePlus,{className:"fk:mr-2 fk:h-4 fk:w-4"}),i,r$1?.size>0&&jsxs(Fragment,{children:[jsx(v,{orientation:"vertical",className:"fk:mx-2 fk:h-4"}),jsx(b$1,{variant:"secondary",className:"fk:rounded-xs fk:px-1 fk:font-normal fk:lg:hidden fk:corner-squircle",children:r$1.size}),jsx("div",{className:"fk:space-x-1 fk:lg:flex",children:r$1.size>2?jsxs(b$1,{variant:"secondary",className:"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle",children:[r$1.size," selected"]}):d.filter(a=>r$1.has(a.value)).map(a=>jsx(b$1,{variant:"secondary",className:"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle",children:a.label},a.value))})]})]})}),jsx(v$1,{className:"fk:w-50 fk:p-0",align:"start",children:jsxs(m,{children:[jsx(o,{placeholder:i}),jsxs(p,{children:[jsx(q,{children:"No results found."}),jsx(r,{children:d.map(a$1=>{let m=r$1.has(a$1.value);return jsxs(t$1,{onSelect:()=>{m?r$1.delete(a$1.value):r$1.add(a$1.value);let c=Array.from(r$1);s$1?.setFilterValue(c.length?c:void 0);},children:[jsx("div",{className:a("fk:mr-2 fk:flex fk:h-4 fk:w-4 fk:items-center fk:justify-center fk:rounded-xs fk:border fk:border-primary fk:corner-squircle",m?"fk:bg-primary fk:text-primary-foreground":"fk:opacity-50 fk:[&_svg]:invisible"),children:jsx(Check,{className:a("fk:size-3.5",m?"fk:text-primary-foreground":"fk:text-muted-foreground")})}),a$1.icon&&jsx(a$1.icon,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:text-muted-foreground"}),jsx("span",{children:a$1.label})]},a$1.value)})}),r$1.size>0&&jsxs(Fragment,{children:[jsx(s,{}),jsx(r,{children:jsx(t$1,{onSelect:()=>s$1?.setFilterValue(void 0),className:"fk:justify-center fk:text-center",children:"Clear filters"})})]})]})]})})]})}export{w as a};//# sourceMappingURL=chunk-3C2EG3SI.js.map
2
+ //# sourceMappingURL=chunk-3C2EG3SI.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data-grid/data-table-faceted-filter.tsx"],"names":["DataTableFacetedFilter","column","title","options","selectedValues","jsxs","Popover","jsx","PopoverTrigger","Button","CirclePlusIcon","Fragment","Separator","Badge","option","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandGroup","isSelected","CommandItem","filterValues","cn","CheckIcon","CommandSeparator"],"mappings":"oSA4BO,SAASA,CAAAA,CAAsC,CACpD,MAAA,CAAAC,GAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,GACF,EAA+C,CAC7C,IAAMC,GAAAA,CAAiB,IAAI,GAAA,CAAIH,GAAAA,EAAQ,cAAA,EAA4B,EAEnE,OACEI,IAAAA,CAACC,CAAAA,CAAA,CACC,QAAA,CAAA,CAAAC,GAAAA,CAACC,CAAAA,CAAA,CAAe,QAAO,IAAA,CACrB,QAAA,CAAAH,IAAAA,CAACI,CAAAA,CAAA,CAAO,OAAA,CAAQ,SAAA,CAAU,IAAA,CAAK,KAAK,SAAA,CAAU,yBAAA,CAC5C,QAAA,CAAA,CAAAF,GAAAA,CAACG,UAAAA,CAAA,CAAe,SAA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,CAAAb,GAAAA,CAACe,GAAAA,CAAA,CACC,QAAA,CAAU,IAAMrB,GAAAA,EAAQ,cAAA,CAAe,MAAS,CAAA,CAChD,SAAA,CAAU,kCAAA,CACX,QAAA,CAAA,eAAA,CAED,EACF,CAAA,CAAA,CACF,CAAA,CAAA,CAEJ,CAAA,CAAA,CACF,CAAA,CACF,GACF,CAEJ","file":"chunk-GW37ZTR2.js","sourcesContent":["import * as React from 'react';\nimport { Check as CheckIcon, CirclePlus as CirclePlusIcon } from 'lucide-react';\nimport { Column } from '@tanstack/react-table';\nimport { cn } from '../ui/lib/utils';\nimport { Badge } from '../ui/primitives/badge';\nimport { Button } from '../ui/primitives/button';\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from '../ui/primitives/command';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/primitives/popover';\nimport { Separator } from '../ui/primitives/separator';\n\ninterface DataTableFacetedFilterProps<TData, TValue> {\n column?: Column<TData, TValue>;\n title?: string;\n options: {\n label: string;\n value: string;\n icon?: React.ComponentType<{ className?: string }>;\n }[];\n}\n\nexport function DataTableFacetedFilter<TData, TValue>({\n column,\n title,\n options,\n}: DataTableFacetedFilterProps<TData, TValue>) {\n const selectedValues = new Set(column?.getFilterValue() as string[]);\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" className=\"fk:h-8 fk:border-dashed\">\n <CirclePlusIcon className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n {title}\n {selectedValues?.size > 0 && (\n <>\n <Separator orientation=\"vertical\" className=\"fk:mx-2 fk:h-4\" />\n <Badge variant=\"secondary\" className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:lg:hidden fk:corner-squircle\">\n {selectedValues.size}\n </Badge>\n <div className=\"fk:space-x-1 fk:lg:flex\">\n {selectedValues.size > 2 ? (\n <Badge variant=\"secondary\" className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle\">\n {selectedValues.size} selected\n </Badge>\n ) : (\n options\n .filter((option) => selectedValues.has(option.value))\n .map((option) => (\n <Badge variant=\"secondary\" key={option.value} className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle\">\n {option.label}\n </Badge>\n ))\n )}\n </div>\n </>\n )}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"fk:w-50 fk:p-0\" align=\"start\">\n <Command>\n <CommandInput placeholder={title} />\n <CommandList>\n <CommandEmpty>No results found.</CommandEmpty>\n <CommandGroup>\n {options.map((option) => {\n const isSelected = selectedValues.has(option.value);\n return (\n <CommandItem\n key={option.value}\n onSelect={() => {\n if (isSelected) {\n selectedValues.delete(option.value);\n } else {\n selectedValues.add(option.value);\n }\n const filterValues = Array.from(selectedValues);\n column?.setFilterValue(filterValues.length ? filterValues : undefined);\n }}\n >\n <div\n className={cn(\n 'fk:mr-2 fk:flex fk:h-4 fk:w-4 fk:items-center fk:justify-center fk:rounded-xs fk:border fk:border-primary fk:corner-squircle',\n isSelected ? 'fk:bg-primary fk:text-primary-foreground' : 'fk:opacity-50 fk:[&_svg]:invisible'\n )}\n >\n <CheckIcon\n className={cn(\n 'fk:size-3.5',\n isSelected ? 'fk:text-primary-foreground' : 'fk:text-muted-foreground'\n )}\n />\n </div>\n {option.icon && <option.icon className=\"fk:mr-2 fk:h-4 fk:w-4 fk:text-muted-foreground\" />}\n <span>{option.label}</span>\n </CommandItem>\n );\n })}\n </CommandGroup>\n {selectedValues.size > 0 && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <CommandItem\n onSelect={() => column?.setFilterValue(undefined)}\n className=\"fk:justify-center fk:text-center\"\n >\n Clear filters\n </CommandItem>\n </CommandGroup>\n </>\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/data-grid/data-table-faceted-filter.tsx"],"names":["DataTableFacetedFilter","column","title","options","selectedValues","jsxs","Popover","jsx","PopoverTrigger","Button","CirclePlusIcon","Fragment","Separator","Badge","option","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandGroup","isSelected","CommandItem","filterValues","cn","CheckIcon","CommandSeparator"],"mappings":"2SA4BO,SAASA,CAAAA,CAAsC,CACpD,MAAA,CAAAC,GAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CACF,EAA+C,CAC7C,IAAMC,GAAAA,CAAiB,IAAI,GAAA,CAAIH,GAAAA,EAAQ,cAAA,EAA4B,EAEnE,OACEI,IAAAA,CAACC,CAAAA,CAAA,CACC,QAAA,CAAA,CAAAC,GAAAA,CAACC,CAAAA,CAAA,CAAe,QAAO,IAAA,CACrB,QAAA,CAAAH,IAAAA,CAACI,CAAAA,CAAA,CAAO,OAAA,CAAQ,SAAA,CAAU,IAAA,CAAK,KAAK,SAAA,CAAU,yBAAA,CAC5C,QAAA,CAAA,CAAAF,GAAAA,CAACG,UAAAA,CAAA,CAAe,SAAA,CAAU,uBAAA,CAAwB,EACjDR,CAAAA,CACAE,GAAAA,EAAgB,IAAA,CAAO,CAAA,EACtBC,IAAAA,CAAAM,QAAAA,CAAA,CACE,QAAA,CAAA,CAAAJ,IAACK,CAAAA,CAAA,CAAU,WAAA,CAAY,UAAA,CAAW,SAAA,CAAU,gBAAA,CAAiB,CAAA,CAC7DL,GAAAA,CAACM,IAAA,CAAM,OAAA,CAAQ,WAAA,CAAY,SAAA,CAAU,sEAAA,CAClC,QAAA,CAAAT,GAAAA,CAAe,IAAA,CAClB,EACAG,GAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,yBAAA,CACZ,QAAA,CAAAH,GAAAA,CAAe,IAAA,CAAO,CAAA,CACrBC,KAACQ,GAAAA,CAAA,CAAM,OAAA,CAAQ,WAAA,CAAY,SAAA,CAAU,yDAAA,CAClC,QAAA,CAAA,CAAAT,GAAAA,CAAe,KAAK,WAAA,CAAA,CACvB,CAAA,CAEAD,CAAAA,CACG,MAAA,CAAQW,CA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0CAAA,CAA6C,oCAC5D,CAAA,CAEA,QAAA,CAAAd,GAAAA,CAACkB,MAAA,CACC,SAAA,CAAWD,CAAAA,CACT,aAAA,CACAH,CAAAA,CAAa,4BAAA,CAA+B,0BAC9C,CAAA,CACF,EACF,CAAA,CACCP,GAAAA,CAAO,IAAA,EAAQP,GAAAA,CAACO,GAAAA,CAAO,IAAA,CAAP,CAAY,SAAA,CAAU,iDAAiD,CAAA,CACxFP,GAAAA,CAAC,MAAA,CAAA,CAAM,QAAA,CAAAO,GAAAA,CAAO,KAAA,CAAM,CAAA,CAAA,CAAA,CAzBfA,GAAAA,CAAO,KA0Bd,CAEJ,CAAC,CAAA,CACH,CAAA,CACCV,GAAAA,CAAe,IAAA,CAAO,CAAA,EACrBC,IAAAA,CAAAM,SAAA,CACE,QAAA,CAAA,CAAAJ,GAAAA,CAACmB,CAAAA,CAAA,EAAiB,CAAA,CAClBnB,GAAAA,CAACa,CAAAA,CAAA,CACC,QAAA,CAAAb,GAAAA,CAACe,GAAAA,CAAA,CACC,QAAA,CAAU,IAAMrB,GAAAA,EAAQ,cAAA,CAAe,MAAS,CAAA,CAChD,SAAA,CAAU,kCAAA,CACX,QAAA,CAAA,eAAA,CAED,EACF,CAAA,CAAA,CACF,CAAA,CAAA,CAEJ,CAAA,CAAA,CACF,CAAA,CACF,GACF,CAEJ","file":"chunk-3C2EG3SI.js","sourcesContent":["import * as React from 'react';\nimport { Check as CheckIcon, CirclePlus as CirclePlusIcon } from 'lucide-react';\nimport { Column } from '@tanstack/react-table';\nimport { cn } from '../ui/lib/utils';\nimport { Badge } from '../ui/primitives/badge';\nimport { Button } from '../ui/primitives/button';\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from '../ui/primitives/command';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/primitives/popover';\nimport { Separator } from '../ui/primitives/separator';\n\ninterface DataTableFacetedFilterProps<TData, TValue> {\n column?: Column<TData, TValue>;\n title?: string;\n options: {\n label: string;\n value: string;\n icon?: React.ComponentType<{ className?: string }>;\n }[];\n}\n\nexport function DataTableFacetedFilter<TData, TValue>({\n column,\n title,\n options,\n}: DataTableFacetedFilterProps<TData, TValue>) {\n const selectedValues = new Set(column?.getFilterValue() as string[]);\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" className=\"fk:h-8 fk:border-dashed\">\n <CirclePlusIcon className=\"fk:mr-2 fk:h-4 fk:w-4\" />\n {title}\n {selectedValues?.size > 0 && (\n <>\n <Separator orientation=\"vertical\" className=\"fk:mx-2 fk:h-4\" />\n <Badge variant=\"secondary\" className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:lg:hidden fk:corner-squircle\">\n {selectedValues.size}\n </Badge>\n <div className=\"fk:space-x-1 fk:lg:flex\">\n {selectedValues.size > 2 ? (\n <Badge variant=\"secondary\" className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle\">\n {selectedValues.size} selected\n </Badge>\n ) : (\n options\n .filter((option) => selectedValues.has(option.value))\n .map((option) => (\n <Badge variant=\"secondary\" key={option.value} className=\"fk:rounded-xs fk:px-1 fk:font-normal fk:corner-squircle\">\n {option.label}\n </Badge>\n ))\n )}\n </div>\n </>\n )}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"fk:w-50 fk:p-0\" align=\"start\">\n <Command>\n <CommandInput placeholder={title} />\n <CommandList>\n <CommandEmpty>No results found.</CommandEmpty>\n <CommandGroup>\n {options.map((option) => {\n const isSelected = selectedValues.has(option.value);\n return (\n <CommandItem\n key={option.value}\n onSelect={() => {\n if (isSelected) {\n selectedValues.delete(option.value);\n } else {\n selectedValues.add(option.value);\n }\n const filterValues = Array.from(selectedValues);\n column?.setFilterValue(filterValues.length ? filterValues : undefined);\n }}\n >\n <div\n className={cn(\n 'fk:mr-2 fk:flex fk:h-4 fk:w-4 fk:items-center fk:justify-center fk:rounded-xs fk:border fk:border-primary fk:corner-squircle',\n isSelected ? 'fk:bg-primary fk:text-primary-foreground' : 'fk:opacity-50 fk:[&_svg]:invisible'\n )}\n >\n <CheckIcon\n className={cn(\n 'fk:size-3.5',\n isSelected ? 'fk:text-primary-foreground' : 'fk:text-muted-foreground'\n )}\n />\n </div>\n {option.icon && <option.icon className=\"fk:mr-2 fk:h-4 fk:w-4 fk:text-muted-foreground\" />}\n <span>{option.label}</span>\n </CommandItem>\n );\n })}\n </CommandGroup>\n {selectedValues.size > 0 && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <CommandItem\n onSelect={() => column?.setFilterValue(undefined)}\n className=\"fk:justify-center fk:text-center\"\n >\n Clear filters\n </CommandItem>\n </CommandGroup>\n </>\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {createContext,useState,useEffect,useContext}from'react';var v=createContext(true);function f(){return useContext(v)}function c(){return typeof document>"u"||document.visibilityState==="visible"&&document.hasFocus()}function g(){let t=f(),[i,o]=useState(c);return useEffect(()=>{let n=()=>o(c());return n(),window.addEventListener("focus",n),window.addEventListener("blur",n),document.addEventListener("visibilitychange",n),()=>{window.removeEventListener("focus",n),window.removeEventListener("blur",n),document.removeEventListener("visibilitychange",n);}},[]),t&&i}var A="1970-01-01T00:00:00.000Z";function h(t){return t.chatId?`agent/chats/${t.chatId}`:t.automationId&&t.automationRunId?`automations/${t.automationId}/runs/${t.automationRunId}`:null}function b(t){return t.chatId?"View chat":t.automationId&&t.automationRunId?"View run":null}var p={approved:"Approved",cancelled:"Cancelled",expired:"Expired",rejected:"Rejected"};function m(t){return t.kind==="automation_failure"?"Failed":t.kind==="automation_result"?"Result":t.resolution?p[t.resolution]:t.requiresAction&&t.state!=="done"&&t.state!=="dismissed"?"Needs approval":null}function w(t){return t.kind==="automation_failure"?"failure":y(t)?"attention":"neutral"}function y(t){return t.requiresAction&&t.resolvedAt===null&&t.state!=="dismissed"&&t.state!=="done"}function E({newItems:t,since:i}){let o=t.reduce((e,u)=>e===null||u.createdAt>e?u.createdAt:e,null);if(i===null)return {notifications:[],since:o??A};let n=t.filter(e=>e.createdAt>i),r=o!==null&&o>i?o:i;return n.length===0?{notifications:[],since:r}:n.length>3?{notifications:[{body:"Open Activity in Flexkit Studio to review them.",path:"activity",tag:`flexkit-activity-batch:${r}`,title:`${n.length.toString()} new items in Activity`}],since:r}:{notifications:n.map(e=>({body:e.body??"",path:`activity/${encodeURIComponent(e.id)}`,tag:`flexkit-activity:${e.id}`,title:e.title})),since:r}}export{v as a,g as b,h as c,b as d,m as e,w as f,y as g,E as h};//# sourceMappingURL=chunk-3TGCCDOR.js.map
2
+ //# sourceMappingURL=chunk-3TGCCDOR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/apps/app-active.ts","../src/apps/ai/activity.ts"],"names":["AppActiveContext","createContext","useIsAppActive","useContext","isWindowInFront","useIsViewing","isAppActive","isInFront","setIsInFront","useState","useEffect","update","EPOCH","getActivitySourcePath","item","getActivitySourceLabel","RESOLUTION_LABELS","getActivityStatusLabel","getActivityStatusTone","isActivityItemOpen","planActivityNotifications","newItems","since","newest","latest","fresh","nextSince"],"mappings":"oFAOO,IAAMA,EAAmBC,aAAAA,CAAc,IAAI,EAE3C,SAASC,CAAAA,EAA0B,CACxC,OAAOC,UAAAA,CAAWH,CAAgB,CACpC,CAEA,SAASI,CAAAA,EAA2B,CAClC,OAAO,OAAO,SAAa,GAAA,EAAgB,QAAA,CAAS,eAAA,GAAoB,SAAA,EAAa,SAAS,QAAA,EAChG,CAMO,SAASC,CAAAA,EAAwB,CACtC,IAAMC,CAAAA,CAAcJ,CAAAA,EAAe,CAC7B,CAACK,CAAAA,CAAWC,CAAY,CAAA,CAAIC,QAAAA,CAASL,CAAe,CAAA,CAE1D,OAAAM,SAAAA,CAAU,IAAM,CACd,IAAMC,CAAAA,CAAS,IAAYH,CAAAA,CAAaJ,CAAAA,EAAiB,CAAA,CAEzD,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C,CACF,CAAA,CACA,KAAA,CAAOC,CACT,CAAA,CAGK,CACL,aAAA,CAAeD,CAAAA,CAAM,IAAKX,CAAAA,GAAU,CAClC,KAAMA,CAAAA,CAAK,IAAA,EAAQ,EAAA,CACnB,IAAA,CAAM,YAAY,kBAAA,CAAmBA,CAAAA,CAAK,EAAE,CAAC,CAAA,CAAA,CAC7C,IAAK,CAAA,iBAAA,EAAoBA,CAAAA,CAAK,EAAE,CAAA,CAAA,CAChC,MAAOA,CAAAA,CAAK,KACd,EAAE,CAAA,CACF,KAAA,CAAOY,CACT,CACF","file":"chunk-3TGCCDOR.js","sourcesContent":["import { createContext, useContext, useEffect, useState } from 'react';\n\n/**\n * Whether the app around a component is the one in front. Opened apps stay\n * mounted behind the active one (see `AppOutlet`), so their effects keep\n * running; this tells them apart. Outside an app it is `true`.\n */\nexport const AppActiveContext = createContext(true);\n\nexport function useIsAppActive(): boolean {\n return useContext(AppActiveContext);\n}\n\nfunction isWindowInFront(): boolean {\n return typeof document === 'undefined' || (document.visibilityState === 'visible' && document.hasFocus());\n}\n\n/**\n * The person is looking at this app right now: it is the app in front, the\n * tab is visible and the browser window has focus.\n */\nexport function useIsViewing(): boolean {\n const isAppActive = useIsAppActive();\n const [isInFront, setIsInFront] = useState(isWindowInFront);\n\n useEffect(() => {\n const update = (): void => setIsInFront(isWindowInFront());\n\n update();\n window.addEventListener('focus', update);\n window.addEventListener('blur', update);\n document.addEventListener('visibilitychange', update);\n\n return () => {\n window.removeEventListener('focus', update);\n window.removeEventListener('blur', update);\n document.removeEventListener('visibilitychange', update);\n };\n }, []);\n\n return isAppActive && isInFront;\n}\n","import type { ActivityItem, ActivityItemResolution } from './types';\n\n/** More new items than this in one poll are announced by a single summary notification. */\nconst MAX_SEPARATE_NOTIFICATIONS = 3;\n\n/** Watermark before the first item exists: every later unread item is new. */\nconst EPOCH = '1970-01-01T00:00:00.000Z';\n\nexport interface ActivityNotification {\n body: string;\n /** AI-app relative path opened on click, e.g. `activity/<id>`. */\n path: string;\n /** Same tag = same notification across tabs and repeated polls. */\n tag: string;\n title: string;\n}\n\n/** Path, relative to the AI app, of the chat or run an item came from. */\nexport function getActivitySourcePath(item: ActivityItem): string | null {\n if (item.chatId) {\n return `agent/chats/${item.chatId}`;\n }\n\n if (item.automationId && item.automationRunId) {\n return `automations/${item.automationId}/runs/${item.automationRunId}`;\n }\n\n return null;\n}\n\nexport function getActivitySourceLabel(item: ActivityItem): string | null {\n if (item.chatId) {\n return 'View chat';\n }\n\n return item.automationId && item.automationRunId ? 'View run' : null;\n}\n\nconst RESOLUTION_LABELS: { [key in ActivityItemResolution]: string } = {\n approved: 'Approved',\n cancelled: 'Cancelled',\n expired: 'Expired',\n rejected: 'Rejected',\n};\n\n/** Short status for a row: what happened to it, or that it still waits on the viewer. */\nexport function getActivityStatusLabel(item: ActivityItem): string | null {\n if (item.kind === 'automation_failure') {\n return 'Failed';\n }\n\n if (item.kind === 'automation_result') {\n return 'Result';\n }\n\n if (item.resolution) {\n return RESOLUTION_LABELS[item.resolution];\n }\n\n return item.requiresAction && item.state !== 'done' && item.state !== 'dismissed' ? 'Needs approval' : null;\n}\n\n/** How a row's status badge reads: waiting on the viewer, a failure, or neutral. */\nexport function getActivityStatusTone(item: ActivityItem): 'attention' | 'failure' | 'neutral' {\n if (item.kind === 'automation_failure') {\n return 'failure';\n }\n\n return isActivityItemOpen(item) ? 'attention' : 'neutral';\n}\n\n/** True while the item still waits on the viewer. */\nexport function isActivityItemOpen(item: ActivityItem): boolean {\n return item.requiresAction && item.resolvedAt === null && item.state !== 'dismissed' && item.state !== 'done';\n}\n\n/**\n * Turns one summary poll into desktop notifications and the next watermark.\n * The first poll (no watermark yet) only seeds it, so opening Studio never\n * replays notifications for items the user already had.\n */\nexport function planActivityNotifications({\n newItems,\n since,\n}: {\n newItems: ActivityItem[];\n since: string | null;\n}): { notifications: ActivityNotification[]; since: string } {\n const newest = newItems.reduce<string | null>(\n (latest, item) => (latest === null || item.createdAt > latest ? item.createdAt : latest),\n null\n );\n\n if (since === null) {\n return { notifications: [], since: newest ?? EPOCH };\n }\n\n const fresh = newItems.filter((item) => item.createdAt > since);\n const nextSince = newest !== null && newest > since ? newest : since;\n\n if (fresh.length === 0) {\n return { notifications: [], since: nextSince };\n }\n\n if (fresh.length > MAX_SEPARATE_NOTIFICATIONS) {\n return {\n notifications: [\n {\n body: 'Open Activity in Flexkit Studio to review them.',\n path: 'activity',\n tag: `flexkit-activity-batch:${nextSince}`,\n title: `${fresh.length.toString()} new items in Activity`,\n },\n ],\n since: nextSince,\n };\n }\n\n return {\n notifications: fresh.map((item) => ({\n body: item.body ?? '',\n path: `activity/${encodeURIComponent(item.id)}`,\n tag: `flexkit-activity:${item.id}`,\n title: item.title,\n })),\n since: nextSince,\n };\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {a as a$1}from'./chunk-O2QMYUPS.js';import {Slot}from'radix-ui';import {cva}from'class-variance-authority';import {jsx}from'react/jsx-runtime';var a=cva("fk:inline-flex fk:shrink-0 fk:items-center fk:justify-center fk:gap-1 fk:rounded-md fk:text-sm fk:font-medium fk:whitespace-nowrap fk:transition-all fk:outline-none fk:focus-visible:border-ring fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:disabled:pointer-events-none fk:disabled:opacity-50 fk:aria-invalid:border-destructive fk:aria-invalid:ring-destructive/20 fk:dark:aria-invalid:ring-destructive/40 fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4 fk:corner-squircle",{variants:{variant:{default:"fk:bg-primary fk:text-primary-foreground fk:hover:bg-primary/90",destructive:"fk:bg-destructive fk:text-white fk:hover:bg-destructive/90 fk:focus-visible:ring-destructive/20 fk:dark:bg-destructive/60 fk:dark:focus-visible:ring-destructive/40",outline:"fk:border fk:bg-background fk:shadow-xs fk:hover:bg-accent fk:hover:text-accent-foreground fk:dark:border-input",secondary:"fk:bg-secondary fk:text-secondary-foreground fk:hover:bg-secondary/80",ghost:"fk:hover:bg-accent fk:hover:text-accent-foreground fk:dark:hover:bg-accent/50",link:"fk:text-primary fk:underline-offset-4 fk:hover:underline"},size:{default:"fk:h-9 fk:px-4 fk:py-2 fk:has-[>svg]:px-3",xs:"fk:h-6 fk:rounded-md fk:px-2 fk:text-xs fk:has-[>svg]:px-1.5 fk:[&_svg:not([class*='size-'])]:size-3 fk:corner-squircle",sm:"fk:h-8 fk:rounded-md fk:px-3 fk:has-[>svg]:px-2.5 fk:corner-squircle",lg:"fk:h-10 fk:rounded-md fk:px-6 fk:has-[>svg]:px-4 fk:corner-squircle",icon:"fk:size-9","icon-xs":"fk:size-6 fk:rounded-md fk:[&_svg:not([class*='size-'])]:size-3 fk:corner-squircle","icon-sm":"fk:size-8","icon-lg":"fk:size-10"}},defaultVariants:{variant:"default",size:"default"}});function v({className:f,variant:e="default",size:r="default",asChild:i=false,...o}){let s=i?Slot.Root:"button";return jsx(s,{"data-slot":"button","data-variant":e,"data-size":r,className:a$1(a({variant:e,size:r,className:f})),...o})}export{a,v as b};//# sourceMappingURL=chunk-6NRQMG26.js.map
2
+ //# sourceMappingURL=chunk-6NRQMG26.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ui/primitives/button.tsx"],"names":["buttonVariants","cva","Button","className","variant","size","asChild","props","Comp","Slot","jsx","cn"],"mappings":"0KAKA,IAAMA,CAAAA,CAAiBC,IACrB,khBAAA,CACA,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,QAAS,iEAAA,CACT,WAAA,CACE,qKAAA,CACF,OAAA,CACE,iHAAA,CACF,SAAA,CAAW,wEACX,KAAA,CAAO,+EAAA,CACP,IAAA,CAAM,0DACR,CAAA,CACA,IAAA,CAAM,CACJ,OAAA,CAAS,2CAAA,CACT,EAAA,CAAI,yHAAA,CACJ,EAAA,CAAI,sEAAA,CACJ,GAAI,qEAAA,CACJ,IAAA,CAAM,WAAA,CACN,SAAA,CAAW,oFAAA,CACX,SAAA,CAAW,WAAA,CACX,SAAA,CAAW,YACb,CACF,CAAA,CACA,eAAA,CAAiB,CACf,OAAA,CAAS,UACT,IAAA,CAAM,SACR,CACF,CACF,EAEA,SAASC,EAAO,CACd,SAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CAAU,SAAA,CACV,KAAAC,CAAAA,CAAO,SAAA,CACP,OAAA,CAAAC,CAAAA,CAAU,KAAA,CACV,GAAGC,CACL,CAAA,CAGK,CACH,IAAMC,CAAAA,CAAOF,CAAAA,CAAUG,IAAAA,CAAK,KAAO,QAAA,CAEnC,OACEC,GAAAA,CAACF,CAAAA,CAAA,CACC,WAAA,CAAU,SACV,cAAA,CAAcJ,CAAAA,CACd,WAAA,CAAWC,CAAAA,CACX,SAAA,CAAWM,GAAAA,CAAGX,EAAe,CAAE,OAAA,CAAAI,CAAAA,CAAS,IAAA,CAAAC,CAAAA,CAAM,SAAA,CAAAF,CAAU,CAAC,CAAC,CAAA,CACzD,GAAGI,CAAAA,CACN,CAEJ","file":"chunk-6NRQMG26.js","sourcesContent":["import * as React from 'react';\nimport { Slot } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../lib/utils';\n\nconst buttonVariants = cva(\n \"fk:inline-flex fk:shrink-0 fk:items-center fk:justify-center fk:gap-1 fk:rounded-md fk:text-sm fk:font-medium fk:whitespace-nowrap fk:transition-all fk:outline-none fk:focus-visible:border-ring fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:disabled:pointer-events-none fk:disabled:opacity-50 fk:aria-invalid:border-destructive fk:aria-invalid:ring-destructive/20 fk:dark:aria-invalid:ring-destructive/40 fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4 fk:corner-squircle\",\n {\n variants: {\n variant: {\n default: 'fk:bg-primary fk:text-primary-foreground fk:hover:bg-primary/90',\n destructive:\n 'fk:bg-destructive fk:text-white fk:hover:bg-destructive/90 fk:focus-visible:ring-destructive/20 fk:dark:bg-destructive/60 fk:dark:focus-visible:ring-destructive/40',\n outline:\n 'fk:border fk:bg-background fk:shadow-xs fk:hover:bg-accent fk:hover:text-accent-foreground fk:dark:border-input',\n secondary: 'fk:bg-secondary fk:text-secondary-foreground fk:hover:bg-secondary/80',\n ghost: 'fk:hover:bg-accent fk:hover:text-accent-foreground fk:dark:hover:bg-accent/50',\n link: 'fk:text-primary fk:underline-offset-4 fk:hover:underline',\n },\n size: {\n default: 'fk:h-9 fk:px-4 fk:py-2 fk:has-[>svg]:px-3',\n xs: \"fk:h-6 fk:rounded-md fk:px-2 fk:text-xs fk:has-[>svg]:px-1.5 fk:[&_svg:not([class*='size-'])]:size-3 fk:corner-squircle\",\n sm: 'fk:h-8 fk:rounded-md fk:px-3 fk:has-[>svg]:px-2.5 fk:corner-squircle',\n lg: 'fk:h-10 fk:rounded-md fk:px-6 fk:has-[>svg]:px-4 fk:corner-squircle',\n icon: 'fk:size-9',\n 'icon-xs': \"fk:size-6 fk:rounded-md fk:[&_svg:not([class*='size-'])]:size-3 fk:corner-squircle\",\n 'icon-sm': 'fk:size-8',\n 'icon-lg': 'fk:size-10',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n);\n\nfunction Button({\n className,\n variant = 'default',\n size = 'default',\n asChild = false,\n ...props\n}: React.ComponentProps<'button'> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n }) {\n const Comp = asChild ? Slot.Root : 'button';\n\n return (\n <Comp\n data-slot=\"button\"\n data-variant={variant}\n data-size={size}\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n );\n}\n\nexport { Button, buttonVariants };\n"]}
@@ -1,2 +1,2 @@
1
- import'./index.css';import {c,e as e$1}from'./chunk-P6BZ4QP7.js';import {f}from'./chunk-66N44IKJ.js';import {e}from'./chunk-NNA4MLFC.js';import {useMemo}from'react';import A from'swr';import {find,propEq}from'ramda';function T(n,i){let{scope:c$1}=c(),{currentProject:e$1}=f(),o=useMemo(()=>e$1?.schema??[],[e$1]),a=e$1?.scopes?.find(t=>t.isDefault)?.name??"default",m=i?.commonParams.q?JSON.stringify(i):null,{data:r,error:s,isLoading:y}=A(m,()=>fetch(e(n).search,{headers:{"Content-Type":"application/json"},body:JSON.stringify(i),method:"POST",mode:"cors"}).then(t=>t.json()));return {results:useMemo(()=>E(r?.results??[],n,o,c$1,a)??[],[r,a,n,o,c$1]),error:s,isLoading:y}}function E(n,i,c,e,o){return n?.filter(l=>l?.hits?.length>0).map(l=>{let a=l,m=a.collection.replace(`${i}_`,"").replace(/_\d+$/,""),r=find(propEq(m,"plural"))(c);if(!r)return [];let s=e$1(r)?.name??"",y=r?.name??m;return a.hits.map(({document:u})=>{let t=u[s],b=(t&&typeof t!="string"?t[e]??t[o]:null)??u[s],N=Object.entries(u).reduce((d,[p,f])=>{if(p!==s&&p!=="id"&&p!=="_updatedAt"){let _=typeof f!="string"?f[e]??f[o]:f;d[p]=_;}return d},{});return {_id:u.id,_entityName:y,_entityNamePlural:m,[s]:b,...N}})}).flat()}export{T as a};//# sourceMappingURL=chunk-LYGHDJ5A.js.map
2
- //# sourceMappingURL=chunk-LYGHDJ5A.js.map
1
+ import'./index.css';import {c,e as e$1}from'./chunk-P6BZ4QP7.js';import {f}from'./chunk-LN55VJ35.js';import {e}from'./chunk-NNA4MLFC.js';import {useMemo}from'react';import A from'swr';import {find,propEq}from'ramda';function T(n,i){let{scope:c$1}=c(),{currentProject:e$1}=f(),o=useMemo(()=>e$1?.schema??[],[e$1]),a=e$1?.scopes?.find(t=>t.isDefault)?.name??"default",m=i?.commonParams.q?JSON.stringify(i):null,{data:r,error:s,isLoading:y}=A(m,()=>fetch(e(n).search,{headers:{"Content-Type":"application/json"},body:JSON.stringify(i),method:"POST",mode:"cors"}).then(t=>t.json()));return {results:useMemo(()=>E(r?.results??[],n,o,c$1,a)??[],[r,a,n,o,c$1]),error:s,isLoading:y}}function E(n,i,c,e,o){return n?.filter(l=>l?.hits?.length>0).map(l=>{let a=l,m=a.collection.replace(`${i}_`,"").replace(/_\d+$/,""),r=find(propEq(m,"plural"))(c);if(!r)return [];let s=e$1(r)?.name??"",y=r?.name??m;return a.hits.map(({document:u})=>{let t=u[s],b=(t&&typeof t!="string"?t[e]??t[o]:null)??u[s],N=Object.entries(u).reduce((d,[p,f])=>{if(p!==s&&p!=="id"&&p!=="_updatedAt"){let _=typeof f!="string"?f[e]??f[o]:f;d[p]=_;}return d},{});return {_id:u.id,_entityName:y,_entityNamePlural:m,[s]:b,...N}})}).flat()}export{T as a};//# sourceMappingURL=chunk-6RDPFMLK.js.map
2
+ //# sourceMappingURL=chunk-6RDPFMLK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/use-search.tsx"],"names":["useSearch","projectId","searchRequest","scope","useAppContext","currentProject","useConfig","schema","useMemo","defaultScope","s","swrKey","data","error","isLoading","useSWR","apiPaths","res","mapResults","results","result","item","entityNamePlural","entitySchema","find","propEq","primaryAttributeName","getDisplayAttribute","entityName","document","primaryAttribute","primaryAttributeValue","attributes","acc","key","value","scopedValue"],"mappings":"wNAWO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CACwE,CACxE,GAAM,CAAE,KAAA,CAAAC,GAAM,CAAA,CAAIC,GAAc,CAC1B,CAAE,cAAA,CAAAC,GAAe,CAAA,CAAIC,CAAAA,EAAU,CAC/BC,CAAAA,CAASC,QAAQ,IAAMH,GAAAA,EAAgB,MAAA,EAAU,EAAC,CAAG,CAACA,GAAc,CAAC,EAErEI,CAAAA,CADSJ,GAAAA,EAAgB,MAAA,EACF,IAAA,CAAMK,CAAAA,EAAMA,CAAAA,CAAE,SAAS,CAAA,EAAG,MAAQ,SAAA,CACzDC,CAAAA,CAAST,CAAAA,EAAe,YAAA,CAAa,CAAA,CAAI,IAAA,CAAK,SAAA,CAAUA,CAAa,EAAI,IAAA,CACzE,CAAE,IAAA,CAAAU,CAAAA,CAAM,MAAAC,CAAAA,CAAO,SAAA,CAAAC,CA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A,CAAoBJ,CAAY,GAAG,IAAA,EAAQ,EAAA,CAClEK,CAAAA,CAAaL,CAAAA,EAAc,IAAA,EAAQD,CAAAA,CAGzC,OAAOD,CAAAA,CAAK,KAAK,GAAA,CAAI,CAAC,CAAE,QAAA,CAAAQ,CAAS,CAAA,GAAM,CACrC,IAAMC,EAAmBD,CAAAA,CAASH,CAAoB,CAAA,CAKhDK,CAAAA,CAAAA,CAHJD,GAAoB,OAAOA,CAAAA,EAAqB,QAAA,CAC3CA,CAAAA,CAAiB3B,CAAK,CAAA,EAAK2B,CAAAA,CAAiBrB,CAAY,CAAA,CACzD,IAAA,GACkDoB,CAAAA,CAASH,CAAoB,CAAA,CAC/EM,EAAa,MAAA,CAAO,OAAA,CAAQH,CAAQ,CAAA,CAAE,MAAA,CAC1C,CAACI,CAAAA,CAA0E,CAACC,EAAKC,CAAK,CAAA,GAAM,CAC1F,GAAID,CAAAA,GAAQR,CAAAA,EAAwBQ,CAAAA,GAAQ,IAAA,EAAQA,IAAQ,YAAA,CAAc,CACxE,IAAME,CAAAA,CAAc,OAAOD,CAAAA,EAAU,QAAA,CAAYA,CAAAA,CAAMhC,CAAK,CAAA,EAAKgC,CAAAA,CAAM1B,CAAY,CAAA,CAAK0B,CAAAA,CAExFF,CAAAA,CAAIC,CAAG,CAAA,CAAIE,EACb,CAEA,OAAOH,CACT,CAAA,CACA,EACF,CAAA,CAEA,OAAO,CACL,GAAA,CAAKJ,CAAAA,CAAS,EAAA,CACd,WAAA,CAAaD,CAAAA,CACb,iBAAA,CAAmBN,CAAAA,CACnB,CAACI,CAAoB,EAAGK,CAAAA,CACxB,GAAGC,CACL,CACF,CAAC,CACH,CAAC,CAAA,CACA,MACL","file":"chunk-LYGHDJ5A.js","sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport useSWR from 'swr';\nimport { find, propEq } from 'ramda';\nimport { apiPaths } from './api-paths';\nimport { useAppContext } from './app-context';\nimport { useConfig } from './config/config-context';\nimport { getDisplayAttribute } from './get-display-attribute';\nimport type { Entity, RawResultItem, RawSearchResultItems, SearchRequestProps, SearchResultItem } from './types';\n\nexport function useSearch(\n projectId: string,\n searchRequest: SearchRequestProps | null\n): { results: SearchResultItem[] | []; error: Error; isLoading: boolean } {\n const { scope } = useAppContext();\n const { currentProject } = useConfig();\n const schema = useMemo(() => currentProject?.schema ?? [], [currentProject]);\n const scopes = currentProject?.scopes;\n const defaultScope = scopes?.find((s) => s.isDefault)?.name ?? 'default';\n const swrKey = searchRequest?.commonParams.q ? JSON.stringify(searchRequest) : null;\n const { data, error, isLoading } = useSWR(swrKey, () =>\n fetch(apiPaths(projectId).search, {\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(searchRequest),\n method: 'POST',\n mode: 'cors',\n }).then((res) => res.json() as Promise<{ results: RawSearchResultItems }>)\n );\n const results = useMemo(\n () => mapResults(data?.results ?? [], projectId, schema, scope, defaultScope) ?? [],\n [data, defaultScope, projectId, schema, scope]\n );\n\n return { results, error, isLoading };\n}\n\nfunction mapResults(\n results: RawSearchResultItems | undefined,\n projectId: string,\n schema: Entity[],\n scope: string,\n defaultScope: string\n): SearchResultItem[] | undefined {\n return results\n ?.filter((result) => (result as RawResultItem)?.hits?.length > 0)\n .map((result) => {\n const item = result as RawResultItem;\n const entityNamePlural = item.collection.replace(`${projectId}_`, '').replace(/_\\d+$/, '');\n const entitySchema = find<Entity>(propEq(entityNamePlural, 'plural'))(schema);\n\n if (!entitySchema) {\n return [];\n }\n\n const primaryAttributeName = getDisplayAttribute(entitySchema)?.name ?? '';\n const entityName = entitySchema?.name ?? entityNamePlural;\n\n // iterate over the hits and return an object with the primary attribute value first and then the rest of the attributes.\n return item.hits.map(({ document }) => {\n const primaryAttribute = document[primaryAttributeName];\n const scopedPrimaryAttribute =\n primaryAttribute && typeof primaryAttribute !== 'string'\n ? (primaryAttribute[scope] ?? primaryAttribute[defaultScope])\n : null;\n const primaryAttributeValue = scopedPrimaryAttribute ?? document[primaryAttributeName];\n const attributes = Object.entries(document).reduce(\n (acc: Omit<SearchResultItem, '_id' | '_entityName' | '_entityNamePlural'>, [key, value]) => {\n if (key !== primaryAttributeName && key !== 'id' && key !== '_updatedAt') {\n const scopedValue = typeof value !== 'string' ? (value[scope] ?? value[defaultScope]) : value;\n\n acc[key] = scopedValue;\n }\n\n return acc;\n },\n {}\n );\n\n return {\n _id: document.id,\n _entityName: entityName,\n _entityNamePlural: entityNamePlural,\n [primaryAttributeName]: primaryAttributeValue as string,\n ...attributes,\n };\n });\n })\n .flat();\n}\n"]}
1
+ {"version":3,"sources":["../src/core/use-search.tsx"],"names":["useSearch","projectId","searchRequest","scope","useAppContext","currentProject","useConfig","schema","useMemo","defaultScope","s","swrKey","data","error","isLoading","useSWR","apiPaths","res","mapResults","results","result","item","entityNamePlural","entitySchema","find","propEq","primaryAttributeName","getDisplayAttribute","entityName","document","primaryAttribute","primaryAttributeValue","attributes","acc","key","value","scopedValue"],"mappings":"wNAWO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CACwE,CACxE,GAAM,CAAE,KAAA,CAAAC,GAAM,CAAA,CAAIC,GAAc,CAC1B,CAAE,cAAA,CAAAC,GAAe,CAAA,CAAIC,CAAAA,EAAU,CAC/BC,CAAAA,CAASC,QAAQ,IAAMH,GAAAA,EAAgB,MAAA,EAAU,EAAC,CAAG,CAACA,GAAc,CAAC,EAErEI,CAAAA,CADSJ,GAAAA,EAAgB,MAAA,EACF,IAAA,CAAMK,CAAAA,EAAMA,CAAAA,CAAE,SAAS,CAAA,EAAG,MAAQ,SAAA,CACzDC,CAAAA,CAAST,CAAAA,EAAe,YAAA,CAAa,CAAA,CAAI,IAAA,CAAK,SAAA,CAAUA,CAAa,EAAI,IAAA,CACzE,CAAE,IAAA,CAAAU,CAAAA,CAAM,MAAAC,CAAAA,CAAO,SAAA,CAAAC,CAAU,CAAA,CAAIC,EAAOJ,CAAAA,CAAQ,IAChD,KAAA,CAAMK,CAAAA,CAASf,CAAS,CAAA,CAAE,MAAA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AA,CAGzC,OAAOD,CAAAA,CAAK,KAAK,GAAA,CAAI,CAAC,CAAE,QAAA,CAAAQ,CAAS,CAAA,GAAM,CACrC,IAAMC,EAAmBD,CAAAA,CAASH,CAAoB,CAAA,CAKhDK,CAAAA,CAAAA,CAHJD,GAAoB,OAAOA,CAAAA,EAAqB,QAAA,CAC3CA,CAAAA,CAAiB3B,CAAK,CAAA,EAAK2B,CAAAA,CAAiBrB,CAAY,CAAA,CACzD,IAAA,GACkDoB,CAAAA,CAASH,CAAoB,CAAA,CAC/EM,EAAa,MAAA,CAAO,OAAA,CAAQH,CAAQ,CAAA,CAAE,MAAA,CAC1C,CAACI,CAAAA,CAA0E,CAACC,EAAKC,CAAK,CAAA,GAAM,CAC1F,GAAID,CAAAA,GAAQR,CAAAA,EAAwBQ,CAAAA,GAAQ,IAAA,EAAQA,IAAQ,YAAA,CAAc,CACxE,IAAME,CAAAA,CAAc,OAAOD,CAAAA,EAAU,QAAA,CAAYA,CAAAA,CAAMhC,CAAK,CAAA,EAAKgC,CAAAA,CAAM1B,CAAY,CAAA,CAAK0B,CAAAA,CAExFF,CAAAA,CAAIC,CAAG,CAAA,CAAIE,EACb,CAEA,OAAOH,CACT,CAAA,CACA,EACF,CAAA,CAEA,OAAO,CACL,GAAA,CAAKJ,CAAAA,CAAS,EAAA,CACd,WAAA,CAAaD,CAAAA,CACb,iBAAA,CAAmBN,CAAAA,CACnB,CAACI,CAAoB,EAAGK,CAAAA,CACxB,GAAGC,CACL,CACF,CAAC,CACH,CAAC,CAAA,CACA,MACL","file":"chunk-6RDPFMLK.js","sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport useSWR from 'swr';\nimport { find, propEq } from 'ramda';\nimport { apiPaths } from './api-paths';\nimport { useAppContext } from './app-context';\nimport { useConfig } from './config/config-context';\nimport { getDisplayAttribute } from './get-display-attribute';\nimport type { Entity, RawResultItem, RawSearchResultItems, SearchRequestProps, SearchResultItem } from './types';\n\nexport function useSearch(\n projectId: string,\n searchRequest: SearchRequestProps | null\n): { results: SearchResultItem[] | []; error: Error; isLoading: boolean } {\n const { scope } = useAppContext();\n const { currentProject } = useConfig();\n const schema = useMemo(() => currentProject?.schema ?? [], [currentProject]);\n const scopes = currentProject?.scopes;\n const defaultScope = scopes?.find((s) => s.isDefault)?.name ?? 'default';\n const swrKey = searchRequest?.commonParams.q ? JSON.stringify(searchRequest) : null;\n const { data, error, isLoading } = useSWR(swrKey, () =>\n fetch(apiPaths(projectId).search, {\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(searchRequest),\n method: 'POST',\n mode: 'cors',\n }).then((res) => res.json() as Promise<{ results: RawSearchResultItems }>)\n );\n const results = useMemo(\n () => mapResults(data?.results ?? [], projectId, schema, scope, defaultScope) ?? [],\n [data, defaultScope, projectId, schema, scope]\n );\n\n return { results, error, isLoading };\n}\n\nfunction mapResults(\n results: RawSearchResultItems | undefined,\n projectId: string,\n schema: Entity[],\n scope: string,\n defaultScope: string\n): SearchResultItem[] | undefined {\n return results\n ?.filter((result) => (result as RawResultItem)?.hits?.length > 0)\n .map((result) => {\n const item = result as RawResultItem;\n const entityNamePlural = item.collection.replace(`${projectId}_`, '').replace(/_\\d+$/, '');\n const entitySchema = find<Entity>(propEq(entityNamePlural, 'plural'))(schema);\n\n if (!entitySchema) {\n return [];\n }\n\n const primaryAttributeName = getDisplayAttribute(entitySchema)?.name ?? '';\n const entityName = entitySchema?.name ?? entityNamePlural;\n\n // iterate over the hits and return an object with the primary attribute value first and then the rest of the attributes.\n return item.hits.map(({ document }) => {\n const primaryAttribute = document[primaryAttributeName];\n const scopedPrimaryAttribute =\n primaryAttribute && typeof primaryAttribute !== 'string'\n ? (primaryAttribute[scope] ?? primaryAttribute[defaultScope])\n : null;\n const primaryAttributeValue = scopedPrimaryAttribute ?? document[primaryAttributeName];\n const attributes = Object.entries(document).reduce(\n (acc: Omit<SearchResultItem, '_id' | '_entityName' | '_entityNamePlural'>, [key, value]) => {\n if (key !== primaryAttributeName && key !== 'id' && key !== '_updatedAt') {\n const scopedValue = typeof value !== 'string' ? (value[scope] ?? value[defaultScope]) : value;\n\n acc[key] = scopedValue;\n }\n\n return acc;\n },\n {}\n );\n\n return {\n _id: document.id,\n _entityName: entityName,\n _entityNamePlural: entityNamePlural,\n [primaryAttributeName]: primaryAttributeValue as string,\n ...attributes,\n };\n });\n })\n .flat();\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import'./index.css';import {put}from'@vercel/blob/client';function I(i,e){let l=e.trim();return l?i.trim()?/\s$/.test(i)||/^[.,!?;:]/.test(l)?`${i}${l}`:`${i} ${l}`:i.length===0?l:`${i}${l}`:i}async function h(i){if(typeof window>"u")throw new Error("Dictation is only available in the browser.");let e=window.AudioContext??window.webkitAudioContext;if(!e)throw new Error("This browser cannot decode recorded audio.");let l=await i.arrayBuffer(),u=new e;try{let n=await u.decodeAudioData(l.slice(0)),s=C(n),t=y(s,n.sampleRate,24e3),o=$(t),r=t.length/24e3;if(r<.25)throw new Error("No speech was captured. Try again.");if(r>60)throw new Error(`Dictation is limited to ${String(60)} seconds.`);return {durationSeconds:r,pcm:new Blob([o],{type:"audio/pcm"})}}finally{await u.close();}}function C(i){let{length:e,numberOfChannels:l}=i;if(l===1)return i.getChannelData(0).slice();let u=new Float32Array(e);for(let n=0;n<e;n+=1){let s=0;for(let t=0;t<l;t+=1)s+=i.getChannelData(t)[n]??0;u[n]=s/l;}return u}function y(i,e,l){if(e===l)return i;let u=e/l,n=Math.max(1,Math.round(i.length/u)),s=new Float32Array(n);for(let t=0;t<n;t+=1){let o=t*u,r=Math.floor(o),a=Math.min(r+1,i.length-1),c=o-r,m=i[r]??0,g=i[a]??0;s[t]=m+(g-m)*c;}return s}function $(i){let e=new ArrayBuffer(i.length*2),l=new DataView(e);for(let u=0;u<i.length;u+=1){let n=Math.max(-1,Math.min(1,i[u]??0));l.setInt16(u*2,n<0?n*32768:n*32767,true);}return e}var d=class extends Error{code;status;constructor(e,l,u=null){super(l),this.name="AgentUploadError",this.code=u,this.status=e;}};function f(){if(typeof window>"u")return "flexkit.io";let{hostname:i}=window.location;return i==="localhost"||i==="127.0.0.1"||i==="flexkit.test"||i.endsWith(".flexkit.test")?"flexkit.test":"flexkit.io"}function T(){return `https://${f()}`}function _(i,e){return `https://${i}.api.${f()}/automations/webhook/${encodeURIComponent(e)}`}function w(i){let e=`/api/flexkit/${i}`,l=`${e}/automations`,u=`${e}/skills`,n=`${e}/agent/chats`;async function s(t,o){let r=await fetch(t,{credentials:"include",headers:{"Content-Type":"application/json",...o?.headers??{}},...o}),a=await r.json();if(!r.ok){let c=a&&typeof a=="object"&&"error"in a?String(a.error):"Request failed";throw new Error(c)}return a}return {connectPlugins:t=>s(`${e}/plugins/connect`,{method:"POST",body:JSON.stringify(t)}),pluginOAuthStatus:t=>s(`${e}/plugins/oauth-transactions/${encodeURIComponent(t)}`),updatePluginConnection:(t,o)=>s(`${e}/plugin-connections/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(o)}),disconnectPlugin:t=>s(`${e}/plugin-connections/${encodeURIComponent(t)}`,{method:"DELETE"}),installPlugin:t=>s(`${e}/plugins/${encodeURIComponent(t)}/installation`,{method:"PUT",body:JSON.stringify({})}),setPluginPolicy:(t,o)=>s(`${e}/plugins/${encodeURIComponent(t)}/policy`,{method:"PATCH",body:JSON.stringify(o)}),refreshPluginTools:t=>s(`${e}/plugin-connections/${encodeURIComponent(t)}/tools/refresh`,{method:"POST"}),cancelRun:async t=>s(`${l}/runs/${encodeURIComponent(t)}/cancel`,{method:"POST"}),createAgentChat:async t=>s(n,{body:JSON.stringify({modelId:t?.modelId??null}),method:"POST"}),deleteAgentChat:async t=>s(`${n}/${encodeURIComponent(t)}`,{method:"DELETE"}),getAgentChatStreamUrl:(t,o)=>`${n}/${encodeURIComponent(t)}/stream?workflowRunId=${encodeURIComponent(o)}`,renameAgentChat:async(t,o)=>s(`${n}/${encodeURIComponent(t)}`,{body:JSON.stringify({title:o}),method:"PATCH"}),sendAgentChatMessage:async(t,o)=>s(`${n}/${encodeURIComponent(t)}/messages`,{body:JSON.stringify(o),method:"POST"}),sendAgentChatFollowUp:async(t,o)=>s(`${n}/${encodeURIComponent(t)}/follow-ups`,{body:JSON.stringify(o),method:"POST"}),startAgentChat:async({attachments:t,content:o,modelId:r})=>s(n,{body:JSON.stringify({message:{attachments:t,content:o},modelId:r??null}),method:"POST"}),startQueuedAgentChatMessage:async(t,o)=>s(`${n}/${encodeURIComponent(t)}/follow-ups/${encodeURIComponent(o)}/start`,{method:"POST"}),stopAgentChat:async t=>s(`${n}/${encodeURIComponent(t)}/stop`,{method:"POST"}),transcribeAgentAudio:async(t,o)=>{let{durationSeconds:r,pcm:a}=await h(t),c=new FormData;c.append("file",a,"audio.pcm"),c.append("durationSeconds",String(r));let m=await fetch(`${e}/agent/transcribe`,{body:c,credentials:"include",method:"POST",signal:o}),g=await m.json();if(!m.ok){let A=g&&typeof g=="object"&&g.error?String(g.error):"Request failed";throw new Error(A)}if(!g.text?.trim())throw new Error("No speech was recognized. Try again.");return {text:g.text}},uploadAgentChatAttachment:async(t,o)=>{let r=await fetch(`${e}/agent/uploads`,{body:JSON.stringify({filename:t.name,mediaType:t.type||null,sizeBytes:t.size}),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST",signal:o}),a=await r.json();if(!r.ok||!a.pathname||!a.token||!a.mediaType)throw new d(r.status,a.error?String(a.error):"The file could not be uploaded.",a.code??null);let c=await put(a.pathname,t,{abortSignal:o,access:"public",contentType:a.mediaType,token:a.token});return {filename:t.name,mediaType:a.mediaType,sizeBytes:t.size,url:c.url}},decideApproval:async(t,o)=>{let r=await fetch(`${l}/approvals/${encodeURIComponent(t)}/decide`,{body:JSON.stringify(o),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST"}),a=await r.json();if(!r.ok&&typeof a.success!="boolean")throw new Error(a.error?String(a.error):"Request failed");return a},markActivityRead:async t=>s(`${e}/activity/read`,{body:JSON.stringify(t==="all"?{all:true}:{ids:t}),method:"POST"}),setActivityItemState:async(t,o)=>s(`${e}/activity/${encodeURIComponent(t)}`,{body:JSON.stringify({state:o}),method:"PATCH"}),createAutomation:async t=>s(l,{body:JSON.stringify(t),method:"POST"}),createSkill:async t=>s(u,{body:JSON.stringify(t),method:"POST"}),deleteAutomation:async t=>s(`${l}/${encodeURIComponent(t)}`,{method:"DELETE"}),deleteSkill:async t=>s(`${u}/${encodeURIComponent(t)}`,{method:"DELETE"}),getArtifactUrl:(t,o)=>{let r=o?.download?"?download=1":"";return `${l}/artifacts/${encodeURIComponent(t)}/content${r}`},getRunArtifacts:async t=>s(`${l}/runs/${encodeURIComponent(t)}/artifacts`).then(o=>o.artifacts),getStreamUrl:t=>`${l}/runs/${encodeURIComponent(t)}/stream`,getTranscriptUrl:t=>`${l}/runs/${encodeURIComponent(t)}/transcript`,listChannels:async(t,o)=>{let r=o?`${e}/plugin-connections/${encodeURIComponent(o)}/channels`:`${e}/plugins/${t}/channels`,a=await fetch(r,{credentials:"include",headers:{"Content-Type":"application/json"}}),c=await a.json();if(a.ok)return {channels:c.channels??[],errorMessage:c.errorMessage,success:c.success??true};if(c.success===false)return {channels:c.channels??[],errorMessage:c.errorMessage??`Failed to load ${t==="slack"?"Slack":"Teams"} channels.`,success:false};let m=c.error?String(c.error):"Request failed";throw new Error(m)},runAutomation:async t=>s(`${l}/${encodeURIComponent(t)}/runs`,{method:"POST"}),updateAutomation:async(t,o)=>s(`${l}/${encodeURIComponent(t)}`,{body:JSON.stringify(o),method:"PATCH"}),updateSkill:async(t,o)=>s(`${u}/${encodeURIComponent(t)}`,{body:JSON.stringify(o),method:"PATCH"})}}var p=class extends Error{status;constructor(e,l="Request failed"){super(l),this.name="FetcherError",this.status=e;}},k=async i=>{let e=await fetch(i,{credentials:"include"});if(!e.ok)throw new p(e.status);return await e.json()};function U(i){let e=`/api/flexkit/${i}/automations`,l=`/api/flexkit/${i}/skills`,u=`/api/flexkit/${i}/agent/chats`;return {activity:(n={})=>{let{filter:s="all",limit:t=25,offset:o=0}=n,r=new URLSearchParams({filter:s,limit:t.toString(),offset:o.toString()});return `/api/flexkit/${i}/activity?${r.toString()}`},activityItem:n=>`/api/flexkit/${i}/activity/${encodeURIComponent(n)}`,activitySummary:n=>n?`/api/flexkit/${i}/activity/summary?since=${encodeURIComponent(n)}`:`/api/flexkit/${i}/activity/summary`,agentChat:n=>`${u}/${encodeURIComponent(n)}`,agentChatSearch:n=>`${u}/search?q=${encodeURIComponent(n)}`,agentChats:(n=0)=>`${u}?offset=${n.toString()}`,agentProfile:()=>`/api/flexkit/${i}/agent/profile`,approval:n=>`${e}/approvals/${encodeURIComponent(n)}`,approvals:(n={})=>{let{limit:s=25,offset:t=0,runId:o,status:r}=n,a=new URLSearchParams({limit:s.toString(),offset:t.toString()});return r&&a.set("status",r),o&&a.set("runId",o),`${e}/approvals?${a.toString()}`},approvalsCount:`${e}/approvals?limit=1`,automation:n=>`${e}/${encodeURIComponent(n)}`,automationRuns:(n,s=0,t=25)=>`${e}/${encodeURIComponent(n)}/runs?offset=${s.toString()}&limit=${t.toString()}`,automations:(n={})=>{let{enabled:s,limit:t=25,offset:o=0,search:r,visibility:a}=n,c=new URLSearchParams({limit:t.toString(),offset:o.toString()});s&&s.length>0&&c.set("enabled",s.map(g=>g?"true":"false").join(",")),a&&a.length>0&&c.set("visibility",a.join(","));let m=r?.trim();return m&&c.set("q",m),`${e}?${c.toString()}`},creditBalance:`${e}/credits`,entities:`${e}/entities`,run:n=>`${e}/runs/${encodeURIComponent(n)}`,runHistory:(n,s=0,t=25)=>`${e}/runs?scope=${n}&offset=${s.toString()}&limit=${t.toString()}`,skill:n=>`${l}/${encodeURIComponent(n)}`,skills:(n={})=>{let{limit:s=25,offset:t=0,search:o,visibility:r}=n,a=new URLSearchParams({limit:s.toString(),offset:t.toString()});r&&r.length>0&&a.set("visibility",r.join(","));let c=o?.trim();return c&&a.set("q",c),`${l}?${a.toString()}`},spaces:`/api/flexkit/${i}/spaces`,members:n=>n?`/api/flexkit/${i}/members?spaceId=${encodeURIComponent(n)}`:`/api/flexkit/${i}/members`,tools:n=>n?`${e}/${encodeURIComponent(n)}/tools`:`${e}/tools`}}
2
+ export{I as a,T as b,_ as c,w as d,p as e,k as f,U as g};//# sourceMappingURL=chunk-CKNFYN3O.js.map
3
+ //# sourceMappingURL=chunk-CKNFYN3O.js.map