PageSourceSearch

https://app.agewise.ai/assets/index-CZEyHd8t.js

js agewise.ai collected 2026-10-05 13:45:44 UTC 6,659 bytes, 1 lines download raw bytes

1import{r as i,j as t,u as N}from"./vendor-query-Wt_7soHn.js";import{C as S,E as j,y as v,z as y,G as E,d as T,H as C,T as n,B,Q as k,f as F,t as L,L as $,x as K,n as U}from"./main-Ddye5eBT.js";import"./index-CarBinyN.js";import"./index-CG7FOVhj.js";import{C as b,a as M,M as P,B as Q,h as z}from"./index-el9odRHe.js";import"./index-DcfttPXw.js";import"./vendor-toastify-Ceb8dUqX.js";import"./index-CtGTOWTz.js";import"./index-C_USx6bQ.js";import{F as h}from"./index-NQH4NNkh.js";import"./index-DvaAlul4.js";import"./index-BWdys8eo.js";import"./index-BwC8gad5.js";import"./vendor-maplibre-B1Ob63-F.js";import{u as O}from"./useBreadcrumbs-k0q2OeUH.js";import{T as R}from"./index-DynBfUK2.js";import{u as p}from"./vendor-i18n-CoWY1jML.js";import"./vendor-clerk-B0xWkOeS.js";import"./vendor-framer-BWb9W9dM.js";import"./vendor-router-Da6rlvKB.js";import"./index-C9fEE3L7.js";import"./x-Bj1kzmuC.js";import"./chevron-right-DE7BtNON.js";import"./heart-CSQoXZa2.js";import"./isEqual-LCzCw8Iz.js";import"./circle-check-wCZ5qGHo.js";import"./menu-MbXZm5ZK.js";import"./style-CzplM7Y0.js";import"./syntax-CQ3CrU3S.js";const q={deprecated:{color:"error",labelKey:"assistant.ai.instructions.tags.deprecated"},"customer-facing":{color:"info",labelKey:"assistant.ai.instructions.tags.customerFacing"},administrative:{color:"default",labelKey:"assistant.ai.instructions.tags.administrative"}},f=i.memo(({tag:s})=>{const{t:e}=p(),a=q[s];return a?t.jsx(b,{size:"small",color:a.color,label:e(a.labelKey)}):t.jsx(b,{size:"small",color:"default",label:s})});f.displayName="InstructionTagChip";const c="v1/ai-assistants/instructions",I=s=>({getAIInstructions:async()=>(await s.get(c)).data,getAIInstruction:async e=>(await s.get(`${c}/${e}`)).data,createAIInstruction:async e=>(await s.post(c,e)).data,updateAIInstruction:async(e,a)=>(await s.put(`${c}/${e}`,a)).data,deleteAIInstruction:async e=>(await s.delete(`${c}/${e}`)).data}),D=I(y),G=async s=>{try{const e=await D.updateAIInstruction(s.name,{instruction:s.updates.instruction||""});return S.emit(j.AIInstructionUpdated),e.instruction}catch(e){return v(e)}},o={instructionsList:"aii-instructions-list",instructionItem:"aii-instruction-item",instructionItemTags:"aii-instruction-item-tags",editorTitle:"aii-editor-title",editorTags:"aii-editor-tags",updateButton:"aii-update-btn",selectPrompt:"aii-select-prompt",errorAlert:"aii-error-alert"},H=i.memo(({selectedInstruction:s})=>{const{t:e}=p(),{showSuccess:a,showError:l}=E(),{value:x,setTrue:d,setFalse:r}=T(!1),{control:u,handleSubmit:w,reset:g}=M({defaultValues:{content:s?.instruction}});i.useEffect(()=>{g({content:s?.instruction||""})},[s,g]);const A=i.useCallback(async m=>{if(!s)return;if(d(),await G({name:s.name,updates:{instruction:m.content}})instanceof C){l({text:e("assistant.ai.instructions.error.update")}),r();return}a({text:e("assistant.ai.instructions.success")}),r()},[s,d,r,a,l,e]);return s?t.jsx(h,{children:t.jsxs("div",{className:"flex flex-col min-h-full bg-surface p-6",children:[t.jsxs("div",{className:"mb-4 flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx(n,{variant:"headlineSmall","data-testid":o.editorTitle,children:s.name}),s.tags&&s.tags.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1 mt-1","data-testid":o.editorTags,children:s.tags.map(m=>t.jsx(f,{tag:m},m))}),t.jsx(n,{variant:"bodyMedium",className:"text-agw-7",children:e("assistant.ai.instructions.editor.description")})]}),t.jsx("div",{children:t.jsx(B,{variant:"contained",onClick:w(A),loading:x,"data-testid":o.updateButton,children:e("common.update")})})]}),t.jsx("div",{className:"flex flex-1 flex-col",children:t.jsx(R,{name:"content",control:u,label:e("assistant.ai.instructions.editor.label")})})]})}):t.jsx(h,{children:t.jsx("div",{className:"flex flex-col min-h-full bg-surface p-6",children:t.jsx("div",{className:"flex flex-1 justify-center items-center",children:t.jsx(n,{variant:"bodyLarge",className:"text-agw-7","data-testid":o.selectPrompt,children:e("assistant.ai.instructions.editor.select")})})})})}),V=I(y),_=async()=>{try{const{instructions:s}=await V.getAIInstructions();return s}catch(s){return v(s)}},J=()=>{const s=N({queryKey:[k.FetchAIInstructionsQuery],queryFn:async()=>L(_)({}),staleTime:3e5,gcTime:6e5});return F(j.AIInstructionUpdated,()=>s.refetch()),s},W=i.memo(({selectedName:s,onSelectionChange:e})=>{const{t:a}=p(),{data:l,isLoading:x,error:d}=J();return x?t.jsxs("div",{className:"flex flex-col h-full bg-surface",children:[t.jsx("div",{className:"p-4 border-b border-border",children:t.jsx(n,{variant:"headlineSmall",children:a("assistant.ai.instructions.list.title")})}),t.jsx($,{})]}):d?t.jsxs("div",{className:"flex flex-col h-full bg-surface",children:[t.jsx("div",{className:"p-4 border-b border-border",children:t.jsx(n,{variant:"headlineSmall",children:a("assistant.ai.instructions.list.title")})}),t.jsx("div",{className:"p-4",children:t.jsx(K,{severity:"error","data-testid":o.errorAlert,children:a("assistant.ai.instructions.error.load")})})]}):t.jsxs("div",{className:"flex flex-col h-full bg-surface",children:[t.jsx("div",{className:"p-4 border-b border-border",children:t.jsx(n,{variant:"headlineSmall",children:a("assistant.ai.instructions.list.title")})}),t.jsx("ul",{className:"flex-1 overflow-auto",role:"listbox","aria-label":a("assistant.ai.instructions.list.title"),"data-testid":o.instructionsList,children:l?.map(r=>
1t.jsx("li",{role:"option","aria-selected":s===r.name,"data-testid":o.instructionItem,children:t.jsxs("button",{type:"button",className:U("w-full px-4 py-3 text-left hover:bg-agw-2 dark:hover:bg-agw-4 focus:bg-agw-2 dark:focus:bg-agw-4 focus:outline-none transition-colors",s===r.name&&"bg-agw-3 dark:bg-agw-4"),onClick:()=>e(r),"data-testid":`aii-instruction-item-${r.name}`,children:[t.jsx(n,{variant:"bodyMedium",children:r.name}),r.tags&&r.tags.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1 mt-1","data-testid":o.instructionItemTags,children:r.tags.map(u=>t.jsx(f,{tag:u},u))}),t.jsx(n,{variant:"bodySmall",className:"text-agw-7",children:a("assistant.ai.instructions.updated",{date:r.updatedAt?new Date(r.updatedAt).toLocaleDateString():a("common.unknown")})})]})},r.name))})]})}),X=i.memo(()=>{const{t:s}=p();return t.jsx(Q,{"aria-label":"breadcrumb",children:t.jsx(z,{children:s("assistant.ai.instructions.breadcrumb")})})}),Tt=i.memo(()=>{const[s,e]=i.useState(null);O({breadcrumbs:t.jsx(X,{})});const a=i.useCallback(l=>{e(l)},[]);return t.jsx(h,{children:t.jsx(P,{leftClassName:"shrink-0 grow-0",LeftComponent:t.jsx(W,{selectedName:s?.name||null,onSelectionChange:a}),RightComponent:t.jsx(H,{selectedInstruction:s},s?.id)})})});export{Tt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.