@redocly/openapi-docs 3.24.0-next.10 → 3.24.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{redocly-openapi-docs.min.AiChatProvider-DhmZRjCy.js → redocly-openapi-docs.min.AiChatProvider-B6qZxoKI.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-D1axMGbc.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-Cy4k7pUw.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiPanel-DsHL8Tj5.js → redocly-openapi-docs.min.AiPanel-Bwuv-ZH_.js} +75 -75
- package/dist/{redocly-openapi-docs.min.SqliteDBStorage-DbMKa2rS.js → redocly-openapi-docs.min.SqliteDBStorage-DlCxvBqX.js} +1 -1
- package/dist/{redocly-openapi-docs.min.ai-chat-mappers-CYTtl-vb.js → redocly-openapi-docs.min.ai-chat-mappers-C8DaS6ge.js} +1 -1
- package/dist/{redocly-openapi-docs.min.external-resolver-l2gG6VEi.js → redocly-openapi-docs.min.external-resolver-CKkEKWzQ.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-DAzSuxAj.js → redocly-openapi-docs.min.index-BsXv-Pjz.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-DdeY52iV.js → redocly-openapi-docs.min.index-DWajc5Ac.js} +1153 -1139
- package/dist/{redocly-openapi-docs.min.index-Cof5qhpm.js → redocly-openapi-docs.min.index-We3Hmt3m.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-DafBC2xj.js → redocly-openapi-docs.min.index-bTUZhh-q.js} +1 -1
- package/dist/redocly-openapi-docs.min.js +1 -1
- package/dist/{redocly-openapi-docs.min.lint-DzAaVAOn.js → redocly-openapi-docs.min.lint-DMpx1vvZ.js} +2 -2
- package/dist/{redocly-openapi-docs.min.lint-graphql-GMwEJAKm.js → redocly-openapi-docs.min.lint-graphql-DH0N_7pS.js} +1 -1
- package/dist/{redocly-openapi-docs.min.respect-run-DeLDyD3E.js → redocly-openapi-docs.min.respect-run-JH1Xd21R.js} +1 -1
- package/dist/{redocly-openapi-docs.min.standalone-DrxWsrqx.js → redocly-openapi-docs.min.standalone-DMeytWE9.js} +3 -3
- package/dist/{redocly-openapi-docs.min.tauri-path-Q8cku-q2.js → redocly-openapi-docs.min.tauri-path-TzmCcPBx.js} +1 -1
- package/dist/{redocly-openapi-docs.min.useAiChatQueries-Bjb0Ax3R.js → redocly-openapi-docs.min.useAiChatQueries-RJxlmgfo.js} +79 -79
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as pt,h as ft,m as
|
|
1
|
+
import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as pt,h as ft,m as ye,n as ht,aA as xt,aB as gt,ae as E,ab as U,d as mt}from"./redocly-openapi-docs.min.standalone-DMeytWE9.js";import{f as J,z as we,B as vt,e as yt,q as je,m as wt,n as jt,C as bt,E as Ct,F as se,G as le,H as kt,J as It,S as $,K as ce,L as Tt,M as _t,N as be,O as St,P as At,R as de,Q as Ot,U as ue,V as Ce,W as ke,t as Ie,X as pe,Y as L,Z as Bt,_ as Vt,$ as zt,a0 as Mt,a1 as Ft}from"./redocly-openapi-docs.min.index-DWajc5Ac.js";import{B as $t,C as Rt,E as Et,F as Lt,G as Nt,H as Dt,I as Pt,J as Te,K as k,L as _e,M as Ut,N as Ht,O as H,P as Gt,Q as Kt,R as Wt,S as V,U as Zt,V as N}from"./redocly-openapi-docs.min.useAiChatQueries-RJxlmgfo.js";function Q(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Yt=45e3,qt=e=>r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:r.jsx("path",{d:"M12 7.5H4V8.5H12V7.5Z"})}),Jt=l(qt).attrs({"data-component-name":"icons/SubtractIcon/SubtractIcon"})`
|
|
2
2
|
path {
|
|
3
3
|
fill: ${({color:e})=>q(e)};
|
|
4
4
|
}
|
|
@@ -29,7 +29,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
29
29
|
|
|
30
30
|
height: ${({size:e="14px"})=>e};
|
|
31
31
|
width: ${({size:e="14px"})=>e};
|
|
32
|
-
`;function sn({placeholder:e="Ask anything...",className:t,disabled:n,isStreaming:
|
|
32
|
+
`;function sn({placeholder:e="Ask anything...",className:t,disabled:n,isStreaming:o=!1,onStop:i,modelSelector:a,value:s,onValueChange:c,onSubmit:d,textareaRef:u}){const f=s.trim(),p=!n&&f.length>0&&!o,x=!n&&f.length>0,g=w=>{c(w.target.value)},v=()=>{!f||n||o||d()},b=()=>{!o||!i||i()},y=w=>{w.key==="Enter"&&!w.shiftKey&&!w.nativeEvent.isComposing&&(w.preventDefault(),o&&i?b():v())};return r.jsxs(ln,{className:t,$isActive:x,children:[r.jsx(cn,{ref:u,rows:1,maxLength:Yt,placeholder:e,value:s,disabled:n,spellCheck:!1,onChange:g,onKeyDown:y}),r.jsxs(dn,{children:[a,o&&i?r.jsx(pn,{type:"button",size:"small","aria-label":"Stop generating",icon:r.jsx(tn,{color:"var(--icon-color-on-color)"}),onClick:b}):r.jsx(un,{type:"button",size:"small","aria-label":"Send message",icon:r.jsx(Xt,{color:"var(--icon-color-on-color)"}),onClick:v,disabled:!p})]})]})}const ln=l.div`
|
|
33
33
|
display: flex;
|
|
34
34
|
flex-direction: column;
|
|
35
35
|
gap: var(--spacing-xs);
|
|
@@ -93,13 +93,13 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
93
93
|
box-sizing: border-box;
|
|
94
94
|
background: var(--color-warm-grey-9);
|
|
95
95
|
border-radius: var(--border-radius-xxl);
|
|
96
|
-
`,fn=new Set(["collection","workflow","step","operation","workflow-run"]);function
|
|
97
|
-
`))&&(t=t.trim()),(!
|
|
98
|
-
`))&&(n=n.trim())):
|
|
96
|
+
`,fn=new Set(["collection","workflow","step","operation","workflow-run"]);function fe(e){return`replay://step?${new URLSearchParams({collectionId:e.collectionId.trim(),workflowId:e.workflowId.trim(),stepId:e.stepId.trim()}).toString()}`}function z(e,t){const n=e.get(t);if(n==null)return null;const o=n.trim();return o.length>0?o:null}function hn(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="replay:")return null;const n=t.hostname.toLowerCase();if(!fn.has(n))return null;const o=t.searchParams;switch(n){case"collection":{const i=z(o,"collectionId");return i?{kind:"collection",collectionId:i}:null}case"workflow":{const i=z(o,"collectionId"),a=z(o,"workflowId");return!i||!a?null:{kind:"workflow",collectionId:i,workflowId:a}}case"step":{const i=z(o,"collectionId"),a=z(o,"workflowId"),s=z(o,"stepId");return!i||!a||!s?null:{kind:"step",collectionId:i,workflowId:a,stepId:s}}case"operation":{const i=z(o,"operationId");return i?{kind:"operation",operationId:i}:null}case"workflow-run":{const i=z(o,"collectionId"),a=z(o,"workflowId");if(!i||!a)return null;const s=z(o,"historyId"),c=s==="null"||s==="undefined"?null:s;return{kind:"workflow-run",collectionId:i,workflowId:a,...c?{historyId:c}:{}}}default:return null}}function xn(e,t,n){return e.tabsState.tabs.get({noproxy:!0}).findIndex(({data:o})=>vt(o,yt.WorkflowRun)&&o.collectionId===t&&o.workflowId===n)}function gn(e,t,n,o={}){switch(n.kind){case"collection":t.openCollectionTab({collectionId:n.collectionId,activeTabName:we.COLLECTION_SETTINGS});break;case"workflow":t.openWorkflowTab({collectionId:n.collectionId,workflowId:n.workflowId,activeTabName:we.WORKFLOW_SETTINGS});break;case"step":t.openStepTabFromCollection({collectionId:n.collectionId,workflowId:n.workflowId,stepId:n.stepId,state:J.Normal});break;case"workflow-run":{const i=o.workflowRunHistoryIds?.[Lt(n.collectionId,n.workflowId)]??[],a=n.historyId&&i.includes(n.historyId)?n.historyId:i.at(-1)??n.historyId;if(a){t.openWorkflowRunTabFromHistory(a,{state:J.Normal});break}const s=xn(e,n.collectionId,n.workflowId);if(s!==-1){e.tabsState.tabs.get({noproxy:!0})[s].state===J.Preview&&t.changeTabState(s,J.Normal),t.handleTabChange(s);break}t.openWorkflowRunTab({collectionId:n.collectionId,workflowId:n.workflowId});break}case"operation":{const i=$t(e,n.operationId);if(!i.ok){console.warn("[executeReplayChatLink] Operation not resolved",{operationId:n.operationId,message:i.message});return}Rt(e,Et(i.value),t);break}}}function mn(e,t,n,o={}){const i=hn(n);i&&gn(e,t,i,o)}function Se({workflowRunHistoryIds:e}={}){const t=je(),{getApiOperation:n}=wt(),{handleTabChange:o,addNewTab:i,openCollectionTab:a,openWorkflowTab:s,openStepTabFromCollection:c,openWorkflowRunTab:d,openWorkflowRunTabFromHistory:u,changeTabState:f}=jt();return h.useCallback(p=>{const x=p.target;if(!(x instanceof Element))return;const g=x.closest("a[href]");if(!(g instanceof HTMLAnchorElement))return;const v=g.getAttribute("href");v?.startsWith("replay:")&&(p.preventDefault(),p.stopPropagation(),mn(t,{getApiOperation:n,handleTabChange:o,addNewTab:i,openCollectionTab:a,openWorkflowTab:s,openStepTabFromCollection:c,openWorkflowRunTab:d,openWorkflowRunTabFromHistory:u,changeTabState:f},v,{workflowRunHistoryIds:e}))},[e,t,n,o,i,a,s,c,d,u,f])}class vn{diff(t,n,o={}){let i;typeof o=="function"?(i=o,o={}):"callback"in o&&(i=o.callback);const a=this.castInput(t,o),s=this.castInput(n,o),c=this.removeEmpty(this.tokenize(a,o)),d=this.removeEmpty(this.tokenize(s,o));return this.diffWithOptionsObj(c,d,o,i)}diffWithOptionsObj(t,n,o,i){var a;const s=m=>{if(m=this.postProcess(m,o),i){setTimeout(function(){i(m)},0);return}else return m},c=n.length,d=t.length;let u=1,f=c+d;o.maxEditLength!=null&&(f=Math.min(f,o.maxEditLength));const p=(a=o.timeout)!==null&&a!==void 0?a:1/0,x=Date.now()+p,g=[{oldPos:-1,lastComponent:void 0}];let v=this.extractCommon(g[0],n,t,0,o);if(g[0].oldPos+1>=d&&v+1>=c)return s(this.buildValues(g[0].lastComponent,n,t));let b=-1/0,y=1/0;const w=()=>{for(let m=Math.max(b,-u);m<=Math.min(y,u);m+=2){let T;const O=g[m-1],S=g[m+1];O&&(g[m-1]=void 0);let F=!1;if(S){const Y=S.oldPos-m;F=S&&0<=Y&&Y<c}const Z=O&&O.oldPos+1<d;if(!F&&!Z){g[m]=void 0;continue}if(!Z||F&&O.oldPos<S.oldPos?T=this.addToPath(S,!0,!1,0,o):T=this.addToPath(O,!1,!0,1,o),v=this.extractCommon(T,n,t,m,o),T.oldPos+1>=d&&v+1>=c)return s(this.buildValues(T.lastComponent,n,t))||!0;g[m]=T,T.oldPos+1>=d&&(y=Math.min(y,m-1)),v+1>=c&&(b=Math.max(b,m+1))}u++};if(i)(function m(){setTimeout(function(){if(u>f||Date.now()>x)return i(void 0);w()||m()},0)})();else for(;u<=f&&Date.now()<=x;){const m=w();if(m)return m}}addToPath(t,n,o,i,a){const s=t.lastComponent;return s&&!a.oneChangePerToken&&s.added===n&&s.removed===o?{oldPos:t.oldPos+i,lastComponent:{count:s.count+1,added:n,removed:o,previousComponent:s.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:n,removed:o,previousComponent:s}}}extractCommon(t,n,o,i,a){const s=n.length,c=o.length;let d=t.oldPos,u=d-i,f=0;for(;u+1<s&&d+1<c&&this.equals(o[d+1],n[u+1],a);)u++,d++,f++,a.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return f&&!a.oneChangePerToken&&(t.lastComponent={count:f,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=d,u}equals(t,n,o){return o.comparator?o.comparator(t,n):t===n||!!o.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let o=0;o<t.length;o++)t[o]&&n.push(t[o]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,o){const i=[];let a;for(;t;)i.push(t),a=t.previousComponent,delete t.previousComponent,t=a;i.reverse();const s=i.length;let c=0,d=0,u=0;for(;c<s;c++){const f=i[c];if(f.removed)f.value=this.join(o.slice(u,u+f.count)),u+=f.count;else{if(!f.added&&this.useLongestToken){let p=n.slice(d,d+f.count);p=p.map(function(x,g){const v=o[u+g];return v.length>x.length?v:x}),f.value=this.join(p)}else f.value=this.join(n.slice(d,d+f.count));d+=f.count,f.added||(u+=f.count)}}return i}}class yn extends vn{constructor(){super(...arguments),this.tokenize=bn}equals(t,n,o){return o.ignoreWhitespace?((!o.newlineIsToken||!t.includes(`
|
|
97
|
+
`))&&(t=t.trim()),(!o.newlineIsToken||!n.includes(`
|
|
98
|
+
`))&&(n=n.trim())):o.ignoreNewlineAtEof&&!o.newlineIsToken&&(t.endsWith(`
|
|
99
99
|
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
100
|
-
`)&&(n=n.slice(0,-1))),super.equals(t,n,
|
|
101
|
-
`));const n=[],
|
|
102
|
-
`);return n.length>1&&n[n.length-1]===""&&n.pop(),n.map(
|
|
100
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,o)}}const wn=new yn;function jn(e,t,n){return wn.diff(e,t,n)}function bn(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
101
|
+
`));const n=[],o=e.split(/(\n|\r\n)/);o[o.length-1]||o.pop();for(let i=0;i<o.length;i++){const a=o[i];i%2&&!t.newlineIsToken?n[n.length-1]+=a:n.push(a)}return n}const Cn=500;function kn(e,t){const n=In(e,t);if(n.length===0)return[];const o=[];let i=0;for(;i<n.length;){let a=i;const s=n[i].type==="context";for(;a<n.length&&n[a].type==="context"===s;)a++;const c=n.slice(i,a);o.push({start:i,end:a,rows:c,hasAdditions:c.some(d=>d.type==="add"),hasRemovals:c.some(d=>d.type==="remove")}),i=a}return o}function In(e,t){if(e===void 0)return t===void 0?[]:D(t,"add");if(t===void 0)return D(e,"remove");if(e===t)return D(t,"context");const n=Tn(e,t);return n?n.flatMap(o=>D(o.value,o.added?"add":o.removed?"remove":"context")):[...D(e,"remove"),...D(t,"add")]}function Tn(e,t){try{return jn(e,t,{timeout:Cn})}catch{return}}function D(e,t){const n=e.split(`
|
|
102
|
+
`);return n.length>1&&n[n.length-1]===""&&n.pop(),n.map(o=>({type:t,text:o}))}const Ae=1,Oe=e=>e&&e.hasAdditions!==e.hasRemovals,Be=e=>e&&(e.hasAdditions||e.hasRemovals);function _n(e,t,n){if(e.hasAdditions||e.hasRemovals)return X(e.rows);const o=n[t-1],i=n[t+1],a=Oe(o)?Ae:0,s=Oe(i)?Ae:0;if(a+s>=e.rows.length)return X(e.rows);const c=e.rows.slice(0,a),d=s>0?e.rows.slice(-s):[],u=[];return u.push(...X(c)),Be(o)&&Be(i)&&u.push({kind:"separator"}),u.push(...X(d)),u}function X(e){return e.map(t=>({kind:"row",row:t}))}const Sn=200;function Ve({oldValue:e,newValue:t}){const n=h.useMemo(()=>kn(e,t),[e,t]),o=h.useMemo(()=>n.flatMap(_n),[n]);return h.useMemo(()=>n.some(i=>i.hasAdditions||i.hasRemovals),[n])?r.jsx(On,{$maxHeight:Sn,children:o.map((i,a)=>{if(i.kind==="separator")return r.jsx(Fn,{children:r.jsx(ze,{children:"\xB7\xB7\xB7"})},a);const{row:s}=i,c=An(s.type);return r.jsxs(c,{children:[r.jsxs(Mn,{children:[s.type==="remove"&&r.jsx(Jt,{size:"12px"}),s.type==="add"&&r.jsx(bt,{size:"12px"})]}),r.jsx(ze,{children:s.text===""?" ":s.text})]},a)})}):null}function An(e){return e==="remove"?Bn:e==="add"?Vn:zn}const On=l.div`
|
|
103
103
|
display: flex;
|
|
104
104
|
flex-direction: column;
|
|
105
105
|
width: 100%;
|
|
@@ -125,14 +125,14 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
125
125
|
`,zn=l(ee)`
|
|
126
126
|
background: transparent;
|
|
127
127
|
color: var(--text-color-secondary);
|
|
128
|
-
`,
|
|
128
|
+
`,Mn=l.span`
|
|
129
129
|
display: flex;
|
|
130
130
|
align-items: center;
|
|
131
131
|
justify-content: center;
|
|
132
132
|
min-width: 16px;
|
|
133
133
|
height: 20px;
|
|
134
134
|
flex-shrink: 0;
|
|
135
|
-
`,
|
|
135
|
+
`,ze=l.span`
|
|
136
136
|
width: 100%;
|
|
137
137
|
min-width: 0;
|
|
138
138
|
line-height: var(--line-height-sm);
|
|
@@ -140,9 +140,9 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
140
140
|
font-weight: var(--font-weight-regular);
|
|
141
141
|
white-space: pre-wrap;
|
|
142
142
|
word-break: break-all;
|
|
143
|
-
`,
|
|
143
|
+
`,Fn=l(ee)`
|
|
144
144
|
user-select: none;
|
|
145
|
-
`,$n=e=>typeof e!="object"||e===null?!1:"kind"in e&&e.kind==="batch"?"changes"in e?Array.isArray(e.changes)&&e.changes.every(
|
|
145
|
+
`,$n=e=>typeof e!="object"||e===null?!1:"kind"in e&&e.kind==="batch"?"changes"in e?Array.isArray(e.changes)&&e.changes.every(Me):!1:Me(e);function Me(e){return typeof e!="object"||e===null||!("id"in e)||!("target"in e)||!("included"in e)||!("kind"in e)?!1:e.kind==="single"}const Rn={approveLabel:"Approve",denyLabel:"Deny"};function En(e,t){const n=j(t,"action");if(n){const i=Nt[n];if(i)return i}return Dt[e]||Rn}function j(e,t){if(!e||typeof e!="object")return null;const n=e.payload;if(!n||typeof n!="object")return null;const o=n[t];return typeof o!="string"?null:o.trim()||null}function te(e,t){if(!(typeof t>"u"))return e?`${e}: ${t}`:t}function Ln(e){return e?"changes"in e?Array.isArray(e.changes)?e.changes.map(t=>!t||typeof t!="object"||!("approved"in t)?!1:t.approved===!0):[]:[]:[]}function Nn(e,t){if(!e||typeof e!="object")return;const n=ne(e,se),o=ne(n,le);if(!(t in o))return;const i=o[t];if(Array.isArray(i)&&i.length!==0&&i.every($n))return i}function Fe(e,t){return Pt(e)&&Te(e)&&e.toolCallId===t}function Dn(e,t,n){const o=e.parts.map(c=>Fe(c,t)?{...c,input:Pn(c.input,n)}:c),i=e.metadata&&typeof e.metadata=="object"?e.metadata:{},a=ne(i,se),s={...ne(a,le),[t]:Ct(n)};return{...e,parts:o,metadata:{...i,[se]:{...a,[le]:s}}}}function ne(e,t){const n=e[t];return typeof n=="object"&&n!==null?n:{}}function Pn(e,t){if(!e||!("changes"in e)||!Array.isArray(e.changes))return e;const{changes:n,...o}=e;return{...o,changes:n.map((i,a)=>({...i,approved:t[a]?.included??!1}))}}function Un({preview:e,isIncluded:t,onToggle:n,readOnly:o}){const{primaryLabel:i,categoryLabel:a,diffLineKey:s}=Hn(e.target);return r.jsx(Gn,{isIncluded:t,onToggle:n,readOnly:o,primaryLabel:i,categoryLabel:a,children:e.kind==="batch"?r.jsx(nr,{children:e.changes.map(c=>r.jsx(Ve,{oldValue:te(c.target.key,c.oldValue),newValue:te(c.target.key,c.newValue)},c.id))}):r.jsx(Ve,{oldValue:te(s,e.oldValue),newValue:te(s,e.newValue)})})}function Hn(e){const t=e.schemeId??e.type;return e.stepId||e.schemeId?{primaryLabel:e.stepId??t,categoryLabel:e.stepId?t:void 0,diffLineKey:e.key}:{primaryLabel:e.key??e.type,categoryLabel:e.key?e.type:void 0,diffLineKey:void 0}}function Gn({isIncluded:e,onToggle:t,readOnly:n,primaryLabel:o,categoryLabel:i,children:a}){return r.jsxs(Kn,{$dimmed:n&&!e,children:[r.jsxs(Wn,{children:[n?r.jsx(Xn,{children:e?r.jsx(er,{size:"16px"}):r.jsx(tr,{size:"16px"})}):r.jsxs(Jn,{children:[r.jsx(qn,{checked:e}),r.jsx(Qn,{type:"checkbox",checked:e,onChange:t})]}),r.jsx(Zn,{children:o}),i?r.jsx(Yn,{children:i}):null]}),a]})}const Kn=l.div`
|
|
146
146
|
display: flex;
|
|
147
147
|
flex-direction: column;
|
|
148
148
|
gap: var(--spacing-xs);
|
|
@@ -210,10 +210,10 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
210
210
|
flex-direction: column;
|
|
211
211
|
gap: var(--spacing-xxs);
|
|
212
212
|
min-width: 0;
|
|
213
|
-
`;function
|
|
213
|
+
`;function $e({previews:e,handleToggle:t,readOnly:n}){return e.length===0?null:r.jsx(rr,{children:e.map((o,i)=>r.jsx(Un,{preview:o,isIncluded:o.included,onToggle:t?()=>t(i):void 0,readOnly:n},o.id))})}const rr=l.div`
|
|
214
214
|
display: flex;
|
|
215
215
|
flex-direction: column;
|
|
216
|
-
`,
|
|
216
|
+
`,or={update_step:sr,update_security:lr,run_request:pr,web_search:fr,manage_environment:dr,manage_collection:ur};function ir(e,t){const n=or[e];return n?n(t):ar(e)}function ar(e){return[{kind:"text",text:e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}]}function sr(e){return Re(e,"Update step")}function lr(e){const t=cr(e);if(t.size>1)return I("Update security");const[n]=t;return Re(e,"Update security",n)}function cr(e){const t=e&&"changes"in e?e.changes:void 0;if(!Array.isArray(t))return new Set;const n=G(e,"stepId"),o=t.map(i=>G(i,"stepId")??n);return new Set(o.filter(i=>!!i))}function Re(e,t,n){const{collectionId:o,workflowId:i,stepId:a}=hr(e),s=n??a;return!o||!i||!s?I(t):he(`${t} `,fe({collectionId:o,workflowId:i,stepId:s}),s)}function I(e){return[{kind:"text",text:e}]}function A(e,t){return t?`${e} "${t}"`:e}function he(e,t,n){return[{kind:"text",text:e},{kind:"link",href:t,label:n}]}function dr(e){const t=j(e,"action"),n=j(e,"environment"),o=n?` in environment "${n}"`:"";switch(t){case"add_environment":return I(A("Add environment",n));case"set_active_environment":return I(n?`Switch active environment to ${n}`:"Switch active environment");case"upsert_input":return I(A("Set input",j(e,"name"))+o);case"remove_input":return I(A("Remove input",j(e,"inputName"))+o);case"upsert_server":return I(A("Set server",j(e,"apiId"))+o);case"remove_server":return I(A("Remove server",j(e,"apiId"))+o);default:return I("Manage environment")}}function ur(e){switch(j(e,"action")){case"create_collection":return I(A("Create collection",j(e,"title")));case"delete_collection":return I(A("Delete collection",j(e,"collectionId")));case"create_workflow":return I(A("Create workflow",j(e,"name")));case"delete_workflow":return I(A("Delete workflow",j(e,"workflowId")));case"create_step":return I(A("Create step",j(e,"stepName")));case"delete_step":{const t=j(e,"collectionId"),n=j(e,"workflowId"),o=j(e,"stepId");return!t||!n||!o?I("Delete step"):he("Delete step ",fe({collectionId:t,workflowId:n,stepId:o}),o)}case"move_step":{const t=j(e,"collectionId"),n=j(e,"workflowId"),o=j(e,"stepId");return!t||!n||!o?I("Move step"):he("Move step ",fe({collectionId:t,workflowId:n,stepId:o}),o)}case"save_tab_to_collection":return I(A("Save tab as step",j(e,"newStepName")));default:return I("Manage collection")}}function pr(){return[{kind:"text",text:"Run current request"}]}function fr(e){return[{kind:"text",text:"Search the web at "},{kind:"link",href:e.url,label:e.url}]}function hr(e){return{collectionId:G(e,"collectionId"),workflowId:G(e,"workflowId"),stepId:G(e,"stepId")}}function G(e,t){if(typeof e!="object"||e===null||!(t in e))return null;const n=e[t];return typeof n=="string"&&n.trim()||null}function Ee({toolName:e,input:t}){const n=ir(e,t),o=Se();return r.jsx(xr,{onClick:o,children:r.jsx(gr,{children:n.map((i,a)=>i.kind==="text"?r.jsx("span",{children:i.text},a):r.jsx(mr,{href:i.href,children:i.label},a))})})}const xr=l.div`
|
|
217
217
|
display: flex;
|
|
218
218
|
flex-direction: column;
|
|
219
219
|
gap: 0;
|
|
@@ -237,7 +237,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
237
237
|
&:hover {
|
|
238
238
|
color: var(--link-color-primary, var(--text-color-link));
|
|
239
239
|
}
|
|
240
|
-
`;function Le(e,t,n){const
|
|
240
|
+
`;function Le(e,t,n){const o={type:e};return t!==void 0&&(o.key=t),n&&(o.stepId=n),o}function C({id:e,targetType:t,targetKey:n,targetStepId:o,oldValue:i,newValue:a}){return{kind:"single",id:e,target:Le(t,n,o),oldValue:i,newValue:a,included:!0}}function R(e,t,n){return C({id:e,targetType:t,targetStepId:n,oldValue:void 0,newValue:void 0})}function P({data:e,baseId:t,targetType:n,batchTargetKey:o,targetStepId:i,getOldValue:a,getNewValue:s=(d,u)=>String(u??""),resolveTargetKey:c=d=>d}){const d=Object.entries(e).filter(([,p])=>p!==void 0);if(d.length===0)return R(t,n,i);if(d.length>=2){const p=d.map(([x,g])=>C({id:`${t}:${x}`,targetType:n,targetKey:c(x),oldValue:a(x),newValue:s(x,g)}));return{kind:"batch",id:t,target:Le(n,o,i),changes:p,included:!0}}const[u,f]=d[0];return C({id:t,targetType:n,targetKey:c(u),targetStepId:i,oldValue:a(u),newValue:s(u,f)})}function vr({store:e,input:t}){if(!yr(t))return[];const n=new Map,o=i=>{const a=n.get(i);if(a)return a;const s=_e(e,t.collectionId,t.workflowId,i),c=s.ok?s.value:null,d=c?Array.from(c.security.get({noproxy:!0})):[];return n.set(i,d),d};return t.changes.map((i,a)=>{const s=i.stepId?.trim(),c=s||t.stepId;return wr(o(c),i,a,s)})}function yr(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.collectionId=="string"&&typeof t.workflowId=="string"&&typeof t.stepId=="string"&&Array.isArray(t.changes)&&t.changes.length>0}function wr(e,t,n,o){const i=`security[${n}]`;switch(t.action){case k.ADD:{const{type:a,schemeId:s,data:c}=t;return!c||Object.keys(c).length===0?K(C({id:i,targetType:a,targetStepId:o,oldValue:void 0,newValue:a}),s):K(P({data:c,baseId:i,targetType:a,targetStepId:o,getOldValue:()=>{}}),s)}case k.UPDATE:{const{type:a,data:s}=t,c=t.index!==void 0?e[t.index]:void 0,d=t.schemeId||xe(c);return!s||Object.keys(s).length===0?K(C({id:i,targetType:a,targetStepId:o,oldValue:De(c),newValue:a}),d):K(P({data:s,baseId:i,targetType:a,targetStepId:o,getOldValue:u=>c?jr(c,u):void 0}),d)}case k.REMOVE:{const a=Ut(e,t),s=a.ok?a.entry:void 0;return K(C({id:i,targetType:s?.securityType??"Security",targetStepId:o,oldValue:De(s),newValue:void 0}),xe(s))}}}function K(e,t){return t?{...e,target:{...e.target,schemeId:t}}:e}function jr(e,t){switch(e.securityType){case $.NoAuth:return;case $.OAuth2:return Ne(e[$.OAuth2],t);case $.OpenIDConnect:{const n=e[$.OpenIDConnect];return t==="openIdConnectUrl"?n.openIdConnectUrl||void 0:t==="userInfoUrl"?n.userInfoUrl||void 0:Ne(n,t)}case $.APIKey:{const n=e[$.APIKey];return t==="location"?re(n,t)?.toLowerCase():re(n,t)}default:{const n=e[e.securityType];return re(n,t)}}}function Ne(e,t){if(t==="grantType")return e.grantType||void 0;if(!e.grantType)return;const n=e[e.grantType];return re(n,t)}function re(e,t){const n=e[t];return n!==void 0&&n!==""?String(n):void 0}function De(e){if(!e||e.securityType===$.NoAuth)return;const t=xe(e);return t?`${e.securityType} (${t})`:e.securityType}function xe(e){return!e||e.securityType===$.NoAuth?void 0:e[e.securityType]?.schemeName||void 0}function br({store:e,input:t}){if(!Cr(t))return[];const n=_e(e,t.collectionId,t.workflowId,t.stepId),o=n.ok?n.value:null;return t.changes.map((i,a)=>kr(o,i,a))}function Cr(e){return typeof e!="object"||e===null?!1:"collectionId"in e&&"workflowId"in e&&"stepId"in e&&"changes"in e&&Array.isArray(e.changes)&&e.changes.length>0&&typeof e.collectionId=="string"&&typeof e.workflowId=="string"&&typeof e.stepId=="string"}function kr(e,t,n){const o=t.id??`${t.field}[${n}]`;switch(t.field){case"method":case"url":case"description":return Ir(e,t,o);case"parameters":return Tr(e,t,o);case"outputs":return _r(e,t,o);case"body":return Sr(e,t,o);case"successCriteria":return Ar(e,t,o)}}function Ir(e,t,n){const o=Q(t.field);switch(t.action){case k.ADD:return C({id:n,targetType:o,oldValue:void 0,newValue:t.data});case k.UPDATE:return C({id:n,targetType:o,oldValue:Pe(e,t.field),newValue:t.data});case k.REMOVE:return C({id:n,targetType:o,oldValue:Pe(e,t.field),newValue:void 0})}}function Tr(e,t,n){switch(t.action){case k.ADD:{if(!t.data)return R(n,"parameter");const{in:o,name:i,value:a}=t.data;return C({id:n,targetType:Q(o),targetKey:i,oldValue:void 0,newValue:a})}case k.UPDATE:{if(!t.id&&!t.data?.name)return R(n,"parameter");const o=Ue(e,t),i=t.data?.in??o?.in??"parameter";return C({id:n,targetType:Q(i),targetKey:t.data?.name??o?.key,oldValue:o?o.value??"":void 0,newValue:t.data?.value})}case k.REMOVE:{if(!t.id&&!t.data?.name)return R(n,"parameter");const o=Ue(e,t),i=t.data?.in??o?.in??"parameter";return C({id:n,targetType:Q(i),targetKey:o?.key??t.data?.name,oldValue:o?o.value??"":void 0,newValue:void 0})}}}function _r(e,t,n){switch(t.action){case k.ADD:return t.data?C({id:n,targetType:"Output",targetKey:t.data.name,oldValue:void 0,newValue:t.data.expression}):C({id:n,targetType:"Output",oldValue:void 0,newValue:void 0});case k.UPDATE:{if(!t.data)return C({id:n,targetType:"Output",oldValue:void 0,newValue:void 0});const o=t.id&&e?We(e,t.id):void 0;return C({id:n,targetType:"Output",targetKey:t.data.name,oldValue:o?.value,newValue:t.data.expression})}case k.REMOVE:{if(!t.id&&!t.data?.name)return R(n,"Output");let o=t.id&&e?We(e,t.id):void 0;return!o&&e&&t.data?.name&&(o=Vr(e,t.data.name)),C({id:n,targetType:"Output",targetKey:o?.key??t.data?.name,oldValue:o?.value,newValue:void 0})}}}function Sr(e,t,n){const{data:o}=t;switch(t.action){case k.ADD:return P({data:o,baseId:n,targetType:"Body",getOldValue:()=>{},getNewValue:i=>i==="content"?ge(o.content,o.contentType):ie(o[i]),resolveTargetKey:i=>i==="content"?void 0:i});case k.UPDATE:{const i=e?.requestBody.type.get(),a=o.contentType??i;return P({data:o,baseId:n,targetType:"Body",getOldValue:s=>{if(e){if(s==="content")return ge(e.requestBody.content.get(),i)||void 0;if(s==="contentType")return i}},getNewValue:s=>s==="content"?ge(o.content,a):ie(o[s]),resolveTargetKey:s=>s==="content"?void 0:s})}case k.REMOVE:{const i=e?ce({contentType:e.requestBody.type.get(),content:e.requestBody.content.get()}):void 0;return C({id:n,targetType:"Body",oldValue:i,newValue:void 0})}}}function Ar(e,t,n){switch(t.action){case k.ADD:return t.data?P({data:t.data,baseId:n,targetType:"successCriteria",getOldValue:()=>{},getNewValue:o=>ie(t.data[o])}):R(n,"successCriteria");case k.UPDATE:{if(!t.data)return R(n,"successCriteria");const o=typeof t.id=="string"&&e?Ge(e,t.id):void 0;return P({data:t.data,baseId:n,targetType:"successCriteria",getOldValue:i=>{if(o){if(i==="condition")return o.condition;if(i==="context")return o.context??void 0;if(i==="type")return o.type}},getNewValue:i=>ie(t.data[i])})}case k.REMOVE:{if(typeof t.id!="string")return R(n,"successCriteria");const o=e?Ge(e,t.id):void 0;return C({id:n,targetType:"successCriteria",targetKey:o?.condition,oldValue:o?ce(o):void 0,newValue:void 0})}}}function Pe(e,t){if(e)switch(t){case"method":return e.xOperation.ornull?.method.get();case"url":return e.xOperation.ornull?.url.get();case"description":return e.description.get()}}function Ue(e,t){let n=t.id&&e?Or(e,t.id):null;return!n&&e&&t.data?.name&&(n=Br(e,t.data.name)),n}function He(e,t){for(const n of["path","query","header","cookie"]){const o=e.parameters[Ht[n]].get().find(i=>Tt(i)&&t(i));if(o)return o}return null}function Or(e,t){return He(e,n=>n.id===t)}function Br(e,t){return He(e,n=>n.key===t)}function Ge(e,t){return e.successCriteria.get().find(n=>n.condition===t)}function Ke(e,t){for(const n of e.outputs.get())if(t(n))return{key:oe(n.key),value:oe(n.value)}}function We(e,t){return Ke(e,n=>oe(n.id)===t)}function Vr(e,t){return Ke(e,n=>oe(n.key)===t)}function oe(e){return typeof e=="string"?e:e.get()}function ie(e){return e==null?"":typeof e=="string"?e:ce(e)}function ge(e,t){if(!e||t!==_t.JSON)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}const zr={update_security:vr,update_step:br};function Ze(e,t){const n=je(),o=h.useMemo(()=>{const d=e?zr[e]:void 0;if(!d)return[];try{return d({store:n,input:t})}catch(u){return console.error("Unable to build change previews",u),[]}},[e,n,t]),[i,a]=h.useState(()=>Object.fromEntries(o.map(d=>[d.id,d.included]))),s=h.useMemo(()=>o.map(d=>({...d,included:i[d.id]??d.included})),[o,i]),c=h.useCallback(d=>{a(typeof d=="function"?u=>{const f=o.map(p=>({...p,included:u[p.id]??p.included}));return Object.fromEntries(d(f).map(p=>[p.id,p.included]))}:Object.fromEntries(d.map(u=>[u.id,u.included])))},[o]);return{previews:s,setPreviews:c}}function Mr({toolCallId:e,toolName:t,input:n,onApprove:o,onDeny:i}){const{updateMessages:a}=H(),{previews:s,setPreviews:c}=Ze(t,n),{includedCount:d,totalCount:u}=h.useMemo(()=>({includedCount:s.filter(v=>v.included).length,totalCount:s.length}),[s]),{approveLabel:f,denyLabel:p}=h.useMemo(()=>En(t,n),[t,n]),x=h.useCallback(()=>{a(v=>{const b=[];for(let y=0;y<v.length;y++){const w=v[y],{parts:m}=w,T=w.role==="assistant",O=m.some(S=>Fe(S,e));if(T&&O){const S=Dn(w,e,s);b.push({index:y,message:S})}}return b}),o()},[s,o,a,e]),g=h.useCallback(v=>{c(b=>b.map((y,w)=>w===v?{...y,included:!y.included}:y))},[c]);return r.jsxs(Fr,{children:[r.jsx(Ee,{toolName:t,input:n}),s.length?r.jsx($r,{children:r.jsx($e,{previews:s,handleToggle:g})}):null,s.length?r.jsx(be,{}):null,r.jsxs(Rr,{children:[u>1?r.jsxs(Er,{children:[d," of ",u," selected"]}):null,r.jsx(Lr,{size:"small",variant:"secondary",onClick:i,children:p}),r.jsx(Nr,{size:"small",variant:"primary",onClick:x,disabled:u>0?d===0:!1,children:f})]})]})}const Fr=l.div`
|
|
241
241
|
display: flex;
|
|
242
242
|
color: var(--text-color-primary);
|
|
243
243
|
flex-direction: column;
|
|
@@ -275,7 +275,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
275
275
|
&:disabled {
|
|
276
276
|
border: 1px solid var(--button-border-color-disabled);
|
|
277
277
|
}
|
|
278
|
-
`;function Dr({approvalId:e,toolCallId:t,toolName:n,input:
|
|
278
|
+
`;function Dr({approvalId:e,toolCallId:t,toolName:n,input:o}){const{addToolApprovalResponse:i}=H(),a=h.useCallback(()=>{i({id:e,approved:!0})},[e,i]),s=h.useCallback(()=>{i({id:e,approved:!1})},[e,i]);return r.jsx(Mr,{onApprove:a,onDeny:s,toolCallId:t,toolName:n,input:o})}function Pr({toolName:e,toolCallId:t,input:n,isDenied:o,messageMetadata:i,onUndo:a}){const s=h.useMemo(()=>Nn(i,t),[i,t]),{previews:c}=Ze(s?void 0:e,n),d=h.useMemo(()=>{const p=s??c;if(o)return p.map(g=>({...g,included:!1}));const x=Ln(n);return p.map((g,v)=>({...g,included:x[v]??g.included}))},[s,c,n,o]);if(d.length===0)return null;const u=d.filter(p=>p.included).length,f=u===0?"Nothing applied":`${u} ${u===1?"change":"changes"} applied`;return r.jsxs(Ur,{children:[r.jsx(Ee,{toolName:e,input:n}),r.jsx(Hr,{children:r.jsx($e,{previews:d,readOnly:!0})}),r.jsx(be,{}),r.jsxs(Gr,{children:[r.jsx(Kr,{children:f}),a?r.jsx(Wr,{size:"small",variant:"outlined",onClick:a,children:"Undo"}):null]})]})}const Ur=l.div`
|
|
279
279
|
display: flex;
|
|
280
280
|
color: var(--text-color-primary);
|
|
281
281
|
flex-direction: column;
|
|
@@ -303,7 +303,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
303
303
|
`,Wr=l(_)`
|
|
304
304
|
padding-top: 0;
|
|
305
305
|
padding-bottom: 0;
|
|
306
|
-
`;function Zr({items:e,isLast:t}){const[n,
|
|
306
|
+
`;function Zr({items:e,isLast:t}){const[n,o]=h.useState(t),i=h.useCallback(()=>{o(s=>!s)},[]),a=h.useMemo(()=>e.filter(s=>s.kind==="action"),[e]);return r.jsxs(qr,{children:[r.jsxs(Jr,{type:"button",onClick:i,"aria-expanded":n,children:[r.jsx(Qr,{children:n?r.jsx(dt,{size:"12px",color:"var(--icon-color-additional)"}):r.jsx(ut,{size:"12px",color:"var(--icon-color-additional)"})}),r.jsxs(Xr,{children:[a.length," ",a.length===1?"action":"actions"]})]}),n&&r.jsx(eo,{children:a.map((s,c)=>r.jsx(Yr,{text:s.text},c))})]})}function Yr({text:e}){return r.jsxs(to,{children:[r.jsxs(no,{children:[r.jsx(ro,{"aria-hidden":!0}),r.jsx(oo,{children:r.jsx(io,{"aria-hidden":!0})}),r.jsx(Ye,{"aria-hidden":!0})]}),r.jsx(ao,{children:e})]})}const qr=l.div`
|
|
307
307
|
display: flex;
|
|
308
308
|
flex-direction: column;
|
|
309
309
|
width: 100%;
|
|
@@ -324,7 +324,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
324
324
|
font-weight: var(--font-weight-regular);
|
|
325
325
|
line-height: var(--line-height-sm);
|
|
326
326
|
color: var(--text-color-description);
|
|
327
|
-
`,
|
|
327
|
+
`,eo=l.div`
|
|
328
328
|
display: flex;
|
|
329
329
|
flex-direction: column;
|
|
330
330
|
gap: 0;
|
|
@@ -336,7 +336,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
336
336
|
background: var(--border-color-secondary);
|
|
337
337
|
flex: 1 1 auto;
|
|
338
338
|
min-height: 8px;
|
|
339
|
-
`,
|
|
339
|
+
`,to=l.div`
|
|
340
340
|
display: flex;
|
|
341
341
|
flex-direction: row;
|
|
342
342
|
align-items: stretch;
|
|
@@ -348,7 +348,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
348
348
|
display: none;
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
`,
|
|
351
|
+
`,no=l.div`
|
|
352
352
|
display: flex;
|
|
353
353
|
flex-direction: column;
|
|
354
354
|
align-items: center;
|
|
@@ -357,14 +357,14 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
357
357
|
flex: 0 0 auto;
|
|
358
358
|
align-self: stretch;
|
|
359
359
|
min-height: 0;
|
|
360
|
-
`,
|
|
360
|
+
`,ro=l.span`
|
|
361
361
|
display: block;
|
|
362
362
|
width: 1px;
|
|
363
363
|
height: 4px;
|
|
364
364
|
flex: 0 0 auto;
|
|
365
365
|
flex-shrink: 0;
|
|
366
366
|
background: var(--border-color-secondary);
|
|
367
|
-
`,
|
|
367
|
+
`,oo=l.div`
|
|
368
368
|
width: 12px;
|
|
369
369
|
height: 12px;
|
|
370
370
|
flex: 0 0 auto;
|
|
@@ -372,7 +372,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
372
372
|
display: flex;
|
|
373
373
|
align-items: center;
|
|
374
374
|
justify-content: center;
|
|
375
|
-
`,
|
|
375
|
+
`,io=l.span`
|
|
376
376
|
width: 4px;
|
|
377
377
|
height: 4px;
|
|
378
378
|
flex-shrink: 0;
|
|
@@ -380,7 +380,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
380
380
|
box-sizing: border-box;
|
|
381
381
|
border: 1px solid var(--border-color-secondary);
|
|
382
382
|
background: transparent;
|
|
383
|
-
`,
|
|
383
|
+
`,ao=l.span`
|
|
384
384
|
flex: 1;
|
|
385
385
|
min-width: 0;
|
|
386
386
|
align-self: flex-start;
|
|
@@ -388,11 +388,11 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
388
388
|
font-weight: var(--font-weight-regular);
|
|
389
389
|
line-height: var(--line-height-sm);
|
|
390
390
|
color: var(--text-color-helper);
|
|
391
|
-
`;function
|
|
391
|
+
`;function so({items:e,messageMetadata:t}){return r.jsx(co,{children:e.map((n,o)=>{if(n.kind==="reasoning-block"){const s=o===e.length-1;return r.jsx(Zr,{items:n.items,isLast:s},n.key)}if(n.kind==="text")return r.jsx(lo,{rawMarkdown:n.text,workflowRunHistoryIds:n.workflowRunHistoryIds},n.key);const{part:i}=n,a=Gt(i.type);return a&&Te(i)?r.jsx(Dr,{approvalId:i.approval.id,toolCallId:i.toolCallId,toolName:a,input:i.input},n.key):a&&Kt(i)?r.jsx(Pr,{toolName:a,toolCallId:i.toolCallId,input:i.input,isDenied:i.state==="output-denied",messageMetadata:t},n.key):null})})}function lo({rawMarkdown:e,workflowRunHistoryIds:t}){const n=Se({workflowRunHistoryIds:t});return r.jsx(uo,{onClick:n,children:r.jsx(St,{rawMarkdown:e,parser:At})})}const co=l.div`
|
|
392
392
|
display: flex;
|
|
393
393
|
flex-direction: column;
|
|
394
394
|
gap: var(--spacing-xs);
|
|
395
|
-
`,
|
|
395
|
+
`,uo=l.div`
|
|
396
396
|
white-space: normal;
|
|
397
397
|
|
|
398
398
|
max-width: 100%;
|
|
@@ -441,22 +441,22 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
441
441
|
transform: scale(1);
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
`;function
|
|
444
|
+
`;function po(){return r.jsxs(fo,{children:[r.jsx(W,{}),r.jsx(W,{}),r.jsx(W,{})]})}const fo=l.div`
|
|
445
445
|
display: flex;
|
|
446
446
|
align-items: center;
|
|
447
447
|
justify-content: space-between;
|
|
448
448
|
width: 24px;
|
|
449
449
|
height: 24px;
|
|
450
|
-
`;function
|
|
450
|
+
`;function ho(){return r.jsxs(xo,{children:[r.jsx(po,{}),r.jsx(go,{children:"Thinking"})]})}const xo=l.div`
|
|
451
451
|
display: flex;
|
|
452
452
|
align-items: center;
|
|
453
453
|
gap: var(--spacing-xxs);
|
|
454
|
-
`,
|
|
454
|
+
`,go=l.span`
|
|
455
455
|
font-family: var(--font-family-base);
|
|
456
456
|
font-size: var(--font-size-sm);
|
|
457
457
|
line-height: var(--line-height-sm);
|
|
458
458
|
color: var(--text-color-helper);
|
|
459
|
-
`;function
|
|
459
|
+
`;function mo({items:e}){return r.jsx(h.Fragment,{children:e.map(t=>t.kind!=="text"?null:r.jsx(qe,{children:t.text},t.key))})}const vo="Something went wrong. Please try again.";function yo(e){return e?.message?.trim()||vo}function wo({message:e,isLastMessage:t}){const{chatStatus:n,chatError:o}=H(),{role:i,parts:a}=e,s=i===V.ASSISTANT,c=h.useMemo(()=>Wt(a),[a]),d=c.length>0,u=n==="error"&&t&&s&&!d;return!d&&!u?null:r.jsx(Je,{$role:i,children:r.jsx(bo,{isFailedEmptyAssistant:u,chatError:o,isAssistant:s,contentItems:c,messageMetadata:e.metadata})})}function jo(){return r.jsx(Je,{$role:V.ASSISTANT,children:r.jsx(me,{children:r.jsx(ho,{})})})}function bo({isFailedEmptyAssistant:e,chatError:t,isAssistant:n,contentItems:o,messageMetadata:i}){return e?r.jsx(me,{children:r.jsx(qe,{children:yo(t)})}):r.jsx(me,{children:n?r.jsx(so,{items:o,messageMetadata:i}):r.jsx(mo,{items:o})})}const Je=l.div`
|
|
460
460
|
display: flex;
|
|
461
461
|
flex-direction: column;
|
|
462
462
|
padding: var(--spacing-xs) var(--spacing-sm);
|
|
@@ -471,13 +471,13 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
471
471
|
word-wrap: break-word;
|
|
472
472
|
white-space: pre-wrap;
|
|
473
473
|
max-width: 100%;
|
|
474
|
-
`,
|
|
474
|
+
`,me=l.div`
|
|
475
475
|
display: flex;
|
|
476
476
|
flex-direction: column;
|
|
477
477
|
gap: var(--spacing-xxs);
|
|
478
478
|
min-width: 0;
|
|
479
479
|
width: 100%;
|
|
480
|
-
`;function
|
|
480
|
+
`;function Co(){const{messages:e,isStreaming:t}=H(),n=e.at(-1),o=h.useMemo(()=>{const i=n?.role===V.ASSISTANT,a=n?.parts.at(-1)?.type==="text";return t&&!(i&&a)},[t,n?.parts,n?.role]);return r.jsxs(ko,{children:[e.map((i,a)=>r.jsx(Qe,{$role:i.role,children:r.jsx(Xe,{$role:i.role,children:r.jsx(wo,{message:i,isLastMessage:a===e.length-1})})},i.id)),o&&r.jsx(Qe,{$role:V.ASSISTANT,children:r.jsx(Xe,{$role:V.ASSISTANT,children:r.jsx(jo,{})})})]})}const ko=l.div`
|
|
481
481
|
display: flex;
|
|
482
482
|
flex-direction: column;
|
|
483
483
|
gap: var(--spacing-xs);
|
|
@@ -494,17 +494,17 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
494
494
|
min-width: 0;
|
|
495
495
|
width: 100%;
|
|
496
496
|
max-width: 100%;
|
|
497
|
-
`;function
|
|
497
|
+
`;function Io(e){const t=h.useRef(void 0);return h.useEffect(()=>{t.current=e}),t.current}const et=l.div`
|
|
498
498
|
display: flex;
|
|
499
499
|
flex-direction: column;
|
|
500
500
|
flex: 1;
|
|
501
501
|
width: 100%;
|
|
502
502
|
overflow: auto;
|
|
503
503
|
padding: var(--spacing-xs);
|
|
504
|
-
`,
|
|
504
|
+
`,To=e=>r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",...e,children:[r.jsx("path",{d:"M12.1683 8.65224C13.4439 7.91782 13.4439 6.08176 12.1683 5.34733L8.48891 3.22903L5.13033 6.57817C5.03961 6.66863 5.03961 6.8153 5.13033 6.90577L8.81674 10.5818L12.1683 8.65224Z",fill:"url(#replay-icon-gradient)"}),r.jsx("path",{d:"M7.56707 11.3013L3.81522 13.4613C2.53957 14.1957 0.945007 13.2777 0.945007 11.8088L0.945008 2.19072C0.945008 0.721872 2.53957 -0.196157 3.81522 0.538267L7.23924 2.50957L4.14475 5.59536C3.5097 6.22861 3.5097 7.25532 4.14475 7.88858L7.56707 11.3013Z",fill:"url(#replay-icon-gradient)"}),r.jsx("defs",{children:r.jsxs("linearGradient",{id:"replay-icon-gradient",x1:"12.0947",y1:"10.9627",x2:"1.65018",y2:"0.120816",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#C361FF"}),r.jsx("stop",{offset:"0.411322",stopColor:"#9461FF"}),r.jsx("stop",{offset:"0.73777",stopColor:"#207DFF"}),r.jsx("stop",{offset:"1",stopColor:"#1DA8F6"})]})})]}),_o=l(To)`
|
|
505
505
|
height: ${({size:e})=>e||"14px"};
|
|
506
506
|
width: ${({size:e})=>e||"14px"};
|
|
507
|
-
`;function
|
|
507
|
+
`;function So(e){const t="var(--font-size-base)";switch(e){case de:return r.jsx(_o,{size:t});case ue.OPENAI:return r.jsx(gt,{size:t,color:"var(--text-color-primary)"});case ue.GEMINI:return r.jsx(rn,{size:t});case ue.ANTHROPIC:return r.jsx(xt,{size:t,color:"var(--replay-claude-icon-color)"})}}function Ao({models:e,selectedModelId:t,placement:n,onModelSelect:o,onSettingsOpen:i}){const a=e.find(p=>p.id===t),s=a?.label??"Replay AI",c=a?.id,d=e.filter(p=>p.provider===de),u=e.filter(p=>p.provider!==de),f=d.length>0&&u.length>0;return r.jsx(zo,{children:r.jsx(Mo,{trigger:r.jsx(Oo,{label:s}),placement:n,alignment:"start",withArrow:!0,children:r.jsxs(Fo,{children:[r.jsxs(Eo,{children:[d.map(p=>r.jsx(tt,{model:p,activeModelId:c,onModelSelect:o},p.id)),f&&r.jsx(nt,{"aria-hidden":!0}),u.length>0&&r.jsx(r.Fragment,{children:u.map(p=>r.jsx(tt,{model:p,activeModelId:c,onModelSelect:o},p.id))})]}),i&&e.length>0&&r.jsx(nt,{"aria-hidden":!0}),i&&r.jsx(Lo,{prefix:r.jsx(Ot,{size:"var(--font-size-base)",color:"var(--text-color-secondary)"}),content:"Manage models",onAction:()=>i("ai-providers")})]})})})}function Oo({label:e,icon:t,onClick:n,onKeyDown:o}){return r.jsxs(Bo,{onClick:n,onKeyDown:o,children:[r.jsx(Vo,{children:e}),t]})}function tt({model:e,activeModelId:t,onModelSelect:n}){const o=e.id===t;return r.jsx(ye,{prefix:So(e.provider),suffix:o?r.jsx(Ro,{size:"var(--font-size-base)",color:"var(--text-color-primary)"}):void 0,onAction:()=>n(e.id),active:o,children:r.jsx($o,{children:e.label})})}const Bo=l.div`
|
|
508
508
|
display: flex;
|
|
509
509
|
align-items: center;
|
|
510
510
|
min-width: 0;
|
|
@@ -519,7 +519,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
519
519
|
&:hover {
|
|
520
520
|
background: var(--layer-color-active);
|
|
521
521
|
}
|
|
522
|
-
`,
|
|
522
|
+
`,Vo=l.span`
|
|
523
523
|
overflow: hidden;
|
|
524
524
|
text-overflow: ellipsis;
|
|
525
525
|
font-family: var(--font-family-base);
|
|
@@ -528,13 +528,13 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
528
528
|
line-height: var(--line-height-base);
|
|
529
529
|
color: var(--text-color-primary);
|
|
530
530
|
white-space: nowrap;
|
|
531
|
-
`,
|
|
531
|
+
`,zo=l.div`
|
|
532
532
|
--dropdown-menu-padding-top: 0;
|
|
533
533
|
|
|
534
534
|
min-width: 0;
|
|
535
535
|
flex: 1;
|
|
536
536
|
position: relative;
|
|
537
|
-
`,
|
|
537
|
+
`,Mo=l(pt)`
|
|
538
538
|
width: 100%;
|
|
539
539
|
min-width: 0;
|
|
540
540
|
flex: 1;
|
|
@@ -543,7 +543,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
543
543
|
width: 100%;
|
|
544
544
|
max-width: 200px;
|
|
545
545
|
}
|
|
546
|
-
`,
|
|
546
|
+
`,Fo=l(ft)`
|
|
547
547
|
--dropdown-menu-item-gap: calc(var(--spacing-unit) / 2);
|
|
548
548
|
--dropdown-menu-item-padding-vertical: var(--spacing-xxs);
|
|
549
549
|
--dropdown-menu-item-padding-horizontal: var(--spacing-xs);
|
|
@@ -552,13 +552,13 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
552
552
|
margin: 5px 0;
|
|
553
553
|
border-radius: var(--border-radius-lg);
|
|
554
554
|
background: var(--bg-color);
|
|
555
|
-
|
|
555
|
+
`,$o=l.span`
|
|
556
556
|
flex: 1;
|
|
557
557
|
min-width: 0;
|
|
558
558
|
overflow: hidden;
|
|
559
559
|
text-overflow: ellipsis;
|
|
560
560
|
white-space: nowrap;
|
|
561
|
-
|
|
561
|
+
`,Ro=l(ht)`
|
|
562
562
|
margin-left: var(--spacing-xxs);
|
|
563
563
|
`,nt=l.li`
|
|
564
564
|
flex-shrink: 0;
|
|
@@ -567,16 +567,16 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
567
567
|
height: 1px;
|
|
568
568
|
margin: 0;
|
|
569
569
|
background: var(--border-color-secondary);
|
|
570
|
-
`,
|
|
570
|
+
`,Eo=l.li`
|
|
571
571
|
display: flex;
|
|
572
572
|
flex-direction: column;
|
|
573
573
|
gap: var(--dropdown-menu-item-gap);
|
|
574
574
|
list-style: none;
|
|
575
575
|
min-height: 0;
|
|
576
576
|
overflow-y: auto;
|
|
577
|
-
`,
|
|
577
|
+
`,Lo=l(ye)`
|
|
578
578
|
flex-shrink: 0;
|
|
579
|
-
`,
|
|
579
|
+
`,No=280;function rt({pinToBottom:e=!1}){const[t,n]=h.useState(()=>Ce().getIndexingActivityState().inProgress);return h.useEffect(()=>Ce().subscribe("indexing-activity",o=>{n(o.inProgress)}),[]),r.jsx(Do,{$open:t,$pinToBottom:e,"aria-hidden":!t,children:r.jsx(E,{tip:"We're building a search index of your project. Until it's ready, the assistant may need more context in each reply to stay accurate, which can use more tokens.",placement:"top",width:"240px",arrowPosition:"left",children:r.jsxs(Po,{role:"status","aria-live":"polite","aria-label":"Indexing in progress...",children:[r.jsx("div",{children:r.jsx(W,{})}),r.jsx(Uo,{children:"Indexing in progress..."})]})})})}const Do=l.div`
|
|
580
580
|
width: 100%;
|
|
581
581
|
display: block;
|
|
582
582
|
|
|
@@ -593,13 +593,13 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
593
593
|
`}
|
|
594
594
|
|
|
595
595
|
opacity: ${({$open:e})=>e?1:0};
|
|
596
|
-
transition: opacity ${
|
|
596
|
+
transition: opacity ${No}ms ease-out;
|
|
597
597
|
pointer-events: ${({$open:e})=>e?"auto":"none"};
|
|
598
598
|
|
|
599
599
|
${W} {
|
|
600
600
|
animation-play-state: ${({$open:e})=>e?"running":"paused"};
|
|
601
601
|
}
|
|
602
|
-
`,
|
|
602
|
+
`,Po=l.div`
|
|
603
603
|
width: 100%;
|
|
604
604
|
display: flex;
|
|
605
605
|
align-items: center;
|
|
@@ -609,10 +609,10 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
609
609
|
border-radius: 4px;
|
|
610
610
|
font-size: var(--font-size-sm);
|
|
611
611
|
line-height: 12px;
|
|
612
|
-
`,
|
|
612
|
+
`,Uo=l.div`
|
|
613
613
|
flex: 1;
|
|
614
614
|
min-width: 0;
|
|
615
|
-
`;function
|
|
615
|
+
`;function Ho(){const{chatId:e,isLoading:t,pendingComposerPreset:n,clearPendingComposerPreset:o,availableModels:i,selectedModelId:a,selectModel:s,onSettingsOpen:c}=ke(),{messages:d,isStreaming:u,sendMessage:f,stopGeneration:p}=H(),{isOpen:x}=Ie(),[g,v]=h.useState(""),b=h.useRef(null),y=h.useRef(null),w=h.useRef(!0),m=d.length>0,T=t||m,O=Io(d.length),S=O!==void 0&&O>0&&!m,F=h.useCallback((B="smooth")=>{y.current&&y.current.scrollTo({top:y.current.scrollHeight,behavior:B})},[]),Z=h.useCallback(()=>{const B=y.current;B&&B.scrollHeight-B.scrollTop-B.clientHeight<50&&(w.current=!0)},[]);h.useEffect(()=>{const B=y.current;if(!B)return;const ve=lt=>{lt.deltaY<0&&(w.current=!1)};return B.addEventListener("wheel",ve,{passive:!0}),()=>B.removeEventListener("wheel",ve)},[]);const Y=h.useCallback(async()=>{g&&(v(""),w.current=!0,await f(g),b.current&&requestAnimationFrame(()=>b.current?.focus()))},[f,g]);h.useEffect(()=>{x&&(b.current&&b.current.focus(),w.current=!0,F())},[x,d.length,F]),h.useEffect(()=>{u&&w.current&&F()}),h.useEffect(function(){x&&b.current&&(b.current.focus(),F("instant"))},[e,x,F]),h.useEffect(function(){!x||n===null||(v(n),o())},[x,n,o]);const st=r.jsx(sn,{value:g,onValueChange:v,onSubmit:Y,isStreaming:u,onStop:p,textareaRef:b,modelSelector:r.jsx(Ao,{models:i,selectedModelId:a,placement:m?"top":"bottom",onModelSelect:s,onSettingsOpen:c})});return r.jsxs(et,{children:[r.jsx(Go,{ref:y,$isExpanded:T,$isAnimated:u||S,onScroll:Z,children:t?r.jsx(Wo,{children:r.jsx(pe,{size:"20px"})}):r.jsx(Co,{})}),r.jsxs(Ko,{$isExpanded:!T,children:[r.jsx(rt,{pinToBottom:!T}),st]})]})}const Go=l.div`
|
|
616
616
|
flex: ${({$isExpanded:e})=>e?1:0};
|
|
617
617
|
width: 100%;
|
|
618
618
|
overflow: auto;
|
|
@@ -620,54 +620,54 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
620
620
|
transition-property: flex;
|
|
621
621
|
transition-duration: ${e=>e.$isAnimated?"var(--replay-transition-duration)":"0s"};
|
|
622
622
|
transition-timing-function: var(--replay-transition-timing-function);
|
|
623
|
-
`,
|
|
623
|
+
`,Ko=l.div`
|
|
624
624
|
position: relative;
|
|
625
625
|
display: flex;
|
|
626
626
|
flex-direction: column;
|
|
627
627
|
width: 100%;
|
|
628
628
|
flex: ${({$isExpanded:e})=>e?1:0};
|
|
629
|
-
`,
|
|
629
|
+
`,Wo=l.div`
|
|
630
630
|
display: flex;
|
|
631
631
|
justify-content: center;
|
|
632
632
|
height: 100%;
|
|
633
633
|
padding-top: var(--spacing-lg);
|
|
634
|
-
`,
|
|
634
|
+
`,M={TODAY:"today",YESTERDAY:"yesterday",LAST_WEEK:"last_week",LAST_MONTH:"last_month",OLDER:"older"},Zo={[M.TODAY]:"Today",[M.YESTERDAY]:"Yesterday",[M.LAST_WEEK]:"Last 7 days",[M.LAST_MONTH]:"Last 30 days",[M.OLDER]:"Older"};function Yo(e,t=Date.now()){const n=L(e).startOf("day"),o=L(t).startOf("day"),i=L(t).subtract(1,"day").startOf("day"),a=L(t).subtract(7,"day").startOf("day"),s=L(t).subtract(30,"day").startOf("day");return n.isSame(o,"day")?M.TODAY:n.isSame(i,"day")?M.YESTERDAY:!n.isBefore(a,"day")&&n.isBefore(i,"day")?M.LAST_WEEK:!n.isBefore(s,"day")&&n.isBefore(a,"day")?M.LAST_MONTH:M.OLDER}function qo(e){const t=[];for(const n of e){const o=Yo(n.updatedAt),i=t[t.length-1];!i||i.bucket!==o?t.push({bucket:o,chats:[n]}):i.chats.push(n)}return t}function Jo(e){const{scrollRef:t,sentinelRef:n,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:a,observerResetKey:s}=e;h.useLayoutEffect(()=>{const c=t.current,d=n.current;if(!c||!d)return;const u=new IntersectionObserver(f=>{const p=f[0];p&&p.isIntersecting&&o&&(i||a())},{root:c,rootMargin:"80px"});return u.observe(d),()=>{u.disconnect()}},[s,a,o,i,t,n])}const ot=l(et)`
|
|
635
635
|
gap: var(--spacing-xxs);
|
|
636
636
|
user-select: none;
|
|
637
|
-
`,
|
|
637
|
+
`,Qo=l.div`
|
|
638
638
|
display: flex;
|
|
639
639
|
flex-direction: column;
|
|
640
640
|
gap: var(--spacing-xs);
|
|
641
|
-
`,
|
|
641
|
+
`,Xo=l.div`
|
|
642
642
|
display: flex;
|
|
643
643
|
flex-direction: column;
|
|
644
644
|
gap: var(--spacing-xxs);
|
|
645
|
-
`,
|
|
645
|
+
`,ei=l(ot)`
|
|
646
646
|
display: flex;
|
|
647
647
|
flex-grow: 1;
|
|
648
648
|
align-items: center;
|
|
649
649
|
flex-direction: column;
|
|
650
650
|
padding: var(--spacing-md);
|
|
651
|
-
`,
|
|
651
|
+
`,ti=l.div`
|
|
652
652
|
display: flex;
|
|
653
653
|
flex-grow: 1;
|
|
654
654
|
align-items: center;
|
|
655
655
|
justify-content: center;
|
|
656
|
-
`,
|
|
656
|
+
`,ni=l.div`
|
|
657
657
|
display: flex;
|
|
658
658
|
flex-direction: column;
|
|
659
659
|
align-items: center;
|
|
660
660
|
max-width: 75%;
|
|
661
661
|
gap: var(--spacing-xxs);
|
|
662
|
-
`,
|
|
662
|
+
`,ri=l.div`
|
|
663
663
|
display: flex;
|
|
664
664
|
justify-content: center;
|
|
665
665
|
padding: var(--spacing-xs);
|
|
666
|
-
`,
|
|
666
|
+
`,oi=l(U)`
|
|
667
667
|
padding-left: var(--spacing-xs);
|
|
668
668
|
font-size: var(--font-size-sm);
|
|
669
669
|
color: var(--color-warm-grey-7);
|
|
670
|
-
`,
|
|
670
|
+
`,ii=l.div`
|
|
671
671
|
display: flex;
|
|
672
672
|
flex-grow: 1;
|
|
673
673
|
|
|
@@ -675,7 +675,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
675
675
|
flex-grow: 1;
|
|
676
676
|
min-width: 0;
|
|
677
677
|
}
|
|
678
|
-
`,
|
|
678
|
+
`,ai=l.div`
|
|
679
679
|
display: flex;
|
|
680
680
|
align-items: center;
|
|
681
681
|
justify-content: space-between;
|
|
@@ -698,19 +698,19 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
698
698
|
display: inline-flex;
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
|
-
`,
|
|
701
|
+
`,si=l(U)`
|
|
702
702
|
overflow: hidden;
|
|
703
703
|
white-space: nowrap;
|
|
704
704
|
text-overflow: ellipsis;
|
|
705
|
-
`,
|
|
705
|
+
`,li=l.div`
|
|
706
706
|
height: 1px;
|
|
707
707
|
flex-shrink: 0;
|
|
708
|
-
`;function
|
|
708
|
+
`;function ci(e){const{chat:t,onSelect:n,onRemove:o}=e;return r.jsx(ii,{children:r.jsx(E,{tip:L(t.updatedAt).format("MMM DD, YYYY, hh:mm:ss A"),className:"expanded",children:r.jsxs(ai,{role:"button",onClick:()=>n?.(t.id),children:[r.jsx(si,{children:t.title??"New chat"}),r.jsx(_,{variant:"ghost",size:"small",tone:"danger",icon:r.jsx(Bt,{}),onClick:i=>{i.stopPropagation(),o?.(t.id)}})]})})})}function di(e){const{group:t,onChatSelect:n,onChatRemove:o}=e;return r.jsxs(Xo,{children:[r.jsx(oi,{children:Zo[t.bucket]}),t.chats.map(i=>r.jsx(ci,{chat:i,onSelect:n,onRemove:o},i.id))]})}function ui(){return r.jsx(ti,{children:r.jsxs(ni,{children:[r.jsx(U,{textAlign:"center",fontWeight:"var(--font-weight-semibold)",children:"No chat history"}),r.jsx(U,{textAlign:"center",children:"Ask questions or let the assistant take action for you."})]})})}function pi(){return r.jsx(ei,{children:r.jsx(pe,{})})}const fi=50;function hi(e){const{onChatSelect:t,onChatRemove:n}=e,o=h.useRef(null),i=h.useRef(null),{data:a,isPending:s,hasNextPage:c,isFetchingNextPage:d,fetchNextPage:u}=Zt(fi),f=h.useMemo(()=>(a?.pages??[]).flatMap(x=>x.items),[a?.pages]),p=h.useMemo(()=>qo(f),[f]);return Jo({scrollRef:o,sentinelRef:i,hasNextPage:c,isFetchingNextPage:d,fetchNextPage:u,observerResetKey:a?.pages.length}),s&&!a?r.jsx(pi,{}):f.length===0?r.jsx(ui,{}):r.jsxs(ot,{ref:o,children:[r.jsx(Qo,{children:p.map(x=>r.jsx(di,{group:x,onChatSelect:t,onChatRemove:n},`${x.bucket}-${x.chats[0]?.id??""}`))}),c&&r.jsx(li,{ref:i,"aria-hidden":!0}),d&&r.jsx(ri,{children:r.jsx(pe,{})})]})}function xi(){const e=h.useRef(null),[t,n]=h.useState(!1);return h.useLayoutEffect(()=>{if(!e.current)return;const o=e.current;function i(){n(o.scrollWidth>o.clientWidth)}i();const a=new ResizeObserver(i);return a.observe(o),()=>a.disconnect()},[]),{ref:e,value:t}}function gi(e){const{ref:t,value:n}=xi();return r.jsx(mi,{children:r.jsx(E,{tip:e.value,className:"no-overflow",disabled:!n,children:r.jsx(vi,{ref:t,children:e.value})})})}const mi=l.div`
|
|
709
709
|
overflow: hidden;
|
|
710
710
|
.tooltip-no-overflow {
|
|
711
711
|
overflow: hidden;
|
|
712
712
|
}
|
|
713
|
-
`,
|
|
713
|
+
`,vi=l.div`
|
|
714
714
|
color: var(--text-color-primary);
|
|
715
715
|
font-size: var(--font-size-base);
|
|
716
716
|
line-height: var(--line-height-base);
|
|
@@ -718,7 +718,7 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
718
718
|
white-space: nowrap;
|
|
719
719
|
text-overflow: ellipsis;
|
|
720
720
|
user-select: none;
|
|
721
|
-
`;function
|
|
721
|
+
`;function it(e){const{children:t,buttons:n}=e;return r.jsxs(yi,{children:[r.jsx(wi,{children:t}),n&&r.jsx(ji,{children:n})]})}const yi=l.div`
|
|
722
722
|
display: flex;
|
|
723
723
|
flex-direction: row;
|
|
724
724
|
align-items: center;
|
|
@@ -726,28 +726,28 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
726
726
|
gap: var(--spacing-xs);
|
|
727
727
|
width: 100%;
|
|
728
728
|
flex-shrink: 0;
|
|
729
|
-
`,
|
|
729
|
+
`,wi=l.div`
|
|
730
730
|
display: flex;
|
|
731
731
|
align-items: center;
|
|
732
732
|
gap: var(--spacing-xs);
|
|
733
733
|
min-width: 0;
|
|
734
734
|
flex: 1;
|
|
735
|
-
`,
|
|
735
|
+
`,ji=l.div`
|
|
736
736
|
display: flex;
|
|
737
737
|
align-items: center;
|
|
738
738
|
gap: 2px;
|
|
739
|
-
`;function
|
|
739
|
+
`;function bi(e){const{title:t,onCreateNewChat:n,onViewHistory:o,onClose:i}=e,a=r.jsxs(r.Fragment,{children:[r.jsx(E,{tip:"New chat",children:r.jsx(_,{size:"small",variant:"text","aria-label":"Create new chat",onClick:n,icon:r.jsx(an,{})})}),r.jsx(E,{tip:"Chat history",children:r.jsx(_,{size:"small",variant:"text","aria-label":"View chat history",onClick:o,icon:r.jsx(zt,{})})}),r.jsx(ki,{children:r.jsx(Mt,{})}),r.jsx(E,{tip:"Close",arrowPosition:"left",children:r.jsx(_,{variant:"text",size:"small","aria-label":"Close panel",icon:r.jsx(mt,{}),onClick:i})})]});return r.jsxs(it,{buttons:a,children:[r.jsx(Ci,{children:r.jsx(Vt,{size:"14px"})}),r.jsx(gi,{value:t})]})}const Ci=l.div`
|
|
740
740
|
display: flex;
|
|
741
|
-
`,
|
|
741
|
+
`,ki=l.div`
|
|
742
742
|
display: flex;
|
|
743
743
|
height: 14px;
|
|
744
|
-
`;function
|
|
744
|
+
`;function Ii(e){const{onReturnFromHistory:t}=e;return r.jsxs(it,{children:[r.jsx(_,{size:"small",variant:"text","aria-label":"Return to chat",onClick:t,icon:r.jsx(Ft,{})}),r.jsx(Ti,{children:r.jsx(U,{children:"Chat history"})})]})}const Ti=l.div`
|
|
745
745
|
user-select: none;
|
|
746
|
-
`;function
|
|
746
|
+
`;function _i(){const[e,t]=h.useState(N.CHAT),n=Ie(),o=ke(),i=()=>{t(N.HISTORY)},a=()=>{t(N.CHAT)},s=async c=>{o.selectChat(c),t(N.CHAT)};return r.jsxs(Si,{children:[r.jsxs(at,{isActive:e===N.CHAT,children:[r.jsx(bi,{title:o.title,onCreateNewChat:o.createNewChat,onViewHistory:i,onClose:n.closePanel}),r.jsx(Ho,{})]}),r.jsxs(at,{isActive:e===N.HISTORY,isSliding:!0,children:[r.jsx(Ii,{onReturnFromHistory:a}),r.jsx(hi,{onChatSelect:s,onChatRemove:o.removeChat}),r.jsx(Oi,{children:r.jsx(rt,{pinToBottom:!0})})]})]})}function at(e){const{children:t,isActive:n,isSliding:o=!1}=e,i=r.jsx(Ai,{inert:!n,children:t});return o?r.jsx(Bi,{$isExpanded:n,children:i}):i}const Si=l.div`
|
|
747
747
|
position: relative;
|
|
748
748
|
height: 100%;
|
|
749
749
|
overflow: clip;
|
|
750
|
-
`,
|
|
750
|
+
`,Ai=l.div`
|
|
751
751
|
display: flex;
|
|
752
752
|
height: 100%;
|
|
753
753
|
flex-direction: column;
|
|
@@ -755,12 +755,12 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
755
755
|
border-radius: var(--border-radius-md);
|
|
756
756
|
background: var(--bg-color);
|
|
757
757
|
margin-left: var(--spacing-xxs);
|
|
758
|
-
`,
|
|
758
|
+
`,Oi=l.div`
|
|
759
759
|
display: flex;
|
|
760
760
|
flex-direction: column;
|
|
761
761
|
width: 100%;
|
|
762
762
|
padding: 0 var(--spacing-xs) var(--spacing-xs);
|
|
763
|
-
`,
|
|
763
|
+
`,Bi=l.div`
|
|
764
764
|
position: absolute;
|
|
765
765
|
inset: 0;
|
|
766
766
|
transform: translateX(${e=>e.$isExpanded?"0%":"100%"});
|
|
@@ -770,4 +770,4 @@ import{g as q,a as l,j as r,f as ae,B as _,r as h,e as ct,O as dt,af as ut,D as
|
|
|
770
770
|
@media (prefers-reduced-motion: reduce) {
|
|
771
771
|
transition-duration: 0ms;
|
|
772
772
|
}
|
|
773
|
-
`;export{
|
|
773
|
+
`;export{_i as AiPanel};
|