@flexkit/studio 0.2.32 → 0.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity-nav-button-ZHQOZBCC.js +2 -0
- package/dist/{activity-nav-button-E4I4YC3X.js.map → activity-nav-button-ZHQOZBCC.js.map} +1 -1
- package/dist/astro.js +1 -1
- package/dist/chat-page-7XT4K75G.js +4 -0
- package/dist/chat-page-7XT4K75G.js.map +1 -0
- package/dist/chunk-2FCVATRT.js +4 -0
- package/dist/{chunk-R2O4WC3H.js.map → chunk-2FCVATRT.js.map} +1 -1
- package/dist/{chunk-ERCVR23U.js → chunk-36DLIVZF.js} +2 -2
- package/dist/{chunk-ERCVR23U.js.map → chunk-36DLIVZF.js.map} +1 -1
- package/dist/{chunk-ONB3FWK5.js → chunk-3OBELKJU.js} +2 -2
- package/dist/{chunk-ONB3FWK5.js.map → chunk-3OBELKJU.js.map} +1 -1
- package/dist/chunk-4ZWQ44NZ.js +2 -0
- package/dist/{chunk-2NXQF2F7.js.map → chunk-4ZWQ44NZ.js.map} +1 -1
- package/dist/chunk-5JUG4BEF.js +2 -0
- package/dist/chunk-5JUG4BEF.js.map +1 -0
- package/dist/{chunk-XV7U33XQ.js → chunk-6AJRQSFO.js} +3 -3
- package/dist/{chunk-XV7U33XQ.js.map → chunk-6AJRQSFO.js.map} +1 -1
- package/dist/chunk-7JA6SI5H.js +2 -0
- package/dist/{chunk-5AJXR47U.js.map → chunk-7JA6SI5H.js.map} +1 -1
- package/dist/{chunk-SZEGGBOC.js → chunk-A4DPLZZF.js} +2 -2
- package/dist/{chunk-SZEGGBOC.js.map → chunk-A4DPLZZF.js.map} +1 -1
- package/dist/{chunk-C4XLDODU.js → chunk-C2KPTRYM.js} +3 -1
- package/dist/{chunk-GSGPULRL.js → chunk-CHNQZU2P.js} +2 -2
- package/dist/{chunk-GSGPULRL.js.map → chunk-CHNQZU2P.js.map} +1 -1
- package/dist/chunk-DFBG7PUJ.js +10 -0
- package/dist/{chunk-JAPZBEBZ.js.map → chunk-DFBG7PUJ.js.map} +1 -1
- package/dist/{chunk-V7C4EHK3.js → chunk-DSLPTDZX.js} +2 -2
- package/dist/{chunk-V7C4EHK3.js.map → chunk-DSLPTDZX.js.map} +1 -1
- package/dist/{chunk-EMFHKTAV.js → chunk-EUWIIL3X.js} +2 -2
- package/dist/{chunk-EMFHKTAV.js.map → chunk-EUWIIL3X.js.map} +1 -1
- package/dist/chunk-G5N6HEPW.js +2 -0
- package/dist/chunk-G5N6HEPW.js.map +1 -0
- package/dist/chunk-HR4QZ5TD.js +3 -0
- package/dist/chunk-HR4QZ5TD.js.map +1 -0
- package/dist/chunk-KO2JLLUJ.js +2 -0
- package/dist/chunk-KO2JLLUJ.js.map +1 -0
- package/dist/chunk-MBBE4RND.js +3 -0
- package/dist/chunk-MBBE4RND.js.map +1 -0
- package/dist/{chunk-USNXQOMJ.js → chunk-N33S7BSG.js} +2 -2
- package/dist/{chunk-USNXQOMJ.js.map → chunk-N33S7BSG.js.map} +1 -1
- package/dist/{chunk-KN7OJFEX.js → chunk-N52JTYBJ.js} +2 -2
- package/dist/{chunk-KN7OJFEX.js.map → chunk-N52JTYBJ.js.map} +1 -1
- package/dist/{chunk-KR27GOH6.js → chunk-PC5Z37LT.js} +3 -3
- package/dist/{chunk-KR27GOH6.js.map → chunk-PC5Z37LT.js.map} +1 -1
- package/dist/{chunk-2NQ2RZ2M.js → chunk-PSECMZJC.js} +3 -3
- package/dist/{chunk-2NQ2RZ2M.js.map → chunk-PSECMZJC.js.map} +1 -1
- package/dist/chunk-RBGXXVF4.js +7 -0
- package/dist/{chunk-NNISUDZX.js.map → chunk-RBGXXVF4.js.map} +1 -1
- package/dist/chunk-RULCANNM.js +7 -0
- package/dist/chunk-RULCANNM.js.map +1 -0
- package/dist/chunk-S7Z6KKIN.js +2 -0
- package/dist/chunk-S7Z6KKIN.js.map +1 -0
- package/dist/{chunk-AY2RXJWS.js → chunk-U6NFYYTF.js} +2 -2
- package/dist/{chunk-AY2RXJWS.js.map → chunk-U6NFYYTF.js.map} +1 -1
- package/dist/chunk-VFV44YZB.js +2 -0
- package/dist/{chunk-54AXLGAK.js.map → chunk-VFV44YZB.js.map} +1 -1
- package/dist/chunk-VRDTHLA3.js +3 -0
- package/dist/chunk-VRDTHLA3.js.map +1 -0
- package/dist/chunk-WU2KCXBC.js +2 -0
- package/dist/{chunk-5LGIALCK.js.map → chunk-WU2KCXBC.js.map} +1 -1
- package/dist/chunk-X3SHNHHM.js +2 -0
- package/dist/chunk-X3SHNHHM.js.map +1 -0
- package/dist/chunk-XYFS6X74.js +2 -0
- package/dist/{chunk-JWJJZVP3.js.map → chunk-XYFS6X74.js.map} +1 -1
- package/dist/chunk-YC7PBLTK.js +2 -0
- package/dist/{chunk-MRHZN4G4.js.map → chunk-YC7PBLTK.js.map} +1 -1
- package/dist/electron.js +1 -1
- package/dist/{entry-CA2QAEHN.js → entry-APJ4V7PW.js} +2 -2
- package/dist/{entry-CA2QAEHN.js.map → entry-APJ4V7PW.js.map} +1 -1
- package/dist/index.css +43 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/list-7IHDJM54.js +3 -0
- package/dist/{list-Q2KAEJ26.js.map → list-7IHDJM54.js.map} +1 -1
- package/dist/list-7WFALOUT.js +2 -0
- package/dist/{list-UMMVRYVD.js.map → list-7WFALOUT.js.map} +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/pages-BV3ABSFQ.js +5 -0
- package/dist/{pages-KZ66JVNU.js.map → pages-BV3ABSFQ.js.map} +1 -1
- package/dist/plugin-pages-OWGJPPWV.js +2 -0
- package/dist/{plugin-pages-SR2WSUKZ.js.map → plugin-pages-OWGJPPWV.js.map} +1 -1
- package/dist/project-selector-V5N2724B.js +2 -0
- package/dist/project-selector-V5N2724B.js.map +1 -0
- package/dist/record-links-3P3XSW66.js +2 -0
- package/dist/{record-links-3WZGSVFU.js.map → record-links-3P3XSW66.js.map} +1 -1
- package/dist/root-F2GTYDJM.js +2 -0
- package/dist/{root-6QTQUYK4.js.map → root-F2GTYDJM.js.map} +1 -1
- package/dist/root-GBBZ3DX5.js +31 -0
- package/dist/{root-7BUVDOMV.js.map → root-GBBZ3DX5.js.map} +1 -1
- package/dist/root-J62PBDZ2.js +2 -0
- package/dist/{root-2VBLPRG7.js.map → root-J62PBDZ2.js.map} +1 -1
- package/dist/root-LYRL7VPN.js +14 -0
- package/dist/{root-LFJ5BQSY.js.map → root-LYRL7VPN.js.map} +1 -1
- package/dist/root-NIL2UHKS.js +2 -0
- package/dist/{root-OXS3QQX6.js.map → root-NIL2UHKS.js.map} +1 -1
- package/dist/root-RGZZYETM.js +23 -0
- package/dist/{root-FZLKYL5W.js.map → root-RGZZYETM.js.map} +1 -1
- package/dist/search-IIGNCQEZ.js +2 -0
- package/dist/{search-AZK3Q2KX.js.map → search-IIGNCQEZ.js.map} +1 -1
- package/dist/skills-pages-T52MF4DO.js +2 -0
- package/dist/{skills-pages-7IYBJ4QI.js.map → skills-pages-T52MF4DO.js.map} +1 -1
- package/dist/source-IJAAJDGW.js +2 -0
- package/dist/{source-4BP5PJ2N.js.map → source-IJAAJDGW.js.map} +1 -1
- package/dist/spec-renderer-Z6GVHLFU.js +2 -0
- package/dist/{spec-renderer-3GAVSV52.js.map → spec-renderer-Z6GVHLFU.js.map} +1 -1
- package/dist/tanstack-start.js +1 -1
- package/dist/ui.js +1 -1
- package/dist/user-nav-ZH63YHX7.js +2 -0
- package/dist/{user-nav-OWTTAXZS.js.map → user-nav-ZH63YHX7.js.map} +1 -1
- package/package.json +2 -2
- package/dist/activity-nav-button-E4I4YC3X.js +0 -2
- package/dist/chat-page-7UB3BMBF.js +0 -4
- package/dist/chat-page-7UB3BMBF.js.map +0 -1
- package/dist/chunk-2NXQF2F7.js +0 -2
- package/dist/chunk-32ZU4MLE.js +0 -2
- package/dist/chunk-32ZU4MLE.js.map +0 -1
- package/dist/chunk-54AXLGAK.js +0 -2
- package/dist/chunk-5AJXR47U.js +0 -2
- package/dist/chunk-5LGIALCK.js +0 -2
- package/dist/chunk-6NRQMG26.js +0 -2
- package/dist/chunk-6NRQMG26.js.map +0 -1
- package/dist/chunk-AKQ6ELDX.js +0 -2
- package/dist/chunk-AKQ6ELDX.js.map +0 -1
- package/dist/chunk-DGIY4SKN.js +0 -7
- package/dist/chunk-DGIY4SKN.js.map +0 -1
- package/dist/chunk-HDOIOXMP.js +0 -2
- package/dist/chunk-HDOIOXMP.js.map +0 -1
- package/dist/chunk-HZOD2HOF.js +0 -3
- package/dist/chunk-HZOD2HOF.js.map +0 -1
- package/dist/chunk-JAPZBEBZ.js +0 -10
- package/dist/chunk-JWJJZVP3.js +0 -2
- package/dist/chunk-MRHZN4G4.js +0 -2
- package/dist/chunk-NNISUDZX.js +0 -7
- package/dist/chunk-O2QMYUPS.js +0 -2
- package/dist/chunk-O2QMYUPS.js.map +0 -1
- package/dist/chunk-R2O4WC3H.js +0 -4
- package/dist/chunk-WPCPL2TQ.js +0 -3
- package/dist/chunk-WPCPL2TQ.js.map +0 -1
- package/dist/list-Q2KAEJ26.js +0 -3
- package/dist/list-UMMVRYVD.js +0 -2
- package/dist/pages-KZ66JVNU.js +0 -5
- package/dist/plugin-pages-SR2WSUKZ.js +0 -2
- package/dist/project-selector-72VM6SUI.js +0 -2
- package/dist/project-selector-72VM6SUI.js.map +0 -1
- package/dist/record-links-3WZGSVFU.js +0 -2
- package/dist/root-2VBLPRG7.js +0 -2
- package/dist/root-6QTQUYK4.js +0 -2
- package/dist/root-7BUVDOMV.js +0 -31
- package/dist/root-FZLKYL5W.js +0 -23
- package/dist/root-LFJ5BQSY.js +0 -14
- package/dist/root-OXS3QQX6.js +0 -2
- package/dist/search-AZK3Q2KX.js +0 -2
- package/dist/skills-pages-7IYBJ4QI.js +0 -2
- package/dist/source-4BP5PJ2N.js +0 -2
- package/dist/spec-renderer-3GAVSV52.js +0 -2
- package/dist/user-nav-OWTTAXZS.js +0 -2
package/dist/chunk-HDOIOXMP.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {a}from'./chunk-O2QMYUPS.js';import {Select}from'radix-ui';import {ChevronDownIcon,CheckIcon,ChevronUpIcon}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';function g({...e}){return jsx(Select.Root,{"data-slot":"select",...e})}function S({...e}){return jsx(Select.Group,{"data-slot":"select-group",...e})}function x({...e}){return jsx(Select.Value,{"data-slot":"select-value",...e})}function b({className:e,size:a$1="default",children:i,...n}){return jsxs(Select.Trigger,{"data-slot":"select-trigger","data-size":a$1,className:a("fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-2 fk:rounded-md fk:border fk:border-input fk:bg-background fk:px-3 fk:py-2 fk:text-sm fk:whitespace-nowrap fk:shadow-xs fk:transition-[color,box-shadow] fk:outline-none fk:focus-visible:border-ring fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:disabled:cursor-not-allowed fk:disabled:opacity-50 fk:aria-invalid:border-destructive fk:aria-invalid:ring-destructive/20 fk:data-placeholder:text-muted-foreground fk:data-[size=default]:h-9 fk:data-[size=sm]:h-8 fk:*:data-[slot=select-value]:line-clamp-1 fk:*:data-[slot=select-value]:flex fk:*:data-[slot=select-value]:items-center fk:*:data-[slot=select-value]:gap-2 fk:hover:bg-accent fk:dark:aria-invalid:ring-destructive/40 fk:*[_svg]:pointer-events-none fk:*[_svg]:shrink-0 fk:*[_svg:not([class*='size-'])]:size-4 fk:*[_svg:not([class*='text-'])]:text-muted-foreground fk:corner-squircle",e),...n,children:[i,jsx(Select.Icon,{asChild:true,children:jsx(ChevronDownIcon,{className:"fk:size-4 fk:opacity-50"})})]})}function P({className:e,children:a$1,position:i="item-aligned",align:n="center",...f}){return jsx(Select.Portal,{children:jsxs(Select.Content,{"data-slot":"select-content",className:a("fk:relative fk:z-50 fk:max-h-(--radix-select-content-available-height) fk:min-w-[8rem] fk:origin-(--radix-select-content-transform-origin) fk:overflow-x-hidden fk:overflow-y-auto fk:rounded-md fk:border fk:bg-popover fk:text-popover-foreground fk:shadow-md fk:data-[side=bottom]:slide-in-from-top-2 fk:data-[side=left]:slide-in-from-right-2 fk:data-[side=right]:slide-in-from-left-2 fk:data-[side=top]:slide-in-from-bottom-2 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95 fk:corner-squircle",i==="popper"&&"fk:data-[side=bottom]:translate-y-1 fk:data-[side=left]:-translate-x-1 fk:data-[side=right]:translate-x-1 fk:data-[side=top]:-translate-y-1",e),position:i,align:n,...f,children:[jsx(d,{}),jsx(Select.Viewport,{className:a("fk:p-1",i==="popper"&&"fk:h-(--radix-select-trigger-height) fk:w-full fk:min-w-(--radix-select-trigger-width) fk:scroll-my-1"),children:a$1}),jsx(m,{})]})})}function h({className:e,...a$1}){return jsx(Select.Label,{"data-slot":"select-label",className:a("fk:px-2 fk:py-1.5 fk:text-xs fk:text-muted-foreground",e),...a$1})}function y({className:e,children:a$1,...i}){return jsxs(Select.Item,{"data-slot":"select-item",className:a("fk:relative fk:flex fk:w-full fk:cursor-default fk:items-center fk:gap-2 fk:rounded-sm fk:py-1.5 fk:pr-8 fk:pl-2 fk:text-sm fk:outline-hidden fk:select-none fk:hover:bg-accent fk:hover:text-accent-foreground fk:focus:bg-accent fk:focus:text-accent-foreground fk:data-[disabled]:pointer-events-none fk:data-[disabled]:opacity-50 fk:*[_svg]:pointer-events-none fk:*[_svg]:shrink-0 fk:*[_svg:not([class*='size-'])]:size-4 fk:*[_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 fk:corner-squircle",e),...i,children:[jsx("span",{"data-slot":"select-item-indicator",className:"fk:absolute fk:right-2 fk:flex fk:size-3.5 fk:items-center fk:justify-center",children:jsx(Select.ItemIndicator,{children:jsx(CheckIcon,{className:"fk:size-4"})})}),jsx(Select.ItemText,{children:a$1})]})}function w({className:e,...a$1}){return jsx(Select.Separator,{"data-slot":"select-separator",className:a("fk:pointer-events-none fk:-mx-1 fk:my-1 fk:h-px fk:bg-border",e),...a$1})}function d({className:e,...a$1}){return jsx(Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:a("fk:flex fk:cursor-default fk:items-center fk:justify-center fk:py-1",e),...a$1,children:jsx(ChevronUpIcon,{className:"size-4"})})}function m({className:e,...a$1}){return jsx(Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:a("fk:flex fk:cursor-default fk:items-center fk:justify-center fk:py-1",e),...a$1,children:jsx(ChevronDownIcon,{className:"size-4"})})}export{g as a,S as b,x as c,b as d,P as e,h as f,y as g,w as h,d as i,m as j};//# sourceMappingURL=chunk-HDOIOXMP.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-HDOIOXMP.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/primitives/select.tsx"],"names":["Select","props","jsx","SelectPrimitive","SelectGroup","SelectValue","SelectTrigger","className","size","children","jsxs","cn","ChevronDownIcon","SelectContent","position","align","SelectScrollUpButton","SelectScrollDownButton","SelectLabel","SelectItem","CheckIcon","SelectSeparator","ChevronUpIcon"],"mappings":"kMAOA,SAASA,EAAO,CAAE,GAAGC,CAAM,CAAA,CAAsD,CAC/E,OAAOC,GAAAA,CAACC,OAAgB,IAAA,CAAhB,CAAqB,YAAU,QAAA,CAAU,GAAGF,CAAAA,CAAO,CAC7D,CAEA,SAASG,CAAAA,CAAY,CAAE,GAAGH,CAAM,EAAuD,CACrF,OAAOC,GAAAA,CAACC,MAAAA,CAAgB,MAAhB,CAAsB,WAAA,CAAU,eAAgB,GAAGF,CAAAA,CAAO,CACpE,CAEA,SAASI,CAAAA,CAAY,CAAE,GAAGJ,CAAM,CAAA,CAAuD,CACrF,OAAOC,GAAAA,CAACC,OAAgB,KAA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AC,IAACoB,aAAAA,CAAA,CAAc,UAAU,QAAA,CAAS,CAAA,CACpC,CAEJ,CAEA,SAASL,CAAAA,CAAuB,CAC9B,UAAAV,CAAAA,CACA,GAAGN,GACL,CAAA,CAAkE,CAChE,OACEC,GAAAA,CAACC,OAAgB,gBAAA,CAAhB,CACC,YAAU,2BAAA,CACV,SAAA,CAAWQ,EAAG,qEAAA,CAAuEJ,CAAS,EAC7F,GAAGN,GAAAA,CAEJ,SAAAC,GAAAA,CAACU,eAAAA,CAAA,CAAgB,SAAA,CAAU,QAAA,CAAS,EACtC,CAEJ","file":"chunk-HDOIOXMP.js","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Select as SelectPrimitive } from 'radix-ui';\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';\nimport { cn } from '../lib/utils';\n\nfunction Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />;\n}\n\nfunction SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nfunction SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />;\n}\n\nfunction SelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default';\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n \"fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-2 fk:rounded-md fk:border fk:border-input fk:bg-background fk:px-3 fk:py-2 fk:text-sm fk:whitespace-nowrap fk:shadow-xs fk:transition-[color,box-shadow] fk:outline-none fk:focus-visible:border-ring fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:disabled:cursor-not-allowed fk:disabled:opacity-50 fk:aria-invalid:border-destructive fk:aria-invalid:ring-destructive/20 fk:data-placeholder:text-muted-foreground fk:data-[size=default]:h-9 fk:data-[size=sm]:h-8 fk:*:data-[slot=select-value]:line-clamp-1 fk:*:data-[slot=select-value]:flex fk:*:data-[slot=select-value]:items-center fk:*:data-[slot=select-value]:gap-2 fk:hover:bg-accent fk:dark:aria-invalid:ring-destructive/40 fk:*[_svg]:pointer-events-none fk:*[_svg]:shrink-0 fk:*[_svg:not([class*='size-'])]:size-4 fk:*[_svg:not([class*='text-'])]:text-muted-foreground fk:corner-squircle\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon className=\"fk:size-4 fk:opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n}\n\nfunction SelectContent({\n className,\n children,\n position = 'item-aligned',\n align = 'center',\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className={cn(\n 'fk:relative fk:z-50 fk:max-h-(--radix-select-content-available-height) fk:min-w-[8rem] fk:origin-(--radix-select-content-transform-origin) fk:overflow-x-hidden fk:overflow-y-auto fk:rounded-md fk:border fk:bg-popover fk:text-popover-foreground fk:shadow-md fk:data-[side=bottom]:slide-in-from-top-2 fk:data-[side=left]:slide-in-from-right-2 fk:data-[side=right]:slide-in-from-left-2 fk:data-[side=top]:slide-in-from-bottom-2 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95 fk:corner-squircle',\n position === 'popper' &&\n 'fk:data-[side=bottom]:translate-y-1 fk:data-[side=left]:-translate-x-1 fk:data-[side=right]:translate-x-1 fk:data-[side=top]:-translate-y-1',\n className\n )}\n position={position}\n align={align}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'fk:p-1',\n position === 'popper' &&\n 'fk:h-(--radix-select-trigger-height) fk:w-full fk:min-w-(--radix-select-trigger-width) fk:scroll-my-1'\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return (\n <SelectPrimitive.Label\n data-slot=\"select-label\"\n className={cn('fk:px-2 fk:py-1.5 fk:text-xs fk:text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"fk:relative fk:flex fk:w-full fk:cursor-default fk:items-center fk:gap-2 fk:rounded-sm fk:py-1.5 fk:pr-8 fk:pl-2 fk:text-sm fk:outline-hidden fk:select-none fk:hover:bg-accent fk:hover:text-accent-foreground fk:focus:bg-accent fk:focus:text-accent-foreground fk:data-[disabled]:pointer-events-none fk:data-[disabled]:opacity-50 fk:*[_svg]:pointer-events-none fk:*[_svg]:shrink-0 fk:*[_svg:not([class*='size-'])]:size-4 fk:*[_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 fk:corner-squircle\",\n className\n )}\n {...props}\n >\n <span\n data-slot=\"select-item-indicator\"\n className=\"fk:absolute fk:right-2 fk:flex fk:size-3.5 fk:items-center fk:justify-center\"\n >\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"fk:size-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn('fk:pointer-events-none fk:-mx-1 fk:my-1 fk:h-px fk:bg-border', className)}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn('fk:flex fk:cursor-default fk:items-center fk:justify-center fk:py-1', className)}\n {...props}\n >\n <ChevronUpIcon className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn('fk:flex fk:cursor-default fk:items-center fk:justify-center fk:py-1', className)}\n {...props}\n >\n <ChevronDownIcon className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n"]}
|
package/dist/chunk-HZOD2HOF.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {g as g$1,d}from'./chunk-WPCPL2TQ.js';import {b as b$1}from'./chunk-U45E5X3H.js';import v,{mutate}from'swr';import {createContext,lazy,Suspense,useMemo,useContext}from'react';import {Navigate,useParams}from'react-router-dom';import {Bot,Layout,FileStack,BookOpenText,Waypoints,SquarePlay}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';var f={name:"_asset",plural:"_assets",display:"originalFilename",menu:{hidden:true},attributes:[{name:"path",label:"Asset",scope:"global",options:{size:140},dataType:"string",inputType:"text",previewType:"assetPreviewField",defaultValue:""},{name:"originalFilename",label:"Filename",scope:"global",options:{size:320},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"size",label:"Size",scope:"global",options:{size:120},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"width",label:"Width",scope:"global",options:{size:90},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"height",label:"Height",scope:"global",options:{size:100},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"mimeType",label:"Mime Type",scope:"global",options:{size:160},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"lqip",label:"lqip",scope:"global",hidden:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"url",label:"URL",scope:"global",hidden:true,readOnly:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"tags",label:"Tags",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",previewType:"tags",options:{size:300},relationship:{mode:"multiple",field:"name",entity:"_tag"}}]};var g={name:"_tag",plural:"_tags",display:"name",menu:{hidden:true},attributes:[{name:"name",label:"Tag Name",scope:"global",options:{size:220},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"assets",label:"Assets",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",relationship:{mode:"multiple",field:"originalFilename",entity:"_asset"}}]};async function w(e){try{let t=await fetch(d(e).schema,{credentials:"include",mode:"cors",cache:"no-cache"});if(!t.ok){let a=t.statusText||`Request failed with status ${String(t.status)}`;try{let i=await t.json();a=i.error??i.message??a;}catch{}return {ok:!1,projectId:e,error:{status:t.status,message:a}}}let n=await t.json();return {ok:!0,project:{...n,projectId:n.projectId||e}}}catch(t){return {ok:false,projectId:e,error:{status:0,message:t instanceof Error?t.message:"Network error"}}}}function C(e,t){let n=[],a={};for(let i of e??[])i.ok?n.push(i.project):a[i.projectId]=i.error;return {projects:n,errors:a,isLoading:t}}var b={revalidateOnFocus:true,focusThrottleInterval:15e3,revalidateOnReconnect:false};function L(e,t){return !t.ok&&e?.ok?e:t}function A(e,t){let n=t&&e.length>0?["project-schemas",t,...e]:null,{data:a,isLoading:i}=v(n,async()=>(await Promise.all(e.map(l=>w(l)))).map((l,u)=>L(a?.[u],l)),b);return C(a,!!n&&(i||a===void 0))}function U(e,t){return C(e?[e]:void 0,t)}function E(e,t){let n=t&&e?["project-schema",t,e]:null,{data:a,isLoading:i}=v(n,async()=>L(a,await w(e??"")),b);return U(a,!!n&&(i||a===void 0))}function N(e,t){return Array.isArray(e)&&(e[0]==="project-schema"||e[0]==="project-schemas")&&e.slice(2).includes(t)}function Ie(e){return mutate(t=>N(t,e))}function I(){let{resolvedTheme:e}=b$1();return jsx("div",{className:"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background",children:jsxs("div",{className:"fk:flex fk:flex-col fk:items-center",children:[e==="dark"?jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"#020817"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"white"})]}):jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"white"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"#020817"})]}),jsx("div",{className:"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse",children:"Loading..."})]})})}var G=Navigate;function o(e){let t=lazy(e);return jsx(Suspense,{fallback:jsx(I,{}),children:jsx(t,{})})}var $=o(()=>import('./root-6QTQUYK4.js').then(e=>({default:e.Root}))),Q=o(()=>import('./list-UMMVRYVD.js').then(e=>({default:e.List}))),Y=o(()=>import('./edit-entity-PVT34FD7.js').then(e=>({default:e.EditEntity}))),ee=o(()=>import('./root-FZLKYL5W.js').then(e=>({default:e.Root}))),te=o(()=>import('./root-2VBLPRG7.js').then(e=>({default:e.Root}))),oe=o(()=>import('./list-Q2KAEJ26.js').then(e=>({default:e.List}))),ne=o(()=>import('./source-4BP5PJ2N.js').then(e=>({default:e.Source}))),ae=o(()=>import('./root-LFJ5BQSY.js').then(e=>({default:e.Root}))),ie=o(()=>import('./root-7BUVDOMV.js').then(e=>({default:e.Root}))),re=o(()=>import('./root-OXS3QQX6.js').then(e=>({default:e.Root}))),se=o(()=>import('./plugin-pages-SR2WSUKZ.js').then(e=>({default:e.PluginsPage}))),pe=o(()=>import('./plugin-pages-SR2WSUKZ.js').then(e=>({default:e.InstalledPluginsPage}))),ce=o(()=>import('./plugin-pages-SR2WSUKZ.js').then(e=>({default:e.PluginDetailPage}))),R=o(()=>import('./chat-page-7UB3BMBF.js').then(e=>({default:e.AgentChatPage}))),le=o(()=>import('./pages-KZ66JVNU.js').then(e=>({default:e.AutomationsPage}))),me=o(()=>import('./pages-KZ66JVNU.js').then(e=>({default:e.RunHistoryPage}))),ue=o(()=>import('./pages-KZ66JVNU.js').then(e=>({default:e.ApprovalsPage}))),de=o(()=>import('./pages-KZ66JVNU.js').then(e=>({default:e.ActivityPage}))),he=o(()=>import('./pages-KZ66JVNU.js').then(e=>({default:e.ActivityItemPage}))),fe=o(()=>import('./pages-KZ66JVNU.js').then(e=>({default:e.CreateAutomationPage}))),ge=o(()=>import('./pages-KZ66JVNU.js').then(e=>({default:e.AutomationDetailPage}))),ye=o(()=>import('./pages-KZ66JVNU.js').then(e=>({default:e.RunsPage}))),Pe=o(()=>import('./pages-KZ66JVNU.js').then(e=>({default:e.RunDetailPage}))),Se=o(()=>import('./skills-pages-7IYBJ4QI.js').then(e=>({default:e.SkillsPage}))),ke=o(()=>import('./skills-pages-7IYBJ4QI.js').then(e=>({default:e.CreateSkillPage}))),je=o(()=>import('./skills-pages-7IYBJ4QI.js').then(e=>({default:e.SkillDetailPage}))),m=[{name:"ai",icon:jsx(Bot,{strokeWidth:1.5}),title:"AI",component:re,routes:[{path:"plugins",component:se},{path:"plugins/installed",component:pe},{path:"plugins/:pluginId",component:ce},{component:jsx(G,{replace:true,to:"agent"}),path:""},{component:R,path:"agent"},{component:R,path:"agent/chats/:chatId"},{component:le,path:"automations"},{component:me,path:"runs"},{component:ue,path:"approvals"},{component:de,path:"activity"},{component:he,path:"activity/:itemId"},{component:fe,path:"automations/new"},{component:ge,path:"automations/:automationId"},{component:ye,path:"automations/:automationId/runs"},{component:Pe,path:"automations/:automationId/runs/:runId"},{component:Se,path:"skills"},{component:ke,path:"skills/new"},{component:je,path:"skills/:skillId"}]},{name:"desk",icon:jsx(Layout,{strokeWidth:1.5}),title:"Desk",component:$,routes:[{path:"list/:entity",component:Q,children:[{path:"edit/:id",component:Y}]}]},{name:"asset-manager",icon:jsx(FileStack,{strokeWidth:1.5}),title:"Asset Manager",component:ee,routes:[]},{name:"knowledge",icon:jsx(BookOpenText,{strokeWidth:1.5}),title:"Knowledge",component:te,routes:[{component:oe,path:""},{component:ne,path:":sourceId"}]},{name:"graph",icon:jsx(Waypoints,{strokeWidth:1.5}),title:"Graph",component:ae,routes:[]},{name:"explorer",icon:jsx(SquarePlay,{strokeWidth:1.5}),title:"Explorer",component:ie,routes:[]}];var V=createContext({mode:"projects",apps:m,contributions:{apps:m},currentProjectId:void 0,currentProject:void 0,currentProjectSchema:[],projects:[],projectIds:[],projectSummaries:[],schemaErrors:{},isLoadingSchemas:false});function we(e){return [...e.filter(n=>n.name!==f.name&&n.name!==g.name),f,g]}function Ke({projectIds:e,projectSummaries:t=[],mode:n="projects",userId:a,children:i}){let{projectId:p}=useParams(),[,l]=g$1(),u=l.user?.id??a,F=A(n==="projects"?e:[],u),H=E(n==="hosted"&&p&&e.includes(p)?p:void 0,u),{projects:P,errors:S,isLoading:k}=n==="hosted"?H:F,d=useMemo(()=>e.map(s=>P.find(h=>h.projectId===s)).filter(s=>s!==void 0).map(s=>({...s,schema:we(s.schema)})),[P,e]),M=useMemo(()=>{let s=d.find(h=>h.projectId===p);return {mode:n,apps:m,contributions:{apps:m},currentProjectId:p,currentProject:s,currentProjectSchema:s?.schema??[],projects:d,projectIds:e,projectSummaries:t,schemaErrors:S,isLoadingSchemas:k}},[p,S,k,n,e,t,d]);return jsx(V.Provider,{value:M,children:i})}function Ge(){return useContext(V)}
|
|
2
|
-
export{I as a,f as b,g as c,Ie as d,Ke as e,Ge as f};//# sourceMappingURL=chunk-HZOD2HOF.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-HZOD2HOF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entities/assets-schema.ts","../src/entities/tags-schema.ts","../src/core/config/use-project-schemas.ts","../src/ui/components/loading.tsx","../src/core/apps/built-in-apps.tsx","../src/core/config/config-context.tsx"],"names":["assetSchema","tagSchema","fetchProjectSchema","projectId","response","apiPaths","message","body","project","error","toProjectSchemasState","outcomes","isLoading","projects","errors","outcome","SCHEMA_SWR_OPTIONS","keepLoadedSchema","previous","next","useProjectSchemas","projectIds","userId","key","data","useSWR","index","toProjectSchemaState","useProjectSchema","isProjectSchemaKey","revalidateProjectSchema","mutate","Loading","resolvedTheme","useTheme","jsx","jsxs","NavigateCompat","Navigate","lazyElement","loader","Component","lazy","Suspense","deskRoot","m","deskList","deskEditEntity","assetManagerRoot","knowledgeRoot","knowledgeList","knowledgeSource","graphRoot","explorerRoot","aiRoot","aiPluginsPage","aiInstalledPluginsPage","aiPluginDetailPage","aiAgentChatPage","aiAutomationsPage","aiRunHistoryPage","aiApprovalsPage","aiActivityPage","aiActivityItemPage","aiCreateAutomationPage","aiAutomationDetailPage","aiRunsPage","aiRunDetailPage","aiSkillsPage","aiCreateSkillPage","aiSkillDetailPage","builtInApps","BotIcon","LayoutIcon","FileStackIcon","BookOpenTextIcon","WaypointsIcon","SquarePlayIcon","ConfigContext","createContext","upsertReservedEntities","schema","entity","ConfigProvider","projectSummaries","mode","children","currentProjectId","useParams","auth","useAuth","schemaUserId","allSchemas","currentSchema","loadedProjects","useMemo","value","currentProject","useConfig","useContext"],"mappings":"uXAEO,IAAMA,CAAAA,CAAsB,CACjC,IAAA,CAAM,QAAA,CACN,OAAQ,SAAA,CACR,OAAA,CAAS,kBAAA,CACT,IAAA,CAAM,CACJ,MAAA,CAAQ,IACV,CAAA,CACA,UAAA,CAAY,CACV,CACE,IAAA,CAAM,OACN,KAAA,CAAO,OAAA,CACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,KAAM,GACR,CAAA,CACA,SAAU,QAAA,CACV,SAAA,CAAW,OACX,WAAA,CAAa,mBAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,kBAAA,CACN,KAAA,CAAO,UAAA,CACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,QAAA,CACV,SAAA,CAAW,OACX,WAAA,CAAa,MAAA,CACb,aAAc,EAChB,CAAA,CACA,CACE,IAAA,CAAM,MAAA,CACN,KAAA,CAAO,MAAA,CACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,MACV,SAAA,CAAW,MAAA,CACX,WAAA,CAAa,MAAA,CACb,YAAA,CAAc,EAChB,EACA,CACE,IAAA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CAAML,CAAAA,EAAYA,CAAAA,CAAQ,SAAA,GAAc+E,CAAgB,CAAA,CAExF,OAAO,CACL,IAAA,CAAAF,CAAAA,CACA,IAAA,CAAMd,CAAAA,CACN,aAAA,CAAe,CAAE,IAAA,CAAMA,CAAY,EACnC,gBAAA,CAAAgB,CAAAA,CACA,eAAAU,CAAAA,CACA,oBAAA,CAAsBA,CAAAA,EAAgB,MAAA,EAAU,EAAC,CACjD,SAAApF,CAAAA,CACA,UAAA,CAAAQ,CAAAA,CACA,gBAAA,CAAA+D,CAAAA,CACA,YAAA,CAActE,EACd,gBAAA,CAAkBF,CACpB,CACF,CAAA,CAAG,CAAC2E,CAAAA,CAAkBzE,EAAQF,CAAAA,CAAWyE,CAAAA,CAAMhE,EAAY+D,CAAAA,CAAkBvE,CAAQ,CAAC,CAAA,CAEtF,OAAOsB,GAAAA,CAAC2C,CAAAA,CAAc,QAAA,CAAd,CAAuB,MAAOkB,CAAAA,CAAQ,QAAA,CAAAV,CAAAA,CAAS,CACzD,CAEO,SAASY,IAA2B,CACzC,OAAOC,UAAAA,CAAWrB,CAAa,CACjC","file":"chunk-HZOD2HOF.js","sourcesContent":["import type { Entity } from '../core/types';\n\nexport const assetSchema: Entity = {\n name: '_asset',\n plural: '_assets',\n display: 'originalFilename',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'path',\n label: 'Asset',\n scope: 'global',\n options: {\n size: 140,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'assetPreviewField',\n defaultValue: '',\n },\n {\n name: 'originalFilename',\n label: 'Filename',\n scope: 'global',\n options: {\n size: 320,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'size',\n label: 'Size',\n scope: 'global',\n options: {\n size: 120,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'width',\n label: 'Width',\n scope: 'global',\n options: {\n size: 90,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'height',\n label: 'Height',\n scope: 'global',\n options: {\n size: 100,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'mimeType',\n label: 'Mime Type',\n scope: 'global',\n options: {\n size: 160,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'lqip',\n label: 'lqip',\n scope: 'global',\n hidden: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'url',\n label: 'URL',\n scope: 'global',\n hidden: true,\n readOnly: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'tags',\n label: 'Tags',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n previewType: 'tags',\n options: {\n size: 300,\n },\n relationship: {\n mode: 'multiple',\n field: 'name',\n entity: '_tag',\n },\n },\n ],\n};\n","import type { Entity } from '../core/types';\n\nexport const tagSchema: Entity = {\n name: '_tag',\n plural: '_tags',\n display: 'name',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'name',\n label: 'Tag Name',\n scope: 'global',\n options: {\n size: 220,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'assets',\n label: 'Assets',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n relationship: {\n mode: 'multiple',\n field: 'originalFilename',\n entity: '_asset',\n },\n },\n ],\n};\n","'use client';\n\nimport useSWR, { mutate } from 'swr';\nimport { apiPaths } from '../api-paths';\nimport type { ProjectSchemaError, ProjectUiConfig } from './types';\n\nexport type ProjectSchemasState = {\n projects: ProjectUiConfig[];\n errors: { [projectId: string]: ProjectSchemaError };\n isLoading: boolean;\n};\n\nexport type FetchOutcome =\n | { ok: true; project: ProjectUiConfig }\n | { ok: false; projectId: string; error: ProjectSchemaError };\n\nasync function fetchProjectSchema(projectId: string): Promise<FetchOutcome> {\n try {\n const response = await fetch(apiPaths(projectId).schema, {\n credentials: 'include',\n mode: 'cors',\n // Revalidate with the server on every fetch (304 when unchanged), so a\n // refetch after a deploy never reads a stale HTTP-cached schema.\n cache: 'no-cache',\n });\n\n if (!response.ok) {\n let message = response.statusText || `Request failed with status ${String(response.status)}`;\n\n try {\n const body = (await response.json()) as { error?: string; message?: string };\n message = body.error ?? body.message ?? message;\n } catch {\n // keep the status text\n }\n\n return { ok: false, projectId, error: { status: response.status, message } };\n }\n\n const project = (await response.json()) as ProjectUiConfig;\n\n return { ok: true, project: { ...project, projectId: project.projectId || projectId } };\n } catch (error) {\n return {\n ok: false,\n projectId,\n error: { status: 0, message: error instanceof Error ? error.message : 'Network error' },\n };\n }\n}\n\nexport function toProjectSchemasState(outcomes: FetchOutcome[] | undefined, isLoading: boolean): ProjectSchemasState {\n const projects: ProjectUiConfig[] = [];\n const errors: { [projectId: string]: ProjectSchemaError } = {};\n\n for (const outcome of outcomes ?? []) {\n if (outcome.ok) {\n projects.push(outcome.project);\n } else {\n errors[outcome.projectId] = outcome.error;\n }\n }\n\n return { projects, errors, isLoading };\n}\n\n/**\n * Schemas change on deploy, which can happen outside this tab (the agent, the\n * CLI). Refetch when the user comes back to the tab, at most every 15s;\n * SWR compares the result, so an unchanged schema does not re-render.\n */\nconst SCHEMA_SWR_OPTIONS = {\n revalidateOnFocus: true,\n focusThrottleInterval: 15_000,\n revalidateOnReconnect: false,\n} as const;\n\n/**\n * A refetch (tab focus, reload button, watched deploy) must never replace a\n * schema that already loaded with an error: that would swap the whole app for\n * an error screen and drop an open edit drawer. Offline, an expired session or\n * revoked access still surface through the GraphQL requests themselves.\n */\nexport function keepLoadedSchema(previous: FetchOutcome | undefined, next: FetchOutcome): FetchOutcome {\n return !next.ok && previous?.ok ? previous : next;\n}\n\n/**\n * Loads the deployed schema of every project the Studio can open. Fetching\n * starts once the user is known (the endpoint needs a session). The result is\n * refetched on tab focus, on the list's reload button and after a deploy the\n * Studio watched.\n */\nexport function useProjectSchemas(projectIds: string[], userId: string | undefined): ProjectSchemasState {\n const key = userId && projectIds.length > 0 ? ['project-schemas', userId, ...projectIds] : null;\n const { data, isLoading } = useSWR(\n key,\n async (): Promise<FetchOutcome[]> => {\n const outcomes = await Promise.all(projectIds.map((projectId) => fetchProjectSchema(projectId)));\n\n // The key fixes the order of projectIds, so outcomes line up with the previous data.\n return outcomes.map((outcome, index) => keepLoadedSchema(data?.[index], outcome));\n },\n SCHEMA_SWR_OPTIONS\n );\n\n return toProjectSchemasState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** State of a single project's schema, in the same shape as the multi-project hook. */\nexport function toProjectSchemaState(outcome: FetchOutcome | undefined, isLoading: boolean): ProjectSchemasState {\n return toProjectSchemasState(outcome ? [outcome] : undefined, isLoading);\n}\n\n/**\n * Hosted mode: loads only the project currently open. Each project has its own\n * SWR key, so switching back to a project reuses the schema already fetched.\n */\nexport function useProjectSchema(projectId: string | undefined, userId: string | undefined): ProjectSchemasState {\n const key = userId && projectId ? ['project-schema', userId, projectId] : null;\n const { data, isLoading } = useSWR(\n key,\n async (): Promise<FetchOutcome> => keepLoadedSchema(data, await fetchProjectSchema(projectId ?? '')),\n SCHEMA_SWR_OPTIONS\n );\n\n return toProjectSchemaState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** True for the SWR keys that hold `projectId`'s schema (single- and multi-project hooks). */\nexport function isProjectSchemaKey(key: unknown, projectId: string): boolean {\n return (\n Array.isArray(key) &&\n (key[0] === 'project-schema' || key[0] === 'project-schemas') &&\n key.slice(2).includes(projectId)\n );\n}\n\n/** Refetches the deployed schema of `projectId`, e.g. after the agent deployed a schema change. */\nexport function revalidateProjectSchema(projectId: string): Promise<unknown> {\n return mutate((key) => isProjectSchemaKey(key, projectId));\n}\n","import type { JSX } from 'react';\nimport { useTheme } from '../theme-context';\n\nexport function Loading(): JSX.Element {\n const { resolvedTheme } = useTheme();\n\n return (\n <div className=\"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background\">\n <div className=\"fk:flex fk:flex-col fk:items-center\">\n {resolvedTheme === 'dark' ? (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"#020817\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"white\"\n />\n </svg>\n ) : (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"white\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"#020817\"\n />\n </svg>\n )}\n <div className=\"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse\">Loading...</div>\n </div>\n </div>\n );\n}\n","import { lazy, Suspense } from 'react';\nimport type { ComponentType, JSX } from 'react';\nimport {\n BookOpenText as BookOpenTextIcon,\n Bot as BotIcon,\n FileStack as FileStackIcon,\n Layout as LayoutIcon,\n SquarePlay as SquarePlayIcon,\n Waypoints as WaypointsIcon,\n} from 'lucide-react';\nimport { Navigate } from 'react-router-dom';\nimport { Loading } from '../../ui/components/loading';\nimport type { AppOptions } from '../config/types';\n\nconst NavigateCompat = Navigate as unknown as ComponentType<{\n replace?: boolean;\n to: string;\n}>;\n\n/**\n * Wraps a lazily imported component in Suspense so each built-in app (and each of its routes)\n * is only downloaded when it is first rendered.\n */\nfunction lazyElement(loader: () => Promise<{ default: ComponentType }>): JSX.Element {\n const Component = lazy(loader);\n\n return (\n <Suspense fallback={<Loading />}>\n <Component />\n </Suspense>\n );\n}\n\n// Desk\nconst deskRoot = lazyElement(() => import('../../apps/desk/root').then((m) => ({ default: m.Root })));\nconst deskList = lazyElement(() => import('../../apps/desk/list').then((m) => ({ default: m.List })));\nconst deskEditEntity = lazyElement(() =>\n import('../../apps/desk/edit-entity').then((m) => ({ default: m.EditEntity }))\n);\n\n// Asset Manager\nconst assetManagerRoot = lazyElement(() => import('../../apps/asset-manager/root').then((m) => ({ default: m.Root })));\n\n// Knowledge\nconst knowledgeRoot = lazyElement(() => import('../../apps/knowledge/root').then((m) => ({ default: m.Root })));\nconst knowledgeList = lazyElement(() => import('../../apps/knowledge/list').then((m) => ({ default: m.List })));\nconst knowledgeSource = lazyElement(() => import('../../apps/knowledge/source').then((m) => ({ default: m.Source })));\n\n// Graph\nconst graphRoot = lazyElement(() => import('../../apps/graph/root').then((m) => ({ default: m.Root })));\n\n// Explorer\nconst explorerRoot = lazyElement(() => import('../../apps/explorer/root').then((m) => ({ default: m.Root })));\n\n// AI\nconst aiRoot = lazyElement(() => import('../../apps/ai/root').then((m) => ({ default: m.Root })));\nconst aiPluginsPage = lazyElement(() => import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginsPage })));\nconst aiInstalledPluginsPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.InstalledPluginsPage }))\n);\nconst aiPluginDetailPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginDetailPage }))\n);\nconst aiAgentChatPage = lazyElement(() =>\n import('../../apps/ai/agent/chat-page').then((m) => ({ default: m.AgentChatPage }))\n);\nconst aiAutomationsPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationsPage }))\n);\nconst aiRunHistoryPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunHistoryPage })));\nconst aiApprovalsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ApprovalsPage })));\nconst aiActivityPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ActivityPage })));\nconst aiActivityItemPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.ActivityItemPage }))\n);\nconst aiCreateAutomationPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.CreateAutomationPage }))\n);\nconst aiAutomationDetailPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationDetailPage }))\n);\nconst aiRunsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunsPage })));\nconst aiRunDetailPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunDetailPage })));\nconst aiSkillsPage = lazyElement(() => import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillsPage })));\nconst aiCreateSkillPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.CreateSkillPage }))\n);\nconst aiSkillDetailPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillDetailPage }))\n);\n\nexport const builtInApps: AppOptions[] = [\n {\n name: 'ai',\n icon: <BotIcon strokeWidth={1.5} />,\n title: 'AI',\n component: aiRoot,\n routes: [\n { path: 'plugins', component: aiPluginsPage },\n { path: 'plugins/installed', component: aiInstalledPluginsPage },\n { path: 'plugins/:pluginId', component: aiPluginDetailPage },\n {\n component: <NavigateCompat replace to=\"agent\" />,\n path: '',\n },\n {\n component: aiAgentChatPage,\n path: 'agent',\n },\n {\n component: aiAgentChatPage,\n path: 'agent/chats/:chatId',\n },\n {\n component: aiAutomationsPage,\n path: 'automations',\n },\n {\n component: aiRunHistoryPage,\n path: 'runs',\n },\n {\n component: aiApprovalsPage,\n path: 'approvals',\n },\n {\n component: aiActivityPage,\n path: 'activity',\n },\n {\n component: aiActivityItemPage,\n path: 'activity/:itemId',\n },\n {\n component: aiCreateAutomationPage,\n path: 'automations/new',\n },\n {\n component: aiAutomationDetailPage,\n path: 'automations/:automationId',\n },\n {\n component: aiRunsPage,\n path: 'automations/:automationId/runs',\n },\n {\n component: aiRunDetailPage,\n path: 'automations/:automationId/runs/:runId',\n },\n {\n component: aiSkillsPage,\n path: 'skills',\n },\n {\n component: aiCreateSkillPage,\n path: 'skills/new',\n },\n {\n component: aiSkillDetailPage,\n path: 'skills/:skillId',\n },\n ],\n },\n {\n name: 'desk',\n icon: <LayoutIcon strokeWidth={1.5} />,\n title: 'Desk',\n component: deskRoot,\n routes: [\n {\n path: 'list/:entity',\n component: deskList,\n children: [\n {\n path: 'edit/:id',\n component: deskEditEntity, // Not used, left here as an example of how to nest routes in apps\n },\n ],\n },\n ],\n },\n {\n name: 'asset-manager',\n icon: <FileStackIcon strokeWidth={1.5} />,\n title: 'Asset Manager',\n component: assetManagerRoot,\n routes: [],\n },\n {\n name: 'knowledge',\n icon: <BookOpenTextIcon strokeWidth={1.5} />,\n title: 'Knowledge',\n component: knowledgeRoot,\n routes: [\n {\n component: knowledgeList,\n path: '',\n },\n {\n component: knowledgeSource,\n path: ':sourceId',\n },\n ],\n },\n {\n name: 'graph',\n icon: <WaypointsIcon strokeWidth={1.5} />,\n title: 'Graph',\n component: graphRoot,\n routes: [],\n },\n {\n name: 'explorer',\n icon: <SquarePlayIcon strokeWidth={1.5} />,\n title: 'Explorer',\n component: explorerRoot,\n routes: [],\n },\n];\n","'use client';\n\nimport { createContext, useContext, useMemo } from 'react';\nimport type { JSX } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useAuth } from '../../auth/auth-context';\nimport { assetSchema } from '../../entities/assets-schema';\nimport { tagSchema } from '../../entities/tags-schema';\nimport { builtInApps } from '../apps/built-in-apps';\nimport type { AppOptions, ProjectSchemaError, ProjectSummary, ProjectUiConfig, StudioMode } from './types';\nimport type { Entity } from '../types';\nimport { useProjectSchema, useProjectSchemas } from './use-project-schemas';\n\nexport interface ConfigContext {\n /** `projects` when the host passed `projectIds`, `hosted` when the Studio listed the user's projects itself. */\n mode: StudioMode;\n /** The Studio apps shown in the app bar, in order. */\n apps: AppOptions[];\n /** Kept for callers that read `contributions.apps`; same list as `apps`. */\n contributions: {\n apps: AppOptions[];\n };\n currentProjectId?: string;\n /** The project named by the `:projectId` route param, once its schema has loaded. */\n currentProject?: ProjectUiConfig;\n currentProjectSchema: Entity[];\n /** Projects whose schema loaded, in `projectIds` order. */\n projects: ProjectUiConfig[];\n /** Every project id the Studio can open, loaded or not. */\n projectIds: string[];\n /** Hosted mode: name, avatar, role and team of each project, known before any schema loads. */\n projectSummaries: ProjectSummary[];\n /** Per project id: why its schema could not be loaded. */\n schemaErrors: { [projectId: string]: ProjectSchemaError };\n isLoadingSchemas: boolean;\n}\n\nconst ConfigContext = createContext<ConfigContext>({\n mode: 'projects',\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId: undefined,\n currentProject: undefined,\n currentProjectSchema: [],\n projects: [],\n projectIds: [],\n projectSummaries: [],\n schemaErrors: {},\n isLoadingSchemas: false,\n});\n\n/** Appends the reserved asset and tag entities to a deployed schema. */\nexport function upsertReservedEntities(schema: Entity[]): Entity[] {\n const withoutReserved = schema.filter((entity) => entity.name !== assetSchema.name && entity.name !== tagSchema.name);\n\n return [...withoutReserved, assetSchema, tagSchema];\n}\n\nexport function ConfigProvider({\n projectIds,\n projectSummaries = [],\n mode = 'projects',\n userId,\n children,\n}: {\n projectIds: string[];\n projectSummaries?: ProjectSummary[];\n mode?: StudioMode;\n /** Hosted mode: the signed-in user's id, known before the per-project `/users/me` call. */\n userId?: string;\n children: React.ReactNode;\n}): JSX.Element {\n /**\n * Getting the projectId from the URL via react-router-dom's useParams hook triggers a rerender of this Context\n * every time the URL changes.\n */\n const { projectId: currentProjectId } = useParams<{ projectId: string }>();\n const [, auth] = useAuth();\n const schemaUserId = auth.user?.id ?? userId;\n // Project mode loads every project up front (short, host-defined list); hosted mode only the one open.\n const allSchemas = useProjectSchemas(mode === 'projects' ? projectIds : [], schemaUserId);\n const currentSchema = useProjectSchema(\n mode === 'hosted' && currentProjectId && projectIds.includes(currentProjectId) ? currentProjectId : undefined,\n schemaUserId\n );\n const { projects: loadedProjects, errors, isLoading } = mode === 'hosted' ? currentSchema : allSchemas;\n const projects = useMemo(\n () =>\n projectIds\n .map((projectId) => loadedProjects.find((project) => project.projectId === projectId))\n .filter((project): project is ProjectUiConfig => project !== undefined)\n .map((project) => ({ ...project, schema: upsertReservedEntities(project.schema) })),\n [loadedProjects, projectIds]\n );\n\n const value = useMemo<ConfigContext>(() => {\n const currentProject = projects.find((project) => project.projectId === currentProjectId);\n\n return {\n mode,\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId,\n currentProject,\n currentProjectSchema: currentProject?.schema ?? [],\n projects,\n projectIds,\n projectSummaries,\n schemaErrors: errors,\n isLoadingSchemas: isLoading,\n };\n }, [currentProjectId, errors, isLoading, mode, projectIds, projectSummaries, projects]);\n\n return <ConfigContext.Provider value={value}>{children}</ConfigContext.Provider>;\n}\n\nexport function useConfig(): ConfigContext {\n return useContext(ConfigContext);\n}\n"]}
|
package/dist/chunk-JAPZBEBZ.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {a}from'./chunk-QSTWBKPN.js';import {d as d$3}from'./chunk-5LGIALCK.js';import {g,f as f$1,d}from'./chunk-U6VZY3V2.js';import {d as d$1,i as i$1,f as f$3,h as h$1}from'./chunk-GSGPULRL.js';import {b as b$5}from'./chunk-V7C4EHK3.js';import {o,e as e$1}from'./chunk-7KLXWCDS.js';import {f,d as d$2}from'./chunk-HZOD2HOF.js';import {b as b$4}from'./chunk-5CVDMZUI.js';import {pa as pa$1,Pb,Sb,qb,Gc,Hc,Ic,qa as qa$1,o as o$1,la as la$1,va as va$1,s,$,aa as aa$1,da as da$1,ea as ea$1,ba as ba$1,fa as fa$1}from'./chunk-DGIY4SKN.js';import {t}from'./chunk-SZEGGBOC.js';import {b as b$1,c as c$1,h,i,k,l,j,f as f$2}from'./chunk-32ZU4MLE.js';import {b as b$2,c,e}from'./chunk-USNXQOMJ.js';import {b as b$3}from'./chunk-6NRQMG26.js';import {lazy,createContext,useCallback,useState,useRef,useEffect,useMemo,useContext,useTransition,useId,Suspense,useSyncExternalStore}from'react';import qa,{useSWRConfig}from'swr';import {formatDistance,format}from'date-fns';import {RadarIcon,BotIcon,XIcon,PlugIcon,XCircleIcon,LoaderCircle,CheckIcon,CloudUploadIcon,FileTextIcon,DownloadIcon,LinkIcon,MessageSquareIcon,SendIcon,LibraryIcon,ChevronDownIcon,BookOpenIcon,CheckCircle2Icon,CircleSlashIcon,ShieldIcon,DatabaseZapIcon,MessageCircleQuestionIcon,ShieldCheckIcon,TriangleAlertIcon,PlayIcon,ArrowRightIcon,FileIcon,BookOpenTextIcon,CornerDownRightIcon,CircleAlertIcon,MoveRightIcon}from'lucide-react';import {Link,useNavigate}from'react-router-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {pipeJsonRender}from'@json-render/core';import {readUIMessageStream,parseJsonEventStream,uiMessageChunkSchema}from'ai';function St(){let{currentProjectId:e}=f(),{mutate:t}=useSWRConfig();return useCallback(n=>{if(!e)return;let a=g(e).approvalsCount;n?t(a,n,{revalidate:true}):t(a),t(g(e).activitySummary());},[e,t])}function Nt(e,t){let n=e.split(`
|
|
2
|
-
`),a=t.split(`
|
|
3
|
-
`);if(n.length*a.length>25e5)return null;let s=a.length+1,r=new Uint32Array((n.length+1)*s);for(let f=n.length-1;f>=0;f--)for(let c=a.length-1;c>=0;c--)r[f*s+c]=n[f]===a[c]?r[(f+1)*s+c+1]+1:Math.max(r[(f+1)*s+c],r[f*s+c+1]);let i=[],d=0,u=0;for(;d<n.length&&u<a.length;)n[d]===a[u]?(i.push({kind:"same",text:n[d]}),d++,u++):r[(d+1)*s+u]>=r[d*s+u+1]?(i.push({kind:"removed",text:n[d]}),d++):(i.push({kind:"added",text:a[u]}),u++);for(;d<n.length;d++)i.push({kind:"removed",text:n[d]});for(;u<a.length;u++)i.push({kind:"added",text:a[u]});return i}var jn=5e3,On=150,Fe=new Set;function Fn(e){return async()=>{let t=await fetch(e,{credentials:"include",mode:"cors"});return t.status===404?"missing":t.ok?(await t.json()).approval??"missing":null}}function Un(e,t,n=d$2){return !e||e.kind!=="schema"||e.status!=="approved"||e.error?false:e.executedAt?(n(t),false):true}function Ne({approvalId:e,approvalUrl:t,fetchApproval:n,projectId:a,revalidate:s=d$2,sleep:r=i=>new Promise(d=>setTimeout(d,i))}){let i=`${a}:${e}`,d=n??(t?Fn(t):null);!d||Fe.has(i)||(Fe.add(i),(async()=>{try{for(let u=0;u<On;u+=1){let f=null;try{f=await d();}catch{f=null;}if(f==="missing"||f!==null&&!Un(f,a,s))return;await r(jn);}}finally{Fe.delete(i);}})());}var Yn=lazy(()=>import('./skills-pages-7IYBJ4QI.js').then(e=>({default:e.SkillContentPane}))),Vn={approved:"fk:bg-success/20 fk:text-success",cancelled:"fk:bg-secondary fk:text-secondary-foreground",expired:"fk:bg-secondary fk:text-secondary-foreground",pending:"fk:bg-amber-500/20 fk:text-amber-600",rejected:"fk:bg-destructive/15 fk:text-destructive"};function Wn({status:e}){return jsx(b$1,{className:`fk:border-none fk:h-4.75 fk:text-[0.6875rem] fk:leading-4.5 fk:tracking-wide ${Vn[e]}`,variant:"secondary",children:e})}function U(e){return e==null?"\u2014":typeof e=="object"?JSON.stringify(e):String(e)}function Dt({after:e,before:t}){let n=U(t),a=U(e);return n===a?jsx("span",{className:"fk:text-muted-foreground",children:n}):jsxs("span",{className:"fk:inline-flex fk:flex-wrap fk:items-center fk:gap-1.5",children:[jsx("span",{className:"fk:rounded fk:bg-destructive/10 fk:px-1 fk:text-destructive fk:line-through fk:corner-squircle",children:n}),jsx(MoveRightIcon,{className:"fk:size-3 fk:shrink-0 fk:text-muted-foreground"}),jsx("span",{className:"fk:rounded fk:bg-success/15 fk:px-1 fk:text-success fk:corner-squircle",children:a})]})}function Gn(e){let t=e.entity??"entities",n=e.affectedCount!==null?` \xB7 ${e.affectedCount.toString()} affected`:"";return e.kind==="create"?`Create ${t}${n}`:e.kind==="update"?`Update ${t}${n}`:e.kind==="delete"?`Delete ${t}${n}`:`Mutation on ${t}${n}`}function Zn({operation:e}){if(e.rows.length===0)return null;let t=(e.contextColumns??[]).filter(a=>a!=="_id");if(e.kind==="delete")return jsxs($,{children:[jsx(aa$1,{children:jsxs(da$1,{children:[jsx(ea$1,{children:"Records to delete"}),t.map(a=>jsx(ea$1,{children:a},a))]})}),jsx(ba$1,{children:e.rows.map((a,s)=>jsxs(da$1,{className:"fk:bg-destructive/5",children:[jsx(fa$1,{className:"fk:font-mono fk:text-xs fk:text-destructive",children:a.id??U(a.before?._id)}),t.map(r=>jsx(fa$1,{className:"fk:text-xs fk:text-muted-foreground",children:U(a.before?.[r])},r))]},a.id??s.toString()))})]});let n=e.columns.filter(a=>a!=="_id"&&!t.includes(a));return jsxs($,{children:[jsx(aa$1,{children:jsxs(da$1,{children:[jsx(ea$1,{children:"ID"}),t.map(a=>jsx(ea$1,{children:a},a)),n.map(a=>jsx(ea$1,{children:a},a))]})}),jsx(ba$1,{children:e.rows.map((a,s)=>jsxs(da$1,{children:[jsx(fa$1,{className:"fk:font-mono fk:text-xs fk:text-muted-foreground",children:a.id??"\u2014"}),t.map(r=>jsx(fa$1,{className:"fk:max-w-72 fk:text-xs fk:text-muted-foreground",children:jsx("span",{className:"fk:line-clamp-3",children:U(a.before?.[r])})},r)),n.map(r=>jsx(fa$1,{className:"fk:text-xs",children:e.kind==="create"?jsx("span",{className:"fk:rounded fk:bg-success/15 fk:px-1 fk:text-success fk:corner-squircle",children:U(a.after?.[r])}):jsx(Dt,{after:a.after?.[r],before:a.before?.[r]})},r))]},a.id??s.toString()))})]})}function ea({operations:e,plugin:t,chat:n,title:a}){return jsxs("details",{className:"fk:rounded-md fk:border fk:border-border fk:corner-squircle",children:[jsx("summary",{className:"fk:cursor-pointer fk:px-3 fk:py-2 fk:text-xs fk:font-medium fk:text-muted-foreground",children:a??(n?"Action details":t?"Plugin tool and arguments":`GraphQL documents (${e.length})`)}),jsx("div",{className:"fk:space-y-3 fk:border-t fk:border-border fk:p-3",children:e.map((s,r)=>jsxs("div",{className:"fk:space-y-2",children:[jsx("pre",{className:"fk:overflow-x-auto fk:rounded-md fk:bg-muted fk:p-3 fk:text-xs fk:corner-squircle",children:s.query}),s.variables&&Object.keys(s.variables).length>0?jsx("pre",{className:"fk:overflow-x-auto fk:rounded-md fk:bg-muted/60 fk:p-3 fk:text-xs fk:corner-squircle",children:JSON.stringify(s.variables,null,2)}):null]},r.toString()))})]})}function It(e){if(e.kind!=="plugin")return null;let n=e.operations[0]?.query.split(`
|
|
4
|
-
`)[0]?.trim()?.split("/"),a=n?.at(-1),s=n?.[0];if(!a||!s||n?.length<2)return null;let r=a.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").toLowerCase(),i=s.replace(/[_-]+/g," ").replace(/\b\w/g,c=>c.toUpperCase()),d=e.operations[0]?.query??"",u=/^Connection:\s*(Project|Personal)\s+—\s+(.+)$/m.exec(d);if(u?.[1]&&u[2])return {action:r,app:i,account:u[2].trim(),scope:u[1]==="Project"?"project":"personal"};let f=/^Connection:.*?([^\s<>]+@[^\s<>]+)\s*$/m.exec(d)?.[1];return {action:r,app:i,account:f}}function ta(e){let t=It(e);if(t)return `${t.action.charAt(0).toUpperCase()}${t.action.slice(1)} in ${t.app}`;if(e.kind==="exec")return "Run a sandbox command";if(e.kind==="schema")return e.operationsSummary.replace(/^Schema: /,"");if(e.kind==="automation"&&e.preview?.automation)return `Create the automation \u201C${e.preview.automation.name}\u201D`;if(e.kind==="automation"&&e.preview?.automationChange)return `Change the automation \u201C${e.preview.automationChange.name}\u201D`;if(e.kind==="skill"&&e.preview?.skill){let{before:n,name:a}=e.preview.skill;return n?`Change the skill \u201C${n.name}\u201D`:`Create the skill \u201C${a}\u201D`}return e.kind==="plugin"?"Use a connected app":e.operationsSummary}function na({operation:e}){if(e.rows.length===0)return null;let t=a=>a!=null&&a!==false,n=e.columns.filter(a=>e.rows.some(r=>t(r.before?.[a])||t(r.after?.[a]))?e.kind!=="update"?true:e.rows.some(r=>U(r.before?.[a])!==U(r.after?.[a])):false);return jsx("div",{className:"fk:overflow-x-auto fk:rounded-md fk:border fk:border-border fk:corner-squircle",children:jsxs($,{className:"fk:text-xs",children:[jsx(aa$1,{children:jsxs(da$1,{children:[jsx(ea$1,{className:"fk:h-8",children:e.entity==="scopes"||e.entity==="spaces"||e.entity==="studio"?"Setting":"Attribute"}),n.map(a=>jsx(ea$1,{className:"fk:h-8",children:a},a))]})}),jsx(ba$1,{children:e.rows.map((a,s)=>jsxs(da$1,{children:[jsxs(fa$1,{className:"fk:py-1.5 fk:font-mono fk:text-[0.7rem]",children:[e.kind==="delete"?jsx("span",{className:"fk:line-through fk:text-destructive",children:a.id}):a.id,e.kind==="update"&&a.before===null?jsx(b$1,{className:"fk:ml-2",variant:"secondary",children:"new"}):null,e.kind==="update"&&a.after===null?jsx(b$1,{className:"fk:ml-2",variant:"destructive",children:"removed"}):null]}),n.map(r=>jsx(fa$1,{className:"fk:py-1.5",children:e.kind==="create"?jsx("span",{children:U(a.after?.[r])}):e.kind==="delete"?jsx("span",{className:"fk:text-muted-foreground",children:U(a.before?.[r])}):jsx(Dt,{after:a.after?.[r],before:a.before?.[r]})},r))]},a.id??s.toString()))})]})})}function aa(e){let t=e.entity??"schema";return t==="scopes"||t==="spaces"||t==="studio"?`Change ${t==="studio"?"Studio settings":t}`:e.kind==="create"?`Add entity ${t} \xB7 ${e.rows.length.toString()} attribute${e.rows.length===1?"":"s"}`:e.kind==="delete"?`Remove entity ${t}`:`Change entity ${t}`}function sa({preview:e}){let t=e.schema;return jsxs("div",{className:"fk:space-y-4",children:[t&&t.breakingChanges.length>0?jsxs("div",{className:"fk:rounded-md fk:border fk:border-destructive/30 fk:bg-destructive/5 fk:p-3 fk:text-sm fk:corner-squircle",children:[jsxs("div",{className:"fk:mb-1 fk:flex fk:items-center fk:gap-2 fk:font-medium fk:text-destructive",children:[jsx(TriangleAlertIcon,{className:"fk:size-4"}),"Breaking changes: existing data becomes inaccessible"]}),jsx("ul",{className:"fk:list-disc fk:pl-5 fk:text-destructive",children:t.breakingChanges.map(n=>jsx("li",{children:n},n))})]}):null,t&&t.warnings.length>0?jsx("div",{className:"fk:rounded-md fk:border fk:border-amber-500/40 fk:bg-amber-500/10 fk:p-3 fk:text-sm fk:corner-squircle",children:jsx("ul",{className:"fk:list-disc fk:pl-5",children:t.warnings.map(n=>jsx("li",{children:n},n))})}):null,e.operations.map((n,a)=>jsxs("div",{className:"fk:space-y-2",children:[jsx("div",{className:`fk:text-sm fk:font-medium ${n.kind==="delete"?"fk:text-destructive":""}`,children:aa(n)}),jsx(na,{operation:n})]},`${n.entity??""}-${a.toString()}`)),e.operations.length===0?jsx("div",{className:"fk:rounded-md fk:border fk:border-dashed fk:p-3 fk:text-xs fk:text-muted-foreground fk:corner-squircle",children:"No visible entity changes. Review the operations below."}):null]})}function ra(e,t){return e.id===t.id&&e.status===t.status&&e.decidedAt===t.decidedAt&&e.decidedBy===t.decidedBy&&e.executedAt===t.executedAt&&e.error===t.error&&e.reason===t.reason&&e.expiresAt===t.expiresAt&&e.operationsSummary===t.operationsSummary&&e.affectedCount===t.affectedCount&&JSON.stringify(e.preview)===JSON.stringify(t.preview)}function Et({api:e,approval:t,onDecided:n}){let[a,s]=useState(t),[r,i]=useState(t),[d,u]=useState(""),[f,c]=useTransition(),[p,x]=useState(false),[v,k]=useState(false),[g$1,w]=useState(""),y=St();t!==r&&(i(t),ra(t,r)||a.id===t.id&&a.status!=="pending"&&t.status==="pending"||s(t));function C(S){s(S),y(),S.kind==="schema"&&S.status==="approved"&&Ne({approvalId:S.id,approvalUrl:g(S.projectId).approval(S.id),projectId:S.projectId}),n?.(S);}function _({approved:S,automationEdits:R,force:$=false,reason:E,remember:Y=false,skillEdits:L}){c(async()=>{u("");try{let I=await e.decideApproval(a.id,{approved:S,...R?{automationEdits:R}:{},force:$,reason:E,remember:Y,...L?{skillEdits:L}:{}});if(I.errorCode==="stale_preview"){k(!0),I.approval&&s(I.approval);return}if(k(!1),x(!1),I.approval?C(I.approval):I.success?C({...a,decidedAt:a.decidedAt??new Date().toISOString(),reason:E??a.reason,status:S?"approved":"rejected"}):I.errorCode==="already_decided"&&n?.(a),!I.success&&(I.errorCode!=="already_decided"||!I.approval)){let ke=Array.isArray(I.errorMessage)?I.errorMessage.join(", "):I.errorMessage;u(ke||"Failed to submit the decision.");}}catch(I){u(I instanceof Error?I.message:"Failed to submit the decision.");}});}return {approval:a,decide:_,errorMessage:d,isDeciding:f,isPending:a.status==="pending",isRejectDialogOpen:p,isStale:v,rejectReason:g$1,setIsRejectDialogOpen:x,setRejectReason:w}}function Mt({allowRemember:e=false,askForRejectionReason:t,decide:n,isDeciding:a,isRejectDialogOpen:s,isStale:r,rejectReason:i$1,setIsRejectDialogOpen:d,setRejectReason:u,variant:f}){let c=f==="header",p=c?"fk:px-8 fk:min-w-32":void 0,x=c?"default":"sm",[v,k$1]=useState(false),g=useId();return jsxs(Fragment,{children:[jsxs("div",{className:"fk:flex fk:flex-nowrap fk:items-center fk:gap-2",children:[jsxs(b$3,{className:p,disabled:a,size:x,onClick:()=>n({approved:true,force:r,remember:e&&v}),children:[a?jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}):jsx(CheckIcon,{className:"fk:size-4"}),r?"Approve anyway":"Approve"]}),jsxs(b$3,{className:p,disabled:a,size:x,variant:"outline",onClick:()=>{t?(u(""),d(true)):n({approved:false});},children:[jsx(XIcon,{className:"fk:size-4"}),"Reject"]}),e?jsxs("label",{className:"fk:ml-1 fk:flex fk:cursor-pointer fk:items-center fk:gap-1.5 fk:whitespace-nowrap fk:text-xs fk:text-muted-foreground",htmlFor:g,children:[jsx(o$1,{checked:v,id:g,onCheckedChange:w=>k$1(w===true)}),"Always allow this tool for this automation"]}):null]}),t?jsx(c$1,{open:s,onOpenChange:d,children:jsxs(h,{children:[jsxs(i,{children:[jsx(k,{children:"Reject this proposal?"}),jsx(l,{children:"The mutation will not be executed. The agent receives your reason and can adapt its plan."})]}),jsx(la$1,{placeholder:"Optional reason for the agent...",value:i$1,onChange:w=>u(w.target.value)}),jsxs(j,{children:[jsx(b$3,{disabled:a,size:"sm",variant:"outline",onClick:()=>d(false),children:"Cancel"}),jsxs(b$3,{disabled:a,size:"sm",variant:"destructive",onClick:()=>n({approved:false,reason:i$1.trim()||void 0}),children:[a?jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}):jsx(ArrowRightIcon,{className:"fk:size-4"}),"Reject proposal"]})]})]})}):null]})}var oa={always:"Every finished run",failures:"Failures only",never:"Never",when_flagged:"Results that need attention"};function $t(e){return e.visibility==="personal"?"Only you":e.visibility==="space"?`Space: ${e.spaceLabel??"unknown"}`:"Everyone in the project"}function ia({approval:e,instructions:t,isPending:n,proposal:a,onInstructionsChange:s}){let r=useId(),i=e.createdAutomation??null,d=[...a.replacesMonitor?[{label:"Replaces",value:`The monitor \u201C${a.replacesMonitor}\u201D, which stops once this exists`}]:[],{label:"Runs",value:a.triggers.join(`
|
|
5
|
-
`)},{label:"Visible to",value:$t(a)},{label:"Data changes",value:a.mutationPolicy==="auto_approve"?"Applied without review":"Wait for approval"},{label:"Notifications",value:`${oa[a.notifyRule]}${a.notifyCreator?", to you":""}${a.subscribers.length>0?` and ${a.subscribers.join(", ")}`:""}`},...a.plugins.length>0?[{label:"Plugins",value:a.plugins.map(u=>[u.account?`${u.name} as ${u.account}`:u.name,u.deliveryChannels.length>0?`posting to ${u.deliveryChannels.join(", ")}`:""].filter(Boolean).join(", ")).join(`
|
|
6
|
-
`)}]:[],...a.skills.length>0?[{label:"Skills",value:a.skills.join(", ")}]:[],...a.customTools.length>0?[{label:"Custom tools",value:a.customTools.join(", ")}]:[],{label:"Model",value:a.modelLabel}];return jsxs("div",{className:"fk:space-y-4",children:[a.mutationPolicy==="auto_approve"?jsxs("div",{className:"fk:flex fk:items-start fk:gap-2 fk:rounded-md fk:border fk:border-amber-500/40 fk:bg-amber-500/10 fk:p-3 fk:text-sm fk:corner-squircle",role:"status",children:[jsx(TriangleAlertIcon,{className:"fk:mt-0.5 fk:size-4 fk:shrink-0 fk:text-amber-600"}),jsxs("span",{children:["Every run will change data",a.plugins.length>0?" and call these plugins":""," without asking anyone first. Reject and ask for review if that is not what you want."]})]}):null,jsx("dl",{className:"fk:grid fk:grid-cols-[max-content_1fr] fk:gap-x-4 fk:gap-y-1.5 fk:text-sm",children:d.map(u=>jsxs("div",{className:"fk:contents",children:[jsx("dt",{className:"fk:text-muted-foreground",children:u.label}),jsx("dd",{className:"fk:whitespace-pre-line",children:u.value})]},u.label))}),jsxs("div",{className:"fk:space-y-1.5",children:[jsx("label",{className:"fk:text-sm fk:font-medium",htmlFor:r,children:"Instructions"}),n&&s?jsxs(Fragment,{children:[jsx("p",{className:"fk:text-xs fk:text-muted-foreground",children:"The automation never sees this chat, so these instructions are all it has to go on. Edit them before creating it."}),jsx(la$1,{className:"fk:min-h-40 fk:text-sm",id:r,value:t,onChange:u=>s(u.target.value)})]}):jsx("p",{className:"fk:whitespace-pre-wrap fk:rounded-md fk:border fk:p-3 fk:text-sm fk:corner-squircle",id:r,children:t})]}),i?jsxs("div",{className:"fk:flex fk:flex-wrap fk:gap-2",children:[jsx(b$3,{asChild:true,size:"sm",variant:"outline",children:jsx(Link,{to:`/${e.projectId}/ai/automations/${i.automationId}`,children:"Open the automation"})}),i.runId?jsx(b$3,{asChild:true,size:"sm",variant:"ghost",children:jsx(Link,{to:`/${e.projectId}/ai/automations/${i.automationId}/runs/${i.runId}`,children:"View its first run"})}):null]}):null]})}function la({approval:e,change:t}){let n=t.changes.filter(s=>s.field!=="instructions"),a=t.changes.find(s=>s.field==="instructions");return jsxs("div",{className:"fk:space-y-4",children:[n.length>0?jsx("dl",{className:"fk:grid fk:grid-cols-[max-content_1fr] fk:gap-x-4 fk:gap-y-2 fk:text-sm",children:n.map(s=>jsxs("div",{className:"fk:contents",children:[jsx("dt",{className:"fk:text-muted-foreground",children:s.label}),jsxs("dd",{className:"fk:space-y-0.5",children:[jsx("div",{className:"fk:whitespace-pre-line fk:text-muted-foreground fk:line-through",children:s.before}),jsx("div",{className:"fk:whitespace-pre-line",children:s.after})]})]},s.field))}):null,a?jsx("div",{className:"fk:grid fk:gap-3 fk:md:grid-cols-2",children:[{label:"Current instructions",muted:true,text:a.before},{label:"New instructions",muted:false,text:a.after}].map(s=>jsxs("div",{className:"fk:min-w-0 fk:space-y-1.5",children:[jsx("div",{className:"fk:text-sm fk:font-medium",children:s.label}),jsx("p",{className:`fk:whitespace-pre-wrap fk:rounded-md fk:border fk:p-3 fk:text-sm fk:corner-squircle${s.muted?" fk:text-muted-foreground":""}`,children:s.text})]},s.label))}):null,jsx(b$3,{asChild:true,size:"sm",variant:"outline",children:jsx(Link,{to:`/${e.projectId}/ai/automations/${t.automationId}`,children:"Open the automation"})})]})}function zt({decide:e,instructions:t,isDeciding:n,proposal:a}){let s=t.trim(),r=s!==a.instructions.trim()?{instructions:s}:{};return jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-2",children:[jsxs(b$3,{disabled:n||s.length===0,size:"sm",variant:a.runOnceAfterCreate?"outline":"default",onClick:()=>e({approved:true,automationEdits:{...r,runOnce:false}}),children:[n?jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}):jsx(CheckIcon,{className:"fk:size-4"}),"Create"]}),jsxs(b$3,{disabled:n||s.length===0,size:"sm",variant:a.runOnceAfterCreate?"default":"outline",onClick:()=>e({approved:true,automationEdits:{...r,runOnce:true}}),children:[jsx(PlayIcon,{className:"fk:size-4"}),"Create and run once now"]}),jsxs(b$3,{disabled:n,size:"sm",variant:"outline",onClick:()=>e({approved:false}),children:[jsx(XIcon,{className:"fk:size-4"}),"Reject"]})]})}var Pt=3;function ua(e){let t=[],n=0;for(;n<e.length;){if(e[n].kind!=="same"){t.push(e[n]),n++;continue}let a=n;for(;a<e.length&&e[a].kind==="same";)a++;let s=e.slice(n,a),r=n===0?0:Pt,i=a===e.length?0:Pt;s.length>r+i+1?t.push(...s.slice(0,r),{count:s.length-r-i,kind:"folded"},...s.slice(s.length-i)):t.push(...s),n=a;}return t}var Rt={added:{className:"fk:bg-success/10",marker:"+"},removed:{className:"fk:bg-destructive/10 fk:text-muted-foreground",marker:"\u2212"},same:{className:"",marker:" "}};function da({after:e,before:t}){let n=useMemo(()=>Nt(t,e),[e,t]);if(!n)return jsx("p",{className:"fk:rounded-md fk:border fk:border-dashed fk:p-3 fk:text-xs fk:text-muted-foreground fk:corner-squircle",children:"The skill is too long to compare line by line. Review the new content below."});let a=n.filter(r=>r.kind==="added").length,s=n.filter(r=>r.kind==="removed").length;return jsxs("div",{className:"fk:space-y-1.5",children:[jsxs("div",{className:"fk:text-xs fk:text-muted-foreground",children:[jsxs("span",{className:"fk:text-success",children:["+",a.toString()]})," ",jsxs("span",{className:"fk:text-destructive",children:["\u2212",s.toString()]})," lines"]}),jsx("div",{className:"fk:max-h-96 fk:overflow-auto fk:rounded-md fk:border fk:py-1 fk:font-mono fk:text-xs fk:corner-squircle",children:ua(n).map((r,i)=>r.kind==="folded"?jsxs("div",{className:"fk:px-3 fk:py-0.5 fk:text-muted-foreground",children:["\u22EF ",r.count.toString()," unchanged ",r.count===1?"line":"lines"]},i.toString()):jsxs("div",{className:`fk:flex fk:gap-2 fk:px-3 ${Rt[r.kind].className}`,children:[jsx("span",{"aria-hidden":true,className:"fk:w-2 fk:shrink-0 fk:select-none fk:text-muted-foreground",children:Rt[r.kind].marker}),jsx("span",{className:"fk:min-w-0 fk:whitespace-pre-wrap fk:break-words",children:r.text||" "})]},i.toString()))})]})}function Tt({after:e,before:t,label:n}){return e===t?null:jsxs("div",{className:"fk:contents",children:[jsx("dt",{className:"fk:text-muted-foreground",children:n}),jsxs("dd",{className:"fk:space-y-0.5",children:[jsx("div",{className:"fk:whitespace-pre-line fk:text-muted-foreground fk:line-through",children:t}),jsx("div",{className:"fk:whitespace-pre-line",children:e})]})]})}function ca({approval:e,fields:t$1,isPending:n,proposal:a,onFieldsChange:s$1}){let r=useId(),i=useId(),{before:d}=a,u=e.savedSkillId??a.skillId,f=n&&s$1;return jsxs("div",{className:"fk:space-y-4",children:[jsxs("dl",{className:"fk:grid fk:grid-cols-[max-content_1fr] fk:gap-x-4 fk:gap-y-2 fk:text-sm",children:[jsx("dt",{className:"fk:text-muted-foreground",children:"Visible to"}),jsx("dd",{children:$t(a)}),d?jsxs(Fragment,{children:[jsx(Tt,{after:t$1.name,before:d.name,label:"Name"}),jsx(Tt,{after:t$1.description,before:d.description,label:"Description"})]}):null]}),d?d.content===t$1.content?jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:"The content stays the same."}):jsxs("div",{className:"fk:space-y-1.5",children:[jsx("div",{className:"fk:text-sm fk:font-medium",children:"Changes to the content"}),jsx(da,{after:t$1.content,before:d.content})]}):null,f?jsxs("div",{className:"fk:space-y-3",children:[jsx("p",{className:"fk:text-xs fk:text-muted-foreground",children:"Every chat and automation that can see this skill picks it by its description and follows its content. Edit them before saving."}),jsxs("div",{className:"fk:space-y-1.5",children:[jsx("label",{className:"fk:text-sm fk:font-medium",htmlFor:r,children:"Name"}),jsx(s,{id:r,maxLength:120,value:t$1.name,onChange:c=>s$1({...t$1,name:c.target.value})})]}),jsxs("div",{className:"fk:space-y-1.5",children:[jsx("label",{className:"fk:text-sm fk:font-medium",htmlFor:i,children:"Description"}),jsx(la$1,{className:"fk:min-h-16 fk:text-sm",id:i,maxLength:1024,value:t$1.description,onChange:c=>s$1({...t$1,description:c.target.value})})]}),jsx("div",{className:"fk:flex fk:h-96 fk:min-w-0 fk:flex-col",children:jsx(Suspense,{fallback:jsx(t,{className:"fk:min-h-0 fk:flex-1 fk:rounded-md"}),children:jsx(Yn,{content:t$1.content,onChange:c=>s$1({...t$1,content:c})})})})]}):jsxs("div",{className:"fk:space-y-3 fk:text-sm",children:[d?null:jsxs("div",{className:"fk:space-y-0.5",children:[jsx("div",{className:"fk:font-medium",children:"Description"}),jsx("p",{className:"fk:whitespace-pre-line fk:text-muted-foreground",children:t$1.description})]}),jsxs("details",{className:"fk:rounded-md fk:border fk:corner-squircle",children:[jsx("summary",{className:"fk:cursor-pointer fk:px-3 fk:py-2 fk:font-medium",children:"Content"}),jsx("pre",{className:"fk:max-h-96 fk:overflow-auto fk:whitespace-pre-wrap fk:border-t fk:p-3 fk:font-mono fk:text-xs",children:t$1.content})]})]}),u&&(!n||d)?jsx(b$3,{asChild:true,size:"sm",variant:"outline",children:jsx(Link,{to:`/${e.projectId}/ai/skills/${u}`,children:"Open the skill"})}):null]})}function _t({decide:e,fields:t,isDeciding:n,proposal:a}){let s={content:t.content.trim(),description:t.description.trim(),name:t.name.trim()},r=!s.name||!s.description||!s.content,i=Object.fromEntries(Object.keys(s).filter(d=>s[d]!==a[d].trim()).map(d=>[d,s[d]]));return jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-2",children:[jsxs(b$3,{disabled:n||r,size:"sm",onClick:()=>e({approved:true,...Object.keys(i).length>0?{skillEdits:i}:{}}),children:[n?jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}):jsx(CheckIcon,{className:"fk:size-4"}),a.before?"Save changes":"Save skill"]}),jsxs(b$3,{disabled:n,size:"sm",variant:"outline",onClick:()=>e({approved:false}),children:[jsx(XIcon,{className:"fk:size-4"}),"Reject"]})]})}function Lt(e){let t=e.kind==="skill"?e.preview?.skill??null:null,[n,a]=useState(null);return {fields:n?.approvalId===e.id?n.fields:t?{content:t.content,description:t.description,name:t.name}:null,proposal:t,setFields:r=>a({approvalId:e.id,fields:r})}}function jt({approval:e,automationInstructions:t,chat:n,errorMessage:a,isPending:s,isStale:r,onAutomationInstructionsChange:i,onSkillFieldsChange:d,skillFields:u}){let{preview:f}=e,c=n?It(e):null;return jsxs("div",{className:"fk:min-w-0 fk:max-w-full fk:space-y-4",children:[jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-2",children:[jsx(Wn,{status:e.status}),e.kind==="schema"?jsx(b$1,{variant:"outline",children:"Schema change"}):null,e.kind==="automation"?jsx(b$1,{variant:"outline",children:f?.automationChange?"Automation change":"New automation"}):null,e.kind==="skill"?jsx(b$1,{variant:"outline",children:f?.skill?.before?"Skill change":"New skill"}):null,jsx("span",{className:"fk:text-sm fk:font-medium",children:n?ta(e):e.operationsSummary})]}),jsxs("div",{className:"fk:text-xs fk:text-muted-foreground",children:[e.automationName?`${e.automationName} \xB7 `:"","requested ",formatDistance(new Date(e.requestedAt),new Date,{addSuffix:true}),s?` \xB7 expires ${formatDistance(new Date(e.expiresAt),new Date,{addSuffix:true})}`:"",e.decidedAt?` \xB7 decided ${format(new Date(e.decidedAt),"PPpp")}`:""]}),r?jsxs("div",{className:"fk:flex fk:items-start fk:gap-2 fk:rounded-md fk:border fk:border-amber-500/40 fk:bg-amber-500/10 fk:p-3 fk:text-sm fk:corner-squircle",children:[jsx(TriangleAlertIcon,{className:"fk:mt-0.5 fk:size-4 fk:shrink-0 fk:text-amber-600"}),jsx("span",{children:"The affected data changed since this proposal was created. The preview below has been refreshed \u2014 review it and approve again to proceed."})]}):null,e.kind==="automation"&&f?.automation?jsx(ia,{approval:e,instructions:t??f.automation.instructions,isPending:s,proposal:f.automation,onInstructionsChange:i}):e.kind==="automation"&&f?.automationChange?jsx(la,{approval:e,change:f.automationChange}):e.kind==="skill"&&f?.skill?jsx(ca,{approval:e,fields:u??f.skill,isPending:s,proposal:f.skill,onFieldsChange:d}):e.kind==="schema"&&f?jsx(sa,{preview:f}):f&&f.operations.length>0?jsx("div",{className:"fk:space-y-4",children:f.operations.map((p,x)=>jsxs("div",{className:"fk:space-y-2",children:[jsx("div",{className:"fk:text-sm fk:font-medium",children:Gn(p)}),p.kind==="delete"&&p.affectedCount!==null?jsxs("div",{className:"fk:rounded-md fk:border fk:border-destructive/30 fk:bg-destructive/5 fk:p-3 fk:text-sm fk:text-destructive fk:corner-squircle",children:[p.affectedCount.toString()," record",p.affectedCount===1?"":"s"," will be permanently deleted."]}):null,jsx(Zn,{operation:p}),p.truncated?jsxs("div",{className:"fk:text-xs fk:text-muted-foreground",children:["Preview limited to the first ",p.rows.length.toString()," rows."]}):null]},x.toString()))}):jsx("div",{className:"fk:rounded-md fk:border fk:border-dashed fk:p-3 fk:text-xs fk:text-muted-foreground fk:corner-squircle",children:n?c?`This action uses ${c.scope==="project"?"the project's":"your"} ${c.app} account${c.account?` (${c.account})`:""}. Check the details before deciding.`:"The assistant wants to make this change. Check the details before deciding.":e.kind==="plugin"?"Review the account, tool, and arguments before allowing this external call.":e.kind==="exec"?"This command runs inside the run's ephemeral sandbox but may send data out or reach other hosts. Review the command line before allowing it.":"No structured preview is available for this proposal. Review the raw GraphQL documents below."}),e.kind==="automation"||e.kind==="skill"?null:jsx(ea,{chat:n,operations:e.operations,plugin:e.kind==="plugin"||e.kind==="exec",title:e.kind==="exec"?"Command and options":e.kind==="schema"?"Operations":void 0}),e.reason?jsxs("div",{className:"fk:text-sm",children:[jsx("span",{className:"fk:font-medium",children:"Reason:"})," ",e.reason]}):null,e.error?jsxs("div",{className:"fk:rounded-md fk:border fk:border-destructive/30 fk:bg-destructive/5 fk:p-3 fk:text-sm fk:corner-squircle",children:["Execution failed: ",e.error]}):null,e.executedAt&&!e.error?jsxs("div",{className:"fk:flex fk:items-center fk:gap-2 fk:text-sm fk:text-success",children:[jsx(CheckIcon,{className:"fk:size-4"}),"Executed ",format(new Date(e.executedAt),"PPpp")]}):null,a?jsx("div",{className:"fk:text-sm fk:text-destructive",children:a}):null]})}function Ot({api:e,approval:t,chat:n,onDecided:a}){let{approval:s,decide:r,errorMessage:i,isDeciding:d,isPending:u,isRejectDialogOpen:f,isStale:c,rejectReason:p,setIsRejectDialogOpen:x,setRejectReason:v}=Et({api:e,approval:t,onDecided:a}),k=s.kind==="automation"?s.preview?.automation??null:null,[g,w]=useState(k?.instructions??""),y=Lt(s);return jsxs(Fragment,{children:[jsx(jt,{approval:s,automationInstructions:k?g:void 0,chat:n,errorMessage:i,isPending:u,isStale:c,onAutomationInstructionsChange:k?w:void 0,onSkillFieldsChange:y.proposal?y.setFields:void 0,skillFields:y.fields??void 0}),u&&y.proposal&&y.fields?jsx("div",{className:"fk:mt-4",children:jsx(_t,{decide:r,fields:y.fields,isDeciding:d,proposal:y.proposal})}):u&&k?jsx("div",{className:"fk:mt-4",children:jsx(zt,{decide:r,instructions:g,isDeciding:d,proposal:k})}):u?jsx("div",{className:"fk:mt-4",children:jsx(Mt,{allowRemember:!n&&s.kind==="plugin"&&!!s.automationId,askForRejectionReason:!n,decide:r,isDeciding:d,isRejectDialogOpen:f,isStale:c,rejectReason:p,setIsRejectDialogOpen:x,setRejectReason:v,variant:"inline"})}):null]})}function Sr({api:e,approval:t,onClose:n,onDecided:a}){let{approval:s,decide:r,errorMessage:i,isDeciding:d,isPending:u,isRejectDialogOpen:f,isStale:c,rejectReason:p,setIsRejectDialogOpen:x,setRejectReason:v}=Et({api:e,approval:t,onDecided:a}),k=s.kind==="automation"?s.preview?.automation??null:null,[g,w]=useState(k?.instructions??""),y=Lt(s);return jsx(pa$1,{actions:u&&y.proposal&&y.fields?jsx(_t,{decide:r,fields:y.fields,isDeciding:d,proposal:y.proposal}):u&&k?jsx(zt,{decide:r,instructions:g,isDeciding:d,proposal:k}):u?jsx(Mt,{allowRemember:s.kind==="plugin"&&!!s.automationId,askForRejectionReason:true,decide:r,isDeciding:d,isRejectDialogOpen:f,isStale:c,rejectReason:p,setIsRejectDialogOpen:x,setRejectReason:v,variant:"header"}):null,depth:0,isFocused:true,onClose:n,title:k?"Automation proposal":s.preview?.automationChange?"Automation change":y.proposal?y.proposal.before?"Skill change":"Skill proposal":"Mutation proposal",children:jsx(jt,{approval:s,automationInstructions:k?g:void 0,chat:false,errorMessage:i,isPending:u,isStale:c,onAutomationInstructionsChange:k?w:void 0,onSkillFieldsChange:y.proposal?y.setFields:void 0,skillFields:y.fields??void 0})})}var fa="Approved by Flexkit Jev policy",pa="Approved by automation tool allow rule",ma=new Set(["data-create-sandbox","data-execute-graphql","data-export-records","data-load-skill","data-plan","data-plugin-call","data-read-source","data-run-command","data-search-schema","data-update-memory","data-validate-graphql","data-web-search"]);function me(e){return ma.has(e)}function b(e){return e.data}function Be(e){return !e.decidedBy&&!!(e.reason?.startsWith(fa)||e.reason?.startsWith(pa))}function H(e,t=72){let n=e.trim();if(n.length<=t)return n;let a=n.slice(0,t),s=a.lastIndexOf(" ");return `${(s>=Math.floor(t*.6)?a.slice(0,s):a).trimEnd()}\u2026`}function ka(e){return e.replace(/^#{1,6}\s+/,"").replace(/^(?:[-*+]|\d+[.)])\s+/,"").replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/(\*\*|__)(.*?)\1/g,"$2").replace(/(\*|_)(.*?)\1/g,"$2").replace(/`([^`]*)`/g,"$1").replace(/[*_`#>]/g,"").replace(/\s+/g," ").trim().replace(/[.:]+$/,"")}function ga(e){let t=e.lastIndexOf(`
|
|
7
|
-
`),n=-1,a=/[.!?](?=\s)/g,s;for(;(s=a.exec(e))!==null;)n=s.index;let r=Math.max(t,n);return r<0?"":e.slice(0,r+1)}function va(e,t){let a=(ga(e)).split(/\r?\n/).map(u=>u.trim()).filter(Boolean),s=a[a.length-1];if(!s)return null;let i=/^\*\*(.+?)\*\*:?$/.exec(s)?.[1]??/^#{1,6}\s+(.+)$/.exec(s)?.[1]??/^(.+?[.!?])(?:\s|$)/.exec(s)?.[1]??s,d=ka(i);return !d||/^reasoning$/i.test(d)?null:H(d)}function Ft(e){return e.replace(/[_-]+/g," ").trim()}function ha(e){if(e.type==="data-load-skill"){let t=b(e);return t.status!=="loading"?null:t.skillName?H(`Loading skill "${t.skillName}"`):"Loading skill"}if(e.type==="data-search-schema")return b(e).status==="loading"?"Searching schema":null;if(e.type==="data-validate-graphql")return b(e).status==="loading"?"Validating GraphQL query":null;if(e.type==="data-execute-graphql"){let t=b(e);return t.status!=="loading"?null:t.operationType==="mutation"?"Executing GraphQL mutation":"Executing GraphQL query"}if(e.type==="data-export-records"){let t=b(e);return t.status!=="loading"?null:t.rowCount>0?`Exporting records (${t.rowCount.toLocaleString("en-US")} so far)`:"Exporting records"}if(e.type==="data-update-memory")return b(e).status==="loading"?"Updating memory":null;if(e.type==="data-web-search"){let t=b(e);return t.status!=="loading"?null:t.query?H(`Searching the web for "${t.query}"`):"Searching the web"}if(e.type==="data-run-command"){let t=b(e);return ["executing","running","waiting"].includes(t.status)?H(`Running ${[t.command,...t.args].join(" ")}`):null}if(e.type==="data-create-sandbox")return b(e).status==="loading"?"Creating sandbox":null;if(e.type==="data-plugin-call"){let t=b(e);return t.status!=="loading"?null:H(`Calling ${t.pluginId}: ${Ft(t.tool)}`)}if(e.type==="data-subtask"){let t=b(e);return t.status==="running"?H(`Running subtask: ${t.title}`):null}if(e.type==="data-knowledge-search"){let t=b(e);return t.status!=="loading"?null:t.query?H(`Searching knowledge for "${t.query}"`):"Searching knowledge"}if(e.type==="data-read-source"){let t=b(e);return t.status!=="loading"?null:t.sourceTitle?H(`Reading "${t.sourceTitle}"`):"Reading a document"}return null}var ya=new Set(["data-execute-graphql","data-read-source","data-search-schema","data-validate-graphql"]);function De(e){if(!me(e.type)||e.type==="data-plan"||ya.has(e.type))return null;let t=b(e);if(t.status!=="error")return null;if(t.error?.message)return t.error.message;switch(e.type){case "data-web-search":return "Failed to search the web";case "data-run-command":return `Command failed: ${String(t.command??"")}`.trim();case "data-create-sandbox":return "Failed to create sandbox";case "data-load-skill":return "Failed to load skill";case "data-update-memory":return "Failed to update memory";case "data-plugin-call":return `Plugin call failed: ${String(t.pluginId??"")}: ${Ft(String(t.tool??""))}`;default:return "The tool call failed"}}function Ie(e){if(e.type==="step-start"||e.type==="reasoning")return true;if(me(e.type))return De(e)===null;if(e.type==="data-knowledge-search")return b(e).status==="loading";if(e.type==="data-mutation-approval"){let t=b(e);return Be(t)&&t.status!=="error"}return false}function pe(e){if(!e)return null;for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n?.type!=="data-plan")continue;let a=b(n),s=a.steps.findIndex(r=>r.status==="in_progress");return s<0?null:H(`Step ${(s+1).toString()} of ${a.steps.length.toString()}: ${a.steps[s].step}`)}return null}function ba(e){if(!e)return null;for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(!(!n||n.type==="step-start"))return n.type==="reasoning"?n.state==="streaming"?va(n.text)??pe(e):pe(e):n.type==="data-mutation-approval"?b(n).status==="pending"?"Awaiting approval":pe(e):n.type==="data-user-question"?b(n).status==="pending"?"Waiting for your answer":pe(e):n.type==="text"?null:ha(n)??pe(e)}return null}function Xe(e){return e?e.parts.some(t=>t.type!=="data-mutation-approval"?false:b(t).status==="pending"):false}function Je(e,t={}){let n=false,a=[];for(let s of e.parts){if(s.type!=="data-mutation-approval"){a.push(s);continue}let r=b(s);if(r.status!=="pending"){a.push(s);continue}n=true;let i=t[r.approvalId];i&&i!=="pending"&&a.push({...s,data:{...r,status:i}});}return n?{...e,parts:a}:e}function Ut(e,t){if(!e)return [];let n=[],a=t?.pendingOnly??false;for(let s of e.parts){if(s.type!=="data-mutation-approval")continue;let r=b(s);a&&r.status!=="pending"||n.push(r.approvalId);}return n}function xa(e){return Ut(e,{pendingOnly:true})}function Qe(e){return !!e?.parts.some(t=>t.type==="data-user-question"&&b(t).status==="pending")}function qt(e){return e.map(()=>({other:"",selected:[]}))}function Bt(e,t,n){return e.multiSelect?{...t,selected:t.selected.includes(n)?t.selected.filter(a=>a!==n):[...t.selected,n]}:{other:"",selected:[n]}}function Xt(e,t,n){return e.multiSelect?{...t,other:n}:{other:n,selected:n.trim()?[]:t.selected}}function Jt(e){let t=[];for(let n of e){let a=n.other.trim();if(n.selected.length===0&&!a)return null;t.push(a?{other:a,selected:n.selected}:{selected:n.selected});}return t}function Qt(e){return e&&[...e.selected,...e.other?[`\u201C${e.other}\u201D`]:[]].join(", ")||"\u2014"}function wa(e){return Array.isArray(e)?e.filter(t=>t.type==="file"&&typeof t.url=="string").map(t=>({filename:t.filename??"file",mediaType:t.mediaType??"application/octet-stream",sizeBytes:t.sizeBytes??0,url:t.url??"",...t.sha256?{sha256:t.sha256}:{},...t.knowledgeSourceId!==void 0?{knowledgeSourceId:t.knowledgeSourceId}:{}})):[]}function Ht(e,t){return e.kind!=="idle"?e:t.knowledgeSourceId?{kind:"added",sourceId:t.knowledgeSourceId}:e}function Da(e){return typeof e=="string"&&e.includes("/agent/chats/")}function Kt({attachment:e$2}){let{currentProjectId:t}=f(),n=b$5(),a=useNavigate(),{mutate:s}=useSWRConfig(),r=useMemo(()=>t?d$1(t):null,[t]),[i,d]=useState({kind:"idle"}),u=Ht(i,e$2),f$1=e$1({name:e$2.filename,size:e$2.sizeBytes})===null;if(!r||!t||!n||!f$1)return null;let c$1=r,p=t;async function x(){d({kind:"adding"});try{let g=await c$1.addChatAttachment({filename:e$2.filename,url:e$2.url});i$1(g,e$2.filename),d({kind:"added",sourceId:g.source.id}),f$3(),s(Da);}catch(g){qa$1.error(h$1(g,`${e$2.filename} could not be added to Knowledge.`)),d({kind:"idle"});}}let v="Add to Knowledge",k=jsx(BookOpenTextIcon,{className:"fk:size-3"});return u.kind==="adding"?k=jsx(LoaderCircle,{className:"fk:size-3 fk:animate-spin"}):u.kind==="added"&&(v="Open in Knowledge",k=jsx(CheckIcon,{className:"fk:size-3"})),jsxs(b$2,{children:[jsx(c,{asChild:true,children:jsx("button",{"aria-disabled":u.kind==="adding","aria-label":`${v}: ${e$2.filename}`,className:"fk:absolute fk:top-1 fk:right-1 fk:z-10 fk:flex fk:size-5 fk:items-center fk:justify-center fk:rounded-full fk:border fk:border-border fk:bg-background fk:text-foreground fk:shadow-sm fk:transition-colors fk:hover:bg-accent fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring fk:aria-disabled:cursor-default fk:aria-disabled:hover:bg-background fk:corner-squircle","data-knowledge-state":u.kind,type:"button",onClick:g=>{g.stopPropagation(),g.preventDefault(),u.kind==="idle"?x():u.kind==="added"&&a(o(p,u.sourceId));},children:k})}),jsx(e,{children:v})]})}var Yt=20*1024*1024,Yr=10,Wt=new Set(["css","csv","gif","gql","graphql","htm","html","jpeg","jpg","js","json","jsx","log","markdown","md","mjs","ndjson","pdf","png","py","sql","ts","tsv","tsx","txt","webp","xml","yaml","yml"]),Gt=new Set(["application/pdf","image/gif","image/jpeg","image/png","image/webp"]),Vr=[...[...Wt].map(e=>`.${e}`),...Gt].join(",");function Zt(e){let t=e.lastIndexOf(".");return t<=0?"":e.slice(t+1).toLowerCase()}function za(e){let t=Zt(e.name);return (t?Wt.has(t):Gt.has(e.type))?e.size===0?`"${e.name}" is empty.`:e.size>Yt?`"${e.name}" exceeds the ${String(Math.round(Yt/(1024*1024)))} MB limit.`:null:`"${e.name}" is not supported. Attach images, PDFs, or text files.`}async function _a(e){let n=await(await fetch(e.url)).blob();return new File([n],e.filename??"file",{type:e.mediaType||n.type})}function Wr(e,t){let{attachments:n}=Pb(),a=useRef({}),[,s]=useState(0),r=useCallback(()=>s(f=>f+1),[]),i=useRef(n.remove);i.current=n.remove;let d=useRef(t);d.current=t,useEffect(()=>{let f=new Set(n.files.map(c=>c.id));for(let[c,p]of Object.entries(a.current))f.has(c)||(p.controller.abort(),delete a.current[c]);for(let c of n.files){if(a.current[c.id])continue;let p=new AbortController,x={controller:p,status:"uploading"};a.current[c.id]=x,(async()=>{try{let v=await _a(c),k=za(v);if(k)throw new Error(k);let g=await e.uploadAgentChatAttachment(v,p.signal);if(p.signal.aborted)return;x.attachment=g,x.status="done";}catch(v){if(p.signal.aborted)return;x.status="error",delete a.current[c.id],i.current(c.id),d.current(v instanceof Error?v.message:"The file could not be uploaded.");}finally{r();}})();}r();},[e,n.files,r]);let u=Object.values(a.current).some(f=>f.status==="uploading");return {getUploaded:f=>f.map(c=>a.current[c]?.attachment).filter(c=>!!c),isUploading:u,isUploadingFile:f=>a.current[f]?.status==="uploading"}}function Ke(e){return !!e?.startsWith("image/")}function en({image:e,onClose:t}){return jsx(c$1,{onOpenChange:n=>n?void 0:t(),open:e!==null,children:jsxs(h,{className:"fk:h-dvh fk:w-dvw fk:max-w-none fk:sm:max-w-none fk:rounded-none fk:border-0 fk:bg-black/90 fk:p-4 fk:shadow-none fk:flex fk:items-center fk:justify-center fk:corner-squircle",showCloseButton:false,children:[jsx(k,{className:"fk:sr-only",children:e?.filename??"Image preview"}),e?jsx("img",{alt:e.filename,className:"fk:block fk:h-auto fk:w-auto fk:max-h-full fk:max-w-full fk:object-contain",src:e.url}):null,jsx(f$2,{"aria-label":"Close preview",className:"fk:absolute fk:top-4 fk:right-4 fk:flex fk:size-9 fk:items-center fk:justify-center fk:rounded-full fk:bg-white/10 fk:text-white fk:transition-colors fk:hover:bg-white/20 fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-white/60 fk:corner-squircle",children:jsx(XIcon,{className:"fk:size-5"})})]})})}function tn({label:e,onRemove:t}){return jsx("button",{"aria-label":e,className:"fk:absolute fk:top-1 fk:right-1 fk:z-10 fk:flex fk:size-5 fk:items-center fk:justify-center fk:rounded-full fk:border fk:border-border fk:bg-background fk:text-foreground fk:shadow-sm fk:transition-colors fk:hover:bg-accent fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring fk:corner-squircle",onClick:n=>{n.stopPropagation(),t();},type:"button",children:jsx(XIcon,{className:"fk:size-3"})})}function nn({image:e,isUploading:t=false,onOpen:n,onRemove:a,sizeClassName:s}){return jsxs("div",{className:`fk:relative fk:shrink-0 fk:overflow-hidden fk:rounded-xl fk:bg-muted ${s} fk:corner-squircle`,children:[jsx("button",{"aria-label":`Preview ${e.filename}`,className:"fk:block fk:size-full fk:cursor-zoom-in fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring",onClick:n,type:"button",children:jsx("img",{alt:e.filename,className:"fk:size-full fk:object-cover",src:e.url})}),t?jsx("div",{className:"fk:pointer-events-none fk:absolute fk:inset-0 fk:flex fk:items-center fk:justify-center fk:bg-background/60",children:jsx(va$1,{className:"fk:size-4"})}):null,a?jsx(tn,{label:`Remove ${e.filename}`,onRemove:a}):null]})}function La(e,t){let n=Zt(e);if(n)return n.toUpperCase();let a=t?.split("/")[1]?.split("+")[0];return a?a.toUpperCase():"FILE"}function an({action:e,file:t,href:n,isUploading:a=false,onRemove:s}){let r=jsxs(Fragment,{children:[jsx("div",{className:"fk:flex fk:size-10 fk:shrink-0 fk:items-center fk:justify-center fk:rounded-lg fk:bg-muted fk:text-muted-foreground fk:corner-squircle",children:a?jsx(va$1,{className:"fk:size-4"}):jsx(FileIcon,{className:"fk:size-5"})}),jsxs("div",{className:"fk:min-w-0 fk:pr-4 fk:text-left",children:[jsx("div",{className:"fk:truncate fk:text-sm fk:font-medium fk:text-foreground",children:t.filename}),jsx("div",{className:"fk:truncate fk:text-xs fk:text-muted-foreground",children:La(t.filename,t.mediaType)})]})]}),i="fk:flex fk:h-14 fk:max-w-64 fk:items-center fk:gap-2.5 fk:rounded-xl fk:border fk:border-border fk:bg-background fk:px-2 fk:corner-squircle";return jsxs("div",{className:"fk:relative fk:shrink-0",children:[n?jsx("a",{className:`${i} fk:transition-colors fk:hover:bg-accent/50 fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring`,href:n,rel:"noreferrer",target:"_blank",children:r}):jsx("div",{className:i,children:r}),s?jsx(tn,{label:`Remove ${t.filename}`,onRemove:s}):null,e]})}function Gr({uploads:e}){let t=Sb(),[n,a]=useState(null);return t.files.length===0?null:jsxs(Fragment,{children:[jsx("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-2",children:t.files.map(s=>{if(Ke(s.mediaType)&&s.url){let r={filename:s.filename??"Image",url:s.url};return jsx(nn,{image:r,isUploading:e.isUploadingFile(s.id),onOpen:()=>a(r),onRemove:()=>t.remove(s.id),sizeClassName:"fk:size-14"},s.id)}return jsx(an,{file:{filename:s.filename??"file",mediaType:s.mediaType},isUploading:e.isUploadingFile(s.id),onRemove:()=>t.remove(s.id)},s.id)})}),jsx(en,{image:n,onClose:()=>a(null)})]})}function sn({attachments:e}){let[t,n]=useState(null);if(e.length===0)return null;let a=e.filter(r=>Ke(r.mediaType)),s=e.filter(r=>!Ke(r.mediaType));return jsxs("div",{className:"fk:flex fk:flex-col fk:items-end fk:gap-2",children:[a.length>0?jsx("div",{className:"fk:flex fk:flex-wrap fk:justify-end fk:gap-2",children:a.map(r=>jsx(nn,{image:r,onOpen:()=>n(r),sizeClassName:"fk:size-24"},r.url))}):null,jsx(en,{image:t,onClose:()=>n(null)}),s.length>0?jsx("div",{className:"fk:flex fk:flex-wrap fk:justify-end fk:gap-2",children:s.map(r=>jsx(an,{action:jsx(Kt,{attachment:r}),file:r,href:r.url},r.url))}):null]})}function lo(e){let t=(Array.isArray(e.parts)?e.parts:[]).find(n=>n.type==="data-monitor-event");return t&&typeof t.data=="object"&&t.data!==null?t.data:null}function ln({data:e,error:t}){let n=e.total-e.events.length;return jsxs("div",{className:"fk:mr-auto fk:w-full fk:max-w-[85%] fk:space-y-1.5 fk:rounded-lg fk:border fk:border-border fk:bg-muted/40 fk:px-3.5 fk:py-2.5 fk:text-sm fk:corner-squircle",children:[jsxs("div",{className:"fk:flex fk:items-center fk:gap-2 fk:text-xs fk:text-muted-foreground",children:[jsx(RadarIcon,{className:"fk:size-3.5 fk:shrink-0"}),jsxs("span",{className:"fk:truncate",children:["Monitor \xB7 ",e.description]})]}),jsxs("ul",{className:"fk:space-y-0.5",children:[e.events.map(a=>jsx("li",{children:a.summary},a.id)),n>0?jsxs("li",{className:"fk:text-muted-foreground",children:["\u2026and ",n.toString()," more"]}):null]}),t?jsx("p",{className:"fk:text-xs fk:text-destructive",children:t}):null]})}function uo({api:e$1,chatId:t,onTurnIntoAutomation:n,projectId:a,sending:s=false}){let{data:r,mutate:i}=qa(g(a).agentChat(t),f$1,{revalidateOnMount:false}),[d,u]=useState(null),f=r?.monitors??[];if(f.length===0)return null;async function c$1(p){u(p.id);try{await e$1.stopAgentChatMonitor(t,p.id),await i();}catch{qa$1.error("Unable to stop the monitor.");}finally{u(null);}}return jsx("div",{className:"fk:mx-auto fk:mb-2 fk:flex fk:max-w-4xl fk:flex-wrap fk:gap-2",children:f.map(p=>jsxs("div",{className:"fk:flex fk:max-w-full fk:items-center fk:gap-2 fk:rounded-full fk:border fk:border-border fk:py-1 fk:pl-3 fk:pr-1 fk:text-xs fk:text-muted-foreground",children:[jsx(RadarIcon,{className:"fk:size-3.5 fk:shrink-0 fk:animate-pulse"}),jsxs("span",{className:"fk:truncate",children:["Watching: ",p.description," \xB7 expires ",formatDistance(new Date(p.expiresAt),new Date,{addSuffix:true})]}),n&&p.sourceType&&p.sourceType!=="job"?jsxs(b$2,{children:[jsx(c,{asChild:true,children:jsx(b$3,{"aria-label":`Turn ${p.description} into an automation`,className:"fk:size-6 fk:rounded-full",disabled:s,size:"icon",variant:"ghost",onClick:()=>n(p),children:jsx(BotIcon,{className:"fk:size-3.5"})})}),jsx(e,{children:"Turn into automation"})]}):null,jsxs(b$2,{children:[jsx(c,{asChild:true,children:jsx(b$3,{"aria-label":`Stop watching ${p.description}`,className:"fk:size-6 fk:rounded-full",disabled:d===p.id,size:"icon",variant:"ghost",onClick:()=>{c$1(p);},children:jsx(XIcon,{className:"fk:size-3.5"})})}),jsx(e,{children:"Stop watching"})]})]},p.id))})}function dn(e,t){let n=t.trim();return !n||/window was closed|not completed/i.test(n)?`${e} authorization didn't finish`:/popups|different account/i.test(n)?n:`${e} authorization didn't finish: ${n.replace(/\.$/,"")}`}function Ba(e){let t=e.connections.filter(n=>n.isPrimary&&n.status==="connected");return t.find(n=>n.scope==="personal")??t.find(n=>n.scope==="project")??null}function un(e,t,n){return n==="personal"?e.allowPersonal:t}function cn(e,t,n){if(!e.enabled)return {kind:"disabled"};let a=n?e.connections.find(i=>i.id===n&&i.status==="needs_auth"):void 0;if(a)return un(e,t,a.scope)?{kind:"reconnect",connection:a}:{kind:"not_permitted"};let s=Ba(e);if(s)return {kind:"connected",connection:s};let r=e.scopes.filter(i=>un(e,t,i));return r.length>0?{kind:"connect",scopes:r}:{kind:"not_permitted"}}var Wa=createContext(null),Ee=new Map,We=new Set;function Ve(e,t){t?Ee.set(e,t):Ee.delete(e),We.forEach(n=>n());}function Ga(e){return We.add(e),()=>We.delete(e)}function Za(e){return useSyncExternalStore(Ga,()=>Ee.get(e)??null,()=>null)}var mn={personal:{description:"Only you can use this connection in this project.",title:"Personal"},project:{description:"Shared with project members who can use this plugin.",title:"Project"}};function es({busy:e,logoUrl:t,name:n,onContinue:a$1,onOpenChange:s,open:r,scopes:i,connect:d}){let[u,f]=useState(i.length===1?i[0]??null:null),c=[...ts(n,d),{description:`Remove the connection to ${n} at any time.`,title:"You stay in control"}];return jsx(c$1,{onOpenChange:s,open:r,children:jsxs(h,{className:"fk:sm:max-w-md",children:[jsxs("div",{className:"fk:flex fk:flex-col fk:items-center fk:gap-3 fk:pt-2 fk:text-center",children:[jsx(a,{className:"fk:size-16 fk:rounded-xl",src:t}),jsxs(k,{className:"fk:text-xl",children:["Connect to ",n]}),jsxs(l,{children:["Let the Flexkit agent access and use ",n," on your behalf."]})]}),jsx("ul",{className:"fk:space-y-3 fk:rounded-xl fk:bg-muted/60 fk:p-4 fk:corner-squircle",children:c.map(p=>jsxs("li",{className:"fk:flex fk:gap-3",children:[jsx(CheckIcon,{className:"fk:mt-0.5 fk:size-4 fk:shrink-0"}),jsxs("span",{children:[jsx("span",{className:"fk:block fk:text-sm fk:font-medium",children:p.title}),jsx("span",{className:"fk:block fk:text-sm fk:text-muted-foreground",children:p.description})]})]},p.title))}),i.length>1?jsx("div",{className:"fk:space-y-1.5",role:"radiogroup","aria-label":"Connection",children:i.map(p=>jsxs("button",{"aria-checked":u===p,className:`fk:flex fk:w-full fk:flex-col fk:rounded-lg fk:border fk:px-3 fk:py-2 fk:text-left fk:corner-squircle ${u===p?"fk:border-primary fk:bg-primary/5":"fk:border-border fk:hover:bg-muted/60"}`,onClick:()=>f(p),role:"radio",type:"button",children:[jsx("span",{className:"fk:text-sm fk:font-medium",children:mn[p].title}),jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:mn[p].description})]},p))}):null,jsx("p",{className:"fk:text-center fk:text-xs fk:text-muted-foreground",children:"You can manage connections anytime in AI \u2192 Plugins."}),jsx(b$3,{className:"fk:w-full",disabled:e||!u,onClick:()=>u&&a$1(u),type:"button",children:"Continue"})]})})}function ts(e,t){switch(t?.type){case "api-token":return [{title:`Paste a ${t.tokenLabel}`,description:`Flexkit stores it encrypted and sends it only to ${e}. The agent never sees it.`},{title:"You decide what the agent can do",description:"The agent only gets the access the token has."}];case "credentials":return [{title:`Enter the credentials of your ${e} app`,description:`Flexkit checks them with ${e}, stores them encrypted and never shows them to the agent.`},{title:"You decide what the agent can do",description:`The agent only gets the access scopes you give the app in ${e}.`}];default:return [{title:`Sign in securely to your ${e} account`,description:"Flexkit never sees your password."},{title:"You decide what the agent can do",description:`The agent only gets the access you approve on ${e}'s sign-in page.`}]}}function ns(e,t,n){if(!n)return `Let the Flexkit agent use ${e}`;switch(t?.type){case "api-token":return `Add a new ${t.tokenLabel} so the agent can keep using ${e}`;case "credentials":return `Enter the credentials again so the agent can keep using ${e}`;default:return `Sign in again so the agent can keep using ${e}`}}function vn({connectionId:e,pluginId:t}){let{currentProjectId:n}=f(),a$1=useMemo(()=>n?d(n):null,[n]),s=n?`/api/flexkit/${n}`:null,r=s?`${s}/plugins/${encodeURIComponent(t)}`:null,{data:i,error:d$1,mutate:u}=qa(r,f$1),{mutate:f$2}=useSWRConfig(),c=useContext(Wa),[p,x]=useState(false),v=`${n??""}:${t}:${e??""}`,k=Za(v),g=k?.status==="connecting",w=k?.status==="failed"?k:null;if(!i)return jsxs("div",{className:"fk:flex fk:items-center fk:gap-2 fk:rounded-2xl fk:border fk:border-border fk:p-4 fk:text-sm fk:text-muted-foreground fk:corner-squircle",children:[d$1?jsx(CircleAlertIcon,{className:"fk:size-4"}):jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}),d$1?`${t} could not be loaded.`:`Loading ${t}\u2026`]});let{plugin:y}=i,C=cn(y,i.canManage,e),_=C.kind==="reconnect"?C.connection:null;function S(E){!a$1||Ee.get(v)?.status==="connecting"||(x(false),Ve(v,{status:"connecting"}),d$3(a$1,y,E,_?{connectionId:_.id}:void 0).then(Y=>{Ve(v,null),Y&&(u().catch(()=>{}),s&&f$2(`${s}/plugins`).catch(()=>{}),c?.onConnected(t));},Y=>{let L=Y instanceof Error?Y.message:"";Ve(v,{message:dn(y.name,L),scope:E,status:"failed"});}));}let R=null,$=null;return C.kind==="connected"?R=jsxs("span",{className:"fk:flex fk:items-center fk:gap-1.5 fk:text-sm fk:text-muted-foreground",children:[jsx(CheckIcon,{className:"fk:size-4 fk:text-green-700"}),"Connected \xB7 ",C.connection.displayName]}):C.kind==="disabled"?R=jsxs("span",{className:"fk:text-sm fk:text-muted-foreground",children:["An owner turned ",y.name," off for this project."]}):C.kind==="not_permitted"?R=jsxs("span",{className:"fk:text-sm fk:text-muted-foreground",children:["Ask a project owner or developer to connect ",y.name,"."]}):w?(R=jsxs("span",{className:"fk:flex fk:items-center fk:gap-1.5 fk:text-sm fk:text-muted-foreground",children:[jsx(CircleAlertIcon,{className:"fk:size-4 fk:shrink-0 fk:text-amber-600"}),w.message]}),$=jsx(b$3,{disabled:g,onClick:()=>S(w.scope),size:"sm",type:"button",variant:"secondary",children:"Retry"})):$=jsxs(b$3,{disabled:g,onClick:()=>_?S(_.scope):x(true),size:"sm",type:"button",children:[g?jsx(LoaderCircle,{className:"fk:size-3.5 fk:animate-spin"}):null,_?"Reconnect":"Authorize"]}),jsxs("div",{className:"fk:space-y-2",children:[jsxs("div",{className:"fk:space-y-3 fk:rounded-2xl fk:border fk:border-border fk:bg-background fk:p-4 fk:corner-squircle",children:[jsxs("div",{className:"fk:flex fk:items-center fk:gap-3",children:[jsx(a,{className:"fk:size-11 fk:rounded-lg",src:y.logoUrl}),jsxs("div",{className:"fk:min-w-0 fk:flex-1",children:[jsx("div",{className:"fk:truncate fk:font-medium",children:y.name}),jsx("div",{className:"fk:truncate fk:text-sm fk:text-muted-foreground",children:ns(y.name,y.connect,!!_)})]}),$&&!w?$:null]}),R?jsxs("div",{className:"fk:flex fk:items-center fk:justify-between fk:gap-3",children:[R,w?$:null]}):null]}),C.kind==="connect"||C.kind==="reconnect"?jsx("p",{className:"fk:px-1 fk:text-xs fk:text-muted-foreground",children:"Plugin actions follow your project's approval rules. Disconnect any time in AI \u2192 Plugins."}):null,C.kind==="connect"?jsx(es,{busy:g,logoUrl:y.logoUrl,name:y.name,onContinue:S,onOpenChange:x,open:p,scopes:C.scopes,connect:y.connect}):null]})}function So({data:e,error:t,label:n}){return jsxs("div",{className:"fk:mr-auto fk:flex fk:max-w-[85%] fk:flex-wrap fk:items-center fk:gap-x-2 fk:gap-y-1 fk:text-sm fk:text-muted-foreground",children:[jsx(PlugIcon,{className:"fk:size-3.5 fk:shrink-0"}),jsxs("span",{children:["Connected ",jsx("span",{className:"fk:font-medium fk:text-foreground",children:e.pluginName}),e.accountName?` \xB7 ${e.accountName}`:""]}),n?jsxs("span",{className:"fk:text-xs",children:["\xB7 ",n]}):null,t?jsx("span",{className:"fk:text-xs fk:text-destructive",children:t}):null]})}function No(e){let t=(Array.isArray(e)?e:[]).find(n=>n.type==="data-plugin-connected");return t&&typeof t.data=="object"&&t.data!==null?t.data:null}var ie=class extends Error{},Me=class extends Error{};function hn({url:e,signal:t,state:n,onState:a,wake:s,fetchStream:r=fetch,retryMs:i=2e3}){let d=0,u=0,f=new TransformStream,c=f.writable.getWriter(),p=new AbortController;c.closed.catch(g=>p.abort(g));let x=()=>{p.abort(t.reason),c.abort(t.reason).catch(()=>{});};t.addEventListener("abort",x,{once:true}),t.aborted&&x();let v=()=>new Promise(g=>{let w=()=>{clearTimeout(y),p.signal.removeEventListener("abort",w),s?.removeEventListener("wake",w),g();},y=setTimeout(w,i);p.signal.addEventListener("abort",w,{once:true}),s?.addEventListener("wake",w,{once:true}),p.signal.aborted&&w();});async function k(){try{for(await c.write({type:"start"});!p.signal.aborted;){try{let g=await r(`${e}${e.includes("?")?"&":"?"}wire=2&startIndex=${d}`,{credentials:"include",signal:p.signal});if(g.status===404){a("unavailable"),await c.close();return}if(g.status===401||g.status===403)throw new Me("Stream access denied");if(!g.ok||!g.body)throw new Error(`Stream request failed: ${g.status}`);if(g.headers.get("x-flexkit-stream-version")!=="2")throw await g.body.cancel(),new ie("Backend uses legacy replay");a("streaming");let w=g.body.pipeThrough(new TextDecoderStream).getReader(),y="",C=!1;try{for(;!p.signal.aborted;){let{value:_,done:S}=await w.read();if(S)break;y+=_;let R;for(;(R=y.indexOf(`
|
|
8
|
-
`))>=0;){let $=y.slice(0,R);if(y=y.slice(R+1),!$)continue;let E=JSON.parse($);if(!Number.isSafeInteger(E.index)||E.index<0)throw new Error("Invalid replay cursor");if(!(E.index<d)){if(E.index!==d)throw new Error("Replay cursor gap");E.chunk&&await c.write(E.chunk),d=E.index+1,u=0,E.chunk?.type==="finish"&&E.chunk.messageMetadata?.flexkitTerminal&&(C=!0);}}if(y.length>2e6)throw new Error("Oversized replay frame");if(C)break}}finally{await w.cancel().catch(()=>{}),w.releaseLock();}if(C||n().terminal&&!y){await c.write({type:"finish"}),await c.close(),a("finished");return}}catch(g){if(p.signal.aborted||g instanceof ie||g instanceof Me||++u>=5)throw g}do a(n().paused?"paused":"streaming"),await v();while(!p.signal.aborted&&n().paused&&!n().terminal)}}catch(g){await c.abort(g).catch(()=>{});}finally{t.removeEventListener("abort",x),c.releaseLock();}}return k(),pipeJsonRender(f.readable)}var rs={pending:"Waiting for an answer.",cancelled:"The turn was stopped before you answered.",dismissed:"You skipped these questions.",expired:"Nobody answered in time."};function os({description:e,label:t,multiSelect:n,onClick:a,selected:s}){return jsxs("button",{"aria-checked":s,className:`fk:flex fk:w-full fk:items-start fk:gap-2.5 fk:rounded-lg fk:border fk:px-3 fk:py-2 fk:text-left fk:transition-colors fk:corner-squircle ${s?"fk:border-primary fk:bg-primary/5":"fk:border-border fk:hover:bg-muted/60"}`,onClick:a,role:n?"checkbox":"radio",type:"button",children:[jsx("span",{className:`fk:mt-0.5 fk:flex fk:size-4 fk:shrink-0 fk:items-center fk:justify-center fk:border ${n?"fk:rounded-sm":"fk:rounded-full"} ${s?"fk:border-primary fk:bg-primary fk:text-primary-foreground":"fk:border-muted-foreground/50"}`,children:s?jsx(CheckIcon,{className:"fk:size-3"}):null}),jsxs("span",{className:"fk:min-w-0",children:[jsx("span",{className:"fk:block fk:text-sm fk:font-medium",children:t}),e?jsx("span",{className:"fk:block fk:text-xs fk:text-muted-foreground",children:e}):null]})]})}function is({disabled:e,draft:t,onChange:n,question:a}){return jsxs("fieldset",{className:"fk:space-y-2",disabled:e,children:[jsxs("legend",{className:"fk:mb-2 fk:flex fk:flex-wrap fk:items-center fk:gap-2",children:[jsx(b$1,{variant:"outline",children:a.header}),jsx("span",{className:"fk:text-sm fk:font-medium",children:a.question}),a.multiSelect?jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:"Pick any"}):null]}),jsxs("div",{className:"fk:space-y-1.5",role:a.multiSelect?"group":"radiogroup",children:[a.options.map(s=>jsx(os,{description:s.description,label:s.label,multiSelect:a.multiSelect,onClick:()=>n(Bt(a,t,s.label)),selected:t.selected.includes(s.label)},s.label)),jsx(s,{"aria-label":`Your own answer to: ${a.question}`,className:"fk:h-9",maxLength:4e3,onChange:s=>n(Xt(a,t,s.target.value)),placeholder:"Other \u2014 type your own answer",value:t.other})]})]})}function ls({data:e}){return e.status==="answered"&&e.message!==void 0?jsxs("div",{className:"fk:space-y-1",children:[jsx("p",{className:"fk:text-xs fk:text-muted-foreground",children:e.questions.map(t=>t.question).join(" \xB7 ")}),jsxs("p",{className:"fk:text-sm",children:["You replied: ",jsxs("span",{className:"fk:whitespace-pre-wrap",children:["\u201C",e.message,"\u201D"]})]})]}):e.status!=="answered"?jsxs("div",{className:"fk:space-y-1",children:[jsx("p",{className:"fk:text-xs fk:text-muted-foreground",children:e.questions.map(t=>t.question).join(" \xB7 ")}),jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:rs[e.status]})]}):jsx("dl",{className:"fk:space-y-1.5",children:e.questions.map((t,n)=>jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-baseline fk:gap-x-2",children:[jsx("dt",{className:"fk:text-xs fk:text-muted-foreground",children:t.question}),jsx("dd",{className:"fk:text-sm fk:font-medium",children:Qt(e.answers?.[n])})]},n))})}function bn({answer:e,data:t}){let[n,a]=useState(()=>qt(t.questions)),[s,r]=useState(null),[i,d]=useState(null),[u,f]=useState(""),c=t.status==="pending"&&s?s:t;if(c.status!=="pending"||!e)return jsx(ls,{data:c});let p=Jt(n);async function x(v){if(e){d(v.action),f("");try{let k=await e(t.questionId,v);k&&r({...k.answers?{answers:k.answers}:{},...k.message!==null?{message:k.message}:{},questionId:k.id,questions:k.questions,status:k.status});}catch(k){f(k instanceof Error?k.message:"Could not send the answer.");}finally{d(null);}}}return jsxs("form",{className:"fk:space-y-5",onSubmit:v=>{v.preventDefault(),p&&x({action:"answer",answers:p});},children:[t.questions.map((v,k)=>jsx(is,{disabled:i!==null,draft:n[k]??{other:"",selected:[]},onChange:g=>a(w=>w.map((y,C)=>C===k?g:y)),question:v},k)),u?jsx("p",{className:"fk:text-xs fk:text-destructive",children:u}):null,jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-2",children:[jsxs(b$3,{disabled:!p||i!==null,size:"sm",type:"submit",children:[i==="answer"?jsx(LoaderCircle,{className:"fk:size-3.5 fk:animate-spin"}):null,"Submit"]}),jsxs(b$3,{disabled:i!==null,onClick:()=>{x({action:"dismiss"});},size:"sm",type:"button",variant:"ghost",children:[i==="dismiss"?jsx(LoaderCircle,{className:"fk:size-3.5 fk:animate-spin"}):null,"Skip"]}),jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:"or reply in the chat"})]})]})}function us(e){let t=[];return e.page!==void 0&&t.push(`p. ${String(e.page)}`),e.slide!==void 0&&t.push(`slide ${String(e.slide)}`),e.headingPath&&e.headingPath.length>0&&t.push(e.headingPath.join(" \u203A ")),t.join(" \xB7 ")}function xn(e){let t=new Map;for(let n of e??[]){let a=t.get(n.sourceId);a||(a={passages:[],sourceId:n.sourceId,sourceTitle:n.sourceTitle},t.set(n.sourceId,a)),!a.passages.some(s=>s.passageId===n.passageId)&&a.passages.push({excerpt:n.excerpt,locator:us(n.locator),passageId:n.passageId});}return [...t.values()]}function wn(e,t){let n=t.reduce((a,s)=>a+s.passages.length,0);return n===0?`No passages matched "${e}"`:`${String(n)} ${n===1?"passage":"passages"} from ${String(t.length)} ${t.length===1?"document":"documents"} for "${e}"`}var Ds=lazy(()=>import('./spec-renderer-3GAVSV52.js').then(e=>({default:e.RunSpecPart})));function Is(e){return jsx(Suspense,{fallback:null,children:jsx(Ds,{...e})})}function Es(){let{currentProjectId:e}=f();return {api:useMemo(()=>e?d(e):null,[e]),projectId:e}}var An=5,In=2e3,En=120,Ge="data-spec",Mn=createContext(null),Ms=createContext(false);function $s(e){return new Promise(t=>window.setTimeout(t,e))}function zs(e){return e instanceof Error?e.name==="AbortError"||e.message.toLowerCase().includes("aborted"):false}function _s(e){return e.some(t=>!Ie(t))}function Ls(e){let t=new Set;for(let n of e)for(let a of n.parts)a.type==="data-user-message"&&a.id&&t.add(a.id);return t}function js(e){let t=Ls(e),n=[];for(let a of e){if(a.role==="user"){t.has(a.id)||n.push(a);continue}if(a.role!=="assistant"){n.push(a);continue}let s=[],r=0,i=()=>{_s(s)&&n.push({...a,id:`${a.id}-${r.toString()}`,parts:s}),r++,s=[];};for(let d of a.parts){if(d.type==="data-user-message"){let u=b(d);i(),n.push({id:d.id??crypto.randomUUID(),parts:u.parts,role:"user"});continue}s.push(d);}i();}return n}function si(e){return useMemo(()=>js(e),[e])}function le(e){return e==="success"||e==="failed"||e==="cancelled"||e==="skipped"}function $n({latestMessage:e,recordStatus:t,suppressApprovalPause:n}){return le(t)||n||t==="running"?false:t==="awaiting_approval"?true:Xe(e)||Qe(e)}function ri(e,t){let[n,a]=useState(false),s=Os(n?e:"",t),[r,i]=useState(),[d,u]=useState("streaming"),f=useRef(t);f.current=t;let c=useRef(null);c.current||(c.current=new EventTarget);let p=c.current,x=t?.resumeToken;return useEffect(()=>{p.dispatchEvent(new Event("wake"));},[x,p]),useEffect(()=>{if(a(false),i(void 0),!e){u("unavailable");return}let v=new AbortController,k,g,w=()=>{k=void 0,g&&!v.signal.aborted&&i({...g});},y=hn({url:e,signal:v.signal,state:()=>({terminal:le(f.current?.recordStatus),paused:$n({latestMessage:g,recordStatus:f.current?.recordStatus,suppressApprovalPause:f.current?.suppressApprovalPause??false})}),onState:C=>{v.signal.aborted||u(C);},wake:p});return (async()=>{try{for await(let C of readUIMessageStream({stream:y,terminateOnError:!0}))g=C,k||(k=setTimeout(w,En));w();}catch(C){if(v.signal.aborted)return;C instanceof ie?a(true):(console.error("Run stream error",C),u("error"));}})(),()=>{v.abort(),k&&clearTimeout(k);}},[e,p]),n?s:{message:r?Je(r,t?.decidedApprovals??{}):void 0,status:d}}function Os(e,t){let[n,a]=useState(),[s,r]=useState("streaming"),i=t?.recordStatus,d=t?.resumeToken??0,u=useRef(t?.decidedApprovals??{});u.current=t?.decidedApprovals??{};let f=useRef(t?.suppressApprovalPause??false);f.current=t?.suppressApprovalPause??false;let c=useRef(e),p=useRef(n);return p.current=n,useEffect(()=>{let x=c.current!==e;if(c.current=e,!e){a(void 0),r("unavailable");return}let v=new AbortController,k=x?void 0:p.current,g=x?0:k?.parts.length??0;if(x)a(void 0);else if(k&&(i==="running"||le(i))){let S=Je(k,u.current);S!==k&&(k=S,a(S));}r("streaming");let w=e.includes("?")?"&":"?",y=async()=>{let S=await fetch(`${e}${w}startIndex=0`,{credentials:"include",signal:v.signal});if(S.status===404)return "unavailable";if(!S.ok||!S.body)throw new Error(`Failed to fetch the run stream (status ${S.status.toString()})`);let R=false,E=parseJsonEventStream({schema:uiMessageChunkSchema,stream:S.body}).pipeThrough(new TransformStream({transform:(j,zn)=>{if(!j.success)throw j.error;j.value.type==="finish"&&(R=true),zn.enqueue(j.value);}})),Y=readUIMessageStream({onError:j=>{v.signal.aborted||console.error("Run stream chunk error",j);},stream:E}),L=null,I=g===0,ke=(j=false)=>{v.signal.aborted||!k||!I&&(I=j||k.parts.length>=g,!I)||a({...k});};try{for await(let j of Y){if(v.signal.aborted)break;k=j,L===null&&(L=window.setTimeout(()=>{L=null,ke();},En));}}finally{L!==null&&(window.clearTimeout(L),L=null),ke(true);}return R?"finished":"incomplete"},C=async()=>{let S=0;for(;!v.signal.aborted;){S>0&&await $s(In);try{let R=await y();if(v.signal.aborted)return;if(R==="unavailable"){r("unavailable");return}if(R==="finished"&&le(i)){r("finished");return}if(le(i)){r("finished");return}if($n({latestMessage:k,recordStatus:i,suppressApprovalPause:f.current})){r("paused");return}if(!(i==="running"||f.current)&&S>=An-1){r("error");return}}catch(R){if(v.signal.aborted||zs(R))return;if(console.error("Run stream error",R),le(i)){r("finished");return}if(!(i==="running"||f.current)&&S>=An-1){r("error");return}}S+=1;}},_=window.setTimeout(()=>{C();},0);return ()=>{window.clearTimeout(_),v.abort("Run replay unmounted");}},[i,d,e]),{message:n,status:s}}function oi(e){return {affectedCount:e.affectedCount,approvalId:e.id,decidedBy:e.decidedBy??void 0,operationsSummary:e.operationsSummary,reason:e.reason??void 0,status:e.status}}function Fs(e){let t=e.trim();return t?t.split(`
|
|
9
|
-
`).every(n=>/^`{3,}[\w-]*$/.test(n.trim())):false}function Us({attachments:e,text:t}){return jsxs("div",{className:"fk:ml-auto fk:flex fk:w-fit fk:max-w-[70%] fk:flex-col fk:items-end fk:gap-1",children:[jsx(sn,{attachments:e}),t.trim()?jsx("div",{className:"fk:whitespace-pre-wrap fk:rounded-xl fk:bg-muted fk:dark:bg-white/20 fk:px-3.5 fk:py-2 fk:text-base fk:corner-squircle",children:t}):null,jsxs("span",{className:"fk:inline-flex fk:items-center fk:gap-1 fk:text-xs fk:text-muted-foreground",children:[jsx(CornerDownRightIcon,{className:"fk:size-3 fk:shrink-0"}),"Added while the agent was working"]})]})}function ii({api:e,part:t,partIndex:n,parts:a}){if(Ie(t))return null;if(me(t.type)){let s=De(t);return s?jsx(Bs,{message:s}):null}if(t.type==="text")return Fs(t.text)&&a.some(r=>r.type===Ge)?null:jsx(qs,{part:t});if(t.type==="data-knowledge-search")return jsx(Ws,{message:b(t)});if(t.type==="data-generating-files")return jsx(Ks,{message:b(t)});if(t.type==="data-run-artifact")return jsx(Ys,{api:e,message:b(t)});if(t.type==="data-tool-delivery")return jsx(Vs,{message:b(t)});if(t.type==="data-run-summary")return jsx(Gs,{message:b(t)});if(t.type==="data-subtask"){let s=b(t),r=s.status==="running"?`Running "${s.title}"`:s.status==="done"?`Completed "${s.title}"${typeof s.stepsUsed=="number"?` in ${s.stepsUsed.toString()} steps`:""}`:`"${s.title}" failed: ${s.error?.message??"unknown error"}`;return jsxs(B,{children:[jsxs(X,{children:[jsx(BotIcon,{className:"fk:size-3.5"}),"Subtask"]}),jsxs("div",{className:"fk:relative fk:min-h-5 fk:pl-6",children:[jsx("span",{className:"fk:absolute fk:left-0 fk:top-0",children:jsx(ze,{isError:s.status==="error",loading:s.status==="running"})}),jsx("span",{className:"fk:text-xs",children:r}),s.resultPreview?jsx("p",{className:"fk:mt-1 fk:text-xs fk:text-muted-foreground",children:s.resultPreview}):null]})]})}if(t.type==="data-mid-turn-message"){let s=b(t);return s.monitorEvent?jsx(ln,{data:s.monitorEvent}):jsx(Us,{attachments:s.attachments,text:s.text})}if(t.type==="data-context-compaction"){let s=b(t);return jsxs("p",{className:"fk:text-xs fk:text-muted-foreground",children:["Earlier messages (",s.summarizedMessageCount.toString(),") were summarized to keep this conversation within the model's context. Details may need to be re-fetched."]})}if(t.type==="data-plugin-connection"){let s=b(t);return jsx(vn,{connectionId:s.connectionId,pluginId:s.pluginId})}if(t.type==="data-suggested-prompt")return null;if(t.type==="data-turn-error"){let s=b(t);return jsxs(B,{className:"fk:border-red-700/40",children:[jsxs(X,{children:[jsx(XCircleIcon,{className:"fk:size-3.5 fk:text-red-700"}),jsx("span",{children:"Turn failed"})]}),jsx("p",{className:"fk:whitespace-pre-wrap fk:text-xs",children:s.message})]})}if(t.type==="data-mutation-approval"){let s=b(t);return Be(s)?jsx(tr,{message:s}):jsx(Zs,{api:e,message:s})}return t.type==="data-user-question"?jsx(er,{data:b(t)}):t.type==="data-bulk-graphql-action"?jsx(nr,{message:b(t)}):t.type===Ge?a.slice(n+1).find(r=>r.type===Ge)?null:jsx(Is,{parts:a}):t.type.startsWith("data-")?jsx(ar,{part:t}):null}function qs({part:e}){return jsx(qb,{className:"fk:min-w-0 fk:max-w-full fk:overflow-x-auto fk:text-base fk:leading-relaxed fk:text-foreground",isAnimating:e.state==="streaming",children:e.text})}function Bs({message:e}){return jsxs("div",{className:"fk:flex fk:items-start fk:gap-2 fk:rounded-xl fk:border fk:border-red-700/40 fk:bg-destructive/5 fk:px-3.5 fk:py-3 fk:text-sm fk:corner-squircle",children:[jsx(XCircleIcon,{className:"fk:mt-0.5 fk:size-3.5 fk:shrink-0 fk:text-red-700"}),jsx("span",{className:"fk:whitespace-pre-wrap fk:text-xs",children:e})]})}var Xs=1e3;function Js({text:e}){let t=useRef(typeof performance>"u"?0:performance.now()),n=()=>-(((typeof performance>"u"?0:performance.now())-t.current)%Xs),[a,s]=useState({current:e,currentDelayMs:0,key:0,previous:null,previousDelayMs:0});return useEffect(()=>{s(r=>r.current===e?r:{current:e,currentDelayMs:n(),key:r.key+1,previous:r.current,previousDelayMs:r.currentDelayMs});},[e]),jsxs("span",{className:"fk:relative fk:block fk:h-5 fk:min-w-0 fk:flex-1 fk:overflow-hidden",children:[a.previous?jsx("span",{"aria-hidden":true,className:"fk:absolute fk:inset-x-0 fk:top-0 fk:block fk:animate-roll-up-out",children:jsx("span",{className:"fk:block fk:truncate fk:shimmer fk:shimmer-duration-1000",style:{animationDelay:`${a.previousDelayMs.toString()}ms`},children:a.previous})},`previous-${a.key.toString()}`):null,jsx("span",{className:a.previous?"fk:block fk:animate-roll-up-in":"fk:block",role:"status",children:jsx("span",{className:"fk:block fk:truncate fk:shimmer fk:shimmer-duration-1000",style:{animationDelay:`${a.currentDelayMs.toString()}ms`},children:a.current})},`current-${a.key.toString()}`)]})}var Qs=1e3;function Hs(e,t){let n=Qs,[a,s]=useState(e),r=useRef(Date.now()),i=useRef(e);return i.current=e,useEffect(()=>{if(e===a)return;let d=Math.max(0,n-(Date.now()-r.current)),u=window.setTimeout(()=>{r.current=Date.now(),s(i.current);},d);return ()=>{window.clearTimeout(u);}},[a,e,n]),a}function li({label:e,visible:t}){let n=Hs(e);return jsx("div",{"aria-hidden":!t,className:`fk:flex fk:h-9 fk:items-center fk:text-sm fk:text-muted-foreground fk:transition-[opacity,visibility] fk:duration-200 ${t?"fk:visible fk:opacity-100":"fk:invisible fk:opacity-0"}`,children:jsx(Js,{text:n})})}function B({children:e,className:t=""}){return jsx("div",{className:`fk:min-w-0 fk:max-w-full fk:overflow-x-auto fk:rounded-xl fk:border fk:border-border fk:bg-background fk:px-3.5 fk:py-3 fk:text-sm ${t} fk:corner-squircle`,children:e})}function X({children:e}){return jsx("div",{className:"fk:flex fk:items-center fk:gap-2 fk:font-medium fk:text-muted-foreground",children:e})}function ze({isError:e,loading:t}){return t?jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}):e?jsx(XIcon,{className:"fk:size-4 fk:text-red-700"}):jsx(CheckIcon,{className:"fk:size-4"})}function _e({error:e,icon:t,loading:n,message:a,title:s}){return jsxs(B,{children:[jsxs(X,{children:[t,s]}),jsxs("div",{className:"fk:relative fk:min-h-5 fk:pl-6",children:[jsx("span",{className:"fk:absolute fk:left-0 fk:top-0",children:jsx(ze,{isError:!!e,loading:n})}),jsx("span",{className:"fk:text-xs",children:a})]})]})}function Ks({message:e}){let t=["error","uploading","generating"].includes(e.status),n=t?e.paths.slice(0,e.paths.length-1):e.paths,a=t?e.paths[e.paths.length-1]??"":null;return jsxs(B,{children:[jsxs(X,{children:[jsx(CloudUploadIcon,{className:"fk:size-3.5"}),jsx("span",{children:e.status==="done"?"Uploaded files":"Generating files"})]}),jsxs("div",{className:"fk:space-y-1 fk:text-sm",children:[n.map((s,r)=>jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(CheckIcon,{className:"fk:size-4"}),jsx("span",{className:"fk:whitespace-pre-wrap",children:s})]},`${s}-${r.toString()}`)),typeof a=="string"?jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(ze,{isError:e.status==="error",loading:e.status!=="error"}),jsx("span",{children:e.status==="error"?e.error?.message??a:a})]}):null]})]})}function Ys({api:e,message:t}){let n=t.status==="done"&&t.artifactId,a=n?b$4()&&t.url||e.getArtifactUrl(t.artifactId??""):"",s=n?e.getArtifactUrl(t.artifactId??"",{download:true}):"",r=sr(t.sizeBytes);return jsxs(B,{children:[jsxs(X,{children:[jsx(FileTextIcon,{className:"fk:size-3.5"}),t.kind==="csv"||t.kind==="json"?"Exported file":t.status==="done"?"Published artifact":"Publishing artifact"]}),jsxs("div",{className:"fk:relative fk:min-h-5 fk:pl-6",children:[jsx("span",{className:"fk:absolute fk:left-0 fk:top-0",children:jsx(ze,{isError:t.status==="error",loading:t.status==="uploading"})}),jsxs("div",{className:"fk:min-w-0 fk:space-y-2",children:[jsxs("div",{className:"fk:min-w-0",children:[jsx("div",{className:"fk:truncate fk:font-medium",children:t.filename}),jsxs("div",{className:"fk:text-xs fk:text-muted-foreground",children:[t.status==="uploading"&&"Uploading to artifacts",t.status==="done"&&[rr(t),r].filter(Boolean).join(" \xB7 "),t.status==="error"&&(t.error?.message??"Failed to publish artifact")]})]}),n?jsxs("div",{className:"fk:flex fk:flex-wrap fk:gap-2",children:[t.kind==="csv"?null:jsx(b$3,{asChild:true,size:"sm",variant:"outline",children:jsx("a",{href:a,rel:"noreferrer",target:"_blank",children:"Preview"})}),jsx(b$3,{asChild:true,size:"sm",variant:"outline",children:jsxs("a",{href:s,children:[jsx(DownloadIcon,{className:"fk:size-3"}),"Download"]})}),t.url?jsx(b$3,{asChild:true,size:"sm",variant:"outline",children:jsxs("a",{href:t.url,rel:"noreferrer",target:"_blank",children:[jsx(LinkIcon,{className:"fk:size-3"}),"Permanent link"]})}):null]}):null]})]})]})}function Vs({message:e}){let t=e.provider==="slack"?"Slack":"Microsoft Teams",n=e.provider==="slack"?jsx(MessageSquareIcon,{className:"fk:size-3.5"}):jsx(SendIcon,{className:"fk:size-3.5"});return jsx(_e,{error:e.error?.message,icon:n,loading:e.status==="loading",message:e.status==="error"?e.error?.message??`Failed to send result to ${e.channelName}`:`${e.status==="done"?"Sent":"Sending"} result to ${e.channelName}`,title:`${t} Delivery`})}function Ws({message:e}){let{currentProjectId:t}=f(),n=useMemo(()=>xn(e.results),[e.results]);return e.status==="error"?jsx(_e,{error:e.error?.message??"The knowledge search failed",icon:jsx(LibraryIcon,{className:"fk:size-3.5"}),loading:false,message:e.error?.message??"The knowledge search failed",title:"Knowledge search"}):jsxs(B,{children:[jsxs(X,{children:[jsx(LibraryIcon,{className:"fk:size-3.5"}),jsx("span",{children:"Knowledge search"})]}),jsx("p",{className:"fk:mt-1 fk:text-xs fk:text-muted-foreground",children:wn(e.query,n)}),n.length>0?jsxs(Gc,{className:"fk:mb-0 fk:mt-2",children:[jsxs(Hc,{count:n.length,children:[jsx("p",{className:"fk:font-medium",children:n.length===1?"Show the cited passages":`Show passages from ${String(n.length)} documents`}),jsx(ChevronDownIcon,{className:"fk:size-4"})]}),jsx(Ic,{className:"fk:w-full",children:n.map(a=>jsxs("div",{className:"fk:flex fk:flex-col fk:gap-1.5",children:[t?jsxs(Link,{className:"fk:flex fk:w-fit fk:items-center fk:gap-2 fk:font-medium fk:text-foreground fk:underline-offset-2 fk:hover:underline",to:o(t,a.sourceId),children:[jsx(BookOpenIcon,{className:"fk:size-4"}),jsx("span",{children:a.sourceTitle})]}):jsxs("span",{className:"fk:flex fk:items-center fk:gap-2 fk:font-medium fk:text-foreground",children:[jsx(BookOpenIcon,{className:"fk:size-4"}),jsx("span",{children:a.sourceTitle})]}),jsx("ul",{className:"fk:flex fk:flex-col fk:gap-1.5 fk:pl-6",children:a.passages.map(s=>jsxs("li",{className:"fk:text-xs fk:text-muted-foreground",children:[s.locator?jsxs("span",{className:"fk:mr-1 fk:font-medium fk:text-foreground/80",children:[s.locator,":"]}):null,jsxs("span",{className:"fk:italic",children:["\u201C",s.excerpt,"\u201D"]})]},s.passageId))})]},a.sourceId))})]}):null]})}function Gs({message:e}){let t=e.status==="success"?jsx(CheckCircle2Icon,{className:"fk:size-3.5 fk:text-green-700"}):e.status==="skipped"?jsx(CircleSlashIcon,{className:"fk:size-3.5"}):jsx(XCircleIcon,{className:"fk:size-3.5 fk:text-red-700"}),n=e.status==="success"?"Run completed":e.status==="skipped"?"Run skipped":"Run failed";return jsxs(B,{className:e.status==="failed"?"fk:border-red-700/40":"fk:border-green-700/40",children:[jsxs(X,{children:[t,jsx("span",{children:n})]}),e.status==="failed"?jsx("p",{className:"fk:whitespace-pre-wrap fk:text-xs",children:e.summary}):null]})}function Zs({api:e,message:t}){let{projectId:n}=Es(),a=useContext(Mn),s=useContext(Ms),r=useRef(void 0),{data:i,error:d,isValidating:u,mutate:f}=qa(n?g(n).approval(t.approvalId):null,f$1,{refreshInterval:g=>t.status!=="pending"||g?.approval?.status&&g.approval.status!=="pending"?0:In}),c=i?.approval?.status,p=(c??t.status)==="pending",x=i?.approval?.kind==="schema"&&i.approval.status==="approved";useEffect(()=>{!x||!n||Ne({approvalId:t.approvalId,approvalUrl:g(n).approval(t.approvalId),projectId:n});},[x,t.approvalId,n]),useEffect(()=>{f();},[t.status,f]),useEffect(()=>{let g=r.current;r.current=c,!(t.status!=="pending"||!c||c==="pending")&&g==="pending"&&a?.onApprovalDecided(i?.approval?.id??t.approvalId,c);},[c,i?.approval?.id,t.approvalId,t.status,a]);function v(g){g.status!=="pending"&&(r.current=g.status),f(),a?.onApprovalDecided(g.id,g.status);}let k;if(i?.approval)k=jsx(Ot,{api:e,approval:i.approval,chat:s,onDecided:v},i.approval.status);else if(d&&!u){let g=d instanceof Error&&d.message?d.message:"Request failed";k=jsxs("div",{className:"fk:space-y-2",children:[jsxs("p",{className:"fk:text-xs fk:text-destructive",children:["Failed to load proposal ",t.operationsSummary,": ",g]}),jsx(b$3,{size:"sm",variant:"outline",onClick:()=>{f();},children:"Retry"})]});}else k=jsxs("div",{className:"fk:flex fk:items-center fk:gap-2 fk:text-xs fk:text-muted-foreground",children:[jsx(LoaderCircle,{className:"fk:size-3.5 fk:animate-spin"}),jsxs("span",{children:["Loading proposal ",t.operationsSummary,"..."]})]});return jsxs(B,{children:[jsxs(X,{children:[s?jsx(ShieldIcon,{className:"fk:size-3.5"}):jsx(DatabaseZapIcon,{className:"fk:size-3.5"}),s?"Approval request":"Mutation approval",p?jsx(LoaderCircle,{className:"fk:ml-1 fk:size-3.5 fk:animate-spin"}):null]}),jsx("div",{className:"fk:mt-2",children:k}),t.status==="error"&&t.error?jsx("p",{className:"fk:mt-2 fk:text-xs fk:text-destructive",children:t.error.message}):null]})}function er({data:e}){let t=useContext(Mn),n=e.questions.length>1;return jsxs(B,{children:[jsxs(X,{children:[jsx(MessageCircleQuestionIcon,{className:"fk:size-3.5"}),e.status==="pending"?n?"The agent has questions":"The agent has a question":n?"Questions":"Question"]}),jsx("div",{className:"fk:mt-3",children:jsx(bn,{answer:t?.answerQuestion,data:e},e.status)})]})}function tr({message:e}){let t=e.operationsSummary.replace(/^Call /,"");return jsx(_e,{error:e.status==="error"?e.error?.message??"The call failed.":void 0,icon:jsx(ShieldCheckIcon,{className:"fk:size-3.5"}),loading:false,message:e.status==="error"?`${t}: ${e.error?.message??"The call failed."}`:`${t} \xB7 Auto-approved by Jev`,title:"Plugin call"})}function nr({message:e}){let t=[typeof e.processedItems=="number"?`${e.processedItems.toString()} processed`:"",typeof e.changedItems=="number"?`${e.changedItems.toString()} changed`:"",typeof e.failedItems=="number"?`${e.failedItems.toString()} failed`:"",typeof e.totalItems=="number"?`${e.totalItems.toString()} total`:""].filter(Boolean);return jsx(_e,{error:e.error?.message,icon:jsx(DatabaseZapIcon,{className:"fk:size-3.5"}),loading:e.status==="loading"||e.status==="running",message:e.status==="error"?e.error?.message??`Failed bulk ${e.operationName}`:`${e.status==="done"?"Completed":"Running"} ${e.operationName}${t.length>0?` (${t.join(", ")})`:""}`,title:"Bulk GraphQL action"})}function ar({part:e}){return jsxs(B,{className:"fk:bg-muted/30",children:[jsxs(X,{children:[jsx(CheckCircle2Icon,{className:"fk:size-3.5"}),e.type.replace(/^data-/,"").replaceAll("-"," ")]}),jsx("p",{className:"fk:text-xs fk:text-muted-foreground",children:"This run emitted a structured event that is not yet rendered by Studio."})]})}function sr(e){if(typeof e!="number")return "";if(e<1024)return `${e.toString()} B`;let t=e/1024;return t<1024?`${t.toFixed(1)} KB`:`${(t/1024).toFixed(1)} MB`}function rr(e){return e.kind==="pdf"?"PDF artifact":e.kind==="html"?"HTML artifact":e.kind==="csv"?"CSV file":e.kind==="json"?"JSON file":"Artifact"}export{Ms as A,si as B,le as C,ri as D,oi as E,ii as F,Bs as G,li as H,Zs as I,St as a,Wn as b,Ot as c,Sr as d,Ie as e,ba as f,Xe as g,Ut as h,xa as i,Qe as j,wa as k,Yt as l,Yr as m,Vr as n,Wr as o,Gr as p,sn as q,lo as r,ln as s,uo as t,Wa as u,So as v,No as w,Es as x,In as y,Mn as z};//# sourceMappingURL=chunk-JAPZBEBZ.js.map
|
|
10
|
-
//# sourceMappingURL=chunk-JAPZBEBZ.js.map
|
package/dist/chunk-JWJJZVP3.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {x}from'./chunk-JAPZBEBZ.js';import {g,f}from'./chunk-U6VZY3V2.js';import {s}from'./chunk-DGIY4SKN.js';import {e,g as g$1,h,j}from'./chunk-SZEGGBOC.js';import {c,h as h$1,i,k,j as j$1}from'./chunk-32ZU4MLE.js';import {b}from'./chunk-6NRQMG26.js';import {useState,useEffect,useMemo,useTransition}from'react';import {LoaderCircle,MessageSquareIcon,MoreHorizontalIcon,PencilIcon,Trash2Icon}from'lucide-react';import {useLocation,useNavigate}from'react-router-dom';import H,{useSWRConfig}from'swr';import U from'swr/infinite';import {jsx,jsxs}from'react/jsx-runtime';function ue(){let a=useLocation(),n="/agent",t=a.pathname.indexOf(n);return t===-1?`${a.pathname.replace(/\/$/,"")}/agent`:a.pathname.slice(0,t+n.length)}function de(a,n){let[t,o]=useState(a);return useEffect(()=>{let f=window.setTimeout(()=>{o(a);},n);return ()=>{window.clearTimeout(f);}},[n,a]),t}function Z(a){let n=new Date(a.lastMessageAt??a.updatedAt).getTime(),t=new Date,o=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();return n>=o?"Today":n>=o-864e5?"Yesterday":n>=o-7*864e5?"Previous 7 days":"Older"}function ee(a){let n=[];for(let t of a){let o=Z(t),f=n.find(u=>u.label===o);f?f.chats.push(t):n.push({chats:[t],label:o});}return n}function te({active:a,api:n,chat:t,onChanged:o,onDeleted:f,onOpen:u}){let[r,l]=useState(null),[g,d]=useState(t.title??""),[p,D]=useTransition(),k$1=t.title?.trim()||"New chat";function v(){D(async()=>{await n.renameAgentChat(t.id,g.trim()),l(null),o();});}function y(){D(async()=>{await n.deleteAgentChat(t.id),l(null),f();});}return jsxs("div",{className:`fk:group/chat fk:flex fk:items-center fk:gap-1 fk:rounded-md fk:pr-1 ${a?"fk:bg-sidebar-accent":"fk:hover:bg-accent/60"} fk:corner-squircle`,children:[jsx("button",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:px-2 fk:py-1.5 fk:text-left fk:text-sm",title:k$1,type:"button",onClick:u,children:k$1}),jsxs(e,{children:[jsx(g$1,{asChild:true,children:jsx(b,{className:"fk:size-6 fk:shrink-0 fk:opacity-0 fk:group-hover/chat:opacity-100 fk:data-[state=open]:opacity-100",size:"icon",variant:"ghost",children:jsx(MoreHorizontalIcon,{className:"fk:size-4"})})}),jsxs(h,{align:"start",children:[jsxs(j,{onClick:()=>{d(t.title??""),l("rename");},children:[jsx(PencilIcon,{className:"fk:size-4"}),"Rename"]}),jsxs(j,{className:"fk:text-destructive",onClick:()=>l("delete"),children:[jsx(Trash2Icon,{className:"fk:size-4"}),"Delete"]})]})]}),jsx(c,{open:r==="rename",onOpenChange:m=>l(m?"rename":null),children:jsxs(h$1,{className:"fk:max-w-sm",children:[jsx(i,{children:jsx(k,{children:"Rename chat"})}),jsx(s,{value:g,onChange:m=>d(m.target.value),placeholder:"Chat title"}),jsx(j$1,{children:jsx(b,{disabled:p||!g.trim(),size:"sm",onClick:v,children:p?"Saving...":"Save"})})]})}),jsx(c,{open:r==="delete",onOpenChange:m=>l(m?"delete":null),children:jsxs(h$1,{className:"fk:max-w-sm",children:[jsx(i,{children:jsx(k,{children:"Delete chat?"})}),jsxs("p",{className:"fk:text-sm fk:text-muted-foreground",children:["\u201C",k$1,"\u201D and its messages will be permanently deleted."]}),jsx(j$1,{children:jsx(b,{disabled:p,size:"sm",variant:"destructive",onClick:y,children:p?"Deleting...":"Delete"})})]})})]})}function ne({onOpen:a,projectId:n,query:t}){let{data:o,isLoading:f$1}=H(g(n).agentChatSearch(t),f,{keepPreviousData:true});return f$1&&!o?jsxs("div",{className:"fk:flex fk:items-center fk:gap-2 fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground",children:[jsx(LoaderCircle,{className:"fk:size-3.5 fk:animate-spin"}),"Searching..."]}):o?.results.length?jsx("div",{className:"fk:space-y-1",children:o.results.map(u=>jsxs("button",{className:"fk:block fk:w-full fk:rounded-md fk:px-2 fk:py-1.5 fk:text-left fk:hover:bg-accent/60 fk:corner-squircle",type:"button",onClick:()=>a(u.chatId),children:[jsx("span",{className:"fk:block fk:truncate fk:text-sm",children:u.chatTitle?.trim()||"New chat"}),jsx("span",{className:"fk:block fk:truncate fk:text-xs fk:text-muted-foreground",children:u.snippet})]},u.messageId))}):jsx("p",{className:"fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground",children:"No matching chats."})}function me({query:a}){let{api:n,projectId:t}=x(),o=useNavigate(),f$1=useLocation(),{mutate:u}=useSWRConfig(),r=/\/agent\/chats\/([^/]+)/.exec(f$1.pathname)?.[1],{data:l,isLoading:g$1,mutate:d,setSize:p,size:D}=U((s,c)=>!t||c&&!c.hasMore?null:g(t).agentChats(s*30),f,{revalidateFirstPage:true}),{data:k}=H(t&&r?g(t).agentChat(r):null,f),v=useMemo(()=>{let s=(l??[]).flatMap(h=>h.chats),c=k?.chat.title?.trim();return !r||!c?s:s.map(h=>h.id!==r||h.title?.trim()?h:{...h,title:c})},[k?.chat.title,r,l]),y=l?.[l.length-1]?.hasMore??false,m=useMemo(()=>ee(v),[v]);if(useEffect(()=>{d();},[r,d]),!t||!n)return null;let J=n,z=t;function L(s){o(`agent/chats/${s}`);}function X(s){d(),s===r?o("agent"):u(g(z).agentChat(s),void 0,{revalidate:false});}return jsx("div",{className:"fk:space-y-2",children:a?jsx(ne,{projectId:z,query:a,onOpen:L}):jsxs("div",{className:"fk:space-y-3",children:[m.map(s=>jsxs("div",{children:[jsx("p",{className:"fk:px-2 fk:pb-1 fk:text-xs fk:font-medium fk:text-muted-foreground",children:s.label}),jsx("div",{className:"fk:space-y-0.5",children:s.chats.map(c=>jsx(te,{active:c.id===r,api:J,chat:c,onChanged:()=>{d();},onDeleted:()=>X(c.id),onOpen:()=>L(c.id)},c.id))})]},s.label)),g$1?jsxs("div",{className:"fk:flex fk:items-center fk:gap-2 fk:px-2 fk:py-3 fk:text-xs fk:text-muted-foreground",children:[jsx(LoaderCircle,{className:"fk:size-3.5 fk:animate-spin"}),"Loading recent chats..."]}):null,!g$1&&v.length===0?jsxs("div",{className:"fk:flex fk:flex-col fk:items-center fk:gap-2 fk:px-2 fk:py-6 fk:text-center fk:text-xs fk:text-muted-foreground",children:[jsx(MessageSquareIcon,{className:"fk:size-5"}),jsx("span",{children:"No chats yet. Start a conversation with the agent."})]}):null,y?jsx(b,{className:"fk:w-full",size:"sm",variant:"ghost",onClick:()=>{p(D+1);},children:"Load more"}):null]})})}export{ue as a,de as b,me as c};//# sourceMappingURL=chunk-JWJJZVP3.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-JWJJZVP3.js.map
|
package/dist/chunk-MRHZN4G4.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {e,c,b,a,g,h as h$1,m as m$1,k as k$2,n}from'./chunk-GSGPULRL.js';import {m as m$2,s as s$2}from'./chunk-KR27GOH6.js';import {b as b$3}from'./chunk-V7C4EHK3.js';import {j}from'./chunk-XV7U33XQ.js';import {c as c$3}from'./chunk-XMOSCJOI.js';import {t,s,u,q as q$1,v,k as k$1,i as i$1,o as o$1,r as r$2,p as p$2}from'./chunk-7KLXWCDS.js';import {a as a$2}from'./chunk-ERDARDGB.js';import {f}from'./chunk-HZOD2HOF.js';import {na,p,q,r,t as t$2,u as u$1,v as v$1,qa,s as s$1}from'./chunk-DGIY4SKN.js';import {t as t$1}from'./chunk-SZEGGBOC.js';import {b as b$2,c as c$1,h,i,k,l,m,o,p as p$1,q as q$2,r as r$1,t as t$3}from'./chunk-32ZU4MLE.js';import {a as a$1,b as b$4,c as c$2,e as e$1}from'./chunk-USNXQOMJ.js';import {b as b$1}from'./chunk-6NRQMG26.js';import {useState,useMemo,useDeferredValue}from'react';import {BookOpenTextIcon,PaperclipIcon,ChevronRightIcon,LayersIcon,XIcon,PlusIcon,Unlink2Icon,LoaderCircle,SearchIcon}from'lucide-react';import {Link}from'react-router-dom';import H from'swr';import Qe from'swr/infinite';import {jsxs,Fragment,jsx}from'react/jsx-runtime';var Be=50;function fe({disabled:n,label:l,onClick:o}){return jsxs(b$4,{children:[jsx(c$2,{asChild:true,children:jsx(b$1,{"aria-label":l,className:"fk:size-7 fk:shrink-0",disabled:n,size:"icon",variant:"ghost",onClick:o,children:jsx(Unlink2Icon,{className:"fk:size-4"})})}),jsx(e$1,{children:l})]})}function Xe({api:n$1,attachedIds:l$1,onAttached:o,onOpenChange:a,open:s,projectId:u,target:r,targetLabel:c$2}){let[p,h$2]=useState(""),m=useDeferredValue(p.trim()),[y,f]=useState(null),b$1=(k,K)=>!s||K&&!K.hasMore?null:c(u).sources({limit:Be,offset:k*Be,search:m||void 0}),{data:v,error:w,isLoading:x,setSize:i$2,size:d}=Qe(b$1,b,{keepPreviousData:true}),g=useMemo(()=>r$2(v?.flatMap(k=>k.sources)??[],l$1),[l$1,v]),L=v?.[v.length-1]?.hasMore??false,C=v!==void 0&&d>v.length;async function A(k){f(k.id);try{let K=await n$1.linkSource(k.id,r);qa.success(K.linked?`Attached "${k.title}".`:`"${k.title}" was already attached.`),o(k),a(!1);}catch(K){qa.error(h$1(K,"The document could not be attached."));}finally{f(null);}}let R;return w?R=jsx("p",{className:"fk:py-6 fk:text-center fk:text-sm fk:text-destructive",children:"The documents could not be loaded."}):x&&!v?R=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-3 fk:py-2",children:[jsx(t$1,{className:"fk:h-10 fk:w-full"}),jsx(t$1,{className:"fk:h-10 fk:w-full"}),jsx(t$1,{className:"fk:h-10 fk:w-full"})]}):g.length===0&&!L?R=jsx("p",{className:"fk:py-6 fk:text-center fk:text-sm fk:text-muted-foreground",children:m?"No documents match your search.":"Every document is attached already, or there are none yet. Add documents in Knowledge first."}):R=jsxs("ul",{className:"fk:flex fk:max-h-80 fk:flex-col fk:overflow-y-auto fk:-mx-2",children:[g.map(k=>{let K=k$1(k),B=y===k.id;return jsx("li",{children:jsxs("button",{className:"fk:flex fk:w-full fk:min-w-0 fk:items-center fk:gap-3 fk:rounded-lg fk:px-2 fk:py-2 fk:text-left fk:transition-colors fk:hover:bg-accent fk:focus-visible:bg-accent fk:focus-visible:outline-none fk:disabled:opacity-60 fk:corner-squircle",disabled:y!==null,type:"button",onClick:()=>{A(k);},children:[jsx(m$1,{source:k}),jsxs("span",{className:"fk:min-w-0 fk:flex-1",children:[jsx("span",{className:"fk:block fk:truncate fk:text-sm fk:font-medium",children:k.title}),jsxs("span",{className:"fk:block fk:truncate fk:text-xs fk:text-muted-foreground",children:[i$1(k)," \xB7 ",K.detail]})]}),B?jsx(LoaderCircle,{className:"fk:size-4 fk:shrink-0 fk:animate-spin fk:text-muted-foreground"}):jsx(k$2,{label:K.label,tone:K.tone})]})},k.id)}),L&&!C?jsx("li",{"aria-hidden":true,children:jsx(n,{onVisible:()=>{i$2(k=>k+1);}})}):null,C?jsx("li",{className:"fk:flex fk:justify-center fk:py-2",children:jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin fk:text-muted-foreground"})}):null]}),jsx(c$1,{open:s,onOpenChange:a,children:jsxs(h,{className:"fk:sm:max-w-lg",children:[jsxs(i,{children:[jsx(k,{children:"Attach a document"}),jsx(l,{children:r.recordId===void 0?`Documents attached to every ${c$2} are searched before the rest of Knowledge when a question is about one of them, or about ${c$2} in general.`:`Documents attached to ${c$2} are searched before the rest of Knowledge when a question is about it.`})]}),jsxs("div",{className:"fk:relative",children:[jsx(SearchIcon,{className:"fk:pointer-events-none fk:absolute fk:left-2.5 fk:top-1/2 fk:size-4 fk:-translate-y-1/2 fk:text-muted-foreground"}),jsx(s$1,{"aria-label":"Search documents",autoFocus:true,className:"fk:pl-8",placeholder:"Search documents by title",value:p,onChange:k=>h$2(k.target.value)})]}),R]})})}function re({projectId:n,renderAction:l,sources:o}){return jsx("ul",{className:"fk:flex fk:flex-col fk:gap-1 fk:-mx-2",children:o.map(a=>{let s=k$1(a);return jsxs("li",{className:"fk:flex fk:min-w-0 fk:items-center fk:gap-2 fk:rounded-lg fk:px-2 fk:py-1.5 fk:corner-squircle",children:[jsxs(Link,{className:"fk:flex fk:min-w-0 fk:flex-1 fk:items-center fk:gap-3 fk:rounded-md fk:hover:underline fk:underline-offset-2",to:o$1(n,a.id),children:[jsx(m$1,{source:a}),jsxs("span",{className:"fk:min-w-0 fk:flex-1",children:[jsx("span",{className:"fk:block fk:truncate fk:text-sm fk:font-medium",children:a.title}),jsxs("span",{className:"fk:block fk:truncate fk:text-xs fk:text-muted-foreground",children:[i$1(a)," \xB7 ",s.detail]})]})]}),jsx(k$2,{label:s.label,tone:s.tone}),l?.(a)]},a.id)})})}function yt({entityName:n}){let{api:l,projectId:o}=e(),{currentProject:a$1}=f(),[s$1,u$1]=useState(false),r=t(a$1?.schema??[],n),c$1=!!r&&s(n),{data:p,error:h}=H(o&&c$1?c(o).entitySources(n):null,b);if(!l||!o||!r||!c$1||h instanceof a&&h.status===404)return null;let m=p?.sources.length??0;return jsxs(Fragment,{children:[jsxs(b$1,{"aria-label":`Knowledge for every ${u(r)}`,className:"fk:mr-2 fk:h-8","data-knowledge-entity-button":true,size:"sm",variant:"outline",onClick:()=>u$1(true),children:[jsx(BookOpenTextIcon,{}),"Knowledge",m>0?jsx(b$2,{className:"fk:corner-squircle",variant:"secondary",children:m}):null]}),jsx(Ue,{api:l,entityLabel:u(r),entityName:n,open:s$1,projectId:o,onOpenChange:u$1})]})}function Ue({api:n,entityLabel:l$1,entityName:o,onOpenChange:a,open:s,projectId:u}){let r=b$3(),[c$2,p]=useState(false),[h$2,m]=useState(null),{data:y,error:f,isLoading:b$4,mutate:v}=H(c(u).entitySources(o),b),w=y?.sources??[],x=useMemo(()=>({entity:o}),[o]);async function i$1(g$1){m(g$1.id);try{await n.unlinkSource(g$1.id,x),qa.success(`"${g$1.title}" no longer applies to every ${l$1}.`),await v({sources:w.filter(L=>L.id!==g$1.id)},{revalidate:!1}),g();}catch(L){qa.error(h$1(L,"The document could not be detached."));}finally{m(null);}}let d;return f?d=jsx("p",{className:"fk:text-sm fk:text-destructive",children:"The documents could not be loaded."}):b$4&&!y?d=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t$1,{className:"fk:h-9 fk:w-full"}),jsx(t$1,{className:"fk:h-9 fk:w-2/3"})]}):w.length===0?d=jsxs("p",{className:"fk:text-sm fk:text-muted-foreground",children:["No documents apply to every ",l$1," yet. Attach a guide, a policy or a spec that holds for all of them and the agent searches it first when asked about any ",l$1,", or about ",l$1," in general."]}):d=jsx(re,{projectId:u,sources:w,renderAction:g=>r?jsx(fe,{disabled:h$2!==null,label:`Detach ${g.title}`,onClick:()=>{i$1(g);}}):null}),jsx(c$1,{open:s,onOpenChange:a,children:jsxs(h,{className:"fk:sm:max-w-lg","data-knowledge-entity-dialog":true,children:[jsxs(i,{children:[jsxs(k,{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(BookOpenTextIcon,{className:"fk:size-4 fk:text-muted-foreground"}),"Knowledge for every ",l$1,y?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:w.length}):null]}),jsxs(l,{children:["Documents attached here apply to every ",l$1,"; each record can hold its own on top."]})]}),jsx("div",{className:"fk:max-h-80 fk:overflow-y-auto",children:d}),jsx("div",{className:"fk:flex fk:justify-end",children:jsx(na,{disabled:!r,children:jsxs(b$1,{disabled:!r,size:"sm",variant:"outline",onClick:()=>p(true),children:[jsx(PaperclipIcon,{}),"Attach document"]})})}),jsx(Xe,{api:n,attachedIds:w.map(g=>g.id),open:c$2,projectId:u,target:x,targetLabel:l$1,onAttached:g$1=>{v({sources:w.some(L=>L.id===g$1.id)?w:[...w,g$1]},{revalidate:false}),g();},onOpenChange:p})]})})}function bt({entityName:n,recordId:l,recordLabel:o}){let{api:a$2,projectId:s$1}=e(),{currentProject:u$1}=f(),r$1=b$3(),[c$1,p$1]=useState(false),[h,m]=useState(false),[y,f$1]=useState(null),b$4=useMemo(()=>({entity:n,recordId:l}),[n,l]),v=t(u$1?.schema??[],n),w=v?u(v):n,x=s(n),{data:i,error:d,isLoading:g$1,mutate:L}=H(s$1&&x?c(s$1).recordSources(b$4):null,b);if(!a$2||!s$1||!x||d instanceof a&&d.status===404)return null;let C=i?.sources??[],A=i?.inherited??[],R=C.map(N=>N.id),k=a$2;async function K(N){f$1(N.id);try{await k.unlinkSource(N.id,b$4),qa.success(`Detached "${N.title}".`),await L({sources:C.filter($=>$.id!==N.id),inherited:A},{revalidate:!1}),g();}catch($){qa.error(h$1($,"The document could not be detached."));}finally{f$1(null);}}let B;return d?B=jsx("p",{className:"fk:text-sm fk:text-destructive",children:"The attached documents could not be loaded."}):g$1&&!i?B=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t$1,{className:"fk:h-9 fk:w-full"}),jsx(t$1,{className:"fk:h-9 fk:w-2/3"})]}):B=jsxs("div",{className:"fk:flex fk:flex-col fk:gap-4",children:[C.length===0?jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:A.length>0?"No documents attached to this record itself; the ones below apply to every record of its type.":"No documents attached. Attach a manual, spec or contract and the agent will use it alongside the record's data when asked about this record."}):jsx(re,{projectId:s$1,sources:C,renderAction:N=>r$1?jsx(fe,{disabled:y!==null,label:`Detach ${N.title}`,onClick:()=>{K(N);}}):null}),A.length>0?jsxs("div",{className:"fk:flex fk:flex-col fk:gap-1","data-knowledge-inherited":true,children:[jsxs("span",{className:"fk:text-xs fk:font-medium fk:uppercase fk:tracking-wide fk:text-muted-foreground",children:["Applies to every ",w]}),jsx(re,{projectId:s$1,sources:A})]}):null]}),jsx(a$1,{children:jsxs(p,{className:`fk:z-10 fk:flex fk:shrink-0 fk:flex-col fk:border-t fk:bg-background ${c$1?"fk:h-1/2":""}`,"data-knowledge-record-panel":true,open:c$1,onOpenChange:p$1,children:[jsxs("div",{className:"fk:flex fk:shrink-0 fk:items-center fk:gap-2 fk:pl-4 fk:pr-10 fk:py-2",children:[jsx(q,{asChild:true,children:jsxs("button",{className:"fk:flex fk:min-w-0 fk:flex-1 fk:items-center fk:gap-2 fk:rounded-md fk:py-1 fk:text-left fk:text-sm fk:font-semibold fk:tracking-tight fk:hover:text-foreground/80 fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring",type:"button",children:[jsx(ChevronRightIcon,{className:`fk:size-4 fk:shrink-0 fk:text-muted-foreground fk:transition-transform ${c$1?"fk:rotate-90":""}`}),jsx(BookOpenTextIcon,{className:"fk:size-4 fk:shrink-0 fk:text-muted-foreground"}),"Knowledge",i?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:C.length+A.length}):null]})}),c$1?jsx(na,{disabled:!r$1,children:jsxs(b$1,{disabled:!r$1,size:"sm",variant:"outline",onClick:()=>m(true),children:[jsx(PaperclipIcon,{}),"Attach document"]})}):null]}),jsx(r,{className:"fk:min-h-0 fk:flex-1 fk:overflow-y-auto fk:px-10 fk:pb-6",children:B}),jsx(Xe,{api:a$2,attachedIds:R,open:h,projectId:s$1,target:b$4,targetLabel:o||`this ${n}`,onAttached:N=>{L({sources:C.some($=>$.id===N.id)?C:[...C,N],inherited:A.filter($=>$.id!==N.id)},{revalidate:false}),g();},onOpenChange:m})]})})}function Ze(n,l,o){let{scope:a}=c$3(),s=n.links.map(r=>r.recordId),{data:u}=s$2({entityNamePlural:n.entityPlural,schema:l,scope:a,selection:"display",includeCount:false,variables:{where:{_id:{in:s}},limit:s.length}});return useMemo(()=>{let r={};for(let c of u??[]){let p=c[o.name];typeof p=="string"&&p.trim()&&(r[c._id]=p);}return r},[u,o])}function Ye(n){let{currentProject:l}=f(),o=useMemo(()=>l?.schema??[],[l]),a=m$2(o,n.group.entityPlural),s=a$2(a);return !a||!s?jsx(Je,{...n,entityLabel:a?u(a):n.group.entityPlural,labels:{}}):jsx(et,{...n,displayAttribute:s,schema:o,entityLabel:u(a)})}function et({displayAttribute:n,entityLabel:l,schema:o,...a}){let s=Ze(a.group,o,n);return jsx(Je,{...a,entityLabel:l,labels:s})}function Je({canMutate:n,detachingKey:l,entityLabel:o,group:a,labels:s,onDetach:u}){let r=j();return jsxs("div",{className:"fk:flex fk:flex-col fk:gap-1",children:[jsx("span",{className:"fk:text-xs fk:font-medium fk:uppercase fk:tracking-wide fk:text-muted-foreground",children:o}),jsx("ul",{className:"fk:flex fk:flex-col fk:-mx-2",children:a.links.map(c=>{let p=p$2(c,s[c.recordId]),h=`${c.entity}:${c.recordId}`;return jsxs("li",{className:"fk:flex fk:min-w-0 fk:items-center fk:gap-2 fk:rounded-lg fk:px-2 fk:py-1 fk:corner-squircle",children:[jsx("button",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:text-left fk:text-sm fk:hover:underline fk:underline-offset-2",title:c.recordId,type:"button",onClick:()=>r({type:"EditEntity",payload:{entityId:c.recordId,entityNamePlural:a.entityPlural}}),children:p}),n?jsx(fe,{disabled:l!==null,label:`Detach from ${p}`,onClick:()=>u(c)}):null]},h)})})]})}function vt({api:n,projectId:l,source:o}){let a=b$3(),[s,u$1]=useState(null),{data:r,error:c$1,isLoading:p,mutate:h}=H(c(l).links(o.id),b),m=useMemo(()=>r?.links??[],[r]),y=useMemo(()=>r?.entities??[],[r]),f=useMemo(()=>q$1(m),[m]);async function b$1(i){u$1(`${i.entity}:${i.recordId}`);try{await n.unlinkSource(o.id,{entity:i.entity,recordId:i.recordId}),qa.success("Detached."),await h({links:m.filter(d=>d.entity!==i.entity||d.recordId!==i.recordId),entities:y},{revalidate:!1}),g();}catch(d){qa.error(h$1(d,"The document could not be detached."));}finally{u$1(null);}}async function v(i){u$1(`${i.entity}:*`);try{await n.unlinkSource(o.id,{entity:i.entity}),qa.success("Detached."),await h({links:m,entities:y.filter(d=>d.entity!==i.entity)},{revalidate:!1}),g();}catch(d){qa.error(h$1(d,"The document could not be detached."));}finally{u$1(null);}}async function w(i){u$1(`${i.name}:+`);try{let d=await n.linkSource(o.id,{entity:i.name});qa.success(d.linked?`Applies to every ${u(i)} now.`:`Already applied to every ${u(i)}.`),await h({links:m,entities:y.some(g=>g.entity===i.name)?y:[...y,{entity:i.name,entityPlural:i.plural}]},{revalidate:!1}),g();}catch(d){qa.error(h$1(d,"The document could not be attached."));}finally{u$1(null);}}let x;return c$1?x=jsx("p",{className:"fk:text-sm fk:text-destructive",children:"The linked records could not be loaded."}):p&&!r?x=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t$1,{className:"fk:h-6 fk:w-1/2"}),jsx(t$1,{className:"fk:h-6 fk:w-1/3"})]}):f.length===0?x=jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:'Not attached to any record. Open a record in the Desk and use "Attach document" so the agent searches this document before the rest of Knowledge when asked about that record.'}):x=jsx("div",{className:"fk:flex fk:flex-col fk:gap-4",children:f.map(i=>jsx(Ye,{canMutate:a,detachingKey:s,group:i,onDetach:d=>{b$1(d);}},i.entityPlural))}),jsxs(Fragment,{children:[jsx(tt,{busy:s!==null,canMutate:a,entities:y,isLoading:p&&!r,onAttach:i=>{w(i);},onDetach:i=>{v(i);}}),jsxs("div",{className:"fk:mt-2 fk:flex fk:items-center fk:gap-2",children:[jsx(PaperclipIcon,{className:"fk:size-4 fk:text-muted-foreground"}),jsx("h3",{className:"fk:text-sm fk:font-semibold fk:tracking-tight",children:"Linked records"}),m.length>0?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:m.length}):null]}),jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:"When a question is about one of these records, the agent searches this document before the rest."}),x]})}function tt({busy:n,canMutate:l,entities:o$1,isLoading:a,onAttach:s,onDetach:u$2}){let{currentProject:r}=f(),c=useMemo(()=>r?.schema??[],[r]),[p,h]=useState(false),m$1=useMemo(()=>v(c,o$1),[o$1,c]),y=f=>{let b=t(c,f.entity);return b?u(b):f.entityPlural};return jsxs("div",{className:"fk:flex fk:flex-col fk:gap-3","data-knowledge-applies-to":true,children:[jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(LayersIcon,{className:"fk:size-4 fk:text-muted-foreground"}),jsx("h3",{className:"fk:text-sm fk:font-semibold fk:tracking-tight",children:"Applies to"}),o$1.length>0?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:o$1.length}):null]}),jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:"Attach this document to a whole entity type and the agent searches it before the rest of Knowledge for every record of that type, and for questions about the type in general."}),a?jsx(t$1,{className:"fk:h-7 fk:w-1/3"}):jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-2",children:[o$1.map(f=>{let b=y(f);return jsxs(b$2,{className:"fk:gap-1 fk:py-1 fk:pl-2.5 fk:pr-1 fk:corner-squircle",variant:"secondary",children:[jsx("span",{className:"fk:capitalize",children:b}),l?jsxs(b$4,{children:[jsx(c$2,{asChild:true,children:jsx("button",{"aria-label":`No longer apply to every ${b}`,className:"fk:rounded-sm fk:p-0.5 fk:text-muted-foreground fk:hover:text-foreground fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring fk:disabled:opacity-50",disabled:n,type:"button",onClick:()=>u$2(f),children:jsx(XIcon,{className:"fk:size-3"})})}),jsxs(e$1,{children:["No longer apply to every ",b]})]}):null]},f.entity)}),jsxs(t$2,{open:p,onOpenChange:h,children:[jsx(na,{disabled:!l,children:jsx(u$1,{asChild:true,children:jsxs(b$1,{className:"fk:h-7",disabled:!l||m$1.length===0,size:"sm",variant:"outline",children:[jsx(PlusIcon,{}),"Add entity type"]})})}),jsx(v$1,{align:"start",className:"fk:w-64 fk:p-0",children:jsxs(m,{children:[jsx(o,{placeholder:"Search entity types"}),jsxs(p$1,{children:[jsx(q$2,{children:"No entity type matches."}),jsx(r$1,{children:m$1.map(f=>jsx(t$3,{keywords:[u(f),f.name,f.plural],value:f.name,onSelect:()=>{h(false),s(f);},children:jsx("span",{className:"fk:capitalize",children:u(f)})},f.name))})]})]})})]})]})]})}export{yt as a,bt as b,vt as c};//# sourceMappingURL=chunk-MRHZN4G4.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-MRHZN4G4.js.map
|
package/dist/chunk-NNISUDZX.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {b}from'./chunk-CAZ6EUR2.js';import {b as b$3}from'./chunk-2DXR5NJV.js';import {e,a as a$2,b as b$2}from'./chunk-XV7U33XQ.js';import {g as g$1,b as b$6}from'./chunk-WPCPL2TQ.js';import {Tc,Uc,Vc,$,aa,da,ea,ba,fa,o}from'./chunk-DGIY4SKN.js';import {e as e$1,g,h,j}from'./chunk-SZEGGBOC.js';import {c as c$1,h as h$1,i,k,l,b as b$5}from'./chunk-32ZU4MLE.js';import {a,b as b$4,c,d,e as e$2}from'./chunk-USNXQOMJ.js';import {b as b$1}from'./chunk-6NRQMG26.js';import {a as a$1}from'./chunk-O2QMYUPS.js';import {AlertCircle,X,ChevronDown,ArrowUp,ArrowDown,Star,CircleCheck,CircleX,Check,Copy}from'lucide-react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useRef,useState,useEffect,useCallback,useMemo}from'react';import {useReactTable,getSortedRowModel,getPaginationRowModel,getFilteredRowModel,getCoreRowModel,flexRender}from'@tanstack/react-table';import {useVirtualizer}from'@tanstack/react-virtual';import {gql}from'@apollo/client';import {useMutation}from'@apollo/client/react';import {getText,getSchema,getTextSerializersFromSchema}from'@tiptap/core';import {Node}from'@tiptap/pm/model';import {TiptapLink,TiptapImage,UploadImagesPlugin,TaskList,TaskItem,HorizontalRule,StarterKit,CodeBlockLowlight,Youtube,Twitter,Mathematics,CharacterCount,Placeholder,AIHighlight,TiptapUnderline,HighlightExtension,TextStyle,Color,CustomKeymap,GlobalDragHandle}from'novel';import {Markdown}from'tiptap-markdown';import {cx}from'class-variance-authority';import {createLowlight,common}from'lowlight';import {defaultStyles,FileIcon}from'react-file-icon';import {isValid,format}from'date-fns';function Xr(){return jsxs(Tc,{variant:"destructive",children:[jsx(AlertCircle,{className:"fk:h-4 fk:w-4"}),jsx(Uc,{children:"Project Paused"}),jsxs(Vc,{children:["This project has been paused. To troubleshoot this error, please"," ",jsx("a",{className:"fk:text-blue-500 fk:underline",href:"https://flexkit.io/docs/errors/project-paused",target:"_blank",rel:"noopener noreferrer",children:"follow these steps"}),"."]})]})}function Kr(){let{schemaErrorMessage:e$1}=e();if(!e$1)return jsx(Fragment,{});let[t,n,...r]=e$1.split(`
|
|
2
|
-
`);return jsxs(Tc,{className:"fk:mb-4",variant:"destructive",children:[jsx(AlertCircle,{className:"fk:h-4 fk:w-4"}),jsx(Uc,{children:"Schema mismatch"}),jsxs(Vc,{children:[jsx("p",{children:t}),n?jsx("p",{className:"fk:mt-1",children:n}):null,r.length>0?jsx("ul",{className:"fk:mt-2 fk:list-disc fk:pl-4",children:r.map(o=>jsx("li",{children:o.replace(/^- /,"")},o))}):null]})]})}function lt({scrollHeight:e,scrollTop:t,clientHeight:n}){if(n<=0)return false;let r=t>0?Math.max(600,n):1;return e-t-n<r}var ln=36,cn=15,fn=2,ut=40;function pt(e){if(!e)return;let t=e.split(/\s+/);if(t.includes("fk:h-20"))return 80;if(t.includes("fk:h-10"))return 40;if(t.includes("fk:h-9"))return 36}function un(e,t){return e??pt(t)??ln}function lo({classNames:e$1,columns:t,data:n,entityName:r,hasMore:o=false,initialSelectionState:l,isLoadingMore:s=false,onEntitySelectionChange:b$1,onLoadMore:u,onScroll:k,onSortingChange:S,pageSize:M,rowHeightEstimate:g,rowAdditionState:i,rowDeletionState:T,scrollToTopKey:X,sorting:de,toolbarComponent:j}){let y=useRef(null),{schemaErrorMessage:N}=e(),[C,me]=useState(l??{}),[Ot,Ut]=useState({}),[zt,Bt]=useState([]),[Xt,jt]=useState([]),$t=de??Xt;useEffect(()=>{y.current?.scrollTo({top:0,left:0});},[r,X]),useEffect(()=>{if(!l)return;let a=Object.keys(C).sort().join(","),c=Object.keys(l).sort().join(",");a!==c&&me(l);},[l,C]);function Jt(a){if(S){S(a);return}jt(a);}let V=useReactTable({data:n,columns:t,state:{sorting:$t,columnVisibility:Ot,rowSelection:C,columnFilters:zt},initialState:{pagination:{pageSize:M??50}},enableRowSelection:true,onRowSelectionChange:Kt,onSortingChange:Jt,onColumnFiltersChange:Bt,onColumnVisibilityChange:Ut,getCoreRowModel:getCoreRowModel(),getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),getSortedRowModel:getSortedRowModel(),getRowId:a=>a._id,manualFiltering:true,manualPagination:true,manualSorting:true,meta:{getRowBackground:a=>mn(a,T,i)}}),{rows:$$1}=V.getRowModel(),Pe=un(g,e$1?.row),qt=pt(e$1?.row)!=null,Le=useVirtualizer({count:$$1.length,estimateSize:()=>Pe,getItemKey:a=>$$1[a]?.id??a,getScrollElement:()=>y.current,overscan:cn,scrollMargin:ut}),F=V.getVisibleLeafColumns(),Ie=V.getHeaderGroups(),R=Ie.length===1,K=useVirtualizer({horizontal:true,count:F.length,estimateSize:a=>F[a].getSize(),getItemKey:a=>F[a].id,getScrollElement:()=>y.current,overscan:fn,enabled:R}),Gt=JSON.stringify(F.map(a=>[a.id,a.getSize()]));useEffect(()=>{K.measure();},[Gt,K]);let H=K.getVirtualItems(),W=R?H[0]?.index??0:0,_e=R?(H[H.length-1]?.index??-1)+1:F.length,Y=R?H[0]?.start??0:0,Q=R?Math.max(0,K.getTotalSize()-(H[H.length-1]?.end??0)):0,Ve=Le.getVirtualItems(),{paddingTop:Fe,paddingBottom:He}=dn(Ve,Le.getTotalSize(),ut),pe=useRef(u),Oe=useRef(o),ge=useRef(s);pe.current=u,Oe.current=o,ge.current=s;let ke=useCallback(a=>{if(!pe.current||!Oe.current||ge.current)return;let c=a??y.current;c&<(c)&&(ge.current=true,pe.current());},[]),Ue=b();useEffect(()=>{Ue&&ke();},[ke,$$1.length,o,s,Ue]);function Kt(a){let c=Object.keys(typeof a=="function"?a(C):a);me(a),b$1?.(c);}function Wt(a){k?.(a),ke(a.currentTarget);}return N?jsx(Fragment,{}):jsxs("div",{className:a$1("fk:flex fk:h-full fk:min-h-0 fk:w-full fk:min-w-0 fk:flex-col fk:gap-4",e$1?.wrapper),children:[j&&j(V),jsx("div",{className:"fk:relative fk:min-h-0 fk:min-w-0 fk:flex-1 fk:-mb-px",children:jsx(a,{delayDuration:400,children:jsxs($,{className:a$1("fk:grid fk:pb-20",e$1?.table),"aria-colcount":F.length,style:{minWidth:V.getTotalSize()},containerClassName:e$1?.tableContainer,onScroll:Wt,ref:y,children:[jsx(aa,{className:"fk:sticky fk:top-0 fk:z-20 fk:grid",children:Ie.map(a=>jsxs(da,{className:"fk:flex fk:w-full",children:[Y>0?jsx(le,{width:Y,header:true}):null,(R?a.headers.slice(W,_e):a.headers).map((c,P)=>jsxs(ea,{"aria-colindex":R?W+P+1:void 0,className:a$1("fk:flex fk:shrink-0 fk:items-center",c.column.id==="actions"&&"fk:pl-0"),colSpan:c.colSpan,style:c.getSize()?{width:`${c.getSize().toString()}px`}:{},children:[c.isPlaceholder?null:flexRender(c.column.columnDef.header,c.getContext()),s?jsx("div",{"aria-hidden":true,className:"fk:pointer-events-none fk:absolute fk:top-10.25 fk:right-px fk:left-px fk:z-20 fk:h-0.5 fk:overflow-hidden fk:opacity-4",children:jsx("div",{className:"fk:animate-progress fk:h-full fk:w-full fk:bg-foreground"})}):null]},c.id)),Q>0?jsx(le,{width:Q,header:true}):null]},a.id))}),jsx(ba,{className:"fk:grid fk:relative",children:$$1.length===0?jsx(da,{children:jsx(fa,{className:"fk:h-24 fk:text-center",colSpan:t.length,children:"No results."})}):jsxs(Fragment,{children:[Fe>0?jsx(dt,{height:Fe}):null,Ve.map(a=>{let c=$$1[a.index];return jsxs(da,{className:a$1(V.options.meta.getRowBackground(c),"fk:flex fk:w-full fk:overflow-hidden fk:transition-none",!qt&&g==null&&"fk:h-9",e$1?.row),"data-index":a.index,"data-state":c.getIsSelected()&&"selected",style:{height:`${Pe.toString()}px`},children:[Y>0?jsx(le,{width:Y}):null,c.getVisibleCells().slice(W,_e).map((P,Yt)=>jsx(fa,{className:a$1("fk:flex fk:shrink-0 fk:items-center fk:truncate",P.column.id==="actions"&&"fk:pl-1!"),"aria-colindex":W+Yt+1,style:{width:P.column.getSize()},children:flexRender(P.column.columnDef.cell,P.getContext())},P.id)),Q>0?jsx(le,{width:Q}):null]},a.key)}),He>0?jsx(dt,{height:He}):null]})})]})})})]})}function dn(e,t,n){if(e.length===0)return {paddingTop:0,paddingBottom:0};let r=e[0]?.start??0,o=e[e.length-1]?.end??0;return {paddingTop:Math.max(0,r-n),paddingBottom:Math.max(0,t-(o-n))}}function le({width:e,header:t=false}){return jsx(t?"th":"td",{"aria-hidden":true,style:{width:e,flexShrink:0,padding:0,border:0}})}function dt({height:e}){return jsx("tr",{"aria-hidden":true,className:"fk:pointer-events-none fk:border-0",style:{display:"block",height:`${e.toString()}px`},children:jsx("td",{className:"fk:p-0 fk:border-0"})})}function mn(e,t,n){return t?.includes(e.original._id)?"fk:bg-row-removed fk:hover:bg-row-removed-hover":n?.some(r=>r._id===e.original._id)?"fk:bg-row-added fk:hover:bg-row-added-hover":""}function po({table:e}){let[t]=e.getState().sorting;if(!t)return null;let r=e.getColumn(t.id)?.columnDef.meta?.label??t.id,o=t.desc?"desc":"asc";return jsxs(b$1,{"aria-label":`Clear sorting by ${r}`,className:"fk:h-8 fk:px-2 fk:lg:px-3 fk:text-success fk:border-none",onClick:()=>{e.resetSorting();},size:"sm",variant:"outline",children:["Sorted by ",r," ",o,jsx(X,{className:"fk:ml-1 fk:h-4 fk:w-4"})]})}function So(){let[e,t]=useState(false),[n,r]=useState(gql`
|
|
3
|
-
mutation updateEntity($any: Any) {
|
|
4
|
-
any
|
|
5
|
-
}
|
|
6
|
-
`),[o,l]=useState({}),[s,{data:b,loading:u,error:k}]=useMutation(n,o),S=a$2(k),{isProjectDisabled:M,isProjectReadOnly:g}=(()=>{if(S?.statusCode===403){let i=b$2(S.bodyText);if(i&&typeof i.code=="string"){if(i.code==="PROJECT_PAUSED")return {isProjectDisabled:true,isProjectReadOnly:false};if(i.code==="READ_ONLY_MODE")return {isProjectDisabled:false,isProjectReadOnly:true}}return {isProjectDisabled:true,isProjectReadOnly:false}}return {isProjectDisabled:false,isProjectReadOnly:false}})();return useEffect(()=>{e&&(s(),t(false));},[e,s]),[t,r,l,{data:b,loading:u,error:k,isProjectDisabled:M,isProjectReadOnly:g}]}function Se({column:e,title:t,className:n}){if(!e.getCanSort())return jsx("div",{className:a$1("fk:flex fk:items-center",n),children:t});let r=e.getIsSorted()==="asc",o=e.getIsSorted()==="desc";return jsxs("div",{className:a$1("fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-1",n),children:[jsx("span",{className:"fk:truncate",children:t}),jsxs(e$1,{children:[jsx(g,{asChild:true,children:jsx("button",{"aria-label":`Sort ${t}`,className:"fk:inline-flex fk:shrink-0 fk:items-center fk:justify-center fk:rounded-sm fk:p-0.5 fk:text-muted-foreground fk:outline-hidden fk:hover:bg-accent fk:hover:text-accent-foreground fk:focus-visible:ring-1 fk:focus-visible:ring-ring fk:corner-squircle",type:"button",children:jsx(ChevronDown,{className:"fk:h-3.5 fk:w-3.5"})})}),jsxs(h,{align:"end",className:"fk:w-44",children:[jsxs(j,{"aria-checked":r,className:a$1(r&&"fk:bg-accent fk:text-accent-foreground"),onSelect:()=>{if(r){e.clearSorting();return}e.toggleSorting(false);},role:"menuitemcheckbox",children:[jsx(ArrowUp,{className:a$1("fk:h-4 fk:w-4",r&&"fk:text-white")}),"Sort Ascending"]}),jsxs(j,{"aria-checked":o,className:a$1(o&&"fk:bg-accent fk:text-accent-foreground"),onSelect:()=>{if(o){e.clearSorting();return}e.toggleSorting(true);},role:"menuitemcheckbox",children:[jsx(ArrowDown,{className:a$1("fk:h-4 fk:w-4",o&&"fk:text-white")}),"Sort Descending"]})]})]})]})}function xe({value:e}){return jsx("div",{className:"fk:flex fk:w-full fk:justify-center",children:e?jsx(CircleCheck,{className:"fk:w-4 fk:h-4 fk:text-emerald-500"}):jsx(CircleX,{className:"fk:w-4 fk:h-4 fk:text-muted-foreground"})})}var ht=500,En=3e3;function w({value:e}){let t=useRef(null),n=useRef(null),[r,o]=useState(false),[l,s]=useState(false);useEffect(()=>()=>{n.current&&clearTimeout(n.current);},[]);function b(){let g=t.current;return g?g.scrollWidth>g.clientWidth:false}async function u(g){if(g.preventDefault(),g.stopPropagation(),!!e){try{await navigator.clipboard.writeText(e);}catch{return}o(true),s(true),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{o(false),s(false);},En);}}function k(){b();}function S(g){if(!r){if(g){s(b());return}s(false);}}if(!e)return jsx("div",{className:"fk:truncate"});let M=e.length>ht?`${e.slice(0,ht)}\u2026`:e;return jsxs(b$4,{open:l,onOpenChange:S,children:[jsx(c,{asChild:true,children:jsxs("button",{"aria-label":"Copy value",className:a$1("fk:group/copyable fk:relative fk:flex fk:w-full fk:min-w-0 fk:items-center fk:rounded-sm fk:border-0 fk:bg-transparent fk:px-0.5 fk:-mx-0.5 fk:py-0.5 fk:text-left fk:text-inherit fk:font-inherit fk:corner-squircle","fk:cursor-pointer fk:transition-[transform,background-color] fk:duration-75 fk:ease-out","fk:hover:bg-muted/50 fk:active:translate-y-px fk:active:scale-[0.98] fk:active:bg-muted/70","fk:focus-visible:outline-hidden fk:focus-visible:ring-1 fk:focus-visible:ring-ring"),onClick:u,onPointerEnter:k,type:"button",children:[jsx("span",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:pr-4",ref:t,children:e}),jsx("span",{"aria-hidden":true,className:a$1("fk:pointer-events-none fk:absolute fk:right-0.5 fk:top-1/2 fk:flex fk:-translate-y-1/2 fk:items-center fk:justify-center","fk:rounded-sm fk:bg-muted/80 fk:p-0.5 fk:text-muted-foreground fk:shadow-sm fk:ring-1 fk:ring-border/60 fk:corner-squircle","fk:transition-opacity fk:duration-100",r?"fk:opacity-100 fk:text-foreground":"fk:opacity-0 fk:group-hover/copyable:opacity-100 fk:group-focus-visible/copyable:opacity-100"),children:r?jsx(Check,{className:"fk:size-3"}):jsx(Copy,{className:"fk:size-3"})})]})}),jsx(e$2,{className:"fk:max-w-xs fk:wrap-break-word",children:r?"Copied to clipboard":M})]})}function B({value:e}){let t=typeof e=="object"||Array.isArray(e)?JSON.stringify(e):e;return t=t==="null"||t==null?"":String(t),jsx(w,{value:t})}var Zn=AIHighlight,er=Placeholder,tr=TiptapLink.configure({HTMLAttributes:{class:cx("fk:text-muted-foreground fk:underline fk:underline-offset-[3px] fk:hover:text-primary fk:transition-colors fk:cursor-pointer")}}),nr=Markdown.configure({html:true,tightLists:true,tightListClass:"tight",bulletListMarker:"-",linkify:false,breaks:false,transformPastedText:false,transformCopiedText:false}),rr=TiptapImage.extend({addProseMirrorPlugins(){return [UploadImagesPlugin({imageClass:cx("fk:opacity-40 fk:rounded-lg fk:border fk:border-stone-200 fk:corner-squircle")})]}}).configure({allowBase64:true,HTMLAttributes:{class:cx("fk:rounded-lg fk:border fk:border-muted fk:corner-squircle")}}),or=TaskList.configure({HTMLAttributes:{class:cx("fk:not-prose fk:pl-2 ")}}),ir=TaskItem.configure({HTMLAttributes:{class:cx("fk:flex gap-2 fk:items-start fk:my-2")},nested:true}),ar=HorizontalRule.configure({HTMLAttributes:{class:cx("mt-4 mb-6 border-t border-muted-foreground")}}),sr=StarterKit.configure({bulletList:{HTMLAttributes:{class:cx("fk:list-disc fk:list-outside fk:leading-3 fk:-mt-2")}},orderedList:{HTMLAttributes:{class:cx("fk:list-decimal fk:list-outside fk:leading-3 fk:-mt-2")}},listItem:{HTMLAttributes:{class:cx("fk:leading-normal fk:-mb-2")}},blockquote:{HTMLAttributes:{class:cx("fk:border-l-4 fk:border-primary")}},codeBlock:false,code:{HTMLAttributes:{class:cx("fk:rounded-md fk:bg-muted fk:px-1.5 fk:py-1 fk:font-mono fk:font-medium fk:corner-squircle"),spellcheck:"false"}},horizontalRule:false,dropcursor:{color:"#DBEAFE",width:4},gapcursor:false}),lr=CodeBlockLowlight.configure({lowlight:createLowlight(common)}),cr=Youtube.configure({HTMLAttributes:{class:cx("fk:rounded-lg fk:border fk:border-muted fk:corner-squircle")},inline:false}),fr=Twitter.configure({HTMLAttributes:{class:cx("fk:not-prose")},inline:false}),ur=Mathematics.configure({HTMLAttributes:{class:cx("fk:text-foreground fk:rounded-sm fk:p-1 fk:hover:bg-muted fk:cursor-pointer fk:corner-squircle")},katexOptions:{throwOnError:false}}),dr=CharacterCount.configure(),Tt=[sr,er,tr,rr,or,ir,ar,Zn,lr,cr,fr,ur,dr,TiptapUnderline,nr,HighlightExtension,TextStyle,Color,CustomKeymap,GlobalDragHandle];var ve;function hr(){let e=getSchema(Tt);return {schema:e,textSerializers:getTextSerializersFromSchema(e)}}function yt(e,t=100){if(!e)return "";try{let n=JSON.parse(e);return ve??=hr(),getText(Node.fromJSON(ve.schema,n),{textSerializers:ve.textSerializers}).substring(0,t)}catch{return e.substring(0,t)}}function St({value:e}){let t=useMemo(()=>yt(e),[e]);return jsx(w,{value:t})}var wt=250,xr=25e5,v=new Map,Ce=new Map,Ae=new Set,xt=new Map;function ce(e){if(xt.has(e))return;let t=new Image;t.decoding="async",t.src=e,xt.set(e,t);}function fe(e){let t=v.get(e);t&&v.set(e,{...t,lastUsedAt:Date.now()});}function vr(){if(v.size<=wt)return;let e=Array.from(v.entries()).sort((n,r)=>n[1].lastUsedAt-r[1].lastUsedAt),t=Math.max(1,Math.ceil(wt*.1));for(let n=0;n<t&&n<e.length;n+=1){let[r,o]=e[n];v.delete(r),URL.revokeObjectURL(o.objectUrl);}}async function Cr(e){if(Ae.has(e)){ce(e);return}if(v.has(e)){fe(e);return}let t=Ce.get(e);if(t){await t;return}let n=(async()=>{try{let r=await fetch(e,{mode:"cors",cache:"force-cache"});if(!r.ok){ce(e);return}let o=await r.blob();if(o.size>xr)return;let l=URL.createObjectURL(o);v.set(e,{objectUrl:l,byteSize:o.size,lastUsedAt:Date.now()}),vr();}catch(r){r instanceof TypeError&&Ae.add(e),ce(e);}})();Ce.set(e,n),await n,Ce.delete(e);}function vt(e){let t=useMemo(()=>{if(!e)return null;let o=v.get(e);return o?(fe(e),o.objectUrl):null},[e]),[n,r]=useState(t);return useEffect(()=>{if(!e){r(null);return}if(Ae.has(e)){ce(e),r(null);return}let o=v.get(e);if(o){fe(e),r(o.objectUrl);return}r(null);let l=false;return Cr(e).then(()=>{let s=v.get(e);s&&(l||(fe(e),r(s.objectUrl)));}),()=>{l=true;}},[e]),n}var De="fk:bg-[#fafafa] [--asset-checker:#f0f0f0] [background-image:linear-gradient(45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(-45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(45deg,transparent_75%,var(--asset-checker)_75%),linear-gradient(-45deg,transparent_75%,var(--asset-checker)_75%)] [background-position:0_0,0_4px,4px_-4px,-4px_0px] [background-size:8px_8px] fk:dark:bg-[#222] dark:[--asset-checker:#2a2a2a]";function Ct({value:e}){return Array.isArray(e)?jsx(Mr,{value:e}):jsx(Er,{value:e})}function Er({value:e}){let t=e?.path??"",n=!!t,r=n&&/\.(png|jpe?g|gif|webp|avif|svg)$/i.test(t),o=u=>{let[k]=u.split("?"),S=k.split(".");return S.length>1?S.pop().toLowerCase():"file"},l=n?t.endsWith(".svg")?`${b$6}${t}`:`${b$6}${t}?w=84&h=84&f=webp`:null,s=n?t.endsWith(".svg")?`${b$6}${t}`:`${b$6}${t}?w=624&h=624&f=webp`:"",b=vt(l);return n?jsx("div",{className:"fk:z-10",children:r?jsxs(b$4,{children:[jsx(c,{asChild:true,children:jsx("img",{alt:"asset",className:`fk:w-7 fk:h-7 fk:cursor-zoom-in fk:overflow-hidden fk:rounded-md fk:object-contain ${De} fk:corner-squircle`,decoding:"async",src:b??void 0})}),jsx(d,{children:jsx(e$2,{children:jsx("img",{alt:"asset",className:`fk:w-52 fk:h-52 fk:overflow-hidden fk:rounded-md fk:object-contain ${De} fk:corner-squircle`,decoding:"async",src:s})})})]}):jsxs(b$4,{children:[jsx(c,{asChild:true,children:jsx("div",{className:"fk:w-7 fk:h-7 fk:rounded-sm fk:bg-transparent fk:flex fk:items-center fk:justify-center fk:[&>svg]:h-full fk:[&>svg]:w-auto fk:corner-squircle",children:(()=>{let u=o(t),k=defaultStyles[u];return jsx(FileIcon,{extension:u,...k||{}})})()})}),jsx(d,{children:jsx(e$2,{children:jsx("div",{className:"fk:text-sm fk:text-muted-foreground",children:"Preview not available"})})})]})}):null}function Mr({value:e}){let t=e.filter(o=>!!o.path).slice(0,3),n=Math.max(e[0]?.totalCount??0,e.length);if(t.length===0)return n>0?jsx("div",{className:"fk:flex fk:items-center",children:jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:n===1?"1 asset":`${n} assets`})}):null;let r=n-t.length;return jsxs("div",{className:"fk:flex fk:items-center",children:[jsx("div",{className:"fk:flex fk:-space-x-2",children:t.map(o=>jsx("img",{alt:"asset",className:`fk:h-7 fk:w-7 fk:overflow-hidden fk:rounded-md fk:object-contain ${De} fk:corner-squircle`,decoding:"async",src:`${b$6}${o.path}?w=84&h=84&f=webp`},o._id))}),r>0?jsxs("span",{className:"fk:ml-2 fk:text-xs fk:text-muted-foreground",children:["+",r]}):null]})}function Me({value:e}){if(e==null||e===""||typeof e!="string")return jsx(w,{value:""});let t=new Date(e);if(!isValid(t))return jsx(w,{value:""});let n=format(t,"MMM d, yyyy")+" at "+format(t,"HH:mm");return jsx(w,{value:n})}function Rr(e){return "groupLabel"in e}function Pr(e){return e.flatMap(t=>Rr(t)?t.items:[t])}function Lr(e,t){if(!t)return e;let n=Pr(t).find(r=>String(r.value)===e);return n?n.label:e}function Et({value:e,options:t}){if(e==null)return jsx(w,{value:""});let n=String(e),r=Lr(n,t?.list);return jsx(w,{value:r})}function Nt({value:e}){return !e||!e.split(",").length?null:jsx("div",{className:"fk:flex fk:flex-wrap fk:gap-1 fk:max-w-full truncate",children:e.split(",").map(t=>jsx(b$5,{className:"fk:px-2.5 fk:py-0 fk:font-normal fk:text-[0.6875rem] fk:leading-4",variant:"secondary",children:t},t))})}function Rt(e,t=5){let n=Number.isFinite(t)&&t>=1?Math.floor(t):5,r=typeof e=="string"&&e.trim()!==""?Number(e):e;if(typeof r!="number"||!Number.isFinite(r))return null;let o=Math.min(n,Math.max(0,Math.round(r)));return {filled:o,max:n,label:`${String(o)} out of ${String(n)} stars`}}function Pt({value:e,options:t}){let n=Rt(e,t?.max);return n?jsx("span",{"aria-label":n.label,className:"fk:inline-flex fk:items-center fk:gap-0.5",role:"img",title:n.label,children:Array.from({length:n.max},(r,o)=>jsx(Star,{"aria-hidden":true,className:o<n.filled?"fk:h-3.5 fk:w-3.5 fk:fill-amber-400 fk:text-amber-400":"fk:h-3.5 fk:w-3.5 fk:fill-transparent fk:text-muted-foreground/40",strokeWidth:1.5},o))}):jsx("span",{})}var _r=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function Lt(e){try{let{pathname:t}=new URL(e);return t.split("/").pop()||t}catch{let[t]=e.split("?");return t}}function It(e){return e.originalFilename?e.originalFilename:e.path?e.path:e.url?Lt(e.url):""}function _t(e){let t=It(e),[n]=t.split("?"),r=n.split(".");return r.length>1?r.pop().toLowerCase():"file"}function Vt(e){return e.mimeType?e.mimeType.startsWith("image/"):_r.test(It(e))}function Re(e,t){if(!e||!t||Lt(e).toLowerCase().endsWith(".svg"))return e;let n=new URLSearchParams({f:"webp",h:String(t.height),w:String(t.width)}),r=e.includes("?")?"&":"?";return `${e}${r}${n.toString()}`}var Or=FileIcon,Ft="fk:bg-[#fafafa] [--asset-checker:#f0f0f0] [background-image:linear-gradient(45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(-45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(45deg,transparent_75%,var(--asset-checker)_75%),linear-gradient(-45deg,transparent_75%,var(--asset-checker)_75%)] [background-position:0_0,0_4px,4px_-4px,-4px_0px] [background-size:8px_8px] fk:dark:bg-[#222] dark:[--asset-checker:#2a2a2a]";function Ht({value:e}){let[t,n]=useState(false),r=e?.url??"";if(!e||!r&&!e.path&&!e.originalFilename)return null;if(!(Vt(e)&&!!r)){let u=_t(e),k=defaultStyles[u];return jsx("div",{className:"fk:z-10",children:jsx(a,{children:jsxs(b$4,{children:[jsx(c,{asChild:true,children:jsx("div",{className:"fk:w-7 fk:h-7 fk:rounded-sm fk:bg-transparent fk:flex fk:items-center fk:justify-center fk:[&>svg]:h-full fk:[&>svg]:w-auto fk:corner-squircle",children:jsx(Or,{extension:u,...k||{}})})}),jsx(d,{children:jsx(e$2,{children:jsx("div",{className:"fk:text-sm fk:text-muted-foreground",children:"Preview not available"})})})]})})})}let l$1=Re(r,{width:84,height:84}),s=Re(r,{width:624,height:624});function b(u){u.stopPropagation(),n(true);}return jsx("div",{className:"fk:z-10",children:jsxs(a,{children:[jsxs(b$4,{children:[jsx(c,{asChild:true,children:jsx("img",{src:l$1,alt:"asset",className:`fk:w-12 fk:h-12 fk:cursor-zoom-in fk:overflow-hidden fk:rounded-md fk:object-contain ${Ft} fk:corner-squircle`,onClick:b})}),jsx(d,{children:jsx(e$2,{children:jsx("img",{src:s,alt:"asset",className:`fk:w-52 fk:h-52 fk:overflow-hidden fk:rounded-md fk:object-contain ${Ft} fk:corner-squircle`})})})]}),jsx(c$1,{open:t,onOpenChange:n,children:jsxs(h$1,{className:"fk:sm:max-w-4xl fk:p-3",children:[jsxs(i,{children:[jsx(k,{className:"fk:sr-only",children:"Asset preview"}),jsx(l,{className:"fk:sr-only",children:"Enlarged asset preview"})]}),jsx("img",{src:r,alt:"asset",className:"fk:max-h-[85vh] fk:w-full fk:overflow-hidden fk:rounded-md fk:object-contain fk:corner-squircle"})]})})]})})}var Ur=new Set(["text","number","datetime","switch","select"]);function Xi({attributesSchema:e,checkboxSelect:t,actionsComponent:n,enableColumnSorting:r=false}){let[,o$1]=g$1(),l=b$3(e,o$1.user?.spaces),s={datetime:"datetime",editor:"editor",asset:"asset",number:"text",relationship:"text",select:"select",switch:"boolean",text:"text",textarea:"text"},b={boolean:xe,date:B,datetime:Me,editor:St,asset:Ct,number:B,relationship:B,select:Et,switch:xe,text:B,textarea:B,tags:Nt,rating:Pt,assetPreviewField:Ht},u=l.map(i=>{if(i.name==="_updatedAt")return null;let T=(i.inputType==="relationship"&&i.relationship?.entity==="_asset"?"asset":void 0)??i.previewType??s[i.inputType],X=b[T]??b.text;if(i.hidden===true)return null;let de=T==="tags",j=r&&i.scope==="global"&&Ur.has(i.inputType);return {accessorKey:i.name,filterFn:(y,N,C)=>de?true:(Array.isArray(C)?C:[C]).includes(y.getValue(N)),header:({column:y})=>j?jsx(Se,{column:y,title:i.label}):jsx("div",{className:"fk:flex fk:items-center",children:i.label}),cell:({row:y})=>{let N=X;return T==="select"||T==="rating"?jsx(N,{value:y.getValue(i.name),options:i.options}):T==="assetPreviewField"?jsx(N,{value:y.original}):jsx(N,{value:y.getValue(i.name)})},enableSorting:j,enableHiding:true,meta:{label:i.label},size:i.options?.size??150}}).filter(i=>i!==null),k={id:"actions",cell:({row:i})=>n?n(i):null,size:80},S={accessorKey:"_updatedAt",header:({column:i})=>r?jsx(Se,{column:i,title:"Updated At"}):jsx("div",{className:"fk:flex fk:items-center",children:"Updated At"}),cell:({row:i})=>jsx(Me,{value:i.getValue("_updatedAt")}),enableSorting:r,enableHiding:false,meta:{label:"Updated At"},size:220},M={id:"select",cell:({row:i,table:T})=>jsx(o,{"aria-label":"Select row",checked:i.getIsSelected(),onCheckedChange:X=>{T.toggleAllPageRowsSelected(false),i.toggleSelected(!!X);}}),enableSorting:false,enableHiding:false,size:50},g={id:"select",header:({table:i})=>jsx(o,{className:"fk:dark:bg-white/15","aria-label":"Select all",checked:i.getIsAllPageRowsSelected()||i.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:T=>{i.toggleAllPageRowsSelected(!!T);}}),cell:({row:i})=>jsx(o,{"aria-label":"Select row",checked:i.getIsSelected(),onCheckedChange:T=>{i.toggleSelected(!!T);}}),enableSorting:false,enableHiding:false,size:50};return [...t==="single"?[M]:[],...t==="multiple"?[g]:[],...n?[k]:[],...u,S]}export{Xr as a,Kr as b,lt as c,lo as d,po as e,So as f,Tt as g,It as h,_t as i,Vt as j,Re as k,Se as l,Xi as m};//# sourceMappingURL=chunk-NNISUDZX.js.map
|
|
7
|
-
//# sourceMappingURL=chunk-NNISUDZX.js.map
|
package/dist/chunk-O2QMYUPS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/lib/utils.ts"],"names":["twMerge","extendTailwindMerge","cn","inputs","clsx"],"mappings":"6FAGA,IAAMA,CAAAA,CAAUC,mBAAAA,CAAoB,CAClC,MAAA,CAAQ,IACV,CAAC,CAAA,CAEM,SAASC,CAAAA,CAAAA,GAAMC,CAAAA,CAA8B,CAClD,OAAOH,CAAAA,CAAQI,IAAAA,CAAKD,CAAM,CAAC,CAC7B","file":"chunk-O2QMYUPS.js","sourcesContent":["import { type ClassValue, clsx } from 'clsx';\nimport { extendTailwindMerge } from 'tailwind-merge';\n\nconst twMerge = extendTailwindMerge({\n prefix: 'fk',\n});\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n"]}
|