@exulu/frontend 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/.next/BUILD_ID +1 -1
  2. package/dist/.next/app-build-manifest.json +140 -140
  3. package/dist/.next/app-path-routes-manifest.json +1 -1
  4. package/dist/.next/build-manifest.json +2 -2
  5. package/dist/.next/prerender-manifest.json +1 -1
  6. package/dist/.next/server/app/(application)/agents/edit/[id]/page_client-reference-manifest.js +1 -1
  7. package/dist/.next/server/app/(application)/agents/page_client-reference-manifest.js +1 -1
  8. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page.js +7 -7
  9. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page_client-reference-manifest.js +1 -1
  10. package/dist/.next/server/app/(application)/chat/[agent]/page_client-reference-manifest.js +1 -1
  11. package/dist/.next/server/app/(application)/chat/page_client-reference-manifest.js +1 -1
  12. package/dist/.next/server/app/(application)/configuration/page_client-reference-manifest.js +1 -1
  13. package/dist/.next/server/app/(application)/dashboard/page_client-reference-manifest.js +1 -1
  14. package/dist/.next/server/app/(application)/data/[[...query]]/page.js +3 -3
  15. package/dist/.next/server/app/(application)/data/[[...query]]/page_client-reference-manifest.js +1 -1
  16. package/dist/.next/server/app/(application)/evals/[id]/page_client-reference-manifest.js +1 -1
  17. package/dist/.next/server/app/(application)/evals/cases/page_client-reference-manifest.js +1 -1
  18. package/dist/.next/server/app/(application)/evals/page_client-reference-manifest.js +1 -1
  19. package/dist/.next/server/app/(application)/explorer/page_client-reference-manifest.js +1 -1
  20. package/dist/.next/server/app/(application)/keys/page_client-reference-manifest.js +1 -1
  21. package/dist/.next/server/app/(application)/page_client-reference-manifest.js +1 -1
  22. package/dist/.next/server/app/(application)/projects/[project]/page_client-reference-manifest.js +1 -1
  23. package/dist/.next/server/app/(application)/projects/page_client-reference-manifest.js +1 -1
  24. package/dist/.next/server/app/(application)/prompts/page_client-reference-manifest.js +1 -1
  25. package/dist/.next/server/app/(application)/roles/page_client-reference-manifest.js +1 -1
  26. package/dist/.next/server/app/(application)/token/page_client-reference-manifest.js +1 -1
  27. package/dist/.next/server/app/(application)/users/page_client-reference-manifest.js +1 -1
  28. package/dist/.next/server/app/(application)/variables/create/page_client-reference-manifest.js +1 -1
  29. package/dist/.next/server/app/(application)/variables/edit/[variable_id]/page_client-reference-manifest.js +1 -1
  30. package/dist/.next/server/app/(application)/variables/page_client-reference-manifest.js +1 -1
  31. package/dist/.next/server/app/(application)/variables/usage/[variable_id]/page_client-reference-manifest.js +1 -1
  32. package/dist/.next/server/app/(application)/workflows/page_client-reference-manifest.js +1 -1
  33. package/dist/.next/server/app/(authentication)/login/page_client-reference-manifest.js +1 -1
  34. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  35. package/dist/.next/server/app/_not-found.html +1 -1
  36. package/dist/.next/server/app/_not-found.rsc +1 -1
  37. package/dist/.next/server/app-paths-manifest.json +6 -6
  38. package/dist/.next/server/chunks/2270.js +17 -6
  39. package/dist/.next/server/chunks/5485.js +1 -1
  40. package/dist/.next/server/chunks/5974.js +1 -1
  41. package/dist/.next/server/middleware-manifest.json +5 -5
  42. package/dist/.next/server/pages/404.html +1 -1
  43. package/dist/.next/server/pages/500.html +1 -1
  44. package/dist/.next/server/server-reference-manifest.json +1 -1
  45. package/dist/.next/static/chunks/3750-e3d1b2cccd265190.js +2 -0
  46. package/dist/.next/static/chunks/3750-e3d1b2cccd265190.js.map +1 -0
  47. package/dist/.next/static/chunks/{3832-417a5eeee712a793.js → 3832-d7782d6a2771ae6c.js} +1 -1
  48. package/dist/.next/static/chunks/{3832-417a5eeee712a793.js.map → 3832-d7782d6a2771ae6c.js.map} +1 -1
  49. package/dist/.next/static/chunks/6280-50b751f993f2fe4f.js +2 -0
  50. package/dist/.next/static/chunks/6280-50b751f993f2fe4f.js.map +1 -0
  51. package/dist/.next/static/chunks/{6373-601400fab8a3bb55.js → 6373-aef582adc575d3ca.js} +2 -2
  52. package/dist/.next/static/chunks/6373-aef582adc575d3ca.js.map +1 -0
  53. package/dist/.next/static/chunks/{8293-0e69d89d2dac7111.js → 8293-ba5cd36594e6fde1.js} +3 -3
  54. package/dist/.next/static/chunks/8293-ba5cd36594e6fde1.js.map +1 -0
  55. package/dist/.next/static/chunks/9105-d8ff41060f7ffc85.js +2 -0
  56. package/dist/.next/static/chunks/9105-d8ff41060f7ffc85.js.map +1 -0
  57. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/{page-7edb1c7c850f982c.js → page-d59534ca19eee51f.js} +1 -1
  58. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/{page-7edb1c7c850f982c.js.map → page-d59534ca19eee51f.js.map} +1 -1
  59. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/layout-0c7c1b0e1713bf60.js +2 -0
  60. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/layout-0c7c1b0e1713bf60.js.map +1 -0
  61. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-7db6bfbf02606136.js +2 -0
  62. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-7db6bfbf02606136.js.map +1 -0
  63. package/dist/.next/static/chunks/app/(application)/explorer/{page-1d676c9dfe3ed58b.js → page-e6b1c034c07776e2.js} +1 -1
  64. package/dist/.next/static/chunks/app/(application)/explorer/{page-1d676c9dfe3ed58b.js.map → page-e6b1c034c07776e2.js.map} +1 -1
  65. package/dist/.next/static/chunks/app/(application)/token/{page-3f74f711f3d04fce.js → page-3acc39cb8a718331.js} +1 -1
  66. package/dist/.next/static/chunks/app/(application)/token/{page-3f74f711f3d04fce.js.map → page-3acc39cb8a718331.js.map} +1 -1
  67. package/dist/.next/static/chunks/ba12c10f-85ed008ce7746dbe.js +2 -0
  68. package/dist/.next/static/chunks/ba12c10f-85ed008ce7746dbe.js.map +1 -0
  69. package/dist/.next/static/css/9c08ae5d990a6b14.css +4 -0
  70. package/dist/.next/static/css/9c08ae5d990a6b14.css.map +1 -0
  71. package/dist/.next/static/css/e3f2a16ab7676b05.css.map +1 -1
  72. package/dist/package.json +1 -1
  73. package/package.json +1 -1
  74. package/dist/.next/static/chunks/3750-f45c59ef1cc79417.js +0 -2
  75. package/dist/.next/static/chunks/3750-f45c59ef1cc79417.js.map +0 -1
  76. package/dist/.next/static/chunks/572-2940a399da1e3a3b.js +0 -2
  77. package/dist/.next/static/chunks/572-2940a399da1e3a3b.js.map +0 -1
  78. package/dist/.next/static/chunks/6373-601400fab8a3bb55.js.map +0 -1
  79. package/dist/.next/static/chunks/8293-0e69d89d2dac7111.js.map +0 -1
  80. package/dist/.next/static/chunks/9105-dfbce1bad8e3e8dd.js +0 -2
  81. package/dist/.next/static/chunks/9105-dfbce1bad8e3e8dd.js.map +0 -1
  82. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/layout-2d47be0ee80dd89d.js +0 -2
  83. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/layout-2d47be0ee80dd89d.js.map +0 -1
  84. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-8d2b3995cacfd832.js +0 -2
  85. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-8d2b3995cacfd832.js.map +0 -1
  86. package/dist/.next/static/chunks/ba12c10f-aaafcb074f608624.js +0 -2
  87. package/dist/.next/static/chunks/ba12c10f-aaafcb074f608624.js.map +0 -1
  88. package/dist/.next/static/css/6f8c5212af8ef284.css +0 -4
  89. package/dist/.next/static/css/6f8c5212af8ef284.css.map +0 -1
  90. /package/dist/.next/static/{ls-syPkq9-MWp-VWWDEZJ → 3j63p6b3zZZB_v1Hn8Mxp}/_buildManifest.js +0 -0
  91. /package/dist/.next/static/{ls-syPkq9-MWp-VWWDEZJ → 3j63p6b3zZZB_v1Hn8Mxp}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
