@patterninc/pattern-ui 0.0.0-main.202611040528.6d912e601fb7 → 0.0.0-main.202611040732.bb44d67d2992

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.
@@ -1 +1 @@
1
- import{a as e}from"../../_chunks/rolldown-runtime-BWaJ3C7D.js";import{t}from"../../_chunks/react-CUaU2Z9V.js";import{t as n}from"../../_chunks/ArrowRightIcon-OEjQROCT.js";import{t as r}from"../../_chunks/compiler-runtime-B3BlmaWz.js";import{t as i}from"../../_chunks/jsx-runtime-Dgn0yPdi.js";import{t as a}from"../../_chunks/dist-BNSTMZct.js";import{a as o,n as s,r as c}from"../../_chunks/Tooltip-CZ9gmT5S.js";import{n as l}from"../../_chunks/react-B3hSlcN2.js";import{t as u}from"../../_chunks/AnimatePresence-B0AmNCpD.js";import{t as d}from"../../_chunks/use-reduced-motion-CNBdBisf.js";import{t as f}from"../../_chunks/use-animation-Dx5JiH_u.js";import{t as p}from"../../_chunks/Button-Dpj5VLQ7.js";import{i as m}from"../../_chunks/dist-BRMXKypj.js";import{n as h,s as g}from"../../_chunks/dist-CPlSvWC_.js";import{t as _}from"../../_chunks/ScrollGradientWrapper-h6yq23DQ.js";import{t as v}from"../../_chunks/TextareaControl-CIEYB2jp.js";import{t as y}from"../../_chunks/StopFillIcon-BHTuKSSq.js";import{t as b}from"../../_chunks/useToggle-CfFQsrI9.js";import{t as x}from"../../_chunks/PaperclipIcon-B8vj2DdY.js";import{t as S}from"../../_chunks/MicrophoneIcon-BuLtN1VU.js";import{n as C,t as w}from"../../_chunks/PromptHint-whUPjpVy.js";import{t as T}from"../../_chunks/LogoPI-DZ2zSwSS.js";import{t as E}from"../../_chunks/ArrowUpRightIcon-BQhMqKWo.js";var ee=r(),D=/* @__PURE__ */ e(i(),1);function O(e){let t=(0,ee.c)(10),{suggestions:n,onSuggestionClick:r,qaTestId:i}=e,o=i===void 0?`prompt-suggestions`:i;if(n.length===0)return null;let s;if(t[0]!==r||t[1]!==n){let e;t[3]===r?e=t[4]:(e=(e,t)=>/* @__PURE__ */ (0,D.jsx)(p,{variant:`weak`,prefix:{icon:E,color:`icon-soft`,animationDirection:`up-right`,className:`text-text-soft`},animateIcon:!0,motionProps:{whileTap:{scale:.95,boxShadow:`none`}},onClick:()=>{r?.(e),e.onClick?.()},className:a(`inline-flex shrink-0 items-center justify-start gap-0.5 rounded-xl bg-base-weak p-2.5 text-left`,`outline-1 -outline-offset-1 outline-depth-black-4 outline-solid`,`hover:bg-depth-black-4 hover:text-text-sub`),children:/* @__PURE__ */ (0,D.jsx)(`span`,{className:`pui-text-mono-small text-text-soft`,children:e.display})},t),t[3]=r,t[4]=e),s=n.map(e),t[0]=r,t[1]=n,t[2]=s}else s=t[2];let c;t[5]===s?c=t[6]:(c=/* @__PURE__ */ (0,D.jsx)(_,{className:`w-full`,scrollClassName:`gap-2`,children:s}),t[5]=s,t[6]=c);let l;return t[7]!==o||t[8]!==c?(l=/* @__PURE__ */ (0,D.jsx)(`div`,{className:`flex w-full flex-col items-start`,"qa-test-id":o,children:c}),t[7]=o,t[8]=c,t[9]=l):l=t[9],l}function te(e){let t=(0,ee.c)(25),{onAttach:r,onMicrophone:i,onStop:o,isStreaming:s,isSubmitLoading:c,isSubmitDisabled:l,className:u,qaTestId:d}=e,f=s!==void 0&&s,h=c!==void 0&&c,g=l===void 0||l,_=d===void 0?`toolbar`:d,{_:v}=m(),b;t[0]===u?b=t[1]:(b=a(`relative flex w-full shrink-0 items-center gap-3`,u),t[0]=u,t[1]=b);let C;t[2]!==v||t[3]!==r?(C=r&&/* @__PURE__ */ (0,D.jsx)(p,{type:`button`,onClick:r,"aria-label":v({id:`x9ecE4`}),variant:`weak`,size:`medium`,prefix:{icon:x}}),t[2]=v,t[3]=r,t[4]=C):C=t[4];let w;t[5]===C?w=t[6]:(w=/* @__PURE__ */ (0,D.jsx)(`div`,{className:`relative flex min-h-px min-w-px flex-1 shrink-0 items-center gap-2 rounded-xl lowercase`,children:C}),t[5]=C,t[6]=w);let T;t[7]!==v||t[8]!==f||t[9]!==i?(T=i&&!f&&/* @__PURE__ */ (0,D.jsx)(p,{type:`button`,onClick:i,"aria-label":v({id:`gPuz_0`}),variant:`weak`,size:`medium`,prefix:{icon:S}}),t[7]=v,t[8]=f,t[9]=i,t[10]=T):T=t[10];let E;t[11]!==v||t[12]!==f||t[13]!==g||t[14]!==h||t[15]!==o?(E=f&&o?/* @__PURE__ */ (0,D.jsx)(p,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),o()},"aria-label":v({id:`ygCKqB`}),variant:`strong`,size:`medium`,prefix:{icon:y}}):/* @__PURE__ */ (0,D.jsx)(p,{type:`submit`,"aria-label":v({id:`JlFcis`}),variant:`strong`,size:`medium`,suffix:{icon:n},disabled:g||h,isLoading:h}),t[11]=v,t[12]=f,t[13]=g,t[14]=h,t[15]=o,t[16]=E):E=t[16];let O;t[17]!==T||t[18]!==E?(O=/* @__PURE__ */ (0,D.jsxs)(`div`,{className:`relative flex shrink-0 items-center gap-2 rounded-xl`,children:[T,E]}),t[17]=T,t[18]=E,t[19]=O):O=t[19];let te;return t[20]!==_||t[21]!==O||t[22]!==b||t[23]!==w?(te=/* @__PURE__ */ (0,D.jsxs)(`div`,{className:b,"qa-test-id":_,children:[w,O]}),t[20]=_,t[21]=O,t[22]=b,t[23]=w,t[24]=te):te=t[24],te}function k(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}const A={"text/plain":`TXT`,"text/markdown":`MD`,"text/html":`HTML`,"text/css":`CSS`,"text/csv":`CSV`,"text/xml":`XML`,"application/xml":`XML`,"application/pdf":`PDF`,"application/json":`JSON`,"application/zip":`ZIP`,"application/msword":`DOC`,"application/vnd.openxmlformats-officedocument.wordprocessingml.document":`DOCX`,"application/vnd.ms-excel":`XLS`,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":`XLSX`,"application/vnd.ms-powerpoint":`PPT`,"application/vnd.openxmlformats-officedocument.presentationml.presentation":`PPTX`};function j(e,t){let n=e.lastIndexOf(`.`);return(n===-1?``:e.slice(n+1).toUpperCase())||A[t]||t.split(`/`).pop()?.toUpperCase()||`FILE`}function M(e,t){let n=e instanceof File,r=n?e.name:e.filename,i=n?e.type:e.mediaType,a=n?URL.createObjectURL(e):e.url,o=n?e:void 0,s=n?e.size:void 0,c=n?`${r}-${s}-${Date.now()}-${Math.random().toString(36).slice(2)}`:t===void 0?`url-${r}-${Date.now()}`:`backend-${t}-${r}`;if(i.startsWith(`image/`))return{id:c,type:`image`,imageSrc:a,file:o};let l=j(r,i);return{id:c,type:`file`,fileName:r,fileMetadata:s===void 0?l:`${l} • ${k(s)}`,file:o}}function ne(e,t){let n=e.getData(`text/plain`);return!n.trim()||!t.every(e=>e.type.startsWith(`image/`))?!1:n.includes(` `)}function N(e){e.type===`image`&&URL.revokeObjectURL(e.imageSrc)}var P=/* @__PURE__ */ e(t(),1);function F(e=[]){let[t,n]=(0,P.useState)(e);return{attachments:t,setAttachments:n,handleFilesSelected:e=>{let t=[];for(let n of e){let e=M(n);e&&t.push(e)}n(e=>[...e,...t])},handleRemoveAttachment:e=>{n(t=>{let n=t.find(t=>t.id===e);return n&&N(n),t.filter(t=>t.id!==e)})},clearAttachments:()=>{n(e=>(e.forEach(N),[]))}}}function re(e){let t=(0,ee.c)(24),{attachments:n,types:r,onRemove:i,layout:a}=e,o;t[0]===r?o=t[1]:(o=Array.isArray(r)?r:[r],t[0]=r,t[1]=o);let s=o,c,l,d,f,p,m;if(t[2]!==n||t[3]!==a||t[4]!==i||t[5]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[12]===s?e=t[13]:(e=e=>s.includes(e.type),t[12]=s,t[13]=e);let r=n.filter(e);if(r.length===0){m=null;break bb0}let o=r.toSorted(I);if(a===`vertical`){m=/* @__PURE__ */ (0,D.jsx)(`div`,{className:`flex w-full flex-col gap-2`,children:/* @__PURE__ */ (0,D.jsx)(u,{mode:`popLayout`,children:o.map(e=>/* @__PURE__ */ (0,D.jsx)(C,{...e,isSingleItem:o.length===1,onRemove:i?()=>i(e.id):void 0},e.id))})});break bb0}p=`w-full [scrollbar-width:none] overflow-x-auto [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden`,f=`inline-flex gap-2`,c=u,l=`popLayout`,d=o.map(e=>/* @__PURE__ */ (0,D.jsx)(C,{...e,isSingleItem:o.length===1,onRemove:i?()=>i(e.id):void 0},e.id))}t[2]=n,t[3]=a,t[4]=i,t[5]=s,t[6]=c,t[7]=l,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else c=t[6],l=t[7],d=t[8],f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[14]!==c||t[15]!==l||t[16]!==d?(h=/* @__PURE__ */ (0,D.jsx)(c,{mode:l,children:d}),t[14]=c,t[15]=l,t[16]=d,t[17]=h):h=t[17];let g;t[18]!==f||t[19]!==h?(g=/* @__PURE__ */ (0,D.jsx)(`div`,{className:f,children:h}),t[18]=f,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==p||t[22]!==g?(_=/* @__PURE__ */ (0,D.jsx)(`div`,{className:p,children:g}),t[21]=p,t[22]=g,t[23]=_):_=t[23],_}function I(e,t){return(e.status===`error`||e.status===`unsupported`?0:1)-(t.status===`error`||t.status===`unsupported`?0:1)}function L(e){let t=(0,ee.c)(206),n,r,i,u,p,_,y,x,S,C,E,k,A,j,M,N,F,I,L,ce,R,le,ue,de,fe,pe,me,he,ge,_e,ve,z;t[0]===e?(n=t[1],r=t[2],i=t[3],u=t[4],p=t[5],_=t[6],y=t[7],x=t[8],S=t[9],C=t[10],E=t[11],k=t[12],A=t[13],j=t[14],M=t[15],N=t[16],F=t[17],I=t[18],L=t[19],ce=t[20],R=t[21],le=t[22],ue=t[23],de=t[24],fe=t[25],pe=t[26],me=t[27],he=t[28],ge=t[29],_e=t[30],ve=t[31],z=t[32]):({className:r,attachments:I,placeholder:N,onFilesSelected:x,accept:n,onSubmit:M,blockSubmit:de,shakeOnBlock:fe,onBlockedSubmit:y,onMicrophone:E,onRemoveAttachment:k,onStop:j,onSteer:A,isStreaming:pe,isSubmitLoading:me,allowEmptySubmit:he,autoFocus:ge,defaultValue:i,showScrollShadow:_e,showLogo:ve,hasShadow:L,showSuggestions:ce,suggestions:R,hint:p,onInputChange:S,onKeyDown:C,inputOverlay:_,textareaClassName:z,insertPastedTextDirectly:le,ref:u,qaTestId:ue,...F}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=u,t[5]=p,t[6]=_,t[7]=y,t[8]=x,t[9]=S,t[10]=C,t[11]=E,t[12]=k,t[13]=A,t[14]=j,t[15]=M,t[16]=N,t[17]=F,t[18]=I,t[19]=L,t[20]=ce,t[21]=R,t[22]=le,t[23]=ue,t[24]=de,t[25]=fe,t[26]=pe,t[27]=me,t[28]=he,t[29]=ge,t[30]=_e,t[31]=ve,t[32]=z);let ye;t[33]===I?ye=t[34]:(ye=I===void 0?[]:I,t[33]=I,t[34]=ye);let B=ye,be=de!==void 0&&de,xe=fe===void 0||fe,V=pe!==void 0&&pe,H=me!==void 0&&me,Se=he!==void 0&&he,Ce=ge===void 0||ge,we=_e!==void 0&&_e,Te=ve===void 0||ve,Ee=L!==void 0&&L,De=ce!==void 0&&ce,Oe;t[35]===R?Oe=t[36]:(Oe=R===void 0?[]:R,t[35]=R,t[36]=Oe);let ke=Oe,Ae=le!==void 0&&le,je=ue===void 0?`prompt`:ue,{_:U}=m(),[W,Me]=(0,P.useState)(i??``),[Ne,Pe]=(0,P.useState)(!1),[Fe,Ie]=(0,P.useState)(!1),[Le,Re]=(0,P.useState)(!1),[ze,Be]=(0,P.useState)(!1),Ve=(0,P.useRef)(null),He=(0,P.useRef)(null),Ue=(0,P.useRef)(null),We=(0,P.useRef)(null),G=f(),Ge=d(),Ke;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(Ke={defaultValue:!1,initializeWithValue:!1},t[37]=Ke):Ke=t[37];let qe=g(`(pointer: coarse)`,Ke),Je=b(`prefer_text_over_image_on_paste`),Ye;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=()=>{let e=He.current;if(e?.isConnected)return e;let t=Ve.current?.querySelector(`textarea`)??null;return He.current=t,t},t[38]=Ye):Ye=t[38];let Xe=Ye,Ze;t[39]===S?Ze=t[40]:(Ze=(e,t)=>{Me(e),S?.(e,t)},t[39]=S,t[40]=Ze);let K=Ze,Qe;t[41]!==G||t[42]!==Ge?(Qe=()=>{Ge?G.set({x:0}):G.start({x:[0,-8,8,-6,6,-4,4,0],transition:{duration:.35,ease:[.32,.72,0,1]}})},t[41]=G,t[42]=Ge,t[43]=Qe):Qe=t[43];let q=Qe,$e;t[44]!==q||t[45]!==K?($e=()=>({focus:()=>Xe()?.focus(),setInputValue:e=>{K(e)},setSelectionRange:(e,t)=>{let n=t===void 0?e:t,r=Xe();r&&(r.focus({preventScroll:!0}),r.setSelectionRange(e,n))},shake:q}),t[44]=q,t[45]=K,t[46]=$e):$e=t[46],(0,P.useImperativeHandle)(u,$e);let et,tt;t[47]===Ce?(et=t[48],tt=t[49]):(et=()=>{Ce&&Xe()?.focus({preventScroll:!0})},tt=[Ce],t[47]=Ce,t[48]=et,t[49]=tt),(0,P.useEffect)(et,tt);let nt;t[50]===_?nt=t[51]:(nt=()=>{let e=Ue.current;if(!_||!e)return;let t=Xe();t&&(e.style.transform=`translate(${-t.scrollLeft}px, ${-t.scrollTop}px)`)},t[50]=_,t[51]=nt);let rt;t[52]!==_||t[53]!==W?(rt=[_,W],t[52]=_,t[53]=W,t[54]=rt):rt=t[54],(0,P.useEffect)(nt,rt);let it,at;t[55]===_?(it=t[56],at=t[57]):(it=()=>{if(!_){let e=Ue.current;e&&(e.style.transform=``)}},at=[_],t[55]=_,t[56]=it,t[57]=at),(0,P.useEffect)(it,at);let ot;t[58]===_?ot=t[59]:(ot=e=>{if(!_)return;let t=Ue.current,n=He.current;t&&n&&e.target===n&&(t.style.transform=`translate(${-n.scrollLeft}px, ${-n.scrollTop}px)`)},t[58]=_,t[59]=ot);let st;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(st={passive:!0,capture:!0},t[60]=st):st=t[60],h(`scroll`,ot,Ve,st);let ct;t[61]!==B.length||t[62]!==W?(ct=W.trim().length>0||B.length>0,t[61]=B.length,t[62]=W,t[63]=ct):ct=t[63];let lt=ct,ut=B.length>0,dt;t[64]===B?dt=t[65]:(dt=B.some(se),t[64]=B,t[65]=dt);let J=!Se&&!lt||dt,ft,pt;t[66]===J?(ft=t[67],pt=t[68]):(ft=()=>{J||Be(!1)},pt=[J],t[66]=J,t[67]=ft,t[68]=pt),(0,P.useEffect)(ft,pt);let Y;bb0:{if(!lt){let e;t[69]===U?e=t[70]:(e=U({id:`E-2Of8`}),t[69]=U,t[70]=e),Y=e;break bb0}if(B.some(oe)){let e;t[71]===U?e=t[72]:(e=U({id:`_D6eRO`}),t[71]=U,t[72]=e),Y=e;break bb0}if(B.some(ae)){let e;t[73]===U?e=t[74]:(e=U({id:`CJndez`}),t[73]=U,t[74]=e),Y=e;break bb0}if(B.some(ie)){let e;t[75]===U?e=t[76]:(e=U({id:`MH3bVF`}),t[75]=U,t[76]=e),Y=e;break bb0}let e;t[77]===U?e=t[78]:(e=U({id:`E-2Of8`}),t[77]=U,t[78]=e),Y=e}let mt=Y,X=p!==void 0&&p!==!1&&!Le&&(typeof p==`boolean`?p:p.text),Z=typeof p==`object`?p:void 0,ht;t[79]!==be||t[80]!==W||t[81]!==V||t[82]!==J||t[83]!==H||t[84]!==y||t[85]!==A||t[86]!==M||t[87]!==q||t[88]!==K||t[89]!==xe?(ht=()=>{if(!H){if(be)xe&&q(),y?.();else if(V){if(!A)return;let e=W.trim();if(!e)return;A(e),K(``)}else J?(q(),Be(!0)):M?.(W)}},t[79]=be,t[80]=W,t[81]=V,t[82]=J,t[83]=H,t[84]=y,t[85]=A,t[86]=M,t[87]=q,t[88]=K,t[89]=xe,t[90]=ht):ht=t[90];let gt=ht,_t;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(_t=()=>{We.current?.click()},t[91]=_t):_t=t[91];let vt=_t,yt;t[92]===x?yt=t[93]:(yt=e=>{let t=e.target.files;t&&t.length>0&&x?.(Array.from(t)),e.target.value=``},t[92]=x,t[93]=yt);let bt=yt,xt;t[94]===x?xt=t[95]:(xt=e=>{e.preventDefault(),e.stopPropagation(),x&&Ie(!0)},t[94]=x,t[95]=xt);let St=xt,Ct;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=e=>{e.preventDefault(),e.stopPropagation(),!(e.relatedTarget&&e.currentTarget.contains(e.relatedTarget))&&Ie(!1)},t[96]=Ct):Ct=t[96];let wt=Ct,Tt;t[97]===x?Tt=t[98]:(Tt=e=>{if(e.preventDefault(),e.stopPropagation(),Ie(!1),!x)return;let t=Array.from(e.dataTransfer.files);t.length>0&&x(t)},t[97]=x,t[98]=Tt);let Et=Tt,Dt;t[99]!==Ae||t[100]!==x||t[101]!==Je||t[102]!==K?(Dt=e=>{if(!x&&!Ae)return;let t=Array.from(e.clipboardData.files);if(x&&t.length>0){if(Je&&ne(e.clipboardData,t))return;e.preventDefault(),x(t);return}let n=e.clipboardData.getData(`text/plain`);if(x&&n.length>4095){e.preventDefault();let t=new File([n],`Pasted Text`,{type:`text/plain`});x([t]);return}if(!Ae)return;let r=Xe();n&&r&&e.target===r&&(e.preventDefault(),document.execCommand(`insertText`,!1,n)||(r.setRangeText(n,r.selectionStart,r.selectionEnd,`end`),K(r.value,r.selectionStart)))},t[99]=Ae,t[100]=x,t[101]=Je,t[102]=K,t[103]=Dt):Dt=t[103];let Ot=Dt,kt;t[104]===Z?kt=t[105]:(kt=()=>{Re(!0),Z?.onDismiss?.()},t[104]=Z,t[105]=kt);let At=kt,jt=Ne||lt||V||Fe||we,Mt=Ee&&`var(--shadow-floating-composer)`,Nt=jt&&!Fe?`inset 0 0 0 1px var(--color-depth-black-4)`:`inset 0 0 0 1px transparent`,Pt;t[106]!==Mt||t[107]!==Nt?(Pt=[Mt,Nt].filter(Boolean),t[106]=Mt,t[107]=Nt,t[108]=Pt):Pt=t[108];let Ft=Pt.join(`, `),It;t[109]===r?It=t[110]:(It=a(`flex w-full max-w-240 flex-col items-start justify-end gap-2`,r),t[109]=r,t[110]=It);let Lt;t[111]!==K||t[112]!==X||t[113]!==De||t[114]!==ke?(Lt=De&&!X?/* @__PURE__ */ (0,D.jsx)(O,{suggestions:ke,onSuggestionClick:e=>K(e.value)}):null,t[111]=K,t[112]=X,t[113]=De,t[114]=ke,t[115]=Lt):Lt=t[115];let Rt;t[116]!==At||t[117]!==Z?.text||t[118]!==X?(Rt=X?/* @__PURE__ */ (0,D.jsx)(w,{text:Z?.text,onDismiss:At}):null,t[116]=At,t[117]=Z?.text,t[118]=X,t[119]=Rt):Rt=t[119];let zt;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(zt={x:0},t[120]=zt):zt=t[120];let Bt;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Bt={willChange:`transform`},t[121]=Bt):Bt=t[121];let Vt=Fe&&`border border-dashed border-primary-base`,Ht;t[122]===Vt?Ht=t[123]:(Ht=a(`relative w-full overflow-hidden rounded-[20px] bg-base-weak`,Vt),t[122]=Vt,t[123]=Ht);let Ut;t[124]===Ft?Ut=t[125]:(Ut={boxShadow:Ft,transition:`box-shadow 0.2s ease`},t[124]=Ft,t[125]=Ut);let Wt,Gt;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(Wt=()=>Pe(!0),Gt=()=>{Pe(!1),Be(!1)},t[126]=Wt,t[127]=Gt):(Wt=t[126],Gt=t[127]);let Kt;t[128]!==n||t[129]!==bt?(Kt=/* @__PURE__ */ (0,D.jsx)(`input`,{ref:We,type:`file`,accept:n,multiple:!0,onChange:bt,className:`hidden`}),t[128]=n,t[129]=bt,t[130]=Kt):Kt=t[130];let qt;t[131]===gt?qt=t[132]:(qt=e=>{e.preventDefault(),gt()},t[131]=gt,t[132]=qt);let Jt;t[133]!==B||t[134]!==ut||t[135]!==k?(Jt=ut?/* @__PURE__ */ (0,D.jsxs)(`div`,{className:`relative flex w-full shrink-0 flex-col items-start gap-2`,children:[/* @__PURE__ */ (0,D.jsx)(re,{attachments:B,types:`thread`,onRemove:k,layout:`vertical`}),/* @__PURE__ */ (0,D.jsx)(re,{attachments:B,types:[`image`,`file`],onRemove:k,layout:`horizontal`})]}):null,t[133]=B,t[134]=ut,t[135]=k,t[136]=Jt):Jt=t[136];let Q;t[137]===Te?Q=t[138]:(Q=Te?/* @__PURE__ */ (0,D.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center`,children:/* @__PURE__ */ (0,D.jsx)(T,{variant:`color`,size:24})}):null,t[137]=Te,t[138]=Q);let Yt;t[139]===K?Yt=t[140]:(Yt=e=>K(e.target.value,e.target.selectionStart),t[139]=K,t[140]=Yt);let Xt;t[141]!==gt||t[142]!==W||t[143]!==qe||t[144]!==C||t[145]!==K?(Xt=e=>{if(C?.(e)===!0)e.preventDefault();else if(!qe&&!(e.nativeEvent.isComposing||e.keyCode===229)){if(e.key===`Enter`&&e.altKey){e.preventDefault();let t=e.currentTarget,n=t.selectionStart??W.length,r=t.selectionEnd??W.length,i=`${W.slice(0,n)}\n${W.slice(r)}`;K(i,n+1),requestAnimationFrame(()=>{t.setSelectionRange(n+1,n+1)})}else e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),gt())}},t[141]=gt,t[142]=W,t[143]=qe,t[144]=C,t[145]=K,t[146]=Xt):Xt=t[146];let Zt;t[147]!==U||t[148]!==N?(Zt=N??U({id:`3ZxGc_`}),t[147]=U,t[148]=N,t[149]=Zt):Zt=t[149];let Qt=_&&`[scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden`,$t;t[150]!==Qt||t[151]!==z?($t=a(`p-0`,Qt,z),t[150]=Qt,t[151]=z,t[152]=$t):$t=t[152];let en;t[153]===_?en=t[154]:(en=_?{color:`transparent`,WebkitTextFillColor:`transparent`,caretColor:`var(--color-text-strong)`}:void 0,t[153]=_,t[154]=en);let tn;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(tn=a(`min-h-0 flex-1 resize-none rounded-none border-none bg-transparent`,`focus-within:bg-transparent hover:bg-transparent`),t[155]=tn):tn=t[155];let nn;t[156]!==W||t[157]!==Yt||t[158]!==Xt||t[159]!==Zt||t[160]!==$t||t[161]!==en?(nn=/* @__PURE__ */ (0,D.jsx)(v,{rows:1,value:W,onChange:Yt,onKeyDown:Xt,placeholder:Zt,variant:`inverse`,maxHeight:200,textareaClassName:$t,style:en,className:tn}),t[156]=W,t[157]=Yt,t[158]=Xt,t[159]=Zt,t[160]=$t,t[161]=en,t[162]=nn):nn=t[162];let rn;t[163]===_?rn=t[164]:(rn=_?/* @__PURE__ */ (0,D.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 overflow-hidden`,children:/* @__PURE__ */ (0,D.jsx)(`div`,{ref:Ue,children:_})}):null,t[163]=_,t[164]=rn);let an;t[165]!==nn||t[166]!==rn?(an=/* @__PURE__ */ (0,D.jsxs)(`div`,{ref:Ve,className:`pui-no-ios-zoom-container relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[nn,rn]}),t[165]=nn,t[166]=rn,t[167]=an):an=t[167];let on=x?vt:void 0,sn;t[168]!==V||t[169]!==H||t[170]!==E||t[171]!==j||t[172]!==on?(sn=/* @__PURE__ */ (0,D.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 rounded-xl`,children:/* @__PURE__ */ (0,D.jsx)(te,{onAttach:on,onMicrophone:E,onStop:j,isStreaming:V,isSubmitLoading:H,isSubmitDisabled:!1,className:`gap-2`})}),t[168]=V,t[169]=H,t[170]=E,t[171]=j,t[172]=on,t[173]=sn):sn=t[173];let cn;t[174]!==Q||t[175]!==an||t[176]!==sn?(cn=/* @__PURE__ */ (0,D.jsxs)(`div`,{className:`flex min-h-10 w-full items-center gap-2 px-1 py-0.5`,children:[Q,an,sn]}),t[174]=Q,t[175]=an,t[176]=sn,t[177]=cn):cn=t[177];let ln;t[178]!==qt||t[179]!==Jt||t[180]!==cn?(ln=/* @__PURE__ */ (0,D.jsxs)(`form`,{onSubmit:qt,className:`flex flex-col items-start justify-center gap-3 p-3`,children:[Jt,cn]}),t[178]=qt,t[179]=Jt,t[180]=cn,t[181]=ln):ln=t[181];let un;t[182]!==St||t[183]!==Et||t[184]!==Ot||t[185]!==Ht||t[186]!==Ut||t[187]!==Kt||t[188]!==ln?(un=/* @__PURE__ */ (0,D.jsxs)(`div`,{"data-slot":`prompt-card`,className:Ht,style:Ut,onMouseEnter:Wt,onMouseLeave:Gt,onDragOver:St,onDragLeave:wt,onDrop:Et,onPaste:Ot,children:[Kt,ln]}),t[182]=St,t[183]=Et,t[184]=Ot,t[185]=Ht,t[186]=Ut,t[187]=Kt,t[188]=ln,t[189]=un):un=t[189];let dn;t[190]!==G||t[191]!==un?(dn=/* @__PURE__ */ (0,D.jsx)(o,{asChild:!0,children:/* @__PURE__ */ (0,D.jsx)(l.div,{className:`w-full`,initial:zt,animate:G,style:Bt,children:un})}),t[190]=G,t[191]=un,t[192]=dn):dn=t[192];let fn;t[193]===mt?fn=t[194]:(fn=/* @__PURE__ */ (0,D.jsx)(c,{side:`top`,sideOffset:8,className:`z-100`,children:mt}),t[193]=mt,t[194]=fn);let $;t[195]!==ze||t[196]!==dn||t[197]!==fn?($=/* @__PURE__ */ (0,D.jsxs)(s,{open:ze,children:[dn,fn]}),t[195]=ze,t[196]=dn,t[197]=fn,t[198]=$):$=t[198];let pn;return t[199]!==F||t[200]!==je||t[201]!==It||t[202]!==Lt||t[203]!==Rt||t[204]!==$?(pn=/* @__PURE__ */ (0,D.jsxs)(`div`,{className:It,"qa-test-id":je,...F,children:[Lt,Rt,$]}),t[199]=F,t[200]=je,t[201]=It,t[202]=Lt,t[203]=Rt,t[204]=$,t[205]=pn):pn=t[205],pn}function ie(e){return e.status===`loading`}function ae(e){return e.status===`error`}function oe(e){return e.status===`unsupported`}function se(e){return e.status===`loading`||e.status===`error`||e.status===`unsupported`}export{C as Attachment,L as Prompt,j as extensionFromFilename,k as formatFileSize,N as revokeAttachmentUrl,ne as shouldPreferTextOverFiles,M as toAttachment,F as useAttachments};
1
+ import{a as e}from"../../_chunks/rolldown-runtime-BWaJ3C7D.js";import{t}from"../../_chunks/react-CUaU2Z9V.js";import{t as n}from"../../_chunks/ArrowRightIcon-OEjQROCT.js";import{t as r}from"../../_chunks/compiler-runtime-B3BlmaWz.js";import{t as i}from"../../_chunks/jsx-runtime-Dgn0yPdi.js";import{t as a}from"../../_chunks/dist-BNSTMZct.js";import{a as o,n as s,r as c}from"../../_chunks/Tooltip-CZ9gmT5S.js";import{n as l}from"../../_chunks/react-B3hSlcN2.js";import{t as u}from"../../_chunks/AnimatePresence-B0AmNCpD.js";import{t as d}from"../../_chunks/use-reduced-motion-CNBdBisf.js";import{t as f}from"../../_chunks/use-animation-Dx5JiH_u.js";import{t as p}from"../../_chunks/Button-Dpj5VLQ7.js";import{i as m}from"../../_chunks/dist-BRMXKypj.js";import{n as h,s as g}from"../../_chunks/dist-CPlSvWC_.js";import{t as _}from"../../_chunks/ScrollGradientWrapper-h6yq23DQ.js";import{t as v}from"../../_chunks/TextareaControl-CIEYB2jp.js";import{t as y}from"../../_chunks/StopFillIcon-BHTuKSSq.js";import{t as b}from"../../_chunks/useToggle-CfFQsrI9.js";import{t as x}from"../../_chunks/PaperclipIcon-B8vj2DdY.js";import{t as S}from"../../_chunks/MicrophoneIcon-BuLtN1VU.js";import{n as C,t as w}from"../../_chunks/PromptHint-whUPjpVy.js";import{t as T}from"../../_chunks/LogoPI-DZ2zSwSS.js";import{t as E}from"../../_chunks/ArrowUpRightIcon-BQhMqKWo.js";var ee=r(),D=/* @__PURE__ */ e(i(),1);function O(e){let t=(0,ee.c)(10),{suggestions:n,onSuggestionClick:r,qaTestId:i}=e,o=i===void 0?`prompt-suggestions`:i;if(n.length===0)return null;let s;if(t[0]!==r||t[1]!==n){let e;t[3]===r?e=t[4]:(e=(e,t)=>/* @__PURE__ */ (0,D.jsx)(p,{variant:`weak`,prefix:{icon:E,color:`icon-soft`,animationDirection:`up-right`,className:`text-text-soft`},animateIcon:!0,motionProps:{whileTap:{scale:.95,boxShadow:`none`}},onClick:()=>{r?.(e),e.onClick?.()},className:a(`inline-flex shrink-0 items-center justify-start gap-0.5 rounded-xl bg-base-weak p-2.5 text-left`,`outline-1 -outline-offset-1 outline-depth-black-4 outline-solid`,`hover:bg-depth-black-4 hover:text-text-sub`),children:/* @__PURE__ */ (0,D.jsx)(`span`,{className:`pui-text-mono-small text-text-soft`,children:e.display})},t),t[3]=r,t[4]=e),s=n.map(e),t[0]=r,t[1]=n,t[2]=s}else s=t[2];let c;t[5]===s?c=t[6]:(c=/* @__PURE__ */ (0,D.jsx)(_,{className:`w-full`,scrollClassName:`gap-2`,children:s}),t[5]=s,t[6]=c);let l;return t[7]!==o||t[8]!==c?(l=/* @__PURE__ */ (0,D.jsx)(`div`,{className:`flex w-full flex-col items-start`,"qa-test-id":o,children:c}),t[7]=o,t[8]=c,t[9]=l):l=t[9],l}function te(e){let t=(0,ee.c)(25),{onAttach:r,onMicrophone:i,onStop:o,isStreaming:s,isSubmitLoading:c,isSubmitDisabled:l,className:u,qaTestId:d}=e,f=s!==void 0&&s,h=c!==void 0&&c,g=l===void 0||l,_=d===void 0?`toolbar`:d,{_:v}=m(),b;t[0]===u?b=t[1]:(b=a(`relative flex w-full shrink-0 items-center gap-3`,u),t[0]=u,t[1]=b);let C;t[2]!==v||t[3]!==r?(C=r&&/* @__PURE__ */ (0,D.jsx)(p,{type:`button`,onClick:r,"aria-label":v({id:`x9ecE4`}),variant:`weak`,size:`medium`,prefix:{icon:x}}),t[2]=v,t[3]=r,t[4]=C):C=t[4];let w;t[5]===C?w=t[6]:(w=/* @__PURE__ */ (0,D.jsx)(`div`,{className:`relative flex min-h-px min-w-px flex-1 shrink-0 items-center gap-2 rounded-xl lowercase`,children:C}),t[5]=C,t[6]=w);let T;t[7]!==v||t[8]!==f||t[9]!==i?(T=i&&!f&&/* @__PURE__ */ (0,D.jsx)(p,{type:`button`,onClick:i,"aria-label":v({id:`gPuz_0`}),variant:`weak`,size:`medium`,prefix:{icon:S}}),t[7]=v,t[8]=f,t[9]=i,t[10]=T):T=t[10];let E;t[11]!==v||t[12]!==f||t[13]!==g||t[14]!==h||t[15]!==o?(E=f&&o?/* @__PURE__ */ (0,D.jsx)(p,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),o()},"aria-label":v({id:`ygCKqB`}),variant:`strong`,size:`medium`,prefix:{icon:y}}):/* @__PURE__ */ (0,D.jsx)(p,{type:`submit`,"aria-label":v({id:`JlFcis`}),variant:`strong`,size:`medium`,suffix:{icon:n},disabled:g||h,isLoading:h}),t[11]=v,t[12]=f,t[13]=g,t[14]=h,t[15]=o,t[16]=E):E=t[16];let O;t[17]!==T||t[18]!==E?(O=/* @__PURE__ */ (0,D.jsxs)(`div`,{className:`relative flex shrink-0 items-center gap-2 rounded-xl`,children:[T,E]}),t[17]=T,t[18]=E,t[19]=O):O=t[19];let te;return t[20]!==_||t[21]!==O||t[22]!==b||t[23]!==w?(te=/* @__PURE__ */ (0,D.jsxs)(`div`,{className:b,"qa-test-id":_,children:[w,O]}),t[20]=_,t[21]=O,t[22]=b,t[23]=w,t[24]=te):te=t[24],te}function k(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}const A={"text/plain":`TXT`,"text/markdown":`MD`,"text/html":`HTML`,"text/css":`CSS`,"text/csv":`CSV`,"text/xml":`XML`,"application/xml":`XML`,"application/pdf":`PDF`,"application/json":`JSON`,"application/zip":`ZIP`,"application/msword":`DOC`,"application/vnd.openxmlformats-officedocument.wordprocessingml.document":`DOCX`,"application/vnd.ms-excel":`XLS`,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":`XLSX`,"application/vnd.ms-powerpoint":`PPT`,"application/vnd.openxmlformats-officedocument.presentationml.presentation":`PPTX`};function j(e,t){let n=e.lastIndexOf(`.`);return(n===-1?``:e.slice(n+1).toUpperCase())||A[t]||t.split(`/`).pop()?.toUpperCase()||`FILE`}function M(e,t){let n=e instanceof File,r=n?e.name:e.filename,i=n?e.type:e.mediaType,a=n?URL.createObjectURL(e):e.url,o=n?e:void 0,s=n?e.size:void 0,c=n?`${r}-${s}-${Date.now()}-${Math.random().toString(36).slice(2)}`:t===void 0?`url-${r}-${Date.now()}`:`backend-${t}-${r}`;if(i.startsWith(`image/`))return{id:c,type:`image`,imageSrc:a,file:o};let l=j(r,i);return{id:c,type:`file`,fileName:r,fileMetadata:s===void 0?l:`${l} • ${k(s)}`,file:o}}function ne(e,t){let n=e.getData(`text/plain`);return!n.trim()||!t.every(e=>e.type.startsWith(`image/`))?!1:n.includes(` `)}function N(e){e.type===`image`&&URL.revokeObjectURL(e.imageSrc)}var P=/* @__PURE__ */ e(t(),1);function F(e=[]){let[t,n]=(0,P.useState)(e);return{attachments:t,setAttachments:n,handleFilesSelected:e=>{let t=[];for(let n of e){let e=M(n);e&&t.push(e)}n(e=>[...e,...t])},handleRemoveAttachment:e=>{n(t=>{let n=t.find(t=>t.id===e);return n&&N(n),t.filter(t=>t.id!==e)})},clearAttachments:()=>{n(e=>(e.forEach(N),[]))}}}function re(e){let t=(0,ee.c)(24),{attachments:n,types:r,onRemove:i,layout:a}=e,o;t[0]===r?o=t[1]:(o=Array.isArray(r)?r:[r],t[0]=r,t[1]=o);let s=o,c,l,d,f,p,m;if(t[2]!==n||t[3]!==a||t[4]!==i||t[5]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[12]===s?e=t[13]:(e=e=>s.includes(e.type),t[12]=s,t[13]=e);let r=n.filter(e);if(r.length===0){m=null;break bb0}let o=r.toSorted(I);if(a===`vertical`){m=/* @__PURE__ */ (0,D.jsx)(`div`,{className:`flex w-full flex-col gap-2`,children:/* @__PURE__ */ (0,D.jsx)(u,{mode:`popLayout`,children:o.map(e=>/* @__PURE__ */ (0,D.jsx)(C,{...e,isSingleItem:o.length===1,onRemove:i?()=>i(e.id):void 0},e.id))})});break bb0}p=`w-full [scrollbar-width:none] overflow-x-auto [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden`,f=`inline-flex gap-2`,c=u,l=`popLayout`,d=o.map(e=>/* @__PURE__ */ (0,D.jsx)(C,{...e,isSingleItem:o.length===1,onRemove:i?()=>i(e.id):void 0},e.id))}t[2]=n,t[3]=a,t[4]=i,t[5]=s,t[6]=c,t[7]=l,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else c=t[6],l=t[7],d=t[8],f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[14]!==c||t[15]!==l||t[16]!==d?(h=/* @__PURE__ */ (0,D.jsx)(c,{mode:l,children:d}),t[14]=c,t[15]=l,t[16]=d,t[17]=h):h=t[17];let g;t[18]!==f||t[19]!==h?(g=/* @__PURE__ */ (0,D.jsx)(`div`,{className:f,children:h}),t[18]=f,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==p||t[22]!==g?(_=/* @__PURE__ */ (0,D.jsx)(`div`,{className:p,children:g}),t[21]=p,t[22]=g,t[23]=_):_=t[23],_}function I(e,t){return(e.status===`error`||e.status===`unsupported`?0:1)-(t.status===`error`||t.status===`unsupported`?0:1)}function L(e){let t=(0,ee.c)(210),n,r,i,u,p,_,y,x,S,C,E,k,A,j,M,N,F,I,L,ce,le,R,ue,de,fe,pe,me,he,ge,_e,ve,ye,z;t[0]===e?(n=t[1],r=t[2],i=t[3],u=t[4],p=t[5],_=t[6],y=t[7],x=t[8],S=t[9],C=t[10],E=t[11],k=t[12],A=t[13],j=t[14],M=t[15],N=t[16],F=t[17],I=t[18],L=t[19],ce=t[20],le=t[21],R=t[22],ue=t[23],de=t[24],fe=t[25],pe=t[26],me=t[27],he=t[28],ge=t[29],_e=t[30],ve=t[31],ye=t[32],z=t[33]):({className:r,attachments:L,placeholder:F,onFilesSelected:S,accept:n,onSubmit:N,blockSubmit:fe,shakeOnBlock:pe,onBlockedSubmit:x,onMicrophone:k,onRemoveAttachment:A,onStop:M,onSteer:j,isStreaming:me,isSubmitLoading:he,allowEmptySubmit:ge,autoFocus:_e,defaultValue:i,showScrollShadow:ve,showLogo:ye,hasShadow:ce,showSuggestions:le,suggestions:R,hint:p,onInputChange:C,onKeyDown:E,inputOverlay:y,inputFooter:_,textareaClassName:z,insertPastedTextDirectly:ue,ref:u,qaTestId:de,...I}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=u,t[5]=p,t[6]=_,t[7]=y,t[8]=x,t[9]=S,t[10]=C,t[11]=E,t[12]=k,t[13]=A,t[14]=j,t[15]=M,t[16]=N,t[17]=F,t[18]=I,t[19]=L,t[20]=ce,t[21]=le,t[22]=R,t[23]=ue,t[24]=de,t[25]=fe,t[26]=pe,t[27]=me,t[28]=he,t[29]=ge,t[30]=_e,t[31]=ve,t[32]=ye,t[33]=z);let be;t[34]===L?be=t[35]:(be=L===void 0?[]:L,t[34]=L,t[35]=be);let B=be,xe=fe!==void 0&&fe,Se=pe===void 0||pe,V=me!==void 0&&me,H=he!==void 0&&he,Ce=ge!==void 0&&ge,we=_e===void 0||_e,Te=ve!==void 0&&ve,Ee=ye===void 0||ye,De=ce!==void 0&&ce,Oe=le!==void 0&&le,ke;t[36]===R?ke=t[37]:(ke=R===void 0?[]:R,t[36]=R,t[37]=ke);let Ae=ke,je=ue!==void 0&&ue,Me=de===void 0?`prompt`:de,{_:U}=m(),[W,Ne]=(0,P.useState)(i??``),[Pe,Fe]=(0,P.useState)(!1),[Ie,Le]=(0,P.useState)(!1),[Re,ze]=(0,P.useState)(!1),[Be,Ve]=(0,P.useState)(!1),He=(0,P.useRef)(null),Ue=(0,P.useRef)(null),We=(0,P.useRef)(null),Ge=(0,P.useRef)(null),G=f(),Ke=d(),qe;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(qe={defaultValue:!1,initializeWithValue:!1},t[38]=qe):qe=t[38];let Je=g(`(pointer: coarse)`,qe),Ye=b(`prefer_text_over_image_on_paste`),Xe;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=()=>{let e=Ue.current;if(e?.isConnected)return e;let t=He.current?.querySelector(`textarea`)??null;return Ue.current=t,t},t[39]=Xe):Xe=t[39];let Ze=Xe,Qe;t[40]===C?Qe=t[41]:(Qe=(e,t)=>{Ne(e),C?.(e,t)},t[40]=C,t[41]=Qe);let K=Qe,$e;t[42]!==G||t[43]!==Ke?($e=()=>{Ke?G.set({x:0}):G.start({x:[0,-8,8,-6,6,-4,4,0],transition:{duration:.35,ease:[.32,.72,0,1]}})},t[42]=G,t[43]=Ke,t[44]=$e):$e=t[44];let q=$e,et;t[45]!==q||t[46]!==K?(et=()=>({focus:()=>Ze()?.focus(),setInputValue:e=>{K(e)},setSelectionRange:(e,t)=>{let n=t===void 0?e:t,r=Ze();r&&(r.focus({preventScroll:!0}),r.setSelectionRange(e,n))},shake:q}),t[45]=q,t[46]=K,t[47]=et):et=t[47],(0,P.useImperativeHandle)(u,et);let tt,nt;t[48]===we?(tt=t[49],nt=t[50]):(tt=()=>{we&&Ze()?.focus({preventScroll:!0})},nt=[we],t[48]=we,t[49]=tt,t[50]=nt),(0,P.useEffect)(tt,nt);let rt;t[51]===y?rt=t[52]:(rt=()=>{let e=We.current;if(!y||!e)return;let t=Ze();t&&(e.style.transform=`translate(${-t.scrollLeft}px, ${-t.scrollTop}px)`)},t[51]=y,t[52]=rt);let it;t[53]!==y||t[54]!==W?(it=[y,W],t[53]=y,t[54]=W,t[55]=it):it=t[55],(0,P.useEffect)(rt,it);let at,ot;t[56]===y?(at=t[57],ot=t[58]):(at=()=>{if(!y){let e=We.current;e&&(e.style.transform=``)}},ot=[y],t[56]=y,t[57]=at,t[58]=ot),(0,P.useEffect)(at,ot);let st;t[59]===y?st=t[60]:(st=e=>{if(!y)return;let t=We.current,n=Ue.current;t&&n&&e.target===n&&(t.style.transform=`translate(${-n.scrollLeft}px, ${-n.scrollTop}px)`)},t[59]=y,t[60]=st);let ct;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ct={passive:!0,capture:!0},t[61]=ct):ct=t[61],h(`scroll`,st,He,ct);let lt;t[62]!==B.length||t[63]!==W?(lt=W.trim().length>0||B.length>0,t[62]=B.length,t[63]=W,t[64]=lt):lt=t[64];let ut=lt,dt=B.length>0,ft;t[65]===B?ft=t[66]:(ft=B.some(se),t[65]=B,t[66]=ft);let J=!Ce&&!ut||ft,pt,mt;t[67]===J?(pt=t[68],mt=t[69]):(pt=()=>{J||Ve(!1)},mt=[J],t[67]=J,t[68]=pt,t[69]=mt),(0,P.useEffect)(pt,mt);let Y;bb0:{if(!ut){let e;t[70]===U?e=t[71]:(e=U({id:`E-2Of8`}),t[70]=U,t[71]=e),Y=e;break bb0}if(B.some(oe)){let e;t[72]===U?e=t[73]:(e=U({id:`_D6eRO`}),t[72]=U,t[73]=e),Y=e;break bb0}if(B.some(ae)){let e;t[74]===U?e=t[75]:(e=U({id:`CJndez`}),t[74]=U,t[75]=e),Y=e;break bb0}if(B.some(ie)){let e;t[76]===U?e=t[77]:(e=U({id:`MH3bVF`}),t[76]=U,t[77]=e),Y=e;break bb0}let e;t[78]===U?e=t[79]:(e=U({id:`E-2Of8`}),t[78]=U,t[79]=e),Y=e}let ht=Y,X=p!==void 0&&p!==!1&&!Re&&(typeof p==`boolean`?p:p.text),Z=typeof p==`object`?p:void 0,gt;t[80]!==xe||t[81]!==W||t[82]!==V||t[83]!==J||t[84]!==H||t[85]!==x||t[86]!==j||t[87]!==N||t[88]!==q||t[89]!==K||t[90]!==Se?(gt=()=>{if(!H){if(xe)Se&&q(),x?.();else if(V){if(!j)return;let e=W.trim();if(!e)return;j(e),K(``)}else J?(q(),Ve(!0)):N?.(W)}},t[80]=xe,t[81]=W,t[82]=V,t[83]=J,t[84]=H,t[85]=x,t[86]=j,t[87]=N,t[88]=q,t[89]=K,t[90]=Se,t[91]=gt):gt=t[91];let _t=gt,vt;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(vt=()=>{Ge.current?.click()},t[92]=vt):vt=t[92];let yt=vt,bt;t[93]===S?bt=t[94]:(bt=e=>{let t=e.target.files;t&&t.length>0&&S?.(Array.from(t)),e.target.value=``},t[93]=S,t[94]=bt);let xt=bt,St;t[95]===S?St=t[96]:(St=e=>{e.preventDefault(),e.stopPropagation(),S&&Le(!0)},t[95]=S,t[96]=St);let Ct=St,wt;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(wt=e=>{e.preventDefault(),e.stopPropagation(),!(e.relatedTarget&&e.currentTarget.contains(e.relatedTarget))&&Le(!1)},t[97]=wt):wt=t[97];let Tt=wt,Et;t[98]===S?Et=t[99]:(Et=e=>{if(e.preventDefault(),e.stopPropagation(),Le(!1),!S)return;let t=Array.from(e.dataTransfer.files);t.length>0&&S(t)},t[98]=S,t[99]=Et);let Dt=Et,Ot;t[100]!==je||t[101]!==S||t[102]!==Ye||t[103]!==K?(Ot=e=>{if(!S&&!je)return;let t=Array.from(e.clipboardData.files);if(S&&t.length>0){if(Ye&&ne(e.clipboardData,t))return;e.preventDefault(),S(t);return}let n=e.clipboardData.getData(`text/plain`);if(S&&n.length>4095){e.preventDefault();let t=new File([n],`Pasted Text`,{type:`text/plain`});S([t]);return}if(!je)return;let r=Ze();n&&r&&e.target===r&&(e.preventDefault(),document.execCommand(`insertText`,!1,n)||(r.setRangeText(n,r.selectionStart,r.selectionEnd,`end`),K(r.value,r.selectionStart)))},t[100]=je,t[101]=S,t[102]=Ye,t[103]=K,t[104]=Ot):Ot=t[104];let kt=Ot,At;t[105]===Z?At=t[106]:(At=()=>{ze(!0),Z?.onDismiss?.()},t[105]=Z,t[106]=At);let jt=At,Mt=Pe||ut||V||Ie||Te,Nt=De&&`var(--shadow-floating-composer)`,Pt=Mt&&!Ie?`inset 0 0 0 1px var(--color-depth-black-4)`:`inset 0 0 0 1px transparent`,Ft;t[107]!==Nt||t[108]!==Pt?(Ft=[Nt,Pt].filter(Boolean),t[107]=Nt,t[108]=Pt,t[109]=Ft):Ft=t[109];let It=Ft.join(`, `),Lt;t[110]===r?Lt=t[111]:(Lt=a(`flex w-full max-w-240 flex-col items-start justify-end gap-2`,r),t[110]=r,t[111]=Lt);let Rt;t[112]!==K||t[113]!==X||t[114]!==Oe||t[115]!==Ae?(Rt=Oe&&!X?/* @__PURE__ */ (0,D.jsx)(O,{suggestions:Ae,onSuggestionClick:e=>K(e.value)}):null,t[112]=K,t[113]=X,t[114]=Oe,t[115]=Ae,t[116]=Rt):Rt=t[116];let zt;t[117]!==jt||t[118]!==Z?.text||t[119]!==X?(zt=X?/* @__PURE__ */ (0,D.jsx)(w,{text:Z?.text,onDismiss:jt}):null,t[117]=jt,t[118]=Z?.text,t[119]=X,t[120]=zt):zt=t[120];let Bt;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Bt={x:0},t[121]=Bt):Bt=t[121];let Vt;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(Vt={willChange:`transform`},t[122]=Vt):Vt=t[122];let Ht=Ie&&`border border-dashed border-primary-base`,Ut;t[123]===Ht?Ut=t[124]:(Ut=a(`relative w-full overflow-hidden rounded-[20px] bg-base-weak`,Ht),t[123]=Ht,t[124]=Ut);let Wt;t[125]===It?Wt=t[126]:(Wt={boxShadow:It,transition:`box-shadow 0.2s ease`},t[125]=It,t[126]=Wt);let Gt,Kt;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(Gt=()=>Fe(!0),Kt=()=>{Fe(!1),Ve(!1)},t[127]=Gt,t[128]=Kt):(Gt=t[127],Kt=t[128]);let qt;t[129]!==n||t[130]!==xt?(qt=/* @__PURE__ */ (0,D.jsx)(`input`,{ref:Ge,type:`file`,accept:n,multiple:!0,onChange:xt,className:`hidden`}),t[129]=n,t[130]=xt,t[131]=qt):qt=t[131];let Jt;t[132]===_t?Jt=t[133]:(Jt=e=>{e.preventDefault(),_t()},t[132]=_t,t[133]=Jt);let Yt;t[134]!==B||t[135]!==dt||t[136]!==A?(Yt=dt?/* @__PURE__ */ (0,D.jsxs)(`div`,{className:`relative flex w-full shrink-0 flex-col items-start gap-2`,children:[/* @__PURE__ */ (0,D.jsx)(re,{attachments:B,types:`thread`,onRemove:A,layout:`vertical`}),/* @__PURE__ */ (0,D.jsx)(re,{attachments:B,types:[`image`,`file`],onRemove:A,layout:`horizontal`})]}):null,t[134]=B,t[135]=dt,t[136]=A,t[137]=Yt):Yt=t[137];let Xt;t[138]===Ee?Xt=t[139]:(Xt=Ee?/* @__PURE__ */ (0,D.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center`,children:/* @__PURE__ */ (0,D.jsx)(T,{variant:`color`,size:24})}):null,t[138]=Ee,t[139]=Xt);let Zt;t[140]===K?Zt=t[141]:(Zt=e=>K(e.target.value,e.target.selectionStart),t[140]=K,t[141]=Zt);let Qt;t[142]!==_t||t[143]!==W||t[144]!==Je||t[145]!==E||t[146]!==K?(Qt=e=>{if(E?.(e)===!0)e.preventDefault();else if(!Je&&!(e.nativeEvent.isComposing||e.keyCode===229)){if(e.key===`Enter`&&e.altKey){e.preventDefault();let t=e.currentTarget,n=t.selectionStart??W.length,r=t.selectionEnd??W.length,i=`${W.slice(0,n)}\n${W.slice(r)}`;K(i,n+1),requestAnimationFrame(()=>{t.setSelectionRange(n+1,n+1)})}else e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),_t())}},t[142]=_t,t[143]=W,t[144]=Je,t[145]=E,t[146]=K,t[147]=Qt):Qt=t[147];let $t;t[148]!==U||t[149]!==F?($t=F??U({id:`3ZxGc_`}),t[148]=U,t[149]=F,t[150]=$t):$t=t[150];let en=y&&`[scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden`,tn;t[151]!==en||t[152]!==z?(tn=a(`p-0`,en,z),t[151]=en,t[152]=z,t[153]=tn):tn=t[153];let Q;t[154]===y?Q=t[155]:(Q=y?{color:`transparent`,WebkitTextFillColor:`transparent`,caretColor:`var(--color-text-strong)`}:void 0,t[154]=y,t[155]=Q);let nn;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(nn=a(`min-h-0 flex-1 resize-none rounded-none border-none bg-transparent`,`focus-within:bg-transparent hover:bg-transparent`),t[156]=nn):nn=t[156];let rn;t[157]!==W||t[158]!==Zt||t[159]!==Qt||t[160]!==$t||t[161]!==tn||t[162]!==Q?(rn=/* @__PURE__ */ (0,D.jsx)(v,{rows:1,value:W,onChange:Zt,onKeyDown:Qt,placeholder:$t,variant:`inverse`,maxHeight:200,textareaClassName:tn,style:Q,className:nn}),t[157]=W,t[158]=Zt,t[159]=Qt,t[160]=$t,t[161]=tn,t[162]=Q,t[163]=rn):rn=t[163];let an;t[164]===y?an=t[165]:(an=y?/* @__PURE__ */ (0,D.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 overflow-hidden`,children:/* @__PURE__ */ (0,D.jsx)(`div`,{ref:We,children:y})}):null,t[164]=y,t[165]=an);let on;t[166]!==rn||t[167]!==an?(on=/* @__PURE__ */ (0,D.jsxs)(`div`,{ref:He,className:`pui-no-ios-zoom-container relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[rn,an]}),t[166]=rn,t[167]=an,t[168]=on):on=t[168];let sn=S?yt:void 0,cn;t[169]!==V||t[170]!==H||t[171]!==k||t[172]!==M||t[173]!==sn?(cn=/* @__PURE__ */ (0,D.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 rounded-xl`,children:/* @__PURE__ */ (0,D.jsx)(te,{onAttach:sn,onMicrophone:k,onStop:M,isStreaming:V,isSubmitLoading:H,isSubmitDisabled:!1,className:`gap-2`})}),t[169]=V,t[170]=H,t[171]=k,t[172]=M,t[173]=sn,t[174]=cn):cn=t[174];let ln;t[175]!==Xt||t[176]!==on||t[177]!==cn?(ln=/* @__PURE__ */ (0,D.jsxs)(`div`,{className:`flex min-h-10 w-full items-center gap-2 px-1 py-0.5`,children:[Xt,on,cn]}),t[175]=Xt,t[176]=on,t[177]=cn,t[178]=ln):ln=t[178];let un;t[179]===_?un=t[180]:(un=_?/* @__PURE__ */ (0,D.jsx)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center gap-2 px-1`,children:_}):null,t[179]=_,t[180]=un);let dn;t[181]!==Jt||t[182]!==Yt||t[183]!==ln||t[184]!==un?(dn=/* @__PURE__ */ (0,D.jsxs)(`form`,{onSubmit:Jt,className:`flex flex-col items-start justify-center gap-3 p-3`,children:[Yt,ln,un]}),t[181]=Jt,t[182]=Yt,t[183]=ln,t[184]=un,t[185]=dn):dn=t[185];let fn;t[186]!==Ct||t[187]!==Dt||t[188]!==kt||t[189]!==Ut||t[190]!==Wt||t[191]!==qt||t[192]!==dn?(fn=/* @__PURE__ */ (0,D.jsxs)(`div`,{"data-slot":`prompt-card`,className:Ut,style:Wt,onMouseEnter:Gt,onMouseLeave:Kt,onDragOver:Ct,onDragLeave:Tt,onDrop:Dt,onPaste:kt,children:[qt,dn]}),t[186]=Ct,t[187]=Dt,t[188]=kt,t[189]=Ut,t[190]=Wt,t[191]=qt,t[192]=dn,t[193]=fn):fn=t[193];let pn;t[194]!==G||t[195]!==fn?(pn=/* @__PURE__ */ (0,D.jsx)(o,{asChild:!0,children:/* @__PURE__ */ (0,D.jsx)(l.div,{className:`w-full`,initial:Bt,animate:G,style:Vt,children:fn})}),t[194]=G,t[195]=fn,t[196]=pn):pn=t[196];let mn;t[197]===ht?mn=t[198]:(mn=/* @__PURE__ */ (0,D.jsx)(c,{side:`top`,sideOffset:8,className:`z-100`,children:ht}),t[197]=ht,t[198]=mn);let $;t[199]!==Be||t[200]!==pn||t[201]!==mn?($=/* @__PURE__ */ (0,D.jsxs)(s,{open:Be,children:[pn,mn]}),t[199]=Be,t[200]=pn,t[201]=mn,t[202]=$):$=t[202];let hn;return t[203]!==I||t[204]!==Me||t[205]!==Lt||t[206]!==Rt||t[207]!==zt||t[208]!==$?(hn=/* @__PURE__ */ (0,D.jsxs)(`div`,{className:Lt,"qa-test-id":Me,...I,children:[Rt,zt,$]}),t[203]=I,t[204]=Me,t[205]=Lt,t[206]=Rt,t[207]=zt,t[208]=$,t[209]=hn):hn=t[209],hn}function ie(e){return e.status===`loading`}function ae(e){return e.status===`error`}function oe(e){return e.status===`unsupported`}function se(e){return e.status===`loading`||e.status===`error`||e.status===`unsupported`}export{C as Attachment,L as Prompt,j as extensionFromFilename,k as formatFileSize,N as revokeAttachmentUrl,ne as shouldPreferTextOverFiles,M as toAttachment,F as useAttachments};
@@ -129,12 +129,13 @@ function _temp(a_0, b) {
129
129
  return (a_0.status === "error" || a_0.status === "unsupported" ? 0 : 1) - (b.status === "error" || b.status === "unsupported" ? 0 : 1);
130
130
  }
131
131
  function Prompt(t0) {
132
- const $ = c(206);
132
+ const $ = c(210);
133
133
  let accept;
134
134
  let className;
135
135
  let defaultValue;
136
136
  let forwardedRef;
137
137
  let hint;
138
+ let inputFooter;
138
139
  let inputOverlay;
139
140
  let onBlockedSubmit;
140
141
  let onFilesSelected;
@@ -163,80 +164,82 @@ function Prompt(t0) {
163
164
  let t9;
164
165
  let textareaClassName;
165
166
  if ($[0] !== t0) {
166
- ({className, attachments: t1, placeholder, onFilesSelected, accept, onSubmit, blockSubmit: t2, shakeOnBlock: t3, onBlockedSubmit, onMicrophone, onRemoveAttachment, onStop, onSteer, isStreaming: t4, isSubmitLoading: t5, allowEmptySubmit: t6, autoFocus: t7, defaultValue, showScrollShadow: t8, showLogo: t9, hasShadow: t10, showSuggestions: t11, suggestions: t12, hint, onInputChange, onKeyDown, inputOverlay, textareaClassName, insertPastedTextDirectly: t13, ref: forwardedRef, qaTestId: t14, ...props} = t0);
167
+ ({className, attachments: t1, placeholder, onFilesSelected, accept, onSubmit, blockSubmit: t2, shakeOnBlock: t3, onBlockedSubmit, onMicrophone, onRemoveAttachment, onStop, onSteer, isStreaming: t4, isSubmitLoading: t5, allowEmptySubmit: t6, autoFocus: t7, defaultValue, showScrollShadow: t8, showLogo: t9, hasShadow: t10, showSuggestions: t11, suggestions: t12, hint, onInputChange, onKeyDown, inputOverlay, inputFooter, textareaClassName, insertPastedTextDirectly: t13, ref: forwardedRef, qaTestId: t14, ...props} = t0);
167
168
  $[0] = t0;
168
169
  $[1] = accept;
169
170
  $[2] = className;
170
171
  $[3] = defaultValue;
171
172
  $[4] = forwardedRef;
172
173
  $[5] = hint;
173
- $[6] = inputOverlay;
174
- $[7] = onBlockedSubmit;
175
- $[8] = onFilesSelected;
176
- $[9] = onInputChange;
177
- $[10] = onKeyDown;
178
- $[11] = onMicrophone;
179
- $[12] = onRemoveAttachment;
180
- $[13] = onSteer;
181
- $[14] = onStop;
182
- $[15] = onSubmit;
183
- $[16] = placeholder;
184
- $[17] = props;
185
- $[18] = t1;
186
- $[19] = t10;
187
- $[20] = t11;
188
- $[21] = t12;
189
- $[22] = t13;
190
- $[23] = t14;
191
- $[24] = t2;
192
- $[25] = t3;
193
- $[26] = t4;
194
- $[27] = t5;
195
- $[28] = t6;
196
- $[29] = t7;
197
- $[30] = t8;
198
- $[31] = t9;
199
- $[32] = textareaClassName;
174
+ $[6] = inputFooter;
175
+ $[7] = inputOverlay;
176
+ $[8] = onBlockedSubmit;
177
+ $[9] = onFilesSelected;
178
+ $[10] = onInputChange;
179
+ $[11] = onKeyDown;
180
+ $[12] = onMicrophone;
181
+ $[13] = onRemoveAttachment;
182
+ $[14] = onSteer;
183
+ $[15] = onStop;
184
+ $[16] = onSubmit;
185
+ $[17] = placeholder;
186
+ $[18] = props;
187
+ $[19] = t1;
188
+ $[20] = t10;
189
+ $[21] = t11;
190
+ $[22] = t12;
191
+ $[23] = t13;
192
+ $[24] = t14;
193
+ $[25] = t2;
194
+ $[26] = t3;
195
+ $[27] = t4;
196
+ $[28] = t5;
197
+ $[29] = t6;
198
+ $[30] = t7;
199
+ $[31] = t8;
200
+ $[32] = t9;
201
+ $[33] = textareaClassName;
200
202
  } else {
201
203
  accept = $[1];
202
204
  className = $[2];
203
205
  defaultValue = $[3];
204
206
  forwardedRef = $[4];
205
207
  hint = $[5];
206
- inputOverlay = $[6];
207
- onBlockedSubmit = $[7];
208
- onFilesSelected = $[8];
209
- onInputChange = $[9];
210
- onKeyDown = $[10];
211
- onMicrophone = $[11];
212
- onRemoveAttachment = $[12];
213
- onSteer = $[13];
214
- onStop = $[14];
215
- onSubmit = $[15];
216
- placeholder = $[16];
217
- props = $[17];
218
- t1 = $[18];
219
- t10 = $[19];
220
- t11 = $[20];
221
- t12 = $[21];
222
- t13 = $[22];
223
- t14 = $[23];
224
- t2 = $[24];
225
- t3 = $[25];
226
- t4 = $[26];
227
- t5 = $[27];
228
- t6 = $[28];
229
- t7 = $[29];
230
- t8 = $[30];
231
- t9 = $[31];
232
- textareaClassName = $[32];
208
+ inputFooter = $[6];
209
+ inputOverlay = $[7];
210
+ onBlockedSubmit = $[8];
211
+ onFilesSelected = $[9];
212
+ onInputChange = $[10];
213
+ onKeyDown = $[11];
214
+ onMicrophone = $[12];
215
+ onRemoveAttachment = $[13];
216
+ onSteer = $[14];
217
+ onStop = $[15];
218
+ onSubmit = $[16];
219
+ placeholder = $[17];
220
+ props = $[18];
221
+ t1 = $[19];
222
+ t10 = $[20];
223
+ t11 = $[21];
224
+ t12 = $[22];
225
+ t13 = $[23];
226
+ t14 = $[24];
227
+ t2 = $[25];
228
+ t3 = $[26];
229
+ t4 = $[27];
230
+ t5 = $[28];
231
+ t6 = $[29];
232
+ t7 = $[30];
233
+ t8 = $[31];
234
+ t9 = $[32];
235
+ textareaClassName = $[33];
233
236
  }
234
237
  let t15;
235
- if ($[33] !== t1) {
238
+ if ($[34] !== t1) {
236
239
  t15 = t1 === void 0 ? [] : t1;
237
- $[33] = t1;
238
- $[34] = t15;
239
- } else t15 = $[34];
240
+ $[34] = t1;
241
+ $[35] = t15;
242
+ } else t15 = $[35];
240
243
  const attachments = t15;
241
244
  const blockSubmit = t2 === void 0 ? false : t2;
242
245
  const shakeOnBlock = t3 === void 0 ? true : t3;
@@ -249,11 +252,11 @@ function Prompt(t0) {
249
252
  const hasShadow = t10 === void 0 ? false : t10;
250
253
  const showSuggestions = t11 === void 0 ? false : t11;
251
254
  let t16;
252
- if ($[35] !== t12) {
255
+ if ($[36] !== t12) {
253
256
  t16 = t12 === void 0 ? [] : t12;
254
- $[35] = t12;
255
- $[36] = t16;
256
- } else t16 = $[36];
257
+ $[36] = t12;
258
+ $[37] = t16;
259
+ } else t16 = $[37];
257
260
  const suggestions = t16;
258
261
  const insertPastedTextDirectly = t13 === void 0 ? false : t13;
259
262
  const qaTestId = t14 === void 0 ? "prompt" : t14;
@@ -270,17 +273,17 @@ function Prompt(t0) {
270
273
  const shakeControls = useAnimationControls();
271
274
  const shouldReduceMotion = useReducedMotion();
272
275
  let t17;
273
- if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
276
+ if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
274
277
  t17 = {
275
278
  defaultValue: false,
276
279
  initializeWithValue: false
277
280
  };
278
- $[37] = t17;
279
- } else t17 = $[37];
281
+ $[38] = t17;
282
+ } else t17 = $[38];
280
283
  const isCoarsePointer = useMediaQuery("(pointer: coarse)", t17);
281
284
  const preferTextOverImageOnPaste = useToggle("prefer_text_over_image_on_paste");
282
285
  let t18;
283
- if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
286
+ if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
284
287
  t18 = () => {
285
288
  const currentTextarea = textareaRef.current;
286
289
  if (currentTextarea?.isConnected) return currentTextarea;
@@ -288,21 +291,21 @@ function Prompt(t0) {
288
291
  textareaRef.current = textarea;
289
292
  return textarea;
290
293
  };
291
- $[38] = t18;
292
- } else t18 = $[38];
294
+ $[39] = t18;
295
+ } else t18 = $[39];
293
296
  const getTextarea = t18;
294
297
  let t19;
295
- if ($[39] !== onInputChange) {
298
+ if ($[40] !== onInputChange) {
296
299
  t19 = (value, caretPosition) => {
297
300
  setInputValue(value);
298
301
  onInputChange?.(value, caretPosition);
299
302
  };
300
- $[39] = onInputChange;
301
- $[40] = t19;
302
- } else t19 = $[40];
303
+ $[40] = onInputChange;
304
+ $[41] = t19;
305
+ } else t19 = $[41];
303
306
  const setInputValueWithChangeEvent = t19;
304
307
  let t20;
305
- if ($[41] !== shakeControls || $[42] !== shouldReduceMotion) {
308
+ if ($[42] !== shakeControls || $[43] !== shouldReduceMotion) {
306
309
  t20 = () => {
307
310
  if (shouldReduceMotion) {
308
311
  shakeControls.set({ x: 0 });
@@ -330,13 +333,13 @@ function Prompt(t0) {
330
333
  }
331
334
  });
332
335
  };
333
- $[41] = shakeControls;
334
- $[42] = shouldReduceMotion;
335
- $[43] = t20;
336
- } else t20 = $[43];
336
+ $[42] = shakeControls;
337
+ $[43] = shouldReduceMotion;
338
+ $[44] = t20;
339
+ } else t20 = $[44];
337
340
  const playShake = t20;
338
341
  let t21;
339
- if ($[44] !== playShake || $[45] !== setInputValueWithChangeEvent) {
342
+ if ($[45] !== playShake || $[46] !== setInputValueWithChangeEvent) {
340
343
  t21 = () => ({
341
344
  focus: () => getTextarea()?.focus(),
342
345
  setInputValue: (value_0) => {
@@ -351,28 +354,28 @@ function Prompt(t0) {
351
354
  },
352
355
  shake: playShake
353
356
  });
354
- $[44] = playShake;
355
- $[45] = setInputValueWithChangeEvent;
356
- $[46] = t21;
357
- } else t21 = $[46];
357
+ $[45] = playShake;
358
+ $[46] = setInputValueWithChangeEvent;
359
+ $[47] = t21;
360
+ } else t21 = $[47];
358
361
  useImperativeHandle(forwardedRef, t21);
359
362
  let t22;
360
363
  let t23;
361
- if ($[47] !== autoFocus) {
364
+ if ($[48] !== autoFocus) {
362
365
  t22 = () => {
363
366
  if (autoFocus) getTextarea()?.focus({ preventScroll: true });
364
367
  };
365
368
  t23 = [autoFocus];
366
- $[47] = autoFocus;
367
- $[48] = t22;
368
- $[49] = t23;
369
+ $[48] = autoFocus;
370
+ $[49] = t22;
371
+ $[50] = t23;
369
372
  } else {
370
- t22 = $[48];
371
- t23 = $[49];
373
+ t22 = $[49];
374
+ t23 = $[50];
372
375
  }
373
376
  useEffect(t22, t23);
374
377
  let t24;
375
- if ($[50] !== inputOverlay) {
378
+ if ($[51] !== inputOverlay) {
376
379
  t24 = () => {
377
380
  const overlayContent = inputOverlayContentRef.current;
378
381
  if (!inputOverlay || !overlayContent) return;
@@ -380,20 +383,20 @@ function Prompt(t0) {
380
383
  if (!textarea_1) return;
381
384
  overlayContent.style.transform = `translate(${-textarea_1.scrollLeft}px, ${-textarea_1.scrollTop}px)`;
382
385
  };
383
- $[50] = inputOverlay;
384
- $[51] = t24;
385
- } else t24 = $[51];
386
+ $[51] = inputOverlay;
387
+ $[52] = t24;
388
+ } else t24 = $[52];
386
389
  let t25;
387
- if ($[52] !== inputOverlay || $[53] !== inputValue) {
390
+ if ($[53] !== inputOverlay || $[54] !== inputValue) {
388
391
  t25 = [inputOverlay, inputValue];
389
- $[52] = inputOverlay;
390
- $[53] = inputValue;
391
- $[54] = t25;
392
- } else t25 = $[54];
392
+ $[53] = inputOverlay;
393
+ $[54] = inputValue;
394
+ $[55] = t25;
395
+ } else t25 = $[55];
393
396
  useEffect(t24, t25);
394
397
  let t26;
395
398
  let t27;
396
- if ($[55] !== inputOverlay) {
399
+ if ($[56] !== inputOverlay) {
397
400
  t26 = () => {
398
401
  if (!inputOverlay) {
399
402
  const overlayContent_0 = inputOverlayContentRef.current;
@@ -401,16 +404,16 @@ function Prompt(t0) {
401
404
  }
402
405
  };
403
406
  t27 = [inputOverlay];
404
- $[55] = inputOverlay;
405
- $[56] = t26;
406
- $[57] = t27;
407
+ $[56] = inputOverlay;
408
+ $[57] = t26;
409
+ $[58] = t27;
407
410
  } else {
408
- t26 = $[56];
409
- t27 = $[57];
411
+ t26 = $[57];
412
+ t27 = $[58];
410
413
  }
411
414
  useEffect(t26, t27);
412
415
  let t28;
413
- if ($[58] !== inputOverlay) {
416
+ if ($[59] !== inputOverlay) {
414
417
  t28 = (event) => {
415
418
  if (!inputOverlay) return;
416
419
  const overlayContent_1 = inputOverlayContentRef.current;
@@ -419,104 +422,104 @@ function Prompt(t0) {
419
422
  if (event.target !== textarea_2) return;
420
423
  overlayContent_1.style.transform = `translate(${-textarea_2.scrollLeft}px, ${-textarea_2.scrollTop}px)`;
421
424
  };
422
- $[58] = inputOverlay;
423
- $[59] = t28;
424
- } else t28 = $[59];
425
+ $[59] = inputOverlay;
426
+ $[60] = t28;
427
+ } else t28 = $[60];
425
428
  let t29;
426
- if ($[60] === Symbol.for("react.memo_cache_sentinel")) {
429
+ if ($[61] === Symbol.for("react.memo_cache_sentinel")) {
427
430
  t29 = {
428
431
  passive: true,
429
432
  capture: true
430
433
  };
431
- $[60] = t29;
432
- } else t29 = $[60];
434
+ $[61] = t29;
435
+ } else t29 = $[61];
433
436
  useEventListener("scroll", t28, textareaContainerRef, t29);
434
437
  let t30;
435
- if ($[61] !== attachments.length || $[62] !== inputValue) {
438
+ if ($[62] !== attachments.length || $[63] !== inputValue) {
436
439
  t30 = inputValue.trim().length > 0 || attachments.length > 0;
437
- $[61] = attachments.length;
438
- $[62] = inputValue;
439
- $[63] = t30;
440
- } else t30 = $[63];
440
+ $[62] = attachments.length;
441
+ $[63] = inputValue;
442
+ $[64] = t30;
443
+ } else t30 = $[64];
441
444
  const hasContent = t30;
442
445
  const hasAttachments = attachments.length > 0;
443
446
  let t31;
444
- if ($[64] !== attachments) {
447
+ if ($[65] !== attachments) {
445
448
  t31 = attachments.some(_temp2);
446
- $[64] = attachments;
447
- $[65] = t31;
448
- } else t31 = $[65];
449
+ $[65] = attachments;
450
+ $[66] = t31;
451
+ } else t31 = $[66];
449
452
  const isSubmitInvalid = !allowEmptySubmit && !hasContent || t31;
450
453
  let t32;
451
454
  let t33;
452
- if ($[66] !== isSubmitInvalid) {
455
+ if ($[67] !== isSubmitInvalid) {
453
456
  t32 = () => {
454
457
  if (!isSubmitInvalid) setShowRejectionTooltip(false);
455
458
  };
456
459
  t33 = [isSubmitInvalid];
457
- $[66] = isSubmitInvalid;
458
- $[67] = t32;
459
- $[68] = t33;
460
+ $[67] = isSubmitInvalid;
461
+ $[68] = t32;
462
+ $[69] = t33;
460
463
  } else {
461
- t32 = $[67];
462
- t33 = $[68];
464
+ t32 = $[68];
465
+ t33 = $[69];
463
466
  }
464
467
  useEffect(t32, t33);
465
468
  let t34;
466
469
  bb0: {
467
470
  if (!hasContent) {
468
471
  let t35;
469
- if ($[69] !== $__) {
472
+ if ($[70] !== $__) {
470
473
  t35 = $__({ id: "E-2Of8" });
471
- $[69] = $__;
472
- $[70] = t35;
473
- } else t35 = $[70];
474
+ $[70] = $__;
475
+ $[71] = t35;
476
+ } else t35 = $[71];
474
477
  t34 = t35;
475
478
  break bb0;
476
479
  }
477
480
  if (attachments.some(_temp3)) {
478
481
  let t35;
479
- if ($[71] !== $__) {
482
+ if ($[72] !== $__) {
480
483
  t35 = $__({ id: "_D6eRO" });
481
- $[71] = $__;
482
- $[72] = t35;
483
- } else t35 = $[72];
484
+ $[72] = $__;
485
+ $[73] = t35;
486
+ } else t35 = $[73];
484
487
  t34 = t35;
485
488
  break bb0;
486
489
  }
487
490
  if (attachments.some(_temp4)) {
488
491
  let t35;
489
- if ($[73] !== $__) {
492
+ if ($[74] !== $__) {
490
493
  t35 = $__({ id: "CJndez" });
491
- $[73] = $__;
492
- $[74] = t35;
493
- } else t35 = $[74];
494
+ $[74] = $__;
495
+ $[75] = t35;
496
+ } else t35 = $[75];
494
497
  t34 = t35;
495
498
  break bb0;
496
499
  }
497
500
  if (attachments.some(_temp5)) {
498
501
  let t35;
499
- if ($[75] !== $__) {
502
+ if ($[76] !== $__) {
500
503
  t35 = $__({ id: "MH3bVF" });
501
- $[75] = $__;
502
- $[76] = t35;
503
- } else t35 = $[76];
504
+ $[76] = $__;
505
+ $[77] = t35;
506
+ } else t35 = $[77];
504
507
  t34 = t35;
505
508
  break bb0;
506
509
  }
507
510
  let t35;
508
- if ($[77] !== $__) {
511
+ if ($[78] !== $__) {
509
512
  t35 = $__({ id: "E-2Of8" });
510
- $[77] = $__;
511
- $[78] = t35;
512
- } else t35 = $[78];
513
+ $[78] = $__;
514
+ $[79] = t35;
515
+ } else t35 = $[79];
513
516
  t34 = t35;
514
517
  }
515
518
  const rejectionTooltipMessage = t34;
516
519
  const showHintBanner = hint !== void 0 && hint !== false && !hintDismissed && (typeof hint === "boolean" ? hint : hint.text);
517
520
  const hintContent = typeof hint === "object" ? hint : void 0;
518
521
  let t35;
519
- if ($[79] !== blockSubmit || $[80] !== inputValue || $[81] !== isStreaming || $[82] !== isSubmitInvalid || $[83] !== isSubmitLoading || $[84] !== onBlockedSubmit || $[85] !== onSteer || $[86] !== onSubmit || $[87] !== playShake || $[88] !== setInputValueWithChangeEvent || $[89] !== shakeOnBlock) {
522
+ if ($[80] !== blockSubmit || $[81] !== inputValue || $[82] !== isStreaming || $[83] !== isSubmitInvalid || $[84] !== isSubmitLoading || $[85] !== onBlockedSubmit || $[86] !== onSteer || $[87] !== onSubmit || $[88] !== playShake || $[89] !== setInputValueWithChangeEvent || $[90] !== shakeOnBlock) {
520
523
  t35 = () => {
521
524
  if (isSubmitLoading) return;
522
525
  if (blockSubmit) {
@@ -539,63 +542,63 @@ function Prompt(t0) {
539
542
  }
540
543
  onSubmit?.(inputValue);
541
544
  };
542
- $[79] = blockSubmit;
543
- $[80] = inputValue;
544
- $[81] = isStreaming;
545
- $[82] = isSubmitInvalid;
546
- $[83] = isSubmitLoading;
547
- $[84] = onBlockedSubmit;
548
- $[85] = onSteer;
549
- $[86] = onSubmit;
550
- $[87] = playShake;
551
- $[88] = setInputValueWithChangeEvent;
552
- $[89] = shakeOnBlock;
553
- $[90] = t35;
554
- } else t35 = $[90];
545
+ $[80] = blockSubmit;
546
+ $[81] = inputValue;
547
+ $[82] = isStreaming;
548
+ $[83] = isSubmitInvalid;
549
+ $[84] = isSubmitLoading;
550
+ $[85] = onBlockedSubmit;
551
+ $[86] = onSteer;
552
+ $[87] = onSubmit;
553
+ $[88] = playShake;
554
+ $[89] = setInputValueWithChangeEvent;
555
+ $[90] = shakeOnBlock;
556
+ $[91] = t35;
557
+ } else t35 = $[91];
555
558
  const handleSubmit = t35;
556
559
  let t36;
557
- if ($[91] === Symbol.for("react.memo_cache_sentinel")) {
560
+ if ($[92] === Symbol.for("react.memo_cache_sentinel")) {
558
561
  t36 = () => {
559
562
  fileInputRef.current?.click();
560
563
  };
561
- $[91] = t36;
562
- } else t36 = $[91];
564
+ $[92] = t36;
565
+ } else t36 = $[92];
563
566
  const handleAttachClick = t36;
564
567
  let t37;
565
- if ($[92] !== onFilesSelected) {
568
+ if ($[93] !== onFilesSelected) {
566
569
  t37 = (e) => {
567
570
  const files = e.target.files;
568
571
  if (files && files.length > 0) onFilesSelected?.(Array.from(files));
569
572
  e.target.value = "";
570
573
  };
571
- $[92] = onFilesSelected;
572
- $[93] = t37;
573
- } else t37 = $[93];
574
+ $[93] = onFilesSelected;
575
+ $[94] = t37;
576
+ } else t37 = $[94];
574
577
  const handleFileChange = t37;
575
578
  let t38;
576
- if ($[94] !== onFilesSelected) {
579
+ if ($[95] !== onFilesSelected) {
577
580
  t38 = (e_0) => {
578
581
  e_0.preventDefault();
579
582
  e_0.stopPropagation();
580
583
  if (onFilesSelected) setIsDragOver(true);
581
584
  };
582
- $[94] = onFilesSelected;
583
- $[95] = t38;
584
- } else t38 = $[95];
585
+ $[95] = onFilesSelected;
586
+ $[96] = t38;
587
+ } else t38 = $[96];
585
588
  const handleDragOver = t38;
586
589
  let t39;
587
- if ($[96] === Symbol.for("react.memo_cache_sentinel")) {
590
+ if ($[97] === Symbol.for("react.memo_cache_sentinel")) {
588
591
  t39 = (e_1) => {
589
592
  e_1.preventDefault();
590
593
  e_1.stopPropagation();
591
594
  if (e_1.relatedTarget && e_1.currentTarget.contains(e_1.relatedTarget)) return;
592
595
  setIsDragOver(false);
593
596
  };
594
- $[96] = t39;
595
- } else t39 = $[96];
597
+ $[97] = t39;
598
+ } else t39 = $[97];
596
599
  const handleDragLeave = t39;
597
600
  let t40;
598
- if ($[97] !== onFilesSelected) {
601
+ if ($[98] !== onFilesSelected) {
599
602
  t40 = (e_2) => {
600
603
  e_2.preventDefault();
601
604
  e_2.stopPropagation();
@@ -604,12 +607,12 @@ function Prompt(t0) {
604
607
  const files_0 = Array.from(e_2.dataTransfer.files);
605
608
  if (files_0.length > 0) onFilesSelected(files_0);
606
609
  };
607
- $[97] = onFilesSelected;
608
- $[98] = t40;
609
- } else t40 = $[98];
610
+ $[98] = onFilesSelected;
611
+ $[99] = t40;
612
+ } else t40 = $[99];
610
613
  const handleDrop = t40;
611
614
  let t41;
612
- if ($[99] !== insertPastedTextDirectly || $[100] !== onFilesSelected || $[101] !== preferTextOverImageOnPaste || $[102] !== setInputValueWithChangeEvent) {
615
+ if ($[100] !== insertPastedTextDirectly || $[101] !== onFilesSelected || $[102] !== preferTextOverImageOnPaste || $[103] !== setInputValueWithChangeEvent) {
613
616
  t41 = (e_3) => {
614
617
  if (!onFilesSelected && !insertPastedTextDirectly) return;
615
618
  const files_1 = Array.from(e_3.clipboardData.files);
@@ -635,105 +638,105 @@ function Prompt(t0) {
635
638
  setInputValueWithChangeEvent(textarea_3.value, textarea_3.selectionStart);
636
639
  }
637
640
  };
638
- $[99] = insertPastedTextDirectly;
639
- $[100] = onFilesSelected;
640
- $[101] = preferTextOverImageOnPaste;
641
- $[102] = setInputValueWithChangeEvent;
642
- $[103] = t41;
643
- } else t41 = $[103];
641
+ $[100] = insertPastedTextDirectly;
642
+ $[101] = onFilesSelected;
643
+ $[102] = preferTextOverImageOnPaste;
644
+ $[103] = setInputValueWithChangeEvent;
645
+ $[104] = t41;
646
+ } else t41 = $[104];
644
647
  const handlePaste = t41;
645
648
  let t42;
646
- if ($[104] !== hintContent) {
649
+ if ($[105] !== hintContent) {
647
650
  t42 = () => {
648
651
  setHintDismissed(true);
649
652
  hintContent?.onDismiss?.();
650
653
  };
651
- $[104] = hintContent;
652
- $[105] = t42;
653
- } else t42 = $[105];
654
+ $[105] = hintContent;
655
+ $[106] = t42;
656
+ } else t42 = $[106];
654
657
  const handleHintDismiss = t42;
655
658
  const showBorder = isHovered || hasContent || isStreaming || isDragOver || showScrollShadow;
656
659
  const t43 = hasShadow && "var(--shadow-floating-composer)";
657
660
  const t44 = showBorder && !isDragOver ? "inset 0 0 0 1px var(--color-depth-black-4)" : "inset 0 0 0 1px transparent";
658
661
  let t45;
659
- if ($[106] !== t43 || $[107] !== t44) {
662
+ if ($[107] !== t43 || $[108] !== t44) {
660
663
  t45 = [t43, t44].filter(Boolean);
661
- $[106] = t43;
662
- $[107] = t44;
663
- $[108] = t45;
664
- } else t45 = $[108];
664
+ $[107] = t43;
665
+ $[108] = t44;
666
+ $[109] = t45;
667
+ } else t45 = $[109];
665
668
  const insetShadow = t45.join(", ");
666
669
  let t46;
667
- if ($[109] !== className) {
670
+ if ($[110] !== className) {
668
671
  t46 = cn("flex w-full max-w-240 flex-col items-start justify-end gap-2", className);
669
- $[109] = className;
670
- $[110] = t46;
671
- } else t46 = $[110];
672
+ $[110] = className;
673
+ $[111] = t46;
674
+ } else t46 = $[111];
672
675
  let t47;
673
- if ($[111] !== setInputValueWithChangeEvent || $[112] !== showHintBanner || $[113] !== showSuggestions || $[114] !== suggestions) {
676
+ if ($[112] !== setInputValueWithChangeEvent || $[113] !== showHintBanner || $[114] !== showSuggestions || $[115] !== suggestions) {
674
677
  t47 = showSuggestions && !showHintBanner ? /* @__PURE__ */ jsx(PromptSuggestions, {
675
678
  suggestions,
676
679
  onSuggestionClick: (s) => setInputValueWithChangeEvent(s.value)
677
680
  }) : null;
678
- $[111] = setInputValueWithChangeEvent;
679
- $[112] = showHintBanner;
680
- $[113] = showSuggestions;
681
- $[114] = suggestions;
682
- $[115] = t47;
683
- } else t47 = $[115];
681
+ $[112] = setInputValueWithChangeEvent;
682
+ $[113] = showHintBanner;
683
+ $[114] = showSuggestions;
684
+ $[115] = suggestions;
685
+ $[116] = t47;
686
+ } else t47 = $[116];
684
687
  let t48;
685
- if ($[116] !== handleHintDismiss || $[117] !== hintContent?.text || $[118] !== showHintBanner) {
688
+ if ($[117] !== handleHintDismiss || $[118] !== hintContent?.text || $[119] !== showHintBanner) {
686
689
  t48 = showHintBanner ? /* @__PURE__ */ jsx(PromptHint, {
687
690
  text: hintContent?.text,
688
691
  onDismiss: handleHintDismiss
689
692
  }) : null;
690
- $[116] = handleHintDismiss;
691
- $[117] = hintContent?.text;
692
- $[118] = showHintBanner;
693
- $[119] = t48;
694
- } else t48 = $[119];
693
+ $[117] = handleHintDismiss;
694
+ $[118] = hintContent?.text;
695
+ $[119] = showHintBanner;
696
+ $[120] = t48;
697
+ } else t48 = $[120];
695
698
  let t49;
696
- if ($[120] === Symbol.for("react.memo_cache_sentinel")) {
699
+ if ($[121] === Symbol.for("react.memo_cache_sentinel")) {
697
700
  t49 = { x: 0 };
698
- $[120] = t49;
699
- } else t49 = $[120];
701
+ $[121] = t49;
702
+ } else t49 = $[121];
700
703
  let t50;
701
- if ($[121] === Symbol.for("react.memo_cache_sentinel")) {
704
+ if ($[122] === Symbol.for("react.memo_cache_sentinel")) {
702
705
  t50 = { willChange: "transform" };
703
- $[121] = t50;
704
- } else t50 = $[121];
706
+ $[122] = t50;
707
+ } else t50 = $[122];
705
708
  const t51 = isDragOver && "border border-dashed border-primary-base";
706
709
  let t52;
707
- if ($[122] !== t51) {
710
+ if ($[123] !== t51) {
708
711
  t52 = cn("relative w-full overflow-hidden rounded-[20px] bg-base-weak", t51);
709
- $[122] = t51;
710
- $[123] = t52;
711
- } else t52 = $[123];
712
+ $[123] = t51;
713
+ $[124] = t52;
714
+ } else t52 = $[124];
712
715
  let t53;
713
- if ($[124] !== insetShadow) {
716
+ if ($[125] !== insetShadow) {
714
717
  t53 = {
715
718
  boxShadow: insetShadow,
716
719
  transition: "box-shadow 0.2s ease"
717
720
  };
718
- $[124] = insetShadow;
719
- $[125] = t53;
720
- } else t53 = $[125];
721
+ $[125] = insetShadow;
722
+ $[126] = t53;
723
+ } else t53 = $[126];
721
724
  let t54;
722
725
  let t55;
723
- if ($[126] === Symbol.for("react.memo_cache_sentinel")) {
726
+ if ($[127] === Symbol.for("react.memo_cache_sentinel")) {
724
727
  t54 = () => setIsHovered(true);
725
728
  t55 = () => {
726
729
  setIsHovered(false);
727
730
  setShowRejectionTooltip(false);
728
731
  };
729
- $[126] = t54;
730
- $[127] = t55;
732
+ $[127] = t54;
733
+ $[128] = t55;
731
734
  } else {
732
- t54 = $[126];
733
- t55 = $[127];
735
+ t54 = $[127];
736
+ t55 = $[128];
734
737
  }
735
738
  let t56;
736
- if ($[128] !== accept || $[129] !== handleFileChange) {
739
+ if ($[129] !== accept || $[130] !== handleFileChange) {
737
740
  t56 = /* @__PURE__ */ jsx("input", {
738
741
  ref: fileInputRef,
739
742
  type: "file",
@@ -742,21 +745,21 @@ function Prompt(t0) {
742
745
  onChange: handleFileChange,
743
746
  className: "hidden"
744
747
  });
745
- $[128] = accept;
746
- $[129] = handleFileChange;
747
- $[130] = t56;
748
- } else t56 = $[130];
748
+ $[129] = accept;
749
+ $[130] = handleFileChange;
750
+ $[131] = t56;
751
+ } else t56 = $[131];
749
752
  let t57;
750
- if ($[131] !== handleSubmit) {
753
+ if ($[132] !== handleSubmit) {
751
754
  t57 = (e_4) => {
752
755
  e_4.preventDefault();
753
756
  handleSubmit();
754
757
  };
755
- $[131] = handleSubmit;
756
- $[132] = t57;
757
- } else t57 = $[132];
758
+ $[132] = handleSubmit;
759
+ $[133] = t57;
760
+ } else t57 = $[133];
758
761
  let t58;
759
- if ($[133] !== attachments || $[134] !== hasAttachments || $[135] !== onRemoveAttachment) {
762
+ if ($[134] !== attachments || $[135] !== hasAttachments || $[136] !== onRemoveAttachment) {
760
763
  t58 = hasAttachments ? /* @__PURE__ */ jsxs("div", {
761
764
  className: "relative flex w-full shrink-0 flex-col items-start gap-2",
762
765
  children: [/* @__PURE__ */ jsx(AttachmentRow, {
@@ -771,13 +774,13 @@ function Prompt(t0) {
771
774
  layout: "horizontal"
772
775
  })]
773
776
  }) : null;
774
- $[133] = attachments;
775
- $[134] = hasAttachments;
776
- $[135] = onRemoveAttachment;
777
- $[136] = t58;
778
- } else t58 = $[136];
777
+ $[134] = attachments;
778
+ $[135] = hasAttachments;
779
+ $[136] = onRemoveAttachment;
780
+ $[137] = t58;
781
+ } else t58 = $[137];
779
782
  let t59;
780
- if ($[137] !== showLogo) {
783
+ if ($[138] !== showLogo) {
781
784
  t59 = showLogo ? /* @__PURE__ */ jsx("div", {
782
785
  className: "flex h-9 w-9 shrink-0 items-center justify-center",
783
786
  children: /* @__PURE__ */ jsx(LogoPI, {
@@ -785,17 +788,17 @@ function Prompt(t0) {
785
788
  size: 24
786
789
  })
787
790
  }) : null;
788
- $[137] = showLogo;
789
- $[138] = t59;
790
- } else t59 = $[138];
791
+ $[138] = showLogo;
792
+ $[139] = t59;
793
+ } else t59 = $[139];
791
794
  let t60;
792
- if ($[139] !== setInputValueWithChangeEvent) {
795
+ if ($[140] !== setInputValueWithChangeEvent) {
793
796
  t60 = (e_5) => setInputValueWithChangeEvent(e_5.target.value, e_5.target.selectionStart);
794
- $[139] = setInputValueWithChangeEvent;
795
- $[140] = t60;
796
- } else t60 = $[140];
797
+ $[140] = setInputValueWithChangeEvent;
798
+ $[141] = t60;
799
+ } else t60 = $[141];
797
800
  let t61;
798
- if ($[141] !== handleSubmit || $[142] !== inputValue || $[143] !== isCoarsePointer || $[144] !== onKeyDown || $[145] !== setInputValueWithChangeEvent) {
801
+ if ($[142] !== handleSubmit || $[143] !== inputValue || $[144] !== isCoarsePointer || $[145] !== onKeyDown || $[146] !== setInputValueWithChangeEvent) {
799
802
  t61 = (e_6) => {
800
803
  if (onKeyDown?.(e_6) === true) {
801
804
  e_6.preventDefault();
@@ -820,45 +823,45 @@ function Prompt(t0) {
820
823
  handleSubmit();
821
824
  }
822
825
  };
823
- $[141] = handleSubmit;
824
- $[142] = inputValue;
825
- $[143] = isCoarsePointer;
826
- $[144] = onKeyDown;
827
- $[145] = setInputValueWithChangeEvent;
828
- $[146] = t61;
829
- } else t61 = $[146];
826
+ $[142] = handleSubmit;
827
+ $[143] = inputValue;
828
+ $[144] = isCoarsePointer;
829
+ $[145] = onKeyDown;
830
+ $[146] = setInputValueWithChangeEvent;
831
+ $[147] = t61;
832
+ } else t61 = $[147];
830
833
  let t62;
831
- if ($[147] !== $__ || $[148] !== placeholder) {
834
+ if ($[148] !== $__ || $[149] !== placeholder) {
832
835
  t62 = placeholder ?? $__({ id: "3ZxGc_" });
833
- $[147] = $__;
834
- $[148] = placeholder;
835
- $[149] = t62;
836
- } else t62 = $[149];
836
+ $[148] = $__;
837
+ $[149] = placeholder;
838
+ $[150] = t62;
839
+ } else t62 = $[150];
837
840
  const t63 = inputOverlay && "[scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden";
838
841
  let t64;
839
- if ($[150] !== t63 || $[151] !== textareaClassName) {
842
+ if ($[151] !== t63 || $[152] !== textareaClassName) {
840
843
  t64 = cn("p-0", t63, textareaClassName);
841
- $[150] = t63;
842
- $[151] = textareaClassName;
843
- $[152] = t64;
844
- } else t64 = $[152];
844
+ $[151] = t63;
845
+ $[152] = textareaClassName;
846
+ $[153] = t64;
847
+ } else t64 = $[153];
845
848
  let t65;
846
- if ($[153] !== inputOverlay) {
849
+ if ($[154] !== inputOverlay) {
847
850
  t65 = inputOverlay ? {
848
851
  color: "transparent",
849
852
  WebkitTextFillColor: "transparent",
850
853
  caretColor: "var(--color-text-strong)"
851
854
  } : void 0;
852
- $[153] = inputOverlay;
853
- $[154] = t65;
854
- } else t65 = $[154];
855
+ $[154] = inputOverlay;
856
+ $[155] = t65;
857
+ } else t65 = $[155];
855
858
  let t66;
856
- if ($[155] === Symbol.for("react.memo_cache_sentinel")) {
859
+ if ($[156] === Symbol.for("react.memo_cache_sentinel")) {
857
860
  t66 = cn("min-h-0 flex-1 resize-none rounded-none border-none bg-transparent", "focus-within:bg-transparent hover:bg-transparent");
858
- $[155] = t66;
859
- } else t66 = $[155];
861
+ $[156] = t66;
862
+ } else t66 = $[156];
860
863
  let t67;
861
- if ($[156] !== inputValue || $[157] !== t60 || $[158] !== t61 || $[159] !== t62 || $[160] !== t64 || $[161] !== t65) {
864
+ if ($[157] !== inputValue || $[158] !== t60 || $[159] !== t61 || $[160] !== t62 || $[161] !== t64 || $[162] !== t65) {
862
865
  t67 = /* @__PURE__ */ jsx(TextareaControl, {
863
866
  rows: 1,
864
867
  value: inputValue,
@@ -871,16 +874,16 @@ function Prompt(t0) {
871
874
  style: t65,
872
875
  className: t66
873
876
  });
874
- $[156] = inputValue;
875
- $[157] = t60;
876
- $[158] = t61;
877
- $[159] = t62;
878
- $[160] = t64;
879
- $[161] = t65;
880
- $[162] = t67;
881
- } else t67 = $[162];
877
+ $[157] = inputValue;
878
+ $[158] = t60;
879
+ $[159] = t61;
880
+ $[160] = t62;
881
+ $[161] = t64;
882
+ $[162] = t65;
883
+ $[163] = t67;
884
+ } else t67 = $[163];
882
885
  let t68;
883
- if ($[163] !== inputOverlay) {
886
+ if ($[164] !== inputOverlay) {
884
887
  t68 = inputOverlay ? /* @__PURE__ */ jsx("div", {
885
888
  className: "pointer-events-none absolute inset-0 z-10 overflow-hidden",
886
889
  children: /* @__PURE__ */ jsx("div", {
@@ -888,23 +891,23 @@ function Prompt(t0) {
888
891
  children: inputOverlay
889
892
  })
890
893
  }) : null;
891
- $[163] = inputOverlay;
892
- $[164] = t68;
893
- } else t68 = $[164];
894
+ $[164] = inputOverlay;
895
+ $[165] = t68;
896
+ } else t68 = $[165];
894
897
  let t69;
895
- if ($[165] !== t67 || $[166] !== t68) {
898
+ if ($[166] !== t67 || $[167] !== t68) {
896
899
  t69 = /* @__PURE__ */ jsxs("div", {
897
900
  ref: textareaContainerRef,
898
901
  className: "pui-no-ios-zoom-container relative flex min-h-0 min-w-0 flex-1 flex-col",
899
902
  children: [t67, t68]
900
903
  });
901
- $[165] = t67;
902
- $[166] = t68;
903
- $[167] = t69;
904
- } else t69 = $[167];
904
+ $[166] = t67;
905
+ $[167] = t68;
906
+ $[168] = t69;
907
+ } else t69 = $[168];
905
908
  const t70 = onFilesSelected ? handleAttachClick : void 0;
906
909
  let t71;
907
- if ($[168] !== isStreaming || $[169] !== isSubmitLoading || $[170] !== onMicrophone || $[171] !== onStop || $[172] !== t70) {
910
+ if ($[169] !== isStreaming || $[170] !== isSubmitLoading || $[171] !== onMicrophone || $[172] !== onStop || $[173] !== t70) {
908
911
  t71 = /* @__PURE__ */ jsx("div", {
909
912
  className: "flex shrink-0 items-center gap-2 rounded-xl",
910
913
  children: /* @__PURE__ */ jsx(Toolbar, {
@@ -917,15 +920,15 @@ function Prompt(t0) {
917
920
  className: "gap-2"
918
921
  })
919
922
  });
920
- $[168] = isStreaming;
921
- $[169] = isSubmitLoading;
922
- $[170] = onMicrophone;
923
- $[171] = onStop;
924
- $[172] = t70;
925
- $[173] = t71;
926
- } else t71 = $[173];
923
+ $[169] = isStreaming;
924
+ $[170] = isSubmitLoading;
925
+ $[171] = onMicrophone;
926
+ $[172] = onStop;
927
+ $[173] = t70;
928
+ $[174] = t71;
929
+ } else t71 = $[174];
927
930
  let t72;
928
- if ($[174] !== t59 || $[175] !== t69 || $[176] !== t71) {
931
+ if ($[175] !== t59 || $[176] !== t69 || $[177] !== t71) {
929
932
  t72 = /* @__PURE__ */ jsxs("div", {
930
933
  className: "flex min-h-10 w-full items-center gap-2 px-1 py-0.5",
931
934
  children: [
@@ -934,26 +937,40 @@ function Prompt(t0) {
934
937
  t71
935
938
  ]
936
939
  });
937
- $[174] = t59;
938
- $[175] = t69;
939
- $[176] = t71;
940
- $[177] = t72;
941
- } else t72 = $[177];
940
+ $[175] = t59;
941
+ $[176] = t69;
942
+ $[177] = t71;
943
+ $[178] = t72;
944
+ } else t72 = $[178];
942
945
  let t73;
943
- if ($[178] !== t57 || $[179] !== t58 || $[180] !== t72) {
944
- t73 = /* @__PURE__ */ jsxs("form", {
946
+ if ($[179] !== inputFooter) {
947
+ t73 = inputFooter ? /* @__PURE__ */ jsx("div", {
948
+ className: "flex w-full min-w-0 flex-wrap items-center gap-2 px-1",
949
+ children: inputFooter
950
+ }) : null;
951
+ $[179] = inputFooter;
952
+ $[180] = t73;
953
+ } else t73 = $[180];
954
+ let t74;
955
+ if ($[181] !== t57 || $[182] !== t58 || $[183] !== t72 || $[184] !== t73) {
956
+ t74 = /* @__PURE__ */ jsxs("form", {
945
957
  onSubmit: t57,
946
958
  className: "flex flex-col items-start justify-center gap-3 p-3",
947
- children: [t58, t72]
959
+ children: [
960
+ t58,
961
+ t72,
962
+ t73
963
+ ]
948
964
  });
949
- $[178] = t57;
950
- $[179] = t58;
951
- $[180] = t72;
952
- $[181] = t73;
953
- } else t73 = $[181];
954
- let t74;
955
- if ($[182] !== handleDragOver || $[183] !== handleDrop || $[184] !== handlePaste || $[185] !== t52 || $[186] !== t53 || $[187] !== t56 || $[188] !== t73) {
956
- t74 = /* @__PURE__ */ jsxs("div", {
965
+ $[181] = t57;
966
+ $[182] = t58;
967
+ $[183] = t72;
968
+ $[184] = t73;
969
+ $[185] = t74;
970
+ } else t74 = $[185];
971
+ let t75;
972
+ if ($[186] !== handleDragOver || $[187] !== handleDrop || $[188] !== handlePaste || $[189] !== t52 || $[190] !== t53 || $[191] !== t56 || $[192] !== t74) {
973
+ t75 = /* @__PURE__ */ jsxs("div", {
957
974
  "data-slot": "prompt-card",
958
975
  className: t52,
959
976
  style: t53,
@@ -963,76 +980,76 @@ function Prompt(t0) {
963
980
  onDragLeave: handleDragLeave,
964
981
  onDrop: handleDrop,
965
982
  onPaste: handlePaste,
966
- children: [t56, t73]
983
+ children: [t56, t74]
967
984
  });
968
- $[182] = handleDragOver;
969
- $[183] = handleDrop;
970
- $[184] = handlePaste;
971
- $[185] = t52;
972
- $[186] = t53;
973
- $[187] = t56;
974
- $[188] = t73;
975
- $[189] = t74;
976
- } else t74 = $[189];
977
- let t75;
978
- if ($[190] !== shakeControls || $[191] !== t74) {
979
- t75 = /* @__PURE__ */ jsx(TooltipTrigger, {
985
+ $[186] = handleDragOver;
986
+ $[187] = handleDrop;
987
+ $[188] = handlePaste;
988
+ $[189] = t52;
989
+ $[190] = t53;
990
+ $[191] = t56;
991
+ $[192] = t74;
992
+ $[193] = t75;
993
+ } else t75 = $[193];
994
+ let t76;
995
+ if ($[194] !== shakeControls || $[195] !== t75) {
996
+ t76 = /* @__PURE__ */ jsx(TooltipTrigger, {
980
997
  asChild: true,
981
998
  children: /* @__PURE__ */ jsx(motion.div, {
982
999
  className: "w-full",
983
1000
  initial: t49,
984
1001
  animate: shakeControls,
985
1002
  style: t50,
986
- children: t74
1003
+ children: t75
987
1004
  })
988
1005
  });
989
- $[190] = shakeControls;
990
- $[191] = t74;
991
- $[192] = t75;
992
- } else t75 = $[192];
993
- let t76;
994
- if ($[193] !== rejectionTooltipMessage) {
995
- t76 = /* @__PURE__ */ jsx(TooltipContent, {
1006
+ $[194] = shakeControls;
1007
+ $[195] = t75;
1008
+ $[196] = t76;
1009
+ } else t76 = $[196];
1010
+ let t77;
1011
+ if ($[197] !== rejectionTooltipMessage) {
1012
+ t77 = /* @__PURE__ */ jsx(TooltipContent, {
996
1013
  side: "top",
997
1014
  sideOffset: 8,
998
1015
  className: "z-100",
999
1016
  children: rejectionTooltipMessage
1000
1017
  });
1001
- $[193] = rejectionTooltipMessage;
1002
- $[194] = t76;
1003
- } else t76 = $[194];
1004
- let t77;
1005
- if ($[195] !== showRejectionTooltip || $[196] !== t75 || $[197] !== t76) {
1006
- t77 = /* @__PURE__ */ jsxs(Tooltip, {
1007
- open: showRejectionTooltip,
1008
- children: [t75, t76]
1009
- });
1010
- $[195] = showRejectionTooltip;
1011
- $[196] = t75;
1012
- $[197] = t76;
1018
+ $[197] = rejectionTooltipMessage;
1013
1019
  $[198] = t77;
1014
1020
  } else t77 = $[198];
1015
1021
  let t78;
1016
- if ($[199] !== props || $[200] !== qaTestId || $[201] !== t46 || $[202] !== t47 || $[203] !== t48 || $[204] !== t77) {
1017
- t78 = /* @__PURE__ */ jsxs("div", {
1022
+ if ($[199] !== showRejectionTooltip || $[200] !== t76 || $[201] !== t77) {
1023
+ t78 = /* @__PURE__ */ jsxs(Tooltip, {
1024
+ open: showRejectionTooltip,
1025
+ children: [t76, t77]
1026
+ });
1027
+ $[199] = showRejectionTooltip;
1028
+ $[200] = t76;
1029
+ $[201] = t77;
1030
+ $[202] = t78;
1031
+ } else t78 = $[202];
1032
+ let t79;
1033
+ if ($[203] !== props || $[204] !== qaTestId || $[205] !== t46 || $[206] !== t47 || $[207] !== t48 || $[208] !== t78) {
1034
+ t79 = /* @__PURE__ */ jsxs("div", {
1018
1035
  className: t46,
1019
1036
  "qa-test-id": qaTestId,
1020
1037
  ...props,
1021
1038
  children: [
1022
1039
  t47,
1023
1040
  t48,
1024
- t77
1041
+ t78
1025
1042
  ]
1026
1043
  });
1027
- $[199] = props;
1028
- $[200] = qaTestId;
1029
- $[201] = t46;
1030
- $[202] = t47;
1031
- $[203] = t48;
1032
- $[204] = t77;
1033
- $[205] = t78;
1034
- } else t78 = $[205];
1035
- return t78;
1044
+ $[203] = props;
1045
+ $[204] = qaTestId;
1046
+ $[205] = t46;
1047
+ $[206] = t47;
1048
+ $[207] = t48;
1049
+ $[208] = t78;
1050
+ $[209] = t79;
1051
+ } else t79 = $[209];
1052
+ return t79;
1036
1053
  }
1037
1054
  function _temp5(a_2) {
1038
1055
  return a_2.status === "loading";
@@ -2,7 +2,7 @@
2
2
  const NPM_CDN = "https://cdn.jsdelivr.net/npm/";
3
3
  const SHARED = /^(@patterninc\/pattern-ui\/|(react|react-dom|@lingui\/core|@lingui\/react|sucrase)(\/|$))/;
4
4
  const scriptUrl = document.currentScript instanceof HTMLScriptElement ? document.currentScript.src : "";
5
- const packageUrl = new URL("../", scriptUrl || location.href).href.replace(/\/@patterninc\/pattern-ui(@[^/]*)?\//, `/@patterninc/pattern-ui@0.0.0-main.202611040528.6d912e601fb7/`);
5
+ const packageUrl = new URL("../", scriptUrl || location.href).href.replace(/\/@patterninc\/pattern-ui(@[^/]*)?\//, `/@patterninc/pattern-ui@0.0.0-main.202611040732.bb44d67d2992/`);
6
6
  const browserUrl = `${packageUrl}dist/browser/`;
7
7
  globalThis.patternPlayCdnUrl = (specifier) => {
8
8
  if (specifier.endsWith(".css")) return `${browserUrl}${specifier}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patterninc/pattern-ui",
3
- "version": "0.0.0-main.202611040528.6d912e601fb7",
3
+ "version": "0.0.0-main.202611040732.bb44d67d2992",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/patterninc/pattern-exp.git",
@@ -211,6 +211,11 @@ export interface PromptProps extends Omit<
211
211
  * transparent so the overlay shows through.
212
212
  */
213
213
  inputOverlay?: ReactNode
214
+ /**
215
+ * Optional row rendered inside the prompt card, under the input row (e.g. a mode switch or a
216
+ * picker that scopes what the prompt sends). Hidden when omitted.
217
+ */
218
+ inputFooter?: ReactNode
214
219
  /**
215
220
  * Optional className merged onto the inner `TextareaControl`'s `<textarea>` element. Use to scope
216
221
  * one-off style overrides (e.g. a `selection:` text-selection color) to a single `Prompt`
@@ -262,6 +267,7 @@ export function Prompt({
262
267
  onInputChange,
263
268
  onKeyDown,
264
269
  inputOverlay,
270
+ inputFooter,
265
271
  textareaClassName,
266
272
  insertPastedTextDirectly = false,
267
273
  ref: forwardedRef,
@@ -708,6 +714,11 @@ export function Prompt({
708
714
  />
709
715
  </div>
710
716
  </div>
717
+ {inputFooter ? (
718
+ <div className='flex w-full min-w-0 flex-wrap items-center gap-2 px-1'>
719
+ {inputFooter}
720
+ </div>
721
+ ) : null}
711
722
  </form>
712
723
  </div>
713
724
  </motion.div>