PageSourceSearch

http://parisobs.com/_next/static/chunks/pages/project/[projectId]/playground-cf110657b2f05c33.js

js parisobs.com collected 2026-10-04 01:41:07 UTC 86,985 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[417,3460,5208],{6159:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/project/[projectId]/playground",function(){return r(36535)}])},9686:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(22222).A)("circle-minus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]])},11341:(e,t,r)=>{"use strict";r.d(t,{Jf:()=>m,S2:()=>c,TD:()=>u,g1:()=>d,ir:()=>f,tZ:()=>x,wJ:()=>i,xP:()=>p});var s=r(73154),a=r(96810),n=r(80676),l=r(27131);r(14183);var o=r(81509);let i=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.uB,{ref:t,className:(0,o.cn)("flex h-full w-full flex-col overflow-hidden rounded-md bg-white text-slate-950 dark:bg-slate-950 dark:text-slate-50",r),...a})});i.displayName=n.uB.displayName;let d=a.forwardRef((e,t)=>{let{className:r,variant:a="default",...i}=e;return(0,s.jsxs)("div",{className:(0,o.cn)("flex items-center px-3","default"===a&&"rounded border","bottom"===a&&"border-b","cmdk-input-wrapper"),children:[(0,s.jsx)(l.A,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,s.jsx)(n.uB.Input,{ref:t,className:(0,o.cn)("flex h-8 w-full rounded border-transparent bg-transparent py-3 text-sm outline-none placeholder:text-slate-500 focus:border-0 focus:border-none focus:border-transparent focus:ring-0 disabled:cursor-not-allowed disabled:opacity-50 dark:placeholder:text-slate-400",r),...i})]})});d.displayName=n.uB.Input.displayName;let c=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.uB.List,{ref:t,className:(0,o.cn)("max-h-[300px] overflow-y-auto overflow-x-hidden",r),...a})});c.displayName=n.uB.List.displayName;let u=a.forwardRef((e,t)=>(0,s.jsx)(n.uB.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));u.displayName=n.uB.Empty.displayName;let m=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.uB.Group,{ref:t,className:(0,o.cn)("overflow-hidden p-1 text-slate-950 dark:text-slate-50 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-slate-500 dark:[&_[cmdk-group-heading]]:text-slate-400",r),...a})});m.displayName=n.uB.Group.displayName;let p=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.uB.Separator,{ref:t,className:(0,o.cn)("-mx-1 h-px bg-slate-200 dark:bg-slate-800",r),...a})});p.displayName=n.uB.Separator.displayName;let x=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.uB.Item,{ref:t,className:(0,o.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-slate-100 aria-selected:text-slate-900 dark:aria-selected:bg-slate-800 dark:aria-selected:text-slate-50",r),...a})});x.displayName=n.uB.Item.displayName;let f=e=>{let{className:t,...r}=e;return(0,s.jsx)("span",{className:(0,o.cn)("ml-auto text-xs tracking-widest text-slate-500 dark:text-slate-400",t),...r,"data-sentry-component":"InputCommandShortcut","data-sentry-source-file":"input-command.tsx"})};f.displayName="CommandShortcut"},16594:(e,t,r)=>{var s=r(43592);e.exports=function(e,t,r){var a=e.length;return r=void 0===r?a:r,!t&&r>=a?e:s(e,t,r)}},16609:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(22222).A)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]])},16758:(e,t,r)=>{"use strict";r.d(t,{HK:()=>o,WM:()=>d,wV:()=>i});var s=r(73154),a=r(74796),n=r(49859),l=r(81509);let o=e=>{let{className:t,...r}=e;return(0,s.jsx)(n.YZ,{className:(0,l.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...r,"data-sentry-element":"ResizablePrimitive.PanelGroup","data-sentry-component":"ResizablePanelGroup","data-sentry-source-file":"resizable.tsx"})},i=n.Zk,d=e=>{let{withHandle:t,className:r,...o}=e;return(0,s.jsx)(n.TW,{className:(0,l.cn)("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",r),...o,"data-sentry-element":"ResizablePrimitive.PanelResizeHandle","data-sentry-component":"ResizableHandle","data-sentry-source-file":"resizable.tsx",children:t&&(0,s.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:(0,s.jsx)(a.A,{className:"h-2.5 w-2.5"})})})}},17982:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(22222).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},36535:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>eZ});var s=r(73154),a=r(96810),n=r(86843),l=r(51883),o=r(22222);let i=(0,o.A)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),d=(0,o.A)("list-restart",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M7 12H3",key:"13ou7f"}],["path",{d:"M7 19H3",key:"wbqt3n"}],["path",{d:"M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14",key:"qth677"}],["path",{d:"M11 10v4h4",key:"172dkj"}]]);var c=r(39156),u=r(89978);let m=()=>{let e=(0,c.useRouter)(),{clearAllCache:t}=(0,u.V)();return(0,s.jsxs)(n.$,{variant:"outline",title:"Reset playground state",onClick:()=>{t(),e.reload()},className:"gap-1","data-sentry-element":"Button","data-sentry-component":"ResetPlaygroundButton","data-sentry-source-file":"ResetPlaygroundButton.tsx",children:[(0,s.jsx)(d,{className:"h-4 w-4","data-sentry-element":"ListRestartIcon","data-sentry-source-file":"ResetPlaygroundButton.tsx"}),(0,s.jsx)("span",{className:"hidden lg:inline",children:"Reset playground"})]})};var p=r(9476),x=r(8163);let f=new Map,h=new EventTarget,y=()=>{let[e,t]=(0,a.useState)(!1),[r,s]=(0,a.useState)(!1),n=(0,a.useRef)(null),l=(0,a.useCallback)(()=>{s(Array.from(f.values()).some(e=>e.hasModelConfigured()))},[]),o=(0,a.useCallback)((e,t)=>{f.set(e,t),l(),h.dispatchEvent(new CustomEvent(p.k.WINDOW_REGISTERED,{detail:{windowId:e}}))},[l]),i=(0,a.useCallback)(e=>{let t=f.has(e);f.delete(e),t&&(l(),h.dispatchEvent(new CustomEvent(p.k.WINDOW_UNREGISTERED,{detail:{windowId:e}})))},[l]),d=(0,a.useCallback)(()=>{let e=Array.from(f.values());!(0===e.length||e.some(e=>e.getIsStreaming()))&&e.some(e=>e.hasModelConfigured())&&(h.dispatchEvent(new CustomEvent(p.k.EXECUTE_ALL)),setTimeout(()=>{if(Array.from(f.values()).some(e=>e.getIsStreaming())){t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{t(!1)},3e4);let e=()=>{Array.from(f.values()).some(e=>e.getIsStreaming())?setTimeout(e,500):(t(!1),n.current&&(clearTimeout(n.current),n.current=null))};setTimeout(e,1e3)}else(0,x.N)("No content to execute","Please add at least one message with content to any window."),t(!1)},500))},[]),c=(0,a.useCallback)(()=>{t(!1),n.current&&(clearTimeout(n.current),n.current=null),h.dispatchEvent(new CustomEvent(p.k.STOP_ALL))},[]),u=(0,a.useCallback)(()=>{let e=Array.from(f.values());if(0===e.length)return null;let t=e.filter(e=>e.getIsStreaming()).length,r=e.length;return 0===t?null:t===r?"Executing all ".concat(r," windows"):"Executing ".concat(t," of ").concat(r," windows")},[]);return(0,a.useEffect)(()=>{let e=()=>{l()};
1return h.addEventListener(p.k.WINDOW_MODEL_CONFIG_CHANGE,e),()=>{h.removeEventListener(p.k.WINDOW_MODEL_CONFIG_CHANGE,e)}},[l]),{registerWindow:o,unregisterWindow:i,executeAllWindows:d,stopAllWindows:c,getExecutionStatus:u,isExecutingAll:e,hasAnyModelConfigured:r}};var g=r(26159),v=r(66449),w=r(33749),j=r(20192),N=r(26202),b=r(92125),C=r(18328),S=r(45596),T=r(82145),k=r(26946);let A=(0,a.createContext)(void 0),E=()=>{let e=(0,a.useContext)(A);if(!e)throw Error("usePlaygroundContext must be used within a PlaygroundProvider");return e},P=e=>{let{children:t,windowId:r}=e,n=(0,b.B)(),l=(0,C.A)(),{playgroundCache:o,setPlaygroundCache:i}=(0,N.A)(r),[d,c]=(0,a.useState)([]),[u,m]=(0,a.useState)([]),[f,g]=(0,a.useState)(""),[T,E]=(0,a.useState)([]),[P,I]=(0,a.useState)(""),[O,R]=(0,a.useState)(!1),B=(0,a.useRef)(O),[z,W]=(0,a.useState)([]),[U,V]=(0,a.useState)(null),[H,F]=(0,a.useState)([(0,w.p)({type:S.ChatMessageType.System,role:S.ChatMessageRole.System,content:""}),(0,w.p)({type:S.ChatMessageType.User,role:S.ChatMessageRole.User,content:""})]),{modelParams:J,setModelParams:G,availableProviders:$,availableModels:X,updateModelParamValue:Y,setModelParamEnabled:K,providerModelCombinations:q}=(0,j.n)(r),{registerWindow:Z,unregisterWindow:Q}=y(),ee=H.reduce((e,t)=>(t.type===S.ChatMessageType.AssistantToolCall&&e.push(...t.toolCalls.map(e=>e.id)),e),[]),[et,er]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(!o)return void er(!0);let{messages:e,modelParams:t,output:r,promptVariables:s,messagePlaceholders:a,tools:n,structuredOutputSchema:l}=o;if(F(e.map(e=>({...e,id:"id"in e&&"string"==typeof e.id?e.id:(0,v.A)()}))),r)try{let e=JSON.parse(r),t=S.ToolCallResponseSchema.parse(e);g(String(t.content)),E(t.tool_calls)}catch(e){g(r),I("")}t&&G(e=>({...e,...t})),s&&c(s),a&&m(a),n&&W(n),l&&V(l),er(!0)},[o,G]);let es=(0,a.useCallback)(()=>{let e=H.map(e=>"content"in e?e.content:e.name).join("\n"),t=(0,S.extractVariables)(e).map(e=>e.trim()).filter(Boolean);c(e=>{let r=e.reduce((e,r)=>{let s=t.includes(r.name);return(s||r.value)&&e.push({...r,isUsed:s}),e},[]);for(let e of t)r.some(t=>t.name===e)||r.push({name:e,value:"",isUsed:!0});return r})},[H]);(0,a.useEffect)(es,[H,es]);let ea=(0,a.useCallback)(e=>{if(e.type===S.ChatMessageType.AssistantToolCall){var t;let r=(0,w.p)({type:S.ChatMessageType.AssistantToolCall,role:S.ChatMessageRole.Assistant,content:null!=(t=e.content)?t:"",toolCalls:e.toolCalls}),s=[];for(let t of e.toolCalls){let e=(0,w.p)({type:S.ChatMessageType.ToolResult,role:S.ChatMessageRole.Tool,content:"",toolCallId:t.id});s.push(e)}return F(e=>[...e,r,...s]),r}if(e.type===S.ChatMessageType.Placeholder){let t={...e,id:(0,v.A)()};return F(e=>[...e,t]),t}{let t=(0,w.p)(e);return F(e=>[...e,t]),t}},[]),en=(0,a.useCallback)((e,t,r,s)=>{F(e=>e.map(e=>e.id===t?{...e,[r]:s}:e))},[]),el=(0,a.useCallback)((e,t)=>{F(r=>r.map(r=>r.id===e?{id:e,...t}:r))},[]),eo=(0,a.useCallback)(e=>{F(t=>t.filter(t=>t.id!==e))},[]),ei=(0,a.useCallback)(async function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];try{var t,r,s,a,o,c;R(!0),g(""),I(""),E([]);let m=function(e,t,r){let s=e.filter(e=>!e.value&&e.isUsed);if(s.length>0)throw Error("Please set a value for the following variables: ".concat(s.map(e=>e.name).join(", ")));let a=r.filter(e=>0===e.value.length&&e.isUsed);if(a.length>0)throw Error("Please set values for the following message placeholders: ".concat(a.map(e=>e.name).join(", ")));let n=r.reduce((e,t)=>(e[t.name]=t.value,e),{}),l=e.reduce((e,t)=>(e[t.name]=t.value,e),{});return(0,S.compileChatMessagesWithIds)(t,n,l).filter(e=>"string"!=typeof e.content||e.content.length>0||"toolCalls"in e&&e.toolCalls&&Array.isArray(e.toolCalls)&&e.toolCalls.length>0)}(d,H,u);if(0===m.length)throw Error("Please add at least one message with content.");let p=(0,S.extractVariables)(m.map(e=>"string"==typeof e.content?e.content:"").join("\n"));if(!J.provider.value||!J.model.value)throw Error("Please select a model");if(p.length>0)throw Error("Error replacing variables. Please check your inputs.");if(z.length>0&&U)throw Error("Cannot use both tools and structured output at the same time");let x="";if(z.length>0){let r=await M(l,m,J,z,e),s="string"==typeof r.content?r.content:null==(t=r.content.find(e=>"type"in e&&"text"===e.type))?void 0:t.text;g(s),E(r.tool_calls),x=JSON.stringify(r,null,2)}else if(U)x=await L(l,m,J,U,e),g(x);else if(e)for await(let e of D(l,m,J))x+=e,g(x);else x=await _(l,m,J),g(x);I((r=x,s=m,a=J,o=z,c=U,JSON.stringify({input:s.map(e=>{var t;return t=e,Object.fromEntries(Object.entries(t).filter(e=>{let[t,r]=e;return"id"!==t}))}),output:r,model:(0,k._)(a),tools:o,structuredOutputSchema:c},null,2))),i({messages:H,modelParams:J,output:x,promptVariables:d,messagePlaceholders:u,tools:z,structuredOutputSchema:U}),n("playground:execute_button_click",{inputLength:m.length,modelName:J.model,modelProvider:J.provider,outputLength:x.length,toolCount:z.length,isStru
1cturedOutput:!!U})}catch(t){let e=t instanceof Error?t.message:"An error occurred";(0,x.N)("Error",e)}finally{R(!1)}},[H,J,d,u,z,n,i,U,l]),ed=(0,a.useCallback)((e,t)=>{c(r=>r.map(r=>r.name===e?{...r,value:t}:r))},[]),ec=(0,a.useCallback)(e=>{c(t=>t.filter(t=>t.name!==e))},[]),eu=(0,a.useCallback)((e,t)=>{m(r=>r.map(r=>r.name===e?{...r,value:t}:r))},[]),em=(0,a.useCallback)(e=>{m(t=>t.filter(t=>t.name!==e))},[]),ep=(0,a.useCallback)(()=>{let e=H.filter(e=>e.type===S.ChatMessageType.Placeholder).map(e=>e.name);m(t=>{let r=t.reduce((t,r)=>{let s=e.includes(r.name);return(s||0!==r.value.length)&&t.push({...r,isUsed:s}),t},[]);for(let t of e)r.some(e=>e.name===t)||r.push({name:t,value:[],isUsed:!0});return r})},[H]);return(0,a.useEffect)(ep,[H,ep]),(0,a.useEffect)(()=>{et&&H.length>0&&i({messages:H,modelParams:J,output:f,promptVariables:d,messagePlaceholders:u,tools:z,structuredOutputSchema:U})},[H,J,f,d,u,z,U,i,et]),(0,a.useEffect)(()=>{let e=r||p.y.DEFAULT_WINDOW_ID;Z(e,{handleSubmit:ei,stopExecution:()=>{R(!1),B.current=!1},getIsStreaming:()=>B.current,hasModelConfigured:()=>!!(J.provider.value&&J.model.value)});let t=()=>{!B.current&&H.some(e=>e.type===S.ChatMessageType.Placeholder||"string"!=typeof e.content||e.content.trim().length>0)&&ei(!0).catch(e=>console.error(e))},s=()=>{B.current&&(R(!1),B.current=!1)};return h.addEventListener(p.k.EXECUTE_ALL,t),h.addEventListener(p.k.STOP_ALL,s),()=>{Q(e),h.removeEventListener(p.k.EXECUTE_ALL,t),h.removeEventListener(p.k.STOP_ALL,s)}},[r,ei,Z,Q,H,J.provider.value,J.model.value]),(0,a.useEffect)(()=>{B.current=O,h.dispatchEvent(new CustomEvent(p.k.WINDOW_EXECUTION_STATE_CHANGE,{detail:{windowId:r||p.y.DEFAULT_WINDOW_ID,isStreaming:O}}))},[r,O]),(0,a.useEffect)(()=>{h.dispatchEvent(new CustomEvent(p.k.WINDOW_MODEL_CONFIG_CHANGE,{detail:{windowId:r||p.y.DEFAULT_WINDOW_ID,hasModel:!!(J.provider.value&&J.model.value)}}))},[r,J.provider.value,J.model.value]),(0,s.jsx)(A.Provider,{value:{promptVariables:d,updatePromptVariableValue:ed,deletePromptVariable:ec,messagePlaceholders:u,updateMessagePlaceholderValue:eu,deleteMessagePlaceholder:em,tools:z,setTools:W,structuredOutputSchema:U,setStructuredOutputSchema:V,messages:H,addMessage:ea,setMessages:F,updateMessage:en,replaceMessage:el,deleteMessage:eo,toolCallIds:ee,modelParams:J,updateModelParamValue:Y,setModelParamEnabled:K,providerModelCombinations:q,output:f,outputJson:P,outputToolCalls:T,handleSubmit:ei,isStreaming:O,availableProviders:$,availableModels:X},"data-sentry-element":"PlaygroundContext.Provider","data-sentry-component":"PlaygroundProvider","data-sentry-source-file":"index.tsx",children:t})};async function M(e,t,r,s){var a;let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!e)throw Error("Project ID is not set");let l=JSON.stringify({projectId:e,messages:t,modelParams:(0,k._)(r),tools:s,streaming:n}),o=await fetch("".concat(null!=(a=T._.NEXT_PUBLIC_BASE_PATH)?a:"","/api/chatCompletion"),{method:"POST",headers:{"Content-Type":"application/json"},body:l}),i=await o.json();if(!o.ok)throw Error("Completion failed: ".concat(i.message));let d=S.ToolCallResponseSchema.safeParse(i);if(!d.success)throw Error("Failed to parse tool call response client-side:\n"+JSON.stringify(i,null,2));return d.data}async function L(e,t,r,s){var a;let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!e)throw Error("Project ID is not set");let l=JSON.stringify({projectId:e,messages:t,modelParams:(0,k._)(r),structuredOutputSchema:null==s?void 0:s.schema,streaming:n}),o=await fetch("".concat(null!=(a=T._.NEXT_PUBLIC_BASE_PATH)?a:"","/api/chatCompletion"),{method:"POST",headers:{"Content-Type":"application/json"},body:l});if(!o.ok){let e=await o.json();throw Error("Completion failed: ".concat(e.message))}let i=await o.text();try{let e=JSON.parse(i);return JSON.stringify(e,null,2)}catch(e){return i}}async function*D(e,t,r){var s,a;if(!e)return void console.error("Project ID is not set");let n=t.some(e=>e.type===S.ChatMessageType.ToolResult),l=JSON.stringify({projectId:e,messages:t,modelParams:(0,k._)(r),streaming:!0,...n&&{tools:[]}}),o=await fetch("".concat(null!=(a=T._.NEXT_PUBLIC_BASE_PATH)?a:"","/api/chatCompletion"),{method:"POST",headers:{"Content-Type":"application/json"},body:l});if(!o.ok){let e=await o.json();throw Error("Completion failed: ".concat(e.message))}let i=null==(s=o.body)?void 0:s.getReader();if(!i)throw Error("Failed to read response body");let d=new TextDecoder("utf-8");try{for(;;){let{done:e,value:t}=await i.read();if(e)break;let r=d.decode(t);yield r}}catch(e){throw e}finally{i.releaseLock()}}async function _(e,t,r){var s;if(!e)throw Error("Project ID is not set");let a=t.some(e=>e.type===S.ChatMessageType.ToolResult),n=JSON.stringify({projectId:e,messages:t,modelParams:(0,k._)(r),streaming:!1,...a&&{tools:[]}}),l=await fetch("".concat(null!=(s=T._.NEXT_PUBLIC_BASE_PATH)?s:"","/api/chatCompletion"),{method:"POST",headers:{"Content-Type":"application/json"},body:n});if(!l.ok){let e=await l.json();throw Error("Completion failed: ".concat(e.message))}return(await l.json()).content||""}let I=(0,o.A)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var O=r(92273),R=r(11341),B=r(97638),z=r(53524),W=r(93367),U=r(81509),
1V=r(35157);let H=e=>{var t,r;let{className:l}=e,[o,i]=(0,a.useState)(""),{modelParams:d,messages:u,output:m,promptVariables:p}=E(),x=(0,b.B)(),f=(0,c.useRouter)(),h=(0,C.A)(),{setPlaygroundCache:y}=(0,N.A)(),g=null!=(r=null==(t=W.FH.prompts.allNames.useQuery({projectId:h,type:S.PromptType.Chat},{enabled:!!h}).data)?void 0:t.map(e=>({name:e.name,id:e.id})))?r:[],v=async()=>{x("playground:save_to_new_prompt_button_click",{projectId:h}),y({modelParams:d,messages:u,output:m,promptVariables:p}),await f.push("/project/".concat(h,"/prompts/new?loadPlaygroundCache=true"))},w=async()=>{x("playground:save_to_prompt_version_button_click",{projectId:h}),y({modelParams:d,messages:u,output:m,promptVariables:p}),await f.push("/project/".concat(h,"/prompts/new?promptId=").concat(o,"&loadPlaygroundCache=true"))};return(0,s.jsx)(z.Bc,{delayDuration:300,"data-sentry-element":"TooltipProvider","data-sentry-component":"SaveToPromptButton","data-sentry-source-file":"SaveToPromptButton.tsx",children:(0,s.jsxs)(B.AM,{"data-sentry-element":"Popover","data-sentry-source-file":"SaveToPromptButton.tsx",children:[(0,s.jsxs)(z.m_,{"data-sentry-element":"Tooltip","data-sentry-source-file":"SaveToPromptButton.tsx",children:[(0,s.jsx)(z.k$,{asChild:!0,"data-sentry-element":"TooltipTrigger","data-sentry-source-file":"SaveToPromptButton.tsx",children:(0,s.jsx)(B.Wv,{asChild:!0,"data-sentry-element":"PopoverTrigger","data-sentry-source-file":"SaveToPromptButton.tsx",children:(0,s.jsxs)(n.$,{variant:"outline",className:(0,U.cn)("h-7 gap-1.5 px-2.5 text-xs @xl:hidden",l),"data-sentry-element":"Button","data-sentry-source-file":"SaveToPromptButton.tsx",children:[(0,s.jsx)(I,{size:14,"data-sentry-element":"Save","data-sentry-source-file":"SaveToPromptButton.tsx"}),(0,s.jsx)("span",{className:"sr-only",children:"Save as prompt"})]})})}),(0,s.jsx)(z.ZI,{className:"text-xs","data-sentry-element":"TooltipContent","data-sentry-source-file":"SaveToPromptButton.tsx",children:"Save as prompt"})]}),(0,s.jsx)(B.Wv,{asChild:!0,"data-sentry-element":"PopoverTrigger","data-sentry-source-file":"SaveToPromptButton.tsx",children:(0,s.jsxs)(n.$,{variant:"outline",className:(0,U.cn)("hidden h-7 gap-1.5 px-2.5 text-xs @xl:flex",l),"data-sentry-element":"Button","data-sentry-source-file":"SaveToPromptButton.tsx",children:[(0,s.jsx)(I,{size:14,"data-sentry-element":"Save","data-sentry-source-file":"SaveToPromptButton.tsx"}),(0,s.jsx)("span",{children:"Save as prompt"})]})}),(0,s.jsxs)(B.hl,{"data-sentry-element":"PopoverContent","data-sentry-source-file":"SaveToPromptButton.tsx",children:[(0,s.jsx)(n.$,{className:"mt-2 w-full",onClick:v,"data-sentry-element":"Button","data-sentry-source-file":"SaveToPromptButton.tsx",children:"Save as new prompt"}),(0,s.jsx)(F,{"data-sentry-element":"Divider","data-sentry-source-file":"SaveToPromptButton.tsx"}),(0,s.jsxs)(R.wJ,{className:"min-h-[8rem]","data-sentry-element":"InputCommand","data-sentry-source-file":"SaveToPromptButton.tsx",children:[(0,s.jsx)(R.g1,{placeholder:"Search chat prompts...",variant:"bottom","data-sentry-element":"InputCommandInput","data-sentry-source-file":"SaveToPromptButton.tsx"}),(0,s.jsxs)(R.TD,{"data-sentry-element":"InputCommandEmpty","data-sentry-source-file":"SaveToPromptButton.tsx",children:["No chat prompt found",(0,s.jsx)(V.A,{description:"Prompts from the playground can only be saved to 'chat' prompts as they include multiple system/user messages.","data-sentry-element":"DocPopup","data-sentry-source-file":"SaveToPromptButton.tsx"})]}),(0,s.jsx)(R.Jf,{className:"mt-2","data-sentry-element":"InputCommandGroup","data-sentry-source-file":"SaveToPromptButton.tsx",children:(0,s.jsx)(R.S2,{"data-sentry-element":"InputCommandList","data-sentry-source-file":"SaveToPromptButton.tsx",children:g.map(e=>(0,s.jsxs)(R.tZ,{title:e.name,value:e.name,onSelect:e=>{var t,r;let s=null!=(r=null==(t=g.find(t=>t.name===e))?void 0:t.id)?r:"";i(s===o?"":s)},children:[(0,s.jsx)(O.A,{className:(0,U.cn)("mr-2 h-4 w-4",o===e.id?"opacity-100":"opacity-0")}),(0,s.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:e.name})]},e.id))})})]}),(0,s.jsx)(n.$,{className:"mt-2 w-full",disabled:!o,onClick:w,"data-sentry-element":"Button","data-sentry-source-file":"SaveToPromptButton.tsx",children:"Save as new prompt version"})]})]})})};function F(){return(0,s.jsxs)("div",{className:"my-3 flex flex-row justify-center align-middle","data-sentry-component":"Divider","data-sentry-source-file":"SaveToPromptButton.tsx",children:[(0,s.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,s.jsx)("div",{className:"flex-1 border-b-2 border-gray-200"}),(0,s.jsx)("div",{className:"flex-1"})]}),(0,s.jsx)("p",{className:"mx-2 text-sm text-gray-400",children:"or"}),(0,s.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,s.jsx)("div",{className:"flex-1 border-b-2 border-gray-200"}),(0,s.jsx)("div",{className:"flex-1"})]})]})}var J=r(65295),G=r(41641),$=r(4198),X=r(88377),Y=r(1597),K=r(31346),q=r(80539),Z=r(66798),Q=r(58579),ee=r(15347),et=r(42661);let er=()=>{let[e,t]=(0,a.useState)(!1),[r,l]=(0,a.useState)(!1),[o,i]=(0,a.useState)(!1),d=(0,a.useRef)(null),{output:c,outputJson:u,addMessage:m,outputToolCalls:p}=E();(0,a.useEffect)(()=>
1{if(d.current){let e=d.current;e.scrollTop=e.scrollHeight}},[c]);let x=(0,s.jsx)(O.A,{className:"h-2 w-2"}),f=(0,s.jsx)(Z.A,{className:"h-2 w-2"}),h=(0,s.jsx)(J.A,{className:"h-2 w-2"}),y=c||p.length?(0,s.jsxs)("div",{className:"absolute right-3 top-2 flex space-x-1 opacity-50",children:[(0,s.jsx)(n.$,{size:"icon",variant:o?"default":"secondary",onClick:()=>{i(e=>!e)},title:"Toggle Input/Output JSON",children:(0,s.jsx)(Q.A,{size:15})}),(0,s.jsx)(n.$,{size:"icon",variant:"secondary",onClick:e?void 0:()=>{t(!0);let e=o?u:c;(0,et.e)(e),setTimeout(()=>t(!1),1e3)},title:"Copy output",children:e?x:f}),(0,s.jsxs)(n.$,{className:"flex items-center gap-1 whitespace-nowrap p-0 px-1",variant:"secondary",onClick:r?void 0:()=>{l(!0),p.length>0?m({type:S.ChatMessageType.AssistantToolCall,role:S.ChatMessageRole.Assistant,content:c,toolCalls:p}):m({type:S.ChatMessageType.AssistantText,role:S.ChatMessageRole.Assistant,content:c}),setTimeout(()=>l(!1),1e3)},title:"Add as assistant message",disabled:r,children:[r?x:h,(0,s.jsx)("span",{className:"text-xs",children:"Add to messages"})]})]}):null;return(0,s.jsx)("div",{className:"relative h-full","data-sentry-component":"GenerationOutput","data-sentry-source-file":"GenerationOutput.tsx",children:(0,s.jsxs)("div",{className:"h-full overflow-auto rounded-lg bg-muted",ref:d,children:[(0,s.jsx)("div",{className:"sticky top-0 z-10 bg-muted p-3",children:(0,s.jsxs)("div",{className:"flex w-full items-center",children:[(0,s.jsx)("p",{className:"flex-1 text-xs font-semibold",children:"Output"}),y]})}),(0,s.jsxs)("div",{className:"px-4",children:[(0,s.jsx)("pre",{className:"whitespace-break-spaces break-words text-xs",children:o?u:c}),p.length>0?p.map(e=>(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(ee.D,{toolCall:e})},e.id)):null]})]})})};var es=r(6838),ea=r(16758);let en=e=>(0,s.jsxs)("div",{className:"flex h-full flex-col space-y-4 pr-4 pt-2","data-sentry-component":"Messages","data-sentry-source-file":"Messages.tsx",children:[(0,s.jsxs)(ea.HK,{direction:"vertical","data-sentry-element":"ResizablePanelGroup","data-sentry-source-file":"Messages.tsx",children:[(0,s.jsx)(ea.wV,{minSize:10,"data-sentry-element":"ResizablePanel","data-sentry-source-file":"Messages.tsx",children:(0,s.jsx)(es.t,{...e,"data-sentry-element":"ChatMessages","data-sentry-source-file":"Messages.tsx"})}),(0,s.jsx)(ea.WM,{withHandle:!0,className:"bg-transparent","data-sentry-element":"ResizableHandle","data-sentry-source-file":"Messages.tsx"}),(0,s.jsx)(ea.wV,{minSize:20,defaultSize:20,className:"flex flex-col space-y-4","data-sentry-element":"ResizablePanel","data-sentry-source-file":"Messages.tsx",children:(0,s.jsx)(er,{"data-sentry-element":"GenerationOutput","data-sentry-source-file":"Messages.tsx"})})]}),(0,s.jsx)(el,{"data-sentry-element":"SubmitButton","data-sentry-source-file":"Messages.tsx"})]}),el=()=>{let{handleSubmit:e,isStreaming:t}=E(),r="true"===T._.NEXT_PUBLIC_LANGFUSE_PLAYGROUND_STREAMING_ENABLED_DEFAULT,[a,l]=(0,q.A)("langfuse-playground-streaming",r);return(0,s.jsxs)("div",{className:"flex items-center gap-2","data-sentry-component":"SubmitButton","data-sentry-source-file":"Messages.tsx",children:[(0,s.jsx)(n.$,{className:"flex-1",onClick:()=>{e(a).catch(e=>console.error(e))},loading:t,"data-sentry-element":"Button","data-sentry-source-file":"Messages.tsx",children:(0,s.jsx)("p",{children:"Submit"})}),(0,s.jsxs)(X.rI,{"data-sentry-element":"DropdownMenu","data-sentry-source-file":"Messages.tsx",children:[(0,s.jsx)(X.ty,{asChild:!0,"data-sentry-element":"DropdownMenuTrigger","data-sentry-source-file":"Messages.tsx",children:(0,s.jsx)(n.$,{variant:"ghost",size:"icon",className:"h-8 w-8 focus:outline-none focus:ring-0 focus-visible:ring-0",disabled:t,"data-sentry-element":"Button","data-sentry-source-file":"Messages.tsx",children:(0,s.jsx)(K.A,{className:"h-4 w-4","data-sentry-element":"Settings","data-sentry-source-file":"Messages.tsx"})})}),(0,s.jsx)(X.SQ,{align:"end",className:"w-52","data-sentry-element":"DropdownMenuContent","data-sentry-source-file":"Messages.tsx",children:(0,s.jsxs)(X._2,{className:"flex cursor-pointer items-center justify-between py-2.5",onClick:e=>e.preventDefault(),"data-sentry-element":"DropdownMenuItem","data-sentry-source-file":"Messages.tsx",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"font-medium",children:"Stream responses"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:a?"Real-time response streaming":"C
1omplete response at once"})]}),(0,s.jsx)(Y.d,{checked:a,onCheckedChange:l,"data-sentry-element":"Switch","data-sentry-source-file":"Messages.tsx"})]})})]})]})};var eo=r(67716),ei=r(18254),ed=r(21);let ec=(0,o.A)("variable",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);var eu=r(76838),em=r(17982),ep=r(9686),ex=r(17020),ef=r(33100),eh=r(16609),ey=r(41454),eg=r(14183),ev=r(10873),ew=r(90270),ej=r(61653);let eN=ey.z.string().regex(/^[a-zA-Z0-9\._-]+$/,"Name must contain only alphanumeric letters, hyphens, periods and underscores").min(1,"Name is required"),eb=ey.z.object({name:eN,description:ey.z.string(),parameters:S.LLMJSONSchema});eb.extend({projectId:ey.z.string()}),eb.extend({id:ey.z.string(),projectId:ey.z.string()}),ey.z.object({id:ey.z.string(),projectId:ey.z.string()});var eC=r(70478);let eS=ey.Ikc({name:eN,description:ey.YjP().min(1,"Description is required"),parameters:S.JSONSchemaFormSchema}),eT=e=>{var t;let{children:r,projectId:l,onSave:o,existingLlmTool:i}=e,d=W.FH.useUtils(),c=W.FH.llmTools.create.useMutation(),u=W.FH.llmTools.update.useMutation(),m=W.FH.llmTools.delete.useMutation(),[p,f]=(0,a.useState)(!1),h=(0,ex.mN)({resolver:(0,ef.u)(eS),defaultValues:null!=(t=e.defaultValues)?t:{name:"",description:"",parameters:JSON.stringify({type:"object",properties:{},required:[],additionalProperties:!1},null,2)}});async function y(e){let t;t=i?await u.mutateAsync({id:i.id,projectId:l,name:e.name,description:e.description,parameters:JSON.parse(e.parameters)}):await c.mutateAsync({projectId:l,name:e.name,description:e.description,parameters:JSON.parse(e.parameters)}),await d.llmTools.getAll.invalidate({projectId:l}),o(t),f(!1)}async function g(){var t;i&&(await m.mutateAsync({id:i.id,projectId:l}),null==(t=e.onDelete)||t.call(e,i),await d.llmTools.getAll.invalidate({projectId:l}),f(!1))}(0,a.useEffect)(()=>{i&&!e.defaultValues&&h.reset({name:i.name,description:i.description,parameters:JSON.stringify(i.parameters,null,2)})},[i,h,e.defaultValues]);let v=()=>{try{let e=h.getValues("parameters"),t=JSON.parse(e),r=JSON.stringify(t,null,2);h.setValue("parameters",r)}catch(e){(0,x.N)("Failed to prettify JSON","Please verify your input is valid JSON","WARNING")}};return(0,s.jsxs)(eg.lG,{open:p,onOpenChange:f,"data-sentry-element":"Dialog","data-sentry-component":"CreateOrEditLLMToolDialog","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx",children:[(0,s.jsx)(eg.zM,{asChild:!0,onClick:e=>e.stopPropagation(),"data-sentry-element":"DialogTrigger","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx",children:r}),(0,s.jsxs)(eg.Cf,{className:"flex flex-col sm:min-w-[32rem] md:min-w-[40rem]",onClick:e=>e.stopPropagation(),"data-sentry-element":"DialogContent","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx",children:[(0,s.jsxs)(eg.c7,{"data-sentry-element":"DialogHeader","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx",children:[(0,s.jsx)(eg.L3,{"data-sentry-element":"DialogTitle","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx",children:i?"Edit LLM Tool":"Create LLM Tool"}),(0,s.jsx)(eg.rr,{"data-sentry-element":"DialogDescription","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx",children:"Define a tool for LLM function calling"})]}),(0,s.jsx)(ev.lV,{...h,"data-sentry-element":"Form","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx",children:(0,s.jsxs)("form",{onSubmit:h.handleSubmit(y),className:"grid max-h-full min-h-0 overflow-hidden",children:[(0,s.jsx)(eg.R4,{"data-sentry-element":"DialogBody","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx",children:(0,s.jsxs)("div",{className:"flex-1 space-y-4 overflow-y-auto",children:[(0,s.jsx)(ev.zB,{control:h.control,name:"name",render:e=>{let{field:t}=e;return(0,s.jsxs)(ev.eI,{children:[(0,s.jsx)(ev.lR,{children:"Name"}),(0,s.jsx)(ev.MJ,{children:(0,s.jsx)(ew.p,{placeholder:"e.g., get_weather",...t})}),(0,s.jsx)(ev.C5,{})]})},"data-sentry-element":"FormField","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx"}),(0,s.jsx)(ev.zB,{control:h.control,name:"description",render:e=>{let{field:t}=e;return(0,s.jsxs)(ev.eI,{children:[(0,s.jsx)(ev.lR,{children:"Description"}),(0,s.jsx)(ev.Rr,{children:"This description will be sent to the LLM to help it understand the tool's purpose and functionality."}),(0,s.jsx)(ev.MJ,{children:(0,s.jsx)(ej.T,{placeholder:"Describe the tool's purpose and usage",className:"max-h-[120px] focus:ring-0 focus:ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0",...t,onKeyDown:e=>{e.stopPropagation()}})}),(0,s.jsx)(ev.C5,{})]})},"data-sentry-element":"FormField","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx"}),(0,s.jsx)(ev.zB,{control:h.control,name:"parameters",render:e=>{let{field:t}=e;return(0,s.jsxs)(ev.eI,{children:[(0,s.jsx)(ev.lR,{children:"Parameters (JSON Schema)"}),(0,s.jsxs)(ev.Rr,{children:["Define the structure of your tool parameters using JSON Schema format."," ",(0,s.jsxs)("a",{href:"https://json-schema.org/learn/miscellaneous-examples",target:"_blank",rel:"noopener noreferrer",className:"flex items-center",children:["See JSON Schema examples here",(0,s.jsx)(eh.A,{className:"h-3 w-3"})]})]}),(0,s.jsx)(ev.MJ,{children:(0,s.jsxs)("div",{className:"relative flex flex-col gap-1",children:[(0,s.jsx)(eC.g,{value:t.value,onChange:t.onChange,mode:"json",minHeight:200,className:"max-h-[25vh]"}),(0,s.jsx)(n.$,{type:"button",variant:"outline",size:"sm",onClick:v,className:"absolute right-3 top-3 text-xs",children:"Prettify"})]})}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Parameters must be a valid JSON Schema object"}),(0,s.jsx)(ev.C5,{})]})},"data-sentry-element":"FormField","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx"})]})}),(0,s.jsx)(eg.Es,{className:"sticky bottom-0 mt-4 flex flex-col gap-2 border-t bg-background pt-4","data-sentry-element":"DialogFooter","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Note: Changes to tools are reflected to all members of this project."}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[i&&(0,s.jsx)(n.$,{type:"button",variant:"destructive",onClick:g,className:"mr-auto",children:"Delete"}),(0,s.jsx)(n.$,{type:"button",variant:"outline",onClick:()=>f(!1),"data-sentry-element":"Button","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx",children:"Cancel"}),(0,s.jsx)(n.$,{type:"submit","data-sentry-element":"Button","data-sentry-source-file":"CreateOrEditLLMToolDialog.tsx",children:"Save"})]})]})})]})})]})]})};var ek=r(95266);let eA=()=>{let{setTools:e}=E(),t=(0,C.A)(),{data:r=[]}=W.FH.llmTools.getAll.useQuery({projectId:t},{enabled:!!t,staleTime:3e5}),a=t=>{e(e=>{let r=-1;if(-1===(r=e.findIndex(e=>e.id===t.id))){let s=e.findIndex(e=>e.name===t.name);-1!==s&&(r=s)}let s={id:t.id,name:t.name,description:t.description,parameters:t.parameters,existingLlmTool:t};if(-1!==r){let t=[...e];return t[r]=s,t}return[...e,s]})};return(0,s.jsxs)(ek.uB,{className:"flex flex-col","data-sentry-element":"Command","data-sentry-component":"PlaygroundToolsPopover","data-sentry-source-file":"index.tsx",children:[(0,s.jsx)(ek.G7,{placeholder:"Search tools...",className:"h-8 border-none py-1 pl-6 pr-1 focus:ring-0 focus:ring-offset-0","data-sentry-element":"CommandInput","data-sentry-source-file":"index.tsx"}),(0,s.jsxs)(ek.oI,{className:"max-h-[300px] overflow-y-auto","data-sentry-element":"CommandList","data-sentry-source-file":"index.tsx",children:[(0,s.jsx)(ek.xL,{"data-sentry-element":"CommandEmpty","data-sentry-source-file":"index.tsx",children:"No tools found."}),(0,s.jsx)(ek.L$,{"data-sentry-element":"CommandGroup","data-sentry-source-file":"index.tsx",children:r.map(r=>(0,s.jsxs)(ek.h_,{value:r.name,onSelect:()=>a(r),className:"flex items-center justify-between px-1 py-2",children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,s.jsx)(ei.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"truncate font-medium",title:r.name,children:r.name}),(0,s.jsx)("div",{className:"line-clamp-1 text-xs text-muted-foreground",children:r.description})]})]}),(0,s.jsx)(eT,{projectId:t,onSave:a,onDelete:()=>{var t;return t=r.id,void e(e=>e.filter(e=>e.id!==t))},existingLlmTool:r,children:(0,s.jsx)(n.$,{variant:"ghost",size:"icon",className:"ml-2 h-7 w-7 shrink-0",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(em.A,{className:"h-3.5 w-3.5"})})})]},r.id))}),(0,s.jsx)(ek.fx,{"data-sentry-element":"CommandSeparator","data-sentry-source-file":"index.tsx"})]}),(0,s.jsx)("div",{className:"mt-auto p-1",children:(0,s.jsx)(eT,{projectId:t,onSave:a,"data-sentry-element":"CreateOrEditLLMToolDialog","data-sentry-source-file":"index.tsx",children:(0,s.jsxs)(n.$,{variant:"outline",size:"default",className:"w-full","data-sentry-element":"Button","data-sentry-source-file":"index.tsx",children:[(0,s.jsx)(J.A,{className:"mr-2 h-4 w-4","data-sentry-element":"PlusIcon","data-sentry-source-file":"index.tsx"}),"Create new tool"]})})})]})},eE=()=>{let{tools:e,setTools:t}=E(),r=(0,C.A)(),{data:l=[]}=W.FH.llmTools.getAll.useQuery({projectId:r},{enabled:!!r,staleTime:3e5}),o=(0,a.useCallback)(e=>l.some(t=>t.id===e.id&&t.description===e.description&&JSON.stringify(t.parameters)===JSON.stringify(e.parameters)),[l]);(0,a.useEffect)(()=>{e.forEach((r,s)=>{if(!r.existingLlmTool){let a=l.find(e=>e.name===r.name);if(a){let n=[...e];n[s]={...r,id:a.id,existingLlmTool:a},t(n)}}})},[l,e,t]);let i=e=>{t(t=>{let r=-1;if(-1===(r=t.findIndex(t=>t.id===e.id))){let s=t.findIndex(t=>t.name===e.name);-1!==s&&(r=s)}let s={id:e.id,name:e.name,description:e.description,parameters:e.parameters,existingLlmTool:e};if(-1!==r){let e=[...t];return e[r]=s,e}return[...t,s]})},d=e=>{t(t=>t.filter(t=>t.id!==e))};return(0,s.jsx)(eu.F,{className:"h-full","data-sentry-element":"ScrollArea","data-sentry-component":"PlaygroundTools","data-sentry-source-file":"index.tsx",children:0===e.length?(0,s.jsx)("div",{className:"flex h-16 flex-col items-center justify-center p-4 text-center",children:(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"No tools attached."})}):(0,s.jsx)("div",{className:"space-y-1",children:e.map(e=>(0,s.jsx)(eT,{projectId:r,onSave:i,onDelete:()=>d(e.id),existingLlmTool:e.existingLlmTool,defaultValues:o(e)?void 0:{name:e.name,description:e.description,parameters:JSON.stringify(e.parameters,null,2)},children:(0,s.jsxs)("div",{className:"cursor-pointer overflow-hidden rounded-md border bg-background p-2 transition-colors duration-200 hover:bg-accent/50",children:[(0,s.jsxs)("div",{className:"mb-1 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-1",children:[(0,s.jsx)(ei.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,s.jsx)("h3",{className:"truncate text-sm font-medium",title:e.name,children:e.name}),o(e)?null:(0,s.jsx)("span",{className:"shrink-0 rounded bg-muted px-1 py-0.5 text-xs text-muted-foreground",children:"Unsaved"})]}),(0,s.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:(0,s.jsx)(n.$,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:t=>{t.stopPropagation(),t.preventDefault(),d(e.id)},children:(0,s.jsx)(ep.A,{className:"h-4 w-4"})})})]}),(0,s.jsx)("p",{className:"line-clamp-2 break-all text-xs text-muted-foreground",title:e.description,children:e.description})]})},e.id))})})},eP=(0,o.A)("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);var eM=r(95296);let eL=()=>{let{structuredOutputSchema:e,setStructuredOutputSchema:t}=E(),r=(0,C.A)(),{data:l=[]}=W.FH.llmSchemas.getAll.useQuery({projectId:r},{enabled:!!r,staleTime:3e5}),o=(0,a.useCallback)(e=>l.some(t=>t.id===e.id&&t.description===e.description&&JSON.stringify(t.schema)===JSON.stringify(e.schema)),[l]),i=r=>
1{e&&e.id===r.id?t({...e,name:r.name,description:r.description,schema:r.schema,existingLlmSchema:r}):(e&&e.name===r.name&&o(e),t({id:r.id,name:r.name,description:r.description,schema:r.schema,existingLlmSchema:r}))};return(0,s.jsxs)(ek.uB,{className:"flex flex-col","data-sentry-element":"Command","data-sentry-component":"StructuredOutputSchemaPopover","data-sentry-source-file":"StructuredOutputSchemaSection.tsx",children:[(0,s.jsx)(ek.G7,{placeholder:"Search schemas...",className:"h-8 border-none py-1 pl-6 pr-1 focus:ring-0 focus:ring-offset-0","data-sentry-element":"CommandInput","data-sentry-source-file":"StructuredOutputSchemaSection.tsx"}),(0,s.jsxs)(ek.oI,{className:"max-h-[300px] overflow-y-auto","data-sentry-element":"CommandList","data-sentry-source-file":"StructuredOutputSchemaSection.tsx",children:[(0,s.jsx)(ek.xL,{"data-sentry-element":"CommandEmpty","data-sentry-source-file":"StructuredOutputSchemaSection.tsx",children:"No schemas found."}),(0,s.jsx)(ek.L$,{"data-sentry-element":"CommandGroup","data-sentry-source-file":"StructuredOutputSchemaSection.tsx",children:l.map(e=>(0,s.jsxs)(ek.h_,{value:e.name,onSelect:()=>i(e),className:"flex items-center justify-between px-1 py-2",children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,s.jsx)(eP,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"truncate font-medium",children:e.name}),(0,s.jsx)("div",{className:"line-clamp-1 text-xs text-muted-foreground",children:e.description})]})]}),(0,s.jsx)(eM._,{projectId:r,onSave:i,onDelete:()=>void t(null),existingLlmSchema:e,children:(0,s.jsx)(n.$,{variant:"ghost",size:"icon",className:"ml-2 h-7 w-7 shrink-0",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(em.A,{className:"h-3.5 w-3.5"})})})]},e.id))}),(0,s.jsx)(ek.fx,{"data-sentry-element":"CommandSeparator","data-sentry-source-file":"StructuredOutputSchemaSection.tsx"})]}),(0,s.jsx)("div",{className:"mt-auto p-1",children:(0,s.jsx)(eM._,{projectId:r,onSave:i,"data-sentry-element":"CreateOrEditLLMSchemaDialog","data-sentry-source-file":"StructuredOutputSchemaSection.tsx",children:(0,s.jsxs)(n.$,{variant:"outline",size:"default",className:"w-full","data-sentry-element":"Button","data-sentry-source-file":"StructuredOutputSchemaSection.tsx",children:[(0,s.jsx)(J.A,{className:"mr-2 h-4 w-4","data-sentry-element":"PlusIcon","data-sentry-source-file":"StructuredOutputSchemaSection.tsx"}),"Create new schema"]})})})]})},eD=()=>{let{structuredOutputSchema:e,setStructuredOutputSchema:t}=E(),r=(0,C.A)(),{data:l=[]}=W.FH.llmSchemas.getAll.useQuery({projectId:r},{enabled:!!r,staleTime:3e5}),o=(0,a.useCallback)(e=>l.some(t=>t.id===e.id&&t.description===e.description&&JSON.stringify(t.schema)===JSON.stringify(e.schema)),[l]);(0,a.useEffect)(()=>{if(e&&!e.existingLlmSchema){let r=l.find(t=>t.name===e.name);r&&t({...e,id:r.id,existingLlmSchema:r})}},[l,e,t]);let i=()=>{t(null)};return(0,s.jsx)(eu.F,{className:"h-full","data-sentry-element":"ScrollArea","data-sentry-component":"StructuredOutputSchemaSection","data-sentry-source-file":"StructuredOutputSchemaSection.tsx",children:e?(0,s.jsx)("div",{className:"space-y-1",children:(0,s.jsx)(eM._,{projectId:r,onSave:r=>{e&&e.id===r.id?t({...e,name:r.name,description:r.description,schema:r.schema,existingLlmSchema:r}):(e&&e.name===r.name&&o(e),t({id:r.id,name:r.name,description:r.description,schema:r.schema,existingLlmSchema:r}))},onDelete:()=>i(),existingLlmSchema:e.existingLlmSchema,defaultValues:o(e)?void 0:{name:e.name,description:e.description,schema:JSON.stringify(e.schema,null,2)},children:(0,s.jsxs)("div",{className:"cursor-pointer overflow-hidden rounded-md border bg-background p-2 transition-colors duration-200 hover:bg-accent/50",children:[(0,s.jsxs)("div",{className:"mb-1 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-1",children:[(0,s.jsx)(eP,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,s.jsx)("h3",{className:"truncate text-sm font-medium",title:e.name,children:e.name}),o(e)?null:(0,s.jsx)("span",{className:"shrink-0 rounded bg-muted px-1 py-0.5 text-xs text-muted-foreground",children:"Unsaved"})]}),(0,s.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:(0,s.jsx)(n.$,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:e=>{e.stopPropagation(),e.preventDefault(),i()},children:(0,s.jsx)(ep.A,{className:"h-4 w-4"})})})]}),(0,s.jsx)("p",{className:"line-clamp-2 break-all text-xs text-muted-foreground",title:e.description,children:e.description})]})})}):(0,s.jsx)("div",{className:"flex h-16 flex-col items-center justify-center p-4 text-center",children:(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"No schema provided."})})})};
1var e_=r(62766),eI=r(64710),eO=r(27427),eR=r(55247);let eB=(e,t)=>(0,a.useMemo)(()=>{let r=e.map(e=>e.name),s=t.map(e=>e.name),a=r.filter(e=>s.includes(e));return{hasConflicts:a.length>0,conflictingNames:a,isVariableConflicting:e=>a.includes(e),isPlaceholderConflicting:e=>a.includes(e)}},[e,t]),ez=e=>{let{promptVariable:t}=e,{updatePromptVariableValue:r,deletePromptVariable:a,promptVariables:l,messagePlaceholders:o}=E(),{name:i,value:d,isUsed:c}=t,{isVariableConflicting:u}=eB(l,o),m=u(i),p=c?(0,s.jsx)(eI.A,{size:16,color:"green"}):(0,s.jsx)(eO.A,{size:16,color:"grey"});return(0,s.jsxs)("div",{className:"p-1","data-sentry-component":"PromptVariableComponent","data-sentry-source-file":"PromptVariableComponent.tsx",children:[(0,s.jsxs)("div",{className:"mb-1 flex flex-row items-center",children:[(0,s.jsxs)("span",{className:"flex flex-1 flex-row space-x-2 text-xs",children:[(0,s.jsx)("p",{title:c?"Variable is in use":"Variable is not in use",children:p}),(0,s.jsx)("p",{className:"min-w-[90px] truncate font-mono ".concat(m?"text-red-500":""),title:i,children:i})]}),(0,s.jsx)(n.$,{variant:"ghost",size:"icon",title:"Delete variable",disabled:c,onClick:()=>{a(i)},className:"p-0","data-sentry-element":"Button","data-sentry-source-file":"PromptVariableComponent.tsx",children:!c&&(0,s.jsx)(eR.A,{size:16})})]}),(0,s.jsx)(eC.g,{value:d,onChange:e=>{r(i,e)},mode:"prompt",className:"max-h-[10rem] w-full resize-y p-1 font-mono text-xs focus:outline-none ".concat(m?"border border-red-500":""),editable:!0,lineNumbers:!1,placeholder:i,"data-sentry-element":"CodeMirrorEditor","data-sentry-source-file":"PromptVariableComponent.tsx"}),m&&(0,s.jsx)("p",{className:"mt-1 text-xs text-red-500",children:"Variable name conflicts with placeholder. Names must be unique."})]})},eW=()=>{let{promptVariables:e}=E();return(0,s.jsx)("div",{className:"flex h-full flex-col","data-sentry-component":"Variables","data-sentry-source-file":"Variables.tsx",children:0===e.length?(0,s.jsxs)("div",{className:"text-xs","data-sentry-component":"renderNoVariables","data-sentry-source-file":"Variables.tsx",children:[(0,s.jsx)("p",{className:"mb-2",children:"No variables defined."}),(0,s.jsx)("p",{children:"Use double curly braces in your prompts to add a variable: {{exampleVariable}}"})]}):(0,s.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden","data-sentry-component":"renderVariables","data-sentry-source-file":"Variables.tsx",children:e.slice().sort((e,t)=>e.isUsed&&!t.isUsed?-1:!e.isUsed&&t.isUsed?1:e.name.localeCompare(t.name)).map((t,r)=>(0,s.jsxs)("div",{children:[(0,s.jsx)(ez,{promptVariable:t}),r!==e.length-1&&(0,s.jsx)(e_.w,{className:"my-2"})]},t.name))})})},eU=e=>{let{messagePlaceholder:t}=e,{updateMessagePlaceholderValue:r,deleteMessagePlaceholder:l,promptVariables:o,messagePlaceholders:i}=E(),{name:d,value:c,isUsed:u}=t,[m,p]=(0,a.useState)(null),{isPlaceholderConflicting:x}=eB(o,i),f=x(d),h=(0,a.useCallback)(e=>{try{let t=""===e.trim()?[]:JSON.parse(e);if(!Array.isArray(t))return void p("Input must be an array of objects");if(!t.every(e=>"object"==typeof e&&null!==e&&!Array.isArray(e)))return void p("All items must be objects");r(d,t),p(null)}catch(e){p("Invalid JSON format")}},[d,r]),y=u?eI.A:eO.A;return(0,s.jsxs)("div",{className:"p-1","data-sentry-component":"MessagePlaceholderComponent","data-sentry-source-file":"MessagePlaceholderComponent.tsx",children:[(0,s.jsxs)("div",{className:"mb-1 flex flex-row items-center",children:[(0,s.jsxs)("span",{className:"flex flex-1 flex-row space-x-2 text-xs",children:[(0,s.jsx)(y,{size:16,color:u?"green":"grey","data-sentry-element":"UsedIcon","data-sentry-source-file":"MessagePlaceholderComponent.tsx"}),(0,s.jsx)("p",{className:"min-w-[90px] truncate font-mono ".concat(f?"text-red-500":""),title:d,children:d||"Unnamed placeholder"})]}),(0,s.jsx)(n.$,{variant:"ghost",size:"icon",title:"Delete placeholder",disabled:u,onClick:()=>l(d),className:"p-0","data-sentry-element":"Button","data-sentry-source-file":"MessagePlaceholderComponent.tsx",children:!u&&(0,s.jsx)(eR.A,{size:16})})]}),(0,s.jsx)(eC.g,{value:0===c.length?'[\n  {\n    "role": "",\n    "content": ""\n  }\n]':JSON.stringify(c,null,2),onChange:h,mode:"json",className:"max-h-[15rem] w-full resize-y p-1 font-mono text-xs focus:outline-none ".concat(f?"border border-red-500":""),editable:!0,lineNumbers:!1,placeholder:'[\n  {\n    "role": "user",\n    "content": "Hello!"\n  },\n  {\n    "role": "assistant",\n    "content": "Hi there!"\n  }\n]',"data-sentry-element":"CodeMirrorEditor","data-sentry-source-file":"MessagePlaceholderComponent.tsx"}),f&&(0,s.jsx)("p",{className:"mt-1 text-xs text-red-500",children:"Placeholder name conflicts with variable. Names must be unique."}),m&&(0,s.jsx)("p",{className:"mt-1 text-xs text-red-500",children:m})]})},eV=()=>{let{messagePlaceholders:e}=E();return(0,s.jsx)("div",{className:"flex h-full flex-col","data-sentry-component":"MessagePlaceholders","data-sentry-source-file":"MessagePlaceholders.tsx",children:0===e.length?(0,s.jsxs)("div",{className:"text-xs",children:[(0,s.jsx)("p",{className:"mb-2",children:"No message placeholders defined."}),(0,s.jsx)("p",{children:"Placeholders can be used to e.g. inject message histories into prompts."})]}):(0,s.jsx)("div",{className:"h-full overflow-auto",children:e.slice().sort((e,t)=>
1e.isUsed&&!t.isUsed?-1:!e.isUsed&&t.isUsed?1:e.name.localeCompare(t.name)).map((t,r)=>(0,s.jsxs)("div",{children:[(0,s.jsx)(eU,{messagePlaceholder:t}),r!==e.length-1&&(0,s.jsx)(e_.w,{className:"my-2"})]},t.name))})})},eH=()=>{let{containerRef:e,isVeryCompact:t,isCompact:r}=(()=>{let[e,t]=(0,a.useState)(0),r=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=r.current;if(!e)return;let s=new ResizeObserver(e=>{for(let r of e)t(r.contentRect.width)});return s.observe(e),()=>{s.disconnect()}},[]),{containerRef:r,width:e,isVeryCompact:e<423,isCompact:e<460}})(),{tools:l,structuredOutputSchema:o,promptVariables:i,messagePlaceholders:d}=E(),c=l.length,u=+!!o,m=i.length+d.length,p=(e,a,n)=>t?(0,s.jsx)(a,{className:"h-3 w-3"}):r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a,{className:"h-3 w-3"}),(0,s.jsx)("span",{className:"text-sm",children:null!=n?n:e})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a,{className:"h-3 w-3","data-sentry-element":"IconComponent","data-sentry-source-file":"ConfigurationDropdowns.tsx"}),(0,s.jsx)("span",{className:"text-sm",children:e})]});return(0,s.jsx)("div",{ref:e,className:"flex-shrink-0 border-b bg-muted/25 px-3 py-2","data-sentry-component":"ConfigurationDropdowns","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:(0,s.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[(0,s.jsxs)(B.AM,{"data-sentry-element":"Popover","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:[(0,s.jsx)(B.Wv,{asChild:!0,"data-sentry-element":"PopoverTrigger","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:(0,s.jsxs)(n.$,{variant:"outline",size:"sm",className:"h-8 gap-2","data-sentry-element":"Button","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:[p("Tools",ei.A),c>0&&(0,s.jsx)(eo.E,{variant:"secondary",className:"h-4 text-xs",children:c}),(0,s.jsx)(ed.A,{className:"h-3 w-3","data-sentry-element":"ChevronDown","data-sentry-source-file":"ConfigurationDropdowns.tsx"})]})}),(0,s.jsxs)(B.hl,{className:"w-80 p-4",align:"start","data-sentry-element":"PopoverContent","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:[(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("h4",{className:"mb-1 text-sm font-medium",children:"Tools"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Configure tools for your model to use."})]}),c>0?(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)(eE,{})}):(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"No tools attached."})}),(0,s.jsx)("div",{className:"border-t pt-3",children:(0,s.jsx)(eA,{"data-sentry-element":"PlaygroundToolsPopover","data-sentry-source-file":"ConfigurationDropdowns.tsx"})})]})]}),(0,s.jsxs)(B.AM,{"data-sentry-element":"Popover","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:[(0,s.jsx)(B.Wv,{asChild:!0,"data-sentry-element":"PopoverTrigger","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:(0,s.jsxs)(n.$,{variant:"outline",size:"sm",className:"h-8 gap-2","data-sentry-element":"Button","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:[p("Schema",Q.A),u>0&&(0,s.jsx)(eo.E,{variant:"secondary",className:"h-4 text-xs",children:u}),(0,s.jsx)(ed.A,{className:"h-3 w-3","data-sentry-element":"ChevronDown","data-sentry-source-file":"ConfigurationDropdowns.tsx"})]})}),(0,s.jsxs)(B.hl,{className:"w-80 p-4",align:"start","data-sentry-element":"PopoverContent","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:[(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("h4",{className:"mb-1 text-sm font-medium",children:"Structured Output"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Configure JSON schema for structured output."})]}),o?(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)(eD,{})}):(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"No schema provided."})}),(0,s.jsx)("div",{className:"border-t pt-3",children:(0,s.jsx)(eL,{"data-sentry-element":"StructuredOutputSchemaPopover","data-sentry-source-file":"ConfigurationDropdowns.tsx"})})]})]}),(0,s.jsxs)(B.AM,{"data-sentry-element":"Popover","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:[(0,s.jsx)(B.Wv,{asChild:!0,"data-sentry-element":"PopoverTrigger","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:(0,s.jsxs)(n.$,{variant:"outline",size:"sm",className:"h-8 gap-2","data-sentry-element":"Button","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:[p("Variables",ec,"Vars"),m>0&&(0,s.jsx)(eo.E,{variant:"secondary",className:"h-4 text-xs",children:m}),(0,s.jsx)(ed.A,{className:"h-3 w-3","data-sentry-element":"ChevronDown","data-sentry-source-file":"ConfigurationDropdowns.tsx"})]})}),(0,s.jsxs)(B.hl,{className:"w-80 p-4",align:"start","data-sentry-element":"PopoverContent","data-sentry-source-file":"ConfigurationDropdowns.tsx",children:[(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("h4",{className:"mb-1 text-sm font-medium",children:"Variables & Message Placeholders"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Configure variables and message placeholders for your prompts."})]}),m>0?(0,s.jsx)("div",{className:"mb-3",style:{maxHeight:"50vh",overflowY:"auto"},children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h5",{className:"mb-2 text-xs font-medium",children:"Variables"}),(0,s.jsx)(eW,{})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h5",{className:"mb-2 text-xs font-medium",children:"Message Placeholders"}),(0,s.jsx)(eV,{})]})]})}):(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"No variables or message placeholders defined."})})]})]})]})})};var eF=r(96916);function eJ(e){let{windowState:t,onRemoveWindow:r,onAddWindow:n}
1=e,l=(0,a.useRef)(null),o=(0,a.useRef)(t.windowIds.length),i=(0,eF.a)(),d=(0,a.useMemo)(()=>{let e=p.y.MIN_WINDOW_WIDTH,r=t.windowIds.length;return"minmax(".concat(e,"px, ").concat("".concat(100/r,"%"),")")},[t.windowIds.length]);(0,a.useEffect)(()=>{let e=t.windowIds.length;e>o.current&&l.current&&l.current.scrollTo({left:l.current.scrollWidth,behavior:"smooth"}),o.current=e},[t.windowIds.length]);let c=(0,a.useCallback)(e=>{n(e)},[n]);return t.windowIds[0]?(0,s.jsx)("div",{ref:l,className:"flex h-full flex-1 overflow-x-auto md:grid",style:{gridAutoFlow:"column",gridAutoColumns:d,gap:"1rem",padding:"1rem",scrollBehavior:"smooth"},"data-sentry-component":"MultiWindowPlayground","data-sentry-source-file":"MultiWindowPlayground.tsx",children:t.windowIds.map((e,a)=>(0,s.jsx)("div",{className:0===a?"flex-1":"hidden md:block",children:(0,s.jsx)(P,{windowId:e,children:(0,s.jsx)(eG,{windowId:e,onRemove:r,onCopy:c,canRemove:t.windowIds.length>1,isMobile:i})})},e))}):null}function eG(e){let{windowId:t,onRemove:r,onCopy:l,canRemove:o,isMobile:i}=e,d=E(),c=(0,a.useCallback)(()=>{r(t)},[t,r]),u=(0,a.useCallback)(()=>{l(t)},[t,l]);return(0,s.jsxs)("div",{className:"playground-window flex h-full min-w-0 flex-col rounded-lg border bg-background shadow-sm @container","data-sentry-component":"PlaygroundWindowContent","data-sentry-source-file":"MultiWindowPlayground.tsx",children:[(0,s.jsx)("div",{className:"relative flex-shrink-0 border-b bg-muted/50 px-3 py-1",children:(0,s.jsxs)("div",{className:"flex items-center pr-32 @xl:pr-96",children:[(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsx)($.s,{...d,layout:"compact","data-sentry-element":"ModelParameters","data-sentry-source-file":"MultiWindowPlayground.tsx"})}),(0,s.jsx)("div",{className:"absolute right-3 top-1/2 flex -translate-y-1/2 items-center gap-2",children:(0,s.jsxs)(z.Bc,{delayDuration:300,"data-sentry-element":"TooltipProvider","data-sentry-source-file":"MultiWindowPlayground.tsx",children:[(0,s.jsx)(H,{"data-sentry-element":"SaveToPromptButton","data-sentry-source-file":"MultiWindowPlayground.tsx"}),!i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(z.m_,{children:[(0,s.jsx)(z.k$,{asChild:!0,children:(0,s.jsxs)(n.$,{variant:"outline",onClick:u,className:"h-7 gap-1.5 px-2.5 text-xs @xl:hidden",children:[(0,s.jsx)(J.A,{size:14}),(0,s.jsx)("span",{className:"sr-only",children:"New split window"})]})}),(0,s.jsx)(z.ZI,{className:"text-xs",children:"New split window"})]}),(0,s.jsxs)(n.$,{variant:"outline",onClick:u,className:"hidden h-7 gap-1.5 px-2.5 text-xs @xl:flex",children:[(0,s.jsx)(J.A,{size:14}),(0,s.jsx)("span",{children:"New split window"})]})]}),o&&(0,s.jsxs)(z.m_,{children:[(0,s.jsx)(z.k$,{asChild:!0,children:(0,s.jsxs)(n.$,{variant:"ghost",onClick:c,className:"h-6 w-6 p-0 hover:bg-destructive/10 hover:text-destructive",children:[(0,s.jsx)(G.A,{size:14}),(0,s.jsx)("span",{className:"sr-only",children:"Remove window"})]})}),(0,s.jsx)(z.ZI,{className:"text-xs",children:"Remove window"})]})]})})]})}),(0,s.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,s.jsxs)("div",{className:"flex h-full flex-col",children:[(0,s.jsx)(eH,{"data-sentry-element":"ConfigurationDropdowns","data-sentry-source-file":"MultiWindowPlayground.tsx"}),(0,s.jsx)("div",{className:"flex-1 overflow-auto p-4",children:(0,s.jsx)(en,{...d,"data-sentry-element":"Messages","data-sentry-source-file":"MultiWindowPlayground.tsx"})})]})})]})}var e$=r(36932),eX=r(68389),eY=r.n(eX),eK=r(79071);function eq(e){let{projectId:t}=e;return(0,s.jsx)("div",{className:"p-4","data-sentry-component":"NoModelConfiguredAlert","data-sentry-source-file":"NoModelConfiguredAlert.tsx",children:(0,s.jsxs)(eK.Fc,{variant:"default",className:"border-yellow-500/50 bg-yellow-50 dark:bg-yellow-950/20","data-sentry-element":"Alert","data-sentry-source-file":"NoModelConfiguredAlert.tsx",children:[(0,s.jsx)(e$.A,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500","data-sentry-element":"AlertCircle","data-sentry-source-file":"NoModelConfiguredAlert.tsx"}),(0,s.jsx)(eK.XL,{className:"text-yellow-800 dark:text-yellow-400","data-sentry-element":"AlertTitle","data-sentry-source-file":"NoModelConfiguredAlert.tsx",children:"No Model Configured"}),(0,s.jsxs)(eK.TN,{className:"text-yellow-700 dark:text-yellow-500","data-sentry-element":"AlertDescription","data-sentry-source-file":"NoModelConfiguredAlert.tsx",children:["To use the playground, you need to configure a model first. Go to"," ",(0,s.jsxs)(eY(),{href:"/project/".concat(t,"/settings/llm-connections"),className:"font-medium underline underline-offset-4 hover:text-yellow-900 dark:hover:text-yellow-300","data-sentry-element":"Link","data-sentry-source-file":"NoModelConfiguredAlert.tsx",children:[(0,s.jsx)(K.A,{className:"inline h-3 w-3","data-sentry-element":"Settings","data-sentry-source-file":"NoModelConfiguredAlert.tsx"})," LLM Connection Settings"]}
1)," ","to add an LLM API key and configure your models."]})]})})}function eZ(){var e,t;let r=(0,C.A)(),{windowIds:o,isLoaded:d,addWindowWithCopy:c,removeWindowId:p}=(0,u.V)(),{executeAllWindows:x,getExecutionStatus:f,isExecutingAll:h,hasAnyModelConfigured:v}=y(),w=(0,a.useCallback)(e=>{let t=c(e);t?console.log("Added new window: ".concat(t)):console.warn("Failed to add new window")},[c]),j=(0,a.useCallback)(e=>{p(e)},[p]),N=(0,a.useCallback)(()=>{x()},[x]);if(e=!h,t=async()=>{x()},(0,a.useEffect)(()=>{function r(r){e&&(r.metaKey||r.ctrlKey)&&"Enter"===r.code&&t().catch(e=>console.error(e))}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t]),!d)return(0,s.jsx)(g.A,{withPadding:!1,headerProps:{title:"Playground",help:{description:"A sandbox to test and iterate your prompts across multiple windows",href:"https://langfuse.com/docs/prompt-management/features/playground"}},children:(0,s.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,s.jsx)(l.A,{className:"h-8 w-8 animate-spin"})})});let b=h?f()||"Executing ".concat(o.length," window").concat(1===o.length?"":"s"):f(),S=h||!v;return(0,s.jsx)(g.A,{scrollable:!1,withPadding:!1,headerProps:{title:"Playground",help:{description:"A sandbox to test and iterate your prompts across multiple windows",href:"https://langfuse.com/docs/prompt-management/features/playground"},actionButtonsRight:(0,s.jsxs)("div",{className:"flex flex-nowrap items-center gap-2",children:[(0,s.jsxs)("div",{className:"hidden items-center gap-2 text-sm text-muted-foreground md:flex",children:[(0,s.jsxs)("span",{className:"whitespace-nowrap",children:[o.length," window",1===o.length?"":"s"]}),b&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"hidden sm:inline",children:"•"}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(l.A,{className:"h-3 w-3 animate-spin"}),(0,s.jsx)("span",{className:"hidden whitespace-nowrap sm:inline",children:b})]})]})]}),(0,s.jsxs)(n.$,{variant:"outline",onClick:N,disabled:S,className:"hidden flex-shrink-0 gap-1 md:flex",title:v?"Execute all playground windows simultaneously":"Please configure a model in Project Settings first",children:[h?(0,s.jsx)(l.A,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(i,{className:"h-3 w-3"}),(0,s.jsx)("span",{className:"hidden lg:inline",children:"Run All (Ctrl + Enter)"})]}),(0,s.jsx)(m,{})]})},"data-sentry-element":"Page","data-sentry-component":"PlaygroundPage","data-sentry-source-file":"index.tsx",children:(0,s.jsxs)("div",{className:"flex h-full flex-col",children:[!v&&r&&(0,s.jsx)(eq,{projectId:r}),(0,s.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,s.jsx)(eJ,{windowState:{windowIds:o,isExecutingAll:h},onRemoveWindow:j,onAddWindow:w,"data-sentry-element":"MultiWindowPlayground","data-sentry-source-file":"index.tsx"})})]})})}},36864:e=>{e.exports=function(e){return e.split("")}},40152:(e,t,r)=>{e.exports=r(86955)("toUpperCase")},41944:(e,t,r)=>{var s=r(36864),a=r(86020),n=r(86176);e.exports=function(e){return a(e)?n(e):s(e)}},43592:e=>{e.exports=function(e,t,r){var s=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(r=r>a?a:r)<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var n=Array(a);++s<a;)n[s]=e[s+t];return n}},55247:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(22222).A)("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},58579:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(22222).A)("braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]])},59649:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(22222).A)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]])},60222:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(22222).A)("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])},64710:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(22222).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},65592:(e,t,r)=>{var s=r(86466),a=r(40152);e.exports=function(e){return a(s(e).toLowerCase())}},66449:(e,t,r)=>{"use strict";let s;r.d(t,{A:()=>
1o});let a={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},n=new Uint8Array(16),l=[];for(let e=0;e<256;++e)l.push((e+256).toString(16).slice(1));let o=function(e,t,r){if(a.randomUUID&&!t&&!e)return a.randomUUID();let o=(e=e||{}).random||(e.rng||function(){if(!s&&!(s="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return s(n)})();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=o[e];return t}return function(e,t=0){return l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]}(o)}},76838:(e,t,r)=>{"use strict";r.d(t,{F:()=>o});var s=r(73154),a=r(96810),n=r(90417),l=r(81509);let o=a.forwardRef((e,t)=>{let{className:r,children:a,...o}=e;return(0,s.jsxs)(n.bL,{ref:t,className:(0,l.cn)("relative overflow-hidden",r),...o,children:[(0,s.jsx)(n.LM,{className:"h-full w-full rounded-[inherit]",children:a}),(0,s.jsx)(i,{}),(0,s.jsx)(n.OK,{})]})});o.displayName=n.bL.displayName;let i=a.forwardRef((e,t)=>{let{className:r,orientation:a="vertical",...o}=e;return(0,s.jsx)(n.VM,{ref:t,orientation:a,className:(0,l.cn)("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",r),...o,children:(0,s.jsx)(n.lr,{className:"relative flex-1 rounded-full bg-border"})})});i.displayName=n.VM.displayName},79071:(e,t,r)=>{"use strict";r.d(t,{Fc:()=>i,TN:()=>c,XL:()=>d});var s=r(73154),a=r(96810),n=r(33616),l=r(81509);let o=(0,n.F)("relative w-full rounded-lg border p-3 [&>svg~*]:pl-6 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-3 [&>svg]:top-3 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),i=a.forwardRef((e,t)=>{let{className:r,variant:a,...n}=e;return(0,s.jsx)("div",{ref:t,role:"alert",className:(0,l.cn)(o({variant:a}),r),...n})});i.displayName="Alert";let d=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)("h5",{ref:t,className:(0,l.cn)("mb-1 font-medium leading-none tracking-tight",r),...a})});d.displayName="AlertTitle";let c=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)("div",{ref:t,className:(0,l.cn)("text-sm [&_p]:leading-relaxed",r),...a})});c.displayName="AlertDescription"},86020:e=>{var t=RegExp("[\\u200d\ud800-\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return t.test(e)}},86176:e=>{var t="\ud800-\udfff",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",s="\ud83c[\udffb-\udfff]",a="[^"+t+"]",n="(?:\ud83c[\udde6-\uddff]){2}",l="[\ud800-\udbff][\udc00-\udfff]",o="(?:"+r+"|"+s+")?",i="[\\ufe0e\\ufe0f]?",d="(?:\\u200d(?:"+[a,n,l].join("|")+")"+i+o+")*",c=RegExp(s+"(?="+s+")|"+("(?:"+[a+r+"?",r,n,l,"["+t+"]"].join("|"))+")"+(i+o+d),"g");e.exports=function(e){return e.match(c)||[]}},86955:(e,t,r)=>{var s=r(16594),a=r(86020),n=r(41944),l=r(86466);e.exports=function(e){return function(t){var r=a(t=l(t))?n(t):void 0,o=r?r[0]:t.charAt(0),i=r?s(r,1).join(""):t.slice(1);return o[e]()+i}}},89978:(e,t,r)=>{"use strict";r.d(t,{V:()=>i});var s=r(96810),a=r(66449),n=r(9476),l=r(47805),o=r(54433);function i(){let[e,t]=(0,s.useState)([]),[r,i]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let e=(()=>{let e=sessionStorage.getItem(l.u);if(e)try{let t=JSON.parse(e);if(Array.isArray(t)&&t.length>0)return t}catch(e){console.error("Failed to parse saved window IDs, clearing.",e),sessionStorage.removeItem(l.u)}return null})();t(null!=e?e:[(0,a.A)()]),i(!0)},[]),(0,s.useEffect)(()=>{r&&sessionStorage.setItem(l.u,JSON.stringify(e))},[e,r]);let d=(0,s.useCallback)(r=>e.includes(r)?r:e.length>=n.y.MAX_WINDOWS?(o.oR.error("Maximum window limit of ".concat(n.y.MAX_WINDOWS," reached")),null):(t(e=>[...e,r]),r),[e]),c=(0,s.useCallback)(r=>{if(e.length>=n.y.MAX_WINDOWS)return o.oR.error("Maximum window limit of ".concat(n.y.MAX_WINDOWS," reached")),null;let s=(0,a.A)(),i=null!=r?r:e[e.length-1];return i&&((e,t)=>{try{let r=(e=>{let t=(0,l.et)(e),r=sessionStorage.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(r){return console.error("Failed to parse cache for window ".concat(e,":"),r),sessionStorage.removeItem(t),null}})(e);if(r){let e=JSON.parse(JSON.stringify(r));sessionStorage.setItem((0,l.et)(t),JSON.stringify(e))}let s=sessionStorage.getItem((0,l.YG)(e));s&&sessionStorage.setItem((0,l.YG)(t),s);let a=sessionStorage.getItem((0,l.i)(e));a&&sessionStorage.setItem((0,l.i)(t),a)}catch(r){console.error("Failed to clone window state from ".concat(e," to ").concat(t),r)}})(i,s),t(e=>[...e,s]),s},[e]),u=(0,s.useCallback)(r=>{if(e.length<=1)return void o.oR.error("Cannot remove the last remaining window");sessionStorage.removeItem((0,l.et)(r)),sessionStorage.removeItem((0,l.YG)(r)),sessionStorage.removeItem((0,l.i)(r)),t(e=>e.filter(e=>e!==r))},[e.length]);return{windowIds:e,isLoaded:r,addWindowWithId:d,addWindowWithCopy:c,removeWindowId:u,clearAllCache:(0,s.useCallback)(e=>{(()=>{let e=[];for(let t=0;t<sessionStorage.length;t++){let r=sessionStorage.key(t);(null==r?void 0:r.startsWith("playground"))&&e.push(r)}
1e.forEach(e=>sessionStorage.removeItem(e));let t=[];for(let e=0;e<sessionStorage.length;e++){let r=sessionStorage.key(e);(null==r?void 0:r.startsWith("llmModel"))&&t.push(r)}t.forEach(e=>sessionStorage.removeItem(e))})(),t([null!=e?e:(0,a.A)()])},[])}}},90417:(e,t,r)=>{"use strict";r.d(t,{LM:()=>X,OK:()=>Y,VM:()=>b,bL:()=>$,lr:()=>_});var s=r(96810),a=r(99297),n=r(7737),l=r(80111),o=r(92905),i=r(54106),d=r(94570),c=r(89218),u=r(60224),m=r(29950),p=r(73154),x="ScrollArea",[f,h]=(0,l.A)(x),[y,g]=f(x),v=s.forwardRef((e,t)=>{let{__scopeScrollArea:r,type:n="hover",dir:l,scrollHideDelay:i=600,...c}=e,[u,m]=s.useState(null),[x,f]=s.useState(null),[h,g]=s.useState(null),[v,w]=s.useState(null),[j,N]=s.useState(null),[b,C]=s.useState(0),[S,T]=s.useState(0),[k,A]=s.useState(!1),[E,P]=s.useState(!1),M=(0,o.s)(t,e=>m(e)),L=(0,d.jH)(l);return(0,p.jsx)(y,{scope:r,type:n,dir:L,scrollHideDelay:i,scrollArea:u,viewport:x,onViewportChange:f,content:h,onContentChange:g,scrollbarX:v,onScrollbarXChange:w,scrollbarXEnabled:k,onScrollbarXEnabledChange:A,scrollbarY:j,onScrollbarYChange:N,scrollbarYEnabled:E,onScrollbarYEnabledChange:P,onCornerWidthChange:C,onCornerHeightChange:T,children:(0,p.jsx)(a.sG.div,{dir:L,...c,ref:M,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":S+"px",...e.style}})})});v.displayName=x;var w="ScrollAreaViewport",j=s.forwardRef((e,t)=>{let{__scopeScrollArea:r,children:n,nonce:l,...i}=e,d=g(w,r),c=s.useRef(null),u=(0,o.s)(t,c,d.onViewportChange);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),(0,p.jsx)(a.sG.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,p.jsx)("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});j.displayName=w;var N="ScrollAreaScrollbar",b=s.forwardRef((e,t)=>{let{forceMount:r,...a}=e,n=g(N,e.__scopeScrollArea),{onScrollbarXEnabledChange:l,onScrollbarYEnabledChange:o}=n,i="horizontal"===e.orientation;return s.useEffect(()=>(i?l(!0):o(!0),()=>{i?l(!1):o(!1)}),[i,l,o]),"hover"===n.type?(0,p.jsx)(C,{...a,ref:t,forceMount:r}):"scroll"===n.type?(0,p.jsx)(S,{...a,ref:t,forceMount:r}):"auto"===n.type?(0,p.jsx)(T,{...a,ref:t,forceMount:r}):"always"===n.type?(0,p.jsx)(k,{...a,ref:t}):null});b.displayName=N;var C=s.forwardRef((e,t)=>{let{forceMount:r,...a}=e,l=g(N,e.__scopeScrollArea),[o,i]=s.useState(!1);return s.useEffect(()=>{let e=l.scrollArea,t=0;if(e){let r=()=>{window.clearTimeout(t),i(!0)},s=()=>{t=window.setTimeout(()=>i(!1),l.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",s),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",s)}}},[l.scrollArea,l.scrollHideDelay]),(0,p.jsx)(n.C,{present:r||o,children:(0,p.jsx)(T,{"data-state":o?"visible":"hidden",...a,ref:t})})}),S=s.forwardRef((e,t)=>{var r;let{forceMount:a,...l}=e,o=g(N,e.__scopeScrollArea),i="horizontal"===e.orientation,d=J(()=>u("SCROLL_END"),100),[c,u]=(r={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},s.useReducer((e,t)=>r[e][t]??e,"hidden"));return s.useEffect(()=>{if("idle"===c){let e=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(e)}},[c,o.scrollHideDelay,u]),s.useEffect(()=>{let e=o.viewport,t=i?"scrollLeft":"scrollTop";if(e){let r=e[t],s=()=>{let s=e[t];r!==s&&(u("SCROLL"),d()),r=s};return e.addEventListener("scroll",s),()=>e.removeEventListener("scroll",s)}},[o.viewport,i,u,d]),(0,p.jsx)(n.C,{present:a||"hidden"!==c,children:(0,p.jsx)(k,{"data-state":"hidden"===c?"hidden":"visible",...l,ref:t,onPointerEnter:(0,m.mK)(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:(0,m.mK)(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),T=s.forwardRef((e,t)=>
1{let r=g(N,e.__scopeScrollArea),{forceMount:a,...l}=e,[o,i]=s.useState(!1),d="horizontal"===e.orientation,c=J(()=>{if(r.viewport){let e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;i(d?e:t)}},10);return G(r.viewport,c),G(r.content,c),(0,p.jsx)(n.C,{present:a||o,children:(0,p.jsx)(k,{"data-state":o?"visible":"hidden",...l,ref:t})})}),k=s.forwardRef((e,t)=>{let{orientation:r="vertical",...a}=e,n=g(N,e.__scopeScrollArea),l=s.useRef(null),o=s.useRef(0),[i,d]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=W(i.viewport,i.content),u={...a,sizes:i,onSizesChange:d,hasThumb:!!(c>0&&c<1),onThumbChange:e=>l.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function m(e,t){return function(e,t,r,s="ltr"){let a=U(r),n=t||a/2,l=r.scrollbar.paddingStart+n,o=r.scrollbar.size-r.scrollbar.paddingEnd-(a-n),i=r.content-r.viewport;return H([l,o],"ltr"===s?[0,i]:[-1*i,0])(e)}(e,o.current,i,t)}return"horizontal"===r?(0,p.jsx)(A,{...u,ref:t,onThumbPositionChange:()=>{if(n.viewport&&l.current){let e=V(n.viewport.scrollLeft,i,n.dir);l.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{n.viewport&&(n.viewport.scrollLeft=e)},onDragScroll:e=>{n.viewport&&(n.viewport.scrollLeft=m(e,n.dir))}}):"vertical"===r?(0,p.jsx)(E,{...u,ref:t,onThumbPositionChange:()=>{if(n.viewport&&l.current){let e=V(n.viewport.scrollTop,i);l.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{n.viewport&&(n.viewport.scrollTop=e)},onDragScroll:e=>{n.viewport&&(n.viewport.scrollTop=m(e))}}):null}),A=s.forwardRef((e,t)=>{let{sizes:r,onSizesChange:a,...n}=e,l=g(N,e.__scopeScrollArea),[i,d]=s.useState(),c=s.useRef(null),u=(0,o.s)(t,c,l.onScrollbarXChange);return s.useEffect(()=>{c.current&&d(getComputedStyle(c.current))},[c]),(0,p.jsx)(L,{"data-orientation":"horizontal",...n,ref:u,sizes:r,style:{bottom:0,left:"rtl"===l.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===l.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":U(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(l.viewport){let s=l.viewport.scrollLeft+t.deltaX;e.onWheelScroll(s),function(e,t){return e>0&&e<t}(s,r)&&t.preventDefault()}},onResize:()=>{c.current&&l.viewport&&i&&a({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:z(i.paddingLeft),paddingEnd:z(i.paddingRight)}})}})}),E=s.forwardRef((e,t)=>{let{sizes:r,onSizesChange:a,...n}=e,l=g(N,e.__scopeScrollArea),[i,d]=s.useState(),c=s.useRef(null),u=(0,o.s)(t,c,l.onScrollbarYChange);return s.useEffect(()=>{c.current&&d(getComputedStyle(c.current))},[c]),(0,p.jsx)(L,{"data-orientation":"vertical",...n,ref:u,sizes:r,style:{top:0,right:"ltr"===l.dir?0:void 0,left:"rtl"===l.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":U(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(l.viewport){let s=l.viewport.scrollTop+t.deltaY;e.onWheelScroll(s),function(e,t){return e>0&&e<t}(s,r)&&t.preventDefault()}},onResize:()=>{c.current&&l.viewport&&i&&a({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:z(i.paddingTop),paddingEnd:z(i.paddingBottom)}})}})}),[P,M]=f(N),L=s.forwardRef((e,t)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:l,onThumbChange:d,onThumbPointerUp:c,onThumbPointerDown:u,onThumbPositionChange:x,onDragScroll:f,onWheelScroll:h,onResize:y,...v}=e,w=g(N,r),[j,b]=s.useState(null),C=(0,o.s)(t,e=>b(e)),S=s.useRef(null),T=s.useRef(""),k=w.viewport,A=n.content-n.viewport,E=(0,i.c)(h),M=(0,i.c)(x),L=J(y,10);function D(e){S.current&&f({x:e.clientX-S.current.left,y:e.clientY-S.current.top})}return s.useEffect(()=>{let e=e=>{let t=e.target;j?.contains(t)&&E(e,A)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[k,j,A,E]),s.useEffect(M,[n,M]),G(j,L),G(w.content,L),(0,p.jsx)(P,{scope:r,scrollbar:j,hasThumb:l,onThumbChange:(0,i.c)(d),onThumbPointerUp:(0,i.c)(c),onThumbPositionChange:M,onThumbPointerDown:(0,i.c)(u),children:(0,p.jsx)(a.sG.div,{...v,ref:C,style:{position:"absolute",...v.style},onPointerDown:(0,m.mK)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),S.current=j.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),D(e))}),onPointerMove:(0,m.mK)(e.onPointerMove,D),onPointerUp:(0,m.mK)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=T.current,w.viewport&&(w.viewport.style.scrollBehavior=""),S.current=null})})})}),D="ScrollAreaThumb",_=s.forwardRef((e,t)=>
1{let{forceMount:r,...s}=e,a=M(D,e.__scopeScrollArea);return(0,p.jsx)(n.C,{present:r||a.hasThumb,children:(0,p.jsx)(I,{ref:t,...s})})}),I=s.forwardRef((e,t)=>{let{__scopeScrollArea:r,style:n,...l}=e,i=g(D,r),d=M(D,r),{onThumbPositionChange:c}=d,u=(0,o.s)(t,e=>d.onThumbChange(e)),x=s.useRef(void 0),f=J(()=>{x.current&&(x.current(),x.current=void 0)},100);return s.useEffect(()=>{let e=i.viewport;if(e){let t=()=>{f(),x.current||(x.current=F(e,c),c())};return c(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,c]),(0,p.jsx)(a.sG.div,{"data-state":d.hasThumb?"visible":"hidden",...l,ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:(0,m.mK)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,s=e.clientY-t.top;d.onThumbPointerDown({x:r,y:s})}),onPointerUp:(0,m.mK)(e.onPointerUp,d.onThumbPointerUp)})});_.displayName=D;var O="ScrollAreaCorner",R=s.forwardRef((e,t)=>{let r=g(O,e.__scopeScrollArea),s=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&s?(0,p.jsx)(B,{...e,ref:t}):null});R.displayName=O;var B=s.forwardRef((e,t)=>{let{__scopeScrollArea:r,...n}=e,l=g(O,r),[o,i]=s.useState(0),[d,c]=s.useState(0),u=!!(o&&d);return G(l.scrollbarX,()=>{let e=l.scrollbarX?.offsetHeight||0;l.onCornerHeightChange(e),c(e)}),G(l.scrollbarY,()=>{let e=l.scrollbarY?.offsetWidth||0;l.onCornerWidthChange(e),i(e)}),u?(0,p.jsx)(a.sG.div,{...n,ref:t,style:{width:o,height:d,position:"absolute",right:"ltr"===l.dir?0:void 0,left:"rtl"===l.dir?0:void 0,bottom:0,...e.style}}):null});function z(e){return e?parseInt(e,10):0}function W(e,t){let r=e/t;return isNaN(r)?0:r}function U(e){let t=W(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function V(e,t,r="ltr"){let s=U(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=t.scrollbar.size-a,l=t.content-t.viewport,o=(0,u.q)(e,"ltr"===r?[0,l]:[-1*l,0]);return H([0,l],[0,n-s])(o)}function H(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(r-e[0])}}var F=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},s=0;return!function a(){let n={left:e.scrollLeft,top:e.scrollTop},l=r.left!==n.left,o=r.top!==n.top;(l||o)&&t(),r=n,s=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(s)};function J(e,t){let r=(0,i.c)(e),a=s.useRef(0);return s.useEffect(()=>()=>window.clearTimeout(a.current),[]),s.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,t)},[r,t])}function G(e,t){let r=(0,i.c)(t);(0,c.N)(()=>{let t=0;if(e){let s=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(t),s.unobserve(e)}}},[e,r])}var $=v,X=j,Y=R},95266:(e,t,r)=>{"use strict";r.d(t,{G7:()=>m,Gj:()=>u,L$:()=>f,fx:()=>h,h_:()=>y,oI:()=>p,uB:()=>c,xL:()=>x});var s=r(73154),a=r(96810),n=r(2198),l=r(80676),o=r(27131),i=r(81509),d=r(14183);let c=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(l.uB,{ref:t,className:(0,i.cn)("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",r),...a})});c.displayName=l.uB.displayName;let u=e=>{let{children:t,filter:r,...a}=e;return(0,s.jsx)(d.lG,{...a,"data-sentry-element":"Dialog","data-sentry-component":"CommandDialog","data-sentry-source-file":"command.tsx",children:(0,s.jsxs)(d.Cf,{className:"overflow-hidden p-0 shadow-lg",closeOnInteractionOutside:!0,"data-sentry-element":"DialogContent","data-sentry-source-file":"command.tsx",children:[(0,s.jsx)(d.c7,{className:"sr-only p-0","data-sentry-element":"DialogHeader","data-sentry-source-file":"command.tsx",children:(0,s.jsx)(n.L3,{"data-sentry-element":"DialogTitle","data-sentry-source-file":"command.tsx",children:"Search"})}),(0,s.jsx)(d.R4,{className:"p-0","data-sentry-element":"DialogBody","data-sentry-source-file":"command.tsx",children:(0,s.jsx)(c,{filter:r,className:"pb-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12","data-sentry-element":"Command","data-sentry-source-file":"command.tsx",children:t})})]})})},m=a.forwardRef((e,t)=>
1{let{className:r,showBorder:a=!0,...n}=e;return(0,s.jsxs)("div",{className:(0,i.cn)("relative flex items-center p-1",a&&"border-b","cmdk-input-wrapper"),children:[(0,s.jsx)(o.A,{className:"absolute left-2 top-1/2 mr-2 h-3.5 w-3.5 shrink-0 -translate-y-1/2 opacity-50"}),(0,s.jsx)(l.uB.Input,{ref:t,className:(0,i.cn)("flex h-8 w-full rounded-md bg-transparent py-3 pl-6 pr-6 text-sm outline-none placeholder:text-muted-foreground focus:outline-none focus:ring-0 disabled:cursor-not-allowed disabled:opacity-50",r),...n})]})});m.displayName=l.uB.Input.displayName;let p=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(l.uB.List,{ref:t,className:(0,i.cn)("max-h-[300px] overflow-y-auto overflow-x-hidden",r),...a})});p.displayName=l.uB.List.displayName;let x=a.forwardRef((e,t)=>(0,s.jsx)(l.uB.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));x.displayName=l.uB.Empty.displayName;let f=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(l.uB.Group,{ref:t,className:(0,i.cn)("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",r),...a})});f.displayName=l.uB.Group.displayName;let h=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(l.uB.Separator,{ref:t,className:(0,i.cn)("-mx-1 h-px bg-border",r),...a})});h.displayName=l.uB.Separator.displayName;let y=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(l.uB.Item,{ref:t,className:(0,i.cn)(r,"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0"),...a})});y.displayName=l.uB.Item.displayName}},e=>{e.O(0,[789,202,9110,1454,531,7020,9225,9825,2911,2896,894,5582,1555,4652,540,2441,2348,7861,9844,636,6593,8792],()=>e(e.s=6159)),_N_E=e.O()}]);

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.