- (()=>{var e={};e.id=6050,e.ids=[6050],e.modules={57343:e=>{"use strict";e.exports=require("graphql")},72934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},27790:e=>{"use strict";e.exports=require("assert")},78893:e=>{"use strict";e.exports=require("buffer")},61282:e=>{"use strict";e.exports=require("child_process")},84770:e=>{"use strict";e.exports=require("crypto")},80665:e=>{"use strict";e.exports=require("dns")},17702:e=>{"use strict";e.exports=require("events")},92048:e=>{"use strict";e.exports=require("fs")},32615:e=>{"use strict";e.exports=require("http")},35240:e=>{"use strict";e.exports=require("https")},98216:e=>{"use strict";e.exports=require("net")},19801:e=>{"use strict";e.exports=require("os")},55315:e=>{"use strict";e.exports=require("path")},86624:e=>{"use strict";e.exports=require("querystring")},76162:e=>{"use strict";e.exports=require("stream")},82452:e=>{"use strict";e.exports=require("tls")},17360:e=>{"use strict";e.exports=require("url")},21764:e=>{"use strict";e.exports=require("util")},71568:e=>{"use strict";e.exports=require("zlib")},8678:e=>{"use strict";e.exports=import("pg")},48644:e=>{"use strict";e.exports=import("prettier/plugins/babel")},93801:e=>{"use strict";e.exports=import("prettier/plugins/estree")},45747:e=>{"use strict";e.exports=import("prettier/standalone")},49411:e=>{"use strict";e.exports=require("node:path")},97742:e=>{"use strict";e.exports=require("node:process")},41041:e=>{"use strict";e.exports=require("node:url")},39701:(e,t,s)=>{"use strict";s.a(e,async(e,r)=>{try{s.r(t),s.d(t,{GlobalError:()=>d.a,__next_app__:()=>p,originalPathname:()=>m,pages:()=>h,routeModule:()=>g,tree:()=>x}),s(21114),s(76738);var n=s(71197);s(35866);var a=s(23191),l=s(88716),i=s(37922),d=s.n(i),c=s(95231),o={};for(let e in c)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(o[e]=()=>c[e]);s.d(t,o);var u=e([n]);n=(u.then?(await u)():u)[0];let x=["",{children:["(application)",{children:["data",{children:["[[...query]]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,21114)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx"]}]},{layout:[()=>Promise.resolve().then(s.bind(s,76738)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/layout.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(s.bind(s,71197)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/layout.tsx"],"not-found":[()=>Promise.resolve().then(s.t.bind(s,35866,23)),"next/dist/client/components/not-found-error"]}]},{"not-found":[()=>Promise.resolve().then(s.t.bind(s,35866,23)),"next/dist/client/components/not-found-error"]}],h=["/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx"],m="/(application)/data/[[...query]]/page",p={require:s,loadChunk:()=>Promise.resolve()},g=new a.AppPageRouteModule({definition:{kind:l.x.APP_PAGE,page:"/(application)/data/[[...query]]/page",pathname:"/data/[[...query]]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:x}});r()}catch(e){r(e)}})},71580:(e,t,s)=>{Promise.resolve().then(s.bind(s,21318))},82736:(e,t,s)=>{Promise.resolve().then(s.bind(s,26533))},21318:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>eB});var r=s(10326),n=s(17577),a=s(76812),l=s(39167),i=s(18753),d=s(86508),c=s(11798),o=s(83855),u=s(23015),x=s(98091),h=s(40900),m=s(35047),p=s(15211),g=s(90772),f=s(53313),j=s(37859),v=s(65685),y=s(65304),b=s(15940),N=s(34789),w=s(77863),k=s(98181);let C=[{id:"select",header:({table:e})=>r.jsx(f.X,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t),"aria-label":"Select all",className:"translate-y-[2px]"}),cell:({row:e})=>r.jsx(f.X,{checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(!!t),"aria-label":"Select row",className:"translate-y-[2px] max-w-[50px]"}),enableSorting:!1,enableHiding:!1},{accessorKey:"Description",cell:({row:e})=>(console.log("original",e.original),(0,r.jsxs)("div",{className:"flex flex-column grid grid-cols-1",children:[r.jsx("span",{className:"max-w-[500px] truncate font-medium w-full",children:e.original.name?e.original.name:e.original.text?.slice(0,200)||"Untitled"}),r.jsx("small",{className:"mt-1",children:(0,k.WU)(new Date(e.original.createdAt),"PP")})]}))}];var z=s(43273),S=s(88307),E=s(94019),_=s(54432);function O({onSearch:e=e=>console.log(`Search query: ${e}`),placeholder:t="Search...",className:s=""}){let[a,l]=(0,n.useState)("");return r.jsx("form",{onSubmit:t=>{t.preventDefault(),e(a)},className:`relative ${s}`,children:(0,r.jsxs)("div",{className:"relative flex items-center w-full",children:[r.jsx(S.Z,{className:"absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx(_.I,{type:"text",placeholder:t,value:a,onChange:e=>l(e.target.value),className:"pl-10 pr-10","aria-label":"Search input"}),a&&(0,r.jsxs)(r.Fragment,{children:[r.jsx("span",{className:"absolute right-10 text-xs text-muted-foreground",children:"Press Enter ↵"}),r.jsx(g.z,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 h-full rounded-l-none",onClick:()=>{l(""),e("")},"aria-label":"Clear search",children:r.jsx(E.Z,{className:"h-4 w-4"})})]})]})})}var M=s(42270);function P({activeFolder:e,activeItem:t,archived:s}){let k=(0,m.usePathname)(),S=(0,m.useSearchParams)(),[E,_]=(0,n.useState)(S.get("page")?parseInt(S.get("page")):1),P=S.get("search"),{user:R}=(0,n.useContext)(p.S),{toast:D}=(0,N.pm)(),[q,I]=(0,n.useState)({...R.company}),A=(0,m.useRouter)(),[L,T]=n.useState({}),[Z,F]=n.useState({}),[$,G]=n.useState([]),[U,V]=n.useState([]),{loading:W,data:B,refetch:J,previousData:X,error:H}=(0,l.aM)((0,M.P3)(e,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{context:e,page:E??1,limit:10,sort:{field:"updatedAt",direction:"DESC"},filters:{archived:{eq:s},...P?{name:{contains:`${P}`}}:{}}}}),K=B?.[e+M.Md],Y=X?.[e+M.Md],[Q,ee]=(0,i.D)((0,M.ty)(e),{onCompleted:()=>{J()}}),[et,es]=(0,i.D)((0,M.mN)(e,[]),{onCompleted:()=>{J()}}),er=n.useMemo(()=>[],[]),{limit:en,onPaginationChange:ea,skip:el,pagination:ei}=function(){let[e,t]=(0,n.useState)({pageSize:5,pageIndex:0}),{pageSize:s,pageIndex:r}=e;return{limit:s,onPaginationChange:t,pagination:e,skip:s*r}}(),ed=(0,d.b7)({data:W&&Y?.items?Y.items:K?.items??er,pageCount:K?.pageInfo?.pageCount??-1,columns:C,state:{sorting:U,columnVisibility:Z,rowSelection:L,columnFilters:$},enableRowSelection:!0,onRowSelectionChange:T,onSortingChange:V,onColumnFiltersChange:G,onColumnVisibilityChange:F,getCoreRowModel:(0,c.sC)(),getFilteredRowModel:(0,c.vL)(),getPaginationRowModel:(0,c.G_)(),getSortedRowModel:(0,c.tj)(),getFacetedRowModel:(0,c.o6)(),getFacetedUniqueValues:(0,c.JG)(),manualPagination:!0,onPaginationChange:ea}),[ec,eo]=(0,i.D)((0,M.tO)(e),{onCompleted:t=>{console.log("data",t);let s=t?t[e+M.Wc]?.item?.id:void 0;s&&A.push(`/data/${e}/${s}`),J()}}),eu=({page:e,search:t})=>{_(e??1);let s=new URLSearchParams;e&&s.set("page",e.toString()),t&&s.set("search",t),A.push(`${k}?${s.toString()}`)},ex=t=>{s?A.push(`/data/${e}/archived/${t}?${S.toString()}`):A.push(`/data/${e}/${t}?${S.toString()}`)};return H?(0,r.jsxs)(z.bZ,{className:"p-4",variant:"destructive",children:[r.jsx(a.LPM,{className:"size-4"}),r.jsx(z.Cd,{children:"Error"}),r.jsx(z.X,{children:H?.message||": unknown"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"grid grid-flow-col grid-cols-[auto_minmax(0,1fr)] grid-rows-1 bg-background/95 p-4 backdrop-blur gap-2 supports-[backdrop-filter]:bg-background/60",children:[r.jsx(f.X,{checked:ed.getIsAllPageRowsSelected()||ed.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:e=>ed.toggleAllPageRowsSelected(!!e),"aria-label":"Select all",className:"my-auto mr-3 translate-y-[2px]"}),r.jsx("div",{className:"relative",children:r.jsx(O,{onSearch:e=>{eu({page:1,search:e})}})}),r.jsx(g.z,{onClick:()=>{ec({variables:{input:{name:"New item",source:"manual",textlength:0,company:q.id}}})},disabled:eo.loading||s,className:"ml-2 ml-auto lg:flex",children:eo.loading?r.jsx(j.g,{}):r.jsx(o.Z,{size:18})})]}),ed.getIsSomeRowsSelected()||ed.getIsAllRowsSelected()?r.jsx("div",{className:"flex px-4 pb-4",children:s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(g.z,{className:"ml-2",onClick:()=>{let e=[];ed.getSelectedRowModel().rows.forEach(t=>{e.push(Q({variables:{id:t.original.id,input:{archived:!1}}}))}),Promise.all(e).then(()=>{ed.resetRowSelection(),D({title:"Unarchived items",description:"We unarchived "+e.length+" items."})})},variant:"secondary",disabled:ee.loading,children:[ee.loading?r.jsx(j.g,{}):r.jsx(u.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Unarchive selected"})]}),(0,r.jsxs)(g.z,{className:"ml-2",onClick:()=>{let t=[];ed.getSelectedRowModel().rows.forEach(s=>{t.push(et({variables:{context:e,id:s.original.id}}))}),Promise.all(t).then(()=>{ed.resetRowSelection(),D({title:"Deleted items",description:"We deleted "+t.length+" items."})})},variant:"secondary",disabled:es.loading,children:[es.loading?r.jsx(j.g,{}):r.jsx(x.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Delete selected"})]})]}):(0,r.jsxs)(g.z,{className:"ml-2",onClick:()=>{let e=[];ed.getSelectedRowModel().rows.forEach(t=>{e.push(Q({variables:{id:t.original?.id,input:{archived:!0}}}))}),Promise.all(e).then(()=>{ed.resetRowSelection(),D({title:"Archived items",description:"We archived "+e.length+" items."})})},variant:"secondary",disabled:ee.loading,children:[ee.loading?r.jsx(j.g,{}):r.jsx(h.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Archive selected"})]})}):null,W?r.jsx(v.x,{className:"h-screen",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2 p-4 pt-0",children:[r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"h-[100px] w-full rounded-lg"})]})}):(0,r.jsxs)("div",{className:"flex max-h-[75vh] flex-col",children:[r.jsx(v.x,{className:"h-screen grow",children:r.jsx("div",{className:"space-y-4",children:r.jsx("div",{className:"border-y",children:r.jsx(b.iA,{children:r.jsx(b.RM,{children:ed.getRowModel().rows?.length?ed.getRowModel().rows.map(e=>r.jsx(b.SC,{className:(0,w.cn)(t===e.original.id?"bg-secondary dark:text-white":""),"data-state":e.getIsSelected()&&"selected",children:e.getVisibleCells().map((t,s)=>s>0?r.jsx(b.pj,{className:"cursor-pointer",onClick:()=>{ex(e.original.id)},children:(0,d.ie)(t.column.columnDef.cell,t.getContext())},t.id):r.jsx(b.pj,{children:(0,d.ie)(t.column.columnDef.cell,t.getContext())},t.id))},e.id)):r.jsx(b.SC,{children:r.jsx(b.pj,{colSpan:C.length,className:"h-24 text-center",children:"No results."})})})})})})}),(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 pb-2",children:[(0,r.jsxs)("div",{className:"flex-1 text-sm text-muted-foreground",children:[ed.getFilteredSelectedRowModel().rows.length," of"," ",ed.getFilteredRowModel().rows.length," row(s) selected (total"," ",K?.pageInfo.itemCount," items)."]}),r.jsx("div",{className:"flex items-center space-x-6 lg:space-x-8",children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsxs)(g.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{eu({page:1,search:P??void 0})},disabled:!K?.pageInfo.hasPreviousPage,children:[r.jsx("span",{className:"sr-only",children:"Go to first page"}),r.jsx(a.kRt,{className:"size-4"})]}),(0,r.jsxs)(g.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{console.log("itemsData.data?.pageInfo.hasPreviousPage",K?.pageInfo.hasPreviousPage),eu({page:K?.pageInfo.hasPreviousPage?E-1:void 0,search:P??void 0})},disabled:!K?.pageInfo.hasPreviousPage||W,children:[r.jsx("span",{className:"sr-only",children:"Go to previous page"}),r.jsx(a.wyc,{className:"size-4"})]}),(0,r.jsxs)(g.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{eu({page:K?.pageInfo.hasNextPage?E+1:void 0,search:P??void 0})},disabled:!K?.pageInfo.hasNextPage||W,children:[r.jsx("span",{className:"sr-only",children:"Go to next page"}),r.jsx(a.XCv,{className:"size-4"})]})]})})]})]})]})}var R=s(76557);let D=(0,R.Z)("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),{createElement:q,createContext:I,createRef:A,forwardRef:L,useCallback:T,useContext:Z,useEffect:F,useImperativeHandle:$,useLayoutEffect:G,useMemo:U,useRef:V,useState:W}=n,B=n["useId".toString()],J=I(null);J.displayName="PanelGroupContext";let X="function"==typeof B?B:()=>null,H=0;function K(e=null){let t=X(),s=V(e||t||null);return null===s.current&&(s.current=""+H++),null!=e?e:s.current}function Y({children:e,className:t="",collapsedSize:s,collapsible:r,defaultSize:n,forwardedRef:a,id:l,maxSize:i,minSize:d,onCollapse:c,onExpand:o,onResize:u,order:x,style:h,tagName:m="div",...p}){let g=Z(J);if(null===g)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:f,expandPanel:j,getPanelSize:v,getPanelStyle:y,groupId:b,isPanelCollapsed:N,reevaluatePanelConstraints:w,registerPanel:k,resizePanel:C,unregisterPanel:z}=g,S=K(l),E=V({callbacks:{onCollapse:c,onExpand:o,onResize:u},constraints:{collapsedSize:s,collapsible:r,defaultSize:n,maxSize:i,minSize:d},id:S,idIsFromProps:void 0!==l,order:x});V({didLogMissingDefaultSizeWarning:!1}),$(a,()=>({collapse:()=>{f(E.current)},expand:()=>{j(E.current)},getId:()=>S,getSize:()=>v(E.current),isCollapsed:()=>N(E.current),isExpanded:()=>!N(E.current),resize:e=>{C(E.current,e)}}),[f,j,v,N,S,C]);let _=y(E.current,n);return q(m,{...p,children:e,className:t,style:{..._,...h},"data-panel":"","data-panel-id":S,"data-panel-group-id":b,"data-panel-collapsible":void 0,"data-panel-size":void 0})}let Q=L((e,t)=>q(Y,{...e,forwardedRef:t}));function ee(e,t="Assertion failed!"){if(!e)throw console.error(t),Error(t)}function et(e,t,s=10){let r=(e=parseFloat(e.toFixed(s)))-(t=parseFloat(t.toFixed(s)));return 0===r?0:r>0?1:-1}function es(e,t,s){return 0===et(e,t,s)}function er({panelConstraints:e,panelIndex:t,size:s}){let r=e[t];ee(null!=r);let{collapsedSize:n=0,collapsible:a,maxSize:l=100,minSize:i=0}=r;return 0>et(s,i)&&(s=a&&0>et(s,(n+i)/2)?n:i),s=parseFloat((s=Math.min(l,s)).toFixed(10))}function en({delta:e,layout:t,panelConstraints:s,pivotIndices:r,trigger:n}){if(es(e,0))return t;let a=[...t],[l,i]=r;ee(null!=l),ee(null!=i);let d=0;if("keyboard"===n){{let r=e<0?i:l,n=s[r];if(ee(n),n.collapsible){let n=t[r];ee(null!=n);let a=s[r];ee(a);let{collapsedSize:l=0,minSize:i=0}=a;if(es(n,l)){let t=i-n;et(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let r=e<0?l:i,n=s[r];ee(n);let{collapsible:a}=n;if(a){let n=t[r];ee(null!=n);let a=s[r];ee(a);let{collapsedSize:l=0,minSize:i=0}=a;if(es(n,i)){let t=n-l;et(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let r=e<0?1:-1,n=e<0?i:l,a=0;for(;;){let e=t[n];if(ee(null!=e),a+=er({panelConstraints:s,panelIndex:n,size:100})-e,(n+=r)<0||n>=s.length)break}let d=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-d:d}{let r=e<0?l:i;for(;r>=0&&r<s.length;){let n=Math.abs(e)-Math.abs(d),l=t[r];ee(null!=l);let i=er({panelConstraints:s,panelIndex:r,size:l-n});if(!es(l,i)&&(d+=l-i,a[r]=i,d.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(es(d,0))return t;{let r=e<0?i:l,n=t[r];ee(null!=n);let c=n+d,o=er({panelConstraints:s,panelIndex:r,size:c});if(a[r]=o,!es(o,c)){let t=c-o,r=e<0?i:l;for(;r>=0&&r<s.length;){let n=a[r];ee(null!=n);let l=er({panelConstraints:s,panelIndex:r,size:n+t});if(es(n,l)||(t-=l-n,a[r]=l),es(t,0))break;e>0?r--:r++}}}return es(a.reduce((e,t)=>t+e,0),100)?a:t}function ea(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function el(e,t,s=document){let r=ea(e,s).findIndex(e=>e.getAttribute("data-panel-resize-handle-id")===t);return null!=r?r:null}function ei(e,t,s){let r=el(e,t,s);return null!=r?[r,r+1]:[-1,-1]}function ed(e,t=document){var s;return t instanceof HTMLElement&&(null==t?void 0:null===(s=t.dataset)||void 0===s?void 0:s.panelGroupId)==e?t:t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`)||null}function ec(e,t=document){return t.querySelector(`[data-panel-resize-handle-id="${e}"]`)||null}function eo(e){return"keydown"===e.type}function eu(e){return e.type.startsWith("mouse")}function ex(e){return e.type.startsWith("touch")}function eh(e,t){let s="horizontal"===e;if(eu(t))return s?t.clientX:t.clientY;if(ex(t)){let e=t.touches[0];return ee(e),s?e.screenX:e.screenY}throw Error(`Unsupported event type "${t.type}"`)}function em(e,t,s){t.forEach((t,r)=>{let n=e[r];ee(n);let{callbacks:a,constraints:l,id:i}=n,{collapsedSize:d=0,collapsible:c}=l,o=s[i];if(null==o||t!==o){s[i]=t;let{onCollapse:e,onExpand:r,onResize:n}=a;n&&n(t,o),c&&(e||r)&&(r&&(null==o||o===d)&&t!==d&&r(),e&&(null==o||o!==d)&&t===d&&e())}})}function ep(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!=t[s])return!1;return!0}Y.displayName="Panel",Q.displayName="forwardRef(Panel)";let eg=null,ef=null;function ej(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function ev(e){if(eg===e)return;eg=e;let t=ej(e);null===ef&&(ef=document.createElement("style"),document.head.appendChild(ef)),ef.innerHTML=`*{cursor: ${t}!important;}`}function ey(e){try{if("undefined"!=typeof localStorage)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function eb(e){return`react-resizable-panels:${e}`}function eN(e,t,s,r,n){var a;let l=eb(e),i=t.map(e=>{let{constraints:t,id:s,idIsFromProps:r,order:n}=e;return r?s:n?`${n}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(","),d=null!==(a=function(e,t){try{let s=eb(e),r=t.getItem(s);if(r){let e=JSON.parse(r);if("object"==typeof e&&null!=e)return e}}catch(e){}return null}(e,n))&&void 0!==a?a:{};d[i]={expandToSizes:Object.fromEntries(s.entries()),layout:r};try{n.setItem(l,JSON.stringify(d))}catch(e){console.error(e)}}let ew={getItem:e=>(ey(ew),ew.getItem(e)),setItem:(e,t)=>{ey(ew),ew.setItem(e,t)}},ek={};function eC({autoSaveId:e=null,children:t,className:s="",direction:r,forwardedRef:n,id:a=null,onLayout:l=null,keyboardResizeBy:i=null,storage:d=ew,style:c,tagName:o="div",...u}){let x=K(a),h=V(null),[m,p]=W(null),[g,f]=W([]),j=V({}),v=V(new Map),y=V(0),b=V({autoSaveId:e,direction:r,dragState:m,id:x,keyboardResizeBy:i,onLayout:l,storage:d}),N=V({layout:g,panelDataArray:[],panelDataArrayChanged:!1});V({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),$(n,()=>({getId:()=>b.current.id,getLayout:()=>{let{layout:e}=N.current;return e},setLayout:e=>{let{onLayout:t}=b.current,{layout:s,panelDataArray:r}=N.current,n=function({layout:e,panelConstraints:t}){let s=[...e],r=s.reduce((e,t)=>e+t,0);if(s.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${s.map(e=>`${e}%`).join(", ")}`);if(!es(r,100))for(let e=0;e<t.length;e++){let t=s[e];ee(null!=t);let n=100/r*t;s[e]=n}let n=0;for(let e=0;e<t.length;e++){let r=s[e];ee(null!=r);let a=er({panelConstraints:t,panelIndex:e,size:r});r!=a&&(n+=r-a,s[e]=a)}if(!es(n,0))for(let e=0;e<t.length;e++){let r=s[e];ee(null!=r);let a=er({panelConstraints:t,panelIndex:e,size:r+n});if(r!==a&&(n-=a-r,s[e]=a,es(n,0)))break}return s}({layout:e,panelConstraints:r.map(e=>e.constraints)});!function(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}(s,n)&&(f(n),N.current.layout=n,t&&t(n),em(r,n,j.current))}}),[]),function({committedValuesRef:e,eagerValuesRef:t,groupId:s,layout:r,panelDataArray:n,panelGroupElement:a,setLayout:l}){V({didWarnAboutMissingResizeHandle:!1}),F(()=>{if(!a)return;let e=t.current;ee(e);let{panelDataArray:n}=e;ee(null!=ed(s,a),`No group found for id "${s}"`);let i=ea(s,a);ee(i);let d=i.map(e=>{let t=e.getAttribute("data-panel-resize-handle-id");ee(t);let[i,d]=function(e,t,s,r=document){var n,a,l,i;let d=ec(t,r),c=ea(e,r),o=d?c.indexOf(d):-1;return[null!==(n=null===(a=s[o])||void 0===a?void 0:a.id)&&void 0!==n?n:null,null!==(l=null===(i=s[o+1])||void 0===i?void 0:i.id)&&void 0!==l?l:null]}(s,t,n,a);if(null==i||null==d)return()=>{};let c=e=>{if(!e.defaultPrevented&&"Enter"===e.key){e.preventDefault();let d=n.findIndex(e=>e.id===i);if(d>=0){let e=n[d];ee(e);let i=r[d],{collapsedSize:c=0,collapsible:o,minSize:u=0}=e.constraints;if(null!=i&&o){let e=en({delta:es(i,c)?u-c:c-i,layout:r,panelConstraints:n.map(e=>e.constraints),pivotIndices:ei(s,t,a),trigger:"keyboard"});r!==e&&l(e)}}}};return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}});return()=>{d.forEach(e=>e())}},[a,e,t,s,r,n,l])}({committedValuesRef:b,eagerValuesRef:N,groupId:x,layout:g,panelDataArray:N.current.panelDataArray,setLayout:f,panelGroupElement:h.current}),F(()=>{let{panelDataArray:t}=N.current;if(e){if(0===g.length||g.length!==t.length)return;let s=ek[e];null==s&&(s=function(e,t=10){let s=null;return(...r)=>{null!==s&&clearTimeout(s),s=setTimeout(()=>{e(...r)},t)}}(eN,100),ek[e]=s),s(e,[...t],new Map(v.current),g,d)}},[e,g,d]),F(()=>{});let w=T(e=>{let{onLayout:t}=b.current,{layout:s,panelDataArray:r}=N.current;if(e.constraints.collapsible){let n=r.map(e=>e.constraints),{collapsedSize:a=0,panelSize:l,pivotIndices:i}=eE(r,e,s);if(ee(null!=l),l!==a){v.current.set(e.id,l);let d=en({delta:eS(r,e)===r.length-1?l-a:a-l,layout:s,panelConstraints:n,pivotIndices:i,trigger:"imperative-api"});ep(s,d)||(f(d),N.current.layout=d,t&&t(d),em(r,d,j.current))}}},[]),k=T(e=>{let{onLayout:t}=b.current,{layout:s,panelDataArray:r}=N.current;if(e.constraints.collapsible){let n=r.map(e=>e.constraints),{collapsedSize:a=0,panelSize:l,minSize:i=0,pivotIndices:d}=eE(r,e,s);if(l===a){let a=v.current.get(e.id),c=null!=a&&a>=i?a:i,o=en({delta:eS(r,e)===r.length-1?l-c:c-l,layout:s,panelConstraints:n,pivotIndices:d,trigger:"imperative-api"});ep(s,o)||(f(o),N.current.layout=o,t&&t(o),em(r,o,j.current))}}},[]),C=T(e=>{let{layout:t,panelDataArray:s}=N.current,{panelSize:r}=eE(s,e,t);return ee(null!=r),r},[]),z=T((e,t)=>{let{panelDataArray:s}=N.current,r=eS(s,e);return function({defaultSize:e,dragState:t,layout:s,panelData:r,panelIndex:n,precision:a=3}){let l=s[n];return{flexBasis:0,flexGrow:null==l?null!=e?e:"1":1===r.length?"1":l.toPrecision(a),flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:m,layout:g,panelData:s,panelIndex:r})},[m,g]),S=T(e=>{let{layout:t,panelDataArray:s}=N.current,{collapsedSize:r=0,collapsible:n,panelSize:a}=eE(s,e,t);return!0===n&&a===r},[]),E=T(e=>{let{layout:t,panelDataArray:s}=N.current,{collapsedSize:r=0,collapsible:n,panelSize:a}=eE(s,e,t);return ee(null!=a),!n||a>r},[]),_=T(e=>{let{panelDataArray:t}=N.current;t.push(e),t.sort((e,t)=>{let s=e.order,r=t.order;return null==s&&null==r?0:null==s?-1:null==r?1:s-r}),N.current.panelDataArrayChanged=!0},[]),O=T(e=>function(t){t.preventDefault();let s=h.current;if(!s)return()=>null;let{direction:r,dragState:n,id:a,keyboardResizeBy:l,onLayout:i}=b.current,{layout:d,panelDataArray:c}=N.current,{initialLayout:o}=null!=n?n:{},u=ei(a,e,s),x=function(e,t,s,r,n,a){if(eo(e)){let t="horizontal"===s,r=0;r=e.shiftKey?100:null!=n?n:10;let a=0;switch(e.key){case"ArrowDown":a=t?0:r;break;case"ArrowLeft":a=t?-r:0;break;case"ArrowRight":a=t?r:0;break;case"ArrowUp":a=t?0:-r;break;case"End":a=100;break;case"Home":a=-100}return a}return null==r?0:function(e,t,s,r,n){let a="horizontal"===s,l=ec(t,n);ee(l);let i=l.getAttribute("data-panel-group-id");ee(i);let{initialCursorPosition:d}=r,c=eh(s,e),o=ed(i,n);ee(o);let u=o.getBoundingClientRect();return(c-d)/(a?u.width:u.height)*100}(e,t,s,r,a)}(t,e,r,n,l,s);if(0===x)return;let m="horizontal"===r;"rtl"===document.dir&&m&&(x=-x);let p=en({delta:x,layout:null!=o?o:d,panelConstraints:c.map(e=>e.constraints),pivotIndices:u,trigger:eo(t)?"keyboard":"mouse-or-touch"}),g=!ep(d,p);(eu(t)||ex(t))&&y.current!=x&&(y.current=x,g?ev(m?"horizontal":"vertical"):m?ev(x<0?"horizontal-min":"horizontal-max"):ev(x<0?"vertical-min":"vertical-max")),g&&(f(p),N.current.layout=p,i&&i(p),em(c,p,j.current))},[]),M=T((e,t)=>{let{onLayout:s}=b.current,{layout:r,panelDataArray:n}=N.current,a=n.map(e=>e.constraints),{panelSize:l,pivotIndices:i}=eE(n,e,r);ee(null!=l);let d=en({delta:eS(n,e)===n.length-1?l-t:t-l,layout:r,panelConstraints:a,pivotIndices:i,trigger:"imperative-api"});ep(r,d)||(f(d),N.current.layout=d,s&&s(d),em(n,d,j.current))},[]),P=T((e,t)=>{let{layout:s,panelDataArray:r}=N.current,{collapsedSize:n=0,collapsible:a}=t,{collapsedSize:l=0,collapsible:i,maxSize:d=100,minSize:c=0}=e.constraints,{panelSize:o}=eE(r,e,s);ee(null!=o),a&&i&&o===n?n!==l&&M(e,l):o<c?M(e,c):o>d&&M(e,d)},[M]),R=T((e,t)=>{let{direction:s}=b.current,{layout:r}=N.current;if(!h.current)return;let n=ec(e,h.current);ee(n);let a=eh(s,t);p({dragHandleId:e,dragHandleRect:n.getBoundingClientRect(),initialCursorPosition:a,initialLayout:r})},[]),D=T(()=>{null!==ef&&(document.head.removeChild(ef),eg=null,ef=null),p(null)},[]),I=T(e=>{let{panelDataArray:t}=N.current,s=eS(t,e);s>=0&&(t.splice(s,1),delete j.current[e.id],N.current.panelDataArrayChanged=!0)},[]),A=U(()=>({collapsePanel:w,direction:r,dragState:m,expandPanel:k,getPanelSize:C,getPanelStyle:z,groupId:x,isPanelCollapsed:S,isPanelExpanded:E,reevaluatePanelConstraints:P,registerPanel:_,registerResizeHandle:O,resizePanel:M,startDragging:R,stopDragging:D,unregisterPanel:I,panelGroupElement:h.current}),[w,m,r,k,C,z,x,S,E,P,_,O,M,R,D,I]);return q(J.Provider,{value:A},q(o,{...u,children:t,className:s,style:{display:"flex",flexDirection:"horizontal"===r?"row":"column",height:"100%",overflow:"hidden",width:"100%",...c},ref:h,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":x}))}let ez=L((e,t)=>q(eC,{...e,forwardedRef:t}));function eS(e,t){return e.findIndex(e=>e===t||e.id===t.id)}function eE(e,t,s){let r=eS(e,t),n=r===e.length-1,a=s[r];return{...t.constraints,panelSize:a,pivotIndices:n?[r-1,r]:[r,r+1]}}function e_({children:e=null,className:t="",disabled:s=!1,id:r,onDragging:n,style:a={},tabIndex:l=0,tagName:i="div",...d}){let c=V(null),o=V({onDragging:n});F(()=>{o.current.onDragging=n});let u=Z(J);if(null===u)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:x,dragState:h,groupId:m,registerResizeHandle:p,startDragging:g,stopDragging:f,panelGroupElement:j}=u,v=K(r),y=(null==h?void 0:h.dragHandleId)===v,[b,N]=W(!1),[w,k]=W(null),C=T(()=>{let e=c.current;ee(e),e.blur(),f();let{onDragging:t}=o.current;t&&t(!1)},[f]);F(()=>{if(s)k(null);else{let e=p(v);k(()=>e)}},[s,v,p]),F(()=>{if(s||null==w||!y)return;let e=e=>{w(e)},t=e=>{w(e)},r=c.current;ee(r);let n=r.ownerDocument;return n.body.addEventListener("contextmenu",C),n.body.addEventListener("mousemove",e),n.body.addEventListener("touchmove",e),n.body.addEventListener("mouseleave",t),window.addEventListener("mouseup",C),window.addEventListener("touchend",C),()=>{n.body.removeEventListener("contextmenu",C),n.body.removeEventListener("mousemove",e),n.body.removeEventListener("touchmove",e),n.body.removeEventListener("mouseleave",t),window.removeEventListener("mouseup",C),window.removeEventListener("touchend",C)}},[x,s,y,w,C]),function({disabled:e,handleId:t,resizeHandler:s,panelGroupElement:r}){F(()=>{if(e||null==s||null==r)return;let n=ec(t,r);if(null==n)return;let a=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),s(e);break;case"F6":{e.preventDefault();let s=n.getAttribute("data-panel-group-id");ee(s);let a=ea(s,r),l=el(s,t,r);ee(null!==l);let i=e.shiftKey?l>0?l-1:a.length-1:l+1<a.length?l+1:0;a[i].focus()}}};return n.addEventListener("keydown",a),()=>{n.removeEventListener("keydown",a)}},[r,e,t,s])}({disabled:s,handleId:v,resizeHandler:w,panelGroupElement:j});let z={cursor:ej(x),touchAction:"none",userSelect:"none"};return q(i,{...d,children:e,className:t,onBlur:()=>N(!1),onFocus:()=>N(!0),onMouseDown:e=>{g(v,e.nativeEvent);let t=o.current;ee(t);let{onDragging:s}=t;s&&s(!0)},onMouseUp:C,onTouchCancel:C,onTouchEnd:C,onTouchStart:e=>{g(v,e.nativeEvent);let t=o.current;ee(t);let{onDragging:s}=t;s&&s(!0)},ref:c,role:"separator",style:{...z,...a},tabIndex:l,"data-panel-group-direction":x,"data-panel-group-id":m,"data-resize-handle":"","data-resize-handle-active":y?"pointer":b?"keyboard":void 0,"data-panel-resize-handle-enabled":!s,"data-panel-resize-handle-id":v})}eC.displayName="PanelGroup",ez.displayName="forwardRef(PanelGroup)",e_.displayName="PanelResizeHandle";let eO=({className:e,...t})=>r.jsx(ez,{className:(0,w.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),eM=({withHandle:e,className:t,...s})=>r.jsx(e_,{className:(0,w.cn)("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...s,children:e&&r.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:r.jsx(D,{className:"size-2.5"})})});var eP=s(8281),eR=s(79210),eD=s(68232),eq=s(44389),eI=s(86333),eA=s(3240);let eL=(0,R.Z)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var eT=s(42924);let eZ=(0,R.Z)("ArchiveX",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"m9.5 17 5-5",key:"nakeu6"}],["path",{d:"m9.5 12 5 5",key:"1hccrj"}]]);var eF=s(88319);let e$=(0,R.Z)("FileStack",[["path",{d:"M16 2v5h5",key:"kt2in0"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17l4 4z",key:"1km23n"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);var eG=s(75909),eU=s(90434);let eV=({index:e,folder:t,edit:s,indented:n,children:a})=>(0,r.jsxs)("div",{className:"flex flex-col ",children:[(0,r.jsxs)("div",{className:(0,w.cn)((0,g.d)({variant:t.variant,size:"sm"}),n?"pl-5":null,t.active?"dark:bg-muted dark:text-white dark:hover:bg-muted dark:hover:text-white":null,"justify-start"),children:[(0,r.jsxs)(eU.default,{className:"flex",href:t.href||"",children:[r.jsx(t.icon,{className:"mr-2 size-4"}),!t.icon&&t.label,null!==t.icon&&r.jsx("span",{className:(0,w.cn)("ml-0 overflow-hidden text-ellipsis max-w-[170px]","default"===t.variant&&"text-background dark:text-white"),children:t.label})]},e),s&&r.jsx(eq.Z,{onClick:()=>{s()},className:"ml-auto size-4 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer"})]}),r.jsx("div",{children:a})]}),eW=({activeFolder:e,activeArchived:t,activeSources:s,activeEmbeddings:n})=>{let{data:a,loading:l,error:i}=(0,eG.t)();return r.jsx(r.Fragment,{children:(0,r.jsxs)("div",{className:"group flex flex-col gap-4 py-2 data-[collapsed=true]:py-2 pb-5",children:[e?r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(g.z,{variant:"link",size:"sm",asChild:!0,children:(0,r.jsxs)(eU.default,{href:"/data",children:[r.jsx(eI.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Back to dashboard"})]})})}):r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"text-sm text-muted-foreground ml-5 pt-3",children:"Select a context:"})}),r.jsx("nav",{className:"grid gap-1 px-2 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2",children:l?r.jsx(eV,{index:111,folder:{label:"Loading...",active:!1,icon:eA.Z,variant:"ghost"}}):a?.contexts?.items.map((a,l)=>r.jsx(eV,{index:l,folder:{label:`${a.name}`,icon:eL,variant:"ghost",href:`/data/${a.id}`},children:e?.toLowerCase()===`${a.id}`.toLowerCase()&&r.jsxs(r.Fragment,{children:[r.jsx(eV,{index:l,indented:!0,folder:{label:"Active data",active:e?.toLowerCase()===`${a.id}`.toLowerCase()&&!t&&!s&&!n,icon:eT.Z,variant:e?.toLowerCase()!==`${a.id}`.toLowerCase()||t||s||n?"ghost":"default",href:`/data/${a.id}`}}),r.jsx(eV,{index:l+1e3,indented:!0,folder:{label:"Archived data",active:t,icon:eZ,variant:t?"default":"ghost",href:`/data/${a.id}/archived`}}),r.jsx(eV,{index:l+1e3,indented:!0,folder:{label:"Sources",active:s,icon:eF.Z,variant:s?"default":"ghost",href:`/data/${a.id}/sources`}}),r.jsx(eV,{index:l+1e3,indented:!0,folder:{label:"Embeddings",active:n,icon:e$,variant:n?"default":"ghost",href:`/data/${a.id}/embeddings`}})]})},a.id))})]},e+t+s+n)})};function eB({children:e,params:t}){let s=t.query&&"archived"===t.query[1],n=t.query&&"sources"===t.query[1],a=t.query&&"embeddings"===t.query[1],l=t.query&&t.query[0],i=null;return t.query&&s?i=t.query[2]||null:!t.query||n||a||(i=t.query[1]||null),r.jsx(eD.pn,{delayDuration:0,children:(0,r.jsxs)(eO,{direction:"horizontal",onLayout:e=>{document.cookie=`react-resizable-panels:layout=${JSON.stringify(e)}`},className:"h-full items-stretch",children:[(0,r.jsxs)(Q,{defaultSize:15,collapsedSize:4,collapsible:!0,minSize:15,maxSize:20,children:[r.jsx(eP.Z,{}),r.jsx(eW,{activeFolder:l,activeArchived:s,activeSources:n,activeEmbeddings:a})]}),l&&!n&&!a&&(0,r.jsxs)(r.Fragment,{children:[r.jsx(eM,{withHandle:!0}),r.jsx(Q,{defaultSize:20,minSize:20,children:(0,r.jsxs)(eR.mQ,{defaultValue:"all",children:[r.jsx("div",{className:"flex items-center px-4 py-2 h-full",children:r.jsx("h1",{className:"text-xl font-bold",children:"Items"})}),r.jsx(eP.Z,{}),r.jsx(P,{activeFolder:l,activeItem:i??void 0,archived:s})]})})]}),r.jsx(eM,{withHandle:!0}),r.jsx(Q,{defaultSize:65,children:r.jsx("div",{className:"max-h-full overflow-y-auto",children:e})})]})})}},26533:(e,t,s)=>{"use strict";s.a(e,async(e,r)=>{try{s.r(t),s.d(t,{default:()=>p});var n=s(10326),a=s(65063);s(17577);var l=s(69771),i=s(18440),d=s(39167),c=s(42270),o=s(43273),u=s(65304),x=s(76812),h=s(5096),m=e([a]);function p({params:e}){let{data:t,loading:s,error:r}=(0,d.aM)(c.fV,{skip:!e?.query?.[0],variables:{id:e?.query?.[0]}});if(!e.query)return n.jsx("div",{className:"grow flex flex-col",children:n.jsx(l.Z,{})});let m=e.query[0]||null,p="archived"===e.query[1],g="sources"===e.query[1],f="embeddings"===e.query[1];if(g)return n.jsx(h.L,{expand:!0,actions:!0,context:m});if(f)return n.jsx(i.U,{expand:!0,actions:!0,context:m});let j=null;return(p?j=e.query[2]||null:g||f||(j=e.query[1]||null),s||!t?.contextById)?(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[n.jsx(u.O,{className:"w-full h-[80px] rounded-md"}),n.jsx(u.O,{className:"w-full h-[50px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):r?(0,n.jsxs)(o.bZ,{variant:"destructive",children:[n.jsx(x.LPM,{className:"size-4"}),n.jsx(o.Cd,{children:"Error"}),n.jsx(o.X,{children:r?.message||"Error loading item."})]}):n.jsx(a.H,{actions:!0,context:t?.contextById,itemId:j})}a=(m.then?(await m)():m)[0],r()}catch(e){r(e)}})},69771:(e,t,s)=>{"use strict";s.d(t,{Z:()=>o});var r=s(10326),n=s(33519),a=s(17577),l=s(31051),i=s(42193),d=s(16923),c=s(22746);function o(){let[e,t]=(0,a.useState)("count"),[s,o]=(0,a.useState)({from:(0,n.k)(new Date,7),to:new Date}),[u,x]=(0,a.useState)("CONTEXT_UPSERT"),[h,m]=(0,a.useState)("label");return(0,r.jsxs)("div",{className:"flex-1 flex flex-col p-8 pt-6 h-screen",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-4xl font-bold tracking-tight bg-clip-text",children:"Contexts Dashboard"}),r.jsx("p",{className:"text-lg",children:"Monitor your contexts and their usage."})]}),r.jsx("div",{className:"flex items-center space-x-2",children:r.jsx(i.z,{dateRange:s,onDateRangeChange:o,maxDays:30})})]}),(0,r.jsxs)("div",{className:"flex-1 grid gap-6 md:grid-cols-3 min-h-0",children:[r.jsx("div",{className:"rounded-lg border md:col-span-2 p-6 flex flex-col",children:r.jsx(d.q,{dateRange:s,selectedType:u,onTypeChange:x,unitOptions:[{value:"count",label:"Count"}],onUnitChange:t,unit:e,dataTypes:[l.h.CONTEXT_RETRIEVE,l.h.CONTEXT_UPSERT]})}),r.jsx("div",{className:"rounded-lg border p-6 flex flex-col",children:r.jsx(c.Y,{groupByOptions:[],dateRange:s,selectedType:u,unit:e,groupBy:h,onGroupByChange:m})})]})]})}},65063:(e,t,s)=>{"use strict";s.a(e,async(e,r)=>{try{s.d(t,{H:()=>X});var n=s(10326),a=s(39167),l=s(18753),i=s(74064),d=s(23015),c=s(98091),o=s(40900),u=s(35157),x=s(31215),h=s(69508),m=s(91470),p=s(24081),g=s(21986),f=s(47206),j=s(231),v=s(35047),y=s(17577),b=s(74723),N=s(770),w=s(57004),k=s(18615),C=s(567),z=s(90772),S=s(55632),E=s(54432),_=s(37859),O=s(8281),M=s(33261),P=s(15940),R=s(87673),D=s(68232),q=s(62288),I=s(60097),A=s(99440),L=s(34789),T=s(77863),Z=s(65304),F=s(43273),$=s(76812),G=s(42270),U=s(15286),V=s(24295),W=s(33071),B=s(77961),J=e([w]);function X(e){let[t,s]=(0,y.useState)(),{toast:r}=(0,L.pm)(),J=(0,v.useRouter)(),[X,H]=(0,y.useState)(),K=e.context,Y=e.context.fields.map(e=>e.name);console.log("fields",Y),console.log("context",K);let{loading:Q,error:ee,refetch:et}=(0,a.aM)((0,G.A1)(e.context.id,Y,!0),{skip:!e.itemId||!e.context?.id,variables:{context:e.context.id,id:e.itemId},fetchPolicy:"no-cache",nextFetchPolicy:"network-only",onCompleted:t=>{let r=t[e.context.id+"_itemsById"];s({...r,tags:r.tags?r.tags.split(","):[]}),H({rights_mode:r.rights_mode,users:r.RBAC?.users,roles:r.RBAC?.roles})}}),[es,er]=(0,l.D)((0,G.ty)(e.context.id),{onCompleted:()=>{r({title:"Item updated",description:"Item updated successfully."})},onError:e=>{r({title:"Error updating item",description:e.message})}}),[en,ea]=(0,l.D)((0,G.mN)(e.context.id,[]),{onCompleted:()=>{r({title:"Item deleted",description:"Item deleted successfully."})},onError:e=>{r({title:"Error deleting item",description:e.message})}}),[el,ei]=(0,l.D)((0,G.Eq)(e.context.id),{onCompleted:t=>{let s=t[e.context.id+"_itemsGenerateChunks"];if(s.jobs?.length>0){r({title:"Chunks generation started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}r({title:"Chunks generated",description:"Chunks generated successfully."})}}),[ed,ec]=(0,l.D)((0,G.ps)(e.context.id),{onCompleted:t=>{let s=t[e.context.id+"_itemsDeleteChunks"];if(s.jobs?.length>0){r({title:"Chunks deletion started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}r({title:"Chunks deleted",description:"Chunks deleted successfully."})}}),[eo,eu]=(0,l.D)((0,G.dc)(e.context.id),{onCompleted:()=>{r({title:"Field processed",description:"Field processed successfully."})},onError:e=>{r({title:"Error processing field",description:e.message})}}),ex=N.Ry({name:N.Z_().nullable().optional(),tags:N.Z_().nullable().optional(),external_id:N.Z_().nullable().optional(),description:N.Z_().min(2,{message:"Text must be at least 2 characters."}).max(1e4,{message:"Text must not be longer than 10.0000 characters."}),...K?.fields?.reduce((e,t)=>({...e,[t.name]:N.Z_().nullable()}),{})??{}}),eh=(0,b.cI)({resolver:(0,i.F)(ex),defaultValues:{description:t?.description},mode:"onChange"}),em=e=>{if(e.target.value&&"Enter"===e.key){let r=t?.tags??[],n=[...Array.isArray(r)?[...r]:[]];n.push(e.target.value),console.log("tags",n),eh.setValue("tags",n.join(",")),s({...t,tags:n}),e.target.value=""}},[ep,eg]=(0,y.useState)(!1),[ef,ej]=(0,y.useState)(null),[ev,ey]=(0,y.useState)(null);return Q?(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[n.jsx(Z.O,{className:"w-full h-[80px] rounded-md"}),n.jsx(Z.O,{className:"w-full h-[50px] rounded-md mt-3"}),n.jsx(Z.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(Z.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(Z.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(Z.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):ee?(0,n.jsxs)(F.bZ,{variant:"destructive",children:[n.jsx($.LPM,{className:"size-4"}),n.jsx(F.Cd,{children:"Error"}),n.jsx(F.X,{children:ee?.message||"Error loading item."})]}):(0,n.jsxs)("div",{className:"flex h-full flex-col",children:[t?(0,n.jsxs)(n.Fragment,{children:[e.actions?(0,n.jsxs)(n.Fragment,{children:[n.jsx("div",{className:"flex items-center p-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[t?.archived?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:async()=>{t.id&&(es({variables:{id:t.id,input:{archived:!1}}}),s({...t,archived:!1}),J.push("./"))},variant:"ghost",size:"icon",disabled:!t||er.loading,children:[er.loading?n.jsx(_.g,{}):n.jsx(d.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Unarchive"})]})}),n.jsx(D._v,{children:"Unarchive"})]}),(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:async()=>{t.id&&(en({variables:{id:t.id}}),J.push("./"))},variant:"ghost",size:"icon",disabled:!t||ea.loading,children:[ea.loading?n.jsx(_.g,{}):n.jsx(c.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Delete"})]})}),n.jsx(D._v,{children:"Delete"})]})]}):(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:async()=>{t?.id&&(es({variables:{id:t.id,input:{archived:!0}}}),s({...t,archived:!0}),J.push("./"))},variant:"ghost",size:"icon",disabled:!t||er.loading,children:[er.loading?n.jsx(_.g,{}):n.jsx(o.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Archive"})]})}),n.jsx(D._v,{children:"Archive"})]}),ep?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:()=>{eg(!1)},variant:"ghost",size:"icon",children:[n.jsx(u.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Cancel"})]})}),n.jsx(D._v,{children:"Cancel"})]}),(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{disabled:er.loading,onClick:()=>{t?.id&&(es({variables:{id:t.id,input:{textlength:t?.text?.length,description:t?.description,name:t?.name,externalId:t?.externalId,tags:t?.tags?.join(","),source:t?.source,archived:t?.archived,rights_mode:X?.rights_mode,RBAC:{users:X?.users||[],roles:X?.roles||[]},...K?.fields?.reduce((e,s)=>({...e,[s.name]:t?.[s.name]}),{})??{}}}}),eg(!1))},variant:"ghost",size:"icon",children:[n.jsx(x.Z,{className:"size-4"}),(0,n.jsxs)("span",{className:"sr-only",children:["Save ",er.loading??n.jsx(_.g,{})]})]})}),n.jsx(D._v,{children:"Save"})]})]}):(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:()=>{eg(!0)},variant:"ghost",size:"icon",disabled:!t||er.loading,children:[n.jsx(h.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Edit"})]})}),n.jsx(D._v,{children:"Edit"})]})]})}),n.jsx(O.Z,{})]}):null,n.jsx("div",{className:"flex flex-1 flex-col",children:(0,n.jsxs)("div",{className:(0,T.cn)("space-y-2"),children:[n.jsx("div",{className:"flex items-center justify-between space-x-4 px-4 bg-muted rounded",children:n.jsx("h3",{className:"text-lg p-5 font-semibold tracking-tight text-lg",children:"Fields"})}),(0,n.jsxs)("div",{className:"p-5",children:[n.jsx(S.l0,{...eh,children:n.jsx("form",{className:"space-y-8",children:(0,n.jsxs)("div",{children:[(0,n.jsxs)(P.iA,{children:[n.jsx(P.xD,{children:(0,n.jsxs)(P.SC,{children:[n.jsx(P.ss,{children:"Name"}),n.jsx(P.ss,{children:"Value"})]})}),(0,n.jsxs)(P.RM,{children:[(0,n.jsxs)(P.SC,{children:[n.jsx(P.pj,{className:"font-medium capitalize",children:"Name"}),n.jsx(P.pj,{children:n.jsx(S.Wi,{control:eh.control,name:"name",render:({field:e})=>n.jsx(S.xJ,{children:ep?(0,n.jsxs)(n.Fragment,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{type:"text",disabled:!ep,onChange:e=>{s({...t,name:e.target.value})},placeholder:"Item name",value:t.name??""})}),n.jsx(S.zG,{})]}):n.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(t.name??""),r({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:t.name&&t.name?.length>200?t.name?.slice(0,200)+"...":t.name})})})})]},"name"),(0,n.jsxs)(P.SC,{children:[n.jsx(P.pj,{className:"font-medium capitalize",children:"Tags"}),(0,n.jsxs)(P.pj,{children:[ep?n.jsx("div",{className:"grid-row grid grid-flow-col gap-4 pt-2",children:n.jsx(S.Wi,{control:eh.control,name:"tags",render:({field:e})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{id:"includes",type:"text",onKeyUp:e=>em(e),placeholder:"Type and press enter to add"})}),n.jsx(S.zG,{})]})})}):null,t?.tags?.length?n.jsx("div",{className:"gap-2 pt-2",children:t?.tags?.map((e,r)=>n.jsx(C.C,{variant:"secondary",className:"px-3 py-2 mr-2 mb-2",children:n.jsxs("div",{className:"flex items-center",children:[n.jsx("div",{className:"text-muted-foreground truncate max-w-[200px]",children:e}),ep?n.jsx("span",{className:"size-4 cursor-pointer text-muted-foreground",onClick:()=>{let e=[...t.tags??[]];e.splice(r,1),eh.setValue("tags",e.join(",")),s({...t,tags:e})},children:n.jsx(m.Z,{className:"ml-1",size:15})}):null]})},`tag-${r}`))}):null]})]},"tags"),(0,n.jsxs)(P.SC,{children:[n.jsx(P.pj,{className:"font-medium capitalize",children:"Description"}),n.jsx(P.pj,{children:n.jsx(S.Wi,{control:eh.control,name:"description",render:({field:e})=>n.jsx(S.xJ,{children:ep?(0,n.jsxs)(n.Fragment,{children:[n.jsx(S.NI,{children:(0,n.jsxs)("div",{className:"relative",children:[n.jsx(R.g,{autoFocus:!0,disabled:!ep,onChange:e=>{s({...t,description:e.target.value})},placeholder:"Item text content",className:"resize-none",value:t.description??""}),(0,n.jsxs)(q.Vq,{children:[n.jsx(q.hg,{asChild:!0,children:(0,n.jsxs)(z.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>ej({name:"description",value:t.description??"",disabled:!1}),children:[n.jsx(p.Z,{className:"h-3 w-3"}),n.jsx("span",{className:"sr-only",children:"Expand"})]})}),(0,n.jsxs)(q.cZ,{className:"max-w-4xl max-h-[80vh]",children:[n.jsx(q.fK,{children:n.jsx(q.$N,{children:"Edit Description"})}),n.jsx("div",{className:"mt-4",children:n.jsx(R.g,{rows:20,className:"min-h-[400px] resize-none",value:ef?.name==="description"?ef.value:t.description??"",onChange:e=>{let r=e.target.value;ej(e=>e?.name==="description"?{...e,value:r}:e),s({...t,description:r})}})})]})]})]})}),n.jsx(S.zG,{})]}):n.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(t.description??""),r({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:n.jsx(k.J,{text:t.description??""})})})})})]},19091),(0,n.jsxs)(P.SC,{children:[n.jsx(P.pj,{className:"font-medium capitalize",children:"External ID"}),n.jsx(P.pj,{children:n.jsx(S.Wi,{control:eh.control,name:"external_id",render:({field:e})=>n.jsx(S.xJ,{children:ep?(0,n.jsxs)(n.Fragment,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{type:"text",disabled:!ep,onChange:e=>{console.log("e",e),s({...t,external_id:e.target.value})},placeholder:"xxxx-xxxx-xxxx-xxxx",value:t.external_id??""})}),n.jsx(S.zG,{})]}):n.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(t.external_id??""),r({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:t.external_id??""})})})})]},"externalId"),K?.fields?.length&&K.fields.map((e,a)=>(0,n.jsxs)(P.SC,{children:[(0,n.jsxs)(P.pj,{className:"font-medium capitalize flex flex-col",children:[e.label,e.calculated&&n.jsx("span",{className:"text-sm text-muted-foreground",children:"Calculated"}),e.processor&&(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{variant:"secondary",size:"sm",className:"w-auto mt-2",onClick:()=>{eo({variables:{item:t?.id,field:e.name}})},disabled:eu.loading,children:[eu.loading?n.jsx(_.g,{}):n.jsx(g.Z,{className:"size-4"}),n.jsx("span",{className:"ml-2",children:"Process"})]})}),n.jsx(D._v,{className:"max-w-xs",children:e.processor.description})]})]}),ep?n.jsx(n.Fragment,{children:(0,n.jsxs)(P.pj,{children:["code"===e.type||"json"===e.type||"text"===e.type||"longText"===e.type||"markdown"===e.type||"shortText"===e.type?n.jsx(S.Wi,{control:eh.control,name:e.name,render:({field:r})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:(0,n.jsxs)("div",{className:"relative",children:[n.jsx(R.g,{id:e.name,rows:"shortText"===e.type?2:7,onChange:r=>{s({...t,[e.name]:r.target.value})},value:t[e.name]??""}),(0,n.jsxs)(q.Vq,{children:[n.jsx(q.hg,{asChild:!0,children:(0,n.jsxs)(z.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>ej({name:e.name,disabled:!1,value:t[e.name]??""}),children:[n.jsx(p.Z,{className:"h-3 w-3"}),n.jsx("span",{className:"sr-only",children:"Expand"})]})}),(0,n.jsxs)(q.cZ,{className:"max-w-4xl max-h-[80vh]",children:[n.jsx(q.fK,{children:(0,n.jsxs)(q.$N,{children:["Edit ",e.name]})}),n.jsx("div",{className:"mt-4",children:n.jsx(R.g,{rows:20,className:"min-h-[400px] resize-none",value:ef?.name===e.name?ef.value:t[e.name]??"",onChange:r=>{let n=r.target.value;ej(t=>t?.name===e.name?{...t,value:n}:t),s({...t,[e.name]:n})}})})]})]})]})}),n.jsx(S.zG,{})]})}):null,"number"===e.type?n.jsx(S.Wi,{control:eh.control,name:e.name,render:({field:r})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{id:e.name,type:"number",onChange:r=>{s({...t,[e.name]:r.target.value})},value:t[e.name]??""})}),n.jsx(S.zG,{})]})}):null,"boolean"===e.type?n.jsx(S.Wi,{control:eh.control,name:e.name,render:({field:r})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:n.jsx(M.r,{checked:!!r.value,onCheckedChange:r=>{s({...t,[e.name]:r})}})}),n.jsx(S.zG,{})]})}):null,"file"===e.type&&n.jsx("div",{children:n.jsx(B.jF,{s3key:t[e.name],children:n.jsx(B.ZP,{id:`item-${t.id}`,buttonText:"Select File",allowedFileTypes:e.allowedFileTypes,dependencies:[],selectionLimit:1,onConfirm:r=>{console.log("keys",r),s({...t,[e.name]:r[0]})}})})})]})}):n.jsx(P.pj,{children:(0,n.jsxs)("span",{children:["code"===e.type&&n.jsx(w.G,{code:t[e.name]}),"json"===e.type&&n.jsx(w.G,{code:t[e.name],language:"json"}),"shortText"===e.type&&n.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(t[e.name]),r({title:"Copied to clipboard"})},children:t[e.name]}),"longText"===e.type&&n.jsx(k.J,{text:t[e.name]}),"file"===e.type&&n.jsx(B.jF,{s3key:t[e.name]}),"markdown"===e.type&&n.jsx(k.J,{text:t[e.name]}),!e.type&&n.jsx(k.J,{text:t[e.name]}),"text"===e.type&&n.jsx(k.J,{text:t[e.name]}),"number"===e.type&&n.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(t[e.name]),r({title:"Copied to clipboard"})},children:t[e.name]}),"boolean"===e.type&&n.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(t[e.name]),r({title:"Copied to clipboard"})},children:t[e.name]??""})]})})]},a))]})]}),n.jsx(O.Z,{className:"my-4"})]})})}),n.jsx(W.Zb,{className:"bg-transparent",children:(0,n.jsxs)(V.zF,{children:[n.jsx(W.Ol,{className:"p-4",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-base",children:"Access Control"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-0",children:"Control access to this item."})]}),n.jsx(V.wy,{asChild:!0,children:(0,n.jsxs)(z.z,{variant:"ghost",size:"icon",className:"size-8",children:[n.jsx(f.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Toggle"})]})})]})}),n.jsx(V.Fw,{className:"mt-5",children:n.jsx(W.aY,{className:"space-y-4",children:n.jsx(U.P,{initialRightsMode:t.rights_mode,initialUsers:t.RBAC?.users,initialRoles:t.RBAC?.roles,onChange:(e,t,s)=>{H({rights_mode:e,users:t,roles:s})}})})})]})}),(0,n.jsxs)("div",{className:"mt-4 border border p-3 pb-5 rounded",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between ml-4 mt-3 mr-4 mb-2",children:[n.jsx("h1",{className:"text-lg font-medium",children:"Embeddings"}),(0,n.jsxs)(I.h_,{modal:!1,children:[n.jsx(I.$F,{asChild:!0,children:(0,n.jsxs)(z.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[n.jsx(j.Z,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Open menu"})]})}),(0,n.jsxs)(I.AW,{align:"end",children:[n.jsx(I.Xi,{onClick:()=>ey("generate"),children:"Generate embeddings"}),n.jsx(I.Xi,{onClick:()=>ey("delete"),children:"Delete embeddings"})]})]})]}),(0,n.jsxs)(P.iA,{children:[n.jsx(P.Rn,{children:t?.chunks?.length?"A list of all embeddings for this item.":"No embeddings found."}),n.jsx(P.xD,{children:(0,n.jsxs)(P.SC,{children:[n.jsx(P.ss,{children:"Index"}),n.jsx(P.ss,{children:"Content"}),n.jsx(P.ss,{children:"Dimensions"}),n.jsx(P.ss,{children:"Created At"}),n.jsx(P.ss,{children:"Updated At"})]})}),n.jsx(P.RM,{children:t?.chunks?.length?t?.chunks?.length&&t.chunks.map(e=>(0,n.jsxs)(P.SC,{children:[n.jsx(P.pj,{className:"font-medium capitalize",children:e.chunk_index+1}),n.jsx(P.pj,{children:n.jsx(k.J,{text:e.content})}),n.jsx(P.pj,{children:e.embedding_size||0}),n.jsx(P.pj,{children:new Date(e.chunk_created_at).toLocaleString()}),n.jsx(P.pj,{children:new Date(e.chunk_updated_at).toLocaleString()})]},e.id)):null})]})]})]})]})})]}):(0,n.jsxs)(n.Fragment,{children:[" ",!t&&e.itemId?n.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Item not found."}):n.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"No item selected."})]}),n.jsx(A.aR,{open:"generate"===ev,onOpenChange:e=>!e&&ey(null),children:(0,n.jsxs)(A._T,{children:[(0,n.jsxs)(A.fY,{children:[n.jsx(A.f$,{children:"Generate Embeddings"}),n.jsx(A.yT,{children:"Are you sure you want to generate embeddings for this item? This will create new embedding vectors for the content."})]}),(0,n.jsxs)(A.xo,{children:[n.jsx(A.le,{children:"Cancel"}),n.jsx(A.OL,{disabled:ei.loading,onClick:()=>{t?.id&&(console.log("Generate embeddings for item:",t?.id),ey(null),el({variables:{where:{id:{eq:t?.id}}}}))},children:"Generate"})]})]})}),n.jsx(A.aR,{open:"delete"===ev,onOpenChange:e=>!e&&ey(null),children:(0,n.jsxs)(A._T,{children:[(0,n.jsxs)(A.fY,{children:[n.jsx(A.f$,{children:"Delete Embeddings"}),n.jsx(A.yT,{children:"Are you sure you want to delete all embeddings for this item? This action cannot be undone."})]}),(0,n.jsxs)(A.xo,{children:[n.jsx(A.le,{children:"Cancel"}),n.jsx(A.OL,{disabled:ec.loading,onClick:async()=>{t?.id&&(console.log("Delete embeddings for item:",t?.id),ey(null),ed({variables:{where:{id:{eq:t?.id}}}}))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}w=(J.then?(await J)():J)[0],r()}catch(e){r(e)}})},18440:(e,t,s)=>{"use strict";s.d(t,{U:()=>P});var r=s(10326),n=s(39167),a=s(18753),l=s(35047),i=s(17577),d=s(567),c=s(90772),o=s(33071),u=s(8281),x=s(65685),h=s(32663),m=s(90434),p=s(99440),g=s(85999),f=s(42270),j=s(29718),v=s(15940),y=s(75290),b=s(60097),N=s(76812);function w({contextId:e}){let[t,s]=(0,i.useState)(null),[l,d]=(0,i.useState)(!0),u=(0,i.useRef)(new Date(Date.now()-18144e5).toISOString()),{loading:x,data:w,refetch:k,previousData:C,error:z}=(0,n.aM)((0,f.P3)(e,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{context:e,page:1,limit:5,filters:[{embeddings_updated_at:{gte:u.current}}],sort:{field:"embeddings_updated_at",direction:"DESC"}}}),[S,E]=(0,a.D)((0,f.Eq)(e),{onCompleted:t=>{let s=t[e+"_itemsGenerateChunks"];if(s.jobs?.length>0){g.Am.success("Chunks generation started",{description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}g.Am.success("Chunks generated",{description:"Chunks generated successfully."})}}),[_,O]=(0,a.D)((0,f.ps)(e),{onCompleted:t=>{let s=t[e+"_itemsDeleteChunks"];if(s.jobs?.length>0){g.Am.success("Chunks deletion started",{description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}g.Am.success("Chunks deleted",{description:"Chunks deleted successfully."})}}),M=w?.[e+f.Md];return x?r.jsx(o.Zb,{children:r.jsx(o.aY,{className:"pt-6",children:r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(y.Z,{className:"h-6 w-6 animate-spin"})})})}):(0,r.jsxs)(o.Zb,{className:"border-0 rounded-none",children:[r.jsx(o.Ol,{children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{children:[r.jsx(o.ll,{children:"Recent Embeddings"}),r.jsx(o.SZ,{children:"Items with embeddings updated in the last 21 days"})]}),x&&r.jsx(y.Z,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),r.jsx("div",{children:(0,r.jsxs)(b.h_,{modal:!1,children:[r.jsx(b.$F,{asChild:!0,children:(0,r.jsxs)(c.z,{variant:"ghost",className:"flex size-8 p-0 data-[state=open]:bg-muted",children:[r.jsx(N.nWS,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Open menu"})]})}),(0,r.jsxs)(b.AW,{align:"end",children:[r.jsx(b.Xi,{onClick:()=>s("generate"),children:"Generate all embeddings"}),r.jsx(b.Xi,{onClick:()=>{s("delete")},children:"Delete all embeddings"})]})]})})]})}),r.jsx(o.aY,{children:r.jsx("div",{className:"border rounded-lg",children:M?.items?.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No recent embeddings"}):(0,r.jsxs)(v.iA,{children:[r.jsx(v.xD,{children:(0,r.jsxs)(v.SC,{children:[r.jsx(v.ss,{children:"Name"}),r.jsx(v.ss,{className:"text-right",children:"Updated"})]})}),r.jsx(v.RM,{children:M?.items?.map((t,s)=>r.jsxs(v.SC,{children:[r.jsx(v.pj,{className:"font-medium",children:r.jsx(m.default,{className:"hover:text-blue-500 hover:underline",href:`/data/${e}/${t.id}`,children:r.jsx(j.L,{text:t.name||t.id||"",length:100})})}),r.jsx(v.pj,{className:"text-right text-sm text-muted-foreground",children:t.embeddings_updated_at?h.Q(new Date(t.embeddings_updated_at),{addSuffix:!0}):"never"})]},s))})]})})}),r.jsx(p.aR,{open:"generate"===t,onOpenChange:e=>!e&&s(null),children:(0,r.jsxs)(p._T,{children:[(0,r.jsxs)(p.fY,{children:[r.jsx(p.f$,{children:"Generate Embeddings"}),r.jsx(p.yT,{children:"Are you sure you want to generate embeddings for this context? This will create new embedding vectors for every item in the context, this can take a long time, might cost money if you are using a paid service as your embedder, or require a lot of computational resources if your embedder is self hosted."})]}),(0,r.jsxs)(p.xo,{children:[r.jsx(p.le,{children:"Cancel"}),r.jsx(p.OL,{disabled:E.loading,onClick:()=>{s(null),S(),g.Am.info("Generating embeddings...",{description:"Embeddings are being generated in the background, depending on the size of the item this may take a while."})},children:"Generate"})]})]})}),r.jsx(p.aR,{open:"delete"===t,onOpenChange:e=>!e&&s(null),children:(0,r.jsxs)(p._T,{children:[(0,r.jsxs)(p.fY,{children:[r.jsx(p.f$,{children:"Delete Embeddings"}),r.jsx(p.yT,{children:"Are you sure you want to delete all embeddings for this context? This action cannot be undone. Embeddings are used to search and filter items, deleting them will remove this functionality from the context, regenerating embeddings might take a long time, might cost money if you are using a paid service as your embedder, or require a lot of computational resources if your embedder is self hosted."})]}),(0,r.jsxs)(p.xo,{children:[r.jsx(p.le,{children:"Cancel"}),r.jsx(p.OL,{disabled:O.loading,onClick:async()=>{s(null),_(),g.Am.success("Embeddings deleted",{description:"All embeddings for this item have been deleted."})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}var k=s(43273),C=s(65304),z=s(34789),S=s(24295),E=s(18286),_=s(86333),O=s(941),M=s(19753);function P(e){let[t,s]=(0,i.useState)(!0),{toast:h}=(0,z.pm)(),{data:m,loading:p,error:g}=(0,n.aM)(f.fV,{variables:{id:e.context}}),j=m?.contextById,v=(0,l.useRouter)(),[y,b]=(0,a.D)(f.xR,{onCompleted:e=>{I(),h({title:"Embedder configs updated",description:"Embedder configs updated successfully."})},onError:e=>{I(),h({title:"Error updating embedder configs",description:e.message})}}),[P,R]=(0,a.D)(f.s7,{onCompleted:e=>{I(),h({title:"Embedder configs created",description:"Embedder configs created successfully."})},onError:e=>{I(),h({title:"Error creating embedder configs",description:e.message})}}),{data:D,loading:q,refetch:I}=(0,n.aM)(f.c2,{skip:!j?.embedder?.id,variables:{context:e.context,embedder:j?.embedder?.id}}),A=D?.embedder_settingsPagination?.items||[],{data:L}=(0,n.aM)(f.Az,{variables:{page:1,limit:100}}),T=L?.variablesPagination?.items||[];return p?(0,r.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[r.jsx(C.O,{className:"w-full h-[80px] rounded-md"}),r.jsx(C.O,{className:"w-full h-[50px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):g?(0,r.jsxs)(k.bZ,{variant:"destructive",children:[r.jsx(N.LPM,{className:"size-4"}),r.jsx(k.Cd,{children:"Error"}),r.jsx(k.X,{children:g?.message||"Error loading item."})]}):(0,r.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex p-2 justify-between",children:[r.jsx("div",{className:"flex items-center gap-2"}),(0,r.jsxs)(c.z,{onClick:()=>{v.push("/context")},variant:"ghost",size:"icon",children:[r.jsx(_.Z,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Back"})]})]}),r.jsx(u.Z,{})]}):null,j?(0,r.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,r.jsxs)(o.Zb,{className:"border-0 rounded-none",children:[r.jsx(o.Ol,{children:r.jsx(o.ll,{className:"text-lg",children:"Settings"})}),r.jsx(o.aY,{className:"grid gap-4",children:r.jsx(x.x,{className:"max-h-[600px]",children:(0,r.jsxs)("div",{className:"space-y-6 pr-4",children:[(0,r.jsxs)("div",{children:[r.jsx("h2",{className:"text-xl font-bold",children:j.name}),r.jsx("p",{className:"text-muted-foreground mt-1",children:j.description}),(0,r.jsxs)("div",{className:"mt-3 flex items-center",children:[r.jsx("span",{className:"text-sm font-medium mr-2",children:"Embedder:"}),(0,r.jsxs)(d.C,{variant:"outline",children:[j.embedder?.name||"None"," (",j.embedder?.id,")"]})]})]}),(0,r.jsxs)("div",{children:[r.jsx("span",{className:"text-sm font-medium mr-2",children:"Calculate Vectors:"}),r.jsx(d.C,{variant:"secondary",children:j.configuration?.calculateVectors?j.configuration.calculateVectors.charAt(0).toUpperCase()+j.configuration.calculateVectors.slice(1):"Manual"}),(0,r.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground",children:[(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"Manual"}),": Vectors are only calculated when triggered manually."]}),(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"On Update"}),": Vectors are recalculated whenever an item is updated."]}),(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"On Insert"}),": Vectors are calculated when a new item is inserted."]}),(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"Always"}),": Vectors are calculated on both insert and update operations."]})]})]}),(0,r.jsxs)("div",{children:[r.jsx("span",{className:"text-sm font-medium mr-2",children:"Embedder Configs:"}),r.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:T?.length&&j?.embedder?.config?.map(t=>{let s=A?.find(e=>e.name===t.name);return console.log("currentValue",s),console.log("embedderConfigs",A),console.log("config",t),r.jsxs("div",{className:"space-y-2",children:[r.jsx(E.f,{configItem:t,currentValue:s?.value||"",variables:T,onVariableSelect:r=>{console.log("variableName",r),s?y({variables:{id:s.id,name:t.name,value:r}}):P({variables:{name:t.name,value:r,context:e.context,embedder:j?.embedder?.id}})}}),r.jsx("span",{children:t.description})]},t.name)})})]})]})})})]}),r.jsx(w,{contextId:j.id}),r.jsx(S.zF,{open:t,onOpenChange:s,children:(0,r.jsxs)(o.Zb,{className:"bg-none border-0 rounded-none",children:[r.jsx(o.Ol,{children:r.jsx(S.wy,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",children:[r.jsx(o.ll,{children:"Queues"}),(0,r.jsxs)(c.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[r.jsx(O.Z,{className:`h-4 w-4 transition-transform ${t?"":"-rotate-90"}`}),r.jsx("span",{className:"sr-only",children:"Toggle sources"})]})]})})}),r.jsx(S.Fw,{children:r.jsx(o.aY,{children:j.embedder?.queue?r.jsx("div",{className:"space-y-4",children:r.jsx("div",{children:r.jsx(M.R,{queueName:j.embedder?.queue,nameGenerator:e=>"Source update",retryJob:e=>{if(!e.data?.source||!e.data?.context)return}})},j.embedder?.queue)}):r.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No queues found."})})})]})})]}):r.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."})]})}},5096:(e,t,s)=>{"use strict";s.d(t,{L:()=>_});var r=s(10326),n=s(39167),a=s(18753),l=s(86333),i=s(94893),d=s(941),c=s(75290),o=s(35047),u=s(17577),x=s(90772),h=s(33071),m=s(8281),p=s(65685),g=s(54432),f=s(31048),j=s(24295),v=s(15940),y=s(567),b=s(68232),N=s(62288),w=s(42270),k=s(43273),C=s(65304),z=s(76812),S=s(19753),E=s(85999);function _(e){let[t,s]=(0,u.useState)(!0),[_,O]=(0,u.useState)(!1),[M,P]=(0,u.useState)(null),[R,D]=(0,u.useState)({}),{data:q,loading:I,error:A}=(0,n.aM)(w.fV,{variables:{id:e.context}}),L=q?.contextById,T=(0,o.useRouter)(),[Z,{loading:F}]=(0,a.D)((0,w.C3)(e.context),{onCompleted:t=>{let s=t[`${e.context}_itemsExecuteSource`];O(!1),P(null),D({}),E.Am.success(s.message||"Source executed successfully",{description:s.jobs?.length?`${s.jobs.length} job(s) scheduled`:s.items?.length?`${s.items.length} item(s) processed`:void 0})},onError:e=>{E.Am.error("Failed to execute source",{description:e.message})}}),$=(e,t,s,r)=>{if(P({id:e,name:t,queue:s,params:r}),r){let e={};r.forEach(t=>{e[t.name]=t.default||""}),D(e)}O(!0)};if(I)return(0,r.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[r.jsx(C.O,{className:"w-full h-[80px] rounded-md"}),r.jsx(C.O,{className:"w-full h-[50px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"})]});if(A)return(0,r.jsxs)(k.bZ,{variant:"destructive",children:[r.jsx(z.LPM,{className:"size-4"}),r.jsx(k.Cd,{children:"Error"}),r.jsx(k.X,{children:A?.message||"Error loading item."})]});let G=[];return L&&(G=Array.from(new Set(L.sources.map(e=>e.config.queue).filter(e=>!!e)))),(0,r.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex p-2 justify-between",children:[r.jsx("div",{className:"flex items-center gap-2"}),(0,r.jsxs)(x.z,{onClick:()=>{T.push("/context")},variant:"ghost",size:"icon",children:[r.jsx(l.Z,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Back"})]})]}),r.jsx(m.Z,{})]}):null,L?(0,r.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,r.jsxs)(h.Zb,{className:"border-0 rounded-none",children:[r.jsx(h.Ol,{children:r.jsx(h.ll,{className:"text-lg",children:"Settings"})}),r.jsx(h.aY,{className:"grid gap-4",children:r.jsx(p.x,{className:"max-h-[600px]",children:r.jsx("div",{className:"space-y-6 pr-4",children:(0,r.jsxs)("div",{children:[r.jsx("h2",{className:"text-xl font-bold",children:L.name}),r.jsx("p",{className:"text-muted-foreground mt-1",children:L.description})]})})})})]}),(0,r.jsxs)(h.Zb,{className:"border-0 rounded-none",children:[(0,r.jsxs)(h.Ol,{children:[r.jsx(h.ll,{children:"Sources"}),r.jsx(h.SZ,{children:"Sources are used to fetch external data and ingest them into the context."})]}),r.jsx(h.aY,{children:L.sources&&L.sources.length>0?r.jsx(b.pn,{children:r.jsx("div",{className:"rounded-md border",children:(0,r.jsxs)(v.iA,{children:[r.jsx(v.xD,{children:(0,r.jsxs)(v.SC,{children:[r.jsx(v.ss,{children:"Name"}),r.jsx(v.ss,{children:"Description"}),r.jsx(v.ss,{children:"Queue Configuration"}),r.jsx(v.ss,{className:"text-right",children:"Actions"})]})}),r.jsx(v.RM,{children:L.sources.map(e=>{let t=e.config.queue||e.config.schedule||void 0!==e.config.retries||e.config.backoff;return(0,r.jsxs)(v.SC,{children:[r.jsx(v.pj,{className:"font-medium",children:e.name}),r.jsx(v.pj,{className:"max-w-[300px]",children:e.description||"-"}),r.jsx(v.pj,{children:t?(0,r.jsxs)(b.u,{children:[r.jsx(b.aJ,{asChild:!0,children:r.jsx("div",{className:"cursor-help",children:e.config.queue?r.jsx(y.C,{variant:"outline",className:"cursor-help",children:e.config.queue}):r.jsx("span",{className:"text-muted-foreground",children:"No queue configured"})})}),r.jsx(b._v,{className:"max-w-[300px]",children:(0,r.jsxs)("div",{className:"space-y-2",children:[e.config.queue&&(0,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Queue:"}),r.jsx("span",{className:"ml-2 text-xs",children:e.config.queue})]}),e.config.schedule&&(0,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Schedule:"}),r.jsx("code",{className:"ml-2 text-xs bg-muted px-1 py-0.5 rounded",children:e.config.schedule})]}),void 0!==e.config.retries&&(0,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Retries:"}),r.jsx("span",{className:"ml-2 text-xs",children:e.config.retries||"Default (3)"})]}),e.config.backoff&&(0,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Backoff:"}),(0,r.jsxs)("span",{className:"ml-2 text-xs",children:[e.config.backoff.type||"Default (exponential)"," (",e.config.backoff.delay||"Default (2000)","ms)"]})]})]})})]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(v.pj,{className:"text-right",children:r.jsx(x.z,{variant:"ghost",size:"sm",onClick:()=>$(e.id,e.name,e.config.queue,e.config.params),title:"Manually trigger source",children:r.jsx(i.Z,{className:"h-4 w-4"})})})]},e.id)})})]})})}):r.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No sources found."})})]}),r.jsx(j.zF,{open:t,onOpenChange:s,children:(0,r.jsxs)(h.Zb,{className:"bg-none border-0 rounded-none",children:[r.jsx(h.Ol,{children:r.jsx(j.wy,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",children:[r.jsx(h.ll,{children:"Queues"}),(0,r.jsxs)(x.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[r.jsx(d.Z,{className:`h-4 w-4 transition-transform ${t?"":"-rotate-90"}`}),r.jsx("span",{className:"sr-only",children:"Toggle sources"})]})]})})}),r.jsx(j.Fw,{children:r.jsx(h.aY,{children:G.length>0?r.jsx("div",{className:"space-y-4",children:G.map(e=>r.jsx("div",{children:r.jsx(S.R,{queueName:e,nameGenerator:e=>"Source update",retryJob:e=>{if(console.log("[EXULU] Retrying job: ",e),!e.data?.source||!e.data?.context)return;let t=L?.sources.find(t=>t.id===e.data?.source);if(!t){E.Am.error("Source not found for job: "+e.data?.source,{description:"The source was not found for the job. This might mean the source no longer exists."});return}let s=t.config;$(t.id,t.name,t.config.queue,s.params)}})},e))}):r.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No queues found."})})})]})})]}):r.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."}),r.jsx(N.Vq,{modal:!1,open:_,onOpenChange:e=>{O(e),e||(D({}),P(null))},children:(0,r.jsxs)(N.cZ,{children:[(0,r.jsxs)(N.fK,{children:[r.jsx(N.$N,{children:"Trigger Source"}),r.jsx(N.Be,{children:M?.queue?(0,r.jsxs)(r.Fragment,{children:["Are you sure you want to trigger ",r.jsx("strong",{children:M.name}),"?",r.jsx("br",{}),r.jsx("br",{}),"A job will be scheduled and visible in the ",r.jsx("span",{className:"font-semibold",children:M.queue})," queue."]}):(0,r.jsxs)(r.Fragment,{children:["Are you sure you want to trigger ",r.jsx("strong",{children:M?.name}),"?",r.jsx("br",{}),r.jsx("br",{}),"The source will be executed immediately without queuing."]})})]}),M?.params&&M.params.length>0&&(0,r.jsxs)("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"text-sm font-medium",children:"Parameters"}),M.params.map(e=>(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)(f._,{htmlFor:e.name,children:[e.name,e.description&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:e.description})]}),r.jsx(g.I,{id:e.name,value:R[e.name]||"",onChange:t=>{D(s=>({...s,[e.name]:t.target.value}))},placeholder:e.default||"",disabled:F})]},e.name))]}),(0,r.jsxs)(N.cN,{children:[r.jsx(x.z,{variant:"outline",onClick:()=>O(!1),disabled:F,children:"Cancel"}),r.jsx(x.z,{onClick:()=>{M&&Z({variables:{source:M.id,inputs:R}})},disabled:F,children:F?(0,r.jsxs)(r.Fragment,{children:[r.jsx(c.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Executing..."]}):(0,r.jsxs)(r.Fragment,{children:[r.jsx(i.Z,{className:"mr-2 h-4 w-4"}),"Trigger Source"]})})]})]})})]})}},42193:(e,t,s)=>{"use strict";s.d(t,{z:()=>f});var r=s(10326),n=s(17577),a=s(76812),l=s(57305),i=s(92977),d=s(98181),c=s(77863),o=s(90772),u=s(11890),x=s(39183),h=s(17757);function m({className:e,classNames:t,showOutsideDays:s=!0,...n}){return r.jsx(h._W,{showOutsideDays:s,className:(0,c.cn)("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:(0,c.cn)((0,o.d)({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:(0,c.cn)((0,o.d)({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({...e})=>r.jsx(u.Z,{className:"size-4"}),IconRight:({...e})=>r.jsx(x.Z,{className:"size-4"})},...n})}m.displayName="Calendar";var p=s(34789),g=s(30811);function f({dateRange:e,onDateRangeChange:t,className:s,maxDays:u=30}){let{toast:x}=(0,p.pm)(),h=n.useMemo(()=>{if(!e?.from)return[];let t=e.from;return[{before:(0,i.E)(t,-u)},{after:(0,i.E)(t,u)}]},[e?.from,u]);return r.jsx("div",{className:(0,c.cn)("grid gap-2",s),children:(0,r.jsxs)(g.J2,{children:[r.jsx(g.xo,{asChild:!0,children:(0,r.jsxs)(o.z,{id:"date",variant:"outline",className:(0,c.cn)("w-[260px] justify-start text-left font-normal",!e&&"text-muted-foreground"),children:[r.jsx(a.Que,{className:"mr-2 h-4 w-4"}),e?.from?e.to?(0,r.jsxs)(r.Fragment,{children:[(0,d.WU)(e.from,"LLL dd, y")," -"," ",(0,d.WU)(e.to,"LLL dd, y")]}):(0,d.WU)(e.from,"LLL dd, y"):r.jsx("span",{children:"Pick a date range"})]})}),(0,r.jsxs)(g.yk,{className:"w-auto p-0",align:"end",children:[r.jsx(m,{initialFocus:!0,mode:"range",defaultMonth:e?.from,selected:e,onSelect:e=>{if(e?.from&&e?.to&&(0,l.j)(e.to,e.from)>u){x({title:"Date range too large",description:`Please select a date range of ${u} days or less.`,variant:"destructive"});return}t(e)},disabled:h,numberOfMonths:2}),(0,r.jsxs)("div",{className:"p-3 pt-0 text-xs text-muted-foreground border-t",children:["Maximum range: ",u," days"]})]})]})})}},22746:(e,t,s)=>{"use strict";s.d(t,{Y:()=>m});var r=s(10326),n=s(17577),a=s(39167),l=s(34474),i=s(65304),d=s(42270),c=s(20751),o=s(78948),u=s(99630),x=s(90250);let h=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))","hsl(var(--chart-6))","hsl(var(--chart-7))","hsl(var(--chart-8))","hsl(var(--chart-9))","hsl(var(--chart-10))"];function m({groupByOptions:e,dateRange:t,selectedType:s,groupBy:m,onGroupByChange:p,unit:g}){let{data:f,loading:j,error:v}=(0,a.aM)(d.YH,{variables:{type:s,groupBy:m,from:t?.from?.toISOString(),to:t?.to?.toISOString(),names:"tokens"===g?["inputTokens","outputTokens"]:["count"]},skip:!t?.from||!t?.to}),{chartData:y,chartConfig:b}=n.useMemo(()=>{if(!f?.trackingStatistics)return{chartData:[],chartConfig:{}};let e=f.trackingStatistics.map((e,t)=>{var s;return{name:(s=e?.group)&&"string"==typeof s?s.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "):"Unknown",value:e?.count,fill:h[t%h.length]}}).sort((e,t)=>t.value-e.value),t=e.reduce((e,t,s)=>(e[t.name]={label:t.name,color:h[s%h.length]},e),{});return{chartData:e,chartConfig:t}},[f]);return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-xl font-semibold",children:"Distribution"}),e.length>0&&r.jsx("div",{className:"w-full max-w-[150px]",children:(0,r.jsxs)(l.Ph,{value:m,onValueChange:p,children:[r.jsx(l.i4,{children:r.jsx(l.ki,{placeholder:"Group by"})}),r.jsx(l.Bw,{children:e.map(e=>r.jsx(l.Ql,{value:e.value,children:e.label},e.value))})]})})]}),r.jsx("div",{className:"flex-1 min-h-0",children:j?r.jsx("div",{className:"space-y-4 h-full",children:r.jsx(i.O,{className:"h-full w-full"})}):v?(0,r.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading distribution data: ",v.message]}):0===y.length?r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-center",children:"No data available for the selected date range, type, and grouping."}):r.jsx(x.BO,{config:b,className:"h-full w-full",children:(0,r.jsxs)(c.u,{children:[r.jsx("defs",{children:y.map((e,t)=>(0,r.jsxs)("radialGradient",{id:`gradient-${e.name.replace(/\s+/g,"-")}`,cx:"50%",cy:"50%",r:"50%",children:[r.jsx("stop",{offset:"0%",stopColor:e.fill,stopOpacity:1}),r.jsx("stop",{offset:"100%",stopColor:e.fill,stopOpacity:.8})]},`gradient-${t}`))}),r.jsx(o.b,{data:y,cx:"50%",cy:"50%",labelLine:!1,label:({cx:e,cy:t,midAngle:s,innerRadius:n,outerRadius:a,percent:l,index:i})=>{if(l<.05)return null;let d=Math.PI/180,c=n+(a-n)*.5,o=e+c*Math.cos(-s*d);return r.jsx("text",{x:o,y:t+c*Math.sin(-s*d),fill:"black",textAnchor:o>e?"start":"end",dominantBaseline:"central",fontSize:"12",fontWeight:"600",paintOrder:"stroke",children:`${(100*l).toFixed(0)}%`})},outerRadius:"75%",innerRadius:"45%",dataKey:"value",strokeWidth:3,children:y.map((e,t)=>r.jsx(u.b,{fill:`url(#gradient-${e.name.replace(/\s+/g,"-")})`},`cell-${t}`))}),r.jsx(x.h7,{content:r.jsx(x.dg,{nameKey:"name",hideLabel:!0,formatter:(e,t)=>["number"==typeof e?e.toLocaleString():e," "+String(t)]})})]})})})]})}},16923:(e,t,s)=>{"use strict";s.d(t,{q:()=>y});var r=s(10326),n=s(17577),a=s(39167),l=s(34474),i=s(65304),d=s(42270),c=s(10669),o=s(18423),u=s(62637),x=s(9997),h=s(47445),m=s(90250),p=s(98181),g=s(99515),f=s(32067);function j(e){return e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}let v={count:{label:"Count",color:"hsl(var(--muted-foreground))"}};function y({dataTypes:e,dateRange:t,selectedType:s,onTypeChange:y,onUnitChange:b,unit:N,unitOptions:w}){let{data:k,loading:C,error:z}=(0,a.aM)(d.j9,{variables:{type:s,name:N,from:t?.from?.toISOString(),to:t?.to?.toISOString(),names:[N]},skip:!t?.from||!t?.to}),S=n.useMemo(()=>{if(!k?.trackingStatistics||!t?.from||!t?.to)return[];let e=new Map;return k.trackingStatistics.forEach(t=>{let s=new Date("number"==typeof t.group?t.group:Number(t.group)),r=(0,p.WU)((0,g.b)(s),"yyyy-MM-dd");e.set(r,t.count)}),(0,f.D)({start:(0,g.b)(t.from),end:(0,g.b)(t.to)}).map(t=>{let s=(0,p.WU)(t,"yyyy-MM-dd"),r=e.get(s)||0;return{date:t.getTime(),count:r,formattedDate:(0,p.WU)(t,"MMM dd"),dateObj:t}})},[k,t]);return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-xl font-semibold",children:"Time Series Analytics"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-[150px]",children:(0,r.jsxs)(l.Ph,{value:s,onValueChange:e=>y(e),children:[r.jsx(l.i4,{children:r.jsx(l.ki,{placeholder:"Select data type"})}),r.jsx(l.Bw,{children:e?.map(e=>r.jsx(l.Ql,{value:e,children:j(e)+" "},e))})]})}),w?.length>1&&r.jsx("div",{className:"w-[150px]",children:(0,r.jsxs)(l.Ph,{value:N,onValueChange:e=>b(e),children:[r.jsx(l.i4,{children:r.jsx(l.ki,{placeholder:"Select unit"})}),r.jsx(l.Bw,{children:w?.map(e=>r.jsx(l.Ql,{value:e.value,children:e.label},e.value))})]})})]})]}),r.jsx("div",{className:"flex-1 min-h-0",children:C?r.jsx("div",{className:"space-y-4 h-full",children:r.jsx(i.O,{className:"h-full w-full"})}):z?(0,r.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading time series data: ",z.message]}):0===S.length?r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No data available for the selected date range and type"}):r.jsx(m.BO,{config:v,className:"h-full w-full",children:(0,r.jsxs)(c.T,{data:S,children:[(0,r.jsxs)("defs",{children:[(0,r.jsxs)("linearGradient",{id:"fillCount",x1:"0",y1:"0",x2:"0",y2:"1",children:[r.jsx("stop",{offset:"5%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.3}),r.jsx("stop",{offset:"95%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.05})]}),(0,r.jsxs)("linearGradient",{id:"strokeCount",x1:"0",y1:"0",x2:"1",y2:"0",children:[r.jsx("stop",{offset:"0%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.8}),r.jsx("stop",{offset:"100%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.6})]})]}),r.jsx(o.q,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,vertical:!1}),r.jsx(u.K,{dataKey:"formattedDate",tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"},tickLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5},axisLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5}}),r.jsx(x.B,{tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"},tickLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5},axisLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5}}),r.jsx(m.h7,{labelFormatter:(e,t)=>t&&t[0]?(0,p.WU)(t[0].payload.dateObj,"PPP")+" ":e,content:r.jsx(m.dg,{nameKey:"name",hideLabel:!0,formatter:(e,t)=>["number"==typeof e?e.toLocaleString():e," "+String(t)]})}),r.jsx(m.Qk,{content:r.jsx(m.cD,{})}),r.jsx(h.u,{type:"monotone",dataKey:"count",stroke:"url(#strokeCount)",strokeWidth:3,fill:"url(#fillCount)",fillOpacity:.6,dot:{fill:"hsl(var(--muted-foreground))",strokeWidth:2,r:4,strokeOpacity:.8},activeDot:{r:6,strokeWidth:2,fill:"hsl(var(--background))",stroke:"hsl(var(--muted-foreground))",strokeOpacity:1},name:j(s)})]})})})]})}},29718:(e,t,s)=>{"use strict";s.d(t,{L:()=>n});var r=s(10326);function n({text:e,length:t}){return e.length>t?(0,r.jsxs)(r.Fragment,{children:[e.slice(0,t),"..."]}):r.jsx(r.Fragment,{children:e})}},90250:(e,t,s)=>{"use strict";s.d(t,{BO:()=>x,Qk:()=>g,cD:()=>f,dg:()=>p,h7:()=>m});var r=s(10326),n=s(17577),a=s(30660),l=s(44675),i=s(69274),d=s(77863);let c={light:"",dark:".dark"},o=n.createContext(null);function u(){let e=n.useContext(o);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}let x=n.forwardRef(({id:e,className:t,children:s,config:l,...i},c)=>{let u=n.useId(),x=`chart-${e||u.replace(/:/g,"")}`;return r.jsx(o.Provider,{value:{config:l},children:(0,r.jsxs)("div",{"data-chart":x,ref:c,className:(0,d.cn)("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...i,children:[r.jsx(h,{id:x,config:l}),r.jsx(a.h,{children:s})]})})});x.displayName="Chart";let h=({id:e,config:t})=>{let s=Object.entries(t).filter(([,e])=>e.theme||e.color);return s.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(c).map(([t,r])=>`
1
+ (()=>{var e={};e.id=6050,e.ids=[6050],e.modules={57343:e=>{"use strict";e.exports=require("graphql")},72934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},27790:e=>{"use strict";e.exports=require("assert")},78893:e=>{"use strict";e.exports=require("buffer")},61282:e=>{"use strict";e.exports=require("child_process")},84770:e=>{"use strict";e.exports=require("crypto")},80665:e=>{"use strict";e.exports=require("dns")},17702:e=>{"use strict";e.exports=require("events")},92048:e=>{"use strict";e.exports=require("fs")},32615:e=>{"use strict";e.exports=require("http")},35240:e=>{"use strict";e.exports=require("https")},98216:e=>{"use strict";e.exports=require("net")},19801:e=>{"use strict";e.exports=require("os")},55315:e=>{"use strict";e.exports=require("path")},86624:e=>{"use strict";e.exports=require("querystring")},76162:e=>{"use strict";e.exports=require("stream")},82452:e=>{"use strict";e.exports=require("tls")},17360:e=>{"use strict";e.exports=require("url")},21764:e=>{"use strict";e.exports=require("util")},71568:e=>{"use strict";e.exports=require("zlib")},8678:e=>{"use strict";e.exports=import("pg")},48644:e=>{"use strict";e.exports=import("prettier/plugins/babel")},93801:e=>{"use strict";e.exports=import("prettier/plugins/estree")},45747:e=>{"use strict";e.exports=import("prettier/standalone")},49411:e=>{"use strict";e.exports=require("node:path")},97742:e=>{"use strict";e.exports=require("node:process")},41041:e=>{"use strict";e.exports=require("node:url")},39701:(e,s,t)=>{"use strict";t.a(e,async(e,r)=>{try{t.r(s),t.d(s,{GlobalError:()=>d.a,__next_app__:()=>p,originalPathname:()=>h,pages:()=>m,routeModule:()=>g,tree:()=>x}),t(21114),t(76738);var n=t(71197);t(35866);var a=t(23191),l=t(88716),i=t(37922),d=t.n(i),c=t(95231),o={};for(let e in c)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(o[e]=()=>c[e]);t.d(s,o);var u=e([n]);n=(u.then?(await u)():u)[0];let x=["",{children:["(application)",{children:["data",{children:["[[...query]]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(t.bind(t,21114)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx"]}]},{layout:[()=>Promise.resolve().then(t.bind(t,76738)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/layout.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(t.bind(t,71197)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/layout.tsx"],"not-found":[()=>Promise.resolve().then(t.t.bind(t,35866,23)),"next/dist/client/components/not-found-error"]}]},{"not-found":[()=>Promise.resolve().then(t.t.bind(t,35866,23)),"next/dist/client/components/not-found-error"]}],m=["/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx"],h="/(application)/data/[[...query]]/page",p={require:t,loadChunk:()=>Promise.resolve()},g=new a.AppPageRouteModule({definition:{kind:l.x.APP_PAGE,page:"/(application)/data/[[...query]]/page",pathname:"/data/[[...query]]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:x}});r()}catch(e){r(e)}})},71580:(e,s,t)=>{Promise.resolve().then(t.bind(t,34614))},82736:(e,s,t)=>{Promise.resolve().then(t.bind(t,26533))},34614:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>eJ});var r=t(10326),n=t(17577),a=t(76812),l=t(39167),i=t(18753),d=t(86508),c=t(11798),o=t(83855),u=t(23015),x=t(98091),m=t(40900),h=t(35047),p=t(15211),g=t(90772),f=t(53313),j=t(37859),v=t(65685),y=t(65304),b=t(15940),N=t(34789),w=t(77863),C=t(98181);let k=[{id:"select",header:({table:e})=>r.jsx(f.X,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:s=>e.toggleAllPageRowsSelected(!!s),"aria-label":"Select all",className:"translate-y-[2px]"}),cell:({row:e})=>r.jsx(f.X,{checked:e.getIsSelected(),onCheckedChange:s=>e.toggleSelected(!!s),"aria-label":"Select row",className:"translate-y-[2px] max-w-[50px]"}),enableSorting:!1,enableHiding:!1},{accessorKey:"Description",cell:({row:e})=>(console.log("original",e.original),(0,r.jsxs)("div",{className:"flex flex-column grid grid-cols-1",children:[r.jsx("span",{className:"max-w-[500px] truncate font-medium w-full",children:e.original.name?e.original.name:e.original.text?.slice(0,200)||"Untitled"}),r.jsx("small",{className:"mt-1",children:(0,C.WU)(new Date(e.original.createdAt),"PP")})]}))}];var z=t(43273),S=t(88307),E=t(94019),_=t(54432);function O({onSearch:e=e=>console.log(`Search query: ${e}`),placeholder:s="Search...",className:t=""}){let[a,l]=(0,n.useState)("");return r.jsx("form",{onSubmit:s=>{s.preventDefault(),e(a)},className:`relative ${t}`,children:(0,r.jsxs)("div",{className:"relative flex items-center w-full",children:[r.jsx(S.Z,{className:"absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx(_.I,{type:"text",placeholder:s,value:a,onChange:e=>l(e.target.value),className:"pl-10 pr-10","aria-label":"Search input"}),a&&(0,r.jsxs)(r.Fragment,{children:[r.jsx("span",{className:"absolute right-10 text-xs text-muted-foreground",children:"Press Enter ↵"}),r.jsx(g.z,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 h-full rounded-l-none",onClick:()=>{l(""),e("")},"aria-label":"Clear search",children:r.jsx(E.Z,{className:"h-4 w-4"})})]})]})})}var q=t(42270);function M({activeFolder:e,activeItem:s,archived:t}){let C=(0,h.usePathname)(),S=(0,h.useSearchParams)(),[E,_]=(0,n.useState)(S.get("page")?parseInt(S.get("page")):1),M=S.get("search"),{user:P}=(0,n.useContext)(p.S),{toast:R}=(0,N.pm)(),[D,I]=(0,n.useState)({...P.company}),A=(0,h.useRouter)(),[Z,L]=n.useState({}),[T,F]=n.useState({}),[$,G]=n.useState([]),[U,V]=n.useState([]),{loading:B,data:W,refetch:J,previousData:X,error:H}=(0,l.aM)((0,q.P3)(e,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{context:e,page:E??1,limit:10,sort:{field:"updatedAt",direction:"DESC"},filters:{archived:{eq:t},...M?{name:{contains:`${M}`}}:{}}}}),Y=W?.[e+q.Md],K=X?.[e+q.Md],[Q,ee]=(0,i.D)((0,q.ty)(e),{onCompleted:()=>{J()}}),[es,et]=(0,i.D)((0,q.mN)(e,[]),{onCompleted:()=>{J()}}),er=n.useMemo(()=>[],[]),{limit:en,onPaginationChange:ea,skip:el,pagination:ei}=function(){let[e,s]=(0,n.useState)({pageSize:5,pageIndex:0}),{pageSize:t,pageIndex:r}=e;return{limit:t,onPaginationChange:s,pagination:e,skip:t*r}}(),ed=(0,d.b7)({data:B&&K?.items?K.items:Y?.items??er,pageCount:Y?.pageInfo?.pageCount??-1,columns:k,state:{sorting:U,columnVisibility:T,rowSelection:Z,columnFilters:$},enableRowSelection:!0,onRowSelectionChange:L,onSortingChange:V,onColumnFiltersChange:G,onColumnVisibilityChange:F,getCoreRowModel:(0,c.sC)(),getFilteredRowModel:(0,c.vL)(),getPaginationRowModel:(0,c.G_)(),getSortedRowModel:(0,c.tj)(),getFacetedRowModel:(0,c.o6)(),getFacetedUniqueValues:(0,c.JG)(),manualPagination:!0,onPaginationChange:ea}),[ec,eo]=(0,i.D)((0,q.tO)(e),{onCompleted:s=>{console.log("data",s);let t=s?s[e+q.Wc]?.item?.id:void 0;t&&A.push(`/data/${e}/${t}`),J()}}),eu=({page:e,search:s})=>{_(e??1);let t=new URLSearchParams;e&&t.set("page",e.toString()),s&&t.set("search",s),A.push(`${C}?${t.toString()}`)},ex=s=>{t?A.push(`/data/${e}/archived/${s}?${S.toString()}`):A.push(`/data/${e}/${s}?${S.toString()}`)};return H?(0,r.jsxs)(z.bZ,{className:"p-4",variant:"destructive",children:[r.jsx(a.LPM,{className:"size-4"}),r.jsx(z.Cd,{children:"Error"}),r.jsx(z.X,{children:H?.message||": unknown"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"grid grid-flow-col grid-cols-[auto_minmax(0,1fr)] grid-rows-1 bg-background/95 p-4 backdrop-blur gap-2 supports-[backdrop-filter]:bg-background/60",children:[r.jsx(f.X,{checked:ed.getIsAllPageRowsSelected()||ed.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:e=>ed.toggleAllPageRowsSelected(!!e),"aria-label":"Select all",className:"my-auto mr-3 translate-y-[2px]"}),r.jsx("div",{className:"relative",children:r.jsx(O,{onSearch:e=>{eu({page:1,search:e})}})}),r.jsx(g.z,{onClick:()=>{ec({variables:{input:{name:"New item",source:"manual",textlength:0,company:D.id}}})},disabled:eo.loading||t,className:"ml-2 ml-auto lg:flex",children:eo.loading?r.jsx(j.g,{}):r.jsx(o.Z,{size:18})})]}),ed.getIsSomeRowsSelected()||ed.getIsAllRowsSelected()?r.jsx("div",{className:"flex px-4 pb-4",children:t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(g.z,{className:"ml-2",onClick:()=>{let e=[];ed.getSelectedRowModel().rows.forEach(s=>{e.push(Q({variables:{id:s.original.id,input:{archived:!1}}}))}),Promise.all(e).then(()=>{ed.resetRowSelection(),R({title:"Unarchived items",description:"We unarchived "+e.length+" items."})})},variant:"secondary",disabled:ee.loading,children:[ee.loading?r.jsx(j.g,{}):r.jsx(u.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Unarchive selected"})]}),(0,r.jsxs)(g.z,{className:"ml-2",onClick:()=>{let s=[];ed.getSelectedRowModel().rows.forEach(t=>{s.push(es({variables:{context:e,id:t.original.id}}))}),Promise.all(s).then(()=>{ed.resetRowSelection(),R({title:"Deleted items",description:"We deleted "+s.length+" items."})})},variant:"secondary",disabled:et.loading,children:[et.loading?r.jsx(j.g,{}):r.jsx(x.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Delete selected"})]})]}):(0,r.jsxs)(g.z,{className:"ml-2",onClick:()=>{let e=[];ed.getSelectedRowModel().rows.forEach(s=>{e.push(Q({variables:{id:s.original?.id,input:{archived:!0}}}))}),Promise.all(e).then(()=>{ed.resetRowSelection(),R({title:"Archived items",description:"We archived "+e.length+" items."})})},variant:"secondary",disabled:ee.loading,children:[ee.loading?r.jsx(j.g,{}):r.jsx(m.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Archive selected"})]})}):null,B?r.jsx(v.x,{className:"h-screen",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2 p-4 pt-0",children:[r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"h-[100px] w-full rounded-lg"})]})}):(0,r.jsxs)("div",{className:"flex max-h-[75vh] flex-col",children:[r.jsx(v.x,{className:"h-screen grow",children:r.jsx("div",{className:"space-y-4",children:r.jsx("div",{className:"border-y",children:r.jsx(b.iA,{children:r.jsx(b.RM,{children:ed.getRowModel().rows?.length?ed.getRowModel().rows.map(e=>r.jsx(b.SC,{className:(0,w.cn)(s===e.original.id?"bg-secondary dark:text-white":""),"data-state":e.getIsSelected()&&"selected",children:e.getVisibleCells().map((s,t)=>t>0?r.jsx(b.pj,{className:"cursor-pointer",onClick:()=>{ex(e.original.id)},children:(0,d.ie)(s.column.columnDef.cell,s.getContext())},s.id):r.jsx(b.pj,{children:(0,d.ie)(s.column.columnDef.cell,s.getContext())},s.id))},e.id)):r.jsx(b.SC,{children:r.jsx(b.pj,{colSpan:k.length,className:"h-24 text-center",children:"No results."})})})})})})}),(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 pb-2",children:[(0,r.jsxs)("div",{className:"flex-1 text-sm text-muted-foreground",children:[ed.getFilteredSelectedRowModel().rows.length," of"," ",ed.getFilteredRowModel().rows.length," row(s) selected (total"," ",Y?.pageInfo.itemCount," items)."]}),r.jsx("div",{className:"flex items-center space-x-6 lg:space-x-8",children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsxs)(g.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{eu({page:1,search:M??void 0})},disabled:!Y?.pageInfo.hasPreviousPage,children:[r.jsx("span",{className:"sr-only",children:"Go to first page"}),r.jsx(a.kRt,{className:"size-4"})]}),(0,r.jsxs)(g.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{console.log("itemsData.data?.pageInfo.hasPreviousPage",Y?.pageInfo.hasPreviousPage),eu({page:Y?.pageInfo.hasPreviousPage?E-1:void 0,search:M??void 0})},disabled:!Y?.pageInfo.hasPreviousPage||B,children:[r.jsx("span",{className:"sr-only",children:"Go to previous page"}),r.jsx(a.wyc,{className:"size-4"})]}),(0,r.jsxs)(g.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{eu({page:Y?.pageInfo.hasNextPage?E+1:void 0,search:M??void 0})},disabled:!Y?.pageInfo.hasNextPage||B,children:[r.jsx("span",{className:"sr-only",children:"Go to next page"}),r.jsx(a.XCv,{className:"size-4"})]})]})})]})]})]})}var P=t(76557);let R=(0,P.Z)("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),{createElement:D,createContext:I,createRef:A,forwardRef:Z,useCallback:L,useContext:T,useEffect:F,useImperativeHandle:$,useLayoutEffect:G,useMemo:U,useRef:V,useState:B}=n,W=n["useId".toString()],J=I(null);J.displayName="PanelGroupContext";let X="function"==typeof W?W:()=>null,H=0;function Y(e=null){let s=X(),t=V(e||s||null);return null===t.current&&(t.current=""+H++),null!=e?e:t.current}function K({children:e,className:s="",collapsedSize:t,collapsible:r,defaultSize:n,forwardedRef:a,id:l,maxSize:i,minSize:d,onCollapse:c,onExpand:o,onResize:u,order:x,style:m,tagName:h="div",...p}){let g=T(J);if(null===g)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:f,expandPanel:j,getPanelSize:v,getPanelStyle:y,groupId:b,isPanelCollapsed:N,reevaluatePanelConstraints:w,registerPanel:C,resizePanel:k,unregisterPanel:z}=g,S=Y(l),E=V({callbacks:{onCollapse:c,onExpand:o,onResize:u},constraints:{collapsedSize:t,collapsible:r,defaultSize:n,maxSize:i,minSize:d},id:S,idIsFromProps:void 0!==l,order:x});V({didLogMissingDefaultSizeWarning:!1}),$(a,()=>({collapse:()=>{f(E.current)},expand:()=>{j(E.current)},getId:()=>S,getSize:()=>v(E.current),isCollapsed:()=>N(E.current),isExpanded:()=>!N(E.current),resize:e=>{k(E.current,e)}}),[f,j,v,N,S,k]);let _=y(E.current,n);return D(h,{...p,children:e,className:s,style:{..._,...m},"data-panel":"","data-panel-id":S,"data-panel-group-id":b,"data-panel-collapsible":void 0,"data-panel-size":void 0})}let Q=Z((e,s)=>D(K,{...e,forwardedRef:s}));function ee(e,s="Assertion failed!"){if(!e)throw console.error(s),Error(s)}function es(e,s,t=10){let r=(e=parseFloat(e.toFixed(t)))-(s=parseFloat(s.toFixed(t)));return 0===r?0:r>0?1:-1}function et(e,s,t){return 0===es(e,s,t)}function er({panelConstraints:e,panelIndex:s,size:t}){let r=e[s];ee(null!=r);let{collapsedSize:n=0,collapsible:a,maxSize:l=100,minSize:i=0}=r;return 0>es(t,i)&&(t=a&&0>es(t,(n+i)/2)?n:i),t=parseFloat((t=Math.min(l,t)).toFixed(10))}function en({delta:e,layout:s,panelConstraints:t,pivotIndices:r,trigger:n}){if(et(e,0))return s;let a=[...s],[l,i]=r;ee(null!=l),ee(null!=i);let d=0;if("keyboard"===n){{let r=e<0?i:l,n=t[r];if(ee(n),n.collapsible){let n=s[r];ee(null!=n);let a=t[r];ee(a);let{collapsedSize:l=0,minSize:i=0}=a;if(et(n,l)){let s=i-n;es(s,Math.abs(e))>0&&(e=e<0?0-s:s)}}}{let r=e<0?l:i,n=t[r];ee(n);let{collapsible:a}=n;if(a){let n=s[r];ee(null!=n);let a=t[r];ee(a);let{collapsedSize:l=0,minSize:i=0}=a;if(et(n,i)){let s=n-l;es(s,Math.abs(e))>0&&(e=e<0?0-s:s)}}}}{let r=e<0?1:-1,n=e<0?i:l,a=0;for(;;){let e=s[n];if(ee(null!=e),a+=er({panelConstraints:t,panelIndex:n,size:100})-e,(n+=r)<0||n>=t.length)break}let d=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-d:d}{let r=e<0?l:i;for(;r>=0&&r<t.length;){let n=Math.abs(e)-Math.abs(d),l=s[r];ee(null!=l);let i=er({panelConstraints:t,panelIndex:r,size:l-n});if(!et(l,i)&&(d+=l-i,a[r]=i,d.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(et(d,0))return s;{let r=e<0?i:l,n=s[r];ee(null!=n);let c=n+d,o=er({panelConstraints:t,panelIndex:r,size:c});if(a[r]=o,!et(o,c)){let s=c-o,r=e<0?i:l;for(;r>=0&&r<t.length;){let n=a[r];ee(null!=n);let l=er({panelConstraints:t,panelIndex:r,size:n+s});if(et(n,l)||(s-=l-n,a[r]=l),et(s,0))break;e>0?r--:r++}}}return et(a.reduce((e,s)=>s+e,0),100)?a:s}function ea(e,s=document){return Array.from(s.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function el(e,s,t=document){let r=ea(e,t).findIndex(e=>e.getAttribute("data-panel-resize-handle-id")===s);return null!=r?r:null}function ei(e,s,t){let r=el(e,s,t);return null!=r?[r,r+1]:[-1,-1]}function ed(e,s=document){var t;return s instanceof HTMLElement&&(null==s?void 0:null===(t=s.dataset)||void 0===t?void 0:t.panelGroupId)==e?s:s.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`)||null}function ec(e,s=document){return s.querySelector(`[data-panel-resize-handle-id="${e}"]`)||null}function eo(e){return"keydown"===e.type}function eu(e){return e.type.startsWith("mouse")}function ex(e){return e.type.startsWith("touch")}function em(e,s){let t="horizontal"===e;if(eu(s))return t?s.clientX:s.clientY;if(ex(s)){let e=s.touches[0];return ee(e),t?e.screenX:e.screenY}throw Error(`Unsupported event type "${s.type}"`)}function eh(e,s,t){s.forEach((s,r)=>{let n=e[r];ee(n);let{callbacks:a,constraints:l,id:i}=n,{collapsedSize:d=0,collapsible:c}=l,o=t[i];if(null==o||s!==o){t[i]=s;let{onCollapse:e,onExpand:r,onResize:n}=a;n&&n(s,o),c&&(e||r)&&(r&&(null==o||o===d)&&s!==d&&r(),e&&(null==o||o!==d)&&s===d&&e())}})}function ep(e,s){if(e.length!==s.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!=s[t])return!1;return!0}K.displayName="Panel",Q.displayName="forwardRef(Panel)";let eg=null,ef=null;function ej(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function ev(e){if(eg===e)return;eg=e;let s=ej(e);null===ef&&(ef=document.createElement("style"),document.head.appendChild(ef)),ef.innerHTML=`*{cursor: ${s}!important;}`}function ey(e){try{if("undefined"!=typeof localStorage)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,s)=>{localStorage.setItem(e,s)};else throw Error("localStorage not supported in this environment")}catch(s){console.error(s),e.getItem=()=>null,e.setItem=()=>{}}}function eb(e){return`react-resizable-panels:${e}`}function eN(e,s,t,r,n){var a;let l=eb(e),i=s.map(e=>{let{constraints:s,id:t,idIsFromProps:r,order:n}=e;return r?t:n?`${n}:${JSON.stringify(s)}`:JSON.stringify(s)}).sort((e,s)=>e.localeCompare(s)).join(","),d=null!==(a=function(e,s){try{let t=eb(e),r=s.getItem(t);if(r){let e=JSON.parse(r);if("object"==typeof e&&null!=e)return e}}catch(e){}return null}(e,n))&&void 0!==a?a:{};d[i]={expandToSizes:Object.fromEntries(t.entries()),layout:r};try{n.setItem(l,JSON.stringify(d))}catch(e){console.error(e)}}let ew={getItem:e=>(ey(ew),ew.getItem(e)),setItem:(e,s)=>{ey(ew),ew.setItem(e,s)}},eC={};function ek({autoSaveId:e=null,children:s,className:t="",direction:r,forwardedRef:n,id:a=null,onLayout:l=null,keyboardResizeBy:i=null,storage:d=ew,style:c,tagName:o="div",...u}){let x=Y(a),m=V(null),[h,p]=B(null),[g,f]=B([]),j=V({}),v=V(new Map),y=V(0),b=V({autoSaveId:e,direction:r,dragState:h,id:x,keyboardResizeBy:i,onLayout:l,storage:d}),N=V({layout:g,panelDataArray:[],panelDataArrayChanged:!1});V({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),$(n,()=>({getId:()=>b.current.id,getLayout:()=>{let{layout:e}=N.current;return e},setLayout:e=>{let{onLayout:s}=b.current,{layout:t,panelDataArray:r}=N.current,n=function({layout:e,panelConstraints:s}){let t=[...e],r=t.reduce((e,s)=>e+s,0);if(t.length!==s.length)throw Error(`Invalid ${s.length} panel layout: ${t.map(e=>`${e}%`).join(", ")}`);if(!et(r,100))for(let e=0;e<s.length;e++){let s=t[e];ee(null!=s);let n=100/r*s;t[e]=n}let n=0;for(let e=0;e<s.length;e++){let r=t[e];ee(null!=r);let a=er({panelConstraints:s,panelIndex:e,size:r});r!=a&&(n+=r-a,t[e]=a)}if(!et(n,0))for(let e=0;e<s.length;e++){let r=t[e];ee(null!=r);let a=er({panelConstraints:s,panelIndex:e,size:r+n});if(r!==a&&(n-=a-r,t[e]=a,et(n,0)))break}return t}({layout:e,panelConstraints:r.map(e=>e.constraints)});!function(e,s){if(e.length!==s.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==s[t])return!1;return!0}(t,n)&&(f(n),N.current.layout=n,s&&s(n),eh(r,n,j.current))}}),[]),function({committedValuesRef:e,eagerValuesRef:s,groupId:t,layout:r,panelDataArray:n,panelGroupElement:a,setLayout:l}){V({didWarnAboutMissingResizeHandle:!1}),F(()=>{if(!a)return;let e=s.current;ee(e);let{panelDataArray:n}=e;ee(null!=ed(t,a),`No group found for id "${t}"`);let i=ea(t,a);ee(i);let d=i.map(e=>{let s=e.getAttribute("data-panel-resize-handle-id");ee(s);let[i,d]=function(e,s,t,r=document){var n,a,l,i;let d=ec(s,r),c=ea(e,r),o=d?c.indexOf(d):-1;return[null!==(n=null===(a=t[o])||void 0===a?void 0:a.id)&&void 0!==n?n:null,null!==(l=null===(i=t[o+1])||void 0===i?void 0:i.id)&&void 0!==l?l:null]}(t,s,n,a);if(null==i||null==d)return()=>{};let c=e=>{if(!e.defaultPrevented&&"Enter"===e.key){e.preventDefault();let d=n.findIndex(e=>e.id===i);if(d>=0){let e=n[d];ee(e);let i=r[d],{collapsedSize:c=0,collapsible:o,minSize:u=0}=e.constraints;if(null!=i&&o){let e=en({delta:et(i,c)?u-c:c-i,layout:r,panelConstraints:n.map(e=>e.constraints),pivotIndices:ei(t,s,a),trigger:"keyboard"});r!==e&&l(e)}}}};return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}});return()=>{d.forEach(e=>e())}},[a,e,s,t,r,n,l])}({committedValuesRef:b,eagerValuesRef:N,groupId:x,layout:g,panelDataArray:N.current.panelDataArray,setLayout:f,panelGroupElement:m.current}),F(()=>{let{panelDataArray:s}=N.current;if(e){if(0===g.length||g.length!==s.length)return;let t=eC[e];null==t&&(t=function(e,s=10){let t=null;return(...r)=>{null!==t&&clearTimeout(t),t=setTimeout(()=>{e(...r)},s)}}(eN,100),eC[e]=t),t(e,[...s],new Map(v.current),g,d)}},[e,g,d]),F(()=>{});let w=L(e=>{let{onLayout:s}=b.current,{layout:t,panelDataArray:r}=N.current;if(e.constraints.collapsible){let n=r.map(e=>e.constraints),{collapsedSize:a=0,panelSize:l,pivotIndices:i}=eE(r,e,t);if(ee(null!=l),l!==a){v.current.set(e.id,l);let d=en({delta:eS(r,e)===r.length-1?l-a:a-l,layout:t,panelConstraints:n,pivotIndices:i,trigger:"imperative-api"});ep(t,d)||(f(d),N.current.layout=d,s&&s(d),eh(r,d,j.current))}}},[]),C=L(e=>{let{onLayout:s}=b.current,{layout:t,panelDataArray:r}=N.current;if(e.constraints.collapsible){let n=r.map(e=>e.constraints),{collapsedSize:a=0,panelSize:l,minSize:i=0,pivotIndices:d}=eE(r,e,t);if(l===a){let a=v.current.get(e.id),c=null!=a&&a>=i?a:i,o=en({delta:eS(r,e)===r.length-1?l-c:c-l,layout:t,panelConstraints:n,pivotIndices:d,trigger:"imperative-api"});ep(t,o)||(f(o),N.current.layout=o,s&&s(o),eh(r,o,j.current))}}},[]),k=L(e=>{let{layout:s,panelDataArray:t}=N.current,{panelSize:r}=eE(t,e,s);return ee(null!=r),r},[]),z=L((e,s)=>{let{panelDataArray:t}=N.current,r=eS(t,e);return function({defaultSize:e,dragState:s,layout:t,panelData:r,panelIndex:n,precision:a=3}){let l=t[n];return{flexBasis:0,flexGrow:null==l?null!=e?e:"1":1===r.length?"1":l.toPrecision(a),flexShrink:1,overflow:"hidden",pointerEvents:null!==s?"none":void 0}}({defaultSize:s,dragState:h,layout:g,panelData:t,panelIndex:r})},[h,g]),S=L(e=>{let{layout:s,panelDataArray:t}=N.current,{collapsedSize:r=0,collapsible:n,panelSize:a}=eE(t,e,s);return!0===n&&a===r},[]),E=L(e=>{let{layout:s,panelDataArray:t}=N.current,{collapsedSize:r=0,collapsible:n,panelSize:a}=eE(t,e,s);return ee(null!=a),!n||a>r},[]),_=L(e=>{let{panelDataArray:s}=N.current;s.push(e),s.sort((e,s)=>{let t=e.order,r=s.order;return null==t&&null==r?0:null==t?-1:null==r?1:t-r}),N.current.panelDataArrayChanged=!0},[]),O=L(e=>function(s){s.preventDefault();let t=m.current;if(!t)return()=>null;let{direction:r,dragState:n,id:a,keyboardResizeBy:l,onLayout:i}=b.current,{layout:d,panelDataArray:c}=N.current,{initialLayout:o}=null!=n?n:{},u=ei(a,e,t),x=function(e,s,t,r,n,a){if(eo(e)){let s="horizontal"===t,r=0;r=e.shiftKey?100:null!=n?n:10;let a=0;switch(e.key){case"ArrowDown":a=s?0:r;break;case"ArrowLeft":a=s?-r:0;break;case"ArrowRight":a=s?r:0;break;case"ArrowUp":a=s?0:-r;break;case"End":a=100;break;case"Home":a=-100}return a}return null==r?0:function(e,s,t,r,n){let a="horizontal"===t,l=ec(s,n);ee(l);let i=l.getAttribute("data-panel-group-id");ee(i);let{initialCursorPosition:d}=r,c=em(t,e),o=ed(i,n);ee(o);let u=o.getBoundingClientRect();return(c-d)/(a?u.width:u.height)*100}(e,s,t,r,a)}(s,e,r,n,l,t);if(0===x)return;let h="horizontal"===r;"rtl"===document.dir&&h&&(x=-x);let p=en({delta:x,layout:null!=o?o:d,panelConstraints:c.map(e=>e.constraints),pivotIndices:u,trigger:eo(s)?"keyboard":"mouse-or-touch"}),g=!ep(d,p);(eu(s)||ex(s))&&y.current!=x&&(y.current=x,g?ev(h?"horizontal":"vertical"):h?ev(x<0?"horizontal-min":"horizontal-max"):ev(x<0?"vertical-min":"vertical-max")),g&&(f(p),N.current.layout=p,i&&i(p),eh(c,p,j.current))},[]),q=L((e,s)=>{let{onLayout:t}=b.current,{layout:r,panelDataArray:n}=N.current,a=n.map(e=>e.constraints),{panelSize:l,pivotIndices:i}=eE(n,e,r);ee(null!=l);let d=en({delta:eS(n,e)===n.length-1?l-s:s-l,layout:r,panelConstraints:a,pivotIndices:i,trigger:"imperative-api"});ep(r,d)||(f(d),N.current.layout=d,t&&t(d),eh(n,d,j.current))},[]),M=L((e,s)=>{let{layout:t,panelDataArray:r}=N.current,{collapsedSize:n=0,collapsible:a}=s,{collapsedSize:l=0,collapsible:i,maxSize:d=100,minSize:c=0}=e.constraints,{panelSize:o}=eE(r,e,t);ee(null!=o),a&&i&&o===n?n!==l&&q(e,l):o<c?q(e,c):o>d&&q(e,d)},[q]),P=L((e,s)=>{let{direction:t}=b.current,{layout:r}=N.current;if(!m.current)return;let n=ec(e,m.current);ee(n);let a=em(t,s);p({dragHandleId:e,dragHandleRect:n.getBoundingClientRect(),initialCursorPosition:a,initialLayout:r})},[]),R=L(()=>{null!==ef&&(document.head.removeChild(ef),eg=null,ef=null),p(null)},[]),I=L(e=>{let{panelDataArray:s}=N.current,t=eS(s,e);t>=0&&(s.splice(t,1),delete j.current[e.id],N.current.panelDataArrayChanged=!0)},[]),A=U(()=>({collapsePanel:w,direction:r,dragState:h,expandPanel:C,getPanelSize:k,getPanelStyle:z,groupId:x,isPanelCollapsed:S,isPanelExpanded:E,reevaluatePanelConstraints:M,registerPanel:_,registerResizeHandle:O,resizePanel:q,startDragging:P,stopDragging:R,unregisterPanel:I,panelGroupElement:m.current}),[w,h,r,C,k,z,x,S,E,M,_,O,q,P,R,I]);return D(J.Provider,{value:A},D(o,{...u,children:s,className:t,style:{display:"flex",flexDirection:"horizontal"===r?"row":"column",height:"100%",overflow:"hidden",width:"100%",...c},ref:m,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":x}))}let ez=Z((e,s)=>D(ek,{...e,forwardedRef:s}));function eS(e,s){return e.findIndex(e=>e===s||e.id===s.id)}function eE(e,s,t){let r=eS(e,s),n=r===e.length-1,a=t[r];return{...s.constraints,panelSize:a,pivotIndices:n?[r-1,r]:[r,r+1]}}function e_({children:e=null,className:s="",disabled:t=!1,id:r,onDragging:n,style:a={},tabIndex:l=0,tagName:i="div",...d}){let c=V(null),o=V({onDragging:n});F(()=>{o.current.onDragging=n});let u=T(J);if(null===u)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:x,dragState:m,groupId:h,registerResizeHandle:p,startDragging:g,stopDragging:f,panelGroupElement:j}=u,v=Y(r),y=(null==m?void 0:m.dragHandleId)===v,[b,N]=B(!1),[w,C]=B(null),k=L(()=>{let e=c.current;ee(e),e.blur(),f();let{onDragging:s}=o.current;s&&s(!1)},[f]);F(()=>{if(t)C(null);else{let e=p(v);C(()=>e)}},[t,v,p]),F(()=>{if(t||null==w||!y)return;let e=e=>{w(e)},s=e=>{w(e)},r=c.current;ee(r);let n=r.ownerDocument;return n.body.addEventListener("contextmenu",k),n.body.addEventListener("mousemove",e),n.body.addEventListener("touchmove",e),n.body.addEventListener("mouseleave",s),window.addEventListener("mouseup",k),window.addEventListener("touchend",k),()=>{n.body.removeEventListener("contextmenu",k),n.body.removeEventListener("mousemove",e),n.body.removeEventListener("touchmove",e),n.body.removeEventListener("mouseleave",s),window.removeEventListener("mouseup",k),window.removeEventListener("touchend",k)}},[x,t,y,w,k]),function({disabled:e,handleId:s,resizeHandler:t,panelGroupElement:r}){F(()=>{if(e||null==t||null==r)return;let n=ec(s,r);if(null==n)return;let a=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),t(e);break;case"F6":{e.preventDefault();let t=n.getAttribute("data-panel-group-id");ee(t);let a=ea(t,r),l=el(t,s,r);ee(null!==l);let i=e.shiftKey?l>0?l-1:a.length-1:l+1<a.length?l+1:0;a[i].focus()}}};return n.addEventListener("keydown",a),()=>{n.removeEventListener("keydown",a)}},[r,e,s,t])}({disabled:t,handleId:v,resizeHandler:w,panelGroupElement:j});let z={cursor:ej(x),touchAction:"none",userSelect:"none"};return D(i,{...d,children:e,className:s,onBlur:()=>N(!1),onFocus:()=>N(!0),onMouseDown:e=>{g(v,e.nativeEvent);let s=o.current;ee(s);let{onDragging:t}=s;t&&t(!0)},onMouseUp:k,onTouchCancel:k,onTouchEnd:k,onTouchStart:e=>{g(v,e.nativeEvent);let s=o.current;ee(s);let{onDragging:t}=s;t&&t(!0)},ref:c,role:"separator",style:{...z,...a},tabIndex:l,"data-panel-group-direction":x,"data-panel-group-id":h,"data-resize-handle":"","data-resize-handle-active":y?"pointer":b?"keyboard":void 0,"data-panel-resize-handle-enabled":!t,"data-panel-resize-handle-id":v})}ek.displayName="PanelGroup",ez.displayName="forwardRef(PanelGroup)",e_.displayName="PanelResizeHandle";let eO=({className:e,...s})=>r.jsx(ez,{className:(0,w.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...s}),eq=({withHandle:e,className:s,...t})=>r.jsx(e_,{className:(0,w.cn)("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",s),...t,children:e&&r.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:r.jsx(R,{className:"size-2.5"})})});var eM=t(8281),eP=t(79210),eR=t(68232),eD=t(44389),eI=t(86333),eA=t(3240);let eZ=(0,P.Z)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var eL=t(42924);let eT=(0,P.Z)("ArchiveX",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"m9.5 17 5-5",key:"nakeu6"}],["path",{d:"m9.5 12 5 5",key:"1hccrj"}]]);var eF=t(88319);let e$=(0,P.Z)("StepForward",[["line",{x1:"6",x2:"6",y1:"4",y2:"20",key:"fy8qot"}],["polygon",{points:"10,4 20,12 10,20",key:"1mc1pf"}]]),eG=(0,P.Z)("FileStack",[["path",{d:"M16 2v5h5",key:"kt2in0"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17l4 4z",key:"1km23n"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);var eU=t(75909),eV=t(90434);let eB=({index:e,folder:s,edit:t,indented:n,children:a})=>(0,r.jsxs)("div",{className:"flex flex-col ",children:[(0,r.jsxs)("div",{className:(0,w.cn)((0,g.d)({variant:s.variant,size:"sm"}),n?"pl-5":null,s.active?"dark:bg-muted dark:text-white dark:hover:bg-muted dark:hover:text-white":null,"justify-start"),children:[(0,r.jsxs)(eV.default,{className:"flex",href:s.href||"",children:[r.jsx(s.icon,{className:"mr-2 size-4"}),!s.icon&&s.label,null!==s.icon&&r.jsx("span",{className:(0,w.cn)("ml-0 overflow-hidden text-ellipsis max-w-[170px]","default"===s.variant&&"text-background dark:text-white"),children:s.label})]},e),t&&r.jsx(eD.Z,{onClick:()=>{t()},className:"ml-auto size-4 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer"})]}),r.jsx("div",{children:a})]}),eW=({activeFolder:e,activeArchived:s,activeSources:t,activeEmbeddings:n,activeProcessors:a})=>{let{data:l,loading:i,error:d}=(0,eU.t)();return r.jsx(r.Fragment,{children:(0,r.jsxs)("div",{className:"group flex flex-col gap-4 py-2 data-[collapsed=true]:py-2 pb-5",children:[e?r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(g.z,{variant:"link",size:"sm",asChild:!0,children:(0,r.jsxs)(eV.default,{href:"/data",children:[r.jsx(eI.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Back to dashboard"})]})})}):r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"text-sm text-muted-foreground ml-5 pt-3",children:"Select a context:"})}),r.jsx("nav",{className:"grid gap-1 px-2 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2",children:i?r.jsx(eB,{index:111,folder:{label:"Loading...",active:!1,icon:eA.Z,variant:"ghost"}}):l?.contexts?.items.map((l,i)=>r.jsx(eB,{index:i,folder:{label:`${l.name}`,icon:eZ,variant:"ghost",href:`/data/${l.id}`},children:e?.toLowerCase()===`${l.id}`.toLowerCase()&&r.jsxs(r.Fragment,{children:[r.jsx(eB,{index:i,indented:!0,folder:{label:"Active data",active:e?.toLowerCase()===`${l.id}`.toLowerCase()&&!s&&!t&&!n&&!a,icon:eL.Z,variant:e?.toLowerCase()!==`${l.id}`.toLowerCase()||s||t||n||a?"ghost":"default",href:`/data/${l.id}`}}),r.jsx(eB,{index:i+1e3,indented:!0,folder:{label:"Archived data",active:s,icon:eT,variant:s?"default":"ghost",href:`/data/${l.id}/archived`}}),r.jsx(eB,{index:i+1e3,indented:!0,folder:{label:"Sources",active:t,icon:eF.Z,variant:t?"default":"ghost",href:`/data/${l.id}/sources`}}),r.jsx(eB,{index:i+1e3,indented:!0,folder:{label:"Processors",active:a,icon:e$,variant:a?"default":"ghost",href:`/data/${l.id}/processors`}}),r.jsx(eB,{index:i+1e3,indented:!0,folder:{label:"Embeddings",active:n,icon:eG,variant:n?"default":"ghost",href:`/data/${l.id}/embeddings`}})]})},l.id))})]},e+s+t+n+a)})};function eJ({children:e,params:s}){let t=s.query&&"archived"===s.query[1],n=s.query&&"sources"===s.query[1],a=s.query&&"embeddings"===s.query[1],l=s.query&&"processors"===s.query[1],i=s.query&&s.query[0],d=null;return s.query&&t?d=s.query[2]||null:!s.query||n||a||(d=s.query[1]||null),r.jsx(eR.pn,{delayDuration:0,children:(0,r.jsxs)(eO,{direction:"horizontal",onLayout:e=>{document.cookie=`react-resizable-panels:layout=${JSON.stringify(e)}`},className:"h-full items-stretch",children:[(0,r.jsxs)(Q,{defaultSize:15,collapsedSize:4,collapsible:!0,minSize:15,maxSize:20,children:[r.jsx(eM.Z,{}),r.jsx(eW,{activeFolder:i,activeArchived:t,activeSources:n,activeEmbeddings:a,activeProcessors:l})]}),i&&!n&&!a&&!l&&(0,r.jsxs)(r.Fragment,{children:[r.jsx(eq,{withHandle:!0}),r.jsx(Q,{defaultSize:20,minSize:20,children:(0,r.jsxs)(eP.mQ,{defaultValue:"all",children:[r.jsx("div",{className:"flex items-center px-4 py-2 h-full",children:r.jsx("h1",{className:"text-xl font-bold",children:"Items"})}),r.jsx(eM.Z,{}),r.jsx(M,{activeFolder:i,activeItem:d??void 0,archived:t})]})})]}),r.jsx(eq,{withHandle:!0}),r.jsx(Q,{defaultSize:65,children:r.jsx("div",{className:"max-h-full overflow-y-auto",children:e})})]})})}},26533:(e,s,t)=>{"use strict";t.a(e,async(e,r)=>{try{t.r(s),t.d(s,{default:()=>g});var n=t(10326),a=t(65063);t(17577);var l=t(69771),i=t(18440),d=t(39167),c=t(42270),o=t(43273),u=t(65304),x=t(76812),m=t(5096),h=t(42239),p=e([a]);function g({params:e}){let{data:s,loading:t,error:r}=(0,d.aM)(c.fV,{skip:!e?.query?.[0],variables:{id:e?.query?.[0]}});if(!e.query)return n.jsx("div",{className:"grow flex flex-col",children:n.jsx(l.Z,{})});let p=e.query[0]||null,g="archived"===e.query[1],f="sources"===e.query[1],j="embeddings"===e.query[1],v="processors"===e.query[1];if(f)return n.jsx(m.L,{expand:!0,actions:!0,context:p});if(j)return n.jsx(i.U,{expand:!0,actions:!0,context:p});if(v)return n.jsx(h.c,{expand:!0,actions:!0,context:p});let y=null;return(g?y=e.query[2]||null:f||j||(y=e.query[1]||null),t||!s?.contextById)?(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[n.jsx(u.O,{className:"w-full h-[80px] rounded-md"}),n.jsx(u.O,{className:"w-full h-[50px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):r?(0,n.jsxs)(o.bZ,{variant:"destructive",children:[n.jsx(x.LPM,{className:"size-4"}),n.jsx(o.Cd,{children:"Error"}),n.jsx(o.X,{children:r?.message||"Error loading item."})]}):n.jsx(a.H,{actions:!0,context:s?.contextById,itemId:y})}a=(p.then?(await p)():p)[0],r()}catch(e){r(e)}})},69771:(e,s,t)=>{"use strict";t.d(s,{Z:()=>o});var r=t(10326),n=t(33519),a=t(17577),l=t(31051),i=t(42193),d=t(16923),c=t(22746);function o(){let[e,s]=(0,a.useState)("count"),[t,o]=(0,a.useState)({from:(0,n.k)(new Date,7),to:new Date}),[u,x]=(0,a.useState)("CONTEXT_UPSERT"),[m,h]=(0,a.useState)("label");return(0,r.jsxs)("div",{className:"flex-1 flex flex-col p-8 pt-6 h-screen",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-4xl font-bold tracking-tight bg-clip-text",children:"Contexts Dashboard"}),r.jsx("p",{className:"text-lg",children:"Monitor your contexts and their usage."})]}),r.jsx("div",{className:"flex items-center space-x-2",children:r.jsx(i.z,{dateRange:t,onDateRangeChange:o,maxDays:30})})]}),(0,r.jsxs)("div",{className:"flex-1 grid gap-6 md:grid-cols-3 min-h-0",children:[r.jsx("div",{className:"rounded-lg border md:col-span-2 p-6 flex flex-col",children:r.jsx(d.q,{dateRange:t,selectedType:u,onTypeChange:x,unitOptions:[{value:"count",label:"Count"}],onUnitChange:s,unit:e,dataTypes:[l.h.CONTEXT_RETRIEVE,l.h.CONTEXT_UPSERT]})}),r.jsx("div",{className:"rounded-lg border p-6 flex flex-col",children:r.jsx(c.Y,{groupByOptions:[],dateRange:t,selectedType:u,unit:e,groupBy:m,onGroupByChange:h})})]})]})}},65063:(e,s,t)=>{"use strict";t.a(e,async(e,r)=>{try{t.d(s,{H:()=>X});var n=t(10326),a=t(39167),l=t(18753),i=t(74064),d=t(23015),c=t(98091),o=t(40900),u=t(35157),x=t(31215),m=t(69508),h=t(91470),p=t(24081),g=t(21986),f=t(47206),j=t(231),v=t(35047),y=t(17577),b=t(74723),N=t(770),w=t(57004),C=t(18615),k=t(567),z=t(90772),S=t(55632),E=t(54432),_=t(37859),O=t(8281),q=t(33261),M=t(15940),P=t(87673),R=t(68232),D=t(62288),I=t(60097),A=t(99440),Z=t(34789),L=t(77863),T=t(65304),F=t(43273),$=t(76812),G=t(42270),U=t(15286),V=t(24295),B=t(33071),W=t(77961),J=e([w]);function X(e){let[s,t]=(0,y.useState)(),{toast:r}=(0,Z.pm)(),J=(0,v.useRouter)(),[X,H]=(0,y.useState)(),Y=e.context,K=e.context.fields.map(e=>e.name);console.log("fields",K),console.log("context",Y);let{loading:Q,error:ee,refetch:es}=(0,a.aM)((0,G.A1)(e.context.id,K,!0),{skip:!e.itemId||!e.context?.id,variables:{context:e.context.id,id:e.itemId},fetchPolicy:"no-cache",nextFetchPolicy:"network-only",onCompleted:s=>{let r=s[e.context.id+"_itemsById"];t({...r,tags:r.tags?r.tags.split(","):[]}),H({rights_mode:r.rights_mode,users:r.RBAC?.users,roles:r.RBAC?.roles})}}),[et,er]=(0,l.D)((0,G.ty)(e.context.id),{onCompleted:()=>{r({title:"Item updated",description:"Item updated successfully."})},onError:e=>{r({title:"Error updating item",description:e.message})}}),[en,ea]=(0,l.D)((0,G.mN)(e.context.id,[]),{onCompleted:()=>{r({title:"Item deleted",description:"Item deleted successfully."})},onError:e=>{r({title:"Error deleting item",description:e.message})}}),[el,ei]=(0,l.D)((0,G.Eq)(e.context.id),{onCompleted:s=>{let t=s[e.context.id+"_itemsGenerateChunks"];if(t.jobs?.length>0){r({title:"Chunks generation started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}r({title:"Chunks generated",description:"Chunks generated successfully."})}}),[ed,ec]=(0,l.D)((0,G.ps)(e.context.id),{onCompleted:s=>{let t=s[e.context.id+"_itemsDeleteChunks"];if(t.jobs?.length>0){r({title:"Chunks deletion started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}r({title:"Chunks deleted",description:"Chunks deleted successfully."})}}),[eo,eu]=(0,l.D)((0,G.dc)(e.context.id),{onCompleted:()=>{r({title:"Field processed",description:"Field processed successfully."})},onError:e=>{r({title:"Error processing field",description:e.message})}}),ex=N.Ry({name:N.Z_().nullable().optional(),tags:N.Z_().nullable().optional(),external_id:N.Z_().nullable().optional(),description:N.Z_().min(2,{message:"Text must be at least 2 characters."}).max(1e4,{message:"Text must not be longer than 10.0000 characters."}),...Y?.fields?.reduce((e,s)=>({...e,[s.name]:N.Z_().nullable()}),{})??{}}),em=(0,b.cI)({resolver:(0,i.F)(ex),defaultValues:{description:s?.description},mode:"onChange"}),eh=e=>{if(e.target.value&&"Enter"===e.key){let r=s?.tags??[],n=[...Array.isArray(r)?[...r]:[]];n.push(e.target.value),console.log("tags",n),em.setValue("tags",n.join(",")),t({...s,tags:n}),e.target.value=""}},[ep,eg]=(0,y.useState)(!1),[ef,ej]=(0,y.useState)(null),[ev,ey]=(0,y.useState)(null);return Q?(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[n.jsx(T.O,{className:"w-full h-[80px] rounded-md"}),n.jsx(T.O,{className:"w-full h-[50px] rounded-md mt-3"}),n.jsx(T.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(T.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(T.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(T.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):ee?(0,n.jsxs)(F.bZ,{variant:"destructive",children:[n.jsx($.LPM,{className:"size-4"}),n.jsx(F.Cd,{children:"Error"}),n.jsx(F.X,{children:ee?.message||"Error loading item."})]}):(0,n.jsxs)("div",{className:"flex h-full flex-col",children:[s?(0,n.jsxs)(n.Fragment,{children:[e.actions?(0,n.jsxs)(n.Fragment,{children:[n.jsx("div",{className:"flex items-center p-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[s?.archived?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(R.u,{children:[n.jsx(R.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:async()=>{s.id&&(et({variables:{id:s.id,input:{archived:!1}}}),t({...s,archived:!1}),J.push("./"))},variant:"ghost",size:"icon",disabled:!s||er.loading,children:[er.loading?n.jsx(_.g,{}):n.jsx(d.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Unarchive"})]})}),n.jsx(R._v,{children:"Unarchive"})]}),(0,n.jsxs)(R.u,{children:[n.jsx(R.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:async()=>{s.id&&(en({variables:{id:s.id}}),J.push("./"))},variant:"ghost",size:"icon",disabled:!s||ea.loading,children:[ea.loading?n.jsx(_.g,{}):n.jsx(c.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Delete"})]})}),n.jsx(R._v,{children:"Delete"})]})]}):(0,n.jsxs)(R.u,{children:[n.jsx(R.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:async()=>{s?.id&&(et({variables:{id:s.id,input:{archived:!0}}}),t({...s,archived:!0}),J.push("./"))},variant:"ghost",size:"icon",disabled:!s||er.loading,children:[er.loading?n.jsx(_.g,{}):n.jsx(o.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Archive"})]})}),n.jsx(R._v,{children:"Archive"})]}),ep?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(R.u,{children:[n.jsx(R.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:()=>{eg(!1)},variant:"ghost",size:"icon",children:[n.jsx(u.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Cancel"})]})}),n.jsx(R._v,{children:"Cancel"})]}),(0,n.jsxs)(R.u,{children:[n.jsx(R.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{disabled:er.loading,onClick:()=>{s?.id&&(et({variables:{id:s.id,input:{textlength:s?.text?.length,description:s?.description,name:s?.name,externalId:s?.externalId,tags:s?.tags?.join(","),source:s?.source,archived:s?.archived,rights_mode:X?.rights_mode,RBAC:{users:X?.users||[],roles:X?.roles||[]},...Y?.fields?.reduce((e,t)=>({...e,[t.name]:s?.[t.name]}),{})??{}}}}),eg(!1))},variant:"ghost",size:"icon",children:[n.jsx(x.Z,{className:"size-4"}),(0,n.jsxs)("span",{className:"sr-only",children:["Save ",er.loading??n.jsx(_.g,{})]})]})}),n.jsx(R._v,{children:"Save"})]})]}):(0,n.jsxs)(R.u,{children:[n.jsx(R.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:()=>{eg(!0)},variant:"ghost",size:"icon",disabled:!s||er.loading,children:[n.jsx(m.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Edit"})]})}),n.jsx(R._v,{children:"Edit"})]})]})}),n.jsx(O.Z,{})]}):null,n.jsx("div",{className:"flex flex-1 flex-col",children:(0,n.jsxs)("div",{className:(0,L.cn)("space-y-2"),children:[n.jsx("div",{className:"flex items-center justify-between space-x-4 px-4 bg-muted rounded",children:n.jsx("h3",{className:"text-lg p-5 font-semibold tracking-tight text-lg",children:"Fields"})}),(0,n.jsxs)("div",{className:"p-5",children:[n.jsx(S.l0,{...em,children:n.jsx("form",{className:"space-y-8",children:(0,n.jsxs)("div",{children:[(0,n.jsxs)(M.iA,{children:[n.jsx(M.xD,{children:(0,n.jsxs)(M.SC,{children:[n.jsx(M.ss,{children:"Name"}),n.jsx(M.ss,{children:"Value"})]})}),(0,n.jsxs)(M.RM,{children:[(0,n.jsxs)(M.SC,{children:[n.jsx(M.pj,{className:"font-medium capitalize",children:"Name"}),n.jsx(M.pj,{children:n.jsx(S.Wi,{control:em.control,name:"name",render:({field:e})=>n.jsx(S.xJ,{children:ep?(0,n.jsxs)(n.Fragment,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{type:"text",disabled:!ep,onChange:e=>{t({...s,name:e.target.value})},placeholder:"Item name",value:s.name??""})}),n.jsx(S.zG,{})]}):n.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(s.name??""),r({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:s.name&&s.name?.length>200?s.name?.slice(0,200)+"...":s.name})})})})]},"name"),(0,n.jsxs)(M.SC,{children:[n.jsx(M.pj,{className:"font-medium capitalize",children:"Tags"}),(0,n.jsxs)(M.pj,{children:[ep?n.jsx("div",{className:"grid-row grid grid-flow-col gap-4 pt-2",children:n.jsx(S.Wi,{control:em.control,name:"tags",render:({field:e})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{id:"includes",type:"text",onKeyUp:e=>eh(e),placeholder:"Type and press enter to add"})}),n.jsx(S.zG,{})]})})}):null,s?.tags?.length?n.jsx("div",{className:"gap-2 pt-2",children:s?.tags?.map((e,r)=>n.jsx(k.C,{variant:"secondary",className:"px-3 py-2 mr-2 mb-2",children:n.jsxs("div",{className:"flex items-center",children:[n.jsx("div",{className:"text-muted-foreground truncate max-w-[200px]",children:e}),ep?n.jsx("span",{className:"size-4 cursor-pointer text-muted-foreground",onClick:()=>{let e=[...s.tags??[]];e.splice(r,1),em.setValue("tags",e.join(",")),t({...s,tags:e})},children:n.jsx(h.Z,{className:"ml-1",size:15})}):null]})},`tag-${r}`))}):null]})]},"tags"),(0,n.jsxs)(M.SC,{children:[n.jsx(M.pj,{className:"font-medium capitalize",children:"Description"}),n.jsx(M.pj,{children:n.jsx(S.Wi,{control:em.control,name:"description",render:({field:e})=>n.jsx(S.xJ,{children:ep?(0,n.jsxs)(n.Fragment,{children:[n.jsx(S.NI,{children:(0,n.jsxs)("div",{className:"relative",children:[n.jsx(P.g,{autoFocus:!0,disabled:!ep,onChange:e=>{t({...s,description:e.target.value})},placeholder:"Item text content",className:"resize-none",value:s.description??""}),(0,n.jsxs)(D.Vq,{children:[n.jsx(D.hg,{asChild:!0,children:(0,n.jsxs)(z.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>ej({name:"description",value:s.description??"",disabled:!1}),children:[n.jsx(p.Z,{className:"h-3 w-3"}),n.jsx("span",{className:"sr-only",children:"Expand"})]})}),(0,n.jsxs)(D.cZ,{className:"max-w-4xl max-h-[80vh]",children:[n.jsx(D.fK,{children:n.jsx(D.$N,{children:"Edit Description"})}),n.jsx("div",{className:"mt-4",children:n.jsx(P.g,{rows:20,className:"min-h-[400px] resize-none",value:ef?.name==="description"?ef.value:s.description??"",onChange:e=>{let r=e.target.value;ej(e=>e?.name==="description"?{...e,value:r}:e),t({...s,description:r})}})})]})]})]})}),n.jsx(S.zG,{})]}):n.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(s.description??""),r({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:n.jsx(C.J,{text:s.description??""})})})})})]},19091),(0,n.jsxs)(M.SC,{children:[n.jsx(M.pj,{className:"font-medium capitalize",children:"External ID"}),n.jsx(M.pj,{children:n.jsx(S.Wi,{control:em.control,name:"external_id",render:({field:e})=>n.jsx(S.xJ,{children:ep?(0,n.jsxs)(n.Fragment,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{type:"text",disabled:!ep,onChange:e=>{console.log("e",e),t({...s,external_id:e.target.value})},placeholder:"xxxx-xxxx-xxxx-xxxx",value:s.external_id??""})}),n.jsx(S.zG,{})]}):n.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(s.external_id??""),r({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:s.external_id??""})})})})]},"externalId"),Y?.fields?.length&&Y.fields.map((e,a)=>(0,n.jsxs)(M.SC,{children:[(0,n.jsxs)(M.pj,{className:"font-medium capitalize flex flex-col",children:[e.label,e.calculated&&n.jsx("span",{className:"text-sm text-muted-foreground",children:"Calculated"}),e.processor&&(0,n.jsxs)(R.u,{children:[n.jsx(R.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{variant:"secondary",size:"sm",className:"w-auto mt-2",onClick:()=>{eo({variables:{item:s?.id,field:e.name}})},disabled:eu.loading,children:[eu.loading?n.jsx(_.g,{}):n.jsx(g.Z,{className:"size-4"}),n.jsx("span",{className:"ml-2",children:"Process"})]})}),n.jsx(R._v,{className:"max-w-xs",children:e.processor.description})]})]}),ep?n.jsx(n.Fragment,{children:(0,n.jsxs)(M.pj,{children:["code"===e.type||"json"===e.type||"text"===e.type||"longText"===e.type||"markdown"===e.type||"shortText"===e.type?n.jsx(S.Wi,{control:em.control,name:e.name,render:({field:r})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:(0,n.jsxs)("div",{className:"relative",children:[n.jsx(P.g,{id:e.name,rows:"shortText"===e.type?2:7,onChange:r=>{t({...s,[e.name]:r.target.value})},value:s[e.name]??""}),(0,n.jsxs)(D.Vq,{children:[n.jsx(D.hg,{asChild:!0,children:(0,n.jsxs)(z.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>ej({name:e.name,disabled:!1,value:s[e.name]??""}),children:[n.jsx(p.Z,{className:"h-3 w-3"}),n.jsx("span",{className:"sr-only",children:"Expand"})]})}),(0,n.jsxs)(D.cZ,{className:"max-w-4xl max-h-[80vh]",children:[n.jsx(D.fK,{children:(0,n.jsxs)(D.$N,{children:["Edit ",e.name]})}),n.jsx("div",{className:"mt-4",children:n.jsx(P.g,{rows:20,className:"min-h-[400px] resize-none",value:ef?.name===e.name?ef.value:s[e.name]??"",onChange:r=>{let n=r.target.value;ej(s=>s?.name===e.name?{...s,value:n}:s),t({...s,[e.name]:n})}})})]})]})]})}),n.jsx(S.zG,{})]})}):null,"number"===e.type?n.jsx(S.Wi,{control:em.control,name:e.name,render:({field:r})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{id:e.name,type:"number",onChange:r=>{t({...s,[e.name]:r.target.value})},value:s[e.name]??""})}),n.jsx(S.zG,{})]})}):null,"boolean"===e.type?n.jsx(S.Wi,{control:em.control,name:e.name,render:({field:r})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:n.jsx(q.r,{checked:!!r.value,onCheckedChange:r=>{t({...s,[e.name]:r})}})}),n.jsx(S.zG,{})]})}):null,"file"===e.type&&n.jsx("div",{children:n.jsx(W.jF,{s3key:s[e.name],children:n.jsx(W.ZP,{id:`item-${s.id}`,buttonText:"Select File",allowedFileTypes:e.allowedFileTypes,dependencies:[],selectionLimit:1,onConfirm:r=>{console.log("keys",r),t({...s,[e.name]:r[0]})}})})})]})}):n.jsx(M.pj,{children:(0,n.jsxs)("span",{children:["code"===e.type&&n.jsx(w.G,{code:s[e.name]}),"json"===e.type&&n.jsx(w.G,{code:s[e.name],language:"json"}),"shortText"===e.type&&n.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(s[e.name]),r({title:"Copied to clipboard"})},children:s[e.name]}),"longText"===e.type&&n.jsx(C.J,{text:s[e.name]}),"file"===e.type&&n.jsx(W.jF,{s3key:s[e.name]}),"markdown"===e.type&&n.jsx(C.J,{text:s[e.name]}),!e.type&&n.jsx(C.J,{text:s[e.name]}),"text"===e.type&&n.jsx(C.J,{text:s[e.name]}),"number"===e.type&&n.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(s[e.name]),r({title:"Copied to clipboard"})},children:s[e.name]}),"boolean"===e.type&&n.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(s[e.name]),r({title:"Copied to clipboard"})},children:s[e.name]??""})]})})]},a))]})]}),n.jsx(O.Z,{className:"my-4"})]})})}),n.jsx(B.Zb,{className:"bg-transparent",children:(0,n.jsxs)(V.zF,{children:[n.jsx(B.Ol,{className:"p-4",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-base",children:"Access Control"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-0",children:"Control access to this item."})]}),n.jsx(V.wy,{asChild:!0,children:(0,n.jsxs)(z.z,{variant:"ghost",size:"icon",className:"size-8",children:[n.jsx(f.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Toggle"})]})})]})}),n.jsx(V.Fw,{className:"mt-5",children:n.jsx(B.aY,{className:"space-y-4",children:n.jsx(U.P,{initialRightsMode:s.rights_mode,initialUsers:s.RBAC?.users,initialRoles:s.RBAC?.roles,onChange:(e,s,t)=>{H({rights_mode:e,users:s,roles:t})}})})})]})}),(0,n.jsxs)("div",{className:"mt-4 border border p-3 pb-5 rounded",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between ml-4 mt-3 mr-4 mb-2",children:[n.jsx("h1",{className:"text-lg font-medium",children:"Embeddings"}),(0,n.jsxs)(I.h_,{modal:!1,children:[n.jsx(I.$F,{asChild:!0,children:(0,n.jsxs)(z.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[n.jsx(j.Z,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Open menu"})]})}),(0,n.jsxs)(I.AW,{align:"end",children:[n.jsx(I.Xi,{onClick:()=>ey("generate"),children:"Generate embeddings"}),n.jsx(I.Xi,{onClick:()=>ey("delete"),children:"Delete embeddings"})]})]})]}),(0,n.jsxs)(M.iA,{children:[n.jsx(M.Rn,{children:s?.chunks?.length?"A list of all embeddings for this item.":"No embeddings found."}),n.jsx(M.xD,{children:(0,n.jsxs)(M.SC,{children:[n.jsx(M.ss,{children:"Index"}),n.jsx(M.ss,{children:"Content"}),n.jsx(M.ss,{children:"Dimensions"}),n.jsx(M.ss,{children:"Created At"}),n.jsx(M.ss,{children:"Updated At"})]})}),n.jsx(M.RM,{children:s?.chunks?.length?s?.chunks?.length&&s.chunks.map(e=>(0,n.jsxs)(M.SC,{children:[n.jsx(M.pj,{className:"font-medium capitalize",children:e.chunk_index+1}),n.jsx(M.pj,{children:n.jsx(C.J,{text:e.content})}),n.jsx(M.pj,{children:e.embedding_size||0}),n.jsx(M.pj,{children:new Date(e.chunk_created_at).toLocaleString()}),n.jsx(M.pj,{children:new Date(e.chunk_updated_at).toLocaleString()})]},e.id)):null})]})]})]})]})})]}):(0,n.jsxs)(n.Fragment,{children:[" ",!s&&e.itemId?n.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Item not found."}):n.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"No item selected."})]}),n.jsx(A.aR,{open:"generate"===ev,onOpenChange:e=>!e&&ey(null),children:(0,n.jsxs)(A._T,{children:[(0,n.jsxs)(A.fY,{children:[n.jsx(A.f$,{children:"Generate Embeddings"}),n.jsx(A.yT,{children:"Are you sure you want to generate embeddings for this item? This will create new embedding vectors for the content."})]}),(0,n.jsxs)(A.xo,{children:[n.jsx(A.le,{children:"Cancel"}),n.jsx(A.OL,{disabled:ei.loading,onClick:()=>{s?.id&&(console.log("Generate embeddings for item:",s?.id),ey(null),el({variables:{where:{id:{eq:s?.id}}}}))},children:"Generate"})]})]})}),n.jsx(A.aR,{open:"delete"===ev,onOpenChange:e=>!e&&ey(null),children:(0,n.jsxs)(A._T,{children:[(0,n.jsxs)(A.fY,{children:[n.jsx(A.f$,{children:"Delete Embeddings"}),n.jsx(A.yT,{children:"Are you sure you want to delete all embeddings for this item? This action cannot be undone."})]}),(0,n.jsxs)(A.xo,{children:[n.jsx(A.le,{children:"Cancel"}),n.jsx(A.OL,{disabled:ec.loading,onClick:async()=>{s?.id&&(console.log("Delete embeddings for item:",s?.id),ey(null),ed({variables:{where:{id:{eq:s?.id}}}}))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}w=(J.then?(await J)():J)[0],r()}catch(e){r(e)}})},18440:(e,s,t)=>{"use strict";t.d(s,{U:()=>M});var r=t(10326),n=t(39167),a=t(18753),l=t(35047),i=t(17577),d=t(567),c=t(90772),o=t(33071),u=t(8281),x=t(65685),m=t(32663),h=t(90434),p=t(99440),g=t(85999),f=t(42270),j=t(29718),v=t(15940),y=t(75290),b=t(60097),N=t(76812);function w({contextId:e}){let[s,t]=(0,i.useState)(null),[l,d]=(0,i.useState)(!0),u=(0,i.useRef)(new Date(Date.now()-18144e5).toISOString()),{loading:x,data:w,refetch:C,previousData:k,error:z}=(0,n.aM)((0,f.P3)(e,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{context:e,page:1,limit:5,filters:[{embeddings_updated_at:{gte:u.current}}],sort:{field:"embeddings_updated_at",direction:"DESC"}}}),[S,E]=(0,a.D)((0,f.Eq)(e),{onCompleted:s=>{let t=s[e+"_itemsGenerateChunks"];if(t.jobs?.length>0){g.Am.success("Chunks generation started",{description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}g.Am.success("Chunks generated",{description:"Chunks generated successfully."})}}),[_,O]=(0,a.D)((0,f.ps)(e),{onCompleted:s=>{let t=s[e+"_itemsDeleteChunks"];if(t.jobs?.length>0){g.Am.success("Chunks deletion started",{description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}g.Am.success("Chunks deleted",{description:"Chunks deleted successfully."})}}),q=w?.[e+f.Md];return x?r.jsx(o.Zb,{children:r.jsx(o.aY,{className:"pt-6",children:r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(y.Z,{className:"h-6 w-6 animate-spin"})})})}):(0,r.jsxs)(o.Zb,{className:"border-0 rounded-none",children:[r.jsx(o.Ol,{children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{children:[r.jsx(o.ll,{children:"Recent Embeddings"}),r.jsx(o.SZ,{children:"Items with embeddings updated in the last 21 days"})]}),x&&r.jsx(y.Z,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),r.jsx("div",{children:(0,r.jsxs)(b.h_,{modal:!1,children:[r.jsx(b.$F,{asChild:!0,children:(0,r.jsxs)(c.z,{variant:"ghost",className:"flex size-8 p-0 data-[state=open]:bg-muted",children:[r.jsx(N.nWS,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Open menu"})]})}),(0,r.jsxs)(b.AW,{align:"end",children:[r.jsx(b.Xi,{onClick:()=>t("generate"),children:"Generate all embeddings"}),r.jsx(b.Xi,{onClick:()=>{t("delete")},children:"Delete all embeddings"})]})]})})]})}),r.jsx(o.aY,{children:r.jsx("div",{className:"border rounded-lg",children:q?.items?.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No recent embeddings"}):(0,r.jsxs)(v.iA,{children:[r.jsx(v.xD,{children:(0,r.jsxs)(v.SC,{children:[r.jsx(v.ss,{children:"Name"}),r.jsx(v.ss,{className:"text-right",children:"Updated"})]})}),r.jsx(v.RM,{children:q?.items?.map((s,t)=>r.jsxs(v.SC,{children:[r.jsx(v.pj,{className:"font-medium",children:r.jsx(h.default,{className:"hover:text-blue-500 hover:underline",href:`/data/${e}/${s.id}`,children:r.jsx(j.L,{text:s.name||s.id||"",length:100})})}),r.jsx(v.pj,{className:"text-right text-sm text-muted-foreground",children:s.embeddings_updated_at?m.Q(new Date(s.embeddings_updated_at),{addSuffix:!0}):"never"})]},t))})]})})}),r.jsx(p.aR,{open:"generate"===s,onOpenChange:e=>!e&&t(null),children:(0,r.jsxs)(p._T,{children:[(0,r.jsxs)(p.fY,{children:[r.jsx(p.f$,{children:"Generate Embeddings"}),r.jsx(p.yT,{children:"Are you sure you want to generate embeddings for this context? This will create new embedding vectors for every item in the context, this can take a long time, might cost money if you are using a paid service as your embedder, or require a lot of computational resources if your embedder is self hosted."})]}),(0,r.jsxs)(p.xo,{children:[r.jsx(p.le,{children:"Cancel"}),r.jsx(p.OL,{disabled:E.loading,onClick:()=>{t(null),S(),g.Am.info("Generating embeddings...",{description:"Embeddings are being generated in the background, depending on the size of the item this may take a while."})},children:"Generate"})]})]})}),r.jsx(p.aR,{open:"delete"===s,onOpenChange:e=>!e&&t(null),children:(0,r.jsxs)(p._T,{children:[(0,r.jsxs)(p.fY,{children:[r.jsx(p.f$,{children:"Delete Embeddings"}),r.jsx(p.yT,{children:"Are you sure you want to delete all embeddings for this context? This action cannot be undone. Embeddings are used to search and filter items, deleting them will remove this functionality from the context, regenerating embeddings might take a long time, might cost money if you are using a paid service as your embedder, or require a lot of computational resources if your embedder is self hosted."})]}),(0,r.jsxs)(p.xo,{children:[r.jsx(p.le,{children:"Cancel"}),r.jsx(p.OL,{disabled:O.loading,onClick:async()=>{t(null),_(),g.Am.success("Embeddings deleted",{description:"All embeddings for this item have been deleted."})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}var C=t(43273),k=t(65304),z=t(34789),S=t(24295),E=t(18286),_=t(86333),O=t(941),q=t(19753);function M(e){let[s,t]=(0,i.useState)(!0),{toast:m}=(0,z.pm)(),{data:h,loading:p,error:g}=(0,n.aM)(f.fV,{variables:{id:e.context}}),j=h?.contextById,v=(0,l.useRouter)(),[y,b]=(0,a.D)(f.xR,{onCompleted:e=>{I(),m({title:"Embedder configs updated",description:"Embedder configs updated successfully."})},onError:e=>{I(),m({title:"Error updating embedder configs",description:e.message})}}),[M,P]=(0,a.D)(f.s7,{onCompleted:e=>{I(),m({title:"Embedder configs created",description:"Embedder configs created successfully."})},onError:e=>{I(),m({title:"Error creating embedder configs",description:e.message})}}),{data:R,loading:D,refetch:I}=(0,n.aM)(f.c2,{skip:!j?.embedder?.id,variables:{context:e.context,embedder:j?.embedder?.id}}),A=R?.embedder_settingsPagination?.items||[],{data:Z}=(0,n.aM)(f.Az,{variables:{page:1,limit:100}}),L=Z?.variablesPagination?.items||[];return p?(0,r.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[r.jsx(k.O,{className:"w-full h-[80px] rounded-md"}),r.jsx(k.O,{className:"w-full h-[50px] rounded-md mt-3"}),r.jsx(k.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(k.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(k.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(k.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):g?(0,r.jsxs)(C.bZ,{variant:"destructive",children:[r.jsx(N.LPM,{className:"size-4"}),r.jsx(C.Cd,{children:"Error"}),r.jsx(C.X,{children:g?.message||"Error loading item."})]}):(0,r.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex p-2 justify-between",children:[r.jsx("div",{className:"flex items-center gap-2"}),(0,r.jsxs)(c.z,{onClick:()=>{v.push("/context")},variant:"ghost",size:"icon",children:[r.jsx(_.Z,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Back"})]})]}),r.jsx(u.Z,{})]}):null,j?(0,r.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,r.jsxs)(o.Zb,{className:"border-0 rounded-none",children:[r.jsx(o.Ol,{children:r.jsx(o.ll,{className:"text-lg",children:"Settings"})}),r.jsx(o.aY,{className:"grid gap-4",children:r.jsx(x.x,{className:"max-h-[600px]",children:(0,r.jsxs)("div",{className:"space-y-6 pr-4",children:[(0,r.jsxs)("div",{children:[r.jsx("h2",{className:"text-xl font-bold",children:j.name}),r.jsx("p",{className:"text-muted-foreground mt-1",children:j.description}),(0,r.jsxs)("div",{className:"mt-3 flex items-center",children:[r.jsx("span",{className:"text-sm font-medium mr-2",children:"Embedder:"}),(0,r.jsxs)(d.C,{variant:"outline",children:[j.embedder?.name||"None"," (",j.embedder?.id,")"]})]})]}),(0,r.jsxs)("div",{children:[r.jsx("span",{className:"text-sm font-medium mr-2",children:"Calculate Vectors:"}),r.jsx(d.C,{variant:"secondary",children:j.configuration?.calculateVectors?j.configuration.calculateVectors.charAt(0).toUpperCase()+j.configuration.calculateVectors.slice(1):"Manual"}),(0,r.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground",children:[(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"Manual"}),": Vectors are only calculated when triggered manually."]}),(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"On Update"}),": Vectors are recalculated whenever an item is updated."]}),(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"On Insert"}),": Vectors are calculated when a new item is inserted."]}),(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"Always"}),": Vectors are calculated on both insert and update operations."]})]})]}),(0,r.jsxs)("div",{children:[r.jsx("span",{className:"text-sm font-medium mr-2",children:"Embedder Configs:"}),r.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:L?.length&&j?.embedder?.config?.map(s=>{let t=A?.find(e=>e.name===s.name);return console.log("currentValue",t),console.log("embedderConfigs",A),console.log("config",s),r.jsxs("div",{className:"space-y-2",children:[r.jsx(E.f,{configItem:s,currentValue:t?.value||"",variables:L,onVariableSelect:r=>{console.log("variableName",r),t?y({variables:{id:t.id,name:s.name,value:r}}):M({variables:{name:s.name,value:r,context:e.context,embedder:j?.embedder?.id}})}}),r.jsx("span",{children:s.description})]},s.name)})})]})]})})})]}),r.jsx(w,{contextId:j.id}),r.jsx(S.zF,{open:s,onOpenChange:t,children:(0,r.jsxs)(o.Zb,{className:"bg-none border-0 rounded-none",children:[r.jsx(o.Ol,{children:r.jsx(S.wy,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",children:[r.jsx(o.ll,{children:"Queues"}),(0,r.jsxs)(c.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[r.jsx(O.Z,{className:`h-4 w-4 transition-transform ${s?"":"-rotate-90"}`}),r.jsx("span",{className:"sr-only",children:"Toggle sources"})]})]})})}),r.jsx(S.Fw,{children:r.jsx(o.aY,{children:j.embedder?.queue?r.jsx("div",{className:"space-y-4",children:r.jsx("div",{children:r.jsx(q.R,{queueName:j.embedder?.queue,nameGenerator:e=>"Source update",retryJob:e=>{if(!e.data?.source||!e.data?.context)return}})},j.embedder?.queue)}):r.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No queues found."})})})]})})]}):r.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."})]})}},42239:(e,s,t)=>{"use strict";t.d(s,{c:()=>v});var r=t(10326),n=t(39167),a=t(35047),l=t(17577),i=t(567),d=t(90772),c=t(33071),o=t(8281),u=t(42270),x=t(43273),m=t(65304),h=t(76812),p=t(24295),g=t(86333),f=t(941),j=t(19753);function v(e){let[s,t]=(0,l.useState)(!0),v=(0,a.useRouter)(),{data:y,loading:b,error:N}=(0,n.aM)(u.fV,{variables:{id:e.context}}),w=y?.contextById;return b?(0,r.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[r.jsx(m.O,{className:"w-full h-[80px] rounded-md"}),r.jsx(m.O,{className:"w-full h-[50px] rounded-md mt-3"}),r.jsx(m.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(m.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(m.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(m.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):N?(0,r.jsxs)(x.bZ,{variant:"destructive",children:[r.jsx(h.LPM,{className:"size-4"}),r.jsx(x.Cd,{children:"Error"}),r.jsx(x.X,{children:N?.message||"Error loading item."})]}):(0,r.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex p-2 justify-between",children:[r.jsx("div",{className:"flex items-center gap-2"}),(0,r.jsxs)(d.z,{onClick:()=>{v.push("/context")},variant:"ghost",size:"icon",children:[r.jsx(g.Z,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Back"})]})]}),r.jsx(o.Z,{})]}):null,w?(0,r.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,r.jsxs)(c.Zb,{className:"border-0 rounded-none",children:[r.jsx(c.Ol,{children:r.jsx(c.ll,{className:"text-lg",children:"Settings"})}),r.jsx(c.aY,{className:"grid gap-4",children:r.jsx("div",{className:"space-y-6 pr-4",children:(0,r.jsxs)("div",{children:[r.jsx("h2",{className:"text-xl font-bold",children:w.name}),r.jsx("p",{className:"text-muted-foreground mt-1",children:w.description}),(0,r.jsxs)("div",{className:"mt-3 flex items-center",children:[r.jsx("span",{className:"text-sm font-medium mr-2",children:"Embedder:"}),(0,r.jsxs)(i.C,{variant:"outline",children:[w.embedder?.name||"None"," (",w.embedder?.id,")"]})]})]})})})]}),r.jsx(p.zF,{open:s,onOpenChange:t,children:(0,r.jsxs)(c.Zb,{className:"bg-none border-0 rounded-none",children:[r.jsx(c.Ol,{children:r.jsx(p.wy,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",children:[r.jsx(c.ll,{children:"Processors"}),(0,r.jsxs)(d.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[r.jsx(f.Z,{className:`h-4 w-4 transition-transform ${s?"":"-rotate-90"}`}),r.jsx("span",{className:"sr-only",children:"Toggle processors"})]})]})})}),r.jsx(p.Fw,{children:(0,r.jsxs)(c.aY,{children:[w.processors?.map(e=>r.jsx("div",{className:"space-y-4 mb-6",children:r.jsxs(c.Zb,{className:"border-l-4 border-l-primary",children:[r.jsxs(c.Ol,{children:[r.jsxs(c.ll,{className:"text-base flex items-center justify-between",children:[r.jsx("span",{children:e.field}),r.jsx(i.C,{variant:"outline",children:e.queue})]}),e.description&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.description})]}),r.jsxs(c.aY,{children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Trigger"}),r.jsx(i.C,{variant:"secondary",className:"font-mono text-xs",children:e.trigger})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Timeout"}),r.jsxs(i.C,{variant:"secondary",className:"font-mono text-xs",children:[e.timeoutInSeconds,"s"]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Embeddings"}),r.jsx(i.C,{variant:e.generateEmbeddings?"default":"secondary",className:"text-xs",children:e.generateEmbeddings?"Enabled, this means embeddings will be generated after the processor finishes executing":"Disabled, this means embeddings will not be generated after the processor finishes executing"})]})]}),r.jsx(o.Z,{className:"my-4"}),r.jsx(j.R,{queueName:e.queue,nameGenerator:e=>"Processor update",retryJob:e=>{if(!e.data?.source||!e.data?.context)return}})]})]})},e.queue)),w.processors?.length===0&&r.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No queues found."})]})})]})})]}):r.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."})]})}},5096:(e,s,t)=>{"use strict";t.d(s,{L:()=>_});var r=t(10326),n=t(39167),a=t(18753),l=t(86333),i=t(94893),d=t(941),c=t(75290),o=t(35047),u=t(17577),x=t(90772),m=t(33071),h=t(8281),p=t(65685),g=t(54432),f=t(31048),j=t(24295),v=t(15940),y=t(567),b=t(68232),N=t(62288),w=t(42270),C=t(43273),k=t(65304),z=t(76812),S=t(19753),E=t(85999);function _(e){let[s,t]=(0,u.useState)(!0),[_,O]=(0,u.useState)(!1),[q,M]=(0,u.useState)(null),[P,R]=(0,u.useState)({}),{data:D,loading:I,error:A}=(0,n.aM)(w.fV,{variables:{id:e.context}}),Z=D?.contextById,L=(0,o.useRouter)(),[T,{loading:F}]=(0,a.D)((0,w.C3)(e.context),{onCompleted:s=>{let t=s[`${e.context}_itemsExecuteSource`];O(!1),M(null),R({}),E.Am.success(t.message||"Source executed successfully",{description:t.jobs?.length?`${t.jobs.length} job(s) scheduled`:t.items?.length?`${t.items.length} item(s) processed`:void 0})},onError:e=>{E.Am.error("Failed to execute source",{description:e.message})}}),$=(e,s,t,r)=>{if(M({id:e,name:s,queue:t,params:r}),r){let e={};r.forEach(s=>{e[s.name]=s.default||""}),R(e)}O(!0)};if(I)return(0,r.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[r.jsx(k.O,{className:"w-full h-[80px] rounded-md"}),r.jsx(k.O,{className:"w-full h-[50px] rounded-md mt-3"}),r.jsx(k.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(k.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(k.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(k.O,{className:"w-full h-[80px] rounded-md mt-3"})]});if(A)return(0,r.jsxs)(C.bZ,{variant:"destructive",children:[r.jsx(z.LPM,{className:"size-4"}),r.jsx(C.Cd,{children:"Error"}),r.jsx(C.X,{children:A?.message||"Error loading item."})]});let G=[];return Z&&(G=Array.from(new Set(Z.sources.map(e=>e.config.queue).filter(e=>!!e)))),(0,r.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex p-2 justify-between",children:[r.jsx("div",{className:"flex items-center gap-2"}),(0,r.jsxs)(x.z,{onClick:()=>{L.push("/context")},variant:"ghost",size:"icon",children:[r.jsx(l.Z,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Back"})]})]}),r.jsx(h.Z,{})]}):null,Z?(0,r.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,r.jsxs)(m.Zb,{className:"border-0 rounded-none",children:[r.jsx(m.Ol,{children:r.jsx(m.ll,{className:"text-lg",children:"Settings"})}),r.jsx(m.aY,{className:"grid gap-4",children:r.jsx(p.x,{className:"max-h-[600px]",children:r.jsx("div",{className:"space-y-6 pr-4",children:(0,r.jsxs)("div",{children:[r.jsx("h2",{className:"text-xl font-bold",children:Z.name}),r.jsx("p",{className:"text-muted-foreground mt-1",children:Z.description})]})})})})]}),(0,r.jsxs)(m.Zb,{className:"border-0 rounded-none",children:[(0,r.jsxs)(m.Ol,{children:[r.jsx(m.ll,{children:"Sources"}),r.jsx(m.SZ,{children:"Sources are used to fetch external data and ingest them into the context."})]}),r.jsx(m.aY,{children:Z.sources&&Z.sources.length>0?r.jsx(b.pn,{children:r.jsx("div",{className:"rounded-md border",children:(0,r.jsxs)(v.iA,{children:[r.jsx(v.xD,{children:(0,r.jsxs)(v.SC,{children:[r.jsx(v.ss,{children:"Name"}),r.jsx(v.ss,{children:"Description"}),r.jsx(v.ss,{children:"Queue Configuration"}),r.jsx(v.ss,{className:"text-right",children:"Actions"})]})}),r.jsx(v.RM,{children:Z.sources.map(e=>{let s=e.config.queue||e.config.schedule||void 0!==e.config.retries||e.config.backoff;return(0,r.jsxs)(v.SC,{children:[r.jsx(v.pj,{className:"font-medium",children:e.name}),r.jsx(v.pj,{className:"max-w-[300px]",children:e.description||"-"}),r.jsx(v.pj,{children:s?(0,r.jsxs)(b.u,{children:[r.jsx(b.aJ,{asChild:!0,children:r.jsx("div",{className:"cursor-help",children:e.config.queue?r.jsx(y.C,{variant:"outline",className:"cursor-help",children:e.config.queue}):r.jsx("span",{className:"text-muted-foreground",children:"No queue configured"})})}),r.jsx(b._v,{className:"max-w-[300px]",children:(0,r.jsxs)("div",{className:"space-y-2",children:[e.config.queue&&(0,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Queue:"}),r.jsx("span",{className:"ml-2 text-xs",children:e.config.queue})]}),e.config.schedule&&(0,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Schedule:"}),r.jsx("code",{className:"ml-2 text-xs bg-muted px-1 py-0.5 rounded",children:e.config.schedule})]}),void 0!==e.config.retries&&(0,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Retries:"}),r.jsx("span",{className:"ml-2 text-xs",children:e.config.retries||"Default (3)"})]}),e.config.backoff&&(0,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Backoff:"}),(0,r.jsxs)("span",{className:"ml-2 text-xs",children:[e.config.backoff.type||"Default (exponential)"," (",e.config.backoff.delay||"Default (2000)","ms)"]})]})]})})]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(v.pj,{className:"text-right",children:r.jsx(x.z,{variant:"ghost",size:"sm",onClick:()=>$(e.id,e.name,e.config.queue,e.config.params),title:"Manually trigger source",children:r.jsx(i.Z,{className:"h-4 w-4"})})})]},e.id)})})]})})}):r.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No sources found."})})]}),r.jsx(j.zF,{open:s,onOpenChange:t,children:(0,r.jsxs)(m.Zb,{className:"bg-none border-0 rounded-none",children:[r.jsx(m.Ol,{children:r.jsx(j.wy,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",children:[r.jsx(m.ll,{children:"Queues"}),(0,r.jsxs)(x.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[r.jsx(d.Z,{className:`h-4 w-4 transition-transform ${s?"":"-rotate-90"}`}),r.jsx("span",{className:"sr-only",children:"Toggle sources"})]})]})})}),r.jsx(j.Fw,{children:r.jsx(m.aY,{children:G.length>0?r.jsx("div",{className:"space-y-4",children:G.map(e=>r.jsx("div",{children:r.jsx(S.R,{queueName:e,nameGenerator:e=>"Source update",retryJob:e=>{if(console.log("[EXULU] Retrying job: ",e),!e.data?.source||!e.data?.context)return;let s=Z?.sources.find(s=>s.id===e.data?.source);if(!s){E.Am.error("Source not found for job: "+e.data?.source,{description:"The source was not found for the job. This might mean the source no longer exists."});return}let t=s.config;$(s.id,s.name,s.config.queue,t.params)}})},e))}):r.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No queues found."})})})]})})]}):r.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."}),r.jsx(N.Vq,{modal:!1,open:_,onOpenChange:e=>{O(e),e||(R({}),M(null))},children:(0,r.jsxs)(N.cZ,{children:[(0,r.jsxs)(N.fK,{children:[r.jsx(N.$N,{children:"Trigger Source"}),r.jsx(N.Be,{children:q?.queue?(0,r.jsxs)(r.Fragment,{children:["Are you sure you want to trigger ",r.jsx("strong",{children:q.name}),"?",r.jsx("br",{}),r.jsx("br",{}),"A job will be scheduled and visible in the ",r.jsx("span",{className:"font-semibold",children:q.queue})," queue."]}):(0,r.jsxs)(r.Fragment,{children:["Are you sure you want to trigger ",r.jsx("strong",{children:q?.name}),"?",r.jsx("br",{}),r.jsx("br",{}),"The source will be executed immediately without queuing."]})})]}),q?.params&&q.params.length>0&&(0,r.jsxs)("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"text-sm font-medium",children:"Parameters"}),q.params.map(e=>(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)(f._,{htmlFor:e.name,children:[e.name,e.description&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:e.description})]}),r.jsx(g.I,{id:e.name,value:P[e.name]||"",onChange:s=>{R(t=>({...t,[e.name]:s.target.value}))},placeholder:e.default||"",disabled:F})]},e.name))]}),(0,r.jsxs)(N.cN,{children:[r.jsx(x.z,{variant:"outline",onClick:()=>O(!1),disabled:F,children:"Cancel"}),r.jsx(x.z,{onClick:()=>{q&&T({variables:{source:q.id,inputs:P}})},disabled:F,children:F?(0,r.jsxs)(r.Fragment,{children:[r.jsx(c.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Executing..."]}):(0,r.jsxs)(r.Fragment,{children:[r.jsx(i.Z,{className:"mr-2 h-4 w-4"}),"Trigger Source"]})})]})]})})]})}},42193:(e,s,t)=>{"use strict";t.d(s,{z:()=>f});var r=t(10326),n=t(17577),a=t(76812),l=t(57305),i=t(92977),d=t(98181),c=t(77863),o=t(90772),u=t(11890),x=t(39183),m=t(17757);function h({className:e,classNames:s,showOutsideDays:t=!0,...n}){return r.jsx(m._W,{showOutsideDays:t,className:(0,c.cn)("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:(0,c.cn)((0,o.d)({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:(0,c.cn)((0,o.d)({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...s},components:{IconLeft:({...e})=>r.jsx(u.Z,{className:"size-4"}),IconRight:({...e})=>r.jsx(x.Z,{className:"size-4"})},...n})}h.displayName="Calendar";var p=t(34789),g=t(30811);function f({dateRange:e,onDateRangeChange:s,className:t,maxDays:u=30}){let{toast:x}=(0,p.pm)(),m=n.useMemo(()=>{if(!e?.from)return[];let s=e.from;return[{before:(0,i.E)(s,-u)},{after:(0,i.E)(s,u)}]},[e?.from,u]);return r.jsx("div",{className:(0,c.cn)("grid gap-2",t),children:(0,r.jsxs)(g.J2,{children:[r.jsx(g.xo,{asChild:!0,children:(0,r.jsxs)(o.z,{id:"date",variant:"outline",className:(0,c.cn)("w-[260px] justify-start text-left font-normal",!e&&"text-muted-foreground"),children:[r.jsx(a.Que,{className:"mr-2 h-4 w-4"}),e?.from?e.to?(0,r.jsxs)(r.Fragment,{children:[(0,d.WU)(e.from,"LLL dd, y")," -"," ",(0,d.WU)(e.to,"LLL dd, y")]}):(0,d.WU)(e.from,"LLL dd, y"):r.jsx("span",{children:"Pick a date range"})]})}),(0,r.jsxs)(g.yk,{className:"w-auto p-0",align:"end",children:[r.jsx(h,{initialFocus:!0,mode:"range",defaultMonth:e?.from,selected:e,onSelect:e=>{if(e?.from&&e?.to&&(0,l.j)(e.to,e.from)>u){x({title:"Date range too large",description:`Please select a date range of ${u} days or less.`,variant:"destructive"});return}s(e)},disabled:m,numberOfMonths:2}),(0,r.jsxs)("div",{className:"p-3 pt-0 text-xs text-muted-foreground border-t",children:["Maximum range: ",u," days"]})]})]})})}},22746:(e,s,t)=>{"use strict";t.d(s,{Y:()=>h});var r=t(10326),n=t(17577),a=t(39167),l=t(34474),i=t(65304),d=t(42270),c=t(20751),o=t(78948),u=t(99630),x=t(90250);let m=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))","hsl(var(--chart-6))","hsl(var(--chart-7))","hsl(var(--chart-8))","hsl(var(--chart-9))","hsl(var(--chart-10))"];function h({groupByOptions:e,dateRange:s,selectedType:t,groupBy:h,onGroupByChange:p,unit:g}){let{data:f,loading:j,error:v}=(0,a.aM)(d.YH,{variables:{type:t,groupBy:h,from:s?.from?.toISOString(),to:s?.to?.toISOString(),names:"tokens"===g?["inputTokens","outputTokens"]:["count"]},skip:!s?.from||!s?.to}),{chartData:y,chartConfig:b}=n.useMemo(()=>{if(!f?.trackingStatistics)return{chartData:[],chartConfig:{}};let e=f.trackingStatistics.map((e,s)=>{var t;return{name:(t=e?.group)&&"string"==typeof t?t.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "):"Unknown",value:e?.count,fill:m[s%m.length]}}).sort((e,s)=>s.value-e.value),s=e.reduce((e,s,t)=>(e[s.name]={label:s.name,color:m[t%m.length]},e),{});return{chartData:e,chartConfig:s}},[f]);return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-xl font-semibold",children:"Distribution"}),e.length>0&&r.jsx("div",{className:"w-full max-w-[150px]",children:(0,r.jsxs)(l.Ph,{value:h,onValueChange:p,children:[r.jsx(l.i4,{children:r.jsx(l.ki,{placeholder:"Group by"})}),r.jsx(l.Bw,{children:e.map(e=>r.jsx(l.Ql,{value:e.value,children:e.label},e.value))})]})})]}),r.jsx("div",{className:"flex-1 min-h-0",children:j?r.jsx("div",{className:"space-y-4 h-full",children:r.jsx(i.O,{className:"h-full w-full"})}):v?(0,r.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading distribution data: ",v.message]}):0===y.length?r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-center",children:"No data available for the selected date range, type, and grouping."}):r.jsx(x.BO,{config:b,className:"h-full w-full",children:(0,r.jsxs)(c.u,{children:[r.jsx("defs",{children:y.map((e,s)=>(0,r.jsxs)("radialGradient",{id:`gradient-${e.name.replace(/\s+/g,"-")}`,cx:"50%",cy:"50%",r:"50%",children:[r.jsx("stop",{offset:"0%",stopColor:e.fill,stopOpacity:1}),r.jsx("stop",{offset:"100%",stopColor:e.fill,stopOpacity:.8})]},`gradient-${s}`))}),r.jsx(o.b,{data:y,cx:"50%",cy:"50%",labelLine:!1,label:({cx:e,cy:s,midAngle:t,innerRadius:n,outerRadius:a,percent:l,index:i})=>{if(l<.05)return null;let d=Math.PI/180,c=n+(a-n)*.5,o=e+c*Math.cos(-t*d);return r.jsx("text",{x:o,y:s+c*Math.sin(-t*d),fill:"black",textAnchor:o>e?"start":"end",dominantBaseline:"central",fontSize:"12",fontWeight:"600",paintOrder:"stroke",children:`${(100*l).toFixed(0)}%`})},outerRadius:"75%",innerRadius:"45%",dataKey:"value",strokeWidth:3,children:y.map((e,s)=>r.jsx(u.b,{fill:`url(#gradient-${e.name.replace(/\s+/g,"-")})`},`cell-${s}`))}),r.jsx(x.h7,{content:r.jsx(x.dg,{nameKey:"name",hideLabel:!0,formatter:(e,s)=>["number"==typeof e?e.toLocaleString():e," "+String(s)]})})]})})})]})}},16923:(e,s,t)=>{"use strict";t.d(s,{q:()=>y});var r=t(10326),n=t(17577),a=t(39167),l=t(34474),i=t(65304),d=t(42270),c=t(10669),o=t(18423),u=t(62637),x=t(9997),m=t(47445),h=t(90250),p=t(98181),g=t(99515),f=t(32067);function j(e){return e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}let v={count:{label:"Count",color:"hsl(var(--muted-foreground))"}};function y({dataTypes:e,dateRange:s,selectedType:t,onTypeChange:y,onUnitChange:b,unit:N,unitOptions:w}){let{data:C,loading:k,error:z}=(0,a.aM)(d.j9,{variables:{type:t,name:N,from:s?.from?.toISOString(),to:s?.to?.toISOString(),names:[N]},skip:!s?.from||!s?.to}),S=n.useMemo(()=>{if(!C?.trackingStatistics||!s?.from||!s?.to)return[];let e=new Map;return C.trackingStatistics.forEach(s=>{let t=new Date("number"==typeof s.group?s.group:Number(s.group)),r=(0,p.WU)((0,g.b)(t),"yyyy-MM-dd");e.set(r,s.count)}),(0,f.D)({start:(0,g.b)(s.from),end:(0,g.b)(s.to)}).map(s=>{let t=(0,p.WU)(s,"yyyy-MM-dd"),r=e.get(t)||0;return{date:s.getTime(),count:r,formattedDate:(0,p.WU)(s,"MMM dd"),dateObj:s}})},[C,s]);return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-xl font-semibold",children:"Time Series Analytics"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-[150px]",children:(0,r.jsxs)(l.Ph,{value:t,onValueChange:e=>y(e),children:[r.jsx(l.i4,{children:r.jsx(l.ki,{placeholder:"Select data type"})}),r.jsx(l.Bw,{children:e?.map(e=>r.jsx(l.Ql,{value:e,children:j(e)+" "},e))})]})}),w?.length>1&&r.jsx("div",{className:"w-[150px]",children:(0,r.jsxs)(l.Ph,{value:N,onValueChange:e=>b(e),children:[r.jsx(l.i4,{children:r.jsx(l.ki,{placeholder:"Select unit"})}),r.jsx(l.Bw,{children:w?.map(e=>r.jsx(l.Ql,{value:e.value,children:e.label},e.value))})]})})]})]}),r.jsx("div",{className:"flex-1 min-h-0",children:k?r.jsx("div",{className:"space-y-4 h-full",children:r.jsx(i.O,{className:"h-full w-full"})}):z?(0,r.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading time series data: ",z.message]}):0===S.length?r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No data available for the selected date range and type"}):r.jsx(h.BO,{config:v,className:"h-full w-full",children:(0,r.jsxs)(c.T,{data:S,children:[(0,r.jsxs)("defs",{children:[(0,r.jsxs)("linearGradient",{id:"fillCount",x1:"0",y1:"0",x2:"0",y2:"1",children:[r.jsx("stop",{offset:"5%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.3}),r.jsx("stop",{offset:"95%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.05})]}),(0,r.jsxs)("linearGradient",{id:"strokeCount",x1:"0",y1:"0",x2:"1",y2:"0",children:[r.jsx("stop",{offset:"0%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.8}),r.jsx("stop",{offset:"100%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.6})]})]}),r.jsx(o.q,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,vertical:!1}),r.jsx(u.K,{dataKey:"formattedDate",tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"},tickLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5},axisLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5}}),r.jsx(x.B,{tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"},tickLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5},axisLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5}}),r.jsx(h.h7,{labelFormatter:(e,s)=>s&&s[0]?(0,p.WU)(s[0].payload.dateObj,"PPP")+" ":e,content:r.jsx(h.dg,{nameKey:"name",hideLabel:!0,formatter:(e,s)=>["number"==typeof e?e.toLocaleString():e," "+String(s)]})}),r.jsx(h.Qk,{content:r.jsx(h.cD,{})}),r.jsx(m.u,{type:"monotone",dataKey:"count",stroke:"url(#strokeCount)",strokeWidth:3,fill:"url(#fillCount)",fillOpacity:.6,dot:{fill:"hsl(var(--muted-foreground))",strokeWidth:2,r:4,strokeOpacity:.8},activeDot:{r:6,strokeWidth:2,fill:"hsl(var(--background))",stroke:"hsl(var(--muted-foreground))",strokeOpacity:1},name:j(t)})]})})})]})}},29718:(e,s,t)=>{"use strict";t.d(s,{L:()=>n});var r=t(10326);function n({text:e,length:s}){return e.length>s?(0,r.jsxs)(r.Fragment,{children:[e.slice(0,s),"..."]}):r.jsx(r.Fragment,{children:e})}},90250:(e,s,t)=>{"use strict";t.d(s,{BO:()=>x,Qk:()=>g,cD:()=>f,dg:()=>p,h7:()=>h});var r=t(10326),n=t(17577),a=t(30660),l=t(44675),i=t(69274),d=t(77863);let c={light:"",dark:".dark"},o=n.createContext(null);function u(){let e=n.useContext(o);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}let x=n.forwardRef(({id:e,className:s,children:t,config:l,...i},c)=>{let u=n.useId(),x=`chart-${e||u.replace(/:/g,"")}`;return r.jsx(o.Provider,{value:{config:l},children:(0,r.jsxs)("div",{"data-chart":x,ref:c,className:(0,d.cn)("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",s),...i,children:[r.jsx(m,{id:x,config:l}),r.jsx(a.h,{children:t})]})})});x.displayName="Chart";let m=({id:e,config:s})=>{let t=Object.entries(s).filter(([,e])=>e.theme||e.color);return t.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(c).map(([s,r])=>`
2
2
  ${r} [data-chart=${e}] {
3
- ${s.map(([e,s])=>{let r=s.theme?.[t]||s.color;return r?` --color-${e}: ${r};`:null}).join("\n")}
3
+ ${t.map(([e,t])=>{let r=t.theme?.[s]||t.color;return r?` --color-${e}: ${r};`:null}).join("\n")}
4
4
  }
5
- `).join("\n")}}):null},m=l.u,p=n.forwardRef(({active:e,payload:t,className:s,indicator:a="dot",hideLabel:l=!1,hideIndicator:i=!1,label:c,labelFormatter:o,labelClassName:x,formatter:h,color:m,nameKey:p,labelKey:g},f)=>{let{config:v}=u(),y=n.useMemo(()=>{if(l||!t?.length)return null;let[e]=t,s=`${g||e?.dataKey||e?.name||"value"}`,n=j(v,e,s),a=g||"string"!=typeof c?n?.label:v[c]?.label||c;return o?r.jsx("div",{className:(0,d.cn)("font-medium",x),children:o(a,t)}):a?r.jsx("div",{className:(0,d.cn)("font-medium",x),children:a}):null},[c,o,t,l,x,v,g]);if(!e||!t?.length)return null;let b=1===t.length&&"dot"!==a;return(0,r.jsxs)("div",{ref:f,className:(0,d.cn)("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",s),children:[b?null:y,r.jsx("div",{className:"grid gap-1.5",children:t.map((e,t)=>{let s=`${p||e.name||e.dataKey||"value"}`,n=j(v,e,s),l=m||e.payload.fill||e.color;return r.jsx("div",{className:(0,d.cn)("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===a&&"items-center"),children:h&&e?.value!==void 0&&e.name?h(e.value,e.name,e,t,e.payload):(0,r.jsxs)(r.Fragment,{children:[n?.icon?r.jsx(n.icon,{}):!i&&r.jsx("div",{className:(0,d.cn)("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===a,"w-1":"line"===a,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===a,"my-0.5":b&&"dashed"===a}),style:{"--color-bg":l,"--color-border":l}}),(0,r.jsxs)("div",{className:(0,d.cn)("flex flex-1 justify-between leading-none",b?"items-end":"items-center"),children:[(0,r.jsxs)("div",{className:"grid gap-1.5",children:[b?y:null,r.jsx("span",{className:"text-muted-foreground",children:n?.label||e.name})]}),e.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});p.displayName="ChartTooltip";let g=i.D,f=n.forwardRef(({className:e,hideIcon:t=!1,payload:s,verticalAlign:n="bottom",nameKey:a},l)=>{let{config:i}=u();return s?.length?r.jsx("div",{ref:l,className:(0,d.cn)("flex items-center justify-center gap-4","top"===n?"pb-3":"pt-3",e),children:s.map(e=>{let s=`${a||e.dataKey||"value"}`,n=j(i,e,s);return(0,r.jsxs)("div",{className:(0,d.cn)("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[n?.icon&&!t?r.jsx(n.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null});function j(e,t,s){if("object"!=typeof t||null===t)return;let r="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0,n=s;return s in t&&"string"==typeof t[s]?n=t[s]:r&&s in r&&"string"==typeof r[s]&&(n=r[s]),n in e?e[n]:e[s]}f.displayName="ChartLegend"},75909:(e,t,s)=>{"use strict";s.d(t,{t:()=>a});var r=s(42270),n=s(39167);let a=()=>(0,n.aM)(r.uw,{variables:{limit:20}})},40900:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).Z)("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]])},24081:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).Z)("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]])},21986:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).Z)("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])},23015:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).Z)("PackageOpen",[["path",{d:"M20.91 8.84 8.56 2.23a1.93 1.93 0 0 0-1.81 0L3.1 4.13a2.12 2.12 0 0 0-.05 3.69l12.22 6.93a2 2 0 0 0 1.94 0L21 12.51a2.12 2.12 0 0 0-.09-3.67Z",key:"1vy178"}],["path",{d:"m3.09 8.84 12.35-6.61a1.93 1.93 0 0 1 1.81 0l3.65 1.9a2.12 2.12 0 0 1 .1 3.69L8.73 14.75a2 2 0 0 1-1.94 0L3 12.51a2.12 2.12 0 0 1 .09-3.67Z",key:"s3bv25"}],["line",{x1:"12",x2:"12",y1:"22",y2:"13",key:"1o4xyi"}],["path",{d:"M20 13.5v3.37a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13.5",key:"1na2nq"}]])},44389:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).Z)("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},91468:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).Z)("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]])},91470:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).Z)("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},35157:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).Z)("XSquare",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},31051:(e,t,s)=>{"use strict";s.d(t,{h:()=>r});let r={CONTEXT_RETRIEVE:"CONTEXT_RETRIEVE",SOURCE_UPDATE:"SOURCE_UPDATE",EMBEDDER_UPSERT:"EMBEDDER_UPSERT",EMBEDDER_GENERATE:"EMBEDDER_GENERATE",EMBEDDER_DELETE:"EMBEDDER_DELETE",WORKFLOW_RUN:"WORKFLOW_RUN",CONTEXT_UPSERT:"CONTEXT_UPSERT",TOOL_CALL:"TOOL_CALL",AGENT_RUN:"AGENT_RUN"}},76738:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>r});let r=(0,s(68570).createProxy)(String.raw`/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/layout.tsx#default`)},21114:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>r});let r=(0,s(68570).createProxy)(String.raw`/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx#default`)}};var t=require("../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[9276,3543,9049,590,814,931,6812,7344,1729,3738,5237,8212,4552,6508,108,2194,9874,8181,3702,5999,1025,7471,5028,5483,1051,7944,2270,5600,5974,6590,8286,5485],()=>s(39701));module.exports=r})();
5
+ `).join("\n")}}):null},h=l.u,p=n.forwardRef(({active:e,payload:s,className:t,indicator:a="dot",hideLabel:l=!1,hideIndicator:i=!1,label:c,labelFormatter:o,labelClassName:x,formatter:m,color:h,nameKey:p,labelKey:g},f)=>{let{config:v}=u(),y=n.useMemo(()=>{if(l||!s?.length)return null;let[e]=s,t=`${g||e?.dataKey||e?.name||"value"}`,n=j(v,e,t),a=g||"string"!=typeof c?n?.label:v[c]?.label||c;return o?r.jsx("div",{className:(0,d.cn)("font-medium",x),children:o(a,s)}):a?r.jsx("div",{className:(0,d.cn)("font-medium",x),children:a}):null},[c,o,s,l,x,v,g]);if(!e||!s?.length)return null;let b=1===s.length&&"dot"!==a;return(0,r.jsxs)("div",{ref:f,className:(0,d.cn)("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",t),children:[b?null:y,r.jsx("div",{className:"grid gap-1.5",children:s.map((e,s)=>{let t=`${p||e.name||e.dataKey||"value"}`,n=j(v,e,t),l=h||e.payload.fill||e.color;return r.jsx("div",{className:(0,d.cn)("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===a&&"items-center"),children:m&&e?.value!==void 0&&e.name?m(e.value,e.name,e,s,e.payload):(0,r.jsxs)(r.Fragment,{children:[n?.icon?r.jsx(n.icon,{}):!i&&r.jsx("div",{className:(0,d.cn)("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===a,"w-1":"line"===a,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===a,"my-0.5":b&&"dashed"===a}),style:{"--color-bg":l,"--color-border":l}}),(0,r.jsxs)("div",{className:(0,d.cn)("flex flex-1 justify-between leading-none",b?"items-end":"items-center"),children:[(0,r.jsxs)("div",{className:"grid gap-1.5",children:[b?y:null,r.jsx("span",{className:"text-muted-foreground",children:n?.label||e.name})]}),e.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});p.displayName="ChartTooltip";let g=i.D,f=n.forwardRef(({className:e,hideIcon:s=!1,payload:t,verticalAlign:n="bottom",nameKey:a},l)=>{let{config:i}=u();return t?.length?r.jsx("div",{ref:l,className:(0,d.cn)("flex items-center justify-center gap-4","top"===n?"pb-3":"pt-3",e),children:t.map(e=>{let t=`${a||e.dataKey||"value"}`,n=j(i,e,t);return(0,r.jsxs)("div",{className:(0,d.cn)("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[n?.icon&&!s?r.jsx(n.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null});function j(e,s,t){if("object"!=typeof s||null===s)return;let r="payload"in s&&"object"==typeof s.payload&&null!==s.payload?s.payload:void 0,n=t;return t in s&&"string"==typeof s[t]?n=s[t]:r&&t in r&&"string"==typeof r[t]&&(n=r[t]),n in e?e[n]:e[t]}f.displayName="ChartLegend"},75909:(e,s,t)=>{"use strict";t.d(s,{t:()=>a});var r=t(42270),n=t(39167);let a=()=>(0,n.aM)(r.uw,{variables:{limit:20}})},40900:(e,s,t)=>{"use strict";t.d(s,{Z:()=>r});let r=(0,t(76557).Z)("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]])},24081:(e,s,t)=>{"use strict";t.d(s,{Z:()=>r});let r=(0,t(76557).Z)("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]])},21986:(e,s,t)=>{"use strict";t.d(s,{Z:()=>r});let r=(0,t(76557).Z)("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])},23015:(e,s,t)=>{"use strict";t.d(s,{Z:()=>r});let r=(0,t(76557).Z)("PackageOpen",[["path",{d:"M20.91 8.84 8.56 2.23a1.93 1.93 0 0 0-1.81 0L3.1 4.13a2.12 2.12 0 0 0-.05 3.69l12.22 6.93a2 2 0 0 0 1.94 0L21 12.51a2.12 2.12 0 0 0-.09-3.67Z",key:"1vy178"}],["path",{d:"m3.09 8.84 12.35-6.61a1.93 1.93 0 0 1 1.81 0l3.65 1.9a2.12 2.12 0 0 1 .1 3.69L8.73 14.75a2 2 0 0 1-1.94 0L3 12.51a2.12 2.12 0 0 1 .09-3.67Z",key:"s3bv25"}],["line",{x1:"12",x2:"12",y1:"22",y2:"13",key:"1o4xyi"}],["path",{d:"M20 13.5v3.37a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13.5",key:"1na2nq"}]])},44389:(e,s,t)=>{"use strict";t.d(s,{Z:()=>r});let r=(0,t(76557).Z)("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},91468:(e,s,t)=>{"use strict";t.d(s,{Z:()=>r});let r=(0,t(76557).Z)("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]])},91470:(e,s,t)=>{"use strict";t.d(s,{Z:()=>r});let r=(0,t(76557).Z)("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},35157:(e,s,t)=>{"use strict";t.d(s,{Z:()=>r});let r=(0,t(76557).Z)("XSquare",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},31051:(e,s,t)=>{"use strict";t.d(s,{h:()=>r});let r={CONTEXT_RETRIEVE:"CONTEXT_RETRIEVE",SOURCE_UPDATE:"SOURCE_UPDATE",EMBEDDER_UPSERT:"EMBEDDER_UPSERT",EMBEDDER_GENERATE:"EMBEDDER_GENERATE",EMBEDDER_DELETE:"EMBEDDER_DELETE",WORKFLOW_RUN:"WORKFLOW_RUN",CONTEXT_UPSERT:"CONTEXT_UPSERT",TOOL_CALL:"TOOL_CALL",AGENT_RUN:"AGENT_RUN"}},76738:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>r});let r=(0,t(68570).createProxy)(String.raw`/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/layout.tsx#default`)},21114:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>r});let r=(0,t(68570).createProxy)(String.raw`/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx#default`)}};var s=require("../../../../webpack-runtime.js");s.C(e);var t=e=>s(s.s=e),r=s.X(0,[9276,3543,9049,590,814,931,6812,7344,1729,3738,5237,8212,4552,6508,108,2194,9874,8181,3702,5999,1025,7471,5028,5483,1051,7944,2270,5600,5974,6590,8286,5485],()=>t(39701));module.exports=r})();