streamlit-nightly 1.42.1.dev20250205__py2.py3-none-any.whl → 1.42.1.dev20250208__py2.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 (78) hide show
  1. streamlit/auth_util.py +8 -0
  2. streamlit/config.py +18 -1
  3. streamlit/proto/NewSession_pb2.pyi +4 -1
  4. streamlit/runtime/app_session.py +35 -15
  5. streamlit/runtime/caching/cache_utils.py +1 -1
  6. streamlit/static/index.html +1 -1
  7. streamlit/static/static/js/{FileDownload.esm.ShSIWsKj.js → FileDownload.esm.D9415avj.js} +1 -1
  8. streamlit/static/static/js/FileDropzone.Cd515bsy.js +5 -0
  9. streamlit/static/static/js/{FormClearHelper.Bue0QSIn.js → FormClearHelper.BBpErIGP.js} +1 -1
  10. streamlit/static/static/js/{Hooks.kV16_k1-.js → Hooks.CeSTXIj2.js} +1 -1
  11. streamlit/static/static/js/{InputInstructions.DpG38kbY.js → InputInstructions.BU5Td5cJ.js} +1 -1
  12. streamlit/static/static/js/{ProgressBar.B_WJAIyy.js → ProgressBar.J2QhvKtD.js} +1 -1
  13. streamlit/static/static/js/{RenderInPortalIfExists.CGAGPcQq.js → RenderInPortalIfExists.BbbrvJaa.js} +1 -1
  14. streamlit/static/static/js/{Toolbar.DBtrI961.js → Toolbar.D-hUr0RX.js} +1 -1
  15. streamlit/static/static/js/{base-input.P8VGAZdC.js → base-input.CNkkCv4B.js} +1 -1
  16. streamlit/static/static/js/{createSuper.GYQHnroV.js → createSuper.DHhKMTIx.js} +1 -1
  17. streamlit/static/static/js/{data-grid-overlay-editor.B1sLTR3f.js → data-grid-overlay-editor.CRylpesE.js} +1 -1
  18. streamlit/static/static/js/{downloader.y-Ssi2d3.js → downloader.D_08g5mI.js} +1 -1
  19. streamlit/static/static/js/{es6.DpUKmjxe.js → es6.B-Rq6ajt.js} +2 -2
  20. streamlit/static/static/js/{iframeResizer.contentWindow.BBjdpeP0.js → iframeResizer.contentWindow.CFL3MAVr.js} +1 -1
  21. streamlit/static/static/js/{index.C-BkiutF.js → index.-SmXSkUY.js} +1 -1
  22. streamlit/static/static/js/{index.DuqdUleB.js → index.9wBA4A4f.js} +5 -5
  23. streamlit/static/static/js/{index.D-Qsohh0.js → index.B-4MHYvl.js} +1 -1
  24. streamlit/static/static/js/{index.B7AJyWjy.js → index.B0xfT3p4.js} +1 -1
  25. streamlit/static/static/js/{index.BqiT_qyM.js → index.B2evntzQ.js} +1 -1
  26. streamlit/static/static/js/{index.D_CViY1G.js → index.B9q8XlSH.js} +1 -1
  27. streamlit/static/static/js/{index.Cd8_b4vi.js → index.BA5ubsQA.js} +1 -1
  28. streamlit/static/static/js/{index.CC_i5fnL.js → index.BCYuLMdi.js} +1 -1
  29. streamlit/static/static/js/{index.CVIsVMt0.js → index.BNrZwkh1.js} +1 -1
  30. streamlit/static/static/js/{index.DdJR-Re7.js → index.BVbWPXFU.js} +1 -1
  31. streamlit/static/static/js/{index.CZFA90VV.js → index.BevO9CYu.js} +2 -2
  32. streamlit/static/static/js/{index.C73Hi-mL.js → index.BlcNB-sY.js} +1 -1
  33. streamlit/static/static/js/{index.BVkJfCWM.js → index.BpmrfDoR.js} +1 -1
  34. streamlit/static/static/js/{index.OWYUy0bC.js → index.BqePTNWb.js} +1 -1
  35. streamlit/static/static/js/{index.DdaoJ1WZ.js → index.Bw9RDCaH.js} +2 -2
  36. streamlit/static/static/js/{index.B11A7C7I.js → index.C-_AHUSz.js} +1 -1
  37. streamlit/static/static/js/{index.CAQGqUJ5.js → index.CEWcZMdD.js} +1 -1
  38. streamlit/static/static/js/{index.BRsob9Jp.js → index.CEj-S3PF.js} +1 -1
  39. streamlit/static/static/js/{index.Cp60C2LQ.js → index.CFtAnwvU.js} +1 -1
  40. streamlit/static/static/js/{index.C8vyFGOc.js → index.CMcCB4vg.js} +1 -1
  41. streamlit/static/static/js/{index.D7HtU_R4.js → index.CQ_wmqnz.js} +1 -1
  42. streamlit/static/static/js/{index.CUzW8sZB.js → index.CuNiy4LB.js} +1 -1
  43. streamlit/static/static/js/index.CvADzqCD.js +1 -0
  44. streamlit/static/static/js/{index.2bJmI0Ih.js → index.D94jjl7_.js} +1 -1
  45. streamlit/static/static/js/{index.D2i6l9uv.js → index.D9M0iUu5.js} +1 -1
  46. streamlit/static/static/js/{index.DsOZJLyF.js → index.DPs04g4h.js} +1 -1
  47. streamlit/static/static/js/{index.DHOnt3Rd.js → index.DWIf4xZP.js} +1 -1
  48. streamlit/static/static/js/{index.GZ99DH1Q.js → index.DYHaq5Cw.js} +22 -22
  49. streamlit/static/static/js/{index.DNKGONSt.js → index.DfCewjMv.js} +1 -1
  50. streamlit/static/static/js/{index.3k422wEU.js → index.DgwklVRJ.js} +1 -1
  51. streamlit/static/static/js/{index.D3PlNa4T.js → index.DwWMkgFE.js} +1 -1
  52. streamlit/static/static/js/{index.CIkzV9zP.js → index.JSS70wsq.js} +1 -1
  53. streamlit/static/static/js/{index.B7aeIxns.js → index.Yr32ts47.js} +1 -1
  54. streamlit/static/static/js/{index.CoJayF2l.js → index.i2uLxrqv.js} +1 -1
  55. streamlit/static/static/js/{index.BW_6EVtw.js → index.joQNIDux.js} +1 -1
  56. streamlit/static/static/js/{index.USVf5VUT.js → index.pzjWTi64.js} +1 -1
  57. streamlit/static/static/js/{index.Bkk4sBLz.js → index.zzxJWhBg.js} +1 -1
  58. streamlit/static/static/js/{input.BANuQoGH.js → input.Dbc83Str.js} +1 -1
  59. streamlit/static/static/js/{memory.DTxlMbK7.js → memory.BzHgTb9i.js} +1 -1
  60. streamlit/static/static/js/{mergeWith.CfihrnQo.js → mergeWith.BCa1_PWb.js} +1 -1
  61. streamlit/static/static/js/{number-overlay-editor.BHsEp8VL.js → number-overlay-editor.CtUWknLp.js} +1 -1
  62. streamlit/static/static/js/{possibleConstructorReturn.BErM7qST.js → possibleConstructorReturn.DGVrr2j8.js} +1 -1
  63. streamlit/static/static/js/{sandbox.BMuVLu80.js → sandbox.C20zasAf.js} +1 -1
  64. streamlit/static/static/js/{textarea.CmSZv6UE.js → textarea.BeRVLTOp.js} +1 -1
  65. streamlit/static/static/js/{timepicker.DsaAj0da.js → timepicker.DyU-jgSC.js} +1 -1
  66. streamlit/static/static/js/{toConsumableArray.DJs7oxRq.js → toConsumableArray.D4FxxWIg.js} +1 -1
  67. streamlit/static/static/js/{uniqueId.CVe3uxKs.js → uniqueId.CAAlIP1-.js} +1 -1
  68. streamlit/static/static/js/{useBasicWidgetState.D572sX2t.js → useBasicWidgetState.C207Y3_O.js} +1 -1
  69. streamlit/static/static/js/{useOnInputChange.D9rTVyjn.js → useOnInputChange.CsqRc0X0.js} +1 -1
  70. streamlit/static/static/js/{withFullScreenWrapper.4QDrgZxA.js → withFullScreenWrapper.DwHjQb3H.js} +1 -1
  71. {streamlit_nightly-1.42.1.dev20250205.dist-info → streamlit_nightly-1.42.1.dev20250208.dist-info}/METADATA +1 -1
  72. {streamlit_nightly-1.42.1.dev20250205.dist-info → streamlit_nightly-1.42.1.dev20250208.dist-info}/RECORD +76 -76
  73. streamlit/static/static/js/FileDropzone.BFkJKygp.js +0 -5
  74. streamlit/static/static/js/index.CIwUls4J.js +0 -1
  75. {streamlit_nightly-1.42.1.dev20250205.data → streamlit_nightly-1.42.1.dev20250208.data}/scripts/streamlit.cmd +0 -0
  76. {streamlit_nightly-1.42.1.dev20250205.dist-info → streamlit_nightly-1.42.1.dev20250208.dist-info}/WHEEL +0 -0
  77. {streamlit_nightly-1.42.1.dev20250205.dist-info → streamlit_nightly-1.42.1.dev20250208.dist-info}/entry_points.txt +0 -0
  78. {streamlit_nightly-1.42.1.dev20250205.dist-info → streamlit_nightly-1.42.1.dev20250208.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{r as h,E as V,_ as z,n as w,z as p,j as r,b8 as y,bp as g,co as E,bq as U,cp as L,a_ as B,F as k,R as N,aC as W,bk as T,J as u,bm as D,bl as H,bs as A,bF as R,bt as _,bc as $,bu as O}from"./index.DuqdUleB.js";import{a as S}from"./axios.upsvKRUO.js";import{F as X}from"./FormClearHelper.Bue0QSIn.js";import{S as x,I as q,b as G,c as J,d as K,C as j,e as Q,f as Y,h as Z,i as ee,g as b,F as f,j as te,k as se,l as ie,s as le,m as ae,n as re}from"./FileDropzone.BFkJKygp.js";import{S as ne,P as oe}from"./ProgressBar.B_WJAIyy.js";import{u as de}from"./Hooks.kV16_k1-.js";import{U as m}from"./UploadFileInfo.C-jY39rj.js";var C=h.forwardRef(function(l,o){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(V,z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},l,{ref:o}),h.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});C.displayName="Error";const ce=w("div",{target:"egc9vxm0"})(({theme:l})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:l.spacing.twoXS,marginBottom:l.spacing.twoXS})),pe=w("div",{target:"egc9vxm1"})(({theme:l})=>({display:"flex",alignItems:"center",justifyContent:"center",color:l.colors.fadedText40})),ue=({currentPage:l,totalPages:o,onNext:e,onPrevious:t})=>p(ce,{"data-testid":"stFileUploaderPagination",children:[r(x,{children:`Showing page ${l} of ${o}`}),p(pe,{children:[r(U,{onClick:t,kind:y.MINIMAL,children:r(g,{content:E,size:"xl"})}),r(U,{onClick:e,kind:y.MINIMAL,children:r(g,{content:L,size:"xl"})})]})]}),I=(l,o)=>Math.ceil(l.length/o),he=l=>B(({pageSize:e,items:t,resetOnAdd:s,...a})=>{const[i,n]=h.useState(0),[d,F]=h.useState(I(t,e)),c=de(t);h.useEffect(()=>{c&&c.length!==t.length&&F(I(t,e)),c&&c.length<t.length?s&&n(0):i+1>=d&&n(d-1)},[t,i,e,c,s,d]);const v=()=>{n(Math.min(i+1,d-1))},M=()=>{n(Math.max(0,i-1))},P=t.slice(i*e,i*e+e);return p(k,{children:[r(l,{items:P,...a}),t.length>e?r(ue,{pageSize:e,totalPages:d,currentPage:i+1,onNext:v,onPrevious:M}):null]})},l),ge=({fileInfo:l})=>l.status.type==="uploading"?r(oe,{value:l.status.progress,size:ne.SMALL}):l.status.type==="error"?p(ee,{children:[r(Y,{"data-testid":"stFileUploaderFileErrorMessage",children:l.status.errorMessage}),r(Z,{children:r(g,{content:C,size:"lg"})})]}):l.status.type==="uploaded"?r(x,{children:b(l.size,f.Byte)}):null,me=({fileInfo:l,onDelete:o})=>p(Q,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[r(G,{children:r(g,{content:q,size:"twoXL"})}),p(J,{className:"stFileUploaderFileData",children:[r(K,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:l.name,children:l.name}),r(ge,{fileInfo:l})]}),r("div",{"data-testid":"stFileUploaderDeleteBtn",children:r(U,{onClick:()=>o(l.id),kind:y.MINIMAL,children:r(g,{content:j,size:"lg"})})})]}),fe=({items:l,onDelete:o})=>r(ie,{children:l.map(e=>r(se,{children:r(me,{fileInfo:e,onDelete:o})},e.id))}),Fe=he(fe),ye=l=>r(te,{children:r(Fe,{...l})});class ve extends N.PureComponent{constructor(o){super(o),this.formClearHelper=new X,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const e=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:a}=this.props,i=s.getFileUploaderStateValue(t);W(e,i)||s.setFileUploaderStateValue(t,e,{fromUi:!0},a)},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:s}=this.props,{multipleFiles:a}=s;if(!a&&e.length===0&&t.length>1){const i=t.findIndex(n=>n.errors.length===1&&n.errors[0].code==="too-many-files");i>=0&&(e.push(t[i].file),t.splice(i,1))}if(this.props.uploadClient.fetchFileURLs(e).then(i=>{if(!a&&e.length>0){const n=this.state.files.find(d=>d.status.type!=="error");n&&(this.forceUpdatingStatus=!0,this.deleteFile(n.id),this.forceUpdatingStatus=!1)}T(i,e).forEach(([n,d])=>{this.uploadFile(n,d)})}).catch(i=>{this.addFiles(e.map(n=>new m(n.name,n.size,this.nextLocalFileId(),{type:"error",errorMessage:i})))}),t.length>0){const i=t.map(n=>{const{file:d}=n;return new m(d.name,d.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(n.errors[0].code,n.file)})});this.addFiles(i)}},this.uploadFile=(e,t)=>{const s=S.CancelToken.source(),a=new m(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:s,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,i=>this.onUploadProgress(i,a.id),s.token).then(()=>this.onUploadComplete(a.id,e)).catch(i=>{S.isCancel(i)||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:i?i.toString():"Unknown error"}))})},this.onUploadComplete=(e,t)=>{const s=this.getFile(e);u(s)||s.status.type!=="uploading"||this.updateFile(s.id,s.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return`File must be ${b(this.maxUploadSizeInBytes,f.Byte)} or smaller.`;case"file-invalid-type":return`${t.type} files are not allowed.`;case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},this.deleteFile=e=>{const t=this.getFile(e);u(t)||(t.status.type==="uploading"&&t.status.cancelToken.cancel(),t.status.type==="uploaded"&&t.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(t.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState(t=>({files:[...t.files,e]}))},this.addFiles=e=>{this.setState(t=>({files:[...t.files,...e]}))},this.removeFile=e=>{this.setState(t=>({files:t.files.filter(s=>s.id!==e)}))},this.getFile=e=>this.state.files.find(t=>t.id===e),this.updateFile=(e,t)=>{this.setState(s=>({files:s.files.map(a=>a.id===e?t:a)}))},this.onUploadProgress=(e,t)=>{const s=this.getFile(t);if(u(s)||s.status.type!=="uploading")return;const a=Math.round(e.loaded*100/e.total);s.status.progress!==a&&this.updateFile(t,s.setStatus({type:"uploading",cancelToken:s.status.cancelToken,progress:a}))},this.onFormCleared=()=>{this.setState({files:[]},()=>{const e=this.createWidgetValue();if(u(e))return;const{widgetMgr:t,element:s,fragmentId:a}=this.props;t.setFileUploaderStateValue(s,e,{fromUi:!0},a)})},this.state=this.initialValue}get initialValue(){const o={files:[],newestServerFileId:0},{widgetMgr:e,element:t}=this.props,s=e.getFileUploaderStateValue(t);if(u(s))return o;const{uploadedFileInfo:a}=s;return u(a)||a.length===0?o:{files:a.map(i=>{const n=i.name,d=i.size,F=i.fileId,c=i.fileUrls;return new m(n,d,this.nextLocalFileId(),{type:"uploaded",fileId:F,fileUrls:c})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const o=this.props.element.maxUploadSizeMb;return le(o,f.Megabyte,f.Byte)}get status(){const o=e=>e.status.type==="uploading";return this.state.files.some(o)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const o=this.createWidgetValue(),{element:e,widgetMgr:t,fragmentId:s}=this.props;t.getFileUploaderStateValue(e)===void 0&&t.setFileUploaderStateValue(e,o,{fromUi:!1},s)}createWidgetValue(){const o=this.state.files.filter(e=>e.status.type==="uploaded").map(e=>{const{name:t,size:s,status:a}=e,{fileId:i,fileUrls:n}=a;return new D({fileId:i,fileUrls:n,name:t,size:s})});return new H({uploadedFileInfo:o})}render(){var d;const{files:o}=this.state,{element:e,disabled:t,widgetMgr:s,width:a}=this.props,i=e.type;this.formClearHelper.manageFormClearListener(s,e.formId,this.onFormCleared);const n=o.slice().reverse();return p(re,{className:"stFileUploader","data-testid":"stFileUploader",width:a,children:[r(O,{label:e.label,disabled:t,labelVisibility:A((d=e.labelVisibility)==null?void 0:d.value),children:e.help&&r(R,{children:r(_,{content:e.help,placement:$.TOP_RIGHT})})}),r(ae,{onDrop:this.dropHandler,multiple:e.multipleFiles,acceptedExtensions:i,maxSizeBytes:this.maxUploadSizeInBytes,label:e.label,disabled:t}),n.length>0&&r(ye,{items:n,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}export{ve as default};
1
+ import{r as h,E as V,_ as z,n as w,z as p,j as r,b8 as y,bp as g,co as E,bq as U,cp as L,a_ as B,F as k,R as N,aC as W,bk as T,K as u,bm as D,bl as H,bs as A,bF as R,bt as _,bc as $,bu as O}from"./index.9wBA4A4f.js";import{a as S}from"./axios.upsvKRUO.js";import{F as X}from"./FormClearHelper.BBpErIGP.js";import{S as x,I as q,b as K,c as G,d as j,C as J,e as Q,f as Y,h as Z,i as ee,g as b,F as f,j as te,k as se,l as ie,s as le,m as ae,n as re}from"./FileDropzone.Cd515bsy.js";import{S as ne,P as oe}from"./ProgressBar.J2QhvKtD.js";import{u as de}from"./Hooks.CeSTXIj2.js";import{U as m}from"./UploadFileInfo.C-jY39rj.js";var C=h.forwardRef(function(l,o){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(V,z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},l,{ref:o}),h.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});C.displayName="Error";const ce=w("div",{target:"egc9vxm0"})(({theme:l})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:l.spacing.twoXS,marginBottom:l.spacing.twoXS})),pe=w("div",{target:"egc9vxm1"})(({theme:l})=>({display:"flex",alignItems:"center",justifyContent:"center",color:l.colors.fadedText40})),ue=({currentPage:l,totalPages:o,onNext:e,onPrevious:t})=>p(ce,{"data-testid":"stFileUploaderPagination",children:[r(x,{children:`Showing page ${l} of ${o}`}),p(pe,{children:[r(U,{onClick:t,kind:y.MINIMAL,children:r(g,{content:E,size:"xl"})}),r(U,{onClick:e,kind:y.MINIMAL,children:r(g,{content:L,size:"xl"})})]})]}),I=(l,o)=>Math.ceil(l.length/o),he=l=>B(({pageSize:e,items:t,resetOnAdd:s,...a})=>{const[i,n]=h.useState(0),[d,F]=h.useState(I(t,e)),c=de(t);h.useEffect(()=>{c&&c.length!==t.length&&F(I(t,e)),c&&c.length<t.length?s&&n(0):i+1>=d&&n(d-1)},[t,i,e,c,s,d]);const v=()=>{n(Math.min(i+1,d-1))},M=()=>{n(Math.max(0,i-1))},P=t.slice(i*e,i*e+e);return p(k,{children:[r(l,{items:P,...a}),t.length>e?r(ue,{pageSize:e,totalPages:d,currentPage:i+1,onNext:v,onPrevious:M}):null]})},l),ge=({fileInfo:l})=>l.status.type==="uploading"?r(oe,{value:l.status.progress,size:ne.SMALL}):l.status.type==="error"?p(ee,{children:[r(Y,{"data-testid":"stFileUploaderFileErrorMessage",children:l.status.errorMessage}),r(Z,{children:r(g,{content:C,size:"lg"})})]}):l.status.type==="uploaded"?r(x,{children:b(l.size,f.Byte)}):null,me=({fileInfo:l,onDelete:o})=>p(Q,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[r(K,{children:r(g,{content:q,size:"twoXL"})}),p(G,{className:"stFileUploaderFileData",children:[r(j,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:l.name,children:l.name}),r(ge,{fileInfo:l})]}),r("div",{"data-testid":"stFileUploaderDeleteBtn",children:r(U,{onClick:()=>o(l.id),kind:y.MINIMAL,children:r(g,{content:J,size:"lg"})})})]}),fe=({items:l,onDelete:o})=>r(ie,{children:l.map(e=>r(se,{children:r(me,{fileInfo:e,onDelete:o})},e.id))}),Fe=he(fe),ye=l=>r(te,{children:r(Fe,{...l})});class ve extends N.PureComponent{constructor(o){super(o),this.formClearHelper=new X,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const e=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:a}=this.props,i=s.getFileUploaderStateValue(t);W(e,i)||s.setFileUploaderStateValue(t,e,{fromUi:!0},a)},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:s}=this.props,{multipleFiles:a}=s;if(!a&&e.length===0&&t.length>1){const i=t.findIndex(n=>n.errors.length===1&&n.errors[0].code==="too-many-files");i>=0&&(e.push(t[i].file),t.splice(i,1))}if(this.props.uploadClient.fetchFileURLs(e).then(i=>{if(!a&&e.length>0){const n=this.state.files.find(d=>d.status.type!=="error");n&&(this.forceUpdatingStatus=!0,this.deleteFile(n.id),this.forceUpdatingStatus=!1)}T(i,e).forEach(([n,d])=>{this.uploadFile(n,d)})}).catch(i=>{this.addFiles(e.map(n=>new m(n.name,n.size,this.nextLocalFileId(),{type:"error",errorMessage:i})))}),t.length>0){const i=t.map(n=>{const{file:d}=n;return new m(d.name,d.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(n.errors[0].code,n.file)})});this.addFiles(i)}},this.uploadFile=(e,t)=>{const s=S.CancelToken.source(),a=new m(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:s,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,i=>this.onUploadProgress(i,a.id),s.token).then(()=>this.onUploadComplete(a.id,e)).catch(i=>{S.isCancel(i)||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:i?i.toString():"Unknown error"}))})},this.onUploadComplete=(e,t)=>{const s=this.getFile(e);u(s)||s.status.type!=="uploading"||this.updateFile(s.id,s.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return`File must be ${b(this.maxUploadSizeInBytes,f.Byte)} or smaller.`;case"file-invalid-type":return`${t.type} files are not allowed.`;case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},this.deleteFile=e=>{const t=this.getFile(e);u(t)||(t.status.type==="uploading"&&t.status.cancelToken.cancel(),t.status.type==="uploaded"&&t.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(t.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState(t=>({files:[...t.files,e]}))},this.addFiles=e=>{this.setState(t=>({files:[...t.files,...e]}))},this.removeFile=e=>{this.setState(t=>({files:t.files.filter(s=>s.id!==e)}))},this.getFile=e=>this.state.files.find(t=>t.id===e),this.updateFile=(e,t)=>{this.setState(s=>({files:s.files.map(a=>a.id===e?t:a)}))},this.onUploadProgress=(e,t)=>{const s=this.getFile(t);if(u(s)||s.status.type!=="uploading")return;const a=Math.round(e.loaded*100/e.total);s.status.progress!==a&&this.updateFile(t,s.setStatus({type:"uploading",cancelToken:s.status.cancelToken,progress:a}))},this.onFormCleared=()=>{this.setState({files:[]},()=>{const e=this.createWidgetValue();if(u(e))return;const{widgetMgr:t,element:s,fragmentId:a}=this.props;t.setFileUploaderStateValue(s,e,{fromUi:!0},a)})},this.state=this.initialValue}get initialValue(){const o={files:[],newestServerFileId:0},{widgetMgr:e,element:t}=this.props,s=e.getFileUploaderStateValue(t);if(u(s))return o;const{uploadedFileInfo:a}=s;return u(a)||a.length===0?o:{files:a.map(i=>{const n=i.name,d=i.size,F=i.fileId,c=i.fileUrls;return new m(n,d,this.nextLocalFileId(),{type:"uploaded",fileId:F,fileUrls:c})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const o=this.props.element.maxUploadSizeMb;return le(o,f.Megabyte,f.Byte)}get status(){const o=e=>e.status.type==="uploading";return this.state.files.some(o)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const o=this.createWidgetValue(),{element:e,widgetMgr:t,fragmentId:s}=this.props;t.getFileUploaderStateValue(e)===void 0&&t.setFileUploaderStateValue(e,o,{fromUi:!1},s)}createWidgetValue(){const o=this.state.files.filter(e=>e.status.type==="uploaded").map(e=>{const{name:t,size:s,status:a}=e,{fileId:i,fileUrls:n}=a;return new D({fileId:i,fileUrls:n,name:t,size:s})});return new H({uploadedFileInfo:o})}render(){var d;const{files:o}=this.state,{element:e,disabled:t,widgetMgr:s,width:a}=this.props,i=e.type;this.formClearHelper.manageFormClearListener(s,e.formId,this.onFormCleared);const n=o.slice().reverse();return p(re,{className:"stFileUploader","data-testid":"stFileUploader",width:a,children:[r(O,{label:e.label,disabled:t,labelVisibility:A((d=e.labelVisibility)==null?void 0:d.value),children:e.help&&r(R,{children:r(_,{content:e.help,placement:$.TOP_RIGHT})})}),r(ae,{onDrop:this.dropHandler,multiple:e.multipleFiles,acceptedExtensions:i,maxSizeBytes:this.maxUploadSizeInBytes,label:e.label,disabled:t}),n.length>0&&r(ye,{items:n,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}export{ve as default};
@@ -1 +1 @@
1
- import{n as s,R as u,aF as b,bb as k,y as C,j as n,b9 as v,bc as L,z as y,D as T,aE as w}from"./index.DuqdUleB.js";const S=s("div",{target:"e1xmaixs0"})({display:"flex",flexDirection:"column"}),h=s("a",{target:"e1xmaixs1"})(({disabled:a,isCurrentPage:o,fluidWidth:l,theme:e})=>({textDecoration:"none",width:typeof l=="number"?`${l}px`:"fit-content",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:e.spacing.sm,borderRadius:e.radii.default,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,marginTop:e.spacing.threeXS,marginBottom:e.spacing.threeXS,lineHeight:e.lineHeights.menuItem,backgroundColor:o?e.colors.darkenedBgMix15:"transparent","&:hover":{backgroundColor:o?e.colors.darkenedBgMix25:e.colors.darkenedBgMix15},"&:active,&:visited,&:hover":{textDecoration:"none"},"&:focus":{outline:"none"},"&:focus-visible":{backgroundColor:e.colors.darkenedBgMix15},"@media print":{paddingLeft:e.spacing.none},...a?{borderColor:e.colors.borderColor,backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:"not-allowed","&:hover":{color:e.colors.fadedText40,backgroundColor:e.colors.transparent}}:{}})),D=s("span",{target:"e1xmaixs2"})(({disabled:a,theme:o})=>({color:o.colors.bodyText,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:"table-cell",...a?{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}:{}}));function P(a,o){return a===null&&o?!0:a===null&&!o?!1:a===!0}function H(a){const{onPageChange:o,currentPageScriptHash:l}=u.useContext(b),e=u.useContext(k),{colors:i}=C(),{disabled:t,element:r,width:c}=a,p={width:c},f=P(r.useContainerWidth,e),d=l===r.pageScriptHash,x=g=>{r.external?t&&g.preventDefault():(g.preventDefault(),t||o(r.pageScriptHash))};return n("div",{className:"stPageLink","data-testid":"stPageLink",style:p,children:n(v,{help:r.help,placement:L.TOP_RIGHT,children:n(S,{children:y(h,{"data-testid":"stPageLink-NavLink",disabled:t,isCurrentPage:d,fluidWidth:f?c:!1,href:r.page,target:r.external?"_blank":"",rel:"noreferrer",onClick:x,children:[r.icon&&n(T,{size:"lg",color:t?i.fadedText40:i.bodyText,iconValue:r.icon}),n(D,{disabled:t,children:n(w,{source:r.label,allowHTML:!1,isLabel:!0,boldLabel:d,largerLabel:!0,disableLinks:!0})})]})})})})}export{H as default};
1
+ import{n as s,R as u,aF as b,bb as k,y as C,j as n,b9 as v,bc as L,z as y,D as T,aE as w}from"./index.9wBA4A4f.js";const S=s("div",{target:"e1xmaixs0"})({display:"flex",flexDirection:"column"}),h=s("a",{target:"e1xmaixs1"})(({disabled:a,isCurrentPage:o,fluidWidth:l,theme:e})=>({textDecoration:"none",width:typeof l=="number"?`${l}px`:"fit-content",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:e.spacing.sm,borderRadius:e.radii.default,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,marginTop:e.spacing.threeXS,marginBottom:e.spacing.threeXS,lineHeight:e.lineHeights.menuItem,backgroundColor:o?e.colors.darkenedBgMix15:"transparent","&:hover":{backgroundColor:o?e.colors.darkenedBgMix25:e.colors.darkenedBgMix15},"&:active,&:visited,&:hover":{textDecoration:"none"},"&:focus":{outline:"none"},"&:focus-visible":{backgroundColor:e.colors.darkenedBgMix15},"@media print":{paddingLeft:e.spacing.none},...a?{borderColor:e.colors.borderColor,backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:"not-allowed","&:hover":{color:e.colors.fadedText40,backgroundColor:e.colors.transparent}}:{}})),D=s("span",{target:"e1xmaixs2"})(({disabled:a,theme:o})=>({color:o.colors.bodyText,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:"table-cell",...a?{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}:{}}));function P(a,o){return a===null&&o?!0:a===null&&!o?!1:a===!0}function H(a){const{onPageChange:o,currentPageScriptHash:l}=u.useContext(b),e=u.useContext(k),{colors:i}=C(),{disabled:t,element:r,width:c}=a,p={width:c},f=P(r.useContainerWidth,e),d=l===r.pageScriptHash,x=g=>{r.external?t&&g.preventDefault():(g.preventDefault(),t||o(r.pageScriptHash))};return n("div",{className:"stPageLink","data-testid":"stPageLink",style:p,children:n(v,{help:r.help,placement:L.TOP_RIGHT,children:n(S,{children:y(h,{"data-testid":"stPageLink-NavLink",disabled:t,isCurrentPage:d,fluidWidth:f?c:!1,href:r.page,target:r.external?"_blank":"",rel:"noreferrer",onClick:x,children:[r.icon&&n(T,{size:"lg",color:t?i.fadedText40:i.bodyText,iconValue:r.icon}),n(D,{disabled:t,children:n(w,{source:r.label,allowHTML:!1,isLabel:!0,boldLabel:d,largerLabel:!0,disableLinks:!0})})]})})})})}export{H as default};
@@ -1 +1 @@
1
- import{n as U,r as s,bj as V,j as l}from"./index.DuqdUleB.js";const P=U("iframe",{target:"eymnmwl0"})(({theme:a})=>({colorScheme:"normal",border:"none",padding:a.spacing.none,margin:a.spacing.none,width:"100%",aspectRatio:"16 / 9"})),R=528;function w({element:a,width:f,endpoints:m,elementMgr:c}){const i=s.useRef(null),{type:E,url:p,startTime:n,subtitles:y,endTime:d,loop:u,autoplay:T,muted:h}=a,S=s.useMemo(()=>{if(!a.id)return!0;const e=c.getElementState(a.id,"preventAutoplay");return e||c.setElementState(a.id,"preventAutoplay",!0),e??!1},[a.id,c]);s.useEffect(()=>{i.current&&(i.current.currentTime=n)},[n]),s.useEffect(()=>{const e=i.current,t=()=>{e&&(e.currentTime=a.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[a]),s.useEffect(()=>{const e=i.current;if(!e)return;let t=!1;const o=()=>{d>0&&e.currentTime>=d&&(u?(e.currentTime=n||0,e.play()):t||(t=!0,e.pause()))};return d>0&&e.addEventListener("timeupdate",o),()=>{e&&d>0&&e.removeEventListener("timeupdate",o)}},[d,u,n]),s.useEffect(()=>{const e=i.current;if(!e)return;const t=()=>{u&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[u,n]);const g=e=>{const{startTime:t,endTime:o,loop:L,autoplay:N,muted:b}=a,r=new URL(e);if(t&&!isNaN(t)&&r.searchParams.append("start",t.toString()),o&&!isNaN(o)&&r.searchParams.append("end",o.toString()),L){r.searchParams.append("loop","1");const v=r.pathname.split("/").pop();v&&r.searchParams.append("playlist",v)}return N&&r.searchParams.append("autoplay","1"),b&&r.searchParams.append("mute","1"),r.toString()};return E===V.Type.YOUTUBE_IFRAME?l(P,{className:"stVideo","data-testid":"stVideo",title:p,src:g(p),allow:"autoplay; encrypted-media",allowFullScreen:!0}):l("video",{className:"stVideo","data-testid":"stVideo",ref:i,controls:!0,muted:h,autoPlay:T&&!S,src:m.buildMediaURL(p),style:{width:f,height:f===0?R:void 0},crossOrigin:void 0,children:y&&y.map((e,t)=>l("track",{kind:"captions",src:m.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0},t))})}export{w as default};
1
+ import{n as U,r as s,bj as V,j as l}from"./index.9wBA4A4f.js";const P=U("iframe",{target:"eymnmwl0"})(({theme:a})=>({colorScheme:"normal",border:"none",padding:a.spacing.none,margin:a.spacing.none,width:"100%",aspectRatio:"16 / 9"})),R=528;function w({element:a,width:f,endpoints:m,elementMgr:c}){const i=s.useRef(null),{type:E,url:p,startTime:n,subtitles:y,endTime:d,loop:u,autoplay:T,muted:h}=a,S=s.useMemo(()=>{if(!a.id)return!0;const e=c.getElementState(a.id,"preventAutoplay");return e||c.setElementState(a.id,"preventAutoplay",!0),e??!1},[a.id,c]);s.useEffect(()=>{i.current&&(i.current.currentTime=n)},[n]),s.useEffect(()=>{const e=i.current,t=()=>{e&&(e.currentTime=a.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[a]),s.useEffect(()=>{const e=i.current;if(!e)return;let t=!1;const o=()=>{d>0&&e.currentTime>=d&&(u?(e.currentTime=n||0,e.play()):t||(t=!0,e.pause()))};return d>0&&e.addEventListener("timeupdate",o),()=>{e&&d>0&&e.removeEventListener("timeupdate",o)}},[d,u,n]),s.useEffect(()=>{const e=i.current;if(!e)return;const t=()=>{u&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[u,n]);const g=e=>{const{startTime:t,endTime:o,loop:L,autoplay:N,muted:b}=a,r=new URL(e);if(t&&!isNaN(t)&&r.searchParams.append("start",t.toString()),o&&!isNaN(o)&&r.searchParams.append("end",o.toString()),L){r.searchParams.append("loop","1");const v=r.pathname.split("/").pop();v&&r.searchParams.append("playlist",v)}return N&&r.searchParams.append("autoplay","1"),b&&r.searchParams.append("mute","1"),r.toString()};return E===V.Type.YOUTUBE_IFRAME?l(P,{className:"stVideo","data-testid":"stVideo",title:p,src:g(p),allow:"autoplay; encrypted-media",allowFullScreen:!0}):l("video",{className:"stVideo","data-testid":"stVideo",ref:i,controls:!0,muted:h,autoPlay:T&&!S,src:m.buildMediaURL(p),style:{width:f,height:f===0?R:void 0},crossOrigin:void 0,children:y&&y.map((e,t)=>l("track",{kind:"captions",src:m.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0},t))})}export{w as default};