@nocobase/portal-template-default 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/assets/CoordinateSystem-C8P-Cleg.js +1 -0
  2. package/dist/assets/LegendVisualProvider-Bdgkckq-.js +1 -0
  3. package/dist/assets/LineDraw-iG-ADes-.js +1 -0
  4. package/dist/assets/SymbolDraw-DXoSw1tM.js +1 -0
  5. package/dist/assets/VisualMapping-C_ee4Eht.js +1 -0
  6. package/dist/assets/auth-method-demo-DaOCuvsq.js +1 -0
  7. package/dist/assets/auto-login-provider-5Uxza9Ms.js +2 -0
  8. package/dist/assets/auto-login-provider-DyaPGK2D.js +1 -0
  9. package/dist/assets/auto-redirect-provider-CfwRvYOI.js +1 -0
  10. package/dist/assets/auto-redirect-provider-Cr3jmYts.js +1 -0
  11. package/dist/assets/auto-redirect-provider-QkJQRBbG.js +1 -0
  12. package/dist/assets/calendar-DjDRfD5t.js +1 -0
  13. package/dist/assets/card-DuQBOS6A.js +1 -0
  14. package/dist/assets/cas-sign-in-button-CyqG1QME.js +1 -0
  15. package/dist/assets/components-D-ptYjX_.js +20 -0
  16. package/dist/assets/configuration-gate-C08mkkiX.js +1 -0
  17. package/dist/assets/createClipPathFromCoordSys-wj34-b1B.js +1 -0
  18. package/dist/assets/createSeriesDataSimply-D0A6SAVQ.js +1 -0
  19. package/dist/assets/customGraphicKeyframeAnimation-DWrhrHL_.js +3 -0
  20. package/dist/assets/demo-BYWHeKUe.js +1 -0
  21. package/dist/assets/demo-CPWoNtx8.js +1 -0
  22. package/dist/assets/demo-CyvJk5zV.js +1 -0
  23. package/dist/assets/demo-D4OiKplc.js +1 -0
  24. package/dist/assets/demo-DBueJg0m.js +1 -0
  25. package/dist/assets/demo-DkIhyiRK.js +1 -0
  26. package/dist/assets/demo-tpTjO0sC.js +1 -0
  27. package/dist/assets/dingtalk-sign-in-button-DSWsSruv.js +1 -0
  28. package/dist/assets/echarts-preview-DxHNfq1C.js +1 -0
  29. package/dist/assets/echarts-runtime-D8kXn6ME.js +58 -0
  30. package/dist/assets/echarts-runtime-advanced-QY8v95qK.js +1 -0
  31. package/dist/assets/echarts-runtime-common-D-yqAK-r.js +1 -0
  32. package/dist/assets/echarts-runtime-components-P4-i8jPU.js +1 -0
  33. package/dist/assets/echarts-runtime-hierarchy-ByQZ-DbP.js +1 -0
  34. package/dist/assets/floating-BFVEyPEp.js +15 -0
  35. package/dist/assets/index-BgCbGDMc.js +43 -0
  36. package/dist/assets/index-Btk35Nx-.js +23 -0
  37. package/dist/assets/index-CwNxd66J.js +1 -0
  38. package/dist/assets/index-MB-jfQld.js +686 -0
  39. package/dist/assets/index-NH3aqqQz.css +1 -0
  40. package/dist/assets/index-gFtCXH3o.js +58 -0
  41. package/dist/assets/index-um5hdKdZ.js +23 -0
  42. package/dist/assets/labelHelper-DQqRy3a_.js +1 -0
  43. package/dist/assets/ldap-sign-in-form--6Gt3yGq.js +1 -0
  44. package/dist/assets/nocobase-ai-chat-VTMaZFQB.svg +50 -0
  45. package/dist/assets/oidc-sign-in-button-CQdRcR_p.js +1 -0
  46. package/dist/assets/page-context-CnQ4GYM7.js +73 -0
  47. package/dist/assets/prompt-card-B2RS4nt2.js +1 -0
  48. package/dist/assets/prompt-output-DZHRM2ft.js +1 -0
  49. package/dist/assets/saml-sign-in-button-BHL5a0JV.js +1 -0
  50. package/dist/assets/sectorHelper-DN_Vv6OL.js +1 -0
  51. package/dist/assets/shortcut-C5x5LQWU.js +47 -0
  52. package/dist/assets/sms-sign-in-form-DTX9GV2I.js +1 -0
  53. package/dist/assets/static.browser-jI1psK0d.js +30 -0
  54. package/dist/assets/switch-CRL8PmRI.js +1 -0
  55. package/dist/assets/tool-cards-DFttLAfo.js +40 -0
  56. package/dist/assets/use-authenticator-sign-in-CRGjzXju.js +1 -0
  57. package/dist/assets/use-dingtalk-sign-in-8WYzJ2jf.js +1 -0
  58. package/dist/assets/use-wecom-sign-in-C9j8wfCD.js +1 -0
  59. package/dist/assets/wecom-sign-in-button-mIS1zGSU.js +1 -0
  60. package/dist/favicon.ico +0 -0
  61. package/dist/index.html +40 -0
  62. package/dist/index.raw.html +49 -0
  63. package/dist/logo-dark.png +0 -0
  64. package/dist/logo-mark-dark.png +0 -0
  65. package/dist/logo-mark.png +0 -0
  66. package/dist/logo.png +0 -0
  67. package/package.json +1 -1
