1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[94360],{43274:function(e,t,n){n.d(t,{g:function(){return X}});var r=n(27573),s=n(88146),a=n(7653),i=n(19369),l=n(16273),o=n(13040),c=n(30048),d=n(25159),u=n(17051),m=n(10269),x=n(36673),p=n(21673),g=n(95731),h=n(90324),f=n(72829),v=n(38983),b=n(20054),y=n(34965),j=n(97236),N=n(18948),w=n(31095),k=n(3172),C=n(70548),_=n(31815),S=n(52893),T=n(59135),P=n(1836),E=n(92482),A=n(95333),R=n(91250),I=n(33956),O=n(85835),D=n(13207),Z=n(33860),L=n(46393),M=n(47200);let F=["?","help","hjelp"];var W=n(37811),z=n(17022),U=n(22113),G=n(75330),V=n(62441),H=n(34078),J=n(25555),q=n(17515);let $={category:z.Z,prompt:x.Z,skill:p.Z,research:g.Z,file:h.Z,pack:f.Z,goal:w.Z,priority:N.Z,task:j.Z,tool:u.Z,semantic:U.Z},B={category:"text-muted-foreground",prompt:"text-blue-500",skill:"text-amber-500",research:"text-violet-500",file:"text-muted-foreground",pack:"text-primary",goal:"text-amber-500",priority:"text-teal-500",task:"text-sky-500",tool:"text-orange-500",semantic:"text-emerald-500"},K={user:G.Z,organization:V.Z,system:H.Z};function Y(e){var t;let{results:n,selectedIndex:s,isLoading:l,query:o,activeCategory:c,onSelect:d,onHover:u,className:m,projectId:x}=e,p=(0,L.T)("chat"),g="no"===(t=(0,W.bU)())?"nb-NO":"sv"===t?"sv-SE":"en-US",h=e=>{d(e)},f=(0,a.useRef)(null),v=(0,a.useRef)(new Map);return((0,a.useEffect)(()=>{let e=v.current.get(s);if(e&&f.current){let t=f.current.getBoundingClientRect(),n=e.getBoundingClientRect();n.bottom>t.bottom?e.scrollIntoView({block:"nearest"}):n.top<t.top&&e.scrollIntoView({block:"nearest"})}},[s]),!l&&0===n.length&&(o||c))?(0,r.jsx)("div",{className:(0,i.cn)("absolute bottom-full left-0 right-0 mb-2 z-50","bg-popover border border-border rounded-lg shadow-lg","p-4 text-center text-sm text-muted-foreground",m),children:c&&!o?(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("div",{className:"font-medium text-foreground",children:p("slashTypeToSearch")}),(0,r.jsxs)("div",{className:"text-muted-foreground",children:[p("slashStartTypingAfter")," ",(0,r.jsxs)("code",{className:"font-mono",children:["/",c," "]})]})]}):(0,r.jsx)(r.Fragment,{children:p("slashNoCommandsFound",{query:"/".concat(o)})})}):l&&0===n.length?(0,r.jsxs)("div",{className:(0,i.cn)("absolute bottom-full left-0 right-0 mb-2 z-50","bg-popover border border-border rounded-lg shadow-lg","p-4 flex items-center justify-center gap-2 text-sm text-muted-foreground",m),children:[(0,r.jsx)(q.Gl,{}),p("searching")]}):0===n.length?null:(0,r.jsxs)("div",{ref:f,className:(0,i.cn)("absolute bottom-full left-0 right-0 mb-2 z-50","bg-popover border border-border rounded-lg shadow-lg","max-h-[300px] overflow-y-auto",m),children:[(0,r.jsxs)("div",{className:"px-3 py-2 border-b border-border/50 flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:l?p("searching"):"".concat(n.length," ").concat(1===n.length?p("slashResult"):p("slashResults"))}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:p("slashNavigationHint")})]}),(0,r.jsx)("div",{className:"py-1",children:n.map((e,t)=>{let n=$[e.type],a=K[e.scope],l=t===s;return(0,r.jsxs)("button",{ref:e=>{e?v.current.set(t,e):v.current.delete(t)},onClick:()=>h(e),onMouseEnter:()=>null==u?void 0:u(t),className:(0,i.cn)("w-full flex items-center gap-3 px-3 py-2 text-left","transition-colors",l?"bg-accent text-accent-foreground":"hover:bg-muted/50"),children:[(0,r.jsx)(n,{className:(0,i.cn)("w-4 h-4 shrink-0",B[e.type])}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"flex items-center gap-2",children:"semantic"===e.type?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-sm text-foreground truncate",children:e.name}),void 0!==e.similarity&&(0,r.jsxs)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-600 font-mono",children:[Math.round(100*e.similarity),"%"]})]}):(0,r.jsxs)(r.Fragment,{children:[e.shortcut&&(0,r.jsxs)("span",{className:"text-sm font-mono text-foreground",children:["/",e.shortcut]}),e.shortcut!==e.name&&(0,r.jsx)("span",{className:"text-sm text-muted-foreground truncate",children:e.name})]})}),e.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:e.description})]}),"semantic"===e.type?(0,r.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.createdAt&&(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground flex items-center gap-0.5",title:p("slashIndexedAt",{date:new Date(e.createdAt).toLocaleStr
1ing(g)}),children:[(0,r.jsx)(J.Z,{className:"w-3 h-3"}),function(e,t){let n=new Date(e),r=new Date().getTime()-n.getTime(),s=Math.floor(r/6e4),a=Math.floor(r/36e5),i=Math.floor(r/864e5);return s<60?t("timeMinutesShort",{count:String(s)}):a<24?t("timeHoursShort",{count:String(a)}):i<7?t("timeDaysShort",{count:String(i)}):t("timeWeeksShort",{count:String(Math.floor(i/7))})}(e.createdAt,p)]}),(0,r.jsxs)("span",{className:(0,i.cn)("text-[10px] px-1.5 py-0.5 rounded flex items-center gap-1","bg-emerald-500/10 text-emerald-600"),children:[(0,r.jsx)(k.Z,{className:"w-3 h-3"}),p("context")]})]}):(0,r.jsx)("span",{className:(0,i.cn)("text-[10px] px-1.5 py-0.5 rounded","bg-muted text-muted-foreground shrink-0"),children:function(e,t){switch(e){case"category":return t("slashTypeCategory");case"prompt":return t("slashTypePrompt");case"skill":return t("slashTypeSkill");case"research":return t("slashTypeResearch");case"file":return t("slashTypeFile");case"pack":return t("slashTypePack");case"goal":return t("slashTypeGoal");case"priority":return t("slashTypePriority");case"task":return t("slashTypeTask");case"tool":return t("slashTypeTool");case"semantic":return t("slashTypeSemantic")}}(e.type,p)}),(0,r.jsx)("div",{className:"shrink-0",title:function(e,t){switch(e){case"user":return t("slashScopeUser");case"organization":return t("slashScopeOrganization");case"system":return t("slashScopeSystem")}}(e.scope,p),children:(0,r.jsx)(a,{className:"w-3.5 h-3.5 text-muted-foreground/60"})})]},"".concat(e.type,"-").concat(e.id))})})]})}var Q=n(90697);function X(e){var t;let{value:n,onChange:o,onSend:P,onStop:E,focusTargetRef:D,onRecallLastMessage:Z,embedded:W=!1,isLoading:z=!1,isStreaming:U=!1,disabled:G=!1,placeholder:V,model:H,onModelChange:J,runtime:q="vercel",onRuntimeChange:$,runtimeOptions:B=[],hideRuntimeSelector:K=!1,deepThinking:X=!1,onDeepThinkingChange:et,contextFiles:er=[],contextFileTruncations:es=[],onAddContextFile:ea,onRemoveContextFile:ei,onClearAllContextFiles:el,onFilesDropped:eo,pendingUploads:ec=[],onRemovePendingUpload:ed,onReferencePasted:eu,selectedPacks:em=[],onRemovePack:ex,onOpenPromptLibrary:ep,onOpenSkillPicker:eg,selectedSkills:eh=[],onRemoveSkill:ef,hideModelSelector:ev=!1,allowedModelProviders:eb,mode:ey="wide",onOpenCommandPalette:ej,pinnedGoals:eN=[],onRemovePinnedGoal:ew,slashCommands:ek,onSlashCommandsChange:eC,onOpenSlashHelp:e_,onSlashAutoExecute:eS,disableSlashCommands:eT=!1,conversationTokens:eP=0,hasSummary:eE=!1,className:eA}=e,eR=(0,L.T)("chat"),eI=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(D)return D.current=eI.current,()=>{D.current===eI.current&&(D.current=null)}},[D]);let eO=(0,a.useRef)(null),eD=(0,a.useRef)(null),[eZ,eL]=(0,a.useState)(!1),[eM,eF]=(0,a.useState)(!1),[eW,ez]=(0,a.useState)(!1),eU=(0,a.useRef)(0),eG=(0,a.useRef)(()=>!1),[eV,eH]=(0,a.useState)(!1),eJ=e=>{if(e.loadFailed)return null;let t=es.find(t=>t.id===e.id||!t.id&&t.name===e.name&&1===[...er,...ec].filter(t=>t.name===e.name).length);return t?(0,r.jsx)("span",{role:"status",className:"text-xs text-status-needs-you-foreground",title:eR("contextFileTruncatedDetail",{delivered:String(t.deliveredChars),total:String(t.totalChars)}),children:eR("contextFileTruncated")}):null},eq=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{debounceMs:t=150,minChars:n=0,onCommandSelected:r}=e,[s,i]=(0,a.useState)(!1),[l,o]=(0,a.useState)(""),[c,d]=(0,a.useState)(null),[u,m]=(0,a.useState)([]),[x,p]=(0,a.useState)(0),[g,h]=(0,a.useState)([]),[f,v]=(0,a.useState)(!1),b=(0,a.useRef)(null),y=(0,a.useRef)(null),j=(0,a.useRef)(0),N=(0,a.useRef)(!1),w=[{key:"tasks",label:"Oppgaver",prefix:"tasks",description:"S\xf8k i oppgaver",types:["task"]},{key:"goals",label:"M\xe5l",prefix:"goals",description:"S\xf8k i m\xe5l",types:["goal"]},{key:"priorities",label:"Prioriteter",prefix:"priorities",description:"S\xf8k i prioriteter",types:["priority"]},{key:"context",label:"Kontekst",prefix:"context",description:"S\xf8k i filer og packs",types:["file","pack"]},{key:"capture",label:"Capture",prefix:"capture",description:"Capture-verkt\xf8y (PDF, dokument, lyd...)",types:["tool"]},{key:"prompts",label:"Prompts",prefix:"prompts",description:"S\xf8k i prompts",types:["prompt"]},{key:"skills",label:"Skills",prefix:"skills",description:"S\xf8k i skills",types:["skill"]},{key:"packs",label:"Packs",prefix:"packs",description:"S\xf8k i context packs",types:["pack"]}],k=(0,a.useCallback)(e=>{let t=e.trim().toLowerCase();return(t?w.filter(e=>e.label.toLowerCase().includes(t)||e.prefix.toLowerCase().includes(t)||e.key.toLowerCase().includes(t)):w).map(e=>({type:"category",id:"category-".concat(e.key),name:e.label,shortcut:e.prefix,description:e.description,icon:"Folder",scope:"system"}))},[]),C=(0,a.useCallback)(()=>{j.current+=1,b.current&&clearTimeout(b.current),y.current&&y.current.abort(),v(!1)},[]),_=(0,a.useCallback)(async(e,t,r)=>{if(y.current&&y.current.abort(),t.length<n){e===j.current&&(m([]),v(!1));return}
1v(!0),y.current=new AbortController;try{let n=new URLSearchParams({q:t});r&&r.length>0&&n.set("types",r.join(","));let s=await fetch("/api/slash-commands/search?".concat(n),{signal:y.current.signal});if(!s.ok)throw Error("Search failed");let a=await s.json();if(e!==j.current)return;let i=a.results||[];N.current&&null===c&&(i=[...k(t),...i]),"capture"===c&&(i=i.filter(e=>"tool"===e.type&&(e.description||"").toLowerCase().includes("capture:"))),m(i),p(0)}catch(t){e===j.current&&"AbortError"!==t.name&&(M.kg.error("Slash command search error:",t),m([]))}finally{e===j.current&&v(!1)}},[n,c]),S=(0,a.useCallback)((e,n)=>{b.current&&clearTimeout(b.current);let r=++j.current;b.current=setTimeout(()=>{_(r,e,n)},t)},[_,t]),T=(0,a.useCallback)(e=>{C();let t=e.trimStart(),n=function(e){let t=e.trim().match(/(?:^|\s)\/([a-zA-Z0-9_-]*)$/);if(t){var n;return null!==(n=t[1])&&void 0!==n?n:""}return null}(e);if(null!==n){let e=n.toLowerCase();if(["search","log"].some(t=>e===t||e.startsWith(t+" ")))return N.current=!1,s&&(i(!1),o(""),m([]),p(0)),!1}if(null!==n&&/^\/[a-zA-Z0-9_-]+$/.test(t)){N.current=!1;let e=n.toLowerCase(),t="task"===e?"tasks":"goal"===e?"goals":"priority"===e?"priorities":e,r=w.find(e=>e.key===t||e.prefix===t);if(r)return s||i(!0),d(r.key),o(""),m([]),p(0),v(!0),S("",r.types),!0}if(/^\/[a-zA-Z0-9_-]*$/.test(t)){N.current=!0,s||i(!0),d(null),o(null!=n?n:"");let e=k(null!=n?n:"");return m(e),p(0),(null!=n?n:"").trim()?(v(0===e.length),S(null!=n?n:"")):v(!1),!0}let r=t.match(/^\/(tasks?|goals?|priorities?|context|capture|prompts|skills|packs)\s+(.*)$/i);if(r){N.current=!1;let e=(r[1]||"").toLowerCase(),t=(r[2]||"").trim(),n="task"===e?"tasks":"goal"===e?"goals":"priority"===e?"priorities":e,a=w.find(e=>e.key===n);return!!a&&((s||i(!0),d(a.key),o(t),t)?S(t,a.types):(m([]),p(0),v(!0),S("",a.types)),!0)}return null!==n?(N.current=!1,s||i(!0),d(null),o(n),S(n),!0):(s&&!e.trimStart().startsWith("/")&&(N.current=!1,i(!1),d(null),o(""),m([]),p(0)),!1)},[s,S,k,C]),P=(0,a.useCallback)(e=>{if(!s||0===u.length){if("Backspace"===e.key&&g.length>0){let t=e.target;if(0===t.selectionStart&&0===t.selectionEnd)return h(e=>e.slice(0,-1)),!0}return!1}switch(e.key){case"ArrowDown":return e.preventDefault(),p(e=>(e+1)%u.length),!0;case"ArrowUp":return e.preventDefault(),p(e=>(e-1+u.length)%u.length),!0;case"Enter":case"Tab":return e.preventDefault(),u[x]&&E(u[x]),!0;case"Escape":return e.preventDefault(),C(),i(!1),d(null),o(""),m([]),!0;default:return!1}},[s,u,x,g.length,C]),E=(0,a.useCallback)(e=>{C();let t={type:e.type,id:e.id,name:e.name,shortcut:e.shortcut||e.name,chunkText:e.chunkText,fileId:e.fileId,createdAt:e.createdAt};if("tool"!==e.type&&"category"!==e.type&&h(e=>e.some(e=>e.id===t.id&&e.type===t.type)?e:[...e,t]),r&&r(t),"category"===e.type){i(!0),d(e.shortcut||null),o(""),m([]),p(0),v(!1);return}i(!1),d(null),o(""),m([]),p(0)},[r,C]),A=(0,a.useCallback)(e=>{E(e)},[E]),R=(0,a.useCallback)(e=>{h(t=>t.filter(t=>t.id!==e))},[]),I=(0,a.useCallback)(()=>{C(),o(""),m([]),p(0)},[C]),O=(0,a.useCallback)(()=>{C(),i(!1),d(null),o(""),m([]),p(0),h([]),v(!1)},[C]);return(0,a.useEffect)(()=>()=>{j.current+=1,b.current&&clearTimeout(b.current),y.current&&y.current.abort()},[]),{isActive:s,query:l,activeCategory:c,results:u,selectedIndex:x,selectedCommands:g,isLoading:f,handleInput:T,handleKeyDown:P,selectCommand:A,removeCommand:R,clearQuery:I,reset:O,setSelectedIndex:p}}({onCommandSelected:(0,a.useCallback)(e=>{if("category"===e.type){let t=n.lastIndexOf("/"),r=-1!==t?n.slice(0,t)+"/".concat(e.shortcut," "):"/".concat(e.shortcut," ");o(r),eG.current(r);return}if(eS&&["prompt","skill","research","file","pack","tool","goal","priority","task"].includes(e.type)){let t=n.lastIndexOf("/");-1!==t&&o(n.slice(0,t)),setTimeout(()=>{eS([e])},100)}},[eS,n,o])});eG.current=eq.handleInput,(0,a.useEffect)(()=>{ek&&eq.selectedCommands},[ek,eq.selectedCommands]),(0,a.useEffect)(()=>{eC&&eq.selectedCommands.length>0&&eC(eq.selectedCommands)},[eq.selectedCommands,eC]);let e$=null!=V?V:eR("typeMessage"),eB=(0,I.lt)(),eK="Control+Space"===eB?"â".concat(eR("spaceKey")):"Alt+Space"===eB?"â¥".concat(eR("spaceKey")):"Shift+Space"===eB?"â§".concat(eR("spaceKey")):"Space"
1===eB?eR("spaceKey"):"Enter"===eB?"âµ":eB;(0,a.useEffect)(()=>{let e=eI.current;if(!e)return;e.style.height="auto";let t=Math.min(e.scrollHeight,200);e.style.height="".concat(t,"px"),e.scrollHeight>200?(e.style.overflowY="auto",e.scrollTop=e.scrollHeight):e.style.overflowY="hidden"},[n]),(0,a.useEffect)(()=>{var e;null===(e=eI.current)||void 0===e||e.focus()},[]),(0,a.useEffect)(()=>{(z||U)&&ez(!1)},[z,U]),(0,a.useEffect)(()=>{""===n&&ez(!1)},[n]);let eY=function(e,t,n){let[r,s]=(0,a.useState)(null),[i,l]=(0,a.useState)([]),[o,c]=(0,a.useState)(!1),[d,u]=(0,a.useState)(!1),[m,x]=(0,a.useState)(0),p=(0,a.useRef)(null),g=(0,a.useCallback)((e,t)=>{var r,a,i;let l=e.slice(0,t).match(/(?:^|\s)@([^\s@]*)$/u);if(!n||!l){p.current=null,s(null);return}let o=t-(null!==(a=null===(r=l[1])||void 0===r?void 0:r.length)&&void 0!==a?a:0)-1;p.current!==o&&(s({start:o,end:t,query:null!==(i=l[1])&&void 0!==i?i:""}),x(0))},[n]),h=(0,a.useCallback)(()=>{var e;p.current=null!==(e=null==r?void 0:r.start)&&void 0!==e?e:null,s(null)},[r]);(0,a.useEffect)(()=>{if(!r){l([]),c(!1),u(!1);return}let e=new AbortController;l([]),c(!0),u(!1);let t=new URLSearchParams({include_production:"true",include_shared:"true",include_org_core_context:"true",metadata_only:"true",search:r.query});return(async()=>{try{let n=await fetch("/api/library/files?".concat(t),{signal:e.signal});if(!n.ok)throw Error("HTTP ".concat(n.status));let r=await n.json();if(!Array.isArray(r.files))throw Error("Missing file metadata");e.signal.aborted||l(r.files.slice(0,20))}catch(t){e.signal.aborted||u(!0)}finally{e.signal.aborted||c(!1)}})(),()=>e.abort()},[r]),(0,a.useEffect)(()=>{r&&e.slice(r.start,r.end)!=="@".concat(r.query)&&s(null)},[e,r]);let f=(0,a.useCallback)(a=>{r&&n&&(t("".concat(e.slice(0,r.start),"@").concat(a.name," ").concat(e.slice(r.end))),n({id:a.id,name:a.name,source:a.is_production?"production":"library"}),p.current=null,s(null))},[r,e,t,n]),v=(0,a.useCallback)(e=>{if(!r)return!1;if("Escape"===e.key)return e.preventDefault(),h(),!0;if(" "===e.key)return h(),!1;if("ArrowDown"===e.key||"ArrowUp"===e.key)return e.preventDefault(),x(t=>i.length?(t+("ArrowDown"===e.key?1:-1)+i.length)%i.length:0),!0;if("Enter"===e.key&&!e.shiftKey){e.preventDefault();let t=i[m];return t&&f(t),!0}return!1},[r,h,i,m,f]);return{active:null!==r,files:i,loading:o,failed:d,selectedIndex:m,handleInput:g,handleKeyDown:v,select:f,close:h}}(n,o,eu),eQ=(0,a.useCallback)(e=>{if(!eY.handleKeyDown(e)&&!(!eT&&eq.isActive&&eq.handleKeyDown(e))){if("Escape"===e.key&&U&&E){e.preventDefault(),E();return}if("ArrowUp"===e.key&&!n.trim()&&Z){e.preventDefault(),Z();return}if(!eT&&"Backspace"===e.key&&eq.selectedCommands.length>0){let t=e.target;if(0===t.selectionStart&&0===t.selectionEnd&&""===n){e.preventDefault();let t=eq.selectedCommands[eq.selectedCommands.length-1];t&&eq.removeCommand(t.id);return}}if("Enter"===e.key&&!e.shiftKey){if(!eT&&eq.isActive){e.preventDefault();return}if(e_){let t=function(e){let t=e.trim();if(!t)return{commands:[],remainingText:t,isHelpQuery:!1};for(let e of F){let r=RegExp("^\\/\\".concat("?"===e?"\\?":e,"(?:\\s+(.*))?$"),"i"),s=t.match(r);if(s){var n;return{commands:[],remainingText:"",isHelpQuery:!0,helpQuery:(null===(n=s[1])||void 0===n?void 0:n.trim())||void 0}}}let r=[],s=0,a=t;for(;a;){let e=a.match(/^\/([a-zA-Z0-9_-]+)/);if(e&&e[1]){r.push(e[1]),s+=e[0].length,a=a.slice(e[0].length).trimStart();let n=t.slice(s).match(/^\s+/);n&&(s+=n[0].length)}else break}return{commands:r,remainingText:a,isHelpQuery:!1}}(n.trim());if(t.isHelpQuery){e.preventDefault(),e_(t.helpQuery),o("");return}}if(e.preventDefault(),!z&&!eW&&n.trim()){var t;ez(!0),null===(t=eD.current)||void 0===t||t.call(eD),eO.current=null,P()}return}if("/"===e.key&&e.metaKey&&ej){e.preventDefault(),ej();return}}},[eY,z,U,eW,n,P,E,Z,ea,ej,eq]),eX=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eU.current++,e.dataTransfer.types.includes("Files")&&eF(!0)},[]),e0=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eU.current--,0===eU.current&&eF(!1)},[]),e1=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),e5=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eU.current=0,eF(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&eo&&eo(t)},[eo]),e3=(0,a.useCallback)(e=>{var t;let n=null===(t=e.clipboardData)||void 0===t?void 0:t.items;if(!n||!eo)return;let r=[];for(let e=0;e<n.length;e++){let t=n[e];if(t&&t.type.startsWith("image/")){let e=t.getAsFile();if(e){let n=new Date().toISOString().replace(/[:.]/g,"-"),s=t.type.split("/")[1]||"png",a=new globalThis.File([e],"screenshot-".concat(n,".").concat(s),{type:e.type});
1r.push(a)}}}r.length>0&&(e.preventDefault(),e.stopPropagation(),eo(r))},[eo]),e2=!z&&!eW&&(null!==(t=null==n?void 0:n.trim().length)&&void 0!==t?t:0)>0,e4=(0,a.useMemo)(()=>{let e=(0,Q.f8)(n||""),t=er.reduce((e,t)=>{var n;let r=t.content?(0,Q.f8)(t.content):0;return(null===(n=t.images)||void 0===n?void 0:n.length)&&(r+=765*t.images.length),e+r},0),r=em.reduce((e,t)=>e+2e3*(t.file_count||0),0),s=eP+e+t+r,a=(0,Q.qc)(H),i=Math.round(s/a*100);return{input:e,conversation:eP,context:t+r,total:s,limit:a,percentage:i,isWarning:i>80,isError:i>95}},[n,er,em,H,eP]);return(0,r.jsxs)("div",{className:(0,i.cn)("w-full relative",eA),onDragEnter:eX,onDragLeave:e0,onDragOver:e1,onDrop:e5,children:[eM&&(0,r.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-2xl border-2 border-dashed border-primary bg-primary/5 backdrop-blur-sm",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,r.jsx)(d.Z,{className:"w-8 h-8 text-primary"}),(0,r.jsx)("p",{className:"text-sm font-medium text-primary",children:eR("dropFilesHere")})]})}),eh.length>0&&(0,r.jsx)("div",{className:"mb-3 flex flex-wrap gap-2","aria-label":eR("skills"),children:eh.map(e=>(0,r.jsxs)("div",{className:"inline-flex min-h-8 max-w-full items-center gap-1 rounded-md border border-border bg-muted pl-2 text-xs text-foreground",children:[(0,r.jsx)(u.Z,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),(0,r.jsx)(s.default,{href:"/skills/".concat(encodeURIComponent(e.id)),className:"min-w-0 truncate py-1 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",title:"".concat(eR("skills"),": ").concat(e.name),children:e.name}),ef&&(0,r.jsx)(l.z,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0","aria-label":eR("removeSelectedSkill",{name:e.name}),title:eR("removeSelectedSkill",{name:e.name}),onClick:()=>ef(e.id),children:(0,r.jsx)(m.Z,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]},e.id))}),(er.length>0||em.length>0||eN.length>0||eq.selectedCommands.length>0)&&(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[eq.selectedCommands.map(e=>{let t="prompt"===e.type?x.Z:"skill"===e.type?p.Z:"research"===e.type?g.Z:"file"===e.type?h.Z:f.Z,n="prompt"===e.type?"bg-blue-500/10 text-blue-700 dark:text-blue-300 border-blue-500/30":"skill"===e.type?"bg-amber-500/10 text-amber-700 dark:text-amber-300 border-amber-500/30":"research"===e.type?"bg-violet-500/10 text-violet-700 dark:text-violet-300 border-violet-500/30":"file"===e.type?"bg-muted/80 text-foreground border-border/50":"bg-primary/10 text-foreground border-primary/30";return(0,r.jsxs)("div",{className:(0,i.cn)("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-sm border",n),children:[(0,r.jsx)(t,{className:"w-3 h-3"}),(0,r.jsxs)("span",{className:"font-mono",children:["/",e.shortcut]}),(0,r.jsx)("button",{onClick:()=>eq.removeCommand(e.id),className:"ml-0.5 opacity-70 hover:opacity-100 transition-opacity",children:(0,r.jsx)(m.Z,{className:"w-3 h-3"})})]},e.id)}),em.map(e=>{var t;return(0,r.jsxs)("div",{className:(0,i.cn)("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full","bg-primary/10 text-sm text-foreground","border border-primary/30"),children:[(0,r.jsx)(f.Z,{className:"w-3 h-3 text-primary"}),(0,r.jsx)("span",{className:"max-w-[150px] truncate",children:e.name}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",e.file_count||(null===(t=e.files)||void 0===t?void 0:t.length)||0,")"]}),ex&&(0,r.jsx)("button",{onClick:()=>ex(e.id),className:"ml-0.5 text-muted-foreground hover:text-foreground transition-colors",children:(0,r.jsx)(m.Z,{className:"w-3 h-3"})})]},e.id)}),er.length>0&&(0,r.jsxs)(r.Fragment,{children:[!(er.length>3)||eV||er.some(e=>null!==eJ(e))?er.map(e=>(0,r.jsxs)("div",{className:(0,i.cn)("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-sm",e.loadFailed?"bg-status-failed-muted text-status-failed-foreground border border-status-failed-border":"bg-muted/80 text-foreground border border-border/50"),title:e.loadFailed?eR("contextFileLoadFailed"):void 0,children:[e.loadFailed?(0,r.jsx)(b.Z,{className:"w-3 h-3"}):(0,r.jsx)(d.Z,{className:"w-3 h-3 text-muted-foreground"}),(0,r.jsx)("span",{className:"max-w-[150px] truncate",children:e.name}),eJ(e),e.loadFailed&&(0,r.jsx)("span",{className:"text-xs",children:eR("contextFileLoadFailed")}),ei&&(0,r.jsx)("button",{onClick:()=>ei(e.id),className:"ml-0.5 text-muted-foreground hover:text-foreground transition-colors",children:(0,r.jsx)(m.Z,{className:"w-3 h-3"})})]},e.id)):(0,r.jsxs)("button",{onClick:()=>eH(!0),className:(0,i.cn)("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full","bg-muted/80 text-sm text-foreground","border border-border/50 hover:bg-muted transition-colors"),children:[(0,r.jsx)(d.Z,{className:"w-3 h-3 text-muted-foreground"}),(0,r.jsx)("span",{children:eR("filesCount",{count:String(er.length)})}),(0,r.jsx)(v.Z,{className:"w-3 h-3 text-muted-foreground"})]}),er.length>3&&eV&&(0,r.jsxs)("button",{onClick:()=>eH(!1),className:(0,i.cn)("inline-flex items-center gap-1 px-2 py-1 rounded-full","text-xs text-muted-foreground hover:text-foreground","hover:bg-muted/50 transition-colors"),title:eR("hideFiles"),children:[(0,r.jsx)(y.Z,{className:"w-3 h-3"}),(0,r.jsx)("span",{children:eR("hide")})]}),er.length>=2&&el&&(0,r.jsxs)("button",{onClick:()=>{el(),eH(!1)},className:(0,i.cn)("inline-flex items-center gap-1 px-2 py-1 rounded-full","text-xs text-muted-foreground hover:text-foreground","hover:bg-muted/50 transition-colors"),title:eR("clearAllContextFiles"),children:[(0,r.jsx)(m.Z,{className:"w-3 h-3"}),(0,r.jsx)("span",{children:eR("clearAll")})]})]}),eN.map(e=>{let t="priority"===e.type,n="task"===e.type,s="on_track"===e.status?"bg-green-500":"at_risk"===e.status?"bg-yellow-500":"off_track"===e.status?"bg-red-500":null;return e.shortId?(0,r.jsxs)("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-sm bg-primary/10 text-primary border border-primary/30",children:[(0,r.jsx)("span",{className:"font-mono font-bold text-xs",children:e.shortId.toUpperCase()}),(0,r.jsx)("span",{className:"max-w-[120px] truncate",children:e.name}),ew&&(0,r.jsx)("button",{onClick:()=>ew(e.id),className:"ml-0.5 opacity-70 hover:opacity-100 transition-opacity",children:(0,r.jsx)(m.Z,{className:"w-3 h-3"})})]},e.id):(0,r.jsxs)("div",{className:(0,i.cn)("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-sm",n?"bg-blue-500/10 text-blue-700 dark:text-blue-300 border border-blue-500/30":t?"bg-teal-500/10 text-teal-700 dark:text-teal-300 border border-teal-500/30":"bg-amber-500/10 text-amber-700 dark:text-amber-300 border border-amber-500/30"),children:[n?(0,r.jsx)(j.Z,{className:"w-3 h-3"}):t?(0,r.jsx)(N.Z,{className:"w-3 h-3"}):(0,r.jsx)(w.Z,{className:"w-3 h-3"}),(0,r.jsx)("span",{className:"max-w-[150px] truncate",children:e.name}),s&&(0,r.jsx)("div",{className:(0,i.cn)("w-2 h-2 rounded-full",s)}),ew&&(0,r.jsx)("button",{onClick:()=>ew(e.id),className:"ml-0.5 opacity-70 hover:opacity-100 transition-opacity",children:(0,r.jsx)(m.Z,{className:"w-3 h-3"})})]},e.id)})]}),(0,r.jsxs)("div",{className:(0,i.cn)("relative rounded-2xl border transition-all duration-200",eM?"border-primary shadow-[0_0_0_3px_rgba(var(--primary),0.1)]":eZ?"border-primary/50 shadow-[0_0_0_3px_rgba(0,0,0,0.05)] dark:shadow-[0_0_0_3px_rgba(255,255,255,0.05)]":W?"border-border-strong hover:border-primary/30":"border-border-strong hover:border-primary/30 shadow-sm",W?"bg-input-bg":"bg-card"),children:[eq.isActive&&!eT&&(0,r.jsx)(Y,{results:eq.results,selectedIndex:eq.selectedIndex,isLoading:eq.isLoading,query:eq.query,activeCategory:eq.activeCategory,onSelect:e=>{var t;eq.selectCommand(e),null===(t=eI.current)||void 0===t||t.focus()},onHover:e=>eq.setSelectedIndex(e)}),ec.length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5 px-3 pt-3",children:ec.map(e=>(0,r.jsxs)("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-md bg-muted/60 text-xs text-muted-foreground border border-border/40",children:[(0,r.jsx)(d.Z,{className:"w-3 h-3 shrink-0"}),(0,r.jsx)("span",{className:"max-w-[180px] truncate",children:e.name}),eJ(e),ed&&(0,r.jsx)("button",{onClick:()=>ed(e.id),className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,r.jsx)(m.Z,{className:"w-3 h-3"})})]},e.id))}),eY.active&&(0,r.jsxs)("div",{className:"rounded-md border border-border bg-card p-1",role:"listbox","aria-label":eR("searchProductionFiles"),children:[eY.loading&&(0,r.jsx)("p",{role:"status",className:"px-3 py-2 text-xs text-muted-foreground",children:eR("loadingFiles")}),eY.failed&&(0,r.jsx)("p",{role:"alert",className:"px-3 py-2 text-xs text-muted-foreground",children:eR("contextFileLoadFailed")}),!eY.loading&&!eY.failed&&0===eY.files.length&&(0,r.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:eR("noFilesMatchSearch")}),eY.files.map((e,t)=>(0,r.jsx)("button",{type:"button",role:"option","aria-selected":t===eY.selectedIndex,className:(0,i.cn)("block w-full rounded px-3 py-2 text-left text-sm",t===eY.selectedIndex?"bg-accent text-accent-foreground":"hover:bg-muted"),onMouseDown:e=>e.preventDefault(),onClick:()=>eY.select(e),children:e.name},e.id))]}),(0,r.jsx)("textarea",{ref:eI,"aria-label":eR("messageInput"),value:n,onChange:e=>{let t=e.target.value,n=(0,O.kj)(t);if(n.length>0&&eu)for(let e of n){t=t.replace(e.fullMatch,"@".concat(e.name," "));let n="file"===e.type?"library":"production"===e.type?"production":"dialogue"===e.type?"dialogue":"flow"===e.type?"flow":"folder"===e.type?"folder":"library";eu({id:e.id,name:e.name,source:n})}o(t),eY.handleInput(t,e.target.selectionStart),eT||eq.handleInput(t)},onKeyDown:eQ,onPaste:e3,onFocus:()=>eL(!0),onBlur:()=>{eL(!1),setTimeout(()=>{var e;null===(e=document.activeElement)||void 0===e||e.closest(".slash-dropdown")},150)},placeholder:e$,disabled:G,rows:1,className:(0,i.cn)("w-full resize-none bg-transparent","px-4 pb-14",ec.length>0?"pt-2":"pt-4","text-base leading-relaxed","placeholder:text-muted-foreground
1/60","focus:outline-none","disabled:opacity-50 disabled:cursor-not-allowed"),style:{minHeight:"60px",maxHeight:"200px"}}),(0,r.jsxs)("div",{className:(0,i.cn)("absolute bottom-0 left-0 right-0 flex items-center justify-between px-3 pb-3 pt-2 rounded-b-2xl",W?"bg-input-bg":"bg-card"),children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(ea||ep||eg)&&(0,r.jsxs)(A.J2,{children:[(0,r.jsx)(A.xo,{asChild:!0,children:(0,r.jsx)(l.z,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground","aria-label":eR("addContext"),children:(0,r.jsx)(k.Z,{className:"w-4 h-4"})})}),(0,r.jsxs)(A.yk,{side:"top",align:"start",className:"w-48 p-1",children:[ea&&(0,r.jsxs)("button",{onClick:()=>{ea()},className:"flex items-center gap-2 w-full px-3 py-2 text-sm rounded-md hover:bg-muted transition-colors text-left",children:[(0,r.jsx)(d.Z,{className:"w-4 h-4 text-muted-foreground"}),(0,r.jsx)("span",{children:eR("contextFiles")}),(0,r.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"@"})]}),ep&&(0,r.jsxs)("button",{onClick:()=>{ep()},className:"flex items-center gap-2 w-full px-3 py-2 text-sm rounded-md hover:bg-muted transition-colors text-left",children:[(0,r.jsx)(C.Z,{className:"w-4 h-4 text-muted-foreground"}),(0,r.jsx)("span",{children:eR("promptLibrary")})]}),eg&&(0,r.jsxs)("button",{onClick:()=>{eg()},className:"flex items-center gap-2 w-full px-3 py-2 text-sm rounded-md hover:bg-muted transition-colors text-left",children:[(0,r.jsx)(u.Z,{className:"w-4 h-4 text-muted-foreground"}),(0,r.jsx)("span",{children:eR("skills")})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(R.VoiceRecorderButton,{onSessionStart:()=>{eO.current=n},onTranscript:e=>{var t;let r=null!==(t=eO.current)&&void 0!==t?t:n,s=r?"".concat(r," ").concat(e):e;o(s),eO.current=null,setTimeout(()=>{var e,t;null===(e=eI.current)||void 0===e||e.focus(),null===(t=eI.current)||void 0===t||t.setSelectionRange(s.length,s.length)},100)},stopRef:eD,size:"sm",className:"h-8 w-8",hideTooltip:!1}),"wide"===ey&&(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground/60",children:eK})]}),!K&&$&&B.length>1&&(0,r.jsx)(ee,{value:q,onChange:$,options:B,disabled:U,compact:"narrow"===ey}),!ev&&(0,r.jsx)(en,{value:H,onChange:J,disabled:U,compact:"narrow"===ey,allowedProviders:eb}),et&&(0,r.jsx)(c.pn,{children:(0,r.jsxs)(c.u,{children:[(0,r.jsx)(c.aJ,{asChild:!0,children:(0,r.jsxs)("button",{onClick:()=>et(!X),className:(0,i.cn)("flex items-center gap-1.5 px-2 h-8 rounded-md text-xs transition-colors",X?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[(0,r.jsx)(_.Z,{className:"w-3.5 h-3.5"}),(0,r.jsx)("span",{className:(0,i.cn)("hidden","wide"===ey&&"sm:inline"),children:eR("deep")})]})}),(0,r.jsx)(c._v,{side:"top",children:(0,r.jsx)("p",{children:X?eR("deepThinkingActive"):eR("enableDeepThinking")})})]})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[U&&(0,r.jsx)(c.pn,{children:(0,r.jsxs)(c.u,{children:[(0,r.jsx)(c.aJ,{asChild:!0,children:(0,r.jsx)(l.z,{variant:"outline",size:"icon-sm",onClick:E,"aria-label":eR("stopGeneration"),className:"rounded-full",children:(0,r.jsx)(S.Z,{className:"w-3 h-3 fill-current"})})}),(0,r.jsx)(c._v,{side:"top",children:(0,r.jsx)("p",{children:eR("stopGeneration")})})]})}),(0,r.jsx)(c.pn,{children:(0,r.jsxs)(c.u,{children:[(0,r.jsx)(c.aJ,{asChild:!0,children:(0,r.jsx)(l.z,{"data-send-button":!0,variant:"default",size:"icon-sm","aria-label":eR("sendMessage"),onClick:()=>{var e;e2&&(ez(!0),null===(e=eD.current)||void 0===e||e.call(eD),eO.current=null,P())},disabled:!e2,className:(0,i.cn)("rounded-full transition-all duration-200",e2&&"shadow-sm"),children:(0,r.jsx)(T.Z,{className:"w-4 h-4"})})}),(0,r.jsx)(c._v,{side:"top",children:(0,r.jsx)("p",{children:eR("sendMessage")})})]})})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1 px-1",children:[(0,r.jsx)(c.pn,{children:(0,r.jsxs)(c.u,{children:[(0,r.jsx)(c.aJ,{asChild:!0,children:(0,r.jsxs)("div",{className:(0,i.cn)("flex items-center gap-1.5 text-[11px] transition-colors cursor-default",e4.isError?"text-destructive":e4.isWarning?"text-amber-500":"text-muted-foreground"),children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"font-medium",children:e4.total.toLocaleStr
1ing()}),(0,r.jsx)("span",{className:"opacity-50",children:"/"}),(0,r.jsx)("span",{className:"opacity-70",children:eR("tokenThousands",{count:(e4.limit/1e3).toFixed(0)})})]}),e4.percentage>0&&(0,r.jsxs)("span",{className:"opacity-50",children:["(",e4.percentage,"%)"]}),eE&&(0,r.jsx)("span",{className:"text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground",children:eR("summarized")})]})}),(0,r.jsx)(c._v,{side:"top",className:"text-xs",children:(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"font-medium",children:eR("tokenUsage")}),e4.conversation>0&&(0,r.jsxs)("p",{children:[eR("conversation"),": ",e4.conversation.toLocaleString()]}),(0,r.jsxs)("p",{children:[eR("inputLabel"),": ",e4.input.toLocaleString()]}),e4.context>0&&(0,r.jsxs)("p",{children:[eR("context"),": ",e4.context.toLocaleString()]}),(0,r.jsxs)("p",{className:"text-muted-foreground",children:[eR("model"),": ",H," (",eR("tokenThousands",{count:(e4.limit/1e3).toFixed(0)})," ",eR("limit"),")"]}),eE&&(0,r.jsx)("p",{className:"text-muted-foreground italic",children:eR("olderMessagesSummarized")})]})})]})}),(0,r.jsx)("p",{className:"text-[9px] text-muted-foreground/30",children:eR("aiCanMakeMistakes")})]})]})}function ee(e){var t,n,s;let{value:a,onChange:l,options:c,disabled:d,compact:u=!1}=e,m=(0,L.T)("chat"),x=null!==(t=c.find(e=>e.id===a))&&void 0!==t?t:c[0];return(0,r.jsxs)(o.Ph,{value:a,onValueChange:e=>l("hermes"===e?"hermes":"vercel"),disabled:d,children:[(0,r.jsxs)(o.i4,{className:(0,i.cn)("h-8 px-2 gap-1 border-0 bg-transparent hover:bg-muted/50","text-muted-foreground hover:text-foreground","focus:ring-0 focus:ring-offset-0","w-auto min-w-0"),title:null!==(n=null==x?void 0:x.label)&&void 0!==n?n:m("runtime"),children:[(0,r.jsx)(P.Z,{className:"w-3.5 h-3.5"}),!u&&(0,r.jsx)("span",{className:"text-sm hidden sm:inline",children:null!==(s=null==x?void 0:x.label)&&void 0!==s?s:m("runtime")})]}),(0,r.jsx)(o.Bw,{align:"start",className:"min-w-[180px]",children:c.map(e=>(0,r.jsx)(o.Ql,{value:e.id,disabled:!e.available,children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"font-medium",children:e.label}),!e.available&&e.unavailableReason&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e.unavailableReason})]})},e.id))})]})}function et(){let e=(0,Z.Ih)();return Z.LF.map(t=>{let n=D.jd[t.id];return n?{id:t.id,name:n.name,provider:n.provider,description:n.description,capabilities:n.capabilities||[],isDefault:t.id===e,displayOrder:t.displayOrder}:null}).filter(e=>null!==e)}function en(e){var t,n;let{value:s,onChange:l,disabled:c,compact:d=!1,allowedProviders:u}=e,[m,x]=(0,a.useState)([]),[p,g]=(0,a.useState)(!0);(0,a.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/ai/available-models");if(e.ok){let t=await e.json();x(t.models||[])}else console.warn("[ModelSelector] API failed, using catalog models"),x(et())}catch(e){console.error("[ModelSelector] Failed to fetch models:",e),x(et())}finally{g(!1)}})()},[]);let h=m.filter(e=>{if(u&&!u.includes(e.provider)||!(0,Z.aA)(e.id))return!1;let t=D.jd[e.id];return null==t||!t.isLegacy}),f=(0,L.T)("chat"),v=(null===(t=h.find(e=>e.id===s))||void 0===t?void 0:t.name)||(null===(n=D.jd[s])||void 0===n?void 0:n.name)||f("model"),b=h.filter(e=>"anthropic"===e.provider),y=h.filter(e=>"openai"===e.provider),j=h.filter(e=>"google"===e.provider),N=h.filter(e=>"mistral"===e.provider),w=h.filter(e=>"openrouter"===e.provider),k=h.filter(e=>"ollama"===e.provider);return(0,r.jsxs)(o.Ph,{value:s,onValueChange:l,disabled:c||p,children:[(0,r.jsxs)(o.i4,{className:(0,i.cn)("h-8 px-2 gap-1 border-0 bg-transparent hover:bg-muted/50","text-muted-foreground hover:text-foreground","focus:ring-0 focus:ring-offset-0","w-auto min-w-0"),title:v,children:[(0,r.jsx)(E.Z,{className:"w-3.5 h-3.5"}),!d&&(0,r.jsx)("span",{className:"text-sm hidden sm:inline",children:v})]}),(0,r.jsx)(o.Bw,{align:"start",className:"min-w-[220px]",children:p?(0,r.jsx)("div",{className:"px-2 py-4 text-sm text-muted-foreground text-center",children:f("loading")}):(0,r.jsxs)(r.Fragment,{children:[b.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:f("modelProviderClaude")}),b.map(e=>(0,r.jsx)(o.Ql,{value:e.id,children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e.description})]})},e.id))]}),y.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"my-1 border-t border-border"}),(0,r.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:f("modelProviderOpenAI")}),y.map(e=>(0,r.jsx)(o.Ql,{value:e.id,children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e.description})]})},e.id))]}),j.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"my-1 border-t border-border"}),(0,r.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:f("modelProviderGoogle")}),j.map(e=>(0,r.jsx)(o.Ql,{value:e.id,children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e.description})]})},e.id))]}),N.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"my-1 border-t border-border"}),(0,r.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:f("modelProviderMistral")}),N.map(e=>(0,r.jsx)(o.Ql,{value:e.id,children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e.description})]})},e.id))]}),w.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"my-1 border-t border-border"}),(0,r.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:f("modelProviderQwen")}),w.map(e=>(0,r.jsx)(o.Ql,{value:e.id,children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e.description})]})},e.id))]}),k.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"my-1 border-t border-border"}),(0,r.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:f("modelProviderOllama")}),k.map(e=>(0,r.jsx)(o.Ql,{value:e.id,children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e.description})]})},e.id))]})]})})]})}},2820:function(e,t,n){n.d(t,{H:function(){return ep}});var r=n(27573),s=n(7653),a=n(19369),i=n(1836),l=n(36673),o=n(46393);function c(e){let{attachments:t}=e,n=(0,o.T)("chat");return(null==t?void 0:t.length)?(0,r.jsx)("ul",{"aria-label":n("messageAttachments"),className:"mb-2 flex flex-wrap justify-end gap-2",children:t.map(e=>(0,r.jsxs)("li",{className:"flex min-w-0 items-center gap-2 rounded-md border border-border bg-card px-3 py-2 text-sm text-foreground",children:[(0,r.jsx)(l.Z,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:"break-all",children:e.name})]},e.id))}):null}var d=n(65316),u=n(72725),m=n(59971),x=n(16273),p=n(26798),g=n(79901),h=n(53512),f=n(96702);let v=/^mcp__([^_](?:[^_]|_(?!_))*)__(.+)$/,b=/^plugin-(.+)$/;function y(e){let t=e.replace(/[_-]+/gu," ").trim();return t.length>0?t:e}function j(e){let{data:t,onResolve:n,resolved:i=null,className:l}
1=e,c=(0,o.T)("chat"),[d,u]=(0,s.useState)(null),[m,j]=(0,s.useState)(!1),[N,w]=(0,s.useState)(!1),k=function(e){var t;let n=v.exec(e);if(!n)return{label:y(e),raw:e,surface:null};let r=n[1],s=n[2];if(void 0===r||void 0===s)return{label:y(e),raw:e,surface:null};let a=b.exec(r),i=null!==(t=null==a?void 0:a[1])&&void 0!==t?t:r;return{label:"".concat(y(s)," \xb7 ").concat(i),raw:e,surface:i}}(t.tool),C="confirmation-details-".concat(t.confirmationId),_=async e=>{if(!i&&!d){j(!1),u(e);try{let t=await n(e);!1===t&&(u(null),j(!0))}catch(e){u(null),j(!0)}}};if(i){let e="confirmed"===i;return(0,r.jsxs)(p.Zb,{className:(0,a.cn)("bg-muted/30 border-muted",l),"data-testid":"confirmation-card",children:[(0,r.jsx)(p.Ol,{className:"pb-2",children:(0,r.jsxs)(p.ll,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e?(0,r.jsx)(g.Z,{className:"h-4 w-4 text-green-500"}):(0,r.jsx)(h.Z,{className:"h-4 w-4 text-muted-foreground"}),c(e?"confirmationConfirmedNotice":"confirmationCancelledNotice")]})}),(0,r.jsx)(p.aY,{children:(0,r.jsx)("p",{className:"text-sm text-foreground",children:c("confirmationActionLabel",{tool:t.tool})})})]})}if(d){let e="cancelled"!==d;return(0,r.jsxs)(p.Zb,{className:(0,a.cn)("bg-muted/30 border-muted",l),"data-testid":"confirmation-card",children:[(0,r.jsx)(p.Ol,{className:"pb-2",children:(0,r.jsxs)(p.ll,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e?(0,r.jsx)(g.Z,{className:"h-4 w-4 text-green-500"}):(0,r.jsx)(h.Z,{className:"h-4 w-4 text-muted-foreground"}),c(e?"confirmationApprovalSubmittedNotice":"confirmationCancellationSubmittedNotice")]})}),(0,r.jsx)(p.aY,{children:(0,r.jsx)("p",{className:"text-sm text-foreground",children:c("confirmationActionLabel",{tool:t.tool})})})]})}return(0,r.jsxs)(p.Zb,{className:(0,a.cn)("border-amber-500/30 bg-amber-500/5",l),"data-testid":"confirmation-card",children:[(0,r.jsx)(p.Ol,{className:"pb-3",children:(0,r.jsxs)(p.ll,{className:"text-sm font-medium flex items-center gap-2",children:[(0,r.jsx)(f.Z,{className:"h-4 w-4 text-amber-600"}),c("confirmationTitle")]})}),(0,r.jsxs)(p.aY,{className:"space-y-2",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:k.label}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:c("external_action"===t.actionClass?"confirmationConsequenceExternal":"confirmationConsequenceHighRisk")}),(0,r.jsx)("button",{type:"button",onClick:()=>w(e=>!e),className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground","aria-expanded":N,"aria-controls":C,"data-testid":"confirmation-details-toggle",children:c(N?"confirmationDetailsHide":"confirmationDetailsShow")}),N&&(0,r.jsxs)("div",{id:C,className:"space-y-2","data-testid":"confirmation-details",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:c("confirmationActionLabel",{tool:k.raw})}),t.input&&(0,r.jsx)("pre",{className:"text-xs bg-muted/50 rounded-md p-2 whitespace-pre-wrap break-all","data-testid":"confirmation-payload",children:t.input}),t.writeTarget&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:c("confirmationTargetLabel",{target:t.writeTarget})})]}),m&&(0,r.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:c("confirmationSubmitFailed")}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)(x.z,{size:"sm",onClick:()=>_("confirmed"),disabled:null!==d,children:c("confirmationConfirm")}),"external_action"===t.actionClass&&(0,r.jsx)(x.z,{size:"sm",variant:"secondary",onClick:()=>_("confirmed_always"),disabled:null!==d,children:c("confirmationConfirmAlways")}),(0,r.jsx)(x.z,{size:"sm",variant:"outline",onClick:()=>_("cancelled"),disabled:null!==d,children:c("confirmationCancel")})]})]})]})}function N(e){let{className:t,conversationId:n}=e,[a,i]=(0,s.useState)(null),l=(0,s.useCallback)(e=>{if(!e.colleague){if("confirmation_required"===e.type){let t="object"!=typeof e||null===e?null:"confirmation_required"!==e.type||"string"!=typeof e.confirmationId||"string"!=typeof e.conversationId||"string"!=typeof e.tool||"string"!=typeof e.actionClass?null:{confirmationId:e.confirmationId,conversationId:e.conversationId,tool:e.tool,actionClass:e.actionClass,input:"string"==typeof e.input?e.input:void 0,writeTarget:"string"==typeof e.writeTarget?e.writeTarget:void 0};t&&(!n||t.conversationId===n)&&i({data:t,resolved:null});return}if("confirmation_resolved"===e.type){i(t=>t&&t.data.confirmationId===e.confirmationId?{...t,resolved:e.resolution}:t);return}if("lifecycle"===e.type&&"request_sent"===e.phase){i(null);return}("run_cancelled"===e.type||"lifecycle"===e.type&&"finished"===e.phase)&&i(e=>e&&!e.resolved?{...e,resolved:"cancelled"}:e)}},[n]);(0,s.useEffect)(()=>{n&&i(e=>e&&e.data.conversationId!==n?null:e)},[n]),(0,s.useEffect)(()=>{for(let e of(0,u.lW)())l(e);let e=e=>{let t=e.detail;t&&l(t)};return window.addEventListener(u.dD,e),()=>window.removeEventListener(u.dD,e)},[l]);let o=(0,s.useCallback)(async e=>{if(!a)return!1;try{let t=await fetch("/api/ai/conversations/".concat(a.data.conversationId,"/confirmations"),{method:"POST",headers:{...(0,m.p)(),"Content-Type":"application/json"},body:JSON.stringify({confirmationId:a.data.confirmationId,resolution:e})});if(!t.ok)return!1;let n=await t.json().catch(()=>null);return(null==n?void 0:n.resolved)===!0}catch(e){return!1}},[a]);return a?(0,r.jsx)(j,{data:a.data,onResolve:o,resolved:a.resolved,className:t}):null}var w=n(55298);let k=/^<!--PRAKSIS_ACTIVE_AGENT_REPLY_V1:([^<>\r\n]{1,4096})-->\n?/,C=/<!--PRAKSIS_ACTIVE_AGENT_REPLY_V1:[^<>\r\n]{1,4096}-->\n?/g;var _=n(56683);
1function S(){let e=(0,_._)(["\n?<!--s*","[sS]*?-->"],["\\n?<!--\\s*","[\\s\\S]*?-->"]);return S=function(){return e},e}let T="MEETING_SPLIT_TRANSCRIPT_FOR_AGENT",P=RegExp(String.raw(S(),T),"g");"".concat(T.slice(0,1),"â").concat(T.slice(1));var E=n(52872);let A=/<!--AGENT_(?:THINKING|REASONING_AVAILABLE|TOOL_START|TOOL_DONE|TOOL_ERROR|RUN_CANCELLED):[\s\S]*?-->\n?/g,R={removeActions:!0,removeCanvas:!0,removeDocumentEdit:!0,removeResearchProgress:!0,removeEditMarkers:!0,removeMarkers:!0},I=[/\[RESEARCH_PROGRESS:[^\]]+\]\n?/g,/^ð\s*.+$/gm,/^ð\s*.+$/gm,/^ð\s*.+$/gm,/^ð\s*.+$/gm,/^ð±\s*.+$/gm,/^ð\s*.+$/gm,/^â
\s*.+$/gm,/^ð\s*.+$/gm,/^ð¦\s*.+$/gm,/^\s+ð\s*.+$/gm,/^\s+ð\s*.+$/gm,/^\s+ð¦\s*.+$/gm,/^Steg \d+\/\d+:.+$/gm,/^Søk \d+\/\d+:.+$/gm,/ð\s*\*Søker pÃ¥ nettet.+\*\n?/g,/ð\s*\*Søker:.+\*\n?/g];var O=n(53146),D=n.n(O);let Z={proff_scraper:"Proff.no",brreg_api:"Br\xf8nn\xf8ysund",parallel_search:"researchToolWebSearch",smart_crawler:"researchToolWebsite",website_crawler:"researchToolWebsite",linkedin_browser:"LinkedIn",jina_reader:"researchToolArticle"},L={starting:["researchPreparing","activityAnalyzingRequest"],analyzing:["researchIdentifyingNeeds","researchSelectingTools"],searching:["activityWebSearch","researchFetchingResults"],crawling:["researchReadingWebsites","researchFetchingContent"],complete:["researchPhaseComplete"]};function M(e){var t,n;let{phase:i,currentTool:l,message:c,className:d}
1=e,u=(0,o.T)("chat"),[m,x]=(0,s.useState)(0);if((0,s.useEffect)(()=>{if("complete"===i)return;let e=i&&L[i]||[];if(e.length<=1)return;let t=setInterval(()=>{x(t=>(t+1)%e.length)},2e3);return()=>clearInterval(t)},[i]),!i)return null;let p="complete"===i,g=l?(null===(t=Z[l])||void 0===t?void 0:t.startsWith("researchTool"))?u(Z[l]):Z[l]||l:null,h=L[i]||["researchProcessing"],f=null!==(n=h[m%h.length])&&void 0!==n?n:"researchProcessing",v=c||u(f);return(0,r.jsxs)("div",{className:"jsx-6fef521a1c450f29 "+((0,a.cn)("flex items-center gap-3 py-2 px-3 rounded-lg bg-muted/30 border border-border/50","animate-in fade-in slide-in-from-bottom-2 duration-300",p&&"bg-muted/20",d)||""),children:[!p&&(0,r.jsx)("div",{className:"jsx-6fef521a1c450f29 flex items-center gap-1",children:[0,1,2].map(e=>(0,r.jsx)("div",{style:{animation:"researchDot 1.2s ease-in-out infinite",animationDelay:"".concat(.15*e,"s")},className:"jsx-6fef521a1c450f29 w-1.5 h-1.5 rounded-full bg-foreground/60"},e))}),p&&(0,r.jsx)("div",{className:"jsx-6fef521a1c450f29 w-4 h-4 rounded-full bg-foreground
1/10 flex items-center justify-center",children:(0,r.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,className:"jsx-6fef521a1c450f29 w-2.5 h-2.5 text-foreground/70",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7",className:"jsx-6fef521a1c450f29"})})}),(0,r.jsxs)("div",{className:"jsx-6fef521a1c450f29 flex-1 min-w-0",children:[(0,r.jsx)("span",{className:"jsx-6fef521a1c450f29 "+((0,a.cn)("text-sm text-muted-foreground","animate-in fade-in duration-200",p&&"text-foreground/70")||""),children:v},v),g&&!p&&(0,r.jsx)("span",{className:"jsx-6fef521a1c450f29 text-xs text-muted-foreground/60 ml-2",children:u("viaTool",{tool:g})})]}),(0,r.jsx)(D(),{id:"6fef521a1c450f29",children:"@-webkit-keyframes researchDot{0%,100%{opacity:.4;-webkit-transform:scale(1)translatey(0);transform:scale(1)translatey(0)}50%{opacity:1;-webkit-transform:scale(1.3)translatey(-2px);transform:scale(1.3)translatey(-2px)}}@-moz-keyframes researchDot{0%,100%{opacity:.4;-moz-transform:scale(1)translatey(0);transform:scale(1)translatey(0)}50%{opacity:1;-moz-transform:scale(1.3)translatey(-2px);transform:scale(1.3)translatey(-2px)}}@-o-keyframes researchDot{0%,100%{opacity:.4;-o-transform:scale(1)translatey(0);transform:scale(1)translatey(0)}50%{opacity:1;-o-transform:scale(1.3)translatey(-2px);transform:scale(1.3)translatey(-2px)}}@keyframes researchDot{0%,100%{opacity:.4;-webkit-transform:scale(1)translatey(0);-moz-transform:scale(1)translatey(0);-o-transform:scale(1)translatey(0);transform:scale(1)translatey(0)}50%{opacity:1;-webkit-transform:scale(1.3)translatey(-2px);-moz-transform:scale(1.3)translatey(-2px);-o-transform:scale(1.3)translatey(-2px);transform:scale(1.3)translatey(-2px)}}"})]})}var F=n(29330),W=n(29656),z=n(84643),U=n(20575),G=n(58975),V=n(81920),H=n(30609),J=n(10269),q=n(87354),$=n(82041);function B(e){let t=(0,E.cK)(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return console.error("[CoreContextDiffPreview] Failed to parse signed proposal"),null}}function K(e){return e.replace(/__CORE_CONTEXT_PROPOSAL__[\s\S]*?__END_PROPOSAL__/g,"").trim()}function Y(e){let{proposal:t,onAccept:n,onReject:i,isProcessing:c=!1,className:d}=e,u=(0,o.T)("chat"),[m,g]=(0,s.useState)(!1),h=function(e,t){let n=e.split("\n"),r=t.split("\n"),s=new Set(n),a=new Set(r),i=n.filter(e=>!a.has(e));return{added:r.filter(e=>!s.has(e)),removed:i,unchanged:n.filter(e=>a.has(e))}}(t.current_content,t.proposed_content);return(0,r.jsxs)(p.Zb,{className:(0,a.cn)("border-amber-500/30 bg-amber-500/5",d),children:[(0,r.jsxs)(p.Ol,{className:"pb-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4 text-amber-500"}),(0,r.jsx)(p.ll,{className:"text-base font-medium",children:t.file_name}),(0,r.jsx)($.C,{variant:"outline",className:"text-xs",children:u("coreContextProposalLabel")})]}),(0,r.jsx)($.C,{variant:"secondary",className:"bg-amber-500/20 text-amber-700 dark:text-amber-300",children:u("coreContextProposalPendingApproval")})]}),t.change_summary&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:t.change_summary})]}),(0,r.jsxs)(p.aY,{className:"space-y-4",children:[(0,r.jsx)("div",{className:"rounded-md bg-muted/50 p-3",children:(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(H.Z,{className:"h-4 w-4 text-amber-500 mt-0.5 shrink-0"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-1",children:u("coreContextProposalReason")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t.change_reason})]})]})}),(0,r.jsxs)("div",{className:"flex gap-4 text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"w-3 h-3 rounded-sm bg-green-500/20 border border-green-500/50"}),(0,r.jsx)("span",{className:"text-green-600 dark:text-green-400",children:u("coreContextProposalAddedCount",{count:h.added.length})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"w-3 h-3 rounded-sm bg-red-500/20 border border-red-500/50"}),(0,r.jsx)("span",{className:"text-red-600 dark:text-red-400",children:u("coreContextProposalRemovedCount",{count:h.removed.length})})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:u("coreContextProposalCurrent")}),(0,r.jsx)("div",{className:"rounded-md border bg-background p-3 text-xs font-mono max-h-64 overflow-y-auto",children:t.current_content.split("\n").map((e,t)=>{let n=h.removed.includes(e);return(0,r.jsx)("div",{className:(0,a.cn)("py-0.5",n&&"bg-red-500/10 text-red-600 dark:text-red-400"),children:e||"\xa0"},t)})})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:u("coreContextProposalProposed")}),(0,r.jsx)("div",{className:"rounded-md border bg-background p-3 text-xs font-mono max-h-64 overflow-y-auto",children:t.proposed_content.split("\n").map((e,t)=>{let n=h.added.includes(e);return(0,r.jsx)("div",{className:(0,a.cn)("py-0.5",n&&"bg-green-500/10 text-green-600 dark:text-green-400"),children:e||"\xa0"},t)})})]})]}),(t.current_content.length>500||t.proposed_content.length>500)&&(0,r.jsx)(x.z,{variant:"ghost",size:"sm",onClick:()=>
1g(!m),className:"text-xs",children:u(m?"showLess":"showFullContent")})]}),(0,r.jsxs)(p.eW,{className:"flex justify-end gap-2 pt-0",children:[(0,r.jsxs)(x.z,{variant:"outline",size:"sm",onClick:()=>null==i?void 0:i(t),disabled:c,className:"text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950",children:[(0,r.jsx)(J.Z,{className:"h-4 w-4 mr-1"}),u("reject")]}),(0,r.jsxs)(x.z,{size:"sm",onClick:()=>null==n?void 0:n(t),disabled:c,className:"bg-green-600 hover:bg-green-700 text-white",children:[(0,r.jsx)(q.Z,{className:"h-4 w-4 mr-1"}),u("accept")]})]})]})}var Q=n(44526),X=n(24875),ee=n(29138);function et(e){return"completed"===e.status?"done":!function(e){if(e.transcriptTurns>0)return!0;let t=e.participants;return!!t&&(t.answered>0||t.total>t.draft)}(e)?e.hasSkill&&e.hasPlacement?"ready":"needs_setup":"in_progress"}var en=n(91416),er=n(10381);function es(e){return e.replace(/<!-- DIALOGUE_WIDGET:.*? -->/g,"").trim()}let ea=(e,t)=>"/production/dialogues/".concat(e).concat(t?"?tab=".concat(t):"");async function ei(e){var t,n;let r=await fetch("/api/dialogues/".concat(e,"/invitations"),{credentials:"same-origin"}),s=await r.json();if(!r.ok)throw Error(null!==(t=s.error)&&void 0!==t?t:"Unable to read the participants");return(null!==(n=s.invitations)&&void 0!==n?n:[]).filter(e=>"draft"===e.status&&!0!==e.is_test).map(e=>e.id)}let el={start:"dialogueCardStart",test_self:"dialogueCardTestSelf",send:"dialogueCardSend",add_participants:"dialogueCardAddParticipants",open_results:"dialogueCardOpenResults",open_setup:"dialogueCardOpenSetup"},eo={needs_setup:"dialogueCardPhaseNeedsSetup",ready:"dialogueCardPhaseReady",in_progress:"dialogueCardPhaseInProgress",done:"dialogueCardPhaseDone"};function ec(e){let{dialogueId:t,actions:n,draftCount:s,busy:a,onSend:i,onTestSelf:l}=e,c=(0,o.T)("chat");return(0,r.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:n.map(e=>"send"===e?(0,r.jsx)(x.z,{size:"sm",disabled:a,onClick:i,children:c("dialogueCardSend",{count:s})},e):"test_self"===e?(0,r.jsx)(x.z,{size:"sm",variant:"outline",disabled:a,onClick:l,children:c(el[e])},e):(0,r.jsx)(x.z,{size:"sm",variant:"outline",asChild:!0,children:(0,r.jsxs)("a",{href:ea(t,"open_results"===e?"responses":void 0),target:"_blank",rel:"noopener noreferrer",children:[c(el[e]),(0,r.jsx)(X.Z,{className:"ml-1 h-3.5 w-3.5"})]})},e))})}function ed(e){var t,n,i,c;let{content:d,className:u}=e,m=(0,o.T)("chat"),x=(0,s.useMemo)(()=>(function(e){let t=e.match(/<!-- DIALOGUE_WIDGET:(.*?) -->/);if(t&&t[1])try{let e=JSON.parse(t[1]);if((null==e?void 0:e.type)==="dialogue_widget")return e}catch(e){}return null})(d),[d]),p=null!==(n=null==x?void 0:x.dialogue_id)&&void 0!==n?n:"",{state:g,failure:h,busy:f,run:v}
1=function(e){let[t,n]=(0,s.useState)(null),[r,a]=(0,s.useState)(null),[i,l]=(0,s.useState)(!1),o=(0,s.useCallback)(async()=>{var t;let r=await fetch("/api/dialogues/".concat(e,"/agent"),{credentials:"same-origin"}),s=await r.json();if(!r.ok)throw Error(null!==(t=s.error)&&void 0!==t?t:"Dialogue unavailable");n(s)},[e]);(0,s.useEffect)(()=>{let e=!0;return o().catch(t=>{e&&a(t instanceof Error?t.message:"Dialogue unavailable")}),()=>{e=!1}},[o]);let c=(0,s.useCallback)(async e=>{if(!i){l(!0),a(null);try{let t=await e();t&&a(t),await o()}catch(e){a(e instanceof Error?e.message:"Action failed")}finally{l(!1)}}},[i,o]);return{state:t,failure:r,busy:i,run:c,setFailure:a}}(p),[b,y]=(0,s.useState)(null);if(!x)return null;let j=null==g?void 0:g.card,N=j?et(j):null,w=j?function(e){var t,n,r,s;let a=et(e);if("needs_setup"===a)return["open_setup"];let i=e.transcriptTurns>0||(null!==(s=null===(r=e.participants)||void 0===r?void 0:r.answered)&&void 0!==s?s:0)>0?["open_results"]:[];return"done"===a?[...i,"open_setup"]:"shared"!==e.dialogue_mode?["start",...i,"open_setup"]:["test_self",(null!==(n=null===(t=e.participants)||void 0===t?void 0:t.draft)&&void 0!==n?n:0)>0?"send":"add_participants",...i,"open_setup"]}(j):[];return(0,r.jsxs)("div",{className:(0,a.cn)("my-3 rounded-lg border bg-card p-4",u),children:[(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"rounded-md bg-muted p-2 text-muted-foreground",children:function(e){switch(e){case"voice_interview":default:return(0,r.jsx)(Q.Z,{className:"h-5 w-5"});case"meeting_notes":return(0,r.jsx)(l.Z,{className:"h-5 w-5"})}}(x.mode)}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h4",{className:"truncate text-sm font-medium text-foreground",children:x.title}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:N?m(eo[N]):m("dialogueCardLoading")})]})]}),h&&(0,r.jsx)("p",{role:"alert",className:"mt-3 text-sm text-destructive",children:h}),(null==g?void 0:g.proposal)&&g.proposalIsCurrent&&(0,r.jsx)(ee.X,{proposal:g.proposal,busy:f,onApprove:()=>v(async()=>{var e;let t=await fetch("/api/dialogues/".concat(p,"/agent"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({action:"approve",proposalId:g.proposal.id})});return t.ok?null:null!==(e=(await t.json()).error)&&void 0!==e?e:"Approval failed"}),className:"mt-3 border-t pt-3",setupMode:null!==(i=(0,er.zs)(null==j?void 0:j.dialogue_mode))&&void 0!==i?i:void 0}),b&&(0,r.jsx)("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"mt-3 block text-sm underline",children:m("dialogueCardTestLink")}),(0,r.jsx)(ec,{dialogueId:p,actions:w,draftCount:null!==(c=null==j?void 0:null===(t=j.participants)||void 0===t?void 0:t.draft)&&void 0!==c?c:0,busy:f,onSend:()=>v(async()=>{let e=await ei(p),t=(await Promise.all(e.map(e=>(0,en.a)(p,e,"resend")))).filter(e=>!e).length;return t>0?m("dialogueCardSendFailed",{count:t}):null}),onTestSelf:()=>v(async()=>{var e,t;let n=await fetch("/api/dialogues/".concat(p,"/invite"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({recipient_name:m("dialogueCardTestRecipient"),recipient_email:"[email protected]",is_test:!0,send_email:!1})}),r=await n.json();return n.ok&&(null===(e=r.invitation)||void 0===e?void 0:e.interview_url)?(y(r.invitation.interview_url),null):null!==(t=r.error)&&void 0!==t?t:m("dialogueCardTestFailed")})})]})}var eu=n(57219),em=n(12102);let ex=(0,s.lazy)(()=>Promise.all([n.e(98292),n.e(34738),n.e(57491),n.e(40428)]).then(n.bind(n,40428)).then(e=>({default:e.ChatMarkdown})));function ep(e){var t,n;let{messages:i,messageTarget:l,messageTargetState:c="loading",conversationId:u,isStreaming:m=!1,className:x,mode:p="wide",onRegenerate:g,onRegenerateWithModel:h,userName:f,onEditMessage:v,renderAfterMessage:b,renderAtEnd:y,renderBeforeMessages:j,hideEmptyState:w=!1,isLoadingFirstMessage:k=!1,forkedWithSummary:C=!1,inputSlot:_,emptyStateIntentFirst:S=!1,emptyStateTitle:T,emptyStateSubtitle:P,searchableRecentSessions:E=!1,recentSessions:A,onSessionClick:R,onViewAllSessions:I,onConfirmation:O,onQuickAction:D,thinkingPhase:Z,deepThinkingEnabled:L=!1,webSearchEnabled:M=!1,streamStartTime:F,hideThinkingWidget:W=!1,onExecutionContextAdd:U,onExecutionOpenDetails:G,onExecutionSelectForChat:V,onCoreContextAccept:H,onCoreContextReject:J,processingCoreContextProposalId:q}=e,$=(0,o.T)("chat"),B=(0,s.useRef)(null),K=(0,s.useRef)(null),Y=function(e){var t;let{messages:n,conversationId:r,target:a,state:i,scrollRef:l}=e,o=!!(a&&a.conversationId===r),c=o&&"ready"===i?null===(t=n.find(e=>"user"===e.role&&e.id===(null==a?void 0:a.messageId)))||void 0===t?void 0:t.id:void 0,d=o&&"loading"!==i&&!c,u=(0,s.useRef)(null);return(0,s.useEffect)(()=>{var e,t;if(!c){u.current=null;return}let n=JSON.stringify([r,c]);if(u.current===n)return;let s=Array.from(null!==(t=null===(e=l.current)||void 0===e?void 0:e.querySelectorAll("[data-message-id]"))&&void 0!==t?t:[]).find(e=>e.dataset.messageId===c);s&&(s.scrollIntoView({behavior:"auto",block:"center"}),s.focus({preventScroll:!0}),u.current=n)},[r,c,l]),{active:o,messageId:c,unavailable:d}}({messages:i,conversationId:u,target:l,state:c,scrollRef:B}),Q=((null===(t=i[i.length-1])||void 0===t?void 0:t.content)||"").length;(0,s.useEffect)(()=>{(!Y.active||m)&&(!S||i.length>0)&&K.current&&K.current.scrollIntoView({behavior:"smooth"})},[i,i.length,m,Q,S,Y.active]);let X=(0,s.useMemo)(()=>{for(let t=i.length-1;t>=0;t--){var e;if((null===(e=i[t])||void 0===e?void 0:e.role)==="assistant")return t}return -1},[i]);return(0,r.jsx)("div",{ref:B,className:(0,a.cn)("flex-1 overflow-y-auto","scrollbar-thin scrollbar-thumb-border scrollbar-track-transparent",x),children:(0,r.jsxs)("div",{className:(0,a.cn)("mx-auto
1space-y-6","wide"===p?"px-4 py-8":"max-w-full px-3 py-4","wide"===p&&(S&&0===i.length?"max-w-[53rem]":"max-w-3xl")),children:[Y.unavailable&&(0,r.jsx)("p",{role:"status",className:"rounded-md border border-border p-3 text-sm text-muted-foreground",children:$("linkedMessageUnavailable")}),0===i.length&&!w&&!k&&(0,r.jsx)(z.I,{userName:f,title:T,subtitle:P,inputSlot:_,intentFirst:S,searchableRecentSessions:E,recentSessions:A,onSessionClick:R,onViewAllSessions:I,forkedWithSummary:C}),0===i.length&&k&&(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,r.jsx)("div",{className:"h-2.5 w-2.5 bg-[#1B4332] animate-bounce",style:{animationDelay:"0ms"}}),(0,r.jsx)("div",{className:"h-2.5 w-2.5 bg-[#1B4332] animate-bounce",style:{animationDelay:"150ms"}}),(0,r.jsx)("div",{className:"h-2.5 w-2.5 bg-[#1B4332] animate-bounce",style:{animationDelay:"300ms"}})]}),(0,r.jsx)("p",{className:"text-sm font-medium",children:$("startingWorksession")}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-1",children:$("aiPreparing")})]}),j&&j(),i.map((e,t)=>{let n=t===X,s=m&&t===i.length-1&&"assistant"===e.role;return(0,r.jsxs)("div",{"data-message-id":e.id,tabIndex:Y.messageId===e.id?-1:void 0,className:Y.messageId===e.id?"rounded-md ring-1 ring-border scroll-my-4":void 0,role:"article","aria-label":"user"===e.role?$("yourMessage"):$("assistantMessage"),children:[(0,r.jsx)(eg,{message:e,isLast:t===i.length-1,isLastAssistant:n,isStreaming:s,mode:p,onRegenerate:g,onRegenerateWithModel:h,onEdit:v,onConfirmation:O,onQuickAction:D,onExecutionContextAdd:U,onExecutionOpenDetails:G,onExecutionSelectForChat:V,onCoreContextAccept:H,onCoreContextReject:J,processingCoreContextProposalId:q}),b&&!s&&(0,r.jsx)("div",{className:"mt-3",children:b(e,t,n)})]},e.id)}),m&&!W&&(0,r.jsx)(d.l,{isActive:m,phase:Z,hasContent:i.length>0&&!!(null===(n=i[i.length-1])||void 0===n?void 0:n.content),deepThinking:L,webSearchEnabled:M,startTime:F,className:"mt-2"}),(0,r.jsx)(N,{className:"mt-2",conversationId:u}),y&&y(),(0,r.jsx)("div",{ref:K})]})})}function eg(e){var t;let{message:n,isLast:l,isLastAssistant:d,isStreaming:u,mode:x,onRegenerate:p,onRegenerateWithModel:g,onEdit:h,onConfirmation:f,onQuickAction:v,onExecutionContextAdd:b,onExecutionOpenDetails:y,onExecutionSelectForChat:j,onCoreContextAccept:N,onCoreContextReject:_,processingCoreContextProposalId:S}=e,O=(0,o.T)("chat"),D="user"===n.role,Z="assistant"===n.role,[L,z]=(0,s.useState)(null),[H,J]=(0,s.useState)(!1),q=(0,s.useMemo)(()=>Z?function(e){let t=e.match(k);if(!t)return{content:e,agentId:null,agentName:null};let n=e.slice(t[0].length);try{var r;let e=JSON.parse(decodeURIComponent(null!==(r=t[1])&&void 0!==r?r:""));if(e&&"object"==typeof e&&!Array.isArray(e)){let t="string"==typeof e.agentId?e.agentId.trim():"",r="string"==typeof e.agentName?e.agentName.trim():"";if(t&&r)return{content:n,agentId:t,agentName:r}}}catch(e){}return{content:n,agentId:null,agentName:null}}(n.content):{content:n.content,agentId:null,agentName:null},[Z,n.content]),{addProcess:$,updateProcess:Q}=(0,G.a)(),X=(0,s.useRef)(!1),ee=(0,s.useRef)(null),et=(0,s.useMemo)(()=>D||!q.content?q.content:function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:R;if(!e)return e;let r=e.length,s=e;s=(t=s)&&t.includes(T)?t.replace(P,""):t,!1!==n.removeCanvas&&(s=(s=(s=s.replace(/\[CANVAS\s*:\s*create\s*\][\s\S]*?\[\s*\/\s*CANVAS\s*\]/gi,"")).replace(/\[CANVAS\s*:\s*create\s*\][\s\S]*/gi,"")).replace(/\[\s*\/?\s*CANVAS\s*(?::\s*\w+)?\s*\]/gi,"")),!1!==n.removeDocumentEdit&&(s=(s=(s=s.replace(/\[DOCUMENT_EDIT\][\s\S]*?\[(?:\/)?DOCUMENT_EDIT\]/gi,"")).replace(/\[DOCUMENT_EDIT\][\s\S]*/gi,"")).replace(/\[\/DOCUMENT_EDIT\]/gi,"")),!1!==n.removeEditMarkers&&(s=(s=(s=(s=s.replace(/\[FULL\][\s\S]*?\[FULL\]/gi,"")).replace(/\[FULL\]/gi,"")).replace(/\[PATCH\][\s\S]*?\[PATCH\]/gi,"")).replace(/\[PATCH\]/gi,"")),!1!==n.removeMarkers&&(s=s.replace(/\[MARKER:\w+:\w+\]/gi,"")),s=(s=(s=s.replace(/\[FORM_SUGGESTION\][\s\S]*?\[\s*\/\s*FORM_SUGGESTION\s*\]/gi,"")).replace(/\[FORM_SUGGESTION\][\s\S]*/gi,"")).replace(/<!--WIDGET:\w+-->/g,""),!1!==n.removeCanvas&&(s=s.replace(/<!--CANVAS_META:\{.*?\}-->/g,"")),s=(s=(s=s.replace(/<!--WORKFLOW_RUNTIME_EVENT:[\s\S]*?-->\n?/g,"")).replace(C,"")).replace(A,""),s=(s=(0,E.DQ)(s)).replace(/__CORE_CONTEXT_PROPOSAL__[\s\S]*?__END_PROPOSAL__/g,"").trim(),s=(s=(s=(s=(s=(s=(0,E.Vj)(s)).replace(/<!--WORKSPACE_REFRESH:[^>]+-->\n?/g,"")).replace(/<!--SUGGEST_PLAN_MODE-->/g,"")).replace(/<!--CONVERSATION_TITLE:[\s\S]*?-->/g,"")).replace(/<!--NOTIFY_USER:.*?-->\n?/g,"")).replace(/<!--SUGGEST_EDIT:.*?-->\n?/g,"");{let e=s.indexOf("<!--CONVERSATION_TITLE:");-1!==e&&(s=s.slice(0,e).trimEnd())}if(s=(0,w.eJ)(s),!1!==n.removeActions&&(s=(s=(s=s.replace(/\[ACTION:[^\]]+:START\][\s\S]*?\[ACTION:[^\]]+:END\]/gi,"")).replace(/\[ACTION:[^\]]+\][\s\S]*?\[\/ACTION:[^\]]+\]/gi,"")).replace(/\[ACTION:[^\]]+\]/gi,"")),!1!==n.removeResearchProgress){for(let e of I)s=s.replace(e,"");s=s.replace(/^[\s]*[ððððð±ðâ
ðð¦]+[\s]*$/gmu,"")}if(0===(s=(s=[...s].filter(e=>{var t;let n=null!==(t=e.codePointAt(0))&&void 0!==t?t:0;return!(n>=127744&&n<=129535||n>=9728&&n<=9983||n>=9984&&n<=10175||n>=129536&&n<=129791||n>=65024&&n<=65039||8205===n||8419===n||n>=917536&&n<=917631)}).join("")).replace(/^\s*\n/gm,"\n").replace(/\n{3,}/g,"\n\n").trim()).length&&r>20){let t=e.replace(/<!--.*?-->/g,"").replace(/__CORE_CONTEXT_PROPOSAL__[\s\S]*?__END_PROPOSAL__/g,"").replace(/\[.*?\]/g,"").replace(/[ððððð±ðâ
ðð¦]/gu,"").trim();if(t.length>0)return console.warn("[cleanAIMarkup] Stripped all content but original had text. Returning original text."),t}return s}(q.content),[q.content,D]),en=null!==(t=q.content)&&void 0!==t?t:"",er=(0,s.useMemo)(()=>{var e;return Z&&n.content?null!==(e=n.researchProvenance)&&void 0!==e?e:(0,w.w3)(n.content):null},[Z,n.content,n.researchProvenance]),ea=(0,s.useMemo)(()=>Z&&n.content?(0,E.bJ)(n.content):null,[Z,n.content]),ei=(0,s.useMemo)(()=>D||!n.content?null:function(e){let t={isActive:!1,currentPhase:null,currentTool:null,toolsRun:[],message:null};if(!e)return t;let n=e.match(/\[RESEARCH_PROGRESS:(\w+):([^:]*):([^\]]*)\]/g);if(n&&n.length>0){t.isActive=!0;let e=n[n.length-1],r=null==e?void 0:e.match(/\[RESEARCH_PROGRESS:(\w+):([^:]*):([^\]]*)\]/);for(let e of(r&&(t.currentPhase=r[1],t.currentTool=r[2]||null,t.message=r[3]||null),n)){let n=e.match(/\[RESEARCH_PROGRESS:\w+:([^:]+):/);(null==n?void 0:n[1])&&""!==n[1]&&t.toolsRun.push(n[1])}}return t}(n.content),[n.content,D]);(0,s.useEffect)(()=>
1{if(!ei||D)return;let{isActive:e,currentPhase:t,currentTool:r,message:s}=ei;if(!e&&"complete"!==t)return;let a=()=>{switch(t){case"starting":return 5;case"analyzing":return 15;case"searching":return 40;case"crawling":return 70;case"complete":return 100;default:return 10}},i=()=>{if(s)return s;if(r)return O("runningTool",{tool:r});switch(t){case"starting":return O("researchStepStarting");case"analyzing":return O("researchStepAnalyzing");case"searching":return O("researchStepSearching");case"crawling":return O("researchStepCrawling");case"complete":return O("researchStepComplete");default:return O("researchStepProcessing")}};if(!X.current&&e){let e=$({name:O("deepResearch"),type:"research",status:"processing",progress:a(),failureNotification:"toast",currentStep:i(),file_id:n.id});ee.current=e,X.current=!0}else X.current&&ee.current&&Q(ee.current,{status:"complete"===t?"completed":"processing",progress:a(),currentStep:i()})},[ei,D,n.id,$,Q,O]);let el=(0,s.useCallback)(e=>{let t=L===e?null:e;if(z(t),!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n.id)){z(L);return}fetch("/api/ai/messages/".concat(n.id,"/feedback"),{method:"POST",headers:{"Content-Type":"application/json",...(0,m.p)()},body:JSON.stringify({feedback:t})}).then(e=>{e.ok||z(L)}).catch(()=>z(L))},[L,n.id]),eo=(0,s.useCallback)(e=>{J(!1),null==h||h(n.id,e)},[n.id,h]);return(0,r.jsx)("div",{className:(0,a.cn)("group flex","animate-in fade-in slide-in-from-bottom-2 duration-300",D?"justify-end":"justify-start"),children:(0,r.jsxs)("div",{className:(0,a.cn)("min-w-0",D?"max-w-[80%]":"max-w-full"),children:[D&&(0,r.jsx)(c,{attachments:n.attachments}),D&&H?(0,r.jsx)("div",{className:"w-full",children:(0,r.jsx)(U.ij,{content:n.content,messageId:n.id,onSave:eo,onCancel:()=>J(!1)})}):(0,r.jsxs)("div",{className:(0,a.cn)(D?"bg-[#1B4332]/8 text-foreground rounded-sm px-4 py-3":"text-foreground pl-4 py-2",!D&&"wide"===x&&"pr-12"),children:[(null==ei?void 0:ei.isActive)&&u&&(0,r.jsx)(M,{phase:ei.currentPhase,currentTool:ei.currentTool,message:ei.message,className:"mb-3"}),er&&(0,r.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:(0,a.cn)("inline-flex items-center rounded-full px-2 py-1 text-[11px] font-medium",function(e){switch(e.status){case"verified":return"bg-emerald-500/10 text-emerald-700 dark:text-emerald-400";case"partial":return"bg-amber-500/10 text-amber-700 dark:text-amber-400";case"unverified":return"bg-red-500/10 text-red-700 dark:text-red-400";default:return"bg-muted text-muted-foreground"}}(er)),children:function(e,t){switch(e.status){case"verified":return t("researchProvenanceVerified");case"partial":return t("researchProvenancePartial");case"unverified":return t("researchProvenanceUnverified");default:return t(e.requiresPrimarySources?"researchProvenanceNotPrimaryVerified":"researchProvenanceModelSynthesis")}}(er,O)}),er.usedTools.length>0&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[O("toolsLabel"),": ",er.usedTools.join(", ")]})]}),Z&&q.agentName&&(0,r.jsxs)("div",{className:"mb-2 inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2 py-1 text-xs font-medium text-foreground",children:[(0,r.jsx)(i.Z,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:"truncate",children:O("messageFromAgent",{name:q.agentName})})]}),et&&(0,V.zd)(et)?(0,r.jsx)(V.Fl,{content:et,onContextItemAdd:b,onOpenDetails:y,onSelectForChat:j}):et&&(0,V.b2)(et)?(0,r.jsxs)(r.Fragment,{children:[(0,V.OG)(et)&&(0,r.jsx)(s.Suspense,{fallback:(0,r.jsx)("p",{className:"whitespace-pre-wrap",children:(0,V.OG)(et)}),children:(0,r.jsx)(ex,{content:(0,V.OG)(et),className:"mb-4"})}),(0,r.jsx)(V.Fl,{content:et,onContextItemAdd:b,onOpenDetails:y,onSelectForChat:j})]}):en.includes(E.Ad)&&!(null!==B(en))?(0,r.jsxs)(r.Fragment,{children:[K(et)&&(0,r.jsx)(s.Suspense,{fallback:(0,r.jsx)("p",{className:"whitespace-pre-wrap",children:K(et)}),children:(0,r.jsx)(ex,{content:K(et),className:"mb-4"})}),(0,r.jsx)("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:O("coreContextProposalUnverified")})]}):null!==B(en)?(0,r.jsxs)(r.Fragment,{children:[K(et)&&(0,r.jsx)(s.Suspense,{fallback:(0,r.jsx)("p",{className:"whitespace-pre-wrap",children:K(et)}),children:(0,r.jsx)(ex,{content:K(et),className:"mb-4"})}),(()=>{let e=B(en);return e?(0,r.jsx)(Y,{proposal:e,onAccept:N,onReject:_,isProcessing:S===e.file_id,className:"mt-3"}):null})()]}):et&&/<!-- DIALOGUE_WIDGET:/.test(et)?(0,r.jsxs)(r.Fragment,{children:[es(et)&&(0,r.jsx)(s.Suspense,{fallback:(0,r.jsx)("p",{className:"whitespace-pre-wrap",children:es(et)}),children:(0,r.jsx)(ex,{content:es(et),className:"mb-4"})}),(0,r.jsx)(ed,{content:et})]}):et?(0,r.jsx)(s.Suspense,{fallback:(0,r.jsx)("p",{className:"whitespace-pre-wrap",children:et}),children:(0,r.jsx)(ex,{content:et})}):null,u&&et&&(0,r.jsx)("span",{className:"inline-block w-2 h-4 bg-current animate-pulse ml-0.5"}),ea&&(0,r.jsx)("div",{"data-slot":"agent-mutation-outcome",className:"mt-3 inline-flex items-center rounded-full border border-border px-2 py-1 text-xs font-medium text-muted-foreground",children:O(em.r6[ea])}),er&&er.sources.length>0&&(0,r.jsx)(eu.vj,{className:"mt-4",sources:er.sources.map((e,t)=>({id:"S".concat(t+1),title:e.title,url:e.url}))})]}),Z&&!u&&et&&f&&d&&function(e){if(!e)return!1;let t=e.toLowerCase();return["skal jeg gj\xf8re denne endringen","skal jeg gj\xf8re disse endringene","skal jeg gj\xf8re det","skal jeg gj\xf8re dem","vil du at jeg skal","skal jeg fortsette","skal jeg?","\xf8nsker du at jeg","er dette korrekt","er det riktig","stemmer dette","skal jeg endre","vil du jeg skal","skal jeg bytte","skal jeg legge til","skal jeg fjerne","should i make this change","should i make these changes","do you want me to","should i continue","should i?","is this correct","should i change","would you like me to","shall i","want me to"].some(e=>t.includes(e))}(et)&&(0,r.jsxs)("div",{className:"flex gap-3 mt-3 text-sm",children:[(0,r.jsxs)("button",{onClick:()=>f(!0),className:(0,a.cn)("px-3 py-1 rounded","hover:bg-muted/50 transition-colors","flex items-center gap-1"),children:[(0,r.jsx)("span",{children:"â"}),(0,r.jsx)("span",{children:O("confirmYes")})]}),(0,r.jsxs)("button",{onClick:()=>f(!1),className:(0,a.cn)("px-3 py-1 rounded","hover:bg-muted/50 transition-colors","text-muted-foreground","flex items-center gap-1"),children:[(0,r.jsx)("span",{children:"â"}),(0,r.jsx)("span",{children:O("confirmNo")})]})]}),!u&&et&&!H&&(0,r.jsxs)("div",{className:(0,a.cn)("flex items-center gap-2 mt-1 px-1",D?"flex-row-reverse":"flex-row"),children:[n.createdAt&&(0,r.jsx)(W.ik,{timestamp:n.createdAt}),Z&&n.model&&(0,r.jsx)(W.Xn,{model:n.model}),D&&h&&(0,r.jsx)("button",{onClick:()=>J(!0),className:(0,a.cn)("p-1 rounded text-xs","text-muted-foreground hover:text-foreground","hover:bg-muted/50 transition-all duration-150","opacity-0 group-hover:opacity-100"),title:O("editAndResend"),children:(0,r.jsxs)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,r.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),Z&&(0,r.jsx)(F.P,{content:et,messageId:n.id,isLastAssistant:d,onRegenerate:p,onRegenerateWithModel:g,onFeedback:el,feedback:L})]})]})})}},65316:function(e,t,n){n.d(t,{l:function(){return R}});var r=n(27573),s=n(7653),a=n(88146),i=n(19369),l=n(27126),o=n(30609),c=n(17051),d=n(31815),u=n(39790),m=n(36673),x=n(92482),p=n(95731),g=n(31503),h=n(75721),f=n(34965),v=n(38983),b=n(46252),y=n(83989),j=n(87354),N=n(92472),w=n(46393),k=n(2479),C=n(72725),_=n(12102);function S(e){let{diagnostics:t}=e;return 0===t.length?null:(0,r.jsx)("div",{className:"border-t border-border/30 animate-in fade-in duration-150",children:t.map(e=>(0,r.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 text-xs",role:"status",children:[(0,r.jsx)(l.Z,{className:"w-3 h-3 shrink-0 mt-0.5 text-muted-foreground
1/60"}),(0,r.jsx)("span",{className:"text-muted-foreground",children:e.notice})]},e.skill))})}let T={spawn_subagent:"activityBringInColleague",readFile:"activityReadFile",writeFile:"activityWriteFile",updateFile:"activityUpdateFile",listFiles:"activityListFiles",searchFiles:"activitySearchFiles",listFolders:"activityListFolders",createFolder:"activityCreateFolder",readCoreContext:"activityReadCoreContext",proposeCoreContextUpdate:"activityProposeCoreContextUpdate",listSkills:"activityListSkills",loadSkill:"activityLoadSkill",loadWorkspaceSkill:"activityLoadWorkspaceSkill",createSkill:"activityCreateSkill",readContext:"activityReadContext",getContextPack:"activityGetContextPack",semanticSearch:"activitySemanticSearch",getSessionContext:"activityGetSessionContext",logMemory:"activityLogMemory",searchMemories:"activitySearchMemories",execution_read_goals:"activityReadGoals",execution_create_goal:"activityCreateGoal",execution_read_priorities:"activityReadPriorities",execution_create_priority:"activityCreatePriority",execution_read_tasks:"activityReadTasks",execution_create_task:"activityCreateTask",execution_add_log:"activityAddLog",dialogue_create:"activityCreateDialogue",dialogue_list:"activityListDialogues",dialogue_read:"activityReadDialogue",dialogue_update:"activityUpdateDialogue",presentation_create:"activityCreatePresentation",presentation_set_slides:"activitySetSlides",presentation_add_slide:"activityAddSlide",deep_research:"activityDeepResearch",web_search:"activityWebSearch",generate_canvas:"activityGenerateDocument",regenerate_canvas:"activityRegenerateDocument",read_canvas:"activityReadDocument",patch_canvas:"activityUpdateDocument",import_goals:"activityImportGoals",run_evaluation:"activityEvaluateDocument",request_files:"activityRequestFiles",request_voice:"activityStartInterview",update_progress:"activityUpdateProgress",save_canvas:"activitySaveDocument",complete_workflow:"activityCompleteWorkSession",url_extract:"activityExtractUrl",agentic_research:"activityDeepResearch",spawn_subagents:"activityBringInColleague"};function P(e,t){return T[e]?t(T[e]):e.replace(/_/g," ")}function E(e){return!!T[e]}let A=["deepThinkingPhraseThinking","deepThinkingPhraseReasoning","deepThinkingPhraseAnalyzing","deepThinkingPhraseConsidering","deepThinkingPhraseExploring"];function R(e){let{isActive:t,phase:n="idle",hasContent:T=!1,deepThinking:R=!1,webSearchEnabled:I=!1,statusMessage:O,startTime:D,defaultExpanded:Z=!1,className:L}=e,M=(0,w.T)("chat"),[F,W]=(0,s.useState)(0),[z,U]=(0,s.useState)(0),[G,V]=(0,s.useState)(Z),[H,J]=(0,s.useState)(!1),[q,$]=(0,s.useState)(!1),[B,K]=(0,s.useState)(_.ps),Y=(0,s.useRef)(null),Q=(0,s.useRef)(Date.now()),X=(0,s.useRef)(!1),{steps:ee,currentTool:et,thinkingPreview:en,referencedNotRead:er}=B,es=(0,s.useCallback)(()=>{K((0,_.ps)())},[]),ea=(0,s.useRef)({t:M,getToolLabel:P});ea.current={t:M,getToolLabel:P},(0,s.useEffect)(()=>{if(!t){$(!1),X.current=!1,es();return}Q.current=Date.now(),X.current=!1,$(!1);let e=()=>({t:ea.current.t,toolLabel:e=>ea.current.getToolLabel(e,ea.current.t),hasToolLabel:E,now:Date.now()});K((0,_.j0)((0,_.ps)(),(0,C.lW)(),e()));let n=t=>{let n=t.detail;n&&"string"==typeof n.type&&(Q.current=Date.now(),"lifecycle"===n.type&&"finished"===n.phase&&(X.current=!0),$(!1),K(t=>(0,_.Bw)(t,n,e())))};return window.addEventListener(C.dD,n),()=>window.removeEventListener(C.dD,n)},[t,es]),(0,s.useEffect)(()=>{if(!t)return;let e=setInterval(()=>{X.current||$(Date.now()-Q.current>=2*k.Rj)},1e3);return()=>clearInterval(e)},[t]),(0,s.useEffect)(()=>{Y.current&&(Y.current.scrollTop=Y.current.scrollHeight)},[ee]);let ei=(0,s.useMemo)(()=>t?et?"tool-use":en?"deep-thinking":I&&"thinking"===n?"web-search":T?"writing":R?"deep-thinking":n:"idle",[t,n,T,R,I,et,en]);(0,s.useEffect)(()=>{if(!t||!D){W(0);return}let e=setInterval(()=>{W(Math.floor((Date.now()-D.getTime())/1e3))},1e3);return()=>clearInterval(e)},[t,D]),(0,s.useEffect)(()=>{if("deep-thinking"!==ei||et)return;let e=setInterval(()=>{U(e=>(e+1)%A.length)},3e3);return()=>clearInterval(e)},[ei,et]);let el=(0,s.useMemo)(()=>{switch(B.phase){case"request_sent":return M("activityRequestSent");case"model_selected":return M("activityModelSelected");case"awaiting_provider":return M("activityAwaitingProvider");default:return null}},[B.phase,M]),eo=(0,s.useMemo)(()=>{let e=new Set;for(let t=ee.length-1;t>=0;t-=1){let n=ee[t];if(null==n?void 0:n.colleague){if("lifecycle"===n.type&&"finished"===n.phase){e.add(n.colleague.id);continue}if(!e.has(n.colleague.id))return n.label}}return null},[ee]),ec=(0,s.useMemo)(()=>{var e;return er?er.notice:q?M("activitySignalLost"):eo||O||(et?"".concat(P(et,M),"..."):"finalizing"===B.phase?M("activityFinalizing"):en?en.slice(0,60)+(en.length>60?"...":""):el||("deep-thinking"===ei?M(null!==(e=A[z])&&void 0!==e?e:"deepThinkingPhraseThinking"):"writing"===ei?M("activityWritingResponse"):"web-search"===ei?M("activityWebSearch"):"tool-use"===ei?M("activityUsingTools"):"analyzing"===ei?M("activityAnalyzingRequest"):"loading-context"===ei?M("activityLoadingContext"):M("thinking")))},[er,q,eo,O,et,en,el,ei,z,M]),ed=(0,s.useMemo)(()=>
1{if(er)return l.Z;if(q)return o.Z;if(et)return c.Z;if(en)return d.Z;if(el)return u.Z;switch(ei){case"loading-context":return m.Z;case"analyzing":return x.Z;case"deep-thinking":return d.Z;case"web-search":return p.Z;case"tool-use":return c.Z;case"writing":return g.Z;default:return h.Z}},[er,q,ei,et,en,el]),eu=ee.filter(e=>"tool_start"===e.type&&!e.colleague).length;return t?(0,r.jsxs)("div",{className:(0,i.cn)("rounded-md border border-border/50 bg-muted/30 transition-all animate-in fade-in slide-in-from-top-2 duration-200",L),children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5 px-3 py-2 cursor-pointer select-none",onClick:()=>V(!G),children:[(0,r.jsx)(ed,{className:(0,i.cn)("w-4 h-4 shrink-0 text-muted-foreground",et&&"animate-spin","deep-thinking"===ei&&!et&&"animate-pulse"),style:et?{animationDuration:"1.5s"}:void 0}),(0,r.jsx)("span",{className:"text-sm text-muted-foreground flex-1 truncate",children:ec}),eu>0&&(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0",children:M("toolsCount",{count:eu})}),F>0&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground/60 tabular-nums shrink-0",children:F<60?"".concat(F,"s"):"".concat(Math.floor(F/60),"m ").concat(F%60,"s")}),(0,r.jsx)("div",{className:"flex gap-1 shrink-0",children:[0,1,2].map(e=>(0,r.jsx)("span",{className:"w-1 h-1 rounded-full animate-pulse bg-muted-foreground/40",style:{animationDelay:"".concat(150*e,"ms")}},e))}),(0,r.jsx)("button",{className:"p-0.5 hover:bg-muted rounded transition-colors shrink-0","aria-label":G?M("collapseActivity"):M("expandActivity"),children:G?(0,r.jsx)(f.Z,{className:"w-3 h-3 text-muted-foreground/60"}):(0,r.jsx)(v.Z,{className:"w-3 h-3 text-muted-foreground/60"})})]}),B.pluginDiagnostics.length>0&&(0,r.jsx)("div",{className:"border-t border-border/30 animate-in fade-in duration-150",children:B.pluginDiagnostics.map(e=>(0,r.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 text-xs",role:"status",children:[(0,r.jsx)(b.Z,{className:"w-3 h-3 shrink-0 mt-0.5 text-muted-foreground/60"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:e.notice})," ",(0,r.jsx)(a.default,{href:e.actionHref,className:"text-foreground underline underline-offset-2 hover:no-underline",onClick:e=>e.stopPropagation(),children:e.actionLabel})]})]},e.plugin))}),(0,r.jsx)(S,{diagnostics:B.workspaceSkillDiagnostics}),G&&B.reasoning.trim().length>0&&(0,r.jsxs)("div",{className:"border-t border-border/30 animate-in fade-in duration-150",children:[(0,r.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-2 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",onClick:()=>J(e=>!e),"aria-expanded":H,children:[(0,r.jsx)(d.Z,{className:"w-3 h-3 shrink-0 text-muted-foreground/60"}),(0,r.jsx)("span",{className:"font-medium",children:M("activityReasoningTitle")}),(0,r.jsx)("span",{className:"ml-auto text-muted-foreground/60",children:H?M("activityHideReasoning"):M("activityShowReasoning")})]}),H&&(0,r.jsx)("div",{className:"max-h-48 overflow-y-auto px-3 pb-2 text-xs text-muted-foreground/70 whitespace-pre-wrap",children:B.reasoning})]}),G&&ee.length>0&&(0,r.jsx)("div",{className:"border-t border-border/30 animate-in fade-in duration-150",children:(0,r.jsx)("div",{ref:Y,className:"max-h-48 overflow-y-auto px-3 py-2 space-y-1",children:ee.map(e=>(0,r.jsxs)("div",{className:(0,i.cn)("flex items-start gap-2 text-xs",e.colleague&&"border-l border-border/30 pl-2 ml-1 -my-0.5 py-0.5"),children:[e.colleague&&(0,r.jsx)(y.Z,{className:"w-3 h-3 text-muted-foreground/60 mt-0.5 shrink-0"}),!e.colleague&&"lifecycle"===e.type&&(0,r.jsx)(u.Z,{className:"w-3 h-3 text-muted-foreground/60 mt-0.5 shrink-0"}),!e.colleague&&("thinking"===e.type||"reasoning"===e.type)&&(0,r.jsx)(d.Z,{className:"w-3 h-3 text-muted-foreground/60 mt-0.5 shrink-0"}),!e.colleague&&"tool_start"===e.type&&(0,r.jsx)(c.Z,{className:"w-3 h-3 text-muted-foreground/60 mt-0.5 shrink-0"}),!e.colleague&&"tool_done"===e.type&&(0,r.jsx)(j.Z,{className:"w-3 h-3 text-muted-foreground
1/60 mt-0.5 shrink-0"}),!e.colleague&&"tool_error"===e.type&&(0,r.jsx)(o.Z,{className:"w-3 h-3 text-muted-foreground/60 mt-0.5 shrink-0"}),!e.colleague&&"run_cancelled"===e.type&&(0,r.jsx)(N.Z,{className:"w-3 h-3 text-muted-foreground/60 mt-0.5 shrink-0"}),!e.colleague&&"read_name_reference"===e.type&&(0,r.jsx)(l.Z,{className:"w-3 h-3 text-muted-foreground/60 mt-0.5 shrink-0"}),!e.colleague&&"plugin_diagnostic"===e.type&&(0,r.jsx)(b.Z,{className:"w-3 h-3 text-muted-foreground/60 mt-0.5 shrink-0"}),!e.colleague&&"workspace_skill_diagnostic"===e.type&&(0,r.jsx)(l.Z,{className:"w-3 h-3 text-muted-foreground/60 mt-0.5 shrink-0"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("span",{className:"text-muted-foreground font-medium",children:e.label}),e.action&&(0,r.jsxs)(r.Fragment,{children:[" ",(0,r.jsx)(a.default,{href:e.action.href,className:"text-foreground underline underline-offset-2 hover:no-underline",onClick:e=>e.stopPropagation(),children:e.action.label})]}),e.detail&&(0,r.jsxs)("span",{className:"text-muted-foreground/50 ml-1 truncate",children:["â ",e.detail]})]})]},e.id))})}),G&&0===ee.length&&(0,r.jsx)("div",{className:"border-t border-border/30 animate-in fade-in duration-150",children:(0,r.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground/50",children:M("waitingForActivity")})})]}):null}},84643:function(e,t,n){n.d(t,{I:function(){return x}});var r=n(27573),s=n(7653),a=n(19369),i=n(3349),l=n(95731),o=n(49743),c=n(44526),d=n(36673),u=n(32917),m=n(46393);function x(e){var t;let{userName:n,title:x,subtitle:p,inputSlot:g,intentFirst:h=!1,searchableRecentSessions:f=!1,recentSessions:v,onSessionClick:b,onViewAllSessions:y,forkedWithSummary:j=!1,className:N}=e,w=(0,m.T)("chat"),[k,C]=(0,s.useState)(""),_=(0,s.useMemo)(()=>{let e=k.trim().toLocaleLowerCase();return e?(null!=v?v:[]).filter(t=>{var n;return"".concat(t.title," ").concat(null!==(n=t.workspace_name)&&void 0!==n?n:"").toLocaleLowerCase().includes(e)}):null!=v?v:[]},[v,k]),S=(null!==(t=null==v?void 0:v.length)&&void 0!==t?t:0)>0,T=_.length>0;return(0,r.jsx)("div",{className:(0,a.cn)("flex flex-col items-center h-full overflow-y-auto",h?"justify-start px-4 py-10 sm:py-14":"justify-center px-4 py-12","animate-in fade-in duration-500",N),children:(0,r.jsxs)("div",{className:(0,a.cn)("w-full flex flex-col items-center",h?"max-w-[49rem]":"max-w-xl"),children:[(0,r.jsx)("h2",{className:(0,a.cn)(h?"text-2xl font-semibold text-foreground mb-2 sm:text-3xl":"text-lg font-medium text-foreground mb-6","animate-in fade-in slide-in-from-bottom-2 duration-300 delay-100"),children:null!=x?x:(0,r.jsxs)(r.Fragment,{children:[function(e){let t=new Date().getHours();return e(t<12?"goodMorning":t<17?"goodAfternoon":"goodEvening")}(w),n?", ".concat(n):""]})}),p&&(0,r.jsx)("p",{className:"mb-6 max-w-xl text-center text-sm text-muted-foreground",children:p}),j&&(0,r.jsxs)("div",{className:(0,a.cn)("flex items-center gap-2 px-4 py-2.5 mb-4 rounded-lg w-full max-w-md","bg-muted/50 border border-border/50 text-sm text-muted-foreground","animate-in fade-in slide-in-from-bottom-2 duration-300 delay-150"),children:[(0,r.jsx)(i.Z,{className:"h-4 w-4 shrink-0"}),(0,r.jsx)("span",{children:w("freshAgentWithPreviousContext")})]}),g&&(0,r.jsx)("div",{className:(0,a.cn)("w-full mb-8","animate-in fade-in slide-in-from-bottom-2 duration-300 delay-200"),children:g}),(S||f)&&(0,r.jsxs)("div",{className:(0,a.cn)("w-full",h&&"max-w-2xl","animate-in fade-in slide-in-from-bottom-2 duration-300 delay-300"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-foreground",children:h?w("continueWhereLeftOff"):w("recentActivity")}),h&&(0,r.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:w("conversationsAcrossWorkspaces")})]}),y&&(0,r.jsx)("button",{onClick:y,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:w("viewAll")})]}),f&&(0,r.jsxs)("label",{className:"mb-3 flex h-10 items-center gap-2 rounded-lg border border-border-strong bg-input-bg px-3 text-sm text-muted-foreground",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,r.jsx)("span",{className:"sr-only",children:w("searchConversationsAndWorkspaces")}),(0,r.jsx)("input",{type:"search",value:k,onChange:e=>C(e.target.value),placeholder:w("searchConversationsAndWorkspaces"),className:"min-w-0 flex-1 bg-transparent text-foreground outline-none placeholder:text-muted-foreground"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[_.map(e=>(0,r.jsxs)("button",{onClick:()=>null==b?void 0:b(e.id),className:(0,a.cn)("flex items-center gap-3 w-full px-3 py-2.5 rounded-lg text-left","bg-card border border-border transition-shadow duration-150 group","hover:shadow-[var(--shadow-hover)]"),children:["presentation"===e.type?(0,r.jsx)(o.Z,{className:"h-4 w-4 text-muted-foreground
1/50 shrink-0"}):"dialogue"===e.type?(0,r.jsx)(c.Z,{className:"h-4 w-4 text-muted-foreground/50 shrink-0"}):"canvas"===e.type?(0,r.jsx)(d.Z,{className:"h-4 w-4 text-muted-foreground/50 shrink-0"}):(0,r.jsx)(u.Z,{className:"h-4 w-4 text-muted-foreground/50 shrink-0"}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,r.jsx)("span",{className:"block truncate text-sm text-foreground",children:e.title||w("untitled")}),e.workspace_name&&(0,r.jsx)("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:e.workspace_name})]}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground/50 tabular-nums shrink-0",children:function(e,t){let n=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(n<1)return t("timeNowLower");if(n<60)return t("timeMinutesShort",{count:String(n)});let r=Math.floor(n/60);if(r<24)return t("timeHoursShort",{count:String(r)});let s=Math.floor(r/24);return s<30?t("timeDaysShort",{count:String(s)}):t("timeMonthsShort",{count:String(Math.floor(s/30))})}(e.updated_at,w)})]},e.id)),!T&&f&&(0,r.jsx)("p",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:w("noConversationMatches")})]})]})]})})}},20575:function(e,t,n){n.d(t,{ij:function(){return u}});var r=n(27573),s=n(7653),a=n(19369),i=n(6315),l=n(87354),o=n(10269),c=n(16273),d=n(46393);
1function u(e){let{content:t,messageId:n,canEdit:u=!0,onSave:m,onCancel:x,className:p}=e,g=(0,d.T)("chat"),[h,f]=(0,s.useState)(!1),[v,b]=(0,s.useState)(t),y=(0,s.useRef)(null);(0,s.useEffect)(()=>{h&&y.current&&(y.current.focus(),y.current.selectionStart=y.current.value.length)},[h]),(0,s.useEffect)(()=>{y.current&&(y.current.style.height="auto",y.current.style.height="".concat(y.current.scrollHeight,"px"))},[v]);let j=(0,s.useCallback)(()=>{b(t),f(!0)},[t]),N=(0,s.useCallback)(()=>{b(t),f(!1),null==x||x()},[t,x]),w=(0,s.useCallback)(()=>{let e=v.trim();e&&e!==t&&m(e),f(!1)},[v,t,m]),k=(0,s.useCallback)(e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&(e.preventDefault(),N()):(e.preventDefault(),w())},[w,N]);return h?(0,r.jsxs)("div",{className:(0,a.cn)("relative",p),children:[(0,r.jsx)("textarea",{ref:y,value:v,onChange:e=>b(e.target.value),onKeyDown:k,className:(0,a.cn)("w-full resize-none rounded-lg","bg-input-bg border border-primary/50","px-3 py-2 text-sm","focus:outline-none focus:ring-2 focus:ring-primary/30","transition-all duration-150"),rows:1,placeholder:g("typeMessage")}),(0,r.jsxs)("div",{className:"flex items-center gap-1 mt-2",children:[(0,r.jsxs)(c.z,{size:"sm",variant:"default",onClick:w,disabled:!v.trim()||v.trim()===t,className:"h-7 px-2 text-xs gap-1",children:[(0,r.jsx)(l.Z,{className:"w-3 h-3"}),g("saveAndResend")]}),(0,r.jsxs)(c.z,{size:"sm",variant:"ghost",onClick:N,className:"h-7 px-2 text-xs gap-1",children:[(0,r.jsx)(o.Z,{className:"w-3 h-3"}),g("cancel")]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:g("editMessageHint")})]}):(0,r.jsxs)("div",{className:(0,a.cn)("group relative",p),children:[(0,r.jsx)("div",{className:"whitespace-pre-wrap",children:t}),u&&(0,r.jsx)("button",{onClick:j,className:(0,a.cn)("absolute -right-8 top-0","p-1 rounded opacity-0 group-hover:opacity-100","text-muted-foreground hover:text-foreground","hover:bg-muted/50 transition-all duration-150"),title:g("editMessage"),children:(0,r.jsx)(i.Z,{className:"w-3.5 h-3.5"})})]})}},81920:function(e,t,n){n.d(t,{Fl:function(){return D},OG:function(){return I},b2:function(){return O},zd:function(){return Z}});var r=n(27573),s=n(7653),a=n(37811),i=n(31095),l=n(3172),o=n(32917),c=n(12486),d=n(97236),u=n(25555),m=n(75330),x=n(2966),p=n(95731),g=n(41755),h=n(30609),f=n(82041),v=n(26798),b=n(19369),y=n(46393);function j(e){switch(null==e?void 0:e.toLowerCase()){case"active":case"in_progress":return"bg-blue-500/20 text-blue-600 border-blue-500/30";case"completed":case"done":return"bg-green-500/20 text-green-600 border-green-500/30";case"blocked":case"on_hold":return"bg-orange-500/20 text-orange-600 border-orange-500/30";case"todo":case"draft":default:return"bg-gray-500/20 text-gray-600 border-gray-500/30";case"cancelled":case"archived":return"bg-red-500/20 text-red-600 border-red-500/30"}}function N(e,t){if(!e)return"";try{return new Intl.DateTimeFormat("no"===t?"nb-NO":"sv"===t?"sv-SE":"en"===t?"en-US":t||"nb-NO",{day:"numeric",month:"short",year:"numeric"}).format(new Date(e))}catch(t){return e}}function w(e){let{goals:t,onAddToContext:n,onOpenDetails:s,onSelectForChat:a}=e,c=(0,y.T)("chat");return(0,r.jsxs)("div",{className:"rounded-lg border bg-card overflow-hidden",children:[(0,r.jsx)("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/50 border-b",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(i.Z,{className:"h-4 w-4 text-primary"}),(0,r.jsx)("span",{className:"font-medium text-sm",children:c("executionWidgetGoalsCount",{count:t.length})})]})}),(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"border-b bg-muted/30",children:[(0,r.jsx)("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground",children:c("executionWidgetName")}),(0,r.jsx)("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground w-20",children:c("executionWidgetProgress")}),(0,r.jsx)("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground w-24",children:c("executionWidgetOwner")}),(0,r.jsx)("th",{className:"text-right px-3 py-2 font-medium text-muted-foreground w-20"})]})}),(0,r.jsx)("tbody",{children:t.map((e,i)=>{let d={id:e.id,type:"goal",name:e.name,status:e.status};return(0,r.jsxs)("tr",{className:(0,b.cn)("hover:bg-muted/50 cursor-pointer transition-colors",i!==t.length-1&&"border-b border-border/50"),onClick:()=>null==s?void 0:s("goal",e.id),children:[(0,r.jsx)("td",{className:"px-3 py-2",children:(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsx)("span",{className:"font-medium truncate max-w-[250px]",children:e.name})})}),(0,r.jsx)("td",{className:"px-3 py-2",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-12 h-1.5 bg-muted rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-primary rounded-full",style:{width:"".concat(e.progress||0,"%")}})}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.progress||0,"%"]})]})}),(0,r.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate max-w-[100px]",children:e.owner||"-"}),(0,r.jsx)("td",{className:"px-3 py-2",children:(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[n&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),n(d)},className:"p-1 rounded hover:bg-muted",title:c("addToContext"),children:(0,r.jsx)(l.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),a(d)},className:"p-1 rounded hover:bg-muted",title:c("discussWithAI"),children:(0,r.jsx)(o.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})})]},e.id)})})]})})]})}function k(e){let{priorities:t,onAddToContext:n,onOpenDetails:s,onSelectForChat:a}=e,i=(0,y.T)("chat");return(0,r.jsxs)("div",{className:"rounded-lg border bg-card overflow-hidden",children:[(0,r.jsx)("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/50 border-b",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(c.Z,{className:"h-4 w-4 text-orange-500"}),(0,r.jsx)("span",{className:"font-medium text-sm",children:i("executionWidgetPrioritiesCount",{count:t.length})})]})}),(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"border-b bg-muted/30",children:[(0,r.jsx)("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground",children:i("executionWidgetName")}),(0,r.jsx)("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground w-20",children:i("executionWidgetStatus")}),(0,r.jsx)("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground w-20",children:i("executionWidgetProgress")}),(0,r.jsx)("th",{className:"text-right px-3 py-2 font-medium text-muted-foreground w-20"})]})}),(0,r.jsx)("tbody",{children:t.map((e,c)=>{let d={id:e.id,type:"priority",name:e.name,status:e.status};return(0,r.jsxs)("tr",{className:(0,b.cn)("hover:bg-muted/50 cursor-pointer transition-colors",c!==t.length-1&&"border-b border-border/50"),onClick:()=>null==s?void 0:s("priority",e.id),children:[(0,r.jsx)("td",{className:"px-3 py-2",children:(0,r.jsx)("span",{className:"font-medium truncate max-w-[250px]",children:e.name})}),(0,r.jsx)("td",{className:"px-3 py-2",children:e.status&&(0,r.jsx)(f.C,{variant:"outline",className:(0,b.cn)("text-xs",j(e.status)),children:e.status})}),(0,r.jsx)("td",{className:"px-3 py-2",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-12 h-1.5 bg-muted rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-orange-500 rounded-full",style:{width:"".concat(e.progress||0,"%")}})}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.progress||0,"%"]})]})}),(0,r.jsx)("td",{className:"px-3 py-2",children:(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[n&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),n(d)},className:"p-1 rounded hover:bg-muted",title:i("addToContext"),children:(0,r.jsx)(l.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),a(d)},className:"p-1 rounded hover:bg-muted",title:i("discussWithAI"),children:(0,r.jsx)(o.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})})]},e.id)})})]})})]})}function C(e){let{tasks:t,onAddToContext:n,onOpenDetails:s,onSelectForChat:i}=e,c=(0,y.T)("chat"),u=(0,a.bU)();return(0,r.jsxs)("div",{className:"rounded-lg border bg-card overflow-hidden",children:[(0,r.jsx)("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/50 border-b",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(d.Z,{className:"h-4 w-4 text-green-500"}),(0,r.jsx)("span",{className:"font-medium text-sm",children:c("executionWidgetTasksCount",{count:t.length})})]})}),(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"border-b bg-muted/30",children:[(0,r.jsx)("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground",children:c("executionWidgetTitle")}),(0,r.jsx)("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground w-20",children:c("executionWidgetStatus")}),(0,r.jsx)("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground w-24",children:c("executionWidgetDueDate")}),(0,r.jsx)("th",{className:"text-right px-3 py-2 font-medium text-muted-foreground w-20"})]})}),(0,r.jsx)("tbody",{children:t.map((e,a)=>{let d={id:e.id,type:"task",name:e.title,status:e.status};return(0,r.jsxs)("tr",{className:(0,b.cn)("hover:bg-muted/50 cursor-pointer transition-colors",a!==t.length-1&&"border-b border-border/50"),onClick:()=>null==s?void 0:s("task",e.id),children:[(0,r.jsx)("td",{className:"px-3 py-2",children:(0,r.jsx)("span",{className:"font-medium truncate max-w-[250px]",children:e.title})}),(0,r.jsx)("td",{className:"px-3 py-2",children:e.status&&(0,r.jsx)(f.C,{variant:"outline",className:(0,b.cn)("text-xs",j(e.status)),children:e.status})}),(0,r.jsx)("td",{className:"px-3 py-2 text-muted-foreground",children:e.due_date?N(e.due_date,u):"-"}),(0,r.jsx)("td",{className:"px-3 py-2",children:(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[n&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),n(d)},className:"p-1 rounded hover:bg-muted",title:c("addToContext"),children:(0,r.jsx)(l.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})}),i&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),i(d)},className:"p-1 rounded hover:bg-muted",title:c("discussWithAI"),children:(0,r.jsx)(o.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})})]},e.id)})})]})})]})}function _(e){let{goal:t,onAddToContext:n,onOpenDetails:s,onSelectForChat:c}=e,d=(0,y.T)("chat"),x=(0,a.bU)(),p={id:t.id,type:"goal",name:t.name,status:t.status};return(0,r.jsxs)(v.Zb,{className:"border-l-4 border-l-primary group hover:shadow-md transition-shadow",children:[(0,r.jsx)(v.Ol,{className:"pb-2",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer flex-1",onClick:()=>null==s?void 0:s("goal",t.id),children:[(0,r.jsx)(i.Z,{className:"h-4 w-4 text-primary"}),(0,r.jsx)(v.ll,{className:"text-sm font-medium hover:text-primary transition-colors",children:t.name})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t.status&&(0,r.jsx)(f.C,{variant:"outline",className:(0,b.cn)("text-xs",j(t.status)),children:t.status}),(0,r.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[n&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),n(p)},className:"p-1 rounded hover:bg-muted",title:d("addToContext"),children:(0,r.jsx)(l.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})}),c&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),c(p)},className:"p-1 rounded hover:bg-muted",title:d("discussWithAI"),children:(0,r.jsx)(o.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]})}),(0,r.jsxs)(v.aY,{className:"space-y-2",children:[t.description&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t.description}),(0,r.jsxs)("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[void 0!==t.progress&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("div",{className:"w-16 h-1.5 bg-muted rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-primary rounded-full",style:{width:"".concat(t.progress,"%")}})}),(0,r.jsxs)("span",{children:[t.progress,"%"]})]}),t.target_date&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(u.Z,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:N(t.target_date,x)})]}),t.owner&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(m.Z,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:t.owner})]})]})]})]})}function S(e){let{priority:t,onAddToContext:n,onOpenDetails:s,onSelectForChat:a}=e,i=(0,y.T)("chat"),d={id:t.id,type:"priority",name:t.name,status:t.status};return(0,r.jsxs)(v.Zb,{className:"border-l-4 border-l-orange-500 group hover:shadow-md transition-shadow",children:[(0,r.jsx)(v.Ol,{className:"pb-2",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer flex-1",onClick:()=>null==s?void 0:s("priority",t.id),children:[(0,r.jsx)(c.Z,{className:"h-4 w-4 text-orange-500"}),(0,r.jsx)(v.ll,{className:"text-sm font-medium hover:text-orange-500 transition-colors",children:t.name})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t.status&&(0,r.jsx)(f.C,{variant:"outline",className:(0,b.cn)("text-xs",j(t.status)),children:t.status}),(0,r.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[n&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),n(d)},className:"p-1 rounded hover:bg-muted",title:i("addToContext"),children:(0,r.jsx)(l.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),a(d)},className:"p-1 rounded hover:bg-muted",title:i("discussWithAI"),children:(0,r.jsx)(o.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]})}),(0,r.jsxs)(v.aY,{className:"space-y-2",children:[t.description&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t.description}),(0,r.jsxs)("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[void 0!==t.progress&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("div",{className:"w-16 h-1.5 bg-muted rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-orange-500 rounded-full",style:{width:"".concat(t.progress,"%")}})}),(0,r.jsxs)("span",{children:[t.progress,"%"]})]}),t.goal&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(x.Z,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:t.goal})]})]})]})]})}function T(e){let{task:t,onAddToContext:n,onOpenDetails:s,onSelectForChat:i}=e,c=(0,y.T)("chat"),p=(0,a.bU)(),g={id:t.id,type:"task",name:t.title,status:t.status};return(0,r.jsxs)(v.Zb,{className:"border-l-4 border-l-blue-500 group hover:shadow-md transition-shadow",children:[(0,r.jsx)(v.Ol,{className:"pb-2",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer flex-1",onClick:()=>null==s?void 0:s("task",t.id),children:[(0,r.jsx)(d.Z,{className:"h-4 w-4 text-blue-500"}),(0,r.jsx)(v.ll,{className:"text-sm font-medium hover:text-blue-500 transition-colors",children:t.title})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t.priority_level&&(0,r.jsx)(f.C,{className:(0,b.cn)("text-xs",function(e){switch(null==e?void 0:e.toLowerCase()){case"urgent":return"bg-red-500/20 text-red-600";case"high":return"bg-orange-500/20 text-orange-600";case"medium":return"bg-yellow-500/20 text-yellow-600";default:return"bg-gray-500/20 text-gray-600"}}(t.priority_level)),childr
1en:t.priority_level}),t.status&&(0,r.jsx)(f.C,{variant:"outline",className:(0,b.cn)("text-xs",j(t.status)),children:t.status}),(0,r.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[n&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),n(g)},className:"p-1 rounded hover:bg-muted",title:c("addToContext"),children:(0,r.jsx)(l.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})}),i&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),i(g)},className:"p-1 rounded hover:bg-muted",title:c("discussWithAI"),children:(0,r.jsx)(o.Z,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]})}),(0,r.jsxs)(v.aY,{className:"space-y-2",children:[t.description&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t.description}),(0,r.jsxs)("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[t.due_date&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(u.Z,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:N(t.due_date,p)})]}),t.assignee&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(m.Z,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:t.assignee})]}),t.priority&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(x.Z,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:t.priority})]})]})]})]})}function P(e){let{candidates:t,count:n}=e,s=(0,y.T)("chat");return t&&0!==t.length?(0,r.jsxs)(v.Zb,{children:[(0,r.jsx)(v.Ol,{className:"pb-2",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(p.Z,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)(v.ll,{className:"text-sm font-medium",children:s("executionWidgetResultsCount",{count:n})})]})}),(0,r.jsx)(v.aY,{className:"space-y-2",children:t.map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 rounded bg-muted/50",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:["goal"===e.type&&(0,r.jsx)(i.Z,{className:"h-3.5 w-3.5 text-primary"}),"priority"===e.type&&(0,r.jsx)(c.Z,{className:"h-3.5 w-3.5 text-orange-500"}),"task"===e.type&&(0,r.jsx)(d.Z,{className:"h-3.5 w-3.5 text-blue-500"}),(0,r.jsx)("span",{className:"text-sm",children:e.title||e.name})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(f.C,{variant:"outline",className:"text-xs capitalize",children:e.type}),e.status&&(0,r.jsx)(f.C,{variant:"outline",className:(0,b.cn)("text-xs",j(e.status)),children:e.status})]})]},e.id))})]}):(0,r.jsx)(v.Zb,{children:(0,r.jsxs)(v.aY,{className:"py-4 text-center text-sm text-muted-foreground",children:[(0,r.jsx)(p.Z,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),s("executionWidgetNoResultsFound")]})})}function E(e){let{logs:t,count:n}=e,s=(0,y.T)("chat"),i=(0,a.bU)();return t&&0!==t.length?(0,r.jsxs)(v.Zb,{children:[(0,r.jsx)(v.Ol,{className:"pb-2",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(g.Z,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)(v.ll,{className:"text-sm font-medium",children:s("executionWidgetLogsCount",{count:n})})]})}),(0,r.jsxs)(v.aY,{className:"space-y-3",children:[t.slice(0,5).map(e=>{var t;return(0,r.jsxs)("div",{className:"border-l-2 border-muted pl-3 py-1",children:[(0,r.jsx)("div",{className:"text-sm",children:e.content}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[(null===(t=e.author)||void 0===t?void 0:t.full_name)&&(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)(m.Z,{className:"h-3 w-3"}),e.author.full_name]}),(0,r.jsx)("span",{children:N(e.created_at,i)}),e.source&&(0,r.jsx)(f.C,{variant:"outline",className:"text-xs",children:e.source})]})]},e.id)}),t.length>5&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground text-center",children:s("executionWidgetMoreEntries",{count:t.length-5})})]})]}):(0,r.jsx)(v.Zb,{children:(0,r.jsxs)(v.aY,{className:"py-4 text-center text-sm text-muted-foreground",children:[(0,r.jsx)(g.Z,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),s("executionWidgetNoLogsFound")]})})}function A(e){let{message:t,type:n}=e,s=n.includes("created")||n.includes("linked")||n.includes("updated");return(0,r.jsx)(v.Zb,{className:(0,b.cn)("border-l-4",s?"border-l-green-500":"border-l-gray-500"),children:(0,r.jsxs)(v.aY,{className:"py-3 flex items-center gap-2",children:[s?(0,r.jsx)(d.Z,{className:"h-4 w-4 text-green-500"}):(0,r.jsx)(h.Z,{className:"h-4 w-4 text-gray-500"}),(0,r.jsx)("span",{className:"text-sm",children:t})]})})}function R(e){let t=e.match(/<!-- EXECUTION_WIDGET:(.*?) -->/);if(t&&t[1])try{let e=JSON.parse(t[1]);if((null==e?void 0:e.type)==="execution_widget"&&(null==e?void 0:e.widget_type))return e}catch(e){}try{let t=JSON.parse(e);if((null==t?void 0:t.type)==="execution_widget"&&(null==t?void 0:t.widget_type))return t;return null}catch(e){return null}}function I(e){return e.replace(/<!-- EXECUTION_WIDGET:.*? -->/g,"").trim()}function O(e){return/<!-- EXECUTION_WIDGET:/.test(e)}
1function D(e){let{content:t,className:n,onContextItemAdd:a,onOpenDetails:i,onSelectForChat:l}=e,o=(0,s.useMemo)(()=>R(t),[t]);return((0,s.useEffect)(()=>{(null==o?void 0:o.context_item)&&a&&a(o.context_item)},[null==o?void 0:o.context_item,a]),o)?(0,r.jsxs)("div",{className:(0,b.cn)("my-2",n),children:["goals"===o.widget_type&&o.goals&&(0,r.jsx)(w,{goals:o.goals,onAddToContext:a,onOpenDetails:i,onSelectForChat:l}),"goal"===o.widget_type&&o.goal&&(0,r.jsx)(_,{goal:o.goal,onAddToContext:a,onOpenDetails:i,onSelectForChat:l}),"priorities"===o.widget_type&&o.priorities&&(0,r.jsx)(k,{priorities:o.priorities,onAddToContext:a,onOpenDetails:i,onSelectForChat:l}),"priority"===o.widget_type&&o.priority&&(0,r.jsx)(S,{priority:o.priority,onAddToContext:a,onOpenDetails:i,onSelectForChat:l}),"tasks"===o.widget_type&&o.tasks&&(0,r.jsx)(C,{tasks:o.tasks,onAddToContext:a,onOpenDetails:i,onSelectForChat:l}),"task"===o.widget_type&&o.task&&(0,r.jsx)(T,{task:o.task,onAddToContext:a,onOpenDetails:i,onSelectForChat:l}),"search_results"===o.widget_type&&(0,r.jsx)(P,{candidates:o.candidates||[],count:o.count||0}),"logs"===o.widget_type&&(0,r.jsx)(E,{logs:o.logs||[],count:o.count||0}),["task_created","task_updated","goal_created","goal_updated","priority_created","priority_updated","log_added","workspace_linked","workspace_unlinked"].includes(o.widget_type)&&o.message&&(0,r.jsx)(A,{message:o.message,type:o.widget_type})]}):null}function Z(e){return null!==R(e)}},29330:function(e,t,n){n.d(t,{P:function(){return f}});var r=n(27573),s=n(47200),a=n(7653),i=n(19369),l=n(87354),o=n(51856),c=n(85653),d=n(53362),u=n(88623),m=n(38983),x=n(30048),p=n(79590),g=n(46393),h=n(13207);function f(e){let{content:t,messageId:n,isLastAssistant:f=!1,onRegenerate:v,onRegenerateWithModel:b,onFeedback:y,feedback:j=null,className:N,position:w="inline"}=e,k=(0,g.T)("chat"),[C,_]=(0,a.useState)(!1),[S,T]=(0,a.useState)(!1),P=k(C?"copied":"copy"),[E,A]=(0,a.useState)(null),[R,I]=(0,a.useState)(!1),[O,D]=(0,a.useState)(!1),Z=(0,a.useCallback)(async()=>{if(null===E&&!R){I(!0),D(!1);try{let e=await fetch("/api/ai/available-models");if(!e.ok)throw Error("HTTP ".concat(e.status));let t=((await e.json()).models||[]).filter(e=>{var t;return!(null===(t=h.jd[e.id])||void 0===t?void 0:t.isLegacy)}).map(e=>({id:e.id,name:e.name}));A(t),0===t.length&&D(!0)}catch(e){s.kg.error("[MessageActions] Failed to load model catalog:",e),D(!0)}finally{I(!1)}}},[E,R]),L=(0,a.useCallback)(async()=>{try{await navigator.clipboard.writeText(t),_(!0),setTimeout(()=>_(!1),2e3)}catch(e){s.kg.error("Failed to copy:",e)}},[t]),M=(0,a.useCallback)(e=>{y&&y(e)},[y,j]);return(0,r.jsx)(x.pn,{delayDuration:300,children:(0,r.jsxs)("div",{className:(0,i.cn)("flex items-center gap-0.5","floating"===w&&"absolute -top-8 right-0 bg-background/80 backdrop-blur-sm rounded-lg border border-border/50 shadow-sm px-1 py-0.5","inline"===w&&"opacity-0 group-hover:opacity-100 transition-opacity duration-200",N),onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),children:[(0,r.jsxs)(x.u,{children:[(0,r.jsx)(x.aJ,{asChild:!0,children:(0,r.jsx)("button",{onClick:L,className:(0,i.cn)("p-1.5 rounded-md transition-all duration-200","text-muted-foreground hover:text-foreground hover:bg-muted/50",C&&"text-green-600 dark:text-green-400"),"aria-label":P,children:C?(0,r.jsx)(l.Z,{className:"w-3.5 h-3.5"}):(0,r.jsx)(o.Z,{className:"w-3.5 h-3.5"})})}),(0,r.jsx)(x._v,{side:"top",className:"text-xs",children:P})]}),y&&(0,r.jsxs)(x.u,{children:[(0,r.jsx)(x.aJ,{asChild:!0,children:(0,r.jsx)("button",{onClick:()=>M("positive"),className:(0,i.cn)("p-1.5 rounded-md transition-all duration-200","text-muted-foreground hover:text-foreground hover:bg-muted/50","positive"===j&&"text-green-600 dark:text-green-400 bg-green-500/10"),"aria-label":k("goodAnswer"),children:(0,r.jsx)(c.Z,{className:(0,i.cn)("w-3.5 h-3.5","positive"===j&&"fill-current")})})}),(0,r.jsx)(x._v,{side:"top",className:"text-xs",children:k("goodAnswer")})]}),y&&(0,r.jsxs)(x.u,{children:[(0,r.jsx)(x.aJ,{asChild:!0,children:(0,r.jsx)("button",{onClick:()=>M("negative"),className:(0,i.cn)("p-1.5 rounded-md transition-all duration-200","text-muted-foreground hover:text-foreground hover:bg-muted/50","negative"===j&&"text-red-600 dark:text-red-400 bg-red-500/10"),"aria-label":k("badAnswer"),children:(0,r.jsx)(d.Z,{className:(0,i.cn)("w-3.5 h-3.5","negative"===j&&"fill-current")})})}),(0,r.jsx)(x._v,{side:"top",className:"text-xs",children:k("badAnswer")})]}),f&&v&&(0,r.jsxs)(x.u,{children:[(0,r.jsx)(x.aJ,{asChild:!0,children:(0,r.jsx)("button",{onClick:()=>v(),className:(0,i.cn)("p-1.5 rounded-md transition-all duration-200","text-muted-foreground hover:text-foreground hover:bg-muted/50"),"aria-label":k("regenerate"),children:(0,r.jsx)(u.Z,{className:"w-3.5 h-3.5"})})}),(0,r.jsx)(x._v,{side:"top",className:"text-xs",children:k("regenerate")})]}),f&&b&&(0,r.jsxs)(p.h_,{onOpenChange:e=>{e&&Z()},children:[(0,r.jsx)(p.$F,{asChild:!0,children:(0,r.jsx)("button",{className:(0,i.cn)("p-1.5 rounded-md transition-all duration-200","text-muted-foreground hover:text-foreground hover:bg-muted/50"),"aria-label":k("retryWithModel"),title:k("retryWithModel"),children:(0,r.jsx)(m.Z,{className:"w-3.5 h-3.5"})})}),(0,r.jsxs)(p.AW,{align:"end",className:"min-w-[200px]",children:[(0,r.jsx)(p.Ju,{className:"text-xs text-muted-foreground",children:k("retryWithModel")}),R?(0,r.jsx)("div",{className:"px-2 py-3 text-xs text-muted-foreground text-center",children:k("loading")}):O?(0,r.jsx)("div",{className:"px-2 py-3 text-xs text-status-failed-foreground text-center",children:k("retryModelListFailed")}):(E||[]).map(e=>(0,r.jsx)(p.Xi,{onClick:()=>b(e.id),children:e.name},e.id))]})]})]})})}},29656:function(e,t,n){n.d(t,{Xn:function(){return m},ik:function(){return u}});var r=n(27573),s=n(7653),a=n(37811),i=n(19369),l=n(30048),o=n(46393),c=n(76786);function d(e,t,n){let r=Math.floor((new Date().getTime()-e.getTime())/1e3),s=Math.floor(r/60),a=Math.floor(s/60),i=Math.floor(a/24);return r<10?t("timeNow"):r<60?t("timeSecondsAgo",{count:String(r)}):s<60?t("timeMinutesAgo",{count:String(s)}):a<24?t("timeHoursAgo",{count:String(a)}):1===i?t("timeYesterday"):i<7?t("timeDaysAgo",{count:String(i)}):e.toLocaleDateString(n,{day:"numeric",month:"short"})}function u(e){var t;let{timestamp:n,className:c,edited:u=!1}=e,m=(0,o.T)("chat"),x="no"===(t=(0,a.bU)())?"nb-NO":"sv"===t?"sv
1-SE":"en-US",p=(0,s.useMemo)(()=>n instanceof Date?n:new Date(n),[n]),[g,h]=(0,s.useState)(()=>d(p,m,x));(0,s.useEffect)(()=>{let e=setInterval(()=>{h(d(p,m,x))},6e4);return()=>clearInterval(e)},[p,x,m]),(0,s.useEffect)(()=>{h(d(p,m,x))},[p,x,m]);let f=(0,s.useMemo)(()=>p.toLocaleString(x,{weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"}),[p,x]);return(0,r.jsx)(l.pn,{delayDuration:200,children:(0,r.jsxs)(l.u,{children:[(0,r.jsx)(l.aJ,{asChild:!0,children:(0,r.jsxs)("span",{className:(0,i.cn)("text-xs text-muted-foreground/60 cursor-default","hover:text-muted-foreground transition-colors",c),children:[g,u&&(0,r.jsxs)("span",{className:"ml-1",children:["(",m("editedLabel"),")"]})]})}),(0,r.jsx)(l._v,{side:"top",className:"text-xs",children:f})]})})}function m(e){let{model:t,className:n}=e,s=(0,c.L2)(t),a=(0,c._m)(t);return(0,r.jsx)("span",{title:s,className:(0,i.cn)("text-[10px] font-medium uppercase tracking-wide","inline-block max-w-[10rem] truncate align-bottom",a,n),children:s})}},57219:function(e,t,n){n.d(t,{vj:function(){return b}});var r=n(27573),s=n(19369),a=n(90979),i=n(84177),l=n(24239),o=n(99685),c=n(99199),d=n(34078),u=n(24875),m=n(30048),x=n(46393);let p={linkedin:a.Z,twitter:i.Z,youtube:l.Z,instagram:o.Z,facebook:c.Z,website:d.Z},g={linkedin:"text-blue-600 dark:text-blue-400",twitter:"text-sky-500",youtube:"text-red-500",instagram:"text-pink-500",facebook:"text-blue-500",website:"text-muted-foreground"};function h(e){try{return new URL(e).hostname.replace("www.","")}catch(t){return e.slice(0,30)}}function f(e){let{id:t,title:n,url:a,className:i}=e;return(0,r.jsx)(m.pn,{delayDuration:200,children:(0,r.jsxs)(m.u,{children:[(0,r.jsx)(m.aJ,{asChild:!0,children:(0,r.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:(0,s.cn)("inline-flex items-center justify-center","w-4 h-4 rounded text-[10px] font-medium","bg-primary/10 text-primary hover:bg-primary/20","transition-colors cursor-pointer","align-super",i),children:t.replace("S","")})}),(0,r.jsx)(m._v,{side:"top",className:"max-w-xs",children:(0,r.jsxs)("div",{className:"text-xs",children:[(0,r.jsx)("div",{className:"font-medium truncate",children:n}),(0,r.jsx)("div",{className:"text-muted-foreground truncate",children:h(a)})]})})]})})}function v(e){let{id:t,title:n,url:a,platform:i,variant:l="card",size:o="md",className:c}=e,x=i||(a.includes("linkedin.com")?"linkedin":a.includes("twitter.com")||a.includes("x.com")?"twitter":a.includes("youtube.com")||a.includes("youtu.be")?"youtube":a.includes("instagram.com")?"instagram":a.includes("facebook.com")?"facebook":"website"),v=p[x]||d.Z,b=g[x]||"text-muted-foreground",y={sm:{container:"px-2 py-1.5 gap-2",icon:"w-3.5 h-3.5",title:"text-xs",domain:"text-[10px]",id:"w-4 h-4 text-[10px]"},md:{container:"px-3 py-2 gap-2.5",icon:"w-4 h-4",title:"text-sm",domain:"text-xs",id:"w-5 h-5 text-xs"}}[o];return"inline"===l?(0,r.jsx)(f,{id:t,title:n,url:a,className:c}):(0,r.jsx)(m.pn,{delayDuration:200,children:(0,r.jsxs)(m.u,{children:[(0,r.jsx)(m.aJ,{asChild:!0,children:(0,r.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:(0,s.cn)("group flex items-center rounded-lg","bg-muted/50 border border-border/50","hover:bg-muted/80 hover:border-border","transition-all duration-200",y.container,c),children:[(0,r.jsx)("div",{className:(0,s.cn)("flex items-center justify-center rounded font-medium","bg-primary/10 text-primary",y.id),children:t.replace("S","")}),(0,r.jsx)(v,{className:(0,s.cn)(y.icon,b)}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:(0,s.cn)(y.title,"truncate text-foreground/80 group-hover:text-foreground"),children:n}),(0,r.jsx)("div",{className:(0,s.cn)(y.domain,"truncate text-muted-foreground"),children:h(a)})]}),(0,r.jsx)(u.Z,{className:(0,s.cn)("w-3.5 h-3.5 text-muted-foreground/40","group-hover:text-muted-foreground","transition-colors")})]})}),(0,r.jsx)(m._v,{side:"top",className:"max-w-sm",children:(0,r.jsxs)("div",{className:"text-xs",children:[(0,r.jsx)("div",{className:"font-medium",children:n}),(0,r.jsx)("div",{className:"text-muted-foreground truncate",children:a})]})})]})})}function b(e){let{sources:t,maxVisible:n=5,className:a}=e,i=(0,x.T)("chat");if(0===t.length)return null;let l=t.slice(0,n),o=t.length-n;return(0,r.jsxs)("div",{className:(0,s.cn)("space-y-2",a),children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)(d.Z,{className:"w-3.5 h-3.5"}),(0,r.jsx)("span",{children:i("sourcesCount",{count:t.length})})]}),(0,r.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:l.map(e=>(0,r.jsx)(v,{id:e.id,title:e.title,url:e.url,platform:e.platform,size:"sm"},e.id))}),o>0&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground text-center py-1",children:i("moreSourcesCount",{count:o})})]})}},12102:function(e,t,n){n.d(t,{r6:function(){return c},Bw:function(){return g},j0:function(){return h},ps:function(){return a}});let r=new Set(["spawn_subagent","spawn_subagents"]);function s(e){return void 0!==e&&r.has(e)}function a(){return{steps:[],currentTool:null,activeTools:[],thinkingPreview:null,reasoning:"",phase:null,finishedStatus:null,referencedNotRead:null,pluginDiagnostics:[],workspaceSkillDiagnostics:[],colleagueReasoning:{},nextId:1}}function i(e){return e?e.id:null}function l(e,t,n){for(let r=e.length-1;r>=0;r-=1){let s=e[r];if(s&&i(s.colleague)===t&&(!n||n(s)))return r}return -1}let o={request_sent:"activityRequestSent",model_selected:"activityModelSelected",awaiting_provider:"activityAwaitingProvider",first_token:"activityFirstToken",generating:"activityGenerating",finalizing:"activityFinalizing",finished:"activityFinished"},c={none_observed:"activityNoChangesMade",verified:"activityChangesVerified",unverified_or_failed:"activityChangesUnverified"};function d(e,t){return e.length>t?"".concat(e.slice(0,t),"â¦"):e}function u(e){return"".concat(Math.round(e/1e3),"s")}function m(e,t){let n=[...e.steps,{...t,id:e.nextId}];for(;n.length>20;){let e=n.findIndex((e,t)=>!!e.colleague&&t<n.length-1);n.splice(-1===e?0:e,1)}return{...e,steps:n,nextId:e.nextId+1}}function x(e,t,n){return n?e.t("activityColleagueDoing",{name:t.name,what:n}):e.t("activityColleagueWorking",{name:t.name})}function p(e,t){if(t&&e.hasToolLabel(t))return e.toolLabel(t).replace(/\s*(\.{3}|â¦)\s*$/u,"")}function g(e,t,n){var r,a,g,h,f,v,b,y;switch(t.type){case"lifecycle":{if(t.colleague){let r=t.colleague,s="finished"===t.phase,a={type:"lifecycle",label:s?n.t(function(e){switch(e){case"budget_exceeded":return"activityColleagueStoppedOnBudget";case"in_doubt":default:return"activityColleagueOutcomeUnknown";case"aborted":case"aborted_client":case"stopped":return"activityColleagueStopped";case"needs_input":return"activityColleagueNeedsInput";case"unsourced":return"activityColleagueUnsourced";case"change_unverified":return"activityColleagueChangeUnverified";case"error":case"failed":return"activityColleagueFailed";case"completed":return"activityColleagueDone"}}(t.status),{name:r.name}):x(n,r),phase:t.phase,colleague:r,timestamp:n.now},i=s?l(e.steps,r.id,e=>"run_cancelled"===e.type):l(e.steps,r.id,e=>"lifecycle"===e.type&&"finished"!==e.phase),o=-1===i?void 0:e.steps[i];if(o&&!s){let t=[...e.steps];return t[i]={...o,...a,id:o.id},{...e,steps:t}}if(s){if(o){let t=e.steps.filter((e,t)=>
1t!==i),n=l(t,r.id,e=>"lifecycle"===e.type),s=-1===n?t:t.filter((e,t)=>t!==n);return m({...e,steps:s},a)}let t=l(e.steps,r.id,e=>"lifecycle"===e.type);return m(-1===t?e:{...e,steps:e.steps.filter((e,n)=>n!==t)},a)}return m(e,a)}let s=[];"model_selected"===t.phase&&t.model&&s.push(t.model),"awaiting_provider"===t.phase&&t.elapsedMs&&t.elapsedMs>=1e3&&s.push(u(t.elapsedMs)),"generating"===t.phase&&"number"==typeof t.outputTokens&&s.push(n.t("tokensCount",{count:t.outputTokens})),"first_token"===t.phase&&"number"==typeof t.elapsedMs&&s.push(u(t.elapsedMs)),"finished"===t.phase&&t.mutationOutcome&&s.push(n.t(c[t.mutationOutcome]));let i={...e,phase:t.phase,finishedStatus:"finished"===t.phase?null!==(r=t.status)&&void 0!==r?r:null:e.finishedStatus,..."finalizing"===t.phase||"finished"===t.phase?{currentTool:null,activeTools:[]}:{}},d="finished"===t.phase?"error"===(y=i.finishedStatus)?"activityFinishedError":"aborted"===y||"aborted_client"===y?"activityCancelled":"activityFinished":o[t.phase],p={type:"lifecycle",label:n.t(d),detail:s.length>0?s.join(" \xb7 "):void 0,phase:t.phase,timestamp:n.now},g=l(i.steps,null),h=-1===g?void 0:i.steps[g];if("finished"===t.phase&&(null==h?void 0:h.type)==="run_cancelled"&&"activityCancelled"===d){let e=[...i.steps];return e[g]={...h,detail:null!==(a=p.detail)&&void 0!==a?a:h.detail,timestamp:n.now},{...i,steps:e}}if(h&&"lifecycle"===h.type&&h.phase===t.phase){let e=[...i.steps];return e[g]={...h,...p,id:h.id},{...i,steps:e}}return m(i,p)}case"reasoning":{if(t.colleague){let r=t.colleague,s=((null!==(g=e.colleagueReasoning[r.id])&&void 0!==g?g:"")+t.text).slice(0,4e3),a=new Set(e.steps.map(e=>{var t;return null===(t=e.colleague)||void 0===t?void 0:t.id}).filter(Boolean));a.add(r.id);let i={};for(let[t,n]of Object.entries(e.colleagueReasoning))a.has(t)&&(i[t]=n);i[r.id]=s;let o={...e,colleagueReasoning:i},c=d(s.trim(),120),u=l(o.steps,r.id),p=-1===u?void 0:o.steps[u];if(p&&"reasoning"===p.type){let e=[...o.steps];return e[u]={...p,detail:c,timestamp:n.now},{...o,steps:e}}return m(o,{type:"reasoning",label:x(n,r,n.t("activityReasoning")),detail:c,colleague:r,timestamp:n.now})}let r=e.reasoning+t.text,s=t.text.trim(),a={...e,reasoning:r,thinkingPreview:s?d(s,150):e.thinkingPreview},i=l(a.steps,null),o=-1===i?void 0:a.steps[i];if(o&&"reasoning"===o.type){let e=[...a.steps];return e[i]={...o,detail:d(r.trim(),120),timestamp:n.now},{...a,steps:e}}return m(a,{type:"reasoning",label:n.t("activityReasoning"),detail:d(r.trim(),120),timestamp:n.now})}case"tool_start":{let r=t.colleague?e.activeTools:t.callId?[...e.activeTools.filter(e=>e.callId!==t.callId),{callId:t.callId,tool:t.tool}]:[...e.activeTools,{tool:t.tool}];return m(t.colleague?e:{...e,activeTools:r,currentTool:t.tool,thinkingPreview:null},{type:"tool_start",callId:t.callId,label:t.colleague?x(n,t.colleague,p(n,t.tool)):n.toolLabel(t.tool),detail:t.colleague||s(t.tool)||!t.input?void 0:d(t.input,120),colleague:t.colleague,timestamp:n.now})}case"tool_running":{let r=i(t.colleague),s=l(e.steps,r,e=>"tool_start"===e.type&&(!t.callId||e.callId===t.callId));if(-1===s)return e;let a=[...e.steps],o=a[s];if(!o)return e;a[s]={...o,detail:u(t.elapsedMs),timestamp:n.now};let c=t.colleague?void 0:t.callId?e.activeTools.find(e=>e.callId===t.callId):[...e.activeTools].reverse().find(e=>e.tool===t.tool);return{...e,steps:a,...c?{currentTool:c.tool}:{}}}case"tool_done":{let r=[...e.activeTools];if(!t.colleague){let e=t.callId?r.findIndex(e=>e.callId===t.callId):r.findLastIndex(e=>!t.tool||e.tool===t.tool);e>=0&&r.splice(e,1)}let a=null!==(f=null===(h=r.at(-1))||void 0===h?void 0:h.tool)&&void 0!==f?f:null;return m(t.colleague?e:{...e,activeTools:r,currentTool:a},{type:"tool_done",label:t.colleague?(e=>{let r=p(n,t.tool);return r?n.t("activityColleagueDidStep",{name:e.name,what:r}):n.t("activityColleagueDidAStep",{name:e.name})})(t.colleague):t.tool?n.t("activityToolDone",{tool:n.toolLabel(t.tool)}):n.t("activityDone"),detail:t.colleague||s(t.tool)||!t.result?void 0:d(t.result,120),colleague:t.colleague,timestamp:n.now})}case"tool_error":{let r=[...e.activeTools];if(!t.colleague){let e=t.callId?r.findIndex(e=>e.callId===t.callId):r.findLastIndex(e=>e.tool===t.tool);e>=0&&r.splice(e,1)}let a=null!==(b=null===(v=r.at(-1))||void 0===v?void 0:v.tool)&&void 0!==b?b:null;return m(t.colleague?e:{...e,activeTools:r,currentTool:a},{type:"tool_error",label:t.colleague?(e=>{let r=p(n,t.tool);return r?n.t("activityColleagueStepFailed",{name:e.name,what:r}):n.t("activityColleagueStepDidNotWork",{name:e.name})})(t.colleague):s(t.tool)?n.t("activityBringInColleagueFailed"):n.t("activityToolFailed",{tool:n.toolLabel(t.tool)}),detail:t.colleague||s(t.tool)||!t.result?void 0:d(t.result,120),colleague:t.colleague,timestamp:n.now})}case"run_cancelled":return m(t.colleague?e:{...e,activeTools:[],currentTool:null,thinkingPreview:null},{type:"run_cancelled",label:t.colleague?n.t("activityColleagueStopped",{name:t.colleague.name}):n.t("activityCancelled"),colleague:t.colleague,timestamp:n.now});case"read_name_reference":{let r=t.notice.trim();if(!r)return e;let s=i(t.colleague),a=e.steps.findIndex(e=>"read_name_reference"===e.type&&i(e.colleague)===s),l=t.colleague?e:{...e,referencedNotRead:{notice:r,count:t.count}},o=t.colleague?x(n,t.colleague,r):r,c=-1===a?void 0:l.steps[a];if(c){let e=[...l.steps];return e[a]={...c,label:o,timestamp:n.now},{...l,steps:e}}return m(l,{type:"read_name_reference",label:o,colleague:t.colleague,timestamp:n.now})}case"plugin_diagnostic":{let r=t.notice.trim(),s=t.colleague?x(n,t.colleague,r):r;
1return function(e,t,n,r,s){var a,i;let l=t.plugin.trim(),o=t.notice.trim();if(!l||!o)return e;let c=e.pluginDiagnostics.some(e=>e.plugin===l),d=t.colleague||c?e:{...e,pluginDiagnostics:[...e.pluginDiagnostics,{plugin:l,notice:o,actionLabel:t.actionLabel,actionHref:t.actionHref}]},u=null!==(i=null===(a=t.colleague)||void 0===a?void 0:a.id)&&void 0!==i?i:null;return d.steps.some(e=>{var t,r;return"plugin_diagnostic"===e.type&&(null!==(r=null===(t=e.colleague)||void 0===t?void 0:t.id)&&void 0!==r?r:null)===u&&e.label===n})?d:s(d,{type:"plugin_diagnostic",label:n,action:{href:t.actionHref,label:t.actionLabel},colleague:t.colleague,timestamp:r})}(e,t,s,n.now,m)}case"workspace_skill_diagnostic":return function(e,t,n,r){let s=t.skill.trim(),a=t.notice.trim();if(!s||!a)return e;let i=e.workspaceSkillDiagnostics.some(e=>e.skill===s)?e:{...e,workspaceSkillDiagnostics:[...e.workspaceSkillDiagnostics,{skill:s,notice:a}]};return i.steps.some(e=>"workspace_skill_diagnostic"===e.type&&e.label===a)?i:r(i,{type:"workspace_skill_diagnostic",label:a,timestamp:n})}(e,t,n.now,m);default:return e}}function h(e,t,n){return t.reduce((e,t)=>g(e,t,n),e)}},52872:function(e,t,n){n.d(t,{Ad:function(){return u},CP:function(){return x},DQ:function(){return c},DW:function(){return i},P0:function(){return l},Vj:function(){return d},bJ:function(){return o},cK:function(){return m}});var r=n(22408);let s=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,a=/^[0-9a-f-]{36}$/i;function i(e){let t=e.match(/<!--AGENT_RESOURCE_NONCE:([0-9a-f-]{36})-->/i),n=null==t?void 0:t[1];if(!n||!a.test(n))return[];let r=[],i=new Set;for(let t of e.matchAll(/<!--AGENT_RESOURCE:([0-9a-f-]{36}):([^>]+)-->/gi))if(t[1]===n&&t[2])try{let e=JSON.parse(decodeURIComponent(t[2]));if(!e.kind||!["board","document","presentation","dialogue","task"].includes(e.kind)||!e.id||!s.test(e.id))continue;let n="".concat(e.kind,":").concat(e.id);if(i.has(n))continue;i.add(n),r.push({kind:e.kind,id:e.id})}catch(e){}return r}function l(e){var t;let n=null===(t=e.match(/<!--AGENT_RESOURCE_NONCE:([0-9a-f-]{36})-->/i))||void 0===t?void 0:t[1];if(!n||!a.test(n))return[];let r=[],s=new Set;for(let t of e.matchAll(/<!--AGENT_RESEARCH_PLAN:([0-9a-f-]{36}):([^>]+)-->/gi))if(t[1]===n&&t[2])try{let e=JSON.parse(decodeURIComponent(t[2]));if(!(e&&"object"==typeof e&&"string"==typeof e.id&&e.id.length>0&&"string"==typeof e.goal&&"string"==typeof e.strategy&&"draft"===e.status&&Array.isArray(e.steps)&&e.steps.every(e=>!!e&&"string"==typeof e.description&&Array.isArray(e.tools)&&e.tools.every(e=>"string"==typeof e)&&Array.isArray(e.targets)&&e.targets.every(e=>!!e&&["company","website","search","social"].includes(e.type)&&"string"==typeof e.identifier&&"string"==typeof e.reason))&&e.estimates&&Number.isFinite(e.estimates.timeMinutes)&&Number.isFinite(e.estimates.costUnits)&&Array.isArray(e.exclusions)&&e.exclusions.every(e=>"string"==typeof e))||s.has(e.id))continue;s.add(e.id),r.push(e)}catch(e){}return r}function o(e){var t;if(!e)return null;let n=null===(t=e.match(/<!--AGENT_RESOURCE_NONCE:([0-9a-f-]{36})-->/i))||void 0===t?void 0:t[1];if(!n||!a.test(n))return null;let s=null;for(let t of e.matchAll(/<!--AGENT_MUTATION_OUTCOME:([0-9a-f-]{36}):([a-z_]+)-->/gi))t[1]===n&&t[2]&&(0,r.KO)(t[2])&&(s=t[2]);return s}function c(e){let t=e.replace(/<!--AGENT_RESOURCE_NONCE:[^>]*-->\n?/gi,"").replace(/<!--AGENT_RESOURCE:[^>]*-->\n?/gi,"").replace(/<!--AGENT_MUTATION_OUTCOME:[^>]*-->\n?/gi,"").replace(/<!--AGENT_RESEARCH_PLAN:[^>]*-->\n?/gi,""),n=Math.min(...[t.indexOf("<!--AGENT_RESOURCE"),t.indexOf("<!--AGENT_MUTATION_OUTCOME"),t.indexOf("<!--AGENT_RESEARCH_PLAN")].filter(e=>-1!==e).concat(Number.POSITIVE_INFINITY));return n===Number.POSITIVE_INFINITY?t:t.slice(0,n).trimEnd()}function d(e){let t="\\/production\\/(?:boards\\/|presentations\\/|dialogues\\/)?[0-9a-f]{8}-[0-9a-f-]{27}";return e.replace(RegExp("\\[([^\\]]+)\\]\\(".concat(t,"\\)"),"gi"),"$1").replace(RegExp("`"+t+"`","gi"),"").replace(RegExp(t,"gi"),"")}let u="__CORE_CONTEXT_PROPOSAL__";function m(e){var t,n,r;let s=null===(t=e.match(/<!--AGENT_RESOURCE_NONCE:([0-9a-f-]{36})-->/i))||void 0===t?void 0:t[1];if(!s||!a.test(s))return null;let i=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");
1return null!==(r=null===(n=e.match(new RegExp("".concat(u).concat(i,":([\\s\\S]*?)").concat("__END_PROPOSAL__"))))||void 0===n?void 0:n[1])&&void 0!==r?r:null}function x(e,t){return"string"==typeof t.file_id&&0!==t.file_id.length&&"string"==typeof t.proposed_content&&e.some(e=>{if(!e)return!1;let n=m(e);if(!n)return!1;try{let e=JSON.parse(n);return e.file_id===t.file_id&&e.proposed_content===t.proposed_content&&e.content_version===t.content_version}catch(e){return!1}})}},76786:function(e,t,n){n.d(t,{L2:function(){return l},_m:function(){return o}});var r=n(13207);let s={"hermes-main":"Agent",hermes:"Agent","elevenlabs-agent":"Voice"},a={"hermes-main":"text-primary",hermes:"text-primary","claude-opus":"text-violet-600 dark:text-violet-400","claude-sonnet":"text-orange-600 dark:text-orange-400","claude-haiku":"text-amber-600","claude-3-opus":"text-violet-600 dark:text-violet-400",claude:"text-orange-500","gpt-5":"text-emerald-600 dark:text-emerald-400","gpt-4":"text-emerald-600","gpt-3.5":"text-teal-500",gpt:"text-emerald-600 dark:text-emerald-400","o1-mini":"text-blue-500",gemini:"text-sky-600",codestral:"text-rose-500",mistral:"text-rose-600 dar
1k:text-rose-400",qwen:"text-indigo-600 dark:text-indigo-400",glm:"text-cyan-600 dark:text-cyan-400"},i="text-muted-foreground";function l(e){var t,n;let a=e.trim();return(Object.hasOwn(r.jd,a)?null===(t=r.jd[a])||void 0===t?void 0:t.name:void 0)||(Object.hasOwn(s,a)&&null!==(n=s[a])&&void 0!==n?n:a)}function o(e){let t=e.trim().toLowerCase();if(!t)return i;let n=Object.keys(a).find(e=>t.includes(e));return n?a[n]:i}},90697:function(e,t,n){n.d(t,{f8:function(){return a},qc:function(){return s}});var r=n(13207);function s(e){if(e){let t=r.jd[e];if(null==t?void 0:t.contextWindow)return t.contextWindow}return 5e4}function a(e){return Math.ceil(e.length/4)}},55298:function(e,t,n){n.d(t,{eJ:function(){return a},w3:function(){return s}});var r=n(6963).Buffer;function s(e){var t;return null!==(t=function(e,t){if(!e)return[];let n=RegExp("<!--".concat(t,":([A-Za-z0-9+/=]+)-->"),"g"),s=e.matchAll(n),a=[];for(let e of s){let t=function(e){try{if(void 0!==r)return JSON.parse(r.from(e,"base64").toString("utf8"))}catch(e){}try{let t=globalThis.atob;if(!t)return null;let n=t(e),r=Uint8Array.from(n,e=>e.charCodeAt(0)),s=new TextDecoder().decode(r);return JSON.parse(s)}catch(e){return null}}(e[1]||"");t&&a.push(t)}return a}(e,"MESSAGE_RESEARCH_PROVENANCE")[0])&&void 0!==t?t:null}function a(e){return e?e.replace(/<!--RESEARCH_TOOL_RESULT:[A-Za-z0-9+/=]+-->\n?/g,"").replace(/<!--MESSAGE_RESEARCH_PROVENANCE:[A-Za-z0-9+/=]+-->\n?/g,""):e}},33860:function(e,t,n){n.d(t,{Ih:function(){return i},LF:function(){return r},aA:function(){return a}});let r=[{id:"claude-sonnet-5",tier:"advanced",isDefault:!0,displayOrder:10,factorCoverage:"covered"},{id:"gpt-5.6-terra",tier:"advanced",isDefault:!1,displayOrder:20,factorCoverage:"pending-v2"},{id:"claude-opus-5",tier:"frontier",isDefault:!1,displayOrder:30,factorCoverage:"covered"},{id:"gpt-5.6-sol",tier:"frontier",isDefault:!1,displayOrder:40,factorCoverage:"pending-v2"}].filter(e=>"covered"===e.factorCoverage),s=new Set(r.map(e=>e.id));function a(e){return"string"==typeof e&&s.has(e.trim())}function i(){var e;let t=r.find(e=>e.isDefault);return null!==(e=null==t?void 0:t.id)&&void 0!==e?e:r[0].id}},13207:function(e,t,n){n.d(t,{Q6:function(){return s},jd:function(){return r}});let r={"jev-1.13.0":{id:"jev-1.13.0",name:"Jev 1.13",provider:"typesafe",description:"Typed shadow decisions; external data use requires separate approval",maxTokens:0,contextWindow:64e3,inputCostPer1k:42e-6,outputCostPer1k:0,capabilities:[],dataResidency:{region:"unknown",zdr:"unknown",evidence:"U"}},"claude-opus-5":{id:"claude-opus-5",name:"Claude Opus 5",provider:"anthropic",description:"Most intelligent â long-horizon agents, deep reasoning, 1M context",maxTokens:64e3,contextWindow:1e6,inputCostPer1k:.005,outputCostPer1k:.025,capabilities:["chat","vision","code","reasoning","tools","agentic","deep-research"],dataResidency:{region:"global",zdr:"available",evidence:"V",note:"US-processed; ZDR via enterprise DPA"}},"claude-opus-4-8":{id:"claude-opus-4-8",name:"Claude Opus 4.8",provider:"anthropic",description:"Previous Opus â long-horizon agents, deep reasoning, 1M context",maxTokens:64e3,contextWindow:1e6,inputCostPer1k:.005,outputCostPer1k:.025,capabilities:["chat","vision","code","reasoning","tools","agentic","deep-research"],dataResidency:{region:"global",zdr:"available",evidence:"V",note:"US-processed; ZDR via enterprise DPA"}},"claude-sonnet-5":{id:"claude-sonnet-5",name:"Claude Sonnet 5",provider:"anthropic",description:"Best speed/intelligence balance â near-Opus on coding/agentic, 1M context",maxTokens:64e3,contextWindow:1e6,inputCostPer1k:.003,outputCostPer1k:.015,capabilities:["chat","vision","code","reasoning","tools","agentic"],isDefault:!0,dataResidency:{region:"global",zdr:"available",evidence:"V",note:"US-processed; ZDR via enterprise DPA"}},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",provider:"anthropic",description:"Previous Opus â strong for complex tasks, 1M context",maxTokens:64e3,contextWindow:1e6,inputCostPer1k:.005,outputCostPer1k:.025,capabilities:["chat","vision","code","reasoning","tools","agentic","deep-research"],dataResidency:{region:"global",zdr:"available",evidence:"V",note:"US-processed; ZDR via enterprise DPA"}},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",provider:"anthropic",description:"Previous Sonnet â speed/intelligence balance, 1M context",maxTokens:16384,contextWindow:1e6,inputCostPer1k:.003,outputCostPer1k:.015,capabilities:["chat","vision","code","reasoning","tools","agentic"],dataResidency:{region:"global",zdr:"available",evidence:"V",note:"US-processed; ZDR via enterprise DPA"}},"claude-opus-4-5-20251101":{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",provider:"anthropic",description:"Legacy â use Claude Opus 4.8 instead",maxTokens:64e3,contextWindow:2e5,inputCostPer1k:.005,outputCostPer1k:.025,capabilities:["chat","vision","code","reasoning","tools","agentic","deep-research"],isLegacy:!0,dataResidency:{region:"global",zdr:"available",evidence:"V",note:"US-processed; ZDR via enterprise DPA"}},"claude-haiku-4-5-20251001":{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",provider:"anthropic",description:"Fast and affordable â tool use, vision, extended thinking. Retirement: not before Oct 2026",maxTokens:8192,contextWindow:2e5,inputCostPer1k:.001,outputCostPer1k:.005,capabilities:["chat","vision","reasoning","tools","fast"],dataResidency:{region:"global",zdr:"available",evidence:"V",note:"US-processed; ZDR via enterprise DPA"}},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro",provider:"google",description:"Advanced reasoning, agentic workflows, 1M context",maxTokens:65536,contextWindow:1e6,inputCostPer1k:.002,outputCostPer1k:.012,capabilities:["chat","vision","code","reasoning","tools","long-context","multimodal","agentic"],dataResidency:{region:"global",zdr:"available",evidence:"V",note:"Vertex EU data-residency configurable; API default global"}},"gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",provider:"google",description:"Newest Flash â beats 3.1 Pro on coding/agentic at lower cost",maxTokens:66e3,contextWindow:1e6,inputCostPer1k:.0015,outputCostPer1k:.009,capabilities:["chat","vision","code","reasoning","tools","long-context","multimodal","fast"],dataResidency:{region:"global",zdr:"available",evidence:"V",note:"Vertex EU data-residency configurable; API default global"}},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",provider:"google",description:"Fast frontier-class â rivals larger models at lower cost",maxTokens:66e3,contextWindow:1e6,inputCostPer1k:5e-4,outputCostPer1k:.003,capabilities:["chat","vision","code","reasoning","tools","long-context","multimodal","fast"],dataResidency:{region:"global",zdr:"available",evidence:"V",note:"Vertex EU data-residency configurable; API default global"}},"gemini-2.0-flash-exp":{id:"gemini-2.0-flash-exp",name:"Gemini 2.0 Flash",provider:"google",description:"Legacy â use Gemini 3 Flash instead",maxTokens:8192,contextWindow:1e6,inputCostPer1k:0,outputCostPer1k:0,capabilities:["chat","vision","code","reasoning","tools","long-context","multimodal","fast"],isLegacy:!0},"gemini-2.5-flash-preview-05-20":{id:"gemini-2.5-flash-preview-05-20",name:"Gemini 2.5 Flash (Preview)",provider:"google",description:"Legacy â use Gemini 3 Flash instead",maxTokens:8192,contextWindow:1e6,inputCostPer1k:1e-4,outputCostPer1k:4e-4,capabilities:["chat","vision","fast","long-context","multimodal"],isLegacy:!0},"gpt-5.6-sol":{id:"gpt-5.6-sol",name:"GPT-5.6 Sol",provider:"openai",description:"Frontier reasoning â agentic, long-context",maxTokens:128e3,contextWindow:4e5,inputCostPer1k:.005,outputCostPer1k:.03,capabilities:["chat","vision","code","reasoning","tools","agentic","long-context"],dataResidency:{region:"global",zdr:"available",evidence:"V",note:"ZDR via enterprise/API data-controls"}},"gpt-5.6-terra":{id:"gpt-5.6-terra",name:"GPT-5.6 Terra",provider:"openai",description:"Balanced â near-frontier qual
1ity at lower cost",maxTokens:128e3,contextWindow:4e5,inputCostPer1k:.0025,outputCostPer1k:.015,capabilities:["chat","vision","code","reasoning","tools","fast"],dataResidency:{region:"global",zdr:"available",evidence:"V",note:"ZDR via enterprise/API data-controls"}},"gpt-5.6-luna":{id:"gpt-5.6-luna",name:"GPT-5.6 Luna",provider:"openai",description:"Cheapest â classification, extraction, simple tasks",maxTokens:128e3,contextWindow:4e5,inputCostPer1k:.001,outputCostPer1k:.006,capabilities:["chat","code","fast"],dataResidency:{region:"global",zdr:"available",evidence:"V",note:"ZDR via enterprise/API data-controls"}},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",provider:"openai",description:"Legacy â use GPT-5.6 Sol instead",maxTokens:128e3,contextWindow:105e4,inputCostPer1k:.0025,outputCostPer1k:.015,capabilities:["chat","vision","code","reasoning","tools","agentic","long-context"],isLegacy:!0},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",provider:"openai",description:"Legacy â use GPT-5.6 Terra instead",maxTokens:128e3,contextWindow:4e5,inputCostPer1k:75e-5,outputCostPer1k:.0045,capabilities:["chat","vision","code","reasoning","tools","fast"],isLegacy:!0},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 Nano",provider:"openai",description:"Legacy â use GPT-5.6 Luna instead",maxTokens:128e3,contextWindow:4e5,inputCostPer1k:2e-4,outputCostPer1k:.00125,capabilities:["chat","code","fast"],isLegacy:!0},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",provider:"openai",description:"Legacy â use GPT-5.4 instead",maxTokens:65536,contextWindow:256e3,inputCostPer1k:.015,outputCostPer1k:.06,capabilities:["chat","vision","code","reasoning","tools","deep-research","agentic"],isLegacy:!0},"gpt-5.2-thinking":{id:"gpt-5.2-thinking",name:"GPT-5.2 Thinking",provider:"openai",description:"Legacy â use GPT-5.4 instead",maxTokens:32768,contextWindow:256e3,inputCostPer1k:.01,outputCostPer1k:.04,capabilities:["chat","vision","code","reasoning","tools"],isLegacy:!0},"gpt-5.2-instant":{id:"gpt-5.2-instant",name:"GPT-5.2 Instant",provider:"openai",description:"Legacy â use GPT-5.4 Mini instead",maxTokens:16384,contextWindow:256e3,inputCostPer1k:.003,outputCostPer1k:.012,capabilities:["chat","vision","code","fast","tools"],isLegacy:!0},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",provider:"openai",description:"Legacy â use GPT-5.4 Mini instead",maxTokens:32768,contextWindow:128e3,inputCostPer1k:.002,outputCostPer1k:.008,capabilities:["chat","vision","code","reasoning","tools"],isLegacy:!0},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 Mini",provider:"openai",description:"Legacy â use GPT-5.4 Nano instead",maxTokens:16384,contextWindow:128e3,inputCostPer1k:4e-4,outputCostPer1k:.0016,capabilities:["chat","fast"],isLegacy:!0},"mistral-large-latest":{id:"mistral-large-latest",name:"Mistral Large",provider:"mistral",description:"EU-hosted â strong tool calling, multimodal, 262K context",maxTokens:8192,contextWindow:262e3,inputCostPer1k:5e-4,outputCostPer1k:.0015,capabilities:["chat","vision","code","reasoning","tools"],dataResidency:{region:"eu",zdr:"available",evidence:"V",note:"EU-hosted default; some features may transfer out of EU (Enterprise can disable)"}},"mistral-small-latest":{id:"mistral-small-latest",name:"Mistral Small",provider:"mistral",description:"Fast and affordable EU-hosted model",maxTokens:8192,contextWindow:128e3,inputCostPer1k:1e-4,outputCostPer1k:3e-4,capabilities:["chat","code","fast"],dataResidency:{region:"eu",zdr:"available",evidence:"V",note:"EU-hosted default; some features may transfer out of EU (Enterprise can disable)"}},"codestral-latest":{id:"codestral-latest",name:"Codestral",provider:"mistral",description:"Code-focused â optimized for code generation and analysis",maxTokens:8192,contextWindow:128e3,inputCostPer1k:3e-4,outputCostPer1k:9e-4,capabilities:["chat","code","fast"]},"alibaba/qwen3.6-plus":{id:"alibaba/qwen3.6-plus",name:"Qwen 3.6 Plus",provider:"openrouter",description:"Long-context agentic open model for A/B testing in worksessions",maxTokens:65536,contextWindow:1e6,inputCostPer1k:325e-6,outputCostPer1k:.00195,capabilities:["chat","code","reasoning","tools","agentic","long-context"],dataResidency:{region:"unknown",zdr:"available",evidence:"U",note:"OpenRouter route; ZDR via privacy setting; sub-provider region not pinned"}},"z-ai/glm-5.2":{id:"z-ai/glm-5.2",name:"GLM-5.2",provider:"openrouter",description:"Open-weight frontier-adjacent (Z.ai, MIT) â selectable;
1 not EU-pinned",maxTokens:65536,contextWindow:1e6,inputCostPer1k:93e-5,outputCostPer1k:.003,capabilities:["chat","code","reasoning","tools","agentic","long-context"],dataResidency:{region:"unknown",zdr:"available",evidence:"U",note:"OpenRouter route; sub-provider and region are not pinned; ZDR requires privacy routing; EU routing requires OpenRouter enterprise"}}},s="claude-sonnet-5"}}]);
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.