@flexkit/studio 0.2.36 → 0.2.37
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-NDVHLH5Q.js → chat-page-XYQOQPMW.js} +3 -3
- package/dist/{chat-page-NDVHLH5Q.js.map → chat-page-XYQOQPMW.js.map} +1 -1
- package/dist/{chunk-FXUD4JRG.js → chunk-337GX2BR.js} +2 -2
- package/dist/{chunk-FXUD4JRG.js.map → chunk-337GX2BR.js.map} +1 -1
- package/dist/{chunk-VIBGMCLS.js → chunk-36YXPN42.js} +2 -2
- package/dist/{chunk-VIBGMCLS.js.map → chunk-36YXPN42.js.map} +1 -1
- package/dist/{chunk-FF5EBXYN.js → chunk-6NRMVVU4.js} +3 -3
- package/dist/{chunk-FF5EBXYN.js.map → chunk-6NRMVVU4.js.map} +1 -1
- package/dist/{chunk-LXLEUEWT.js → chunk-AQSL5HBZ.js} +2 -2
- package/dist/{chunk-LXLEUEWT.js.map → chunk-AQSL5HBZ.js.map} +1 -1
- package/dist/{chunk-NKDQQHCL.js → chunk-BHHLWGZ4.js} +2 -2
- package/dist/{chunk-NKDQQHCL.js.map → chunk-BHHLWGZ4.js.map} +1 -1
- package/dist/{chunk-TWA6OG5U.js → chunk-CC2U7ASG.js} +3 -3
- package/dist/{chunk-TWA6OG5U.js.map → chunk-CC2U7ASG.js.map} +1 -1
- package/dist/{chunk-HXPETSXC.js → chunk-CRTUZ22E.js} +3 -3
- package/dist/{chunk-HXPETSXC.js.map → chunk-CRTUZ22E.js.map} +1 -1
- package/dist/{chunk-FJS4SN3K.js → chunk-DO32GATF.js} +3 -3
- package/dist/{chunk-FJS4SN3K.js.map → chunk-DO32GATF.js.map} +1 -1
- package/dist/{chunk-LTM3MW2D.js → chunk-KOM7G7WT.js} +2 -2
- package/dist/{chunk-LTM3MW2D.js.map → chunk-KOM7G7WT.js.map} +1 -1
- package/dist/{chunk-GTR4M2BQ.js → chunk-ND2RTUMM.js} +3 -3
- package/dist/{chunk-GTR4M2BQ.js.map → chunk-ND2RTUMM.js.map} +1 -1
- package/dist/{chunk-2PBDHGRR.js → chunk-OWY5BQER.js} +2 -2
- package/dist/{chunk-2PBDHGRR.js.map → chunk-OWY5BQER.js.map} +1 -1
- package/dist/{chunk-OJ4RI6IQ.js → chunk-PNGPE7QM.js} +3 -3
- package/dist/{chunk-OJ4RI6IQ.js.map → chunk-PNGPE7QM.js.map} +1 -1
- package/dist/{chunk-27JTWTU6.js → chunk-RGISZNQ2.js} +2 -2
- package/dist/{chunk-27JTWTU6.js.map → chunk-RGISZNQ2.js.map} +1 -1
- package/dist/{chunk-SOA2F7Z6.js → chunk-RX6QUDLZ.js} +3 -3
- package/dist/{chunk-SOA2F7Z6.js.map → chunk-RX6QUDLZ.js.map} +1 -1
- package/dist/{chunk-MHEFVYKP.js → chunk-U4DUXPZV.js} +2 -2
- package/dist/{chunk-MHEFVYKP.js.map → chunk-U4DUXPZV.js.map} +1 -1
- package/dist/{chunk-474MQNDK.js → chunk-UULPCFWK.js} +3 -3
- package/dist/{chunk-474MQNDK.js.map → chunk-UULPCFWK.js.map} +1 -1
- package/dist/{chunk-CGMKGENV.js → chunk-XV4QJKOJ.js} +2 -2
- package/dist/{chunk-CGMKGENV.js.map → chunk-XV4QJKOJ.js.map} +1 -1
- package/dist/chunk-ZV7I5RUM.js +10 -0
- package/dist/chunk-ZV7I5RUM.js.map +1 -0
- package/dist/{entry-XHH3NKN2.js → entry-6EWYXIS5.js} +2 -2
- package/dist/{entry-XHH3NKN2.js.map → entry-6EWYXIS5.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/{list-R64THLZD.js → list-GBM53HFN.js} +2 -2
- package/dist/{list-R64THLZD.js.map → list-GBM53HFN.js.map} +1 -1
- package/dist/{list-XIE55HYD.js → list-N5W7G3LD.js} +3 -3
- package/dist/{list-XIE55HYD.js.map → list-N5W7G3LD.js.map} +1 -1
- package/dist/{pages-OWXBU64L.js → pages-HPR3UHT7.js} +3 -3
- package/dist/{pages-OWXBU64L.js.map → pages-HPR3UHT7.js.map} +1 -1
- package/dist/{plugin-pages-JBJQHBIN.js → plugin-pages-VDRT7RLY.js} +2 -2
- package/dist/{plugin-pages-JBJQHBIN.js.map → plugin-pages-VDRT7RLY.js.map} +1 -1
- package/dist/{project-selector-L2WZ3MB5.js → project-selector-RRG52TSX.js} +2 -2
- package/dist/{project-selector-L2WZ3MB5.js.map → project-selector-RRG52TSX.js.map} +1 -1
- package/dist/record-links-CI4OJPWW.js +2 -0
- package/dist/{record-links-BEKOPDDR.js.map → record-links-CI4OJPWW.js.map} +1 -1
- package/dist/{root-RUOT5OSO.js → root-DF2BNGOF.js} +3 -3
- package/dist/{root-RUOT5OSO.js.map → root-DF2BNGOF.js.map} +1 -1
- package/dist/{root-VLD6GNZL.js → root-IXK2ESCS.js} +3 -3
- package/dist/{root-VLD6GNZL.js.map → root-IXK2ESCS.js.map} +1 -1
- package/dist/{root-B5XP6VYU.js → root-JFYE2JRJ.js} +2 -2
- package/dist/{root-B5XP6VYU.js.map → root-JFYE2JRJ.js.map} +1 -1
- package/dist/{root-I22KNOFC.js → root-KF6EFGM6.js} +3 -3
- package/dist/{root-I22KNOFC.js.map → root-KF6EFGM6.js.map} +1 -1
- package/dist/{root-O4DMQLEH.js → root-LUWJS7SQ.js} +2 -2
- package/dist/{root-O4DMQLEH.js.map → root-LUWJS7SQ.js.map} +1 -1
- package/dist/{root-DUQULYRX.js → root-RGAV2YAF.js} +2 -2
- package/dist/{root-DUQULYRX.js.map → root-RGAV2YAF.js.map} +1 -1
- package/dist/{search-4UQR6ENH.js → search-DQLC3XDJ.js} +2 -2
- package/dist/{search-4UQR6ENH.js.map → search-DQLC3XDJ.js.map} +1 -1
- package/dist/{skills-pages-VUIOUEYQ.js → skills-pages-Q4YUDTC2.js} +2 -2
- package/dist/{skills-pages-VUIOUEYQ.js.map → skills-pages-Q4YUDTC2.js.map} +1 -1
- package/dist/{source-L54C4T3X.js → source-J3ZCTEWZ.js} +2 -2
- package/dist/{source-L54C4T3X.js.map → source-J3ZCTEWZ.js.map} +1 -1
- package/package.json +5 -5
- package/dist/chunk-YJ4NWJCC.js +0 -10
- package/dist/chunk-YJ4NWJCC.js.map +0 -1
- package/dist/record-links-BEKOPDDR.js +0 -2
|
@@ -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-KOM7G7WT.js';import'./chunk-QSTWBKPN.js';import'./chunk-L5Z56DDM.js';import'./chunk-PLCI2RJA.js';import'./chunk-7KLXWCDS.js';import'./chunk-HKN6BX5U.js';import'./chunk-CC2U7ASG.js';import'./chunk-MBBE4RND.js';import'./chunk-5CVDMZUI.js';import'./chunk-RULCANNM.js';import'./chunk-A4DPLZZF.js';import'./chunk-G5N6HEPW.js';import'./chunk-5JUG4BEF.js';import'./chunk-S7Z6KKIN.js';import'./chunk-U45E5X3H.js';import'./chunk-N33S7BSG.js';import'./chunk-X3SHNHHM.js';//# sourceMappingURL=plugin-pages-VDRT7RLY.js.map
|
|
2
|
+
//# sourceMappingURL=plugin-pages-VDRT7RLY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"plugin-pages-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"plugin-pages-VDRT7RLY.js"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./index.css';import {a,b,d as d$1}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=project-selector-
|
|
1
|
+
import'./index.css';import {a,b,d as d$1}from'./chunk-AQSL5HBZ.js';export{a as getProjectLabel}from'./chunk-AQSL5HBZ.js';import'./chunk-ND2RTUMM.js';import {f}from'./chunk-CC2U7ASG.js';import'./chunk-MBBE4RND.js';import'./chunk-5CVDMZUI.js';import'./chunk-G5N6HEPW.js';import {a as a$1,d,c,e,b as b$1,f as f$1,g,h,k,p,q as q$1,s,t}from'./chunk-S7Z6KKIN.js';import'./chunk-U45E5X3H.js';import'./chunk-X3SHNHHM.js';import {useState}from'react';import {useNavigate}from'react-router-dom';import {Plus}from'lucide-react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';var _="__new_project__";function q({projectId:i,projectIds:v,projectSummaries:a$2=[],projects:s$1}){let L=useNavigate(),{mode:E,teams:V}=f(),[m,r]=useState(false),p$1=a(i,s$1,a$2),J=b(v,a$2),g$1=E==="hosted";return jsxs(Fragment,{children:[jsxs(a$1,{onValueChange:o=>{if(o===_){r(true);return}L(`/${o}`);},value:i,children:[jsx(d,{className:"fk:w-48! fk:h-9 fk:py-1",id:"project",children:jsx(c,{"aria-label":p$1,children:p$1})}),jsxs(e,{children:[J.map((o,U)=>jsxs(b$1,{children:[o.label?jsx(f$1,{children:o.label}):null,o.projectIds.map(c=>jsx(g,{value:c,children:a(c,s$1,a$2)},c))]},o.label??U)),g$1?jsxs(Fragment,{children:[jsx(h,{}),jsxs(g,{value:_,children:[jsx(Plus,{className:"fk:h-4 fk:w-4"}),"New project"]})]}):null]})]}),g$1?jsx(k,{onOpenChange:r,open:m,children:jsxs(p,{className:"fk:sm:max-w-md",children:[jsxs(q$1,{children:[jsx(s,{children:"New project"}),jsx(t,{children:"Projects start on the Free plan. Start from the commerce starter, or let the AI agent design the schema with you."})]}),m?jsx(d$1,{onCancel:()=>{r(false);},onCreated:()=>{r(false);},teams:V}):null]})}):null]})}export{q as ProjectSelector};//# sourceMappingURL=project-selector-RRG52TSX.js.map
|
|
2
|
+
//# sourceMappingURL=project-selector-RRG52TSX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/components/project-selector.tsx"],"names":["NEW_PROJECT_VALUE","ProjectSelector","projectId","projectIds","projectSummaries","projects","navigate","useNavigate","mode","teams","useConfig","isCreating","setIsCreating","useState","label","getProjectLabel","groups","groupProjectIdsByTeam","canCreate","jsxs","Fragment","Select","id","jsx","SelectTrigger","SelectValue","SelectContent","group","index","SelectGroup","SelectLabel","SelectItem","SelectSeparator","Plus","Dialog","DialogContent","DialogHeader","DialogTitle","DialogDescription","NewProjectFlow"],"mappings":"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","file":"project-selector-
|
|
1
|
+
{"version":3,"sources":["../src/ui/components/project-selector.tsx"],"names":["NEW_PROJECT_VALUE","ProjectSelector","projectId","projectIds","projectSummaries","projects","navigate","useNavigate","mode","teams","useConfig","isCreating","setIsCreating","useState","label","getProjectLabel","groups","groupProjectIdsByTeam","canCreate","jsxs","Fragment","Select","id","jsx","SelectTrigger","SelectValue","SelectContent","group","index","SelectGroup","SelectLabel","SelectItem","SelectSeparator","Plus","Dialog","DialogContent","DialogHeader","DialogTitle","DialogDescription","NewProjectFlow"],"mappings":"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","file":"project-selector-RRG52TSX.js","sourcesContent":["import { useState, type JSX } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { Plus } from 'lucide-react';\nimport { useConfig } from '../../core/config/config-context';\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../primitives/dialog';\nimport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from '../primitives/select';\nimport type { ProjectSummary, ProjectUiConfig } from '../../core/config/types';\nimport { NewProjectFlow } from './new-project-flow';\nimport { getProjectLabel, groupProjectIdsByTeam } from './project-label';\n\n/** Select value of the \"New project\" entry; project ids are ten lowercase characters, so it cannot collide. */\nconst NEW_PROJECT_VALUE = '__new_project__';\n\nexport { getProjectLabel } from './project-label';\n\ntype Props = {\n projectId: string;\n /** Every project the Studio can open, loaded or not. */\n projectIds: string[];\n /** Hosted mode: names and teams known before any schema loads. */\n projectSummaries?: ProjectSummary[];\n /** Projects whose schema has loaded; used for titles. */\n projects: ProjectUiConfig[];\n};\n\nexport function ProjectSelector({ projectId, projectIds, projectSummaries = [], projects }: Props): JSX.Element {\n const navigate = useNavigate();\n const { mode, teams } = useConfig();\n const [isCreating, setIsCreating] = useState(false);\n const label = getProjectLabel(projectId, projects, projectSummaries);\n const groups = groupProjectIdsByTeam(projectIds, projectSummaries);\n // Projects are created from the hosted Studio only; a self-hosted Studio lists fixed project ids.\n const canCreate = mode === 'hosted';\n\n return (\n <>\n <Select\n onValueChange={(id) => {\n if (id === NEW_PROJECT_VALUE) {\n setIsCreating(true);\n\n return;\n }\n\n navigate(`/${id}`);\n }}\n value={projectId}\n >\n <SelectTrigger className=\"fk:w-48! fk:h-9 fk:py-1\" id=\"project\">\n <SelectValue aria-label={label}>{label}</SelectValue>\n </SelectTrigger>\n <SelectContent>\n {groups.map((group, index) => (\n <SelectGroup key={group.label ?? index}>\n {group.label ? <SelectLabel>{group.label}</SelectLabel> : null}\n {group.projectIds.map((id) => (\n <SelectItem key={id} value={id}>\n {getProjectLabel(id, projects, projectSummaries)}\n </SelectItem>\n ))}\n </SelectGroup>\n ))}\n {canCreate ? (\n <>\n <SelectSeparator />\n <SelectItem value={NEW_PROJECT_VALUE}>\n <Plus className=\"fk:h-4 fk:w-4\" />\n New project\n </SelectItem>\n </>\n ) : null}\n </SelectContent>\n </Select>\n {canCreate ? (\n <Dialog onOpenChange={setIsCreating} open={isCreating}>\n <DialogContent className=\"fk:sm:max-w-md\">\n <DialogHeader>\n <DialogTitle>New project</DialogTitle>\n <DialogDescription>\n Projects start on the Free plan. Start from the commerce starter, or let the AI agent design the schema\n with you.\n </DialogDescription>\n </DialogHeader>\n {isCreating ? (\n <NewProjectFlow\n onCancel={() => {\n setIsCreating(false);\n }}\n onCreated={() => {\n setIsCreating(false);\n }}\n teams={teams}\n />\n ) : null}\n </DialogContent>\n </Dialog>\n ) : null}\n </>\n );\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./index.css';export{a as EntityKnowledgeButton,c as LinkedRecordsSection,b as RecordKnowledgePanel}from'./chunk-BHHLWGZ4.js';import'./chunk-36YXPN42.js';import'./chunk-4ZWQ44NZ.js';import'./chunk-337GX2BR.js';import'./chunk-DSLPTDZX.js';import'./chunk-UULPCFWK.js';import'./chunk-OWY5BQER.js';import'./chunk-7KLXWCDS.js';import'./chunk-HKN6BX5U.js';import'./chunk-DO32GATF.js';import'./chunk-CC2U7ASG.js';import'./chunk-MBBE4RND.js';import'./chunk-5CVDMZUI.js';import'./chunk-RULCANNM.js';import'./chunk-A4DPLZZF.js';import'./chunk-G5N6HEPW.js';import'./chunk-5JUG4BEF.js';import'./chunk-S7Z6KKIN.js';import'./chunk-U45E5X3H.js';import'./chunk-N33S7BSG.js';import'./chunk-X3SHNHHM.js';//# sourceMappingURL=record-links-CI4OJPWW.js.map
|
|
2
|
+
//# sourceMappingURL=record-links-CI4OJPWW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"record-links-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"record-links-CI4OJPWW.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import'./index.css';import {a as a$1}from'./chunk-CLCIE5RF.js';import {c as c$3,a as a$5}from'./chunk-
|
|
1
|
+
import'./index.css';import {a as a$1}from'./chunk-CLCIE5RF.js';import {c as c$3,a as a$5}from'./chunk-RGISZNQ2.js';import {a as a$4}from'./chunk-VFV44YZB.js';import {a as a$3}from'./chunk-U4DUXPZV.js';import {m,a,b as b$1,d,f as f$1,e as e$4,c as c$5,h as h$2,j as j$3,i as i$2,k as k$1}from'./chunk-CRTUZ22E.js';import {b as b$5}from'./chunk-CAZ6EUR2.js';import'./chunk-2DXR5NJV.js';import {e as e$1}from'./chunk-337GX2BR.js';import {b as b$2}from'./chunk-DSLPTDZX.js';import {e,j as j$1}from'./chunk-UULPCFWK.js';import {c}from'./chunk-OWY5BQER.js';import {o,i,m as m$1,l}from'./chunk-DO32GATF.js';import {f,b}from'./chunk-CC2U7ASG.js';import'./chunk-MBBE4RND.js';import'./chunk-5CVDMZUI.js';import {v,w,x,ja,c as c$4,d as d$1,n}from'./chunk-RULCANNM.js';import {e as e$3,g,h,j,o as o$1,t as t$1}from'./chunk-A4DPLZZF.js';import {b as b$4}from'./chunk-G5N6HEPW.js';import {m as m$2,d as d$2,e as e$5,f as f$2,g as g$1,h as h$1,j as j$2,i as i$1}from'./chunk-5JUG4BEF.js';import {k,l as l$1,p,q,s,t,r}from'./chunk-S7Z6KKIN.js';import'./chunk-U45E5X3H.js';import {a as a$2,b as b$3,c as c$1,e as e$2}from'./chunk-N33S7BSG.js';import {c as c$2}from'./chunk-X3SHNHHM.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 be={where:{},limit:500,offset:0,sort:[{name:"ASC"}]},Y={selection:"display",includeCount:false};function Pt(){let{scope:e}=c(),{currentProjectSchema:n}=f(),[t$1,s$1,r$1]=f$1(),[f$2,l$2]=useState(""),[u,D]=useState(false),[v,g$1]=useState(false),[I,i$1]=useState(null),[A,d]=useState(false),[_,x]=useState(null),[J,M]=useState(""),[P,O]=useState(false),[R,B]=useState(false),k$1=b$2(),w="_tag",c$3="_tags",{data:b,isLoading:T}=e$1({entityNamePlural:c$3,schema:n,scope:e,variables:be,...Y}),z=(Array.isArray(b)?b:[]).map(a=>{let U=a;return {_id:U._id,name:U.name}}),L=useCallback(async()=>{let a=f$2.trim();if(!a)return;O(true);let U=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}`,F=o(c$3,n,{name:{value:a,disabled:false,scope:"default"}},U),j=i(c$3,e,n,Y),K=gql`
|
|
2
2
|
${j.query}
|
|
3
3
|
`;await new Promise(h=>{s$1(gql`
|
|
4
4
|
${F}
|
|
@@ -19,5 +19,5 @@ import'./index.css';import {a as a$1}from'./chunk-CLCIE5RF.js';import {c as c$3,
|
|
|
19
19
|
${w}
|
|
20
20
|
`),D({variables:{where:{_id:{in:e}}},onCompleted:T=>{M(T),c();},onError:T=>b(T)}),l$1(!0);}),s?.(),x(),t(null);}catch{}finally{A(false);}}},[M,e,i,s,t,x,l$1,v,r,g,u,D]),O=useCallback(async()=>{if(!(e.length===0||g.length===0||i)){A(true);try{let k={tags:{relationships:{disconnect:g},disabled:!1,scope:r}},w=l("_assets",e[0]??"",r,v,{},k,{responseFields:Ft});await new Promise((c,b)=>{u(gql`
|
|
21
21
|
${w}
|
|
22
|
-
`),D({variables:{where:{_id:{in:e}}},onCompleted:T=>{M(T),c();},onError:T=>b(T)}),l$1(!0);}),s?.(),x(),t(null);}catch{}finally{A(false);}}},[M,e,i,s,t,x,l$1,v,r,g,u,D]),R=n==="remove",B=R?"Remove tag(s)":"Add tag(s)";return e.length>1&&(B=R?"Remove tag(s) from selected assets":"Add tag(s) to selected assets"),jsxs(d$2,{open:n!==null,onOpenChange:J,children:[jsx(e$5,{placeholder:"Search tags..."}),jsxs(f$2,{className:"fk:h-75",children:[jsx(g$1,{children:"No tags found."}),jsx(h$1,{heading:"Tags",children:_.map(k=>{let w=g.includes(k._id);return jsxs(j$2,{disabled:i,onSelect:()=>{i||I(c=>w?c.filter(b=>b!==k._id):[...c,k._id]);},children:[jsx("input",{className:"fk:mr-2",checked:w,onChange:()=>{},type:"checkbox"}),k.name]},k._id)})})]}),jsx(i$1,{}),jsx("div",{className:"fk:p-2",children:jsxs(c$2,{className:"fk:w-full",disabled:g.length===0||i,onClick:R?O:P,children:[i?jsx(LoaderCircle,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin"}):null,B]})})]})}function Ve({overlay:e=false,row:n}){let[t,s]=useState(null),[r,f]=useState(null),l=j$1(),u=b$2(),D=n.original,v=D._id??"",g$1=D.url??"";function I(){l({type:"DeleteEntity",payload:{entityId:v,entityName:b.name}});}function i(d,_){navigator.clipboard.writeText(_),s(d),window.setTimeout(()=>s(null),1500);}return jsxs(Fragment,{children:[jsxs(e$3,{children:[jsx(g,{asChild:true,children:jsxs(c$2,{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:d=>d.stopPropagation(),variant:"ghost",children:[jsx(Ellipsis,{className:"fk:h-4 fk:w-4"}),jsx("span",{className:"fk:sr-only",children:"Open menu"})]})}),jsxs(h,{align:"start",className:"fk:w-45",children:[jsxs(j,{disabled:!v,onClick:d=>{d.stopPropagation(),i("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,{disabled:!g$1,onClick:d=>{d.stopPropagation(),i("url",g$1);},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$1,{}),jsxs(j,{disabled:!v||!u,onClick:d=>{d.stopPropagation(),f("add");},children:[jsx(TagIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Add tag"]}),jsxs(j,{disabled:!v||!u,onClick:d=>{d.stopPropagation(),f("remove");},children:[jsx(MinusIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Remove tag"]}),jsx(o$1,{}),jsxs(j,{className:"fk:text-destructive",disabled:!v||!u,onClick:d=>{d.stopPropagation(),I();},children:[jsx(Trash2,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Delete"]})]})]}),r!==null?jsx(Le,{assetIds:v?[v]:[],mode:r,onModeChange:f}):null]})}var ho=FileIcon,yo="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 vo(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 Ut({columns:e$1,data:n,entityName:t,hasMore:s=false,isLoading:r=false,isLoadingMore:f=false,onLoadMore:l,onSortingChange:u,pageSize:D,sorting:v,toolbarComponent:g}){let I=useRef(null),{schemaErrorMessage:i}=e(),[A,d]=useState({}),[_,x]=useState({}),[J,M]=useState([]),[P,O]=useState([]),R=v??P;useEffect(()=>{I.current?.scrollTo({top:0});},[t]);function B(y){if(u){u(y);return}O(y);}let k=useReactTable({data:n,columns:e$1,state:{sorting:R,columnVisibility:_,rowSelection:A,columnFilters:J},initialState:{pagination:{pageSize:D??50}},enableRowSelection:true,onRowSelectionChange:d,onSortingChange:B,onColumnFiltersChange:M,onColumnVisibilityChange:x,getCoreRowModel:getCoreRowModel(),getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),getSortedRowModel:getSortedRowModel(),getRowId:y=>y._id,manualFiltering:true,manualPagination:true,manualSorting:true}),{rows:w}=k.getRowModel(),c=useRef(l),b=useRef(s),T=useRef(f);c.current=l,b.current=s,T.current=f;let z=useCallback(y=>{if(!c.current||!b.current||T.current)return;let a=y??I.current;a&&c$5(a)&&(T.current=true,c.current());},[]),L=b$5();useEffect(()=>{L&&z();},[z,w.length,s,f,L]);function q(y){z(y.currentTarget);}return i?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:[g?g(k):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:q,ref:I,children:[r?jsx("div",{className:"fk:grid fk:grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] fk:gap-3",children:Array.from({length:D??50},(y,a)=>jsxs("div",{className:"fk:rounded-md fk:border fk:border-border fk:p-2 fk:corner-squircle",children:[jsx(t$1,{className:"fk:aspect-square fk:w-full fk:rounded-sm fk:corner-squircle"}),jsx(t$1,{className:"fk:mt-2 fk:h-3 fk:w-[75%]"}),jsx(t$1,{className:"fk:mt-1.5 fk:h-3 fk:w-[50%]"})]},`skeleton-${a}`))}):null,!r&&w.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,!r&&w.length>0?jsx("div",{className:"fk:grid fk:grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] fk:pl-0.5 fk:gap-3",children:w.map(y=>jsx(wo,{row:y},y.id))}):null]})]})]})}function wo({row:e}){let n$1=e.original,t=h$2(n$1)||"Untitled",s=n$1.mimeType??"",r=vo(n$1.size),f=e.getIsSelected(),l=[s,r].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(n,{className:"fk:border-white!","aria-label":`Select ${t}`,checked:f,onCheckedChange:u=>{e.toggleSelected(!!u);},onClick:u=>u.stopPropagation()})}),jsx("div",{className:"fk:group fk:absolute fk:right-2 fk:top-2 fk:z-10 fk:mix-blend-difference",children:jsx(Ve,{overlay:true,row:e})}),jsx(bo,{asset:n$1,filename:t}),jsx("div",{className:"fk:mt-2 fk:truncate fk:text-xs fk:font-medium",title:t,children:t}),l?jsx("div",{className:"fk:mt-0.5 fk:truncate fk:text-[11px] fk:text-muted-foreground",title:l,children:l}):null]})}function bo({asset:e,filename:n}){let[t$1,s$1]=useState(false),[r,f]=useState(false),l=e.url??"";if(!l&&!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(!j$3(e)||!l){let i=i$2(e),A=defaultStyles[i];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(ho,{extension:i,...A||{}})})}let D=k$1(l,{width:320,height:320}),v=l;function g(i){i.stopPropagation(),f(false),s$1(true);}function I(i){s$1(i),i||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 ${yo} fk:corner-squircle`,onClick:g,type:"button",children:jsx("img",{alt:n,className:"fk:h-full fk:w-full fk:object-contain",src:D})}),jsx(k,{open:t$1,onOpenChange:I,children:jsxs(p,{className:"fk:sm:max-w-4xl fk:p-3",children:[jsxs(q,{children:[jsx(s,{className:"fk:sr-only",children:"Asset preview"}),jsx(t,{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:[r?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 ${r?"fk:opacity-100":"fk:opacity-0"}`,onError:()=>f(true),onLoad:()=>f(true),src:v})]})]})})]})}var Fo=[{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 je({entityName:e,isUploading:n=false,table:t,viewMode:s,onUploadClick:r,onViewModeChange:f$1,onSearchLoadingChange:l,onSearchWhereChange:u}){let D=t.getState().columnFilters.length>0,{projectId:v}=useParams(),g$1=j$1(),{scope:I}=c(),[i,A]=useState(null),{currentProjectSchema:d}=f(),_=b$2(),[x,J]=useState(""),M=useRef({}),P=useRef({});function O(){return {searchRequests:{searches:[{collection:"_assets"},{collection:"_tags"}]},commonParams:{q:""}}}let R=useMemo(()=>O(),[]),[B,k]=useState(R),{results:w,isLoading:c$1}=a$3(v??"",B),b=useRef(""),T=x.trim(),z=B.commonParams.q??"",L=T.length>0&&(c$1||z!==T),q=useMemo(()=>Lo(m=>{k({...R,commonParams:{q:m}});},300),[R]);useEffect(()=>()=>{q.cancel();},[q]);let y=t.getSelectedRowModel().rows.map(m=>m.original._id),{data:a}=e$1({entityNamePlural:"_tags",schema:d,scope:I,variables:be,...Y}),U=useMemo(()=>(Array.isArray(a)?a:[]).map(S=>({_id:S._id,name:S.name})),[a]),Z=useMemo(()=>U.map(m=>({value:m._id,label:m.name})),[U]),F=useCallback(()=>{if(!u)return;let m=[];Object.keys(M.current).length>0&&m.push(M.current),Object.keys(P.current).length>0&&m.push(P.current);let S=m.length===0?{}:m.length===1?m[0]:{AND:m},H=JSON.stringify(S);b.current!==H&&(b.current=H,u(S));},[u]);function j$2(){q.cancel(),J(""),k({...R,commonParams:{q:""}}),M.current={},F();}async function K(){g$1({type:"AlertDialog",payload:{options:{dialogTitle:`Delete ${y.length} asset${y.length>1?"s":""}`,dialogMessage:y.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:()=>{g$1({type:"DeleteEntity",_id:`delete-batch-${Date.now()}`,payload:{entityId:y,entityName:e,silent:true}}),t.resetRowSelection();}}}});}useEffect(()=>{l?.(L);},[L,l]),useEffect(()=>{if(!u)return;if(T.length===0){M.current={},F();return}if(L)return;let m=w??[],S={};if(m.length===0)S={_id:{in:[]}};else {let H=m.filter(V=>V._entityNamePlural==="_assets").map(V=>V._id),xe=m.filter(V=>V._entityNamePlural==="_tags").map(V=>({tags:{some:{_id:{eq:V._id}}}})),Q=[];H.length>0&&Q.push({_id:{in:H}}),Q.push(...xe),Q.length===0?S={_id:{in:[]}}:Q.length===1?S=Q[0]:S={OR:Q};}M.current=S,F();},[F,L,u,w,T]);let h$1=JSON.stringify(t.getState().columnFilters);return useEffect(()=>{if(!u)return;let m=t.getState().columnFilters.find(V=>V.id==="mimeType"),S=Array.isArray(m?.value)?m?.value:[],H=t.getState().columnFilters.find(V=>V.id==="tags"),xe=Array.isArray(H?.value)?H?.value:[],Q=[];if(S.length>0&&Q.push({mimeType:{in:S}}),xe.length>0){let V=xe.map(jt=>({tags:{some:{_id:{eq:jt}}}}));Q.push(V.length===1?V[0]:{OR:V});}Q.length===0?P.current={}:Q.length===1?P.current=Q[0]:P.current={AND:Q},F();},[h$1,F,u,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:[c$1?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(b$4,{placeholder:"Search assets...",name:"search-assets",value:x,onChange:m=>{let{value:S}=m.target;if(J(S),S.trim().length===0){j$2();return}q(S.trim());},className:"fk:h-8 fk:w-37.5 fk:lg:w-70 fk:px-7"}),x?jsx(c$2,{"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$2,type:"button",children:jsx(X,{className:"fk:h-4 fk:w-4"})}):null]}),t.getColumn("mimeType")&&jsx(a$4,{column:t.getColumn("mimeType"),options:Fo,title:"File type"}),t.getColumn("tags")&&jsx(a$4,{column:t.getColumn("tags"),options:Z,title:"Tags"}),D&&jsxs(c$2,{variant:"ghost",onClick:()=>{t.resetColumnFilters(),P.current={},F();},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(e$4,{table:t})]}),y.length>0?jsx("div",{className:"fk:flex fk:items-center fk:gap-2",children:jsxs(e$3,{children:[jsx(ja,{disabled:!_,children:jsx(g,{asChild:true,children:jsxs(c$2,{className:"fk:h-8 fk:mr-2 fk:lg:flex",disabled:!_,size:"sm",variant:"secondary",children:["Actions ",jsx(ListChecks,{className:"fk:ml-2 fk:h-4 fk:w-4"})]})})}),jsxs(h,{align:"end",className:"fk:w-[240px]",children:[jsxs(j,{onClick:()=>A("add"),children:[jsx(TagIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Add tag"]}),jsxs(j,{onClick:()=>A("remove"),children:[jsx(MinusIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Remove tag"]}),jsx(o$1,{}),jsxs(j,{onClick:K,className:"fk:text-destructive",children:[jsx(Trash2Icon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Delete asset",y.length>1?"s":""," (",y.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:s,onValueChange:m=>{(m==="list"||m==="grid")&&f$1(m);},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(ja,{disabled:!_,children:jsxs(c$2,{"aria-busy":n,className:"fk:h-8 fk:lg:flex",disabled:!_||n,onClick:r,size:"sm",variant:"default",children:[n?jsx(LoaderCircle,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin"}):null,"Upload assets"]})})]}),i!==null?jsx(Le,{assetIds:y,mode:i,onCompleted:()=>t.resetRowSelection(),onModeChange:A}):null]})}function Lo(e,n=300){let t,s=function(...r){t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,e.apply(this,r);},n);};return s.cancel=()=>{t!==void 0&&(clearTimeout(t),t=void 0);},s}var Uo=4*1024*1024;function Gt(){let{projectId:e}=useParams(),n=c$3(),t=b$2(),[s,r]=useState(false);async function f(l){if(!(!t||s)&&!(l&&l.length===0))try{await n({files:l,maxBytes:Uo,multiple:!0,onUploadStart:()=>{r(!0);},projectId:e});}finally{r(false);}}return {canMutate:t,isUploading:s,uploadFiles:l=>f(l),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,Qo=[{_updatedAt:"DESC"},{_id:"DESC"}];function Xt(){let e$2="_assets",{search:n}=useLocation(),s=new URLSearchParams(n).get("id"),{scope:r}=c(),{schemaErrorMessage:f$1}=e(),{currentProject:l}=f(),u=l?.schema??[],[D,v]=useState([]),[g,I]=useState(()=>$t()),i=m({attributesSchema:b.attributes,actionsComponent:h=>jsx(Ve,{row:h}),checkboxSelect:"multiple",enableColumnSorting:true}),[A,d$1]=useState({}),[_,x]=useState(false),{canMutate:J,isUploading:M,uploadFiles:P,uploadFromDialog:O}=Gt(),R=useMemo(()=>{let h=s?{_id:{eq:s}}:{NOT:{path:{eq:null}}};return !A||Object.keys(A).length===0||s?h:{AND:[h,A]}},[s,A]),B=useMemo(()=>{if(D.length===0)return Qo;let h=D.map(({id:S,desc:H})=>({[S]:H?"DESC":"ASC"}));return h.some(S=>"_id"in S)?h:[...h,{_id:"DESC"}]},[D]),k=useMemo(()=>({where:R,offset:0,limit:Me,sort:B}),[R,B]);function w(h){v(h);}function c$1(h){I(h),Jt(h);}let{isLoading:b$2,isLoadingMore:T,fetchMore:z,count:L,data:q,isProjectDisabled:y}=e$1({entityNamePlural:e$2,schema:u,scope:r,variables:k,selection:"list"}),a$2=_||b$2&&(q==null||q.length===0),U=q?.length??0,Z=!_&&L>0&&U>0&&U<L,F=useCallback(()=>{z({variables:{offset:0,limit:Me}});},[z]),j=useMemo(()=>Array.from({length:Me},(h,m)=>({_id:`loading-${m}`})),[]),K=useMemo(()=>Go(i),[i]);return y?jsx("div",{className:"fk:flex fk:flex-col fk:h-full fk:pl-3",children:jsx(a,{})}):jsxs("div",{className:"fk:flex fk:flex-col fk:h-full fk:pl-3",children:[jsx(b$1,{}),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"}),a$2?null:jsxs("span",{className:"fk:ml-auto fk:text-sm fk:font-normal fk:text-muted-foreground",children:[L.toLocaleString()," ",L===1?"record":"records"]})]}),f$1?null:jsx(a$1,{disabled:!J||M,onDropFiles:P,children:g==="list"?jsx(d,{classNames:{row:"fk:h-20"},columns:a$2?K:i,data:a$2?j:q??[],entityName:b.name,hasMore:Z,isLoadingMore:T,pageSize:Me,sorting:D,onLoadMore:F,onSortingChange:w,toolbarComponent:h=>jsx(je,{entityName:b.name,isUploading:M,table:h,viewMode:g,onSearchLoadingChange:x,onSearchWhereChange:d$1,onUploadClick:O,onViewModeChange:c$1})}):jsx(Ut,{columns:i,data:a$2?[]:q??[],entityName:b.name,hasMore:Z,isLoading:a$2,isLoadingMore:T,pageSize:Me,sorting:D,onLoadMore:F,onSortingChange:w,toolbarComponent:h=>jsx(je,{entityName:b.name,isUploading:M,table:h,viewMode:g,onSearchLoadingChange:x,onSearchWhereChange:d$1,onUploadClick:O,onViewModeChange:c$1})})}),jsx(Outlet,{})]})}function Go(e){return e.map(n=>({...n,cell:()=>jsx(t$1,{className:"fk:h-4 fk:w-full",style:{marginTop:"7px",marginBottom:"6px"}})}))}function Rn(){return jsxs(v,{orientation:"horizontal",className:"fk:h-full",children:[jsx(w,{className:"fk:p-3",defaultSize:"82%",children:jsx("div",{className:"fk:flex fk:flex-col fk:h-full",children:jsx(Xt,{})})}),jsx(x,{className:"fk:hover:bg-blue-500 fk:transition-colors",withHandle:true}),jsx(w,{defaultSize:"18%",minSize:"10%",children:jsx("div",{className:"fk:sm:hidden fk:md:block",children:jsx(Pt,{})})})]})}export{Rn as Root};//# sourceMappingURL=root-RUOT5OSO.js.map
|
|
23
|
-
//# sourceMappingURL=root-
|
|
22
|
+
`),D({variables:{where:{_id:{in:e}}},onCompleted:T=>{M(T),c();},onError:T=>b(T)}),l$1(!0);}),s?.(),x(),t(null);}catch{}finally{A(false);}}},[M,e,i,s,t,x,l$1,v,r,g,u,D]),R=n==="remove",B=R?"Remove tag(s)":"Add tag(s)";return e.length>1&&(B=R?"Remove tag(s) from selected assets":"Add tag(s) to selected assets"),jsxs(d$2,{open:n!==null,onOpenChange:J,children:[jsx(e$5,{placeholder:"Search tags..."}),jsxs(f$2,{className:"fk:h-75",children:[jsx(g$1,{children:"No tags found."}),jsx(h$1,{heading:"Tags",children:_.map(k=>{let w=g.includes(k._id);return jsxs(j$2,{disabled:i,onSelect:()=>{i||I(c=>w?c.filter(b=>b!==k._id):[...c,k._id]);},children:[jsx("input",{className:"fk:mr-2",checked:w,onChange:()=>{},type:"checkbox"}),k.name]},k._id)})})]}),jsx(i$1,{}),jsx("div",{className:"fk:p-2",children:jsxs(c$2,{className:"fk:w-full",disabled:g.length===0||i,onClick:R?O:P,children:[i?jsx(LoaderCircle,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin"}):null,B]})})]})}function Ve({overlay:e=false,row:n}){let[t,s]=useState(null),[r,f]=useState(null),l=j$1(),u=b$2(),D=n.original,v=D._id??"",g$1=D.url??"";function I(){l({type:"DeleteEntity",payload:{entityId:v,entityName:b.name}});}function i(d,_){navigator.clipboard.writeText(_),s(d),window.setTimeout(()=>s(null),1500);}return jsxs(Fragment,{children:[jsxs(e$3,{children:[jsx(g,{asChild:true,children:jsxs(c$2,{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:d=>d.stopPropagation(),variant:"ghost",children:[jsx(Ellipsis,{className:"fk:h-4 fk:w-4"}),jsx("span",{className:"fk:sr-only",children:"Open menu"})]})}),jsxs(h,{align:"start",className:"fk:w-45",children:[jsxs(j,{disabled:!v,onClick:d=>{d.stopPropagation(),i("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,{disabled:!g$1,onClick:d=>{d.stopPropagation(),i("url",g$1);},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$1,{}),jsxs(j,{disabled:!v||!u,onClick:d=>{d.stopPropagation(),f("add");},children:[jsx(TagIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Add tag"]}),jsxs(j,{disabled:!v||!u,onClick:d=>{d.stopPropagation(),f("remove");},children:[jsx(MinusIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Remove tag"]}),jsx(o$1,{}),jsxs(j,{className:"fk:text-destructive",disabled:!v||!u,onClick:d=>{d.stopPropagation(),I();},children:[jsx(Trash2,{className:"fk:mr-2 fk:h-4 fk:w-4"}),"Delete"]})]})]}),r!==null?jsx(Le,{assetIds:v?[v]:[],mode:r,onModeChange:f}):null]})}var ho=FileIcon,yo="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 vo(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 Ut({columns:e$1,data:n,entityName:t,hasMore:s=false,isLoading:r=false,isLoadingMore:f=false,onLoadMore:l,onSortingChange:u,pageSize:D,sorting:v,toolbarComponent:g}){let I=useRef(null),{schemaErrorMessage:i}=e(),[A,d]=useState({}),[_,x]=useState({}),[J,M]=useState([]),[P,O]=useState([]),R=v??P;useEffect(()=>{I.current?.scrollTo({top:0});},[t]);function B(y){if(u){u(y);return}O(y);}let k=useReactTable({data:n,columns:e$1,state:{sorting:R,columnVisibility:_,rowSelection:A,columnFilters:J},initialState:{pagination:{pageSize:D??50}},enableRowSelection:true,onRowSelectionChange:d,onSortingChange:B,onColumnFiltersChange:M,onColumnVisibilityChange:x,getCoreRowModel:getCoreRowModel(),getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),getSortedRowModel:getSortedRowModel(),getRowId:y=>y._id,manualFiltering:true,manualPagination:true,manualSorting:true}),{rows:w}=k.getRowModel(),c=useRef(l),b=useRef(s),T=useRef(f);c.current=l,b.current=s,T.current=f;let z=useCallback(y=>{if(!c.current||!b.current||T.current)return;let a=y??I.current;a&&c$5(a)&&(T.current=true,c.current());},[]),L=b$5();useEffect(()=>{L&&z();},[z,w.length,s,f,L]);function q(y){z(y.currentTarget);}return i?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:[g?g(k):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:q,ref:I,children:[r?jsx("div",{className:"fk:grid fk:grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] fk:gap-3",children:Array.from({length:D??50},(y,a)=>jsxs("div",{className:"fk:rounded-md fk:border fk:border-border fk:p-2 fk:corner-squircle",children:[jsx(t$1,{className:"fk:aspect-square fk:w-full fk:rounded-sm fk:corner-squircle"}),jsx(t$1,{className:"fk:mt-2 fk:h-3 fk:w-[75%]"}),jsx(t$1,{className:"fk:mt-1.5 fk:h-3 fk:w-[50%]"})]},`skeleton-${a}`))}):null,!r&&w.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,!r&&w.length>0?jsx("div",{className:"fk:grid fk:grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] fk:pl-0.5 fk:gap-3",children:w.map(y=>jsx(wo,{row:y},y.id))}):null]})]})]})}function wo({row:e}){let n$1=e.original,t=h$2(n$1)||"Untitled",s=n$1.mimeType??"",r=vo(n$1.size),f=e.getIsSelected(),l=[s,r].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(n,{className:"fk:border-white!","aria-label":`Select ${t}`,checked:f,onCheckedChange:u=>{e.toggleSelected(!!u);},onClick:u=>u.stopPropagation()})}),jsx("div",{className:"fk:group fk:absolute fk:right-2 fk:top-2 fk:z-10 fk:mix-blend-difference",children:jsx(Ve,{overlay:true,row:e})}),jsx(bo,{asset:n$1,filename:t}),jsx("div",{className:"fk:mt-2 fk:truncate fk:text-xs fk:font-medium",title:t,children:t}),l?jsx("div",{className:"fk:mt-0.5 fk:truncate fk:text-[11px] fk:text-muted-foreground",title:l,children:l}):null]})}function bo({asset:e,filename:n}){let[t$1,s$1]=useState(false),[r,f]=useState(false),l=e.url??"";if(!l&&!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(!j$3(e)||!l){let i=i$2(e),A=defaultStyles[i];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(ho,{extension:i,...A||{}})})}let D=k$1(l,{width:320,height:320}),v=l;function g(i){i.stopPropagation(),f(false),s$1(true);}function I(i){s$1(i),i||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 ${yo} fk:corner-squircle`,onClick:g,type:"button",children:jsx("img",{alt:n,className:"fk:h-full fk:w-full fk:object-contain",src:D})}),jsx(k,{open:t$1,onOpenChange:I,children:jsxs(p,{className:"fk:sm:max-w-4xl fk:p-3",children:[jsxs(q,{children:[jsx(s,{className:"fk:sr-only",children:"Asset preview"}),jsx(t,{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:[r?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 ${r?"fk:opacity-100":"fk:opacity-0"}`,onError:()=>f(true),onLoad:()=>f(true),src:v})]})]})})]})}var Fo=[{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 je({entityName:e,isUploading:n=false,table:t,viewMode:s,onUploadClick:r,onViewModeChange:f$1,onSearchLoadingChange:l,onSearchWhereChange:u}){let D=t.getState().columnFilters.length>0,{projectId:v}=useParams(),g$1=j$1(),{scope:I}=c(),[i,A]=useState(null),{currentProjectSchema:d}=f(),_=b$2(),[x,J]=useState(""),M=useRef({}),P=useRef({});function O(){return {searchRequests:{searches:[{collection:"_assets"},{collection:"_tags"}]},commonParams:{q:""}}}let R=useMemo(()=>O(),[]),[B,k]=useState(R),{results:w,isLoading:c$1}=a$3(v??"",B),b=useRef(""),T=x.trim(),z=B.commonParams.q??"",L=T.length>0&&(c$1||z!==T),q=useMemo(()=>Lo(m=>{k({...R,commonParams:{q:m}});},300),[R]);useEffect(()=>()=>{q.cancel();},[q]);let y=t.getSelectedRowModel().rows.map(m=>m.original._id),{data:a}=e$1({entityNamePlural:"_tags",schema:d,scope:I,variables:be,...Y}),U=useMemo(()=>(Array.isArray(a)?a:[]).map(S=>({_id:S._id,name:S.name})),[a]),Z=useMemo(()=>U.map(m=>({value:m._id,label:m.name})),[U]),F=useCallback(()=>{if(!u)return;let m=[];Object.keys(M.current).length>0&&m.push(M.current),Object.keys(P.current).length>0&&m.push(P.current);let S=m.length===0?{}:m.length===1?m[0]:{AND:m},H=JSON.stringify(S);b.current!==H&&(b.current=H,u(S));},[u]);function j$2(){q.cancel(),J(""),k({...R,commonParams:{q:""}}),M.current={},F();}async function K(){g$1({type:"AlertDialog",payload:{options:{dialogTitle:`Delete ${y.length} asset${y.length>1?"s":""}`,dialogMessage:y.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:()=>{g$1({type:"DeleteEntity",_id:`delete-batch-${Date.now()}`,payload:{entityId:y,entityName:e,silent:true}}),t.resetRowSelection();}}}});}useEffect(()=>{l?.(L);},[L,l]),useEffect(()=>{if(!u)return;if(T.length===0){M.current={},F();return}if(L)return;let m=w??[],S={};if(m.length===0)S={_id:{in:[]}};else {let H=m.filter(V=>V._entityNamePlural==="_assets").map(V=>V._id),xe=m.filter(V=>V._entityNamePlural==="_tags").map(V=>({tags:{some:{_id:{eq:V._id}}}})),Q=[];H.length>0&&Q.push({_id:{in:H}}),Q.push(...xe),Q.length===0?S={_id:{in:[]}}:Q.length===1?S=Q[0]:S={OR:Q};}M.current=S,F();},[F,L,u,w,T]);let h$1=JSON.stringify(t.getState().columnFilters);return useEffect(()=>{if(!u)return;let m=t.getState().columnFilters.find(V=>V.id==="mimeType"),S=Array.isArray(m?.value)?m?.value:[],H=t.getState().columnFilters.find(V=>V.id==="tags"),xe=Array.isArray(H?.value)?H?.value:[],Q=[];if(S.length>0&&Q.push({mimeType:{in:S}}),xe.length>0){let V=xe.map(jt=>({tags:{some:{_id:{eq:jt}}}}));Q.push(V.length===1?V[0]:{OR:V});}Q.length===0?P.current={}:Q.length===1?P.current=Q[0]:P.current={AND:Q},F();},[h$1,F,u,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:[c$1?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(b$4,{placeholder:"Search assets...",name:"search-assets",value:x,onChange:m=>{let{value:S}=m.target;if(J(S),S.trim().length===0){j$2();return}q(S.trim());},className:"fk:h-8 fk:w-37.5 fk:lg:w-70 fk:px-7"}),x?jsx(c$2,{"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$2,type:"button",children:jsx(X,{className:"fk:h-4 fk:w-4"})}):null]}),t.getColumn("mimeType")&&jsx(a$4,{column:t.getColumn("mimeType"),options:Fo,title:"File type"}),t.getColumn("tags")&&jsx(a$4,{column:t.getColumn("tags"),options:Z,title:"Tags"}),D&&jsxs(c$2,{variant:"ghost",onClick:()=>{t.resetColumnFilters(),P.current={},F();},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(e$4,{table:t})]}),y.length>0?jsx("div",{className:"fk:flex fk:items-center fk:gap-2",children:jsxs(e$3,{children:[jsx(ja,{disabled:!_,children:jsx(g,{asChild:true,children:jsxs(c$2,{className:"fk:h-8 fk:mr-2 fk:lg:flex",disabled:!_,size:"sm",variant:"secondary",children:["Actions ",jsx(ListChecks,{className:"fk:ml-2 fk:h-4 fk:w-4"})]})})}),jsxs(h,{align:"end",className:"fk:w-[240px]",children:[jsxs(j,{onClick:()=>A("add"),children:[jsx(TagIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Add tag"]}),jsxs(j,{onClick:()=>A("remove"),children:[jsx(MinusIcon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Remove tag"]}),jsx(o$1,{}),jsxs(j,{onClick:K,className:"fk:text-destructive",children:[jsx(Trash2Icon,{className:"fk:mr-2 fk:h-4 fk:w-4"})," Delete asset",y.length>1?"s":""," (",y.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:s,onValueChange:m=>{(m==="list"||m==="grid")&&f$1(m);},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(ja,{disabled:!_,children:jsxs(c$2,{"aria-busy":n,className:"fk:h-8 fk:lg:flex",disabled:!_||n,onClick:r,size:"sm",variant:"default",children:[n?jsx(LoaderCircle,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:animate-spin"}):null,"Upload assets"]})})]}),i!==null?jsx(Le,{assetIds:y,mode:i,onCompleted:()=>t.resetRowSelection(),onModeChange:A}):null]})}function Lo(e,n=300){let t,s=function(...r){t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,e.apply(this,r);},n);};return s.cancel=()=>{t!==void 0&&(clearTimeout(t),t=void 0);},s}var Uo=4*1024*1024;function Gt(){let{projectId:e}=useParams(),n=c$3(),t=b$2(),[s,r]=useState(false);async function f(l){if(!(!t||s)&&!(l&&l.length===0))try{await n({files:l,maxBytes:Uo,multiple:!0,onUploadStart:()=>{r(!0);},projectId:e});}finally{r(false);}}return {canMutate:t,isUploading:s,uploadFiles:l=>f(l),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,Qo=[{_updatedAt:"DESC"},{_id:"DESC"}];function Xt(){let e$2="_assets",{search:n}=useLocation(),s=new URLSearchParams(n).get("id"),{scope:r}=c(),{schemaErrorMessage:f$1}=e(),{currentProject:l}=f(),u=l?.schema??[],[D,v]=useState([]),[g,I]=useState(()=>$t()),i=m({attributesSchema:b.attributes,actionsComponent:h=>jsx(Ve,{row:h}),checkboxSelect:"multiple",enableColumnSorting:true}),[A,d$1]=useState({}),[_,x]=useState(false),{canMutate:J,isUploading:M,uploadFiles:P,uploadFromDialog:O}=Gt(),R=useMemo(()=>{let h=s?{_id:{eq:s}}:{NOT:{path:{eq:null}}};return !A||Object.keys(A).length===0||s?h:{AND:[h,A]}},[s,A]),B=useMemo(()=>{if(D.length===0)return Qo;let h=D.map(({id:S,desc:H})=>({[S]:H?"DESC":"ASC"}));return h.some(S=>"_id"in S)?h:[...h,{_id:"DESC"}]},[D]),k=useMemo(()=>({where:R,offset:0,limit:Me,sort:B}),[R,B]);function w(h){v(h);}function c$1(h){I(h),Jt(h);}let{isLoading:b$2,isLoadingMore:T,fetchMore:z,count:L,data:q,isProjectDisabled:y}=e$1({entityNamePlural:e$2,schema:u,scope:r,variables:k,selection:"list"}),a$2=_||b$2&&(q==null||q.length===0),U=q?.length??0,Z=!_&&L>0&&U>0&&U<L,F=useCallback(()=>{z({variables:{offset:0,limit:Me}});},[z]),j=useMemo(()=>Array.from({length:Me},(h,m)=>({_id:`loading-${m}`})),[]),K=useMemo(()=>Go(i),[i]);return y?jsx("div",{className:"fk:flex fk:flex-col fk:h-full fk:pl-3",children:jsx(a,{})}):jsxs("div",{className:"fk:flex fk:flex-col fk:h-full fk:pl-3",children:[jsx(b$1,{}),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"}),a$2?null:jsxs("span",{className:"fk:ml-auto fk:text-sm fk:font-normal fk:text-muted-foreground",children:[L.toLocaleString()," ",L===1?"record":"records"]})]}),f$1?null:jsx(a$1,{disabled:!J||M,onDropFiles:P,children:g==="list"?jsx(d,{classNames:{row:"fk:h-20"},columns:a$2?K:i,data:a$2?j:q??[],entityName:b.name,hasMore:Z,isLoadingMore:T,pageSize:Me,sorting:D,onLoadMore:F,onSortingChange:w,toolbarComponent:h=>jsx(je,{entityName:b.name,isUploading:M,table:h,viewMode:g,onSearchLoadingChange:x,onSearchWhereChange:d$1,onUploadClick:O,onViewModeChange:c$1})}):jsx(Ut,{columns:i,data:a$2?[]:q??[],entityName:b.name,hasMore:Z,isLoading:a$2,isLoadingMore:T,pageSize:Me,sorting:D,onLoadMore:F,onSortingChange:w,toolbarComponent:h=>jsx(je,{entityName:b.name,isUploading:M,table:h,viewMode:g,onSearchLoadingChange:x,onSearchWhereChange:d$1,onUploadClick:O,onViewModeChange:c$1})})}),jsx(Outlet,{})]})}function Go(e){return e.map(n=>({...n,cell:()=>jsx(t$1,{className:"fk:h-4 fk:w-full",style:{marginTop:"7px",marginBottom:"6px"}})}))}function Rn(){return jsxs(v,{orientation:"horizontal",className:"fk:h-full",children:[jsx(w,{className:"fk:p-3",defaultSize:"82%",children:jsx("div",{className:"fk:flex fk:flex-col fk:h-full",children:jsx(Xt,{})})}),jsx(x,{className:"fk:hover:bg-blue-500 fk:transition-colors",withHandle:true}),jsx(w,{defaultSize:"18%",minSize:"10%",children:jsx("div",{className:"fk:sm:hidden fk:md:block",children:jsx(Pt,{})})})]})}export{Rn as Root};//# sourceMappingURL=root-DF2BNGOF.js.map
|
|
23
|
+
//# sourceMappingURL=root-DF2BNGOF.js.map
|