@@ -0,0 +1,58 @@
1
+ import{t as U,v as T,j as e,A as G,b as A,w as X,l as Y,m as Z,n as B,o as w,p as ee,q as v,x as se,C as te,k as D,I as k,T as re,B as W,y as ie,z as c,U as q,D as u,P as ne,E as ae,F as oe,G as le}from"./index-MB-jfQld.js";import{C as m,a as h,b as p,c as P,d as x}from"./card-DuQBOS6A.js";import{P as de}from"./prompt-output-DZHRM2ft.js";/**
2
+ * @license lucide-react v0.487.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ce=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]],L=U("layout-panel-top",ce);/**
7
+ * @license lucide-react v0.487.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const me=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],V=U("lock-keyhole",me);/**
12
+ * @license lucide-react v0.487.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const ue=[["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}]],he=U("user-round-cog",ue),O=s=>({resource:s.resource,action:s.action,id:s.id,field:s.field,dataSourceKey:s.dataSourceKey});function pe({children:s,anyOf:t,allOf:r,roles:i,fallback:a=e.jsx(G,{})}){const n=T(),o=!(t!=null&&t.length)||t.some(g=>n(O(g))),f=!(r!=null&&r.length)||r.every(g=>n(O(g)));return n({roles:i})&&o&&f?s:a}function z({children:s,resource:t,action:r,id:i,dataSourceKey:a,fallback:n="hidden"}){return T()({resource:t,action:r,id:i,dataSourceKey:a})?s:n==="hidden"?null:n==="forbidden"?e.jsx(G,{className:"min-h-40"}):n}function C({children:s,resource:t,action:r,field:i,dataSourceKey:a,fallback:n=null}){return T()({resource:t,action:r,field:i,dataSourceKey:a})?s:n}function d({children:s,roles:t,permissions:r={},recordPermissions:i=[]}){const a=A.useMemo(()=>{const n=Array.from(new Set(Object.keys(r).map(l=>l.slice(0,l.lastIndexOf(":"))))),o={status:"ready",permissions:{currentRole:t.length>1?"__union__":t[0],roles:t,roleMode:t.length>1?"allow-use-union":"default",resources:n,actions:r,actionAlias:{list:"list",get:"get",create:"create",update:"update",destroy:"destroy"},snippets:[]}},f=new Map(i.map(l=>[`${l.dataSourceKey??"main"}:${l.resource}:${l.action}:${l.id}`,l.allowed]));return{getState:()=>o,subscribe:()=>()=>{},load:async()=>o,retry:async()=>o,clear:()=>{},recordPermissions:{getState:()=>f,subscribe:()=>()=>{},getPermission:({dataSourceKey:l="main",resource:g,action:J,id:Q})=>f.get(`${l}:${g}:${J}:${Q}`)}}},[r,i,t]);return e.jsx(X,{store:a,children:s})}const xe=[["roles","RoleConstraint","undefined","Checks the current effective roles with anyOf, allOf, and noneOf."],["resource / action","string","undefined","Checks a NocoBase resource action. When roles are also present, both checks must pass."],["id / field","BaseKey / string","undefined","Optionally narrows the decision to one record or field."],["fallback","ReactNode","null","Renders when the access request is denied."]],fe=[["anyOf","AclPermission[]","undefined","Allows the page when any listed permission is available."],["allOf","AclPermission[]","undefined","Requires every listed permission before rendering the page."],["roles","RoleConstraint","undefined","Requires the current effective roles to match anyOf, allOf, and noneOf constraints."],["fallback","ReactNode","AccessDenied","Replaces the complete page when its permission test fails."],["children","ReactNode","required","The protected page content."]],ge=[["resource","string","required","NocoBase collection or ACL resource name."],["action","string","required","Resource action such as list, show, create, edit, or delete."],["id","BaseKey","undefined","Optional record ID for record-scoped permission checks."],["dataSourceKey","string","undefined","Selects a non-main NocoBase data source."],["fallback",'"hidden" | "forbidden" | ReactNode','"hidden"',"Hides the region or replaces it with a local denied state."],["children","ReactNode","required","The protected page region."]],je=[["resource","string","required","NocoBase collection containing the field."],["action","string","required","The action whose field whitelist should be checked."],["field","string","required","Exact NocoBase field name."],["dataSourceKey","string","undefined","Selects a non-main NocoBase data source."],["fallback","ReactNode","null","Optional read-only replacement for a denied field."],["children","ReactNode","required","The protected field or field group."]],be=[["AclStoreProvider","{ store, children }","required","Connects React ACL hooks and components to the application aclStore. The Starter mounts it at the application root."],["useGetRoles","() => QueryResult<string[]>","-","Returns the current effective ACL role names, including all participating roles in union mode."]];function ye(){return e.jsxs("section",{className:"space-y-5 border-t pt-8",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Permission boundaries"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Components behind the patterns"}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Use the smallest boundary that matches the intended user experience: complete page, independent region, or individual field."})]}),e.jsxs("div",{className:"space-y-7",children:[e.jsx(j,{title:"CanAccess",description:"The Starter access boundary for role-only, resource-only, or combined permission checks.",rows:xe}),e.jsx(j,{title:"AclPage",description:"Protects a complete route or business page. This corresponds to the Page permission pattern above.",rows:fe}),e.jsx(j,{title:"AclRegion",description:"Protects one independent area inside a larger page. This corresponds to the Region permission pattern.",rows:ge}),e.jsx(j,{title:"AclField",description:"Protects one field or field group. This corresponds to the Field permission pattern.",rows:je}),e.jsx(j,{title:"ACL context APIs",description:"Read the active role context from the application ACL store. Demo previews use an isolated in-memory store with the same evaluator.",rows:be})]})]})}function j({title:s,description:t,rows:r}){return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:s}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t})]}),e.jsx(m,{className:"gap-0 overflow-hidden py-0",children:e.jsxs(Y,{children:[e.jsx(Z,{children:e.jsxs(B,{children:[e.jsx(w,{children:"Prop"}),e.jsx(w,{children:"Type"}),e.jsx(w,{children:"Default"}),e.jsx(w,{children:"Description"})]})}),e.jsx(ee,{children:r.map(([i,a,n,o])=>e.jsxs(B,{children:[e.jsx(v,{className:"font-mono text-xs font-medium",children:i}),e.jsx(v,{className:"font-mono text-xs text-muted-foreground",children:a}),e.jsx(v,{className:"font-mono text-xs text-muted-foreground",children:n}),e.jsx(v,{className:"min-w-72 whitespace-normal text-muted-foreground",children:o})]},i))})]})})]})}function we({config:s}){const[t,r]=A.useState(s.defaultScene),[i,a]=A.useState(s.defaultTarget),n=A.useMemo(()=>`Build a complete NocoBase ACL scene in the NocoBase Admin Starter.
17
+
18
+ Business scene
19
+ - Page or feature: ${t}
20
+ - Permission target: ${i}
21
+ - Use realistic fixed sample content so the permission behavior is visible immediately.
22
+ - Build the complete page section and user flow, not an isolated ACL snippet.
23
+
24
+ ACL scenario
25
+ ${s.requirements}
26
+
27
+ Implementation contract
28
+ - Use the Starter's built-in NocoBase accessControlProvider and ACL store.
29
+ - NocoBase roles:check is the source of truth. Do not create a second permission store. Use configured role names only when the requirement explicitly includes a role constraint.
30
+ - Import the Starter CanAccess from @/components/access-control/can-access. Use it with AclPage, AclRegion, and AclField for permission presentation. Do not copy their checks into local booleans or role comparisons.
31
+ - Use useGetRoles only when UI needs to display or pass through the current effective ACL roles; it is not a replacement permission evaluator.
32
+ - Keep backend ACL enforcement in place; frontend checks only control presentation and navigation.
33
+ - Import reusable components from the installed local entry point at @/extensions/nocobase-acl when page composition is needed.
34
+ - Resource actions use the application names list, show, create, edit, and delete. Let the Starter map them to NocoBase list/get/create/update/destroy.
35
+ - Preserve dataSourceKey when the collection belongs to a non-main data source.
36
+ - Show an understandable forbidden or hidden state where appropriate.
37
+ - Deliver complete React component code, resource metadata, route integration, and the visible sample UI.`,[s.requirements,t,i]);return e.jsxs("details",{className:"group rounded-xl border bg-muted/15",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium marker:hidden",children:[e.jsx(se,{className:"size-4 text-primary"}),"Prompt generator",e.jsx("span",{className:"ml-auto text-xs font-normal text-muted-foreground",children:s.title}),e.jsx(te,{className:"size-4 text-muted-foreground transition-transform group-open:rotate-180"})]}),e.jsxs("div",{className:"grid items-start gap-5 border-t p-4 xl:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs(m,{className:"gap-0 py-0",children:[e.jsxs(h,{className:"border-b py-4",children:[e.jsx(p,{className:"text-base",children:"Scenario settings"}),e.jsx(P,{children:s.description})]}),e.jsxs(x,{className:"space-y-5 py-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{htmlFor:`${s.title}-scene`,children:"Business scene"}),e.jsx(k,{id:`${s.title}-scene`,value:t,onChange:o=>r(o.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{htmlFor:`${s.title}-target`,children:"Permission target"}),e.jsx(re,{id:`${s.title}-target`,value:i,onChange:o=>a(o.target.value),className:"min-h-24"})]})]})]}),e.jsx(de,{description:"Updates as you change the business scene and permission target.",prompt:n})]})]})}function b({eyebrow:s,title:t,description:r,children:i,prompt:a}){return e.jsxs("section",{className:"space-y-5 border-t pt-8",children:[e.jsxs("div",{children:[e.jsx(W,{variant:"outline",children:s}),e.jsx("h2",{className:"mt-3 text-2xl font-semibold tracking-[-0.025em]",children:t}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-muted-foreground",children:r})]}),i,e.jsx(we,{config:a})]})}const R=[{id:1,name:"Alex Johnson",username:"alex",email:"alex@example.com",phone:"+1 202 555 0148",role:"Administrator"},{id:2,name:"Jamie Chen",username:"jamie",email:"jamie@example.com",phone:"+1 202 555 0186",role:"Member"},{id:3,name:"Morgan Lee",username:"morgan",email:"morgan@example.com",phone:"+1 202 555 0162",role:"Member"}],$={anyOf:["admin"]},ve={"users:list":{},"departments:list":{}},Ne={"users:list":{}},Ae={"users:get":{},"users:create":{},"users:update":{},"users:destroy":{}},ke={"users:get":{},"users:update":{},"users:destroy":{}},Pe=R.flatMap(s=>[{resource:"users",action:"update",id:s.id,allowed:!1},{resource:"users",action:"destroy",id:s.id,allowed:!1}]),Re={"users:update":{fields:["nickname","email","phone"]}},Ce={"users:update":{fields:["nickname"]}};function qe(){return e.jsxs("div",{className:"space-y-10 pb-12",children:[e.jsxs("header",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-[-0.025em] sm:text-3xl",children:"Permission patterns"}),e.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:"Compare the authorized and restricted outcomes of navigation, pages, regions, record actions, and form fields using the same fixed data."})]}),e.jsx(b,{eyebrow:"Navigation permission",title:"Role-restricted routes disappear from navigation",description:"A route outside the current effective role is removed from the sidebar and its direct URL is guarded. Other accessible navigation remains unchanged.",prompt:{title:"Resource navigation",description:"Generate application resources, sidebar behavior, and guarded routes backed by NocoBase collections.",defaultScene:"User and role administration",defaultTarget:"Allow administrators to open Users, but remove it from navigation and block its direct URL for other roles.",requirements:`- Put role constraints on the route resource through meta.acl.roles using anyOf, allOf, or noneOf.
38
+ - Use meta.acl.type = "authenticated" when the route itself is role-controlled and its inner regions perform collection checks.
39
+ - Let the Starter filter inaccessible sidebar items and choose the first accessible default route.
40
+ - Wrap list, create, show, and edit routes with the Starter CanAccess and provide an AccessDenied fallback.
41
+ - Mark non-collection utility pages as authenticated, snippet, route, or acl: false instead of treating them as collections.
42
+ - If a parent route is denied but an accessible child remains, navigation must continue to the child route.`},children:e.jsx(y,{allowedTitle:"Users permission granted",deniedTitle:"Users permission denied",allowed:e.jsx(d,{roles:["admin"],children:e.jsx(E,{})}),denied:e.jsx(d,{roles:["member"],children:e.jsx(E,{})})})}),e.jsx(b,{eyebrow:"Page permission",title:"A complete page is either available or replaced",description:"Page-level permission is useful when the whole route has one business purpose. Denial produces an understandable destination instead of a blank screen.",prompt:{title:"Page permission",description:"Generate a complete page whose availability depends on NocoBase permissions.",defaultScene:"User directory and account administration page",defaultTarget:"Allow administrators and user managers to render the complete page.",requirements:`- Wrap the complete business page with AclPage.
43
+ - Use the AclPage roles prop with anyOf, allOf, or noneOf for page-level role access.
44
+ - Keep anyOf and allOf for resource permissions when the page also needs collection access.
45
+ - Provide a useful page-level fallback instead of rendering an empty screen.
46
+ - Keep each inner data region independently protected when the page combines multiple collections.`},children:e.jsx(y,{allowedTitle:"Page allowed",deniedTitle:"Page denied",allowed:e.jsx(d,{roles:["user-manager"],children:e.jsx(F,{})}),denied:e.jsx(d,{roles:["member"],children:e.jsx(F,{})})})}),e.jsx(b,{eyebrow:"Region permission",title:"Only the protected region changes",description:"On a page with multiple resources, denying Departments hides only that panel and must not affect the Users table.",prompt:{title:"Region permission",description:"Generate a multi-resource page where each region follows its own collection ACL.",defaultScene:"Organization management dashboard",defaultTarget:"Keep Users visible while hiding the denied Departments panel.",requirements:`- Keep the outer page visible when its page-level permission is satisfied.
47
+ - Wrap every collection-backed panel in its own AclRegion.
48
+ - Enable each data query only when the corresponding list permission is allowed.
49
+ - Use fallback="hidden" so denied regions do not reveal unavailable resources or placeholders.
50
+ - Never use permission for one collection to hide unrelated tables or controls.`},children:e.jsx(y,{allowedTitle:"Both regions allowed",deniedTitle:"Departments resource hidden",allowed:e.jsx(d,{roles:["member"],permissions:ve,children:e.jsx(I,{})}),denied:e.jsx(d,{roles:["member"],permissions:Ne,children:e.jsx(I,{})})})}),e.jsx(b,{eyebrow:"Action and record permission",title:"Only unavailable actions are removed",description:"Collection permission controls global actions such as Create. Record ACL metadata controls Edit and Delete for each individual row.",prompt:{title:"Action permission",description:"Generate a data table whose toolbar and row actions respond to collection and record scopes.",defaultScene:"User administration table",defaultTarget:"Allow all actions for one user record and show a view-only row when update and delete are denied.",requirements:`- Use the Starter dataProvider so X-With-ACL-Meta captures NocoBase allowedActions from list, get, and getMany responses.
51
+ - Use the built-in Create, Show, Edit, and Delete buttons; do not manually compare user IDs or role names.
52
+ - Collection-level denial hides the action everywhere.
53
+ - Record-level allowedActions must hide or disable only the affected row action.
54
+ - Keep 403 responses authenticated and let NocoBase perform the final action validation.`},children:e.jsx(y,{allowedTitle:"Create and row actions allowed",deniedTitle:"Create, Update, and Delete denied",allowed:e.jsx(d,{roles:["admin"],permissions:Ae,children:e.jsx(K,{})}),denied:e.jsx(d,{roles:["viewer"],permissions:ke,recordPermissions:Pe,children:e.jsx(K,{})})})}),e.jsx(b,{eyebrow:"Field permission",title:"A form can mix editable, read-only, and hidden fields",description:"Field ACL does not have to hide the complete form. Only protected inputs change, while permitted fields remain usable.",prompt:{title:"Field permission",description:"Generate a form or detail page whose individual fields follow NocoBase field ACL.",defaultScene:"User profile edit form",defaultTarget:"Allow nickname editing, make email read-only, and hide phone when those fields are denied.",requirements:`- Wrap each protected field or field group with AclField.
55
+ - Pass the collection resource, application action, and exact field name.
56
+ - Choose whether a denied field is hidden, replaced by read-only output, or shown with a custom fallback.
57
+ - Do not infer field access from the overall edit permission.
58
+ - Submit only values the current UI is allowed to edit; NocoBase still performs final field validation.`},children:e.jsx(y,{allowedTitle:"All fields editable",deniedTitle:"Email read-only and phone hidden",allowed:e.jsx(d,{roles:["admin"],permissions:Re,children:e.jsx(M,{})}),denied:e.jsx(d,{roles:["member"],permissions:Ce,children:e.jsx(M,{})})})}),e.jsx(ye,{})]})}function y({allowedTitle:s,deniedTitle:t,allowed:r,denied:i}){return e.jsxs("div",{className:"grid items-start gap-5 xl:grid-cols-2",children:[e.jsxs("div",{className:"min-w-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-emerald-700 dark:text-emerald-400",children:[e.jsx(ie,{className:"size-4"}),s]}),r]}),e.jsxs("div",{className:"min-w-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-amber-700 dark:text-amber-400",children:[e.jsx(V,{className:"size-4"}),t]}),i]})]})}function E(){return e.jsxs("div",{className:"grid min-h-48 grid-cols-[150px_minmax(0,1fr)] overflow-hidden rounded-xl border bg-background",children:[e.jsxs("aside",{className:"border-r bg-muted/35 p-3",children:[e.jsx("div",{className:"mb-3 text-xs font-semibold text-muted-foreground",children:"Workspace"}),e.jsx(S,{icon:e.jsx(L,{}),label:"Dashboard"}),e.jsx(c,{roles:$,children:e.jsx(S,{icon:e.jsx(q,{}),label:"Users",active:!0})}),e.jsx(S,{icon:e.jsx(he,{}),label:"Roles"})]}),e.jsx("div",{className:"flex items-center justify-center p-5 text-center",children:e.jsx(c,{roles:$,fallback:e.jsxs("div",{children:[e.jsx(L,{className:"mx-auto size-7 text-muted-foreground"}),e.jsx("div",{className:"mt-2 font-medium",children:"Dashboard"}),e.jsx("div",{className:"mt-1 max-w-48 text-xs text-muted-foreground",children:"Users is absent from navigation and its direct route is guarded."})]}),children:e.jsxs("div",{children:[e.jsx(q,{className:"mx-auto size-7 text-primary"}),e.jsx("div",{className:"mt-2 font-medium",children:"Users"}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Route is available"})]})})})]})}function S({icon:s,label:t,active:r=!1}){return e.jsxs("div",{className:`mb-1 flex items-center gap-2 rounded-md px-2 py-2 text-xs ${r?"bg-primary text-primary-foreground":"text-muted-foreground"}`,children:[e.jsx("span",{className:"[&_svg]:size-3.5",children:s}),t]})}function F(){return e.jsx(pe,{roles:{anyOf:["admin","user-manager"]},fallback:e.jsx(Ue,{}),children:e.jsx(Se,{})})}function Se(){return e.jsxs(m,{children:[e.jsxs(h,{children:[e.jsx(p,{children:"User directory"}),e.jsx(P,{children:"3 users"})]}),e.jsx(x,{children:e.jsx(H,{})})]})}function Ue(){return e.jsx("div",{className:"flex min-h-64 items-center justify-center rounded-xl border border-dashed bg-background p-6 text-center",children:e.jsxs("div",{children:[e.jsx(V,{className:"mx-auto size-8 text-muted-foreground"}),e.jsx("div",{className:"mt-3 font-medium",children:"You cannot open this page"}),e.jsx("p",{className:"mx-auto mt-1 max-w-xs text-sm text-muted-foreground",children:"Ask an administrator for access to the user directory or return to an available page."}),e.jsx(u,{className:"mt-4",variant:"outline",size:"sm",children:"Return to dashboard"})]})})}function I(){return e.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border bg-background p-3 md:flex-row",children:[e.jsx(z,{resource:"users",action:"list",children:e.jsxs(m,{size:"sm",className:"min-w-0 flex-1",children:[e.jsx(h,{children:e.jsx(p,{children:"Users"})}),e.jsx(x,{children:e.jsx(H,{limit:2})})]})}),e.jsx(z,{resource:"departments",action:"list",children:e.jsxs(m,{size:"sm",className:"md:w-56",children:[e.jsx(h,{children:e.jsx(p,{children:"Departments"})}),e.jsxs(x,{className:"space-y-2",children:[e.jsx(_,{title:"Engineering",name:"engineering"}),e.jsx(_,{title:"Operations",name:"operations"})]})]})})]})}function K(){return e.jsxs(m,{children:[e.jsxs(h,{className:"flex-row items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(p,{children:"Users"}),e.jsx(P,{children:"Record actions"})]}),e.jsx(c,{resource:"users",action:"create",children:e.jsxs(u,{size:"sm",children:[e.jsx(ne,{})," New user"]})})]}),e.jsx(x,{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[420px] text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[e.jsx("th",{className:"pb-3 font-medium",children:"User"}),e.jsx("th",{className:"pb-3 font-medium",children:"Role"}),e.jsx("th",{className:"pb-3 text-right font-medium",children:"Actions"})]})}),e.jsx("tbody",{children:R.slice(0,2).map(s=>e.jsxs("tr",{className:"border-b last:border-0",children:[e.jsx("td",{className:"py-3 font-medium",children:s.name}),e.jsx("td",{className:"py-3 text-muted-foreground",children:s.role}),e.jsx("td",{className:"py-3",children:e.jsxs("div",{className:"flex justify-end gap-1",children:[e.jsx(c,{resource:"users",action:"show",id:s.id,children:e.jsx(u,{variant:"ghost",size:"icon-sm","aria-label":"View user",children:e.jsx(ae,{})})}),e.jsx(c,{resource:"users",action:"edit",id:s.id,children:e.jsx(u,{variant:"ghost",size:"icon-sm","aria-label":"Edit user",children:e.jsx(oe,{})})}),e.jsx(c,{resource:"users",action:"delete",id:s.id,children:e.jsx(u,{variant:"ghost",size:"icon-sm","aria-label":"Delete user",children:e.jsx(le,{})})})]})})]},s.id))})]})})]})}function M(){const s=R[1];return e.jsxs(m,{children:[e.jsxs(h,{children:[e.jsx(p,{children:"Edit profile"}),e.jsx(P,{children:s.name})]}),e.jsxs(x,{className:"space-y-4",children:[e.jsx(C,{resource:"users",action:"edit",field:"nickname",children:e.jsx(N,{label:"Nickname",children:e.jsx(k,{defaultValue:s.name})})}),e.jsx(C,{resource:"users",action:"edit",field:"email",fallback:e.jsx(N,{label:"Email",children:e.jsxs("div",{className:"rounded-md border bg-muted/45 px-3 py-2 text-sm text-muted-foreground",children:[s.email,e.jsx(W,{className:"ml-2",variant:"outline",children:"Read only"})]})}),children:e.jsx(N,{label:"Email",children:e.jsx(k,{defaultValue:s.email})})}),e.jsx(C,{resource:"users",action:"edit",field:"phone",children:e.jsx(N,{label:"Phone",children:e.jsx(k,{defaultValue:s.phone})})}),e.jsx(c,{resource:"users",action:"edit",children:e.jsx(u,{size:"sm",children:"Save changes"})})]})]})}function N({label:s,children:t}){return e.jsxs("label",{className:"block space-y-2",children:[e.jsx("span",{className:"text-xs font-medium",children:s}),t]})}function H({limit:s=3}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[360px] text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[e.jsx("th",{className:"pb-3 font-medium",children:"User"}),e.jsx("th",{className:"pb-3 font-medium",children:"Email"})]})}),e.jsx("tbody",{children:R.slice(0,s).map(t=>e.jsxs("tr",{className:"border-b last:border-0",children:[e.jsxs("td",{className:"py-3",children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t.username})]}),e.jsx("td",{className:"py-3 text-muted-foreground",children:t.email})]},t.id))})]})})}function _({title:s,name:t}){return e.jsxs("div",{className:"rounded-lg border px-3 py-2",children:[e.jsx("div",{className:"text-sm font-medium",children:s}),e.jsx("div",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:t})]})}export{qe as AclPatternsPage};
@@ -0,0 +1,23 @@
1
+ import{t as N,bc as j,b as l,j as e,x as f,C as v,k as g,I as w,T as L,bd as C,be as S,B as x,bf as h,bg as k,bh as R,a$ as P}from"./index-MB-jfQld.js";import{C as c,a as d,b as m,c as p,d as u}from"./card-DuQBOS6A.js";import{P as z}from"./prompt-output-DZHRM2ft.js";/**
2
+ * @license lucide-react v0.487.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const B=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],I=N("database",B);function T(){const s=j(),[n,a]=l.useState("A customer support workspace"),[t,i]=l.useState("English and Simplified Chinese"),y=l.useMemo(()=>`Build a complete multilingual scene in the NocoBase Admin Starter.
7
+
8
+ Application scene
9
+ - Product or page: ${n}
10
+ - Supported languages: ${t}
11
+ - Translate the complete visible user flow, including empty, loading, validation, and error states.
12
+
13
+ Implementation contract
14
+ - Use the Starter's @/providers/i18n runtime and the application's translation and locale hooks.
15
+ - Put application-owned React messages in src/locales and register the app namespace through registerTranslationResources from @/lib/i18n.
16
+ - Keep each Registry component's messages in its own namespace and register them with registerLocaleResources().
17
+ - Do not place application messages inside src/extensions/nocobase-i18n/locales because installed Registry files may be refreshed independently.
18
+ - Use the reusable LanguageSwitcher when the page needs an explicit language control; the signed-in user menu already includes one.
19
+ - Reuse the Starter's shared system settings instead of requesting systemSettings:get again.
20
+ - Keep Starter and Registry UI resources local. Use app:getLang only for registered dynamic server namespaces such as lm-collections when the NocoBase i18n Registry is installed.
21
+ - Let the shared NocoBase client send the selected locale through X-Locale.
22
+ - Preserve compatibility when server metadata contains exact {{t("...")}} expressions.
23
+ - Provide complete React components, locale resource files, route/resource integration, and realistic visible content.`,[t,n]);return e.jsxs("details",{open:!0,className:"group rounded-xl border bg-muted/15",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium marker:hidden",children:[e.jsx(f,{className:"size-4 text-primary"}),s("demo.prompt.title",{ns:"nocobase-i18n"},"Prompt generator"),e.jsx(v,{className:"ml-auto size-4 text-muted-foreground transition-transform group-open:rotate-180"})]}),e.jsxs("div",{className:"grid items-start gap-5 border-t p-4 xl:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs(c,{className:"gap-0 py-0",children:[e.jsxs(d,{className:"border-b py-4",children:[e.jsx(m,{className:"text-base",children:s("demo.prompt.settings",{ns:"nocobase-i18n"},"Scene settings")}),e.jsx(p,{children:s("demo.prompt.description",{ns:"nocobase-i18n"},"Describe a complete multilingual application scene and generate an implementation prompt.")})]}),e.jsxs(u,{className:"space-y-5 py-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"i18n-prompt-scene",children:s("demo.prompt.scene",{ns:"nocobase-i18n"},"Application scene")}),e.jsx(w,{id:"i18n-prompt-scene",value:n,onChange:r=>a(r.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"i18n-prompt-languages",children:s("demo.prompt.languages",{ns:"nocobase-i18n"},"Languages")}),e.jsx(L,{id:"i18n-prompt-languages",value:t,onChange:r=>i(r.target.value),className:"min-h-24"})]})]})]}),e.jsx(z,{title:s("demo.prompt.output",{ns:"nocobase-i18n"},"Generated prompt"),description:s("demo.prompt.outputDescription",{ns:"nocobase-i18n"},"Updates as you change the scene and language requirements."),prompt:y,copyLabel:s("demo.prompt.copy",{ns:"nocobase-i18n"},"Copy prompt"),copiedLabel:s("demo.prompt.copied",{ns:"nocobase-i18n"},"Copied"),copyErrorLabel:s("demo.prompt.copyError",{ns:"nocobase-i18n"},"Clipboard access failed. Select the prompt and copy it manually.")})]})]})}function E(){const s=j(),a=C()(),i=S().length>1;return e.jsxs("div",{className:"space-y-10 pb-12",children:[e.jsxs("header",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{variant:"secondary",children:"i18n"}),e.jsx(x,{variant:"outline",children:a})]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-[-0.025em] sm:text-3xl",children:s("demo.title",{ns:"nocobase-i18n"},"Internationalization")}),e.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:s("demo.description",{ns:"nocobase-i18n"},"Optional NocoBase server translations and language controls built on the Starter's internationalization runtime.")})]}),e.jsxs("section",{className:"grid gap-5 xl:grid-cols-3",children:[e.jsxs(c,{children:[e.jsxs(d,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(h,{className:"size-4"}),s("demo.switcher.title",{ns:"nocobase-i18n"},"Language switcher")]}),e.jsx(p,{children:s("demo.switcher.description",{ns:"nocobase-i18n"},"The same reusable component is also integrated into the signed-in user menu.")})]}),e.jsx(u,{children:i?e.jsx(k,{className:"max-w-sm"}):e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border bg-muted/30 p-4",children:[e.jsx(h,{className:"mt-0.5 size-5 shrink-0 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("demo.switcher.unavailable.title",{ns:"nocobase-i18n"},"Only one language is enabled")}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:s("demo.switcher.unavailable.description",{ns:"nocobase-i18n"},"Enable another language in NocoBase system settings to display the switcher.")})]})]})})]}),e.jsx(b,{icon:e.jsx(R,{className:"size-4"}),title:s("demo.frontend.title",{ns:"nocobase-i18n"},"Application UI translations"),description:s("demo.frontend.description",{ns:"nocobase-i18n"},"The Starter provides the runtime while application and Registry components keep their messages in local resource files."),children:e.jsxs("div",{className:"divide-y rounded-lg border",children:[e.jsx(o,{label:s("language.current",{ns:"nocobase-i18n"},"Current language"),value:a}),e.jsx(o,{label:s("demo.frontend.actions",{ns:"nocobase-i18n"},"Common actions"),value:`${s("buttons.apply","Apply")} · ${s("buttons.clear","Clear")}`})]})}),e.jsx(b,{icon:e.jsx(I,{className:"size-4"}),title:s("demo.server.title",{ns:"nocobase-i18n"},"NocoBase metadata translations"),description:s("demo.server.description",{ns:"nocobase-i18n"},"Collection and field labels are loaded from dynamic server namespaces such as lm-collections."),children:e.jsxs("div",{className:"divide-y rounded-lg border",children:[e.jsx(o,{label:"Users",value:s("Users",{ns:"lm-collections"},"Users")}),e.jsx(o,{label:"Nickname",value:s("Nickname",{ns:"lm-collections"},"Nickname")}),e.jsx(o,{label:"X-Locale",value:P.getLocale()??a,code:!0})]})})]}),e.jsx("section",{className:"border-t pt-8",children:e.jsx(T,{})})]})}function o({code:s,label:n,value:a}){return e.jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2.5",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:n}),s?e.jsx("code",{className:"rounded bg-muted px-2 py-1 text-xs",children:a}):e.jsx("span",{className:"text-sm font-medium",children:a})]})}function b({children:s,description:n,icon:a,title:t}){return e.jsxs(c,{children:[e.jsxs(d,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[a,t]}),e.jsx(p,{children:n})]}),e.jsx(u,{className:"text-sm",children:s})]})}export{E as I18nDemoPage};
@@ -0,0 +1 @@
1
+ import{ar as t,H as u}from"./echarts-runtime-D8kXn6ME.js";function o(r,l){var e=r.mapDimensionsAll("defaultedLabel"),a=e.length;if(a===1){var n=t(r,l,e[0]);return n!=null?n+"":null}else if(a){for(var s=[],f=0;f<e.length;f++)s.push(t(r,l,e[f]));return s.join(" ")}}function v(r,l){var e=r.mapDimensionsAll("defaultedLabel");if(!u(l))return l+"";for(var a=[],n=0;n<e.length;n++){var s=r.getDimensionIndex(e[n]);s>=0&&a.push(l[s])}return a.join(" ")}export{o as a,v as g};
@@ -0,0 +1 @@
1
+ import{b as i,j as s,k as l,I as x,b6 as g,D as f}from"./index-MB-jfQld.js";import{u as j}from"./use-authenticator-sign-in-CRGjzXju.js";function w(e){return j(e)}function b({authenticator:e,onSignIn:t}){var o;const[n,c]=i.useState(""),[r,d]=i.useState(""),{signIn:p,isPending:u}=w(e.name),m=((o=e.options)==null?void 0:o.autoSignup)===!0;return s.jsxs("form",{className:"space-y-5",onSubmit:a=>{if(a.preventDefault(),t){t({account:n,password:r});return}p({account:n,password:r})},children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(l,{htmlFor:`${e.name}-ldap-account`,children:"Account"}),s.jsx(x,{id:`${e.name}-ldap-account`,value:n,onChange:a=>c(a.target.value),autoComplete:"username",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(l,{htmlFor:`${e.name}-ldap-password`,children:"Password"}),s.jsx(g,{id:`${e.name}-ldap-password`,value:r,onChange:a=>d(a.target.value),autoComplete:"current-password",required:!0})]}),s.jsx(f,{type:"submit",className:"w-full",disabled:!t&&u,children:!t&&u?"Signing in…":"Sign in"}),m&&s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"An account will be created automatically after the first successful LDAP sign-in."})]})}export{b as default};
@@ -0,0 +1,50 @@
1
+ <svg width="878" height="878" viewBox="0 0 878 878" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_2002_119)">
3
+ <circle cx="439" cy="439" r="439" fill="url(#paint0_linear_2002_119)"/>
4
+ <mask id="mask0_2002_119" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="878" height="878">
5
+ <path d="M0 439C0 196.547 196.547 0 439 0C681.453 0 878 196.547 878 439C878 681.453 681.453 878 439 878C196.547 878 0 681.453 0 439Z" fill="url(#paint1_linear_2002_119)"/>
6
+ </mask>
7
+ <g mask="url(#mask0_2002_119)">
8
+ <path d="M159.539 597.752V635.001C159.539 642.174 57.0002 639.762 57.0002 629.419C57.0002 619.684 57.1917 575.572 57.0002 530.188C34.0374 499.434 34.0374 480.212 52.1937 460.346C70.3489 440.48 199.594 430.547 199.594 430.547C199.594 430.547 209.291 526.913 210.81 553.053C211.42 563.566 218.02 597.752 192.385 597.752H159.539Z" fill="#D1B9F0"/>
9
+ <g style="mix-blend-mode:multiply">
10
+ <path d="M159.501 594.57C138.626 592.216 118.452 585.408 100.258 574.574C100.258 574.574 113.075 606.029 159.501 614.565V594.57Z" fill="#A9A5A5"/>
11
+ </g>
12
+ <path d="M276.491 709.179C286.66 730.543 294.672 765.86 300.524 815.131H-84C-78.1446 765.855 -70.1337 730.537 -59.9672 709.179C-49.8351 687.89 44.1751 646.917 44.1751 646.917C44.1751 646.917 46.0459 628.189 50.5832 625.504C55.1205 622.819 160.537 622.82 165.941 625.504C171.345 628.187 172.35 646.907 172.35 646.907C172.35 646.907 266.379 687.934 276.491 709.179Z" fill="#9066ED"/>
13
+ <path d="M110.043 539.15C102.51 520.344 81.7101 442.202 105.803 442.202C125.737 456.505 137.339 461.708 163.674 433.567C168.878 449.972 179.314 452.938 197.425 455.486L206.888 496.108V446.392C217.781 447.525 226.438 448.753 228.565 441.044C230.692 433.336 216.952 423.763 216.952 423.763C216.952 423.763 237.172 428.326 236.875 417.291C236.578 406.256 216.918 398.121 216.918 398.121C216.918 398.121 240.567 401.572 240.08 385.273C239.595 368.974 120.799 335.204 61.8955 393.059C43.4601 389.953 33.4321 388.948 22.6513 404.113C15.7356 421.257 23.7293 428.994 35.9311 443.119C26.8545 443.818 25.5811 446.238 23.6146 452.927C21.6481 459.617 30.268 472.499 40.1055 483.145C31.7259 488.149 27.5177 488.165 28.5129 496.108C29.5081 504.049 40.2321 507.547 40.2321 507.547L57.9336 531.281V576.013L68.8192 500.923C81.5994 519.66 90.5075 538.781 95.6122 563.173C102.025 593.822 142.911 606.248 183.797 606.248C207.847 606.248 223.079 586.367 211.054 553.233C210.253 556.547 203.358 562.061 190.211 564.001C173.375 566.487 119.663 563.173 110.043 539.15Z" fill="black"/>
14
+ <path d="M110.043 539.15C102.51 520.344 81.7101 442.202 105.803 442.202C125.737 456.505 137.339 461.708 163.674 433.567C168.878 449.972 179.314 452.938 197.425 455.486L206.888 496.108V446.392C217.781 447.525 226.438 448.753 228.565 441.044C230.692 433.336 216.952 423.763 216.952 423.763C216.952 423.763 237.172 428.326 236.875 417.291C236.578 406.256 216.918 398.121 216.918 398.121C216.918 398.121 240.567 401.572 240.08 385.273C239.595 368.974 120.799 335.204 61.8955 393.059C43.4601 389.953 33.4321 388.948 22.6513 404.113C15.7356 421.257 23.7293 428.994 35.9311 443.119C26.8545 443.818 25.5811 446.238 23.6146 452.927C21.6481 459.617 30.268 472.499 40.1055 483.145C31.7259 488.149 27.5177 488.165 28.5129 496.108C29.5081 504.049 40.2321 507.547 40.2321 507.547L57.9336 531.281V576.013L68.8192 500.923C81.5994 519.66 90.5075 538.781 95.6122 563.173C102.025 593.822 142.911 606.248 183.797 606.248C207.847 606.248 223.079 586.367 211.054 553.233C210.253 556.547 203.358 562.061 190.211 564.001C173.375 566.487 119.663 563.173 110.043 539.15Z" fill="#644B85"/>
15
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M196.196 541.84C196.707 542.848 196.33 544.094 195.354 544.622C176.02 555.08 162.648 546.013 158.266 539.686C157.625 538.76 157.832 537.473 158.728 536.81C159.623 536.148 160.87 536.362 161.51 537.287C164.852 542.112 176.106 550.382 193.505 540.97C194.48 540.442 195.685 540.832 196.196 541.84Z" fill="white"/>
16
+ <path d="M800.108 409.771C788.692 373.235 768.964 361 738.848 361C683.204 361 619.222 404.799 623.145 468.797C627.354 537.442 613.508 572.319 594.223 584.629C594.223 584.629 634.771 610.274 714.717 605.851C696.088 590.271 686.276 565.652 685.976 545.035C685.787 532.138 689.398 483.926 689.66 476.918C753.943 480.935 788.097 455.857 788.097 455.857C788.097 455.857 760.834 507.024 764.93 531.742C769.026 556.461 761.872 582.422 759.673 590.727C758.274 596.015 846.798 590.957 852.722 584.629C856.103 581.018 838.5 549.238 836.522 525.644C834.281 498.915 846.908 479.995 842.654 460.314C836.488 431.782 825.643 411.778 800.108 409.771Z" fill="#644B85"/>
17
+ <path d="M682.801 617.325C682.801 602.148 682.303 527.288 682.328 526.023C642.156 532.165 642.969 452.906 683.614 472.3C692.556 478.201 717.755 472.3 715.317 423.396C759.213 472.3 810.176 415.26 814.546 461.74C820.514 525.205 814.511 591.624 776.485 591.629C772.325 591.576 768.177 591.147 764.09 590.344V617.325C764.09 634.189 793.354 642.62 793.354 642.62C793.354 642.62 742.805 692.031 721.82 691.757C700.834 691.484 653.537 642.62 653.537 642.62C653.537 642.62 682.801 634.189 682.801 617.325Z" fill="#D1B9F0"/>
18
+ <g style="mix-blend-mode:multiply">
19
+ <path d="M764.083 590.336C743.914 585.695 724.801 577.049 707.8 564.874C707.8 564.874 721.828 600.443 764.031 607.192L764.083 590.336Z" fill="#9F9F9F"/>
20
+ </g>
21
+ <path d="M873.111 715.2C884.91 752.604 891 866 891 866H556C556 866 562.09 752.604 573.888 715.2C584.225 682.434 652.335 644.813 672.295 634C683.82 652.392 700.336 664.159 723.5 664.159C746.663 664.159 763.18 652.392 774.704 634C794.664 644.813 862.775 682.434 873.111 715.2Z" fill="#E1CBED"/>
22
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M810.507 513.765C823.869 514.972 835.644 504.715 836.808 490.855C837.972 476.995 828.083 464.781 814.721 463.574C801.36 462.367 789.584 472.624 788.42 486.483C787.256 500.343 797.145 512.557 810.507 513.765ZM810.156 517.948C825.744 519.356 839.482 507.39 840.84 491.22C842.198 475.051 830.662 460.8 815.073 459.392C799.484 457.983 785.746 469.95 784.388 486.119C783.03 502.289 794.566 516.539 810.156 517.948Z" fill="white"/>
23
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M742.179 517.072C755.541 518.279 767.317 508.022 768.482 494.163C769.645 480.303 759.757 468.089 746.395 466.881C733.033 465.674 721.257 475.931 720.094 489.791C718.929 503.651 728.817 515.865 742.179 517.072ZM741.828 521.254C757.418 522.663 771.155 510.697 772.513 494.528C773.872 478.357 762.335 464.107 746.746 462.699C731.157 461.29 717.419 473.256 716.061 489.427C714.703 505.596 726.239 519.846 741.828 521.254Z" fill="white"/>
24
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M772.23 484.946C774.285 483.156 776.941 482.285 779.614 482.527C782.288 482.768 784.76 484.102 786.485 486.234C788.212 488.366 789.05 491.121 788.817 493.894L784.785 493.53C784.925 491.866 784.421 490.213 783.386 488.934C782.351 487.655 780.867 486.854 779.263 486.71C777.659 486.565 776.065 487.086 774.832 488.161C773.599 489.235 772.828 490.774 772.688 492.437L768.656 492.073C768.888 489.3 770.173 486.736 772.23 484.946Z" fill="white"/>
25
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M687.49 492.673L718.216 489.656L718.597 493.835L687.872 496.854L687.49 492.673Z" fill="white"/>
26
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M810.507 513.765C823.869 514.972 835.644 504.715 836.808 490.855C837.972 476.995 828.083 464.781 814.721 463.574C801.36 462.367 789.584 472.624 788.42 486.483C787.256 500.343 797.145 512.557 810.507 513.765ZM810.156 517.948C825.744 519.356 839.482 507.39 840.84 491.22C842.198 475.051 830.662 460.8 815.073 459.392C799.484 457.983 785.746 469.95 784.388 486.119C783.03 502.289 794.566 516.539 810.156 517.948Z" fill="white"/>
27
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M742.179 517.072C755.541 518.279 767.317 508.023 768.482 494.164C769.645 480.304 759.757 468.09 746.395 466.882C733.033 465.675 721.257 475.931 720.094 489.791C718.929 503.651 728.817 515.865 742.179 517.072ZM741.828 521.255C757.418 522.663 771.155 510.697 772.513 494.528C773.872 478.358 762.335 464.108 746.746 462.699C731.157 461.29 717.419 473.257 716.061 489.427C714.703 505.596 726.239 519.846 741.828 521.255Z" fill="white"/>
28
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M772.23 484.946C774.285 483.156 776.941 482.285 779.614 482.527C782.288 482.768 784.76 484.102 786.485 486.234C788.212 488.366 789.05 491.121 788.817 493.894L784.785 493.53C784.925 491.866 784.421 490.213 783.386 488.934C782.351 487.655 780.867 486.854 779.263 486.709C777.659 486.565 776.065 487.086 774.832 488.161C773.599 489.235 772.828 490.773 772.688 492.437L768.656 492.073C768.888 489.3 770.173 486.736 772.23 484.946Z" fill="white"/>
29
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M687.49 492.673L718.216 489.656L718.597 493.835L687.872 496.854L687.49 492.673Z" fill="white"/>
30
+ <path d="M612.419 368.971C612.419 437.401 538.694 459.726 496.644 408.286L531.072 546.095C644.606 610.588 726.741 719.073 724.77 755.925L612.419 878L478.386 792.778C189.822 708.017 217.548 527.13 267.481 447.283C259.597 233.536 389.773 220.01 478.386 286.051C579.305 258.412 609.791 329.813 612.419 368.971Z" fill="#644B85"/>
31
+ <path d="M180.406 720.095C162.803 754.212 154 878.494 154 878.494H648.497C648.497 878.494 639.694 754.212 622.091 720.095C595.687 668.921 401.249 603.124 401.249 603.124C401.249 603.124 206.811 668.921 180.406 720.095Z" fill="#E1CBED"/>
32
+ <path d="M343.645 632.11C343.645 632.11 374.877 671.364 403.068 671.364C431.26 671.364 458.867 632.11 458.867 632.11V578.968C464.932 579.932 471.075 580.3 477.211 580.064C534.794 580.06 556.506 495.66 545.284 392.973C538.083 392.973 521.279 392.973 497.275 359.155C503.275 406.258 433.662 399.011 407.258 361.571C420.459 406.258 385.653 436.453 355.647 418.336C296.809 382.81 283.582 491.106 343.645 492.009V632.11Z" fill="#D1B9F0"/>
33
+ <path d="M458.879 578.971C429.101 573.454 400.607 562.396 374.862 546.362C374.862 546.362 404.868 598.295 458.879 598.295V578.971Z" fill="#80728F"/>
34
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M282.556 506.505C282.556 488.239 297.272 473.43 315.425 473.43V467.416C293.972 467.416 276.579 484.918 276.579 506.505C276.579 528.093 293.972 545.595 315.425 545.595C336.878 545.595 354.271 528.093 354.271 506.505C354.271 496.741 349.363 488.796 345.13 481.944C344.751 481.329 344.376 480.723 344.011 480.125L344.005 480.116L342.619 477.86L337.536 481.027L338.918 483.273L338.921 483.277C339.257 483.826 339.592 484.372 339.923 484.913C344.296 492.03 348.294 498.537 348.294 506.505C348.294 524.772 333.578 539.581 315.425 539.581C297.272 539.581 282.556 524.772 282.556 506.505Z" fill="white"/>
35
+ </g>
36
+ </g>
37
+ <defs>
38
+ <linearGradient id="paint0_linear_2002_119" x1="726" y1="116" x2="63" y2="699.5" gradientUnits="userSpaceOnUse">
39
+ <stop stop-color="#9169EB"/>
40
+ <stop offset="1" stop-color="#FBC2EB"/>
41
+ </linearGradient>
42
+ <linearGradient id="paint1_linear_2002_119" x1="101.5" y1="712.5" x2="684.5" y2="81.5" gradientUnits="userSpaceOnUse">
43
+ <stop stop-color="#E6C1DC"/>
44
+ <stop offset="1" stop-color="#8E64EE"/>
45
+ </linearGradient>
46
+ <clipPath id="clip0_2002_119">
47
+ <rect width="878" height="878" fill="white"/>
48
+ </clipPath>
49
+ </defs>
50
+ </svg>
@@ -0,0 +1 @@
1
+ import{aZ as g,b as o,a_ as m,a$ as d,j as t,aT as f,aV as h,aW as x,D as b,b0 as v,r as p}from"./index-MB-jfQld.js";function w(r){const[e]=g(),[i,a]=o.useState(!1),[n,l]=o.useState(),u=o.useMemo(()=>{if(e.get("authenticator")!==r.name)return;const s=e.get("error");return s?new Error(s):void 0},[r.name,e]);return{signIn:o.useCallback(async()=>{l(void 0),a(!0);try{const s=m(e.get("to")||e.get("redirect")||"/"),c=await d.action("oidc","getAuthUrl",{method:"POST",authenticator:r.name,includeRole:!1,withAclMeta:!1,body:{redirect:s}});if(!c)throw new Error("NocoBase did not return an OIDC authorization URL.");window.location.replace(d.resolveUrl(c))}catch(s){l(s instanceof Error?s:new Error("Unable to start OIDC sign-in.")),a(!1)}},[r.name,e]),isPending:i,error:n??u}}function E({authenticator:r,onSignIn:e}){const{signIn:i,isPending:a,error:n}=w(r);return t.jsxs("div",{className:"space-y-3",children:[n&&t.jsxs(f,{variant:"destructive",children:[t.jsx(h,{children:"OIDC sign-in failed"}),t.jsx(x,{children:n.message})]}),t.jsxs(b,{type:"button",variant:"outline",className:"w-full",disabled:!e&&a,onClick:e??i,children:[t.jsx(v,{}),!e&&a?"Redirecting…":p(r.title||r.authTypeTitle||"OIDC")]})]})}export{E as default};
@@ -0,0 +1,73 @@
1
+ import{aI as E,b as t,j as e,k as i,I as y,T as U,d as k,e as N,f as C,g as S,i as l,Y as F,$ as ce,a0 as de,a1 as me,_ as ue,aJ as M,B as b,K as $,N as B,a4 as D,aL as _,aK as J,aP as he,aQ as xe,D as pe,aR as ge}from"./index-MB-jfQld.js";import{C as j,a as A,b as T,d as P}from"./card-DuQBOS6A.js";import{A as je}from"./configuration-gate-C08mkkiX.js";import{S as fe}from"./switch-CRL8PmRI.js";import{P as ve}from"./prompt-card-B2RS4nt2.js";import"./prompt-output-DZHRM2ft.js";function ye(n,r){for(const[o,c]of Object.entries(r)){const u=o;n.setValue(u,c,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}}const be=n=>!["nathan","dara"].includes(n.toLowerCase());function we(){var Y,X;const{employees:n}=E(),r=n.filter(a=>be(a.username)),[o,c]=t.useState(((Y=r[0])==null?void 0:Y.username)??((X=n[0])==null?void 0:X.username)??""),[u,d]=t.useState("Customer renewal workspace"),[p,g]=t.useState("Show a customer renewal detail with account health, contract value, renewal date, owner, recent activity, and a working AI conversation beside it."),[m,f]=t.useState("Review renewal risk"),[s,I]=t.useState("Review this customer renewal, identify risks, and recommend the next action."),[h,v]=t.useState(!1),[w,K]=t.useState("shortcut"),[x,z]=t.useState("renewal-detail"),[V,ee]=t.useState("Customer renewal detail"),[q,te]=t.useState("context"),[H,se]=t.useState("update_renewal_plan"),[O,ae]=t.useState("Update the renewal risk level and the visible follow-up note on the page."),[W,ne]=t.useState("ASK"),re=t.useMemo(()=>{var Z;const a=((Z=n.find(le=>le.username===o))==null?void 0:Z.nickname)??o,Q=`{ type: "page-element", id: "${x}", title: "${V}" }`,G=w==="manual"?!1:h,oe={shortcut:`Place an AIEmployeeShortcut in the page header, visually separated from the registered business element. Target the embedded chat controller and configure this task on its tasks prop:
2
+ - Title: ${m}
3
+ - User message: ${s}
4
+ - Auto send: ${G}
5
+ - Set task.message.workContext to [${Q}].
6
+
7
+ The Shortcut must remain outside the registered element so the scene clearly demonstrates an explicit task-to-context reference.`,preset:`Do not render an AIEmployeeShortcut. Configure AIChatProvider.employeeTasks for ${a} (${o}) and show this task in the embedded conversation empty state:
8
+ - Title: ${m}
9
+ - User message: ${s}
10
+ - Auto send: ${G}
11
+ - Set task.message.workContext to [${Q}].
12
+
13
+ The task should disappear after a conversation starts and must resolve the latest page values when triggered.`,scope:`Place an AIEmployeeShortcut in the scene header and wrap both the business work area and chat surface with:
14
+
15
+ <AIPageContextScope context={${Q}}>
16
+ {/* Complete business scene and conversation */}
17
+ </AIPageContextScope>
18
+
19
+ Configure the Shortcut task without message.workContext so it inherits the surrounding context. Keep the registered element and task visibly within the same scoped scene.`,manual:`Do not pre-attach workContext to a Shortcut or preset task. Add a "Pick page element" composer action using useAIPageElementPicker. When the user selects an element, call addWorkContext(item) and focusComposer().
20
+
21
+ Show "${s}" as a suggested prompt near the chat, but keep it in the composer for review. The user must pick context manually before sending, so this scene must not auto-send.`}[w],ie={context:"Build the primary work area as a polished, read-only business detail view based on the scene brief. Include at least five realistic fields, a status indicator, and a short recent-activity section. Register the complete detail region with useAIPageElementHandle and return its current serializable values from getContext. Reuse handle.ref on the visible element and handle.context wherever the scene needs a context reference.","form-filler":`Build the primary work area with two connected parts: realistic source material and an editable business form derived from the scene brief. Use React Hook Form and register the form with useAIForm using id "${x}", meaningful field definitions, getValues, and setValues.
22
+
23
+ Use the fixed built-in formFiller Tool. Do not register Form filler as a custom frontend Tool and do not add formFiller manually to task.skillSettings: the Registry activates it automatically when a registered form context is sent. The Tool may fill declared editable values only and must never submit or save the form. Include a visible reset action and import applyReactHookFormValues from the optional adapters/react-hook-form Registry item for setValues.`,"custom-tool":`Register a custom frontend Tool on the useAIPageElement descriptor:
24
+ - Name: ${H}
25
+ - Business action: ${O}
26
+ - Permission: ${W}
27
+ - Provide a concise description, JSON inputSchema, and execute(args).
28
+
29
+ Build visible state in the business work area that clearly changes when this Tool succeeds, including before/after values or a status/note update. Keep it separate from the fixed formFiller Tool. The execute function must update only the current React page state and return a serializable result. NocoBase runtime handles ASK / ALLOW execution behavior.
30
+ `}[q];return`Build a complete, self-contained NocoBase AI page-context scene.
31
+
32
+ Scene
33
+ - Title: ${u}
34
+ - Business brief: ${p}
35
+ - Create a dedicated demo page or scene component rather than adding an isolated integration snippet to an unspecified page.
36
+ - Use realistic fixed sample data so the scene works immediately without additional backend setup.
37
+ - Add a clear page header, a primary business work area, and an embedded AI conversation in a responsive two-column layout. Stack the conversation below the work area on smaller screens.
38
+ - Keep one AIChatProvider mounted for the entire scene and target the same chat controller from any Shortcut.
39
+
40
+ AI employee and task
41
+ - Employee: ${a} (${o})
42
+ - Task: ${m}
43
+ - Message: ${s}
44
+ - Auto send: ${G}
45
+
46
+ Business context
47
+ - Context id: ${x}
48
+ - Context title: ${V}
49
+ - Register a visible, meaningful business element with this stable id.
50
+ - Resolve its content at task or message send time so the AI always receives the latest displayed values.
51
+ - Prefer useAIPageElementHandle so the registered ref and context reference cannot drift apart.
52
+
53
+ AI interaction pattern
54
+ ${oe}
55
+
56
+ Business surface and capability
57
+ ${ie}
58
+
59
+ Implementation requirements
60
+ - Use AIProvider and AIPageElementProvider from the NocoBase AI Registry.
61
+ - Use AIChatProvider, ChatInline, AIChatWindow, and useAIChatController to create the working conversation beside the business surface.
62
+ - The finished result must demonstrate the entire user journey: inspect or edit the business surface, trigger or compose the AI request, see the selected context, and observe the response or page update.
63
+ - Keep page context serializable. Never pass React instances, DOM nodes, form instances, or callback functions to the backend.
64
+ - Public React APIs use context id, not Flow Model uid.
65
+ - Page-context resolution errors must block sending and remain visible to the user; do not silently send an unresolved reference.
66
+ - Explicit task message.workContext takes precedence over trigger context and AIPageContextScope.
67
+ - A task without explicit context inherits the surrounding scope.
68
+ - Manual Pick affects only the current composed message.
69
+ - Preserve NocoBase streaming, conversation history, Tool approval, and resume behavior.
70
+ - Use shadcn/Base UI components and the existing Registry components.
71
+ - Deliver the complete component code, including sample state, context registration, task configuration, chat layout, and all visible business UI.`},[h,q,x,V,o,n,w,p,u,s,m,O,H,W]);return e.jsxs("div",{className:"grid items-start gap-5 xl:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs(j,{className:"gap-0 py-0",children:[e.jsx(A,{className:"border-b py-4",children:e.jsx(T,{children:"Scene settings"})}),e.jsxs(P,{className:"space-y-5 py-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-scene-title",children:"Scene title"}),e.jsx(y,{id:"context-generator-scene-title",value:u,onChange:a=>d(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-scene-brief",children:"Business scene"}),e.jsx(U,{id:"context-generator-scene-brief",value:p,onChange:a=>g(a.target.value),className:"min-h-28"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"AI employee"}),e.jsxs(k,{value:o,onValueChange:a=>a&&c(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsx(S,{children:(r.length?r:n).map(a=>e.jsx(l,{value:a.username,children:a.nickname},a.username))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-task-title",children:"Task title"}),e.jsx(y,{id:"context-generator-task-title",value:m,onChange:a=>f(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-task-message",children:"Task message"}),e.jsx(U,{id:"context-generator-task-message",value:s,onChange:a=>I(a.target.value),className:"min-h-24"})]}),e.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border px-3 py-2.5",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Auto send"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Otherwise fill the composer for review."})]}),e.jsx(fe,{checked:w==="manual"?!1:h,disabled:w==="manual",onCheckedChange:v})]}),w==="manual"?e.jsx("p",{className:"-mt-3 text-xs leading-5 text-muted-foreground",children:"Manual Pick keeps the message in the composer so context can be selected before sending."}):null,e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Context integration"}),e.jsxs(k,{value:w,onValueChange:a=>a&&K(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"shortcut",children:"Shortcut task"}),e.jsx(l,{value:"preset",children:"Conversation preset task"}),e.jsx(l,{value:"scope",children:"Scope inheritance"}),e.jsx(l,{value:"manual",children:"Manual Pick"})]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-1",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-id",children:"Context id"}),e.jsx(y,{id:"context-generator-id",value:x,onChange:a=>z(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-title",children:"Context title"}),e.jsx(y,{id:"context-generator-title",value:V,onChange:a=>ee(a.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Page capability"}),e.jsxs(k,{value:q,onValueChange:a=>a&&te(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"context",children:"Context only"}),e.jsx(l,{value:"form-filler",children:"Built-in Form filler"}),e.jsx(l,{value:"custom-tool",children:"Custom frontend Tool"})]})]})]}),q==="custom-tool"?e.jsxs("div",{className:"space-y-4 rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-tool-name",children:"Tool name"}),e.jsx(y,{id:"context-generator-tool-name",value:H,onChange:a=>se(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-tool-action",children:"Business action"}),e.jsx(U,{id:"context-generator-tool-action",value:O,onChange:a=>ae(a.target.value),className:"min-h-20"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Permission"}),e.jsxs(k,{value:W,onValueChange:a=>a&&ne(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"ASK",children:"ASK"}),e.jsx(l,{value:"ALLOW",children:"ALLOW"})]})]})]})]}):null]})]}),e.jsx(ve,{title:"Complete page context scene prompt",description:"Copy this prompt to generate the business page, AI interaction, context binding, and working conversation as one complete scene.",prompt:re})]})}function ke(){return e.jsx(F,{id:"page-element-demo",children:e.jsx(Ne,{})})}function Ne(){const[n,r]=t.useState("Northwind Studio"),[o,c]=t.useState("ops@northwind.test"),[u,d]=t.useState("high"),[p,g]=t.useState(!1),{id:m,addWorkContext:f,focusComposer:s}=ce(),{registeredCount:I,startPicking:h}=de(),v=t.useMemo(()=>[{key:"pick-page-element",label:"Pick page element",icon:e.jsx(me,{}),disabled:I===0,onClick:()=>h({chatId:m,onSelect:x=>{f(x),s()}})},{key:"web-search",label:"Web search",icon:e.jsx(ue,{}),active:p,onClick:()=>g(x=>!x)}],[f,m,s,I,h,p]),w=M({id:"customer-intake-form",title:"Customer intake form",kind:"form",getContext:()=>({form:"customer-intake",values:{customerName:n,contactEmail:o,priority:u}})}),K=M({id:"customer-health-summary",title:"Customer health summary",kind:"record-detail",getContext:()=>({resource:"customers",record:{name:n,plan:"Enterprise",healthScore:86,openRequests:3,renewalDate:"2026-09-30"}})});return e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] lg:grid-cols-[minmax(0,1fr)_390px]",children:[e.jsxs("div",{className:"space-y-4 bg-muted/15 p-4 sm:p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Customer workspace"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"The form and detail card are registered page elements."})]}),e.jsx(b,{variant:"outline",children:"2 selectable elements"})]}),e.jsxs(j,{ref:w,className:"transition-shadow",children:[e.jsxs(A,{children:[e.jsx(T,{children:"Customer intake form"}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"Update a value, then pick this form to capture its current state."})]}),e.jsxs(P,{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[e.jsx(i,{htmlFor:"page-context-customer-name",children:"Customer name"}),e.jsx(y,{id:"page-context-customer-name",value:n,onChange:x=>r(x.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"page-context-contact-email",children:"Contact email"}),e.jsx(y,{id:"page-context-contact-email",value:o,onChange:x=>c(x.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Priority"}),e.jsxs(k,{value:u,onValueChange:x=>x&&d(x),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"normal",children:"Normal"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]}),e.jsxs(j,{ref:K,className:"transition-shadow",children:[e.jsx(A,{children:e.jsx(T,{children:"Customer health summary"})}),e.jsx(P,{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[["Plan","Enterprise"],["Health score","86 / 100"],["Open requests","3"],["Renewal","Sep 30, 2026"]].map(([x,z])=>e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:x}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:z})]},x))})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card lg:border-l lg:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{composerActions:v,showConversationToggle:!1,enableAttachments:!0,attachmentActionIndex:1,disclaimer:!1})})})]})})}const L=n=>!["nathan","dara"].includes(n.username.toLowerCase());function Le(){return e.jsx(je,{children:e.jsx(Ce,{})})}function Ce(){return e.jsxs("div",{className:"space-y-12 pb-12",children:[e.jsx("section",{className:"flex flex-wrap items-start justify-between gap-5 border-b pb-8",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"secondary",children:"AI Components"}),e.jsx(b,{variant:"outline",children:"Conversation context"})]}),e.jsx("h1",{className:"mt-4 text-3xl font-semibold tracking-[-0.035em]",children:"Page context and frontend tools"}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Connect AI employees to live React page state. Start with manual context selection, configure task context, then expose fixed or custom frontend capabilities that can safely update the page."})]})}),e.jsx(R,{eyebrow:"Manual context",title:"Pick page context while composing a message",description:"The user can pick any registered page element from the composer. Its current content is added to this message without changing task configuration.",children:e.jsx(ke,{})}),e.jsx(R,{eyebrow:"Task context · Shortcut",title:"Reference page context from a Shortcut task",description:"The Shortcut task stores a page-element reference in message.workContext and reads its latest content when the user starts the task.",children:e.jsx(Te,{})}),e.jsx(R,{eyebrow:"Task context · Conversation preset",title:"Reference page context from a conversation preset task",description:"The AIChatProvider employeeTasks configuration uses the same message.workContext reference, but exposes the task in the conversation empty state instead of through a Shortcut.",children:e.jsx(Pe,{})}),e.jsx(R,{eyebrow:"Task context · Scope inheritance",title:"Inherit the surrounding page context",description:"A Shortcut or AIChatProvider inside AIPageContextScope inherits that context. A task-level message.workContext still takes precedence when configured.",children:e.jsx(Ie,{})}),e.jsx(R,{eyebrow:"Built-in frontend tool",title:"Fill a registered React form with Form filler",description:"Form filler is registered once by AIProvider. The form exposes its identifier, field schema, live values, and setter through useAIForm; it is not part of the custom frontend Tool catalog.",children:e.jsx(Se,{})}),e.jsx(R,{eyebrow:"Custom frontend tool",title:"Expose a page-specific action to the AI employee",description:"A registered page element can advertise custom Tools through the NocoBase loadFrontendTool and executeFrontendTool protocol. The example uses ASK permission and updates only the local quote preview.",children:e.jsx(Ae,{})}),e.jsx(R,{eyebrow:"Prompt generator",title:"Generate a complete page context scene",description:"Describe the business scene, select the AI employee and task, then generate the full page surface, context binding, conversation layout, and optional frontend capability together.",children:e.jsx(we,{})})]})}function Se(){const{employees:n}=E(),r=n.find(s=>s.username==="form_assistant")??n.find(s=>s.username.toLowerCase()==="dex")??n.filter(L)[0],o=D(),[c,u]=t.useState("Acme Logistics is evaluating the enterprise plan. The main contact is Jordan Lee at jordan.lee@acme.test. This is a high-priority opportunity."),d=he({defaultValues:{company:"",contactName:"",email:"",priority:"normal"}}),p=t.useMemo(()=>[{name:"company",title:"Company",type:"string",required:!0},{name:"contactName",title:"Contact name",type:"string",required:!0},{name:"email",title:"Email",type:"email"},{name:"priority",title:"Priority",type:"string",enum:["low","normal","high"]}],[]),g=xe({id:"lead-intake-form",title:"Lead intake form",fields:p,getValues:d.getValues,setValues:s=>ye(d,s)}),m=t.useMemo(()=>({type:"page-element",id:"lead-intake-form",title:"Lead intake form",kind:"form"}),[]),f=t.useMemo(()=>({title:"Fill lead form",message:{user:`Extract the lead details from the following text and fill the current form. Do not submit it.
72
+
73
+ ${c}`},autoSend:!0}),[c]);return e.jsx(J,{context:m,children:e.jsx(F,{id:"form-filler-context-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[610px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsxs("div",{className:"space-y-5 bg-muted/15 p-4 sm:p-5",children:[e.jsxs(j,{children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Source content"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"Edit this text, then ask the AI employee to fill the registered form below."})]}),e.jsx(_,{aiEmployee:r.username,target:o,tasks:[f],label:`Ask ${r.nickname}`,size:34})]})}),e.jsx(P,{children:e.jsx(U,{value:c,onChange:s=>u(s.target.value),className:"min-h-28"})})]}),e.jsxs("form",{ref:g,className:"rounded-xl border bg-card",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 border-b p-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Lead intake form"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Form filler changes visible values only. It never submits the form."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"secondary",children:"useAIForm"}),e.jsx(pe,{type:"button",variant:"outline",size:"sm",onClick:()=>d.reset({company:"",contactName:"",email:"",priority:"normal"}),children:"Clear"})]})]}),e.jsxs("div",{className:"grid gap-4 p-5 sm:grid-cols-2",children:[e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-company",children:"Company"}),e.jsx(y,{id:"form-filler-company",...d.register("company")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-contact",children:"Contact name"}),e.jsx(y,{id:"form-filler-contact",...d.register("contactName")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-email",children:"Email"}),e.jsx(y,{id:"form-filler-email",type:"email",...d.register("email")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{children:"Priority"}),e.jsxs(k,{value:d.watch("priority"),onValueChange:s=>s&&d.setValue("priority",s,{shouldDirty:!0,shouldTouch:!0}),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"normal",children:"Normal"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[610px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function Ae(){const{employees:n}=E(),r=n.filter(L)[0],o=D(),[c,u]=t.useState(0),[d,p]=t.useState("Not reviewed"),g=24e3,m=g*(1-c/100),f=t.useMemo(()=>[{name:"update_quote_discount",title:"Update quote discount",description:"Update the discount percentage and review note shown on the current quote. This changes the page preview only and does not save the quote.",permission:"ASK",inputSchema:{type:"object",properties:{discountPercent:{type:"number",minimum:0,maximum:30,description:"Discount percentage applied to the quote."},note:{type:"string",description:"Short explanation shown in the review note."}},required:["discountPercent","note"],additionalProperties:!1},execute:h=>{const v=h&&typeof h=="object"&&!Array.isArray(h)?h:{};return typeof v.discountPercent!="number"||v.discountPercent<0||v.discountPercent>30||typeof v.note!="string"?{status:"error",content:"Provide a discount from 0 to 30 and a review note."}:(u(v.discountPercent),p(v.note),{status:"success",content:`Updated the quote preview to a ${v.discountPercent}% discount.`})}}],[]),s=ge({id:"quote-review-card",title:"Quote review",kind:"record-detail",tools:f,getContext:()=>({resource:"quotes",record:{quoteNumber:"QT-2026-1048",customer:"Northwind Studio",baseAmount:g,discountPercent:c,total:m,approvalNote:d}})}),I=t.useMemo(()=>({title:"Apply review discount",message:{user:"Update the current quote preview to use a 12% discount and set the review note to 'Approved for the renewal discussion'."},autoSend:!0}),[]);return e.jsx(J,{context:s.context,children:e.jsx(F,{id:"custom-frontend-tool-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:s.ref,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Quote review"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"QT-2026-1048 · Northwind Studio"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"outline",children:"Custom Tool"}),e.jsx(b,{variant:"secondary",children:"ASK"})]})]})}),e.jsxs(P,{className:"space-y-5",children:[e.jsx("div",{className:"grid gap-3 sm:grid-cols-3",children:[["Base amount",`$${g.toLocaleString()}`],["Discount",`${c}%`],["Preview total",`$${m.toLocaleString()}`]].map(([h,v])=>e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:h}),e.jsx("div",{className:"mt-1 font-medium",children:v})]},h))}),e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Review note"}),e.jsx("div",{className:"mt-1 text-sm",children:d})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t pt-4",children:[e.jsx("p",{className:"max-w-lg text-xs leading-5 text-muted-foreground",children:"The page element registers update_quote_discount. Its full input schema is loaded only when the AI chooses this Tool. Approval is controlled by the ASK permission."}),e.jsx(_,{aiEmployee:r.username,target:o,tasks:[I],label:`Ask ${r.nickname}`,size:34})]})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function Te(){const{employees:n}=E(),r=n.filter(L)[0],o=D(),[c,u]=t.useState("Payment callback reached the order service twelve minutes late."),[d,p]=t.useState("high"),g=t.useMemo(()=>({type:"page-element",id:"selected-support-case",title:"Selected support case"}),[]),m=M({id:"selected-support-case",title:"Selected support case",kind:"editable-record",getContext:()=>({resource:"supportTickets",values:{summary:c,severity:d}})}),f=t.useMemo(()=>({title:"Analyze selected case",message:{user:"Analyze the selected support case.",workContext:[g]},autoSend:!1}),[g]);return e.jsx(F,{id:"shortcut-task-context-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsxs("div",{className:"bg-muted/15 p-4 sm:p-5",children:[e.jsxs(j,{ref:m,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Selected support case"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Change a value before running either task."})]}),e.jsx(b,{variant:"secondary",children:"Task context"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"selected-context-summary",children:"Summary"}),e.jsx(y,{id:"selected-context-summary",value:c,onChange:s=>u(s.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Severity"}),e.jsxs(k,{value:d,onValueChange:s=>s&&p(s),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"medium",children:"Medium"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]}),e.jsxs(j,{className:"mt-5 border-dashed bg-background/80",children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Task shortcut area"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"This button is outside the selected page element. Its task explicitly references “Selected support case”."})]}),e.jsx(b,{variant:"outline",children:"Explicit reference"})]})}),e.jsx(P,{children:e.jsx(_,{aiEmployee:r.username,target:o,tasks:[f],label:"Analyze selected case",size:34})})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})}function Pe(){const{employees:n}=E(),r=n.filter(L)[0],[o,c]=t.useState("Enterprise workspace expansion"),[u,d]=t.useState("likely"),p=t.useMemo(()=>({type:"page-element",id:"selected-opportunity",title:"Selected opportunity"}),[]),g=M({id:"selected-opportunity",title:"Selected opportunity",kind:"record-detail",getContext:()=>({resource:"opportunities",record:{name:o,forecast:u}})}),m=t.useMemo(()=>({title:"Prepare opportunity brief",message:{user:"Prepare a brief for the selected opportunity.",workContext:[p]},autoSend:!1}),[p]),f=t.useMemo(()=>({[r.username]:[m]}),[r.username,m]);return e.jsx(F,{id:"preset-task-context-demo",defaultEmployee:r.username,employeeTasks:f,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:g,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Selected opportunity"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Change a value, then select the preset task in the chat."})]}),e.jsx(b,{variant:"secondary",children:"Preset task context"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"preset-context-opportunity",children:"Opportunity"}),e.jsx(y,{id:"preset-context-opportunity",value:o,onChange:s=>c(s.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Forecast"}),e.jsxs(k,{value:u,onValueChange:s=>s&&d(s),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"pipeline",children:"Pipeline"}),e.jsx(l,{value:"likely",children:"Likely"}),e.jsx(l,{value:"committed",children:"Committed"})]})]})]}),e.jsx("div",{className:"rounded-lg border bg-background p-3 text-xs leading-5 text-muted-foreground",children:"No Shortcut is used here. “Prepare opportunity brief” comes from AIChatProvider.employeeTasks and appears in the conversation empty state."})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})}function Ie(){const{employees:n}=E(),r=n.filter(L)[0],o=D(),[c,u]=t.useState("Northwind Finance"),[d,p]=t.useState("negotiation"),g=t.useMemo(()=>({type:"page-element",id:"inherited-renewal-context",title:"Current account renewal"}),[]),m=M({id:"inherited-renewal-context",title:"Current account renewal",kind:"record-detail",getContext:()=>({resource:"accounts",record:{accountName:c,stage:d}})}),f=t.useMemo(()=>({title:"Review current renewal",message:{user:"Review the current account renewal."},autoSend:!1}),[]),s=t.useMemo(()=>({title:"Recommend next renewal action",message:{user:"Recommend the next renewal action."},autoSend:!1}),[]),I=t.useMemo(()=>({[r.username]:[s]}),[r.username,s]);return e.jsx(J,{context:g,children:e.jsx(F,{id:"inherited-context-demo",controller:o,defaultEmployee:r.username,employeeTasks:I,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:m,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Current account renewal"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Shortcut and conversation are inside this context scope."})]}),e.jsx(b,{variant:"outline",children:"Inherited"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"inherited-account-name",children:"Account"}),e.jsx(y,{id:"inherited-account-name",value:c,onChange:h=>u(h.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Renewal stage"}),e.jsxs(k,{value:d,onValueChange:h=>h&&p(h),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"discovery",children:"Discovery"}),e.jsx(l,{value:"negotiation",children:"Negotiation"}),e.jsx(l,{value:"committed",children:"Committed"})]})]})]}),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Shortcut task without message.workContext"}),e.jsx(_,{aiEmployee:r.username,target:o,tasks:[f],label:"Review current renewal",size:34})]}),e.jsx("div",{className:"rounded-lg border bg-background p-3 text-xs leading-5 text-muted-foreground",children:"The preset task “Recommend next renewal action” also has no task context, so it inherits this scope."})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function R({eyebrow:n,title:r,description:o,children:c}){return e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:n}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:r}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:o})]}),c]})}export{Le as PageContextPage};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-MB-jfQld.js";import{P as p}from"./prompt-output-DZHRM2ft.js";function x({title:r,description:t,prompt:m}){return o.jsx(p,{title:r,description:t,prompt:m,promptClassName:"max-h-[620px]"})}export{x as P};
@@ -0,0 +1 @@
1
+ import{b as o,j as e,D as f,y as h,bx as y,c as i}from"./index-MB-jfQld.js";import{C as j}from"./card-DuQBOS6A.js";function C({className:c,copiedLabel:n="Copied",copyErrorLabel:p="Clipboard access failed. Select the prompt and copy it manually.",copyLabel:d="Copy prompt",description:l,prompt:t,promptClassName:x,title:m="Generated prompt"}){const[s,a]=o.useState(!1),[u,r]=o.useState(!1);return e.jsxs(j,{className:i("min-w-0 gap-0 overflow-hidden py-0",c),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium",children:m}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l})]}),e.jsxs(f,{type:"button",size:"sm",className:"shrink-0",onClick:async()=>{try{await navigator.clipboard.writeText(t),r(!1),a(!0),window.setTimeout(()=>a(!1),1500)}catch{r(!0)}},children:[s?e.jsx(h,{}):e.jsx(y,{}),s?n:d]})]}),u?e.jsx("p",{className:"border-b px-4 py-2 text-xs text-destructive",children:p}):null,e.jsx("pre",{className:i("max-h-[560px] overflow-auto whitespace-pre-wrap bg-muted/25 p-5 font-mono text-xs leading-5 text-muted-foreground",x),children:t})]})}export{C as P};
@@ -0,0 +1 @@
1
+ import{aZ as m,b as o,a_ as g,a$ as d,j as a,aT as f,aV as h,aW as x,D as b,b0 as v,r as S}from"./index-MB-jfQld.js";function p(r){const[e]=m(),[i,t]=o.useState(!1),[n,l]=o.useState(),u=o.useMemo(()=>{if(e.get("authenticator")!==r.name)return;const s=e.get("error");return s?new Error(s):void 0},[r.name,e]);return{signIn:o.useCallback(async()=>{l(void 0),t(!0);try{const s=g(e.get("to")||e.get("redirect")||"/"),c=await d.action("saml","getAuthUrl",{method:"POST",authenticator:r.name,includeRole:!1,withAclMeta:!1,body:{redirect:s}});if(!c)throw new Error("NocoBase did not return a SAML authorization URL.");window.location.replace(d.resolveUrl(c))}catch(s){l(s instanceof Error?s:new Error("Unable to start SAML sign-in.")),t(!1)}},[r.name,e]),isPending:i,error:n??u}}function j({authenticator:r,onSignIn:e}){const{signIn:i,isPending:t,error:n}=p(r);return a.jsxs("div",{className:"space-y-3",children:[n&&a.jsxs(f,{variant:"destructive",children:[a.jsx(h,{children:"SAML sign-in failed"}),a.jsx(x,{children:n.message})]}),a.jsxs(b,{type:"button",variant:"outline",className:"w-full",disabled:!e&&t,onClick:e??i,children:[a.jsx(v,{}),!e&&t?"Redirecting…":S(r.title||r.authTypeTitle||"SAML")]})]})}export{j as default};
@@ -0,0 +1 @@
1
+ import{_ as m,P as y,H as A,m as I,aq as R}from"./echarts-runtime-D8kXn6ME.js";var p=(function(){function u(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return u})(),b=(function(u){m(s,u);function s(a){var r=u.call(this,a)||this;return r.type="sausage",r}return s.prototype.getDefaultShape=function(){return new p},s.prototype.buildPath=function(a,r){var e=r.cx,i=r.cy,o=Math.max(r.r0||0,0),h=Math.max(r.r,0),d=(h-o)*.5,v=o+d,t=r.startAngle,n=r.endAngle,c=r.clockwise,l=Math.PI*2,M=c?n-t<l:t-n<l;M||(t=n-(c?l:-l));var f=Math.cos(t),g=Math.sin(t),P=Math.cos(n),S=Math.sin(n);M?(a.moveTo(f*o+e,g*o+i),a.arc(f*v+e,g*v+i,d,-Math.PI+t,t,!c)):a.moveTo(f*h+e,g*h+i),a.arc(e,i,h,t,n,!c),a.arc(P*v+e,S*v+i,d,n-Math.PI*2,n-Math.PI,!c),o!==0&&a.arc(e,i,o,n,t,c)},s})(y);function k(u,s,a){var r=u.get("borderRadius");if(r==null)return a?{cornerRadius:0}:null;A(r)||(r=[r,r,r,r]);var e=Math.abs(s.r||0-s.r0||0);return{cornerRadius:I(r,function(i){return R(i,e)})}}export{b as S,k as g};
@@ -0,0 +1,47 @@
1
+ import{b as n,a7 as ge,a8 as St,a9 as tt,aa as st,ab as se,j as e,ac as It,ad as at,ae as Pt,af as At,ag as nt,ah as xe,ai as Mt,aj as Tt,ak as rt,al as ot,am as fe,an as Et,ao as Rt,ap as $t,c as le,C as Bt,aq as Ut,ar as it,as as Dt,at as Vt,au as Wt,av as Ft,aw as Fe,ax as zt,ay as Ot,az as Kt,aA as Lt,aB as ze,aC as qt,aD as Gt,aE as Ht,aF as _t,aG as Jt,aH as Xt,y as Yt,aI as lt,a4 as Qt,aJ as Zt,B as Se,aK as es,aL as Pe,Y as Oe,K as Ke,N as Le,a0 as ts,aM as Ie,d as Q,e as Z,f as ee,g as te,i as W,I as qe,D as pe,P as ss,G as as,h as ns,aN as rs,T as Ge,a1 as os,aO as is}from"./index-MB-jfQld.js";import{C as he,a as Ae,b as Me,d as Te}from"./card-DuQBOS6A.js";import{u as ls,S as He}from"./switch-CRL8PmRI.js";import{P as ds}from"./prompt-card-B2RS4nt2.js";import{A as cs}from"./configuration-gate-C08mkkiX.js";import"./prompt-output-DZHRM2ft.js";const us=n.createContext({disabled:!1});function ms(){return n.useContext(us)}const ps=n.createContext(void 0);function hs(s=!0){const a=n.useContext(ps);if(a===void 0&&!s)throw new Error(ge(3));return a}const dt=n.createContext(void 0);function ct(){const s=n.useContext(dt);if(s===void 0)throw new Error(ge(10));return s}const xs={value:()=>null},fs=n.forwardRef(function(a,l){const{render:x,className:P,disabled:m=!1,hiddenUntilFound:h,keepMounted:d,loopFocus:v,onValueChange:f,multiple:M=!1,orientation:k="vertical",value:T,defaultValue:j,style:S,...y}=a,E=St(),I=n.useMemo(()=>{if(T===void 0)return j??[]},[T,j]),C=n.useRef([]),[c,w]=tt({controlled:T,default:I,name:"Accordion",state:"value"}),V=st(($,K,g)=>{if(M)if(K){const N=c.slice();if(N.push($),f==null||f(N,g),g.isCanceled)return;w(N)}else{const N=c.filter(q=>q!==$);if(f==null||f(N,g),g.isCanceled)return;w(N)}else{const N=c[0]===$?[]:[$];if(f==null||f(N,g),g.isCanceled)return;w(N)}}),b=n.useMemo(()=>({value:c,disabled:m,orientation:k}),[c,m,k]),R=n.useMemo(()=>({disabled:m,handleValueChange:V,hiddenUntilFound:h??!1,keepMounted:d??!1,state:b,value:c}),[m,V,h,d,b,c]),p=se("div",a,{state:b,ref:l,props:[{dir:E},y],stateAttributesMapping:xs});return e.jsx(dt.Provider,{value:R,children:e.jsx(It,{elementsRef:C,children:p})})}),ut=n.createContext(void 0);function Ee(){const s=n.useContext(ut);if(s===void 0)throw new Error(ge(9));return s}let gs=(function(s){return s.index="data-index",s.disabled="data-disabled",s.open="data-open",s})({});const Re={...Pt,index:s=>Number.isInteger(s)?{[gs.index]:String(s)}:null,...at,value:()=>null},bs=n.forwardRef(function(a,l){const{className:x,disabled:P=!1,onOpenChange:m,render:h,value:d,style:v,...f}=a,{ref:M,index:k}=At(),T=nt(l,M),{disabled:j,handleValueChange:S,state:y,value:E}=ct(),I=xe(),C=d??I,c=P||j,w=n.useMemo(()=>{if(!E)return!1;for(let B=0;B<E.length;B+=1)if(E[B]===C)return!0;return!1},[E,C]),V=st((B,F)=>{m==null||m(B,F),!F.isCanceled&&S(C,B,F)}),b=Mt({open:w,onOpenChange:V,disabled:c}),R=n.useMemo(()=>({open:b.open,disabled:b.disabled,transitionStatus:b.transitionStatus}),[b.open,b.disabled,b.transitionStatus]),p=n.useMemo(()=>({...b,onOpenChange:V,state:R}),[b,R,V]),$=n.useMemo(()=>({...y,hidden:!w&&!b.mounted,index:k,disabled:c,open:w}),[b.mounted,c,k,w,y]),K=xe(),[g,N]=n.useState(),q=n.useMemo(()=>({open:w,state:$,setTriggerId:N,triggerId:g??K}),[K,w,$,N,g]),G=se("div",a,{state:$,ref:T,props:f,stateAttributesMapping:Re});return e.jsx(Tt.Provider,{value:p,children:e.jsx(ut.Provider,{value:q,children:G})})}),ks=n.forwardRef(function(a,l){const{render:x,className:P,style:m,...h}=a,{state:d}=Ee();return se("h3",a,{state:d,ref:l,props:h,stateAttributesMapping:Re})}),vs=n.forwardRef(function(a,l){const{disabled:x,className:P,id:m,render:h,nativeButton:d=!0,style:v,...f}=a,{panelId:M,open:k,handleTrigger:T,disabled:j}=rt(),S=x||j,{getButtonProps:y,buttonRef:E}=ot({disabled:S,focusableWhenDisabled:!0,native:d}),{state:I,setTriggerId:C,triggerId:c}=Ee();return fe(()=>(m&&C(m),()=>{C(void 0)}),[m,C]),se("button",a,{state:I,ref:[l,E],props:[{"aria-controls":k?M:void 0,"aria-expanded":k,id:c,onClick:T},f,y],stateAttributesMapping:Et})});let _e=(function(s){return s.accordionPanelHeight="--accordion-panel-height",s.accordionPanelWidth="--accordion-panel-width",s})({});const js=n.forwardRef(function(a,l){const{className:x,hiddenUntilFound:P,keepMounted:m,id:h,render:d,style:v,...f}=a,{hiddenUntilFound:M,keepMounted:k}=ct(),{mounted:T,onOpenChange:j,open:S,panelId:y,setMounted:E,setOpen:I,setPanelIdState:C,transitionStatus:c}=rt(),w=P??M,V=m??k;fe(()=>{if(h)return C(h),()=>{C(void 0)}},[h,C]);const{height:b,props:R,ref:p,shouldPreventOpenAnimation:$,shouldRender:K,transitionStatus:g,width:N}=Rt({externalRef:l,hiddenUntilFound:w,id:h??y,keepMounted:V,mounted:T,onOpenChange:j,open:S,setMounted:E,setOpen:I,transitionStatus:c}),{state:q,triggerId:G}=Ee(),B={...q,transitionStatus:g},F=$t(v,B),ae=se("div",{...a,style:void 0},{state:B,ref:p,props:[R,{"aria-labelledby":G,role:"region",style:{[_e.accordionPanelHeight]:b===void 0?"auto":`${b}px`,[_e.accordionPanelWidth]:N===void 0?"auto":`${N}px`}},f,F?{style:F}:void 0,$?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Re});return K?ae:null});function ys({className:s,...a}){return e.jsx(fs,{"data-slot":"accordion",className:le("flex w-full flex-col",s),...a})}function ws({className:s,...a}){return e.jsx(bs,{"data-slot":"accordion-item",className:le("not-last:border-b",s),...a})}function Cs({className:s,children:a,...l}){return e.jsx(ks,{className:"flex",children:e.jsxs(vs,{"data-slot":"accordion-trigger",className:le("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",s),...l,children:[a,e.jsx(Bt,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),e.jsx(Ut,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function Ns({className:s,children:a,...l}){return e.jsx(js,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...l,children:e.jsx("div",{className:le("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",s),children:a})})}function Ss(s){if(!s)return null;for(const a of s.elements){const l=a.tagName;if(l==="BUTTON"||l==="INPUT"){const x=a;if(x.type==="submit")return x}}return null}let Je=(function(s){return s.checked="data-checked",s.unchecked="data-unchecked",s.indeterminate="data-indeterminate",s.disabled="data-disabled",s.readonly="data-readonly",s.required="data-required",s.valid="data-valid",s.invalid="data-invalid",s.touched="data-touched",s.dirty="data-dirty",s.filled="data-filled",s.focused="data-focused",s})({});function mt(s){return n.useMemo(()=>({checked(a){return s.indeterminate?{}:a?{[Je.checked]:""}:{[Je.unchecked]:""}},...it}),[s.indeterminate])}const pt=n.createContext(void 0);function Is(){const s=n.useContext(pt);if(s===void 0)throw new Error(ge(14));return s}const Ps="data-parent",As=n.forwardRef(function(a,l){const{checked:x,className:P,defaultChecked:m=!1,"aria-labelledby":h,disabled:d=!1,form:v,id:f,indeterminate:M=!1,inputRef:k,name:T,onCheckedChange:j,parent:S=!1,readOnly:y=!1,render:E,required:I=!1,uncheckedValue:C,value:c,nativeButton:w=!1,style:V,...b}=a,{clearErrors:R}=Dt(),{disabled:p,name:$,setDirty:K,setFilled:g,setFocused:N,setTouched:q,state:G,validationMode:B,validityData:F,validation:ae}=Vt(),de=ms(),{labelId:ce,controlId:t,registerControlId:o,getDescriptionProps:r}=Wt(),i=hs(),z=i==null?void 0:i.parent,H=z&&i.allValues,A=p||de.disabled||(i==null?void 0:i.disabled)||d,ne=$??T,U=c??ne,$e=xe(),xt=xe();let _=t;H?_=S?xt:`${z.id}-${U}`:f&&(_=f);let be={};H&&(S?be=i.parent.getParentProps():U&&(be=i.parent.getChildProps(U)));const{checked:Be=x,indeterminate:ft=M,onCheckedChange:ke,...gt}=be,re=i==null?void 0:i.value,Ue=i==null?void 0:i.setValue,De=i==null?void 0:i.defaultValue,ve=n.useRef(null),ue=Ft(()=>Symbol("checkbox-control")),je=n.useRef(!1),{getButtonProps:bt,buttonRef:kt}=ot({disabled:A,native:w}),oe=(i==null?void 0:i.validation)??ae,[O,vt]=tt({controlled:U&&re&&!S?re.includes(U):Be,default:U&&De&&!S?De.includes(U):m,name:"Checkbox",state:"checked"}),ye=H?!!Be:O,ie=H&&ft||M;fe(()=>{o!==Fe&&(je.current=!0,o(ue.current,_))},[_,o,ue]),n.useEffect(()=>{const u=ue.current;return()=>{!je.current||o===Fe||(je.current=!1,o(u,void 0))}},[o,ue]),zt(ve,$e,O,void 0,!i&&!A,T);const J=n.useRef(null),jt=nt(k,J,oe.inputRef,oe.registerInput),yt=ls(h,ce,J,!w,_??void 0);fe(()=>{J.current&&(J.current.indeterminate=ie,O&&g(!0))},[O,ie,g]),Ot(O,()=>{i||(R(ne),g(O),K(O!==F.initialValue),oe.change(O))});const wt=Kt({checked:O,disabled:A,form:v,name:S?void 0:ne,id:w?void 0:_??void 0,required:I,ref:jt,style:ne?qt:Gt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(u){if(u.nativeEvent.defaultPrevented)return;if(y){u.preventDefault();return}const L=u.currentTarget.checked,X=Ht(_t,u.nativeEvent);if(j==null||j(L,X),!X.isCanceled&&(ke==null||ke(L,X),!X.isCanceled&&(vt(L),U&&re&&Ue&&!S&&!H))){const Y=L?[...re,U]:re.filter(me=>me!==U);Ue(Y,X)}},onFocus(){var u;(u=ve.current)==null||u.focus()}},c!==void 0?{value:(i?O&&c:c)||""}:Lt,r,u=>oe.getValidationProps(A,u));n.useEffect(()=>{if(!z||!U)return;const u=z.disabledStatesRef.current;return u.set(U,A),()=>{u.delete(U)}},[z,A,U]);const we=n.useMemo(()=>({...G,checked:ye,disabled:A,readOnly:y,required:I,indeterminate:ie}),[G,ye,A,y,I,ie]),Ct=mt(we),Nt=se("span",a,{state:we,ref:[kt,ve,l,i==null?void 0:i.registerControlRef],props:[{id:w?_??void 0:$e,role:"checkbox","aria-checked":ie?"mixed":ye,"aria-readonly":y||void 0,"aria-required":I||void 0,"aria-labelledby":yt,[Ps]:S?"":void 0,onFocus(){A||N(!0)},onBlur(){const u=J.current;u&&(q(!0),N(!1),B==="onBlur"&&oe.commit(i?re:u.checked))},onKeyDown(u){var Ve;if(u.key!=="Enter"||(u.preventBaseUIHandler(),u.defaultPrevented))return;const L=((Ve=J.current)==null?void 0:Ve.form)??null,X=u.currentTarget,Y=u.nativeEvent,me=u.preventDefault,Ce=Y.preventDefault;let Ne=!1;u.preventDefault=()=>{Ne=!0,me.call(u)},Y.preventDefault=()=>{Ne=!0,Ce.call(Y)},Ce.call(Y),ze(X).queueMicrotask(()=>{var We;u.preventDefault=me,Y.preventDefault=Ce,Ne||(We=Ss(L))==null||We.click()})},onClick(u){if(y||A)return;u.preventDefault();const L=J.current;L&&L.dispatchEvent(new(ze(L)).PointerEvent("click",{bubbles:!0,shiftKey:u.shiftKey,ctrlKey:u.ctrlKey,altKey:u.altKey,metaKey:u.metaKey}))}},b,gt,bt,r,u=>oe.getValidationProps(A,u)],stateAttributesMapping:Ct});return e.jsxs(pt.Provider,{value:we,children:[Nt,!O&&!i&&ne&&!S&&C!==void 0&&e.jsx("input",{type:"hidden",form:v,name:ne,value:C,disabled:A}),e.jsx("input",{...wt,suppressHydrationWarning:!0})]})}),Ms=n.forwardRef(function(a,l){const{render:x,className:P,style:m,keepMounted:h=!1,...d}=a,v=Is(),f=v.checked||v.indeterminate,{mounted:M,transitionStatus:k,setMounted:T}=Jt(f),j=n.useRef(null),S={...v,transitionStatus:k};Xt({open:f,ref:j,onComplete(){f||T(!1)}});const E={...mt(v),...at,...it},I=h||M,C=se("span",a,{ref:[l,j],state:S,stateAttributesMapping:E,props:d});return I?C:null});function Ts({className:s,...a}){return e.jsx(As,{"data-slot":"checkbox",className:le("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",s),...a,children:e.jsx(Ms,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e.jsx(Yt,{})})})}const Xe={title:"Analyze this ticket",message:{system:"Review the current ticket, identify operational risk, and suggest the next action.",user:"Analyze the current ticket and recommend the next action."},autoSend:!0,model:{llmService:"openai",model:"gpt-5"},webSearch:!0,skillSettings:{skills:["ticket-analysis"],tools:["inspect-record"]}},Ye={title:"Draft a customer reply",message:{user:"Draft a concise customer reply for the current ticket."},autoSend:!1,skillSettings:{skills:["response-drafting"],tools:["inspect-record"]}},Qe={title:"Review operational risk",message:{system:"Review the current queue, identify operational risk, and prioritize the next actions.",user:"Review the current ticket queue and identify operational risk."},autoSend:!1,skillSettings:{skills:["ticket-analysis"],tools:["inspect-record"]}},D={id:"TK-1042",title:"Payment callback delayed",status:"Open",requester:"Northwind Finance",createdAt:"July 22, 2026 · 09:42",description:"Payment succeeded, but the callback reached the order service twelve minutes late. The customer needs an impact assessment and a response before the next settlement window."},Es=[D,{id:"TK-1041",title:"Unable to update profile"},{id:"TK-1038",title:"Invoice export formatting"}],ht=s=>!["nathan","dara"].includes(s.username.toLowerCase());function Ks(){return e.jsx(cs,{children:e.jsx(Rs,{})})}function Rs(){const{employees:s}=lt(),a=Qt(),l=s.filter(ht),x=l.find(v=>v.username.toLowerCase()==="atlas")??l[0],P=l.find(v=>v.username!==x.username)??x,m=l.find(v=>v.username.toLowerCase()==="atlas")??l.find(v=>v.username!==x.username)??x,h=Zt({id:"support-ticket-detail",title:`${D.id} · ${D.title}`,kind:"record-detail",getContext:()=>({resource:"supportTickets",record:D})}),d=n.useMemo(()=>({[x.username]:[Xe,Ye],...P.username!==x.username?{[P.username]:[Qe]}:{}}),[x.username,P.username]);return e.jsxs("div",{className:"space-y-12 pb-12",children:[e.jsx("section",{className:"flex flex-wrap items-start justify-between gap-5 border-b pb-8",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Se,{variant:"secondary",children:"AI Components"}),e.jsx(Se,{variant:"outline",children:"Employee capability"})]}),e.jsx("h1",{className:"mt-4 text-3xl font-semibold tracking-[-0.035em]",children:"Employee tasks"}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Bind reusable tasks to AI employees. Tasks can appear directly inside a chat when the employee is selected, or be triggered from contextual buttons elsewhere in the application."})]})}),e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Scenario 1 · Multiple tasks"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Trigger employee tasks from a business record"}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:"The Shortcut component can still sit in a detail header and provide the current record as work context. Opening it shows the configured analysis and reply tasks below the employee greeting."})]}),e.jsx(es,{context:{type:"page-element",id:"support-ticket-detail",title:`${D.id} · ${D.title}`},children:e.jsxs(he,{ref:h,className:"gap-0 overflow-hidden py-0",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b p-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:D.id}),e.jsx(Se,{variant:"outline",children:D.status})]}),e.jsx("h3",{className:"mt-2 text-lg font-semibold tracking-tight",children:D.title})]}),e.jsx(Pe,{aiEmployee:x.username,tasks:[Xe,Ye],label:`Ask ${x.nickname}`,size:34})]}),e.jsxs("div",{className:"grid gap-5 p-5 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Requester"}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:D.requester})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Created"}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:D.createdAt})]})]}),e.jsxs("div",{className:"border-t p-5",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6",children:D.description})]})]})})]}),e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Scenario 2 · Explicit target"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Send a shortcut task to a designated embedded chat"}),e.jsxs("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:["The shortcut receives the embedded chat Controller directly. Its Provider explicitly configures ",m.nickname," and an employee task set. It does not need a global target ID and cannot accidentally trigger another conversation on the same page."]})]}),e.jsx(Oe,{id:"shortcut-embedded-chat",controller:a,defaultEmployee:m.username,children:e.jsxs("div",{className:"grid items-stretch gap-5 xl:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs(he,{children:[e.jsx(Ae,{children:e.jsx(Me,{className:"text-base",children:"Risk review workspace"})}),e.jsxs(Te,{className:"space-y-5",children:[e.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:"The embedded chat starts without preset tasks. Clicking the Shortcut injects “Review operational risk” into this specific conversation, where the user can choose it before the request is placed in the composer."}),e.jsx(Pe,{aiEmployee:m.username,target:a,tasks:[Qe],auto:!1,context:[{type:"table",title:"Open ticket queue",content:Es}],label:`Ask ${m.nickname}`,size:36})]})]}),e.jsx(Ke,{className:"h-[560px] min-h-0",children:e.jsx(Le,{})})]})})]}),e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Scenario 3 · Chat-bound tasks"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Show tasks when the selected employee changes"}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:"This conversation window binds task lists directly to business AI employees. Starting a new conversation or switching employees in the composer immediately replaces the empty-state tasks. Employees without a binding keep the normal greeting-only state."})]}),e.jsxs("div",{className:"grid items-stretch gap-5 xl:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs(he,{children:[e.jsx(Ae,{children:e.jsx(Me,{className:"text-base",children:"Employee task bindings"})}),e.jsxs(Te,{className:"space-y-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"rounded-lg border bg-muted/25 p-3 font-mono text-xs leading-5",children:[e.jsx("div",{children:x.username}),e.jsx("div",{className:"pl-4",children:"Analyze this ticket"}),e.jsx("div",{className:"pl-4",children:"Draft a customer reply"}),P.username!==x.username?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2",children:P.username}),e.jsx("div",{className:"pl-4",children:"Review operational risk"})]}):null]}),e.jsx("p",{children:"Switch employees from the bottom of the chat to preview each configured task list."}),e.jsxs("p",{children:["The same ",e.jsx("code",{children:"employeeTasks"})," parameter works in page, embedded, side-panel, dialog, and mobile containers."]})]})]}),e.jsx(Oe,{id:"employee-task-scenario-chat",defaultEmployee:x.username,employeeTasks:d,children:e.jsx(Ke,{className:"h-[620px] min-h-0",children:e.jsx(Le,{})})})]})]}),e.jsx(Us,{embeddedController:a})]})}const $s=[{value:"ticket-analysis",label:"Ticket analysis"},{value:"response-drafting",label:"Response drafting"},{value:"workflow-design",label:"Workflow design"}],Bs=[{value:"inspect-record",label:"Inspect record"},{value:"search-records",label:"Search records"},{value:"update-record",label:"Update record"}],Ze=[{id:"analyze-ticket",employee:"",title:"Analyze this ticket",background:"Identify operational risk and recommend the next action.",userMessage:"Analyze the current ticket and recommend the next action.",autoSend:!0,workContext:[{type:"page-element",id:"support-ticket-detail",title:`${D.id} · ${D.title}`}],model:"gpt-5",webSearch:!0,skillsMode:"custom",skills:["ticket-analysis"],toolsMode:"custom",tools:["inspect-record"]},{id:"draft-reply",employee:"",title:"Draft a customer reply",background:"Write a concise and helpful response using the ticket context.",userMessage:"Draft a customer reply for the current ticket.",autoSend:!1,workContext:[],model:"default",webSearch:!1,skillsMode:"custom",skills:["response-drafting"],toolsMode:"preset",tools:[]}];function Us({embeddedController:s}){var B,F,ae,de,ce;const{employees:a,models:l}=lt(),{registeredCount:x,startPicking:P}=ts(),m=a.filter(ht),h=m.find(t=>t.username.toLowerCase()==="atlas")??m[0],[d,v]=n.useState("shortcut"),[f,M]=n.useState("the ticket detail header actions"),[k,T]=n.useState(h.username),[j,S]=n.useState(h.username),[y,E]=n.useState("global-side-panel"),[I,C]=n.useState("embedded"),[c,w]=n.useState(()=>Ze.map(t=>({...t,employee:h.username}))),[V,b]=n.useState(Ze[0].id),R=d==="chat-tasks"?c.filter(t=>t.employee===j):c,p=R.find(t=>t.id===V)??R[0],$=n.useMemo(()=>c.map(t=>{const o=Ie(l,t.model),r=t.skillsMode==="custom"||t.toolsMode==="custom";return{title:t.title,message:{system:t.background||void 0,user:t.userMessage||void 0,workContext:t.workContext.length?t.workContext:void 0},autoSend:t.autoSend,model:o?{llmService:o.llmService,model:o.value}:void 0,webSearch:t.webSearch,skillSettings:r?{skills:t.skillsMode==="custom"?t.skills:void 0,tools:t.toolsMode==="custom"?t.tools:void 0}:void 0}}),[l,c]),K=n.useMemo(()=>{const t=(r,i)=>{var H;const z=r.model==="default"?"Use the AI employee default":((H=l.find(A=>A.value===r.model))==null?void 0:H.label)??r.model;return`${i+1}. ${r.title}
2
+ - Background: ${r.background||"None"}
3
+ - Default user message: ${r.userMessage||"None"}
4
+ - Send automatically: ${r.autoSend}
5
+ - Work context: ${r.workContext.map(A=>A.title??A.id).join(", ")||"Inherit the surrounding context"}
6
+ - Model: ${z}
7
+ - Web search: ${r.webSearch}
8
+ - Skills: ${r.skillsMode==="preset"?"Use the AI employee defaults":r.skills.join(", ")||"Disabled"}
9
+ - Tools: ${r.toolsMode==="preset"?"Use the AI employee defaults":r.tools.join(", ")||"Disabled"}`},o=d==="chat-tasks"?Array.from(new Set(c.map(r=>r.employee))).map(r=>{const i=c.filter(z=>z.employee===r);return`AI employee: ${r}
10
+ ${i.map(t).join(`
11
+ `)}`}).join(`
12
+
13
+ `):c.map(t).join(`
14
+ `);if(d==="chat-tasks"){const r={page:"a dedicated page",embedded:"an embedded block in the page","side-panel":"a push side panel",dialog:"a dialog"}[I];return`Add an AI conversation window to ${f} using ${r}.
15
+
16
+ Employee task bindings:
17
+ ${o}
18
+
19
+ Implementation requirements:
20
+ - Render AIChatWindow in the selected container and wrap it with AIChatProvider.
21
+ - Configure AIChatProvider with employeeTasks grouped by AI employee username.
22
+ - When the user starts a new conversation or switches AI employees, show the matching tasks below that employee’s greeting.
23
+ - Employees without configured tasks must keep the greeting-only empty state.
24
+ - Selecting a task must respect autoSend: either send immediately or fill the composer for review.
25
+ - Resolve task message.workContext when the task starts so selected page elements use their latest values.
26
+ - When a task has no message.workContext, inherit the context surrounding the Shortcut or AIChatProvider.
27
+ - Preserve every task’s background prompt, model override, Web search setting, Skills, Tools, and work context.
28
+ - Keep the employeeTasks capability independent of the container so the same configuration works in page, embedded, side-panel, dialog, and mobile layouts.
29
+ - Use the existing AIProvider/AIChatProvider runtime with shadcn/Base UI components.`}return`Add an AI employee shortcut to ${f}.
30
+
31
+ Shortcut configuration:
32
+ - AI employee: ${k}
33
+ - Target conversation: ${y==="global-side-panel"?"the default global push side panel":"the embedded chat rendered in this page section"}
34
+ - Include the current record or form values as work context.
35
+
36
+ Tasks:
37
+ ${o}
38
+
39
+ Implementation requirements:
40
+ - Use AIEmployeeShortcut and pass all configured tasks through its tasks prop.
41
+ - When multiple tasks are provided, open a new conversation and show the tasks below the AI employee greeting.
42
+ - Selecting a task must respect that task's autoSend setting: either send immediately or fill the composer for review.
43
+ - Resolve task message.workContext when the task starts so selected page elements use their latest values.
44
+ - When a task has no message.workContext, inherit the context surrounding the Shortcut or AIChatProvider.
45
+ - Preserve each task's background prompt, work context, model override, Web search setting, Skills, and Tools.
46
+ - ${y==="global-side-panel"?"Use the global AI chat controller; do not pass a target prop.":"Create a dedicated controller with useAIChatController(), bind it to the embedded AIChatProvider, and pass it through the shortcut target prop."}
47
+ - Use the existing AIProvider and AIChatProvider runtime with shadcn/Base UI components.`},[I,k,d,f,l,y,c]),g=t=>{p&&w(o=>o.map(r=>r.id===p.id?{...r,...t}:r))},N=()=>{const t=`task-${crypto.randomUUID()}`;w(o=>[...o,{id:t,employee:d==="chat-tasks"?j:k,title:`Task ${o.length+1}`,background:"",userMessage:"",autoSend:!1,workContext:[],model:"default",webSearch:!1,skillsMode:"preset",skills:[],toolsMode:"preset",tools:[]}]),b(t)},q=t=>{if(c.length===1)return;const o=c.filter(r=>r.id!==t);if(w(o),V===t){const r=d==="chat-tasks"?o.find(i=>i.employee===j):o[0];b((r==null?void 0:r.id)??"")}},G=(t,o,r)=>{if(!p)return;const i=p[t];g({[t]:r?[...i,o]:i.filter(z=>z!==o)})};return e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Employee tasks prompt"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Generate an integration prompt"}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Choose whether tasks are exposed through a contextual Shortcut or directly by the selected employee in a chat. Both modes share the same task, model, Web search, Skills, and Tools configuration."})]}),e.jsxs("div",{className:"grid items-start gap-5 xl:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs(he,{className:"gap-0 py-0",children:[e.jsx(Ae,{className:"py-4",children:e.jsx(Me,{className:"text-base",children:"Employee task configuration"})}),e.jsxs(Te,{className:"space-y-4 pb-4",children:[e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Integration"}),e.jsxs(Q,{value:d,onValueChange:t=>{if(!t)return;const o=t;v(o),M(o==="shortcut"?"the ticket detail header actions":"the ticket detail page");const r=o==="chat-tasks"?c.find(i=>i.employee===j):c[0];b((r==null?void 0:r.id)??"")},children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:d==="shortcut"?"Contextual Shortcut":"Tasks inside a chat"})}),e.jsxs(te,{children:[e.jsx(W,{value:"shortcut",children:"Contextual Shortcut"}),e.jsx(W,{value:"chat-tasks",children:"Tasks inside a chat"})]})]})]}),d==="chat-tasks"?e.jsxs("label",{className:"block space-y-2 border-t pt-4 text-xs font-medium",children:[e.jsx("span",{children:"AI employee"}),e.jsxs(Q,{value:j,onValueChange:t=>{var o;t&&(S(t),b(((o=c.find(r=>r.employee===t))==null?void 0:o.id)??""))},children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:((B=m.find(t=>t.username===j))==null?void 0:B.nickname)??j})}),e.jsx(te,{children:m.map(t=>e.jsx(W,{value:t.username,children:t.nickname},t.username))})]}),e.jsx("span",{className:"block font-normal leading-5 text-muted-foreground",children:"Select an employee first, then configure the tasks shown in that employee’s new-conversation state."})]}):null,e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[d==="shortcut"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"AI employee"}),e.jsxs(Q,{value:k,onValueChange:t=>t&&T(t),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:((F=m.find(t=>t.username===k))==null?void 0:F.nickname)??k})}),e.jsx(te,{children:m.map(t=>e.jsx(W,{value:t.username,children:t.nickname},t.username))})]})]}):null,e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Placement"}),e.jsx(qe,{value:f,onChange:t=>M(t.target.value)})]}),d==="chat-tasks"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Chat container"}),e.jsxs(Q,{value:I,onValueChange:t=>t&&C(t),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:{page:"Page",embedded:"Embedded block","side-panel":"Side panel",dialog:"Dialog"}[I]})}),e.jsxs(te,{children:[e.jsx(W,{value:"page",children:"Page"}),e.jsx(W,{value:"embedded",children:"Embedded block"}),e.jsx(W,{value:"side-panel",children:"Side panel"}),e.jsx(W,{value:"dialog",children:"Dialog"})]})]})]}):null]}),d==="shortcut"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Target conversation"}),e.jsxs(Q,{value:y,onValueChange:t=>t&&E(t),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:y==="global-side-panel"?"Global side panel":"Embedded chat"})}),e.jsxs(te,{children:[e.jsx(W,{value:"global-side-panel",children:"Global side panel"}),e.jsx(W,{value:"embedded",children:"Embedded chat"})]})]})]}):null,e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Tasks"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[R.length," configured task",R.length===1?"":"s",d==="chat-tasks"?" for this employee":""]})]}),e.jsxs(pe,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(ss,{})," Add task"]})]}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:R.map((t,o)=>e.jsxs("div",{className:t.id===(p==null?void 0:p.id)?"flex items-center gap-2 rounded-lg border border-foreground/25 bg-muted/60 p-1":"flex items-center gap-2 rounded-lg border p-1",children:[e.jsxs("button",{type:"button",className:"min-w-0 flex-1 rounded-md px-2 py-1.5 text-left",onClick:()=>b(t.id),children:[e.jsxs("span",{className:"block truncate text-xs font-medium",children:[o+1,". ",t.title]}),e.jsxs("span",{className:"block text-[10px] text-muted-foreground",children:[t.autoSend?"Auto send":"Fill composer",t.workContext.length?" · Task context":"",t.webSearch?" · Web search":""]})]}),e.jsx(pe,{variant:"ghost",size:"icon-xs",disabled:c.length===1,"aria-label":`Remove ${t.title}`,onClick:()=>q(t.id),children:e.jsx(as,{})})]},t.id))})]}),p?e.jsxs("div",{className:"space-y-3 border-t pt-4",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Title"}),e.jsx(qe,{value:p.title,onChange:t=>g({title:t.target.value})})]}),e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Model"}),e.jsxs(Q,{value:p.model,onValueChange:t=>t&&g({model:t}),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{className:"min-w-0 overflow-hidden",children:e.jsx("span",{className:"block min-w-0 truncate",title:p.model==="default"?"Use employee default":((ae=Ie(l,p.model))==null?void 0:ae.label)??p.model,children:p.model==="default"?"Use employee default":((de=Ie(l,p.model))==null?void 0:de.label)??p.model})})}),e.jsxs(te,{children:[e.jsx(W,{value:"default",children:"Use employee default"}),e.jsx(ns,{}),e.jsx(rs,{models:l})]})]})]})]}),e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Default user message"}),e.jsx(Ge,{className:"min-h-16",value:p.userMessage,onChange:t=>g({userMessage:t.target.value})})]}),e.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"Auto send"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Otherwise the message is placed in the composer."})]}),e.jsx(He,{size:"sm",checked:p.autoSend,onCheckedChange:t=>g({autoSend:t})})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Work context"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Select a page context for this task. Without one, the task inherits its surrounding context."})]}),e.jsxs(pe,{variant:"outline",size:"sm",disabled:x===0,onClick:()=>P({onSelect:t=>g({workContext:[{type:t.type,id:t.id,title:t.title,kind:t.kind}]})}),children:[e.jsx(os,{})," Pick context"]})]}),p.workContext.map((t,o)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted/50 px-2 py-1.5 text-xs",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.title??t.id??t.type}),e.jsx(pe,{variant:"ghost",size:"icon-xs","aria-label":"Remove task context",onClick:()=>g({workContext:[]}),children:e.jsx(is,{})})]},`${t.type}:${t.id??o}`))]}),e.jsx(ys,{children:e.jsxs(ws,{value:"advanced-task-settings",className:"rounded-lg border px-3",children:[e.jsx(Cs,{className:"no-underline hover:no-underline",children:e.jsxs("span",{children:[e.jsx("span",{className:"block",children:"Advanced task settings"}),e.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:"Background, Web search, Skills, and Tools"})]})}),e.jsxs(Ns,{className:"space-y-4 pt-1",children:[e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Background"}),e.jsx(Ge,{className:"min-h-16",value:p.background,onChange:t=>g({background:t.target.value})})]}),e.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"Web search"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Subject to the selected LLM service capability."})]}),e.jsx(He,{size:"sm",checked:p.webSearch,onCheckedChange:t=>g({webSearch:t})})]}),e.jsx(et,{title:"Skills",mode:p.skillsMode,values:p.skills,options:$s,onModeChange:t=>g({skillsMode:t}),onToggle:(t,o)=>G("skills",t,o)}),e.jsx(et,{title:"Tools",mode:p.toolsMode,values:p.tools,options:Bs,onModeChange:t=>g({toolsMode:t}),onToggle:(t,o)=>G("tools",t,o)})]})]})})]}):null,e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t pt-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium",children:d==="shortcut"?"Live shortcut preview":"Chat-bound task configuration"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:d==="shortcut"?"Multiple tasks appear in the chat empty state after opening.":"Use the third scenario above to preview employee switching."})]}),d==="shortcut"?e.jsx(Pe,{aiEmployee:k,tasks:$,target:y==="embedded"?s:void 0,label:`Ask ${((ce=m.find(t=>t.username===k))==null?void 0:ce.nickname)??k}`,size:34}):null]})]})]}),e.jsx(ds,{title:d==="shortcut"?"Add an AI employee task shortcut":"Add employee tasks to a chat",description:d==="shortcut"?"The prompt includes every task, capability override, and target conversation.":"The prompt groups configured tasks by business AI employee and selected chat container.",prompt:K})]})]})}function et({title:s,mode:a,values:l,options:x,onModeChange:P,onToggle:m}){return e.jsxs("div",{className:"space-y-3 rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:s}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Preset inherits the AI employee configuration."})]}),e.jsxs(Q,{value:a,onValueChange:h=>h&&P(h),children:[e.jsx(Z,{size:"sm",className:"w-28",children:e.jsx(ee,{children:a==="preset"?"Preset":"Custom"})}),e.jsxs(te,{children:[e.jsx(W,{value:"preset",children:"Preset"}),e.jsx(W,{value:"custom",children:"Custom"})]})]})]}),a==="custom"?e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:x.map(h=>e.jsxs("label",{className:"flex items-center gap-2 rounded-md bg-muted/40 px-2.5 py-2 text-xs",children:[e.jsx(Ts,{checked:l.includes(h.value),onCheckedChange:d=>m(h.value,d)}),e.jsx("span",{children:h.label})]},h.value))}):null]})}export{Ks as ShortcutPage};
@@ -0,0 +1 @@
1
+ import{b as a,a$ as y,j as e,aT as j,aV as b,aW as A,k as S,I as v,D as w}from"./index-MB-jfQld.js";import{u as C}from"./use-authenticator-sign-in-CRGjzXju.js";function E(n){var x;const s=C(n.name),[l,r]=a.useState(!1),[g,d]=a.useState(),[c,t]=a.useState(),[f,m]=a.useState(Date.now()),i=typeof((x=n.options)==null?void 0:x.verifier)=="string"?n.options.verifier:"";a.useEffect(()=>{if(!c||c<=Date.now())return;const u=window.setInterval(()=>m(Date.now()),1e3);return()=>window.clearInterval(u)},[c]);const h=a.useMemo(()=>c?Math.max(0,Math.ceil((c-f)/1e3)):0,[c,f]);return{sendCode:a.useCallback(async u=>{if(!u)throw new Error("Enter a phone number first.");if(!i)throw new Error("The SMS verifier is not configured.");if(!(h>0)){d(void 0),r(!0);try{const o=await y.action("smsOTP","publicCreate",{method:"POST",authenticator:null,includeRole:!1,withAclMeta:!1,body:{action:"auth:signIn",verifier:i,uuid:u}}),p=o!=null&&o.expiresAt?Date.parse(o.expiresAt):Date.now()+6e4;m(Date.now()),t(p)}catch(o){const p=o instanceof Error?o:new Error("Unable to send the verification code.");throw d(p),p}finally{r(!1)}}},[h,i]),signIn:(u,o)=>s.signIn({uuid:u,code:o}),isSendingCode:l,isSigningIn:s.isPending,retryAfter:h,error:g??s.error}}function N({authenticator:n,onSendCode:s,onSignIn:l}){var m;const[r,g]=a.useState(""),[d,c]=a.useState(""),t=E(n),f=((m=n.options)==null?void 0:m.autoSignup)===!0;return e.jsxs("form",{className:"space-y-5",onSubmit:i=>{if(i.preventDefault(),l){l({phone:r,code:d});return}t.signIn(r,d)},children:[t.error&&e.jsxs(j,{variant:"destructive",children:[e.jsx(b,{children:"SMS sign-in failed"}),e.jsx(A,{children:t.error.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:`${n.name}-phone`,children:"Phone"}),e.jsx(v,{id:`${n.name}-phone`,type:"tel",value:r,onChange:i=>g(i.target.value),autoComplete:"tel",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:`${n.name}-code`,children:"Verification code"}),e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-2",children:[e.jsx(v,{id:`${n.name}-code`,inputMode:"numeric",value:d,onChange:i=>c(i.target.value),autoComplete:"one-time-code",required:!0}),e.jsx(w,{type:"button",variant:"outline",disabled:!s&&(t.isSendingCode||t.retryAfter>0)||!r,onClick:()=>{if(s){s(r);return}t.sendCode(r).catch(()=>{})},children:!s&&t.isSendingCode?"Sending…":!s&&t.retryAfter>0?`Retry in ${t.retryAfter}s`:"Send code"})]})]}),e.jsx(w,{type:"submit",className:"w-full",disabled:!l&&t.isSigningIn,children:!l&&t.isSigningIn?"Signing in…":"Sign in"}),f&&e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"An account will be created automatically if this phone number is new."})]})}export{N as default};