@flexkit/studio 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chat-page-3YSJP7FC.js → chat-page-EKOGKEFR.js} +3 -3
- package/dist/{chat-page-3YSJP7FC.js.map → chat-page-EKOGKEFR.js.map} +1 -1
- package/dist/{chunk-OI6GA6PE.js → chunk-6YOVF2AD.js} +3 -3
- package/dist/{chunk-OI6GA6PE.js.map → chunk-6YOVF2AD.js.map} +1 -1
- package/dist/{chunk-YODWX4WT.js → chunk-7IHEL6LU.js} +2 -2
- package/dist/{chunk-YODWX4WT.js.map → chunk-7IHEL6LU.js.map} +1 -1
- package/dist/{chunk-7JSGAY3E.js → chunk-BOXFB6E6.js} +2 -2
- package/dist/{chunk-7JSGAY3E.js.map → chunk-BOXFB6E6.js.map} +1 -1
- package/dist/{chunk-TPLL535V.js → chunk-C47FNPLK.js} +3 -3
- package/dist/{chunk-TPLL535V.js.map → chunk-C47FNPLK.js.map} +1 -1
- package/dist/{chunk-GDTOP4MU.js → chunk-EWBEPYML.js} +3 -3
- package/dist/{chunk-GDTOP4MU.js.map → chunk-EWBEPYML.js.map} +1 -1
- package/dist/{chunk-22DXYOXX.js → chunk-F2DHCPWW.js} +2 -2
- package/dist/{chunk-22DXYOXX.js.map → chunk-F2DHCPWW.js.map} +1 -1
- package/dist/{chunk-YSMRXGVX.js → chunk-OFJOZMCR.js} +2 -2
- package/dist/{chunk-YSMRXGVX.js.map → chunk-OFJOZMCR.js.map} +1 -1
- package/dist/chunk-QQSI7BPK.js +8 -0
- package/dist/chunk-QQSI7BPK.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{list-N5WCJSJC.js → list-DOTORSUC.js} +2 -2
- package/dist/{list-N5WCJSJC.js.map → list-DOTORSUC.js.map} +1 -1
- package/dist/{pages-65QNO7ME.js → pages-ILAXYS2J.js} +3 -3
- package/dist/{pages-65QNO7ME.js.map → pages-ILAXYS2J.js.map} +1 -1
- package/dist/{plugin-pages-F5K745MZ.js → plugin-pages-RKJRHKNL.js} +2 -2
- package/dist/{plugin-pages-F5K745MZ.js.map → plugin-pages-RKJRHKNL.js.map} +1 -1
- package/dist/{root-DK5C7DYH.js → root-76YQTZUI.js} +2 -2
- package/dist/{root-DK5C7DYH.js.map → root-76YQTZUI.js.map} +1 -1
- package/dist/{root-MMAJEVBH.js → root-A4VHAEK5.js} +3 -3
- package/dist/{root-MMAJEVBH.js.map → root-A4VHAEK5.js.map} +1 -1
- package/dist/{root-4E3YUTQU.js → root-JB3NZZNZ.js} +3 -3
- package/dist/{root-4E3YUTQU.js.map → root-JB3NZZNZ.js.map} +1 -1
- package/dist/{root-WYRLSQPK.js → root-RE3ZNXQ3.js} +2 -2
- package/dist/{root-WYRLSQPK.js.map → root-RE3ZNXQ3.js.map} +1 -1
- package/dist/{search-EK4XBDGL.js → search-WUO6VWKU.js} +2 -2
- package/dist/{search-EK4XBDGL.js.map → search-WUO6VWKU.js.map} +1 -1
- package/dist/{skills-pages-O35YZMMC.js → skills-pages-POKCFHOL.js} +2 -2
- package/dist/{skills-pages-O35YZMMC.js.map → skills-pages-POKCFHOL.js.map} +1 -1
- package/package.json +3 -3
- package/dist/chunk-B4WSTNZ3.js +0 -8
- package/dist/chunk-B4WSTNZ3.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./index.css';export{b as CatalogHeader,d as InstalledPluginsPage,a as PluginConnectControl,e as PluginDetailPage,c as PluginsPage}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=plugin-pages-
|
|
1
|
+
import'./index.css';export{b as CatalogHeader,d as InstalledPluginsPage,a as PluginConnectControl,e as PluginDetailPage,c as PluginsPage}from'./chunk-BOXFB6E6.js';import'./chunk-KXAGLQ2B.js';import'./chunk-2HSIWUH3.js';import'./chunk-C47FNPLK.js';import'./chunk-TYDYAOQ7.js';import'./chunk-YCCFUGWJ.js';import'./chunk-32ZU4MLE.js';import'./chunk-HDOIOXMP.js';import'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import'./chunk-USNXQOMJ.js';import'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';//# sourceMappingURL=plugin-pages-RKJRHKNL.js.map
|
|
2
|
+
//# sourceMappingURL=plugin-pages-RKJRHKNL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"plugin-pages-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"plugin-pages-RKJRHKNL.js"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./index.css';import {a}from'./chunk-HYSTMQD7.js';import {b,c}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=root-
|
|
1
|
+
import'./index.css';import {a}from'./chunk-HYSTMQD7.js';import {b,c}from'./chunk-F2DHCPWW.js';import'./chunk-QQSI7BPK.js';import'./chunk-KXAGLQ2B.js';import {g,f as f$1}from'./chunk-2HSIWUH3.js';import {f}from'./chunk-C47FNPLK.js';import'./chunk-TYDYAOQ7.js';import {L,P,M,R,T as T$1,s as s$1,Q,U as U$1,V,W,O}from'./chunk-YCCFUGWJ.js';import {b as b$1}from'./chunk-32ZU4MLE.js';import'./chunk-HDOIOXMP.js';import'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import'./chunk-USNXQOMJ.js';import'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';import {Outlet,useLocation,NavLink}from'react-router-dom';import {useState}from'react';import {SearchIcon,XIcon,SquarePenIcon,BellIcon,BotIcon,HistoryIcon,InboxIcon,PlugIcon}from'lucide-react';import Q$1 from'swr';import {jsxs,jsx}from'react/jsx-runtime';var K=300,s=NavLink;function T(){let{currentProjectId:a}=f(),{data:e}=Q$1(a?g(a).approvalsCount:null,f$1,{refreshInterval:3e4}),o=e?.pendingCount??0;return o===0?null:jsx(b$1,{className:"fk:ml-auto fk:h-5 fk:min-w-5 fk:justify-center fk:rounded-full fk:bg-amber-500/20 fk:px-1.5 fk:text-[0.6875rem] fk:text-amber-600 fk:border-none fk:corner-squircle",children:o>99?"99+":o.toString()})}function U(){let{currentProjectId:a$1}=f(),e=a(a$1),o=e?.needsActionCount??0,f$1=o>0?o:e?.unreadCount??0;return f$1===0?null:jsx(b$1,{className:`fk:ml-auto fk:h-5 fk:min-w-5 fk:justify-center fk:rounded-full fk:px-1.5 fk:text-[0.6875rem] fk:border-none fk:corner-squircle ${o>0?"fk:bg-amber-500/20 fk:text-amber-600":"fk:bg-muted fk:text-muted-foreground"}`,children:f$1>99?"99+":f$1.toString()})}function B(){let e=useLocation().pathname.replace(/\/$/,""),o=e.endsWith("/ai/agent"),f=e.endsWith("/ai/runs"),w=e.endsWith("/ai/approvals"),P=e.endsWith("/ai/activity")||e.includes("/ai/activity/"),R$1=e.includes("/ai/plugins")||e.includes("/ai/skills"),W$1=e.includes("/ai/automations"),[d,k]=useState(""),E=b(d.trim(),K);return jsxs(M,{collapsible:"icon",variant:"inset",children:[jsx(R,{className:"fk:shrink-0 fk:pb-1.5 fk:group-data-[collapsible=icon]:hidden",children:jsxs(T$1,{className:"fk:relative",children:[jsx(SearchIcon,{className:"fk:absolute fk:left-2 fk:top-1/2 fk:size-3.5 fk:-translate-y-1/2 fk:text-muted-foreground"}),jsx(s$1,{className:"fk:h-8 fk:bg-background fk:pl-7 fk:pr-7 fk:text-sm",placeholder:"Search chats...",value:d,onChange:L=>k(L.target.value)}),d?jsx("button",{"aria-label":"Clear search",className:"fk:absolute fk:right-2 fk:top-1/2 fk:-translate-y-1/2 fk:cursor-pointer fk:text-muted-foreground fk:hover:text-foreground",type:"button",onClick:()=>k(""),children:jsx(XIcon,{className:"fk:size-3.5"})}):null]})}),jsxs(Q,{children:[jsx(R,{children:jsxs(U$1,{children:[jsx(V,{children:jsx(W,{asChild:true,isActive:o,tooltip:"New chat",children:jsxs(s,{to:"agent",children:[jsx(SquarePenIcon,{className:"fk:h-4 fk:w-4",strokeWidth:2}),jsx("span",{children:"New chat"})]})})}),jsx(V,{children:jsx(W,{asChild:true,isActive:P,tooltip:"Activity",children:jsxs(s,{to:"activity",children:[jsx(BellIcon,{className:"fk:h-4 fk:w-4",strokeWidth:2}),jsx("span",{children:"Activity"}),jsx(U,{})]})})}),jsx(V,{children:jsx(W,{asChild:true,isActive:W$1,tooltip:"Automations",children:jsxs(s,{to:"automations",children:[jsx(BotIcon,{className:"fk:h-4 fk:w-4",strokeWidth:2}),jsx("span",{children:"Automations"})]})})}),jsx(V,{children:jsx(W,{asChild:true,isActive:f,tooltip:"Run History",children:jsxs(s,{to:"runs",children:[jsx(HistoryIcon,{className:"fk:h-4 fk:w-4",strokeWidth:2}),jsx("span",{children:"Run History"})]})})}),jsx(V,{children:jsx(W,{asChild:true,isActive:w,tooltip:"Approvals",children:jsxs(s,{to:"approvals",children:[jsx(InboxIcon,{className:"fk:h-4 fk:w-4",strokeWidth:2}),jsx("span",{children:"Approvals"}),jsx(T,{})]})})}),jsx(V,{children:jsx(W,{asChild:true,isActive:R$1,tooltip:"Plugins",children:jsxs(s,{to:"plugins",children:[jsx(PlugIcon,{className:"fk:size-4"}),jsx("span",{children:"Plugins"})]})})})]})}),jsx(R,{className:"fk:mt-4 fk:group-data-[collapsible=icon]:hidden",children:jsx(T$1,{children:jsx(c,{query:E})})})]}),jsx(O,{})]})}var F="flexkit:sidebar:state";function pt(){let{currentProjectId:a}=f(),e=document.cookie.split("; ").find(o=>o.startsWith(`${F}=`))?.split("=")[1]!=="false";return a?jsxs(L,{className:"fk:h-full",defaultOpen:e,children:[jsx(B,{}),jsx(P,{className:"fk:min-w-0",children:jsx("div",{className:"fk:flex fk:h-full fk:min-h-0 fk:min-w-0 fk:flex-col fk:overflow-hidden fk:pl-4 fk:pt-3",children:jsx("div",{className:"fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col",children:jsx(Outlet,{})})})})]}):jsx("main",{className:"fk:flex fk:h-full fk:flex-1 fk:items-center fk:justify-center fk:p-8 fk:text-sm fk:text-muted-foreground",children:"Select a project to manage automations and skills."})}export{pt as Root};//# sourceMappingURL=root-76YQTZUI.js.map
|
|
2
|
+
//# sourceMappingURL=root-76YQTZUI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/apps/ai/sidebar.tsx","../src/apps/ai/root.tsx"],"names":["SEARCH_DEBOUNCE_MS","NavLinkCompat","NavLink","PendingApprovalsBadge","currentProjectId","useConfig","data","useSWR","paths","fetcher","pendingCount","jsx","Badge","ActivityBadge","useActivitySummary","needsAction","count","AutomationsSidebar","pathname","useLocation","isNewChat","isRunHistory","isApprovals","isActivity","isPlugins","isAutomations","query","setQuery","useState","debouncedQuery","useDebouncedValue","jsxs","Sidebar","SidebarGroup","SidebarGroupContent","SearchIcon","Input","event","XIcon","SidebarContent","SidebarMenu","SidebarMenuItem","SidebarMenuButton","SquarePenIcon","BellIcon","BotIcon","HistoryIcon","InboxIcon","PlugIcon","AgentChatsSection","SidebarRail","SIDEBAR_COOKIE_NAME","Root","defaultOpen","row","SidebarProvider","SidebarInset","Outlet"],"mappings":"kyBAuBA,IAAMA,CAAAA,CAAqB,GAAA,CAErBC,EAAgBC,OAAAA,CAKtB,SAASC,CAAAA,EAA4C,CACnD,GAAM,CAAE,gBAAA,CAAAC,CAAiB,CAAA,CAAIC,GAAU,CACjC,CAAE,IAAA,CAAAC,CAAK,CAAA,CAAIC,GAAAA,CACfH,CAAAA,CAAmBI,CAAAA,CAAMJ,CAAgB,CAAA,CAAE,cAAA,CAAiB,IAAA,CAC5DK,GAAAA,CACA,CAAE,eAAA,CAAiB,GAAO,CAC5B,CAAA,CACMC,EAAeJ,CAAAA,EAAM,YAAA,EAAgB,CAAA,CAE3C,OAAII,CAAAA,GAAiB,CAAA,CACZ,IAAA,CAIPC,GAAAA,CAACC,IAAA,CAAM,SAAA,CAAU,qKAAA,CACd,QAAA,CAAAF,EAAe,EAAA,CAAK,KAAA,CAAQA,CAAAA,C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,CACF,CAAA,CAAA,CACF,CAAA,CACAlB,IAACuC,CAAAA,CAAA,EAAY,CAAA,CAAA,CACf,CAEJ,CCrKA,IAAMC,CAAAA,CAAsB,uBAAA,CAErB,SAASC,EAAAA,EAAoB,CAClC,GAAM,CAAE,iBAAAhD,CAAiB,CAAA,CAAIC,CAAAA,EAAU,CACjCgD,EACJ,QAAA,CAAS,MAAA,CACN,KAAA,CAAM,IAAI,EACV,IAAA,CAAMC,CAAAA,EAAQA,CAAAA,CAAI,UAAA,CAAW,CAAA,EAAGH,CAAmB,CAAA,CAAA,CAAG,CAAC,GACtD,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,IAAM,OAAA,CAExB,OAAK/C,CAAAA,CASH2B,IAAAA,CAACwB,EAAA,CAAgB,SAAA,CAAU,WAAA,CAAY,WAAA,CAAaF,CAAAA,CAClD,QAAA,CAAA,CAAA1C,GAAAA,CAACM,CAAAA,CAAA,EAAmB,CAAA,CACpBN,GAAAA,CAAC6C,CAAAA,CAAA,CAAa,UAAU,YAAA,CACtB,QAAA,CAAA7C,GAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,wFAAA,CACb,QAAA,CAAAA,GAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,qDAAA,CACb,QAAA,CAAAA,GAAAA,CAAC8C,MAAAA,CAAA,EAAO,CAAA,CACV,CAAA,CACF,CAAA,CACF,CAAA,CAAA,CACF,EAhBE9C,GAAAA,CAAC,MAAA,CAAA,CAAK,SAAA,CAAU,0GAAA,CAA2G,8DAE3H,CAgBN","file":"root-DK5C7DYH.js","sourcesContent":["import type { JSX } from 'react';\nimport { useState } from 'react';\nimport { BellIcon, BotIcon, PlugIcon, HistoryIcon, InboxIcon, SearchIcon, SquarePenIcon, XIcon } from 'lucide-react';\nimport { NavLink, useLocation } from 'react-router-dom';\nimport useSWR from 'swr';\nimport { useConfig } from '../../core/config/config-context';\nimport {\n Badge,\n Input,\n SidebarContent,\n SidebarGroup,\n SidebarGroupContent,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarPanel,\n SidebarRail,\n} from '../../ui';\nimport { fetcher, paths } from './api';\nimport { useActivitySummary } from './activity-nav-button';\nimport { AgentChatsSection, useDebouncedValue } from './agent/chat-list';\nimport type { AutomationApprovals } from './types';\n\nconst SEARCH_DEBOUNCE_MS = 300;\n\nconst NavLinkCompat = NavLink as unknown as React.ComponentType<{\n children?: React.ReactNode;\n to: string;\n}>;\n\nfunction PendingApprovalsBadge(): JSX.Element | null {\n const { currentProjectId } = useConfig();\n const { data } = useSWR<AutomationApprovals>(\n currentProjectId ? paths(currentProjectId).approvalsCount : null,\n fetcher,\n { refreshInterval: 30_000 }\n );\n const pendingCount = data?.pendingCount ?? 0;\n\n if (pendingCount === 0) {\n return null;\n }\n\n return (\n <Badge className=\"fk:ml-auto fk:h-5 fk:min-w-5 fk:justify-center fk:rounded-full fk:bg-amber-500/20 fk:px-1.5 fk:text-[0.6875rem] fk:text-amber-600 fk:border-none fk:corner-squircle\">\n {pendingCount > 99 ? '99+' : pendingCount.toString()}\n </Badge>\n );\n}\n\n/** Open items that wait on the viewer; falls back to the unread count when nothing waits. */\nfunction ActivityBadge(): JSX.Element | null {\n const { currentProjectId } = useConfig();\n const data = useActivitySummary(currentProjectId);\n const needsAction = data?.needsActionCount ?? 0;\n const count = needsAction > 0 ? needsAction : (data?.unreadCount ?? 0);\n\n if (count === 0) {\n return null;\n }\n\n return (\n <Badge\n className={`fk:ml-auto fk:h-5 fk:min-w-5 fk:justify-center fk:rounded-full fk:px-1.5 fk:text-[0.6875rem] fk:border-none fk:corner-squircle ${\n needsAction > 0 ? 'fk:bg-amber-500/20 fk:text-amber-600' : 'fk:bg-muted fk:text-muted-foreground'\n }`}\n >\n {count > 99 ? '99+' : count.toString()}\n </Badge>\n );\n}\n\nexport function AutomationsSidebar(): JSX.Element {\n const location = useLocation();\n const pathname = location.pathname.replace(/\\/$/, '');\n const isNewChat = pathname.endsWith('/ai/agent');\n const isRunHistory = pathname.endsWith('/ai/runs');\n const isApprovals = pathname.endsWith('/ai/approvals');\n const isActivity = pathname.endsWith('/ai/activity') || pathname.includes('/ai/activity/');\n const isPlugins = pathname.includes('/ai/plugins') || pathname.includes('/ai/skills');\n const isAutomations = pathname.includes('/ai/automations');\n const [query, setQuery] = useState('');\n const debouncedQuery = useDebouncedValue(query.trim(), SEARCH_DEBOUNCE_MS);\n\n return (\n <SidebarPanel collapsible=\"icon\" variant=\"inset\">\n <SidebarGroup className=\"fk:shrink-0 fk:pb-1.5 fk:group-data-[collapsible=icon]:hidden\">\n <SidebarGroupContent className=\"fk:relative\">\n <SearchIcon className=\"fk:absolute fk:left-2 fk:top-1/2 fk:size-3.5 fk:-translate-y-1/2 fk:text-muted-foreground\" />\n <Input\n className=\"fk:h-8 fk:bg-background fk:pl-7 fk:pr-7 fk:text-sm\"\n placeholder=\"Search chats...\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n />\n {query ? (\n <button\n aria-label=\"Clear search\"\n className=\"fk:absolute fk:right-2 fk:top-1/2 fk:-translate-y-1/2 fk:cursor-pointer fk:text-muted-foreground fk:hover:text-foreground\"\n type=\"button\"\n onClick={() => setQuery('')}\n >\n <XIcon className=\"fk:size-3.5\" />\n </button>\n ) : null}\n </SidebarGroupContent>\n </SidebarGroup>\n <SidebarContent>\n <SidebarGroup>\n <SidebarMenu>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isNewChat} tooltip=\"New chat\">\n <NavLinkCompat to=\"agent\">\n <SquarePenIcon className=\"fk:h-4 fk:w-4\" strokeWidth={2} />\n <span>New chat</span>\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isActivity} tooltip=\"Activity\">\n <NavLinkCompat to=\"activity\">\n <BellIcon className=\"fk:h-4 fk:w-4\" strokeWidth={2} />\n <span>Activity</span>\n <ActivityBadge />\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isAutomations} tooltip=\"Automations\">\n <NavLinkCompat to=\"automations\">\n <BotIcon className=\"fk:h-4 fk:w-4\" strokeWidth={2} />\n <span>Automations</span>\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isRunHistory} tooltip=\"Run History\">\n <NavLinkCompat to=\"runs\">\n <HistoryIcon className=\"fk:h-4 fk:w-4\" strokeWidth={2} />\n <span>Run History</span>\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isApprovals} tooltip=\"Approvals\">\n <NavLinkCompat to=\"approvals\">\n <InboxIcon className=\"fk:h-4 fk:w-4\" strokeWidth={2} />\n <span>Approvals</span>\n <PendingApprovalsBadge />\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isPlugins} tooltip=\"Plugins\">\n <NavLinkCompat to=\"plugins\">\n <PlugIcon className=\"fk:size-4\" />\n <span>Plugins</span>\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n </SidebarMenu>\n </SidebarGroup>\n <SidebarGroup className=\"fk:mt-4 fk:group-data-[collapsible=icon]:hidden\">\n <SidebarGroupContent>\n <AgentChatsSection query={debouncedQuery} />\n </SidebarGroupContent>\n </SidebarGroup>\n </SidebarContent>\n <SidebarRail />\n </SidebarPanel>\n );\n}\n","import type { JSX } from 'react';\nimport { Outlet } from 'react-router-dom';\nimport { useConfig } from '../../core/config/config-context';\nimport { SidebarInset, SidebarProvider } from '../../ui';\nimport { AutomationsSidebar } from './sidebar';\n\nconst SIDEBAR_COOKIE_NAME = 'flexkit:sidebar:state';\n\nexport function Root(): JSX.Element {\n const { currentProjectId } = useConfig();\n const defaultOpen =\n document.cookie\n .split('; ')\n .find((row) => row.startsWith(`${SIDEBAR_COOKIE_NAME}=`))\n ?.split('=')[1] !== 'false';\n\n if (!currentProjectId) {\n return (\n <main className=\"fk:flex fk:h-full fk:flex-1 fk:items-center fk:justify-center fk:p-8 fk:text-sm fk:text-muted-foreground\">\n Select a project to manage automations and skills.\n </main>\n );\n }\n\n return (\n <SidebarProvider className=\"fk:h-full\" defaultOpen={defaultOpen}>\n <AutomationsSidebar />\n <SidebarInset className=\"fk:min-w-0\">\n <div className=\"fk:flex fk:h-full fk:min-h-0 fk:min-w-0 fk:flex-col fk:overflow-hidden fk:pl-4 fk:pt-3\">\n <div className=\"fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col\">\n <Outlet />\n </div>\n </div>\n </SidebarInset>\n </SidebarProvider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/apps/ai/sidebar.tsx","../src/apps/ai/root.tsx"],"names":["SEARCH_DEBOUNCE_MS","NavLinkCompat","NavLink","PendingApprovalsBadge","currentProjectId","useConfig","data","useSWR","paths","fetcher","pendingCount","jsx","Badge","ActivityBadge","useActivitySummary","needsAction","count","AutomationsSidebar","pathname","useLocation","isNewChat","isRunHistory","isApprovals","isActivity","isPlugins","isAutomations","query","setQuery","useState","debouncedQuery","useDebouncedValue","jsxs","Sidebar","SidebarGroup","SidebarGroupContent","SearchIcon","Input","event","XIcon","SidebarContent","SidebarMenu","SidebarMenuItem","SidebarMenuButton","SquarePenIcon","BellIcon","BotIcon","HistoryIcon","InboxIcon","PlugIcon","AgentChatsSection","SidebarRail","SIDEBAR_COOKIE_NAME","Root","defaultOpen","row","SidebarProvider","SidebarInset","Outlet"],"mappings":"kyBAuBA,IAAMA,CAAAA,CAAqB,GAAA,CAErBC,EAAgBC,OAAAA,CAKtB,SAASC,CAAAA,EAA4C,CACnD,GAAM,CAAE,gBAAA,CAAAC,CAAiB,CAAA,CAAIC,GAAU,CACjC,CAAE,IAAA,CAAAC,CAAK,CAAA,CAAIC,GAAAA,CACfH,CAAAA,CAAmB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SAAA,CAAU,0GAAA,CAA2G,8DAE3H,CAgBN","file":"root-76YQTZUI.js","sourcesContent":["import type { JSX } from 'react';\nimport { useState } from 'react';\nimport { BellIcon, BotIcon, PlugIcon, HistoryIcon, InboxIcon, SearchIcon, SquarePenIcon, XIcon } from 'lucide-react';\nimport { NavLink, useLocation } from 'react-router-dom';\nimport useSWR from 'swr';\nimport { useConfig } from '../../core/config/config-context';\nimport {\n Badge,\n Input,\n SidebarContent,\n SidebarGroup,\n SidebarGroupContent,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarPanel,\n SidebarRail,\n} from '../../ui';\nimport { fetcher, paths } from './api';\nimport { useActivitySummary } from './activity-nav-button';\nimport { AgentChatsSection, useDebouncedValue } from './agent/chat-list';\nimport type { AutomationApprovals } from './types';\n\nconst SEARCH_DEBOUNCE_MS = 300;\n\nconst NavLinkCompat = NavLink as unknown as React.ComponentType<{\n children?: React.ReactNode;\n to: string;\n}>;\n\nfunction PendingApprovalsBadge(): JSX.Element | null {\n const { currentProjectId } = useConfig();\n const { data } = useSWR<AutomationApprovals>(\n currentProjectId ? paths(currentProjectId).approvalsCount : null,\n fetcher,\n { refreshInterval: 30_000 }\n );\n const pendingCount = data?.pendingCount ?? 0;\n\n if (pendingCount === 0) {\n return null;\n }\n\n return (\n <Badge className=\"fk:ml-auto fk:h-5 fk:min-w-5 fk:justify-center fk:rounded-full fk:bg-amber-500/20 fk:px-1.5 fk:text-[0.6875rem] fk:text-amber-600 fk:border-none fk:corner-squircle\">\n {pendingCount > 99 ? '99+' : pendingCount.toString()}\n </Badge>\n );\n}\n\n/** Open items that wait on the viewer; falls back to the unread count when nothing waits. */\nfunction ActivityBadge(): JSX.Element | null {\n const { currentProjectId } = useConfig();\n const data = useActivitySummary(currentProjectId);\n const needsAction = data?.needsActionCount ?? 0;\n const count = needsAction > 0 ? needsAction : (data?.unreadCount ?? 0);\n\n if (count === 0) {\n return null;\n }\n\n return (\n <Badge\n className={`fk:ml-auto fk:h-5 fk:min-w-5 fk:justify-center fk:rounded-full fk:px-1.5 fk:text-[0.6875rem] fk:border-none fk:corner-squircle ${\n needsAction > 0 ? 'fk:bg-amber-500/20 fk:text-amber-600' : 'fk:bg-muted fk:text-muted-foreground'\n }`}\n >\n {count > 99 ? '99+' : count.toString()}\n </Badge>\n );\n}\n\nexport function AutomationsSidebar(): JSX.Element {\n const location = useLocation();\n const pathname = location.pathname.replace(/\\/$/, '');\n const isNewChat = pathname.endsWith('/ai/agent');\n const isRunHistory = pathname.endsWith('/ai/runs');\n const isApprovals = pathname.endsWith('/ai/approvals');\n const isActivity = pathname.endsWith('/ai/activity') || pathname.includes('/ai/activity/');\n const isPlugins = pathname.includes('/ai/plugins') || pathname.includes('/ai/skills');\n const isAutomations = pathname.includes('/ai/automations');\n const [query, setQuery] = useState('');\n const debouncedQuery = useDebouncedValue(query.trim(), SEARCH_DEBOUNCE_MS);\n\n return (\n <SidebarPanel collapsible=\"icon\" variant=\"inset\">\n <SidebarGroup className=\"fk:shrink-0 fk:pb-1.5 fk:group-data-[collapsible=icon]:hidden\">\n <SidebarGroupContent className=\"fk:relative\">\n <SearchIcon className=\"fk:absolute fk:left-2 fk:top-1/2 fk:size-3.5 fk:-translate-y-1/2 fk:text-muted-foreground\" />\n <Input\n className=\"fk:h-8 fk:bg-background fk:pl-7 fk:pr-7 fk:text-sm\"\n placeholder=\"Search chats...\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n />\n {query ? (\n <button\n aria-label=\"Clear search\"\n className=\"fk:absolute fk:right-2 fk:top-1/2 fk:-translate-y-1/2 fk:cursor-pointer fk:text-muted-foreground fk:hover:text-foreground\"\n type=\"button\"\n onClick={() => setQuery('')}\n >\n <XIcon className=\"fk:size-3.5\" />\n </button>\n ) : null}\n </SidebarGroupContent>\n </SidebarGroup>\n <SidebarContent>\n <SidebarGroup>\n <SidebarMenu>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isNewChat} tooltip=\"New chat\">\n <NavLinkCompat to=\"agent\">\n <SquarePenIcon className=\"fk:h-4 fk:w-4\" strokeWidth={2} />\n <span>New chat</span>\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isActivity} tooltip=\"Activity\">\n <NavLinkCompat to=\"activity\">\n <BellIcon className=\"fk:h-4 fk:w-4\" strokeWidth={2} />\n <span>Activity</span>\n <ActivityBadge />\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isAutomations} tooltip=\"Automations\">\n <NavLinkCompat to=\"automations\">\n <BotIcon className=\"fk:h-4 fk:w-4\" strokeWidth={2} />\n <span>Automations</span>\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isRunHistory} tooltip=\"Run History\">\n <NavLinkCompat to=\"runs\">\n <HistoryIcon className=\"fk:h-4 fk:w-4\" strokeWidth={2} />\n <span>Run History</span>\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isApprovals} tooltip=\"Approvals\">\n <NavLinkCompat to=\"approvals\">\n <InboxIcon className=\"fk:h-4 fk:w-4\" strokeWidth={2} />\n <span>Approvals</span>\n <PendingApprovalsBadge />\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n <SidebarMenuItem>\n <SidebarMenuButton asChild isActive={isPlugins} tooltip=\"Plugins\">\n <NavLinkCompat to=\"plugins\">\n <PlugIcon className=\"fk:size-4\" />\n <span>Plugins</span>\n </NavLinkCompat>\n </SidebarMenuButton>\n </SidebarMenuItem>\n </SidebarMenu>\n </SidebarGroup>\n <SidebarGroup className=\"fk:mt-4 fk:group-data-[collapsible=icon]:hidden\">\n <SidebarGroupContent>\n <AgentChatsSection query={debouncedQuery} />\n </SidebarGroupContent>\n </SidebarGroup>\n </SidebarContent>\n <SidebarRail />\n </SidebarPanel>\n );\n}\n","import type { JSX } from 'react';\nimport { Outlet } from 'react-router-dom';\nimport { useConfig } from '../../core/config/config-context';\nimport { SidebarInset, SidebarProvider } from '../../ui';\nimport { AutomationsSidebar } from './sidebar';\n\nconst SIDEBAR_COOKIE_NAME = 'flexkit:sidebar:state';\n\nexport function Root(): JSX.Element {\n const { currentProjectId } = useConfig();\n const defaultOpen =\n document.cookie\n .split('; ')\n .find((row) => row.startsWith(`${SIDEBAR_COOKIE_NAME}=`))\n ?.split('=')[1] !== 'false';\n\n if (!currentProjectId) {\n return (\n <main className=\"fk:flex fk:h-full fk:flex-1 fk:items-center fk:justify-center fk:p-8 fk:text-sm fk:text-muted-foreground\">\n Select a project to manage automations and skills.\n </main>\n );\n }\n\n return (\n <SidebarProvider className=\"fk:h-full\" defaultOpen={defaultOpen}>\n <AutomationsSidebar />\n <SidebarInset className=\"fk:min-w-0\">\n <div className=\"fk:flex fk:h-full fk:min-h-0 fk:min-w-0 fk:flex-col fk:overflow-hidden fk:pl-4 fk:pt-3\">\n <div className=\"fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col\">\n <Outlet />\n </div>\n </div>\n </SidebarInset>\n </SidebarProvider>\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import'./index.css';import {c as c$3,a as a$3}from'./chunk-
|
|
1
|
+
import'./index.css';import {c as c$3,a as a$3}from'./chunk-OFJOZMCR.js';import {a as a$1}from'./chunk-7IHEL6LU.js';import {a as a$2}from'./chunk-3C2EG3SI.js';import {s,J,u,v,w,x as x$1,C,j,e,h,g,A,B,E,G,F,H}from'./chunk-6YOVF2AD.js';import {c}from'./chunk-P6BZ4QP7.js';import {b as b$1}from'./chunk-V64P56OA.js';import'./chunk-2DXR5NJV.js';import {f,b}from'./chunk-C47FNPLK.js';import'./chunk-TYDYAOQ7.js';import {x,y,z,s as s$1,ma,c as c$4,d as d$1,o as o$2}from'./chunk-YCCFUGWJ.js';import {c as c$2,d,h as h$1,i,k,l,j as j$1,w as w$1,n,o as o$1,p,q,r,t as t$1,s as s$2}from'./chunk-32ZU4MLE.js';import'./chunk-HDOIOXMP.js';import {e as e$2,g as g$1,h as h$2,j as j$2,o,t}from'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import {a,b as b$2,c as c$1,e as e$1}from'./chunk-USNXQOMJ.js';import {b as b$3}from'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';import {useState,useMemo,useCallback,useRef,useEffect}from'react';import {TagIcon,PlusIcon,Loader2,Ellipsis,Check,Copy,Link,MinusIcon,Trash2,LoaderCircle,Search,X,ImagePlayIcon,ImageIcon,FilePlayIcon,LayersIcon,SplinePointerIcon,ListChecks,Trash2Icon,LayoutGrid,List}from'lucide-react';import {gql}from'@apollo/client';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useLocation,Outlet,useParams}from'react-router-dom';import {useReactTable,getSortedRowModel,getPaginationRowModel,getFilteredRowModel,getCoreRowModel}from'@tanstack/react-table';import {defaultStyles,FileIcon}from'react-file-icon';var we={where:{},limit:500,offset:0,sort:[{name:"ASC"}]},Y={selection:"display",includeCount:false};function Et(){let{scope:e$3}=c(),{currentProjectSchema:n}=f(),[t,a$1,i$1]=C(),[f$1,c$3]=useState(""),[d$1,b]=useState(false),[v,u$1]=useState(false),[l$1,s]=useState(null),[M,p]=useState(false),[E,I]=useState(null),[J,x]=useState(""),[_,U]=useState(false),[F,B]=useState(false),h$3=b$1(),D="_tag",m="_tags",{data:C$1,isLoading:S}=u({entityNamePlural:m,schema:n,scope:e$3,variables:we,...Y}),z=(Array.isArray(C$1)?C$1:[]).map(r=>{let V=r;return {_id:V._id,name:V.name}}),O=useCallback(async()=>{let r=f$1.trim();if(!r)return;U(true);let V=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}`,L=j(m,n,{name:{value:r,disabled:false,scope:"default"}},V),j$1=e(m,e$3,n,Y),K=gql`
|
|
2
2
|
${j$1.query}
|
|
3
3
|
`;await new Promise(y=>{a$1(gql`
|
|
4
4
|
${L}
|
|
@@ -19,5 +19,5 @@ import'./index.css';import {c as c$3,a as a$3}from'./chunk-YSMRXGVX.js';import {
|
|
|
19
19
|
${D}
|
|
20
20
|
`),b({variables:{where:{_id:{in:e}}},onCompleted:S=>{x(S),m();},onError:S=>C(S)}),c$1(!0);}),a?.(),I(),t(null);}catch{}finally{M(false);}}},[x,e,s,a,t,I,c$1,v,i,u$1,d,b]),U=useCallback(async()=>{if(!(e.length===0||u$1.length===0||s)){M(true);try{let h={tags:{relationships:{disconnect:u$1},disabled:!1,scope:i}},D=g("_assets",e[0]??"",i,v,{},h,{responseFields:Ft});await new Promise((m,C)=>{d(gql`
|
|
21
21
|
${D}
|
|
22
|
-
`),b({variables:{where:{_id:{in:e}}},onCompleted:S=>{x(S),m();},onError:S=>C(S)}),c$1(!0);}),a?.(),I(),t(null);}catch{}finally{M(false);}}},[x,e,s,a,t,I,c$1,v,i,u$1,d,b]),F=n$1==="remove",B=F?"Remove tag(s)":"Add tag(s)";return e.length>1&&(B=F?"Remove tag(s) from selected assets":"Add tag(s) to selected assets"),jsxs(n,{open:n$1!==null,onOpenChange:J,children:[jsx(o$1,{placeholder:"Search tags..."}),jsxs(p,{className:"fk:h-75",children:[jsx(q,{children:"No tags found."}),jsx(r,{heading:"Tags",children:E.map(h=>{let D=u$1.includes(h._id);return jsxs(t$1,{disabled:s,onSelect:()=>{s||l(m=>D?m.filter(C=>C!==h._id):[...m,h._id]);},children:[jsx("input",{className:"fk:mr-2",checked:D,onChange:()=>{},type:"checkbox"}),h.name]},h._id)})})]}),jsx(s$2,{}),jsx("div",{className:"fk:p-2",children:jsxs(b$3,{className:"fk:w-full",disabled:u$1.length===0||s,onClick:F?U:_,children:[s?jsx(LoaderCircle,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin"}):null,B]})})]})}function qe({overlay:e=false,row:n}){let[t,a]=useState(null),[i,f]=useState(null),c=A(),d=b$1(),b$2=n.original,v=b$2._id??"",u=b$2.url??"";function l(){c({type:"DeleteEntity",payload:{entityId:v,entityName:b.name}});}function s(p,E){navigator.clipboard.writeText(E),a(p),window.setTimeout(()=>a(null),1500);}return jsxs(Fragment,{children:[jsxs(e$2,{children:[jsx(g$1,{asChild:true,children:jsxs(b$3,{className:e?"fk:flex fk:h-7 fk:w-7 fk:p-0 fk:text-white fk:group-hover:bg-background/10 fk:group-hover:text-white! fk:data-[state=open]:bg-background/15":"fk:flex fk:h-8 fk:w-8 fk:p-0 fk:data-[state=open]:bg-muted",onClick:p=>p.stopPropagation(),variant:"ghost",children:[jsx(Ellipsis,{className:"fk:h-4 fk:w-4"}),jsx("span",{className:"fk:sr-only",children:"Open menu"})]})}),jsxs(h$2,{align:"start",className:"fk:w-45",children:[jsxs(j$2,{disabled:!v,onClick:p=>{p.stopPropagation(),s("id",v);},children:[t==="id"?jsx(Check,{className:"fk:mr-2 fk:h-4 fk:w-4"}):jsx(Copy,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Copy ID"]}),jsxs(j$2,{disabled:!u,onClick:p=>{p.stopPropagation(),s("url",u);},children:[t==="url"?jsx(Check,{className:"fk:mr-2 fk:h-4 fk:w-4"}):jsx(Link,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Copy URL"]}),jsx(o,{}),jsxs(j$2,{disabled:!v||!d,onClick:p=>{p.stopPropagation(),f("add");},children:[jsx(TagIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Add tag"]}),jsxs(j$2,{disabled:!v||!d,onClick:p=>{p.stopPropagation(),f("remove");},children:[jsx(MinusIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Remove tag"]}),jsx(o,{}),jsxs(j$2,{className:"fk:text-destructive",disabled:!v||!d,onClick:p=>{p.stopPropagation(),l();},children:[jsx(Trash2,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Delete"]})]})]}),i!==null?jsx(Ve,{assetIds:v?[v]:[],mode:i,onModeChange:f}):null]})}var bo=FileIcon,wo="fk:bg-[#fafafa] [--asset-checker:#f0f0f0] [background-image:linear-gradient(45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(-45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(45deg,transparent_75%,var(--asset-checker)_75%),linear-gradient(-45deg,transparent_75%,var(--asset-checker)_75%)] [background-position:0_0,0_4px,4px_-4px,-4px_0px] [background-size:8px_8px] fk:dark:bg-[#222] dark:[--asset-checker:#2a2a2a]";function Do(e){return Math.max(600,e)}function Co(e){return e==null||Number.isNaN(e)?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ot({columns:e,data:n,entityName:t$1,hasMore:a=false,isLoading:i=false,isLoadingMore:f=false,onLoadMore:c,onSortingChange:d,pageSize:b,sorting:v,toolbarComponent:u}){let l=useRef(null),{schemaErrorMessage:s$1}=s(),[M,p]=useState({}),[E,I]=useState({}),[J,x]=useState([]),[_,U]=useState([]),F=v??_;useEffect(()=>{l.current?.scrollTo({top:0});},[t$1]);function B(w){if(d){d(w);return}U(w);}let h=useReactTable({data:n,columns:e,state:{sorting:F,columnVisibility:E,rowSelection:M,columnFilters:J},initialState:{pagination:{pageSize:b??50}},enableRowSelection:true,onRowSelectionChange:p,onSortingChange:B,onColumnFiltersChange:x,onColumnVisibilityChange:I,getCoreRowModel:getCoreRowModel(),getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),getSortedRowModel:getSortedRowModel(),getRowId:w=>w._id,manualFiltering:true,manualPagination:true,manualSorting:true}),{rows:D}=h.getRowModel(),m=useRef(c),C=useRef(a),S=useRef(f);m.current=c,C.current=a,S.current=f;let z=useCallback(w=>{if(!m.current||!C.current||S.current)return;let P=w??l.current;if(!P)return;let{scrollHeight:r,scrollTop:V,clientHeight:X}=P;r-V-X>=Do(X)||m.current();},[]);useEffect(()=>{z();},[z,D.length,a,f]);function O(w){z(w.currentTarget);}return s$1?jsx(Fragment,{}):jsxs("div",{className:"fk:flex fk:h-full fk:min-h-0 fk:w-full fk:min-w-0 fk:flex-col fk:gap-4",children:[u?u(h):null,jsxs("div",{className:"fk:relative fk:min-h-0 fk:min-w-0 fk:flex-1",children:[f?jsx("div",{"aria-hidden":true,className:"fk:pointer-events-none fk:absolute fk:top-0 fk:right-px fk:left-px fk:z-20 fk:h-0.5 fk:overflow-hidden fk:opacity-40",children:jsx("div",{className:"fk:animate-progress fk:h-full fk:w-full fk:bg-foreground"})}):null,jsxs("div",{className:"fk:h-full fk:overflow-auto fk:pt-px fk:pb-20 fk:-ml-0.5 fk:pr-3",onScroll:O,ref:l,children:[i?jsx("div",{className:"fk:grid fk:grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] fk:gap-3",children:Array.from({length:b??50},(w,P)=>jsxs("div",{className:"fk:rounded-md fk:border fk:border-border fk:p-2 fk:corner-squircle",children:[jsx(t,{className:"fk:aspect-square fk:w-full fk:rounded-sm fk:corner-squircle"}),jsx(t,{className:"fk:mt-2 fk:h-3 fk:w-[75%]"}),jsx(t,{className:"fk:mt-1.5 fk:h-3 fk:w-[50%]"})]},`skeleton-${P}`))}):null,!i&&D.length===0?jsx("div",{className:"fk:flex fk:h-24 fk:items-center fk:justify-center fk:text-sm fk:text-muted-foreground",children:"No results."}):null,!i&&D.length>0?jsx("div",{className:"fk:grid fk:grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] fk:pl-0.5 fk:gap-3",children:D.map(w=>jsx(To,{row:w},w.id))}):null]})]})]})}function To({row:e}){let n=e.original,t=E(n)||"Untitled",a=n.mimeType??"",i=Co(n.size),f=e.getIsSelected(),c=[a,i].filter(Boolean).join(" \xB7 ");return jsxs("div",{className:`fk:relative fk:rounded-md fk:border fk:p-2 fk:transition-colors ${f?"fk:border-primary fk:ring-1 fk:ring-primary/40 fk:bg-muted/40":"fk:border-border fk:bg-background fk:hover:border-muted-foreground/30"} fk:corner-squircle`,"data-state":f?"selected":void 0,children:[jsx("div",{className:"fk:absolute fk:left-3 fk:top-3 fk:z-10 fk:mix-blend-difference",children:jsx(o$2,{className:"fk:border-white!","aria-label":`Select ${t}`,checked:f,onCheckedChange:d=>{e.toggleSelected(!!d);},onClick:d=>d.stopPropagation()})}),jsx("div",{className:"fk:group fk:absolute fk:right-2 fk:top-2 fk:z-10 fk:mix-blend-difference",children:jsx(qe,{overlay:true,row:e})}),jsx(So,{asset:n,filename:t}),jsx("div",{className:"fk:mt-2 fk:truncate fk:text-xs fk:font-medium",title:t,children:t}),c?jsx("div",{className:"fk:mt-0.5 fk:truncate fk:text-[11px] fk:text-muted-foreground",title:c,children:c}):null]})}function So({asset:e,filename:n}){let[t,a]=useState(false),[i$1,f]=useState(false),c=e.url??"";if(!c&&!e.path)return jsx("div",{className:"fk:flex fk:aspect-square fk:items-center fk:justify-center fk:rounded-sm fk:bg-muted fk:corner-squircle",children:jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:"No preview"})});if(!G(e)||!c){let s=F(e),M=defaultStyles[s];return jsx("div",{className:"fk:flex fk:aspect-square fk:items-center fk:justify-center fk:rounded-sm fk:bg-muted fk:[&>svg]:h-12 fk:[&>svg]:w-auto fk:corner-squircle",children:jsx(bo,{extension:s,...M||{}})})}let b=H(c,{width:320,height:320}),v=c;function u(s){s.stopPropagation(),f(false),a(true);}function l$1(s){a(s),s||f(false);}return jsxs(Fragment,{children:[jsx("button",{className:`fk:aspect-square fk:w-full fk:cursor-zoom-in fk:overflow-hidden fk:rounded-sm fk:border-0 fk:p-0 ${wo} fk:corner-squircle`,onClick:u,type:"button",children:jsx("img",{alt:n,className:"fk:h-full fk:w-full fk:object-contain",src:b})}),jsx(c$2,{open:t,onOpenChange:l$1,children:jsxs(h$1,{className:"fk:sm:max-w-4xl fk:p-3",children:[jsxs(i,{children:[jsx(k,{className:"fk:sr-only",children:"Asset preview"}),jsx(l,{className:"fk:sr-only",children:"Enlarged asset preview"})]}),jsxs("div",{className:"fk:relative fk:flex fk:h-[min(85vh,56rem)] fk:w-full fk:items-center fk:justify-center fk:overflow-hidden fk:rounded-md fk:corner-squircle",children:[i$1?null:jsx(LoaderCircle,{"aria-label":"Loading image",className:"fk:absolute fk:h-8 fk:w-8 fk:animate-spin fk:text-muted-foreground"}),jsx("img",{alt:n,className:`fk:max-h-full fk:max-w-full fk:object-contain fk:transition-opacity ${i$1?"fk:opacity-100":"fk:opacity-0"}`,onError:()=>f(true),onLoad:()=>f(true),src:v})]})]})})]})}var Oo=[{value:"image/gif",label:"GIF",icon:ImagePlayIcon},{value:"image/jpeg",label:"JPEG",icon:ImageIcon},{value:"video/mp4",label:"MP4",icon:FilePlayIcon},{value:"image/png",label:"PNG",icon:LayersIcon},{value:"image/svg+xml",label:"SVG",icon:SplinePointerIcon},{value:"image/webp",label:"WebP",icon:ImageIcon}];function Ze({entityName:e,isUploading:n=false,table:t,viewMode:a,onUploadClick:i,onViewModeChange:f$1,onSearchLoadingChange:c$1,onSearchWhereChange:d}){let b=t.getState().columnFilters.length>0,{projectId:v}=useParams(),u$1=A(),{scope:l}=c(),[s,M]=useState(null),{currentProjectSchema:p}=f(),E=b$1(),[I,J]=useState(""),x=useRef({}),_=useRef({});function U(){return {searchRequests:{searches:[{collection:"_assets"},{collection:"_tags"}]},commonParams:{q:""}}}let F=useMemo(()=>U(),[]),[B$1,h]=useState(F),{results:D,isLoading:m}=a$1(v??"",B$1),C=useRef(""),S=I.trim(),z=B$1.commonParams.q??"",O=S.length>0&&(m||z!==S),w=useMemo(()=>Uo(g=>{h({...F,commonParams:{q:g}});},300),[F]);useEffect(()=>()=>{w.cancel();},[w]);let P=t.getSelectedRowModel().rows.map(g=>g.original._id),{data:r}=u({entityNamePlural:"_tags",schema:p,scope:l,variables:we,...Y}),V=useMemo(()=>(Array.isArray(r)?r:[]).map(N=>({_id:N._id,name:N.name})),[r]),X$1=useMemo(()=>V.map(g=>({value:g._id,label:g.name})),[V]),L=useCallback(()=>{if(!d)return;let g=[];Object.keys(x.current).length>0&&g.push(x.current),Object.keys(_.current).length>0&&g.push(_.current);let N=g.length===0?{}:g.length===1?g[0]:{AND:g},Z=JSON.stringify(N);C.current!==Z&&(C.current=Z,d(N));},[d]);function j(){w.cancel(),J(""),h({...F,commonParams:{q:""}}),x.current={},L();}async function K(){u$1({type:"AlertDialog",payload:{options:{dialogTitle:`Delete ${P.length} asset${P.length>1?"s":""}`,dialogMessage:P.length>1?"Are you sure you want to delete the selected assets? They will be deleted permanently.":"Are you sure you want to delete the selected asset? The item will be deleted permanently.",dialogCancelTitle:"Cancel",dialogActionLabel:"Delete",isDestructive:true,dialogActionCancel:()=>{},dialogActionSubmit:()=>{u$1({type:"DeleteEntity",_id:`delete-batch-${Date.now()}`,payload:{entityId:P,entityName:e,silent:true}}),t.resetRowSelection();}}}});}useEffect(()=>{c$1?.(O);},[O,c$1]),useEffect(()=>{if(!d)return;if(S.length===0){x.current={},L();return}if(O)return;let g=D??[],N={};if(g.length===0)N={_id:{in:[]}};else {let Z=g.filter(q=>q._entityNamePlural==="_assets").map(q=>q._id),xe=g.filter(q=>q._entityNamePlural==="_tags").map(q=>({tags:{some:{_id:{eq:q._id}}}})),Q=[];Z.length>0&&Q.push({_id:{in:Z}}),Q.push(...xe),Q.length===0?N={_id:{in:[]}}:Q.length===1?N=Q[0]:N={OR:Q};}x.current=N,L();},[L,O,d,D,S]);let y=JSON.stringify(t.getState().columnFilters);return useEffect(()=>{if(!d)return;let g=t.getState().columnFilters.find(q=>q.id==="mimeType"),N=Array.isArray(g?.value)?g?.value:[],Z=t.getState().columnFilters.find(q=>q.id==="tags"),xe=Array.isArray(Z?.value)?Z?.value:[],Q=[];if(N.length>0&&Q.push({mimeType:{in:N}}),xe.length>0){let q=xe.map(Ht=>({tags:{some:{_id:{eq:Ht}}}}));Q.push(q.length===1?q[0]:{OR:q});}Q.length===0?_.current={}:Q.length===1?_.current=Q[0]:_.current={AND:Q},L();},[y,L,d,t]),jsxs("div",{className:"fk:flex fk:items-center fk:justify-between fk:pr-3",children:[jsxs("div",{className:"fk:flex fk:flex-1 fk:items-center fk:space-x-2",children:[jsxs("div",{className:"fk:relative",children:[m?jsx(LoaderCircle,{className:"fk:absolute fk:left-2 fk:top-2 fk:h-4 fk:w-4 fk:shrink-0 fk:opacity-50 fk:animate-spin"}):jsx(Search,{className:"fk:absolute fk:left-2 fk:top-2 fk:h-4 fk:w-4 fk:shrink-0 fk:opacity-50"}),jsx(s$1,{placeholder:"Search assets...",name:"search-assets",value:I,onChange:g=>{let{value:N}=g.target;if(J(N),N.trim().length===0){j();return}w(N.trim());},className:"fk:h-8 fk:w-37.5 fk:lg:w-70 fk:px-7"}),I?jsx(b$3,{"aria-label":"Clear search",className:"fk:absolute fk:right-1 fk:top-1 fk:h-6 fk:w-6 fk:text-muted-foreground fk:hover:text-foreground fk:hover:bg-foreground/10 fk:cursor-pointer fk:rounded-full fk:bg-transparent fk:corner-squircle",onClick:j,type:"button",children:jsx(X,{className:"fk:h-4 fk:w-4"})}):null]}),t.getColumn("mimeType")&&jsx(a$2,{column:t.getColumn("mimeType"),options:Oo,title:"File type"}),t.getColumn("tags")&&jsx(a$2,{column:t.getColumn("tags"),options:X$1,title:"Tags"}),b&&jsxs(b$3,{variant:"ghost",onClick:()=>{t.resetColumnFilters(),_.current={},L();},className:"fk:h-8 fk:px-2 fk:lg:px-3",children:["Reset",jsx(X,{className:"fk:ml-2 fk:h-4 fk:w-4"})]}),jsx(B,{table:t})]}),P.length>0?jsx("div",{className:"fk:flex fk:items-center fk:gap-2",children:jsxs(e$2,{children:[jsx(ma,{disabled:!E,children:jsx(g$1,{asChild:true,children:jsxs(b$3,{className:"fk:h-8 fk:mr-2 fk:lg:flex",disabled:!E,size:"sm",variant:"secondary",children:["Actions ",jsx(ListChecks,{className:"fk:ml-2 fk:h-4 fk:w-4"})]})})}),jsxs(h$2,{align:"end",className:"fk:w-[240px]",children:[jsxs(j$2,{onClick:()=>M("add"),children:[jsx(TagIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Add tag"]}),jsxs(j$2,{onClick:()=>M("remove"),children:[jsx(MinusIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Remove tag"]}),jsx(o,{}),jsxs(j$2,{onClick:K,className:"fk:text-destructive",children:[jsx(Trash2Icon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Delete asset",P.length>1?"s":""," (",P.length,")"]})]})]})}):null,jsxs("div",{className:"fk:ml-auto fk:flex fk:items-center fk:gap-2",children:[jsxs(c$4,{size:"sm",type:"single",value:a,onValueChange:g=>{(g==="list"||g==="grid")&&f$1(g);},children:[jsx(d$1,{"aria-label":"Grid view",value:"grid",children:jsx(LayoutGrid,{className:"fk:h-4 fk:w-4"})}),jsx(d$1,{"aria-label":"List view",value:"list",children:jsx(List,{className:"fk:h-4 fk:w-4"})})]}),jsx(ma,{disabled:!E,children:jsxs(b$3,{"aria-busy":n,className:"fk:h-8 fk:lg:flex",disabled:!E||n,onClick:i,size:"sm",variant:"default",children:[n?jsx(LoaderCircle,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin"}):null,"Upload assets"]})})]}),s!==null?jsx(Ve,{assetIds:P,mode:s,onCompleted:()=>t.resetRowSelection(),onModeChange:M}):null]})}function Uo(e,n=300){let t,a=function(...i){t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,e.apply(this,i);},n);};return a.cancel=()=>{t!==void 0&&(clearTimeout(t),t=void 0);},a}var Qo=4*1024*1024;function Gt(){let{projectId:e}=useParams(),n=c$3(),t=b$1(),[a,i]=useState(false);async function f(c){if(!(!t||a)&&!(c&&c.length===0))try{await n({files:c,maxBytes:Qo,multiple:!0,onUploadStart:()=>{i(!0);},projectId:e});}finally{i(false);}}return {canMutate:t,isUploading:a,uploadFiles:c=>f(c),uploadFromDialog:()=>f()}}var Wt="flexkit-asset-manager:viewMode";function $t(){if(typeof localStorage>"u")return "grid";try{let e=localStorage.getItem(Wt);if(e==="list"||e==="grid")return e}catch{}return "grid"}function Jt(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(Wt,e);}catch{}}var Me=36,Jo=[{_updatedAt:"DESC"},{_id:"DESC"}];function Xt(){let e="_assets",{search:n}=useLocation(),a=new URLSearchParams(n).get("id"),{scope:i}=c(),{schemaErrorMessage:f$1}=s(),{currentProject:c$1}=f(),d=c$1?.schema??[],[b$1,v$1]=useState([]),[u$1,l]=useState(()=>$t()),s$1=J({attributesSchema:b.attributes,actionsComponent:y=>jsx(qe,{row:y}),checkboxSelect:"multiple",enableColumnSorting:true}),[M,p]=useState({}),[E,I]=useState(false),{canMutate:J$1,isUploading:x,uploadFiles:_,uploadFromDialog:U}=Gt(),F=useMemo(()=>{let y=a?{_id:{eq:a}}:{NOT:{path:{eq:null}}};return !M||Object.keys(M).length===0||a?y:{AND:[y,M]}},[a,M]),B=useMemo(()=>{if(b$1.length===0)return Jo;let y=b$1.map(({id:N,desc:Z})=>({[N]:Z?"DESC":"ASC"}));return y.some(N=>"_id"in N)?y:[...y,{_id:"DESC"}]},[b$1]),h=useMemo(()=>({where:F,offset:0,limit:Me,sort:B}),[F,B]);function D(y){v$1(y);}function m(y){l(y),Jt(y);}let{isLoading:C,isLoadingMore:S,fetchMore:z,count:O,data:w$1,isProjectDisabled:P}=u({entityNamePlural:e,schema:d,scope:i,variables:h,selection:"list"}),r=E||C&&(w$1==null||w$1.length===0),V=w$1?.length??0,X=!E&&O>0&&V>0&&V<O,L=useCallback(()=>{z({variables:{offset:0,limit:Me}});},[z]),j=useMemo(()=>Array.from({length:Me},(y,g)=>({_id:`loading-${g}`})),[]),K=useMemo(()=>Xo(s$1),[s$1]);return P?jsx("div",{className:"fk:flex fk:flex-col fk:h-full fk:pl-3",children:jsx(v,{})}):jsxs("div",{className:"fk:flex fk:flex-col fk:h-full fk:pl-3",children:[jsx(w,{}),jsxs("div",{className:"fk:mb-4 fk:flex fk:items-center fk:gap-2 fk:pr-3",children:[jsx("h2",{className:"fk:text-lg fk:font-semibold fk:leading-none fk:tracking-tight",children:"Asset Manager"}),r?null:jsxs("span",{className:"fk:ml-auto fk:text-sm fk:font-normal fk:text-muted-foreground",children:[O.toLocaleString()," ",O===1?"record":"records"]})]}),f$1?null:jsx(_t,{disabled:!J$1||x,onDropFiles:_,children:u$1==="list"?jsx(x$1,{classNames:{row:"fk:h-20"},columns:r?K:s$1,data:r?j:w$1??[],entityName:b.name,hasMore:X,isLoadingMore:S,pageSize:Me,sorting:b$1,onLoadMore:L,onSortingChange:D,toolbarComponent:y=>jsx(Ze,{entityName:b.name,isUploading:x,table:y,viewMode:u$1,onSearchLoadingChange:I,onSearchWhereChange:p,onUploadClick:U,onViewModeChange:m})}):jsx(Ot,{columns:s$1,data:r?[]:w$1??[],entityName:b.name,hasMore:X,isLoading:r,isLoadingMore:S,pageSize:Me,sorting:b$1,onLoadMore:L,onSortingChange:D,toolbarComponent:y=>jsx(Ze,{entityName:b.name,isUploading:x,table:y,viewMode:u$1,onSearchLoadingChange:I,onSearchWhereChange:p,onUploadClick:U,onViewModeChange:m})})}),jsx(Outlet,{})]})}function Xo(e){return e.map(n=>({...n,cell:()=>jsx(t,{className:"fk:h-4 fk:w-full",style:{marginTop:"7px",marginBottom:"6px"}})}))}function On(){return jsxs(x,{orientation:"horizontal",className:"fk:h-full",children:[jsx(y,{className:"fk:p-3",defaultSize:"82%",children:jsx("div",{className:"fk:flex fk:flex-col fk:h-full",children:jsx(Xt,{})})}),jsx(z,{className:"fk:hover:bg-blue-500 fk:transition-colors",withHandle:true}),jsx(y,{defaultSize:"18%",minSize:"10%",children:jsx("div",{className:"fk:sm:hidden fk:md:block",children:jsx(Et,{})})})]})}export{On as Root};//# sourceMappingURL=root-MMAJEVBH.js.map
|
|
23
|
-
//# sourceMappingURL=root-
|
|
22
|
+
`),b({variables:{where:{_id:{in:e}}},onCompleted:S=>{x(S),m();},onError:S=>C(S)}),c$1(!0);}),a?.(),I(),t(null);}catch{}finally{M(false);}}},[x,e,s,a,t,I,c$1,v,i,u$1,d,b]),F=n$1==="remove",B=F?"Remove tag(s)":"Add tag(s)";return e.length>1&&(B=F?"Remove tag(s) from selected assets":"Add tag(s) to selected assets"),jsxs(n,{open:n$1!==null,onOpenChange:J,children:[jsx(o$1,{placeholder:"Search tags..."}),jsxs(p,{className:"fk:h-75",children:[jsx(q,{children:"No tags found."}),jsx(r,{heading:"Tags",children:E.map(h=>{let D=u$1.includes(h._id);return jsxs(t$1,{disabled:s,onSelect:()=>{s||l(m=>D?m.filter(C=>C!==h._id):[...m,h._id]);},children:[jsx("input",{className:"fk:mr-2",checked:D,onChange:()=>{},type:"checkbox"}),h.name]},h._id)})})]}),jsx(s$2,{}),jsx("div",{className:"fk:p-2",children:jsxs(b$3,{className:"fk:w-full",disabled:u$1.length===0||s,onClick:F?U:_,children:[s?jsx(LoaderCircle,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin"}):null,B]})})]})}function qe({overlay:e=false,row:n}){let[t,a]=useState(null),[i,f]=useState(null),c=A(),d=b$1(),b$2=n.original,v=b$2._id??"",u=b$2.url??"";function l(){c({type:"DeleteEntity",payload:{entityId:v,entityName:b.name}});}function s(p,E){navigator.clipboard.writeText(E),a(p),window.setTimeout(()=>a(null),1500);}return jsxs(Fragment,{children:[jsxs(e$2,{children:[jsx(g$1,{asChild:true,children:jsxs(b$3,{className:e?"fk:flex fk:h-7 fk:w-7 fk:p-0 fk:text-white fk:group-hover:bg-background/10 fk:group-hover:text-white! fk:data-[state=open]:bg-background/15":"fk:flex fk:h-8 fk:w-8 fk:p-0 fk:data-[state=open]:bg-muted",onClick:p=>p.stopPropagation(),variant:"ghost",children:[jsx(Ellipsis,{className:"fk:h-4 fk:w-4"}),jsx("span",{className:"fk:sr-only",children:"Open menu"})]})}),jsxs(h$2,{align:"start",className:"fk:w-45",children:[jsxs(j$2,{disabled:!v,onClick:p=>{p.stopPropagation(),s("id",v);},children:[t==="id"?jsx(Check,{className:"fk:mr-2 fk:h-4 fk:w-4"}):jsx(Copy,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Copy ID"]}),jsxs(j$2,{disabled:!u,onClick:p=>{p.stopPropagation(),s("url",u);},children:[t==="url"?jsx(Check,{className:"fk:mr-2 fk:h-4 fk:w-4"}):jsx(Link,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Copy URL"]}),jsx(o,{}),jsxs(j$2,{disabled:!v||!d,onClick:p=>{p.stopPropagation(),f("add");},children:[jsx(TagIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Add tag"]}),jsxs(j$2,{disabled:!v||!d,onClick:p=>{p.stopPropagation(),f("remove");},children:[jsx(MinusIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Remove tag"]}),jsx(o,{}),jsxs(j$2,{className:"fk:text-destructive",disabled:!v||!d,onClick:p=>{p.stopPropagation(),l();},children:[jsx(Trash2,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Delete"]})]})]}),i!==null?jsx(Ve,{assetIds:v?[v]:[],mode:i,onModeChange:f}):null]})}var bo=FileIcon,wo="fk:bg-[#fafafa] [--asset-checker:#f0f0f0] [background-image:linear-gradient(45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(-45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(45deg,transparent_75%,var(--asset-checker)_75%),linear-gradient(-45deg,transparent_75%,var(--asset-checker)_75%)] [background-position:0_0,0_4px,4px_-4px,-4px_0px] [background-size:8px_8px] fk:dark:bg-[#222] dark:[--asset-checker:#2a2a2a]";function Do(e){return Math.max(600,e)}function Co(e){return e==null||Number.isNaN(e)?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ot({columns:e,data:n,entityName:t$1,hasMore:a=false,isLoading:i=false,isLoadingMore:f=false,onLoadMore:c,onSortingChange:d,pageSize:b,sorting:v,toolbarComponent:u}){let l=useRef(null),{schemaErrorMessage:s$1}=s(),[M,p]=useState({}),[E,I]=useState({}),[J,x]=useState([]),[_,U]=useState([]),F=v??_;useEffect(()=>{l.current?.scrollTo({top:0});},[t$1]);function B(w){if(d){d(w);return}U(w);}let h=useReactTable({data:n,columns:e,state:{sorting:F,columnVisibility:E,rowSelection:M,columnFilters:J},initialState:{pagination:{pageSize:b??50}},enableRowSelection:true,onRowSelectionChange:p,onSortingChange:B,onColumnFiltersChange:x,onColumnVisibilityChange:I,getCoreRowModel:getCoreRowModel(),getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),getSortedRowModel:getSortedRowModel(),getRowId:w=>w._id,manualFiltering:true,manualPagination:true,manualSorting:true}),{rows:D}=h.getRowModel(),m=useRef(c),C=useRef(a),S=useRef(f);m.current=c,C.current=a,S.current=f;let z=useCallback(w=>{if(!m.current||!C.current||S.current)return;let P=w??l.current;if(!P)return;let{scrollHeight:r,scrollTop:V,clientHeight:X}=P;r-V-X>=Do(X)||m.current();},[]);useEffect(()=>{z();},[z,D.length,a,f]);function O(w){z(w.currentTarget);}return s$1?jsx(Fragment,{}):jsxs("div",{className:"fk:flex fk:h-full fk:min-h-0 fk:w-full fk:min-w-0 fk:flex-col fk:gap-4",children:[u?u(h):null,jsxs("div",{className:"fk:relative fk:min-h-0 fk:min-w-0 fk:flex-1",children:[f?jsx("div",{"aria-hidden":true,className:"fk:pointer-events-none fk:absolute fk:top-0 fk:right-px fk:left-px fk:z-20 fk:h-0.5 fk:overflow-hidden fk:opacity-40",children:jsx("div",{className:"fk:animate-progress fk:h-full fk:w-full fk:bg-foreground"})}):null,jsxs("div",{className:"fk:h-full fk:overflow-auto fk:pt-px fk:pb-20 fk:-ml-0.5 fk:pr-3",onScroll:O,ref:l,children:[i?jsx("div",{className:"fk:grid fk:grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] fk:gap-3",children:Array.from({length:b??50},(w,P)=>jsxs("div",{className:"fk:rounded-md fk:border fk:border-border fk:p-2 fk:corner-squircle",children:[jsx(t,{className:"fk:aspect-square fk:w-full fk:rounded-sm fk:corner-squircle"}),jsx(t,{className:"fk:mt-2 fk:h-3 fk:w-[75%]"}),jsx(t,{className:"fk:mt-1.5 fk:h-3 fk:w-[50%]"})]},`skeleton-${P}`))}):null,!i&&D.length===0?jsx("div",{className:"fk:flex fk:h-24 fk:items-center fk:justify-center fk:text-sm fk:text-muted-foreground",children:"No results."}):null,!i&&D.length>0?jsx("div",{className:"fk:grid fk:grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] fk:pl-0.5 fk:gap-3",children:D.map(w=>jsx(To,{row:w},w.id))}):null]})]})]})}function To({row:e}){let n=e.original,t=E(n)||"Untitled",a=n.mimeType??"",i=Co(n.size),f=e.getIsSelected(),c=[a,i].filter(Boolean).join(" \xB7 ");return jsxs("div",{className:`fk:relative fk:rounded-md fk:border fk:p-2 fk:transition-colors ${f?"fk:border-primary fk:ring-1 fk:ring-primary/40 fk:bg-muted/40":"fk:border-border fk:bg-background fk:hover:border-muted-foreground/30"} fk:corner-squircle`,"data-state":f?"selected":void 0,children:[jsx("div",{className:"fk:absolute fk:left-3 fk:top-3 fk:z-10 fk:mix-blend-difference",children:jsx(o$2,{className:"fk:border-white!","aria-label":`Select ${t}`,checked:f,onCheckedChange:d=>{e.toggleSelected(!!d);},onClick:d=>d.stopPropagation()})}),jsx("div",{className:"fk:group fk:absolute fk:right-2 fk:top-2 fk:z-10 fk:mix-blend-difference",children:jsx(qe,{overlay:true,row:e})}),jsx(So,{asset:n,filename:t}),jsx("div",{className:"fk:mt-2 fk:truncate fk:text-xs fk:font-medium",title:t,children:t}),c?jsx("div",{className:"fk:mt-0.5 fk:truncate fk:text-[11px] fk:text-muted-foreground",title:c,children:c}):null]})}function So({asset:e,filename:n}){let[t,a]=useState(false),[i$1,f]=useState(false),c=e.url??"";if(!c&&!e.path)return jsx("div",{className:"fk:flex fk:aspect-square fk:items-center fk:justify-center fk:rounded-sm fk:bg-muted fk:corner-squircle",children:jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:"No preview"})});if(!G(e)||!c){let s=F(e),M=defaultStyles[s];return jsx("div",{className:"fk:flex fk:aspect-square fk:items-center fk:justify-center fk:rounded-sm fk:bg-muted fk:[&>svg]:h-12 fk:[&>svg]:w-auto fk:corner-squircle",children:jsx(bo,{extension:s,...M||{}})})}let b=H(c,{width:320,height:320}),v=c;function u(s){s.stopPropagation(),f(false),a(true);}function l$1(s){a(s),s||f(false);}return jsxs(Fragment,{children:[jsx("button",{className:`fk:aspect-square fk:w-full fk:cursor-zoom-in fk:overflow-hidden fk:rounded-sm fk:border-0 fk:p-0 ${wo} fk:corner-squircle`,onClick:u,type:"button",children:jsx("img",{alt:n,className:"fk:h-full fk:w-full fk:object-contain",src:b})}),jsx(c$2,{open:t,onOpenChange:l$1,children:jsxs(h$1,{className:"fk:sm:max-w-4xl fk:p-3",children:[jsxs(i,{children:[jsx(k,{className:"fk:sr-only",children:"Asset preview"}),jsx(l,{className:"fk:sr-only",children:"Enlarged asset preview"})]}),jsxs("div",{className:"fk:relative fk:flex fk:h-[min(85vh,56rem)] fk:w-full fk:items-center fk:justify-center fk:overflow-hidden fk:rounded-md fk:corner-squircle",children:[i$1?null:jsx(LoaderCircle,{"aria-label":"Loading image",className:"fk:absolute fk:h-8 fk:w-8 fk:animate-spin fk:text-muted-foreground"}),jsx("img",{alt:n,className:`fk:max-h-full fk:max-w-full fk:object-contain fk:transition-opacity ${i$1?"fk:opacity-100":"fk:opacity-0"}`,onError:()=>f(true),onLoad:()=>f(true),src:v})]})]})})]})}var Oo=[{value:"image/gif",label:"GIF",icon:ImagePlayIcon},{value:"image/jpeg",label:"JPEG",icon:ImageIcon},{value:"video/mp4",label:"MP4",icon:FilePlayIcon},{value:"image/png",label:"PNG",icon:LayersIcon},{value:"image/svg+xml",label:"SVG",icon:SplinePointerIcon},{value:"image/webp",label:"WebP",icon:ImageIcon}];function Ze({entityName:e,isUploading:n=false,table:t,viewMode:a,onUploadClick:i,onViewModeChange:f$1,onSearchLoadingChange:c$1,onSearchWhereChange:d}){let b=t.getState().columnFilters.length>0,{projectId:v}=useParams(),u$1=A(),{scope:l}=c(),[s,M]=useState(null),{currentProjectSchema:p}=f(),E=b$1(),[I,J]=useState(""),x=useRef({}),_=useRef({});function U(){return {searchRequests:{searches:[{collection:"_assets"},{collection:"_tags"}]},commonParams:{q:""}}}let F=useMemo(()=>U(),[]),[B$1,h]=useState(F),{results:D,isLoading:m}=a$1(v??"",B$1),C=useRef(""),S=I.trim(),z=B$1.commonParams.q??"",O=S.length>0&&(m||z!==S),w=useMemo(()=>Uo(g=>{h({...F,commonParams:{q:g}});},300),[F]);useEffect(()=>()=>{w.cancel();},[w]);let P=t.getSelectedRowModel().rows.map(g=>g.original._id),{data:r}=u({entityNamePlural:"_tags",schema:p,scope:l,variables:we,...Y}),V=useMemo(()=>(Array.isArray(r)?r:[]).map(N=>({_id:N._id,name:N.name})),[r]),X$1=useMemo(()=>V.map(g=>({value:g._id,label:g.name})),[V]),L=useCallback(()=>{if(!d)return;let g=[];Object.keys(x.current).length>0&&g.push(x.current),Object.keys(_.current).length>0&&g.push(_.current);let N=g.length===0?{}:g.length===1?g[0]:{AND:g},Z=JSON.stringify(N);C.current!==Z&&(C.current=Z,d(N));},[d]);function j(){w.cancel(),J(""),h({...F,commonParams:{q:""}}),x.current={},L();}async function K(){u$1({type:"AlertDialog",payload:{options:{dialogTitle:`Delete ${P.length} asset${P.length>1?"s":""}`,dialogMessage:P.length>1?"Are you sure you want to delete the selected assets? They will be deleted permanently.":"Are you sure you want to delete the selected asset? The item will be deleted permanently.",dialogCancelTitle:"Cancel",dialogActionLabel:"Delete",isDestructive:true,dialogActionCancel:()=>{},dialogActionSubmit:()=>{u$1({type:"DeleteEntity",_id:`delete-batch-${Date.now()}`,payload:{entityId:P,entityName:e,silent:true}}),t.resetRowSelection();}}}});}useEffect(()=>{c$1?.(O);},[O,c$1]),useEffect(()=>{if(!d)return;if(S.length===0){x.current={},L();return}if(O)return;let g=D??[],N={};if(g.length===0)N={_id:{in:[]}};else {let Z=g.filter(q=>q._entityNamePlural==="_assets").map(q=>q._id),xe=g.filter(q=>q._entityNamePlural==="_tags").map(q=>({tags:{some:{_id:{eq:q._id}}}})),Q=[];Z.length>0&&Q.push({_id:{in:Z}}),Q.push(...xe),Q.length===0?N={_id:{in:[]}}:Q.length===1?N=Q[0]:N={OR:Q};}x.current=N,L();},[L,O,d,D,S]);let y=JSON.stringify(t.getState().columnFilters);return useEffect(()=>{if(!d)return;let g=t.getState().columnFilters.find(q=>q.id==="mimeType"),N=Array.isArray(g?.value)?g?.value:[],Z=t.getState().columnFilters.find(q=>q.id==="tags"),xe=Array.isArray(Z?.value)?Z?.value:[],Q=[];if(N.length>0&&Q.push({mimeType:{in:N}}),xe.length>0){let q=xe.map(Ht=>({tags:{some:{_id:{eq:Ht}}}}));Q.push(q.length===1?q[0]:{OR:q});}Q.length===0?_.current={}:Q.length===1?_.current=Q[0]:_.current={AND:Q},L();},[y,L,d,t]),jsxs("div",{className:"fk:flex fk:items-center fk:justify-between fk:pr-3",children:[jsxs("div",{className:"fk:flex fk:flex-1 fk:items-center fk:space-x-2",children:[jsxs("div",{className:"fk:relative",children:[m?jsx(LoaderCircle,{className:"fk:absolute fk:left-2 fk:top-2 fk:h-4 fk:w-4 fk:shrink-0 fk:opacity-50 fk:animate-spin"}):jsx(Search,{className:"fk:absolute fk:left-2 fk:top-2 fk:h-4 fk:w-4 fk:shrink-0 fk:opacity-50"}),jsx(s$1,{placeholder:"Search assets...",name:"search-assets",value:I,onChange:g=>{let{value:N}=g.target;if(J(N),N.trim().length===0){j();return}w(N.trim());},className:"fk:h-8 fk:w-37.5 fk:lg:w-70 fk:px-7"}),I?jsx(b$3,{"aria-label":"Clear search",className:"fk:absolute fk:right-1 fk:top-1 fk:h-6 fk:w-6 fk:text-muted-foreground fk:hover:text-foreground fk:hover:bg-foreground/10 fk:cursor-pointer fk:rounded-full fk:bg-transparent fk:corner-squircle",onClick:j,type:"button",children:jsx(X,{className:"fk:h-4 fk:w-4"})}):null]}),t.getColumn("mimeType")&&jsx(a$2,{column:t.getColumn("mimeType"),options:Oo,title:"File type"}),t.getColumn("tags")&&jsx(a$2,{column:t.getColumn("tags"),options:X$1,title:"Tags"}),b&&jsxs(b$3,{variant:"ghost",onClick:()=>{t.resetColumnFilters(),_.current={},L();},className:"fk:h-8 fk:px-2 fk:lg:px-3",children:["Reset",jsx(X,{className:"fk:ml-2 fk:h-4 fk:w-4"})]}),jsx(B,{table:t})]}),P.length>0?jsx("div",{className:"fk:flex fk:items-center fk:gap-2",children:jsxs(e$2,{children:[jsx(ma,{disabled:!E,children:jsx(g$1,{asChild:true,children:jsxs(b$3,{className:"fk:h-8 fk:mr-2 fk:lg:flex",disabled:!E,size:"sm",variant:"secondary",children:["Actions ",jsx(ListChecks,{className:"fk:ml-2 fk:h-4 fk:w-4"})]})})}),jsxs(h$2,{align:"end",className:"fk:w-[240px]",children:[jsxs(j$2,{onClick:()=>M("add"),children:[jsx(TagIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Add tag"]}),jsxs(j$2,{onClick:()=>M("remove"),children:[jsx(MinusIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Remove tag"]}),jsx(o,{}),jsxs(j$2,{onClick:K,className:"fk:text-destructive",children:[jsx(Trash2Icon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Delete asset",P.length>1?"s":""," (",P.length,")"]})]})]})}):null,jsxs("div",{className:"fk:ml-auto fk:flex fk:items-center fk:gap-2",children:[jsxs(c$4,{size:"sm",type:"single",value:a,onValueChange:g=>{(g==="list"||g==="grid")&&f$1(g);},children:[jsx(d$1,{"aria-label":"Grid view",value:"grid",children:jsx(LayoutGrid,{className:"fk:h-4 fk:w-4"})}),jsx(d$1,{"aria-label":"List view",value:"list",children:jsx(List,{className:"fk:h-4 fk:w-4"})})]}),jsx(ma,{disabled:!E,children:jsxs(b$3,{"aria-busy":n,className:"fk:h-8 fk:lg:flex",disabled:!E||n,onClick:i,size:"sm",variant:"default",children:[n?jsx(LoaderCircle,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin"}):null,"Upload assets"]})})]}),s!==null?jsx(Ve,{assetIds:P,mode:s,onCompleted:()=>t.resetRowSelection(),onModeChange:M}):null]})}function Uo(e,n=300){let t,a=function(...i){t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,e.apply(this,i);},n);};return a.cancel=()=>{t!==void 0&&(clearTimeout(t),t=void 0);},a}var Qo=4*1024*1024;function Gt(){let{projectId:e}=useParams(),n=c$3(),t=b$1(),[a,i]=useState(false);async function f(c){if(!(!t||a)&&!(c&&c.length===0))try{await n({files:c,maxBytes:Qo,multiple:!0,onUploadStart:()=>{i(!0);},projectId:e});}finally{i(false);}}return {canMutate:t,isUploading:a,uploadFiles:c=>f(c),uploadFromDialog:()=>f()}}var Wt="flexkit-asset-manager:viewMode";function $t(){if(typeof localStorage>"u")return "grid";try{let e=localStorage.getItem(Wt);if(e==="list"||e==="grid")return e}catch{}return "grid"}function Jt(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(Wt,e);}catch{}}var Me=36,Jo=[{_updatedAt:"DESC"},{_id:"DESC"}];function Xt(){let e="_assets",{search:n}=useLocation(),a=new URLSearchParams(n).get("id"),{scope:i}=c(),{schemaErrorMessage:f$1}=s(),{currentProject:c$1}=f(),d=c$1?.schema??[],[b$1,v$1]=useState([]),[u$1,l]=useState(()=>$t()),s$1=J({attributesSchema:b.attributes,actionsComponent:y=>jsx(qe,{row:y}),checkboxSelect:"multiple",enableColumnSorting:true}),[M,p]=useState({}),[E,I]=useState(false),{canMutate:J$1,isUploading:x,uploadFiles:_,uploadFromDialog:U}=Gt(),F=useMemo(()=>{let y=a?{_id:{eq:a}}:{NOT:{path:{eq:null}}};return !M||Object.keys(M).length===0||a?y:{AND:[y,M]}},[a,M]),B=useMemo(()=>{if(b$1.length===0)return Jo;let y=b$1.map(({id:N,desc:Z})=>({[N]:Z?"DESC":"ASC"}));return y.some(N=>"_id"in N)?y:[...y,{_id:"DESC"}]},[b$1]),h=useMemo(()=>({where:F,offset:0,limit:Me,sort:B}),[F,B]);function D(y){v$1(y);}function m(y){l(y),Jt(y);}let{isLoading:C,isLoadingMore:S,fetchMore:z,count:O,data:w$1,isProjectDisabled:P}=u({entityNamePlural:e,schema:d,scope:i,variables:h,selection:"list"}),r=E||C&&(w$1==null||w$1.length===0),V=w$1?.length??0,X=!E&&O>0&&V>0&&V<O,L=useCallback(()=>{z({variables:{offset:0,limit:Me}});},[z]),j=useMemo(()=>Array.from({length:Me},(y,g)=>({_id:`loading-${g}`})),[]),K=useMemo(()=>Xo(s$1),[s$1]);return P?jsx("div",{className:"fk:flex fk:flex-col fk:h-full fk:pl-3",children:jsx(v,{})}):jsxs("div",{className:"fk:flex fk:flex-col fk:h-full fk:pl-3",children:[jsx(w,{}),jsxs("div",{className:"fk:mb-4 fk:flex fk:items-center fk:gap-2 fk:pr-3",children:[jsx("h2",{className:"fk:text-lg fk:font-semibold fk:leading-none fk:tracking-tight",children:"Asset Manager"}),r?null:jsxs("span",{className:"fk:ml-auto fk:text-sm fk:font-normal fk:text-muted-foreground",children:[O.toLocaleString()," ",O===1?"record":"records"]})]}),f$1?null:jsx(_t,{disabled:!J$1||x,onDropFiles:_,children:u$1==="list"?jsx(x$1,{classNames:{row:"fk:h-20"},columns:r?K:s$1,data:r?j:w$1??[],entityName:b.name,hasMore:X,isLoadingMore:S,pageSize:Me,sorting:b$1,onLoadMore:L,onSortingChange:D,toolbarComponent:y=>jsx(Ze,{entityName:b.name,isUploading:x,table:y,viewMode:u$1,onSearchLoadingChange:I,onSearchWhereChange:p,onUploadClick:U,onViewModeChange:m})}):jsx(Ot,{columns:s$1,data:r?[]:w$1??[],entityName:b.name,hasMore:X,isLoading:r,isLoadingMore:S,pageSize:Me,sorting:b$1,onLoadMore:L,onSortingChange:D,toolbarComponent:y=>jsx(Ze,{entityName:b.name,isUploading:x,table:y,viewMode:u$1,onSearchLoadingChange:I,onSearchWhereChange:p,onUploadClick:U,onViewModeChange:m})})}),jsx(Outlet,{})]})}function Xo(e){return e.map(n=>({...n,cell:()=>jsx(t,{className:"fk:h-4 fk:w-full",style:{marginTop:"7px",marginBottom:"6px"}})}))}function On(){return jsxs(x,{orientation:"horizontal",className:"fk:h-full",children:[jsx(y,{className:"fk:p-3",defaultSize:"82%",children:jsx("div",{className:"fk:flex fk:flex-col fk:h-full",children:jsx(Xt,{})})}),jsx(z,{className:"fk:hover:bg-blue-500 fk:transition-colors",withHandle:true}),jsx(y,{defaultSize:"18%",minSize:"10%",children:jsx("div",{className:"fk:sm:hidden fk:md:block",children:jsx(Et,{})})})]})}export{On as Root};//# sourceMappingURL=root-A4VHAEK5.js.map
|
|
23
|
+
//# sourceMappingURL=root-A4VHAEK5.js.map
|