streamlit-nightly 1.46.2.dev20250708__py3-none-any.whl → 1.46.2.dev20250709__py3-none-any.whl

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.
Files changed (79) hide show
  1. streamlit/elements/vega_charts.py +8 -0
  2. streamlit/elements/widgets/chat.py +35 -5
  3. streamlit/runtime/secrets.py +4 -8
  4. streamlit/static/index.html +1 -1
  5. streamlit/static/manifest.json +218 -218
  6. streamlit/static/static/js/{ErrorOutline.esm.CO5UETnI.js → ErrorOutline.esm.CQd6KUc-.js} +1 -1
  7. streamlit/static/static/js/{FileDownload.esm.BodlLZ2E.js → FileDownload.esm.DViLqD3l.js} +1 -1
  8. streamlit/static/static/js/{FileHelper.BJWG5mWZ.js → FileHelper.C4kAiX-d.js} +1 -1
  9. streamlit/static/static/js/{FormClearHelper.Bfl6Fb0k.js → FormClearHelper.3-U9496x.js} +1 -1
  10. streamlit/static/static/js/{Hooks.BZNasbgB.js → Hooks.rP-qI29F.js} +1 -1
  11. streamlit/static/static/js/{InputInstructions.D9_advjq.js → InputInstructions.BbLQarVh.js} +1 -1
  12. streamlit/static/static/js/{ProgressBar.BOxvIdHT.js → ProgressBar.XjFCBQue.js} +1 -1
  13. streamlit/static/static/js/{RenderInPortalIfExists.B-maQ3lr.js → RenderInPortalIfExists.BjvT0tcH.js} +1 -1
  14. streamlit/static/static/js/{Toolbar.BulWrSVh.js → Toolbar.CI7e539m.js} +1 -1
  15. streamlit/static/static/js/{base-input.oeeD4NYL.js → base-input.BwJuQKxC.js} +1 -1
  16. streamlit/static/static/js/{checkbox.BqkhIzEX.js → checkbox.YcCb7In-.js} +1 -1
  17. streamlit/static/static/js/{createSuper.bxk9uEsc.js → createSuper.fMnDQXwy.js} +1 -1
  18. streamlit/static/static/js/{data-grid-overlay-editor.BFUaa7qj.js → data-grid-overlay-editor.DispNmCy.js} +1 -1
  19. streamlit/static/static/js/{downloader.CkJ9l-mW.js → downloader._vfB-j-e.js} +1 -1
  20. streamlit/static/static/js/{es6.CwBeRZxt.js → es6.DIYMfE-r.js} +2 -2
  21. streamlit/static/static/js/{iframeResizer.contentWindow.B4xDykub.js → iframeResizer.contentWindow.CXpyzNXN.js} +1 -1
  22. streamlit/static/static/js/{index.D4WIU5V6.js → index.4cT3qV4n.js} +1 -1
  23. streamlit/static/static/js/{index.BffMV8Pv.js → index.5oEU0Akm.js} +1 -1
  24. streamlit/static/static/js/{index.BNmqvLux.js → index.B1xRrJhO.js} +1 -1
  25. streamlit/static/static/js/{index.JlbLrYBv.js → index.BIU1Hwtm.js} +7 -7
  26. streamlit/static/static/js/{index.CGqm8hCs.js → index.BIsGWvbq.js} +1 -1
  27. streamlit/static/static/js/{index.Dl-ChXDk.js → index.BJLFstQK.js} +1 -1
  28. streamlit/static/static/js/{index.CL4vTLmN.js → index.BNjHNjlf.js} +1 -1
  29. streamlit/static/static/js/{index.CfqX1ZBe.js → index.BQVB466_.js} +1 -1
  30. streamlit/static/static/js/{index.D3TXItBH.js → index.BYrFjIUs.js} +1 -1
  31. streamlit/static/static/js/{index.Ba65H8D9.js → index.BdEa6sZz.js} +1 -1
  32. streamlit/static/static/js/{index.B0vAXwMf.js → index.BgUl4InR.js} +1 -1
  33. streamlit/static/static/js/{index.BxVKLNUY.js → index.Bo8tNSYW.js} +1 -1
  34. streamlit/static/static/js/{index.BTHnpf1I.js → index.BqJEh5EN.js} +1 -1
  35. streamlit/static/static/js/{index.CIEFJvy6.js → index.Bqhfg7Oa.js} +1 -1
  36. streamlit/static/static/js/{index.BPKHA8Id.js → index.CQayRGxD.js} +1 -1
  37. streamlit/static/static/js/{index.D-sXGL7m.js → index.CUirymUQ.js} +1 -1
  38. streamlit/static/static/js/{index.D-8V3tc4.js → index.Cfv4QyQX.js} +1 -1
  39. streamlit/static/static/js/{index.BypmpIBL.js → index.Chkl1asR.js} +1 -1
  40. streamlit/static/static/js/{index.BdnKKSPg.js → index.ColMLoRT.js} +1 -1
  41. streamlit/static/static/js/{index.VY0EoknV.js → index.Cx24fujh.js} +1 -1
  42. streamlit/static/static/js/{index.BP1DQKkm.js → index.D1VFO1GM.js} +1 -1
  43. streamlit/static/static/js/{index.DFRMOZ8C.js → index.D2-Y5_wx.js} +173 -173
  44. streamlit/static/static/js/{index.oJk4Ge1s.js → index.D4qwHqKM.js} +1 -1
  45. streamlit/static/static/js/{index.BGGyfLIH.js → index.D8bLiwaV.js} +1 -1
  46. streamlit/static/static/js/{index.BHzjJ3JF.js → index.D958aGV_.js} +5 -5
  47. streamlit/static/static/js/{index.B6ClyDWN.js → index.D9GxqhKH.js} +1 -1
  48. streamlit/static/static/js/{index.DQXLgrs8.js → index.DG9Ir4m4.js} +1 -1
  49. streamlit/static/static/js/{index.BAyahmk4.js → index.DQXpaPor.js} +1 -1
  50. streamlit/static/static/js/{index.zT8XLZtx.js → index.DfriPCJP.js} +1 -1
  51. streamlit/static/static/js/{index.CFoM9W4u.js → index.Dga_qPJ0.js} +1 -1
  52. streamlit/static/static/js/{index.FerMd1cU.js → index.Dgd7wAuk.js} +1 -1
  53. streamlit/static/static/js/{index.CIeZ4fAx.js → index.Dy7h795S.js} +1 -1
  54. streamlit/static/static/js/{index.aAeBp5Oj.js → index.E56AjTPB.js} +1 -1
  55. streamlit/static/static/js/{index.um9CUbiU.js → index.Jr-tvRTy.js} +1 -1
  56. streamlit/static/static/js/{index.Bejef4Pk.js → index.LbtilNNP.js} +3 -3
  57. streamlit/static/static/js/{index.C795t44A.js → index.atasR7_f.js} +1 -1
  58. streamlit/static/static/js/{index.DgSLJq20.js → index.c5gLd5mL.js} +1 -1
  59. streamlit/static/static/js/{input.C3tznRn_.js → input.Dudaq2DP.js} +1 -1
  60. streamlit/static/static/js/{memory.OHbOX5Ru.js → memory.DIuUp1Sn.js} +1 -1
  61. streamlit/static/static/js/{mergeWith._KN0v5Xp.js → mergeWith.D9D0WgL_.js} +1 -1
  62. streamlit/static/static/js/{number-overlay-editor.BKok-OUE.js → number-overlay-editor.DUBtvgiU.js} +1 -1
  63. streamlit/static/static/js/{possibleConstructorReturn.BfCdE8Gx.js → possibleConstructorReturn.ql9j_wzC.js} +1 -1
  64. streamlit/static/static/js/{sandbox.BeWP76j9.js → sandbox.D_vlGgEg.js} +1 -1
  65. streamlit/static/static/js/{timepicker.C8LfA2ZU.js → timepicker.DtFPFwb0.js} +1 -1
  66. streamlit/static/static/js/{toConsumableArray.BHlwNsw4.js → toConsumableArray.DMsseOni.js} +1 -1
  67. streamlit/static/static/js/{uniqueId.Ds4mfmXu.js → uniqueId.BkUMU8CT.js} +1 -1
  68. streamlit/static/static/js/{useBasicWidgetState.Ds5amAnj.js → useBasicWidgetState.Cp78gjjh.js} +1 -1
  69. streamlit/static/static/js/{useOnInputChange.CnPrmPV-.js → useOnInputChange.CHkjh73V.js} +1 -1
  70. streamlit/static/static/js/{useTextInputAutoExpand.DRi3Jfhk.js → useTextInputAutoExpand.CE_GiZ0L.js} +1 -1
  71. streamlit/static/static/js/{withFullScreenWrapper.DtwYvNjS.js → withFullScreenWrapper.CplO1PK6.js} +1 -1
  72. streamlit/watcher/event_based_path_watcher.py +3 -2
  73. streamlit/watcher/polling_path_watcher.py +2 -1
  74. {streamlit_nightly-1.46.2.dev20250708.dist-info → streamlit_nightly-1.46.2.dev20250709.dist-info}/METADATA +1 -1
  75. {streamlit_nightly-1.46.2.dev20250708.dist-info → streamlit_nightly-1.46.2.dev20250709.dist-info}/RECORD +79 -79
  76. {streamlit_nightly-1.46.2.dev20250708.data → streamlit_nightly-1.46.2.dev20250709.data}/scripts/streamlit.cmd +0 -0
  77. {streamlit_nightly-1.46.2.dev20250708.dist-info → streamlit_nightly-1.46.2.dev20250709.dist-info}/WHEEL +0 -0
  78. {streamlit_nightly-1.46.2.dev20250708.dist-info → streamlit_nightly-1.46.2.dev20250709.dist-info}/entry_points.txt +0 -0
  79. {streamlit_nightly-1.46.2.dev20250708.dist-info → streamlit_nightly-1.46.2.dev20250709.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{r as l,E as _,_ as G,s as p,B as dt,z as $,j as o,b9 as Y,bu as ct,C as S,bp as J,b4 as q,bo as E,a_ as pt,bI as ut,bG as j,bj as gt,bJ as v,bs as ht,F as Q,aP as ft,bg as mt,bK as yt,M as H,bl as Ct,bk as bt}from"./index.JlbLrYBv.js";import{g as vt,C as It,I as xt,F as M,E as wt,a as St,s as Ft,u as Ut,b as zt}from"./FileHelper.BJWG5mWZ.js";import{I as Et}from"./InputInstructions.D9_advjq.js";import{i as Tt}from"./inputUtils.CptNuJwn.js";import{u as Bt,T as Dt}from"./useTextInputAutoExpand.DRi3Jfhk.js";import{E as Rt}from"./ErrorOutline.esm.CO5UETnI.js";import{U as Z}from"./UploadFileInfo.C-jY39rj.js";import"./base-input.oeeD4NYL.js";var tt=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(_,G({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),l.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});tt.displayName="AttachFile";var et=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(_,G({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("rect",{width:24,height:24,fill:"none"}),l.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});et.displayName="Send";const Ht=p("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),Lt=p("div",{target:"e1togvvn1"})(({theme:t,extended:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??t.colors.transparent,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:t.spacing.lg,maxHeight:e?"none":t.sizes.minElementHeight,gap:t.spacing.sm,overflow:"hidden",":focus-within":{borderColor:t.colors.primary}})),kt=p("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:r})=>{const d=dt(t),[f,c]=d?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:r?"0":t.radii.chatInput,borderTopLeftRadius:r?t.radii.default:"0",borderBottomRightRadius:t.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.sm,color:e?f:c,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:d?t.colors.gray10:t.colors.gray90},"&:hover":{color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray,cursor:"not-allowed"}}}),Mt=p("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),$t=p("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),Vt=p("div",{target:"e15560op0"})(({theme:t,height:e})=>({backgroundColor:t.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${t.sizes.emptyDropdownHeight}, ${e})`,width:"100%",zIndex:t.zIndices.priority})),Wt=p("div",{target:"e15560op1"})(({theme:t,height:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.primary,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,color:t.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",height:e,width:"100%",fontWeight:t.fontWeights.bold})),Nt=p("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),At=p("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),Pt=p("div",{target:"e15560op4"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),Kt=p("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Ot=p("div",{target:"e15560op6"})({display:"flex"}),Xt=p("div",{target:"e15560op7"})({flex:"0 0 auto"}),jt=p("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),_t=p("div",{target:"e15560op9"})(({theme:t})=>({color:t.colors.fadedText60})),Gt=p("div",{target:"e15560op10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Yt=p("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Jt=p("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function qt({children:t,content:e}){const r=$();return o(ct,{content:e,placement:Y.TOP,overrides:{Body:{style:{top:`-${r.sizes.minElementHeight}`}}},children:t})}const Qt=({fileInfo:t})=>{const e=$(),{type:r}=t.status;switch(r){case"uploading":return o(ut,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return o(qt,{content:t.status.errorMessage,children:o(E,{color:e.colors.red,content:Rt,size:"lg"})});case"uploaded":return o(E,{content:xt,size:"lg"});default:return pt(r),null}},Zt=({fileInfo:t,onDelete:e})=>S(jt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[o(_t,{children:o(Qt,{fileInfo:t})}),o(Gt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),o(Yt,{children:vt(t.size,M.Byte)}),o(Jt,{"data-testid":"stChatInputDeleteBtn",children:o(J,{onClick:()=>e(t.id),kind:q.MINIMAL,children:o(E,{content:It,size:"lg"})})})]}),te=l.memo(Zt),ee=({items:t,onDelete:e})=>o(Kt,{"data-testid":"stChatUploadedFiles",children:o(Ot,{children:t.map(r=>o(Xt,{children:o(te,{fileInfo:r,onDelete:e})},r.id))})}),oe=l.memo(ee),ne=({getNextLocalFileId:t,addFiles:e,updateFile:r,uploadClient:d,element:f,onUploadProgress:c,onUploadComplete:C})=>(y,m)=>{const g=j.CancelToken.source(),u=new Z(m.name,m.size,t(),{type:"uploading",cancelToken:g,progress:1});e([u]),d.uploadFile({formId:"",...f},y.uploadUrl,m,h=>c(h,u.id),g.token).then(()=>C(u.id,y)).catch(h=>{j.isCancel(h)||r(u.id,u.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},ae=({acceptMultipleFiles:t,maxFileSize:e,uploadClient:r,uploadFile:d,addFiles:f,getNextLocalFileId:c,deleteExistingFiles:C,onUploadComplete:y})=>(m,g)=>{if(!t&&m.length===0&&g.length>1){const u=g.findIndex(h=>h.errors?.[0].code===wt.TooManyFiles);u>=0&&(m.push(g[u].file),g.splice(u,1))}if(!t&&m.length>0&&C(),r.fetchFileURLs(m).then(u=>{gt(u,m).forEach(([h,T])=>{d(h,T)})}).catch(u=>{f(m.map(h=>new Z(h.name,h.size,c(),{type:"error",errorMessage:u})))}),g.length>0){const u=g.map(h=>St(h,c(),e));f(u)}y()},re=({getRootProps:t,getInputProps:e,acceptFile:r,disabled:d,theme:f})=>S(Nt,{disabled:d,children:[S(At,{"data-testid":"stChatInputFileUploadButton",disabled:d,...t(),children:[o("input",{...e()}),o(ht,{content:`Upload or drag and drop ${r===v.Multiple?"files":"a file"}`,placement:Y.TOP,onMouseEnterDelay:500,children:o(J,{kind:q.MINIMAL,disabled:d,children:o(E,{content:tt,size:"lg",color:d?f.colors.fadedText40:f.colors.fadedText60})})})]}),o(Pt,{})]}),ie=l.memo(re),se=({getRootProps:t,getInputProps:e,acceptFile:r,inputHeight:d})=>S(Q,{children:[o(Vt,{height:d,...t(),children:o("input",{...e()})}),o(Wt,{height:d,children:`Drag and drop ${r===v.Multiple?"files":"a file"} here`})]}),le=l.memo(se),L=(t,e,r)=>r.map(d=>d.id===t?e:d),k=(t,e)=>e.find(r=>r.id===t);function de({disabled:t,element:e,widgetMgr:r,fragmentId:d,uploadClient:f}){const c=$(),{placeholder:C,maxChars:y}=e,m=l.useRef(0),g=l.useRef(null),[u,h]=ft(),{innerWidth:T,innerHeight:V}=mt(),[F,B]=l.useState(e.default),[I,x]=l.useState([]),[U,D]=l.useState(!1),w=Bt({textareaRef:g,dependencies:[C]}),R=l.useMemo(()=>I.some(n=>n.status.type==="uploading")?!1:F!==""||I.length>0,[I,F]),b=yt(e.acceptFile),W=Ft(e.maxUploadSizeMb,M.Megabyte,M.Byte),N=l.useCallback(n=>x(i=>[...i,...n]),[]),A=l.useCallback(n=>{x(i=>{const s=k(n,i);return H(s)?i:(s.status.type==="uploading"&&s.status.cancelToken.cancel(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&f.deleteFile(s.status.fileUrls.deleteUrl),i.filter(a=>a.id!==n))})},[f]),ot=()=>{const n=I.filter(i=>i.status.type==="uploaded").map(i=>{const{name:s,size:a,status:z}=i,{fileId:st,fileUrls:lt}=z;return new Ct({fileId:st,fileUrls:lt,name:s,size:a})});return new bt({uploadedFileInfo:n})},P=()=>m.current++,nt=ae({acceptMultipleFiles:b===v.Multiple,maxFileSize:W,uploadClient:f,uploadFile:ne({getNextLocalFileId:P,addFiles:N,updateFile:(n,i)=>{x(s=>L(n,i,s))},uploadClient:f,element:e,onUploadProgress:(n,i)=>{x(s=>{const a=k(i,s);if(H(a)||a.status.type!=="uploading")return s;const z=Math.round(n.loaded*100/n.total);return a.status.progress===z?s:L(i,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:z}),s)})},onUploadComplete:(n,i)=>{x(s=>{const a=k(n,s);return H(a)||a.status.type!=="uploading"?s:L(a.id,a.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}),s)})}}),addFiles:N,getNextLocalFileId:P,deleteExistingFiles:()=>I.forEach(n=>A(n.id)),onUploadComplete:()=>{g.current&&g.current.focus()}}),{getRootProps:K,getInputProps:O}=Ut({onDrop:nt,multiple:b===v.Multiple,accept:zt(e.fileType),maxSize:W}),X=()=>{if(g.current&&g.current.focus(),!R||t)return;const n={data:F,fileUploaderState:ot()};r.setChatInputValue(e,n,{fromUi:!0},d),x([]),B("")},at=n=>{const{metaKey:i,ctrlKey:s,shiftKey:a}=n;Tt(n)&&!a&&!s&&!i&&(n.preventDefault(),X())},rt=n=>{const{value:i}=n.target;y!==0&&i.length>y||(B(i),w.updateScrollHeight())};l.useEffect(()=>{if(e.setValue){e.setValue=!1;const n=e.value||"";B(n)}},[e]),l.useEffect(()=>{const n=a=>{a.preventDefault(),a.stopPropagation(),!U&&a.dataTransfer?.types.includes("Files")&&D(!0)},i=a=>{a.preventDefault(),a.stopPropagation(),U&&(a.clientX<=0&&a.clientY<=0||a.clientX>=T&&a.clientY>=V)&&D(!1)},s=a=>{a.preventDefault(),a.stopPropagation(),U&&D(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",s),window.addEventListener("dragleave",i),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",s),window.removeEventListener("dragleave",i)}},[U,T,V]);const it=b!==v.None&&U;return S(Q,{children:[b===v.None?null:o(oe,{items:[...I],onDelete:A}),o(Ht,{className:"stChatInput","data-testid":"stChatInput",ref:h,children:it?o(le,{getRootProps:K,getInputProps:O,acceptFile:b,inputHeight:w.height}):S(Lt,{extended:w.isExtended,children:[b===v.None?null:o(ie,{getRootProps:K,getInputProps:O,acceptFile:b,disabled:t,theme:c}),o(Dt,{inputRef:g,value:F,placeholder:C,onChange:rt,onKeyDown:at,"aria-label":C,disabled:t,rows:1,overrides:{Root:{style:{minHeight:c.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:c.fontWeights.normal,lineHeight:c.lineHeights.inputWidget,"::placeholder":{color:c.colors.fadedText60},height:w.height,maxHeight:w.maxHeight,paddingLeft:c.spacing.none,paddingBottom:c.spacing.sm,paddingTop:c.spacing.sm,paddingRight:`calc(${c.iconSizes.xl} + 2 * ${c.spacing.sm} + ${c.spacing.sm})`}}}}),u>c.breakpoints.hideWidgetDetails&&o($t,{children:o(Et,{dirty:R,value:F,maxLength:y,type:"chat",inForm:!1})}),o(Mt,{children:o(kt,{onClick:X,disabled:!R||t,extended:w.isExtended,"data-testid":"stChatInputSubmitButton",children:o(E,{content:et,size:"xl",color:"inherit"})})})]})})]})}const Ce=l.memo(de);export{Ce as default};
1
+ import{r as l,E as _,_ as G,s as p,B as dt,z as $,j as o,b9 as Y,bu as ct,C as S,bp as J,b4 as q,bo as E,a_ as pt,bI as ut,bG as j,bj as gt,bJ as v,bs as ht,F as Q,aP as ft,bg as mt,bK as yt,M as H,bl as Ct,bk as bt}from"./index.BIU1Hwtm.js";import{g as vt,C as It,I as xt,F as M,E as wt,a as St,s as Ft,u as Ut,b as zt}from"./FileHelper.C4kAiX-d.js";import{I as Et}from"./InputInstructions.BbLQarVh.js";import{i as Tt}from"./inputUtils.CptNuJwn.js";import{u as Bt,T as Dt}from"./useTextInputAutoExpand.CE_GiZ0L.js";import{E as Rt}from"./ErrorOutline.esm.CQd6KUc-.js";import{U as Z}from"./UploadFileInfo.C-jY39rj.js";import"./base-input.BwJuQKxC.js";var tt=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(_,G({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),l.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});tt.displayName="AttachFile";var et=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(_,G({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("rect",{width:24,height:24,fill:"none"}),l.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});et.displayName="Send";const Ht=p("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),Lt=p("div",{target:"e1togvvn1"})(({theme:t,extended:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??t.colors.transparent,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:t.spacing.lg,maxHeight:e?"none":t.sizes.minElementHeight,gap:t.spacing.sm,overflow:"hidden",":focus-within":{borderColor:t.colors.primary}})),kt=p("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:r})=>{const d=dt(t),[f,c]=d?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:r?"0":t.radii.chatInput,borderTopLeftRadius:r?t.radii.default:"0",borderBottomRightRadius:t.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.sm,color:e?f:c,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:d?t.colors.gray10:t.colors.gray90},"&:hover":{color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray,cursor:"not-allowed"}}}),Mt=p("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),$t=p("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),Vt=p("div",{target:"e15560op0"})(({theme:t,height:e})=>({backgroundColor:t.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${t.sizes.emptyDropdownHeight}, ${e})`,width:"100%",zIndex:t.zIndices.priority})),Wt=p("div",{target:"e15560op1"})(({theme:t,height:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.primary,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,color:t.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",height:e,width:"100%",fontWeight:t.fontWeights.bold})),Nt=p("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),At=p("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),Pt=p("div",{target:"e15560op4"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),Kt=p("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Ot=p("div",{target:"e15560op6"})({display:"flex"}),Xt=p("div",{target:"e15560op7"})({flex:"0 0 auto"}),jt=p("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),_t=p("div",{target:"e15560op9"})(({theme:t})=>({color:t.colors.fadedText60})),Gt=p("div",{target:"e15560op10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Yt=p("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Jt=p("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function qt({children:t,content:e}){const r=$();return o(ct,{content:e,placement:Y.TOP,overrides:{Body:{style:{top:`-${r.sizes.minElementHeight}`}}},children:t})}const Qt=({fileInfo:t})=>{const e=$(),{type:r}=t.status;switch(r){case"uploading":return o(ut,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return o(qt,{content:t.status.errorMessage,children:o(E,{color:e.colors.red,content:Rt,size:"lg"})});case"uploaded":return o(E,{content:xt,size:"lg"});default:return pt(r),null}},Zt=({fileInfo:t,onDelete:e})=>S(jt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[o(_t,{children:o(Qt,{fileInfo:t})}),o(Gt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),o(Yt,{children:vt(t.size,M.Byte)}),o(Jt,{"data-testid":"stChatInputDeleteBtn",children:o(J,{onClick:()=>e(t.id),kind:q.MINIMAL,children:o(E,{content:It,size:"lg"})})})]}),te=l.memo(Zt),ee=({items:t,onDelete:e})=>o(Kt,{"data-testid":"stChatUploadedFiles",children:o(Ot,{children:t.map(r=>o(Xt,{children:o(te,{fileInfo:r,onDelete:e})},r.id))})}),oe=l.memo(ee),ne=({getNextLocalFileId:t,addFiles:e,updateFile:r,uploadClient:d,element:f,onUploadProgress:c,onUploadComplete:C})=>(y,m)=>{const g=j.CancelToken.source(),u=new Z(m.name,m.size,t(),{type:"uploading",cancelToken:g,progress:1});e([u]),d.uploadFile({formId:"",...f},y.uploadUrl,m,h=>c(h,u.id),g.token).then(()=>C(u.id,y)).catch(h=>{j.isCancel(h)||r(u.id,u.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},ae=({acceptMultipleFiles:t,maxFileSize:e,uploadClient:r,uploadFile:d,addFiles:f,getNextLocalFileId:c,deleteExistingFiles:C,onUploadComplete:y})=>(m,g)=>{if(!t&&m.length===0&&g.length>1){const u=g.findIndex(h=>h.errors?.[0].code===wt.TooManyFiles);u>=0&&(m.push(g[u].file),g.splice(u,1))}if(!t&&m.length>0&&C(),r.fetchFileURLs(m).then(u=>{gt(u,m).forEach(([h,T])=>{d(h,T)})}).catch(u=>{f(m.map(h=>new Z(h.name,h.size,c(),{type:"error",errorMessage:u})))}),g.length>0){const u=g.map(h=>St(h,c(),e));f(u)}y()},re=({getRootProps:t,getInputProps:e,acceptFile:r,disabled:d,theme:f})=>S(Nt,{disabled:d,children:[S(At,{"data-testid":"stChatInputFileUploadButton",disabled:d,...t(),children:[o("input",{...e()}),o(ht,{content:`Upload or drag and drop ${r===v.Multiple?"files":"a file"}`,placement:Y.TOP,onMouseEnterDelay:500,children:o(J,{kind:q.MINIMAL,disabled:d,children:o(E,{content:tt,size:"lg",color:d?f.colors.fadedText40:f.colors.fadedText60})})})]}),o(Pt,{})]}),ie=l.memo(re),se=({getRootProps:t,getInputProps:e,acceptFile:r,inputHeight:d})=>S(Q,{children:[o(Vt,{height:d,...t(),children:o("input",{...e()})}),o(Wt,{height:d,children:`Drag and drop ${r===v.Multiple?"files":"a file"} here`})]}),le=l.memo(se),L=(t,e,r)=>r.map(d=>d.id===t?e:d),k=(t,e)=>e.find(r=>r.id===t);function de({disabled:t,element:e,widgetMgr:r,fragmentId:d,uploadClient:f}){const c=$(),{placeholder:C,maxChars:y}=e,m=l.useRef(0),g=l.useRef(null),[u,h]=ft(),{innerWidth:T,innerHeight:V}=mt(),[F,B]=l.useState(e.default),[I,x]=l.useState([]),[U,D]=l.useState(!1),w=Bt({textareaRef:g,dependencies:[C]}),R=l.useMemo(()=>I.some(n=>n.status.type==="uploading")?!1:F!==""||I.length>0,[I,F]),b=yt(e.acceptFile),W=Ft(e.maxUploadSizeMb,M.Megabyte,M.Byte),N=l.useCallback(n=>x(i=>[...i,...n]),[]),A=l.useCallback(n=>{x(i=>{const s=k(n,i);return H(s)?i:(s.status.type==="uploading"&&s.status.cancelToken.cancel(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&f.deleteFile(s.status.fileUrls.deleteUrl),i.filter(a=>a.id!==n))})},[f]),ot=()=>{const n=I.filter(i=>i.status.type==="uploaded").map(i=>{const{name:s,size:a,status:z}=i,{fileId:st,fileUrls:lt}=z;return new Ct({fileId:st,fileUrls:lt,name:s,size:a})});return new bt({uploadedFileInfo:n})},P=()=>m.current++,nt=ae({acceptMultipleFiles:b===v.Multiple,maxFileSize:W,uploadClient:f,uploadFile:ne({getNextLocalFileId:P,addFiles:N,updateFile:(n,i)=>{x(s=>L(n,i,s))},uploadClient:f,element:e,onUploadProgress:(n,i)=>{x(s=>{const a=k(i,s);if(H(a)||a.status.type!=="uploading")return s;const z=Math.round(n.loaded*100/n.total);return a.status.progress===z?s:L(i,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:z}),s)})},onUploadComplete:(n,i)=>{x(s=>{const a=k(n,s);return H(a)||a.status.type!=="uploading"?s:L(a.id,a.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}),s)})}}),addFiles:N,getNextLocalFileId:P,deleteExistingFiles:()=>I.forEach(n=>A(n.id)),onUploadComplete:()=>{g.current&&g.current.focus()}}),{getRootProps:K,getInputProps:O}=Ut({onDrop:nt,multiple:b===v.Multiple,accept:zt(e.fileType),maxSize:W}),X=()=>{if(g.current&&g.current.focus(),!R||t)return;const n={data:F,fileUploaderState:ot()};r.setChatInputValue(e,n,{fromUi:!0},d),x([]),B("")},at=n=>{const{metaKey:i,ctrlKey:s,shiftKey:a}=n;Tt(n)&&!a&&!s&&!i&&(n.preventDefault(),X())},rt=n=>{const{value:i}=n.target;y!==0&&i.length>y||(B(i),w.updateScrollHeight())};l.useEffect(()=>{if(e.setValue){e.setValue=!1;const n=e.value||"";B(n)}},[e]),l.useEffect(()=>{const n=a=>{a.preventDefault(),a.stopPropagation(),!U&&a.dataTransfer?.types.includes("Files")&&D(!0)},i=a=>{a.preventDefault(),a.stopPropagation(),U&&(a.clientX<=0&&a.clientY<=0||a.clientX>=T&&a.clientY>=V)&&D(!1)},s=a=>{a.preventDefault(),a.stopPropagation(),U&&D(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",s),window.addEventListener("dragleave",i),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",s),window.removeEventListener("dragleave",i)}},[U,T,V]);const it=b!==v.None&&U;return S(Q,{children:[b===v.None?null:o(oe,{items:[...I],onDelete:A}),o(Ht,{className:"stChatInput","data-testid":"stChatInput",ref:h,children:it?o(le,{getRootProps:K,getInputProps:O,acceptFile:b,inputHeight:w.height}):S(Lt,{extended:w.isExtended,children:[b===v.None?null:o(ie,{getRootProps:K,getInputProps:O,acceptFile:b,disabled:t,theme:c}),o(Dt,{inputRef:g,value:F,placeholder:C,onChange:rt,onKeyDown:at,"aria-label":C,disabled:t,rows:1,overrides:{Root:{style:{minHeight:c.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:c.fontWeights.normal,lineHeight:c.lineHeights.inputWidget,"::placeholder":{color:c.colors.fadedText60},height:w.height,maxHeight:w.maxHeight,paddingLeft:c.spacing.none,paddingBottom:c.spacing.sm,paddingTop:c.spacing.sm,paddingRight:`calc(${c.iconSizes.xl} + 2 * ${c.spacing.sm} + ${c.spacing.sm})`}}}}),u>c.breakpoints.hideWidgetDetails&&o($t,{children:o(Et,{dirty:R,value:F,maxLength:y,type:"chat",inForm:!1})}),o(Mt,{children:o(kt,{onClick:X,disabled:!R||t,extended:w.isExtended,"data-testid":"stChatInputSubmitButton",children:o(E,{content:et,size:"xl",color:"inherit"})})})]})})]})}const Ce=l.memo(de);export{Ce as default};